@szum-tech/design-system 3.8.0 → 3.8.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/dist/{chunk-F3GJIJRL.cjs → chunk-3Z3GVXXN.cjs} +84 -51
- package/dist/chunk-E5TYGWGE.js +176 -0
- package/dist/{chunk-3SDAJSY6.js → chunk-SZ3LC2VO.js} +81 -48
- package/dist/chunk-XJZOANXX.cjs +183 -0
- package/dist/components/alert/index.cjs +0 -1
- package/dist/components/alert/index.js +0 -1
- package/dist/components/alert-dialog/index.cjs +0 -1
- package/dist/components/alert-dialog/index.js +0 -1
- package/dist/components/avatar/index.cjs +0 -1
- package/dist/components/avatar/index.js +0 -1
- package/dist/components/badge/index.cjs +0 -1
- package/dist/components/badge/index.js +0 -1
- package/dist/components/button/index.cjs +5 -6
- package/dist/components/button/index.js +4 -5
- package/dist/components/card/index.cjs +0 -1
- package/dist/components/card/index.js +0 -1
- package/dist/components/checkbox/index.cjs +0 -1
- package/dist/components/checkbox/index.js +0 -1
- package/dist/components/color-swatch/index.cjs +0 -1
- package/dist/components/color-swatch/index.js +0 -1
- package/dist/components/dialog/index.cjs +0 -1
- package/dist/components/dialog/index.js +0 -1
- package/dist/components/empty/index.cjs +0 -1
- package/dist/components/empty/index.js +0 -1
- package/dist/components/field/index.cjs +0 -1
- package/dist/components/field/index.js +0 -1
- package/dist/components/header/index.cjs +0 -1
- package/dist/components/header/index.js +0 -1
- package/dist/components/index.cjs +36 -37
- package/dist/components/index.d.cts +0 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +4 -5
- package/dist/components/input/index.cjs +0 -1
- package/dist/components/input/index.js +0 -1
- package/dist/components/item/index.cjs +0 -1
- package/dist/components/item/index.js +0 -1
- package/dist/components/label/index.cjs +0 -1
- package/dist/components/label/index.js +0 -1
- package/dist/components/progress/index.cjs +0 -1
- package/dist/components/progress/index.js +0 -1
- package/dist/components/radio-group/index.cjs +0 -1
- package/dist/components/radio-group/index.js +0 -1
- package/dist/components/scroll-area/index.cjs +0 -1
- package/dist/components/scroll-area/index.js +0 -1
- package/dist/components/select/index.cjs +7 -8
- package/dist/components/select/index.d.cts +1 -2
- package/dist/components/select/index.d.ts +1 -2
- package/dist/components/select/index.js +1 -2
- package/dist/components/separator/index.cjs +0 -1
- package/dist/components/separator/index.js +0 -1
- package/dist/components/sheet/index.cjs +0 -1
- package/dist/components/sheet/index.js +0 -1
- package/dist/components/spinner/index.cjs +0 -1
- package/dist/components/spinner/index.js +0 -1
- package/dist/components/stepper/index.cjs +23 -24
- package/dist/components/stepper/index.js +4 -5
- package/dist/components/textarea/index.cjs +0 -1
- package/dist/components/textarea/index.js +0 -1
- package/dist/components/toaster/index.cjs +6 -7
- package/dist/components/toaster/index.js +4 -5
- package/dist/components/tooltip/index.cjs +0 -1
- package/dist/components/tooltip/index.js +0 -1
- package/dist/contexts/index.cjs +0 -1
- package/dist/contexts/index.js +0 -1
- package/dist/hooks/index.cjs +0 -1
- package/dist/hooks/index.js +0 -1
- package/dist/icons/index.cjs +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.js +0 -1
- package/package.json +1 -1
- package/dist/chunk-3376ZTRC.cjs +0 -2
- package/dist/chunk-3ZRMIVJM.cjs +0 -4934
- package/dist/chunk-BYXBJQAS.js +0 -1
- package/dist/chunk-O7QFYWMK.js +0 -4907
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk3WSQRFUY_cjs = require('./chunk-3WSQRFUY.cjs');
|
|
4
|
-
var chunk3ZRMIVJM_cjs = require('./chunk-3ZRMIVJM.cjs');
|
|
5
|
-
var chunk7EYMOUWG_cjs = require('./chunk-7EYMOUWG.cjs');
|
|
6
4
|
var chunkEW6TE3N5_cjs = require('./chunk-EW6TE3N5.cjs');
|
|
5
|
+
var chunk7EYMOUWG_cjs = require('./chunk-7EYMOUWG.cjs');
|
|
7
6
|
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
8
|
-
var
|
|
7
|
+
var React6 = require('react');
|
|
9
8
|
var reactSlot = require('@radix-ui/react-slot');
|
|
10
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
10
|
var lucideReact = require('lucide-react');
|
|
@@ -30,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
30
29
|
return Object.freeze(n);
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
var
|
|
32
|
+
var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
|
|
34
33
|
|
|
35
34
|
// src/components/stepper/stepper.constants.ts
|
|
36
35
|
var STEPPER_ROOT_NAME = "Stepper";
|
|
@@ -58,9 +57,9 @@ var STEPPER_MAP_KEY_TO_FOCUS_INTENT = {
|
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
// src/components/stepper/stepper.context.tsx
|
|
61
|
-
var StepperContext =
|
|
60
|
+
var StepperContext = React6__namespace.createContext(null);
|
|
62
61
|
function useStepperContext(consumerName) {
|
|
63
|
-
const context =
|
|
62
|
+
const context = React6__namespace.useContext(StepperContext);
|
|
64
63
|
if (!context) {
|
|
65
64
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
66
65
|
}
|
|
@@ -150,9 +149,9 @@ function createStepperStore(listenersRef, stateRef, onValueChange, onValueComple
|
|
|
150
149
|
};
|
|
151
150
|
return store;
|
|
152
151
|
}
|
|
153
|
-
var StepperStoreContext =
|
|
152
|
+
var StepperStoreContext = React6__namespace.createContext(null);
|
|
154
153
|
function useStepperStoreContext(consumerName) {
|
|
155
|
-
const context =
|
|
154
|
+
const context = React6__namespace.useContext(StepperStoreContext);
|
|
156
155
|
if (!context) {
|
|
157
156
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
158
157
|
}
|
|
@@ -160,8 +159,8 @@ function useStepperStoreContext(consumerName) {
|
|
|
160
159
|
}
|
|
161
160
|
function useStepperStore(selector) {
|
|
162
161
|
const store = useStepperStoreContext("useStore");
|
|
163
|
-
const getSnapshot =
|
|
164
|
-
return
|
|
162
|
+
const getSnapshot = React6__namespace.useCallback(() => selector(store.getState()), [selector, store]);
|
|
163
|
+
return React6__namespace.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
165
164
|
}
|
|
166
165
|
function Stepper({
|
|
167
166
|
value,
|
|
@@ -183,14 +182,14 @@ function Stepper({
|
|
|
183
182
|
indicators = {},
|
|
184
183
|
...rootProps
|
|
185
184
|
}) {
|
|
186
|
-
const id =
|
|
185
|
+
const id = React6__namespace.useId();
|
|
187
186
|
const rootId = idProp ?? id;
|
|
188
187
|
const listenersRef = chunk7EYMOUWG_cjs.useLazyRef(() => /* @__PURE__ */ new Set());
|
|
189
188
|
const stateRef = chunk7EYMOUWG_cjs.useLazyRef(() => ({
|
|
190
189
|
steps: /* @__PURE__ */ new Map(),
|
|
191
190
|
value: value ?? defaultValue
|
|
192
191
|
}));
|
|
193
|
-
const store =
|
|
192
|
+
const store = React6__namespace.useMemo(
|
|
194
193
|
() => createStepperStore(listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate),
|
|
195
194
|
[listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate]
|
|
196
195
|
);
|
|
@@ -200,7 +199,7 @@ function Stepper({
|
|
|
200
199
|
}
|
|
201
200
|
}, [value]);
|
|
202
201
|
const dir = chunkEW6TE3N5_cjs.useDirection(dirProp);
|
|
203
|
-
const contextValue =
|
|
202
|
+
const contextValue = React6__namespace.useMemo(
|
|
204
203
|
() => ({
|
|
205
204
|
id: rootId,
|
|
206
205
|
dir,
|
|
@@ -252,14 +251,48 @@ var StepperDataState = {
|
|
|
252
251
|
ACTIVE: "active",
|
|
253
252
|
COMPLETED: "completed"
|
|
254
253
|
};
|
|
255
|
-
var StepperFocusContext =
|
|
254
|
+
var StepperFocusContext = React6__namespace.createContext(null);
|
|
256
255
|
function useStepperFocusContext(consumerName) {
|
|
257
|
-
const context =
|
|
256
|
+
const context = React6__namespace.useContext(StepperFocusContext);
|
|
258
257
|
if (!context) {
|
|
259
258
|
throw new Error(`\`${consumerName}\` must be used within \`FocusProvider\``);
|
|
260
259
|
}
|
|
261
260
|
return context;
|
|
262
261
|
}
|
|
262
|
+
function setRef(ref, value) {
|
|
263
|
+
if (typeof ref === "function") {
|
|
264
|
+
return ref(value);
|
|
265
|
+
} else if (ref !== null && ref !== void 0) {
|
|
266
|
+
ref.current = value;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function composeRefs(...refs) {
|
|
270
|
+
return (node) => {
|
|
271
|
+
let hasCleanup = false;
|
|
272
|
+
const cleanups = refs.map((ref) => {
|
|
273
|
+
const cleanup = setRef(ref, node);
|
|
274
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
275
|
+
hasCleanup = true;
|
|
276
|
+
}
|
|
277
|
+
return cleanup;
|
|
278
|
+
});
|
|
279
|
+
if (hasCleanup) {
|
|
280
|
+
return () => {
|
|
281
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
282
|
+
const cleanup = cleanups[i];
|
|
283
|
+
if (typeof cleanup == "function") {
|
|
284
|
+
cleanup();
|
|
285
|
+
} else {
|
|
286
|
+
setRef(refs[i], null);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function useComposedRefs(...refs) {
|
|
294
|
+
return React6__namespace.useCallback(composeRefs(...refs), refs);
|
|
295
|
+
}
|
|
263
296
|
|
|
264
297
|
// src/components/stepper/stepper.utils.tsx
|
|
265
298
|
function focusFirst(candidates, preventScroll = false) {
|
|
@@ -309,32 +342,32 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
309
342
|
const context = useStepperContext(STEPPER_NAV_NAME);
|
|
310
343
|
const orientation = context.orientation;
|
|
311
344
|
const currentValue = useStepperStore((state) => state.value);
|
|
312
|
-
const [tabStopId, setTabStopId] =
|
|
313
|
-
const [isTabbingBackOut, setIsTabbingBackOut] =
|
|
314
|
-
const [focusableItemCount, setFocusableItemCount] =
|
|
315
|
-
const isClickFocusRef =
|
|
316
|
-
const itemsRef =
|
|
317
|
-
const listRef =
|
|
318
|
-
const composedRef =
|
|
319
|
-
const onItemFocus =
|
|
345
|
+
const [tabStopId, setTabStopId] = React6__namespace.useState(null);
|
|
346
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React6__namespace.useState(false);
|
|
347
|
+
const [focusableItemCount, setFocusableItemCount] = React6__namespace.useState(0);
|
|
348
|
+
const isClickFocusRef = React6__namespace.useRef(false);
|
|
349
|
+
const itemsRef = React6__namespace.useRef(/* @__PURE__ */ new Map());
|
|
350
|
+
const listRef = React6__namespace.useRef(null);
|
|
351
|
+
const composedRef = useComposedRefs(ref, listRef);
|
|
352
|
+
const onItemFocus = React6__namespace.useCallback((tabStopId2) => {
|
|
320
353
|
setTabStopId(tabStopId2);
|
|
321
354
|
}, []);
|
|
322
|
-
const onItemShiftTab =
|
|
355
|
+
const onItemShiftTab = React6__namespace.useCallback(() => {
|
|
323
356
|
setIsTabbingBackOut(true);
|
|
324
357
|
}, []);
|
|
325
|
-
const onFocusableItemAdd =
|
|
358
|
+
const onFocusableItemAdd = React6__namespace.useCallback(() => {
|
|
326
359
|
setFocusableItemCount((prevCount) => prevCount + 1);
|
|
327
360
|
}, []);
|
|
328
|
-
const onFocusableItemRemove =
|
|
361
|
+
const onFocusableItemRemove = React6__namespace.useCallback(() => {
|
|
329
362
|
setFocusableItemCount((prevCount) => prevCount - 1);
|
|
330
363
|
}, []);
|
|
331
|
-
const onItemRegister =
|
|
364
|
+
const onItemRegister = React6__namespace.useCallback((item) => {
|
|
332
365
|
itemsRef.current.set(item.id, item);
|
|
333
366
|
}, []);
|
|
334
|
-
const onItemUnregister =
|
|
367
|
+
const onItemUnregister = React6__namespace.useCallback((id) => {
|
|
335
368
|
itemsRef.current.delete(id);
|
|
336
369
|
}, []);
|
|
337
|
-
const getItems =
|
|
370
|
+
const getItems = React6__namespace.useCallback(() => {
|
|
338
371
|
return Array.from(itemsRef.current.values()).filter((item) => item.ref.current).sort((a, b) => {
|
|
339
372
|
const elementA = a.ref.current;
|
|
340
373
|
const elementB = b.ref.current;
|
|
@@ -349,7 +382,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
349
382
|
return 0;
|
|
350
383
|
});
|
|
351
384
|
}, []);
|
|
352
|
-
const onBlur =
|
|
385
|
+
const onBlur = React6__namespace.useCallback(
|
|
353
386
|
(event) => {
|
|
354
387
|
listProps.onBlur?.(event);
|
|
355
388
|
if (event.defaultPrevented) return;
|
|
@@ -357,7 +390,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
357
390
|
},
|
|
358
391
|
[listProps.onBlur]
|
|
359
392
|
);
|
|
360
|
-
const onFocus =
|
|
393
|
+
const onFocus = React6__namespace.useCallback(
|
|
361
394
|
(event) => {
|
|
362
395
|
listProps.onFocus?.(event);
|
|
363
396
|
if (event.defaultPrevented) return;
|
|
@@ -382,7 +415,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
382
415
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
383
416
|
[listProps.onFocus, isTabbingBackOut, currentValue, tabStopId]
|
|
384
417
|
);
|
|
385
|
-
const onMouseDown =
|
|
418
|
+
const onMouseDown = React6__namespace.useCallback(
|
|
386
419
|
(event) => {
|
|
387
420
|
listProps.onMouseDown?.(event);
|
|
388
421
|
if (event.defaultPrevented) return;
|
|
@@ -391,7 +424,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
391
424
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
392
425
|
[listProps.onMouseDown]
|
|
393
426
|
);
|
|
394
|
-
const focusContextValue =
|
|
427
|
+
const focusContextValue = React6__namespace.useMemo(
|
|
395
428
|
() => ({
|
|
396
429
|
tabStopId,
|
|
397
430
|
onItemFocus,
|
|
@@ -437,9 +470,9 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
437
470
|
}
|
|
438
471
|
) });
|
|
439
472
|
}
|
|
440
|
-
var StepperItemContext =
|
|
473
|
+
var StepperItemContext = React6__namespace.createContext(null);
|
|
441
474
|
function useStepperItemContext(consumerName) {
|
|
442
|
-
const context =
|
|
475
|
+
const context = React6__namespace.useContext(StepperItemContext);
|
|
443
476
|
if (!context) {
|
|
444
477
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ITEM_NAME}\``);
|
|
445
478
|
}
|
|
@@ -470,7 +503,7 @@ function StepperItem({
|
|
|
470
503
|
const stepState = useStepperStore((state) => state.steps.get(itemValue));
|
|
471
504
|
const steps = useStepperStore((state) => state.steps);
|
|
472
505
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
473
|
-
const itemContextValue =
|
|
506
|
+
const itemContextValue = React6__namespace.useMemo(
|
|
474
507
|
() => ({
|
|
475
508
|
value: itemValue,
|
|
476
509
|
stepState
|
|
@@ -532,11 +565,11 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
532
565
|
const isActive = value === itemValue;
|
|
533
566
|
const isTabStop = focusContext.tabStopId === triggerId;
|
|
534
567
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
535
|
-
const triggerRef =
|
|
536
|
-
const composedRef =
|
|
537
|
-
const isArrowKeyPressedRef =
|
|
538
|
-
const isMouseClickRef =
|
|
539
|
-
|
|
568
|
+
const triggerRef = React6__namespace.useRef(null);
|
|
569
|
+
const composedRef = useComposedRefs(ref, triggerRef);
|
|
570
|
+
const isArrowKeyPressedRef = React6__namespace.useRef(false);
|
|
571
|
+
const isMouseClickRef = React6__namespace.useRef(false);
|
|
572
|
+
React6__namespace.useEffect(() => {
|
|
540
573
|
function onKeyDown2(event) {
|
|
541
574
|
if (STEPPER_ARROW_KEYS.includes(event.key)) {
|
|
542
575
|
isArrowKeyPressedRef.current = true;
|
|
@@ -570,7 +603,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
570
603
|
}
|
|
571
604
|
};
|
|
572
605
|
}, [focusContext, triggerId, itemValue, isTabStop, isDisabled]);
|
|
573
|
-
const onClick =
|
|
606
|
+
const onClick = React6__namespace.useCallback(
|
|
574
607
|
async (event) => {
|
|
575
608
|
triggerProps.onClick?.(event);
|
|
576
609
|
if (event.defaultPrevented) return;
|
|
@@ -584,7 +617,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
584
617
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
585
618
|
[isDisabled, context.nonInteractive, store, itemValue, value, steps, triggerProps.onClick]
|
|
586
619
|
);
|
|
587
|
-
const onFocus =
|
|
620
|
+
const onFocus = React6__namespace.useCallback(
|
|
588
621
|
async (event) => {
|
|
589
622
|
triggerProps.onFocus?.(event);
|
|
590
623
|
if (event.defaultPrevented) return;
|
|
@@ -612,7 +645,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
612
645
|
store
|
|
613
646
|
]
|
|
614
647
|
);
|
|
615
|
-
const onKeyDown =
|
|
648
|
+
const onKeyDown = React6__namespace.useCallback(
|
|
616
649
|
async (event) => {
|
|
617
650
|
triggerProps.onKeyDown?.(event);
|
|
618
651
|
if (event.defaultPrevented) return;
|
|
@@ -681,7 +714,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
681
714
|
steps
|
|
682
715
|
]
|
|
683
716
|
);
|
|
684
|
-
const onMouseDown =
|
|
717
|
+
const onMouseDown = React6__namespace.useCallback(
|
|
685
718
|
(event) => {
|
|
686
719
|
triggerProps.onMouseDown?.(event);
|
|
687
720
|
if (event.defaultPrevented) {
|
|
@@ -842,7 +875,7 @@ function StepperNextTrigger({ asChild = false, onClick, disabled, ...props }) {
|
|
|
842
875
|
const stepKeys = Array.from(steps.keys());
|
|
843
876
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
844
877
|
const isDisabled = disabled || currentIndex >= stepKeys.length - 1;
|
|
845
|
-
const handleClick =
|
|
878
|
+
const handleClick = React6__namespace.useCallback(
|
|
846
879
|
async (event) => {
|
|
847
880
|
onClick?.(event);
|
|
848
881
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -875,7 +908,7 @@ function StepperPrevTrigger({ asChild = false, disabled, onClick, ...props }) {
|
|
|
875
908
|
const stepKeys = Array.from(steps.keys());
|
|
876
909
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
877
910
|
const isDisabled = disabled || currentIndex <= 0;
|
|
878
|
-
const handleClick =
|
|
911
|
+
const handleClick = React6__namespace.useCallback(
|
|
879
912
|
async (event) => {
|
|
880
913
|
onClick?.(event);
|
|
881
914
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -1022,15 +1055,15 @@ function ButtonContent({
|
|
|
1022
1055
|
const isEndLoading = loading && loadingPosition === "end";
|
|
1023
1056
|
const EndIcon = isEndLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : endIcon || null;
|
|
1024
1057
|
const isCenterLoading = loading && loadingPosition === "center";
|
|
1025
|
-
return asChild &&
|
|
1058
|
+
return asChild && React6__namespace.isValidElement(children) ? React6__namespace.cloneElement(
|
|
1026
1059
|
children,
|
|
1027
1060
|
props,
|
|
1028
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1061
|
+
/* @__PURE__ */ jsxRuntime.jsxs(React6__namespace.Fragment, { children: [
|
|
1029
1062
|
StartIcon,
|
|
1030
|
-
isCenterLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) :
|
|
1063
|
+
isCenterLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : React6__namespace.isValidElement(children) ? children.props?.children : null,
|
|
1031
1064
|
EndIcon
|
|
1032
1065
|
] })
|
|
1033
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1066
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(React6__namespace.Fragment, { children: [
|
|
1034
1067
|
StartIcon,
|
|
1035
1068
|
isCenterLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : children,
|
|
1036
1069
|
EndIcon
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { cn } from './chunk-ZD2QRAOX.js';
|
|
2
|
+
import { ChevronDownIcon, ChevronUpIcon, CheckIcon } from 'lucide-react';
|
|
3
|
+
import { Select as Select$1 } from 'radix-ui';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Select({
|
|
7
|
+
children,
|
|
8
|
+
disabled,
|
|
9
|
+
defaultOpen,
|
|
10
|
+
defaultValue,
|
|
11
|
+
value,
|
|
12
|
+
dir,
|
|
13
|
+
open,
|
|
14
|
+
form,
|
|
15
|
+
name,
|
|
16
|
+
onOpenChange,
|
|
17
|
+
onValueChange,
|
|
18
|
+
required,
|
|
19
|
+
autoComplete,
|
|
20
|
+
// value props
|
|
21
|
+
placeholder,
|
|
22
|
+
// trigger props
|
|
23
|
+
className,
|
|
24
|
+
size = "default",
|
|
25
|
+
invalid = false,
|
|
26
|
+
...triggerProps
|
|
27
|
+
}) {
|
|
28
|
+
const rootProps = {
|
|
29
|
+
children,
|
|
30
|
+
disabled,
|
|
31
|
+
defaultOpen,
|
|
32
|
+
defaultValue,
|
|
33
|
+
value,
|
|
34
|
+
dir,
|
|
35
|
+
open,
|
|
36
|
+
form,
|
|
37
|
+
name,
|
|
38
|
+
onOpenChange,
|
|
39
|
+
onValueChange,
|
|
40
|
+
required,
|
|
41
|
+
autoComplete
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ jsxs(Select$1.Root, { "data-slot": "select", ...rootProps, children: [
|
|
44
|
+
/* @__PURE__ */ jsxs(
|
|
45
|
+
Select$1.Trigger,
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "select-trigger",
|
|
48
|
+
"aria-invalid": triggerProps["aria-invalid"] || invalid ? true : void 0,
|
|
49
|
+
"data-size": size,
|
|
50
|
+
className: cn(
|
|
51
|
+
"border-input dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none",
|
|
52
|
+
"*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
|
|
53
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
54
|
+
"aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error",
|
|
55
|
+
"data-[size=default]:h-9 data-[size=sm]:h-8",
|
|
56
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
57
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
58
|
+
"data-[placeholder]:text-muted-foreground",
|
|
59
|
+
className
|
|
60
|
+
),
|
|
61
|
+
...triggerProps,
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsx(Select$1.Value, { "data-slot": "select-value", placeholder }),
|
|
64
|
+
/* @__PURE__ */ jsx(Select$1.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
children
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
function SelectContent({
|
|
72
|
+
className,
|
|
73
|
+
children,
|
|
74
|
+
position = "popper",
|
|
75
|
+
align = "center",
|
|
76
|
+
...props
|
|
77
|
+
}) {
|
|
78
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsxs(
|
|
79
|
+
Select$1.Content,
|
|
80
|
+
{
|
|
81
|
+
"data-slot": "select-content",
|
|
82
|
+
className: cn(
|
|
83
|
+
"bg-popover text-popover-foreground border-border relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded border shadow-sm",
|
|
84
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
85
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
86
|
+
className
|
|
87
|
+
),
|
|
88
|
+
position,
|
|
89
|
+
align,
|
|
90
|
+
...props,
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
Select$1.Viewport,
|
|
95
|
+
{
|
|
96
|
+
className: cn(
|
|
97
|
+
"p-1",
|
|
98
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
99
|
+
),
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
) });
|
|
107
|
+
}
|
|
108
|
+
function SelectScrollUpButton({ className, ...props }) {
|
|
109
|
+
return /* @__PURE__ */ jsx(
|
|
110
|
+
Select$1.ScrollUpButton,
|
|
111
|
+
{
|
|
112
|
+
"data-slot": "select-scroll-up-button",
|
|
113
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
114
|
+
...props,
|
|
115
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function SelectScrollDownButton({
|
|
120
|
+
className,
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
Select$1.ScrollDownButton,
|
|
125
|
+
{
|
|
126
|
+
"data-slot": "select-scroll-down-button",
|
|
127
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
128
|
+
...props,
|
|
129
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function SelectGroup(props) {
|
|
134
|
+
return /* @__PURE__ */ jsx(Select$1.Group, { "data-slot": "select-group", ...props });
|
|
135
|
+
}
|
|
136
|
+
function SelectItem({ className, children, ...props }) {
|
|
137
|
+
return /* @__PURE__ */ jsxs(
|
|
138
|
+
Select$1.Item,
|
|
139
|
+
{
|
|
140
|
+
"data-slot": "select-item",
|
|
141
|
+
className: cn(
|
|
142
|
+
"focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
143
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
144
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
145
|
+
className
|
|
146
|
+
),
|
|
147
|
+
...props,
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
|
|
150
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, { children })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
function SelectLabel({ className, ...props }) {
|
|
156
|
+
return /* @__PURE__ */ jsx(
|
|
157
|
+
Select$1.Label,
|
|
158
|
+
{
|
|
159
|
+
"data-slot": "select-label",
|
|
160
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
161
|
+
...props
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function SelectSeparator({ className, ...props }) {
|
|
166
|
+
return /* @__PURE__ */ jsx(
|
|
167
|
+
Select$1.Separator,
|
|
168
|
+
{
|
|
169
|
+
"data-slot": "select-separator",
|
|
170
|
+
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
171
|
+
...props
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator };
|