@usefui/components 1.6.0 → 1.7.1
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 +12 -0
- package/dist/index.d.mts +380 -52
- package/dist/index.d.ts +380 -52
- package/dist/index.js +2532 -511
- package/dist/index.mjs +2518 -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 +13 -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,17 @@ 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
|
+
|
|
2017
|
+
padding: var(--measurement-medium-30);
|
|
1436
2018
|
width: 100%;
|
|
1437
2019
|
|
|
1438
|
-
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
1439
|
-
background-color: var(--body-color);
|
|
1440
2020
|
border-radius: var(--measurement-medium-30);
|
|
2021
|
+
background: var(--body-color);
|
|
2022
|
+
|
|
2023
|
+
border: var(--measurement-small-10) solid var(--contrast-color);
|
|
2024
|
+
box-shadow: 0 var(--measurement-medium-40) var(--measurement-medium-60)
|
|
2025
|
+
calc(var(--measurement-medium-60) * -1) rgba(0, 0, 0, 0.3);
|
|
1441
2026
|
|
|
1442
2027
|
transition: all ease-in-out 0.2s;
|
|
1443
2028
|
z-index: var(--depth-default-100);
|
|
@@ -1452,7 +2037,7 @@ var DialogSizeStyles = css6`
|
|
|
1452
2037
|
max-height: var(--max-height);
|
|
1453
2038
|
}
|
|
1454
2039
|
&[data-size="medium"] {
|
|
1455
|
-
max-width: calc(var(--measurement-large-90) * 2
|
|
2040
|
+
max-width: calc(var(--measurement-large-90) * 2);
|
|
1456
2041
|
max-height: var(--max-height);
|
|
1457
2042
|
}
|
|
1458
2043
|
|
|
@@ -1474,14 +2059,14 @@ var Menu = styled7.menu`
|
|
|
1474
2059
|
}
|
|
1475
2060
|
`;
|
|
1476
2061
|
var DialogWrapper = styled7.dialog`
|
|
1477
|
-
@keyframes
|
|
2062
|
+
@keyframes scale-in {
|
|
1478
2063
|
0% {
|
|
1479
2064
|
opacity: 0;
|
|
1480
|
-
transform:
|
|
2065
|
+
transform: scale(0.95);
|
|
1481
2066
|
}
|
|
1482
2067
|
100% {
|
|
1483
2068
|
opacity: 1;
|
|
1484
|
-
transform:
|
|
2069
|
+
transform: Scale(1);
|
|
1485
2070
|
}
|
|
1486
2071
|
}
|
|
1487
2072
|
|
|
@@ -1494,7 +2079,7 @@ var DialogWrapper = styled7.dialog`
|
|
|
1494
2079
|
${DialogSizeStyles}
|
|
1495
2080
|
|
|
1496
2081
|
animation-duration: 0.2s;
|
|
1497
|
-
animation-name:
|
|
2082
|
+
animation-name: scale-in;
|
|
1498
2083
|
animation-fill-mode: backwards;
|
|
1499
2084
|
}
|
|
1500
2085
|
`;
|
|
@@ -1683,15 +2268,7 @@ function useDropdownMenuProvider() {
|
|
|
1683
2268
|
}
|
|
1684
2269
|
|
|
1685
2270
|
// 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
|
-
`;
|
|
2271
|
+
import styled9, { css as css7 } from "styled-components";
|
|
1695
2272
|
var ContentWrapperSizes = css7`
|
|
1696
2273
|
--small: var(--measurement-large-60);
|
|
1697
2274
|
--medium: var(--measurement-large-80);
|
|
@@ -1722,6 +2299,17 @@ var ContentWrapper = styled9.ul`
|
|
|
1722
2299
|
--medium: var(--measurement-large-80);
|
|
1723
2300
|
--large: var(--measurement-large-90);
|
|
1724
2301
|
|
|
2302
|
+
@keyframes slide-in {
|
|
2303
|
+
0% {
|
|
2304
|
+
opacity: 0;
|
|
2305
|
+
transform: translateY(calc(var(--measurement-small-60) * -1));
|
|
2306
|
+
}
|
|
2307
|
+
100% {
|
|
2308
|
+
opacity: 1;
|
|
2309
|
+
transform: translateY(0);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
|
|
1725
2313
|
&[data-raw="false"] {
|
|
1726
2314
|
position: fixed;
|
|
1727
2315
|
margin: 0;
|
|
@@ -1734,11 +2322,11 @@ var ContentWrapper = styled9.ul`
|
|
|
1734
2322
|
border-radius: var(--measurement-medium-30);
|
|
1735
2323
|
|
|
1736
2324
|
z-index: var(--depth-default-100);
|
|
1737
|
-
animation-duration: 0.2s;
|
|
1738
|
-
animation-name: ${FadeIn};
|
|
1739
|
-
animation-fill-mode: backwards;
|
|
1740
2325
|
|
|
1741
2326
|
${ContentWrapperSizes}
|
|
2327
|
+
animation-duration: 0.2s;
|
|
2328
|
+
animation-name: slide-in;
|
|
2329
|
+
animation-fill-mode: backwards;
|
|
1742
2330
|
}
|
|
1743
2331
|
`;
|
|
1744
2332
|
var ItemWrapper2 = styled9.li`
|
|
@@ -1748,20 +2336,28 @@ var ItemWrapper2 = styled9.li`
|
|
|
1748
2336
|
user-select: none;
|
|
1749
2337
|
|
|
1750
2338
|
&[data-raw="false"] {
|
|
1751
|
-
|
|
1752
|
-
padding: var(--measurement-medium-30);
|
|
2339
|
+
padding: var(--measurement-medium-10) var(--measurement-medium-30);
|
|
1753
2340
|
border-radius: var(--measurement-medium-20);
|
|
2341
|
+
|
|
1754
2342
|
text-align: left;
|
|
1755
|
-
|
|
2343
|
+
font-weight: 600;
|
|
2344
|
+
letter-spacing: calc(
|
|
2345
|
+
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
2346
|
+
);
|
|
2347
|
+
font-size: var(--fontsize-medium-10);
|
|
2348
|
+
color: var(--font-color);
|
|
2349
|
+
|
|
1756
2350
|
outline: none;
|
|
1757
|
-
transition: all ease-in-out 0.2s;
|
|
1758
2351
|
cursor: pointer;
|
|
1759
2352
|
|
|
2353
|
+
transition: all ease-in-out 0.2s;
|
|
2354
|
+
|
|
1760
2355
|
&:hover,
|
|
1761
2356
|
&:focus,
|
|
1762
|
-
&:active
|
|
1763
|
-
|
|
1764
|
-
|
|
2357
|
+
&:active,
|
|
2358
|
+
&:focus-within,
|
|
2359
|
+
&:has(:active) {
|
|
2360
|
+
background-color: var(--contrast-color);
|
|
1765
2361
|
}
|
|
1766
2362
|
}
|
|
1767
2363
|
|
|
@@ -1871,7 +2467,18 @@ var DropdownMenuContent = React17.forwardRef((props, _) => {
|
|
|
1871
2467
|
mounted.current = false;
|
|
1872
2468
|
};
|
|
1873
2469
|
}, [states.open]);
|
|
1874
|
-
|
|
2470
|
+
React17.useEffect(() => {
|
|
2471
|
+
if (!states.open) return;
|
|
2472
|
+
const handleKeyDown = (event) => {
|
|
2473
|
+
if (event.key === "Escape" && methods.toggleOpen) {
|
|
2474
|
+
methods.toggleOpen();
|
|
2475
|
+
}
|
|
2476
|
+
};
|
|
2477
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2478
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2479
|
+
}, [states.open]);
|
|
2480
|
+
if (!states.open) return null;
|
|
2481
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1875
2482
|
ContentWrapper,
|
|
1876
2483
|
{
|
|
1877
2484
|
ref: contentRef,
|
|
@@ -1891,7 +2498,7 @@ var DropdownMenuContent = React17.forwardRef((props, _) => {
|
|
|
1891
2498
|
...restProps
|
|
1892
2499
|
},
|
|
1893
2500
|
children
|
|
1894
|
-
)
|
|
2501
|
+
);
|
|
1895
2502
|
});
|
|
1896
2503
|
DropdownMenuContent.displayName = "DropdownMenu.Content";
|
|
1897
2504
|
var DropdownMenuItem = (props) => {
|
|
@@ -1985,15 +2592,17 @@ var FieldDefaultStyles = css8`
|
|
|
1985
2592
|
|
|
1986
2593
|
font-size: var(--fontsize-medium-20);
|
|
1987
2594
|
|
|
1988
|
-
line-height: 1
|
|
2595
|
+
line-height: 1;
|
|
1989
2596
|
letter-spacing: calc(
|
|
1990
2597
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
1991
2598
|
);
|
|
1992
2599
|
|
|
1993
2600
|
border: var(--measurement-small-10) solid transparent;
|
|
2601
|
+
|
|
1994
2602
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
1995
2603
|
color: var(--font-color-alpha-60);
|
|
1996
|
-
|
|
2604
|
+
|
|
2605
|
+
width: 100%;
|
|
1997
2606
|
height: fit-content;
|
|
1998
2607
|
|
|
1999
2608
|
transition: all ease-in-out 0.2s;
|
|
@@ -2006,7 +2615,9 @@ var FieldDefaultStyles = css8`
|
|
|
2006
2615
|
|
|
2007
2616
|
&:hover,
|
|
2008
2617
|
&:focus,
|
|
2009
|
-
&:active
|
|
2618
|
+
&:active,
|
|
2619
|
+
&:focus-within,
|
|
2620
|
+
&:has(:active) {
|
|
2010
2621
|
color: var(--font-color);
|
|
2011
2622
|
svg,
|
|
2012
2623
|
span,
|
|
@@ -2019,26 +2630,46 @@ var FieldDefaultStyles = css8`
|
|
|
2019
2630
|
color: var(--font-color-alpha-30);
|
|
2020
2631
|
}
|
|
2021
2632
|
|
|
2022
|
-
&:disabled
|
|
2633
|
+
&:disabled,
|
|
2634
|
+
&:has(:disabled) {
|
|
2023
2635
|
cursor: not-allowed;
|
|
2024
2636
|
opacity: 0.6;
|
|
2025
2637
|
}
|
|
2026
2638
|
`;
|
|
2027
2639
|
var FieldVariantsStyles = css8`
|
|
2028
2640
|
&[data-variant="primary"] {
|
|
2029
|
-
background-color:
|
|
2641
|
+
background-color: transparent;
|
|
2030
2642
|
border-color: var(--font-color-alpha-10);
|
|
2031
2643
|
|
|
2644
|
+
&:hover,
|
|
2032
2645
|
&:focus,
|
|
2033
|
-
&:active
|
|
2034
|
-
|
|
2646
|
+
&:active,
|
|
2647
|
+
&:focus-within,
|
|
2648
|
+
&:has(:hover),
|
|
2649
|
+
&:has(:active) {
|
|
2650
|
+
border-color: var(--font-color-alpha-20);
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
&:focus,
|
|
2654
|
+
&:active,
|
|
2655
|
+
&:focus-within,
|
|
2656
|
+
&:has(:active) {
|
|
2657
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-accent-30);
|
|
2035
2658
|
}
|
|
2036
2659
|
|
|
2037
2660
|
&[data-error="true"] {
|
|
2038
2661
|
color: var(--color-red);
|
|
2039
|
-
background-color: var(--alpha-red-10);
|
|
2040
2662
|
border-color: var(--alpha-red-10);
|
|
2041
|
-
|
|
2663
|
+
|
|
2664
|
+
&:hover,
|
|
2665
|
+
&:focus,
|
|
2666
|
+
&:active,
|
|
2667
|
+
&:focus-within,
|
|
2668
|
+
&:has(:hover),
|
|
2669
|
+
&:has(:active) {
|
|
2670
|
+
background-color: var(--alpha-red-10);
|
|
2671
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
2672
|
+
}
|
|
2042
2673
|
}
|
|
2043
2674
|
}
|
|
2044
2675
|
|
|
@@ -2048,12 +2679,17 @@ var FieldVariantsStyles = css8`
|
|
|
2048
2679
|
|
|
2049
2680
|
&:hover,
|
|
2050
2681
|
&:focus,
|
|
2051
|
-
&:active
|
|
2682
|
+
&:active,
|
|
2683
|
+
&:focus-within,
|
|
2684
|
+
&:has(:hover),
|
|
2685
|
+
&:has(:active) {
|
|
2052
2686
|
border-color: var(--font-color-alpha-20);
|
|
2053
2687
|
}
|
|
2054
2688
|
|
|
2055
2689
|
&:focus,
|
|
2056
|
-
&:active
|
|
2690
|
+
&:active,
|
|
2691
|
+
&:focus-within,
|
|
2692
|
+
&:has(:active) {
|
|
2057
2693
|
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
2058
2694
|
}
|
|
2059
2695
|
|
|
@@ -2063,7 +2699,10 @@ var FieldVariantsStyles = css8`
|
|
|
2063
2699
|
|
|
2064
2700
|
&:hover,
|
|
2065
2701
|
&:focus,
|
|
2066
|
-
&:active
|
|
2702
|
+
&:active,
|
|
2703
|
+
&:focus-within,
|
|
2704
|
+
&:has(:hover),
|
|
2705
|
+
&:has(:active) {
|
|
2067
2706
|
background-color: var(--alpha-red-10);
|
|
2068
2707
|
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
2069
2708
|
}
|
|
@@ -2080,7 +2719,10 @@ var FieldVariantsStyles = css8`
|
|
|
2080
2719
|
|
|
2081
2720
|
&:hover,
|
|
2082
2721
|
&:focus,
|
|
2083
|
-
&:active
|
|
2722
|
+
&:active,
|
|
2723
|
+
&:focus-within,
|
|
2724
|
+
&:has(:hover),
|
|
2725
|
+
&:has(:active) {
|
|
2084
2726
|
color: var(--font-color);
|
|
2085
2727
|
}
|
|
2086
2728
|
|
|
@@ -2101,7 +2743,6 @@ var FieldSizeStyles = css8`
|
|
|
2101
2743
|
padding: 0 var(--measurement-medium-30);
|
|
2102
2744
|
min-width: var(--measurement-medium-90);
|
|
2103
2745
|
min-height: var(--measurement-medium-90);
|
|
2104
|
-
width: fit-content;
|
|
2105
2746
|
}
|
|
2106
2747
|
&[data-size="large"] {
|
|
2107
2748
|
padding: var(--measurement-medium-50);
|
|
@@ -2118,6 +2759,7 @@ var FieldShapeStyles = css8`
|
|
|
2118
2759
|
}
|
|
2119
2760
|
&[data-shape="round"] {
|
|
2120
2761
|
border-radius: var(--measurement-large-90);
|
|
2762
|
+
padding-left: var(--measurement-medium-50) !important;
|
|
2121
2763
|
}
|
|
2122
2764
|
`;
|
|
2123
2765
|
var Fieldset = styled10.fieldset`
|
|
@@ -2164,6 +2806,265 @@ var Def = styled10.dfn`
|
|
|
2164
2806
|
}
|
|
2165
2807
|
}
|
|
2166
2808
|
`;
|
|
2809
|
+
var ParentContainer = styled10.div`
|
|
2810
|
+
position: relative;
|
|
2811
|
+
display: flex;
|
|
2812
|
+
align-items: stretch;
|
|
2813
|
+
width: 100%;
|
|
2814
|
+
height: 100%;
|
|
2815
|
+
|
|
2816
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
2817
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
2818
|
+
-webkit-appearance: none;
|
|
2819
|
+
margin: 0;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
input {
|
|
2823
|
+
width: 100% !important;
|
|
2824
|
+
}
|
|
2825
|
+
input[type="number"] {
|
|
2826
|
+
appearance: textfield;
|
|
2827
|
+
-moz-appearance: textfield;
|
|
2828
|
+
}
|
|
2829
|
+
`;
|
|
2830
|
+
var ParentWrapper = styled10.div`
|
|
2831
|
+
&[data-raw="false"] {
|
|
2832
|
+
${FieldDefaultStyles}
|
|
2833
|
+
${FieldVariantsStyles}
|
|
2834
|
+
${FieldSizeStyles}
|
|
2835
|
+
${FieldShapeStyles}
|
|
2836
|
+
|
|
2837
|
+
cursor: default;
|
|
2838
|
+
display: flex;
|
|
2839
|
+
align-items: center;
|
|
2840
|
+
justify-content: start;
|
|
2841
|
+
gap: var(--measurement-small-30);
|
|
2842
|
+
width: 100% !important;
|
|
2843
|
+
text-align: left !important;
|
|
2844
|
+
|
|
2845
|
+
&[data-error="true"] {
|
|
2846
|
+
&::placeholder {
|
|
2847
|
+
color: var(--alpha-red-30);
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
&[data-wrap="true"] {
|
|
2852
|
+
flex-wrap: wrap;
|
|
2853
|
+
align-items: center;
|
|
2854
|
+
align-content: center;
|
|
2855
|
+
height: auto;
|
|
2856
|
+
padding-top: var(--measurement-small-60);
|
|
2857
|
+
padding-bottom: var(--measurement-small-60);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
`;
|
|
2861
|
+
var InnerDivider = styled10.div`
|
|
2862
|
+
height: var(--measurement-small-10);
|
|
2863
|
+
width: 100%;
|
|
2864
|
+
background-color: var(--font-color-alpha-10);
|
|
2865
|
+
`;
|
|
2866
|
+
var InnerWrapper = styled10.div`
|
|
2867
|
+
&[data-raw="false"] {
|
|
2868
|
+
position: absolute;
|
|
2869
|
+
display: flex;
|
|
2870
|
+
flex-direction: column;
|
|
2871
|
+
|
|
2872
|
+
right: 0;
|
|
2873
|
+
&[data-multiple="true"] {
|
|
2874
|
+
right: var(--measurement-small-10) !important;
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
top: var(--measurement-small-10);
|
|
2878
|
+
bottom: var(--measurement-small-10);
|
|
2879
|
+
|
|
2880
|
+
border-left: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2881
|
+
border-color: var(--font-color-alpha-10);
|
|
2882
|
+
|
|
2883
|
+
overflow: hidden;
|
|
2884
|
+
|
|
2885
|
+
&[data-error="true"] {
|
|
2886
|
+
border-color: var(--alpha-red-10) !important;
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
&[data-shape="round"] {
|
|
2890
|
+
border-radius: 0 var(--measurement-large-90) var(--measurement-large-90) 0;
|
|
2891
|
+
}
|
|
2892
|
+
&[data-shape="smooth"] {
|
|
2893
|
+
border-radius: 0 var(--measurement-medium-20) var(--measurement-medium-20)
|
|
2894
|
+
0;
|
|
2895
|
+
}
|
|
2896
|
+
&[data-shape="square"] {
|
|
2897
|
+
border-radius: 0;
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
`;
|
|
2901
|
+
var InnerTrigger = styled10.button`
|
|
2902
|
+
all: unset;
|
|
2903
|
+
|
|
2904
|
+
position: relative;
|
|
2905
|
+
display: flex;
|
|
2906
|
+
flex: 1;
|
|
2907
|
+
|
|
2908
|
+
align-items: center;
|
|
2909
|
+
justify-content: center;
|
|
2910
|
+
box-sizing: border-box;
|
|
2911
|
+
padding: 0 var(--measurement-medium-40);
|
|
2912
|
+
|
|
2913
|
+
color: var(--font-color-alpha-60);
|
|
2914
|
+
|
|
2915
|
+
background-color: var(--body-color);
|
|
2916
|
+
background: linear-gradient(
|
|
2917
|
+
180deg,
|
|
2918
|
+
transparent 50%,
|
|
2919
|
+
var(--font-color-alpha-10) 100%
|
|
2920
|
+
);
|
|
2921
|
+
background-size: 100% 200%;
|
|
2922
|
+
background-position: 0% 0%;
|
|
2923
|
+
backdrop-filter: blur(var(--measurement-medium-10));
|
|
2924
|
+
|
|
2925
|
+
cursor: pointer;
|
|
2926
|
+
transition: all ease-in-out 0.2s;
|
|
2927
|
+
|
|
2928
|
+
svg {
|
|
2929
|
+
opacity: 0.6;
|
|
2930
|
+
transition: all ease-in-out 0.2s;
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
::before {
|
|
2934
|
+
content: "";
|
|
2935
|
+
inset: 0;
|
|
2936
|
+
|
|
2937
|
+
border-radius: inherit;
|
|
2938
|
+
position: absolute;
|
|
2939
|
+
box-sizing: border-box;
|
|
2940
|
+
margin: 0;
|
|
2941
|
+
padding: 0;
|
|
2942
|
+
|
|
2943
|
+
mask-composite: intersect;
|
|
2944
|
+
|
|
2945
|
+
transition: all ease-in-out 0.2s;
|
|
2946
|
+
mask-image: linear-gradient(var(--font-color), transparent);
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
&:hover,
|
|
2950
|
+
&:active {
|
|
2951
|
+
color: var(--font-color);
|
|
2952
|
+
background-position: 0% 50%;
|
|
2953
|
+
|
|
2954
|
+
svg {
|
|
2955
|
+
opacity: 0.8;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
&:disabled {
|
|
2960
|
+
cursor: not-allowed;
|
|
2961
|
+
opacity: 0.3;
|
|
2962
|
+
}
|
|
2963
|
+
`;
|
|
2964
|
+
var InnerSegment = styled10.span`
|
|
2965
|
+
&[data-raw="false"] {
|
|
2966
|
+
border-radius: inherit;
|
|
2967
|
+
|
|
2968
|
+
text-align: center;
|
|
2969
|
+
outline: none;
|
|
2970
|
+
color: inherit;
|
|
2971
|
+
transition: background-color ease-in-out 0.2s;
|
|
2972
|
+
|
|
2973
|
+
&[data-placeholder="true"] {
|
|
2974
|
+
color: var(--font-color-alpha-30);
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
&:hover,
|
|
2978
|
+
&:focus,
|
|
2979
|
+
&:active,
|
|
2980
|
+
&:focus-within,
|
|
2981
|
+
&:has(:active) {
|
|
2982
|
+
background-color: var(--font-color-alpha-10);
|
|
2983
|
+
color: var(--font-color);
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
`;
|
|
2987
|
+
var Muted = styled10.span`
|
|
2988
|
+
&[data-raw="false"] {
|
|
2989
|
+
color: var(--font-color-alpha-30);
|
|
2990
|
+
user-select: none;
|
|
2991
|
+
}
|
|
2992
|
+
`;
|
|
2993
|
+
var HiddenInput = styled10.input`
|
|
2994
|
+
border: none;
|
|
2995
|
+
outline: none;
|
|
2996
|
+
background: transparent;
|
|
2997
|
+
flex: 1;
|
|
2998
|
+
font: inherit;
|
|
2999
|
+
color: inherit;
|
|
3000
|
+
padding: 0;
|
|
3001
|
+
min-width: var(--measurement-medium-60);
|
|
3002
|
+
`;
|
|
3003
|
+
|
|
3004
|
+
// src/field/types/index.ts
|
|
3005
|
+
var SegmentRanges = {
|
|
3006
|
+
day: { min: 1, max: () => 31 },
|
|
3007
|
+
month: { min: 1, max: () => 12 },
|
|
3008
|
+
year: { min: 1, max: () => 9999 },
|
|
3009
|
+
hour: { min: 0, max: () => 23 },
|
|
3010
|
+
minute: { min: 0, max: () => 59 }
|
|
3011
|
+
};
|
|
3012
|
+
|
|
3013
|
+
// src/field/utils/index.ts
|
|
3014
|
+
function dateToState(date) {
|
|
3015
|
+
return {
|
|
3016
|
+
day: date.getDate(),
|
|
3017
|
+
month: date.getMonth() + 1,
|
|
3018
|
+
// Normalize: Date months are 0-indexed
|
|
3019
|
+
year: date.getFullYear(),
|
|
3020
|
+
hour: date.getHours(),
|
|
3021
|
+
minute: date.getMinutes()
|
|
3022
|
+
};
|
|
3023
|
+
}
|
|
3024
|
+
function stateToDate(state) {
|
|
3025
|
+
return new Date(
|
|
3026
|
+
state.year,
|
|
3027
|
+
state.month - 1,
|
|
3028
|
+
// Normalize: Date constructor expects 0-indexed months
|
|
3029
|
+
state.day,
|
|
3030
|
+
state.hour,
|
|
3031
|
+
state.minute
|
|
3032
|
+
);
|
|
3033
|
+
}
|
|
3034
|
+
function buildSegments(state, locale, withTime) {
|
|
3035
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
3036
|
+
day: "2-digit",
|
|
3037
|
+
month: "2-digit",
|
|
3038
|
+
year: "numeric"
|
|
3039
|
+
});
|
|
3040
|
+
const timeFormatter = new Intl.DateTimeFormat(locale, {
|
|
3041
|
+
hour: "2-digit",
|
|
3042
|
+
minute: "2-digit",
|
|
3043
|
+
hour12: false
|
|
3044
|
+
});
|
|
3045
|
+
const probe = stateToDate(state);
|
|
3046
|
+
const dateParts = dateFormatter.formatToParts(probe).filter((p) => p.type !== "literal" || p.value.trim() !== "").map((p) => {
|
|
3047
|
+
if (p.type === "day") return { type: "day", value: p.value };
|
|
3048
|
+
if (p.type === "month") return { type: "month", value: p.value };
|
|
3049
|
+
if (p.type === "year") return { type: "year", value: p.value };
|
|
3050
|
+
return { type: "literal", value: p.value };
|
|
3051
|
+
});
|
|
3052
|
+
if (!withTime) return dateParts;
|
|
3053
|
+
const timeParts = timeFormatter.formatToParts(probe).filter((p) => p.type !== "literal" || p.value.trim() !== "").map((p) => {
|
|
3054
|
+
if (p.type === "hour") return { type: "hour", value: p.value };
|
|
3055
|
+
if (p.type === "minute") return { type: "minute", value: p.value };
|
|
3056
|
+
return { type: "literal", value: p.value };
|
|
3057
|
+
});
|
|
3058
|
+
return [...dateParts, { type: "literal", value: " " }, ...timeParts];
|
|
3059
|
+
}
|
|
3060
|
+
var commitState = (isControlled, next, setInternalState, onChange) => {
|
|
3061
|
+
if (!isControlled) setInternalState(next);
|
|
3062
|
+
onChange?.(stateToDate(next));
|
|
3063
|
+
};
|
|
3064
|
+
var clamp = (val, seg, internalState) => {
|
|
3065
|
+
const { min, max } = SegmentRanges[seg];
|
|
3066
|
+
return Math.min(Math.max(val, min), max(internalState));
|
|
3067
|
+
};
|
|
2167
3068
|
|
|
2168
3069
|
// src/field/index.tsx
|
|
2169
3070
|
var MetaVariantEnum = /* @__PURE__ */ ((MetaVariantEnum2) => {
|
|
@@ -2177,8 +3078,8 @@ var Field = (props) => {
|
|
|
2177
3078
|
const {
|
|
2178
3079
|
raw,
|
|
2179
3080
|
sizing = "medium" /* Medium */,
|
|
2180
|
-
variant = "
|
|
2181
|
-
shape = "smooth"
|
|
3081
|
+
variant = "secondary" /* Secondary */,
|
|
3082
|
+
shape = "smooth" /* Smooth */,
|
|
2182
3083
|
error,
|
|
2183
3084
|
hint,
|
|
2184
3085
|
...restProps
|
|
@@ -2225,33 +3126,644 @@ var FieldLabel = (props) => {
|
|
|
2225
3126
|
const { id } = useField();
|
|
2226
3127
|
return /* @__PURE__ */ React19.createElement(Label, { htmlFor: id, "data-raw": Boolean(raw), ...restProps }, children, !optional && /* @__PURE__ */ React19.createElement(Sup, null, "*"));
|
|
2227
3128
|
};
|
|
2228
|
-
FieldLabel.displayName = "Field.Label";
|
|
2229
|
-
var FieldMeta = (props) => {
|
|
3129
|
+
FieldLabel.displayName = "Field.Label";
|
|
3130
|
+
var FieldMeta = (props) => {
|
|
3131
|
+
const {
|
|
3132
|
+
raw,
|
|
3133
|
+
variant = "emphasis" /* Emphasis */,
|
|
3134
|
+
children,
|
|
3135
|
+
...restProps
|
|
3136
|
+
} = props;
|
|
3137
|
+
const metaId = React19.useId();
|
|
3138
|
+
const { id } = useField();
|
|
3139
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3140
|
+
Def,
|
|
3141
|
+
{
|
|
3142
|
+
id: metaId,
|
|
3143
|
+
"aria-details": id,
|
|
3144
|
+
"data-variant": variant,
|
|
3145
|
+
"data-raw": Boolean(raw),
|
|
3146
|
+
...restProps
|
|
3147
|
+
},
|
|
3148
|
+
children
|
|
3149
|
+
);
|
|
3150
|
+
};
|
|
3151
|
+
FieldMeta.displayName = "Field.Meta";
|
|
3152
|
+
var FieldNumber = (props) => {
|
|
3153
|
+
const {
|
|
3154
|
+
raw,
|
|
3155
|
+
sizing = "medium" /* Medium */,
|
|
3156
|
+
variant = "secondary" /* Secondary */,
|
|
3157
|
+
shape = "smooth" /* Smooth */,
|
|
3158
|
+
error,
|
|
3159
|
+
step = 1,
|
|
3160
|
+
...restProps
|
|
3161
|
+
} = props;
|
|
3162
|
+
const inputRef = React19.useRef(null);
|
|
3163
|
+
const handleStep = (direction) => {
|
|
3164
|
+
if (!inputRef.current) return;
|
|
3165
|
+
direction === "up" ? inputRef.current.stepUp() : inputRef.current.stepDown();
|
|
3166
|
+
inputRef.current.dispatchEvent(new Event("change", { bubbles: true }));
|
|
3167
|
+
};
|
|
3168
|
+
const ChevronIcon = ({ direction }) => /* @__PURE__ */ React19.createElement(
|
|
3169
|
+
"svg",
|
|
3170
|
+
{
|
|
3171
|
+
width: "8",
|
|
3172
|
+
height: "4",
|
|
3173
|
+
viewBox: "0 0 10 6",
|
|
3174
|
+
fill: "none",
|
|
3175
|
+
style: {
|
|
3176
|
+
transform: direction === "up" ? "rotate(180deg)" : "none"
|
|
3177
|
+
},
|
|
3178
|
+
"aria-hidden": "true"
|
|
3179
|
+
},
|
|
3180
|
+
/* @__PURE__ */ React19.createElement(
|
|
3181
|
+
"path",
|
|
3182
|
+
{
|
|
3183
|
+
d: "M1 1L5 5L9 1",
|
|
3184
|
+
stroke: "currentColor",
|
|
3185
|
+
strokeWidth: "1.5",
|
|
3186
|
+
strokeLinecap: "round",
|
|
3187
|
+
strokeLinejoin: "round"
|
|
3188
|
+
}
|
|
3189
|
+
)
|
|
3190
|
+
);
|
|
3191
|
+
return /* @__PURE__ */ React19.createElement(ParentContainer, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React19.createElement(
|
|
3192
|
+
Field,
|
|
3193
|
+
{
|
|
3194
|
+
ref: inputRef,
|
|
3195
|
+
type: "number",
|
|
3196
|
+
raw,
|
|
3197
|
+
sizing,
|
|
3198
|
+
variant,
|
|
3199
|
+
shape,
|
|
3200
|
+
error,
|
|
3201
|
+
step,
|
|
3202
|
+
...restProps
|
|
3203
|
+
}
|
|
3204
|
+
), /* @__PURE__ */ React19.createElement(
|
|
3205
|
+
InnerWrapper,
|
|
3206
|
+
{
|
|
3207
|
+
"data-raw": Boolean(raw),
|
|
3208
|
+
"data-error": Boolean(error),
|
|
3209
|
+
"data-variant": variant,
|
|
3210
|
+
"data-shape": shape,
|
|
3211
|
+
"data-multiple": "true"
|
|
3212
|
+
},
|
|
3213
|
+
/* @__PURE__ */ React19.createElement(
|
|
3214
|
+
InnerTrigger,
|
|
3215
|
+
{
|
|
3216
|
+
type: "button",
|
|
3217
|
+
"aria-label": "Increment",
|
|
3218
|
+
"data-raw": Boolean(raw),
|
|
3219
|
+
onClick: () => handleStep("up"),
|
|
3220
|
+
tabIndex: -1
|
|
3221
|
+
},
|
|
3222
|
+
/* @__PURE__ */ React19.createElement(ChevronIcon, { direction: "up" })
|
|
3223
|
+
),
|
|
3224
|
+
/* @__PURE__ */ React19.createElement(InnerDivider, { "data-raw": Boolean(raw) }),
|
|
3225
|
+
/* @__PURE__ */ React19.createElement(
|
|
3226
|
+
InnerTrigger,
|
|
3227
|
+
{
|
|
3228
|
+
type: "button",
|
|
3229
|
+
"aria-label": "Decrement",
|
|
3230
|
+
"data-raw": Boolean(raw),
|
|
3231
|
+
onClick: () => handleStep("down"),
|
|
3232
|
+
tabIndex: -1
|
|
3233
|
+
},
|
|
3234
|
+
/* @__PURE__ */ React19.createElement(ChevronIcon, { direction: "down" })
|
|
3235
|
+
)
|
|
3236
|
+
));
|
|
3237
|
+
};
|
|
3238
|
+
FieldNumber.displayName = "Field.Number";
|
|
3239
|
+
var FieldDate = (props) => {
|
|
3240
|
+
const {
|
|
3241
|
+
raw,
|
|
3242
|
+
sizing = "medium" /* Medium */,
|
|
3243
|
+
variant = "secondary" /* Secondary */,
|
|
3244
|
+
shape = "smooth" /* Smooth */,
|
|
3245
|
+
error,
|
|
3246
|
+
value,
|
|
3247
|
+
defaultValue,
|
|
3248
|
+
onChange,
|
|
3249
|
+
locale = typeof globalThis.navigator !== "undefined" ? globalThis.navigator.language : "en-US",
|
|
3250
|
+
withTime = false,
|
|
3251
|
+
disabled = false,
|
|
3252
|
+
id: idProp
|
|
3253
|
+
} = props;
|
|
3254
|
+
const { id: contextId } = useField();
|
|
3255
|
+
const id = idProp ?? contextId;
|
|
3256
|
+
const isControlled = value !== void 0;
|
|
3257
|
+
const metaId = React19.useId();
|
|
3258
|
+
const bufferRef = React19.useRef("");
|
|
3259
|
+
const segmentRefs = React19.useRef(/* @__PURE__ */ new Map());
|
|
3260
|
+
const [internalState, setInternalState] = React19.useState(
|
|
3261
|
+
() => dateToState(defaultValue ?? value ?? /* @__PURE__ */ new Date())
|
|
3262
|
+
);
|
|
3263
|
+
const [focusedSegment, setFocusedSegment] = React19.useState(null);
|
|
3264
|
+
const segments = buildSegments(internalState, locale, withTime);
|
|
3265
|
+
const editableSegments = segments.filter(
|
|
3266
|
+
(s) => s.type !== "literal"
|
|
3267
|
+
).map((s) => s.type);
|
|
3268
|
+
const stepSegment = (seg, delta) => {
|
|
3269
|
+
const { min, max } = SegmentRanges[seg];
|
|
3270
|
+
const current = internalState[seg];
|
|
3271
|
+
const range = max(internalState) - min + 1;
|
|
3272
|
+
const next = (current - min + delta + range) % range + min;
|
|
3273
|
+
commitState(
|
|
3274
|
+
isControlled,
|
|
3275
|
+
{ ...internalState, [seg]: next },
|
|
3276
|
+
setInternalState,
|
|
3277
|
+
onChange
|
|
3278
|
+
);
|
|
3279
|
+
};
|
|
3280
|
+
const handleSegmentKeyDown = (e, seg) => {
|
|
3281
|
+
if (disabled) return;
|
|
3282
|
+
const idx = editableSegments.indexOf(seg);
|
|
3283
|
+
switch (e.key) {
|
|
3284
|
+
case "ArrowUp": {
|
|
3285
|
+
e.preventDefault();
|
|
3286
|
+
bufferRef.current = "";
|
|
3287
|
+
stepSegment(seg, 1);
|
|
3288
|
+
break;
|
|
3289
|
+
}
|
|
3290
|
+
case "ArrowDown": {
|
|
3291
|
+
e.preventDefault();
|
|
3292
|
+
bufferRef.current = "";
|
|
3293
|
+
stepSegment(seg, -1);
|
|
3294
|
+
break;
|
|
3295
|
+
}
|
|
3296
|
+
// Move to the previous segment and reset the buffer
|
|
3297
|
+
case "ArrowLeft":
|
|
3298
|
+
case "Backspace": {
|
|
3299
|
+
e.preventDefault();
|
|
3300
|
+
bufferRef.current = "";
|
|
3301
|
+
if (idx > 0) focusSegmentByType(editableSegments[idx - 1]);
|
|
3302
|
+
break;
|
|
3303
|
+
}
|
|
3304
|
+
// ArrowRight advances manually; Tab is left to bubble for natural focus
|
|
3305
|
+
case "ArrowRight":
|
|
3306
|
+
case "Tab": {
|
|
3307
|
+
if (e.key === "ArrowRight") {
|
|
3308
|
+
e.preventDefault();
|
|
3309
|
+
bufferRef.current = "";
|
|
3310
|
+
if (idx < editableSegments.length - 1)
|
|
3311
|
+
focusSegmentByType(editableSegments[idx + 1]);
|
|
3312
|
+
}
|
|
3313
|
+
break;
|
|
3314
|
+
}
|
|
3315
|
+
default: {
|
|
3316
|
+
if (/^\d$/.test(e.key)) {
|
|
3317
|
+
e.preventDefault();
|
|
3318
|
+
bufferRef.current += e.key;
|
|
3319
|
+
const num = parseInt(bufferRef.current, 10);
|
|
3320
|
+
const { max } = SegmentRanges[seg];
|
|
3321
|
+
const maxVal = max(internalState);
|
|
3322
|
+
const clamped = clamp(num, seg, internalState);
|
|
3323
|
+
commitState(
|
|
3324
|
+
isControlled,
|
|
3325
|
+
{ ...internalState, [seg]: clamped },
|
|
3326
|
+
setInternalState,
|
|
3327
|
+
onChange
|
|
3328
|
+
);
|
|
3329
|
+
const maxDigits = String(maxVal).length;
|
|
3330
|
+
const willOverflow = parseInt(bufferRef.current + "0", 10) > maxVal || bufferRef.current.length >= maxDigits;
|
|
3331
|
+
if (willOverflow) {
|
|
3332
|
+
bufferRef.current = "";
|
|
3333
|
+
if (idx < editableSegments.length - 1)
|
|
3334
|
+
focusSegmentByType(editableSegments[idx + 1]);
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
};
|
|
3340
|
+
const focusSegmentByType = (type) => {
|
|
3341
|
+
if (!type) return;
|
|
3342
|
+
segmentRefs.current.get(type)?.focus();
|
|
3343
|
+
};
|
|
3344
|
+
const handleWrapperClick = (e) => {
|
|
3345
|
+
if (e.target.dataset.segment) return;
|
|
3346
|
+
const timeout = setTimeout(() => {
|
|
3347
|
+
focusSegmentByType(editableSegments[0]);
|
|
3348
|
+
}, 0);
|
|
3349
|
+
return () => clearTimeout(timeout);
|
|
3350
|
+
};
|
|
3351
|
+
React19.useEffect(() => {
|
|
3352
|
+
if (isControlled && value) setInternalState(dateToState(value));
|
|
3353
|
+
}, [isControlled, value]);
|
|
3354
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3355
|
+
ParentWrapper,
|
|
3356
|
+
{
|
|
3357
|
+
id,
|
|
3358
|
+
role: "group",
|
|
3359
|
+
"aria-label": "Date input",
|
|
3360
|
+
"aria-invalid": !!error,
|
|
3361
|
+
"aria-describedby": metaId,
|
|
3362
|
+
"data-error": Boolean(error),
|
|
3363
|
+
"data-variant": variant,
|
|
3364
|
+
"data-size": sizing,
|
|
3365
|
+
"data-shape": shape,
|
|
3366
|
+
"data-raw": Boolean(raw),
|
|
3367
|
+
"data-disabled": disabled,
|
|
3368
|
+
onClick: handleWrapperClick
|
|
3369
|
+
},
|
|
3370
|
+
segments.map((seg, i) => {
|
|
3371
|
+
if (seg.type === "literal") {
|
|
3372
|
+
return /* @__PURE__ */ React19.createElement(Muted, { key: i, "data-raw": Boolean(raw), "aria-hidden": "true" }, seg.value);
|
|
3373
|
+
}
|
|
3374
|
+
const isFocused = focusedSegment === seg.type;
|
|
3375
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3376
|
+
InnerSegment,
|
|
3377
|
+
{
|
|
3378
|
+
key: seg.type,
|
|
3379
|
+
ref: (el) => segmentRefs.current.set(seg.type, el),
|
|
3380
|
+
role: "spinbutton",
|
|
3381
|
+
"aria-label": seg.type,
|
|
3382
|
+
"aria-valuenow": internalState[seg.type],
|
|
3383
|
+
"aria-valuemin": SegmentRanges[seg.type].min,
|
|
3384
|
+
"aria-valuemax": SegmentRanges[seg.type].max(internalState),
|
|
3385
|
+
tabIndex: disabled ? -1 : 0,
|
|
3386
|
+
"data-raw": Boolean(raw),
|
|
3387
|
+
"data-focused": isFocused,
|
|
3388
|
+
"data-segment": seg.type,
|
|
3389
|
+
onFocus: () => {
|
|
3390
|
+
setFocusedSegment(seg.type);
|
|
3391
|
+
bufferRef.current = "";
|
|
3392
|
+
},
|
|
3393
|
+
onBlur: () => setFocusedSegment(null),
|
|
3394
|
+
onKeyDown: (e) => {
|
|
3395
|
+
if (seg.type === "literal") return;
|
|
3396
|
+
handleSegmentKeyDown(e, seg.type);
|
|
3397
|
+
}
|
|
3398
|
+
},
|
|
3399
|
+
seg.value
|
|
3400
|
+
);
|
|
3401
|
+
})
|
|
3402
|
+
);
|
|
3403
|
+
};
|
|
3404
|
+
FieldDate.displayName = "Field.Date";
|
|
3405
|
+
var FieldFile = (props) => {
|
|
3406
|
+
const {
|
|
3407
|
+
raw,
|
|
3408
|
+
sizing = "medium" /* Medium */,
|
|
3409
|
+
variant = "secondary" /* Secondary */,
|
|
3410
|
+
shape = "smooth" /* Smooth */,
|
|
3411
|
+
error,
|
|
3412
|
+
trigger,
|
|
3413
|
+
onFileChange,
|
|
3414
|
+
disabled,
|
|
3415
|
+
accept,
|
|
3416
|
+
multiple,
|
|
3417
|
+
...restProps
|
|
3418
|
+
} = props;
|
|
3419
|
+
const fileInputRef = React19.useRef(null);
|
|
3420
|
+
const [fileName, setFileName] = React19.useState("");
|
|
3421
|
+
const handleTriggerClick = () => {
|
|
3422
|
+
fileInputRef.current?.click();
|
|
3423
|
+
};
|
|
3424
|
+
const handleFileChange = (e) => {
|
|
3425
|
+
const files = e.target.files;
|
|
3426
|
+
if (files && files.length > 0) {
|
|
3427
|
+
const names = Array.from(files).map((f) => f.name).join(", ");
|
|
3428
|
+
setFileName(names);
|
|
3429
|
+
} else setFileName("");
|
|
3430
|
+
onFileChange?.(files);
|
|
3431
|
+
};
|
|
3432
|
+
const handleKeyDown = (e) => {
|
|
3433
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3434
|
+
e.preventDefault();
|
|
3435
|
+
fileInputRef.current?.click();
|
|
3436
|
+
}
|
|
3437
|
+
};
|
|
3438
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
3439
|
+
"input",
|
|
3440
|
+
{
|
|
3441
|
+
ref: fileInputRef,
|
|
3442
|
+
type: "file",
|
|
3443
|
+
"aria-hidden": "true",
|
|
3444
|
+
tabIndex: -1,
|
|
3445
|
+
disabled,
|
|
3446
|
+
accept,
|
|
3447
|
+
multiple,
|
|
3448
|
+
onChange: handleFileChange,
|
|
3449
|
+
style: { display: "none" }
|
|
3450
|
+
}
|
|
3451
|
+
), /* @__PURE__ */ React19.createElement(ParentContainer, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React19.createElement(
|
|
3452
|
+
Field,
|
|
3453
|
+
{
|
|
3454
|
+
type: "text",
|
|
3455
|
+
readOnly: true,
|
|
3456
|
+
raw,
|
|
3457
|
+
sizing,
|
|
3458
|
+
variant,
|
|
3459
|
+
shape,
|
|
3460
|
+
error,
|
|
3461
|
+
disabled,
|
|
3462
|
+
value: fileName,
|
|
3463
|
+
onClick: (e) => {
|
|
3464
|
+
handleTriggerClick();
|
|
3465
|
+
restProps.onClick?.(e);
|
|
3466
|
+
},
|
|
3467
|
+
onKeyDown: (e) => {
|
|
3468
|
+
handleKeyDown(e);
|
|
3469
|
+
restProps.onKeyDown?.(e);
|
|
3470
|
+
},
|
|
3471
|
+
...restProps
|
|
3472
|
+
}
|
|
3473
|
+
), trigger && /* @__PURE__ */ React19.createElement(
|
|
3474
|
+
InnerWrapper,
|
|
3475
|
+
{
|
|
3476
|
+
"data-raw": Boolean(raw),
|
|
3477
|
+
"data-error": Boolean(error),
|
|
3478
|
+
"data-variant": variant,
|
|
3479
|
+
"data-shape": shape
|
|
3480
|
+
},
|
|
3481
|
+
/* @__PURE__ */ React19.createElement(
|
|
3482
|
+
InnerTrigger,
|
|
3483
|
+
{
|
|
3484
|
+
type: "button",
|
|
3485
|
+
"data-raw": Boolean(raw),
|
|
3486
|
+
"data-shape": shape,
|
|
3487
|
+
"data-error": Boolean(error),
|
|
3488
|
+
disabled,
|
|
3489
|
+
variant,
|
|
3490
|
+
onClick: handleTriggerClick,
|
|
3491
|
+
"aria-label": typeof trigger === "string" ? trigger : "file-upload-trigger"
|
|
3492
|
+
},
|
|
3493
|
+
trigger
|
|
3494
|
+
)
|
|
3495
|
+
)));
|
|
3496
|
+
};
|
|
3497
|
+
FieldFile.displayName = "Field.File";
|
|
3498
|
+
var FieldPassword = (props) => {
|
|
3499
|
+
const {
|
|
3500
|
+
raw,
|
|
3501
|
+
sizing = "medium" /* Medium */,
|
|
3502
|
+
variant = "secondary" /* Secondary */,
|
|
3503
|
+
shape = "smooth" /* Smooth */,
|
|
3504
|
+
error,
|
|
3505
|
+
disabled,
|
|
3506
|
+
defaultType,
|
|
3507
|
+
...restProps
|
|
3508
|
+
} = props;
|
|
3509
|
+
const [type, setType] = React19.useState(
|
|
3510
|
+
defaultType ?? "password"
|
|
3511
|
+
);
|
|
3512
|
+
const handleChangeType = React19.useCallback(() => {
|
|
3513
|
+
if (type === "text") setType("password");
|
|
3514
|
+
if (type === "password") setType("text");
|
|
3515
|
+
}, [type, setType]);
|
|
3516
|
+
const ShowIcon = () => {
|
|
3517
|
+
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" }));
|
|
3518
|
+
};
|
|
3519
|
+
const HideIcon = () => {
|
|
3520
|
+
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" }));
|
|
3521
|
+
};
|
|
3522
|
+
return /* @__PURE__ */ React19.createElement(ParentContainer, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React19.createElement(
|
|
3523
|
+
Field,
|
|
3524
|
+
{
|
|
3525
|
+
autoComplete: "off",
|
|
3526
|
+
type,
|
|
3527
|
+
raw,
|
|
3528
|
+
sizing,
|
|
3529
|
+
variant,
|
|
3530
|
+
shape,
|
|
3531
|
+
error,
|
|
3532
|
+
disabled,
|
|
3533
|
+
...restProps
|
|
3534
|
+
}
|
|
3535
|
+
), /* @__PURE__ */ React19.createElement(
|
|
3536
|
+
InnerWrapper,
|
|
3537
|
+
{
|
|
3538
|
+
"data-raw": Boolean(raw),
|
|
3539
|
+
"data-error": Boolean(error),
|
|
3540
|
+
"data-variant": variant,
|
|
3541
|
+
"data-shape": shape
|
|
3542
|
+
},
|
|
3543
|
+
/* @__PURE__ */ React19.createElement(
|
|
3544
|
+
InnerTrigger,
|
|
3545
|
+
{
|
|
3546
|
+
type: "button",
|
|
3547
|
+
"data-raw": Boolean(raw),
|
|
3548
|
+
"data-shape": shape,
|
|
3549
|
+
"data-error": Boolean(error),
|
|
3550
|
+
disabled,
|
|
3551
|
+
variant,
|
|
3552
|
+
onClick: handleChangeType,
|
|
3553
|
+
"aria-label": "password-field-trigger"
|
|
3554
|
+
},
|
|
3555
|
+
/* @__PURE__ */ React19.createElement(
|
|
3556
|
+
"svg",
|
|
3557
|
+
{
|
|
3558
|
+
viewBox: "0 0 24 24",
|
|
3559
|
+
width: "var(--fontsize-medium-10)",
|
|
3560
|
+
height: "var(--fontsize-medium-10)",
|
|
3561
|
+
stroke: "currentColor",
|
|
3562
|
+
"stroke-width": "2",
|
|
3563
|
+
fill: "none",
|
|
3564
|
+
"stroke-linecap": "round",
|
|
3565
|
+
"stroke-linejoin": "round",
|
|
3566
|
+
"aria-hidden": "true"
|
|
3567
|
+
},
|
|
3568
|
+
type === "password" ? /* @__PURE__ */ React19.createElement(ShowIcon, null) : /* @__PURE__ */ React19.createElement(HideIcon, null)
|
|
3569
|
+
)
|
|
3570
|
+
)
|
|
3571
|
+
));
|
|
3572
|
+
};
|
|
3573
|
+
FieldPassword.displayName = "Field.Password";
|
|
3574
|
+
var FieldTag = (props) => {
|
|
2230
3575
|
const {
|
|
2231
3576
|
raw,
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
3577
|
+
sizing = "medium" /* Medium */,
|
|
3578
|
+
variant = "secondary" /* Secondary */,
|
|
3579
|
+
shape = "smooth" /* Smooth */,
|
|
3580
|
+
error,
|
|
3581
|
+
value,
|
|
3582
|
+
defaultValue,
|
|
3583
|
+
allowed,
|
|
3584
|
+
onChange,
|
|
3585
|
+
disabled = false,
|
|
3586
|
+
placeholder,
|
|
3587
|
+
id: idProp
|
|
2235
3588
|
} = props;
|
|
3589
|
+
const { id: contextId } = useField();
|
|
3590
|
+
const id = idProp ?? contextId;
|
|
2236
3591
|
const metaId = React19.useId();
|
|
2237
|
-
const
|
|
3592
|
+
const isControlled = value !== void 0;
|
|
3593
|
+
const [internalTags, setInternalTags] = React19.useState(
|
|
3594
|
+
defaultValue ?? []
|
|
3595
|
+
);
|
|
3596
|
+
const [inputValue, setInputValue] = React19.useState("");
|
|
3597
|
+
const [focusedTagIndex, setFocusedTagIndex] = React19.useState(
|
|
3598
|
+
null
|
|
3599
|
+
);
|
|
3600
|
+
const inputRef = React19.useRef(null);
|
|
3601
|
+
const tagRefs = React19.useRef(/* @__PURE__ */ new Map());
|
|
3602
|
+
const tags = isControlled ? value : internalTags;
|
|
3603
|
+
const commitTags = React19.useCallback(
|
|
3604
|
+
(next) => {
|
|
3605
|
+
if (!isControlled) setInternalTags(next);
|
|
3606
|
+
onChange?.(next);
|
|
3607
|
+
},
|
|
3608
|
+
[isControlled, onChange]
|
|
3609
|
+
);
|
|
3610
|
+
const addTag = React19.useCallback(
|
|
3611
|
+
(label) => {
|
|
3612
|
+
const trimmed = label.trim();
|
|
3613
|
+
if (!trimmed) return;
|
|
3614
|
+
if (tags.some((t) => t.toLowerCase() === trimmed.toLowerCase())) {
|
|
3615
|
+
return;
|
|
3616
|
+
}
|
|
3617
|
+
if (!allowed?.some((a) => a.toLowerCase() === trimmed.toLowerCase())) {
|
|
3618
|
+
return;
|
|
3619
|
+
}
|
|
3620
|
+
commitTags([...tags, trimmed]);
|
|
3621
|
+
setInputValue("");
|
|
3622
|
+
},
|
|
3623
|
+
[tags, commitTags, allowed]
|
|
3624
|
+
);
|
|
3625
|
+
const removeTag = React19.useCallback(
|
|
3626
|
+
(index) => {
|
|
3627
|
+
const next = tags.filter((_, i) => i !== index);
|
|
3628
|
+
commitTags(next);
|
|
3629
|
+
setFocusedTagIndex(null);
|
|
3630
|
+
inputRef.current?.focus();
|
|
3631
|
+
},
|
|
3632
|
+
[tags, commitTags]
|
|
3633
|
+
);
|
|
3634
|
+
const handleInputKeyDown = (e) => {
|
|
3635
|
+
if (disabled) return;
|
|
3636
|
+
if (e.key === "Enter") {
|
|
3637
|
+
e.preventDefault();
|
|
3638
|
+
addTag(inputValue);
|
|
3639
|
+
return;
|
|
3640
|
+
}
|
|
3641
|
+
if ((e.key === "Backspace" || e.key === "Delete") && inputValue === "" && tags.length > 0) {
|
|
3642
|
+
e.preventDefault();
|
|
3643
|
+
const lastIndex = tags.length - 1;
|
|
3644
|
+
setFocusedTagIndex(lastIndex);
|
|
3645
|
+
tagRefs.current.get(lastIndex)?.focus();
|
|
3646
|
+
}
|
|
3647
|
+
};
|
|
3648
|
+
const handleTagKeyDown = (e, index) => {
|
|
3649
|
+
if (disabled) return;
|
|
3650
|
+
switch (e.key) {
|
|
3651
|
+
case "Backspace":
|
|
3652
|
+
case "Delete": {
|
|
3653
|
+
e.preventDefault();
|
|
3654
|
+
removeTag(index);
|
|
3655
|
+
break;
|
|
3656
|
+
}
|
|
3657
|
+
case "ArrowLeft": {
|
|
3658
|
+
e.preventDefault();
|
|
3659
|
+
if (index > 0) {
|
|
3660
|
+
const prev = index - 1;
|
|
3661
|
+
setFocusedTagIndex(prev);
|
|
3662
|
+
tagRefs.current.get(prev)?.focus();
|
|
3663
|
+
}
|
|
3664
|
+
break;
|
|
3665
|
+
}
|
|
3666
|
+
case "ArrowRight": {
|
|
3667
|
+
e.preventDefault();
|
|
3668
|
+
if (index < tags.length - 1) {
|
|
3669
|
+
const next = index + 1;
|
|
3670
|
+
setFocusedTagIndex(next);
|
|
3671
|
+
tagRefs.current.get(next)?.focus();
|
|
3672
|
+
} else {
|
|
3673
|
+
setFocusedTagIndex(null);
|
|
3674
|
+
inputRef.current?.focus();
|
|
3675
|
+
}
|
|
3676
|
+
break;
|
|
3677
|
+
}
|
|
3678
|
+
case "Escape": {
|
|
3679
|
+
e.preventDefault();
|
|
3680
|
+
setFocusedTagIndex(null);
|
|
3681
|
+
inputRef.current?.focus();
|
|
3682
|
+
break;
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
};
|
|
3686
|
+
const handleWrapperClick = (e) => {
|
|
3687
|
+
const target = e.target;
|
|
3688
|
+
if (!target.closest("[data-tag]")) {
|
|
3689
|
+
inputRef.current?.focus();
|
|
3690
|
+
}
|
|
3691
|
+
};
|
|
3692
|
+
React19.useEffect(() => {
|
|
3693
|
+
if (isControlled && value) setInternalTags(value);
|
|
3694
|
+
}, [isControlled, value]);
|
|
2238
3695
|
return /* @__PURE__ */ React19.createElement(
|
|
2239
|
-
|
|
3696
|
+
ParentWrapper,
|
|
2240
3697
|
{
|
|
2241
|
-
id
|
|
2242
|
-
"
|
|
3698
|
+
id,
|
|
3699
|
+
role: "group",
|
|
3700
|
+
"aria-invalid": !!error,
|
|
3701
|
+
"aria-describedby": metaId,
|
|
3702
|
+
"data-error": Boolean(error),
|
|
2243
3703
|
"data-variant": variant,
|
|
3704
|
+
"data-size": sizing,
|
|
3705
|
+
"data-shape": shape,
|
|
2244
3706
|
"data-raw": Boolean(raw),
|
|
2245
|
-
|
|
3707
|
+
"data-disabled": disabled,
|
|
3708
|
+
"data-wrap": "true",
|
|
3709
|
+
onClick: handleWrapperClick
|
|
2246
3710
|
},
|
|
2247
|
-
|
|
3711
|
+
tags.map((tag, index) => /* @__PURE__ */ React19.createElement(
|
|
3712
|
+
InnerSegment,
|
|
3713
|
+
{
|
|
3714
|
+
key: `${tag}-${index}`,
|
|
3715
|
+
ref: (el) => tagRefs.current.set(index, el),
|
|
3716
|
+
role: "option",
|
|
3717
|
+
"aria-label": tag,
|
|
3718
|
+
"aria-selected": focusedTagIndex === index,
|
|
3719
|
+
tabIndex: disabled ? -1 : -1,
|
|
3720
|
+
"data-raw": Boolean(raw),
|
|
3721
|
+
"data-focused": focusedTagIndex === index,
|
|
3722
|
+
"data-tag": "true",
|
|
3723
|
+
onFocus: () => setFocusedTagIndex(index),
|
|
3724
|
+
onBlur: () => setFocusedTagIndex(null),
|
|
3725
|
+
onKeyDown: (e) => handleTagKeyDown(e, index)
|
|
3726
|
+
},
|
|
3727
|
+
/* @__PURE__ */ React19.createElement(Badge, { sizing: "small", variant: "border" }, tag, !disabled && /* @__PURE__ */ React19.createElement(
|
|
3728
|
+
Button,
|
|
3729
|
+
{
|
|
3730
|
+
variant: "ghost",
|
|
3731
|
+
sizing: "small",
|
|
3732
|
+
"aria-label": `Remove ${tag}`,
|
|
3733
|
+
"data-tag": "true",
|
|
3734
|
+
className: "m-l-small-60 ",
|
|
3735
|
+
onClick: (e) => {
|
|
3736
|
+
e.stopPropagation();
|
|
3737
|
+
removeTag(index);
|
|
3738
|
+
}
|
|
3739
|
+
},
|
|
3740
|
+
"\xD7"
|
|
3741
|
+
))
|
|
3742
|
+
)),
|
|
3743
|
+
/* @__PURE__ */ React19.createElement(
|
|
3744
|
+
HiddenInput,
|
|
3745
|
+
{
|
|
3746
|
+
ref: inputRef,
|
|
3747
|
+
type: "text",
|
|
3748
|
+
value: inputValue,
|
|
3749
|
+
disabled,
|
|
3750
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
3751
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
3752
|
+
onKeyDown: handleInputKeyDown
|
|
3753
|
+
}
|
|
3754
|
+
)
|
|
2248
3755
|
);
|
|
2249
3756
|
};
|
|
2250
|
-
|
|
3757
|
+
FieldTag.displayName = "Field.Tag";
|
|
2251
3758
|
Field.Root = FieldRoot;
|
|
2252
3759
|
Field.Wrapper = FieldWrapper;
|
|
2253
3760
|
Field.Label = FieldLabel;
|
|
2254
3761
|
Field.Meta = FieldMeta;
|
|
3762
|
+
Field.Number = FieldNumber;
|
|
3763
|
+
Field.Date = FieldDate;
|
|
3764
|
+
Field.File = FieldFile;
|
|
3765
|
+
Field.Password = FieldPassword;
|
|
3766
|
+
Field.Tag = FieldTag;
|
|
2255
3767
|
|
|
2256
3768
|
// src/message-bubble/index.tsx
|
|
2257
3769
|
import React21 from "react";
|
|
@@ -2306,26 +3818,23 @@ var MessageBubbleBadge = styled11(Badge)`
|
|
|
2306
3818
|
width: 100%;
|
|
2307
3819
|
justify-self: flex-end;
|
|
2308
3820
|
padding: var(--measurement-medium-30) var(--measurement-medium-50) !important;
|
|
2309
|
-
border-radius: var(--measurement-medium-60) !important;
|
|
2310
3821
|
|
|
2311
3822
|
&[data-side="left"] {
|
|
2312
|
-
|
|
2313
|
-
border-bottom-left-radius: 0 !important;
|
|
3823
|
+
border-top-left-radius: 0 !important;
|
|
2314
3824
|
}
|
|
2315
3825
|
|
|
2316
3826
|
&[data-side="right"] {
|
|
2317
|
-
|
|
2318
|
-
border-bottom-right-radius: 0 !important;
|
|
3827
|
+
border-top-right-radius: 0 !important;
|
|
2319
3828
|
}
|
|
2320
3829
|
`;
|
|
2321
3830
|
var MessageBubbleContentWrapper = styled11.div`
|
|
2322
|
-
line-height: 1.
|
|
3831
|
+
line-height: 1.3;
|
|
2323
3832
|
font-weight: 500;
|
|
2324
3833
|
word-break: keep-all;
|
|
2325
3834
|
width: 100%;
|
|
2326
3835
|
|
|
2327
3836
|
* {
|
|
2328
|
-
font-size:
|
|
3837
|
+
font-size: inherit !important;
|
|
2329
3838
|
}
|
|
2330
3839
|
`;
|
|
2331
3840
|
var MessageBubbleMetaWrapper = styled11.div`
|
|
@@ -2367,14 +3876,16 @@ var MessageBubble = (props) => {
|
|
|
2367
3876
|
};
|
|
2368
3877
|
MessageBubble.displayName = "MessageBubble";
|
|
2369
3878
|
var MessageBubbleContent = (props) => {
|
|
2370
|
-
const { children, raw, ...restProps } = props;
|
|
3879
|
+
const { sizing, shape, variant, children, raw, ...restProps } = props;
|
|
2371
3880
|
const { id, states } = useMessageBubble();
|
|
2372
3881
|
return /* @__PURE__ */ React21.createElement(
|
|
2373
3882
|
MessageBubbleBadge,
|
|
2374
3883
|
{
|
|
2375
|
-
variant: "secondary",
|
|
2376
3884
|
"data-raw": Boolean(raw),
|
|
2377
3885
|
"data-side": states?.side,
|
|
3886
|
+
variant: variant ?? "border" /* Border */,
|
|
3887
|
+
shape: shape ?? "smooth" /* Smooth */,
|
|
3888
|
+
sizing: sizing ?? "medium" /* Medium */,
|
|
2378
3889
|
"aria-label": `message-bubble-content-${id}`,
|
|
2379
3890
|
...restProps
|
|
2380
3891
|
},
|
|
@@ -2395,6 +3906,7 @@ var MessageBubbleMeta = (props) => {
|
|
|
2395
3906
|
"data-raw": Boolean(raw),
|
|
2396
3907
|
"data-side": states?.side,
|
|
2397
3908
|
"aria-label": `message-bubble-meta-${states?.side}`,
|
|
3909
|
+
className: "fs-small-60 opacity-default-60",
|
|
2398
3910
|
...restProps
|
|
2399
3911
|
},
|
|
2400
3912
|
formattedDate
|
|
@@ -2420,36 +3932,132 @@ var useOTPField = () => {
|
|
|
2420
3932
|
};
|
|
2421
3933
|
|
|
2422
3934
|
// src/otp-field/styles/index.ts
|
|
2423
|
-
import styled12 from "styled-components";
|
|
2424
|
-
var
|
|
3935
|
+
import styled12, { css as css9 } from "styled-components";
|
|
3936
|
+
var OTPShapeStyles = css9`
|
|
3937
|
+
&[data-shape="square"] {
|
|
3938
|
+
border-radius: 0;
|
|
3939
|
+
}
|
|
3940
|
+
&[data-shape="smooth"] {
|
|
3941
|
+
border-radius: var(--measurement-medium-20);
|
|
3942
|
+
}
|
|
3943
|
+
&[data-shape="round"] {
|
|
3944
|
+
border-radius: var(--measurement-large-90);
|
|
3945
|
+
padding-left: var(--measurement-medium-50) !important;
|
|
3946
|
+
}
|
|
3947
|
+
`;
|
|
3948
|
+
var OTPCellDefaultStyles = css9`
|
|
3949
|
+
outline: none;
|
|
3950
|
+
cursor: text;
|
|
3951
|
+
display: flex;
|
|
3952
|
+
align-items: center;
|
|
3953
|
+
justify-content: center;
|
|
3954
|
+
text-align: center;
|
|
3955
|
+
box-sizing: border-box;
|
|
3956
|
+
|
|
3957
|
+
font-size: var(--fontsize-medium-20);
|
|
3958
|
+
|
|
3959
|
+
padding: 0 var(--measurement-medium-30);
|
|
2425
3960
|
width: var(--measurement-medium-90);
|
|
2426
3961
|
height: var(--measurement-medium-90);
|
|
2427
|
-
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2428
3962
|
|
|
2429
|
-
|
|
3963
|
+
line-height: 1;
|
|
3964
|
+
letter-spacing: calc(
|
|
3965
|
+
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
3966
|
+
);
|
|
3967
|
+
|
|
3968
|
+
border: var(--measurement-small-10) solid transparent;
|
|
3969
|
+
|
|
2430
3970
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
3971
|
+
color: var(--font-color-alpha-60);
|
|
2431
3972
|
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
3973
|
+
transition: all ease-in-out 0.2s;
|
|
3974
|
+
|
|
3975
|
+
svg,
|
|
3976
|
+
span,
|
|
3977
|
+
img {
|
|
3978
|
+
opacity: 0.6;
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
&:hover,
|
|
3982
|
+
&:focus,
|
|
3983
|
+
&:active,
|
|
3984
|
+
&:focus-within,
|
|
3985
|
+
&:has(:active) {
|
|
3986
|
+
color: var(--font-color);
|
|
3987
|
+
svg,
|
|
3988
|
+
span,
|
|
3989
|
+
img {
|
|
3990
|
+
opacity: 1;
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
|
|
3994
|
+
&::placeholder {
|
|
3995
|
+
color: var(--font-color-alpha-30);
|
|
3996
|
+
}
|
|
2435
3997
|
|
|
2436
|
-
|
|
2437
|
-
|
|
3998
|
+
&:disabled,
|
|
3999
|
+
&:has(:disabled) {
|
|
4000
|
+
cursor: not-allowed;
|
|
4001
|
+
opacity: 0.6;
|
|
4002
|
+
}
|
|
2438
4003
|
|
|
2439
4004
|
background-color: transparent;
|
|
2440
|
-
|
|
2441
|
-
outline: none;
|
|
4005
|
+
border-color: var(--font-color-alpha-10);
|
|
2442
4006
|
|
|
2443
|
-
&:
|
|
2444
|
-
|
|
4007
|
+
&:hover,
|
|
4008
|
+
&:focus,
|
|
4009
|
+
&:active,
|
|
4010
|
+
&:focus-within,
|
|
4011
|
+
&:has(:hover),
|
|
4012
|
+
&:has(:active) {
|
|
4013
|
+
border-color: var(--font-color-alpha-20);
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
&:focus,
|
|
4017
|
+
&:active,
|
|
4018
|
+
&:focus-within,
|
|
4019
|
+
&:has(:active) {
|
|
4020
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-accent-30);
|
|
2445
4021
|
}
|
|
2446
4022
|
|
|
2447
|
-
|
|
4023
|
+
background-color: transparent;
|
|
4024
|
+
border-color: var(--font-color-alpha-10);
|
|
4025
|
+
|
|
4026
|
+
&:hover,
|
|
4027
|
+
&:focus,
|
|
4028
|
+
&:active,
|
|
4029
|
+
&:focus-within,
|
|
4030
|
+
&:has(:hover),
|
|
4031
|
+
&:has(:active) {
|
|
2448
4032
|
border-color: var(--font-color-alpha-20);
|
|
2449
4033
|
}
|
|
2450
4034
|
|
|
2451
|
-
|
|
2452
|
-
|
|
4035
|
+
&:focus,
|
|
4036
|
+
&:active,
|
|
4037
|
+
&:focus-within,
|
|
4038
|
+
&:has(:active) {
|
|
4039
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
&[data-error="true"] {
|
|
4043
|
+
color: var(--color-red);
|
|
4044
|
+
border-color: var(--alpha-red-10);
|
|
4045
|
+
|
|
4046
|
+
&:hover,
|
|
4047
|
+
&:focus,
|
|
4048
|
+
&:active,
|
|
4049
|
+
&:focus-within,
|
|
4050
|
+
&:has(:hover),
|
|
4051
|
+
&:has(:active) {
|
|
4052
|
+
background-color: var(--alpha-red-10);
|
|
4053
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
`;
|
|
4057
|
+
var OTPCell = styled12.input`
|
|
4058
|
+
&[data-raw="false"] {
|
|
4059
|
+
${OTPCellDefaultStyles}
|
|
4060
|
+
${OTPShapeStyles}
|
|
2453
4061
|
}
|
|
2454
4062
|
`;
|
|
2455
4063
|
|
|
@@ -2559,6 +4167,8 @@ var OTPFieldGroup = React23.forwardRef(({ ...props }, ref) => {
|
|
|
2559
4167
|
OTPFieldGroup.displayName = "OTPField.Group";
|
|
2560
4168
|
var OTPFieldSlot = ({
|
|
2561
4169
|
index,
|
|
4170
|
+
shape,
|
|
4171
|
+
raw,
|
|
2562
4172
|
...props
|
|
2563
4173
|
}) => {
|
|
2564
4174
|
const context = useOTPField();
|
|
@@ -2582,6 +4192,8 @@ var OTPFieldSlot = ({
|
|
|
2582
4192
|
type: "text",
|
|
2583
4193
|
"data-testid": "otp-field-slot",
|
|
2584
4194
|
"data-active": activeIndex === index,
|
|
4195
|
+
"data-shape": shape ?? "smooth" /* Smooth */,
|
|
4196
|
+
"data-raw": Boolean(raw),
|
|
2585
4197
|
autoComplete: "one-time-code",
|
|
2586
4198
|
maxLength: 1,
|
|
2587
4199
|
value: otp[index] || "",
|
|
@@ -2624,6 +4236,7 @@ var OverlayWrapper = styled13.div`
|
|
|
2624
4236
|
|
|
2625
4237
|
&[data-raw="false"] {
|
|
2626
4238
|
background-color: rgba(0, 0, 0, 0.6); // Always forced to black
|
|
4239
|
+
|
|
2627
4240
|
animation-duration: 0.2s;
|
|
2628
4241
|
animation-name: animate-fade;
|
|
2629
4242
|
animation-fill-mode: backwards;
|
|
@@ -2661,8 +4274,8 @@ import React25 from "react";
|
|
|
2661
4274
|
import styled15 from "styled-components";
|
|
2662
4275
|
|
|
2663
4276
|
// src/scrollarea/styles/index.ts
|
|
2664
|
-
import styled14, { css as
|
|
2665
|
-
var HiddenScrollbar =
|
|
4277
|
+
import styled14, { css as css10 } from "styled-components";
|
|
4278
|
+
var HiddenScrollbar = css10`
|
|
2666
4279
|
scrollbar-width: none;
|
|
2667
4280
|
|
|
2668
4281
|
&::-webkit-scrollbar {
|
|
@@ -2674,7 +4287,7 @@ var HiddenScrollbar = css9`
|
|
|
2674
4287
|
display: none;
|
|
2675
4288
|
}
|
|
2676
4289
|
`;
|
|
2677
|
-
var CustomScrollbar =
|
|
4290
|
+
var CustomScrollbar = css10`
|
|
2678
4291
|
height: ${({ $height }) => $height || "100%"};
|
|
2679
4292
|
width: ${({ $width }) => $width || "100%"};
|
|
2680
4293
|
overflow-y: auto;
|
|
@@ -2916,55 +4529,19 @@ var Portal = (props) => {
|
|
|
2916
4529
|
};
|
|
2917
4530
|
Portal.displayName = "Portal";
|
|
2918
4531
|
|
|
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
4532
|
// src/resizable/index.tsx
|
|
2956
|
-
import
|
|
4533
|
+
import React27 from "react";
|
|
2957
4534
|
|
|
2958
4535
|
// src/resizable/styles/index.ts
|
|
2959
|
-
import
|
|
2960
|
-
var SplitContainer =
|
|
4536
|
+
import styled16 from "styled-components";
|
|
4537
|
+
var SplitContainer = styled16.div`
|
|
2961
4538
|
position: relative;
|
|
2962
4539
|
`;
|
|
2963
|
-
var Panel =
|
|
4540
|
+
var Panel = styled16.div`
|
|
2964
4541
|
overflow: hidden;
|
|
2965
4542
|
width: ${(props) => props.width}%;
|
|
2966
4543
|
`;
|
|
2967
|
-
var Divider2 =
|
|
4544
|
+
var Divider2 = styled16.div`
|
|
2968
4545
|
width: var(--measurement-medium-10);
|
|
2969
4546
|
height: 100%;
|
|
2970
4547
|
top: 0;
|
|
@@ -2988,14 +4565,14 @@ var Divider2 = styled17.div`
|
|
|
2988
4565
|
height: ${(props) => props.$dragging ? "var(--measurement-large-10)" : "var(--measurement-medium-60)"};
|
|
2989
4566
|
}
|
|
2990
4567
|
`;
|
|
2991
|
-
var DragHandle =
|
|
4568
|
+
var DragHandle = styled16.div`
|
|
2992
4569
|
position: absolute;
|
|
2993
4570
|
top: 0;
|
|
2994
4571
|
bottom: 0;
|
|
2995
4572
|
left: calc(var(--measurement-medium-10) * -1);
|
|
2996
4573
|
right: calc(var(--measurement-medium-10) * -1);
|
|
2997
4574
|
`;
|
|
2998
|
-
var DragIndicator =
|
|
4575
|
+
var DragIndicator = styled16.div`
|
|
2999
4576
|
position: fixed;
|
|
3000
4577
|
width: var(--measurement-medium-10);
|
|
3001
4578
|
/* height: var(--measurement-medium-60); */
|
|
@@ -3005,7 +4582,7 @@ var DragIndicator = styled17.div`
|
|
|
3005
4582
|
opacity: 0;
|
|
3006
4583
|
transition: all 0.2s;
|
|
3007
4584
|
`;
|
|
3008
|
-
var DragOverlay =
|
|
4585
|
+
var DragOverlay = styled16.div`
|
|
3009
4586
|
position: fixed;
|
|
3010
4587
|
top: 0;
|
|
3011
4588
|
left: 0;
|
|
@@ -3021,12 +4598,12 @@ var Resizable = ({
|
|
|
3021
4598
|
left,
|
|
3022
4599
|
right
|
|
3023
4600
|
}) => {
|
|
3024
|
-
const containerRef =
|
|
3025
|
-
const [leftWidth, setLeftWidth] =
|
|
3026
|
-
const [isDragging, setIsDragging] =
|
|
3027
|
-
const handleMouseDown =
|
|
3028
|
-
const handleMouseUp =
|
|
3029
|
-
const handleMouseMove =
|
|
4601
|
+
const containerRef = React27.useRef(null);
|
|
4602
|
+
const [leftWidth, setLeftWidth] = React27.useState(defaultWidth ?? 50);
|
|
4603
|
+
const [isDragging, setIsDragging] = React27.useState(false);
|
|
4604
|
+
const handleMouseDown = React27.useCallback(() => setIsDragging(true), []);
|
|
4605
|
+
const handleMouseUp = React27.useCallback(() => setIsDragging(false), []);
|
|
4606
|
+
const handleMouseMove = React27.useCallback(
|
|
3030
4607
|
(e) => {
|
|
3031
4608
|
if (!isDragging || !containerRef.current) return;
|
|
3032
4609
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
@@ -3040,7 +4617,7 @@ var Resizable = ({
|
|
|
3040
4617
|
},
|
|
3041
4618
|
[isDragging]
|
|
3042
4619
|
);
|
|
3043
|
-
|
|
4620
|
+
React27.useEffect(() => {
|
|
3044
4621
|
if (isDragging) {
|
|
3045
4622
|
document.addEventListener("mousemove", handleMouseMove);
|
|
3046
4623
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -3059,47 +4636,47 @@ var Resizable = ({
|
|
|
3059
4636
|
document.body.style.userSelect = "";
|
|
3060
4637
|
};
|
|
3061
4638
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
3062
|
-
return /* @__PURE__ */
|
|
4639
|
+
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
4640
|
Divider2,
|
|
3064
4641
|
{
|
|
3065
4642
|
$dragging: isDragging,
|
|
3066
4643
|
onMouseDown: handleMouseDown,
|
|
3067
4644
|
onTouchStart: handleMouseDown
|
|
3068
4645
|
},
|
|
3069
|
-
/* @__PURE__ */
|
|
4646
|
+
/* @__PURE__ */ React27.createElement(
|
|
3070
4647
|
DragHandle,
|
|
3071
4648
|
{
|
|
3072
4649
|
className: "flex align-center justify-center",
|
|
3073
4650
|
id: "drag-handle"
|
|
3074
4651
|
},
|
|
3075
|
-
/* @__PURE__ */
|
|
4652
|
+
/* @__PURE__ */ React27.createElement(DragIndicator, { className: "drag-indicator-handle" })
|
|
3076
4653
|
)
|
|
3077
|
-
), /* @__PURE__ */
|
|
4654
|
+
), /* @__PURE__ */ React27.createElement(Panel, { width: 100 - leftWidth }, right)), isDragging && /* @__PURE__ */ React27.createElement(DragOverlay, null));
|
|
3078
4655
|
};
|
|
3079
4656
|
Resizable.displayName = "Resizable";
|
|
3080
4657
|
|
|
3081
4658
|
// src/sheet/index.tsx
|
|
3082
|
-
import
|
|
4659
|
+
import React29 from "react";
|
|
3083
4660
|
|
|
3084
4661
|
// src/sheet/hooks/index.tsx
|
|
3085
|
-
import
|
|
3086
|
-
var SheetContext =
|
|
4662
|
+
import React28 from "react";
|
|
4663
|
+
var SheetContext = React28.createContext({
|
|
3087
4664
|
id: {},
|
|
3088
4665
|
states: {},
|
|
3089
4666
|
methods: {}
|
|
3090
4667
|
});
|
|
3091
|
-
var useSheet = () =>
|
|
4668
|
+
var useSheet = () => React28.useContext(SheetContext);
|
|
3092
4669
|
var SheetProvider = ({
|
|
3093
4670
|
children
|
|
3094
4671
|
}) => {
|
|
3095
4672
|
const context = useSheetProvider();
|
|
3096
|
-
return /* @__PURE__ */
|
|
4673
|
+
return /* @__PURE__ */ React28.createElement(SheetContext.Provider, { value: context }, children);
|
|
3097
4674
|
};
|
|
3098
4675
|
function useSheetProvider() {
|
|
3099
|
-
const containerId =
|
|
3100
|
-
const triggerId =
|
|
3101
|
-
const controlId =
|
|
3102
|
-
const [open, setOpen] =
|
|
4676
|
+
const containerId = React28.useId();
|
|
4677
|
+
const triggerId = React28.useId();
|
|
4678
|
+
const controlId = React28.useId();
|
|
4679
|
+
const [open, setOpen] = React28.useState(false);
|
|
3103
4680
|
return {
|
|
3104
4681
|
id: {
|
|
3105
4682
|
containerId,
|
|
@@ -3117,8 +4694,8 @@ function useSheetProvider() {
|
|
|
3117
4694
|
}
|
|
3118
4695
|
|
|
3119
4696
|
// src/sheet/styles/index.ts
|
|
3120
|
-
import
|
|
3121
|
-
var SheetStyles =
|
|
4697
|
+
import styled17, { css as css11 } from "styled-components";
|
|
4698
|
+
var SheetStyles = css11`
|
|
3122
4699
|
all: unset;
|
|
3123
4700
|
position: fixed;
|
|
3124
4701
|
background-color: var(--body-color);
|
|
@@ -3149,7 +4726,7 @@ var SheetStyles = css10`
|
|
|
3149
4726
|
animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
|
|
3150
4727
|
animation-fill-mode: backwards;
|
|
3151
4728
|
`;
|
|
3152
|
-
var SheetSizeStyles =
|
|
4729
|
+
var SheetSizeStyles = css11`
|
|
3153
4730
|
&[data-size="small"] {
|
|
3154
4731
|
width: var(--measurement-large-80);
|
|
3155
4732
|
}
|
|
@@ -3162,7 +4739,7 @@ var SheetSizeStyles = css10`
|
|
|
3162
4739
|
width: calc(var(--measurement-large-90) * 1.5);
|
|
3163
4740
|
}
|
|
3164
4741
|
`;
|
|
3165
|
-
var SheetSideStyles =
|
|
4742
|
+
var SheetSideStyles = css11`
|
|
3166
4743
|
top: 0;
|
|
3167
4744
|
|
|
3168
4745
|
&[data-side="right"] {
|
|
@@ -3177,7 +4754,7 @@ var SheetSideStyles = css10`
|
|
|
3177
4754
|
animation-name: slide-left;
|
|
3178
4755
|
}
|
|
3179
4756
|
`;
|
|
3180
|
-
var SheetWrapper =
|
|
4757
|
+
var SheetWrapper = styled17.dialog`
|
|
3181
4758
|
&[data-raw="false"] {
|
|
3182
4759
|
${SheetStyles}
|
|
3183
4760
|
${SheetSideStyles}
|
|
@@ -3187,7 +4764,7 @@ var SheetWrapper = styled18.dialog`
|
|
|
3187
4764
|
|
|
3188
4765
|
// src/sheet/index.tsx
|
|
3189
4766
|
var SheetRoot = ({ children }) => {
|
|
3190
|
-
return /* @__PURE__ */
|
|
4767
|
+
return /* @__PURE__ */ React29.createElement(SheetProvider, null, children);
|
|
3191
4768
|
};
|
|
3192
4769
|
SheetRoot.displayName = "Sheet.Root";
|
|
3193
4770
|
var Sheet = (props) => {
|
|
@@ -3208,16 +4785,16 @@ var Sheet = (props) => {
|
|
|
3208
4785
|
const { id, states, methods } = useSheet();
|
|
3209
4786
|
const { toggle } = methods;
|
|
3210
4787
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
3211
|
-
|
|
4788
|
+
React29.useEffect(() => {
|
|
3212
4789
|
if (open && toggle) return toggle();
|
|
3213
4790
|
}, [open]);
|
|
3214
|
-
|
|
4791
|
+
React29.useEffect(() => {
|
|
3215
4792
|
if (shortcut && shortcutControls && toggle) {
|
|
3216
4793
|
return toggle();
|
|
3217
4794
|
}
|
|
3218
4795
|
}, [shortcutControls]);
|
|
3219
4796
|
useDisabledScroll(lock && Boolean(states.open));
|
|
3220
|
-
return /* @__PURE__ */
|
|
4797
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, states.open && /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
|
|
3221
4798
|
SheetWrapper,
|
|
3222
4799
|
{
|
|
3223
4800
|
role: "dialog",
|
|
@@ -3234,7 +4811,7 @@ var Sheet = (props) => {
|
|
|
3234
4811
|
...restProps
|
|
3235
4812
|
},
|
|
3236
4813
|
children
|
|
3237
|
-
), overlay && /* @__PURE__ */
|
|
4814
|
+
), overlay && /* @__PURE__ */ React29.createElement(
|
|
3238
4815
|
Overlay,
|
|
3239
4816
|
{
|
|
3240
4817
|
onClick: () => toggle && toggle(!states.open),
|
|
@@ -3260,7 +4837,7 @@ var SheetTrigger = (props) => {
|
|
|
3260
4837
|
if (onClick) onClick(event);
|
|
3261
4838
|
if (toggle) toggle(!states.open);
|
|
3262
4839
|
};
|
|
3263
|
-
return /* @__PURE__ */
|
|
4840
|
+
return /* @__PURE__ */ React29.createElement(
|
|
3264
4841
|
Button,
|
|
3265
4842
|
{
|
|
3266
4843
|
id: id.triggerId,
|
|
@@ -3280,11 +4857,11 @@ Sheet.Root = SheetRoot;
|
|
|
3280
4857
|
Sheet.Trigger = SheetTrigger;
|
|
3281
4858
|
|
|
3282
4859
|
// src/shimmer/index.tsx
|
|
3283
|
-
import
|
|
4860
|
+
import React30 from "react";
|
|
3284
4861
|
|
|
3285
4862
|
// src/shimmer/styles/index.ts
|
|
3286
|
-
import
|
|
3287
|
-
var shimmer =
|
|
4863
|
+
import styled18, { keyframes } from "styled-components";
|
|
4864
|
+
var shimmer = keyframes`
|
|
3288
4865
|
0% {
|
|
3289
4866
|
background-position: 200% center;
|
|
3290
4867
|
}
|
|
@@ -3292,7 +4869,7 @@ var shimmer = keyframes2`
|
|
|
3292
4869
|
background-position: -200% center;
|
|
3293
4870
|
}
|
|
3294
4871
|
`;
|
|
3295
|
-
var TextShimmerWrapper =
|
|
4872
|
+
var TextShimmerWrapper = styled18.span`
|
|
3296
4873
|
background: linear-gradient(
|
|
3297
4874
|
90deg,
|
|
3298
4875
|
${({ "data-base-color": baseColor }) => baseColor} 0%,
|
|
@@ -3325,7 +4902,7 @@ var Shimmer = (props) => {
|
|
|
3325
4902
|
baseColor = DEFAULT_BASE_COLOR,
|
|
3326
4903
|
...restProps
|
|
3327
4904
|
} = props;
|
|
3328
|
-
return /* @__PURE__ */
|
|
4905
|
+
return /* @__PURE__ */ React30.createElement(
|
|
3329
4906
|
TextShimmerWrapper,
|
|
3330
4907
|
{
|
|
3331
4908
|
"data-raw": Boolean(raw),
|
|
@@ -3342,13 +4919,13 @@ var Shimmer = (props) => {
|
|
|
3342
4919
|
Shimmer.displayName = "Shimmer";
|
|
3343
4920
|
|
|
3344
4921
|
// src/scrollarea/index.tsx
|
|
3345
|
-
import
|
|
4922
|
+
import React31 from "react";
|
|
3346
4923
|
var ScrollArea = ({
|
|
3347
4924
|
scrollbar = false,
|
|
3348
4925
|
children,
|
|
3349
4926
|
...restProps
|
|
3350
4927
|
}) => {
|
|
3351
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ React31.createElement(
|
|
3352
4929
|
ScrollAreaWrapper,
|
|
3353
4930
|
{
|
|
3354
4931
|
"aria-hidden": "true",
|
|
@@ -3360,59 +4937,84 @@ var ScrollArea = ({
|
|
|
3360
4937
|
};
|
|
3361
4938
|
|
|
3362
4939
|
// src/spinner/index.tsx
|
|
3363
|
-
import
|
|
4940
|
+
import React32 from "react";
|
|
3364
4941
|
|
|
3365
4942
|
// src/spinner/styles/index.ts
|
|
3366
|
-
import
|
|
3367
|
-
var Rotate =
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
}
|
|
3371
|
-
100% {
|
|
3372
|
-
transform: rotate(360deg);
|
|
3373
|
-
}
|
|
4943
|
+
import styled19, { css as css12, keyframes as keyframes2 } from "styled-components";
|
|
4944
|
+
var Rotate = keyframes2`
|
|
4945
|
+
0% { transform: rotate(0deg); }
|
|
4946
|
+
100% { transform: rotate(360deg); }
|
|
3374
4947
|
`;
|
|
3375
|
-
var
|
|
4948
|
+
var SpinnerSizeStyles = css12`
|
|
3376
4949
|
&[data-size="small"] {
|
|
3377
|
-
width:
|
|
3378
|
-
height:
|
|
4950
|
+
width: 12px;
|
|
4951
|
+
height: 12px;
|
|
3379
4952
|
}
|
|
3380
4953
|
&[data-size="medium"] {
|
|
3381
|
-
width:
|
|
3382
|
-
height:
|
|
4954
|
+
width: 18px;
|
|
4955
|
+
height: 18px;
|
|
3383
4956
|
}
|
|
3384
4957
|
&[data-size="large"] {
|
|
3385
|
-
width:
|
|
3386
|
-
height:
|
|
4958
|
+
width: 24px;
|
|
4959
|
+
height: 24px;
|
|
3387
4960
|
}
|
|
3388
4961
|
`;
|
|
3389
|
-
var
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
display: inline-block;
|
|
3394
|
-
box-sizing: border-box;
|
|
4962
|
+
var CircleStyles = css12`
|
|
4963
|
+
border: var(--measurement-small-80) solid var(--font-color-alpha-10);
|
|
4964
|
+
border-bottom-color: transparent;
|
|
4965
|
+
border-radius: var(--measurement-large-90);
|
|
3395
4966
|
|
|
4967
|
+
animation: ${Rotate} 0.8s linear infinite;
|
|
4968
|
+
`;
|
|
4969
|
+
var CircleFilledStyles = css12`
|
|
3396
4970
|
border: var(--measurement-small-60) solid var(--font-color-alpha-30);
|
|
4971
|
+
|
|
4972
|
+
border-top-color: transparent;
|
|
4973
|
+
border-right-color: transparent;
|
|
3397
4974
|
border-bottom-color: transparent;
|
|
4975
|
+
|
|
3398
4976
|
border-radius: var(--measurement-large-90);
|
|
4977
|
+
background-color: var(--font-color-alpha-10);
|
|
4978
|
+
|
|
4979
|
+
&::before {
|
|
4980
|
+
position: absolute;
|
|
4981
|
+
content: "";
|
|
4982
|
+
width: 100%;
|
|
4983
|
+
height: 100%;
|
|
4984
|
+
background-color: var(--body-color);
|
|
4985
|
+
border-radius: var(--measurement-large-90);
|
|
4986
|
+
}
|
|
3399
4987
|
|
|
3400
|
-
animation: ${Rotate}
|
|
4988
|
+
animation: ${Rotate} 0.8s linear infinite;
|
|
4989
|
+
`;
|
|
4990
|
+
var AnimatedSpinner = styled19.div`
|
|
4991
|
+
${SpinnerSizeStyles}
|
|
3401
4992
|
|
|
3402
|
-
|
|
4993
|
+
&[data-variant="circle"] {
|
|
4994
|
+
${CircleStyles}
|
|
4995
|
+
}
|
|
4996
|
+
&[data-variant="circle-filled"] {
|
|
4997
|
+
${CircleFilledStyles}
|
|
4998
|
+
}
|
|
3403
4999
|
`;
|
|
3404
5000
|
|
|
3405
5001
|
// src/spinner/index.tsx
|
|
3406
5002
|
var Spinner = (props) => {
|
|
3407
|
-
return /* @__PURE__ */
|
|
5003
|
+
return /* @__PURE__ */ React32.createElement(
|
|
5004
|
+
AnimatedSpinner,
|
|
5005
|
+
{
|
|
5006
|
+
"data-variant": props?.variant ?? "circle",
|
|
5007
|
+
"data-size": props?.sizing ?? "medium"
|
|
5008
|
+
}
|
|
5009
|
+
);
|
|
3408
5010
|
};
|
|
3409
5011
|
|
|
3410
5012
|
// src/skeleton/index.tsx
|
|
3411
|
-
import
|
|
5013
|
+
import React33 from "react";
|
|
3412
5014
|
|
|
3413
5015
|
// src/skeleton/styles/index.ts
|
|
3414
|
-
import
|
|
3415
|
-
var SkeletonBlink =
|
|
5016
|
+
import styled20, { css as css13, keyframes as keyframes3 } from "styled-components";
|
|
5017
|
+
var SkeletonBlink = keyframes3`
|
|
3416
5018
|
0% {
|
|
3417
5019
|
opacity: 0.3;
|
|
3418
5020
|
}
|
|
@@ -3420,7 +5022,7 @@ var SkeletonBlink = keyframes4`
|
|
|
3420
5022
|
opacity: 0.1;
|
|
3421
5023
|
}
|
|
3422
5024
|
`;
|
|
3423
|
-
var SkeletonBaseStyles =
|
|
5025
|
+
var SkeletonBaseStyles = css13`
|
|
3424
5026
|
background: linear-gradient(
|
|
3425
5027
|
45deg,
|
|
3426
5028
|
var(--font-color-alpha-10),
|
|
@@ -3428,7 +5030,7 @@ var SkeletonBaseStyles = css12`
|
|
|
3428
5030
|
);
|
|
3429
5031
|
animation: ${SkeletonBlink} 1s ease-in-out alternate-reverse infinite;
|
|
3430
5032
|
`;
|
|
3431
|
-
var SkeletonSizeStyles =
|
|
5033
|
+
var SkeletonSizeStyles = css13`
|
|
3432
5034
|
&[data-size="small"] {
|
|
3433
5035
|
width: 100%;
|
|
3434
5036
|
|
|
@@ -3446,7 +5048,7 @@ var SkeletonSizeStyles = css12`
|
|
|
3446
5048
|
min-height: var(--measurement-medium-90);
|
|
3447
5049
|
}
|
|
3448
5050
|
`;
|
|
3449
|
-
var SkeletonShapeStyles =
|
|
5051
|
+
var SkeletonShapeStyles = css13`
|
|
3450
5052
|
&[data-shape="square"] {
|
|
3451
5053
|
border-radius: 0;
|
|
3452
5054
|
}
|
|
@@ -3457,7 +5059,7 @@ var SkeletonShapeStyles = css12`
|
|
|
3457
5059
|
border-radius: var(--measurement-large-90);
|
|
3458
5060
|
}
|
|
3459
5061
|
`;
|
|
3460
|
-
var SkeletonLoader =
|
|
5062
|
+
var SkeletonLoader = styled20.span`
|
|
3461
5063
|
${SkeletonBaseStyles}
|
|
3462
5064
|
${SkeletonSizeStyles}
|
|
3463
5065
|
${SkeletonShapeStyles}
|
|
@@ -3467,10 +5069,10 @@ var SkeletonLoader = styled21.span`
|
|
|
3467
5069
|
var Skeleton = (props) => {
|
|
3468
5070
|
const {
|
|
3469
5071
|
sizing = "medium" /* Medium */,
|
|
3470
|
-
shape = "smooth"
|
|
5072
|
+
shape = "smooth" /* Smooth */,
|
|
3471
5073
|
...restProps
|
|
3472
5074
|
} = props;
|
|
3473
|
-
return /* @__PURE__ */
|
|
5075
|
+
return /* @__PURE__ */ React33.createElement(
|
|
3474
5076
|
SkeletonLoader,
|
|
3475
5077
|
{
|
|
3476
5078
|
"data-size": sizing,
|
|
@@ -3483,10 +5085,10 @@ var Skeleton = (props) => {
|
|
|
3483
5085
|
Skeleton.displayName = "Skeleton";
|
|
3484
5086
|
|
|
3485
5087
|
// src/switch/index.tsx
|
|
3486
|
-
import
|
|
5088
|
+
import React35 from "react";
|
|
3487
5089
|
|
|
3488
5090
|
// src/switch/hooks/index.tsx
|
|
3489
|
-
import
|
|
5091
|
+
import React34, { useState as useState7, createContext as createContext7, useContext as useContext7 } from "react";
|
|
3490
5092
|
var defaultComponentAPI7 = {
|
|
3491
5093
|
id: "",
|
|
3492
5094
|
states: {},
|
|
@@ -3498,11 +5100,11 @@ var SwitchProvider = ({
|
|
|
3498
5100
|
children
|
|
3499
5101
|
}) => {
|
|
3500
5102
|
const context = useSwitchProvider();
|
|
3501
|
-
return /* @__PURE__ */
|
|
5103
|
+
return /* @__PURE__ */ React34.createElement(SwitchContext.Provider, { value: context }, children);
|
|
3502
5104
|
};
|
|
3503
5105
|
function useSwitchProvider() {
|
|
3504
5106
|
const [checked, setChecked] = useState7(false);
|
|
3505
|
-
const switchId =
|
|
5107
|
+
const switchId = React34.useId();
|
|
3506
5108
|
return {
|
|
3507
5109
|
id: switchId,
|
|
3508
5110
|
states: {
|
|
@@ -3515,8 +5117,8 @@ function useSwitchProvider() {
|
|
|
3515
5117
|
}
|
|
3516
5118
|
|
|
3517
5119
|
// src/switch/styles/index.ts
|
|
3518
|
-
import
|
|
3519
|
-
var SwitchDefaultStyles =
|
|
5120
|
+
import styled21, { css as css14 } from "styled-components";
|
|
5121
|
+
var SwitchDefaultStyles = css14`
|
|
3520
5122
|
all: unset;
|
|
3521
5123
|
|
|
3522
5124
|
border: var(--measurement-small-10) solid transparent;
|
|
@@ -3530,105 +5132,105 @@ var SwitchDefaultStyles = css13`
|
|
|
3530
5132
|
opacity: 0.6;
|
|
3531
5133
|
}
|
|
3532
5134
|
`;
|
|
3533
|
-
var SwitchVariantsStyles =
|
|
3534
|
-
&[data-variant="
|
|
5135
|
+
var SwitchVariantsStyles = css14`
|
|
5136
|
+
&[data-variant="accent"] {
|
|
3535
5137
|
&[aria-checked="true"] {
|
|
3536
|
-
background-color: var(--color-
|
|
3537
|
-
border-color: var(--
|
|
5138
|
+
background-color: var(--color-accent);
|
|
5139
|
+
border-color: var(--alpha-accent-10);
|
|
3538
5140
|
}
|
|
3539
5141
|
&[aria-checked="false"] {
|
|
3540
5142
|
background-color: var(--font-color-alpha-10);
|
|
3541
5143
|
border-color: var(--font-color-alpha-10);
|
|
3542
5144
|
}
|
|
3543
5145
|
}
|
|
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"] {
|
|
5146
|
+
&[data-variant="primary"] {
|
|
3555
5147
|
&[aria-checked="true"] {
|
|
5148
|
+
background-color: var(--color-green);
|
|
3556
5149
|
border-color: var(--font-color-alpha-10);
|
|
3557
|
-
background-color: var(--body-color-alpha-10);
|
|
3558
5150
|
}
|
|
3559
5151
|
&[aria-checked="false"] {
|
|
5152
|
+
background-color: var(--font-color-alpha-10);
|
|
3560
5153
|
border-color: var(--font-color-alpha-10);
|
|
3561
5154
|
}
|
|
3562
5155
|
}
|
|
3563
5156
|
`;
|
|
3564
|
-
var SwitchSizeStyles =
|
|
5157
|
+
var SwitchSizeStyles = css14`
|
|
3565
5158
|
&[data-size="small"] {
|
|
3566
|
-
|
|
3567
|
-
|
|
5159
|
+
--thumb-size: calc(
|
|
5160
|
+
var(--measurement-medium-40) - var(--measurement-small-10)
|
|
5161
|
+
);
|
|
5162
|
+
|
|
5163
|
+
padding: 0 var(--measurement-small-10);
|
|
5164
|
+
width: calc(var(--thumb-size) * 2);
|
|
5165
|
+
height: var(--measurement-medium-40);
|
|
3568
5166
|
|
|
3569
5167
|
span {
|
|
3570
|
-
width: var(--
|
|
3571
|
-
height: var(--
|
|
5168
|
+
width: var(--thumb-size);
|
|
5169
|
+
height: var(--thumb-size);
|
|
5170
|
+
|
|
3572
5171
|
&[data-checked="true"] {
|
|
3573
|
-
transform: translateX(var(--
|
|
3574
|
-
}
|
|
3575
|
-
&[data-checked="false"] {
|
|
3576
|
-
transform: translateX(var(--measurement-small-60));
|
|
5172
|
+
transform: translateX(var(--thumb-size));
|
|
3577
5173
|
}
|
|
3578
5174
|
}
|
|
3579
5175
|
}
|
|
3580
|
-
|
|
3581
5176
|
&[data-size="medium"] {
|
|
3582
|
-
|
|
5177
|
+
--thumb-size: calc(
|
|
5178
|
+
var(--measurement-medium-60) - var(--measurement-small-10)
|
|
5179
|
+
);
|
|
5180
|
+
|
|
5181
|
+
padding: 0 var(--measurement-small-10);
|
|
5182
|
+
width: calc(var(--thumb-size) * 2);
|
|
3583
5183
|
height: var(--measurement-medium-60);
|
|
3584
5184
|
|
|
3585
5185
|
span {
|
|
3586
|
-
width: var(--
|
|
3587
|
-
height: var(--
|
|
5186
|
+
width: var(--thumb-size);
|
|
5187
|
+
height: var(--thumb-size);
|
|
5188
|
+
|
|
3588
5189
|
&[data-checked="true"] {
|
|
3589
|
-
transform: translateX(var(--
|
|
3590
|
-
}
|
|
3591
|
-
&[data-checked="false"] {
|
|
3592
|
-
transform: translateX(var(--measurement-small-60));
|
|
5190
|
+
transform: translateX(var(--thumb-size));
|
|
3593
5191
|
}
|
|
3594
5192
|
}
|
|
3595
5193
|
}
|
|
3596
|
-
|
|
3597
5194
|
&[data-size="large"] {
|
|
3598
|
-
|
|
5195
|
+
--thumb-size: calc(
|
|
5196
|
+
var(--measurement-medium-70) - var(--measurement-small-30)
|
|
5197
|
+
);
|
|
5198
|
+
|
|
5199
|
+
padding: 0 var(--measurement-small-30);
|
|
5200
|
+
width: calc(var(--thumb-size) * 2);
|
|
3599
5201
|
height: var(--measurement-medium-70);
|
|
3600
5202
|
|
|
3601
5203
|
span {
|
|
3602
|
-
width: var(--
|
|
3603
|
-
height: var(--
|
|
5204
|
+
width: var(--thumb-size);
|
|
5205
|
+
height: var(--thumb-size);
|
|
5206
|
+
|
|
3604
5207
|
&[data-checked="true"] {
|
|
3605
|
-
transform: translateX(
|
|
3606
|
-
}
|
|
3607
|
-
&[data-checked="false"] {
|
|
3608
|
-
transform: translateX(var(--measurement-small-80));
|
|
5208
|
+
transform: translateX(var(--thumb-size));
|
|
3609
5209
|
}
|
|
3610
5210
|
}
|
|
3611
5211
|
}
|
|
3612
5212
|
`;
|
|
3613
|
-
var TriggerWrapper =
|
|
5213
|
+
var TriggerWrapper = styled21.button`
|
|
3614
5214
|
&[data-raw="false"] {
|
|
3615
5215
|
${SwitchDefaultStyles}
|
|
3616
5216
|
${SwitchVariantsStyles}
|
|
3617
5217
|
${SwitchSizeStyles}
|
|
3618
5218
|
}
|
|
3619
5219
|
`;
|
|
3620
|
-
var Thumb =
|
|
5220
|
+
var Thumb = styled21.span`
|
|
3621
5221
|
&[data-raw="false"] {
|
|
3622
5222
|
all: unset;
|
|
3623
5223
|
display: block;
|
|
3624
5224
|
|
|
3625
|
-
background:
|
|
3626
|
-
border-radius:
|
|
3627
|
-
|
|
5225
|
+
background: white;
|
|
5226
|
+
border-radius: var(--measurement-large-90);
|
|
5227
|
+
box-shadow:
|
|
5228
|
+
0 var(--measurement-small-30) var(--measurement-small-80)
|
|
5229
|
+
var(--alpha-mono-darkest-10),
|
|
5230
|
+
0 var(--measurement-small-30) var(--measurement-small-60)
|
|
5231
|
+
calc(var(--measurement-small-30) * -1) var(--alpha-mono-darkest-10);
|
|
3628
5232
|
|
|
3629
|
-
|
|
3630
|
-
background: var(--font-color);
|
|
3631
|
-
}
|
|
5233
|
+
transition: all 0.1s ease-in-out 0.2s;
|
|
3632
5234
|
}
|
|
3633
5235
|
`;
|
|
3634
5236
|
|
|
@@ -3651,10 +5253,10 @@ var Switch = (props) => {
|
|
|
3651
5253
|
if (onClick) onClick(event);
|
|
3652
5254
|
if (toggleSwitch) toggleSwitch();
|
|
3653
5255
|
};
|
|
3654
|
-
|
|
5256
|
+
React35.useEffect(() => {
|
|
3655
5257
|
if (defaultChecked && toggleSwitch) toggleSwitch();
|
|
3656
5258
|
}, [defaultChecked]);
|
|
3657
|
-
return /* @__PURE__ */
|
|
5259
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3658
5260
|
TriggerWrapper,
|
|
3659
5261
|
{
|
|
3660
5262
|
type: "button",
|
|
@@ -3670,19 +5272,19 @@ var Switch = (props) => {
|
|
|
3670
5272
|
"data-raw": Boolean(raw),
|
|
3671
5273
|
...restProps
|
|
3672
5274
|
},
|
|
3673
|
-
/* @__PURE__ */
|
|
5275
|
+
/* @__PURE__ */ React35.createElement("title", null, "Switch"),
|
|
3674
5276
|
children
|
|
3675
5277
|
);
|
|
3676
5278
|
};
|
|
3677
5279
|
Switch.displayName = "Switch";
|
|
3678
5280
|
var SwitchRoot = ({ children }) => {
|
|
3679
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ React35.createElement(SwitchProvider, null, children);
|
|
3680
5282
|
};
|
|
3681
5283
|
SwitchRoot.displayName = "Switch.Root";
|
|
3682
5284
|
var SwitchThumb = (props) => {
|
|
3683
5285
|
const { raw, sizing } = props;
|
|
3684
5286
|
const { id, states } = useSwitch();
|
|
3685
|
-
return /* @__PURE__ */
|
|
5287
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3686
5288
|
Thumb,
|
|
3687
5289
|
{
|
|
3688
5290
|
role: "presentation",
|
|
@@ -3702,11 +5304,11 @@ Switch.Root = SwitchRoot;
|
|
|
3702
5304
|
Switch.Thumb = SwitchThumb;
|
|
3703
5305
|
|
|
3704
5306
|
// src/table/index.tsx
|
|
3705
|
-
import
|
|
5307
|
+
import React36 from "react";
|
|
3706
5308
|
|
|
3707
5309
|
// src/table/styles/index.ts
|
|
3708
|
-
import
|
|
3709
|
-
var CellStyles =
|
|
5310
|
+
import styled22, { css as css15 } from "styled-components";
|
|
5311
|
+
var CellStyles = css15`
|
|
3710
5312
|
box-sizing: border-box;
|
|
3711
5313
|
border: none;
|
|
3712
5314
|
line-height: 1;
|
|
@@ -3716,11 +5318,11 @@ var CellStyles = css14`
|
|
|
3716
5318
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
3717
5319
|
);
|
|
3718
5320
|
`;
|
|
3719
|
-
var TableLayer =
|
|
5321
|
+
var TableLayer = styled22.div`
|
|
3720
5322
|
border-radius: var(--measurement-medium-30);
|
|
3721
5323
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
3722
5324
|
`;
|
|
3723
|
-
var TableWrapper =
|
|
5325
|
+
var TableWrapper = styled22.table`
|
|
3724
5326
|
border-collapse: collapse;
|
|
3725
5327
|
|
|
3726
5328
|
tbody {
|
|
@@ -3731,7 +5333,7 @@ var TableWrapper = styled23.table`
|
|
|
3731
5333
|
}
|
|
3732
5334
|
}
|
|
3733
5335
|
`;
|
|
3734
|
-
var RowWrapper =
|
|
5336
|
+
var RowWrapper = styled22.tr`
|
|
3735
5337
|
border-bottom: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
3736
5338
|
|
|
3737
5339
|
transition: background-color linear 0.1s;
|
|
@@ -3740,7 +5342,7 @@ var RowWrapper = styled23.tr`
|
|
|
3740
5342
|
background-color: var(--font-color-alpha-10);
|
|
3741
5343
|
}
|
|
3742
5344
|
`;
|
|
3743
|
-
var HeadCellWrapper =
|
|
5345
|
+
var HeadCellWrapper = styled22.th`
|
|
3744
5346
|
font-size: var(--fontsize-medium-10);
|
|
3745
5347
|
${CellStyles}
|
|
3746
5348
|
|
|
@@ -3748,7 +5350,7 @@ var HeadCellWrapper = styled23.th`
|
|
|
3748
5350
|
color: var(--font-color-alpha-60);
|
|
3749
5351
|
}
|
|
3750
5352
|
`;
|
|
3751
|
-
var CellWrapper =
|
|
5353
|
+
var CellWrapper = styled22.td`
|
|
3752
5354
|
${CellStyles}
|
|
3753
5355
|
`;
|
|
3754
5356
|
|
|
@@ -3757,43 +5359,43 @@ var Table = ({
|
|
|
3757
5359
|
children,
|
|
3758
5360
|
...restProps
|
|
3759
5361
|
}) => {
|
|
3760
|
-
return /* @__PURE__ */
|
|
5362
|
+
return /* @__PURE__ */ React36.createElement(ScrollArea, { as: TableLayer, role: "presentation", tabIndex: -1 }, /* @__PURE__ */ React36.createElement(TableWrapper, { ...restProps, cellSpacing: "0", cellPadding: "0" }, children));
|
|
3761
5363
|
};
|
|
3762
5364
|
Table.displayName = "Table";
|
|
3763
5365
|
var TableHead = ({
|
|
3764
5366
|
children,
|
|
3765
5367
|
...restProps
|
|
3766
5368
|
}) => {
|
|
3767
|
-
return /* @__PURE__ */
|
|
5369
|
+
return /* @__PURE__ */ React36.createElement("thead", { ...restProps }, children);
|
|
3768
5370
|
};
|
|
3769
5371
|
TableHead.displayName = "Table.Head";
|
|
3770
5372
|
var TableBody = ({
|
|
3771
5373
|
children,
|
|
3772
5374
|
...restProps
|
|
3773
5375
|
}) => {
|
|
3774
|
-
return /* @__PURE__ */
|
|
5376
|
+
return /* @__PURE__ */ React36.createElement("tbody", { ...restProps }, children);
|
|
3775
5377
|
};
|
|
3776
5378
|
TableBody.displayName = "Table.Body";
|
|
3777
5379
|
var TableHeadCell = ({
|
|
3778
5380
|
children,
|
|
3779
5381
|
...restProps
|
|
3780
5382
|
}) => {
|
|
3781
|
-
return /* @__PURE__ */
|
|
5383
|
+
return /* @__PURE__ */ React36.createElement(HeadCellWrapper, { colSpan: 1, ...restProps }, /* @__PURE__ */ React36.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
3782
5384
|
};
|
|
3783
5385
|
TableHeadCell.displayName = "Table.HeadCell";
|
|
3784
5386
|
var TableRow = ({ children, ...restProps }) => {
|
|
3785
|
-
return /* @__PURE__ */
|
|
5387
|
+
return /* @__PURE__ */ React36.createElement(RowWrapper, { className: "p-medium-30", ...restProps }, children);
|
|
3786
5388
|
};
|
|
3787
5389
|
TableRow.displayName = "Table.Row";
|
|
3788
5390
|
var TableCell = ({ children, ...restProps }) => {
|
|
3789
|
-
return /* @__PURE__ */
|
|
5391
|
+
return /* @__PURE__ */ React36.createElement(CellWrapper, { ...restProps }, /* @__PURE__ */ React36.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
3790
5392
|
};
|
|
3791
5393
|
TableCell.displayName = "Table.Cell";
|
|
3792
5394
|
var TableFooter = ({
|
|
3793
5395
|
children,
|
|
3794
5396
|
...restProps
|
|
3795
5397
|
}) => {
|
|
3796
|
-
return /* @__PURE__ */
|
|
5398
|
+
return /* @__PURE__ */ React36.createElement("tfoot", { ...restProps }, children);
|
|
3797
5399
|
};
|
|
3798
5400
|
TableFooter.displayName = "Table.Footer";
|
|
3799
5401
|
Table.Head = TableHead;
|
|
@@ -3804,10 +5406,10 @@ Table.Cell = TableCell;
|
|
|
3804
5406
|
Table.Footer = TableFooter;
|
|
3805
5407
|
|
|
3806
5408
|
// src/tabs/index.tsx
|
|
3807
|
-
import
|
|
5409
|
+
import React38, { Children } from "react";
|
|
3808
5410
|
|
|
3809
5411
|
// src/tabs/hooks/index.tsx
|
|
3810
|
-
import
|
|
5412
|
+
import React37, { createContext as createContext8, useContext as useContext8, useState as useState8 } from "react";
|
|
3811
5413
|
var defaultComponentAPI8 = {
|
|
3812
5414
|
id: "",
|
|
3813
5415
|
states: {},
|
|
@@ -3819,11 +5421,11 @@ var TabsProvider = ({
|
|
|
3819
5421
|
children
|
|
3820
5422
|
}) => {
|
|
3821
5423
|
const context = useTabsProvider();
|
|
3822
|
-
return /* @__PURE__ */
|
|
5424
|
+
return /* @__PURE__ */ React37.createElement(TabsContext.Provider, { value: context }, children);
|
|
3823
5425
|
};
|
|
3824
5426
|
function useTabsProvider() {
|
|
3825
5427
|
const [value, setValue] = useState8(null);
|
|
3826
|
-
const tabsId =
|
|
5428
|
+
const tabsId = React37.useId();
|
|
3827
5429
|
return {
|
|
3828
5430
|
id: tabsId,
|
|
3829
5431
|
states: {
|
|
@@ -3837,8 +5439,8 @@ function useTabsProvider() {
|
|
|
3837
5439
|
}
|
|
3838
5440
|
|
|
3839
5441
|
// src/tabs/styles/index.ts
|
|
3840
|
-
import
|
|
3841
|
-
var TabWrapper =
|
|
5442
|
+
import styled23 from "styled-components";
|
|
5443
|
+
var TabWrapper = styled23.div`
|
|
3842
5444
|
button {
|
|
3843
5445
|
&[aria-selected="true"] {
|
|
3844
5446
|
color: var(--font-color) !important;
|
|
@@ -3853,20 +5455,20 @@ var Tabs = (props) => {
|
|
|
3853
5455
|
const { applyValue } = methods;
|
|
3854
5456
|
const childArray = Children.toArray(children);
|
|
3855
5457
|
const firstChild = childArray[0];
|
|
3856
|
-
|
|
3857
|
-
if (
|
|
5458
|
+
React38.useEffect(() => {
|
|
5459
|
+
if (React38.isValidElement(firstChild)) {
|
|
3858
5460
|
if (childArray.length > 0 && applyValue)
|
|
3859
5461
|
applyValue(firstChild.props.value);
|
|
3860
5462
|
}
|
|
3861
5463
|
}, []);
|
|
3862
|
-
|
|
5464
|
+
React38.useEffect(() => {
|
|
3863
5465
|
if (defaultOpen && applyValue) applyValue(defaultOpen);
|
|
3864
5466
|
}, []);
|
|
3865
|
-
return /* @__PURE__ */
|
|
5467
|
+
return /* @__PURE__ */ React38.createElement(TabWrapper, { role: "tablist", ...restProps }, children);
|
|
3866
5468
|
};
|
|
3867
5469
|
Tabs.displayName = "Tabs";
|
|
3868
5470
|
var TabsRoot = ({ children }) => {
|
|
3869
|
-
return /* @__PURE__ */
|
|
5471
|
+
return /* @__PURE__ */ React38.createElement(TabsProvider, null, children);
|
|
3870
5472
|
};
|
|
3871
5473
|
TabsRoot.displayName = "Tabs.Root";
|
|
3872
5474
|
var TabsTrigger = (props) => {
|
|
@@ -3882,7 +5484,7 @@ var TabsTrigger = (props) => {
|
|
|
3882
5484
|
if (applyValue) applyValue(value);
|
|
3883
5485
|
if (onClick) onClick(event);
|
|
3884
5486
|
};
|
|
3885
|
-
return /* @__PURE__ */
|
|
5487
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3886
5488
|
Button,
|
|
3887
5489
|
{
|
|
3888
5490
|
type: "button",
|
|
@@ -3910,7 +5512,7 @@ var TabsContent = (props) => {
|
|
|
3910
5512
|
trigger: getTabsId && getTabsId({ value, type: "trigger" }),
|
|
3911
5513
|
content: getTabsId && getTabsId({ value, type: "content" })
|
|
3912
5514
|
};
|
|
3913
|
-
return /* @__PURE__ */
|
|
5515
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3914
5516
|
"div",
|
|
3915
5517
|
{
|
|
3916
5518
|
tabIndex: 0,
|
|
@@ -3931,11 +5533,11 @@ Tabs.Trigger = TabsTrigger;
|
|
|
3931
5533
|
Tabs.Content = TabsContent;
|
|
3932
5534
|
|
|
3933
5535
|
// src/text-area/index.tsx
|
|
3934
|
-
import
|
|
5536
|
+
import React39 from "react";
|
|
3935
5537
|
|
|
3936
5538
|
// src/text-area/styles/index.ts
|
|
3937
|
-
import
|
|
3938
|
-
var CustomScrollbar2 =
|
|
5539
|
+
import styled24, { css as css16 } from "styled-components";
|
|
5540
|
+
var CustomScrollbar2 = css16`
|
|
3939
5541
|
height: ${({ $height }) => $height ?? "100%"};
|
|
3940
5542
|
width: ${({ $width }) => $width ?? "100%"};
|
|
3941
5543
|
overflow-y: auto;
|
|
@@ -3967,7 +5569,7 @@ var CustomScrollbar2 = css15`
|
|
|
3967
5569
|
scrollbar-width: thin;
|
|
3968
5570
|
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor ?? "var(--font-color-alpha-10)"} ${$trackColor ?? "transparent"}`};
|
|
3969
5571
|
`;
|
|
3970
|
-
var TextareaSizeStyles =
|
|
5572
|
+
var TextareaSizeStyles = css16`
|
|
3971
5573
|
padding: var(--measurement-medium-30);
|
|
3972
5574
|
max-height: var(--measurement-large-60);
|
|
3973
5575
|
|
|
@@ -3982,7 +5584,7 @@ var TextareaSizeStyles = css15`
|
|
|
3982
5584
|
max-height: var(--measurement-large-80);
|
|
3983
5585
|
}
|
|
3984
5586
|
`;
|
|
3985
|
-
var TextareaResizableStyles =
|
|
5587
|
+
var TextareaResizableStyles = css16`
|
|
3986
5588
|
&[data-resizable="true"] {
|
|
3987
5589
|
resize: vertical;
|
|
3988
5590
|
}
|
|
@@ -3990,7 +5592,7 @@ var TextareaResizableStyles = css15`
|
|
|
3990
5592
|
resize: none;
|
|
3991
5593
|
}
|
|
3992
5594
|
`;
|
|
3993
|
-
var TextAreaContainer =
|
|
5595
|
+
var TextAreaContainer = styled24.textarea`
|
|
3994
5596
|
&[data-raw="false"] {
|
|
3995
5597
|
${FieldDefaultStyles}
|
|
3996
5598
|
${FieldShapeStyles}
|
|
@@ -4006,7 +5608,7 @@ var TextAreaContainer = styled25.textarea`
|
|
|
4006
5608
|
// src/text-area/index.tsx
|
|
4007
5609
|
var Textarea = (props) => {
|
|
4008
5610
|
const { raw, shape, sizing, variant, resizable, onChange } = props;
|
|
4009
|
-
const textareaRef =
|
|
5611
|
+
const textareaRef = React39.useRef(null);
|
|
4010
5612
|
const adjustHeight = () => {
|
|
4011
5613
|
const textarea = textareaRef.current;
|
|
4012
5614
|
if (textarea) {
|
|
@@ -4021,14 +5623,14 @@ var Textarea = (props) => {
|
|
|
4021
5623
|
adjustHeight();
|
|
4022
5624
|
onChange?.(e);
|
|
4023
5625
|
};
|
|
4024
|
-
|
|
4025
|
-
return /* @__PURE__ */
|
|
5626
|
+
React39.useEffect(() => adjustHeight(), [props.value]);
|
|
5627
|
+
return /* @__PURE__ */ React39.createElement(
|
|
4026
5628
|
TextAreaContainer,
|
|
4027
5629
|
{
|
|
4028
5630
|
ref: textareaRef,
|
|
4029
5631
|
onChange: handleChange,
|
|
4030
|
-
"data-variant": variant ?? "secondary"
|
|
4031
|
-
"data-shape": shape ?? "smooth"
|
|
5632
|
+
"data-variant": variant ?? "secondary" /* Secondary */,
|
|
5633
|
+
"data-shape": shape ?? "smooth" /* Smooth */,
|
|
4032
5634
|
"data-size": sizing ?? "medium" /* Medium */,
|
|
4033
5635
|
"data-resizable": resizable,
|
|
4034
5636
|
"data-raw": String(Boolean(raw)),
|
|
@@ -4039,22 +5641,22 @@ var Textarea = (props) => {
|
|
|
4039
5641
|
Textarea.displayName = "Textarea";
|
|
4040
5642
|
|
|
4041
5643
|
// src/toggle/index.tsx
|
|
4042
|
-
import
|
|
5644
|
+
import React40 from "react";
|
|
4043
5645
|
var Toggle = (props) => {
|
|
4044
5646
|
const { defaultChecked, onClick, disabled, children, ...restProps } = props;
|
|
4045
|
-
const [checked, setChecked] =
|
|
5647
|
+
const [checked, setChecked] = React40.useState(
|
|
4046
5648
|
defaultChecked ?? false
|
|
4047
5649
|
);
|
|
4048
5650
|
const handleClick = (event) => {
|
|
4049
5651
|
if (onClick) onClick(event);
|
|
4050
5652
|
if (!disabled) setChecked((prevChecked) => !prevChecked);
|
|
4051
5653
|
};
|
|
4052
|
-
|
|
5654
|
+
React40.useEffect(() => {
|
|
4053
5655
|
if (defaultChecked !== void 0) {
|
|
4054
5656
|
setChecked(Boolean(defaultChecked));
|
|
4055
5657
|
}
|
|
4056
5658
|
}, [defaultChecked]);
|
|
4057
|
-
return /* @__PURE__ */
|
|
5659
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4058
5660
|
Button,
|
|
4059
5661
|
{
|
|
4060
5662
|
role: "switch",
|
|
@@ -4072,10 +5674,10 @@ var Toggle = (props) => {
|
|
|
4072
5674
|
Toggle.displayName = "Toggle";
|
|
4073
5675
|
|
|
4074
5676
|
// src/toolbar/index.tsx
|
|
4075
|
-
import
|
|
5677
|
+
import React42 from "react";
|
|
4076
5678
|
|
|
4077
5679
|
// src/toolbar/hooks/index.tsx
|
|
4078
|
-
import
|
|
5680
|
+
import React41, { useState as useState9, createContext as createContext9, useContext as useContext9 } from "react";
|
|
4079
5681
|
var defaultComponentAPI9 = {
|
|
4080
5682
|
id: "",
|
|
4081
5683
|
states: {},
|
|
@@ -4087,11 +5689,11 @@ var ToolbarProvider = ({
|
|
|
4087
5689
|
children
|
|
4088
5690
|
}) => {
|
|
4089
5691
|
const context = useToolbarProvider();
|
|
4090
|
-
return /* @__PURE__ */
|
|
5692
|
+
return /* @__PURE__ */ React41.createElement(ToolbarContext.Provider, { value: context }, children);
|
|
4091
5693
|
};
|
|
4092
5694
|
function useToolbarProvider() {
|
|
4093
5695
|
const [expanded, setExpanded] = useState9(false);
|
|
4094
|
-
const toolbarId =
|
|
5696
|
+
const toolbarId = React41.useId();
|
|
4095
5697
|
return {
|
|
4096
5698
|
id: toolbarId,
|
|
4097
5699
|
states: {
|
|
@@ -4104,8 +5706,8 @@ function useToolbarProvider() {
|
|
|
4104
5706
|
}
|
|
4105
5707
|
|
|
4106
5708
|
// src/toolbar/styles/index.ts
|
|
4107
|
-
import
|
|
4108
|
-
var ToolbarDefaultStyles =
|
|
5709
|
+
import styled25, { css as css17 } from "styled-components";
|
|
5710
|
+
var ToolbarDefaultStyles = css17`
|
|
4109
5711
|
margin: 0;
|
|
4110
5712
|
display: grid;
|
|
4111
5713
|
grid-template-rows: min-content;
|
|
@@ -4139,7 +5741,7 @@ var ToolbarDefaultStyles = css16`
|
|
|
4139
5741
|
}
|
|
4140
5742
|
}
|
|
4141
5743
|
`;
|
|
4142
|
-
var ToolbarSizeStyles =
|
|
5744
|
+
var ToolbarSizeStyles = css17`
|
|
4143
5745
|
&[data-size="small"] {
|
|
4144
5746
|
&[aria-orientation="vertical"] {
|
|
4145
5747
|
max-width: var(--measurement-large-70);
|
|
@@ -4185,7 +5787,7 @@ var ToolbarSizeStyles = css16`
|
|
|
4185
5787
|
}
|
|
4186
5788
|
}
|
|
4187
5789
|
`;
|
|
4188
|
-
var ToolbarSideStyles =
|
|
5790
|
+
var ToolbarSideStyles = css17`
|
|
4189
5791
|
&[data-side="top"] {
|
|
4190
5792
|
border-bottom-color: var(--font-color-alpha-10);
|
|
4191
5793
|
}
|
|
@@ -4217,7 +5819,7 @@ var ToolbarSideStyles = css16`
|
|
|
4217
5819
|
}
|
|
4218
5820
|
}
|
|
4219
5821
|
`;
|
|
4220
|
-
var ToolbarWrapper =
|
|
5822
|
+
var ToolbarWrapper = styled25.menu`
|
|
4221
5823
|
&[data-raw="false"] {
|
|
4222
5824
|
${ToolbarDefaultStyles}
|
|
4223
5825
|
${ToolbarSizeStyles}
|
|
@@ -4225,7 +5827,7 @@ var ToolbarWrapper = styled26.menu`
|
|
|
4225
5827
|
${ToolbarSideStyles}
|
|
4226
5828
|
}
|
|
4227
5829
|
`;
|
|
4228
|
-
var ToolbarTriggerWrapper =
|
|
5830
|
+
var ToolbarTriggerWrapper = styled25.menu`
|
|
4229
5831
|
&[data-raw="false"] {
|
|
4230
5832
|
all: unset;
|
|
4231
5833
|
align-self: flex-end;
|
|
@@ -4250,13 +5852,13 @@ var Toolbar = (props) => {
|
|
|
4250
5852
|
const { toggleToolbar } = methods;
|
|
4251
5853
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
4252
5854
|
const orientation = side && ["left", "right"].includes(side) ? "vertical" : "horizontal";
|
|
4253
|
-
|
|
5855
|
+
React42.useEffect(() => {
|
|
4254
5856
|
if (defaultOpen && toggleToolbar) return toggleToolbar(true);
|
|
4255
5857
|
}, [defaultOpen]);
|
|
4256
|
-
|
|
5858
|
+
React42.useEffect(() => {
|
|
4257
5859
|
if (shortcut && shortcutControls && toggleToolbar) toggleToolbar();
|
|
4258
5860
|
}, [shortcutControls]);
|
|
4259
|
-
return /* @__PURE__ */
|
|
5861
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4260
5862
|
ToolbarWrapper,
|
|
4261
5863
|
{
|
|
4262
5864
|
id,
|
|
@@ -4276,7 +5878,7 @@ var Toolbar = (props) => {
|
|
|
4276
5878
|
};
|
|
4277
5879
|
Toolbar.displayName = "Toolbar";
|
|
4278
5880
|
var ToolbarRoot = ({ children }) => {
|
|
4279
|
-
return /* @__PURE__ */
|
|
5881
|
+
return /* @__PURE__ */ React42.createElement(ToolbarProvider, null, children);
|
|
4280
5882
|
};
|
|
4281
5883
|
ToolbarRoot.displayName = "Toolbar.Root";
|
|
4282
5884
|
var ToolbarTrigger = (props) => {
|
|
@@ -4294,7 +5896,7 @@ var ToolbarTrigger = (props) => {
|
|
|
4294
5896
|
if (onClick) onClick(event);
|
|
4295
5897
|
if (toggleToolbar) toggleToolbar(!states.expanded);
|
|
4296
5898
|
};
|
|
4297
|
-
return /* @__PURE__ */
|
|
5899
|
+
return /* @__PURE__ */ React42.createElement(ToolbarTriggerWrapper, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React42.createElement(
|
|
4298
5900
|
Button,
|
|
4299
5901
|
{
|
|
4300
5902
|
id: `${id}-trigger`,
|
|
@@ -4312,13 +5914,13 @@ var ToolbarSection = (props) => {
|
|
|
4312
5914
|
const { showoncollapse, children, ...restProps } = props;
|
|
4313
5915
|
const { states } = useToolbar();
|
|
4314
5916
|
const { expanded } = states;
|
|
4315
|
-
if (showoncollapse) return /* @__PURE__ */
|
|
4316
|
-
return /* @__PURE__ */
|
|
5917
|
+
if (showoncollapse) return /* @__PURE__ */ React42.createElement("section", { ...restProps }, children);
|
|
5918
|
+
return /* @__PURE__ */ React42.createElement("section", { ...restProps }, expanded && children);
|
|
4317
5919
|
};
|
|
4318
5920
|
ToolbarSection.displayName = "Toolbar.Section";
|
|
4319
5921
|
var ToolbarItem = (props) => {
|
|
4320
5922
|
const { showfirstchild, onClick, children, ...restProps } = props;
|
|
4321
|
-
const childArray =
|
|
5923
|
+
const childArray = React42.Children.toArray(children);
|
|
4322
5924
|
const { id, states, methods } = useToolbar();
|
|
4323
5925
|
const { expanded } = states;
|
|
4324
5926
|
const { toggleToolbar } = methods;
|
|
@@ -4327,7 +5929,7 @@ var ToolbarItem = (props) => {
|
|
|
4327
5929
|
if (onClick) onClick(event);
|
|
4328
5930
|
if (toggleToolbar && !expanded) toggleToolbar(true);
|
|
4329
5931
|
};
|
|
4330
|
-
return /* @__PURE__ */
|
|
5932
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4331
5933
|
"div",
|
|
4332
5934
|
{
|
|
4333
5935
|
tabIndex: -1,
|
|
@@ -4348,11 +5950,11 @@ Toolbar.Item = ToolbarItem;
|
|
|
4348
5950
|
Toolbar.Section = ToolbarSection;
|
|
4349
5951
|
|
|
4350
5952
|
// src/tooltip/index.tsx
|
|
4351
|
-
import
|
|
5953
|
+
import React43 from "react";
|
|
4352
5954
|
|
|
4353
5955
|
// src/tooltip/styles/index.ts
|
|
4354
|
-
import
|
|
4355
|
-
var
|
|
5956
|
+
import styled26, { keyframes as keyframes4 } from "styled-components";
|
|
5957
|
+
var FadeIn = keyframes4`
|
|
4356
5958
|
0% {
|
|
4357
5959
|
opacity: 0;
|
|
4358
5960
|
}
|
|
@@ -4360,11 +5962,11 @@ var FadeIn2 = keyframes5`
|
|
|
4360
5962
|
opacity: 1;
|
|
4361
5963
|
}
|
|
4362
5964
|
`;
|
|
4363
|
-
var ContentBox =
|
|
5965
|
+
var ContentBox = styled26.div`
|
|
4364
5966
|
display: inline-block;
|
|
4365
5967
|
position: relative;
|
|
4366
5968
|
`;
|
|
4367
|
-
var ContentWrapper2 =
|
|
5969
|
+
var ContentWrapper2 = styled26.span`
|
|
4368
5970
|
&[data-raw="false"] {
|
|
4369
5971
|
width: fit-content;
|
|
4370
5972
|
max-width: var(--measurement-large-60);
|
|
@@ -4383,7 +5985,7 @@ var ContentWrapper2 = styled27.span`
|
|
|
4383
5985
|
font-size: var(--fontsize-medium-10);
|
|
4384
5986
|
z-index: var(--depth-default-100);
|
|
4385
5987
|
animation-duration: 0.2s;
|
|
4386
|
-
animation-name: ${
|
|
5988
|
+
animation-name: ${FadeIn};
|
|
4387
5989
|
animation-fill-mode: backwards;
|
|
4388
5990
|
}
|
|
4389
5991
|
`;
|
|
@@ -4395,13 +5997,13 @@ var Tooltip = ({
|
|
|
4395
5997
|
children,
|
|
4396
5998
|
...restProps
|
|
4397
5999
|
}) => {
|
|
4398
|
-
const [visible, setVisible] =
|
|
4399
|
-
const [triggerProps, setTriggerProps] =
|
|
4400
|
-
const [contentProps, setContentProps] =
|
|
4401
|
-
const mounted =
|
|
4402
|
-
const containerRef =
|
|
4403
|
-
const contentRef =
|
|
4404
|
-
const timeoutRef =
|
|
6000
|
+
const [visible, setVisible] = React43.useState(false);
|
|
6001
|
+
const [triggerProps, setTriggerProps] = React43.useState(null);
|
|
6002
|
+
const [contentProps, setContentProps] = React43.useState(null);
|
|
6003
|
+
const mounted = React43.useRef(false);
|
|
6004
|
+
const containerRef = React43.useRef(null);
|
|
6005
|
+
const contentRef = React43.useRef(null);
|
|
6006
|
+
const timeoutRef = React43.useRef(null);
|
|
4405
6007
|
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
4406
6008
|
const bodyRect = () => {
|
|
4407
6009
|
if (typeof document !== "undefined") {
|
|
@@ -4425,14 +6027,14 @@ var Tooltip = ({
|
|
|
4425
6027
|
};
|
|
4426
6028
|
const hasEnoughHorizontalSpace = Number(dimensions.body_width) - Number(dimensions.content_left) > Number(dimensions.content_width) * 1.1;
|
|
4427
6029
|
const hasEnoughVerticalSpace = Number(dimensions.body_height) - Number(dimensions.content_bottom) > Number(dimensions.content_height) * 0.9;
|
|
4428
|
-
const showTooltip =
|
|
6030
|
+
const showTooltip = React43.useCallback(() => {
|
|
4429
6031
|
timeoutRef.current = setTimeout(() => setVisible(true), delay);
|
|
4430
6032
|
}, [delay]);
|
|
4431
|
-
const hideTooltip =
|
|
6033
|
+
const hideTooltip = React43.useCallback(() => {
|
|
4432
6034
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4433
6035
|
setVisible(false);
|
|
4434
6036
|
}, []);
|
|
4435
|
-
const handleMouseEnter =
|
|
6037
|
+
const handleMouseEnter = React43.useCallback(() => {
|
|
4436
6038
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
4437
6039
|
if (rect) {
|
|
4438
6040
|
setTriggerProps({
|
|
@@ -4446,11 +6048,11 @@ var Tooltip = ({
|
|
|
4446
6048
|
showTooltip();
|
|
4447
6049
|
}
|
|
4448
6050
|
}, [showTooltip]);
|
|
4449
|
-
const handleMouseLeave =
|
|
6051
|
+
const handleMouseLeave = React43.useCallback(
|
|
4450
6052
|
() => hideTooltip(),
|
|
4451
6053
|
[hideTooltip]
|
|
4452
6054
|
);
|
|
4453
|
-
|
|
6055
|
+
React43.useEffect(() => {
|
|
4454
6056
|
mounted.current = true;
|
|
4455
6057
|
setContentProps && setContentProps({
|
|
4456
6058
|
top: Number(contentRect()?.top),
|
|
@@ -4464,7 +6066,7 @@ var Tooltip = ({
|
|
|
4464
6066
|
mounted.current = false;
|
|
4465
6067
|
};
|
|
4466
6068
|
}, [visible]);
|
|
4467
|
-
return /* @__PURE__ */
|
|
6069
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4468
6070
|
ContentBox,
|
|
4469
6071
|
{
|
|
4470
6072
|
ref: containerRef,
|
|
@@ -4474,7 +6076,7 @@ var Tooltip = ({
|
|
|
4474
6076
|
...restProps
|
|
4475
6077
|
},
|
|
4476
6078
|
children,
|
|
4477
|
-
visible && /* @__PURE__ */
|
|
6079
|
+
visible && /* @__PURE__ */ React43.createElement(
|
|
4478
6080
|
ContentWrapper2,
|
|
4479
6081
|
{
|
|
4480
6082
|
ref: contentRef,
|
|
@@ -4489,17 +6091,17 @@ var Tooltip = ({
|
|
|
4489
6091
|
"data-side": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
|
|
4490
6092
|
"data-align": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */
|
|
4491
6093
|
},
|
|
4492
|
-
/* @__PURE__ */
|
|
6094
|
+
/* @__PURE__ */ React43.createElement("div", null, content)
|
|
4493
6095
|
)
|
|
4494
6096
|
);
|
|
4495
6097
|
};
|
|
4496
6098
|
Tooltip.displayName = "Tooltip";
|
|
4497
6099
|
|
|
4498
6100
|
// src/tree/index.tsx
|
|
4499
|
-
import
|
|
6101
|
+
import React46 from "react";
|
|
4500
6102
|
|
|
4501
6103
|
// src/tree/hooks/tree-provider.tsx
|
|
4502
|
-
import
|
|
6104
|
+
import React44, { useState as useState10, createContext as createContext10, useContext as useContext10 } from "react";
|
|
4503
6105
|
var defaultTreeAPI = {
|
|
4504
6106
|
id: "",
|
|
4505
6107
|
states: {},
|
|
@@ -4516,13 +6118,13 @@ var TreeProvider = ({
|
|
|
4516
6118
|
defaultExpandedIds,
|
|
4517
6119
|
onSelectionChange
|
|
4518
6120
|
});
|
|
4519
|
-
return /* @__PURE__ */
|
|
6121
|
+
return /* @__PURE__ */ React44.createElement(TreeContext.Provider, { value: context }, children);
|
|
4520
6122
|
};
|
|
4521
6123
|
function useTreeProviderContext({
|
|
4522
6124
|
defaultExpandedIds,
|
|
4523
6125
|
onSelectionChange
|
|
4524
6126
|
}) {
|
|
4525
|
-
const treeId =
|
|
6127
|
+
const treeId = React44.useId();
|
|
4526
6128
|
const [expandedIds, setExpandedIds] = useState10(
|
|
4527
6129
|
() => new Set(defaultExpandedIds)
|
|
4528
6130
|
);
|
|
@@ -4557,7 +6159,7 @@ function useTreeProviderContext({
|
|
|
4557
6159
|
}
|
|
4558
6160
|
|
|
4559
6161
|
// src/tree/hooks/tree-node-provider.tsx
|
|
4560
|
-
import
|
|
6162
|
+
import React45, { createContext as createContext11, useContext as useContext11 } from "react";
|
|
4561
6163
|
var defaultTreeNodeAPI = {
|
|
4562
6164
|
id: "",
|
|
4563
6165
|
states: {},
|
|
@@ -4572,7 +6174,7 @@ var TreeNodeProvider = ({
|
|
|
4572
6174
|
isLast
|
|
4573
6175
|
}) => {
|
|
4574
6176
|
const context = useTreeNodeProviderContext({ nodeId, level, isLast });
|
|
4575
|
-
return /* @__PURE__ */
|
|
6177
|
+
return /* @__PURE__ */ React45.createElement(TreeNodeContext.Provider, { value: context }, children);
|
|
4576
6178
|
};
|
|
4577
6179
|
function useTreeNodeProviderContext({
|
|
4578
6180
|
nodeId,
|
|
@@ -4591,20 +6193,20 @@ function useTreeNodeProviderContext({
|
|
|
4591
6193
|
}
|
|
4592
6194
|
|
|
4593
6195
|
// src/tree/styles/index.ts
|
|
4594
|
-
import
|
|
4595
|
-
var TreeView =
|
|
6196
|
+
import styled27 from "styled-components";
|
|
6197
|
+
var TreeView = styled27.ul`
|
|
4596
6198
|
display: flex;
|
|
4597
6199
|
flex-direction: column;
|
|
4598
6200
|
list-style: none;
|
|
4599
6201
|
margin: 0;
|
|
4600
6202
|
padding: 0;
|
|
4601
6203
|
`;
|
|
4602
|
-
var TreeItem =
|
|
6204
|
+
var TreeItem = styled27.li`
|
|
4603
6205
|
display: flex;
|
|
4604
6206
|
flex-direction: column;
|
|
4605
6207
|
list-style: none;
|
|
4606
6208
|
`;
|
|
4607
|
-
var TreeNodeContent =
|
|
6209
|
+
var TreeNodeContent = styled27.ul`
|
|
4608
6210
|
display: flex;
|
|
4609
6211
|
flex-direction: column;
|
|
4610
6212
|
list-style: none;
|
|
@@ -4616,7 +6218,7 @@ var TreeNodeContent = styled28.ul`
|
|
|
4616
6218
|
var Tree = (props) => {
|
|
4617
6219
|
const { children, ...restProps } = props;
|
|
4618
6220
|
const { id } = useTree();
|
|
4619
|
-
return /* @__PURE__ */
|
|
6221
|
+
return /* @__PURE__ */ React46.createElement(TreeView, { id, role: "tree", ...restProps }, children);
|
|
4620
6222
|
};
|
|
4621
6223
|
Tree.displayName = "Tree";
|
|
4622
6224
|
var TreeRoot = ({
|
|
@@ -4624,7 +6226,7 @@ var TreeRoot = ({
|
|
|
4624
6226
|
defaultExpandedIds,
|
|
4625
6227
|
onSelectionChange
|
|
4626
6228
|
}) => {
|
|
4627
|
-
return /* @__PURE__ */
|
|
6229
|
+
return /* @__PURE__ */ React46.createElement(
|
|
4628
6230
|
TreeProvider,
|
|
4629
6231
|
{
|
|
4630
6232
|
defaultExpandedIds,
|
|
@@ -4636,7 +6238,7 @@ var TreeRoot = ({
|
|
|
4636
6238
|
TreeRoot.displayName = "Tree.Root";
|
|
4637
6239
|
var TreeNode = (props) => {
|
|
4638
6240
|
const { nodeId, level = 0, isLast = false, children, ...restProps } = props;
|
|
4639
|
-
return /* @__PURE__ */
|
|
6241
|
+
return /* @__PURE__ */ React46.createElement(TreeNodeProvider, { nodeId, level, isLast }, /* @__PURE__ */ React46.createElement(TreeItem, { role: "treeitem", "aria-level": level + 1, ...restProps }, children));
|
|
4640
6242
|
};
|
|
4641
6243
|
TreeNode.displayName = "Tree.Node";
|
|
4642
6244
|
var TreeTrigger = (props) => {
|
|
@@ -4658,7 +6260,7 @@ var TreeTrigger = (props) => {
|
|
|
4658
6260
|
toggleSelected && toggleSelected(nodeId);
|
|
4659
6261
|
}
|
|
4660
6262
|
};
|
|
4661
|
-
return /* @__PURE__ */
|
|
6263
|
+
return /* @__PURE__ */ React46.createElement(
|
|
4662
6264
|
Button,
|
|
4663
6265
|
{
|
|
4664
6266
|
id: String(IdHandler.trigger),
|
|
@@ -4684,11 +6286,11 @@ var TreeContent = (props) => {
|
|
|
4684
6286
|
trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
|
|
4685
6287
|
content: getTreeId && getTreeId({ nodeId, type: "content" })
|
|
4686
6288
|
};
|
|
4687
|
-
|
|
6289
|
+
React46.useEffect(() => {
|
|
4688
6290
|
if (defaultOpen && !isExpanded && toggleExpanded) toggleExpanded(nodeId);
|
|
4689
6291
|
}, []);
|
|
4690
6292
|
if (isExpanded)
|
|
4691
|
-
return /* @__PURE__ */
|
|
6293
|
+
return /* @__PURE__ */ React46.createElement(
|
|
4692
6294
|
TreeNodeContent,
|
|
4693
6295
|
{
|
|
4694
6296
|
role: "group",
|
|
@@ -4699,13 +6301,410 @@ var TreeContent = (props) => {
|
|
|
4699
6301
|
},
|
|
4700
6302
|
children
|
|
4701
6303
|
);
|
|
4702
|
-
return /* @__PURE__ */
|
|
6304
|
+
return /* @__PURE__ */ React46.createElement(React46.Fragment, null);
|
|
4703
6305
|
};
|
|
4704
6306
|
TreeContent.displayName = "Tree.Content";
|
|
4705
6307
|
Tree.Root = TreeRoot;
|
|
4706
6308
|
Tree.Node = TreeNode;
|
|
4707
6309
|
Tree.Trigger = TreeTrigger;
|
|
4708
6310
|
Tree.Content = TreeContent;
|
|
6311
|
+
|
|
6312
|
+
// src/select/index.tsx
|
|
6313
|
+
import React48 from "react";
|
|
6314
|
+
|
|
6315
|
+
// src/select/hooks/index.tsx
|
|
6316
|
+
import React47 from "react";
|
|
6317
|
+
var defaultComponentAPI10 = {
|
|
6318
|
+
id: "",
|
|
6319
|
+
states: {},
|
|
6320
|
+
methods: {}
|
|
6321
|
+
};
|
|
6322
|
+
var SelectContext = React47.createContext(defaultComponentAPI10);
|
|
6323
|
+
var useSelect = () => React47.useContext(SelectContext);
|
|
6324
|
+
var SelectProvider = ({
|
|
6325
|
+
children
|
|
6326
|
+
}) => {
|
|
6327
|
+
const context = useSelectProvider();
|
|
6328
|
+
return /* @__PURE__ */ React47.createElement(SelectContext.Provider, { value: context }, children);
|
|
6329
|
+
};
|
|
6330
|
+
function useSelectProvider() {
|
|
6331
|
+
const DEFAULT_POSITIONS2 = {
|
|
6332
|
+
top: 0,
|
|
6333
|
+
right: 0,
|
|
6334
|
+
bottom: 0,
|
|
6335
|
+
left: 0
|
|
6336
|
+
};
|
|
6337
|
+
const DEFAULT_DIMENSIONS2 = {
|
|
6338
|
+
width: 0,
|
|
6339
|
+
height: 0
|
|
6340
|
+
};
|
|
6341
|
+
const [open, setOpen] = React47.useState(false);
|
|
6342
|
+
const [value, setValue] = React47.useState(null);
|
|
6343
|
+
const [label, setLabel] = React47.useState("");
|
|
6344
|
+
const [contentProps, setContentProps] = React47.useState({
|
|
6345
|
+
...DEFAULT_POSITIONS2,
|
|
6346
|
+
...DEFAULT_DIMENSIONS2
|
|
6347
|
+
});
|
|
6348
|
+
const [triggerProps, setTriggerProps] = React47.useState({
|
|
6349
|
+
...DEFAULT_POSITIONS2,
|
|
6350
|
+
...DEFAULT_DIMENSIONS2
|
|
6351
|
+
});
|
|
6352
|
+
const triggerId = React47.useId();
|
|
6353
|
+
const listboxId = React47.useId();
|
|
6354
|
+
const composedId = `${triggerId}|${listboxId}`;
|
|
6355
|
+
return {
|
|
6356
|
+
id: composedId,
|
|
6357
|
+
states: {
|
|
6358
|
+
open,
|
|
6359
|
+
value,
|
|
6360
|
+
label,
|
|
6361
|
+
contentProps,
|
|
6362
|
+
triggerProps
|
|
6363
|
+
},
|
|
6364
|
+
methods: {
|
|
6365
|
+
toggleOpen: () => setOpen(!open),
|
|
6366
|
+
setOpen,
|
|
6367
|
+
setValue,
|
|
6368
|
+
setLabel,
|
|
6369
|
+
setContentProps,
|
|
6370
|
+
setTriggerProps
|
|
6371
|
+
}
|
|
6372
|
+
};
|
|
6373
|
+
}
|
|
6374
|
+
|
|
6375
|
+
// src/select/styles/index.tsx
|
|
6376
|
+
import styled28 from "styled-components";
|
|
6377
|
+
var Wrapper = styled28.div`
|
|
6378
|
+
position: relative;
|
|
6379
|
+
width: 100%;
|
|
6380
|
+
`;
|
|
6381
|
+
var Trigger = styled28.button`
|
|
6382
|
+
all: unset;
|
|
6383
|
+
box-sizing: border-box;
|
|
6384
|
+
|
|
6385
|
+
position: relative;
|
|
6386
|
+
display: flex;
|
|
6387
|
+
align-items: center;
|
|
6388
|
+
justify-content: space-between;
|
|
6389
|
+
gap: var(--measurement-medium-10);
|
|
6390
|
+
|
|
6391
|
+
${FieldDefaultStyles}
|
|
6392
|
+
${FieldVariantsStyles}
|
|
6393
|
+
${FieldShapeStyles}
|
|
6394
|
+
${FieldSizeStyles}
|
|
6395
|
+
|
|
6396
|
+
|
|
6397
|
+
cursor: pointer !important;
|
|
6398
|
+
`;
|
|
6399
|
+
var Label2 = styled28.span`
|
|
6400
|
+
flex: 1;
|
|
6401
|
+
text-align: left;
|
|
6402
|
+
font-weight: 400;
|
|
6403
|
+
white-space: nowrap;
|
|
6404
|
+
overflow: hidden;
|
|
6405
|
+
text-overflow: ellipsis;
|
|
6406
|
+
`;
|
|
6407
|
+
var Content = styled28.ul`
|
|
6408
|
+
@keyframes select-slide-in-down {
|
|
6409
|
+
0% {
|
|
6410
|
+
opacity: 0;
|
|
6411
|
+
transform: translateY(calc(var(--measurement-small-60) * -1));
|
|
6412
|
+
}
|
|
6413
|
+
100% {
|
|
6414
|
+
opacity: 1;
|
|
6415
|
+
transform: translateY(0);
|
|
6416
|
+
}
|
|
6417
|
+
}
|
|
6418
|
+
|
|
6419
|
+
@keyframes select-slide-in-up {
|
|
6420
|
+
0% {
|
|
6421
|
+
opacity: 0;
|
|
6422
|
+
transform: translateY(var(--measurement-small-60));
|
|
6423
|
+
}
|
|
6424
|
+
100% {
|
|
6425
|
+
opacity: 1;
|
|
6426
|
+
transform: translateY(0);
|
|
6427
|
+
}
|
|
6428
|
+
}
|
|
6429
|
+
|
|
6430
|
+
&[data-raw="false"] {
|
|
6431
|
+
position: fixed;
|
|
6432
|
+
margin: 0;
|
|
6433
|
+
box-sizing: border-box;
|
|
6434
|
+
|
|
6435
|
+
padding: var(--measurement-medium-30);
|
|
6436
|
+
|
|
6437
|
+
list-style: none;
|
|
6438
|
+
|
|
6439
|
+
background-color: var(--body-color);
|
|
6440
|
+
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
6441
|
+
border-radius: var(--measurement-medium-30);
|
|
6442
|
+
|
|
6443
|
+
z-index: var(--depth-default-100);
|
|
6444
|
+
|
|
6445
|
+
height: auto;
|
|
6446
|
+
max-height: var(--measurement-large-90);
|
|
6447
|
+
overflow-y: auto;
|
|
6448
|
+
|
|
6449
|
+
animation-duration: 0.2s;
|
|
6450
|
+
animation-fill-mode: backwards;
|
|
6451
|
+
|
|
6452
|
+
&[data-side="bottom"] {
|
|
6453
|
+
animation-name: select-slide-in-down;
|
|
6454
|
+
}
|
|
6455
|
+
|
|
6456
|
+
&[data-side="top"] {
|
|
6457
|
+
animation-name: select-slide-in-up;
|
|
6458
|
+
}
|
|
6459
|
+
}
|
|
6460
|
+
`;
|
|
6461
|
+
var List = styled28.li`
|
|
6462
|
+
list-style: none;
|
|
6463
|
+
padding: 0;
|
|
6464
|
+
margin: 0;
|
|
6465
|
+
user-select: none;
|
|
6466
|
+
|
|
6467
|
+
&[data-raw="false"] {
|
|
6468
|
+
display: flex;
|
|
6469
|
+
align-items: center;
|
|
6470
|
+
justify-content: space-between;
|
|
6471
|
+
gap: var(--measurement-medium-10);
|
|
6472
|
+
|
|
6473
|
+
padding: var(--measurement-medium-30);
|
|
6474
|
+
border-radius: var(--measurement-medium-20);
|
|
6475
|
+
|
|
6476
|
+
text-align: left;
|
|
6477
|
+
|
|
6478
|
+
color: var(--font-color);
|
|
6479
|
+
|
|
6480
|
+
outline: none;
|
|
6481
|
+
cursor: pointer;
|
|
6482
|
+
|
|
6483
|
+
transition: all ease-in-out 0.2s;
|
|
6484
|
+
|
|
6485
|
+
&:hover,
|
|
6486
|
+
&:focus,
|
|
6487
|
+
&:active,
|
|
6488
|
+
&:focus-within,
|
|
6489
|
+
&:has(:active) {
|
|
6490
|
+
background-color: var(--contrast-color);
|
|
6491
|
+
}
|
|
6492
|
+
|
|
6493
|
+
&[data-selected="true"] {
|
|
6494
|
+
color: var(--font-color);
|
|
6495
|
+
background-color: var(--contrast-color);
|
|
6496
|
+
|
|
6497
|
+
&:hover,
|
|
6498
|
+
&:focus,
|
|
6499
|
+
&:active {
|
|
6500
|
+
background-color: var(--font-color-alpha-10);
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6503
|
+
}
|
|
6504
|
+
|
|
6505
|
+
&[aria-disabled="true"] {
|
|
6506
|
+
cursor: not-allowed;
|
|
6507
|
+
opacity: 0.6;
|
|
6508
|
+
}
|
|
6509
|
+
`;
|
|
6510
|
+
var Item = styled28.span`
|
|
6511
|
+
display: flex;
|
|
6512
|
+
align-items: center;
|
|
6513
|
+
gap: var(--measurement-small-60);
|
|
6514
|
+
flex: 1;
|
|
6515
|
+
white-space: nowrap;
|
|
6516
|
+
overflow: hidden;
|
|
6517
|
+
text-overflow: ellipsis;
|
|
6518
|
+
`;
|
|
6519
|
+
|
|
6520
|
+
// src/select/index.tsx
|
|
6521
|
+
var SelectRoot = ({ children }) => {
|
|
6522
|
+
return /* @__PURE__ */ React48.createElement(SelectProvider, null, children);
|
|
6523
|
+
};
|
|
6524
|
+
SelectRoot.displayName = "Select.Root";
|
|
6525
|
+
var Select = ({ children }) => {
|
|
6526
|
+
const selectRef = React48.useRef(null);
|
|
6527
|
+
const { states, methods } = useSelect();
|
|
6528
|
+
const handleClickOutside = () => {
|
|
6529
|
+
if (states.open && methods.setOpen) {
|
|
6530
|
+
methods.setOpen(false);
|
|
6531
|
+
}
|
|
6532
|
+
};
|
|
6533
|
+
useClickOutside(
|
|
6534
|
+
selectRef,
|
|
6535
|
+
handleClickOutside
|
|
6536
|
+
);
|
|
6537
|
+
return /* @__PURE__ */ React48.createElement(Wrapper, { ref: selectRef }, children);
|
|
6538
|
+
};
|
|
6539
|
+
Select.displayName = "Select";
|
|
6540
|
+
var SelectTrigger = (props) => {
|
|
6541
|
+
const {
|
|
6542
|
+
raw,
|
|
6543
|
+
variant,
|
|
6544
|
+
shape,
|
|
6545
|
+
sizing,
|
|
6546
|
+
error = false,
|
|
6547
|
+
disabled,
|
|
6548
|
+
children,
|
|
6549
|
+
...restProps
|
|
6550
|
+
} = props;
|
|
6551
|
+
const triggerRef = React48.useRef(null);
|
|
6552
|
+
const triggerRect = () => triggerRef.current?.getBoundingClientRect();
|
|
6553
|
+
const { id, states, methods } = useSelect();
|
|
6554
|
+
const { toggleOpen, setTriggerProps } = methods;
|
|
6555
|
+
const handleClick = () => {
|
|
6556
|
+
if (disabled) return;
|
|
6557
|
+
if (toggleOpen) toggleOpen();
|
|
6558
|
+
if (setTriggerProps) {
|
|
6559
|
+
setTriggerProps({
|
|
6560
|
+
top: Number(triggerRect()?.top),
|
|
6561
|
+
right: Number(triggerRect()?.right),
|
|
6562
|
+
bottom: Number(triggerRect()?.bottom),
|
|
6563
|
+
left: Number(triggerRect()?.left),
|
|
6564
|
+
width: Number(triggerRect()?.width),
|
|
6565
|
+
height: Number(triggerRect()?.height)
|
|
6566
|
+
});
|
|
6567
|
+
}
|
|
6568
|
+
};
|
|
6569
|
+
return /* @__PURE__ */ React48.createElement(
|
|
6570
|
+
Trigger,
|
|
6571
|
+
{
|
|
6572
|
+
ref: triggerRef,
|
|
6573
|
+
type: "button",
|
|
6574
|
+
role: "combobox",
|
|
6575
|
+
id: id.split("|").at(0),
|
|
6576
|
+
onClick: handleClick,
|
|
6577
|
+
"aria-haspopup": "listbox",
|
|
6578
|
+
"aria-expanded": Boolean(states.open),
|
|
6579
|
+
"aria-controls": id.split("|").at(-1),
|
|
6580
|
+
"data-state": states.open ? "open" : "closed",
|
|
6581
|
+
"data-variant": variant ?? "secondary" /* Secondary */,
|
|
6582
|
+
"data-shape": shape ?? "smooth" /* Smooth */,
|
|
6583
|
+
"data-size": sizing ?? "medium" /* Medium */,
|
|
6584
|
+
"data-error": error,
|
|
6585
|
+
"data-raw": Boolean(raw),
|
|
6586
|
+
disabled,
|
|
6587
|
+
...restProps
|
|
6588
|
+
},
|
|
6589
|
+
/* @__PURE__ */ React48.createElement(Label2, null, children)
|
|
6590
|
+
);
|
|
6591
|
+
};
|
|
6592
|
+
SelectTrigger.displayName = "Select.Trigger";
|
|
6593
|
+
var SelectContent = (props) => {
|
|
6594
|
+
const { raw, defaultOpen, children, ...restProps } = props;
|
|
6595
|
+
const { id, states, methods } = useSelect();
|
|
6596
|
+
const { toggleOpen, setContentProps } = methods;
|
|
6597
|
+
const mounted = React48.useRef(false);
|
|
6598
|
+
const contentRef = React48.useRef(null);
|
|
6599
|
+
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
6600
|
+
const bodyRect = () => {
|
|
6601
|
+
if (typeof document !== "undefined") {
|
|
6602
|
+
return document?.body?.getBoundingClientRect();
|
|
6603
|
+
}
|
|
6604
|
+
return void 0;
|
|
6605
|
+
};
|
|
6606
|
+
const positions = {
|
|
6607
|
+
btt: `calc((${states?.triggerProps?.top}px - ${states?.contentProps?.height}px) - (var(--measurement-medium-10) * 2))`,
|
|
6608
|
+
ttb: `calc((${states?.triggerProps?.top}px + ${states?.triggerProps?.height}px) + var(--measurement-medium-10))`
|
|
6609
|
+
};
|
|
6610
|
+
const dimensions = {
|
|
6611
|
+
body_height: bodyRect()?.height ?? 0,
|
|
6612
|
+
content_height: states.contentProps.height,
|
|
6613
|
+
content_bottom: states.contentProps.bottom
|
|
6614
|
+
};
|
|
6615
|
+
const hasEnoughVerticalSpace = dimensions.body_height - dimensions.content_bottom > dimensions.content_height - dimensions.content_height * 0.9;
|
|
6616
|
+
React48.useEffect(() => {
|
|
6617
|
+
if (defaultOpen && toggleOpen) toggleOpen();
|
|
6618
|
+
}, []);
|
|
6619
|
+
React48.useEffect(() => {
|
|
6620
|
+
mounted.current = true;
|
|
6621
|
+
if (setContentProps) {
|
|
6622
|
+
setContentProps({
|
|
6623
|
+
top: Number(contentRect()?.top),
|
|
6624
|
+
right: Number(contentRect()?.right),
|
|
6625
|
+
bottom: Number(contentRect()?.bottom),
|
|
6626
|
+
left: Number(contentRect()?.left),
|
|
6627
|
+
width: Number(contentRect()?.width),
|
|
6628
|
+
height: Number(contentRect()?.height)
|
|
6629
|
+
});
|
|
6630
|
+
}
|
|
6631
|
+
return () => {
|
|
6632
|
+
mounted.current = false;
|
|
6633
|
+
};
|
|
6634
|
+
}, [states.open]);
|
|
6635
|
+
React48.useEffect(() => {
|
|
6636
|
+
if (!states.open) return;
|
|
6637
|
+
const handleKeyDown = (event) => {
|
|
6638
|
+
if (event.key === "Escape" && methods.setOpen) {
|
|
6639
|
+
methods.setOpen(false);
|
|
6640
|
+
}
|
|
6641
|
+
};
|
|
6642
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
6643
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
6644
|
+
}, [states.open]);
|
|
6645
|
+
if (!states.open) return null;
|
|
6646
|
+
return /* @__PURE__ */ React48.createElement(
|
|
6647
|
+
ScrollArea,
|
|
6648
|
+
{
|
|
6649
|
+
scrollbar: true,
|
|
6650
|
+
as: Content,
|
|
6651
|
+
ref: contentRef,
|
|
6652
|
+
id: id.split("|").at(-1),
|
|
6653
|
+
role: "listbox",
|
|
6654
|
+
tabIndex: -1,
|
|
6655
|
+
"aria-labelledby": id.split("|").at(0),
|
|
6656
|
+
"data-state": applyDataState(Boolean(states.open)),
|
|
6657
|
+
"data-side": hasEnoughVerticalSpace ? "bottom" : "top",
|
|
6658
|
+
"data-raw": Boolean(raw),
|
|
6659
|
+
style: {
|
|
6660
|
+
top: hasEnoughVerticalSpace ? positions.ttb : positions.btt,
|
|
6661
|
+
left: `${states?.triggerProps?.left}px`,
|
|
6662
|
+
width: `${states?.triggerProps?.width}px`
|
|
6663
|
+
},
|
|
6664
|
+
...restProps
|
|
6665
|
+
},
|
|
6666
|
+
children
|
|
6667
|
+
);
|
|
6668
|
+
};
|
|
6669
|
+
SelectContent.displayName = "Select.Content";
|
|
6670
|
+
var SelectItem = (props) => {
|
|
6671
|
+
const { raw, value, disabled, onClick, children, ...restProps } = props;
|
|
6672
|
+
const { states, methods } = useSelect();
|
|
6673
|
+
const isSelected = states?.value === value;
|
|
6674
|
+
const handleSelect = (event) => {
|
|
6675
|
+
if (disabled) return;
|
|
6676
|
+
if (methods.setValue) methods.setValue(value);
|
|
6677
|
+
if (methods.setOpen) methods.setOpen(false);
|
|
6678
|
+
if (onClick) onClick(event);
|
|
6679
|
+
};
|
|
6680
|
+
const handleKeyDown = (event) => {
|
|
6681
|
+
if (["Space", "Enter"].includes(event.code || event.key) && !disabled) {
|
|
6682
|
+
event.preventDefault();
|
|
6683
|
+
handleSelect(event);
|
|
6684
|
+
}
|
|
6685
|
+
};
|
|
6686
|
+
return /* @__PURE__ */ React48.createElement(
|
|
6687
|
+
List,
|
|
6688
|
+
{
|
|
6689
|
+
role: "option",
|
|
6690
|
+
tabIndex: 0,
|
|
6691
|
+
"aria-disabled": disabled,
|
|
6692
|
+
"aria-selected": isSelected,
|
|
6693
|
+
"data-orientation": "vertical",
|
|
6694
|
+
"data-selected": isSelected,
|
|
6695
|
+
"data-raw": Boolean(raw),
|
|
6696
|
+
onClick: handleSelect,
|
|
6697
|
+
onKeyDown: handleKeyDown,
|
|
6698
|
+
...restProps
|
|
6699
|
+
},
|
|
6700
|
+
/* @__PURE__ */ React48.createElement(Item, null, children)
|
|
6701
|
+
);
|
|
6702
|
+
};
|
|
6703
|
+
SelectItem.displayName = "Select.Item";
|
|
6704
|
+
Select.Root = SelectRoot;
|
|
6705
|
+
Select.Trigger = SelectTrigger;
|
|
6706
|
+
Select.Content = SelectContent;
|
|
6707
|
+
Select.Item = SelectItem;
|
|
4709
6708
|
export {
|
|
4710
6709
|
Accordion,
|
|
4711
6710
|
AccordionContent,
|
|
@@ -4713,6 +6712,7 @@ export {
|
|
|
4713
6712
|
AccordionTrigger,
|
|
4714
6713
|
AvataStatusEnum,
|
|
4715
6714
|
Avatar,
|
|
6715
|
+
AvatarStatus,
|
|
4716
6716
|
Badge,
|
|
4717
6717
|
Breadcrumb,
|
|
4718
6718
|
BreadcrumbItem,
|
|
@@ -4743,9 +6743,14 @@ export {
|
|
|
4743
6743
|
DropdownMenuRoot,
|
|
4744
6744
|
DropdownMenuTrigger,
|
|
4745
6745
|
Field,
|
|
6746
|
+
FieldDate,
|
|
6747
|
+
FieldFile,
|
|
4746
6748
|
FieldLabel,
|
|
4747
6749
|
FieldMeta,
|
|
6750
|
+
FieldNumber,
|
|
6751
|
+
FieldPassword,
|
|
4748
6752
|
FieldRoot,
|
|
6753
|
+
FieldTag,
|
|
4749
6754
|
FieldWrapper,
|
|
4750
6755
|
MessageBubble,
|
|
4751
6756
|
MessageBubbleContent,
|
|
@@ -4763,9 +6768,13 @@ export {
|
|
|
4763
6768
|
PageTools,
|
|
4764
6769
|
PageWrapper,
|
|
4765
6770
|
Portal,
|
|
4766
|
-
PrivacyField,
|
|
4767
6771
|
Resizable,
|
|
4768
6772
|
ScrollArea,
|
|
6773
|
+
Select,
|
|
6774
|
+
SelectContent,
|
|
6775
|
+
SelectItem,
|
|
6776
|
+
SelectRoot,
|
|
6777
|
+
SelectTrigger,
|
|
4769
6778
|
Sheet,
|
|
4770
6779
|
SheetRoot,
|
|
4771
6780
|
SheetTrigger,
|
|
@@ -4806,6 +6815,7 @@ export {
|
|
|
4806
6815
|
useDropdownMenu,
|
|
4807
6816
|
useField,
|
|
4808
6817
|
useMessageBubble,
|
|
6818
|
+
useSelect,
|
|
4809
6819
|
useSheet,
|
|
4810
6820
|
useSwitch,
|
|
4811
6821
|
useTabs,
|