blunt-ui 0.3.0 → 0.3.2
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 +101 -1
- package/dist/components/Badge/Badge.types.d.ts +4 -4
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/DataTable/DataTable.d.ts +5 -0
- package/dist/components/DataTable/DataTable.stories.d.ts +14 -0
- package/dist/components/{EditableTable/EditableTable.types.d.ts → DataTable/DataTable.types.d.ts} +12 -4
- package/dist/components/DataTable/index.d.ts +2 -0
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/Table.stories.d.ts +16 -0
- package/dist/components/Table/Table.types.d.ts +29 -2
- package/dist/components/Table/index.d.ts +3 -1
- package/dist/components/Table/useTable.d.ts +12 -0
- package/dist/components/Table/useTablePagination.d.ts +16 -0
- package/dist/components/Table/useTableSort.d.ts +13 -0
- package/dist/index.cjs +405 -276
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1124 -689
- package/package.json +1 -1
- package/dist/components/EditableTable/EditableTable.d.ts +0 -5
- package/dist/components/EditableTable/index.d.ts +0 -2
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
background: ${
|
|
3
|
-
color: ${
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("styled-components"),l=require("react"),no=require("react-dom"),A=(o,r,n)=>s.css`
|
|
2
|
+
background: ${r};
|
|
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
|
+
`,No=s.span`
|
|
7
7
|
display: inline-flex;
|
|
8
8
|
align-items: center;
|
|
9
9
|
font-weight: 700;
|
|
@@ -15,36 +15,36 @@
|
|
|
15
15
|
text-overflow: ellipsis;
|
|
16
16
|
max-width: 20ch;
|
|
17
17
|
|
|
18
|
-
${({$size:o,theme:
|
|
18
|
+
${({$size:o,theme:r})=>({sm:s.css`
|
|
19
19
|
padding: 2px 8px;
|
|
20
|
-
font-size: ${
|
|
21
|
-
`,md:
|
|
20
|
+
font-size: ${r.fontSizes.xs};
|
|
21
|
+
`,md:s.css`
|
|
22
22
|
padding: 4px 10px;
|
|
23
|
-
font-size: ${
|
|
23
|
+
font-size: ${r.fontSizes.sm};
|
|
24
24
|
`})[o]}
|
|
25
25
|
|
|
26
|
-
${({$variant:o,theme:
|
|
27
|
-
background: ${
|
|
28
|
-
color: ${
|
|
29
|
-
`,neutral:
|
|
30
|
-
background: ${
|
|
31
|
-
color: ${
|
|
32
|
-
`,success:
|
|
33
|
-
background: ${
|
|
34
|
-
color: ${
|
|
35
|
-
`,error:
|
|
36
|
-
background: ${
|
|
37
|
-
color: ${
|
|
38
|
-
`,warning:
|
|
39
|
-
background: ${
|
|
40
|
-
color: ${
|
|
41
|
-
`,info:
|
|
42
|
-
background: ${
|
|
43
|
-
color: ${
|
|
26
|
+
${({$variant:o,theme:r})=>r.brutalism?{primary:A(r,r.colors.primary[500],r.colors.primary.contrast),neutral:A(r,r.colors.neutral[200],r.colors.neutral[900]),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]:{primary:s.css`
|
|
27
|
+
background: ${r.colors.primary[50]};
|
|
28
|
+
color: ${r.colors.primary[500]};
|
|
29
|
+
`,neutral:s.css`
|
|
30
|
+
background: ${r.colors.neutral[200]};
|
|
31
|
+
color: ${r.colors.neutral[600]};
|
|
32
|
+
`,success:s.css`
|
|
33
|
+
background: ${r.colors.success[50]};
|
|
34
|
+
color: ${r.colors.success[500]};
|
|
35
|
+
`,error:s.css`
|
|
36
|
+
background: ${r.colors.error[50]};
|
|
37
|
+
color: ${r.colors.error[500]};
|
|
38
|
+
`,warning:s.css`
|
|
39
|
+
background: ${r.colors.warning[50]};
|
|
40
|
+
color: ${r.colors.warning[500]};
|
|
41
|
+
`,info:s.css`
|
|
42
|
+
background: ${r.colors.info[50]};
|
|
43
|
+
color: ${r.colors.info[500]};
|
|
44
44
|
`}[o]}
|
|
45
|
-
`;function
|
|
46
|
-
background-color: ${
|
|
47
|
-
color: ${
|
|
45
|
+
`;function go({variant:o="primary",size:r="md",children:n,...e}){return t.jsx(No,{$variant:o,$size:r,...e,children:n})}go.displayName="Badge";const Q=(o,r,n)=>s.css`
|
|
46
|
+
background-color: ${r};
|
|
47
|
+
color: ${n};
|
|
48
48
|
border: ${o.brutalism.borderWidth} solid ${o.colors.neutral[900]};
|
|
49
49
|
box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
|
|
50
50
|
0 ${o.colors.neutral[900]};
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
transform: translate(2px, 2px);
|
|
56
56
|
box-shadow: 2px 2px 0 ${o.colors.neutral[900]};
|
|
57
57
|
}
|
|
58
|
-
`,
|
|
58
|
+
`,Lo=s.button`
|
|
59
59
|
display: inline-flex;
|
|
60
60
|
align-items: center;
|
|
61
61
|
justify-content: center;
|
|
@@ -74,51 +74,51 @@
|
|
|
74
74
|
cursor: not-allowed;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
${({$variant:o,theme:
|
|
78
|
-
background-color: ${
|
|
79
|
-
color: ${
|
|
77
|
+
${({$variant:o,theme:r})=>r.brutalism?{primary:Q(r,r.colors.primary[500],r.colors.primary.contrast),secondary:Q(r,r.colors.neutral[100],r.colors.neutral[900]),outline:Q(r,r.colors.neutral[0],r.colors.neutral[900])}[o]:{primary:s.css`
|
|
78
|
+
background-color: ${r.colors.primary[500]};
|
|
79
|
+
color: ${r.colors.neutral[0]};
|
|
80
80
|
border: none;
|
|
81
81
|
&:hover:not(:disabled) {
|
|
82
|
-
background-color: ${
|
|
82
|
+
background-color: ${r.colors.primary[700]};
|
|
83
83
|
}
|
|
84
|
-
`,secondary:
|
|
85
|
-
background-color: ${
|
|
86
|
-
color: ${
|
|
84
|
+
`,secondary:s.css`
|
|
85
|
+
background-color: ${r.colors.neutral[200]};
|
|
86
|
+
color: ${r.colors.neutral[600]};
|
|
87
87
|
border: none;
|
|
88
88
|
&:hover:not(:disabled) {
|
|
89
|
-
background-color: ${
|
|
89
|
+
background-color: ${r.colors.neutral[300]};
|
|
90
90
|
}
|
|
91
|
-
`,outline:
|
|
91
|
+
`,outline:s.css`
|
|
92
92
|
background-color: transparent;
|
|
93
|
-
color: ${
|
|
94
|
-
border: 2px solid ${
|
|
93
|
+
color: ${r.colors.primary[500]};
|
|
94
|
+
border: 2px solid ${r.colors.primary[500]};
|
|
95
95
|
&:hover:not(:disabled) {
|
|
96
|
-
background-color: ${
|
|
96
|
+
background-color: ${r.colors.primary[50]};
|
|
97
97
|
}
|
|
98
98
|
`}[o]}
|
|
99
99
|
|
|
100
|
-
${({$size:o,theme:
|
|
101
|
-
padding: ${
|
|
102
|
-
font-size: ${
|
|
103
|
-
`,md:
|
|
104
|
-
padding: ${
|
|
105
|
-
font-size: ${
|
|
106
|
-
`,lg:
|
|
107
|
-
padding: ${
|
|
108
|
-
font-size: ${
|
|
100
|
+
${({$size:o,theme:r})=>({sm:s.css`
|
|
101
|
+
padding: ${r.spacing[1]} ${r.spacing[3]};
|
|
102
|
+
font-size: ${r.fontSizes.sm};
|
|
103
|
+
`,md:s.css`
|
|
104
|
+
padding: ${r.spacing[2]} ${r.spacing[4]};
|
|
105
|
+
font-size: ${r.fontSizes.md};
|
|
106
|
+
`,lg:s.css`
|
|
107
|
+
padding: ${r.spacing[3]} ${r.spacing[6]};
|
|
108
|
+
font-size: ${r.fontSizes.lg};
|
|
109
109
|
`})[o]}
|
|
110
|
-
`;function
|
|
110
|
+
`;function $o({ref:o,as:r,href:n,variant:e="primary",size:d="md",isLoading:i,disabled:c,children:u,...b}){const p=r??(n?"a":"button");return t.jsx(Lo,{ref:o,as:p,href:n,$variant:e,$size:d,disabled:i||c,...b,children:i?"Loading...":u})}$o.displayName="Button";const Ao=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
|
+
`,Mo=s.label`
|
|
116
116
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
117
117
|
font-weight: ${({theme:o})=>o.brutalism?"700":"500"};
|
|
118
|
-
`,
|
|
118
|
+
`,_o=s.span`
|
|
119
119
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
120
|
-
color: ${({$error:o,theme:
|
|
121
|
-
`,
|
|
120
|
+
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
121
|
+
`,Vo=s.div`
|
|
122
122
|
display: flex;
|
|
123
123
|
align-items: center;
|
|
124
124
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
@@ -126,44 +126,44 @@
|
|
|
126
126
|
border-color 0.2s,
|
|
127
127
|
box-shadow 0.2s;
|
|
128
128
|
|
|
129
|
-
${({$size:o="md",theme:
|
|
130
|
-
padding: ${
|
|
131
|
-
font-size: ${
|
|
132
|
-
`,md:
|
|
133
|
-
padding: ${
|
|
134
|
-
font-size: ${
|
|
135
|
-
`,lg:
|
|
136
|
-
padding: ${
|
|
137
|
-
font-size: ${
|
|
129
|
+
${({$size:o="md",theme:r})=>({sm:s.css`
|
|
130
|
+
padding: ${r.spacing[1]} ${r.spacing[2]};
|
|
131
|
+
font-size: ${r.fontSizes.sm};
|
|
132
|
+
`,md:s.css`
|
|
133
|
+
padding: ${r.spacing[2]} ${r.spacing[3]};
|
|
134
|
+
font-size: ${r.fontSizes.md};
|
|
135
|
+
`,lg:s.css`
|
|
136
|
+
padding: ${r.spacing[3]} ${r.spacing[4]};
|
|
137
|
+
font-size: ${r.fontSizes.lg};
|
|
138
138
|
`})[o]}
|
|
139
139
|
|
|
140
|
-
${({$variant:o="default",theme:
|
|
141
|
-
border: ${
|
|
142
|
-
${
|
|
143
|
-
background-color: ${
|
|
144
|
-
box-shadow: 3px 3px 0 ${
|
|
145
|
-
`:{default:
|
|
146
|
-
border: 1px solid ${
|
|
147
|
-
background-color: ${
|
|
148
|
-
`,outlined:
|
|
149
|
-
border: 2px solid ${
|
|
150
|
-
background-color: ${
|
|
151
|
-
`,filled:
|
|
140
|
+
${({$variant:o="default",theme:r})=>r.brutalism?s.css`
|
|
141
|
+
border: ${r.brutalism.borderWidth} solid
|
|
142
|
+
${r.colors.neutral[900]};
|
|
143
|
+
background-color: ${r.colors.neutral[0]};
|
|
144
|
+
box-shadow: 3px 3px 0 ${r.colors.neutral[900]};
|
|
145
|
+
`:{default:s.css`
|
|
146
|
+
border: 1px solid ${r.colors.neutral[400]};
|
|
147
|
+
background-color: ${r.colors.neutral[0]};
|
|
148
|
+
`,outlined:s.css`
|
|
149
|
+
border: 2px solid ${r.colors.primary[500]};
|
|
150
|
+
background-color: ${r.colors.neutral[0]};
|
|
151
|
+
`,filled:s.css`
|
|
152
152
|
border: 1px solid transparent;
|
|
153
|
-
background-color: ${
|
|
153
|
+
background-color: ${r.colors.neutral[100]};
|
|
154
154
|
`}[o]}
|
|
155
155
|
|
|
156
|
-
${({$error:o,theme:
|
|
157
|
-
border-color: ${
|
|
158
|
-
${
|
|
159
|
-
box-shadow: 3px 3px 0 ${
|
|
156
|
+
${({$error:o,theme:r})=>o&&s.css`
|
|
157
|
+
border-color: ${r.colors.error[500]};
|
|
158
|
+
${r.brutalism&&s.css`
|
|
159
|
+
box-shadow: 3px 3px 0 ${r.colors.error[500]};
|
|
160
160
|
`}
|
|
161
161
|
`}
|
|
162
162
|
|
|
163
163
|
&:focus-within {
|
|
164
164
|
box-shadow: ${({theme:o})=>o.shadows.focusRing};
|
|
165
165
|
}
|
|
166
|
-
`,
|
|
166
|
+
`,Fo=s.input`
|
|
167
167
|
flex: 1;
|
|
168
168
|
border: none;
|
|
169
169
|
outline: none;
|
|
@@ -174,11 +174,11 @@
|
|
|
174
174
|
cursor: not-allowed;
|
|
175
175
|
opacity: 0.6;
|
|
176
176
|
}
|
|
177
|
-
`,
|
|
177
|
+
`,lo=s.div`
|
|
178
178
|
display: inline-flex;
|
|
179
179
|
align-items: center;
|
|
180
180
|
margin: 0 ${({theme:o})=>o.spacing[1]};
|
|
181
|
-
`,
|
|
181
|
+
`,Ko=s.button`
|
|
182
182
|
display: inline-flex;
|
|
183
183
|
align-items: center;
|
|
184
184
|
margin: 0 ${({theme:o})=>o.spacing[1]};
|
|
@@ -191,19 +191,19 @@
|
|
|
191
191
|
&:hover {
|
|
192
192
|
opacity: 0.8;
|
|
193
193
|
}
|
|
194
|
-
`;function
|
|
194
|
+
`;function xo({ref:o,type:r="text",size:n="md",variant:e="default",label:d,helperText:i,error:c,leftElement:u,rightElement:b,clearable:p,onClear:$,fullWidth:w,id:y,value:g,defaultValue:m,onChange:I,...z}){const x=l.useId(),E=y??x,W=`${E}-hint`,[B,h]=l.useState(m??""),v=g!==void 0,k=v?g:B,P=typeof c=="string"?c:void 0,R=!!(i||c),D=O=>{v||h(O.target.value),I?.(O)},N=()=>{v||h(""),$?.()};return t.jsxs(Ao,{$fullWidth:w,children:[d&&t.jsx(Mo,{htmlFor:E,children:d}),t.jsxs(Vo,{$size:n,$variant:e,$error:!!c,children:[u&&t.jsx(lo,{children:u}),t.jsx(Fo,{id:E,ref:o,type:r,value:k,onChange:D,...z,"aria-invalid":!!c,"aria-describedby":R?W:void 0}),p&&k&&t.jsx(Ko,{type:"button",onClick:N,"aria-label":"Clear input",children:"✕"}),b&&t.jsx(lo,{children:b})]}),R&&t.jsx(_o,{id:W,$error:!!c,children:P??i})]})}xo.displayName="Input";const Ho=s.keyframes`
|
|
195
195
|
from { opacity: 0; }
|
|
196
196
|
to { opacity: 1; }
|
|
197
|
-
`,
|
|
197
|
+
`,qo=s.keyframes`
|
|
198
198
|
from { opacity: 1; }
|
|
199
199
|
to { opacity: 0; }
|
|
200
|
-
`,
|
|
200
|
+
`,Yo=s.keyframes`
|
|
201
201
|
from { opacity: 0; transform: scale(0.95) translateY(-8px); }
|
|
202
202
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
203
|
-
`,
|
|
203
|
+
`,Uo=s.keyframes`
|
|
204
204
|
from { opacity: 1; transform: scale(1) translateY(0); }
|
|
205
205
|
to { opacity: 0; transform: scale(0.95) translateY(-8px); }
|
|
206
|
-
`,
|
|
206
|
+
`,Go=s.div`
|
|
207
207
|
position: fixed;
|
|
208
208
|
inset: 0;
|
|
209
209
|
background-color: rgba(0, 0, 0, 0.5);
|
|
@@ -211,9 +211,9 @@
|
|
|
211
211
|
align-items: center;
|
|
212
212
|
justify-content: center;
|
|
213
213
|
z-index: ${({theme:o})=>o.zIndex.modal};
|
|
214
|
-
animation: ${({$closing:o})=>o?
|
|
214
|
+
animation: ${({$closing:o})=>o?qo:Ho} 0.15s ease
|
|
215
215
|
forwards;
|
|
216
|
-
`,
|
|
216
|
+
`,Xo=s.div`
|
|
217
217
|
position: relative;
|
|
218
218
|
background: ${({theme:o})=>o.colors.neutral[0]};
|
|
219
219
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
@@ -222,37 +222,37 @@
|
|
|
222
222
|
display: flex;
|
|
223
223
|
flex-direction: column;
|
|
224
224
|
max-height: 90vh;
|
|
225
|
-
animation: ${({$closing:o})=>o?
|
|
225
|
+
animation: ${({$closing:o})=>o?Uo:Yo} 0.15s ease
|
|
226
226
|
forwards;
|
|
227
227
|
|
|
228
|
-
${({$size:o})=>o==="sm"&&
|
|
228
|
+
${({$size:o})=>o==="sm"&&s.css`
|
|
229
229
|
width: min(400px, 90vw);
|
|
230
230
|
`}
|
|
231
|
-
${({$size:o})=>o==="md"&&
|
|
231
|
+
${({$size:o})=>o==="md"&&s.css`
|
|
232
232
|
width: min(560px, 90vw);
|
|
233
233
|
`}
|
|
234
|
-
${({$size:o})=>o==="lg"&&
|
|
234
|
+
${({$size:o})=>o==="lg"&&s.css`
|
|
235
235
|
width: min(720px, 90vw);
|
|
236
236
|
`}
|
|
237
|
-
${({$size:o})=>o==="fullscreen"&&
|
|
237
|
+
${({$size:o})=>o==="fullscreen"&&s.css`
|
|
238
238
|
width: 100vw;
|
|
239
239
|
height: 100vh;
|
|
240
240
|
max-height: 100vh;
|
|
241
241
|
border-radius: 0;
|
|
242
242
|
`}
|
|
243
|
-
`,
|
|
243
|
+
`,Zo=s.div`
|
|
244
244
|
display: flex;
|
|
245
245
|
align-items: center;
|
|
246
246
|
gap: ${({theme:o})=>o.spacing[2]};
|
|
247
247
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
248
248
|
border-bottom: 1px solid ${({theme:o})=>o.colors.neutral[200]};
|
|
249
249
|
flex-shrink: 0;
|
|
250
|
-
`,
|
|
250
|
+
`,Jo=s.h2`
|
|
251
251
|
flex: 1;
|
|
252
252
|
font-size: ${({theme:o})=>o.fontSizes.lg};
|
|
253
253
|
font-weight: 600;
|
|
254
254
|
margin: 0;
|
|
255
|
-
`,
|
|
255
|
+
`,Qo=s.button`
|
|
256
256
|
display: inline-flex;
|
|
257
257
|
align-items: center;
|
|
258
258
|
justify-content: center;
|
|
@@ -277,11 +277,11 @@
|
|
|
277
277
|
outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
|
|
278
278
|
outline-offset: 2px;
|
|
279
279
|
}
|
|
280
|
-
`,
|
|
280
|
+
`,or=s.div`
|
|
281
281
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
282
282
|
overflow-y: auto;
|
|
283
283
|
flex: 1;
|
|
284
|
-
`,
|
|
284
|
+
`,rr=s.div`
|
|
285
285
|
display: flex;
|
|
286
286
|
align-items: center;
|
|
287
287
|
justify-content: flex-end;
|
|
@@ -289,16 +289,16 @@
|
|
|
289
289
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
290
290
|
border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
|
|
291
291
|
flex-shrink: 0;
|
|
292
|
-
`,
|
|
292
|
+
`,sr=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");function co(o){return Array.from(o.querySelectorAll(sr))}function yo({open:o,onClose:r,title:n,children:e,footer:d,size:i="md",closeOnBackdrop:c=!0,closeOnEscape:u=!0,ariaLabelledBy:b,ariaDescribedBy:p}){const $=l.useRef(null),w=l.useId(),y=b??(n?w:void 0),[g,m]=l.useState(o),[I,z]=l.useState(!1);return l.useEffect(()=>{if(o)m(!0),z(!1);else if(g){z(!0);const x=setTimeout(()=>{m(!1),z(!1)},150);return()=>clearTimeout(x)}},[o,g]),l.useEffect(()=>{if(!o)return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[o]),l.useEffect(()=>{if(!o||!$.current)return;const x=$.current,E=document.activeElement;(co(x)[0]??x).focus();const B=h=>{if(h.key==="Escape"&&u){r();return}if(h.key!=="Tab")return;const v=co(x);if(v.length===0){h.preventDefault();return}const k=v[0],P=v[v.length-1];h.shiftKey?document.activeElement===k&&(h.preventDefault(),P.focus()):document.activeElement===P&&(h.preventDefault(),k.focus())};return document.addEventListener("keydown",B),()=>{document.removeEventListener("keydown",B),E?.focus()}},[o,u,r,g]),g?no.createPortal(t.jsx(Go,{$closing:I,onClick:c?r:void 0,children:t.jsxs(Xo,{ref:$,role:"dialog","aria-modal":"true","aria-labelledby":y,"aria-describedby":p,$size:i,$closing:I,tabIndex:-1,onClick:x=>x.stopPropagation(),children:[t.jsxs(Zo,{children:[n&&t.jsx(Jo,{id:w,children:n}),t.jsx(Qo,{onClick:r,"aria-label":"Close modal",children:"×"})]}),t.jsx(or,{children:e}),d&&t.jsx(rr,{children:d})]})}),document.body):null}yo.displayName="Modal";const ho=(...o)=>o.filter((r,n,e)=>!!r&&r.trim()!==""&&e.indexOf(r)===n).join(" ").trim();const nr=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const tr=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,e)=>e?e.toUpperCase():n.toLowerCase());const uo=o=>{const r=tr(o);return r.charAt(0).toUpperCase()+r.slice(1)};var oo={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 er=o=>{for(const r in o)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},ir=l.createContext({}),ar=()=>l.useContext(ir),lr=l.forwardRef(({color:o,size:r,strokeWidth:n,absoluteStrokeWidth:e,className:d="",children:i,iconNode:c,...u},b)=>{const{size:p=24,strokeWidth:$=2,absoluteStrokeWidth:w=!1,color:y="currentColor",className:g=""}=ar()??{},m=e??w?Number(n??$)*24/Number(r??p):n??$;return l.createElement("svg",{ref:b,...oo,width:r??p??oo.width,height:r??p??oo.height,stroke:o??y,strokeWidth:m,className:ho("lucide",g,d),...!i&&!er(u)&&{"aria-hidden":"true"},...u},[...c.map(([I,z])=>l.createElement(I,z)),...Array.isArray(i)?i:[i]])});const H=(o,r)=>{const n=l.forwardRef(({className:e,...d},i)=>l.createElement(lr,{ref:i,iconNode:r,className:ho(`lucide-${nr(uo(o))}`,`lucide-${o}`,e),...d}));return n.displayName=uo(o),n};const cr=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],dr=H("arrow-down",cr);const ur=[["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"}]],pr=H("arrow-up-down",ur);const fr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],br=H("arrow-up",fr);const gr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],wo=H("chevron-down",gr);const $r=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],vo=H("x",$r),xr=s.keyframes`
|
|
293
293
|
from { opacity: 0; transform: translateY(12px); }
|
|
294
294
|
to { opacity: 1; transform: translateY(0); }
|
|
295
|
-
`,
|
|
295
|
+
`,yr=s.keyframes`
|
|
296
296
|
from { opacity: 0; transform: translateY(-12px); }
|
|
297
297
|
to { opacity: 1; transform: translateY(0); }
|
|
298
|
-
`,
|
|
298
|
+
`,hr=s.keyframes`
|
|
299
299
|
from { opacity: 1; }
|
|
300
300
|
to { opacity: 0; }
|
|
301
|
-
`,
|
|
301
|
+
`,wr=s.div`
|
|
302
302
|
position: fixed;
|
|
303
303
|
z-index: ${({theme:o})=>o.zIndex.toast};
|
|
304
304
|
display: flex;
|
|
@@ -308,58 +308,58 @@
|
|
|
308
308
|
max-width: 400px;
|
|
309
309
|
padding: ${({theme:o})=>`${o.spacing[3]} ${o.spacing[4]}`};
|
|
310
310
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
311
|
-
animation: ${({$closing:o,$position:
|
|
312
|
-
${
|
|
313
|
-
`:
|
|
314
|
-
${
|
|
315
|
-
`:
|
|
316
|
-
${
|
|
311
|
+
animation: ${({$closing:o,$position:r})=>o?s.css`
|
|
312
|
+
${hr} 0.2s ease forwards
|
|
313
|
+
`:r.startsWith("top")?s.css`
|
|
314
|
+
${yr} 0.2s ease forwards
|
|
315
|
+
`:s.css`
|
|
316
|
+
${xr} 0.2s ease forwards
|
|
317
317
|
`};
|
|
318
318
|
|
|
319
|
-
${({$position:o,theme:
|
|
320
|
-
bottom: ${
|
|
321
|
-
right: ${
|
|
322
|
-
`,"bottom-left":
|
|
323
|
-
bottom: ${
|
|
324
|
-
left: ${
|
|
325
|
-
`,"top-right":
|
|
326
|
-
top: ${
|
|
327
|
-
right: ${
|
|
328
|
-
`,"top-left":
|
|
329
|
-
top: ${
|
|
330
|
-
left: ${
|
|
319
|
+
${({$position:o,theme:r})=>({"bottom-right":s.css`
|
|
320
|
+
bottom: ${r.spacing[6]};
|
|
321
|
+
right: ${r.spacing[6]};
|
|
322
|
+
`,"bottom-left":s.css`
|
|
323
|
+
bottom: ${r.spacing[6]};
|
|
324
|
+
left: ${r.spacing[6]};
|
|
325
|
+
`,"top-right":s.css`
|
|
326
|
+
top: ${r.spacing[6]};
|
|
327
|
+
right: ${r.spacing[6]};
|
|
328
|
+
`,"top-left":s.css`
|
|
329
|
+
top: ${r.spacing[6]};
|
|
330
|
+
left: ${r.spacing[6]};
|
|
331
331
|
`})[o]}
|
|
332
|
-
`,
|
|
333
|
-
background: ${
|
|
334
|
-
border: ${o.brutalism.borderWidth} solid ${
|
|
332
|
+
`,Y=(o,r,n)=>s.css`
|
|
333
|
+
background: ${r};
|
|
334
|
+
border: ${o.brutalism.borderWidth} solid ${n};
|
|
335
335
|
box-shadow: ${o.brutalism.shadowOffset} ${o.brutalism.shadowOffset}
|
|
336
|
-
0 ${
|
|
337
|
-
`,
|
|
338
|
-
${({$variant:o,theme:
|
|
339
|
-
background: ${
|
|
340
|
-
border-left: 4px solid ${
|
|
336
|
+
0 ${n};
|
|
337
|
+
`,vr=s(wr)`
|
|
338
|
+
${({$variant:o,theme:r})=>r.brutalism?{success:Y(r,r.colors.success[50],r.colors.success[500]),error:Y(r,r.colors.error[50],r.colors.error[500]),warning:Y(r,r.colors.warning[50],r.colors.warning[500]),info:Y(r,r.colors.info[50],r.colors.info[500])}[o]:{success:s.css`
|
|
339
|
+
background: ${r.colors.success[50]};
|
|
340
|
+
border-left: 4px solid ${r.colors.success[500]};
|
|
341
341
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
342
|
-
`,error:
|
|
343
|
-
background: ${
|
|
344
|
-
border-left: 4px solid ${
|
|
342
|
+
`,error:s.css`
|
|
343
|
+
background: ${r.colors.error[50]};
|
|
344
|
+
border-left: 4px solid ${r.colors.error[500]};
|
|
345
345
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
346
|
-
`,warning:
|
|
347
|
-
background: ${
|
|
348
|
-
border-left: 4px solid ${
|
|
346
|
+
`,warning:s.css`
|
|
347
|
+
background: ${r.colors.warning[50]};
|
|
348
|
+
border-left: 4px solid ${r.colors.warning[500]};
|
|
349
349
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
350
|
-
`,info:
|
|
351
|
-
background: ${
|
|
352
|
-
border-left: 4px solid ${
|
|
350
|
+
`,info:s.css`
|
|
351
|
+
background: ${r.colors.info[50]};
|
|
352
|
+
border-left: 4px solid ${r.colors.info[500]};
|
|
353
353
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
354
354
|
`}[o]}
|
|
355
|
-
`,
|
|
355
|
+
`,kr=s.p`
|
|
356
356
|
flex: 1;
|
|
357
357
|
margin: 0;
|
|
358
358
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
359
359
|
font-weight: ${({theme:o})=>o.brutalism?600:400};
|
|
360
360
|
line-height: 1.5;
|
|
361
361
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
362
|
-
`,
|
|
362
|
+
`,mr=s.button`
|
|
363
363
|
flex-shrink: 0;
|
|
364
364
|
display: inline-flex;
|
|
365
365
|
align-items: center;
|
|
@@ -381,38 +381,37 @@
|
|
|
381
381
|
outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
|
|
382
382
|
outline-offset: 2px;
|
|
383
383
|
}
|
|
384
|
-
`;function
|
|
384
|
+
`;function to({open:o,onClose:r,message:n,variant:e="info",duration:d=4e3,position:i="bottom-right"}){const[c,u]=l.useState(o),[b,p]=l.useState(!1);return l.useEffect(()=>{if(o)u(!0),p(!1);else if(c){p(!0);const $=setTimeout(()=>{u(!1),p(!1)},200);return()=>{clearTimeout($)}}},[o,c]),l.useEffect(()=>{if(!o||d===0)return;const $=setTimeout(r,d);return()=>{clearTimeout($)}},[o,d,r]),c?no.createPortal(t.jsxs(vr,{$position:i,$variant:e,$closing:b,role:"alert","aria-live":"polite",children:[t.jsx(kr,{children:n}),t.jsx(mr,{onClick:r,"aria-label":"Close notification",children:t.jsx(vo,{size:14,strokeWidth:2.5})})]}),document.body):null}to.displayName="Toast";const jr=s.form`
|
|
385
385
|
display: flex;
|
|
386
386
|
flex-direction: column;
|
|
387
387
|
gap: ${({theme:o})=>o.spacing[4]};
|
|
388
|
-
`,
|
|
388
|
+
`,Sr=s.div`
|
|
389
389
|
display: flex;
|
|
390
390
|
flex-direction: column;
|
|
391
391
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
392
|
-
`,
|
|
392
|
+
`,Cr=s.label`
|
|
393
393
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
394
394
|
font-weight: 500;
|
|
395
395
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
396
|
-
`,
|
|
396
|
+
`,zr=s.span`
|
|
397
397
|
color: ${({theme:o})=>o.colors.error[500]};
|
|
398
398
|
margin-left: 2px;
|
|
399
|
-
|
|
400
|
-
`,rs=r.span`
|
|
399
|
+
`,Tr=s.span`
|
|
401
400
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
402
|
-
color: ${({$error:o,theme:
|
|
403
|
-
`;function
|
|
401
|
+
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
402
|
+
`;function ko({onSubmit:o,children:r,...n}){return t.jsx(jr,{onSubmit:e=>{e.preventDefault(),o?.(e)},noValidate:!0,...n,children:r})}ko.displayName="Form";function mo({label:o,error:r,helperText:n,required:e,children:d}){const i=l.useId(),c=`${i}-hint`,u=!!(r||n),b=typeof r=="string"?r:void 0,p=l.isValidElement(d)?l.cloneElement(d,{id:i,...u&&{"aria-describedby":c},...r&&{"aria-invalid":!0}}):d;return t.jsxs(Sr,{children:[o&&t.jsxs(Cr,{htmlFor:i,children:[o,e&&t.jsx(zr,{"aria-hidden":"true",children:" *"})]}),p,u&&t.jsx(Tr,{id:c,$error:!!r,children:b??n})]})}mo.displayName="FormField";const Ir=s.div`
|
|
404
403
|
display: inline-flex;
|
|
405
404
|
flex-direction: column;
|
|
406
405
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
407
406
|
width: ${({$fullWidth:o})=>o?"100%":"auto"};
|
|
408
|
-
`,
|
|
407
|
+
`,Er=s.div`
|
|
409
408
|
position: relative;
|
|
410
409
|
display: flex;
|
|
411
410
|
width: 100%;
|
|
412
|
-
`,
|
|
411
|
+
`,Pr=s.span`
|
|
413
412
|
font-size: ${({theme:o})=>o.fontSizes.xs};
|
|
414
|
-
color: ${({$error:o,theme:
|
|
415
|
-
`,
|
|
413
|
+
color: ${({$error:o,theme:r})=>o?r.colors.error[500]:r.colors.neutral[500]};
|
|
414
|
+
`,Wr=s.select`
|
|
416
415
|
appearance: none;
|
|
417
416
|
width: 100%;
|
|
418
417
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
@@ -423,37 +422,37 @@
|
|
|
423
422
|
border-color 0.2s,
|
|
424
423
|
box-shadow 0.2s;
|
|
425
424
|
|
|
426
|
-
${({$size:o,theme:
|
|
427
|
-
padding: ${
|
|
428
|
-
font-size: ${
|
|
429
|
-
`,md:
|
|
430
|
-
padding: ${
|
|
431
|
-
font-size: ${
|
|
432
|
-
`,lg:
|
|
433
|
-
padding: ${
|
|
434
|
-
font-size: ${
|
|
425
|
+
${({$size:o,theme:r})=>({sm:s.css`
|
|
426
|
+
padding: ${r.spacing[1]} ${r.spacing[2]};
|
|
427
|
+
font-size: ${r.fontSizes.sm};
|
|
428
|
+
`,md:s.css`
|
|
429
|
+
padding: ${r.spacing[2]} ${r.spacing[3]};
|
|
430
|
+
font-size: ${r.fontSizes.md};
|
|
431
|
+
`,lg:s.css`
|
|
432
|
+
padding: ${r.spacing[3]} ${r.spacing[4]};
|
|
433
|
+
font-size: ${r.fontSizes.lg};
|
|
435
434
|
`})[o]}
|
|
436
435
|
|
|
437
436
|
padding-right: 2.5rem;
|
|
438
437
|
|
|
439
|
-
${({$variant:o,theme:
|
|
440
|
-
border: ${
|
|
441
|
-
${
|
|
442
|
-
background-color: ${
|
|
443
|
-
box-shadow: 3px 3px 0 ${
|
|
444
|
-
`:{default:
|
|
445
|
-
border: 1px solid ${
|
|
446
|
-
background-color: ${
|
|
447
|
-
`,outlined:
|
|
448
|
-
border: 2px solid ${
|
|
449
|
-
background-color: ${
|
|
450
|
-
`,filled:
|
|
438
|
+
${({$variant:o,theme:r})=>r.brutalism?s.css`
|
|
439
|
+
border: ${r.brutalism.borderWidth} solid
|
|
440
|
+
${r.colors.neutral[900]};
|
|
441
|
+
background-color: ${r.colors.neutral[0]};
|
|
442
|
+
box-shadow: 3px 3px 0 ${r.colors.neutral[900]};
|
|
443
|
+
`:{default:s.css`
|
|
444
|
+
border: 1px solid ${r.colors.neutral[400]};
|
|
445
|
+
background-color: ${r.colors.neutral[0]};
|
|
446
|
+
`,outlined:s.css`
|
|
447
|
+
border: 2px solid ${r.colors.primary[500]};
|
|
448
|
+
background-color: ${r.colors.neutral[0]};
|
|
449
|
+
`,filled:s.css`
|
|
451
450
|
border: 1px solid transparent;
|
|
452
|
-
background-color: ${
|
|
451
|
+
background-color: ${r.colors.neutral[100]};
|
|
453
452
|
`}[o]}
|
|
454
453
|
|
|
455
|
-
${({$error:o,theme:
|
|
456
|
-
border-color: ${
|
|
454
|
+
${({$error:o,theme:r})=>o&&s.css`
|
|
455
|
+
border-color: ${r.colors.error[500]};
|
|
457
456
|
`}
|
|
458
457
|
|
|
459
458
|
&:focus {
|
|
@@ -465,7 +464,7 @@
|
|
|
465
464
|
cursor: not-allowed;
|
|
466
465
|
opacity: 0.6;
|
|
467
466
|
}
|
|
468
|
-
`,
|
|
467
|
+
`,Br=s.button`
|
|
469
468
|
position: absolute;
|
|
470
469
|
right: ${({theme:o})=>o.spacing[3]};
|
|
471
470
|
top: 50%;
|
|
@@ -487,7 +486,7 @@
|
|
|
487
486
|
outline-offset: 2px;
|
|
488
487
|
border-radius: 2px;
|
|
489
488
|
}
|
|
490
|
-
`,
|
|
489
|
+
`,Or=s.span`
|
|
491
490
|
position: absolute;
|
|
492
491
|
right: ${({theme:o})=>o.spacing[3]};
|
|
493
492
|
top: 50%;
|
|
@@ -496,7 +495,7 @@
|
|
|
496
495
|
display: flex;
|
|
497
496
|
align-items: center;
|
|
498
497
|
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
499
|
-
`;function
|
|
498
|
+
`;function jo({options:o,placeholder:r,size:n="md",variant:e="default",error:d,fullWidth:i,clearable:c,onClear:u,id:b,value:p,defaultValue:$,onChange:w,...y}){const g=l.useId(),m=b??g,I=`${m}-hint`,z=typeof d=="string"?d:void 0,[x,E]=l.useState($??""),W=p!==void 0,B=W?p:x,h=P=>{W||E(P.target.value),w?.(P)},v=()=>{W||E(""),u?.()},k=c&&!!B;return t.jsxs(Ir,{$fullWidth:i,children:[t.jsxs(Er,{children:[t.jsxs(Wr,{id:m,$size:n,$variant:e,$error:!!d,"aria-invalid":!!d,"aria-describedby":z?I:void 0,value:B,onChange:h,...y,children:[r&&t.jsx("option",{value:"",disabled:!0,children:r}),o.map(P=>t.jsx("option",{value:P.value,disabled:P.disabled,children:P.label},P.value))]}),k?t.jsx(Br,{type:"button",onClick:v,"aria-label":"Clear selection",children:t.jsx(vo,{size:14})}):t.jsx(Or,{"aria-hidden":"true",children:t.jsx(wo,{size:14})})]}),z&&t.jsx(Pr,{id:I,$error:!0,children:z})]})}jo.displayName="Select";const Rr=s.a`
|
|
500
499
|
text-decoration: underline;
|
|
501
500
|
text-underline-offset: 2px;
|
|
502
501
|
transition: color 0.15s;
|
|
@@ -507,33 +506,33 @@
|
|
|
507
506
|
border-radius: 2px;
|
|
508
507
|
}
|
|
509
508
|
|
|
510
|
-
${({$variant:o,theme:
|
|
511
|
-
color: ${
|
|
509
|
+
${({$variant:o,theme:r})=>({default:s.css`
|
|
510
|
+
color: ${r.colors.primary[500]};
|
|
512
511
|
&:hover {
|
|
513
|
-
color: ${
|
|
512
|
+
color: ${r.colors.primary[700]};
|
|
514
513
|
}
|
|
515
|
-
`,subtle:
|
|
516
|
-
color: ${
|
|
514
|
+
`,subtle:s.css`
|
|
515
|
+
color: ${r.colors.neutral[500]};
|
|
517
516
|
&:hover {
|
|
518
|
-
color: ${
|
|
517
|
+
color: ${r.colors.neutral[900]};
|
|
519
518
|
}
|
|
520
519
|
`})[o]}
|
|
521
|
-
`;function
|
|
520
|
+
`;function So({variant:o="default",external:r,children:n,...e}){return t.jsx(Rr,{$variant:o,...r&&{target:"_blank",rel:"noreferrer"},...e,children:n})}So.displayName="Link";const Dr=s.div`
|
|
522
521
|
border-radius: ${({theme:o})=>o.radius.md};
|
|
523
522
|
background: ${({theme:o})=>o.colors.neutral[0]};
|
|
524
523
|
overflow: hidden;
|
|
525
524
|
|
|
526
|
-
${({theme:o,$accentColor:
|
|
525
|
+
${({theme:o,$accentColor:r})=>o.brutalism?s.css`
|
|
527
526
|
border: ${o.brutalism.borderWidth} solid
|
|
528
|
-
${
|
|
527
|
+
${r??o.colors.neutral[900]};
|
|
529
528
|
box-shadow: ${o.brutalism.shadowOffset}
|
|
530
529
|
${o.brutalism.shadowOffset} 0
|
|
531
|
-
${
|
|
532
|
-
`:
|
|
533
|
-
border: 1px solid ${
|
|
530
|
+
${r??o.colors.neutral[900]};
|
|
531
|
+
`:s.css`
|
|
532
|
+
border: 1px solid ${r??o.colors.neutral[200]};
|
|
534
533
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
|
535
534
|
`}
|
|
536
|
-
`,
|
|
535
|
+
`,Nr=s.button`
|
|
537
536
|
width: 100%;
|
|
538
537
|
display: flex;
|
|
539
538
|
align-items: flex-start;
|
|
@@ -550,22 +549,22 @@
|
|
|
550
549
|
|
|
551
550
|
&:focus-visible {
|
|
552
551
|
outline: 2px solid
|
|
553
|
-
${({theme:o,$accentColor:
|
|
552
|
+
${({theme:o,$accentColor:r})=>r??o.colors.primary[500]};
|
|
554
553
|
outline-offset: -2px;
|
|
555
554
|
}
|
|
556
|
-
`,
|
|
555
|
+
`,Lr=s.div`
|
|
557
556
|
flex: 1;
|
|
558
557
|
min-width: 0;
|
|
559
|
-
`,
|
|
558
|
+
`,Ar=s.span`
|
|
560
559
|
display: block;
|
|
561
560
|
font-size: ${({theme:o})=>o.fontSizes.md};
|
|
562
561
|
font-weight: 600;
|
|
563
562
|
color: ${({theme:o})=>o.colors.neutral[900]};
|
|
564
|
-
`,
|
|
563
|
+
`,Mr=s.span`
|
|
565
564
|
display: block;
|
|
566
565
|
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
567
566
|
color: ${({theme:o})=>o.colors.neutral[500]};
|
|
568
|
-
|
|
567
|
+
`,_r=s.div`
|
|
569
568
|
display: flex;
|
|
570
569
|
flex-direction: row;
|
|
571
570
|
align-items: center;
|
|
@@ -577,122 +576,247 @@
|
|
|
577
576
|
align-items: flex-start;
|
|
578
577
|
gap: ${({theme:o})=>o.spacing[2]};
|
|
579
578
|
}
|
|
580
|
-
`,
|
|
579
|
+
`,Vr=s.div`
|
|
581
580
|
display: flex;
|
|
582
581
|
align-items: center;
|
|
583
582
|
gap: ${({theme:o})=>o.spacing[2]};
|
|
584
|
-
`,
|
|
583
|
+
`,Fr=s.span`
|
|
585
584
|
display: inline-flex;
|
|
586
585
|
align-items: center;
|
|
587
586
|
justify-content: center;
|
|
588
587
|
flex-shrink: 0;
|
|
589
588
|
transition: transform 0.2s ease;
|
|
590
589
|
transform: ${({$open:o})=>o?"rotate(180deg)":"rotate(0deg)"};
|
|
591
|
-
color: ${({theme:o,$accentColor:
|
|
592
|
-
`,
|
|
590
|
+
color: ${({theme:o,$accentColor:r})=>r??o.colors.neutral[500]};
|
|
591
|
+
`,Kr=s.div`
|
|
593
592
|
display: grid;
|
|
594
593
|
grid-template-rows: ${({$open:o})=>o?"1fr":"0fr"};
|
|
595
594
|
transition: grid-template-rows 0.2s ease;
|
|
596
|
-
`,
|
|
595
|
+
`,Hr=s.div`
|
|
597
596
|
overflow: hidden;
|
|
598
|
-
`,
|
|
597
|
+
`,qr=s.div`
|
|
599
598
|
padding: ${({theme:o})=>o.spacing[4]};
|
|
600
599
|
border-top: 1px solid ${({theme:o})=>o.colors.neutral[200]};
|
|
601
|
-
`;function
|
|
602
|
-
overflow-x: auto;
|
|
600
|
+
`;function Co({title:o,children:r,defaultOpen:n=!1,open:e,onToggle:d,subtitle:i,headerActions:c,accentColor:u}){const[b,p]=l.useState(n),$=l.useId(),w=e!==void 0,y=w?e:b,g=()=>{const m=!y;w||p(m),d?.(m)};return t.jsxs(Dr,{$accentColor:u,children:[t.jsxs(Nr,{type:"button",$open:y,$accentColor:u,"aria-expanded":y,"aria-controls":$,onClick:g,children:[t.jsxs(Lr,{children:[t.jsx(Ar,{children:o}),(i||c)&&t.jsxs(_r,{children:[i&&t.jsx(Mr,{children:i}),c&&t.jsx(Vr,{onClick:m=>m.stopPropagation(),children:c})]})]}),t.jsx(Fr,{$open:y,$accentColor:u,"aria-hidden":"true",children:t.jsx(wo,{size:18,strokeWidth:2.5})})]}),t.jsx(Kr,{$open:y,children:t.jsx(Hr,{id:$,role:"region","aria-label":o,children:t.jsx(qr,{children:r})})})]})}Co.displayName="CollapsibleCard";const zo=l.createContext(null);function Yr({children:o}){const[r,n]=l.useState(null),e=l.useCallback(i=>{n({...i,id:Date.now()})},[]),d=l.useMemo(()=>Object.assign(i=>e(i),{success:(i,c)=>e({...c,message:i,variant:"success"}),error:(i,c)=>e({...c,message:i,variant:"error"}),warning:(i,c)=>e({...c,message:i,variant:"warning"}),info:(i,c)=>e({...c,message:i,variant:"info"})}),[e]);return t.jsxs(zo.Provider,{value:{toast:d},children:[o,r&&t.jsx(to,{open:!0,onClose:()=>n(null),message:r.message,variant:r.variant,duration:r.duration,position:r.position},r.id)]})}function Ur(){const o=l.useContext(zo);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}function Gr({initialValues:o,validate:r,onSubmit:n,onError:e}){const[d,i]=l.useState(o),[c,u]=l.useState({}),[b,p]=l.useState({}),[$,w]=l.useState(!1),y=l.useRef(d);y.current=d;const g=l.useCallback(h=>{if(!r)return{};const v=r(h);return Object.fromEntries(Object.entries(v).filter(([,k])=>k!==void 0))},[r]),m=l.useRef(b);m.current=b;const I=l.useCallback(h=>{const{name:v,value:k}=h.target,P={...y.current,[v]:k};i(P),m.current[v]&&u(g(P))},[g]),z=l.useCallback(h=>{const{name:v}=h.target;p(k=>({...k,[v]:!0})),u(g(y.current))},[g]),x=l.useCallback(h=>{h?.preventDefault();const v=Object.keys(y.current).reduce((R,D)=>({...R,[D]:!0}),{});p(v);const k=g(y.current);if(u(k),Object.keys(k).length>0){e?.(k);return}(async()=>{w(!0);try{await n?.(y.current)}finally{w(!1)}})()},[g,n,e]),E=l.useCallback((h,v)=>{i(k=>({...k,[h]:v}))},[]),W=l.useCallback(()=>{i(o),u({}),p({}),w(!1)},[o]),B=Object.fromEntries(Object.entries(c).filter(([h])=>b[h]));return{values:d,errors:B,touched:b,handleChange:I,handleBlur:z,handleSubmit:x,setFieldValue:E,reset:W,isSubmitting:$}}function Xr(o,r){return o?.key!==r?{key:r,direction:"asc"}:o.direction==="asc"?{key:r,direction:"desc"}:null}function Zr({data:o,sort:r,defaultSort:n,onSortChange:e}){const d=r!==void 0,[i,c]=l.useState(n??null),u=d?r??null:i,b=$=>{const w=Xr(u,$);return d||c(w),e?.(w),w},p=l.useMemo(()=>d||!u?o:[...o].sort(($,w)=>{const y=$[u.key],g=w[u.key],m=y<g?-1:y>g?1:0;return u.direction==="asc"?m:-m}),[o,u,d]);return{activeSort:u,sortedData:p,handleSort:b}}const Jr=7,po=3,fo=1;function Qr(o,r){if(r<=Jr)return Array.from({length:r},(e,d)=>d+1);const n=[1];o>po&&n.push("...");for(let e=Math.max(2,o-fo);e<=Math.min(r-1,o+fo);e++)n.push(e);return o<r-po+1&&n.push("..."),n.push(r),n}function os({data:o,pageSize:r,page:n,defaultPage:e,totalRows:d,onPageChange:i}){const c=n!==void 0,[u,b]=l.useState(e??1),p=c?n:u,$=I=>{c||b(I),i?.(I)},w=c||d!==void 0,y=d??o.length,g=r?Math.max(1,Math.ceil(y/r)):1,m=l.useMemo(()=>{if(!r||w)return o;const I=(p-1)*r;return o.slice(I,I+r)},[o,r,p,w]);return{activePage:p,totalPages:g,displayData:m,handlePageChange:$}}const To=(o,r)=>o==="sm"?`${r.spacing[1]} ${r.spacing[2]}`:o==="lg"?`${r.spacing[3]} ${r.spacing[4]}`:`${r.spacing[2]} ${r.spacing[3]}`,Io=s.div`
|
|
603
601
|
width: 100%;
|
|
604
602
|
|
|
605
|
-
${({theme:o})=>o.brutalism?
|
|
606
|
-
border: ${o.brutalism.borderWidth} solid
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
603
|
+
${({theme:o,$borderColor:r})=>o.brutalism?s.css`
|
|
604
|
+
border: ${o.brutalism.borderWidth} solid
|
|
605
|
+
${r??o.colors.neutral[900]};
|
|
606
|
+
box-shadow: ${o.brutalism.shadowOffset}
|
|
607
|
+
${o.brutalism.shadowOffset} 0
|
|
608
|
+
${r??o.colors.neutral[900]};
|
|
609
|
+
`:s.css`
|
|
610
|
+
border: 1px solid ${r??o.colors.neutral[300]};
|
|
611
611
|
border-radius: ${o.radius.md};
|
|
612
612
|
overflow: hidden;
|
|
613
613
|
`}
|
|
614
|
-
|
|
614
|
+
|
|
615
|
+
overflow-x: auto;
|
|
616
|
+
${({$stickyHeader:o})=>o&&s.css`
|
|
617
|
+
overflow-y: auto;
|
|
618
|
+
`}
|
|
619
|
+
`,Eo=s.table`
|
|
615
620
|
width: 100%;
|
|
616
621
|
border-collapse: collapse;
|
|
617
|
-
font-size: ${({$size:o,theme:
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
622
|
+
font-size: ${({$size:o,theme:r})=>({sm:r.fontSizes.sm,md:r.fontSizes.md,lg:r.fontSizes.lg})[o]};
|
|
623
|
+
|
|
624
|
+
caption {
|
|
625
|
+
padding: 8px 0;
|
|
626
|
+
}
|
|
627
|
+
`,Po=s.thead`
|
|
628
|
+
${({$stickyHeader:o})=>o&&s.css`
|
|
629
|
+
position: sticky;
|
|
630
|
+
top: 0;
|
|
631
|
+
z-index: 1;
|
|
632
|
+
`}
|
|
633
|
+
|
|
634
|
+
${({theme:o,$headerColor:r,$borderColor:n})=>r?s.css`
|
|
635
|
+
--th-bg: ${r};
|
|
636
|
+
--th-text: ${o.colors.neutral[0]};
|
|
637
|
+
--th-sep: rgba(255, 255, 255, 0.25);
|
|
638
|
+
`:o.brutalism?s.css`
|
|
639
|
+
--th-bg: ${o.colors.neutral[900]};
|
|
640
|
+
--th-text: ${o.colors.neutral[0]};
|
|
641
|
+
--th-sep: ${n??o.colors.neutral[600]};
|
|
642
|
+
`:s.css`
|
|
643
|
+
--th-bg: ${o.colors.neutral[100]};
|
|
644
|
+
--th-text: ${o.colors.neutral[600]};
|
|
645
|
+
--th-sep: ${n??o.colors.neutral[300]};
|
|
646
|
+
`}
|
|
647
|
+
`,Wo=s.tbody`
|
|
648
|
+
${({$rowColor:o})=>o&&s.css`
|
|
649
|
+
tr {
|
|
650
|
+
background-color: ${o};
|
|
651
|
+
}
|
|
652
|
+
`}
|
|
653
|
+
|
|
654
|
+
${({$striped:o,theme:r,$stripeColor:n})=>o&&s.css`
|
|
628
655
|
tr:nth-child(even) {
|
|
629
|
-
background-color: ${
|
|
656
|
+
background-color: ${n??r.colors.neutral[100]};
|
|
630
657
|
}
|
|
631
658
|
`}
|
|
632
659
|
|
|
633
660
|
tr:last-child td {
|
|
634
661
|
border-bottom: none;
|
|
635
662
|
}
|
|
636
|
-
`,
|
|
663
|
+
`,K=s.tr``,eo=s.th`
|
|
664
|
+
background-color: var(--th-bg);
|
|
665
|
+
color: var(--th-text);
|
|
637
666
|
text-align: left;
|
|
638
667
|
font-weight: 700;
|
|
639
668
|
white-space: nowrap;
|
|
640
669
|
|
|
641
|
-
${({$size:o,theme:
|
|
642
|
-
padding: ${s.spacing[1]} ${s.spacing[2]};
|
|
643
|
-
`,md:r.css`
|
|
644
|
-
padding: ${s.spacing[2]} ${s.spacing[3]};
|
|
645
|
-
`,lg:r.css`
|
|
646
|
-
padding: ${s.spacing[3]} ${s.spacing[4]};
|
|
647
|
-
`})[o]}
|
|
670
|
+
padding: ${({$size:o,theme:r})=>To(o,r)};
|
|
648
671
|
|
|
649
|
-
${({theme:o})=>o.brutalism?
|
|
650
|
-
border-right: 1px solid
|
|
651
|
-
&:last-child {
|
|
652
|
-
border-right: none;
|
|
653
|
-
}
|
|
654
|
-
`:r.css`
|
|
655
|
-
border-bottom: 2px solid ${o.colors.neutral[300]};
|
|
656
|
-
border-right: 1px solid ${o.colors.neutral[200]};
|
|
672
|
+
${({theme:o,$bordered:r})=>o.brutalism?s.css`
|
|
673
|
+
border-right: 1px solid var(--th-sep);
|
|
657
674
|
&:last-child {
|
|
658
675
|
border-right: none;
|
|
659
676
|
}
|
|
677
|
+
`:s.css`
|
|
678
|
+
border-bottom: 2px solid var(--th-sep);
|
|
679
|
+
${r&&s.css`
|
|
680
|
+
border-right: 1px solid var(--th-sep);
|
|
681
|
+
&:last-child {
|
|
682
|
+
border-right: none;
|
|
683
|
+
}
|
|
684
|
+
`}
|
|
660
685
|
`}
|
|
661
|
-
`,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
686
|
+
`,rs=s.button`
|
|
687
|
+
display: inline-flex;
|
|
688
|
+
align-items: center;
|
|
689
|
+
gap: ${({theme:o})=>o.spacing[1]};
|
|
690
|
+
background: none;
|
|
691
|
+
border: none;
|
|
692
|
+
cursor: pointer;
|
|
693
|
+
font: inherit;
|
|
694
|
+
color: inherit;
|
|
695
|
+
font-weight: 700;
|
|
696
|
+
padding: 0;
|
|
697
|
+
width: 100%;
|
|
698
|
+
text-align: left;
|
|
669
699
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
700
|
+
&:focus-visible {
|
|
701
|
+
outline: 2px solid currentColor;
|
|
702
|
+
outline-offset: 2px;
|
|
703
|
+
border-radius: 2px;
|
|
704
|
+
}
|
|
705
|
+
`,ss=s.span`
|
|
706
|
+
opacity: 0.5;
|
|
707
|
+
display: inline-flex;
|
|
708
|
+
align-items: center;
|
|
709
|
+
`,G=s.td`
|
|
710
|
+
padding: ${({$size:o,theme:r})=>To(o,r)};
|
|
711
|
+
|
|
712
|
+
${({$bordered:o,$borderColor:r,theme:n})=>n.brutalism?s.css`
|
|
713
|
+
border-bottom: ${n.brutalism.borderWidth} solid
|
|
714
|
+
${r??n.colors.neutral[900]};
|
|
715
|
+
${o&&s.css`
|
|
716
|
+
border-right: ${n.brutalism.borderWidth} solid
|
|
717
|
+
${r??n.colors.neutral[900]};
|
|
676
718
|
&:last-child {
|
|
677
719
|
border-right: none;
|
|
678
720
|
}
|
|
679
721
|
`}
|
|
680
|
-
`:o
|
|
681
|
-
border: 1px solid ${
|
|
682
|
-
`:
|
|
683
|
-
border-bottom: 1px solid
|
|
722
|
+
`:o?s.css`
|
|
723
|
+
border: 1px solid ${r??n.colors.neutral[300]};
|
|
724
|
+
`:s.css`
|
|
725
|
+
border-bottom: 1px solid
|
|
726
|
+
${r??n.colors.neutral[200]};
|
|
684
727
|
`}
|
|
685
|
-
|
|
686
|
-
|
|
728
|
+
`,ns=s.td`
|
|
729
|
+
text-align: center;
|
|
730
|
+
color: ${({theme:o})=>o.colors.neutral[400]};
|
|
731
|
+
padding: ${({theme:o})=>`${o.spacing[4]} ${o.spacing[3]}`};
|
|
732
|
+
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
733
|
+
border-bottom: none;
|
|
734
|
+
`,ts=s.keyframes`
|
|
735
|
+
0% { background-position: -400px 0; }
|
|
736
|
+
100% { background-position: 400px 0; }
|
|
737
|
+
`,es=s(G)``,is=s.div`
|
|
738
|
+
height: 14px;
|
|
739
|
+
border-radius: 4px;
|
|
740
|
+
background: linear-gradient(
|
|
741
|
+
90deg,
|
|
742
|
+
${({theme:o})=>o.colors.neutral[200]} 25%,
|
|
743
|
+
${({theme:o})=>o.colors.neutral[100]} 50%,
|
|
744
|
+
${({theme:o})=>o.colors.neutral[200]} 75%
|
|
745
|
+
);
|
|
746
|
+
background-size: 800px 100%;
|
|
747
|
+
animation: ${ts} 1.6s ease-in-out infinite;
|
|
748
|
+
`,as=s.div`
|
|
749
|
+
display: flex;
|
|
750
|
+
align-items: center;
|
|
751
|
+
justify-content: center;
|
|
752
|
+
gap: ${({theme:o})=>o.spacing[1]};
|
|
753
|
+
padding: ${({theme:o})=>`${o.spacing[2]} ${o.spacing[3]}`};
|
|
754
|
+
|
|
755
|
+
${({theme:o})=>o.brutalism?s.css`
|
|
756
|
+
border-top: ${o.brutalism.borderWidth} solid
|
|
757
|
+
${o.colors.neutral[900]};
|
|
758
|
+
`:s.css`
|
|
759
|
+
border-top: 1px solid ${o.colors.neutral[200]};
|
|
760
|
+
`}
|
|
761
|
+
`,ro=s.button`
|
|
762
|
+
display: inline-flex;
|
|
763
|
+
align-items: center;
|
|
764
|
+
justify-content: center;
|
|
765
|
+
min-width: 32px;
|
|
766
|
+
height: 32px;
|
|
767
|
+
padding: 0 ${({theme:o})=>o.spacing[2]};
|
|
768
|
+
font: inherit;
|
|
769
|
+
font-size: ${({theme:o})=>o.fontSizes.sm};
|
|
770
|
+
cursor: pointer;
|
|
771
|
+
|
|
772
|
+
${({$active:o,theme:r})=>r.brutalism?s.css`
|
|
773
|
+
border: ${r.brutalism.borderWidth} solid
|
|
774
|
+
${r.colors.neutral[900]};
|
|
775
|
+
background: ${o?r.colors.neutral[900]:"transparent"};
|
|
776
|
+
color: ${o?r.colors.neutral[0]:r.colors.neutral[900]};
|
|
777
|
+
box-shadow: ${o?"none":`2px 2px 0 ${r.colors.neutral[900]}`};
|
|
778
|
+
|
|
779
|
+
&:hover:not(:disabled) {
|
|
780
|
+
background: ${o?r.colors.neutral[600]:r.colors.neutral[100]};
|
|
781
|
+
}
|
|
782
|
+
`:s.css`
|
|
783
|
+
border: 1px solid
|
|
784
|
+
${o?r.colors.primary[500]:"transparent"};
|
|
785
|
+
border-radius: ${r.radius.md};
|
|
786
|
+
background: ${o?r.colors.primary[500]:"transparent"};
|
|
787
|
+
color: ${o?r.colors.neutral[0]:r.colors.neutral[600]};
|
|
788
|
+
|
|
789
|
+
&:hover:not(:disabled) {
|
|
790
|
+
background: ${o?r.colors.primary[700]:r.colors.neutral[100]};
|
|
791
|
+
border-color: ${o?r.colors.primary[700]:r.colors.neutral[200]};
|
|
792
|
+
}
|
|
793
|
+
`}
|
|
794
|
+
|
|
795
|
+
&:disabled {
|
|
796
|
+
opacity: 0.4;
|
|
797
|
+
cursor: not-allowed;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
&:focus-visible {
|
|
801
|
+
outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
|
|
802
|
+
outline-offset: 2px;
|
|
803
|
+
}
|
|
804
|
+
`,ls=4;function cs(o,r){return o?.key!==r?t.jsx(pr,{size:14}):o.direction==="asc"?t.jsx(br,{size:14}):t.jsx(dr,{size:14})}function Bo({columns:o,data:r,rowKey:n,size:e="md",striped:d,bordered:i,stickyHeader:c,caption:u,emptyMessage:b="No data",loading:p,sort:$,defaultSort:w,onSortChange:y,pageSize:g,page:m,defaultPage:I,totalRows:z,onPageChange:x,onChange:E,borderColor:W,headerColor:B,rowColor:h,stripeColor:v,className:k,style:P}){const{activeSort:R,sortedData:D,handleSort:N}=Zr({data:r,sort:$,defaultSort:w,onSortChange:y}),{activePage:O,totalPages:M,displayData:_,handlePageChange:X}=os({data:D,pageSize:g,page:m,defaultPage:I,totalRows:z,onPageChange:x}),Z=a=>{const j=N(a);E?.({sort:j,page:O})},V=a=>{X(a),E?.({sort:R,page:a})},J=(a,j)=>String(n?a[n]:j),f=!p&&_.length===0,S=g??ls;return t.jsxs(Io,{$borderColor:W,$stickyHeader:c,className:k,style:P,children:[t.jsxs(Eo,{$size:e,children:[u&&t.jsx("caption",{children:u}),t.jsx(Po,{$headerColor:B,$borderColor:W,$stickyHeader:c,children:t.jsx(K,{children:o.map(a=>t.jsx(eo,{$size:e,$bordered:i,scope:"col",style:a.width?{width:a.width}:void 0,children:a.sortable?t.jsxs(rs,{type:"button",onClick:()=>Z(a.key),"aria-label":`Sort by ${a.header}${R?.key===a.key?`, ${R.direction}ending`:""}`,children:[a.header,t.jsx(ss,{"aria-hidden":"true",children:cs(R,a.key)})]}):a.header},a.key))})}),t.jsx(Wo,{$striped:d,$rowColor:h,$stripeColor:v,children:p?Array.from({length:S}).map((a,j)=>t.jsx(K,{children:o.map(C=>t.jsx(es,{$size:e,$bordered:i,$borderColor:W,children:t.jsx(is,{})},C.key))},j)):f?t.jsx("tr",{children:t.jsx(ns,{colSpan:o.length,children:b})}):_.map((a,j)=>t.jsx(K,{children:o.map(C=>t.jsx(G,{$size:e,$bordered:i,$borderColor:W,children:C.render?C.render(a[C.key],a,j):String(a[C.key]??"")||" "},C.key))},J(a,j)))})]}),g&&M>1&&t.jsxs(as,{children:[t.jsx(ro,{type:"button",onClick:()=>V(O-1),disabled:O<=1,"aria-label":"Previous page",children:"←"}),Qr(O,M).map((a,j)=>a==="..."?t.jsx("span",{"aria-hidden":"true",style:{padding:"0 4px"},children:"…"},`e${j}`):t.jsx(ro,{type:"button",$active:a===O,onClick:()=>V(a),"aria-label":`Page ${a}`,"aria-current":a===O?"page":void 0,children:a},a)),t.jsx(ro,{type:"button",onClick:()=>V(O+1),disabled:O>=M,"aria-label":"Next page",children:"→"})]})]})}Bo.displayName="Table";function ds({defaultSort:o,defaultPage:r=1}={}){const[n,e]=l.useState(o??null),[d,i]=l.useState(r);return{sort:n,page:d,onSortChange:b=>{e(b),i(1)},onPageChange:b=>{i(b)}}}const us=s(Eo)`
|
|
805
|
+
table-layout: fixed;
|
|
806
|
+
`,ps=s(G)`
|
|
807
|
+
${({$editable:o,theme:r})=>o&&s.css`
|
|
687
808
|
cursor: pointer;
|
|
688
809
|
position: relative;
|
|
689
810
|
|
|
690
811
|
&:hover {
|
|
691
|
-
background-color: ${
|
|
812
|
+
background-color: ${r.brutalism?r.colors.neutral[100]:r.colors.primary[50]};
|
|
692
813
|
}
|
|
693
814
|
`}
|
|
694
|
-
`,
|
|
815
|
+
`,Oo=s.css`
|
|
816
|
+
display: block;
|
|
695
817
|
width: 100%;
|
|
818
|
+
min-width: 0;
|
|
819
|
+
box-sizing: border-box;
|
|
696
820
|
border: none;
|
|
697
821
|
outline: none;
|
|
698
822
|
background: transparent;
|
|
@@ -701,24 +825,29 @@
|
|
|
701
825
|
padding: 0;
|
|
702
826
|
margin: 0;
|
|
703
827
|
|
|
704
|
-
${({theme:o})=>o.brutalism?
|
|
828
|
+
${({theme:o})=>o.brutalism?s.css`
|
|
705
829
|
&:focus {
|
|
706
830
|
outline: 2px solid ${o.colors.neutral[900]};
|
|
707
831
|
outline-offset: 1px;
|
|
708
832
|
}
|
|
709
|
-
`:
|
|
833
|
+
`:s.css`
|
|
710
834
|
&:focus {
|
|
711
835
|
box-shadow: ${o.shadows.focusRing};
|
|
712
836
|
}
|
|
713
837
|
`}
|
|
714
|
-
`,
|
|
838
|
+
`,fs=s.input`
|
|
839
|
+
${Oo}
|
|
840
|
+
`,bs=s.select`
|
|
841
|
+
${Oo}
|
|
842
|
+
cursor: pointer;
|
|
843
|
+
`,gs=s(eo)`
|
|
715
844
|
width: 40px;
|
|
716
|
-
|
|
845
|
+
`,$s=s(G)`
|
|
717
846
|
width: 40px;
|
|
718
847
|
text-align: center;
|
|
719
848
|
padding-left: 0;
|
|
720
849
|
padding-right: 0;
|
|
721
|
-
`,
|
|
850
|
+
`,xs=s.button`
|
|
722
851
|
display: inline-flex;
|
|
723
852
|
align-items: center;
|
|
724
853
|
justify-content: center;
|
|
@@ -736,18 +865,18 @@
|
|
|
736
865
|
&:hover {
|
|
737
866
|
color: ${({theme:o})=>o.colors.error[500]};
|
|
738
867
|
|
|
739
|
-
${({theme:o})=>o.brutalism&&
|
|
868
|
+
${({theme:o})=>o.brutalism&&s.css`
|
|
740
869
|
background-color: ${o.colors.error[50]};
|
|
741
870
|
`}
|
|
742
871
|
}
|
|
743
|
-
`,
|
|
744
|
-
${({theme:o})=>o.brutalism?
|
|
872
|
+
`,ys=s.tr`
|
|
873
|
+
${({theme:o})=>o.brutalism?s.css`
|
|
745
874
|
border-top: ${o.brutalism.borderWidth} solid
|
|
746
875
|
${o.colors.neutral[900]};
|
|
747
|
-
`:
|
|
876
|
+
`:s.css`
|
|
748
877
|
border-top: 1px solid ${o.colors.neutral[200]};
|
|
749
878
|
`}
|
|
750
|
-
`,
|
|
879
|
+
`,hs=s.button`
|
|
751
880
|
display: inline-flex;
|
|
752
881
|
align-items: center;
|
|
753
882
|
gap: ${({theme:o})=>o.spacing[1]};
|
|
@@ -769,4 +898,4 @@
|
|
|
769
898
|
outline: 2px solid ${({theme:o})=>o.colors.primary[500]};
|
|
770
899
|
outline-offset: 2px;
|
|
771
900
|
}
|
|
772
|
-
`;function
|
|
901
|
+
`;function so(o,r,n){return typeof o.editable=="function"?o.editable(r,n):!!o.editable}function Ro({columns:o,defaultData:r,data:n,rowKey:e,onChange:d,size:i="md",borderColor:c,headerColor:u,addRowLabel:b="Add row",newRowFactory:p,deletable:$=!1,className:w,style:y}){const g=n!==void 0,[m,I]=l.useState(r??[]),z=g?n:m,[x,E]=l.useState(null),[W,B]=l.useState(""),h=l.useRef(null),v=l.useRef(null);l.useEffect(()=>{if(!x)return;o.find(S=>S.key===x.colKey)?.options?v.current?.focus():(h.current?.focus(),h.current?.select())},[x,o]);const k=l.useCallback(f=>{g||I(f),d?.(f)},[g,d]),P=l.useCallback(()=>p?p():Object.fromEntries(o.map(f=>[f.key,""])),[p,o]),R=l.useCallback(f=>{const S=[];return f.forEach((a,j)=>{o.forEach(C=>{so(C,a,j)&&S.push({rowIndex:j,colKey:C.key})})}),S},[o]),D=(f,S,a)=>{E({rowIndex:f,colKey:S}),B(String(a??""))},N=l.useCallback(()=>{if(!x)return;const{rowIndex:f,colKey:S}=x,a=z.map((j,C)=>C===f?{...j,[S]:W}:j);k(a),E(null)},[x,z,W,k]),O=()=>{E(null),B("")},M=f=>{if(!x)return;f.preventDefault();const{rowIndex:S,colKey:a}=x,j=z.map((T,q)=>q===S?{...T,[a]:W}:T);k(j);const C=R(j),F=C.findIndex(T=>T.rowIndex===S&&T.colKey===a),L=f.shiftKey?F-1:F+1;if(L>=0&&L<C.length){const T=C[L];E(T),B(String(j[T.rowIndex][T.colKey]??""));return}if(!f.shiftKey&&L>=C.length){const T=P(),q=[...j,T];k(q);const io=q.length-1,ao=o.find(Do=>so(Do,T,io));E(ao?{rowIndex:io,colKey:ao.key}:null),B("");return}E(null),B("")},_=f=>{if(f.key==="Enter"){if(o.find(a=>a.key===x?.colKey)?.options){v.current?.showPicker();return}N();return}if(f.key==="Escape"){O();return}f.key==="Tab"&&M(f)},X=()=>k([...z,P()]),Z=f=>{x?.rowIndex===f&&E(null),k(z.filter((S,a)=>a!==f))},V=(f,S)=>String(e?f[e]:S),J=$?o.length+1:o.length;return t.jsx(Io,{$borderColor:c,className:w,style:y,children:t.jsxs(us,{$size:i,children:[t.jsx(Po,{$headerColor:u,$borderColor:c,children:t.jsxs(K,{children:[o.map(f=>t.jsx(eo,{$size:i,scope:"col",style:f.width?{width:f.width}:void 0,children:f.header},f.key)),$&&t.jsx(gs,{$size:i,"aria-label":"Actions"})]})}),t.jsxs(Wo,{children:[z.map((f,S)=>t.jsxs(K,{children:[o.map(a=>{const j=x?.rowIndex===S&&x.colKey===a.key,C=f[a.key],F=so(a,f,S),L=a.options?(a.options.find(T=>T.value===String(C??""))?.label??String(C??""))||" ":a.render?a.render(C,f,S):String(C??"")||" ";return t.jsx(ps,{$size:i,$borderColor:c,$editable:F&&!j,onClick:F&&!j?()=>{a.options?(no.flushSync(()=>D(S,a.key,C)),v.current?.showPicker()):D(S,a.key,C)}:void 0,children:j&&a.options?t.jsx(bs,{ref:v,$size:i,value:W,onChange:T=>B(T.target.value),onBlur:N,onKeyDown:_,"aria-label":`Edit ${a.header}`,children:a.options.map(T=>t.jsx("option",{value:T.value,children:T.label},T.value))}):j?t.jsx(fs,{ref:h,$size:i,value:W,onChange:T=>B(T.target.value),onBlur:N,onKeyDown:_,"aria-label":`Edit ${a.header}`}):L},a.key)}),$&&t.jsx($s,{$size:i,$borderColor:c,children:t.jsx(xs,{type:"button",onClick:()=>Z(S),"aria-label":"Delete row",children:"✕"})})]},V(f,S))),t.jsx(ys,{children:t.jsx("td",{colSpan:J,children:t.jsxs(hs,{type:"button",onClick:X,children:["+ ",b]})})})]})]})})}Ro.displayName="DataTable";const bo={primary:{50:"#f0f8ff",500:"#0070f3",700:"#005bb5"},neutral:{0:"#ffffff",100:"#f5f5f5",200:"#eaeaea",300:"#cacaca",400:"#cccccc",500:"#666666",600:"#333333",900:"#111111"},error:{50:"#fef2f2",500:"#d32f2f"},success:{50:"#f0fdf4",500:"#16a34a"},warning:{50:"#fffbeb",500:"#d97706"},info:{50:"#eff6ff",500:"#2563eb"}},ws={1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px"},vs={md:"6px"},ks={modal:1e3,toast:1100},ms={xs:"12px",sm:"14px",md:"16px",lg:"18px"},js={colors:{...bo,primary:{...bo.primary,contrast:"#ffffff"}},spacing:ws,fontSizes:ms,radius:vs,zIndex:ks,shadows:{focusRing:"0 0 0 2px rgba(0, 112, 243, 0.25)"}};function Ss(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,d=c=>c<=.03928?c/12.92:((c+.055)/1.055)**2.4;return .2126*d(r)+.7152*d(n)+.0722*d(e)>.179?"#111111":"#ffffff"}const U={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:{1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px"},radius:{md:"2px"},zIndex:{modal:1e3,toast:1100},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px"},shadows:{focusRing:"3px 3px 0 #111111"},brutalism:{borderWidth:"2px",shadowOffset:"4px"}};function Cs(o){return{...U,colors:{...U.colors,primary:{50:"#fffff0",500:o,700:o,contrast:Ss(o)}}}}function zs({theme:o=U,children:r}){return t.jsx(s.ThemeProvider,{theme:o,children:r})}exports.Badge=go;exports.Button=$o;exports.CollapsibleCard=Co;exports.DataTable=Ro;exports.Form=ko;exports.FormField=mo;exports.Input=xo;exports.Link=So;exports.Modal=yo;exports.Select=jo;exports.Table=Bo;exports.ThemeProvider=zs;exports.Toast=to;exports.ToastProvider=Yr;exports.createNeoBrutalTheme=Cs;exports.defaultTheme=js;exports.neoBrutalTheme=U;exports.useForm=Gr;exports.useTable=ds;exports.useToast=Ur;
|