Skip to content

Commit 01fbfc1

Browse files
v1.0.0 ci: update workflows config. b2d6c8e
0 parents  commit 01fbfc1

8 files changed

Lines changed: 181 additions & 0 deletions

File tree

.nojekyll

Whitespace-only changes.

CONTRIBUTORS.svg

Lines changed: 12 additions & 0 deletions
Loading

index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { Hr } from './react-hr';
2+
export type { HrProps, HrVariant } from './react-hr';
3+
//# sourceMappingURL=index.d.ts.map

index.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react-hr.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),k="#d0d0d5",f="#a2a9b6",w="1.25rem",p=(n,e)=>typeof n=="number"?`${n}px`:n??e,y=n=>`url("data:image/svg+xml,${encodeURIComponent(n)}")`,j=n=>y(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="8" viewBox="0 0 16 8"><path d="M0 4 Q4 0 8 4 T16 4" fill="none" stroke="${n}" stroke-width="1.4"/></svg>`),T=(n,e)=>[...(e?["calc(50% - 24px)","50%","calc(50% + 24px)"]:["50%"]).map(r=>`linear-gradient(45deg, transparent calc(50% - 5px), ${n} calc(50% - 5px) calc(50% + 5px), transparent calc(50% + 5px)) ${r} 50% / 12px 12px no-repeat`),`linear-gradient(${n}, ${n}) center / 100% 1px no-repeat`].join(", "),S=(n,e)=>[...(e?["calc(50% - 24px)","50%","calc(50% + 24px)"]:["50%"]).map(r=>`radial-gradient(circle at center, ${n} 0 6px, transparent 6.5px) ${r} 50% / 14px 14px no-repeat`),`linear-gradient(${n}, ${n}) center / 100% 1px no-repeat`].join(", ");function B({variant:n="solid",color:e=k,accentColor:t=f,content:r,multiple:d,dashedFilled:l,dashedOpen:h,margin:b,style:i,...s}){const g=p(b,w),x=p(l,"4px"),u=p(h,"6px"),c={boxSizing:"border-box",border:0,margin:`${g} 0`},$={solid:{borderTop:`1px solid ${e}`},dotted:{borderTop:`1px dotted ${t}`},dotted2:{borderTop:`2px dotted ${t}`},dashed:{borderTop:`1px dashed ${t}`},dashed2:{borderTop:`2px dashed ${t}`},double:{borderTop:`3px double ${e}`},"dashed-fixed":{height:1,background:`repeating-linear-gradient(to right, ${t} 0 ${x}, transparent 0 calc(${x} + ${u}))`},"edge-weak":{height:1,background:`linear-gradient(to right, transparent, ${e}, transparent)`},twill:{height:6,background:`repeating-linear-gradient(135deg, ${t} 0px, ${t} 1px, transparent 1px, transparent 6px)`},"twill-colorful":{height:6,background:"linear-gradient(135deg, red, orange, green, blue, purple)",WebkitMaskImage:"repeating-linear-gradient(135deg, #000 0px, #000 1px, transparent 1px, transparent 6px)",maskImage:"repeating-linear-gradient(135deg, #000 0px, #000 1px, transparent 1px, transparent 6px)"},wavy:{height:8,backgroundImage:j(e),backgroundRepeat:"repeat-x",backgroundPosition:"center",backgroundSize:"16px 8px"},shadow:{borderTop:"1px solid rgb(0 0 0 / 10%)",boxShadow:`inset 0 10px 10px -10px ${e}`,paddingTop:10},"mid-circle":{height:14,background:S(e,d)},"mid-square":{height:16,background:T(e,d)},"space-square":{height:16,background:[`linear-gradient(45deg, transparent calc(50% - 5px), ${e} calc(50% - 5px) calc(50% + 5px), transparent calc(50% + 5px)) left 50% / 12px 12px no-repeat`,`linear-gradient(45deg, transparent calc(50% - 5px), ${e} calc(50% - 5px) calc(50% + 5px), transparent calc(50% + 5px)) right 50% / 12px 12px no-repeat`,`linear-gradient(${e}, ${e}) center / calc(100% - 32px) 1px no-repeat`].join(", ")},"double-arrow":{height:10,marginLeft:20,marginRight:20,background:[`linear-gradient(45deg, transparent 0 5px, ${e} 5px 7px, transparent 7px) left center / 12px 12px no-repeat`,`linear-gradient(225deg, transparent 0 5px, ${e} 5px 7px, transparent 7px) right center / 12px 12px no-repeat`,`linear-gradient(${e}, ${e}) center calc(50% - 2px) / 100% 1px no-repeat`,`linear-gradient(${e}, ${e}) center calc(50% + 2px) / 100% 1px no-repeat`].join(", ")},"solid-content":{},"dashed-content":{},"fade-content":{},"mid-border-content":{}};if(n.endsWith("content")){const o={...c,flex:1,margin:0,borderTop:n==="dashed-content"?`1px dashed ${e}`:n==="fade-content"?0:`1px solid ${e}`,height:n==="fade-content"?1:void 0,background:n==="fade-content"?`linear-gradient(to right, transparent, ${e}, transparent)`:void 0,...i},m={color:n==="mid-border-content"?"transparent":t,border:n==="mid-border-content"?`1px solid ${e}`:void 0,padding:n==="mid-border-content"?"4px 1ch":"0 1ch",fontSize:12,lineHeight:"1.2",whiteSpace:"nowrap"};return a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:0,margin:`${g} 0`,width:"100%"},children:[a.jsx("hr",{...s,style:o}),a.jsx("span",{"aria-hidden":"true",style:m,children:r}),a.jsx("hr",{"aria-hidden":"true",style:o})]})}return a.jsx("hr",{...s,style:{...c,...$[n],...i}})}exports.Hr=B;

react-hr.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { HTMLAttributes } from 'react';
2+
export type HrVariant = 'solid' | 'dotted' | 'dotted2' | 'dashed' | 'dashed2' | 'double' | 'dashed-fixed' | 'edge-weak' | 'twill' | 'twill-colorful' | 'wavy' | 'shadow' | 'mid-circle' | 'mid-square' | 'space-square' | 'double-arrow' | 'solid-content' | 'dashed-content' | 'fade-content' | 'mid-border-content';
3+
export interface HrProps extends Omit<HTMLAttributes<HTMLHRElement>, 'children' | 'color'> {
4+
variant?: HrVariant;
5+
color?: string;
6+
accentColor?: string;
7+
content?: string;
8+
multiple?: boolean;
9+
dashedFilled?: number | string;
10+
dashedOpen?: number | string;
11+
margin?: number | string;
12+
}
13+
export declare function Hr({ variant, color, accentColor, content, multiple, dashedFilled, dashedOpen, margin, style, ...rest }: HrProps): import("react/jsx-runtime").JSX.Element;
14+
//# sourceMappingURL=react-hr.d.ts.map

react-hr.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)