@usefui/components 1.6.0 → 1.7.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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +380 -52
- package/dist/index.d.ts +380 -52
- package/dist/index.js +2534 -511
- package/dist/index.mjs +2520 -508
- package/package.json +3 -3
- package/src/__tests__/Avatar.test.tsx +55 -55
- package/src/accordion/Accordion.stories.tsx +6 -4
- package/src/accordion/index.tsx +1 -2
- package/src/avatar/Avatar.stories.tsx +37 -7
- package/src/avatar/index.tsx +90 -19
- package/src/avatar/styles/index.ts +58 -12
- package/src/badge/Badge.stories.tsx +27 -5
- package/src/badge/index.tsx +21 -13
- package/src/badge/styles/index.ts +69 -40
- package/src/button/Button.stories.tsx +40 -27
- package/src/button/index.tsx +13 -9
- package/src/button/styles/index.ts +308 -47
- package/src/card/index.tsx +2 -4
- package/src/checkbox/Checkbox.stories.tsx +72 -33
- package/src/checkbox/index.tsx +8 -6
- package/src/checkbox/styles/index.ts +239 -19
- package/src/collapsible/Collapsible.stories.tsx +6 -4
- package/src/dialog/Dialog.stories.tsx +173 -31
- package/src/dialog/styles/index.ts +15 -8
- package/src/dropdown/Dropdown.stories.tsx +61 -23
- package/src/dropdown/index.tsx +42 -31
- package/src/dropdown/styles/index.ts +30 -19
- package/src/field/Field.stories.tsx +183 -24
- package/src/field/index.tsx +930 -13
- package/src/field/styles/index.ts +246 -14
- package/src/field/types/index.ts +31 -0
- package/src/field/utils/index.ts +201 -0
- package/src/index.ts +2 -1
- package/src/message-bubble/MessageBubble.stories.tsx +59 -12
- package/src/message-bubble/index.tsx +22 -4
- package/src/message-bubble/styles/index.ts +4 -7
- package/src/otp-field/OTPField.stories.tsx +22 -24
- package/src/otp-field/index.tsx +9 -0
- package/src/otp-field/styles/index.ts +114 -16
- package/src/otp-field/types/index.ts +9 -1
- package/src/overlay/styles/index.ts +1 -0
- package/src/ruler/Ruler.stories.tsx +43 -0
- package/src/ruler/constants/index.ts +3 -0
- package/src/ruler/hooks/index.tsx +53 -0
- package/src/ruler/index.tsx +239 -0
- package/src/ruler/styles/index.tsx +154 -0
- package/src/ruler/types/index.ts +17 -0
- package/src/select/Select.stories.tsx +91 -0
- package/src/select/hooks/index.tsx +71 -0
- package/src/select/index.tsx +331 -0
- package/src/select/styles/index.tsx +156 -0
- package/src/shimmer/Shimmer.stories.tsx +6 -4
- package/src/skeleton/index.tsx +7 -6
- package/src/spinner/Spinner.stories.tsx +29 -4
- package/src/spinner/index.tsx +16 -6
- package/src/spinner/styles/index.ts +41 -22
- package/src/switch/Switch.stories.tsx +46 -17
- package/src/switch/index.tsx +5 -8
- package/src/switch/styles/index.ts +45 -45
- package/src/tabs/Tabs.stories.tsx +43 -15
- package/src/text-area/Textarea.stories.tsx +45 -8
- package/src/text-area/index.tsx +9 -6
- package/src/text-area/styles/index.ts +1 -1
- package/src/toggle/Toggle.stories.tsx +6 -4
- package/src/tree/Tree.stories.tsx +6 -4
- package/src/privacy-field/PrivacyField.stories.tsx +0 -29
- package/src/privacy-field/index.tsx +0 -56
- package/src/privacy-field/styles/index.ts +0 -17
package/dist/index.mjs
CHANGED
|
@@ -106,39 +106,158 @@ var ButtonIconStyles = css`
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
`;
|
|
109
|
+
var ButtonSizeStyles = css`
|
|
110
|
+
&[data-size="small"] {
|
|
111
|
+
font-size: var(--fontsize-small-60);
|
|
112
|
+
|
|
113
|
+
gap: var(--measurement-medium-10);
|
|
114
|
+
padding: var(--measurement-medium-10) var(--measurement-medium-30);
|
|
115
|
+
min-width: var(--measurement-medium-60);
|
|
116
|
+
min-height: var(--measurement-medium-60);
|
|
117
|
+
|
|
118
|
+
svg {
|
|
119
|
+
width: var(--fontsize-medium-10);
|
|
120
|
+
height: var(--fontsize-medium-10);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
&[data-size="medium"] {
|
|
124
|
+
padding: var(--measurement-medium-10) var(--measurement-medium-60);
|
|
125
|
+
min-width: var(--measurement-medium-60);
|
|
126
|
+
min-height: var(--measurement-medium-80);
|
|
127
|
+
}
|
|
128
|
+
&[data-size="large"] {
|
|
129
|
+
padding: var(--measurement-medium-10) var(--measurement-medium-60);
|
|
130
|
+
min-width: var(--measurement-medium-60);
|
|
131
|
+
min-height: var(--measurement-medium-90);
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
var ButtonShapeStyles = css`
|
|
135
|
+
&[data-shape="square"] {
|
|
136
|
+
border-radius: 0;
|
|
137
|
+
}
|
|
138
|
+
&[data-shape="smooth"] {
|
|
139
|
+
border-radius: var(--measurement-medium-20);
|
|
140
|
+
}
|
|
141
|
+
&[data-shape="round"] {
|
|
142
|
+
border-radius: var(--measurement-large-90);
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
var ButtonBeforeDefaultStyles = css`
|
|
146
|
+
content: "";
|
|
147
|
+
inset: 0;
|
|
148
|
+
|
|
149
|
+
border-radius: inherit;
|
|
150
|
+
border: var(--measurement-small-10) solid transparent;
|
|
151
|
+
position: absolute;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
|
|
156
|
+
mask-composite: intersect;
|
|
157
|
+
|
|
158
|
+
transition: all ease-in-out 0.2s;
|
|
159
|
+
`;
|
|
109
160
|
var ButtonVariantsStyles = css`
|
|
110
161
|
&[data-variant="primary"] {
|
|
111
|
-
color: var(--body-color)
|
|
162
|
+
color: var(--body-color-alpha-80);
|
|
112
163
|
background-color: var(--font-color);
|
|
164
|
+
background: linear-gradient(
|
|
165
|
+
180deg,
|
|
166
|
+
var(--font-color) 50%,
|
|
167
|
+
var(--font-color-alpha-60) 100%
|
|
168
|
+
);
|
|
169
|
+
background-size: 100% 200%;
|
|
170
|
+
background-position: 0% 50%;
|
|
171
|
+
|
|
172
|
+
::before {
|
|
173
|
+
${ButtonBeforeDefaultStyles}
|
|
174
|
+
border-color: var(--body-color-alpha-20);
|
|
175
|
+
mask-image: linear-gradient(var(--body-color-alpha-90), transparent);
|
|
176
|
+
}
|
|
113
177
|
|
|
114
178
|
&:hover,
|
|
115
179
|
&:focus,
|
|
116
180
|
&:active {
|
|
117
181
|
color: var(--body-color);
|
|
182
|
+
background-position: 0% 25%;
|
|
183
|
+
|
|
184
|
+
::before {
|
|
185
|
+
border-color: var(--body-color-alpha-10);
|
|
186
|
+
}
|
|
118
187
|
}
|
|
119
188
|
}
|
|
120
189
|
&[data-variant="secondary"] {
|
|
121
190
|
color: var(--font-color-alpha-60);
|
|
122
|
-
background-color: transparent;
|
|
123
191
|
border-color: var(--font-color-alpha-10);
|
|
124
192
|
|
|
193
|
+
background-color: var(--body-color);
|
|
194
|
+
background: linear-gradient(
|
|
195
|
+
180deg,
|
|
196
|
+
transparent 50%,
|
|
197
|
+
var(--contrast-color) 100%
|
|
198
|
+
);
|
|
199
|
+
background-size: 100% 200%;
|
|
200
|
+
background-position: 0% 50%;
|
|
201
|
+
|
|
202
|
+
::before {
|
|
203
|
+
${ButtonBeforeDefaultStyles}
|
|
204
|
+
border-color: var(--font-color-alpha-10);
|
|
205
|
+
mask-image: linear-gradient(var(--font-color-alpha-30), transparent);
|
|
206
|
+
}
|
|
207
|
+
|
|
125
208
|
&:hover,
|
|
126
209
|
&:focus,
|
|
127
210
|
&:active {
|
|
128
211
|
color: var(--font-color);
|
|
129
212
|
background-color: var(--font-color-alpha-10);
|
|
213
|
+
background-position: 0% 75%;
|
|
130
214
|
border-color: transparent;
|
|
131
215
|
}
|
|
132
216
|
}
|
|
133
217
|
&[data-variant="tertiary"] {
|
|
134
|
-
color: var(--font-color-alpha-
|
|
218
|
+
color: var(--font-color-alpha-60);
|
|
219
|
+
|
|
135
220
|
background-color: transparent;
|
|
221
|
+
background: linear-gradient(
|
|
222
|
+
-180deg,
|
|
223
|
+
transparent 50%,
|
|
224
|
+
var(--font-color-alpha-10) 100%
|
|
225
|
+
);
|
|
226
|
+
background-size: 100% 200%;
|
|
227
|
+
background-position: 0% 10%;
|
|
136
228
|
|
|
137
229
|
&:hover,
|
|
138
230
|
&:focus,
|
|
139
231
|
&:active {
|
|
140
232
|
color: var(--font-color);
|
|
141
233
|
background-color: var(--font-color-alpha-10);
|
|
234
|
+
background-position: 0% 75%;
|
|
235
|
+
|
|
236
|
+
::before {
|
|
237
|
+
${ButtonBeforeDefaultStyles}
|
|
238
|
+
border-color: var(--font-color-alpha-10);
|
|
239
|
+
mask-image: linear-gradient(var(--font-color-alpha-30), transparent);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
&[data-variant="mono"] {
|
|
244
|
+
color: var(--font-color-alpha-80);
|
|
245
|
+
background-color: var(--contrast-color);
|
|
246
|
+
|
|
247
|
+
::before {
|
|
248
|
+
${ButtonBeforeDefaultStyles}
|
|
249
|
+
border-color: var(--font-color-alpha-10);
|
|
250
|
+
mask-image: linear-gradient(var(--font-color-alpha-30), transparent);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&:hover,
|
|
254
|
+
&:focus,
|
|
255
|
+
&:active {
|
|
256
|
+
color: var(--font-color);
|
|
257
|
+
|
|
258
|
+
::before {
|
|
259
|
+
border-color: var(--font-color-alpha-30);
|
|
260
|
+
}
|
|
142
261
|
}
|
|
143
262
|
}
|
|
144
263
|
&[data-variant="border"] {
|
|
@@ -152,36 +271,213 @@ var ButtonVariantsStyles = css`
|
|
|
152
271
|
color: var(--font-color);
|
|
153
272
|
border-color: var(--font-color-alpha-20);
|
|
154
273
|
}
|
|
274
|
+
|
|
275
|
+
::before {
|
|
276
|
+
${ButtonBeforeDefaultStyles}
|
|
277
|
+
border-color: var(--font-color-alpha-10);
|
|
278
|
+
mask-image: linear-gradient(var(--font-color-alpha-20), transparent);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&[data-variant="accent"] {
|
|
283
|
+
background-color: var(--color-accent);
|
|
284
|
+
background: linear-gradient(
|
|
285
|
+
180deg,
|
|
286
|
+
var(--color-accent) 50%,
|
|
287
|
+
var(--shade-accent-30) 100%
|
|
288
|
+
);
|
|
289
|
+
background-size: 100% 200%;
|
|
290
|
+
background-position: 0% 50%;
|
|
291
|
+
|
|
292
|
+
::before {
|
|
293
|
+
${ButtonBeforeDefaultStyles}
|
|
294
|
+
border-color: var(--shade-accent-10);
|
|
295
|
+
mask-image: linear-gradient(var(--shade-accent-10), transparent);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&:hover,
|
|
299
|
+
&:focus,
|
|
300
|
+
&:active {
|
|
301
|
+
background-color: var(--tint-accent-10);
|
|
302
|
+
|
|
303
|
+
background-position: 0% 75%;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
&[data-variant="meta"] {
|
|
308
|
+
color: var(--alpha-mono-white-80);
|
|
309
|
+
background-color: var(--color-blue);
|
|
310
|
+
background: linear-gradient(
|
|
311
|
+
180deg,
|
|
312
|
+
var(--tint-blue-10) 50%,
|
|
313
|
+
var(--alpha-blue-60) 100%
|
|
314
|
+
);
|
|
315
|
+
background-size: 100% 200%;
|
|
316
|
+
background-position: 0% 50%;
|
|
317
|
+
|
|
318
|
+
::before {
|
|
319
|
+
${ButtonBeforeDefaultStyles}
|
|
320
|
+
border-color: var(--tint-blue-30);
|
|
321
|
+
mask-image: linear-gradient(var(--tint-blue-10), transparent);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
&:hover,
|
|
325
|
+
&:focus,
|
|
326
|
+
&:active {
|
|
327
|
+
color: var(--color-mono-white);
|
|
328
|
+
background-color: var(--shade-blue-10);
|
|
329
|
+
|
|
330
|
+
background-position: 0% 25%;
|
|
331
|
+
|
|
332
|
+
::before {
|
|
333
|
+
border-color: var(--tint-blue-40);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
&[data-variant="hint"] {
|
|
338
|
+
color: var(--alpha-mono-white-80);
|
|
339
|
+
background-color: var(--color-purple);
|
|
340
|
+
background: linear-gradient(
|
|
341
|
+
180deg,
|
|
342
|
+
var(--shade-purple-10) 50%,
|
|
343
|
+
var(--alpha-purple-60) 100%
|
|
344
|
+
);
|
|
345
|
+
background-size: 100% 200%;
|
|
346
|
+
background-position: 0% 50%;
|
|
347
|
+
|
|
348
|
+
::before {
|
|
349
|
+
${ButtonBeforeDefaultStyles}
|
|
350
|
+
border-color: var(--shade-purple-20);
|
|
351
|
+
mask-image: linear-gradient(var(--shade-purple-10), transparent);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&:hover,
|
|
355
|
+
&:focus,
|
|
356
|
+
&:active {
|
|
357
|
+
color: var(--color-mono-white);
|
|
358
|
+
background-color: var(--shade-purple-10);
|
|
359
|
+
|
|
360
|
+
background-position: 0% 25%;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
&[data-variant="success"] {
|
|
364
|
+
color: var(--alpha-mono-white-90);
|
|
365
|
+
background-color: var(--shade-green-30);
|
|
366
|
+
background: linear-gradient(
|
|
367
|
+
180deg,
|
|
368
|
+
var(--shade-green-10) 50%,
|
|
369
|
+
var(--alpha-green-60) 100%
|
|
370
|
+
);
|
|
371
|
+
background-size: 100% 200%;
|
|
372
|
+
background-position: 0% 50%;
|
|
373
|
+
|
|
374
|
+
::before {
|
|
375
|
+
${ButtonBeforeDefaultStyles}
|
|
376
|
+
border-color: var(--shade-green-20);
|
|
377
|
+
mask-image: linear-gradient(var(--shade-green-10), transparent);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
&:hover,
|
|
381
|
+
&:focus,
|
|
382
|
+
&:active {
|
|
383
|
+
color: var(--color-mono-white);
|
|
384
|
+
background-color: var(--shade-green-10);
|
|
385
|
+
|
|
386
|
+
background-position: 0% 75%;
|
|
387
|
+
}
|
|
155
388
|
}
|
|
156
389
|
&[data-variant="danger"] {
|
|
157
|
-
color: var(--
|
|
390
|
+
color: var(--alpha-mono-white-80);
|
|
158
391
|
background-color: var(--color-red);
|
|
392
|
+
background: linear-gradient(
|
|
393
|
+
180deg,
|
|
394
|
+
var(--tint-red-10) 50%,
|
|
395
|
+
var(--alpha-red-60) 100%
|
|
396
|
+
);
|
|
397
|
+
background-size: 100% 200%;
|
|
398
|
+
background-position: 0% 50%;
|
|
399
|
+
|
|
400
|
+
::before {
|
|
401
|
+
${ButtonBeforeDefaultStyles}
|
|
402
|
+
border-color: var(--tint-red-60);
|
|
403
|
+
mask-image: linear-gradient(var(--tint-red-10), transparent);
|
|
404
|
+
}
|
|
159
405
|
|
|
160
406
|
&:hover,
|
|
161
407
|
&:focus,
|
|
162
408
|
&:active {
|
|
409
|
+
color: var(--color-mono-white);
|
|
163
410
|
background-color: var(--shade-red-10);
|
|
411
|
+
background-position: 0% 25%;
|
|
412
|
+
|
|
413
|
+
::before {
|
|
414
|
+
border-color: var(--tint-red-80);
|
|
415
|
+
}
|
|
164
416
|
}
|
|
165
417
|
}
|
|
166
418
|
&[data-variant="warning"] {
|
|
167
|
-
color: var(--
|
|
419
|
+
color: var(--alpha-mono-dark-80);
|
|
168
420
|
background-color: var(--color-orange);
|
|
421
|
+
background: linear-gradient(
|
|
422
|
+
180deg,
|
|
423
|
+
var(--tint-orange-10) 50%,
|
|
424
|
+
var(--alpha-orange-60) 100%
|
|
425
|
+
);
|
|
426
|
+
background-size: 100% 200%;
|
|
427
|
+
background-position: 0% 50%;
|
|
428
|
+
|
|
429
|
+
::before {
|
|
430
|
+
${ButtonBeforeDefaultStyles}
|
|
431
|
+
border-color: var(--tint-orange-30);
|
|
432
|
+
mask-image: linear-gradient(var(--tint-orange-10), transparent);
|
|
433
|
+
}
|
|
169
434
|
|
|
170
435
|
&:hover,
|
|
171
436
|
&:focus,
|
|
172
437
|
&:active {
|
|
438
|
+
color: var(--color-mono-dark);
|
|
173
439
|
background-color: var(--shade-orange-10);
|
|
440
|
+
|
|
441
|
+
background-position: 0% 25%;
|
|
442
|
+
|
|
443
|
+
::before {
|
|
444
|
+
border-color: var(--tint-orange-40);
|
|
445
|
+
}
|
|
174
446
|
}
|
|
175
447
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
448
|
+
|
|
449
|
+
&[data-variant="link"] {
|
|
450
|
+
position: relative;
|
|
451
|
+
border: none;
|
|
452
|
+
padding: 0;
|
|
453
|
+
background-color: transparent;
|
|
454
|
+
min-width: fit-content;
|
|
455
|
+
min-height: var(--measurement-medium-60);
|
|
456
|
+
color: currentColor;
|
|
457
|
+
opacity: 0.6;
|
|
458
|
+
|
|
459
|
+
::before {
|
|
460
|
+
content: "";
|
|
461
|
+
position: absolute;
|
|
462
|
+
width: 0;
|
|
463
|
+
height: var(--measurement-small-30);
|
|
464
|
+
background-color: transparent;
|
|
465
|
+
bottom: calc(var(--measurement-small-80) * -1);
|
|
466
|
+
left: var(--measurement-small-10);
|
|
467
|
+
|
|
468
|
+
transition: all ease-in-out 0.2s;
|
|
469
|
+
transform-origin: left left;
|
|
470
|
+
}
|
|
179
471
|
|
|
180
472
|
&:hover,
|
|
181
473
|
&:focus,
|
|
182
474
|
&:active {
|
|
183
|
-
|
|
184
|
-
|
|
475
|
+
opacity: 1;
|
|
476
|
+
|
|
477
|
+
::before {
|
|
478
|
+
width: calc(100% - var(--measurement-small-10));
|
|
479
|
+
background-color: currentColor;
|
|
480
|
+
}
|
|
185
481
|
}
|
|
186
482
|
}
|
|
187
483
|
&[data-variant="ghost"] {
|
|
@@ -189,8 +485,9 @@ var ButtonVariantsStyles = css`
|
|
|
189
485
|
padding: 0;
|
|
190
486
|
background-color: transparent;
|
|
191
487
|
min-width: fit-content;
|
|
192
|
-
min-height:
|
|
488
|
+
min-height: fit-content;
|
|
193
489
|
color: var(--font-color-alpha-60);
|
|
490
|
+
line-height: 0;
|
|
194
491
|
|
|
195
492
|
&:hover,
|
|
196
493
|
&:focus,
|
|
@@ -199,42 +496,6 @@ var ButtonVariantsStyles = css`
|
|
|
199
496
|
}
|
|
200
497
|
}
|
|
201
498
|
`;
|
|
202
|
-
var ButtonSizeStyles = css`
|
|
203
|
-
&[data-size="small"] {
|
|
204
|
-
font-size: var(--fontsize-small-60);
|
|
205
|
-
|
|
206
|
-
gap: var(--measurement-medium-10);
|
|
207
|
-
padding: var(--measurement-medium-10) var(--measurement-medium-30);
|
|
208
|
-
min-width: var(--measurement-medium-60);
|
|
209
|
-
min-height: var(--measurement-medium-60);
|
|
210
|
-
|
|
211
|
-
svg {
|
|
212
|
-
width: var(--fontsize-medium-10);
|
|
213
|
-
height: var(--fontsize-medium-10);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
&[data-size="medium"] {
|
|
217
|
-
padding: var(--measurement-medium-10) var(--measurement-medium-60);
|
|
218
|
-
min-width: var(--measurement-medium-90);
|
|
219
|
-
min-height: var(--measurement-medium-80);
|
|
220
|
-
}
|
|
221
|
-
&[data-size="large"] {
|
|
222
|
-
padding: var(--measurement-medium-10) var(--measurement-medium-60);
|
|
223
|
-
min-width: var(--measurement-medium-90);
|
|
224
|
-
min-height: var(--measurement-medium-90);
|
|
225
|
-
}
|
|
226
|
-
`;
|
|
227
|
-
var ButtonShapeStyles = css`
|
|
228
|
-
&[data-shape="square"] {
|
|
229
|
-
border-radius: 0;
|
|
230
|
-
}
|
|
231
|
-
&[data-shape="smooth"] {
|
|
232
|
-
border-radius: var(--measurement-medium-20);
|
|
233
|
-
}
|
|
234
|
-
&[data-shape="round"] {
|
|
235
|
-
border-radius: var(--measurement-large-90);
|
|
236
|
-
}
|
|
237
|
-
`;
|
|
238
499
|
var ButtonWrapper = styled.button`
|
|
239
500
|
&[data-raw="false"] {
|
|
240
501
|
${ButtonDefaultStyles}
|
|
@@ -284,7 +545,7 @@ var Button = React2.forwardRef(
|
|
|
284
545
|
name,
|
|
285
546
|
variant = "primary" /* Primary */,
|
|
286
547
|
sizing = "medium" /* Medium */,
|
|
287
|
-
shape = "smooth"
|
|
548
|
+
shape = "smooth" /* Smooth */,
|
|
288
549
|
animation,
|
|
289
550
|
raw,
|
|
290
551
|
rawicon,
|
|
@@ -452,19 +713,19 @@ import React4 from "react";
|
|
|
452
713
|
import styled2, { css as css2 } from "styled-components";
|
|
453
714
|
var AvatarSizesStyles = css2`
|
|
454
715
|
&[data-size="small"] {
|
|
716
|
+
width: var(--measurement-medium-70);
|
|
717
|
+
height: var(--measurement-medium-70);
|
|
718
|
+
min-width: var(--measurement-medium-70);
|
|
719
|
+
min-height: var(--measurement-medium-70);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
&[data-size="medium"] {
|
|
455
723
|
width: var(--measurement-large-10);
|
|
456
724
|
height: var(--measurement-large-10);
|
|
457
725
|
min-width: var(--measurement-large-10);
|
|
458
726
|
min-height: var(--measurement-large-10);
|
|
459
727
|
}
|
|
460
728
|
|
|
461
|
-
&[data-size="medium"] {
|
|
462
|
-
width: var(--measurement-medium-90);
|
|
463
|
-
height: var(--measurement-medium-90);
|
|
464
|
-
min-width: var(--measurement-medium-90);
|
|
465
|
-
min-height: var(--measurement-medium-90);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
729
|
&[data-size="large"] {
|
|
469
730
|
width: var(--measurement-large-20);
|
|
470
731
|
height: var(--measurement-large-20);
|
|
@@ -472,6 +733,26 @@ var AvatarSizesStyles = css2`
|
|
|
472
733
|
min-height: var(--measurement-large-20);
|
|
473
734
|
}
|
|
474
735
|
`;
|
|
736
|
+
var AvatarShapesStyles = css2`
|
|
737
|
+
&[data-shape="square"] {
|
|
738
|
+
border-radius: 0;
|
|
739
|
+
img {
|
|
740
|
+
border-radius: 0;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
&[data-shape="smooth"] {
|
|
744
|
+
border-radius: var(--measurement-medium-30);
|
|
745
|
+
img {
|
|
746
|
+
border-radius: var(--measurement-medium-30);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
&[data-shape="round"] {
|
|
750
|
+
border-radius: 100%;
|
|
751
|
+
img {
|
|
752
|
+
border-radius: 100%;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
`;
|
|
475
756
|
var AvatarStatusesStyles = css2`
|
|
476
757
|
&[data-status="online"] {
|
|
477
758
|
fill: var(--shade-green-10);
|
|
@@ -490,7 +771,7 @@ var AvatarStatusesStyles = css2`
|
|
|
490
771
|
|
|
491
772
|
&[data-status="offline"] {
|
|
492
773
|
fill: var(--body-color);
|
|
493
|
-
stroke: var(--
|
|
774
|
+
stroke: var(--contrast-color);
|
|
494
775
|
}
|
|
495
776
|
`;
|
|
496
777
|
var AvatarWrapper = styled2.div`
|
|
@@ -500,17 +781,18 @@ var AvatarWrapper = styled2.div`
|
|
|
500
781
|
align-items: center;
|
|
501
782
|
justify-content: center;
|
|
502
783
|
|
|
503
|
-
background-color: var(--
|
|
504
|
-
border
|
|
784
|
+
background-color: var(--font-color-alpha-10);
|
|
785
|
+
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
505
786
|
|
|
506
787
|
img {
|
|
507
788
|
width: inherit;
|
|
508
789
|
height: inherit;
|
|
509
790
|
min-width: inherit;
|
|
510
791
|
min-height: inherit;
|
|
511
|
-
border
|
|
792
|
+
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
512
793
|
}
|
|
513
794
|
|
|
795
|
+
${AvatarShapesStyles}
|
|
514
796
|
${AvatarSizesStyles}
|
|
515
797
|
}
|
|
516
798
|
`;
|
|
@@ -520,12 +802,37 @@ var StatusWrapper = styled2.svg`
|
|
|
520
802
|
);
|
|
521
803
|
|
|
522
804
|
position: absolute;
|
|
523
|
-
stroke-width: var(--measurement-small-
|
|
805
|
+
stroke-width: var(--measurement-small-10);
|
|
524
806
|
bottom: var(--status-position);
|
|
525
807
|
right: var(--status-position);
|
|
526
808
|
|
|
527
809
|
${AvatarStatusesStyles}
|
|
528
810
|
`;
|
|
811
|
+
var BadgeWrapper = styled2.div`
|
|
812
|
+
--status-position: calc(
|
|
813
|
+
var(--measurement-medium-10) - (var(--measurement-medium-10) * 2)
|
|
814
|
+
);
|
|
815
|
+
|
|
816
|
+
position: absolute;
|
|
817
|
+
|
|
818
|
+
bottom: var(--status-position);
|
|
819
|
+
right: var(--status-position);
|
|
820
|
+
|
|
821
|
+
width: var(--measurement-medium-60);
|
|
822
|
+
height: var(--measurement-medium-60);
|
|
823
|
+
|
|
824
|
+
background-color: var(--font-color-alpha-10);
|
|
825
|
+
border-radius: 100%;
|
|
826
|
+
|
|
827
|
+
img {
|
|
828
|
+
width: inherit;
|
|
829
|
+
height: inherit;
|
|
830
|
+
min-width: inherit;
|
|
831
|
+
min-height: inherit;
|
|
832
|
+
border-radius: 100%;
|
|
833
|
+
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
834
|
+
}
|
|
835
|
+
`;
|
|
529
836
|
|
|
530
837
|
// src/avatar/index.tsx
|
|
531
838
|
var AvataStatusEnum = /* @__PURE__ */ ((AvataStatusEnum2) => {
|
|
@@ -540,6 +847,7 @@ var Avatar = (props) => {
|
|
|
540
847
|
raw,
|
|
541
848
|
sizing = "medium" /* Medium */,
|
|
542
849
|
status,
|
|
850
|
+
shape = "round" /* Round */,
|
|
543
851
|
src,
|
|
544
852
|
alt,
|
|
545
853
|
children,
|
|
@@ -552,10 +860,11 @@ var Avatar = (props) => {
|
|
|
552
860
|
"data-raw": Boolean(raw),
|
|
553
861
|
"data-size": sizing,
|
|
554
862
|
"data-status": status,
|
|
863
|
+
"data-shape": shape,
|
|
555
864
|
"aria-label": props["aria-label"] ?? `${sizeLabel}-user-avatar`,
|
|
556
865
|
...restProps
|
|
557
866
|
},
|
|
558
|
-
|
|
867
|
+
src && /* @__PURE__ */ React4.createElement(
|
|
559
868
|
"img",
|
|
560
869
|
{
|
|
561
870
|
"aria-label": `${sizeLabel}-user-avatar-image`,
|
|
@@ -564,114 +873,142 @@ var Avatar = (props) => {
|
|
|
564
873
|
}
|
|
565
874
|
),
|
|
566
875
|
children,
|
|
567
|
-
status && /* @__PURE__ */ React4.createElement(
|
|
568
|
-
StatusWrapper,
|
|
569
|
-
{
|
|
570
|
-
role: "img",
|
|
571
|
-
"aria-label": `${sizing}-user-avatar-status`,
|
|
572
|
-
"aria-labelledby": "title desc",
|
|
573
|
-
"data-status": status,
|
|
574
|
-
height: "16",
|
|
575
|
-
width: "16"
|
|
576
|
-
},
|
|
577
|
-
/* @__PURE__ */ React4.createElement("title", null, "Activity status"),
|
|
578
|
-
/* @__PURE__ */ React4.createElement("desc", null, status),
|
|
579
|
-
/* @__PURE__ */ React4.createElement("circle", { role: "presentation", cx: "8", cy: "8", r: "6" })
|
|
580
|
-
)
|
|
876
|
+
status && /* @__PURE__ */ React4.createElement(Avatar.Status, { status })
|
|
581
877
|
);
|
|
582
878
|
};
|
|
583
879
|
Avatar.displayName = "Avatar";
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
880
|
+
var AvatarStatus = (props) => {
|
|
881
|
+
const { status } = props;
|
|
882
|
+
return /* @__PURE__ */ React4.createElement(
|
|
883
|
+
StatusWrapper,
|
|
884
|
+
{
|
|
885
|
+
role: "img",
|
|
886
|
+
"aria-label": `${status}-user-avatar-status`,
|
|
887
|
+
"aria-labelledby": "title desc",
|
|
888
|
+
"data-status": status,
|
|
889
|
+
height: "12",
|
|
890
|
+
width: "12",
|
|
891
|
+
...props
|
|
892
|
+
},
|
|
893
|
+
/* @__PURE__ */ React4.createElement("title", null, "Activity status"),
|
|
894
|
+
/* @__PURE__ */ React4.createElement("desc", null, status),
|
|
895
|
+
/* @__PURE__ */ React4.createElement("circle", { role: "presentation", cx: "6", cy: "6", r: "4" })
|
|
896
|
+
);
|
|
897
|
+
};
|
|
898
|
+
AvatarStatus.displayName = "Avatar.Status";
|
|
899
|
+
var AvatarBadge = (props) => {
|
|
900
|
+
const { src, alt, children } = props;
|
|
901
|
+
return /* @__PURE__ */ React4.createElement(BadgeWrapper, { role: "img", "aria-label": "user-avatar-badge-wrapper", ...props }, src && !children && /* @__PURE__ */ React4.createElement(
|
|
902
|
+
"img",
|
|
903
|
+
{
|
|
904
|
+
"aria-label": "user-avatar-badge",
|
|
905
|
+
alt: alt ?? "user-avatar-badge",
|
|
906
|
+
src
|
|
907
|
+
}
|
|
908
|
+
), !src && children && children);
|
|
909
|
+
};
|
|
910
|
+
AvatarBadge.displayName = "Avatar.Badge";
|
|
911
|
+
Avatar.Status = AvatarStatus;
|
|
912
|
+
Avatar.Badge = AvatarBadge;
|
|
913
|
+
|
|
914
|
+
// src/badge/index.tsx
|
|
915
|
+
import React5 from "react";
|
|
916
|
+
|
|
917
|
+
// src/badge/styles/index.ts
|
|
918
|
+
import styled3, { css as css3 } from "styled-components";
|
|
919
|
+
var BadgeBaseStyles = css3`
|
|
920
|
+
display: flex;
|
|
921
|
+
align-items: center;
|
|
593
922
|
justify-content: center;
|
|
594
923
|
gap: var(--measurement-medium-10);
|
|
924
|
+
|
|
595
925
|
min-width: var(--measurement-medium-60);
|
|
596
926
|
min-height: var(--measurement-medium-60);
|
|
597
927
|
width: fit-content;
|
|
598
928
|
|
|
599
929
|
border: var(--measurement-small-10) solid transparent;
|
|
930
|
+
padding: 0 var(--measurement-medium-30);
|
|
600
931
|
|
|
601
932
|
font-size: var(--fontsize-small-60);
|
|
602
|
-
padding: var(--measurement-medium-10) var(--measurement-medium-30);
|
|
603
933
|
font-weight: 500;
|
|
934
|
+
letter-spacing: calc(
|
|
935
|
+
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
936
|
+
);
|
|
937
|
+
line-height: 0;
|
|
938
|
+
|
|
604
939
|
transition: all ease-in-out 0.2s;
|
|
605
940
|
`;
|
|
606
941
|
var BadgeVariantStyles = css3`
|
|
607
942
|
border: var(--measurement-small-10) solid transparent;
|
|
608
943
|
|
|
609
944
|
&[data-variant="primary"] {
|
|
610
|
-
background-color: var(--font-color);
|
|
611
|
-
color: var(--
|
|
945
|
+
background-color: var(--font-color-alpha-10);
|
|
946
|
+
color: var(--font-color-alpha-80);
|
|
612
947
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
border-color: var(--font-color-alpha-10);
|
|
948
|
+
* {
|
|
949
|
+
color: currentColor !important;
|
|
616
950
|
}
|
|
617
951
|
}
|
|
618
952
|
&[data-variant="secondary"] {
|
|
619
|
-
background-color: var(--
|
|
620
|
-
color: var(--font-color-alpha-
|
|
953
|
+
background-color: var(--contrast-color);
|
|
954
|
+
color: var(--font-color-alpha-80);
|
|
621
955
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
color: var(--font-color);
|
|
956
|
+
* {
|
|
957
|
+
color: currentColor !important;
|
|
625
958
|
}
|
|
626
959
|
}
|
|
627
960
|
&[data-variant="border"] {
|
|
628
961
|
background-color: transparent;
|
|
629
962
|
border-color: var(--font-color-alpha-10);
|
|
630
|
-
color: var(--font-color-alpha-
|
|
963
|
+
color: var(--font-color-alpha-80);
|
|
631
964
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
color: var(--font-color);
|
|
965
|
+
* {
|
|
966
|
+
color: currentColor !important;
|
|
635
967
|
}
|
|
636
968
|
}
|
|
637
|
-
&[data-variant="
|
|
969
|
+
&[data-variant="danger"] {
|
|
638
970
|
background-color: var(--alpha-red-10);
|
|
639
|
-
color: var(--alpha-red-
|
|
971
|
+
border-color: var(--alpha-red-10);
|
|
972
|
+
color: var(--shade-red-20);
|
|
640
973
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
background-color: var(--alpha-red-10);
|
|
644
|
-
color: var(--color-red);
|
|
974
|
+
* {
|
|
975
|
+
color: currentColor !important;
|
|
645
976
|
}
|
|
646
977
|
}
|
|
647
978
|
&[data-variant="warning"] {
|
|
648
979
|
background-color: var(--alpha-orange-10);
|
|
649
|
-
color: var(--alpha-orange-
|
|
980
|
+
border-color: var(--alpha-orange-10);
|
|
981
|
+
color: var(--shade-orange-20);
|
|
650
982
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
background-color: var(--alpha-orange-10);
|
|
654
|
-
color: var(--color-orange);
|
|
983
|
+
* {
|
|
984
|
+
color: currentColor !important;
|
|
655
985
|
}
|
|
656
986
|
}
|
|
657
987
|
&[data-variant="success"] {
|
|
658
988
|
background-color: var(--alpha-green-10);
|
|
659
|
-
color: var(--alpha-green-
|
|
989
|
+
border-color: var(--alpha-green-10);
|
|
990
|
+
color: var(--shade-lime-20);
|
|
660
991
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
background-color: var(--alpha-green-10);
|
|
664
|
-
color: var(--color-green);
|
|
992
|
+
* {
|
|
993
|
+
color: currentColor !important;
|
|
665
994
|
}
|
|
666
995
|
}
|
|
667
996
|
&[data-variant="meta"] {
|
|
668
|
-
background-color: var(--alpha-
|
|
669
|
-
color: var(--alpha-
|
|
997
|
+
background-color: var(--alpha-indigo-10);
|
|
998
|
+
border-color: var(--alpha-indigo-10);
|
|
999
|
+
color: var(--shade-indigo-20);
|
|
670
1000
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
1001
|
+
* {
|
|
1002
|
+
color: currentColor !important;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
&[data-variant="hint"] {
|
|
1006
|
+
background-color: var(--alpha-purple-10);
|
|
1007
|
+
border-color: var(--alpha-purple-10);
|
|
1008
|
+
color: var(--shade-purple-20);
|
|
1009
|
+
|
|
1010
|
+
* {
|
|
1011
|
+
color: currentColor !important;
|
|
675
1012
|
}
|
|
676
1013
|
}
|
|
677
1014
|
`;
|
|
@@ -683,14 +1020,35 @@ var BadgeShapeStyles = css3`
|
|
|
683
1020
|
border-radius: var(--measurement-medium-20);
|
|
684
1021
|
}
|
|
685
1022
|
&[data-shape="round"] {
|
|
686
|
-
border-radius: var(--measurement-
|
|
1023
|
+
border-radius: var(--measurement-medium-60);
|
|
1024
|
+
}
|
|
1025
|
+
`;
|
|
1026
|
+
var BadgeSizeStyles = css3`
|
|
1027
|
+
&[data-size="small"] {
|
|
1028
|
+
padding: 0 var(--measurement-medium-30);
|
|
1029
|
+
|
|
1030
|
+
min-width: var(--measurement-medium-70);
|
|
1031
|
+
min-height: var(--measurement-medium-70);
|
|
1032
|
+
}
|
|
1033
|
+
&[data-size="medium"] {
|
|
1034
|
+
padding: 0 var(--measurement-medium-40);
|
|
1035
|
+
|
|
1036
|
+
min-width: var(--fontsize-medium-60);
|
|
1037
|
+
min-height: var(--fontsize-medium-60);
|
|
1038
|
+
}
|
|
1039
|
+
&[data-size="large"] {
|
|
1040
|
+
padding: 0 var(--measurement-medium-40);
|
|
1041
|
+
|
|
1042
|
+
min-width: var(--fontsize-medium-70);
|
|
1043
|
+
min-height: var(--fontsize-medium-70);
|
|
687
1044
|
}
|
|
688
1045
|
`;
|
|
689
|
-
var
|
|
1046
|
+
var BadgeWrapper2 = styled3.div`
|
|
690
1047
|
&[data-raw="false"] {
|
|
691
1048
|
${BadgeBaseStyles}
|
|
692
1049
|
${BadgeVariantStyles}
|
|
693
1050
|
${BadgeShapeStyles}
|
|
1051
|
+
${BadgeSizeStyles}
|
|
694
1052
|
}
|
|
695
1053
|
`;
|
|
696
1054
|
|
|
@@ -698,17 +1056,19 @@ var BadgeWrapper = styled3.div`
|
|
|
698
1056
|
var Badge = (props) => {
|
|
699
1057
|
const {
|
|
700
1058
|
raw = false,
|
|
701
|
-
|
|
702
|
-
|
|
1059
|
+
sizing = "small" /* Small */,
|
|
1060
|
+
variant = "primary" /* Primary */,
|
|
1061
|
+
shape = "smooth" /* Smooth */,
|
|
703
1062
|
children,
|
|
704
1063
|
...restProps
|
|
705
1064
|
} = props;
|
|
706
1065
|
return /* @__PURE__ */ React5.createElement(
|
|
707
|
-
|
|
1066
|
+
BadgeWrapper2,
|
|
708
1067
|
{
|
|
709
1068
|
"data-raw": raw,
|
|
710
1069
|
"data-variant": variant,
|
|
711
1070
|
"data-shape": shape,
|
|
1071
|
+
"data-size": sizing,
|
|
712
1072
|
...restProps
|
|
713
1073
|
},
|
|
714
1074
|
children
|
|
@@ -920,74 +1280,294 @@ var CheckboxDefaultStyles = css5`
|
|
|
920
1280
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
921
1281
|
transition: all ease-in-out 0.2s;
|
|
922
1282
|
`;
|
|
1283
|
+
var CheckboxBeforeDefaultStyles = css5`
|
|
1284
|
+
content: "";
|
|
1285
|
+
inset: 0;
|
|
1286
|
+
|
|
1287
|
+
border-radius: inherit;
|
|
1288
|
+
border: var(--measurement-small-10) solid transparent;
|
|
1289
|
+
position: absolute;
|
|
1290
|
+
box-sizing: border-box;
|
|
1291
|
+
margin: 0;
|
|
1292
|
+
padding: 0;
|
|
1293
|
+
|
|
1294
|
+
mask-composite: intersect;
|
|
1295
|
+
|
|
1296
|
+
transition: all ease-in-out 0.2s;
|
|
1297
|
+
`;
|
|
923
1298
|
var CheckboxVariantsStyles = css5`
|
|
924
|
-
&[data-variant="
|
|
925
|
-
background-color: var(--
|
|
926
|
-
border: var(--measurement-small-10) solid transparent;
|
|
1299
|
+
&[data-variant="accent"] {
|
|
1300
|
+
background-color: var(--alpha-accent-30);
|
|
927
1301
|
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
border-color: var(--
|
|
1302
|
+
::before {
|
|
1303
|
+
${CheckboxBeforeDefaultStyles}
|
|
1304
|
+
border-color: var(--alpha-accent-30);
|
|
1305
|
+
mask-image: linear-gradient(var(--alpha-accent-30), transparent);
|
|
931
1306
|
}
|
|
932
1307
|
|
|
1308
|
+
&:hover,
|
|
1309
|
+
&:focus,
|
|
933
1310
|
&:active,
|
|
934
1311
|
&[data-state="checked"] {
|
|
935
|
-
|
|
1312
|
+
color: var(--font-color);
|
|
1313
|
+
|
|
1314
|
+
::before {
|
|
1315
|
+
border-color: var(--color-accent);
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
svg {
|
|
1319
|
+
stroke: var(--color-accent);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
&[data-variant="primary"] {
|
|
1324
|
+
background-color: var(--font-color);
|
|
1325
|
+
background: linear-gradient(
|
|
1326
|
+
180deg,
|
|
1327
|
+
var(--font-color) 50%,
|
|
1328
|
+
var(--font-color-alpha-60) 100%
|
|
1329
|
+
);
|
|
1330
|
+
background-size: 100% 200%;
|
|
1331
|
+
background-position: 0% 50%;
|
|
1332
|
+
|
|
1333
|
+
::before {
|
|
1334
|
+
${CheckboxBeforeDefaultStyles}
|
|
1335
|
+
border-color: var(--body-color-alpha-20);
|
|
1336
|
+
mask-image: linear-gradient(var(--body-color-alpha-90), transparent);
|
|
936
1337
|
}
|
|
937
1338
|
|
|
1339
|
+
&:hover,
|
|
1340
|
+
&:focus,
|
|
1341
|
+
&:active,
|
|
938
1342
|
&[data-state="checked"] {
|
|
1343
|
+
background-position: 0% 25%;
|
|
1344
|
+
|
|
1345
|
+
::before {
|
|
1346
|
+
border-color: var(--body-color-alpha-10);
|
|
1347
|
+
}
|
|
1348
|
+
|
|
939
1349
|
svg {
|
|
940
1350
|
stroke: var(--body-color);
|
|
941
1351
|
}
|
|
942
1352
|
}
|
|
943
1353
|
}
|
|
1354
|
+
&[data-variant="secondary"] {
|
|
1355
|
+
background-color: var(--contrast-color);
|
|
1356
|
+
|
|
1357
|
+
::before {
|
|
1358
|
+
${CheckboxBeforeDefaultStyles}
|
|
1359
|
+
border-color: var(--font-color-alpha-30);
|
|
1360
|
+
mask-image: linear-gradient(var(--font-color-alpha-30), transparent);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
&:hover,
|
|
1364
|
+
&:focus,
|
|
1365
|
+
&:active,
|
|
1366
|
+
&[data-state="checked"] {
|
|
1367
|
+
color: var(--font-color);
|
|
1368
|
+
|
|
1369
|
+
::before {
|
|
1370
|
+
border-color: var(--font-color-alpha-60);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
svg {
|
|
1374
|
+
stroke: var(--font-color);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
&[data-variant="tertiary"] {
|
|
1379
|
+
border-color: var(--font-color-alpha-10);
|
|
944
1380
|
|
|
945
|
-
&[data-variant="border"] {
|
|
946
1381
|
background-color: var(--body-color);
|
|
947
|
-
|
|
1382
|
+
background: linear-gradient(
|
|
1383
|
+
180deg,
|
|
1384
|
+
transparent 0%,
|
|
1385
|
+
var(--contrast-color) 100%
|
|
1386
|
+
);
|
|
1387
|
+
background-size: 100% 200%;
|
|
1388
|
+
background-position: 0% 50%;
|
|
1389
|
+
|
|
1390
|
+
::before {
|
|
1391
|
+
${CheckboxBeforeDefaultStyles}
|
|
1392
|
+
border-color: var(--font-color-alpha-10);
|
|
1393
|
+
mask-image: linear-gradient(var(--font-color-alpha-30), transparent);
|
|
1394
|
+
}
|
|
948
1395
|
|
|
949
1396
|
&:hover,
|
|
950
1397
|
&:focus,
|
|
951
1398
|
&:active,
|
|
952
1399
|
&[data-state="checked"] {
|
|
953
1400
|
background-color: var(--font-color-alpha-10);
|
|
1401
|
+
background-position: 0% 75%;
|
|
954
1402
|
border-color: transparent;
|
|
1403
|
+
|
|
1404
|
+
svg {
|
|
1405
|
+
stroke: var(--font-color);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
&[data-variant="success"] {
|
|
1410
|
+
background-color: var(--alpha-green-30);
|
|
1411
|
+
|
|
1412
|
+
background: linear-gradient(
|
|
1413
|
+
180deg,
|
|
1414
|
+
transparent 0%,
|
|
1415
|
+
var(--alpha-green-30) 100%
|
|
1416
|
+
);
|
|
1417
|
+
background-size: 100% 200%;
|
|
1418
|
+
background-position: 0% 50%;
|
|
1419
|
+
|
|
1420
|
+
::before {
|
|
1421
|
+
${CheckboxBeforeDefaultStyles}
|
|
1422
|
+
border-color: var(--alpha-green-30);
|
|
1423
|
+
mask-image: linear-gradient(var(--alpha-green-30), transparent);
|
|
955
1424
|
}
|
|
956
1425
|
|
|
1426
|
+
&:hover,
|
|
1427
|
+
&:focus,
|
|
1428
|
+
&:active,
|
|
957
1429
|
&[data-state="checked"] {
|
|
1430
|
+
color: var(--font-color);
|
|
1431
|
+
|
|
1432
|
+
::before {
|
|
1433
|
+
border-color: var(--color-green);
|
|
1434
|
+
background-color: var(--alpha-green-60);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
958
1437
|
svg {
|
|
959
|
-
stroke: var(--
|
|
1438
|
+
stroke: var(--color-green);
|
|
960
1439
|
}
|
|
961
1440
|
}
|
|
962
1441
|
}
|
|
963
|
-
&[data-variant="
|
|
964
|
-
background-color: var(--
|
|
965
|
-
|
|
1442
|
+
&[data-variant="meta"] {
|
|
1443
|
+
background-color: var(--alpha-blue-30);
|
|
1444
|
+
|
|
1445
|
+
background: linear-gradient(
|
|
1446
|
+
180deg,
|
|
1447
|
+
transparent 0%,
|
|
1448
|
+
var(--alpha-blue-30) 100%
|
|
1449
|
+
);
|
|
1450
|
+
background-size: 100% 200%;
|
|
1451
|
+
background-position: 0% 50%;
|
|
1452
|
+
|
|
1453
|
+
::before {
|
|
1454
|
+
${CheckboxBeforeDefaultStyles}
|
|
1455
|
+
border-color: var(--alpha-blue-30);
|
|
1456
|
+
mask-image: linear-gradient(var(--alpha-blue-30), transparent);
|
|
1457
|
+
}
|
|
966
1458
|
|
|
967
1459
|
&:hover,
|
|
968
1460
|
&:focus,
|
|
969
1461
|
&:active,
|
|
970
1462
|
&[data-state="checked"] {
|
|
971
|
-
|
|
1463
|
+
color: var(--font-color);
|
|
1464
|
+
|
|
1465
|
+
::before {
|
|
1466
|
+
border-color: var(--color-blue);
|
|
1467
|
+
background-color: var(--alpha-blue-60);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
svg {
|
|
1471
|
+
stroke: var(--color-blue);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
&[data-variant="hint"] {
|
|
1476
|
+
background-color: var(--alpha-purple-30);
|
|
1477
|
+
|
|
1478
|
+
background: linear-gradient(
|
|
1479
|
+
180deg,
|
|
1480
|
+
transparent 0%,
|
|
1481
|
+
var(--alpha-purple-30) 100%
|
|
1482
|
+
);
|
|
1483
|
+
background-size: 100% 200%;
|
|
1484
|
+
background-position: 0% 50%;
|
|
1485
|
+
|
|
1486
|
+
::before {
|
|
1487
|
+
${CheckboxBeforeDefaultStyles}
|
|
1488
|
+
border-color: var(--alpha-purple-30);
|
|
1489
|
+
mask-image: linear-gradient(var(--alpha-purple-30), transparent);
|
|
972
1490
|
}
|
|
973
1491
|
|
|
1492
|
+
&:hover,
|
|
1493
|
+
&:focus,
|
|
1494
|
+
&:active,
|
|
974
1495
|
&[data-state="checked"] {
|
|
1496
|
+
color: var(--font-color);
|
|
1497
|
+
|
|
1498
|
+
::before {
|
|
1499
|
+
border-color: var(--color-purple);
|
|
1500
|
+
background-color: var(--alpha-purple-60);
|
|
1501
|
+
}
|
|
1502
|
+
|
|
975
1503
|
svg {
|
|
976
|
-
stroke: var(--
|
|
1504
|
+
stroke: var(--color-purple);
|
|
977
1505
|
}
|
|
978
1506
|
}
|
|
979
1507
|
}
|
|
980
|
-
&[data-variant="
|
|
981
|
-
|
|
1508
|
+
&[data-variant="danger"] {
|
|
1509
|
+
background-color: var(--alpha-red-30);
|
|
1510
|
+
|
|
1511
|
+
background: linear-gradient(
|
|
1512
|
+
180deg,
|
|
1513
|
+
transparent 0%,
|
|
1514
|
+
var(--alpha-red-30) 100%
|
|
1515
|
+
);
|
|
1516
|
+
background-size: 100% 200%;
|
|
1517
|
+
background-position: 0% 50%;
|
|
1518
|
+
|
|
1519
|
+
::before {
|
|
1520
|
+
${CheckboxBeforeDefaultStyles}
|
|
1521
|
+
border-color: var(--alpha-red-30);
|
|
1522
|
+
mask-image: linear-gradient(var(--alpha-red-30), transparent);
|
|
1523
|
+
}
|
|
982
1524
|
|
|
983
1525
|
&:hover,
|
|
984
1526
|
&:focus,
|
|
985
1527
|
&:active,
|
|
986
1528
|
&[data-state="checked"] {
|
|
987
|
-
|
|
1529
|
+
color: var(--font-color);
|
|
1530
|
+
|
|
1531
|
+
::before {
|
|
1532
|
+
border-color: var(--color-red);
|
|
1533
|
+
background-color: var(--alpha-red-60);
|
|
1534
|
+
}
|
|
988
1535
|
|
|
989
1536
|
svg {
|
|
990
|
-
stroke: var(--
|
|
1537
|
+
stroke: var(--color-red);
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
&[data-variant="warning"] {
|
|
1542
|
+
background-color: var(--alpha-orange-30);
|
|
1543
|
+
|
|
1544
|
+
background: linear-gradient(
|
|
1545
|
+
180deg,
|
|
1546
|
+
transparent 0%,
|
|
1547
|
+
var(--alpha-orange-30) 100%
|
|
1548
|
+
);
|
|
1549
|
+
background-size: 100% 200%;
|
|
1550
|
+
background-position: 0% 50%;
|
|
1551
|
+
|
|
1552
|
+
::before {
|
|
1553
|
+
${CheckboxBeforeDefaultStyles}
|
|
1554
|
+
border-color: var(--alpha-orange-30);
|
|
1555
|
+
mask-image: linear-gradient(var(--alpha-orange-30), transparent);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
&:hover,
|
|
1559
|
+
&:focus,
|
|
1560
|
+
&:active,
|
|
1561
|
+
&[data-state="checked"] {
|
|
1562
|
+
color: var(--font-color);
|
|
1563
|
+
|
|
1564
|
+
::before {
|
|
1565
|
+
border-color: var(--color-orange);
|
|
1566
|
+
background-color: var(--alpha-orange-60);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
svg {
|
|
1570
|
+
stroke: var(--color-orange);
|
|
991
1571
|
}
|
|
992
1572
|
}
|
|
993
1573
|
}
|
|
@@ -1056,7 +1636,7 @@ var Checkbox = (props) => {
|
|
|
1056
1636
|
const {
|
|
1057
1637
|
raw,
|
|
1058
1638
|
sizing = "medium" /* Medium */,
|
|
1059
|
-
variant = "
|
|
1639
|
+
variant = "secondary" /* Secondary */,
|
|
1060
1640
|
name,
|
|
1061
1641
|
disabled,
|
|
1062
1642
|
required,
|
|
@@ -1432,12 +2012,19 @@ import styled7, { css as css6 } from "styled-components";
|
|
|
1432
2012
|
var DialogDefaultStyles = css6`
|
|
1433
2013
|
position: fixed;
|
|
1434
2014
|
top: 15dvh;
|
|
1435
|
-
|
|
2015
|
+
bottom: auto;
|
|
2016
|
+
left: auto;
|
|
2017
|
+
right: auto;
|
|
2018
|
+
|
|
2019
|
+
padding: var(--measurement-medium-30);
|
|
1436
2020
|
width: 100%;
|
|
1437
2021
|
|
|
1438
|
-
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
1439
|
-
background-color: var(--body-color);
|
|
1440
2022
|
border-radius: var(--measurement-medium-30);
|
|
2023
|
+
background: var(--body-color);
|
|
2024
|
+
|
|
2025
|
+
border: var(--measurement-small-10) solid var(--contrast-color);
|
|
2026
|
+
box-shadow: 0 var(--measurement-medium-40) var(--measurement-medium-60)
|
|
2027
|
+
calc(var(--measurement-medium-60) * -1) rgba(0, 0, 0, 0.3);
|
|
1441
2028
|
|
|
1442
2029
|
transition: all ease-in-out 0.2s;
|
|
1443
2030
|
z-index: var(--depth-default-100);
|
|
@@ -1452,7 +2039,7 @@ var DialogSizeStyles = css6`
|
|
|
1452
2039
|
max-height: var(--max-height);
|
|
1453
2040
|
}
|
|
1454
2041
|
&[data-size="medium"] {
|
|
1455
|
-
max-width: calc(var(--measurement-large-90) * 2
|
|
2042
|
+
max-width: calc(var(--measurement-large-90) * 2);
|
|
1456
2043
|
max-height: var(--max-height);
|
|
1457
2044
|
}
|
|
1458
2045
|
|
|
@@ -1474,14 +2061,14 @@ var Menu = styled7.menu`
|
|
|
1474
2061
|
}
|
|
1475
2062
|
`;
|
|
1476
2063
|
var DialogWrapper = styled7.dialog`
|
|
1477
|
-
@keyframes
|
|
2064
|
+
@keyframes scale-in {
|
|
1478
2065
|
0% {
|
|
1479
2066
|
opacity: 0;
|
|
1480
|
-
transform:
|
|
2067
|
+
transform: scale(0.95);
|
|
1481
2068
|
}
|
|
1482
2069
|
100% {
|
|
1483
2070
|
opacity: 1;
|
|
1484
|
-
transform:
|
|
2071
|
+
transform: Scale(1);
|
|
1485
2072
|
}
|
|
1486
2073
|
}
|
|
1487
2074
|
|
|
@@ -1494,7 +2081,7 @@ var DialogWrapper = styled7.dialog`
|
|
|
1494
2081
|
${DialogSizeStyles}
|
|
1495
2082
|
|
|
1496
2083
|
animation-duration: 0.2s;
|
|
1497
|
-
animation-name:
|
|
2084
|
+
animation-name: scale-in;
|
|
1498
2085
|
animation-fill-mode: backwards;
|
|
1499
2086
|
}
|
|
1500
2087
|
`;
|
|
@@ -1683,15 +2270,7 @@ function useDropdownMenuProvider() {
|
|
|
1683
2270
|
}
|
|
1684
2271
|
|
|
1685
2272
|
// src/dropdown/styles/index.ts
|
|
1686
|
-
import styled9, { css as css7
|
|
1687
|
-
var FadeIn = keyframes`
|
|
1688
|
-
0% {
|
|
1689
|
-
opacity: 0;
|
|
1690
|
-
}
|
|
1691
|
-
100% {
|
|
1692
|
-
opacity: 1;
|
|
1693
|
-
}
|
|
1694
|
-
`;
|
|
2273
|
+
import styled9, { css as css7 } from "styled-components";
|
|
1695
2274
|
var ContentWrapperSizes = css7`
|
|
1696
2275
|
--small: var(--measurement-large-60);
|
|
1697
2276
|
--medium: var(--measurement-large-80);
|
|
@@ -1722,6 +2301,17 @@ var ContentWrapper = styled9.ul`
|
|
|
1722
2301
|
--medium: var(--measurement-large-80);
|
|
1723
2302
|
--large: var(--measurement-large-90);
|
|
1724
2303
|
|
|
2304
|
+
@keyframes slide-in {
|
|
2305
|
+
0% {
|
|
2306
|
+
opacity: 0;
|
|
2307
|
+
transform: translateY(calc(var(--measurement-small-60) * -1));
|
|
2308
|
+
}
|
|
2309
|
+
100% {
|
|
2310
|
+
opacity: 1;
|
|
2311
|
+
transform: translateY(0);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
|
|
1725
2315
|
&[data-raw="false"] {
|
|
1726
2316
|
position: fixed;
|
|
1727
2317
|
margin: 0;
|
|
@@ -1734,11 +2324,11 @@ var ContentWrapper = styled9.ul`
|
|
|
1734
2324
|
border-radius: var(--measurement-medium-30);
|
|
1735
2325
|
|
|
1736
2326
|
z-index: var(--depth-default-100);
|
|
1737
|
-
animation-duration: 0.2s;
|
|
1738
|
-
animation-name: ${FadeIn};
|
|
1739
|
-
animation-fill-mode: backwards;
|
|
1740
2327
|
|
|
1741
2328
|
${ContentWrapperSizes}
|
|
2329
|
+
animation-duration: 0.2s;
|
|
2330
|
+
animation-name: slide-in;
|
|
2331
|
+
animation-fill-mode: backwards;
|
|
1742
2332
|
}
|
|
1743
2333
|
`;
|
|
1744
2334
|
var ItemWrapper2 = styled9.li`
|
|
@@ -1748,20 +2338,28 @@ var ItemWrapper2 = styled9.li`
|
|
|
1748
2338
|
user-select: none;
|
|
1749
2339
|
|
|
1750
2340
|
&[data-raw="false"] {
|
|
1751
|
-
|
|
1752
|
-
padding: var(--measurement-medium-30);
|
|
2341
|
+
padding: var(--measurement-medium-10) var(--measurement-medium-30);
|
|
1753
2342
|
border-radius: var(--measurement-medium-20);
|
|
2343
|
+
|
|
1754
2344
|
text-align: left;
|
|
1755
|
-
|
|
2345
|
+
font-weight: 600;
|
|
2346
|
+
letter-spacing: calc(
|
|
2347
|
+
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
2348
|
+
);
|
|
2349
|
+
font-size: var(--fontsize-medium-10);
|
|
2350
|
+
color: var(--font-color);
|
|
2351
|
+
|
|
1756
2352
|
outline: none;
|
|
1757
|
-
transition: all ease-in-out 0.2s;
|
|
1758
2353
|
cursor: pointer;
|
|
1759
2354
|
|
|
2355
|
+
transition: all ease-in-out 0.2s;
|
|
2356
|
+
|
|
1760
2357
|
&:hover,
|
|
1761
2358
|
&:focus,
|
|
1762
|
-
&:active
|
|
1763
|
-
|
|
1764
|
-
|
|
2359
|
+
&:active,
|
|
2360
|
+
&:focus-within,
|
|
2361
|
+
&:has(:active) {
|
|
2362
|
+
background-color: var(--contrast-color);
|
|
1765
2363
|
}
|
|
1766
2364
|
}
|
|
1767
2365
|
|
|
@@ -1871,7 +2469,18 @@ var DropdownMenuContent = React17.forwardRef((props, _) => {
|
|
|
1871
2469
|
mounted.current = false;
|
|
1872
2470
|
};
|
|
1873
2471
|
}, [states.open]);
|
|
1874
|
-
|
|
2472
|
+
React17.useEffect(() => {
|
|
2473
|
+
if (!states.open) return;
|
|
2474
|
+
const handleKeyDown = (event) => {
|
|
2475
|
+
if (event.key === "Escape" && methods.toggleOpen) {
|
|
2476
|
+
methods.toggleOpen();
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2480
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2481
|
+
}, [states.open]);
|
|
2482
|
+
if (!states.open) return null;
|
|
2483
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1875
2484
|
ContentWrapper,
|
|
1876
2485
|
{
|
|
1877
2486
|
ref: contentRef,
|
|
@@ -1891,7 +2500,7 @@ var DropdownMenuContent = React17.forwardRef((props, _) => {
|
|
|
1891
2500
|
...restProps
|
|
1892
2501
|
},
|
|
1893
2502
|
children
|
|
1894
|
-
)
|
|
2503
|
+
);
|
|
1895
2504
|
});
|
|
1896
2505
|
DropdownMenuContent.displayName = "DropdownMenu.Content";
|
|
1897
2506
|
var DropdownMenuItem = (props) => {
|
|
@@ -1985,15 +2594,17 @@ var FieldDefaultStyles = css8`
|
|
|
1985
2594
|
|
|
1986
2595
|
font-size: var(--fontsize-medium-20);
|
|
1987
2596
|
|
|
1988
|
-
line-height: 1
|
|
2597
|
+
line-height: 1;
|
|
1989
2598
|
letter-spacing: calc(
|
|
1990
2599
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
1991
2600
|
);
|
|
1992
2601
|
|
|
1993
2602
|
border: var(--measurement-small-10) solid transparent;
|
|
2603
|
+
|
|
1994
2604
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
1995
2605
|
color: var(--font-color-alpha-60);
|
|
1996
|
-
|
|
2606
|
+
|
|
2607
|
+
width: 100%;
|
|
1997
2608
|
height: fit-content;
|
|
1998
2609
|
|
|
1999
2610
|
transition: all ease-in-out 0.2s;
|
|
@@ -2006,7 +2617,9 @@ var FieldDefaultStyles = css8`
|
|
|
2006
2617
|
|
|
2007
2618
|
&:hover,
|
|
2008
2619
|
&:focus,
|
|
2009
|
-
&:active
|
|
2620
|
+
&:active,
|
|
2621
|
+
&:focus-within,
|
|
2622
|
+
&:has(:active) {
|
|
2010
2623
|
color: var(--font-color);
|
|
2011
2624
|
svg,
|
|
2012
2625
|
span,
|
|
@@ -2019,26 +2632,46 @@ var FieldDefaultStyles = css8`
|
|
|
2019
2632
|
color: var(--font-color-alpha-30);
|
|
2020
2633
|
}
|
|
2021
2634
|
|
|
2022
|
-
&:disabled
|
|
2635
|
+
&:disabled,
|
|
2636
|
+
&:has(:disabled) {
|
|
2023
2637
|
cursor: not-allowed;
|
|
2024
2638
|
opacity: 0.6;
|
|
2025
2639
|
}
|
|
2026
2640
|
`;
|
|
2027
2641
|
var FieldVariantsStyles = css8`
|
|
2028
2642
|
&[data-variant="primary"] {
|
|
2029
|
-
background-color:
|
|
2643
|
+
background-color: transparent;
|
|
2030
2644
|
border-color: var(--font-color-alpha-10);
|
|
2031
2645
|
|
|
2646
|
+
&:hover,
|
|
2032
2647
|
&:focus,
|
|
2033
|
-
&:active
|
|
2034
|
-
|
|
2648
|
+
&:active,
|
|
2649
|
+
&:focus-within,
|
|
2650
|
+
&:has(:hover),
|
|
2651
|
+
&:has(:active) {
|
|
2652
|
+
border-color: var(--font-color-alpha-20);
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
&:focus,
|
|
2656
|
+
&:active,
|
|
2657
|
+
&:focus-within,
|
|
2658
|
+
&:has(:active) {
|
|
2659
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-accent-30);
|
|
2035
2660
|
}
|
|
2036
2661
|
|
|
2037
2662
|
&[data-error="true"] {
|
|
2038
2663
|
color: var(--color-red);
|
|
2039
|
-
background-color: var(--alpha-red-10);
|
|
2040
2664
|
border-color: var(--alpha-red-10);
|
|
2041
|
-
|
|
2665
|
+
|
|
2666
|
+
&:hover,
|
|
2667
|
+
&:focus,
|
|
2668
|
+
&:active,
|
|
2669
|
+
&:focus-within,
|
|
2670
|
+
&:has(:hover),
|
|
2671
|
+
&:has(:active) {
|
|
2672
|
+
background-color: var(--alpha-red-10);
|
|
2673
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
2674
|
+
}
|
|
2042
2675
|
}
|
|
2043
2676
|
}
|
|
2044
2677
|
|
|
@@ -2048,12 +2681,17 @@ var FieldVariantsStyles = css8`
|
|
|
2048
2681
|
|
|
2049
2682
|
&:hover,
|
|
2050
2683
|
&:focus,
|
|
2051
|
-
&:active
|
|
2684
|
+
&:active,
|
|
2685
|
+
&:focus-within,
|
|
2686
|
+
&:has(:hover),
|
|
2687
|
+
&:has(:active) {
|
|
2052
2688
|
border-color: var(--font-color-alpha-20);
|
|
2053
2689
|
}
|
|
2054
2690
|
|
|
2055
2691
|
&:focus,
|
|
2056
|
-
&:active
|
|
2692
|
+
&:active,
|
|
2693
|
+
&:focus-within,
|
|
2694
|
+
&:has(:active) {
|
|
2057
2695
|
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
2058
2696
|
}
|
|
2059
2697
|
|
|
@@ -2063,7 +2701,10 @@ var FieldVariantsStyles = css8`
|
|
|
2063
2701
|
|
|
2064
2702
|
&:hover,
|
|
2065
2703
|
&:focus,
|
|
2066
|
-
&:active
|
|
2704
|
+
&:active,
|
|
2705
|
+
&:focus-within,
|
|
2706
|
+
&:has(:hover),
|
|
2707
|
+
&:has(:active) {
|
|
2067
2708
|
background-color: var(--alpha-red-10);
|
|
2068
2709
|
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
2069
2710
|
}
|
|
@@ -2080,7 +2721,10 @@ var FieldVariantsStyles = css8`
|
|
|
2080
2721
|
|
|
2081
2722
|
&:hover,
|
|
2082
2723
|
&:focus,
|
|
2083
|
-
&:active
|
|
2724
|
+
&:active,
|
|
2725
|
+
&:focus-within,
|
|
2726
|
+
&:has(:hover),
|
|
2727
|
+
&:has(:active) {
|
|
2084
2728
|
color: var(--font-color);
|
|
2085
2729
|
}
|
|
2086
2730
|
|
|
@@ -2101,7 +2745,6 @@ var FieldSizeStyles = css8`
|
|
|
2101
2745
|
padding: 0 var(--measurement-medium-30);
|
|
2102
2746
|
min-width: var(--measurement-medium-90);
|
|
2103
2747
|
min-height: var(--measurement-medium-90);
|
|
2104
|
-
width: fit-content;
|
|
2105
2748
|
}
|
|
2106
2749
|
&[data-size="large"] {
|
|
2107
2750
|
padding: var(--measurement-medium-50);
|
|
@@ -2118,6 +2761,7 @@ var FieldShapeStyles = css8`
|
|
|
2118
2761
|
}
|
|
2119
2762
|
&[data-shape="round"] {
|
|
2120
2763
|
border-radius: var(--measurement-large-90);
|
|
2764
|
+
padding-left: var(--measurement-medium-50) !important;
|
|
2121
2765
|
}
|
|
2122
2766
|
`;
|
|
2123
2767
|
var Fieldset = styled10.fieldset`
|
|
@@ -2164,6 +2808,265 @@ var Def = styled10.dfn`
|
|
|
2164
2808
|
}
|
|
2165
2809
|
}
|
|
2166
2810
|
`;
|
|
2811
|
+
var ParentContainer = styled10.div`
|
|
2812
|
+
position: relative;
|
|
2813
|
+
display: flex;
|
|
2814
|
+
align-items: stretch;
|
|
2815
|
+
width: 100%;
|
|
2816
|
+
height: 100%;
|
|
2817
|
+
|
|
2818
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
2819
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
2820
|
+
-webkit-appearance: none;
|
|
2821
|
+
margin: 0;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
input {
|
|
2825
|
+
width: 100% !important;
|
|
2826
|
+
}
|
|
2827
|
+
input[type="number"] {
|
|
2828
|
+
appearance: textfield;
|
|
2829
|
+
-moz-appearance: textfield;
|
|
2830
|
+
}
|
|
2831
|
+
`;
|
|
2832
|
+
var ParentWrapper = styled10.div`
|
|
2833
|
+
&[data-raw="false"] {
|
|
2834
|
+
${FieldDefaultStyles}
|
|
2835
|
+
${FieldVariantsStyles}
|
|
2836
|
+
${FieldSizeStyles}
|
|
2837
|
+
${FieldShapeStyles}
|
|
2838
|
+
|
|
2839
|
+
cursor: default;
|
|
2840
|
+
display: flex;
|
|
2841
|
+
align-items: center;
|
|
2842
|
+
justify-content: start;
|
|
2843
|
+
gap: var(--measurement-small-30);
|
|
2844
|
+
width: 100% !important;
|
|
2845
|
+
text-align: left !important;
|
|
2846
|
+
|
|
2847
|
+
&[data-error="true"] {
|
|
2848
|
+
&::placeholder {
|
|
2849
|
+
color: var(--alpha-red-30);
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
&[data-wrap="true"] {
|
|
2854
|
+
flex-wrap: wrap;
|
|
2855
|
+
align-items: center;
|
|
2856
|
+
align-content: center;
|
|
2857
|
+
height: auto;
|
|
2858
|
+
padding-top: var(--measurement-small-60);
|
|
2859
|
+
padding-bottom: var(--measurement-small-60);
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
`;
|
|
2863
|
+
var InnerDivider = styled10.div`
|
|
2864
|
+
height: var(--measurement-small-10);
|
|
2865
|
+
width: 100%;
|
|
2866
|
+
background-color: var(--font-color-alpha-10);
|
|
2867
|
+
`;
|
|
2868
|
+
var InnerWrapper = styled10.div`
|
|
2869
|
+
&[data-raw="false"] {
|
|
2870
|
+
position: absolute;
|
|
2871
|
+
display: flex;
|
|
2872
|
+
flex-direction: column;
|
|
2873
|
+
|
|
2874
|
+
right: 0;
|
|
2875
|
+
&[data-multiple="true"] {
|
|
2876
|
+
right: var(--measurement-small-10) !important;
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
top: var(--measurement-small-10);
|
|
2880
|
+
bottom: var(--measurement-small-10);
|
|
2881
|
+
|
|
2882
|
+
border-left: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2883
|
+
border-color: var(--font-color-alpha-10);
|
|
2884
|
+
|
|
2885
|
+
overflow: hidden;
|
|
2886
|
+
|
|
2887
|
+
&[data-error="true"] {
|
|
2888
|
+
border-color: var(--alpha-red-10) !important;
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
&[data-shape="round"] {
|
|
2892
|
+
border-radius: 0 var(--measurement-large-90) var(--measurement-large-90) 0;
|
|
2893
|
+
}
|
|
2894
|
+
&[data-shape="smooth"] {
|
|
2895
|
+
border-radius: 0 var(--measurement-medium-20) var(--measurement-medium-20)
|
|
2896
|
+
0;
|
|
2897
|
+
}
|
|
2898
|
+
&[data-shape="square"] {
|
|
2899
|
+
border-radius: 0;
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
`;
|
|
2903
|
+
var InnerTrigger = styled10.button`
|
|
2904
|
+
all: unset;
|
|
2905
|
+
|
|
2906
|
+
position: relative;
|
|
2907
|
+
display: flex;
|
|
2908
|
+
flex: 1;
|
|
2909
|
+
|
|
2910
|
+
align-items: center;
|
|
2911
|
+
justify-content: center;
|
|
2912
|
+
box-sizing: border-box;
|
|
2913
|
+
padding: 0 var(--measurement-medium-40);
|
|
2914
|
+
|
|
2915
|
+
color: var(--font-color-alpha-60);
|
|
2916
|
+
|
|
2917
|
+
background-color: var(--body-color);
|
|
2918
|
+
background: linear-gradient(
|
|
2919
|
+
180deg,
|
|
2920
|
+
transparent 50%,
|
|
2921
|
+
var(--font-color-alpha-10) 100%
|
|
2922
|
+
);
|
|
2923
|
+
background-size: 100% 200%;
|
|
2924
|
+
background-position: 0% 0%;
|
|
2925
|
+
backdrop-filter: blur(var(--measurement-medium-10));
|
|
2926
|
+
|
|
2927
|
+
cursor: pointer;
|
|
2928
|
+
transition: all ease-in-out 0.2s;
|
|
2929
|
+
|
|
2930
|
+
svg {
|
|
2931
|
+
opacity: 0.6;
|
|
2932
|
+
transition: all ease-in-out 0.2s;
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
::before {
|
|
2936
|
+
content: "";
|
|
2937
|
+
inset: 0;
|
|
2938
|
+
|
|
2939
|
+
border-radius: inherit;
|
|
2940
|
+
position: absolute;
|
|
2941
|
+
box-sizing: border-box;
|
|
2942
|
+
margin: 0;
|
|
2943
|
+
padding: 0;
|
|
2944
|
+
|
|
2945
|
+
mask-composite: intersect;
|
|
2946
|
+
|
|
2947
|
+
transition: all ease-in-out 0.2s;
|
|
2948
|
+
mask-image: linear-gradient(var(--font-color), transparent);
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
&:hover,
|
|
2952
|
+
&:active {
|
|
2953
|
+
color: var(--font-color);
|
|
2954
|
+
background-position: 0% 50%;
|
|
2955
|
+
|
|
2956
|
+
svg {
|
|
2957
|
+
opacity: 0.8;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
&:disabled {
|
|
2962
|
+
cursor: not-allowed;
|
|
2963
|
+
opacity: 0.3;
|
|
2964
|
+
}
|
|
2965
|
+
`;
|
|
2966
|
+
var InnerSegment = styled10.span`
|
|
2967
|
+
&[data-raw="false"] {
|
|
2968
|
+
border-radius: inherit;
|
|
2969
|
+
|
|
2970
|
+
text-align: center;
|
|
2971
|
+
outline: none;
|
|
2972
|
+
color: inherit;
|
|
2973
|
+
transition: background-color ease-in-out 0.2s;
|
|
2974
|
+
|
|
2975
|
+
&[data-placeholder="true"] {
|
|
2976
|
+
color: var(--font-color-alpha-30);
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
&:hover,
|
|
2980
|
+
&:focus,
|
|
2981
|
+
&:active,
|
|
2982
|
+
&:focus-within,
|
|
2983
|
+
&:has(:active) {
|
|
2984
|
+
background-color: var(--font-color-alpha-10);
|
|
2985
|
+
color: var(--font-color);
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
`;
|
|
2989
|
+
var Muted = styled10.span`
|
|
2990
|
+
&[data-raw="false"] {
|
|
2991
|
+
color: var(--font-color-alpha-30);
|
|
2992
|
+
user-select: none;
|
|
2993
|
+
}
|
|
2994
|
+
`;
|
|
2995
|
+
var HiddenInput = styled10.input`
|
|
2996
|
+
border: none;
|
|
2997
|
+
outline: none;
|
|
2998
|
+
background: transparent;
|
|
2999
|
+
flex: 1;
|
|
3000
|
+
font: inherit;
|
|
3001
|
+
color: inherit;
|
|
3002
|
+
padding: 0;
|
|
3003
|
+
min-width: var(--measurement-medium-60);
|
|
3004
|
+
`;
|
|
3005
|
+
|
|
3006
|
+
// src/field/types/index.ts
|
|
3007
|
+
var SegmentRanges = {
|
|
3008
|
+
day: { min: 1, max: () => 31 },
|
|
3009
|
+
month: { min: 1, max: () => 12 },
|
|
3010
|
+
year: { min: 1, max: () => 9999 },
|
|
3011
|
+
hour: { min: 0, max: () => 23 },
|
|
3012
|
+
minute: { min: 0, max: () => 59 }
|
|
3013
|
+
};
|
|
3014
|
+
|
|
3015
|
+
// src/field/utils/index.ts
|
|
3016
|
+
function dateToState(date) {
|
|
3017
|
+
return {
|
|
3018
|
+
day: date.getDate(),
|
|
3019
|
+
month: date.getMonth() + 1,
|
|
3020
|
+
// Normalize: Date months are 0-indexed
|
|
3021
|
+
year: date.getFullYear(),
|
|
3022
|
+
hour: date.getHours(),
|
|
3023
|
+
minute: date.getMinutes()
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
function stateToDate(state) {
|
|
3027
|
+
return new Date(
|
|
3028
|
+
state.year,
|
|
3029
|
+
state.month - 1,
|
|
3030
|
+
// Normalize: Date constructor expects 0-indexed months
|
|
3031
|
+
state.day,
|
|
3032
|
+
state.hour,
|
|
3033
|
+
state.minute
|
|
3034
|
+
);
|
|
3035
|
+
}
|
|
3036
|
+
function buildSegments(state, locale, withTime) {
|
|
3037
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
3038
|
+
day: "2-digit",
|
|
3039
|
+
month: "2-digit",
|
|
3040
|
+
year: "numeric"
|
|
3041
|
+
});
|
|
3042
|
+
const timeFormatter = new Intl.DateTimeFormat(locale, {
|
|
3043
|
+
hour: "2-digit",
|
|
3044
|
+
minute: "2-digit",
|
|
3045
|
+
hour12: false
|
|
3046
|
+
});
|
|
3047
|
+
const probe = stateToDate(state);
|
|
3048
|
+
const dateParts = dateFormatter.formatToParts(probe).filter((p) => p.type !== "literal" || p.value.trim() !== "").map((p) => {
|
|
3049
|
+
if (p.type === "day") return { type: "day", value: p.value };
|
|
3050
|
+
if (p.type === "month") return { type: "month", value: p.value };
|
|
3051
|
+
if (p.type === "year") return { type: "year", value: p.value };
|
|
3052
|
+
return { type: "literal", value: p.value };
|
|
3053
|
+
});
|
|
3054
|
+
if (!withTime) return dateParts;
|
|
3055
|
+
const timeParts = timeFormatter.formatToParts(probe).filter((p) => p.type !== "literal" || p.value.trim() !== "").map((p) => {
|
|
3056
|
+
if (p.type === "hour") return { type: "hour", value: p.value };
|
|
3057
|
+
if (p.type === "minute") return { type: "minute", value: p.value };
|
|
3058
|
+
return { type: "literal", value: p.value };
|
|
3059
|
+
});
|
|
3060
|
+
return [...dateParts, { type: "literal", value: " " }, ...timeParts];
|
|
3061
|
+
}
|
|
3062
|
+
var commitState = (isControlled, next, setInternalState, onChange) => {
|
|
3063
|
+
if (!isControlled) setInternalState(next);
|
|
3064
|
+
onChange?.(stateToDate(next));
|
|
3065
|
+
};
|
|
3066
|
+
var clamp = (val, seg, internalState) => {
|
|
3067
|
+
const { min, max } = SegmentRanges[seg];
|
|
3068
|
+
return Math.min(Math.max(val, min), max(internalState));
|
|
3069
|
+
};
|
|
2167
3070
|
|
|
2168
3071
|
// src/field/index.tsx
|
|
2169
3072
|
var MetaVariantEnum = /* @__PURE__ */ ((MetaVariantEnum2) => {
|
|
@@ -2177,8 +3080,8 @@ var Field = (props) => {
|
|
|
2177
3080
|
const {
|
|
2178
3081
|
raw,
|
|
2179
3082
|
sizing = "medium" /* Medium */,
|
|
2180
|
-
variant = "
|
|
2181
|
-
shape = "smooth"
|
|
3083
|
+
variant = "secondary" /* Secondary */,
|
|
3084
|
+
shape = "smooth" /* Smooth */,
|
|
2182
3085
|
error,
|
|
2183
3086
|
hint,
|
|
2184
3087
|
...restProps
|
|
@@ -2225,33 +3128,644 @@ var FieldLabel = (props) => {
|
|
|
2225
3128
|
const { id } = useField();
|
|
2226
3129
|
return /* @__PURE__ */ React19.createElement(Label, { htmlFor: id, "data-raw": Boolean(raw), ...restProps }, children, !optional && /* @__PURE__ */ React19.createElement(Sup, null, "*"));
|
|
2227
3130
|
};
|
|
2228
|
-
FieldLabel.displayName = "Field.Label";
|
|
2229
|
-
var FieldMeta = (props) => {
|
|
3131
|
+
FieldLabel.displayName = "Field.Label";
|
|
3132
|
+
var FieldMeta = (props) => {
|
|
3133
|
+
const {
|
|
3134
|
+
raw,
|
|
3135
|
+
variant = "emphasis" /* Emphasis */,
|
|
3136
|
+
children,
|
|
3137
|
+
...restProps
|
|
3138
|
+
} = props;
|
|
3139
|
+
const metaId = React19.useId();
|
|
3140
|
+
const { id } = useField();
|
|
3141
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3142
|
+
Def,
|
|
3143
|
+
{
|
|
3144
|
+
id: metaId,
|
|
3145
|
+
"aria-details": id,
|
|
3146
|
+
"data-variant": variant,
|
|
3147
|
+
"data-raw": Boolean(raw),
|
|
3148
|
+
...restProps
|
|
3149
|
+
},
|
|
3150
|
+
children
|
|
3151
|
+
);
|
|
3152
|
+
};
|
|
3153
|
+
FieldMeta.displayName = "Field.Meta";
|
|
3154
|
+
var FieldNumber = (props) => {
|
|
3155
|
+
const {
|
|
3156
|
+
raw,
|
|
3157
|
+
sizing = "medium" /* Medium */,
|
|
3158
|
+
variant = "secondary" /* Secondary */,
|
|
3159
|
+
shape = "smooth" /* Smooth */,
|
|
3160
|
+
error,
|
|
3161
|
+
step = 1,
|
|
3162
|
+
...restProps
|
|
3163
|
+
} = props;
|
|
3164
|
+
const inputRef = React19.useRef(null);
|
|
3165
|
+
const handleStep = (direction) => {
|
|
3166
|
+
if (!inputRef.current) return;
|
|
3167
|
+
direction === "up" ? inputRef.current.stepUp() : inputRef.current.stepDown();
|
|
3168
|
+
inputRef.current.dispatchEvent(new Event("change", { bubbles: true }));
|
|
3169
|
+
};
|
|
3170
|
+
const ChevronIcon = ({ direction }) => /* @__PURE__ */ React19.createElement(
|
|
3171
|
+
"svg",
|
|
3172
|
+
{
|
|
3173
|
+
width: "8",
|
|
3174
|
+
height: "4",
|
|
3175
|
+
viewBox: "0 0 10 6",
|
|
3176
|
+
fill: "none",
|
|
3177
|
+
style: {
|
|
3178
|
+
transform: direction === "up" ? "rotate(180deg)" : "none"
|
|
3179
|
+
},
|
|
3180
|
+
"aria-hidden": "true"
|
|
3181
|
+
},
|
|
3182
|
+
/* @__PURE__ */ React19.createElement(
|
|
3183
|
+
"path",
|
|
3184
|
+
{
|
|
3185
|
+
d: "M1 1L5 5L9 1",
|
|
3186
|
+
stroke: "currentColor",
|
|
3187
|
+
strokeWidth: "1.5",
|
|
3188
|
+
strokeLinecap: "round",
|
|
3189
|
+
strokeLinejoin: "round"
|
|
3190
|
+
}
|
|
3191
|
+
)
|
|
3192
|
+
);
|
|
3193
|
+
return /* @__PURE__ */ React19.createElement(ParentContainer, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React19.createElement(
|
|
3194
|
+
Field,
|
|
3195
|
+
{
|
|
3196
|
+
ref: inputRef,
|
|
3197
|
+
type: "number",
|
|
3198
|
+
raw,
|
|
3199
|
+
sizing,
|
|
3200
|
+
variant,
|
|
3201
|
+
shape,
|
|
3202
|
+
error,
|
|
3203
|
+
step,
|
|
3204
|
+
...restProps
|
|
3205
|
+
}
|
|
3206
|
+
), /* @__PURE__ */ React19.createElement(
|
|
3207
|
+
InnerWrapper,
|
|
3208
|
+
{
|
|
3209
|
+
"data-raw": Boolean(raw),
|
|
3210
|
+
"data-error": Boolean(error),
|
|
3211
|
+
"data-variant": variant,
|
|
3212
|
+
"data-shape": shape,
|
|
3213
|
+
"data-multiple": "true"
|
|
3214
|
+
},
|
|
3215
|
+
/* @__PURE__ */ React19.createElement(
|
|
3216
|
+
InnerTrigger,
|
|
3217
|
+
{
|
|
3218
|
+
type: "button",
|
|
3219
|
+
"aria-label": "Increment",
|
|
3220
|
+
"data-raw": Boolean(raw),
|
|
3221
|
+
onClick: () => handleStep("up"),
|
|
3222
|
+
tabIndex: -1
|
|
3223
|
+
},
|
|
3224
|
+
/* @__PURE__ */ React19.createElement(ChevronIcon, { direction: "up" })
|
|
3225
|
+
),
|
|
3226
|
+
/* @__PURE__ */ React19.createElement(InnerDivider, { "data-raw": Boolean(raw) }),
|
|
3227
|
+
/* @__PURE__ */ React19.createElement(
|
|
3228
|
+
InnerTrigger,
|
|
3229
|
+
{
|
|
3230
|
+
type: "button",
|
|
3231
|
+
"aria-label": "Decrement",
|
|
3232
|
+
"data-raw": Boolean(raw),
|
|
3233
|
+
onClick: () => handleStep("down"),
|
|
3234
|
+
tabIndex: -1
|
|
3235
|
+
},
|
|
3236
|
+
/* @__PURE__ */ React19.createElement(ChevronIcon, { direction: "down" })
|
|
3237
|
+
)
|
|
3238
|
+
));
|
|
3239
|
+
};
|
|
3240
|
+
FieldNumber.displayName = "Field.Number";
|
|
3241
|
+
var FieldDate = (props) => {
|
|
3242
|
+
const {
|
|
3243
|
+
raw,
|
|
3244
|
+
sizing = "medium" /* Medium */,
|
|
3245
|
+
variant = "secondary" /* Secondary */,
|
|
3246
|
+
shape = "smooth" /* Smooth */,
|
|
3247
|
+
error,
|
|
3248
|
+
value,
|
|
3249
|
+
defaultValue,
|
|
3250
|
+
onChange,
|
|
3251
|
+
locale = typeof globalThis.navigator !== "undefined" ? globalThis.navigator.language : "en-US",
|
|
3252
|
+
withTime = false,
|
|
3253
|
+
disabled = false,
|
|
3254
|
+
id: idProp
|
|
3255
|
+
} = props;
|
|
3256
|
+
const { id: contextId } = useField();
|
|
3257
|
+
const id = idProp ?? contextId;
|
|
3258
|
+
const isControlled = value !== void 0;
|
|
3259
|
+
const metaId = React19.useId();
|
|
3260
|
+
const bufferRef = React19.useRef("");
|
|
3261
|
+
const segmentRefs = React19.useRef(/* @__PURE__ */ new Map());
|
|
3262
|
+
const [internalState, setInternalState] = React19.useState(
|
|
3263
|
+
() => dateToState(defaultValue ?? value ?? /* @__PURE__ */ new Date())
|
|
3264
|
+
);
|
|
3265
|
+
const [focusedSegment, setFocusedSegment] = React19.useState(null);
|
|
3266
|
+
const segments = buildSegments(internalState, locale, withTime);
|
|
3267
|
+
const editableSegments = segments.filter(
|
|
3268
|
+
(s) => s.type !== "literal"
|
|
3269
|
+
).map((s) => s.type);
|
|
3270
|
+
const stepSegment = (seg, delta) => {
|
|
3271
|
+
const { min, max } = SegmentRanges[seg];
|
|
3272
|
+
const current = internalState[seg];
|
|
3273
|
+
const range = max(internalState) - min + 1;
|
|
3274
|
+
const next = (current - min + delta + range) % range + min;
|
|
3275
|
+
commitState(
|
|
3276
|
+
isControlled,
|
|
3277
|
+
{ ...internalState, [seg]: next },
|
|
3278
|
+
setInternalState,
|
|
3279
|
+
onChange
|
|
3280
|
+
);
|
|
3281
|
+
};
|
|
3282
|
+
const handleSegmentKeyDown = (e, seg) => {
|
|
3283
|
+
if (disabled) return;
|
|
3284
|
+
const idx = editableSegments.indexOf(seg);
|
|
3285
|
+
switch (e.key) {
|
|
3286
|
+
case "ArrowUp": {
|
|
3287
|
+
e.preventDefault();
|
|
3288
|
+
bufferRef.current = "";
|
|
3289
|
+
stepSegment(seg, 1);
|
|
3290
|
+
break;
|
|
3291
|
+
}
|
|
3292
|
+
case "ArrowDown": {
|
|
3293
|
+
e.preventDefault();
|
|
3294
|
+
bufferRef.current = "";
|
|
3295
|
+
stepSegment(seg, -1);
|
|
3296
|
+
break;
|
|
3297
|
+
}
|
|
3298
|
+
// Move to the previous segment and reset the buffer
|
|
3299
|
+
case "ArrowLeft":
|
|
3300
|
+
case "Backspace": {
|
|
3301
|
+
e.preventDefault();
|
|
3302
|
+
bufferRef.current = "";
|
|
3303
|
+
if (idx > 0) focusSegmentByType(editableSegments[idx - 1]);
|
|
3304
|
+
break;
|
|
3305
|
+
}
|
|
3306
|
+
// ArrowRight advances manually; Tab is left to bubble for natural focus
|
|
3307
|
+
case "ArrowRight":
|
|
3308
|
+
case "Tab": {
|
|
3309
|
+
if (e.key === "ArrowRight") {
|
|
3310
|
+
e.preventDefault();
|
|
3311
|
+
bufferRef.current = "";
|
|
3312
|
+
if (idx < editableSegments.length - 1)
|
|
3313
|
+
focusSegmentByType(editableSegments[idx + 1]);
|
|
3314
|
+
}
|
|
3315
|
+
break;
|
|
3316
|
+
}
|
|
3317
|
+
default: {
|
|
3318
|
+
if (/^\d$/.test(e.key)) {
|
|
3319
|
+
e.preventDefault();
|
|
3320
|
+
bufferRef.current += e.key;
|
|
3321
|
+
const num = parseInt(bufferRef.current, 10);
|
|
3322
|
+
const { max } = SegmentRanges[seg];
|
|
3323
|
+
const maxVal = max(internalState);
|
|
3324
|
+
const clamped = clamp(num, seg, internalState);
|
|
3325
|
+
commitState(
|
|
3326
|
+
isControlled,
|
|
3327
|
+
{ ...internalState, [seg]: clamped },
|
|
3328
|
+
setInternalState,
|
|
3329
|
+
onChange
|
|
3330
|
+
);
|
|
3331
|
+
const maxDigits = String(maxVal).length;
|
|
3332
|
+
const willOverflow = parseInt(bufferRef.current + "0", 10) > maxVal || bufferRef.current.length >= maxDigits;
|
|
3333
|
+
if (willOverflow) {
|
|
3334
|
+
bufferRef.current = "";
|
|
3335
|
+
if (idx < editableSegments.length - 1)
|
|
3336
|
+
focusSegmentByType(editableSegments[idx + 1]);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
};
|
|
3342
|
+
const focusSegmentByType = (type) => {
|
|
3343
|
+
if (!type) return;
|
|
3344
|
+
segmentRefs.current.get(type)?.focus();
|
|
3345
|
+
};
|
|
3346
|
+
const handleWrapperClick = (e) => {
|
|
3347
|
+
if (e.target.dataset.segment) return;
|
|
3348
|
+
const timeout = setTimeout(() => {
|
|
3349
|
+
focusSegmentByType(editableSegments[0]);
|
|
3350
|
+
}, 0);
|
|
3351
|
+
return () => clearTimeout(timeout);
|
|
3352
|
+
};
|
|
3353
|
+
React19.useEffect(() => {
|
|
3354
|
+
if (isControlled && value) setInternalState(dateToState(value));
|
|
3355
|
+
}, [isControlled, value]);
|
|
3356
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3357
|
+
ParentWrapper,
|
|
3358
|
+
{
|
|
3359
|
+
id,
|
|
3360
|
+
role: "group",
|
|
3361
|
+
"aria-label": "Date input",
|
|
3362
|
+
"aria-invalid": !!error,
|
|
3363
|
+
"aria-describedby": metaId,
|
|
3364
|
+
"data-error": Boolean(error),
|
|
3365
|
+
"data-variant": variant,
|
|
3366
|
+
"data-size": sizing,
|
|
3367
|
+
"data-shape": shape,
|
|
3368
|
+
"data-raw": Boolean(raw),
|
|
3369
|
+
"data-disabled": disabled,
|
|
3370
|
+
onClick: handleWrapperClick
|
|
3371
|
+
},
|
|
3372
|
+
segments.map((seg, i) => {
|
|
3373
|
+
if (seg.type === "literal") {
|
|
3374
|
+
return /* @__PURE__ */ React19.createElement(Muted, { key: i, "data-raw": Boolean(raw), "aria-hidden": "true" }, seg.value);
|
|
3375
|
+
}
|
|
3376
|
+
const isFocused = focusedSegment === seg.type;
|
|
3377
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3378
|
+
InnerSegment,
|
|
3379
|
+
{
|
|
3380
|
+
key: seg.type,
|
|
3381
|
+
ref: (el) => segmentRefs.current.set(seg.type, el),
|
|
3382
|
+
role: "spinbutton",
|
|
3383
|
+
"aria-label": seg.type,
|
|
3384
|
+
"aria-valuenow": internalState[seg.type],
|
|
3385
|
+
"aria-valuemin": SegmentRanges[seg.type].min,
|
|
3386
|
+
"aria-valuemax": SegmentRanges[seg.type].max(internalState),
|
|
3387
|
+
tabIndex: disabled ? -1 : 0,
|
|
3388
|
+
"data-raw": Boolean(raw),
|
|
3389
|
+
"data-focused": isFocused,
|
|
3390
|
+
"data-segment": seg.type,
|
|
3391
|
+
onFocus: () => {
|
|
3392
|
+
setFocusedSegment(seg.type);
|
|
3393
|
+
bufferRef.current = "";
|
|
3394
|
+
},
|
|
3395
|
+
onBlur: () => setFocusedSegment(null),
|
|
3396
|
+
onKeyDown: (e) => {
|
|
3397
|
+
if (seg.type === "literal") return;
|
|
3398
|
+
handleSegmentKeyDown(e, seg.type);
|
|
3399
|
+
}
|
|
3400
|
+
},
|
|
3401
|
+
seg.value
|
|
3402
|
+
);
|
|
3403
|
+
})
|
|
3404
|
+
);
|
|
3405
|
+
};
|
|
3406
|
+
FieldDate.displayName = "Field.Date";
|
|
3407
|
+
var FieldFile = (props) => {
|
|
3408
|
+
const {
|
|
3409
|
+
raw,
|
|
3410
|
+
sizing = "medium" /* Medium */,
|
|
3411
|
+
variant = "secondary" /* Secondary */,
|
|
3412
|
+
shape = "smooth" /* Smooth */,
|
|
3413
|
+
error,
|
|
3414
|
+
trigger,
|
|
3415
|
+
onFileChange,
|
|
3416
|
+
disabled,
|
|
3417
|
+
accept,
|
|
3418
|
+
multiple,
|
|
3419
|
+
...restProps
|
|
3420
|
+
} = props;
|
|
3421
|
+
const fileInputRef = React19.useRef(null);
|
|
3422
|
+
const [fileName, setFileName] = React19.useState("");
|
|
3423
|
+
const handleTriggerClick = () => {
|
|
3424
|
+
fileInputRef.current?.click();
|
|
3425
|
+
};
|
|
3426
|
+
const handleFileChange = (e) => {
|
|
3427
|
+
const files = e.target.files;
|
|
3428
|
+
if (files && files.length > 0) {
|
|
3429
|
+
const names = Array.from(files).map((f) => f.name).join(", ");
|
|
3430
|
+
setFileName(names);
|
|
3431
|
+
} else setFileName("");
|
|
3432
|
+
onFileChange?.(files);
|
|
3433
|
+
};
|
|
3434
|
+
const handleKeyDown = (e) => {
|
|
3435
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3436
|
+
e.preventDefault();
|
|
3437
|
+
fileInputRef.current?.click();
|
|
3438
|
+
}
|
|
3439
|
+
};
|
|
3440
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
3441
|
+
"input",
|
|
3442
|
+
{
|
|
3443
|
+
ref: fileInputRef,
|
|
3444
|
+
type: "file",
|
|
3445
|
+
"aria-hidden": "true",
|
|
3446
|
+
tabIndex: -1,
|
|
3447
|
+
disabled,
|
|
3448
|
+
accept,
|
|
3449
|
+
multiple,
|
|
3450
|
+
onChange: handleFileChange,
|
|
3451
|
+
style: { display: "none" }
|
|
3452
|
+
}
|
|
3453
|
+
), /* @__PURE__ */ React19.createElement(ParentContainer, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React19.createElement(
|
|
3454
|
+
Field,
|
|
3455
|
+
{
|
|
3456
|
+
type: "text",
|
|
3457
|
+
readOnly: true,
|
|
3458
|
+
raw,
|
|
3459
|
+
sizing,
|
|
3460
|
+
variant,
|
|
3461
|
+
shape,
|
|
3462
|
+
error,
|
|
3463
|
+
disabled,
|
|
3464
|
+
value: fileName,
|
|
3465
|
+
onClick: (e) => {
|
|
3466
|
+
handleTriggerClick();
|
|
3467
|
+
restProps.onClick?.(e);
|
|
3468
|
+
},
|
|
3469
|
+
onKeyDown: (e) => {
|
|
3470
|
+
handleKeyDown(e);
|
|
3471
|
+
restProps.onKeyDown?.(e);
|
|
3472
|
+
},
|
|
3473
|
+
...restProps
|
|
3474
|
+
}
|
|
3475
|
+
), trigger && /* @__PURE__ */ React19.createElement(
|
|
3476
|
+
InnerWrapper,
|
|
3477
|
+
{
|
|
3478
|
+
"data-raw": Boolean(raw),
|
|
3479
|
+
"data-error": Boolean(error),
|
|
3480
|
+
"data-variant": variant,
|
|
3481
|
+
"data-shape": shape
|
|
3482
|
+
},
|
|
3483
|
+
/* @__PURE__ */ React19.createElement(
|
|
3484
|
+
InnerTrigger,
|
|
3485
|
+
{
|
|
3486
|
+
type: "button",
|
|
3487
|
+
"data-raw": Boolean(raw),
|
|
3488
|
+
"data-shape": shape,
|
|
3489
|
+
"data-error": Boolean(error),
|
|
3490
|
+
disabled,
|
|
3491
|
+
variant,
|
|
3492
|
+
onClick: handleTriggerClick,
|
|
3493
|
+
"aria-label": typeof trigger === "string" ? trigger : "file-upload-trigger"
|
|
3494
|
+
},
|
|
3495
|
+
trigger
|
|
3496
|
+
)
|
|
3497
|
+
)));
|
|
3498
|
+
};
|
|
3499
|
+
FieldFile.displayName = "Field.File";
|
|
3500
|
+
var FieldPassword = (props) => {
|
|
3501
|
+
const {
|
|
3502
|
+
raw,
|
|
3503
|
+
sizing = "medium" /* Medium */,
|
|
3504
|
+
variant = "secondary" /* Secondary */,
|
|
3505
|
+
shape = "smooth" /* Smooth */,
|
|
3506
|
+
error,
|
|
3507
|
+
disabled,
|
|
3508
|
+
defaultType,
|
|
3509
|
+
...restProps
|
|
3510
|
+
} = props;
|
|
3511
|
+
const [type, setType] = React19.useState(
|
|
3512
|
+
defaultType ?? "password"
|
|
3513
|
+
);
|
|
3514
|
+
const handleChangeType = React19.useCallback(() => {
|
|
3515
|
+
if (type === "text") setType("password");
|
|
3516
|
+
if (type === "password") setType("text");
|
|
3517
|
+
}, [type, setType]);
|
|
3518
|
+
const ShowIcon = () => {
|
|
3519
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement("path", { d: "M2.42 12.713c-.136-.215-.204-.323-.242-.49a1.173 1.173 0 0 1 0-.446c.038-.167.106-.274.242-.49C3.546 9.505 6.895 5 12 5s8.455 4.505 9.58 6.287c.137.215.205.323.243.49.029.125.029.322 0 .446-.038.167-.106.274-.242.49C20.455 14.495 17.105 19 12 19c-5.106 0-8.455-4.505-9.58-6.287Z" }), /* @__PURE__ */ React19.createElement("path", { d: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" }));
|
|
3520
|
+
};
|
|
3521
|
+
const HideIcon = () => {
|
|
3522
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement("path", { d: "M10.743 5.092C11.149 5.032 11.569 5 12 5c5.105 0 8.455 4.505 9.58 6.287.137.215.205.323.243.49a1.16 1.16 0 0 1 0 .447c-.038.166-.107.274-.244.492-.3.474-.757 1.141-1.363 1.865M6.724 6.715c-2.162 1.467-3.63 3.504-4.303 4.57-.137.217-.205.325-.243.492a1.173 1.173 0 0 0 0 .446c.038.167.106.274.242.49C3.546 14.495 6.895 19 12 19c2.059 0 3.832-.732 5.289-1.723M3 3l18 18M9.88 9.879a3 3 0 1 0 4.243 4.243" }));
|
|
3523
|
+
};
|
|
3524
|
+
return /* @__PURE__ */ React19.createElement(ParentContainer, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React19.createElement(
|
|
3525
|
+
Field,
|
|
3526
|
+
{
|
|
3527
|
+
autoComplete: "off",
|
|
3528
|
+
type,
|
|
3529
|
+
raw,
|
|
3530
|
+
sizing,
|
|
3531
|
+
variant,
|
|
3532
|
+
shape,
|
|
3533
|
+
error,
|
|
3534
|
+
disabled,
|
|
3535
|
+
...restProps
|
|
3536
|
+
}
|
|
3537
|
+
), /* @__PURE__ */ React19.createElement(
|
|
3538
|
+
InnerWrapper,
|
|
3539
|
+
{
|
|
3540
|
+
"data-raw": Boolean(raw),
|
|
3541
|
+
"data-error": Boolean(error),
|
|
3542
|
+
"data-variant": variant,
|
|
3543
|
+
"data-shape": shape
|
|
3544
|
+
},
|
|
3545
|
+
/* @__PURE__ */ React19.createElement(
|
|
3546
|
+
InnerTrigger,
|
|
3547
|
+
{
|
|
3548
|
+
type: "button",
|
|
3549
|
+
"data-raw": Boolean(raw),
|
|
3550
|
+
"data-shape": shape,
|
|
3551
|
+
"data-error": Boolean(error),
|
|
3552
|
+
disabled,
|
|
3553
|
+
variant,
|
|
3554
|
+
onClick: handleChangeType,
|
|
3555
|
+
"aria-label": "password-field-trigger"
|
|
3556
|
+
},
|
|
3557
|
+
/* @__PURE__ */ React19.createElement(
|
|
3558
|
+
"svg",
|
|
3559
|
+
{
|
|
3560
|
+
viewBox: "0 0 24 24",
|
|
3561
|
+
width: "var(--fontsize-medium-10)",
|
|
3562
|
+
height: "var(--fontsize-medium-10)",
|
|
3563
|
+
stroke: "currentColor",
|
|
3564
|
+
"stroke-width": "2",
|
|
3565
|
+
fill: "none",
|
|
3566
|
+
"stroke-linecap": "round",
|
|
3567
|
+
"stroke-linejoin": "round",
|
|
3568
|
+
"aria-hidden": "true"
|
|
3569
|
+
},
|
|
3570
|
+
type === "password" ? /* @__PURE__ */ React19.createElement(ShowIcon, null) : /* @__PURE__ */ React19.createElement(HideIcon, null)
|
|
3571
|
+
)
|
|
3572
|
+
)
|
|
3573
|
+
));
|
|
3574
|
+
};
|
|
3575
|
+
FieldPassword.displayName = "Field.Password";
|
|
3576
|
+
var FieldTag = (props) => {
|
|
2230
3577
|
const {
|
|
2231
3578
|
raw,
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
3579
|
+
sizing = "medium" /* Medium */,
|
|
3580
|
+
variant = "secondary" /* Secondary */,
|
|
3581
|
+
shape = "smooth" /* Smooth */,
|
|
3582
|
+
error,
|
|
3583
|
+
value,
|
|
3584
|
+
defaultValue,
|
|
3585
|
+
allowed,
|
|
3586
|
+
onChange,
|
|
3587
|
+
disabled = false,
|
|
3588
|
+
placeholder,
|
|
3589
|
+
id: idProp
|
|
2235
3590
|
} = props;
|
|
3591
|
+
const { id: contextId } = useField();
|
|
3592
|
+
const id = idProp ?? contextId;
|
|
2236
3593
|
const metaId = React19.useId();
|
|
2237
|
-
const
|
|
3594
|
+
const isControlled = value !== void 0;
|
|
3595
|
+
const [internalTags, setInternalTags] = React19.useState(
|
|
3596
|
+
defaultValue ?? []
|
|
3597
|
+
);
|
|
3598
|
+
const [inputValue, setInputValue] = React19.useState("");
|
|
3599
|
+
const [focusedTagIndex, setFocusedTagIndex] = React19.useState(
|
|
3600
|
+
null
|
|
3601
|
+
);
|
|
3602
|
+
const inputRef = React19.useRef(null);
|
|
3603
|
+
const tagRefs = React19.useRef(/* @__PURE__ */ new Map());
|
|
3604
|
+
const tags = isControlled ? value : internalTags;
|
|
3605
|
+
const commitTags = React19.useCallback(
|
|
3606
|
+
(next) => {
|
|
3607
|
+
if (!isControlled) setInternalTags(next);
|
|
3608
|
+
onChange?.(next);
|
|
3609
|
+
},
|
|
3610
|
+
[isControlled, onChange]
|
|
3611
|
+
);
|
|
3612
|
+
const addTag = React19.useCallback(
|
|
3613
|
+
(label) => {
|
|
3614
|
+
const trimmed = label.trim();
|
|
3615
|
+
if (!trimmed) return;
|
|
3616
|
+
if (tags.some((t) => t.toLowerCase() === trimmed.toLowerCase())) {
|
|
3617
|
+
return;
|
|
3618
|
+
}
|
|
3619
|
+
if (!allowed?.some((a) => a.toLowerCase() === trimmed.toLowerCase())) {
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
commitTags([...tags, trimmed]);
|
|
3623
|
+
setInputValue("");
|
|
3624
|
+
},
|
|
3625
|
+
[tags, commitTags, allowed]
|
|
3626
|
+
);
|
|
3627
|
+
const removeTag = React19.useCallback(
|
|
3628
|
+
(index) => {
|
|
3629
|
+
const next = tags.filter((_, i) => i !== index);
|
|
3630
|
+
commitTags(next);
|
|
3631
|
+
setFocusedTagIndex(null);
|
|
3632
|
+
inputRef.current?.focus();
|
|
3633
|
+
},
|
|
3634
|
+
[tags, commitTags]
|
|
3635
|
+
);
|
|
3636
|
+
const handleInputKeyDown = (e) => {
|
|
3637
|
+
if (disabled) return;
|
|
3638
|
+
if (e.key === "Enter") {
|
|
3639
|
+
e.preventDefault();
|
|
3640
|
+
addTag(inputValue);
|
|
3641
|
+
return;
|
|
3642
|
+
}
|
|
3643
|
+
if ((e.key === "Backspace" || e.key === "Delete") && inputValue === "" && tags.length > 0) {
|
|
3644
|
+
e.preventDefault();
|
|
3645
|
+
const lastIndex = tags.length - 1;
|
|
3646
|
+
setFocusedTagIndex(lastIndex);
|
|
3647
|
+
tagRefs.current.get(lastIndex)?.focus();
|
|
3648
|
+
}
|
|
3649
|
+
};
|
|
3650
|
+
const handleTagKeyDown = (e, index) => {
|
|
3651
|
+
if (disabled) return;
|
|
3652
|
+
switch (e.key) {
|
|
3653
|
+
case "Backspace":
|
|
3654
|
+
case "Delete": {
|
|
3655
|
+
e.preventDefault();
|
|
3656
|
+
removeTag(index);
|
|
3657
|
+
break;
|
|
3658
|
+
}
|
|
3659
|
+
case "ArrowLeft": {
|
|
3660
|
+
e.preventDefault();
|
|
3661
|
+
if (index > 0) {
|
|
3662
|
+
const prev = index - 1;
|
|
3663
|
+
setFocusedTagIndex(prev);
|
|
3664
|
+
tagRefs.current.get(prev)?.focus();
|
|
3665
|
+
}
|
|
3666
|
+
break;
|
|
3667
|
+
}
|
|
3668
|
+
case "ArrowRight": {
|
|
3669
|
+
e.preventDefault();
|
|
3670
|
+
if (index < tags.length - 1) {
|
|
3671
|
+
const next = index + 1;
|
|
3672
|
+
setFocusedTagIndex(next);
|
|
3673
|
+
tagRefs.current.get(next)?.focus();
|
|
3674
|
+
} else {
|
|
3675
|
+
setFocusedTagIndex(null);
|
|
3676
|
+
inputRef.current?.focus();
|
|
3677
|
+
}
|
|
3678
|
+
break;
|
|
3679
|
+
}
|
|
3680
|
+
case "Escape": {
|
|
3681
|
+
e.preventDefault();
|
|
3682
|
+
setFocusedTagIndex(null);
|
|
3683
|
+
inputRef.current?.focus();
|
|
3684
|
+
break;
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
};
|
|
3688
|
+
const handleWrapperClick = (e) => {
|
|
3689
|
+
const target = e.target;
|
|
3690
|
+
if (!target.closest("[data-tag]")) {
|
|
3691
|
+
inputRef.current?.focus();
|
|
3692
|
+
}
|
|
3693
|
+
};
|
|
3694
|
+
React19.useEffect(() => {
|
|
3695
|
+
if (isControlled && value) setInternalTags(value);
|
|
3696
|
+
}, [isControlled, value]);
|
|
2238
3697
|
return /* @__PURE__ */ React19.createElement(
|
|
2239
|
-
|
|
3698
|
+
ParentWrapper,
|
|
2240
3699
|
{
|
|
2241
|
-
id
|
|
2242
|
-
"
|
|
3700
|
+
id,
|
|
3701
|
+
role: "group",
|
|
3702
|
+
"aria-invalid": !!error,
|
|
3703
|
+
"aria-describedby": metaId,
|
|
3704
|
+
"data-error": Boolean(error),
|
|
2243
3705
|
"data-variant": variant,
|
|
3706
|
+
"data-size": sizing,
|
|
3707
|
+
"data-shape": shape,
|
|
2244
3708
|
"data-raw": Boolean(raw),
|
|
2245
|
-
|
|
3709
|
+
"data-disabled": disabled,
|
|
3710
|
+
"data-wrap": "true",
|
|
3711
|
+
onClick: handleWrapperClick
|
|
2246
3712
|
},
|
|
2247
|
-
|
|
3713
|
+
tags.map((tag, index) => /* @__PURE__ */ React19.createElement(
|
|
3714
|
+
InnerSegment,
|
|
3715
|
+
{
|
|
3716
|
+
key: `${tag}-${index}`,
|
|
3717
|
+
ref: (el) => tagRefs.current.set(index, el),
|
|
3718
|
+
role: "option",
|
|
3719
|
+
"aria-label": tag,
|
|
3720
|
+
"aria-selected": focusedTagIndex === index,
|
|
3721
|
+
tabIndex: disabled ? -1 : -1,
|
|
3722
|
+
"data-raw": Boolean(raw),
|
|
3723
|
+
"data-focused": focusedTagIndex === index,
|
|
3724
|
+
"data-tag": "true",
|
|
3725
|
+
onFocus: () => setFocusedTagIndex(index),
|
|
3726
|
+
onBlur: () => setFocusedTagIndex(null),
|
|
3727
|
+
onKeyDown: (e) => handleTagKeyDown(e, index)
|
|
3728
|
+
},
|
|
3729
|
+
/* @__PURE__ */ React19.createElement(Badge, { sizing: "small", variant: "border" }, tag, !disabled && /* @__PURE__ */ React19.createElement(
|
|
3730
|
+
Button,
|
|
3731
|
+
{
|
|
3732
|
+
variant: "ghost",
|
|
3733
|
+
sizing: "small",
|
|
3734
|
+
"aria-label": `Remove ${tag}`,
|
|
3735
|
+
"data-tag": "true",
|
|
3736
|
+
className: "m-l-small-60 ",
|
|
3737
|
+
onClick: (e) => {
|
|
3738
|
+
e.stopPropagation();
|
|
3739
|
+
removeTag(index);
|
|
3740
|
+
}
|
|
3741
|
+
},
|
|
3742
|
+
"\xD7"
|
|
3743
|
+
))
|
|
3744
|
+
)),
|
|
3745
|
+
/* @__PURE__ */ React19.createElement(
|
|
3746
|
+
HiddenInput,
|
|
3747
|
+
{
|
|
3748
|
+
ref: inputRef,
|
|
3749
|
+
type: "text",
|
|
3750
|
+
value: inputValue,
|
|
3751
|
+
disabled,
|
|
3752
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
3753
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
3754
|
+
onKeyDown: handleInputKeyDown
|
|
3755
|
+
}
|
|
3756
|
+
)
|
|
2248
3757
|
);
|
|
2249
3758
|
};
|
|
2250
|
-
|
|
3759
|
+
FieldTag.displayName = "Field.Tag";
|
|
2251
3760
|
Field.Root = FieldRoot;
|
|
2252
3761
|
Field.Wrapper = FieldWrapper;
|
|
2253
3762
|
Field.Label = FieldLabel;
|
|
2254
3763
|
Field.Meta = FieldMeta;
|
|
3764
|
+
Field.Number = FieldNumber;
|
|
3765
|
+
Field.Date = FieldDate;
|
|
3766
|
+
Field.File = FieldFile;
|
|
3767
|
+
Field.Password = FieldPassword;
|
|
3768
|
+
Field.Tag = FieldTag;
|
|
2255
3769
|
|
|
2256
3770
|
// src/message-bubble/index.tsx
|
|
2257
3771
|
import React21 from "react";
|
|
@@ -2306,26 +3820,23 @@ var MessageBubbleBadge = styled11(Badge)`
|
|
|
2306
3820
|
width: 100%;
|
|
2307
3821
|
justify-self: flex-end;
|
|
2308
3822
|
padding: var(--measurement-medium-30) var(--measurement-medium-50) !important;
|
|
2309
|
-
border-radius: var(--measurement-medium-60) !important;
|
|
2310
3823
|
|
|
2311
3824
|
&[data-side="left"] {
|
|
2312
|
-
|
|
2313
|
-
border-bottom-left-radius: 0 !important;
|
|
3825
|
+
border-top-left-radius: 0 !important;
|
|
2314
3826
|
}
|
|
2315
3827
|
|
|
2316
3828
|
&[data-side="right"] {
|
|
2317
|
-
|
|
2318
|
-
border-bottom-right-radius: 0 !important;
|
|
3829
|
+
border-top-right-radius: 0 !important;
|
|
2319
3830
|
}
|
|
2320
3831
|
`;
|
|
2321
3832
|
var MessageBubbleContentWrapper = styled11.div`
|
|
2322
|
-
line-height: 1.
|
|
3833
|
+
line-height: 1.3;
|
|
2323
3834
|
font-weight: 500;
|
|
2324
3835
|
word-break: keep-all;
|
|
2325
3836
|
width: 100%;
|
|
2326
3837
|
|
|
2327
3838
|
* {
|
|
2328
|
-
font-size:
|
|
3839
|
+
font-size: inherit !important;
|
|
2329
3840
|
}
|
|
2330
3841
|
`;
|
|
2331
3842
|
var MessageBubbleMetaWrapper = styled11.div`
|
|
@@ -2367,14 +3878,16 @@ var MessageBubble = (props) => {
|
|
|
2367
3878
|
};
|
|
2368
3879
|
MessageBubble.displayName = "MessageBubble";
|
|
2369
3880
|
var MessageBubbleContent = (props) => {
|
|
2370
|
-
const { children, raw, ...restProps } = props;
|
|
3881
|
+
const { sizing, shape, variant, children, raw, ...restProps } = props;
|
|
2371
3882
|
const { id, states } = useMessageBubble();
|
|
2372
3883
|
return /* @__PURE__ */ React21.createElement(
|
|
2373
3884
|
MessageBubbleBadge,
|
|
2374
3885
|
{
|
|
2375
|
-
variant: "secondary",
|
|
2376
3886
|
"data-raw": Boolean(raw),
|
|
2377
3887
|
"data-side": states?.side,
|
|
3888
|
+
variant: variant ?? "border" /* Border */,
|
|
3889
|
+
shape: shape ?? "smooth" /* Smooth */,
|
|
3890
|
+
sizing: sizing ?? "medium" /* Medium */,
|
|
2378
3891
|
"aria-label": `message-bubble-content-${id}`,
|
|
2379
3892
|
...restProps
|
|
2380
3893
|
},
|
|
@@ -2395,6 +3908,7 @@ var MessageBubbleMeta = (props) => {
|
|
|
2395
3908
|
"data-raw": Boolean(raw),
|
|
2396
3909
|
"data-side": states?.side,
|
|
2397
3910
|
"aria-label": `message-bubble-meta-${states?.side}`,
|
|
3911
|
+
className: "fs-small-60 opacity-default-60",
|
|
2398
3912
|
...restProps
|
|
2399
3913
|
},
|
|
2400
3914
|
formattedDate
|
|
@@ -2420,36 +3934,132 @@ var useOTPField = () => {
|
|
|
2420
3934
|
};
|
|
2421
3935
|
|
|
2422
3936
|
// src/otp-field/styles/index.ts
|
|
2423
|
-
import styled12 from "styled-components";
|
|
2424
|
-
var
|
|
3937
|
+
import styled12, { css as css9 } from "styled-components";
|
|
3938
|
+
var OTPShapeStyles = css9`
|
|
3939
|
+
&[data-shape="square"] {
|
|
3940
|
+
border-radius: 0;
|
|
3941
|
+
}
|
|
3942
|
+
&[data-shape="smooth"] {
|
|
3943
|
+
border-radius: var(--measurement-medium-20);
|
|
3944
|
+
}
|
|
3945
|
+
&[data-shape="round"] {
|
|
3946
|
+
border-radius: var(--measurement-large-90);
|
|
3947
|
+
padding-left: var(--measurement-medium-50) !important;
|
|
3948
|
+
}
|
|
3949
|
+
`;
|
|
3950
|
+
var OTPCellDefaultStyles = css9`
|
|
3951
|
+
outline: none;
|
|
3952
|
+
cursor: text;
|
|
3953
|
+
display: flex;
|
|
3954
|
+
align-items: center;
|
|
3955
|
+
justify-content: center;
|
|
3956
|
+
text-align: center;
|
|
3957
|
+
box-sizing: border-box;
|
|
3958
|
+
|
|
3959
|
+
font-size: var(--fontsize-medium-20);
|
|
3960
|
+
|
|
3961
|
+
padding: 0 var(--measurement-medium-30);
|
|
2425
3962
|
width: var(--measurement-medium-90);
|
|
2426
3963
|
height: var(--measurement-medium-90);
|
|
2427
|
-
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2428
3964
|
|
|
2429
|
-
|
|
3965
|
+
line-height: 1;
|
|
3966
|
+
letter-spacing: calc(
|
|
3967
|
+
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
3968
|
+
);
|
|
3969
|
+
|
|
3970
|
+
border: var(--measurement-small-10) solid transparent;
|
|
3971
|
+
|
|
2430
3972
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
3973
|
+
color: var(--font-color-alpha-60);
|
|
2431
3974
|
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
3975
|
+
transition: all ease-in-out 0.2s;
|
|
3976
|
+
|
|
3977
|
+
svg,
|
|
3978
|
+
span,
|
|
3979
|
+
img {
|
|
3980
|
+
opacity: 0.6;
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
&:hover,
|
|
3984
|
+
&:focus,
|
|
3985
|
+
&:active,
|
|
3986
|
+
&:focus-within,
|
|
3987
|
+
&:has(:active) {
|
|
3988
|
+
color: var(--font-color);
|
|
3989
|
+
svg,
|
|
3990
|
+
span,
|
|
3991
|
+
img {
|
|
3992
|
+
opacity: 1;
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
|
|
3996
|
+
&::placeholder {
|
|
3997
|
+
color: var(--font-color-alpha-30);
|
|
3998
|
+
}
|
|
2435
3999
|
|
|
2436
|
-
|
|
2437
|
-
|
|
4000
|
+
&:disabled,
|
|
4001
|
+
&:has(:disabled) {
|
|
4002
|
+
cursor: not-allowed;
|
|
4003
|
+
opacity: 0.6;
|
|
4004
|
+
}
|
|
2438
4005
|
|
|
2439
4006
|
background-color: transparent;
|
|
2440
|
-
|
|
2441
|
-
outline: none;
|
|
4007
|
+
border-color: var(--font-color-alpha-10);
|
|
2442
4008
|
|
|
2443
|
-
&:
|
|
2444
|
-
|
|
4009
|
+
&:hover,
|
|
4010
|
+
&:focus,
|
|
4011
|
+
&:active,
|
|
4012
|
+
&:focus-within,
|
|
4013
|
+
&:has(:hover),
|
|
4014
|
+
&:has(:active) {
|
|
4015
|
+
border-color: var(--font-color-alpha-20);
|
|
4016
|
+
}
|
|
4017
|
+
|
|
4018
|
+
&:focus,
|
|
4019
|
+
&:active,
|
|
4020
|
+
&:focus-within,
|
|
4021
|
+
&:has(:active) {
|
|
4022
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-accent-30);
|
|
2445
4023
|
}
|
|
2446
4024
|
|
|
2447
|
-
|
|
4025
|
+
background-color: transparent;
|
|
4026
|
+
border-color: var(--font-color-alpha-10);
|
|
4027
|
+
|
|
4028
|
+
&:hover,
|
|
4029
|
+
&:focus,
|
|
4030
|
+
&:active,
|
|
4031
|
+
&:focus-within,
|
|
4032
|
+
&:has(:hover),
|
|
4033
|
+
&:has(:active) {
|
|
2448
4034
|
border-color: var(--font-color-alpha-20);
|
|
2449
4035
|
}
|
|
2450
4036
|
|
|
2451
|
-
|
|
2452
|
-
|
|
4037
|
+
&:focus,
|
|
4038
|
+
&:active,
|
|
4039
|
+
&:focus-within,
|
|
4040
|
+
&:has(:active) {
|
|
4041
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
&[data-error="true"] {
|
|
4045
|
+
color: var(--color-red);
|
|
4046
|
+
border-color: var(--alpha-red-10);
|
|
4047
|
+
|
|
4048
|
+
&:hover,
|
|
4049
|
+
&:focus,
|
|
4050
|
+
&:active,
|
|
4051
|
+
&:focus-within,
|
|
4052
|
+
&:has(:hover),
|
|
4053
|
+
&:has(:active) {
|
|
4054
|
+
background-color: var(--alpha-red-10);
|
|
4055
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
`;
|
|
4059
|
+
var OTPCell = styled12.input`
|
|
4060
|
+
&[data-raw="false"] {
|
|
4061
|
+
${OTPCellDefaultStyles}
|
|
4062
|
+
${OTPShapeStyles}
|
|
2453
4063
|
}
|
|
2454
4064
|
`;
|
|
2455
4065
|
|
|
@@ -2559,6 +4169,8 @@ var OTPFieldGroup = React23.forwardRef(({ ...props }, ref) => {
|
|
|
2559
4169
|
OTPFieldGroup.displayName = "OTPField.Group";
|
|
2560
4170
|
var OTPFieldSlot = ({
|
|
2561
4171
|
index,
|
|
4172
|
+
shape,
|
|
4173
|
+
raw,
|
|
2562
4174
|
...props
|
|
2563
4175
|
}) => {
|
|
2564
4176
|
const context = useOTPField();
|
|
@@ -2582,6 +4194,8 @@ var OTPFieldSlot = ({
|
|
|
2582
4194
|
type: "text",
|
|
2583
4195
|
"data-testid": "otp-field-slot",
|
|
2584
4196
|
"data-active": activeIndex === index,
|
|
4197
|
+
"data-shape": shape ?? "smooth" /* Smooth */,
|
|
4198
|
+
"data-raw": Boolean(raw),
|
|
2585
4199
|
autoComplete: "one-time-code",
|
|
2586
4200
|
maxLength: 1,
|
|
2587
4201
|
value: otp[index] || "",
|
|
@@ -2624,6 +4238,7 @@ var OverlayWrapper = styled13.div`
|
|
|
2624
4238
|
|
|
2625
4239
|
&[data-raw="false"] {
|
|
2626
4240
|
background-color: rgba(0, 0, 0, 0.6); // Always forced to black
|
|
4241
|
+
|
|
2627
4242
|
animation-duration: 0.2s;
|
|
2628
4243
|
animation-name: animate-fade;
|
|
2629
4244
|
animation-fill-mode: backwards;
|
|
@@ -2661,8 +4276,8 @@ import React25 from "react";
|
|
|
2661
4276
|
import styled15 from "styled-components";
|
|
2662
4277
|
|
|
2663
4278
|
// src/scrollarea/styles/index.ts
|
|
2664
|
-
import styled14, { css as
|
|
2665
|
-
var HiddenScrollbar =
|
|
4279
|
+
import styled14, { css as css10 } from "styled-components";
|
|
4280
|
+
var HiddenScrollbar = css10`
|
|
2666
4281
|
scrollbar-width: none;
|
|
2667
4282
|
|
|
2668
4283
|
&::-webkit-scrollbar {
|
|
@@ -2674,7 +4289,7 @@ var HiddenScrollbar = css9`
|
|
|
2674
4289
|
display: none;
|
|
2675
4290
|
}
|
|
2676
4291
|
`;
|
|
2677
|
-
var CustomScrollbar =
|
|
4292
|
+
var CustomScrollbar = css10`
|
|
2678
4293
|
height: ${({ $height }) => $height || "100%"};
|
|
2679
4294
|
width: ${({ $width }) => $width || "100%"};
|
|
2680
4295
|
overflow-y: auto;
|
|
@@ -2916,55 +4531,19 @@ var Portal = (props) => {
|
|
|
2916
4531
|
};
|
|
2917
4532
|
Portal.displayName = "Portal";
|
|
2918
4533
|
|
|
2919
|
-
// src/privacy-field/index.tsx
|
|
2920
|
-
import React27 from "react";
|
|
2921
|
-
|
|
2922
|
-
// src/privacy-field/styles/index.ts
|
|
2923
|
-
import styled16 from "styled-components";
|
|
2924
|
-
var Wrapper = styled16(Field.Wrapper)`
|
|
2925
|
-
position: relative;
|
|
2926
|
-
|
|
2927
|
-
input {
|
|
2928
|
-
width: 100% !important;
|
|
2929
|
-
}
|
|
2930
|
-
`;
|
|
2931
|
-
var Trigger = styled16(Button)`
|
|
2932
|
-
position: absolute !important;
|
|
2933
|
-
right: var(--measurement-medium-50);
|
|
2934
|
-
top: calc(var(--measurement-medium-50));
|
|
2935
|
-
`;
|
|
2936
|
-
|
|
2937
|
-
// src/privacy-field/index.tsx
|
|
2938
|
-
var PrivacyField = ({
|
|
2939
|
-
defaultType,
|
|
2940
|
-
textIcon,
|
|
2941
|
-
passwordIcon,
|
|
2942
|
-
...restProps
|
|
2943
|
-
}) => {
|
|
2944
|
-
const [type, setType] = React27.useState(
|
|
2945
|
-
defaultType ?? "password"
|
|
2946
|
-
);
|
|
2947
|
-
const handleChangeType = React27.useCallback(() => {
|
|
2948
|
-
if (type === "text") setType("password");
|
|
2949
|
-
if (type === "password") setType("text");
|
|
2950
|
-
}, [type, setType]);
|
|
2951
|
-
return /* @__PURE__ */ React27.createElement(Wrapper, { className: "flex" }, /* @__PURE__ */ React27.createElement(Field, { autoComplete: "off", type, ...restProps }), /* @__PURE__ */ React27.createElement(Trigger, { variant: "ghost", sizing: "small", onClick: handleChangeType }, type === "text" && textIcon, type === "password" && passwordIcon));
|
|
2952
|
-
};
|
|
2953
|
-
PrivacyField.displayName = "PrivacyField";
|
|
2954
|
-
|
|
2955
4534
|
// src/resizable/index.tsx
|
|
2956
|
-
import
|
|
4535
|
+
import React27 from "react";
|
|
2957
4536
|
|
|
2958
4537
|
// src/resizable/styles/index.ts
|
|
2959
|
-
import
|
|
2960
|
-
var SplitContainer =
|
|
4538
|
+
import styled16 from "styled-components";
|
|
4539
|
+
var SplitContainer = styled16.div`
|
|
2961
4540
|
position: relative;
|
|
2962
4541
|
`;
|
|
2963
|
-
var Panel =
|
|
4542
|
+
var Panel = styled16.div`
|
|
2964
4543
|
overflow: hidden;
|
|
2965
4544
|
width: ${(props) => props.width}%;
|
|
2966
4545
|
`;
|
|
2967
|
-
var Divider2 =
|
|
4546
|
+
var Divider2 = styled16.div`
|
|
2968
4547
|
width: var(--measurement-medium-10);
|
|
2969
4548
|
height: 100%;
|
|
2970
4549
|
top: 0;
|
|
@@ -2988,14 +4567,14 @@ var Divider2 = styled17.div`
|
|
|
2988
4567
|
height: ${(props) => props.$dragging ? "var(--measurement-large-10)" : "var(--measurement-medium-60)"};
|
|
2989
4568
|
}
|
|
2990
4569
|
`;
|
|
2991
|
-
var DragHandle =
|
|
4570
|
+
var DragHandle = styled16.div`
|
|
2992
4571
|
position: absolute;
|
|
2993
4572
|
top: 0;
|
|
2994
4573
|
bottom: 0;
|
|
2995
4574
|
left: calc(var(--measurement-medium-10) * -1);
|
|
2996
4575
|
right: calc(var(--measurement-medium-10) * -1);
|
|
2997
4576
|
`;
|
|
2998
|
-
var DragIndicator =
|
|
4577
|
+
var DragIndicator = styled16.div`
|
|
2999
4578
|
position: fixed;
|
|
3000
4579
|
width: var(--measurement-medium-10);
|
|
3001
4580
|
/* height: var(--measurement-medium-60); */
|
|
@@ -3005,7 +4584,7 @@ var DragIndicator = styled17.div`
|
|
|
3005
4584
|
opacity: 0;
|
|
3006
4585
|
transition: all 0.2s;
|
|
3007
4586
|
`;
|
|
3008
|
-
var DragOverlay =
|
|
4587
|
+
var DragOverlay = styled16.div`
|
|
3009
4588
|
position: fixed;
|
|
3010
4589
|
top: 0;
|
|
3011
4590
|
left: 0;
|
|
@@ -3021,12 +4600,12 @@ var Resizable = ({
|
|
|
3021
4600
|
left,
|
|
3022
4601
|
right
|
|
3023
4602
|
}) => {
|
|
3024
|
-
const containerRef =
|
|
3025
|
-
const [leftWidth, setLeftWidth] =
|
|
3026
|
-
const [isDragging, setIsDragging] =
|
|
3027
|
-
const handleMouseDown =
|
|
3028
|
-
const handleMouseUp =
|
|
3029
|
-
const handleMouseMove =
|
|
4603
|
+
const containerRef = React27.useRef(null);
|
|
4604
|
+
const [leftWidth, setLeftWidth] = React27.useState(defaultWidth ?? 50);
|
|
4605
|
+
const [isDragging, setIsDragging] = React27.useState(false);
|
|
4606
|
+
const handleMouseDown = React27.useCallback(() => setIsDragging(true), []);
|
|
4607
|
+
const handleMouseUp = React27.useCallback(() => setIsDragging(false), []);
|
|
4608
|
+
const handleMouseMove = React27.useCallback(
|
|
3030
4609
|
(e) => {
|
|
3031
4610
|
if (!isDragging || !containerRef.current) return;
|
|
3032
4611
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
@@ -3040,7 +4619,7 @@ var Resizable = ({
|
|
|
3040
4619
|
},
|
|
3041
4620
|
[isDragging]
|
|
3042
4621
|
);
|
|
3043
|
-
|
|
4622
|
+
React27.useEffect(() => {
|
|
3044
4623
|
if (isDragging) {
|
|
3045
4624
|
document.addEventListener("mousemove", handleMouseMove);
|
|
3046
4625
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -3059,47 +4638,47 @@ var Resizable = ({
|
|
|
3059
4638
|
document.body.style.userSelect = "";
|
|
3060
4639
|
};
|
|
3061
4640
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
3062
|
-
return /* @__PURE__ */
|
|
4641
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(SplitContainer, { ref: containerRef, className: "h-100 flex" }, /* @__PURE__ */ React27.createElement(Panel, { width: leftWidth }, left), /* @__PURE__ */ React27.createElement(
|
|
3063
4642
|
Divider2,
|
|
3064
4643
|
{
|
|
3065
4644
|
$dragging: isDragging,
|
|
3066
4645
|
onMouseDown: handleMouseDown,
|
|
3067
4646
|
onTouchStart: handleMouseDown
|
|
3068
4647
|
},
|
|
3069
|
-
/* @__PURE__ */
|
|
4648
|
+
/* @__PURE__ */ React27.createElement(
|
|
3070
4649
|
DragHandle,
|
|
3071
4650
|
{
|
|
3072
4651
|
className: "flex align-center justify-center",
|
|
3073
4652
|
id: "drag-handle"
|
|
3074
4653
|
},
|
|
3075
|
-
/* @__PURE__ */
|
|
4654
|
+
/* @__PURE__ */ React27.createElement(DragIndicator, { className: "drag-indicator-handle" })
|
|
3076
4655
|
)
|
|
3077
|
-
), /* @__PURE__ */
|
|
4656
|
+
), /* @__PURE__ */ React27.createElement(Panel, { width: 100 - leftWidth }, right)), isDragging && /* @__PURE__ */ React27.createElement(DragOverlay, null));
|
|
3078
4657
|
};
|
|
3079
4658
|
Resizable.displayName = "Resizable";
|
|
3080
4659
|
|
|
3081
4660
|
// src/sheet/index.tsx
|
|
3082
|
-
import
|
|
4661
|
+
import React29 from "react";
|
|
3083
4662
|
|
|
3084
4663
|
// src/sheet/hooks/index.tsx
|
|
3085
|
-
import
|
|
3086
|
-
var SheetContext =
|
|
4664
|
+
import React28 from "react";
|
|
4665
|
+
var SheetContext = React28.createContext({
|
|
3087
4666
|
id: {},
|
|
3088
4667
|
states: {},
|
|
3089
4668
|
methods: {}
|
|
3090
4669
|
});
|
|
3091
|
-
var useSheet = () =>
|
|
4670
|
+
var useSheet = () => React28.useContext(SheetContext);
|
|
3092
4671
|
var SheetProvider = ({
|
|
3093
4672
|
children
|
|
3094
4673
|
}) => {
|
|
3095
4674
|
const context = useSheetProvider();
|
|
3096
|
-
return /* @__PURE__ */
|
|
4675
|
+
return /* @__PURE__ */ React28.createElement(SheetContext.Provider, { value: context }, children);
|
|
3097
4676
|
};
|
|
3098
4677
|
function useSheetProvider() {
|
|
3099
|
-
const containerId =
|
|
3100
|
-
const triggerId =
|
|
3101
|
-
const controlId =
|
|
3102
|
-
const [open, setOpen] =
|
|
4678
|
+
const containerId = React28.useId();
|
|
4679
|
+
const triggerId = React28.useId();
|
|
4680
|
+
const controlId = React28.useId();
|
|
4681
|
+
const [open, setOpen] = React28.useState(false);
|
|
3103
4682
|
return {
|
|
3104
4683
|
id: {
|
|
3105
4684
|
containerId,
|
|
@@ -3117,8 +4696,8 @@ function useSheetProvider() {
|
|
|
3117
4696
|
}
|
|
3118
4697
|
|
|
3119
4698
|
// src/sheet/styles/index.ts
|
|
3120
|
-
import
|
|
3121
|
-
var SheetStyles =
|
|
4699
|
+
import styled17, { css as css11 } from "styled-components";
|
|
4700
|
+
var SheetStyles = css11`
|
|
3122
4701
|
all: unset;
|
|
3123
4702
|
position: fixed;
|
|
3124
4703
|
background-color: var(--body-color);
|
|
@@ -3149,7 +4728,7 @@ var SheetStyles = css10`
|
|
|
3149
4728
|
animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
|
|
3150
4729
|
animation-fill-mode: backwards;
|
|
3151
4730
|
`;
|
|
3152
|
-
var SheetSizeStyles =
|
|
4731
|
+
var SheetSizeStyles = css11`
|
|
3153
4732
|
&[data-size="small"] {
|
|
3154
4733
|
width: var(--measurement-large-80);
|
|
3155
4734
|
}
|
|
@@ -3162,7 +4741,7 @@ var SheetSizeStyles = css10`
|
|
|
3162
4741
|
width: calc(var(--measurement-large-90) * 1.5);
|
|
3163
4742
|
}
|
|
3164
4743
|
`;
|
|
3165
|
-
var SheetSideStyles =
|
|
4744
|
+
var SheetSideStyles = css11`
|
|
3166
4745
|
top: 0;
|
|
3167
4746
|
|
|
3168
4747
|
&[data-side="right"] {
|
|
@@ -3177,7 +4756,7 @@ var SheetSideStyles = css10`
|
|
|
3177
4756
|
animation-name: slide-left;
|
|
3178
4757
|
}
|
|
3179
4758
|
`;
|
|
3180
|
-
var SheetWrapper =
|
|
4759
|
+
var SheetWrapper = styled17.dialog`
|
|
3181
4760
|
&[data-raw="false"] {
|
|
3182
4761
|
${SheetStyles}
|
|
3183
4762
|
${SheetSideStyles}
|
|
@@ -3187,7 +4766,7 @@ var SheetWrapper = styled18.dialog`
|
|
|
3187
4766
|
|
|
3188
4767
|
// src/sheet/index.tsx
|
|
3189
4768
|
var SheetRoot = ({ children }) => {
|
|
3190
|
-
return /* @__PURE__ */
|
|
4769
|
+
return /* @__PURE__ */ React29.createElement(SheetProvider, null, children);
|
|
3191
4770
|
};
|
|
3192
4771
|
SheetRoot.displayName = "Sheet.Root";
|
|
3193
4772
|
var Sheet = (props) => {
|
|
@@ -3208,16 +4787,16 @@ var Sheet = (props) => {
|
|
|
3208
4787
|
const { id, states, methods } = useSheet();
|
|
3209
4788
|
const { toggle } = methods;
|
|
3210
4789
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
3211
|
-
|
|
4790
|
+
React29.useEffect(() => {
|
|
3212
4791
|
if (open && toggle) return toggle();
|
|
3213
4792
|
}, [open]);
|
|
3214
|
-
|
|
4793
|
+
React29.useEffect(() => {
|
|
3215
4794
|
if (shortcut && shortcutControls && toggle) {
|
|
3216
4795
|
return toggle();
|
|
3217
4796
|
}
|
|
3218
4797
|
}, [shortcutControls]);
|
|
3219
4798
|
useDisabledScroll(lock && Boolean(states.open));
|
|
3220
|
-
return /* @__PURE__ */
|
|
4799
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, states.open && /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
|
|
3221
4800
|
SheetWrapper,
|
|
3222
4801
|
{
|
|
3223
4802
|
role: "dialog",
|
|
@@ -3234,7 +4813,7 @@ var Sheet = (props) => {
|
|
|
3234
4813
|
...restProps
|
|
3235
4814
|
},
|
|
3236
4815
|
children
|
|
3237
|
-
), overlay && /* @__PURE__ */
|
|
4816
|
+
), overlay && /* @__PURE__ */ React29.createElement(
|
|
3238
4817
|
Overlay,
|
|
3239
4818
|
{
|
|
3240
4819
|
onClick: () => toggle && toggle(!states.open),
|
|
@@ -3260,7 +4839,7 @@ var SheetTrigger = (props) => {
|
|
|
3260
4839
|
if (onClick) onClick(event);
|
|
3261
4840
|
if (toggle) toggle(!states.open);
|
|
3262
4841
|
};
|
|
3263
|
-
return /* @__PURE__ */
|
|
4842
|
+
return /* @__PURE__ */ React29.createElement(
|
|
3264
4843
|
Button,
|
|
3265
4844
|
{
|
|
3266
4845
|
id: id.triggerId,
|
|
@@ -3280,11 +4859,11 @@ Sheet.Root = SheetRoot;
|
|
|
3280
4859
|
Sheet.Trigger = SheetTrigger;
|
|
3281
4860
|
|
|
3282
4861
|
// src/shimmer/index.tsx
|
|
3283
|
-
import
|
|
4862
|
+
import React30 from "react";
|
|
3284
4863
|
|
|
3285
4864
|
// src/shimmer/styles/index.ts
|
|
3286
|
-
import
|
|
3287
|
-
var shimmer =
|
|
4865
|
+
import styled18, { keyframes } from "styled-components";
|
|
4866
|
+
var shimmer = keyframes`
|
|
3288
4867
|
0% {
|
|
3289
4868
|
background-position: 200% center;
|
|
3290
4869
|
}
|
|
@@ -3292,7 +4871,7 @@ var shimmer = keyframes2`
|
|
|
3292
4871
|
background-position: -200% center;
|
|
3293
4872
|
}
|
|
3294
4873
|
`;
|
|
3295
|
-
var TextShimmerWrapper =
|
|
4874
|
+
var TextShimmerWrapper = styled18.span`
|
|
3296
4875
|
background: linear-gradient(
|
|
3297
4876
|
90deg,
|
|
3298
4877
|
${({ "data-base-color": baseColor }) => baseColor} 0%,
|
|
@@ -3325,7 +4904,7 @@ var Shimmer = (props) => {
|
|
|
3325
4904
|
baseColor = DEFAULT_BASE_COLOR,
|
|
3326
4905
|
...restProps
|
|
3327
4906
|
} = props;
|
|
3328
|
-
return /* @__PURE__ */
|
|
4907
|
+
return /* @__PURE__ */ React30.createElement(
|
|
3329
4908
|
TextShimmerWrapper,
|
|
3330
4909
|
{
|
|
3331
4910
|
"data-raw": Boolean(raw),
|
|
@@ -3342,13 +4921,13 @@ var Shimmer = (props) => {
|
|
|
3342
4921
|
Shimmer.displayName = "Shimmer";
|
|
3343
4922
|
|
|
3344
4923
|
// src/scrollarea/index.tsx
|
|
3345
|
-
import
|
|
4924
|
+
import React31 from "react";
|
|
3346
4925
|
var ScrollArea = ({
|
|
3347
4926
|
scrollbar = false,
|
|
3348
4927
|
children,
|
|
3349
4928
|
...restProps
|
|
3350
4929
|
}) => {
|
|
3351
|
-
return /* @__PURE__ */
|
|
4930
|
+
return /* @__PURE__ */ React31.createElement(
|
|
3352
4931
|
ScrollAreaWrapper,
|
|
3353
4932
|
{
|
|
3354
4933
|
"aria-hidden": "true",
|
|
@@ -3360,59 +4939,84 @@ var ScrollArea = ({
|
|
|
3360
4939
|
};
|
|
3361
4940
|
|
|
3362
4941
|
// src/spinner/index.tsx
|
|
3363
|
-
import
|
|
4942
|
+
import React32 from "react";
|
|
3364
4943
|
|
|
3365
4944
|
// src/spinner/styles/index.ts
|
|
3366
|
-
import
|
|
3367
|
-
var Rotate =
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
}
|
|
3371
|
-
100% {
|
|
3372
|
-
transform: rotate(360deg);
|
|
3373
|
-
}
|
|
4945
|
+
import styled19, { css as css12, keyframes as keyframes2 } from "styled-components";
|
|
4946
|
+
var Rotate = keyframes2`
|
|
4947
|
+
0% { transform: rotate(0deg); }
|
|
4948
|
+
100% { transform: rotate(360deg); }
|
|
3374
4949
|
`;
|
|
3375
|
-
var
|
|
4950
|
+
var SpinnerSizeStyles = css12`
|
|
3376
4951
|
&[data-size="small"] {
|
|
3377
|
-
width:
|
|
3378
|
-
height:
|
|
4952
|
+
width: 12px;
|
|
4953
|
+
height: 12px;
|
|
3379
4954
|
}
|
|
3380
4955
|
&[data-size="medium"] {
|
|
3381
|
-
width:
|
|
3382
|
-
height:
|
|
4956
|
+
width: 18px;
|
|
4957
|
+
height: 18px;
|
|
3383
4958
|
}
|
|
3384
4959
|
&[data-size="large"] {
|
|
3385
|
-
width:
|
|
3386
|
-
height:
|
|
4960
|
+
width: 24px;
|
|
4961
|
+
height: 24px;
|
|
3387
4962
|
}
|
|
3388
4963
|
`;
|
|
3389
|
-
var
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
display: inline-block;
|
|
3394
|
-
box-sizing: border-box;
|
|
4964
|
+
var CircleStyles = css12`
|
|
4965
|
+
border: var(--measurement-small-80) solid var(--font-color-alpha-10);
|
|
4966
|
+
border-bottom-color: transparent;
|
|
4967
|
+
border-radius: var(--measurement-large-90);
|
|
3395
4968
|
|
|
4969
|
+
animation: ${Rotate} 0.8s linear infinite;
|
|
4970
|
+
`;
|
|
4971
|
+
var CircleFilledStyles = css12`
|
|
3396
4972
|
border: var(--measurement-small-60) solid var(--font-color-alpha-30);
|
|
4973
|
+
|
|
4974
|
+
border-top-color: transparent;
|
|
4975
|
+
border-right-color: transparent;
|
|
3397
4976
|
border-bottom-color: transparent;
|
|
4977
|
+
|
|
3398
4978
|
border-radius: var(--measurement-large-90);
|
|
4979
|
+
background-color: var(--font-color-alpha-10);
|
|
4980
|
+
|
|
4981
|
+
&::before {
|
|
4982
|
+
position: absolute;
|
|
4983
|
+
content: "";
|
|
4984
|
+
width: 100%;
|
|
4985
|
+
height: 100%;
|
|
4986
|
+
background-color: var(--body-color);
|
|
4987
|
+
border-radius: var(--measurement-large-90);
|
|
4988
|
+
}
|
|
3399
4989
|
|
|
3400
|
-
animation: ${Rotate}
|
|
4990
|
+
animation: ${Rotate} 0.8s linear infinite;
|
|
4991
|
+
`;
|
|
4992
|
+
var AnimatedSpinner = styled19.div`
|
|
4993
|
+
${SpinnerSizeStyles}
|
|
3401
4994
|
|
|
3402
|
-
|
|
4995
|
+
&[data-variant="circle"] {
|
|
4996
|
+
${CircleStyles}
|
|
4997
|
+
}
|
|
4998
|
+
&[data-variant="circle-filled"] {
|
|
4999
|
+
${CircleFilledStyles}
|
|
5000
|
+
}
|
|
3403
5001
|
`;
|
|
3404
5002
|
|
|
3405
5003
|
// src/spinner/index.tsx
|
|
3406
5004
|
var Spinner = (props) => {
|
|
3407
|
-
return /* @__PURE__ */
|
|
5005
|
+
return /* @__PURE__ */ React32.createElement(
|
|
5006
|
+
AnimatedSpinner,
|
|
5007
|
+
{
|
|
5008
|
+
"data-variant": props?.variant ?? "circle",
|
|
5009
|
+
"data-size": props?.sizing ?? "medium"
|
|
5010
|
+
}
|
|
5011
|
+
);
|
|
3408
5012
|
};
|
|
3409
5013
|
|
|
3410
5014
|
// src/skeleton/index.tsx
|
|
3411
|
-
import
|
|
5015
|
+
import React33 from "react";
|
|
3412
5016
|
|
|
3413
5017
|
// src/skeleton/styles/index.ts
|
|
3414
|
-
import
|
|
3415
|
-
var SkeletonBlink =
|
|
5018
|
+
import styled20, { css as css13, keyframes as keyframes3 } from "styled-components";
|
|
5019
|
+
var SkeletonBlink = keyframes3`
|
|
3416
5020
|
0% {
|
|
3417
5021
|
opacity: 0.3;
|
|
3418
5022
|
}
|
|
@@ -3420,7 +5024,7 @@ var SkeletonBlink = keyframes4`
|
|
|
3420
5024
|
opacity: 0.1;
|
|
3421
5025
|
}
|
|
3422
5026
|
`;
|
|
3423
|
-
var SkeletonBaseStyles =
|
|
5027
|
+
var SkeletonBaseStyles = css13`
|
|
3424
5028
|
background: linear-gradient(
|
|
3425
5029
|
45deg,
|
|
3426
5030
|
var(--font-color-alpha-10),
|
|
@@ -3428,7 +5032,7 @@ var SkeletonBaseStyles = css12`
|
|
|
3428
5032
|
);
|
|
3429
5033
|
animation: ${SkeletonBlink} 1s ease-in-out alternate-reverse infinite;
|
|
3430
5034
|
`;
|
|
3431
|
-
var SkeletonSizeStyles =
|
|
5035
|
+
var SkeletonSizeStyles = css13`
|
|
3432
5036
|
&[data-size="small"] {
|
|
3433
5037
|
width: 100%;
|
|
3434
5038
|
|
|
@@ -3446,7 +5050,7 @@ var SkeletonSizeStyles = css12`
|
|
|
3446
5050
|
min-height: var(--measurement-medium-90);
|
|
3447
5051
|
}
|
|
3448
5052
|
`;
|
|
3449
|
-
var SkeletonShapeStyles =
|
|
5053
|
+
var SkeletonShapeStyles = css13`
|
|
3450
5054
|
&[data-shape="square"] {
|
|
3451
5055
|
border-radius: 0;
|
|
3452
5056
|
}
|
|
@@ -3457,7 +5061,7 @@ var SkeletonShapeStyles = css12`
|
|
|
3457
5061
|
border-radius: var(--measurement-large-90);
|
|
3458
5062
|
}
|
|
3459
5063
|
`;
|
|
3460
|
-
var SkeletonLoader =
|
|
5064
|
+
var SkeletonLoader = styled20.span`
|
|
3461
5065
|
${SkeletonBaseStyles}
|
|
3462
5066
|
${SkeletonSizeStyles}
|
|
3463
5067
|
${SkeletonShapeStyles}
|
|
@@ -3467,10 +5071,10 @@ var SkeletonLoader = styled21.span`
|
|
|
3467
5071
|
var Skeleton = (props) => {
|
|
3468
5072
|
const {
|
|
3469
5073
|
sizing = "medium" /* Medium */,
|
|
3470
|
-
shape = "smooth"
|
|
5074
|
+
shape = "smooth" /* Smooth */,
|
|
3471
5075
|
...restProps
|
|
3472
5076
|
} = props;
|
|
3473
|
-
return /* @__PURE__ */
|
|
5077
|
+
return /* @__PURE__ */ React33.createElement(
|
|
3474
5078
|
SkeletonLoader,
|
|
3475
5079
|
{
|
|
3476
5080
|
"data-size": sizing,
|
|
@@ -3483,10 +5087,10 @@ var Skeleton = (props) => {
|
|
|
3483
5087
|
Skeleton.displayName = "Skeleton";
|
|
3484
5088
|
|
|
3485
5089
|
// src/switch/index.tsx
|
|
3486
|
-
import
|
|
5090
|
+
import React35 from "react";
|
|
3487
5091
|
|
|
3488
5092
|
// src/switch/hooks/index.tsx
|
|
3489
|
-
import
|
|
5093
|
+
import React34, { useState as useState7, createContext as createContext7, useContext as useContext7 } from "react";
|
|
3490
5094
|
var defaultComponentAPI7 = {
|
|
3491
5095
|
id: "",
|
|
3492
5096
|
states: {},
|
|
@@ -3498,11 +5102,11 @@ var SwitchProvider = ({
|
|
|
3498
5102
|
children
|
|
3499
5103
|
}) => {
|
|
3500
5104
|
const context = useSwitchProvider();
|
|
3501
|
-
return /* @__PURE__ */
|
|
5105
|
+
return /* @__PURE__ */ React34.createElement(SwitchContext.Provider, { value: context }, children);
|
|
3502
5106
|
};
|
|
3503
5107
|
function useSwitchProvider() {
|
|
3504
5108
|
const [checked, setChecked] = useState7(false);
|
|
3505
|
-
const switchId =
|
|
5109
|
+
const switchId = React34.useId();
|
|
3506
5110
|
return {
|
|
3507
5111
|
id: switchId,
|
|
3508
5112
|
states: {
|
|
@@ -3515,8 +5119,8 @@ function useSwitchProvider() {
|
|
|
3515
5119
|
}
|
|
3516
5120
|
|
|
3517
5121
|
// src/switch/styles/index.ts
|
|
3518
|
-
import
|
|
3519
|
-
var SwitchDefaultStyles =
|
|
5122
|
+
import styled21, { css as css14 } from "styled-components";
|
|
5123
|
+
var SwitchDefaultStyles = css14`
|
|
3520
5124
|
all: unset;
|
|
3521
5125
|
|
|
3522
5126
|
border: var(--measurement-small-10) solid transparent;
|
|
@@ -3530,105 +5134,105 @@ var SwitchDefaultStyles = css13`
|
|
|
3530
5134
|
opacity: 0.6;
|
|
3531
5135
|
}
|
|
3532
5136
|
`;
|
|
3533
|
-
var SwitchVariantsStyles =
|
|
3534
|
-
&[data-variant="
|
|
5137
|
+
var SwitchVariantsStyles = css14`
|
|
5138
|
+
&[data-variant="accent"] {
|
|
3535
5139
|
&[aria-checked="true"] {
|
|
3536
|
-
background-color: var(--color-
|
|
3537
|
-
border-color: var(--
|
|
5140
|
+
background-color: var(--color-accent);
|
|
5141
|
+
border-color: var(--alpha-accent-10);
|
|
3538
5142
|
}
|
|
3539
5143
|
&[aria-checked="false"] {
|
|
3540
5144
|
background-color: var(--font-color-alpha-10);
|
|
3541
5145
|
border-color: var(--font-color-alpha-10);
|
|
3542
5146
|
}
|
|
3543
5147
|
}
|
|
3544
|
-
&[data-variant="
|
|
3545
|
-
&[aria-checked="true"] {
|
|
3546
|
-
background-color: var(--font-color-alpha-10);
|
|
3547
|
-
border-color: var(--font-color-alpha-10);
|
|
3548
|
-
}
|
|
3549
|
-
&[aria-checked="false"] {
|
|
3550
|
-
background-color: var(--body-color-alpha-10);
|
|
3551
|
-
}
|
|
3552
|
-
}
|
|
3553
|
-
|
|
3554
|
-
&[data-variant="ghost"] {
|
|
5148
|
+
&[data-variant="primary"] {
|
|
3555
5149
|
&[aria-checked="true"] {
|
|
5150
|
+
background-color: var(--color-green);
|
|
3556
5151
|
border-color: var(--font-color-alpha-10);
|
|
3557
|
-
background-color: var(--body-color-alpha-10);
|
|
3558
5152
|
}
|
|
3559
5153
|
&[aria-checked="false"] {
|
|
5154
|
+
background-color: var(--font-color-alpha-10);
|
|
3560
5155
|
border-color: var(--font-color-alpha-10);
|
|
3561
5156
|
}
|
|
3562
5157
|
}
|
|
3563
5158
|
`;
|
|
3564
|
-
var SwitchSizeStyles =
|
|
5159
|
+
var SwitchSizeStyles = css14`
|
|
3565
5160
|
&[data-size="small"] {
|
|
3566
|
-
|
|
3567
|
-
|
|
5161
|
+
--thumb-size: calc(
|
|
5162
|
+
var(--measurement-medium-40) - var(--measurement-small-10)
|
|
5163
|
+
);
|
|
5164
|
+
|
|
5165
|
+
padding: 0 var(--measurement-small-10);
|
|
5166
|
+
width: calc(var(--thumb-size) * 2);
|
|
5167
|
+
height: var(--measurement-medium-40);
|
|
3568
5168
|
|
|
3569
5169
|
span {
|
|
3570
|
-
width: var(--
|
|
3571
|
-
height: var(--
|
|
5170
|
+
width: var(--thumb-size);
|
|
5171
|
+
height: var(--thumb-size);
|
|
5172
|
+
|
|
3572
5173
|
&[data-checked="true"] {
|
|
3573
|
-
transform: translateX(var(--
|
|
3574
|
-
}
|
|
3575
|
-
&[data-checked="false"] {
|
|
3576
|
-
transform: translateX(var(--measurement-small-60));
|
|
5174
|
+
transform: translateX(var(--thumb-size));
|
|
3577
5175
|
}
|
|
3578
5176
|
}
|
|
3579
5177
|
}
|
|
3580
|
-
|
|
3581
5178
|
&[data-size="medium"] {
|
|
3582
|
-
|
|
5179
|
+
--thumb-size: calc(
|
|
5180
|
+
var(--measurement-medium-60) - var(--measurement-small-10)
|
|
5181
|
+
);
|
|
5182
|
+
|
|
5183
|
+
padding: 0 var(--measurement-small-10);
|
|
5184
|
+
width: calc(var(--thumb-size) * 2);
|
|
3583
5185
|
height: var(--measurement-medium-60);
|
|
3584
5186
|
|
|
3585
5187
|
span {
|
|
3586
|
-
width: var(--
|
|
3587
|
-
height: var(--
|
|
5188
|
+
width: var(--thumb-size);
|
|
5189
|
+
height: var(--thumb-size);
|
|
5190
|
+
|
|
3588
5191
|
&[data-checked="true"] {
|
|
3589
|
-
transform: translateX(var(--
|
|
3590
|
-
}
|
|
3591
|
-
&[data-checked="false"] {
|
|
3592
|
-
transform: translateX(var(--measurement-small-60));
|
|
5192
|
+
transform: translateX(var(--thumb-size));
|
|
3593
5193
|
}
|
|
3594
5194
|
}
|
|
3595
5195
|
}
|
|
3596
|
-
|
|
3597
5196
|
&[data-size="large"] {
|
|
3598
|
-
|
|
5197
|
+
--thumb-size: calc(
|
|
5198
|
+
var(--measurement-medium-70) - var(--measurement-small-30)
|
|
5199
|
+
);
|
|
5200
|
+
|
|
5201
|
+
padding: 0 var(--measurement-small-30);
|
|
5202
|
+
width: calc(var(--thumb-size) * 2);
|
|
3599
5203
|
height: var(--measurement-medium-70);
|
|
3600
5204
|
|
|
3601
5205
|
span {
|
|
3602
|
-
width: var(--
|
|
3603
|
-
height: var(--
|
|
5206
|
+
width: var(--thumb-size);
|
|
5207
|
+
height: var(--thumb-size);
|
|
5208
|
+
|
|
3604
5209
|
&[data-checked="true"] {
|
|
3605
|
-
transform: translateX(
|
|
3606
|
-
}
|
|
3607
|
-
&[data-checked="false"] {
|
|
3608
|
-
transform: translateX(var(--measurement-small-80));
|
|
5210
|
+
transform: translateX(var(--thumb-size));
|
|
3609
5211
|
}
|
|
3610
5212
|
}
|
|
3611
5213
|
}
|
|
3612
5214
|
`;
|
|
3613
|
-
var TriggerWrapper =
|
|
5215
|
+
var TriggerWrapper = styled21.button`
|
|
3614
5216
|
&[data-raw="false"] {
|
|
3615
5217
|
${SwitchDefaultStyles}
|
|
3616
5218
|
${SwitchVariantsStyles}
|
|
3617
5219
|
${SwitchSizeStyles}
|
|
3618
5220
|
}
|
|
3619
5221
|
`;
|
|
3620
|
-
var Thumb =
|
|
5222
|
+
var Thumb = styled21.span`
|
|
3621
5223
|
&[data-raw="false"] {
|
|
3622
5224
|
all: unset;
|
|
3623
5225
|
display: block;
|
|
3624
5226
|
|
|
3625
|
-
background:
|
|
3626
|
-
border-radius:
|
|
3627
|
-
|
|
5227
|
+
background: white;
|
|
5228
|
+
border-radius: var(--measurement-large-90);
|
|
5229
|
+
box-shadow:
|
|
5230
|
+
0 var(--measurement-small-30) var(--measurement-small-80)
|
|
5231
|
+
var(--alpha-mono-darkest-10),
|
|
5232
|
+
0 var(--measurement-small-30) var(--measurement-small-60)
|
|
5233
|
+
calc(var(--measurement-small-30) * -1) var(--alpha-mono-darkest-10);
|
|
3628
5234
|
|
|
3629
|
-
|
|
3630
|
-
background: var(--font-color);
|
|
3631
|
-
}
|
|
5235
|
+
transition: all 0.1s ease-in-out 0.2s;
|
|
3632
5236
|
}
|
|
3633
5237
|
`;
|
|
3634
5238
|
|
|
@@ -3651,10 +5255,10 @@ var Switch = (props) => {
|
|
|
3651
5255
|
if (onClick) onClick(event);
|
|
3652
5256
|
if (toggleSwitch) toggleSwitch();
|
|
3653
5257
|
};
|
|
3654
|
-
|
|
5258
|
+
React35.useEffect(() => {
|
|
3655
5259
|
if (defaultChecked && toggleSwitch) toggleSwitch();
|
|
3656
5260
|
}, [defaultChecked]);
|
|
3657
|
-
return /* @__PURE__ */
|
|
5261
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3658
5262
|
TriggerWrapper,
|
|
3659
5263
|
{
|
|
3660
5264
|
type: "button",
|
|
@@ -3670,19 +5274,19 @@ var Switch = (props) => {
|
|
|
3670
5274
|
"data-raw": Boolean(raw),
|
|
3671
5275
|
...restProps
|
|
3672
5276
|
},
|
|
3673
|
-
/* @__PURE__ */
|
|
5277
|
+
/* @__PURE__ */ React35.createElement("title", null, "Switch"),
|
|
3674
5278
|
children
|
|
3675
5279
|
);
|
|
3676
5280
|
};
|
|
3677
5281
|
Switch.displayName = "Switch";
|
|
3678
5282
|
var SwitchRoot = ({ children }) => {
|
|
3679
|
-
return /* @__PURE__ */
|
|
5283
|
+
return /* @__PURE__ */ React35.createElement(SwitchProvider, null, children);
|
|
3680
5284
|
};
|
|
3681
5285
|
SwitchRoot.displayName = "Switch.Root";
|
|
3682
5286
|
var SwitchThumb = (props) => {
|
|
3683
5287
|
const { raw, sizing } = props;
|
|
3684
5288
|
const { id, states } = useSwitch();
|
|
3685
|
-
return /* @__PURE__ */
|
|
5289
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3686
5290
|
Thumb,
|
|
3687
5291
|
{
|
|
3688
5292
|
role: "presentation",
|
|
@@ -3702,11 +5306,11 @@ Switch.Root = SwitchRoot;
|
|
|
3702
5306
|
Switch.Thumb = SwitchThumb;
|
|
3703
5307
|
|
|
3704
5308
|
// src/table/index.tsx
|
|
3705
|
-
import
|
|
5309
|
+
import React36 from "react";
|
|
3706
5310
|
|
|
3707
5311
|
// src/table/styles/index.ts
|
|
3708
|
-
import
|
|
3709
|
-
var CellStyles =
|
|
5312
|
+
import styled22, { css as css15 } from "styled-components";
|
|
5313
|
+
var CellStyles = css15`
|
|
3710
5314
|
box-sizing: border-box;
|
|
3711
5315
|
border: none;
|
|
3712
5316
|
line-height: 1;
|
|
@@ -3716,11 +5320,11 @@ var CellStyles = css14`
|
|
|
3716
5320
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
3717
5321
|
);
|
|
3718
5322
|
`;
|
|
3719
|
-
var TableLayer =
|
|
5323
|
+
var TableLayer = styled22.div`
|
|
3720
5324
|
border-radius: var(--measurement-medium-30);
|
|
3721
5325
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
3722
5326
|
`;
|
|
3723
|
-
var TableWrapper =
|
|
5327
|
+
var TableWrapper = styled22.table`
|
|
3724
5328
|
border-collapse: collapse;
|
|
3725
5329
|
|
|
3726
5330
|
tbody {
|
|
@@ -3731,7 +5335,7 @@ var TableWrapper = styled23.table`
|
|
|
3731
5335
|
}
|
|
3732
5336
|
}
|
|
3733
5337
|
`;
|
|
3734
|
-
var RowWrapper =
|
|
5338
|
+
var RowWrapper = styled22.tr`
|
|
3735
5339
|
border-bottom: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
3736
5340
|
|
|
3737
5341
|
transition: background-color linear 0.1s;
|
|
@@ -3740,7 +5344,7 @@ var RowWrapper = styled23.tr`
|
|
|
3740
5344
|
background-color: var(--font-color-alpha-10);
|
|
3741
5345
|
}
|
|
3742
5346
|
`;
|
|
3743
|
-
var HeadCellWrapper =
|
|
5347
|
+
var HeadCellWrapper = styled22.th`
|
|
3744
5348
|
font-size: var(--fontsize-medium-10);
|
|
3745
5349
|
${CellStyles}
|
|
3746
5350
|
|
|
@@ -3748,7 +5352,7 @@ var HeadCellWrapper = styled23.th`
|
|
|
3748
5352
|
color: var(--font-color-alpha-60);
|
|
3749
5353
|
}
|
|
3750
5354
|
`;
|
|
3751
|
-
var CellWrapper =
|
|
5355
|
+
var CellWrapper = styled22.td`
|
|
3752
5356
|
${CellStyles}
|
|
3753
5357
|
`;
|
|
3754
5358
|
|
|
@@ -3757,43 +5361,43 @@ var Table = ({
|
|
|
3757
5361
|
children,
|
|
3758
5362
|
...restProps
|
|
3759
5363
|
}) => {
|
|
3760
|
-
return /* @__PURE__ */
|
|
5364
|
+
return /* @__PURE__ */ React36.createElement(ScrollArea, { as: TableLayer, role: "presentation", tabIndex: -1 }, /* @__PURE__ */ React36.createElement(TableWrapper, { ...restProps, cellSpacing: "0", cellPadding: "0" }, children));
|
|
3761
5365
|
};
|
|
3762
5366
|
Table.displayName = "Table";
|
|
3763
5367
|
var TableHead = ({
|
|
3764
5368
|
children,
|
|
3765
5369
|
...restProps
|
|
3766
5370
|
}) => {
|
|
3767
|
-
return /* @__PURE__ */
|
|
5371
|
+
return /* @__PURE__ */ React36.createElement("thead", { ...restProps }, children);
|
|
3768
5372
|
};
|
|
3769
5373
|
TableHead.displayName = "Table.Head";
|
|
3770
5374
|
var TableBody = ({
|
|
3771
5375
|
children,
|
|
3772
5376
|
...restProps
|
|
3773
5377
|
}) => {
|
|
3774
|
-
return /* @__PURE__ */
|
|
5378
|
+
return /* @__PURE__ */ React36.createElement("tbody", { ...restProps }, children);
|
|
3775
5379
|
};
|
|
3776
5380
|
TableBody.displayName = "Table.Body";
|
|
3777
5381
|
var TableHeadCell = ({
|
|
3778
5382
|
children,
|
|
3779
5383
|
...restProps
|
|
3780
5384
|
}) => {
|
|
3781
|
-
return /* @__PURE__ */
|
|
5385
|
+
return /* @__PURE__ */ React36.createElement(HeadCellWrapper, { colSpan: 1, ...restProps }, /* @__PURE__ */ React36.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
3782
5386
|
};
|
|
3783
5387
|
TableHeadCell.displayName = "Table.HeadCell";
|
|
3784
5388
|
var TableRow = ({ children, ...restProps }) => {
|
|
3785
|
-
return /* @__PURE__ */
|
|
5389
|
+
return /* @__PURE__ */ React36.createElement(RowWrapper, { className: "p-medium-30", ...restProps }, children);
|
|
3786
5390
|
};
|
|
3787
5391
|
TableRow.displayName = "Table.Row";
|
|
3788
5392
|
var TableCell = ({ children, ...restProps }) => {
|
|
3789
|
-
return /* @__PURE__ */
|
|
5393
|
+
return /* @__PURE__ */ React36.createElement(CellWrapper, { ...restProps }, /* @__PURE__ */ React36.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
3790
5394
|
};
|
|
3791
5395
|
TableCell.displayName = "Table.Cell";
|
|
3792
5396
|
var TableFooter = ({
|
|
3793
5397
|
children,
|
|
3794
5398
|
...restProps
|
|
3795
5399
|
}) => {
|
|
3796
|
-
return /* @__PURE__ */
|
|
5400
|
+
return /* @__PURE__ */ React36.createElement("tfoot", { ...restProps }, children);
|
|
3797
5401
|
};
|
|
3798
5402
|
TableFooter.displayName = "Table.Footer";
|
|
3799
5403
|
Table.Head = TableHead;
|
|
@@ -3804,10 +5408,10 @@ Table.Cell = TableCell;
|
|
|
3804
5408
|
Table.Footer = TableFooter;
|
|
3805
5409
|
|
|
3806
5410
|
// src/tabs/index.tsx
|
|
3807
|
-
import
|
|
5411
|
+
import React38, { Children } from "react";
|
|
3808
5412
|
|
|
3809
5413
|
// src/tabs/hooks/index.tsx
|
|
3810
|
-
import
|
|
5414
|
+
import React37, { createContext as createContext8, useContext as useContext8, useState as useState8 } from "react";
|
|
3811
5415
|
var defaultComponentAPI8 = {
|
|
3812
5416
|
id: "",
|
|
3813
5417
|
states: {},
|
|
@@ -3819,11 +5423,11 @@ var TabsProvider = ({
|
|
|
3819
5423
|
children
|
|
3820
5424
|
}) => {
|
|
3821
5425
|
const context = useTabsProvider();
|
|
3822
|
-
return /* @__PURE__ */
|
|
5426
|
+
return /* @__PURE__ */ React37.createElement(TabsContext.Provider, { value: context }, children);
|
|
3823
5427
|
};
|
|
3824
5428
|
function useTabsProvider() {
|
|
3825
5429
|
const [value, setValue] = useState8(null);
|
|
3826
|
-
const tabsId =
|
|
5430
|
+
const tabsId = React37.useId();
|
|
3827
5431
|
return {
|
|
3828
5432
|
id: tabsId,
|
|
3829
5433
|
states: {
|
|
@@ -3837,8 +5441,8 @@ function useTabsProvider() {
|
|
|
3837
5441
|
}
|
|
3838
5442
|
|
|
3839
5443
|
// src/tabs/styles/index.ts
|
|
3840
|
-
import
|
|
3841
|
-
var TabWrapper =
|
|
5444
|
+
import styled23 from "styled-components";
|
|
5445
|
+
var TabWrapper = styled23.div`
|
|
3842
5446
|
button {
|
|
3843
5447
|
&[aria-selected="true"] {
|
|
3844
5448
|
color: var(--font-color) !important;
|
|
@@ -3853,20 +5457,20 @@ var Tabs = (props) => {
|
|
|
3853
5457
|
const { applyValue } = methods;
|
|
3854
5458
|
const childArray = Children.toArray(children);
|
|
3855
5459
|
const firstChild = childArray[0];
|
|
3856
|
-
|
|
3857
|
-
if (
|
|
5460
|
+
React38.useEffect(() => {
|
|
5461
|
+
if (React38.isValidElement(firstChild)) {
|
|
3858
5462
|
if (childArray.length > 0 && applyValue)
|
|
3859
5463
|
applyValue(firstChild.props.value);
|
|
3860
5464
|
}
|
|
3861
5465
|
}, []);
|
|
3862
|
-
|
|
5466
|
+
React38.useEffect(() => {
|
|
3863
5467
|
if (defaultOpen && applyValue) applyValue(defaultOpen);
|
|
3864
5468
|
}, []);
|
|
3865
|
-
return /* @__PURE__ */
|
|
5469
|
+
return /* @__PURE__ */ React38.createElement(TabWrapper, { role: "tablist", ...restProps }, children);
|
|
3866
5470
|
};
|
|
3867
5471
|
Tabs.displayName = "Tabs";
|
|
3868
5472
|
var TabsRoot = ({ children }) => {
|
|
3869
|
-
return /* @__PURE__ */
|
|
5473
|
+
return /* @__PURE__ */ React38.createElement(TabsProvider, null, children);
|
|
3870
5474
|
};
|
|
3871
5475
|
TabsRoot.displayName = "Tabs.Root";
|
|
3872
5476
|
var TabsTrigger = (props) => {
|
|
@@ -3882,7 +5486,7 @@ var TabsTrigger = (props) => {
|
|
|
3882
5486
|
if (applyValue) applyValue(value);
|
|
3883
5487
|
if (onClick) onClick(event);
|
|
3884
5488
|
};
|
|
3885
|
-
return /* @__PURE__ */
|
|
5489
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3886
5490
|
Button,
|
|
3887
5491
|
{
|
|
3888
5492
|
type: "button",
|
|
@@ -3910,7 +5514,7 @@ var TabsContent = (props) => {
|
|
|
3910
5514
|
trigger: getTabsId && getTabsId({ value, type: "trigger" }),
|
|
3911
5515
|
content: getTabsId && getTabsId({ value, type: "content" })
|
|
3912
5516
|
};
|
|
3913
|
-
return /* @__PURE__ */
|
|
5517
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3914
5518
|
"div",
|
|
3915
5519
|
{
|
|
3916
5520
|
tabIndex: 0,
|
|
@@ -3931,11 +5535,11 @@ Tabs.Trigger = TabsTrigger;
|
|
|
3931
5535
|
Tabs.Content = TabsContent;
|
|
3932
5536
|
|
|
3933
5537
|
// src/text-area/index.tsx
|
|
3934
|
-
import
|
|
5538
|
+
import React39 from "react";
|
|
3935
5539
|
|
|
3936
5540
|
// src/text-area/styles/index.ts
|
|
3937
|
-
import
|
|
3938
|
-
var CustomScrollbar2 =
|
|
5541
|
+
import styled24, { css as css16 } from "styled-components";
|
|
5542
|
+
var CustomScrollbar2 = css16`
|
|
3939
5543
|
height: ${({ $height }) => $height ?? "100%"};
|
|
3940
5544
|
width: ${({ $width }) => $width ?? "100%"};
|
|
3941
5545
|
overflow-y: auto;
|
|
@@ -3967,7 +5571,7 @@ var CustomScrollbar2 = css15`
|
|
|
3967
5571
|
scrollbar-width: thin;
|
|
3968
5572
|
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor ?? "var(--font-color-alpha-10)"} ${$trackColor ?? "transparent"}`};
|
|
3969
5573
|
`;
|
|
3970
|
-
var TextareaSizeStyles =
|
|
5574
|
+
var TextareaSizeStyles = css16`
|
|
3971
5575
|
padding: var(--measurement-medium-30);
|
|
3972
5576
|
max-height: var(--measurement-large-60);
|
|
3973
5577
|
|
|
@@ -3982,7 +5586,7 @@ var TextareaSizeStyles = css15`
|
|
|
3982
5586
|
max-height: var(--measurement-large-80);
|
|
3983
5587
|
}
|
|
3984
5588
|
`;
|
|
3985
|
-
var TextareaResizableStyles =
|
|
5589
|
+
var TextareaResizableStyles = css16`
|
|
3986
5590
|
&[data-resizable="true"] {
|
|
3987
5591
|
resize: vertical;
|
|
3988
5592
|
}
|
|
@@ -3990,7 +5594,7 @@ var TextareaResizableStyles = css15`
|
|
|
3990
5594
|
resize: none;
|
|
3991
5595
|
}
|
|
3992
5596
|
`;
|
|
3993
|
-
var TextAreaContainer =
|
|
5597
|
+
var TextAreaContainer = styled24.textarea`
|
|
3994
5598
|
&[data-raw="false"] {
|
|
3995
5599
|
${FieldDefaultStyles}
|
|
3996
5600
|
${FieldShapeStyles}
|
|
@@ -4006,7 +5610,7 @@ var TextAreaContainer = styled25.textarea`
|
|
|
4006
5610
|
// src/text-area/index.tsx
|
|
4007
5611
|
var Textarea = (props) => {
|
|
4008
5612
|
const { raw, shape, sizing, variant, resizable, onChange } = props;
|
|
4009
|
-
const textareaRef =
|
|
5613
|
+
const textareaRef = React39.useRef(null);
|
|
4010
5614
|
const adjustHeight = () => {
|
|
4011
5615
|
const textarea = textareaRef.current;
|
|
4012
5616
|
if (textarea) {
|
|
@@ -4021,14 +5625,14 @@ var Textarea = (props) => {
|
|
|
4021
5625
|
adjustHeight();
|
|
4022
5626
|
onChange?.(e);
|
|
4023
5627
|
};
|
|
4024
|
-
|
|
4025
|
-
return /* @__PURE__ */
|
|
5628
|
+
React39.useEffect(() => adjustHeight(), [props.value]);
|
|
5629
|
+
return /* @__PURE__ */ React39.createElement(
|
|
4026
5630
|
TextAreaContainer,
|
|
4027
5631
|
{
|
|
4028
5632
|
ref: textareaRef,
|
|
4029
5633
|
onChange: handleChange,
|
|
4030
|
-
"data-variant": variant ?? "secondary"
|
|
4031
|
-
"data-shape": shape ?? "smooth"
|
|
5634
|
+
"data-variant": variant ?? "secondary" /* Secondary */,
|
|
5635
|
+
"data-shape": shape ?? "smooth" /* Smooth */,
|
|
4032
5636
|
"data-size": sizing ?? "medium" /* Medium */,
|
|
4033
5637
|
"data-resizable": resizable,
|
|
4034
5638
|
"data-raw": String(Boolean(raw)),
|
|
@@ -4039,22 +5643,22 @@ var Textarea = (props) => {
|
|
|
4039
5643
|
Textarea.displayName = "Textarea";
|
|
4040
5644
|
|
|
4041
5645
|
// src/toggle/index.tsx
|
|
4042
|
-
import
|
|
5646
|
+
import React40 from "react";
|
|
4043
5647
|
var Toggle = (props) => {
|
|
4044
5648
|
const { defaultChecked, onClick, disabled, children, ...restProps } = props;
|
|
4045
|
-
const [checked, setChecked] =
|
|
5649
|
+
const [checked, setChecked] = React40.useState(
|
|
4046
5650
|
defaultChecked ?? false
|
|
4047
5651
|
);
|
|
4048
5652
|
const handleClick = (event) => {
|
|
4049
5653
|
if (onClick) onClick(event);
|
|
4050
5654
|
if (!disabled) setChecked((prevChecked) => !prevChecked);
|
|
4051
5655
|
};
|
|
4052
|
-
|
|
5656
|
+
React40.useEffect(() => {
|
|
4053
5657
|
if (defaultChecked !== void 0) {
|
|
4054
5658
|
setChecked(Boolean(defaultChecked));
|
|
4055
5659
|
}
|
|
4056
5660
|
}, [defaultChecked]);
|
|
4057
|
-
return /* @__PURE__ */
|
|
5661
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4058
5662
|
Button,
|
|
4059
5663
|
{
|
|
4060
5664
|
role: "switch",
|
|
@@ -4072,10 +5676,10 @@ var Toggle = (props) => {
|
|
|
4072
5676
|
Toggle.displayName = "Toggle";
|
|
4073
5677
|
|
|
4074
5678
|
// src/toolbar/index.tsx
|
|
4075
|
-
import
|
|
5679
|
+
import React42 from "react";
|
|
4076
5680
|
|
|
4077
5681
|
// src/toolbar/hooks/index.tsx
|
|
4078
|
-
import
|
|
5682
|
+
import React41, { useState as useState9, createContext as createContext9, useContext as useContext9 } from "react";
|
|
4079
5683
|
var defaultComponentAPI9 = {
|
|
4080
5684
|
id: "",
|
|
4081
5685
|
states: {},
|
|
@@ -4087,11 +5691,11 @@ var ToolbarProvider = ({
|
|
|
4087
5691
|
children
|
|
4088
5692
|
}) => {
|
|
4089
5693
|
const context = useToolbarProvider();
|
|
4090
|
-
return /* @__PURE__ */
|
|
5694
|
+
return /* @__PURE__ */ React41.createElement(ToolbarContext.Provider, { value: context }, children);
|
|
4091
5695
|
};
|
|
4092
5696
|
function useToolbarProvider() {
|
|
4093
5697
|
const [expanded, setExpanded] = useState9(false);
|
|
4094
|
-
const toolbarId =
|
|
5698
|
+
const toolbarId = React41.useId();
|
|
4095
5699
|
return {
|
|
4096
5700
|
id: toolbarId,
|
|
4097
5701
|
states: {
|
|
@@ -4104,8 +5708,8 @@ function useToolbarProvider() {
|
|
|
4104
5708
|
}
|
|
4105
5709
|
|
|
4106
5710
|
// src/toolbar/styles/index.ts
|
|
4107
|
-
import
|
|
4108
|
-
var ToolbarDefaultStyles =
|
|
5711
|
+
import styled25, { css as css17 } from "styled-components";
|
|
5712
|
+
var ToolbarDefaultStyles = css17`
|
|
4109
5713
|
margin: 0;
|
|
4110
5714
|
display: grid;
|
|
4111
5715
|
grid-template-rows: min-content;
|
|
@@ -4139,7 +5743,7 @@ var ToolbarDefaultStyles = css16`
|
|
|
4139
5743
|
}
|
|
4140
5744
|
}
|
|
4141
5745
|
`;
|
|
4142
|
-
var ToolbarSizeStyles =
|
|
5746
|
+
var ToolbarSizeStyles = css17`
|
|
4143
5747
|
&[data-size="small"] {
|
|
4144
5748
|
&[aria-orientation="vertical"] {
|
|
4145
5749
|
max-width: var(--measurement-large-70);
|
|
@@ -4185,7 +5789,7 @@ var ToolbarSizeStyles = css16`
|
|
|
4185
5789
|
}
|
|
4186
5790
|
}
|
|
4187
5791
|
`;
|
|
4188
|
-
var ToolbarSideStyles =
|
|
5792
|
+
var ToolbarSideStyles = css17`
|
|
4189
5793
|
&[data-side="top"] {
|
|
4190
5794
|
border-bottom-color: var(--font-color-alpha-10);
|
|
4191
5795
|
}
|
|
@@ -4217,7 +5821,7 @@ var ToolbarSideStyles = css16`
|
|
|
4217
5821
|
}
|
|
4218
5822
|
}
|
|
4219
5823
|
`;
|
|
4220
|
-
var ToolbarWrapper =
|
|
5824
|
+
var ToolbarWrapper = styled25.menu`
|
|
4221
5825
|
&[data-raw="false"] {
|
|
4222
5826
|
${ToolbarDefaultStyles}
|
|
4223
5827
|
${ToolbarSizeStyles}
|
|
@@ -4225,7 +5829,7 @@ var ToolbarWrapper = styled26.menu`
|
|
|
4225
5829
|
${ToolbarSideStyles}
|
|
4226
5830
|
}
|
|
4227
5831
|
`;
|
|
4228
|
-
var ToolbarTriggerWrapper =
|
|
5832
|
+
var ToolbarTriggerWrapper = styled25.menu`
|
|
4229
5833
|
&[data-raw="false"] {
|
|
4230
5834
|
all: unset;
|
|
4231
5835
|
align-self: flex-end;
|
|
@@ -4250,13 +5854,13 @@ var Toolbar = (props) => {
|
|
|
4250
5854
|
const { toggleToolbar } = methods;
|
|
4251
5855
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
4252
5856
|
const orientation = side && ["left", "right"].includes(side) ? "vertical" : "horizontal";
|
|
4253
|
-
|
|
5857
|
+
React42.useEffect(() => {
|
|
4254
5858
|
if (defaultOpen && toggleToolbar) return toggleToolbar(true);
|
|
4255
5859
|
}, [defaultOpen]);
|
|
4256
|
-
|
|
5860
|
+
React42.useEffect(() => {
|
|
4257
5861
|
if (shortcut && shortcutControls && toggleToolbar) toggleToolbar();
|
|
4258
5862
|
}, [shortcutControls]);
|
|
4259
|
-
return /* @__PURE__ */
|
|
5863
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4260
5864
|
ToolbarWrapper,
|
|
4261
5865
|
{
|
|
4262
5866
|
id,
|
|
@@ -4276,7 +5880,7 @@ var Toolbar = (props) => {
|
|
|
4276
5880
|
};
|
|
4277
5881
|
Toolbar.displayName = "Toolbar";
|
|
4278
5882
|
var ToolbarRoot = ({ children }) => {
|
|
4279
|
-
return /* @__PURE__ */
|
|
5883
|
+
return /* @__PURE__ */ React42.createElement(ToolbarProvider, null, children);
|
|
4280
5884
|
};
|
|
4281
5885
|
ToolbarRoot.displayName = "Toolbar.Root";
|
|
4282
5886
|
var ToolbarTrigger = (props) => {
|
|
@@ -4294,7 +5898,7 @@ var ToolbarTrigger = (props) => {
|
|
|
4294
5898
|
if (onClick) onClick(event);
|
|
4295
5899
|
if (toggleToolbar) toggleToolbar(!states.expanded);
|
|
4296
5900
|
};
|
|
4297
|
-
return /* @__PURE__ */
|
|
5901
|
+
return /* @__PURE__ */ React42.createElement(ToolbarTriggerWrapper, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React42.createElement(
|
|
4298
5902
|
Button,
|
|
4299
5903
|
{
|
|
4300
5904
|
id: `${id}-trigger`,
|
|
@@ -4312,13 +5916,13 @@ var ToolbarSection = (props) => {
|
|
|
4312
5916
|
const { showoncollapse, children, ...restProps } = props;
|
|
4313
5917
|
const { states } = useToolbar();
|
|
4314
5918
|
const { expanded } = states;
|
|
4315
|
-
if (showoncollapse) return /* @__PURE__ */
|
|
4316
|
-
return /* @__PURE__ */
|
|
5919
|
+
if (showoncollapse) return /* @__PURE__ */ React42.createElement("section", { ...restProps }, children);
|
|
5920
|
+
return /* @__PURE__ */ React42.createElement("section", { ...restProps }, expanded && children);
|
|
4317
5921
|
};
|
|
4318
5922
|
ToolbarSection.displayName = "Toolbar.Section";
|
|
4319
5923
|
var ToolbarItem = (props) => {
|
|
4320
5924
|
const { showfirstchild, onClick, children, ...restProps } = props;
|
|
4321
|
-
const childArray =
|
|
5925
|
+
const childArray = React42.Children.toArray(children);
|
|
4322
5926
|
const { id, states, methods } = useToolbar();
|
|
4323
5927
|
const { expanded } = states;
|
|
4324
5928
|
const { toggleToolbar } = methods;
|
|
@@ -4327,7 +5931,7 @@ var ToolbarItem = (props) => {
|
|
|
4327
5931
|
if (onClick) onClick(event);
|
|
4328
5932
|
if (toggleToolbar && !expanded) toggleToolbar(true);
|
|
4329
5933
|
};
|
|
4330
|
-
return /* @__PURE__ */
|
|
5934
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4331
5935
|
"div",
|
|
4332
5936
|
{
|
|
4333
5937
|
tabIndex: -1,
|
|
@@ -4348,11 +5952,11 @@ Toolbar.Item = ToolbarItem;
|
|
|
4348
5952
|
Toolbar.Section = ToolbarSection;
|
|
4349
5953
|
|
|
4350
5954
|
// src/tooltip/index.tsx
|
|
4351
|
-
import
|
|
5955
|
+
import React43 from "react";
|
|
4352
5956
|
|
|
4353
5957
|
// src/tooltip/styles/index.ts
|
|
4354
|
-
import
|
|
4355
|
-
var
|
|
5958
|
+
import styled26, { keyframes as keyframes4 } from "styled-components";
|
|
5959
|
+
var FadeIn = keyframes4`
|
|
4356
5960
|
0% {
|
|
4357
5961
|
opacity: 0;
|
|
4358
5962
|
}
|
|
@@ -4360,11 +5964,11 @@ var FadeIn2 = keyframes5`
|
|
|
4360
5964
|
opacity: 1;
|
|
4361
5965
|
}
|
|
4362
5966
|
`;
|
|
4363
|
-
var ContentBox =
|
|
5967
|
+
var ContentBox = styled26.div`
|
|
4364
5968
|
display: inline-block;
|
|
4365
5969
|
position: relative;
|
|
4366
5970
|
`;
|
|
4367
|
-
var ContentWrapper2 =
|
|
5971
|
+
var ContentWrapper2 = styled26.span`
|
|
4368
5972
|
&[data-raw="false"] {
|
|
4369
5973
|
width: fit-content;
|
|
4370
5974
|
max-width: var(--measurement-large-60);
|
|
@@ -4383,7 +5987,7 @@ var ContentWrapper2 = styled27.span`
|
|
|
4383
5987
|
font-size: var(--fontsize-medium-10);
|
|
4384
5988
|
z-index: var(--depth-default-100);
|
|
4385
5989
|
animation-duration: 0.2s;
|
|
4386
|
-
animation-name: ${
|
|
5990
|
+
animation-name: ${FadeIn};
|
|
4387
5991
|
animation-fill-mode: backwards;
|
|
4388
5992
|
}
|
|
4389
5993
|
`;
|
|
@@ -4395,13 +5999,13 @@ var Tooltip = ({
|
|
|
4395
5999
|
children,
|
|
4396
6000
|
...restProps
|
|
4397
6001
|
}) => {
|
|
4398
|
-
const [visible, setVisible] =
|
|
4399
|
-
const [triggerProps, setTriggerProps] =
|
|
4400
|
-
const [contentProps, setContentProps] =
|
|
4401
|
-
const mounted =
|
|
4402
|
-
const containerRef =
|
|
4403
|
-
const contentRef =
|
|
4404
|
-
const timeoutRef =
|
|
6002
|
+
const [visible, setVisible] = React43.useState(false);
|
|
6003
|
+
const [triggerProps, setTriggerProps] = React43.useState(null);
|
|
6004
|
+
const [contentProps, setContentProps] = React43.useState(null);
|
|
6005
|
+
const mounted = React43.useRef(false);
|
|
6006
|
+
const containerRef = React43.useRef(null);
|
|
6007
|
+
const contentRef = React43.useRef(null);
|
|
6008
|
+
const timeoutRef = React43.useRef(null);
|
|
4405
6009
|
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
4406
6010
|
const bodyRect = () => {
|
|
4407
6011
|
if (typeof document !== "undefined") {
|
|
@@ -4425,14 +6029,14 @@ var Tooltip = ({
|
|
|
4425
6029
|
};
|
|
4426
6030
|
const hasEnoughHorizontalSpace = Number(dimensions.body_width) - Number(dimensions.content_left) > Number(dimensions.content_width) * 1.1;
|
|
4427
6031
|
const hasEnoughVerticalSpace = Number(dimensions.body_height) - Number(dimensions.content_bottom) > Number(dimensions.content_height) * 0.9;
|
|
4428
|
-
const showTooltip =
|
|
6032
|
+
const showTooltip = React43.useCallback(() => {
|
|
4429
6033
|
timeoutRef.current = setTimeout(() => setVisible(true), delay);
|
|
4430
6034
|
}, [delay]);
|
|
4431
|
-
const hideTooltip =
|
|
6035
|
+
const hideTooltip = React43.useCallback(() => {
|
|
4432
6036
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4433
6037
|
setVisible(false);
|
|
4434
6038
|
}, []);
|
|
4435
|
-
const handleMouseEnter =
|
|
6039
|
+
const handleMouseEnter = React43.useCallback(() => {
|
|
4436
6040
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
4437
6041
|
if (rect) {
|
|
4438
6042
|
setTriggerProps({
|
|
@@ -4446,11 +6050,11 @@ var Tooltip = ({
|
|
|
4446
6050
|
showTooltip();
|
|
4447
6051
|
}
|
|
4448
6052
|
}, [showTooltip]);
|
|
4449
|
-
const handleMouseLeave =
|
|
6053
|
+
const handleMouseLeave = React43.useCallback(
|
|
4450
6054
|
() => hideTooltip(),
|
|
4451
6055
|
[hideTooltip]
|
|
4452
6056
|
);
|
|
4453
|
-
|
|
6057
|
+
React43.useEffect(() => {
|
|
4454
6058
|
mounted.current = true;
|
|
4455
6059
|
setContentProps && setContentProps({
|
|
4456
6060
|
top: Number(contentRect()?.top),
|
|
@@ -4464,7 +6068,7 @@ var Tooltip = ({
|
|
|
4464
6068
|
mounted.current = false;
|
|
4465
6069
|
};
|
|
4466
6070
|
}, [visible]);
|
|
4467
|
-
return /* @__PURE__ */
|
|
6071
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4468
6072
|
ContentBox,
|
|
4469
6073
|
{
|
|
4470
6074
|
ref: containerRef,
|
|
@@ -4474,7 +6078,7 @@ var Tooltip = ({
|
|
|
4474
6078
|
...restProps
|
|
4475
6079
|
},
|
|
4476
6080
|
children,
|
|
4477
|
-
visible && /* @__PURE__ */
|
|
6081
|
+
visible && /* @__PURE__ */ React43.createElement(
|
|
4478
6082
|
ContentWrapper2,
|
|
4479
6083
|
{
|
|
4480
6084
|
ref: contentRef,
|
|
@@ -4489,17 +6093,17 @@ var Tooltip = ({
|
|
|
4489
6093
|
"data-side": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
|
|
4490
6094
|
"data-align": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */
|
|
4491
6095
|
},
|
|
4492
|
-
/* @__PURE__ */
|
|
6096
|
+
/* @__PURE__ */ React43.createElement("div", null, content)
|
|
4493
6097
|
)
|
|
4494
6098
|
);
|
|
4495
6099
|
};
|
|
4496
6100
|
Tooltip.displayName = "Tooltip";
|
|
4497
6101
|
|
|
4498
6102
|
// src/tree/index.tsx
|
|
4499
|
-
import
|
|
6103
|
+
import React46 from "react";
|
|
4500
6104
|
|
|
4501
6105
|
// src/tree/hooks/tree-provider.tsx
|
|
4502
|
-
import
|
|
6106
|
+
import React44, { useState as useState10, createContext as createContext10, useContext as useContext10 } from "react";
|
|
4503
6107
|
var defaultTreeAPI = {
|
|
4504
6108
|
id: "",
|
|
4505
6109
|
states: {},
|
|
@@ -4516,13 +6120,13 @@ var TreeProvider = ({
|
|
|
4516
6120
|
defaultExpandedIds,
|
|
4517
6121
|
onSelectionChange
|
|
4518
6122
|
});
|
|
4519
|
-
return /* @__PURE__ */
|
|
6123
|
+
return /* @__PURE__ */ React44.createElement(TreeContext.Provider, { value: context }, children);
|
|
4520
6124
|
};
|
|
4521
6125
|
function useTreeProviderContext({
|
|
4522
6126
|
defaultExpandedIds,
|
|
4523
6127
|
onSelectionChange
|
|
4524
6128
|
}) {
|
|
4525
|
-
const treeId =
|
|
6129
|
+
const treeId = React44.useId();
|
|
4526
6130
|
const [expandedIds, setExpandedIds] = useState10(
|
|
4527
6131
|
() => new Set(defaultExpandedIds)
|
|
4528
6132
|
);
|
|
@@ -4557,7 +6161,7 @@ function useTreeProviderContext({
|
|
|
4557
6161
|
}
|
|
4558
6162
|
|
|
4559
6163
|
// src/tree/hooks/tree-node-provider.tsx
|
|
4560
|
-
import
|
|
6164
|
+
import React45, { createContext as createContext11, useContext as useContext11 } from "react";
|
|
4561
6165
|
var defaultTreeNodeAPI = {
|
|
4562
6166
|
id: "",
|
|
4563
6167
|
states: {},
|
|
@@ -4572,7 +6176,7 @@ var TreeNodeProvider = ({
|
|
|
4572
6176
|
isLast
|
|
4573
6177
|
}) => {
|
|
4574
6178
|
const context = useTreeNodeProviderContext({ nodeId, level, isLast });
|
|
4575
|
-
return /* @__PURE__ */
|
|
6179
|
+
return /* @__PURE__ */ React45.createElement(TreeNodeContext.Provider, { value: context }, children);
|
|
4576
6180
|
};
|
|
4577
6181
|
function useTreeNodeProviderContext({
|
|
4578
6182
|
nodeId,
|
|
@@ -4591,20 +6195,20 @@ function useTreeNodeProviderContext({
|
|
|
4591
6195
|
}
|
|
4592
6196
|
|
|
4593
6197
|
// src/tree/styles/index.ts
|
|
4594
|
-
import
|
|
4595
|
-
var TreeView =
|
|
6198
|
+
import styled27 from "styled-components";
|
|
6199
|
+
var TreeView = styled27.ul`
|
|
4596
6200
|
display: flex;
|
|
4597
6201
|
flex-direction: column;
|
|
4598
6202
|
list-style: none;
|
|
4599
6203
|
margin: 0;
|
|
4600
6204
|
padding: 0;
|
|
4601
6205
|
`;
|
|
4602
|
-
var TreeItem =
|
|
6206
|
+
var TreeItem = styled27.li`
|
|
4603
6207
|
display: flex;
|
|
4604
6208
|
flex-direction: column;
|
|
4605
6209
|
list-style: none;
|
|
4606
6210
|
`;
|
|
4607
|
-
var TreeNodeContent =
|
|
6211
|
+
var TreeNodeContent = styled27.ul`
|
|
4608
6212
|
display: flex;
|
|
4609
6213
|
flex-direction: column;
|
|
4610
6214
|
list-style: none;
|
|
@@ -4616,7 +6220,7 @@ var TreeNodeContent = styled28.ul`
|
|
|
4616
6220
|
var Tree = (props) => {
|
|
4617
6221
|
const { children, ...restProps } = props;
|
|
4618
6222
|
const { id } = useTree();
|
|
4619
|
-
return /* @__PURE__ */
|
|
6223
|
+
return /* @__PURE__ */ React46.createElement(TreeView, { id, role: "tree", ...restProps }, children);
|
|
4620
6224
|
};
|
|
4621
6225
|
Tree.displayName = "Tree";
|
|
4622
6226
|
var TreeRoot = ({
|
|
@@ -4624,7 +6228,7 @@ var TreeRoot = ({
|
|
|
4624
6228
|
defaultExpandedIds,
|
|
4625
6229
|
onSelectionChange
|
|
4626
6230
|
}) => {
|
|
4627
|
-
return /* @__PURE__ */
|
|
6231
|
+
return /* @__PURE__ */ React46.createElement(
|
|
4628
6232
|
TreeProvider,
|
|
4629
6233
|
{
|
|
4630
6234
|
defaultExpandedIds,
|
|
@@ -4636,7 +6240,7 @@ var TreeRoot = ({
|
|
|
4636
6240
|
TreeRoot.displayName = "Tree.Root";
|
|
4637
6241
|
var TreeNode = (props) => {
|
|
4638
6242
|
const { nodeId, level = 0, isLast = false, children, ...restProps } = props;
|
|
4639
|
-
return /* @__PURE__ */
|
|
6243
|
+
return /* @__PURE__ */ React46.createElement(TreeNodeProvider, { nodeId, level, isLast }, /* @__PURE__ */ React46.createElement(TreeItem, { role: "treeitem", "aria-level": level + 1, ...restProps }, children));
|
|
4640
6244
|
};
|
|
4641
6245
|
TreeNode.displayName = "Tree.Node";
|
|
4642
6246
|
var TreeTrigger = (props) => {
|
|
@@ -4658,7 +6262,7 @@ var TreeTrigger = (props) => {
|
|
|
4658
6262
|
toggleSelected && toggleSelected(nodeId);
|
|
4659
6263
|
}
|
|
4660
6264
|
};
|
|
4661
|
-
return /* @__PURE__ */
|
|
6265
|
+
return /* @__PURE__ */ React46.createElement(
|
|
4662
6266
|
Button,
|
|
4663
6267
|
{
|
|
4664
6268
|
id: String(IdHandler.trigger),
|
|
@@ -4684,11 +6288,11 @@ var TreeContent = (props) => {
|
|
|
4684
6288
|
trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
|
|
4685
6289
|
content: getTreeId && getTreeId({ nodeId, type: "content" })
|
|
4686
6290
|
};
|
|
4687
|
-
|
|
6291
|
+
React46.useEffect(() => {
|
|
4688
6292
|
if (defaultOpen && !isExpanded && toggleExpanded) toggleExpanded(nodeId);
|
|
4689
6293
|
}, []);
|
|
4690
6294
|
if (isExpanded)
|
|
4691
|
-
return /* @__PURE__ */
|
|
6295
|
+
return /* @__PURE__ */ React46.createElement(
|
|
4692
6296
|
TreeNodeContent,
|
|
4693
6297
|
{
|
|
4694
6298
|
role: "group",
|
|
@@ -4699,13 +6303,410 @@ var TreeContent = (props) => {
|
|
|
4699
6303
|
},
|
|
4700
6304
|
children
|
|
4701
6305
|
);
|
|
4702
|
-
return /* @__PURE__ */
|
|
6306
|
+
return /* @__PURE__ */ React46.createElement(React46.Fragment, null);
|
|
4703
6307
|
};
|
|
4704
6308
|
TreeContent.displayName = "Tree.Content";
|
|
4705
6309
|
Tree.Root = TreeRoot;
|
|
4706
6310
|
Tree.Node = TreeNode;
|
|
4707
6311
|
Tree.Trigger = TreeTrigger;
|
|
4708
6312
|
Tree.Content = TreeContent;
|
|
6313
|
+
|
|
6314
|
+
// src/select/index.tsx
|
|
6315
|
+
import React48 from "react";
|
|
6316
|
+
|
|
6317
|
+
// src/select/hooks/index.tsx
|
|
6318
|
+
import React47 from "react";
|
|
6319
|
+
var defaultComponentAPI10 = {
|
|
6320
|
+
id: "",
|
|
6321
|
+
states: {},
|
|
6322
|
+
methods: {}
|
|
6323
|
+
};
|
|
6324
|
+
var SelectContext = React47.createContext(defaultComponentAPI10);
|
|
6325
|
+
var useSelect = () => React47.useContext(SelectContext);
|
|
6326
|
+
var SelectProvider = ({
|
|
6327
|
+
children
|
|
6328
|
+
}) => {
|
|
6329
|
+
const context = useSelectProvider();
|
|
6330
|
+
return /* @__PURE__ */ React47.createElement(SelectContext.Provider, { value: context }, children);
|
|
6331
|
+
};
|
|
6332
|
+
function useSelectProvider() {
|
|
6333
|
+
const DEFAULT_POSITIONS2 = {
|
|
6334
|
+
top: 0,
|
|
6335
|
+
right: 0,
|
|
6336
|
+
bottom: 0,
|
|
6337
|
+
left: 0
|
|
6338
|
+
};
|
|
6339
|
+
const DEFAULT_DIMENSIONS2 = {
|
|
6340
|
+
width: 0,
|
|
6341
|
+
height: 0
|
|
6342
|
+
};
|
|
6343
|
+
const [open, setOpen] = React47.useState(false);
|
|
6344
|
+
const [value, setValue] = React47.useState(null);
|
|
6345
|
+
const [label, setLabel] = React47.useState("");
|
|
6346
|
+
const [contentProps, setContentProps] = React47.useState({
|
|
6347
|
+
...DEFAULT_POSITIONS2,
|
|
6348
|
+
...DEFAULT_DIMENSIONS2
|
|
6349
|
+
});
|
|
6350
|
+
const [triggerProps, setTriggerProps] = React47.useState({
|
|
6351
|
+
...DEFAULT_POSITIONS2,
|
|
6352
|
+
...DEFAULT_DIMENSIONS2
|
|
6353
|
+
});
|
|
6354
|
+
const triggerId = React47.useId();
|
|
6355
|
+
const listboxId = React47.useId();
|
|
6356
|
+
const composedId = `${triggerId}|${listboxId}`;
|
|
6357
|
+
return {
|
|
6358
|
+
id: composedId,
|
|
6359
|
+
states: {
|
|
6360
|
+
open,
|
|
6361
|
+
value,
|
|
6362
|
+
label,
|
|
6363
|
+
contentProps,
|
|
6364
|
+
triggerProps
|
|
6365
|
+
},
|
|
6366
|
+
methods: {
|
|
6367
|
+
toggleOpen: () => setOpen(!open),
|
|
6368
|
+
setOpen,
|
|
6369
|
+
setValue,
|
|
6370
|
+
setLabel,
|
|
6371
|
+
setContentProps,
|
|
6372
|
+
setTriggerProps
|
|
6373
|
+
}
|
|
6374
|
+
};
|
|
6375
|
+
}
|
|
6376
|
+
|
|
6377
|
+
// src/select/styles/index.tsx
|
|
6378
|
+
import styled28 from "styled-components";
|
|
6379
|
+
var Wrapper = styled28.div`
|
|
6380
|
+
position: relative;
|
|
6381
|
+
width: 100%;
|
|
6382
|
+
`;
|
|
6383
|
+
var Trigger = styled28.button`
|
|
6384
|
+
all: unset;
|
|
6385
|
+
box-sizing: border-box;
|
|
6386
|
+
|
|
6387
|
+
position: relative;
|
|
6388
|
+
display: flex;
|
|
6389
|
+
align-items: center;
|
|
6390
|
+
justify-content: space-between;
|
|
6391
|
+
gap: var(--measurement-medium-10);
|
|
6392
|
+
|
|
6393
|
+
${FieldDefaultStyles}
|
|
6394
|
+
${FieldVariantsStyles}
|
|
6395
|
+
${FieldShapeStyles}
|
|
6396
|
+
${FieldSizeStyles}
|
|
6397
|
+
|
|
6398
|
+
|
|
6399
|
+
cursor: pointer !important;
|
|
6400
|
+
`;
|
|
6401
|
+
var Label2 = styled28.span`
|
|
6402
|
+
flex: 1;
|
|
6403
|
+
text-align: left;
|
|
6404
|
+
font-weight: 400;
|
|
6405
|
+
white-space: nowrap;
|
|
6406
|
+
overflow: hidden;
|
|
6407
|
+
text-overflow: ellipsis;
|
|
6408
|
+
`;
|
|
6409
|
+
var Content = styled28.ul`
|
|
6410
|
+
@keyframes select-slide-in-down {
|
|
6411
|
+
0% {
|
|
6412
|
+
opacity: 0;
|
|
6413
|
+
transform: translateY(calc(var(--measurement-small-60) * -1));
|
|
6414
|
+
}
|
|
6415
|
+
100% {
|
|
6416
|
+
opacity: 1;
|
|
6417
|
+
transform: translateY(0);
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
|
|
6421
|
+
@keyframes select-slide-in-up {
|
|
6422
|
+
0% {
|
|
6423
|
+
opacity: 0;
|
|
6424
|
+
transform: translateY(var(--measurement-small-60));
|
|
6425
|
+
}
|
|
6426
|
+
100% {
|
|
6427
|
+
opacity: 1;
|
|
6428
|
+
transform: translateY(0);
|
|
6429
|
+
}
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6432
|
+
&[data-raw="false"] {
|
|
6433
|
+
position: fixed;
|
|
6434
|
+
margin: 0;
|
|
6435
|
+
box-sizing: border-box;
|
|
6436
|
+
|
|
6437
|
+
padding: var(--measurement-medium-30);
|
|
6438
|
+
|
|
6439
|
+
list-style: none;
|
|
6440
|
+
|
|
6441
|
+
background-color: var(--body-color);
|
|
6442
|
+
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
6443
|
+
border-radius: var(--measurement-medium-30);
|
|
6444
|
+
|
|
6445
|
+
z-index: var(--depth-default-100);
|
|
6446
|
+
|
|
6447
|
+
height: auto;
|
|
6448
|
+
max-height: var(--measurement-large-90);
|
|
6449
|
+
overflow-y: auto;
|
|
6450
|
+
|
|
6451
|
+
animation-duration: 0.2s;
|
|
6452
|
+
animation-fill-mode: backwards;
|
|
6453
|
+
|
|
6454
|
+
&[data-side="bottom"] {
|
|
6455
|
+
animation-name: select-slide-in-down;
|
|
6456
|
+
}
|
|
6457
|
+
|
|
6458
|
+
&[data-side="top"] {
|
|
6459
|
+
animation-name: select-slide-in-up;
|
|
6460
|
+
}
|
|
6461
|
+
}
|
|
6462
|
+
`;
|
|
6463
|
+
var List = styled28.li`
|
|
6464
|
+
list-style: none;
|
|
6465
|
+
padding: 0;
|
|
6466
|
+
margin: 0;
|
|
6467
|
+
user-select: none;
|
|
6468
|
+
|
|
6469
|
+
&[data-raw="false"] {
|
|
6470
|
+
display: flex;
|
|
6471
|
+
align-items: center;
|
|
6472
|
+
justify-content: space-between;
|
|
6473
|
+
gap: var(--measurement-medium-10);
|
|
6474
|
+
|
|
6475
|
+
padding: var(--measurement-medium-30);
|
|
6476
|
+
border-radius: var(--measurement-medium-20);
|
|
6477
|
+
|
|
6478
|
+
text-align: left;
|
|
6479
|
+
|
|
6480
|
+
color: var(--font-color);
|
|
6481
|
+
|
|
6482
|
+
outline: none;
|
|
6483
|
+
cursor: pointer;
|
|
6484
|
+
|
|
6485
|
+
transition: all ease-in-out 0.2s;
|
|
6486
|
+
|
|
6487
|
+
&:hover,
|
|
6488
|
+
&:focus,
|
|
6489
|
+
&:active,
|
|
6490
|
+
&:focus-within,
|
|
6491
|
+
&:has(:active) {
|
|
6492
|
+
background-color: var(--contrast-color);
|
|
6493
|
+
}
|
|
6494
|
+
|
|
6495
|
+
&[data-selected="true"] {
|
|
6496
|
+
color: var(--font-color);
|
|
6497
|
+
background-color: var(--contrast-color);
|
|
6498
|
+
|
|
6499
|
+
&:hover,
|
|
6500
|
+
&:focus,
|
|
6501
|
+
&:active {
|
|
6502
|
+
background-color: var(--font-color-alpha-10);
|
|
6503
|
+
}
|
|
6504
|
+
}
|
|
6505
|
+
}
|
|
6506
|
+
|
|
6507
|
+
&[aria-disabled="true"] {
|
|
6508
|
+
cursor: not-allowed;
|
|
6509
|
+
opacity: 0.6;
|
|
6510
|
+
}
|
|
6511
|
+
`;
|
|
6512
|
+
var Item = styled28.span`
|
|
6513
|
+
display: flex;
|
|
6514
|
+
align-items: center;
|
|
6515
|
+
gap: var(--measurement-small-60);
|
|
6516
|
+
flex: 1;
|
|
6517
|
+
white-space: nowrap;
|
|
6518
|
+
overflow: hidden;
|
|
6519
|
+
text-overflow: ellipsis;
|
|
6520
|
+
`;
|
|
6521
|
+
|
|
6522
|
+
// src/select/index.tsx
|
|
6523
|
+
var SelectRoot = ({ children }) => {
|
|
6524
|
+
return /* @__PURE__ */ React48.createElement(SelectProvider, null, children);
|
|
6525
|
+
};
|
|
6526
|
+
SelectRoot.displayName = "Select.Root";
|
|
6527
|
+
var Select = ({ children }) => {
|
|
6528
|
+
const selectRef = React48.useRef(null);
|
|
6529
|
+
const { states, methods } = useSelect();
|
|
6530
|
+
const handleClickOutside = () => {
|
|
6531
|
+
if (states.open && methods.setOpen) {
|
|
6532
|
+
methods.setOpen(false);
|
|
6533
|
+
}
|
|
6534
|
+
};
|
|
6535
|
+
useClickOutside(
|
|
6536
|
+
selectRef,
|
|
6537
|
+
handleClickOutside
|
|
6538
|
+
);
|
|
6539
|
+
return /* @__PURE__ */ React48.createElement(Wrapper, { ref: selectRef }, children);
|
|
6540
|
+
};
|
|
6541
|
+
Select.displayName = "Select";
|
|
6542
|
+
var SelectTrigger = (props) => {
|
|
6543
|
+
const {
|
|
6544
|
+
raw,
|
|
6545
|
+
variant,
|
|
6546
|
+
shape,
|
|
6547
|
+
sizing,
|
|
6548
|
+
error = false,
|
|
6549
|
+
disabled,
|
|
6550
|
+
children,
|
|
6551
|
+
...restProps
|
|
6552
|
+
} = props;
|
|
6553
|
+
const triggerRef = React48.useRef(null);
|
|
6554
|
+
const triggerRect = () => triggerRef.current?.getBoundingClientRect();
|
|
6555
|
+
const { id, states, methods } = useSelect();
|
|
6556
|
+
const { toggleOpen, setTriggerProps } = methods;
|
|
6557
|
+
const handleClick = () => {
|
|
6558
|
+
if (disabled) return;
|
|
6559
|
+
if (toggleOpen) toggleOpen();
|
|
6560
|
+
if (setTriggerProps) {
|
|
6561
|
+
setTriggerProps({
|
|
6562
|
+
top: Number(triggerRect()?.top),
|
|
6563
|
+
right: Number(triggerRect()?.right),
|
|
6564
|
+
bottom: Number(triggerRect()?.bottom),
|
|
6565
|
+
left: Number(triggerRect()?.left),
|
|
6566
|
+
width: Number(triggerRect()?.width),
|
|
6567
|
+
height: Number(triggerRect()?.height)
|
|
6568
|
+
});
|
|
6569
|
+
}
|
|
6570
|
+
};
|
|
6571
|
+
return /* @__PURE__ */ React48.createElement(
|
|
6572
|
+
Trigger,
|
|
6573
|
+
{
|
|
6574
|
+
ref: triggerRef,
|
|
6575
|
+
type: "button",
|
|
6576
|
+
role: "combobox",
|
|
6577
|
+
id: id.split("|").at(0),
|
|
6578
|
+
onClick: handleClick,
|
|
6579
|
+
"aria-haspopup": "listbox",
|
|
6580
|
+
"aria-expanded": Boolean(states.open),
|
|
6581
|
+
"aria-controls": id.split("|").at(-1),
|
|
6582
|
+
"data-state": states.open ? "open" : "closed",
|
|
6583
|
+
"data-variant": variant ?? "secondary" /* Secondary */,
|
|
6584
|
+
"data-shape": shape ?? "smooth" /* Smooth */,
|
|
6585
|
+
"data-size": sizing ?? "medium" /* Medium */,
|
|
6586
|
+
"data-error": error,
|
|
6587
|
+
"data-raw": Boolean(raw),
|
|
6588
|
+
disabled,
|
|
6589
|
+
...restProps
|
|
6590
|
+
},
|
|
6591
|
+
/* @__PURE__ */ React48.createElement(Label2, null, children)
|
|
6592
|
+
);
|
|
6593
|
+
};
|
|
6594
|
+
SelectTrigger.displayName = "Select.Trigger";
|
|
6595
|
+
var SelectContent = (props) => {
|
|
6596
|
+
const { raw, defaultOpen, children, ...restProps } = props;
|
|
6597
|
+
const { id, states, methods } = useSelect();
|
|
6598
|
+
const { toggleOpen, setContentProps } = methods;
|
|
6599
|
+
const mounted = React48.useRef(false);
|
|
6600
|
+
const contentRef = React48.useRef(null);
|
|
6601
|
+
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
6602
|
+
const bodyRect = () => {
|
|
6603
|
+
if (typeof document !== "undefined") {
|
|
6604
|
+
return document?.body?.getBoundingClientRect();
|
|
6605
|
+
}
|
|
6606
|
+
return void 0;
|
|
6607
|
+
};
|
|
6608
|
+
const positions = {
|
|
6609
|
+
btt: `calc((${states?.triggerProps?.top}px - ${states?.contentProps?.height}px) - (var(--measurement-medium-10) * 2))`,
|
|
6610
|
+
ttb: `calc((${states?.triggerProps?.top}px + ${states?.triggerProps?.height}px) + var(--measurement-medium-10))`
|
|
6611
|
+
};
|
|
6612
|
+
const dimensions = {
|
|
6613
|
+
body_height: bodyRect()?.height ?? 0,
|
|
6614
|
+
content_height: states.contentProps.height,
|
|
6615
|
+
content_bottom: states.contentProps.bottom
|
|
6616
|
+
};
|
|
6617
|
+
const hasEnoughVerticalSpace = dimensions.body_height - dimensions.content_bottom > dimensions.content_height - dimensions.content_height * 0.9;
|
|
6618
|
+
React48.useEffect(() => {
|
|
6619
|
+
if (defaultOpen && toggleOpen) toggleOpen();
|
|
6620
|
+
}, []);
|
|
6621
|
+
React48.useEffect(() => {
|
|
6622
|
+
mounted.current = true;
|
|
6623
|
+
if (setContentProps) {
|
|
6624
|
+
setContentProps({
|
|
6625
|
+
top: Number(contentRect()?.top),
|
|
6626
|
+
right: Number(contentRect()?.right),
|
|
6627
|
+
bottom: Number(contentRect()?.bottom),
|
|
6628
|
+
left: Number(contentRect()?.left),
|
|
6629
|
+
width: Number(contentRect()?.width),
|
|
6630
|
+
height: Number(contentRect()?.height)
|
|
6631
|
+
});
|
|
6632
|
+
}
|
|
6633
|
+
return () => {
|
|
6634
|
+
mounted.current = false;
|
|
6635
|
+
};
|
|
6636
|
+
}, [states.open]);
|
|
6637
|
+
React48.useEffect(() => {
|
|
6638
|
+
if (!states.open) return;
|
|
6639
|
+
const handleKeyDown = (event) => {
|
|
6640
|
+
if (event.key === "Escape" && methods.setOpen) {
|
|
6641
|
+
methods.setOpen(false);
|
|
6642
|
+
}
|
|
6643
|
+
};
|
|
6644
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
6645
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
6646
|
+
}, [states.open]);
|
|
6647
|
+
if (!states.open) return null;
|
|
6648
|
+
return /* @__PURE__ */ React48.createElement(
|
|
6649
|
+
ScrollArea,
|
|
6650
|
+
{
|
|
6651
|
+
scrollbar: true,
|
|
6652
|
+
as: Content,
|
|
6653
|
+
ref: contentRef,
|
|
6654
|
+
id: id.split("|").at(-1),
|
|
6655
|
+
role: "listbox",
|
|
6656
|
+
tabIndex: -1,
|
|
6657
|
+
"aria-labelledby": id.split("|").at(0),
|
|
6658
|
+
"data-state": applyDataState(Boolean(states.open)),
|
|
6659
|
+
"data-side": hasEnoughVerticalSpace ? "bottom" : "top",
|
|
6660
|
+
"data-raw": Boolean(raw),
|
|
6661
|
+
style: {
|
|
6662
|
+
top: hasEnoughVerticalSpace ? positions.ttb : positions.btt,
|
|
6663
|
+
left: `${states?.triggerProps?.left}px`,
|
|
6664
|
+
width: `${states?.triggerProps?.width}px`
|
|
6665
|
+
},
|
|
6666
|
+
...restProps
|
|
6667
|
+
},
|
|
6668
|
+
children
|
|
6669
|
+
);
|
|
6670
|
+
};
|
|
6671
|
+
SelectContent.displayName = "Select.Content";
|
|
6672
|
+
var SelectItem = (props) => {
|
|
6673
|
+
const { raw, value, disabled, onClick, children, ...restProps } = props;
|
|
6674
|
+
const { states, methods } = useSelect();
|
|
6675
|
+
const isSelected = states?.value === value;
|
|
6676
|
+
const handleSelect = (event) => {
|
|
6677
|
+
if (disabled) return;
|
|
6678
|
+
if (methods.setValue) methods.setValue(value);
|
|
6679
|
+
if (methods.setOpen) methods.setOpen(false);
|
|
6680
|
+
if (onClick) onClick(event);
|
|
6681
|
+
};
|
|
6682
|
+
const handleKeyDown = (event) => {
|
|
6683
|
+
if (["Space", "Enter"].includes(event.code || event.key) && !disabled) {
|
|
6684
|
+
event.preventDefault();
|
|
6685
|
+
handleSelect(event);
|
|
6686
|
+
}
|
|
6687
|
+
};
|
|
6688
|
+
return /* @__PURE__ */ React48.createElement(
|
|
6689
|
+
List,
|
|
6690
|
+
{
|
|
6691
|
+
role: "option",
|
|
6692
|
+
tabIndex: 0,
|
|
6693
|
+
"aria-disabled": disabled,
|
|
6694
|
+
"aria-selected": isSelected,
|
|
6695
|
+
"data-orientation": "vertical",
|
|
6696
|
+
"data-selected": isSelected,
|
|
6697
|
+
"data-raw": Boolean(raw),
|
|
6698
|
+
onClick: handleSelect,
|
|
6699
|
+
onKeyDown: handleKeyDown,
|
|
6700
|
+
...restProps
|
|
6701
|
+
},
|
|
6702
|
+
/* @__PURE__ */ React48.createElement(Item, null, children)
|
|
6703
|
+
);
|
|
6704
|
+
};
|
|
6705
|
+
SelectItem.displayName = "Select.Item";
|
|
6706
|
+
Select.Root = SelectRoot;
|
|
6707
|
+
Select.Trigger = SelectTrigger;
|
|
6708
|
+
Select.Content = SelectContent;
|
|
6709
|
+
Select.Item = SelectItem;
|
|
4709
6710
|
export {
|
|
4710
6711
|
Accordion,
|
|
4711
6712
|
AccordionContent,
|
|
@@ -4713,6 +6714,7 @@ export {
|
|
|
4713
6714
|
AccordionTrigger,
|
|
4714
6715
|
AvataStatusEnum,
|
|
4715
6716
|
Avatar,
|
|
6717
|
+
AvatarStatus,
|
|
4716
6718
|
Badge,
|
|
4717
6719
|
Breadcrumb,
|
|
4718
6720
|
BreadcrumbItem,
|
|
@@ -4743,9 +6745,14 @@ export {
|
|
|
4743
6745
|
DropdownMenuRoot,
|
|
4744
6746
|
DropdownMenuTrigger,
|
|
4745
6747
|
Field,
|
|
6748
|
+
FieldDate,
|
|
6749
|
+
FieldFile,
|
|
4746
6750
|
FieldLabel,
|
|
4747
6751
|
FieldMeta,
|
|
6752
|
+
FieldNumber,
|
|
6753
|
+
FieldPassword,
|
|
4748
6754
|
FieldRoot,
|
|
6755
|
+
FieldTag,
|
|
4749
6756
|
FieldWrapper,
|
|
4750
6757
|
MessageBubble,
|
|
4751
6758
|
MessageBubbleContent,
|
|
@@ -4763,9 +6770,13 @@ export {
|
|
|
4763
6770
|
PageTools,
|
|
4764
6771
|
PageWrapper,
|
|
4765
6772
|
Portal,
|
|
4766
|
-
PrivacyField,
|
|
4767
6773
|
Resizable,
|
|
4768
6774
|
ScrollArea,
|
|
6775
|
+
Select,
|
|
6776
|
+
SelectContent,
|
|
6777
|
+
SelectItem,
|
|
6778
|
+
SelectRoot,
|
|
6779
|
+
SelectTrigger,
|
|
4769
6780
|
Sheet,
|
|
4770
6781
|
SheetRoot,
|
|
4771
6782
|
SheetTrigger,
|
|
@@ -4806,6 +6817,7 @@ export {
|
|
|
4806
6817
|
useDropdownMenu,
|
|
4807
6818
|
useField,
|
|
4808
6819
|
useMessageBubble,
|
|
6820
|
+
useSelect,
|
|
4809
6821
|
useSheet,
|
|
4810
6822
|
useSwitch,
|
|
4811
6823
|
useTabs,
|