blunt-ui 0.3.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -25
- package/dist/components/Badge/Badge.types.d.ts +4 -4
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/{Badge.stories.d.ts → stories/Badge.stories.d.ts} +1 -1
- package/dist/components/Button/Button.types.d.ts +4 -4
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/{Button.stories.d.ts → stories/Button.stories.d.ts} +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +5 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +11 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/stories/Checkbox.stories.d.ts +11 -0
- package/dist/components/CollapsibleCard/{CollapsibleCard.stories.d.ts → stories/CollapsibleCard.stories.d.ts} +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.hooks.d.ts +2 -0
- package/dist/components/ConfirmDialog/{useConfirm.d.ts → ConfirmDialog.provider.d.ts} +2 -2
- package/dist/components/ConfirmDialog/ConfirmDialog.types.d.ts +14 -2
- package/dist/components/ConfirmDialog/index.d.ts +4 -3
- package/dist/components/ConfirmDialog/{ConfirmDialog.stories.d.ts → stories/ConfirmDialog.stories.d.ts} +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.types.d.ts +14 -6
- package/dist/components/DatePicker/index.d.ts +2 -1
- package/dist/components/DatePicker/{DatePicker.stories.d.ts → stories/DatePicker.stories.d.ts} +2 -1
- package/dist/components/Editable/{Editable.stories.d.ts → stories/Editable.stories.d.ts} +1 -1
- package/dist/components/Field/{Field.stories.d.ts → stories/Field.stories.d.ts} +1 -1
- package/dist/components/Form/{useForm.d.ts → Form.hooks.d.ts} +1 -1
- package/dist/components/Form/Form.types.d.ts +19 -7
- package/dist/components/Form/{FormField.d.ts → FormField/FormField.d.ts} +1 -1
- package/dist/components/Form/FormField/FormField.types.d.ts +8 -0
- package/dist/components/Form/FormField/index.d.ts +2 -0
- package/dist/components/Form/index.d.ts +4 -3
- package/dist/components/Form/{Form.stories.d.ts → stories/Form.stories.d.ts} +1 -1
- package/dist/components/Form/tests/Form.validators.test.d.ts +1 -0
- package/dist/components/Form/validators/Form.validators.d.ts +9 -0
- package/dist/components/Input/Input.types.d.ts +6 -6
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Input/{Input.stories.d.ts → stories/Input.stories.d.ts} +1 -1
- package/dist/components/Link/Link.types.d.ts +2 -2
- package/dist/components/Link/index.d.ts +2 -1
- package/dist/components/Link/{Link.stories.d.ts → stories/Link.stories.d.ts} +1 -1
- package/dist/components/Link/tests/Link.test.d.ts +0 -0
- package/dist/components/Modal/Modal.types.d.ts +2 -2
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/{Modal.stories.d.ts → stories/Modal.stories.d.ts} +1 -1
- package/dist/components/Modal/tests/Modal.test.d.ts +0 -0
- package/dist/components/Radio/Radio.d.ts +5 -0
- package/dist/components/Radio/Radio.types.d.ts +10 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/stories/Radio.stories.d.ts +10 -0
- package/dist/components/Radio/tests/Radio.test.d.ts +0 -0
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.types.d.ts +15 -6
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/{Select.stories.d.ts → stories/Select.stories.d.ts} +1 -1
- package/dist/components/Select/tests/Select.test.d.ts +0 -0
- package/dist/components/Spinner/Spinner.types.d.ts +4 -4
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/Spinner/{Spinner.stories.d.ts → stories/Spinner.stories.d.ts} +1 -1
- package/dist/components/Spinner/tests/Spinner.test.d.ts +0 -0
- package/dist/components/Switch/Switch.d.ts +5 -0
- package/dist/components/Switch/Switch.types.d.ts +8 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/stories/Switch.stories.d.ts +9 -0
- package/dist/components/Switch/tests/Switch.test.d.ts +0 -0
- package/dist/components/Table/Table.consts.d.ts +3 -0
- package/dist/components/Table/Table.hooks.d.ts +29 -0
- package/dist/components/Table/Table.types.d.ts +12 -2
- package/dist/components/Table/index.d.ts +2 -3
- package/dist/components/Table/{Table.stories.d.ts → stories/Table.stories.d.ts} +1 -1
- package/dist/components/Table/tests/Table.test.d.ts +0 -0
- package/dist/components/Textarea/Textarea.types.d.ts +4 -4
- package/dist/components/Textarea/index.d.ts +1 -1
- package/dist/components/Textarea/{Textarea.stories.d.ts → stories/Textarea.stories.d.ts} +1 -1
- package/dist/components/Textarea/tests/Textarea.test.d.ts +0 -0
- package/dist/components/Toast/Toast.hooks.d.ts +2 -0
- package/dist/components/Toast/{useToast.d.ts → Toast.provider.d.ts} +2 -2
- package/dist/components/Toast/Toast.types.d.ts +18 -2
- package/dist/components/Toast/index.d.ts +4 -3
- package/dist/components/Toast/{Toast.stories.d.ts → stories/Toast.stories.d.ts} +1 -1
- package/dist/components/Toast/tests/Toast.provider.test.d.ts +0 -0
- package/dist/components/Toast/tests/Toast.test.d.ts +0 -0
- package/dist/index.cjs +495 -186
- package/dist/index.d.ts +19 -13
- package/dist/index.js +1996 -1119
- package/dist/themes/types.d.ts +9 -0
- package/package.json +2 -2
- package/dist/components/ConfirmDialog/useConfirm.types.d.ts +0 -14
- package/dist/components/Form/useForm.types.d.ts +0 -20
- package/dist/components/Table/useTable.d.ts +0 -12
- package/dist/components/Table/useTablePagination.d.ts +0 -16
- package/dist/components/Table/useTableSort.d.ts +0 -13
- package/dist/components/Toast/useToast.types.d.ts +0 -17
- /package/dist/components/{Button/Button.test.d.ts → Badge/tests/Badge.test.d.ts} +0 -0
- /package/dist/components/{CollapsibleCard/CollapsibleCard.test.d.ts → Button/tests/Button.test.d.ts} +0 -0
- /package/dist/components/{ConfirmDialog/ConfirmDialog.test.d.ts → Checkbox/tests/Checkbox.test.d.ts} +0 -0
- /package/dist/components/{ConfirmDialog/useConfirm.test.d.ts → CollapsibleCard/tests/CollapsibleCard.test.d.ts} +0 -0
- /package/dist/components/{DatePicker/DatePicker.test.d.ts → ConfirmDialog/tests/ConfirmDialog.provider.test.d.ts} +0 -0
- /package/dist/components/{Form/Form.test.d.ts → ConfirmDialog/tests/ConfirmDialog.test.d.ts} +0 -0
- /package/dist/components/{Input/Input.test.d.ts → DatePicker/tests/DatePicker.test.d.ts} +0 -0
- /package/dist/components/{Modal/Modal.test.d.ts → Editable/tests/Editable.test.d.ts} +0 -0
- /package/dist/components/{Select/Select.test.d.ts → Field/tests/Field.test.d.ts} +0 -0
- /package/dist/components/Form/{useForm.test.d.ts → tests/Form.hooks.test.d.ts} +0 -0
- /package/dist/components/{Toast/Toast.test.d.ts → Form/tests/Form.test.d.ts} +0 -0
- /package/dist/components/{Toast/useToast.test.d.ts → Input/tests/Input.test.d.ts} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("styled-components"),a=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("styled-components"),a=require("react"),co=require("react-dom"),Q=(o,r,n)=>s.css`
|
|
2
2
|
background: ${r};
|
|
3
3
|
color: ${n};
|
|
4
4
|
border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
|
|
5
5
|
box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
|
|
6
|
-
`,
|
|
6
|
+
`,fr=s.span`
|
|
7
7
|
display: inline-flex;
|
|
8
8
|
align-items: center;
|
|
9
|
-
font-weight:
|
|
9
|
+
font-weight: ${({theme:o})=>o.fontWeights.bold};
|
|
10
10
|
letter-spacing: 0.04em;
|
|
11
11
|
cursor: default;
|
|
12
12
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
max-width: 20ch;
|
|
17
17
|
|
|
18
18
|
${({$size:o,theme:r})=>({sm:s.css`
|
|
19
|
-
padding:
|
|
19
|
+
padding: ${r.spacing[.5]} ${r.spacing[2]};
|
|
20
20
|
font-size: ${r.fontSizes.xs};
|
|
21
21
|
`,md:s.css`
|
|
22
|
-
padding:
|
|
22
|
+
padding: ${r.spacing[1]} ${r.spacing[3]};
|
|
23
23
|
font-size: ${r.fontSizes.sm};
|
|
24
24
|
`})[o]}
|
|
25
25
|
|
|
26
|
-
${({$variant:o,theme:r})=>r.brutalism?{primary:
|
|
26
|
+
${({$variant:o,theme:r})=>r.brutalism?{primary:Q(r,r.colors.primary[500],r.colors.primary.contrast),neutral:Q(r,r.colors.neutral[200],r.colors.neutral[900]),success:Q(r,r.colors.success[50],r.colors.success[500]),error:Q(r,r.colors.error[50],r.colors.error[500]),warning:Q(r,r.colors.warning[50],r.colors.warning[500]),info:Q(r,r.colors.info[50],r.colors.info[500])}[o]:{primary:s.css`
|
|
27
27
|
background: ${r.colors.primary[50]};
|
|
28
28
|
color: ${r.colors.primary[500]};
|
|
29
29
|
`,neutral:s.css`
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
background: ${r.colors.info[50]};
|
|
43
43
|
color: ${r.colors.info[500]};
|
|
44
44
|
`}[o]}
|
|
45
|
-
`;function
|
|
45
|
+
`;function No({variant:o="primary",size:r="md",children:n,...e}){return t.jsx(fr,{$variant:o,$size:r,...e,children:n})}No.displayName="Badge";const $o=(o,r,n)=>s.css`
|
|
46
46
|
background-color: ${r};
|
|
47
47
|
color: ${n};
|
|
48
48
|
border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
transform: translate(2px, 2px);
|
|
56
56
|
box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
|
|
57
57
|
}
|
|
58
|
-
`,
|
|
58
|
+
`,pr=s.button`
|
|
59
59
|
display: inline-flex;
|
|
60
60
|
align-items: center;
|
|
61
61
|
justify-content: center;
|
|
62
62
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
63
|
-
font-weight:
|
|
63
|
+
font-weight: ${({theme:o})=>o.fontWeights.semibold};
|
|
64
64
|
cursor: pointer;
|
|
65
65
|
text-decoration: none;
|
|
66
66
|
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
cursor: not-allowed;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
${({$variant:o,theme:r})=>r.brutalism?{primary
|
|
77
|
+
${({$variant:o,theme:r})=>r.brutalism?{primary:$o(r,r.colors.primary[500],r.colors.primary.contrast),secondary:$o(r,r.colors.neutral[100],r.colors.neutral[900]),outline:$o(r,r.colors.neutral[0],r.colors.neutral[900])}[o]:{primary:s.css`
|
|
78
78
|
background-color: ${r.colors.primary[500]};
|
|
79
79
|
color: ${r.colors.neutral[0]};
|
|
80
80
|
border: none;
|
|
@@ -107,18 +107,18 @@
|
|
|
107
107
|
padding: ${r.spacing[3]} ${r.spacing[6]};
|
|
108
108
|
font-size: ${r.fontSizes.lg};
|
|
109
109
|
`})[o]}
|
|
110
|
-
`;function
|
|
110
|
+
`;function ao({ref:o,as:r,href:n,variant:e="primary",size:i="md",isLoading:l,disabled:d,children:f,...u}){const p=r??(n?"a":"button");return t.jsx(pr,{ref:o,as:p,href:n,$variant:e,$size:i,disabled:l||d,...u,children:l?"Loading...":f})}ao.displayName="Button";const $r=s.div`
|
|
111
111
|
display: flex;
|
|
112
112
|
flex-direction: column;
|
|
113
113
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
114
114
|
width: ${({$fullWidth:o})=>o?"100%":"auto"};
|
|
115
|
-
`,
|
|
115
|
+
`,gr=s.label`
|
|
116
116
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
117
|
-
font-weight: ${({theme:o})=>o.brutalism?
|
|
118
|
-
`,
|
|
117
|
+
font-weight: ${({theme:o})=>o.brutalism?o.fontWeights.bold:o.fontWeights.medium};
|
|
118
|
+
`,br=s.span`
|
|
119
119
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
120
120
|
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
121
|
-
`,
|
|
121
|
+
`,xr=s.div`
|
|
122
122
|
display: flex;
|
|
123
123
|
align-items: center;
|
|
124
124
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
&:focus-within {
|
|
161
161
|
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
162
162
|
}
|
|
163
|
-
`,
|
|
163
|
+
`,yr=s.input`
|
|
164
164
|
flex: 1;
|
|
165
165
|
border: none;
|
|
166
166
|
outline: none;
|
|
@@ -171,11 +171,11 @@
|
|
|
171
171
|
cursor: not-allowed;
|
|
172
172
|
opacity: 0.6;
|
|
173
173
|
}
|
|
174
|
-
`,
|
|
174
|
+
`,Co=s.div`
|
|
175
175
|
display: inline-flex;
|
|
176
176
|
align-items: center;
|
|
177
177
|
margin: 0 ${({theme:o})=>o.spacing[1]};
|
|
178
|
-
`,
|
|
178
|
+
`,hr=s.button`
|
|
179
179
|
display: inline-flex;
|
|
180
180
|
align-items: center;
|
|
181
181
|
margin: 0 ${({theme:o})=>o.spacing[1]};
|
|
@@ -188,18 +188,18 @@
|
|
|
188
188
|
&:hover {
|
|
189
189
|
opacity: 0.8;
|
|
190
190
|
}
|
|
191
|
-
`;function
|
|
191
|
+
`;function Po({ref:o,type:r="text",size:n="md",variant:e="default",label:i,helperText:l,error:d,leftElement:f,rightElement:u,clearable:p,onClear:$,fullWidth:m,id:w,value:y,defaultValue:v,onChange:S,...W}){const L=a.useId(),E=w??L,g=`${E}-hint`,[j,h]=a.useState(v??""),x=y!==void 0,C=x?y:j,I=typeof d=="string"?d:void 0,z=!!(l||d),D=F=>{x||h(F.target.value),S?.(F)},P=()=>{x||h(""),$?.()};return t.jsxs($r,{$fullWidth:m,children:[i&&t.jsx(gr,{htmlFor:E,children:i}),t.jsxs(xr,{$size:n,$variant:e,$error:!!d,children:[f&&t.jsx(Co,{children:f}),t.jsx(yr,{id:E,ref:o,type:r,value:C,onChange:D,...W,"aria-invalid":!!d,"aria-describedby":z?g:void 0}),p&&C&&t.jsx(hr,{type:"button",onClick:P,"aria-label":"Clear input",children:"✕"}),u&&t.jsx(Co,{children:u})]}),z&&t.jsx(br,{id:g,$error:!!d,children:I??l})]})}Po.displayName="Input";const mr=s.div`
|
|
192
192
|
display: flex;
|
|
193
193
|
flex-direction: column;
|
|
194
194
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
195
195
|
width: ${({$fullWidth:o})=>o?"100%":"auto"};
|
|
196
|
-
`,
|
|
196
|
+
`,wr=s.label`
|
|
197
197
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
198
|
-
font-weight: ${({theme:o})=>o.brutalism?
|
|
199
|
-
`,
|
|
198
|
+
font-weight: ${({theme:o})=>o.brutalism?o.fontWeights.bold:o.fontWeights.medium};
|
|
199
|
+
`,vr=s.span`
|
|
200
200
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
201
201
|
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
202
|
-
`,
|
|
202
|
+
`,kr=s.div`
|
|
203
203
|
display: flex;
|
|
204
204
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
205
205
|
transition:
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
&:focus-within {
|
|
241
241
|
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
242
242
|
}
|
|
243
|
-
`,
|
|
243
|
+
`,Sr=s.textarea`
|
|
244
244
|
flex: 1;
|
|
245
245
|
border: none;
|
|
246
246
|
outline: none;
|
|
@@ -253,25 +253,32 @@
|
|
|
253
253
|
cursor: not-allowed;
|
|
254
254
|
opacity: 0.6;
|
|
255
255
|
}
|
|
256
|
-
`;function
|
|
256
|
+
`;function Fo({ref:o,size:r="md",variant:n="default",label:e,helperText:i,error:l,fullWidth:d,id:f,value:u,defaultValue:p,onChange:$,...m}){const w=a.useId(),y=f??w,v=`${y}-hint`,[S,W]=a.useState(p??""),L=u!==void 0,E=L?u:S,g=typeof l=="string"?l:void 0,j=!!(i||l),h=x=>{L||W(x.target.value),$?.(x)};return t.jsxs(mr,{$fullWidth:d,children:[e&&t.jsx(wr,{htmlFor:y,children:e}),t.jsx(kr,{$size:r,$variant:n,$error:!!l,children:t.jsx(Sr,{id:y,ref:o,value:E,onChange:h,...m,"aria-invalid":!!l,"aria-describedby":j?v:void 0})}),j&&t.jsx(vr,{id:v,$error:!!l,children:g??i})]})}Fo.displayName="Textarea";const Vo=(...o)=>o.filter((r,n,e)=>!!r&&r.trim()!==""&&e.indexOf(r)===n).join(" ").trim();const jr=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Cr=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,e)=>e?e.toUpperCase():n.toLowerCase());const zo=o=>{const r=Cr(o);return r.charAt(0).toUpperCase()+r.slice(1)};var go={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const zr=o=>{for(const r in o)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},Ir=a.createContext({}),Tr=()=>a.useContext(Ir),Dr=a.forwardRef(({color:o,size:r,strokeWidth:n,absoluteStrokeWidth:e,className:i="",children:l,iconNode:d,...f},u)=>{const{size:p=24,strokeWidth:$=2,absoluteStrokeWidth:m=!1,color:w="currentColor",className:y=""}=Tr()??{},v=e??m?Number(n??$)*24/Number(r??p):n??$;return a.createElement("svg",{ref:u,...go,width:r??p??go.width,height:r??p??go.height,stroke:o??w,strokeWidth:v,className:Vo("lucide",y,i),...!l&&!zr(f)&&{"aria-hidden":"true"},...f},[...d.map(([S,W])=>a.createElement(S,W)),...Array.isArray(l)?l:[l]])});const U=(o,r)=>{const n=a.forwardRef(({className:e,...i},l)=>a.createElement(Dr,{ref:l,iconNode:r,className:Vo(`lucide-${jr(zo(o))}`,`lucide-${o}`,e),...i}));return n.displayName=zo(o),n};const Wr=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Er=U("arrow-down",Wr);const Mr=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Or=U("arrow-up-down",Mr);const Lr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Rr=U("arrow-up",Lr);const Nr=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Pr=U("calendar",Nr);const Fr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bo=U("chevron-down",Fr);const Vr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Br=U("chevron-left",Vr);const Ar=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_r=U("chevron-right",Ar);const Hr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],uo=U("x",Hr),Yr=s.div`
|
|
257
257
|
display: inline-flex;
|
|
258
258
|
flex-direction: column;
|
|
259
259
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
260
260
|
width: ${({$fullWidth:o})=>o?"100%":"auto"};
|
|
261
|
-
`,br=s.div`
|
|
262
261
|
position: relative;
|
|
262
|
+
min-width: 0;
|
|
263
|
+
`,Ur=s.div`
|
|
264
|
+
height: 0;
|
|
265
|
+
overflow: hidden;
|
|
266
|
+
visibility: hidden;
|
|
267
|
+
pointer-events: none;
|
|
263
268
|
display: flex;
|
|
264
|
-
|
|
265
|
-
`,
|
|
266
|
-
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
267
|
-
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
268
|
-
`,xr=s.select`
|
|
269
|
+
flex-direction: column;
|
|
270
|
+
`,qr=s.button`
|
|
269
271
|
appearance: none;
|
|
270
272
|
width: 100%;
|
|
271
273
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
272
|
-
cursor: pointer;
|
|
274
|
+
cursor: ${({$disabled:o})=>o?"not-allowed":"pointer"};
|
|
273
275
|
font: inherit;
|
|
274
276
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
277
|
+
display: flex;
|
|
278
|
+
align-items: center;
|
|
279
|
+
gap: ${({theme:o})=>o.spacing[2]};
|
|
280
|
+
text-align: left;
|
|
281
|
+
background: none;
|
|
275
282
|
transition:
|
|
276
283
|
border-color 0.2s,
|
|
277
284
|
box-shadow 0.2s;
|
|
@@ -287,8 +294,6 @@
|
|
|
287
294
|
font-size: ${r.fontSizes.lg};
|
|
288
295
|
`})[o]}
|
|
289
296
|
|
|
290
|
-
padding-right: 2.5rem;
|
|
291
|
-
|
|
292
297
|
${({$variant:o,theme:r})=>r.brutalism?s.css`
|
|
293
298
|
border: ${r.brutalism.borderWidth} solid
|
|
294
299
|
${r.colors.neutral[900]};
|
|
@@ -306,22 +311,106 @@
|
|
|
306
311
|
border-color: ${r.colors.error[500]};
|
|
307
312
|
`}
|
|
308
313
|
|
|
309
|
-
|
|
314
|
+
${({$disabled:o})=>o&&s.css`
|
|
315
|
+
opacity: 0.6;
|
|
316
|
+
`}
|
|
317
|
+
|
|
318
|
+
&:focus-visible {
|
|
310
319
|
outline: none;
|
|
311
320
|
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
312
321
|
}
|
|
322
|
+
`,bo=s.span`
|
|
323
|
+
flex: 1;
|
|
324
|
+
overflow: hidden;
|
|
325
|
+
white-space: nowrap;
|
|
326
|
+
text-overflow: ellipsis;
|
|
327
|
+
color: ${({$placeholder:o,theme:r})=>o?r.colors.neutral[400]:r.colors.neutral[900]};
|
|
328
|
+
`,Kr=s.span`
|
|
329
|
+
display: flex;
|
|
330
|
+
align-items: center;
|
|
331
|
+
gap: ${({theme:o})=>o.spacing[1]};
|
|
332
|
+
flex-shrink: 0;
|
|
333
|
+
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
334
|
+
`,Gr=s.span`
|
|
335
|
+
display: inline-flex;
|
|
336
|
+
align-items: center;
|
|
337
|
+
transition: transform 0.15s;
|
|
338
|
+
transform: ${({$open:o})=>o?"rotate(180deg)":"rotate(0deg)"};
|
|
339
|
+
`,Xr=s.ul`
|
|
340
|
+
z-index: ${({theme:o})=>o.zIndex.modal};
|
|
341
|
+
margin: 0;
|
|
342
|
+
padding: ${({theme:o})=>o.spacing[1]} 0;
|
|
343
|
+
list-style: none;
|
|
344
|
+
background-color: ${({theme:o})=>o.colors.neutral[0]};
|
|
345
|
+
border-radius: ${({theme:o})=>o.radius.md};
|
|
346
|
+
max-height: 240px;
|
|
347
|
+
overflow-y: auto;
|
|
313
348
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
349
|
+
${({theme:o})=>o.brutalism?s.css`
|
|
350
|
+
border: ${o.brutalism.borderWidth} solid
|
|
351
|
+
${o.colors.neutral[900]};
|
|
352
|
+
box-shadow: ${o.brutalism.shadowOffset}
|
|
353
|
+
${o.brutalism.shadowOffset} 0 ${o.colors.neutral[900]};
|
|
354
|
+
`:s.css`
|
|
355
|
+
border: 1px solid ${o.colors.neutral[300]};
|
|
356
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
357
|
+
`}
|
|
358
|
+
`,Jr=s.div`
|
|
359
|
+
padding: ${({theme:o})=>o.spacing[2]};
|
|
360
|
+
border-bottom: 1px solid ${({theme:o})=>o.colors.neutral[200]};
|
|
361
|
+
`,Qr=s.input`
|
|
362
|
+
width: 100%;
|
|
363
|
+
border: 1px solid ${({theme:o})=>o.colors.neutral[300]};
|
|
364
|
+
border-radius: ${({theme:o})=>o.radius.md};
|
|
365
|
+
padding: ${({theme:o})=>`${o.spacing[1]} ${o.spacing[2]}`};
|
|
366
|
+
font: inherit;
|
|
367
|
+
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
368
|
+
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
369
|
+
background: ${({theme:o})=>o.colors.neutral[0]};
|
|
370
|
+
outline: none;
|
|
371
|
+
|
|
372
|
+
&:focus {
|
|
373
|
+
border-color: ${({theme:o})=>o.colors.primary[500]};
|
|
374
|
+
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
317
375
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
376
|
+
|
|
377
|
+
${({theme:o})=>o.brutalism&&s.css`
|
|
378
|
+
border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
|
|
379
|
+
&:focus {
|
|
380
|
+
box-shadow: ${o.shadows.focusRing};
|
|
381
|
+
}
|
|
382
|
+
`}
|
|
383
|
+
`,Zr=s.li`
|
|
384
|
+
padding: ${({theme:o})=>`${o.spacing[2]} ${o.spacing[3]}`};
|
|
385
|
+
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
386
|
+
color: ${({theme:o})=>o.colors.neutral[400]};
|
|
387
|
+
list-style: none;
|
|
388
|
+
`,os=s.li`
|
|
323
389
|
display: flex;
|
|
324
390
|
align-items: center;
|
|
391
|
+
padding: ${({theme:o})=>`${o.spacing[2]} ${o.spacing[3]}`};
|
|
392
|
+
font-size: ${({theme:o})=>o.fontSizes.md};
|
|
393
|
+
cursor: ${({$disabled:o})=>o?"not-allowed":"pointer"};
|
|
394
|
+
color: ${({$disabled:o,theme:r})=>o?r.colors.neutral[400]:r.colors.neutral[900]};
|
|
395
|
+
|
|
396
|
+
background-color: ${({$selected:o,$focused:r,theme:n})=>o?n.colors.primary[50]:r?n.colors.neutral[100]:"transparent"};
|
|
397
|
+
|
|
398
|
+
font-weight: ${({$selected:o,theme:r})=>o?r.fontWeights.semibold:r.fontWeights.normal};
|
|
399
|
+
|
|
400
|
+
${({$selected:o,theme:r})=>o&&s.css`
|
|
401
|
+
border-left: ${r.spacing[1]} solid ${r.colors.primary[500]};
|
|
402
|
+
padding-left: ${r.spacing[2]};
|
|
403
|
+
`}
|
|
404
|
+
|
|
405
|
+
&:hover {
|
|
406
|
+
background-color: ${({$disabled:o,$selected:r,theme:n})=>o?"transparent":r?n.colors.primary[50]:n.colors.neutral[100]};
|
|
407
|
+
}
|
|
408
|
+
`,rs=s.span`
|
|
409
|
+
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
410
|
+
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
411
|
+
`,ss=s.button`
|
|
412
|
+
display: inline-flex;
|
|
413
|
+
align-items: center;
|
|
325
414
|
padding: 0;
|
|
326
415
|
background: none;
|
|
327
416
|
border: none;
|
|
@@ -337,18 +426,9 @@
|
|
|
337
426
|
outline-offset: 2px;
|
|
338
427
|
border-radius: 2px;
|
|
339
428
|
}
|
|
340
|
-
`,
|
|
341
|
-
position: absolute;
|
|
342
|
-
right: ${({theme:o})=>o.spacing[3]};
|
|
343
|
-
top: 50%;
|
|
344
|
-
transform: translateY(-50%);
|
|
345
|
-
pointer-events: none;
|
|
346
|
-
display: flex;
|
|
347
|
-
align-items: center;
|
|
348
|
-
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
349
|
-
`;function mo({options:o,placeholder:r,size:n="md",variant:e="default",error:l,fullWidth:i,clearable:c,onClear:d,id:p,value:b,defaultValue:g,onChange:h,...y}){const f=a.useId(),x=p??f,v=`${x}-hint`,k=typeof l=="string"?l:void 0,[T,$]=a.useState(g??""),C=b!==void 0,S=C?b:T,j=I=>{C||$(I.target.value),h?.(I)},w=()=>{C||$(""),d?.()},z=c&&!!S;return t.jsxs($r,{$fullWidth:i,children:[t.jsxs(br,{children:[t.jsxs(xr,{id:x,$size:n,$variant:e,$error:!!l,"aria-invalid":!!l,"aria-describedby":k?v:void 0,value:S,onChange:j,...y,children:[r&&t.jsx("option",{value:"",disabled:!0,children:r}),o.map(I=>t.jsx("option",{value:I.value,disabled:I.disabled,children:I.label},I.value))]}),z?t.jsx(yr,{type:"button",onClick:w,"aria-label":"Clear selection",children:t.jsx(Q,{size:14})}):t.jsx(hr,{"aria-hidden":"true",children:t.jsx(wo,{size:14})})]}),k&&t.jsx(gr,{id:v,$error:!0,children:k})]})}mo.displayName="Select";const io=s.span`
|
|
429
|
+
`;function Ao({options:o,placeholder:r,size:n="md",variant:e="default",error:i,fullWidth:l,clearable:d,onClear:f,id:u,name:p,value:$,defaultValue:m,onChange:w,disabled:y,searchable:v,"aria-label":S,"aria-describedby":W}){const L=a.useId(),E=u??L,g=`${E}-list`,j=`${E}-search`,h=typeof i=="string"?i:void 0,[x,C]=a.useState(!1),[I,z]=a.useState(-1),[D,P]=a.useState(""),[F,O]=a.useState({top:0,left:0,width:0}),[V,q]=a.useState(m??""),N=$!==void 0,_=N?$:V,K=a.useRef(null),H=a.useRef(null),G=a.useRef(null),X=a.useRef(null),k=o.find(c=>c.value===_),M=v&&D?o.filter(c=>c.label.toLowerCase().includes(D.toLowerCase())):o,B=a.useCallback(()=>{if(!H.current)return;const c=H.current.getBoundingClientRect();O({top:c.bottom+4,left:c.left,width:c.width})},[]);a.useEffect(()=>{if(x)return B(),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B)}},[x,B]),a.useEffect(()=>{if(!x)return;const c=T=>{const Y=K.current?.contains(T.target),to=G.current?.contains(T.target);!Y&&!to&&C(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[x]),a.useEffect(()=>{x&&v&&setTimeout(()=>X.current?.focus(),0),x||(P(""),z(-1))},[x,v]),a.useEffect(()=>{z(-1)},[D]),a.useEffect(()=>{if(I<0)return;const c=document.getElementById(`${g}-option-${I}`);c&&typeof c.scrollIntoView=="function"&&c.scrollIntoView({block:"nearest"})},[I,g]);function A(c,T){let Y=c+T;for(;Y>=0&&Y<M.length;){if(!M[Y].disabled)return Y;Y+=T}return c}function oo(){return M.findIndex(c=>!c.disabled)}function no(){for(let c=M.length-1;c>=0;c--)if(!M[c].disabled)return c;return-1}function ro(c){if(c.disabled)return;N||q(c.value);const T={target:{name:p??"",value:c.value},currentTarget:{name:p??"",value:c.value}};w?.(T),C(!1),H.current?.focus()}function J(c){c.stopPropagation(),N||q(""),w?.({target:{name:p??"",value:""},currentTarget:{name:p??"",value:""}}),f?.(),H.current?.focus()}function fo(c){if(!y){if(!x){["ArrowDown","ArrowUp","Enter"," "].includes(c.key)&&(c.preventDefault(),C(!0),v||z(oo()));return}if(c.key==="Escape"){c.preventDefault(),C(!1);return}if(!v){if(c.key==="ArrowDown"){c.preventDefault(),z(T=>A(T,1));return}if(c.key==="ArrowUp"){c.preventDefault(),z(T=>A(T,-1));return}if(c.key==="Home"){c.preventDefault(),z(oo());return}if(c.key==="End"){c.preventDefault(),z(no());return}(c.key==="Enter"||c.key===" ")&&I>=0&&(c.preventDefault(),ro(M[I]))}}}function po(c){if(c.key==="Escape"){C(!1),H.current?.focus();return}if(c.key==="ArrowDown"){c.preventDefault(),z(T=>T<0?oo():A(T,1));return}if(c.key==="ArrowUp"){c.preventDefault(),z(T=>T<0?no():A(T,-1));return}c.key==="Enter"&&I>=0&&(c.preventDefault(),ro(M[I]))}const b=d&&!!_&&!y,R=I>=0?`${g}-option-${I}`:void 0;return t.jsxs(Yr,{ref:K,$fullWidth:l,children:[t.jsxs(Ur,{"aria-hidden":"true",children:[r&&t.jsx(bo,{children:r}),o.map(c=>t.jsx(bo,{children:c.label},c.value))]}),t.jsxs(qr,{ref:H,id:E,type:"button",role:"combobox","aria-expanded":x,"aria-haspopup":"listbox","aria-controls":x?g:void 0,"aria-activedescendant":x&&!v?R:void 0,"aria-invalid":!!i,"aria-label":S,"aria-describedby":W,$size:n,$variant:e,$error:!!i,$disabled:y,$open:x,disabled:y,onClick:()=>!y&&C(c=>!c),onKeyDown:fo,children:[t.jsx(bo,{$placeholder:!k,children:k?.label??r??"Select..."}),t.jsxs(Kr,{children:[b&&t.jsx(ss,{type:"button",onClick:J,"aria-label":"Clear selection",children:t.jsx(uo,{size:14})}),t.jsx(Gr,{$open:x,"aria-hidden":"true",children:t.jsx(Bo,{size:14})})]})]}),x&&co.createPortal(t.jsxs(Xr,{ref:G,id:g,role:"listbox","aria-label":r??"Options",style:{position:"fixed",top:F.top,left:F.left,width:F.width},children:[v&&t.jsx(Jr,{children:t.jsx(Qr,{ref:X,id:j,type:"text",placeholder:"Search...",value:D,onChange:c=>P(c.target.value),onKeyDown:po,"aria-label":"Search options","aria-controls":g,"aria-activedescendant":R})}),M.length===0&&t.jsx(Zr,{children:"No options found"}),M.map((c,T)=>t.jsx(os,{id:`${g}-option-${T}`,role:"option","aria-selected":c.value===_,"aria-disabled":c.disabled,$selected:c.value===_,$focused:T===I,$disabled:c.disabled,onClick:()=>ro(c),onMouseEnter:()=>!c.disabled&&z(T),children:c.label},c.value))]}),document.body),h&&t.jsx(rs,{$error:!0,children:h})]})}Ao.displayName="Select";const Io=s.span`
|
|
350
430
|
display: inline-block;
|
|
351
|
-
`,
|
|
431
|
+
`,ns=s.span`
|
|
352
432
|
display: inline-block;
|
|
353
433
|
min-width: 60px;
|
|
354
434
|
padding: ${({theme:o})=>`${o.spacing[1]} ${o.spacing[2]}`};
|
|
@@ -386,7 +466,7 @@
|
|
|
386
466
|
box-shadow: ${r.shadows.focusRing};
|
|
387
467
|
}
|
|
388
468
|
`}
|
|
389
|
-
`,
|
|
469
|
+
`,ts=s.input`
|
|
390
470
|
display: inline-block;
|
|
391
471
|
min-width: 60px;
|
|
392
472
|
padding: ${({theme:o})=>`${o.spacing[1]} ${o.spacing[2]}`};
|
|
@@ -405,7 +485,7 @@
|
|
|
405
485
|
border: 1px solid ${o.colors.primary[500]};
|
|
406
486
|
box-shadow: ${o.shadows.focusRing};
|
|
407
487
|
`}
|
|
408
|
-
`;function
|
|
488
|
+
`;function _o({value:o,defaultValue:r="",onChange:n,onSubmit:e,onCancel:i,placeholder:l="Click to edit",disabled:d=!1}){const f=o!==void 0,[u,p]=a.useState(r),$=f?o:u,[m,w]=a.useState(!1),[y,v]=a.useState(""),S=a.useRef(null),W=()=>{d||(v($),w(!0),setTimeout(()=>{S.current?.focus(),S.current?.select()},0))},L=()=>{f||p(y),n?.(y),e?.(y),w(!1)},E=()=>{i?.($),w(!1)},g=j=>{j.key==="Enter"?L():j.key==="Escape"&&E()};return m?t.jsx(Io,{children:t.jsx(ts,{ref:S,value:y,size:Math.max(y.length,l.length,10),onChange:j=>v(j.target.value),onBlur:L,onKeyDown:g,"aria-label":"Edit value"})}):t.jsx(Io,{children:t.jsx(ns,{role:d?void 0:"button",tabIndex:d?void 0:0,$disabled:d,$empty:!$,onClick:W,onKeyDown:j=>j.key==="Enter"&&W(),children:$||l})})}_o.displayName="Editable";const es=s.a`
|
|
409
489
|
text-decoration: underline;
|
|
410
490
|
text-underline-offset: 2px;
|
|
411
491
|
transition: color 0.15s;
|
|
@@ -427,30 +507,30 @@
|
|
|
427
507
|
color: ${r.colors.neutral[900]};
|
|
428
508
|
}
|
|
429
509
|
`})[o]}
|
|
430
|
-
`;function
|
|
510
|
+
`;function mo({variant:o="default",external:r,children:n,...e}){return t.jsx(es,{$variant:o,...r&&{target:"_blank",rel:"noreferrer"},...e,children:n})}mo.displayName="Link";const is=s.div`
|
|
431
511
|
display: flex;
|
|
432
512
|
flex-direction: column;
|
|
433
513
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
434
|
-
`,
|
|
514
|
+
`,as=s.span`
|
|
435
515
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
436
516
|
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
437
|
-
font-weight: ${({theme:o})=>o.brutalism?
|
|
438
|
-
`,
|
|
517
|
+
font-weight: ${({theme:o})=>o.brutalism?o.fontWeights.bold:o.fontWeights.medium};
|
|
518
|
+
`,ls=s.span`
|
|
439
519
|
font-size: ${({theme:o})=>o.fontSizes.md};
|
|
440
520
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
441
|
-
`;function
|
|
521
|
+
`;function Ho({label:o,value:r,href:n}){return t.jsxs(is,{children:[t.jsx(as,{children:o}),n?t.jsx(mo,{href:n,external:!0,children:r}):t.jsx(ls,{children:r??"—"})]})}Ho.displayName="Field";const cs=s.keyframes`
|
|
442
522
|
from { opacity: 0; }
|
|
443
523
|
to { opacity: 1; }
|
|
444
|
-
`,
|
|
524
|
+
`,ds=s.keyframes`
|
|
445
525
|
from { opacity: 1; }
|
|
446
526
|
to { opacity: 0; }
|
|
447
|
-
`,
|
|
527
|
+
`,us=s.keyframes`
|
|
448
528
|
from { opacity: 0; transform: scale(0.95) translateY(-8px); }
|
|
449
529
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
450
|
-
`,
|
|
530
|
+
`,fs=s.keyframes`
|
|
451
531
|
from { opacity: 1; transform: scale(1) translateY(0); }
|
|
452
532
|
to { opacity: 0; transform: scale(0.95) translateY(-8px); }
|
|
453
|
-
`,
|
|
533
|
+
`,ps=s.div`
|
|
454
534
|
position: fixed;
|
|
455
535
|
inset: 0;
|
|
456
536
|
background-color: rgba(0, 0, 0, 0.5);
|
|
@@ -458,9 +538,9 @@
|
|
|
458
538
|
align-items: center;
|
|
459
539
|
justify-content: center;
|
|
460
540
|
z-index: ${({theme:o})=>o.zIndex.modal};
|
|
461
|
-
animation: ${({$closing:o})=>o?
|
|
541
|
+
animation: ${({$closing:o})=>o?ds:cs} 0.15s ease
|
|
462
542
|
forwards;
|
|
463
|
-
|
|
543
|
+
`,$s=s.div`
|
|
464
544
|
position: relative;
|
|
465
545
|
background: ${({theme:o})=>o.colors.neutral[0]};
|
|
466
546
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
@@ -469,7 +549,7 @@
|
|
|
469
549
|
display: flex;
|
|
470
550
|
flex-direction: column;
|
|
471
551
|
max-height: 90vh;
|
|
472
|
-
animation: ${({$closing:o})=>o?
|
|
552
|
+
animation: ${({$closing:o})=>o?fs:us} 0.15s ease
|
|
473
553
|
forwards;
|
|
474
554
|
|
|
475
555
|
${({$size:o})=>o==="sm"&&s.css`
|
|
@@ -487,19 +567,19 @@
|
|
|
487
567
|
max-height: 100vh;
|
|
488
568
|
border-radius: 0;
|
|
489
569
|
`}
|
|
490
|
-
`,
|
|
570
|
+
`,gs=s.div`
|
|
491
571
|
display: flex;
|
|
492
572
|
align-items: center;
|
|
493
573
|
gap: ${({theme:o})=>o.spacing[2]};
|
|
494
574
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
495
575
|
border-bottom: 1px solid ${({theme:o})=>o.colors.neutral[200]};
|
|
496
576
|
flex-shrink: 0;
|
|
497
|
-
`,
|
|
577
|
+
`,bs=s.h2`
|
|
498
578
|
flex: 1;
|
|
499
579
|
font-size: ${({theme:o})=>o.fontSizes.lg};
|
|
500
|
-
font-weight:
|
|
580
|
+
font-weight: ${({theme:o})=>o.fontWeights.semibold};
|
|
501
581
|
margin: 0;
|
|
502
|
-
`,
|
|
582
|
+
`,xs=s.button`
|
|
503
583
|
display: inline-flex;
|
|
504
584
|
align-items: center;
|
|
505
585
|
justify-content: center;
|
|
@@ -524,11 +604,11 @@
|
|
|
524
604
|
outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
|
|
525
605
|
outline-offset: 2px;
|
|
526
606
|
}
|
|
527
|
-
`,
|
|
607
|
+
`,ys=s.div`
|
|
528
608
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
529
609
|
overflow-y: auto;
|
|
530
610
|
flex: 1;
|
|
531
|
-
`,
|
|
611
|
+
`,hs=s.div`
|
|
532
612
|
display: flex;
|
|
533
613
|
align-items: center;
|
|
534
614
|
justify-content: flex-end;
|
|
@@ -536,18 +616,37 @@
|
|
|
536
616
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
537
617
|
border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
|
|
538
618
|
flex-shrink: 0;
|
|
539
|
-
`,
|
|
619
|
+
`,ms=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");function To(o){return Array.from(o.querySelectorAll(ms))}function wo({open:o,onClose:r,title:n,children:e,footer:i,size:l="md",closeOnBackdrop:d=!0,closeOnEscape:f=!0,ariaLabelledBy:u,ariaDescribedBy:p}){const $=a.useRef(null),m=a.useRef(null),w=a.useRef(r);w.current=r;const y=a.useId(),v=u??(n?y:void 0),[S,W]=a.useState(o),[L,E]=a.useState(!1);return a.useEffect(()=>{if(o)W(!0),E(!1);else if(S){E(!0);const g=setTimeout(()=>{W(!1),E(!1)},150);return()=>clearTimeout(g)}},[o,S]),a.useEffect(()=>{if(!o)return;const g=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=g}},[o]),a.useEffect(()=>{if(!o||!$.current)return;const g=$.current,j=document.activeElement;(To(g)[0]??g).focus();const x=C=>{if(C.key==="Escape"&&f){w.current();return}if(C.key!=="Tab")return;const I=To(g);if(I.length===0){C.preventDefault();return}const z=I[0],D=I[I.length-1];C.shiftKey?document.activeElement===z&&(C.preventDefault(),D.focus()):document.activeElement===D&&(C.preventDefault(),z.focus())};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x),j?.focus()}},[o,f,S]),S?co.createPortal(t.jsx(ps,{$closing:L,onMouseDown:g=>{m.current=g.target},onClick:g=>{d&&m.current===g.currentTarget&&r()},children:t.jsxs($s,{ref:$,role:"dialog","aria-modal":"true","aria-labelledby":v,"aria-describedby":p,$size:l,$closing:L,tabIndex:-1,onClick:g=>g.stopPropagation(),children:[t.jsxs(gs,{children:[n&&t.jsx(bs,{id:y,children:n}),t.jsx(xs,{onClick:r,"aria-label":"Close modal",children:"×"})]}),t.jsx(ys,{children:e}),i&&t.jsx(hs,{children:i})]})}),document.body):null}wo.displayName="Modal";const Yo=s.keyframes`
|
|
540
620
|
from { opacity: 0; transform: translateY(12px); }
|
|
541
621
|
to { opacity: 1; transform: translateY(0); }
|
|
542
|
-
`,
|
|
622
|
+
`,Uo=s.keyframes`
|
|
543
623
|
from { opacity: 0; transform: translateY(-12px); }
|
|
544
624
|
to { opacity: 1; transform: translateY(0); }
|
|
545
|
-
`,
|
|
625
|
+
`,qo=s.keyframes`
|
|
546
626
|
from { opacity: 1; }
|
|
547
627
|
to { opacity: 0; }
|
|
548
|
-
`,
|
|
549
|
-
|
|
550
|
-
|
|
628
|
+
`,eo=(o,r,n)=>s.css`
|
|
629
|
+
background: ${r};
|
|
630
|
+
border: ${o.brutalism.borderWidth} solid ${n};
|
|
631
|
+
box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
|
|
632
|
+
0 ${n};
|
|
633
|
+
`;function Ko(o,r){return r.brutalism?{success:eo(r,r.colors.success[50],r.colors.success[500]),error:eo(r,r.colors.error[50],r.colors.error[500]),warning:eo(r,r.colors.warning[50],r.colors.warning[500]),info:eo(r,r.colors.info[50],r.colors.info[500])}[o]:{success:s.css`
|
|
634
|
+
background: ${r.colors.success[50]};
|
|
635
|
+
border-left: ${r.spacing[1]} solid ${r.colors.success[500]};
|
|
636
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
637
|
+
`,error:s.css`
|
|
638
|
+
background: ${r.colors.error[50]};
|
|
639
|
+
border-left: ${r.spacing[1]} solid ${r.colors.error[500]};
|
|
640
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
641
|
+
`,warning:s.css`
|
|
642
|
+
background: ${r.colors.warning[50]};
|
|
643
|
+
border-left: ${r.spacing[1]} solid ${r.colors.warning[500]};
|
|
644
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
645
|
+
`,info:s.css`
|
|
646
|
+
background: ${r.colors.info[50]};
|
|
647
|
+
border-left: ${r.spacing[1]} solid ${r.colors.info[500]};
|
|
648
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
649
|
+
`}[o]}const Go=s.css`
|
|
551
650
|
display: flex;
|
|
552
651
|
align-items: center;
|
|
553
652
|
gap: ${({theme:o})=>o.spacing[3]};
|
|
@@ -555,58 +654,79 @@
|
|
|
555
654
|
max-width: 400px;
|
|
556
655
|
padding: ${({theme:o})=>`${o.spacing[3]} ${o.spacing[4]}`};
|
|
557
656
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
657
|
+
`,ws={"bottom-right":s.css`
|
|
658
|
+
bottom: 24px;
|
|
659
|
+
right: 24px;
|
|
660
|
+
`,"bottom-left":s.css`
|
|
661
|
+
bottom: 24px;
|
|
662
|
+
left: 24px;
|
|
663
|
+
`,"top-right":s.css`
|
|
664
|
+
top: 24px;
|
|
665
|
+
right: 24px;
|
|
666
|
+
`,"top-left":s.css`
|
|
667
|
+
top: 24px;
|
|
668
|
+
left: 24px;
|
|
669
|
+
`},vs=s.div`
|
|
670
|
+
position: fixed;
|
|
671
|
+
z-index: ${({theme:o})=>o.zIndex.toast};
|
|
672
|
+
${Go}
|
|
673
|
+
|
|
558
674
|
animation: ${({$closing:o,$position:r})=>o?s.css`
|
|
559
|
-
${
|
|
675
|
+
${qo} 0.2s ease forwards
|
|
560
676
|
`:r.startsWith("top")?s.css`
|
|
561
|
-
${
|
|
677
|
+
${Uo} 0.2s ease forwards
|
|
678
|
+
`:s.css`
|
|
679
|
+
${Yo} 0.2s ease forwards
|
|
680
|
+
`};
|
|
681
|
+
|
|
682
|
+
${({$position:o})=>ws[o]}
|
|
683
|
+
${({$variant:o,theme:r})=>Ko(o,r)}
|
|
684
|
+
`,ks=s.div`
|
|
685
|
+
${Go}
|
|
686
|
+
pointer-events: all;
|
|
687
|
+
|
|
688
|
+
animation: ${({$closing:o,$isTop:r})=>o?s.css`
|
|
689
|
+
${qo} 0.2s ease forwards
|
|
690
|
+
`:r?s.css`
|
|
691
|
+
${Uo} 0.2s ease forwards
|
|
562
692
|
`:s.css`
|
|
563
|
-
${
|
|
693
|
+
${Yo} 0.2s ease forwards
|
|
564
694
|
`};
|
|
565
695
|
|
|
696
|
+
${({$variant:o,theme:r})=>Ko(o,r)}
|
|
697
|
+
`,Ss=s.div`
|
|
698
|
+
position: fixed;
|
|
699
|
+
z-index: ${({theme:o})=>o.zIndex.toast};
|
|
700
|
+
display: flex;
|
|
701
|
+
flex-direction: column;
|
|
702
|
+
gap: ${({theme:o})=>o.spacing[2]};
|
|
703
|
+
pointer-events: none;
|
|
704
|
+
|
|
566
705
|
${({$position:o,theme:r})=>({"bottom-right":s.css`
|
|
567
706
|
bottom: ${r.spacing[6]};
|
|
568
707
|
right: ${r.spacing[6]};
|
|
708
|
+
align-items: flex-end;
|
|
569
709
|
`,"bottom-left":s.css`
|
|
570
710
|
bottom: ${r.spacing[6]};
|
|
571
711
|
left: ${r.spacing[6]};
|
|
712
|
+
align-items: flex-start;
|
|
572
713
|
`,"top-right":s.css`
|
|
573
714
|
top: ${r.spacing[6]};
|
|
574
715
|
right: ${r.spacing[6]};
|
|
716
|
+
align-items: flex-end;
|
|
575
717
|
`,"top-left":s.css`
|
|
576
718
|
top: ${r.spacing[6]};
|
|
577
719
|
left: ${r.spacing[6]};
|
|
720
|
+
align-items: flex-start;
|
|
578
721
|
`})[o]}
|
|
579
|
-
`,
|
|
580
|
-
background: ${r};
|
|
581
|
-
border: ${o.brutalism.borderWidth} solid ${n};
|
|
582
|
-
box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
|
|
583
|
-
0 ${n};
|
|
584
|
-
`,Rr=s(_r)`
|
|
585
|
-
${({$variant:o,theme:r})=>r.brutalism?{success:A(r,r.colors.success[50],r.colors.success[500]),error:A(r,r.colors.error[50],r.colors.error[500]),warning:A(r,r.colors.warning[50],r.colors.warning[500]),info:A(r,r.colors.info[50],r.colors.info[500])}[o]:{success:s.css`
|
|
586
|
-
background: ${r.colors.success[50]};
|
|
587
|
-
border-left: 4px solid ${r.colors.success[500]};
|
|
588
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
589
|
-
`,error:s.css`
|
|
590
|
-
background: ${r.colors.error[50]};
|
|
591
|
-
border-left: 4px solid ${r.colors.error[500]};
|
|
592
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
593
|
-
`,warning:s.css`
|
|
594
|
-
background: ${r.colors.warning[50]};
|
|
595
|
-
border-left: 4px solid ${r.colors.warning[500]};
|
|
596
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
597
|
-
`,info:s.css`
|
|
598
|
-
background: ${r.colors.info[50]};
|
|
599
|
-
border-left: 4px solid ${r.colors.info[500]};
|
|
600
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
601
|
-
`}[o]}
|
|
602
|
-
`,Ar=s.p`
|
|
722
|
+
`,Xo=s.p`
|
|
603
723
|
flex: 1;
|
|
604
724
|
margin: 0;
|
|
605
725
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
606
|
-
font-weight: ${({theme:o})=>o.brutalism?
|
|
726
|
+
font-weight: ${({theme:o})=>o.brutalism?o.fontWeights.semibold:o.fontWeights.normal};
|
|
607
727
|
line-height: 1.5;
|
|
608
728
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
609
|
-
`,
|
|
729
|
+
`,Jo=s.button`
|
|
610
730
|
flex-shrink: 0;
|
|
611
731
|
display: inline-flex;
|
|
612
732
|
align-items: center;
|
|
@@ -628,25 +748,214 @@
|
|
|
628
748
|
outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
|
|
629
749
|
outline-offset: 2px;
|
|
630
750
|
}
|
|
631
|
-
`;function
|
|
751
|
+
`;function Qo({open:o,onClose:r,message:n,variant:e="info",duration:i=4e3,position:l="bottom-right"}){const[d,f]=a.useState(o),[u,p]=a.useState(!1);return a.useEffect(()=>{if(o)f(!0),p(!1);else if(d){p(!0);const $=setTimeout(()=>{f(!1),p(!1)},200);return()=>{clearTimeout($)}}},[o,d]),a.useEffect(()=>{if(!o||i===0)return;const $=setTimeout(r,i);return()=>{clearTimeout($)}},[o,i,r]),d?co.createPortal(t.jsxs(vs,{$position:l,$variant:e,$closing:u,role:"alert","aria-live":"polite",children:[t.jsx(Xo,{children:n}),t.jsx(Jo,{onClick:r,"aria-label":"Close notification",children:t.jsx(uo,{size:14,strokeWidth:2.5})})]}),document.body):null}Qo.displayName="Toast";const Zo=a.createContext(null),Do=5,js="bottom-right";function Cs({toast:o,isTop:r,onClose:n}){return a.useEffect(()=>{const e=o.duration??4e3;if(e===0)return;const i=setTimeout(()=>n(o.id),e);return()=>clearTimeout(i)},[o.id,o.duration,n]),t.jsxs(ks,{$variant:o.variant??"info",$closing:o.closing,$isTop:r,role:"alert","aria-live":"polite",children:[t.jsx(Xo,{children:o.message}),t.jsx(Jo,{onClick:()=>n(o.id),"aria-label":"Close notification",children:t.jsx(uo,{size:14,strokeWidth:2.5})})]})}function zs({children:o}){const[r,n]=a.useState([]),e=a.useCallback(u=>{n(p=>p.map($=>$.id===u?{...$,closing:!0}:$)),setTimeout(()=>{n(p=>p.filter($=>$.id!==u))},200)},[]),i=a.useCallback(u=>{const p=Date.now();n($=>{const m=[...$,{...u,id:p,closing:!1}];return m.length>Do?m.slice(m.length-Do):m})},[]),l=a.useMemo(()=>Object.assign(u=>i(u),{success:(u,p)=>i({...p,message:u,variant:"success"}),error:(u,p)=>i({...p,message:u,variant:"error"}),warning:(u,p)=>i({...p,message:u,variant:"warning"}),info:(u,p)=>i({...p,message:u,variant:"info"})}),[i]),d=r[r.length-1]?.position??js,f=d.startsWith("top");return t.jsxs(Zo.Provider,{value:{toast:l},children:[o,r.length>0&&co.createPortal(t.jsx(Ss,{$position:d,children:r.map(u=>t.jsx(Cs,{toast:u,isTop:f,onClose:e},u.id))}),document.body)]})}function Is(){const o=a.useContext(Zo);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}const Ts=s.form`
|
|
632
752
|
display: flex;
|
|
633
753
|
flex-direction: column;
|
|
634
754
|
gap: ${({theme:o})=>o.spacing[4]};
|
|
635
|
-
|
|
755
|
+
`;function or({onSubmit:o,children:r,...n}){return t.jsx(Ts,{onSubmit:e=>{e.preventDefault(),o?.(e)},noValidate:!0,...n,children:r})}or.displayName="Form";const Ds=s.div`
|
|
636
756
|
display: flex;
|
|
637
757
|
flex-direction: column;
|
|
638
758
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
639
|
-
`,
|
|
759
|
+
`,Ws=s.label`
|
|
640
760
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
641
|
-
font-weight:
|
|
761
|
+
font-weight: ${({theme:o})=>o.fontWeights.medium};
|
|
642
762
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
643
|
-
`,
|
|
763
|
+
`,Es=s.span`
|
|
644
764
|
color: ${({theme:o})=>o.colors.error[500]};
|
|
645
|
-
margin-left:
|
|
646
|
-
`,
|
|
765
|
+
margin-left: ${({theme:o})=>o.spacing[.5]};
|
|
766
|
+
`,Ms=s.span`
|
|
767
|
+
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
768
|
+
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
769
|
+
`;function vo({label:o,error:r,helperText:n,required:e,children:i}){const l=a.useId(),d=`${l}-hint`,f=!!(r||n),u=typeof r=="string"?r:void 0,p=a.isValidElement(i)?a.cloneElement(i,{id:l,...f&&{"aria-describedby":d},...r&&{"aria-invalid":!0}}):i;return t.jsxs(Ds,{children:[o&&t.jsxs(Ws,{htmlFor:l,children:[o,e&&t.jsx(Es,{"aria-hidden":"true",children:" *"})]}),p,f&&t.jsx(Ms,{id:d,$error:!!r,children:u??n})]})}vo.displayName="FormField";function Os({initialValues:o,validate:r,onSubmit:n,onError:e}){const[i,l]=a.useState(o),[d,f]=a.useState({}),[u,p]=a.useState({}),[$,m]=a.useState(!1),w=a.useRef(i);w.current=i;const y=a.useCallback(h=>{if(!r)return{};const x=r(h);return Object.fromEntries(Object.entries(x).filter(([,C])=>C!==void 0))},[r]),v=a.useRef(u);v.current=u;const S=a.useCallback(h=>{const{name:x,value:C}=h.target;process.env.NODE_ENV!=="production"&&!x&&console.warn("[useForm] handleChange: field is missing a `name` attribute — value will not be tracked.");const I={...w.current,[x]:C};l(I),v.current[x]&&f(y(I))},[y]),W=a.useCallback(h=>{const{name:x}=h.target;process.env.NODE_ENV!=="production"&&!x&&console.warn("[useForm] handleBlur: field is missing a `name` attribute — touched state will not be tracked."),p(C=>({...C,[x]:!0})),f(y(w.current))},[y]),L=a.useCallback(h=>{h?.preventDefault();const x=Object.keys(w.current).reduce((z,D)=>({...z,[D]:!0}),{});p(x);const C=y(w.current);if(f(C),Object.keys(C).length>0){e?.(C);return}(async()=>{m(!0);try{await n?.(w.current)}finally{m(!1)}})()},[y,n,e]),E=a.useCallback((h,x)=>{l(C=>({...C,[h]:x}))},[]),g=a.useCallback(h=>{l(h??o),f({}),p({}),m(!1)},[o]),j=Object.fromEntries(Object.entries(d).filter(([h])=>u[h]));return{values:i,errors:j,touched:u,handleChange:S,handleBlur:W,handleSubmit:L,setFieldValue:E,reset:g,isSubmitting:$}}const Ls=(o="Required")=>r=>{if(!r.trim())return o},Rs=(o,r)=>n=>{if(n.length<o)return r??`Must be at least ${o} characters`},Ns=(o,r)=>n=>{if(n.length>o)return r??`Must be at most ${o} characters`},Ps=(o="Enter a valid email")=>r=>{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))return o},Fs=(o="Enter a valid URL")=>r=>{try{new URL(r);return}catch{return o}},Vs=(o,r)=>n=>{if(!o.test(n))return r};function Bs(...o){return r=>{for(const n of o){const e=n(r);if(e!==void 0)return e}}}const As=s.div`
|
|
770
|
+
display: flex;
|
|
771
|
+
flex-direction: column;
|
|
772
|
+
gap: ${({theme:o})=>o.spacing[1]};
|
|
773
|
+
`,_s=s.label`
|
|
774
|
+
display: inline-flex;
|
|
775
|
+
align-items: center;
|
|
776
|
+
gap: ${({theme:o})=>o.spacing[2]};
|
|
777
|
+
cursor: ${({$disabled:o})=>o?"not-allowed":"pointer"};
|
|
778
|
+
opacity: ${({$disabled:o})=>o?.6:1};
|
|
779
|
+
`,Hs=s.input`
|
|
780
|
+
position: absolute;
|
|
781
|
+
opacity: 0;
|
|
782
|
+
width: 0;
|
|
783
|
+
height: 0;
|
|
784
|
+
margin: 0;
|
|
785
|
+
padding: 0;
|
|
786
|
+
|
|
787
|
+
&:focus-visible + div {
|
|
788
|
+
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
789
|
+
}
|
|
790
|
+
`,Ys=s.div`
|
|
791
|
+
position: relative;
|
|
792
|
+
display: flex;
|
|
793
|
+
align-items: center;
|
|
794
|
+
justify-content: center;
|
|
795
|
+
flex-shrink: 0;
|
|
796
|
+
border-radius: ${({theme:o})=>o.radius.md};
|
|
797
|
+
border: ${({theme:o})=>o.brutalism?.borderWidth??"2px"} solid
|
|
798
|
+
${({$error:o,$borderColor:r,theme:n})=>o?n.colors.error[500]:r??n.colors.neutral[900]};
|
|
799
|
+
background-color: ${({$checked:o,$color:r,theme:n})=>o?r??n.colors.primary[500]:n.colors.neutral[0]};
|
|
800
|
+
transition:
|
|
801
|
+
background-color 0.1s,
|
|
802
|
+
border-color 0.1s;
|
|
803
|
+
|
|
804
|
+
${({$size:o="md",theme:r})=>({sm:s.css`
|
|
805
|
+
width: ${r.spacing[4]};
|
|
806
|
+
height: ${r.spacing[4]};
|
|
807
|
+
`,md:s.css`
|
|
808
|
+
width: ${r.spacing[5]};
|
|
809
|
+
height: ${r.spacing[5]};
|
|
810
|
+
`})[o]}
|
|
811
|
+
|
|
812
|
+
${({$checked:o,$checkColor:r})=>o&&s.css`
|
|
813
|
+
&::after {
|
|
814
|
+
content: "";
|
|
815
|
+
display: block;
|
|
816
|
+
width: 5px;
|
|
817
|
+
height: 9px;
|
|
818
|
+
border: 2px solid ${r??"currentColor"};
|
|
819
|
+
border-top: none;
|
|
820
|
+
border-left: none;
|
|
821
|
+
transform: rotate(45deg) translate(-1px, -1px);
|
|
822
|
+
}
|
|
823
|
+
`}
|
|
824
|
+
`,Us=s.span`
|
|
825
|
+
font-size: ${({$size:o="md",theme:r})=>o==="sm"?r.fontSizes.sm:r.fontSizes.md};
|
|
826
|
+
font-weight: ${({theme:o})=>o.fontWeights.medium};
|
|
827
|
+
`,qs=s.span`
|
|
828
|
+
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
829
|
+
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
830
|
+
`;function rr({ref:o,label:r,size:n="md",error:e,helperText:i,disabled:l,checked:d,id:f,color:u,borderColor:p,checkColor:$,...m}){const w=a.useId(),y=f??w,v=typeof e=="string"?e:void 0,S=!!(i||e);return t.jsxs(As,{children:[t.jsxs(_s,{htmlFor:y,$disabled:l,children:[t.jsx(Hs,{id:y,ref:o,type:"checkbox",checked:d,disabled:l,"aria-invalid":!!e,...m}),t.jsx(Ys,{$checked:d,$error:!!e,$disabled:l,$size:n,$color:u,$borderColor:p,$checkColor:$}),r&&t.jsx(Us,{$size:n,children:r})]}),S&&t.jsx(qs,{$error:!!e,children:v??i})]})}rr.displayName="Checkbox";const Ks=s.div`
|
|
831
|
+
display: flex;
|
|
832
|
+
flex-direction: column;
|
|
833
|
+
gap: ${({theme:o})=>o.spacing[1]};
|
|
834
|
+
`,Gs=s.label`
|
|
835
|
+
display: inline-flex;
|
|
836
|
+
align-items: center;
|
|
837
|
+
gap: ${({theme:o})=>o.spacing[2]};
|
|
838
|
+
cursor: ${({$disabled:o})=>o?"not-allowed":"pointer"};
|
|
839
|
+
opacity: ${({$disabled:o})=>o?.6:1};
|
|
840
|
+
`,Xs=s.input`
|
|
841
|
+
position: absolute;
|
|
842
|
+
opacity: 0;
|
|
843
|
+
width: 0;
|
|
844
|
+
height: 0;
|
|
845
|
+
margin: 0;
|
|
846
|
+
padding: 0;
|
|
847
|
+
|
|
848
|
+
&:focus-visible + div {
|
|
849
|
+
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
850
|
+
}
|
|
851
|
+
`,Js=s.div`
|
|
852
|
+
position: relative;
|
|
853
|
+
display: flex;
|
|
854
|
+
align-items: center;
|
|
855
|
+
justify-content: center;
|
|
856
|
+
flex-shrink: 0;
|
|
857
|
+
border-radius: 50%;
|
|
858
|
+
border: ${({theme:o})=>o.brutalism?.borderWidth??"2px"} solid
|
|
859
|
+
${({$error:o,$borderColor:r,theme:n})=>o?n.colors.error[500]:r??n.colors.neutral[900]};
|
|
860
|
+
background-color: ${({theme:o})=>o.colors.neutral[0]};
|
|
861
|
+
transition:
|
|
862
|
+
background-color 0.1s,
|
|
863
|
+
border-color 0.1s;
|
|
864
|
+
|
|
865
|
+
${({$size:o="md",theme:r})=>({sm:s.css`
|
|
866
|
+
width: ${r.spacing[4]};
|
|
867
|
+
height: ${r.spacing[4]};
|
|
868
|
+
`,md:s.css`
|
|
869
|
+
width: ${r.spacing[5]};
|
|
870
|
+
height: ${r.spacing[5]};
|
|
871
|
+
`})[o]}
|
|
872
|
+
|
|
873
|
+
${({$checked:o,$color:r,theme:n})=>o&&s.css`
|
|
874
|
+
&::after {
|
|
875
|
+
content: "";
|
|
876
|
+
display: block;
|
|
877
|
+
width: 8px;
|
|
878
|
+
height: 8px;
|
|
879
|
+
border-radius: 50%;
|
|
880
|
+
background-color: ${r??n.colors.primary[500]};
|
|
881
|
+
}
|
|
882
|
+
`}
|
|
883
|
+
`,Qs=s.span`
|
|
884
|
+
font-size: ${({$size:o="md",theme:r})=>o==="sm"?r.fontSizes.sm:r.fontSizes.md};
|
|
885
|
+
font-weight: ${({theme:o})=>o.fontWeights.medium};
|
|
886
|
+
`,Zs=s.span`
|
|
647
887
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
648
888
|
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
649
|
-
`;function
|
|
889
|
+
`;function sr({ref:o,label:r,size:n="md",error:e,helperText:i,disabled:l,checked:d,id:f,color:u,borderColor:p,...$}){const m=a.useId(),w=f??m,y=!!(i||e);return t.jsxs(Ks,{children:[t.jsxs(Gs,{htmlFor:w,$disabled:l,children:[t.jsx(Xs,{id:w,ref:o,type:"radio",checked:d,disabled:l,"aria-invalid":!!e,...$}),t.jsx(Js,{$checked:d,$error:e,$disabled:l,$size:n,$color:u,$borderColor:p}),r&&t.jsx(Qs,{$size:n,children:r})]}),y&&t.jsx(Zs,{$error:e,children:i})]})}sr.displayName="Radio";const on=s.div`
|
|
890
|
+
display: flex;
|
|
891
|
+
flex-direction: column;
|
|
892
|
+
gap: ${({theme:o})=>o.spacing[1]};
|
|
893
|
+
`,rn=s.label`
|
|
894
|
+
display: inline-flex;
|
|
895
|
+
align-items: center;
|
|
896
|
+
gap: ${({theme:o})=>o.spacing[2]};
|
|
897
|
+
cursor: ${({$disabled:o})=>o?"not-allowed":"pointer"};
|
|
898
|
+
opacity: ${({$disabled:o})=>o?.6:1};
|
|
899
|
+
`,sn=s.input`
|
|
900
|
+
position: absolute;
|
|
901
|
+
opacity: 0;
|
|
902
|
+
width: 0;
|
|
903
|
+
height: 0;
|
|
904
|
+
margin: 0;
|
|
905
|
+
padding: 0;
|
|
906
|
+
|
|
907
|
+
&:focus-visible + div {
|
|
908
|
+
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
909
|
+
}
|
|
910
|
+
`,nn=s.div`
|
|
911
|
+
position: relative;
|
|
912
|
+
flex-shrink: 0;
|
|
913
|
+
border-radius: 9999px;
|
|
914
|
+
border: ${({theme:o})=>o.brutalism?.borderWidth??"2px"} solid
|
|
915
|
+
${({$borderColor:o,theme:r})=>o??r.colors.neutral[900]};
|
|
916
|
+
background-color: ${({$checked:o,$color:r,theme:n})=>o?r??n.colors.primary[500]:n.colors.neutral[200]};
|
|
917
|
+
transition:
|
|
918
|
+
background-color 0.15s,
|
|
919
|
+
box-shadow 0.15s;
|
|
920
|
+
|
|
921
|
+
${({$checked:o,theme:r})=>o&&s.css`
|
|
922
|
+
box-shadow: ${r.brutalism?.shadowOffset??"4px"}
|
|
923
|
+
${r.brutalism?.shadowOffset??"4px"} 0 ${r.colors.neutral[900]};
|
|
924
|
+
`}
|
|
925
|
+
|
|
926
|
+
${({$size:o="md"})=>({sm:s.css`
|
|
927
|
+
width: 36px;
|
|
928
|
+
height: 20px;
|
|
929
|
+
`,md:s.css`
|
|
930
|
+
width: 44px;
|
|
931
|
+
height: 24px;
|
|
932
|
+
`})[o]}
|
|
933
|
+
|
|
934
|
+
&::after {
|
|
935
|
+
content: "";
|
|
936
|
+
position: absolute;
|
|
937
|
+
top: 50%;
|
|
938
|
+
border-radius: 50%;
|
|
939
|
+
background-color: ${({theme:o})=>o.colors.neutral[0]};
|
|
940
|
+
border: 2px solid ${({theme:o})=>o.colors.neutral[900]};
|
|
941
|
+
transition: transform 0.15s;
|
|
942
|
+
|
|
943
|
+
${({$size:o="md",$checked:r})=>{const n=s.css`
|
|
944
|
+
width: 12px;
|
|
945
|
+
height: 12px;
|
|
946
|
+
margin-top: -6px;
|
|
947
|
+
transform: translateX(${r?"calc(100% + 4px)":"2px"});
|
|
948
|
+
`,e=s.css`
|
|
949
|
+
width: 16px;
|
|
950
|
+
height: 16px;
|
|
951
|
+
margin-top: -8px;
|
|
952
|
+
transform: translateX(${r?"calc(100% + 4px)":"2px"});
|
|
953
|
+
`;return o==="sm"?n:e}}
|
|
954
|
+
}
|
|
955
|
+
`,tn=s.span`
|
|
956
|
+
font-size: ${({$size:o="md",theme:r})=>o==="sm"?r.fontSizes.sm:r.fontSizes.md};
|
|
957
|
+
font-weight: ${({theme:o})=>o.fontWeights.medium};
|
|
958
|
+
`;function nr({ref:o,label:r,size:n="md",disabled:e,checked:i,id:l,color:d,borderColor:f,...u}){const p=a.useId(),$=l??p;return t.jsx(on,{children:t.jsxs(rn,{htmlFor:$,$disabled:e,children:[t.jsx(sn,{id:$,ref:o,type:"checkbox",role:"switch",checked:i,disabled:e,...u}),t.jsx(nn,{$checked:i,$size:n,$color:d,$borderColor:f}),r&&t.jsx(tn,{$size:n,children:r})]})})}nr.displayName="Switch";const en=s.div`
|
|
650
959
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
651
960
|
background: ${({theme:o})=>o.colors.neutral[0]};
|
|
652
961
|
overflow: hidden;
|
|
@@ -661,7 +970,7 @@
|
|
|
661
970
|
border: 1px solid ${r??o.colors.neutral[200]};
|
|
662
971
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
|
663
972
|
`}
|
|
664
|
-
`,
|
|
973
|
+
`,an=s.button`
|
|
665
974
|
width: 100%;
|
|
666
975
|
display: flex;
|
|
667
976
|
align-items: flex-start;
|
|
@@ -681,19 +990,19 @@
|
|
|
681
990
|
${({theme:o,$accentColor:r})=>r??o.colors.primary[500]};
|
|
682
991
|
outline-offset: -2px;
|
|
683
992
|
}
|
|
684
|
-
`,
|
|
993
|
+
`,ln=s.div`
|
|
685
994
|
flex: 1;
|
|
686
995
|
min-width: 0;
|
|
687
|
-
`,
|
|
996
|
+
`,cn=s.span`
|
|
688
997
|
display: block;
|
|
689
998
|
font-size: ${({theme:o})=>o.fontSizes.md};
|
|
690
|
-
font-weight:
|
|
999
|
+
font-weight: ${({theme:o})=>o.fontWeights.semibold};
|
|
691
1000
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
692
|
-
`,
|
|
1001
|
+
`,dn=s.span`
|
|
693
1002
|
display: block;
|
|
694
1003
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
695
1004
|
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
696
|
-
`,
|
|
1005
|
+
`,un=s.div`
|
|
697
1006
|
display: flex;
|
|
698
1007
|
flex-direction: row;
|
|
699
1008
|
align-items: center;
|
|
@@ -705,11 +1014,11 @@
|
|
|
705
1014
|
align-items: flex-start;
|
|
706
1015
|
gap: ${({theme:o})=>o.spacing[2]};
|
|
707
1016
|
}
|
|
708
|
-
`,
|
|
1017
|
+
`,fn=s.div`
|
|
709
1018
|
display: flex;
|
|
710
1019
|
align-items: center;
|
|
711
1020
|
gap: ${({theme:o})=>o.spacing[2]};
|
|
712
|
-
`,
|
|
1021
|
+
`,pn=s.span`
|
|
713
1022
|
display: inline-flex;
|
|
714
1023
|
align-items: center;
|
|
715
1024
|
justify-content: center;
|
|
@@ -717,29 +1026,29 @@
|
|
|
717
1026
|
transition: transform 0.2s ease;
|
|
718
1027
|
transform: ${({$open:o})=>o?"rotate(180deg)":"rotate(0deg)"};
|
|
719
1028
|
color: ${({theme:o,$accentColor:r})=>r??o.colors.neutral[500]};
|
|
720
|
-
|
|
1029
|
+
`,$n=s.div`
|
|
721
1030
|
display: grid;
|
|
722
1031
|
grid-template-rows: ${({$open:o})=>o?"1fr":"0fr"};
|
|
723
1032
|
transition: grid-template-rows 0.2s ease;
|
|
724
|
-
`,
|
|
1033
|
+
`,gn=s.div`
|
|
725
1034
|
overflow: hidden;
|
|
726
|
-
`,
|
|
1035
|
+
`,bn=s.div`
|
|
727
1036
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
728
1037
|
border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
|
|
729
|
-
`;function
|
|
1038
|
+
`;function tr({title:o,children:r,defaultOpen:n=!1,open:e,onToggle:i,subtitle:l,headerActions:d,accentColor:f}){const[u,p]=a.useState(n),$=a.useId(),m=e!==void 0,w=m?e:u,y=()=>{const v=!w;m||p(v),i?.(v)};return t.jsxs(en,{$accentColor:f,children:[t.jsxs(an,{type:"button",$open:w,$accentColor:f,"aria-expanded":w,"aria-controls":$,onClick:y,children:[t.jsxs(ln,{children:[t.jsx(cn,{children:o}),(l||d)&&t.jsxs(un,{children:[l&&t.jsx(dn,{children:l}),d&&t.jsx(fn,{onClick:v=>v.stopPropagation(),children:d})]})]}),t.jsx(pn,{$open:w,$accentColor:f,"aria-hidden":"true",children:t.jsx(Bo,{size:18,strokeWidth:2.5})})]}),t.jsx($n,{$open:w,children:t.jsx(gn,{id:$,role:"region","aria-label":o,children:t.jsx(bn,{children:r})})})]})}tr.displayName="CollapsibleCard";const xn=s.keyframes`
|
|
730
1039
|
to { transform: rotate(360deg); }
|
|
731
|
-
`,
|
|
1040
|
+
`,yn={sm:"16px",md:"24px",lg:"40px"},hn={thin:"2px",normal:"3px",bold:"5px"},mn=s.span`
|
|
732
1041
|
display: inline-block;
|
|
733
1042
|
border-radius: 50%;
|
|
734
|
-
animation: ${
|
|
1043
|
+
animation: ${xn} 0.7s linear infinite;
|
|
735
1044
|
|
|
736
|
-
${({$size:o="md",$weight:r="normal",$color:n,theme:e})=>{const
|
|
737
|
-
width: ${
|
|
738
|
-
height: ${
|
|
739
|
-
border: ${
|
|
740
|
-
border-top-color: ${
|
|
1045
|
+
${({$size:o="md",$weight:r="normal",$color:n,theme:e})=>{const i=yn[o],l=hn[r],d=e.colors.neutral[200],f=n??e.colors.primary[500];return s.css`
|
|
1046
|
+
width: ${i};
|
|
1047
|
+
height: ${i};
|
|
1048
|
+
border: ${l} solid ${d};
|
|
1049
|
+
border-top-color: ${f};
|
|
741
1050
|
`}}
|
|
742
|
-
`;function
|
|
1051
|
+
`;function er({size:o="md",weight:r="normal",color:n,label:e="Loading..."}){return t.jsx(mn,{$size:o,$weight:r,$color:n,role:"status","aria-label":e})}er.displayName="Spinner";const wn=7,Wo=3,Eo=1;function vn({defaultSort:o,defaultPage:r=1}={}){const[n,e]=a.useState(o??null),[i,l]=a.useState(r);return{sort:n,page:i,onSortChange:u=>{e(u),l(1)},onPageChange:u=>{l(u)}}}function kn(o,r){return o?.key!==r?{key:r,direction:"asc"}:o.direction==="asc"?{key:r,direction:"desc"}:null}function Sn({data:o,sort:r,defaultSort:n,onSortChange:e}){const i=r!==void 0,[l,d]=a.useState(n??null),f=i?r??null:l,u=$=>{const m=kn(f,$);return i||d(m),e?.(m),m},p=a.useMemo(()=>i||!f?o:[...o].sort(($,m)=>{const w=$[f.key],y=m[f.key],v=w<y?-1:w>y?1:0;return f.direction==="asc"?v:-v}),[o,f,i]);return{activeSort:f,sortedData:p,handleSort:u}}function jn(o,r){if(r<=wn)return Array.from({length:r},(e,i)=>i+1);const n=[1];o>Wo&&n.push("...");for(let e=Math.max(2,o-Eo);e<=Math.min(r-1,o+Eo);e++)n.push(e);return o<r-Wo+1&&n.push("..."),n.push(r),n}function Cn({data:o,pageSize:r,page:n,defaultPage:e,totalRows:i,onPageChange:l}){const d=n!==void 0,[f,u]=a.useState(e??1),p=d?n:f,$=S=>{d||u(S),l?.(S)},m=d||i!==void 0,w=i??o.length,y=r?Math.max(1,Math.ceil(w/r)):1,v=a.useMemo(()=>{if(!r||m)return o;const S=(p-1)*r;return o.slice(S,S+r)},[o,r,p,m]);return{activePage:p,totalPages:y,displayData:v,handlePageChange:$}}const ir=(o,r)=>o==="sm"?`${r.spacing[1]} ${r.spacing[2]}`:o==="lg"?`${r.spacing[3]} ${r.spacing[4]}`:`${r.spacing[2]} ${r.spacing[3]}`,zn=s.div`
|
|
743
1052
|
width: 100%;
|
|
744
1053
|
|
|
745
1054
|
${({theme:o,$borderColor:r})=>o.brutalism?s.css`
|
|
@@ -758,15 +1067,15 @@
|
|
|
758
1067
|
${({$stickyHeader:o})=>o&&s.css`
|
|
759
1068
|
overflow-y: auto;
|
|
760
1069
|
`}
|
|
761
|
-
`,
|
|
1070
|
+
`,In=s.table`
|
|
762
1071
|
width: 100%;
|
|
763
1072
|
border-collapse: collapse;
|
|
764
1073
|
font-size: ${({$size:o,theme:r})=>({sm:r.fontSizes.sm,md:r.fontSizes.md,lg:r.fontSizes.lg})[o]};
|
|
765
1074
|
|
|
766
1075
|
caption {
|
|
767
|
-
padding:
|
|
1076
|
+
padding: ${({theme:o})=>o.spacing[2]} 0;
|
|
768
1077
|
}
|
|
769
|
-
`,
|
|
1078
|
+
`,Tn=s.thead`
|
|
770
1079
|
${({$stickyHeader:o})=>o&&s.css`
|
|
771
1080
|
position: sticky;
|
|
772
1081
|
top: 0;
|
|
@@ -786,7 +1095,7 @@
|
|
|
786
1095
|
--th-text: ${o.colors.neutral[600]};
|
|
787
1096
|
--th-sep: ${n??o.colors.neutral[300]};
|
|
788
1097
|
`}
|
|
789
|
-
`,
|
|
1098
|
+
`,Dn=s.tbody`
|
|
790
1099
|
${({$rowColor:o})=>o&&s.css`
|
|
791
1100
|
tr {
|
|
792
1101
|
background-color: ${o};
|
|
@@ -806,7 +1115,7 @@
|
|
|
806
1115
|
tr:hover td {
|
|
807
1116
|
background-color: rgba(0, 0, 0, 0.04);
|
|
808
1117
|
}
|
|
809
|
-
`,
|
|
1118
|
+
`,io=s.tr``,Wn=s(io)`
|
|
810
1119
|
cursor: pointer;
|
|
811
1120
|
|
|
812
1121
|
td {
|
|
@@ -823,14 +1132,14 @@
|
|
|
823
1132
|
box-shadow: inset 4px 0 0
|
|
824
1133
|
${({$accentColor:o,theme:r})=>o??r.colors.neutral[900]};
|
|
825
1134
|
}
|
|
826
|
-
`,
|
|
1135
|
+
`,En=s.th`
|
|
827
1136
|
background-color: var(--th-bg);
|
|
828
1137
|
color: var(--th-text);
|
|
829
1138
|
text-align: left;
|
|
830
|
-
font-weight:
|
|
1139
|
+
font-weight: ${({theme:o})=>o.fontWeights.bold};
|
|
831
1140
|
white-space: nowrap;
|
|
832
1141
|
|
|
833
|
-
padding: ${({$size:o,theme:r})=>
|
|
1142
|
+
padding: ${({$size:o,theme:r})=>ir(o,r)};
|
|
834
1143
|
|
|
835
1144
|
${({theme:o,$bordered:r})=>o.brutalism?s.css``:s.css`
|
|
836
1145
|
border-bottom: 2px solid var(--th-sep);
|
|
@@ -841,7 +1150,7 @@
|
|
|
841
1150
|
}
|
|
842
1151
|
`}
|
|
843
1152
|
`}
|
|
844
|
-
`,
|
|
1153
|
+
`,Mn=s.button`
|
|
845
1154
|
display: inline-flex;
|
|
846
1155
|
align-items: center;
|
|
847
1156
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
@@ -850,7 +1159,7 @@
|
|
|
850
1159
|
cursor: pointer;
|
|
851
1160
|
font: inherit;
|
|
852
1161
|
color: inherit;
|
|
853
|
-
font-weight:
|
|
1162
|
+
font-weight: ${({theme:o})=>o.fontWeights.bold};
|
|
854
1163
|
padding: 0;
|
|
855
1164
|
width: 100%;
|
|
856
1165
|
text-align: left;
|
|
@@ -860,12 +1169,12 @@
|
|
|
860
1169
|
outline-offset: 2px;
|
|
861
1170
|
border-radius: 2px;
|
|
862
1171
|
}
|
|
863
|
-
`,
|
|
1172
|
+
`,On=s.span`
|
|
864
1173
|
opacity: 0.5;
|
|
865
1174
|
display: inline-flex;
|
|
866
1175
|
align-items: center;
|
|
867
|
-
`,
|
|
868
|
-
padding: ${({$size:o,theme:r})=>
|
|
1176
|
+
`,ar=s.td`
|
|
1177
|
+
padding: ${({$size:o,theme:r})=>ir(o,r)};
|
|
869
1178
|
|
|
870
1179
|
${({$bordered:o,$borderColor:r,theme:n})=>n.brutalism?s.css`
|
|
871
1180
|
border-bottom: ${n.brutalism.borderWidth} solid
|
|
@@ -883,16 +1192,16 @@
|
|
|
883
1192
|
border-bottom: 1px solid
|
|
884
1193
|
${r??n.colors.neutral[200]};
|
|
885
1194
|
`}
|
|
886
|
-
`,
|
|
1195
|
+
`,Ln=s.td`
|
|
887
1196
|
text-align: center;
|
|
888
1197
|
color: ${({theme:o})=>o.colors.neutral[400]};
|
|
889
1198
|
padding: ${({theme:o})=>`${o.spacing[4]} ${o.spacing[3]}`};
|
|
890
1199
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
891
1200
|
border-bottom: none;
|
|
892
|
-
`,
|
|
1201
|
+
`,Rn=s.keyframes`
|
|
893
1202
|
0% { background-position: -400px 0; }
|
|
894
1203
|
100% { background-position: 400px 0; }
|
|
895
|
-
`,
|
|
1204
|
+
`,Nn=s(ar)``,Pn=s.div`
|
|
896
1205
|
height: 14px;
|
|
897
1206
|
border-radius: 4px;
|
|
898
1207
|
background: linear-gradient(
|
|
@@ -902,8 +1211,8 @@
|
|
|
902
1211
|
${({theme:o})=>o.colors.neutral[200]} 75%
|
|
903
1212
|
);
|
|
904
1213
|
background-size: 800px 100%;
|
|
905
|
-
animation: ${
|
|
906
|
-
`,
|
|
1214
|
+
animation: ${Rn} 1.6s ease-in-out infinite;
|
|
1215
|
+
`,Fn=s.div`
|
|
907
1216
|
display: flex;
|
|
908
1217
|
align-items: center;
|
|
909
1218
|
justify-content: center;
|
|
@@ -916,7 +1225,7 @@
|
|
|
916
1225
|
`:s.css`
|
|
917
1226
|
border-top: 1px solid ${o.colors.neutral[200]};
|
|
918
1227
|
`}
|
|
919
|
-
`,
|
|
1228
|
+
`,xo=s.button`
|
|
920
1229
|
display: inline-flex;
|
|
921
1230
|
align-items: center;
|
|
922
1231
|
justify-content: center;
|
|
@@ -959,17 +1268,17 @@
|
|
|
959
1268
|
outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
|
|
960
1269
|
outline-offset: 2px;
|
|
961
1270
|
}
|
|
962
|
-
`,
|
|
1271
|
+
`,Vn=4;function Bn(o,r){return o?.key!==r?t.jsx(Or,{size:14}):o.direction==="asc"?t.jsx(Rr,{size:14}):t.jsx(Er,{size:14})}function lr({columns:o,data:r,rowKey:n,size:e="md",striped:i,bordered:l,stickyHeader:d,caption:f,emptyMessage:u="No data",loading:p,sort:$,defaultSort:m,onSortChange:w,pageSize:y,page:v,defaultPage:S,totalRows:W,onPageChange:L,onChange:E,onRowClick:g,borderColor:j,headerColor:h,rowColor:x,stripeColor:C,className:I,style:z}){const{activeSort:D,sortedData:P,handleSort:F}=Sn({data:r,sort:$,defaultSort:m,onSortChange:w}),{activePage:O,totalPages:V,displayData:q,handlePageChange:N}=Cn({data:P,pageSize:y,page:v,defaultPage:S,totalRows:W,onPageChange:L}),_=k=>{const M=F(k);E?.({sort:M,page:O})},K=k=>{N(k),E?.({sort:D,page:k})},H=(k,M)=>String(n?k[n]:M),G=!p&&q.length===0,X=y??Vn;return t.jsxs(zn,{$borderColor:j,$stickyHeader:d,className:I,style:z,children:[t.jsxs(In,{$size:e,children:[f&&t.jsx("caption",{children:f}),t.jsx(Tn,{$headerColor:h,$borderColor:j,$stickyHeader:d,children:t.jsx(io,{children:o.map(k=>t.jsx(En,{$size:e,$bordered:l,scope:"col",style:k.width?{width:k.width}:void 0,children:k.sortable?t.jsxs(Mn,{type:"button",onClick:()=>_(k.key),"aria-label":`Sort by ${k.header}${D?.key===k.key?`, ${D.direction}ending`:""}`,children:[k.header,t.jsx(On,{"aria-hidden":"true",children:Bn(D,k.key)})]}):k.header},k.key))})}),t.jsx(Dn,{$striped:i,$rowColor:x,$stripeColor:C,children:p?Array.from({length:X}).map((k,M)=>t.jsx(io,{children:o.map(B=>t.jsx(Nn,{$size:e,$bordered:l,$borderColor:j,children:t.jsx(Pn,{})},B.key))},M)):G?t.jsx("tr",{children:t.jsx(Ln,{colSpan:o.length,children:u})}):q.map((k,M)=>{const B=g?Wn:io;return t.jsx(B,{onClick:g?()=>g(k):void 0,$accentColor:g?j:void 0,children:o.map(A=>t.jsx(ar,{$size:e,$bordered:l,$borderColor:j,children:A.render?A.render(k[A.key],k,M):String(k[A.key]??"")||" "},A.key))},H(k,M))})})]}),y&&V>1&&t.jsxs(Fn,{children:[t.jsx(xo,{type:"button",onClick:()=>K(O-1),disabled:O<=1,"aria-label":"Previous page",children:"←"}),jn(O,V).map((k,M)=>k==="..."?t.jsx("span",{"aria-hidden":"true",style:{padding:"0 4px"},children:"…"},`e${M}`):t.jsx(xo,{type:"button",$active:k===O,onClick:()=>K(k),"aria-label":`Page ${k}`,"aria-current":k===O?"page":void 0,children:k},k)),t.jsx(xo,{type:"button",onClick:()=>K(O+1),disabled:O>=V,"aria-label":"Next page",children:"→"})]})]})}lr.displayName="Table";const An=s.p`
|
|
963
1272
|
margin: 0;
|
|
964
1273
|
font-size: ${({theme:o})=>o.fontSizes.md};
|
|
965
1274
|
color: ${({theme:o})=>o.colors.neutral[600]};
|
|
966
1275
|
line-height: 1.5;
|
|
967
|
-
`,
|
|
1276
|
+
`,_n=s.button`
|
|
968
1277
|
display: inline-flex;
|
|
969
1278
|
align-items: center;
|
|
970
1279
|
justify-content: center;
|
|
971
1280
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
972
|
-
font-weight:
|
|
1281
|
+
font-weight: ${({theme:o})=>o.fontWeights.semibold};
|
|
973
1282
|
cursor: pointer;
|
|
974
1283
|
padding: ${({theme:o})=>o.spacing[2]} ${({theme:o})=>o.spacing[4]};
|
|
975
1284
|
font-size: ${({theme:o})=>o.fontSizes.md};
|
|
@@ -1004,12 +1313,12 @@
|
|
|
1004
1313
|
box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
|
|
1005
1314
|
}
|
|
1006
1315
|
`}
|
|
1007
|
-
`;function
|
|
1316
|
+
`;function ko({open:o,title:r="Are you sure?",message:n,confirmLabel:e="Confirm",cancelLabel:i="Cancel",variant:l="default",size:d="sm",onConfirm:f,onCancel:u}){return t.jsx(wo,{open:o,onClose:u,title:r,size:d,closeOnBackdrop:!1,footer:t.jsxs(t.Fragment,{children:[t.jsx(ao,{variant:"outline",onClick:u,children:i}),l==="danger"?t.jsx(_n,{type:"button",onClick:f,children:e}):t.jsx(ao,{variant:"primary",onClick:f,children:e})]}),children:t.jsx(An,{children:n})})}ko.displayName="ConfirmDialog";const cr=a.createContext(null);function Hn({children:o}){const[r,n]=a.useState(null),e=a.useCallback(d=>new Promise(f=>{n({...d,resolve:f})}),[]),i=()=>{r?.resolve(!0),n(null)},l=()=>{r?.resolve(!1),n(null)};return t.jsxs(cr.Provider,{value:{confirm:e},children:[o,r&&t.jsx(ko,{open:!0,title:r.title,message:r.message,confirmLabel:r.confirmLabel,cancelLabel:r.cancelLabel,variant:r.variant,size:r.size,onConfirm:i,onCancel:l})]})}function Yn(){const o=a.useContext(cr);if(!o)throw new Error("useConfirm must be used within a ConfirmProvider");return o.confirm}const Un=s.div`
|
|
1008
1317
|
position: relative;
|
|
1009
1318
|
display: inline-flex;
|
|
1010
1319
|
flex-direction: column;
|
|
1011
1320
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
1012
|
-
`,
|
|
1321
|
+
`,qn=s.div`
|
|
1013
1322
|
display: flex;
|
|
1014
1323
|
align-items: center;
|
|
1015
1324
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
@@ -1054,19 +1363,19 @@
|
|
|
1054
1363
|
outline: none;
|
|
1055
1364
|
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
1056
1365
|
}
|
|
1057
|
-
`,
|
|
1366
|
+
`,Kn=s.span`
|
|
1058
1367
|
flex: 1;
|
|
1059
1368
|
color: ${({$hasValue:o,theme:r})=>o?r.colors.neutral[900]:r.colors.neutral[400]};
|
|
1060
1369
|
white-space: nowrap;
|
|
1061
1370
|
overflow: hidden;
|
|
1062
1371
|
text-overflow: ellipsis;
|
|
1063
|
-
`,
|
|
1372
|
+
`,Gn=s.span`
|
|
1064
1373
|
display: inline-flex;
|
|
1065
1374
|
align-items: center;
|
|
1066
1375
|
margin-left: ${({theme:o})=>o.spacing[2]};
|
|
1067
1376
|
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
1068
1377
|
flex-shrink: 0;
|
|
1069
|
-
`,
|
|
1378
|
+
`,Xn=s.button`
|
|
1070
1379
|
display: inline-flex;
|
|
1071
1380
|
align-items: center;
|
|
1072
1381
|
margin-left: ${({theme:o})=>o.spacing[2]};
|
|
@@ -1086,10 +1395,10 @@
|
|
|
1086
1395
|
outline-offset: 2px;
|
|
1087
1396
|
border-radius: 2px;
|
|
1088
1397
|
}
|
|
1089
|
-
|
|
1398
|
+
`;s.span`
|
|
1090
1399
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
1091
1400
|
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
1092
|
-
|
|
1401
|
+
`;const Jn=s.div`
|
|
1093
1402
|
position: absolute;
|
|
1094
1403
|
top: calc(100% + 4px);
|
|
1095
1404
|
left: 0;
|
|
@@ -1108,12 +1417,12 @@
|
|
|
1108
1417
|
border: 1px solid ${o.colors.neutral[200]};
|
|
1109
1418
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
1110
1419
|
`}
|
|
1111
|
-
`,
|
|
1420
|
+
`,Qn=s.div`
|
|
1112
1421
|
display: flex;
|
|
1113
1422
|
align-items: center;
|
|
1114
1423
|
justify-content: space-between;
|
|
1115
1424
|
margin-bottom: ${({theme:o})=>o.spacing[3]};
|
|
1116
|
-
`,
|
|
1425
|
+
`,Mo=s.button`
|
|
1117
1426
|
display: inline-flex;
|
|
1118
1427
|
align-items: center;
|
|
1119
1428
|
justify-content: center;
|
|
@@ -1143,24 +1452,24 @@
|
|
|
1143
1452
|
transform: translate(1px, 1px);
|
|
1144
1453
|
}
|
|
1145
1454
|
`}
|
|
1146
|
-
`,
|
|
1147
|
-
font-weight:
|
|
1455
|
+
`,Zn=s.span`
|
|
1456
|
+
font-weight: ${({theme:o})=>o.fontWeights.semibold};
|
|
1148
1457
|
font-size: ${({theme:o})=>o.fontSizes.md};
|
|
1149
1458
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
1150
|
-
`,
|
|
1459
|
+
`,ot=s.div`
|
|
1151
1460
|
display: grid;
|
|
1152
1461
|
grid-template-columns: repeat(7, 1fr);
|
|
1153
|
-
gap:
|
|
1154
|
-
`,
|
|
1462
|
+
gap: ${({theme:o})=>o.spacing[.5]};
|
|
1463
|
+
`,rt=s.span`
|
|
1155
1464
|
display: flex;
|
|
1156
1465
|
align-items: center;
|
|
1157
1466
|
justify-content: center;
|
|
1158
1467
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
1159
|
-
font-weight:
|
|
1468
|
+
font-weight: ${({theme:o})=>o.fontWeights.semibold};
|
|
1160
1469
|
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
1161
1470
|
padding: ${({theme:o})=>o.spacing[1]};
|
|
1162
|
-
margin-bottom:
|
|
1163
|
-
`,
|
|
1471
|
+
margin-bottom: ${({theme:o})=>o.spacing[.5]};
|
|
1472
|
+
`,yo=s.button`
|
|
1164
1473
|
display: flex;
|
|
1165
1474
|
align-items: center;
|
|
1166
1475
|
justify-content: center;
|
|
@@ -1171,15 +1480,15 @@
|
|
|
1171
1480
|
cursor: pointer;
|
|
1172
1481
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
1173
1482
|
padding: ${({theme:o})=>o.spacing[1]};
|
|
1174
|
-
font-weight: ${({$today:o,$selected:r})=>o||r?
|
|
1483
|
+
font-weight: ${({$today:o,$selected:r,$rangeStart:n,$rangeEnd:e,$inRange:i,theme:l})=>o||r||n||e?l.fontWeights.semibold:l.fontWeights.normal};
|
|
1175
1484
|
pointer-events: ${({$currentMonth:o})=>o?"auto":"none"};
|
|
1176
1485
|
|
|
1177
|
-
color: ${({$currentMonth:o,$selected:r,$today:n,theme:
|
|
1486
|
+
color: ${({$currentMonth:o,$selected:r,$today:n,$rangeStart:e,$rangeEnd:i,theme:l})=>o?r||e||i?l.colors.primary.contrast:n?l.colors.primary[500]:l.colors.neutral[900]:l.colors.neutral[300]};
|
|
1178
1487
|
|
|
1179
|
-
background-color: ${({$selected:o,theme:
|
|
1488
|
+
background-color: ${({$selected:o,$rangeStart:r,$rangeEnd:n,$inRange:e,$currentMonth:i,theme:l})=>i?o||r||n?l.colors.primary[500]:e?l.colors.primary[50]:"transparent":"transparent"};
|
|
1180
1489
|
|
|
1181
1490
|
&:hover:not(:disabled) {
|
|
1182
|
-
background-color: ${({$selected:o,theme:
|
|
1491
|
+
background-color: ${({$selected:o,$rangeStart:r,$rangeEnd:n,theme:e})=>o||r||n?e.colors.primary[700]:e.colors.neutral[100]};
|
|
1183
1492
|
}
|
|
1184
1493
|
|
|
1185
1494
|
&:disabled {
|
|
@@ -1192,13 +1501,13 @@
|
|
|
1192
1501
|
outline-offset: 1px;
|
|
1193
1502
|
}
|
|
1194
1503
|
|
|
1195
|
-
${({$selected:o,$today:
|
|
1196
|
-
border: ${
|
|
1197
|
-
${o&&s.css`
|
|
1198
|
-
box-shadow: 2px 2px 0 ${
|
|
1504
|
+
${({$selected:o,$rangeStart:r,$rangeEnd:n,$today:e,theme:i})=>i.brutalism&&(o||r||n||e)&&s.css`
|
|
1505
|
+
border: ${i.brutalism.borderWidth} solid ${i.colors.neutral[900]};
|
|
1506
|
+
${(o||r||n)&&s.css`
|
|
1507
|
+
box-shadow: 2px 2px 0 ${i.colors.neutral[900]};
|
|
1199
1508
|
`}
|
|
1200
1509
|
`}
|
|
1201
|
-
`,
|
|
1510
|
+
`,st=["January","February","March","April","May","June","July","August","September","October","November","December"],nt=["Su","Mo","Tu","We","Th","Fr","Sa"];function Oo(o,r){return new Date(o,r+1,0).getDate()}function tt(o,r){return new Date(o,r,1).getDay()}function so(o,r){return o.getFullYear()===r.getFullYear()&&o.getMonth()===r.getMonth()&&o.getDate()===r.getDate()}function et(o,r,n){if(r){const e=new Date(r.getFullYear(),r.getMonth(),r.getDate());if(o<e)return!0}if(n){const e=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(o>e)return!0}return!1}function Lo(o){return o.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Ro(o){return o.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}function ho(o){if(!o)return null;const r=o.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),e=parseInt(r[1],10),i=parseInt(r[2],10);return isNaN(n)||isNaN(e)||isNaN(i)?null:new Date(n,e-1,i)}function Z(o){const r=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),e=String(o.getDate()).padStart(2,"0");return`${r}-${n}-${e}`}function dr({name:o,label:r,value:n,onChange:e,placeholder:i="Select date...",size:l="md",disabled:d=!1,clearable:f=!1,minDate:u,maxDate:p,formatDate:$,error:m,required:w,helperText:y,mode:v="single",nameFrom:S,nameTo:W,valueFrom:L,valueTo:E}){const g=v==="range",j=ho(n??""),h=ho(L??""),x=ho(E??""),C=new Date,I=()=>g?h??x??C:j??C,[z,D]=a.useState(!1),[P,F]=a.useState(()=>I().getFullYear()),[O,V]=a.useState(()=>I().getMonth()),[q,N]=a.useState("from"),_=a.useRef(null);a.useEffect(()=>{if(!z)return;const b=R=>{_.current&&!_.current.contains(R.target)&&(D(!1),g&&N("from"))};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[z,g]),a.useEffect(()=>{!g&&j&&(F(j.getFullYear()),V(j.getMonth()))},[n,g]),a.useEffect(()=>{g&&h&&(F(h.getFullYear()),V(h.getMonth()))},[L,g]);const H=(()=>{if(!g)return j?$?$(j):Lo(j):"";if(!h&&!x)return"";const b=$??Lo;return h&&x?`${b(h)} - ${b(x)}`:h?`${b(h)} - ...`:""})(),G=g?!!(h||x):!!j,X=b=>{const R=new Date(P,O,b);if(!g){e(o??"",Z(R)),D(!1);return}if(q==="from"){e(S??"",Z(R)),N("to");return}if(!h){e(S??"",Z(R)),N("to");return}if(so(R,h)){e(S??"",""),e(W??"",""),N("from");return}if(R>=h){e(W??"",Z(R)),N("from"),D(!1);return}e(W??"",Z(h)),e(S??"",Z(R)),N("from"),D(!1)},k=b=>{b.stopPropagation(),g?(e(S??"",""),e(W??"",""),N("from")):e(o??"","")},M=()=>{if(d)return;const b=!z;D(b),!b&&g&&N("from")},B=b=>{if((b.key==="Enter"||b.key===" ")&&!d){b.preventDefault();const R=!z;D(R),!R&&g&&N("from")}b.key==="Escape"&&(D(!1),g&&N("from"))},A=()=>{O===0?(V(11),F(b=>b-1)):V(b=>b-1)},oo=()=>{O===11?(V(0),F(b=>b+1)):V(b=>b+1)},no=Oo(P,O),ro=tt(P,O),J=[],fo=Oo(O===0?P-1:P,O===0?11:O-1);for(let b=ro-1;b>=0;b--)J.push({day:fo-b,currentMonth:!1});for(let b=1;b<=no;b++)J.push({day:b,currentMonth:!0});const po=42-J.length;for(let b=1;b<=po;b++)J.push({day:b,currentMonth:!1});return t.jsx(vo,{label:r,error:m,helperText:y,required:w,children:t.jsxs(Un,{ref:_,children:[t.jsxs(qn,{$size:l,$error:!!m,$disabled:d,role:"combobox","aria-haspopup":"true","aria-expanded":z,tabIndex:d?-1:0,onClick:M,onKeyDown:B,children:[t.jsx(Kn,{$hasValue:G,children:H||i}),f&&G?t.jsx(Xn,{type:"button",onClick:k,"aria-label":"Clear date",children:t.jsx(uo,{size:14})}):t.jsx(Gn,{"aria-hidden":"true",children:t.jsx(Pr,{size:14})})]}),z&&t.jsxs(Jn,{role:"dialog","aria-label":"Calendar",children:[t.jsxs(Qn,{children:[t.jsx(Mo,{type:"button",onClick:A,"aria-label":"Previous month",children:t.jsx(Br,{size:16})}),t.jsxs(Zn,{children:[st[O]," ",P]}),t.jsx(Mo,{type:"button",onClick:oo,"aria-label":"Next month",children:t.jsx(_r,{size:16})})]}),t.jsxs(ot,{children:[nt.map(b=>t.jsx(rt,{children:b},b)),J.map((b,R)=>{if(!b.currentMonth)return t.jsx(yo,{type:"button",$currentMonth:!1,$selected:!1,$today:!1,disabled:!0,tabIndex:-1,children:b.day},R);const c=new Date(P,O,b.day),T=so(c,C),Y=et(c,u,p);if(g){const So=h?so(c,h):!1,jo=x?so(c,x):!1,ur=h&&x?c>h&&c<x:!1;return t.jsx(yo,{type:"button",$currentMonth:!0,$selected:!1,$today:T,$rangeStart:So,$rangeEnd:jo,$inRange:ur,disabled:Y,"aria-label":Ro(c),"aria-pressed":So||jo,onClick:()=>X(b.day),children:b.day},R)}const to=j?so(c,j):!1;return t.jsx(yo,{type:"button",$currentMonth:!0,$selected:to,$today:T,disabled:Y,"aria-label":Ro(c),"aria-pressed":to,onClick:()=>X(b.day),children:b.day},R)})]})]})]})})}dr.displayName="DatePicker";function it(o){const r=parseInt(o.slice(1,3),16)/255,n=parseInt(o.slice(3,5),16)/255,e=parseInt(o.slice(5,7),16)/255,i=d=>d<=.03928?d/12.92:((d+.055)/1.055)**2.4;return .2126*i(r)+.7152*i(n)+.0722*i(e)>.179?"#111111":"#ffffff"}const lo={colors:{primary:{50:"#fffde6",500:"#ffd000",700:"#ffd000",contrast:"#111111"},neutral:{0:"#ffffff",100:"#f5f0e8",200:"#e8e3db",300:"#ccc8c0",400:"#a8a49c",500:"#706c64",600:"#3c3830",900:"#111111"},error:{50:"#fff0f0",500:"#ff3333"},success:{50:"#f0fff4",500:"#00cc44"},warning:{50:"#fffbe6",500:"#ff9900"},info:{50:"#f0f0ff",500:"#3333ff"}},spacing:{.5:"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px"},radius:{md:"2px"},zIndex:{modal:1e3,toast:1100},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px"},fontWeights:{normal:"400",medium:"500",semibold:"600",bold:"700"},shadows:{focusRing:"3px 3px 0 #111111"},brutalism:{borderWidth:"2px",shadowOffset:"4px"}};function at(o){return{...lo,colors:{...lo.colors,primary:{50:"#fffff0",500:o,700:o,contrast:it(o)}}}}function lt({theme:o=lo,children:r}){return t.jsx(s.ThemeProvider,{theme:o,children:r})}const ct=s.createGlobalStyle`
|
|
1202
1511
|
*, *::before, *::after {
|
|
1203
1512
|
box-sizing: border-box;
|
|
1204
1513
|
margin: 0;
|
|
@@ -1215,4 +1524,4 @@
|
|
|
1215
1524
|
button, input, select, textarea {
|
|
1216
1525
|
font-family: inherit;
|
|
1217
1526
|
}
|
|
1218
|
-
`;exports.Badge=
|
|
1527
|
+
`;exports.Badge=No;exports.Button=ao;exports.Checkbox=rr;exports.CollapsibleCard=tr;exports.ConfirmDialog=ko;exports.ConfirmProvider=Hn;exports.DatePicker=dr;exports.Editable=_o;exports.Field=Ho;exports.Form=or;exports.FormField=vo;exports.GlobalStyles=ct;exports.Input=Po;exports.Link=mo;exports.Modal=wo;exports.Radio=sr;exports.Select=Ao;exports.Spinner=er;exports.Switch=nr;exports.Table=lr;exports.Textarea=Fo;exports.ThemeProvider=lt;exports.Toast=Qo;exports.ToastProvider=zs;exports.composeValidators=Bs;exports.createNeoBrutalTheme=at;exports.isEmail=Ps;exports.isUrl=Fs;exports.maxLength=Ns;exports.minLength=Rs;exports.neoBrutalTheme=lo;exports.pattern=Vs;exports.required=Ls;exports.useConfirm=Yn;exports.useForm=Os;exports.useTable=vn;exports.useToast=Is;
|