@bestow-ui/react 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +285 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +256 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +85 -2
- package/dist/index.d.ts +85 -2
- package/dist/index.js +287 -65
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -36,9 +36,12 @@ __export(index_exports, {
|
|
|
36
36
|
Input: () => Input,
|
|
37
37
|
Modal: () => Modal,
|
|
38
38
|
ModalClose: () => ModalClose,
|
|
39
|
+
RadioGroup: () => RadioGroup,
|
|
39
40
|
Select: () => Select,
|
|
40
41
|
Stack: () => Stack,
|
|
42
|
+
Switch: () => Switch,
|
|
41
43
|
TextField: () => TextField,
|
|
44
|
+
Textarea: () => Textarea,
|
|
42
45
|
ThemeProvider: () => ThemeProvider,
|
|
43
46
|
ToastProvider: () => ToastProvider,
|
|
44
47
|
Tooltip: () => Tooltip,
|
|
@@ -311,7 +314,7 @@ var root2 = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1
|
|
|
311
314
|
|
|
312
315
|
// src/components/Checkbox/Checkbox.tsx
|
|
313
316
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
314
|
-
var Checkbox = (0, import_react3.forwardRef)(function Checkbox2({ label:
|
|
317
|
+
var Checkbox = (0, import_react3.forwardRef)(function Checkbox2({ label: label3, size, indeterminate = false, invalid, disabled, className, ...rest }, ref) {
|
|
315
318
|
const innerRef = (0, import_react3.useRef)(null);
|
|
316
319
|
(0, import_react3.useEffect)(() => {
|
|
317
320
|
if (innerRef.current) innerRef.current.indeterminate = indeterminate;
|
|
@@ -332,7 +335,7 @@ var Checkbox = (0, import_react3.forwardRef)(function Checkbox2({ label: label2,
|
|
|
332
335
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: checkIcon, viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 10.5l3.2 3L15 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
333
336
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: indeterminateIcon, viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6 10h8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })
|
|
334
337
|
] }),
|
|
335
|
-
|
|
338
|
+
label3
|
|
336
339
|
] });
|
|
337
340
|
});
|
|
338
341
|
|
|
@@ -380,13 +383,13 @@ var Input = (0, import_react4.forwardRef)(function Input2({ size, invalid, fullW
|
|
|
380
383
|
// src/components/Input/TextField.tsx
|
|
381
384
|
var import_react5 = require("react");
|
|
382
385
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
383
|
-
var TextField = (0, import_react5.forwardRef)(function TextField2({ label:
|
|
386
|
+
var TextField = (0, import_react5.forwardRef)(function TextField2({ label: label3, helperText: helperText2, error, required, fullWidth, id, "aria-describedby": ariaDescribedBy, ...rest }, ref) {
|
|
384
387
|
const generatedId = (0, import_react5.useId)();
|
|
385
388
|
const inputId = id ?? generatedId;
|
|
386
389
|
const helperId = helperText2 ? `${inputId}-helper` : void 0;
|
|
387
390
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
388
|
-
|
|
389
|
-
|
|
391
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: inputId, className: label, children: [
|
|
392
|
+
label3,
|
|
390
393
|
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
391
394
|
] }),
|
|
392
395
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -429,9 +432,9 @@ function Modal({
|
|
|
429
432
|
onOpenChange,
|
|
430
433
|
trigger: trigger2,
|
|
431
434
|
title: title3,
|
|
432
|
-
description:
|
|
435
|
+
description: description4,
|
|
433
436
|
children,
|
|
434
|
-
footer:
|
|
437
|
+
footer: footer3,
|
|
435
438
|
size,
|
|
436
439
|
hideCloseButton = false,
|
|
437
440
|
closeOnOverlayClick = true,
|
|
@@ -448,17 +451,17 @@ function Modal({
|
|
|
448
451
|
className: cx(portal2.className, content({ size }), className),
|
|
449
452
|
style: portal2.style,
|
|
450
453
|
onPointerDownOutside: closeOnOverlayClick ? void 0 : (event) => event.preventDefault(),
|
|
451
|
-
...
|
|
454
|
+
...description4 ? {} : { "aria-describedby": void 0 },
|
|
452
455
|
children: [
|
|
453
456
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: header, children: [
|
|
454
457
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: headings, children: [
|
|
455
458
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog.Title, { className: title, children: title3 }),
|
|
456
|
-
|
|
459
|
+
description4 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog.Description, { className: description, children: description4 })
|
|
457
460
|
] }),
|
|
458
461
|
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog.Close, { className: closeButton, "aria-label": "\uB2EB\uAE30", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons.XIcon, { size: 16 }) })
|
|
459
462
|
] }),
|
|
460
463
|
children && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: body, children }),
|
|
461
|
-
|
|
464
|
+
footer3 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: footer, children: footer3 })
|
|
462
465
|
]
|
|
463
466
|
}
|
|
464
467
|
)
|
|
@@ -467,9 +470,99 @@ function Modal({
|
|
|
467
470
|
}
|
|
468
471
|
var ModalClose = Dialog.Close;
|
|
469
472
|
|
|
473
|
+
// src/components/RadioGroup/RadioGroup.tsx
|
|
474
|
+
var RadixRadioGroup = __toESM(require("@radix-ui/react-radio-group"), 1);
|
|
475
|
+
var import_react6 = require("react");
|
|
476
|
+
|
|
477
|
+
// src/components/RadioGroup/RadioGroup.css.ts
|
|
478
|
+
var import_createRuntimeFn5 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
479
|
+
var description2 = "_1w9iwjmd";
|
|
480
|
+
var groupLabel = "_1w9iwjme";
|
|
481
|
+
var indicator = "_1w9iwjma";
|
|
482
|
+
var items = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "_1w9iwjm0", variantClassNames: { orientation: { vertical: "_1w9iwjm1", horizontal: "_1w9iwjm2" } }, defaultVariants: { orientation: "vertical" }, compoundVariants: [] });
|
|
483
|
+
var labelText = "_1w9iwjmc";
|
|
484
|
+
var option = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "_1w9iwjm3", variantClassNames: { size: { sm: "_1w9iwjm4", md: "_1w9iwjm5" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
485
|
+
var radio = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "_1w9iwjm7", variantClassNames: { size: { sm: "_1w9iwjm8", md: "_1w9iwjm9" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
486
|
+
var text = "_1w9iwjmb";
|
|
487
|
+
|
|
488
|
+
// src/components/RadioGroup/RadioGroup.tsx
|
|
489
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
490
|
+
var RadioGroup = (0, import_react6.forwardRef)(function RadioGroup2(props, ref) {
|
|
491
|
+
const {
|
|
492
|
+
options,
|
|
493
|
+
value: value2,
|
|
494
|
+
defaultValue,
|
|
495
|
+
onValueChange,
|
|
496
|
+
label: label3,
|
|
497
|
+
helperText: helperText2,
|
|
498
|
+
error,
|
|
499
|
+
orientation = "vertical",
|
|
500
|
+
size,
|
|
501
|
+
disabled,
|
|
502
|
+
required,
|
|
503
|
+
name,
|
|
504
|
+
id,
|
|
505
|
+
"aria-label": ariaLabel,
|
|
506
|
+
className
|
|
507
|
+
} = props;
|
|
508
|
+
const isControlled = "value" in props;
|
|
509
|
+
const generatedId = (0, import_react6.useId)();
|
|
510
|
+
const baseId = id ?? generatedId;
|
|
511
|
+
const labelId = label3 ? `${baseId}-label` : void 0;
|
|
512
|
+
const helperId = helperText2 ? `${baseId}-helper` : void 0;
|
|
513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cx(field, className), children: [
|
|
514
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { id: labelId, className: cx(label, groupLabel), children: [
|
|
515
|
+
label3,
|
|
516
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
517
|
+
] }),
|
|
518
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
519
|
+
RadixRadioGroup.Root,
|
|
520
|
+
{
|
|
521
|
+
ref,
|
|
522
|
+
id: baseId,
|
|
523
|
+
value: isControlled ? value2 ?? "" : void 0,
|
|
524
|
+
defaultValue,
|
|
525
|
+
onValueChange,
|
|
526
|
+
orientation,
|
|
527
|
+
disabled,
|
|
528
|
+
required,
|
|
529
|
+
name,
|
|
530
|
+
"aria-label": ariaLabel,
|
|
531
|
+
"aria-labelledby": labelId,
|
|
532
|
+
"aria-describedby": helperId,
|
|
533
|
+
"aria-invalid": error || void 0,
|
|
534
|
+
className: items({ orientation }),
|
|
535
|
+
children: options.map((option2) => {
|
|
536
|
+
const itemId = `${baseId}-${option2.value}`;
|
|
537
|
+
const descriptionId = option2.description ? `${itemId}-description` : void 0;
|
|
538
|
+
const itemDisabled = disabled || option2.disabled;
|
|
539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: option({ size }), "data-disabled": itemDisabled || void 0, children: [
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
541
|
+
RadixRadioGroup.Item,
|
|
542
|
+
{
|
|
543
|
+
id: itemId,
|
|
544
|
+
value: option2.value,
|
|
545
|
+
disabled: option2.disabled,
|
|
546
|
+
"aria-describedby": descriptionId,
|
|
547
|
+
className: radio({ size }),
|
|
548
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RadixRadioGroup.Indicator, { className: indicator })
|
|
549
|
+
}
|
|
550
|
+
),
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: text, children: [
|
|
552
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: itemId, className: labelText, children: option2.label }),
|
|
553
|
+
option2.description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: descriptionId, className: description2, children: option2.description })
|
|
554
|
+
] })
|
|
555
|
+
] }, option2.value);
|
|
556
|
+
})
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
helperText2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: helperId, className: helperText({ error }), children: helperText2 })
|
|
560
|
+
] });
|
|
561
|
+
});
|
|
562
|
+
|
|
470
563
|
// src/components/Select/Select.tsx
|
|
471
564
|
var RadixSelect = __toESM(require("@radix-ui/react-select"), 1);
|
|
472
|
-
var
|
|
565
|
+
var import_react7 = require("react");
|
|
473
566
|
var import_icons2 = require("@bestow-ui/icons");
|
|
474
567
|
|
|
475
568
|
// src/components/Select/Select.css.ts
|
|
@@ -482,15 +575,15 @@ var value = "_1kx81e81";
|
|
|
482
575
|
var viewport = "_1kx81e84";
|
|
483
576
|
|
|
484
577
|
// src/components/Select/Select.tsx
|
|
485
|
-
var
|
|
486
|
-
var Select = (0,
|
|
578
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
579
|
+
var Select = (0, import_react7.forwardRef)(function Select2(props, ref) {
|
|
487
580
|
const {
|
|
488
581
|
options,
|
|
489
582
|
value: value2,
|
|
490
583
|
defaultValue,
|
|
491
584
|
onValueChange,
|
|
492
585
|
placeholder,
|
|
493
|
-
label:
|
|
586
|
+
label: label3,
|
|
494
587
|
helperText: helperText2,
|
|
495
588
|
error,
|
|
496
589
|
size,
|
|
@@ -503,16 +596,16 @@ var Select = (0, import_react6.forwardRef)(function Select2(props, ref) {
|
|
|
503
596
|
className
|
|
504
597
|
} = props;
|
|
505
598
|
const isControlled = "value" in props;
|
|
506
|
-
const generatedId = (0,
|
|
599
|
+
const generatedId = (0, import_react7.useId)();
|
|
507
600
|
const triggerId = id ?? generatedId;
|
|
508
601
|
const helperId = helperText2 ? `${triggerId}-helper` : void 0;
|
|
509
602
|
const portal2 = usePortalProps();
|
|
510
|
-
return /* @__PURE__ */ (0,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
required && /* @__PURE__ */ (0,
|
|
603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
604
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { htmlFor: triggerId, className: label, children: [
|
|
605
|
+
label3,
|
|
606
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
514
607
|
] }),
|
|
515
|
-
/* @__PURE__ */ (0,
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
516
609
|
RadixSelect.Root,
|
|
517
610
|
{
|
|
518
611
|
value: isControlled ? value2 ?? "" : void 0,
|
|
@@ -522,7 +615,7 @@ var Select = (0, import_react6.forwardRef)(function Select2(props, ref) {
|
|
|
522
615
|
required,
|
|
523
616
|
name,
|
|
524
617
|
children: [
|
|
525
|
-
/* @__PURE__ */ (0,
|
|
618
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
526
619
|
RadixSelect.Trigger,
|
|
527
620
|
{
|
|
528
621
|
ref,
|
|
@@ -533,12 +626,12 @@ var Select = (0, import_react6.forwardRef)(function Select2(props, ref) {
|
|
|
533
626
|
"data-invalid": error || void 0,
|
|
534
627
|
className: cx(root3({ size, fullWidth }), trigger, className),
|
|
535
628
|
children: [
|
|
536
|
-
/* @__PURE__ */ (0,
|
|
537
|
-
/* @__PURE__ */ (0,
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: value, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadixSelect.Value, { placeholder }) }),
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadixSelect.Icon, { className: icon2, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.ChevronDownIcon, { size: 16 }) })
|
|
538
631
|
]
|
|
539
632
|
}
|
|
540
633
|
),
|
|
541
|
-
/* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadixSelect.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
542
635
|
RadixSelect.Content,
|
|
543
636
|
{
|
|
544
637
|
position: "popper",
|
|
@@ -546,39 +639,39 @@ var Select = (0, import_react6.forwardRef)(function Select2(props, ref) {
|
|
|
546
639
|
collisionPadding: 8,
|
|
547
640
|
className: cx(portal2.className, content2),
|
|
548
641
|
style: portal2.style,
|
|
549
|
-
children: /* @__PURE__ */ (0,
|
|
642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadixSelect.Viewport, { className: viewport, children: options.map((option2) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
550
643
|
RadixSelect.Item,
|
|
551
644
|
{
|
|
552
|
-
value:
|
|
553
|
-
disabled:
|
|
645
|
+
value: option2.value,
|
|
646
|
+
disabled: option2.disabled,
|
|
554
647
|
className: item,
|
|
555
648
|
children: [
|
|
556
|
-
/* @__PURE__ */ (0,
|
|
557
|
-
/* @__PURE__ */ (0,
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadixSelect.ItemText, { children: option2.label }),
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadixSelect.ItemIndicator, { className: itemIndicator, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.CheckIcon, { size: 16 }) })
|
|
558
651
|
]
|
|
559
652
|
},
|
|
560
|
-
|
|
653
|
+
option2.value
|
|
561
654
|
)) })
|
|
562
655
|
}
|
|
563
656
|
) })
|
|
564
657
|
]
|
|
565
658
|
}
|
|
566
659
|
),
|
|
567
|
-
helperText2 && /* @__PURE__ */ (0,
|
|
660
|
+
helperText2 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: helperId, className: helperText({ error }), children: helperText2 })
|
|
568
661
|
] });
|
|
569
662
|
});
|
|
570
663
|
|
|
571
664
|
// src/components/Stack/Stack.tsx
|
|
572
|
-
var
|
|
665
|
+
var import_react8 = require("react");
|
|
573
666
|
|
|
574
667
|
// src/components/Stack/Stack.css.ts
|
|
575
|
-
var
|
|
576
|
-
var stack = (0,
|
|
668
|
+
var import_createRuntimeFn6 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
669
|
+
var stack = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "_1jz9hj90", variantClassNames: { direction: { row: "_1jz9hj91", column: "_1jz9hj92", "row-reverse": "_1jz9hj93", "column-reverse": "_1jz9hj94" }, gap: { "0": "_1jz9hj95", "1": "_1jz9hj96", "2": "_1jz9hj97", "3": "_1jz9hj98", "4": "_1jz9hj99", "5": "_1jz9hj9a", "6": "_1jz9hj9b", "8": "_1jz9hj9c", "10": "_1jz9hj9d", "12": "_1jz9hj9e", "16": "_1jz9hj9f" }, align: { start: "_1jz9hj9g", center: "_1jz9hj9h", end: "_1jz9hj9i", stretch: "_1jz9hj9j", baseline: "_1jz9hj9k" }, justify: { start: "_1jz9hj9l", center: "_1jz9hj9m", end: "_1jz9hj9n", between: "_1jz9hj9o", around: "_1jz9hj9p", evenly: "_1jz9hj9q" }, wrap: { true: "_1jz9hj9r" } }, defaultVariants: { direction: "column" }, compoundVariants: [] });
|
|
577
670
|
|
|
578
671
|
// src/components/Stack/Stack.tsx
|
|
579
|
-
var
|
|
580
|
-
var Stack = (0,
|
|
581
|
-
return /* @__PURE__ */ (0,
|
|
672
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
673
|
+
var Stack = (0, import_react8.forwardRef)(function Stack2({ as: Component = "div", direction, gap, align, justify, wrap, className, ...rest }, ref) {
|
|
674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
582
675
|
Component,
|
|
583
676
|
{
|
|
584
677
|
ref,
|
|
@@ -588,42 +681,163 @@ var Stack = (0, import_react7.forwardRef)(function Stack2({ as: Component = "div
|
|
|
588
681
|
);
|
|
589
682
|
});
|
|
590
683
|
|
|
684
|
+
// src/components/Switch/Switch.tsx
|
|
685
|
+
var RadixSwitch = __toESM(require("@radix-ui/react-switch"), 1);
|
|
686
|
+
var import_react9 = require("react");
|
|
687
|
+
|
|
688
|
+
// src/components/Switch/Switch.css.ts
|
|
689
|
+
var import_createRuntimeFn7 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
690
|
+
var label2 = "o33ul29";
|
|
691
|
+
var root4 = (0, import_createRuntimeFn7.createRuntimeFn)({ defaultClassName: "o33ul20", variantClassNames: { size: { sm: "o33ul21", md: "o33ul22" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
692
|
+
var thumb = (0, import_createRuntimeFn7.createRuntimeFn)({ defaultClassName: "o33ul26", variantClassNames: { size: { sm: "o33ul27", md: "o33ul28" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
693
|
+
var track = (0, import_createRuntimeFn7.createRuntimeFn)({ defaultClassName: "o33ul23", variantClassNames: { size: { sm: "o33ul24", md: "o33ul25" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
694
|
+
|
|
695
|
+
// src/components/Switch/Switch.tsx
|
|
696
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
697
|
+
var Switch = (0, import_react9.forwardRef)(function Switch2({ label: label3, size, id, className, disabled, "aria-label": ariaLabel, ...rest }, ref) {
|
|
698
|
+
const generatedId = (0, import_react9.useId)();
|
|
699
|
+
const switchId = id ?? generatedId;
|
|
700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: cx(root4({ size }), className), "data-disabled": disabled || void 0, children: [
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
702
|
+
RadixSwitch.Root,
|
|
703
|
+
{
|
|
704
|
+
ref,
|
|
705
|
+
id: switchId,
|
|
706
|
+
disabled,
|
|
707
|
+
"aria-label": ariaLabel,
|
|
708
|
+
className: track({ size }),
|
|
709
|
+
...rest,
|
|
710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RadixSwitch.Thumb, { className: thumb({ size }) })
|
|
711
|
+
}
|
|
712
|
+
),
|
|
713
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { htmlFor: switchId, className: label2, children: label3 })
|
|
714
|
+
] });
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// src/components/Textarea/Textarea.tsx
|
|
718
|
+
var import_react10 = require("react");
|
|
719
|
+
|
|
720
|
+
// src/components/Textarea/Textarea.css.ts
|
|
721
|
+
var import_createRuntimeFn8 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
722
|
+
var count = "_1koawa9";
|
|
723
|
+
var countOver = "_1koawaa";
|
|
724
|
+
var defaultWidth = "_1koawa7";
|
|
725
|
+
var footer2 = "_1koawa8";
|
|
726
|
+
var textarea = (0, import_createRuntimeFn8.createRuntimeFn)({ defaultClassName: "_1koawa0", variantClassNames: { size: { sm: "_1koawa1", md: "_1koawa2", lg: "_1koawa3" }, resize: { none: "_1koawa4", vertical: "_1koawa5", both: "_1koawa6" } }, defaultVariants: { size: "md", resize: "vertical" }, compoundVariants: [] });
|
|
727
|
+
|
|
728
|
+
// src/components/Textarea/Textarea.tsx
|
|
729
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
730
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react10.useLayoutEffect : import_react10.useEffect;
|
|
731
|
+
var Textarea = (0, import_react10.forwardRef)(function Textarea2({
|
|
732
|
+
label: label3,
|
|
733
|
+
helperText: helperText2,
|
|
734
|
+
error,
|
|
735
|
+
size,
|
|
736
|
+
fullWidth,
|
|
737
|
+
resize,
|
|
738
|
+
autoResize,
|
|
739
|
+
showCount,
|
|
740
|
+
required,
|
|
741
|
+
id,
|
|
742
|
+
rows = 3,
|
|
743
|
+
value: value2,
|
|
744
|
+
defaultValue,
|
|
745
|
+
onChange,
|
|
746
|
+
maxLength,
|
|
747
|
+
className,
|
|
748
|
+
style,
|
|
749
|
+
"aria-describedby": ariaDescribedBy,
|
|
750
|
+
...rest
|
|
751
|
+
}, ref) {
|
|
752
|
+
const generatedId = (0, import_react10.useId)();
|
|
753
|
+
const textareaId = id ?? generatedId;
|
|
754
|
+
const helperId = helperText2 ? `${textareaId}-helper` : void 0;
|
|
755
|
+
const innerRef = (0, import_react10.useRef)(null);
|
|
756
|
+
const [uncontrolledLength, setUncontrolledLength] = (0, import_react10.useState)(() => String(defaultValue ?? "").length);
|
|
757
|
+
const length = value2 !== void 0 ? String(value2).length : uncontrolledLength;
|
|
758
|
+
const fitHeight = (0, import_react10.useCallback)(() => {
|
|
759
|
+
const el = innerRef.current;
|
|
760
|
+
if (!autoResize || !el) return;
|
|
761
|
+
el.style.height = "auto";
|
|
762
|
+
const borders = el.offsetHeight - el.clientHeight;
|
|
763
|
+
el.style.height = `${el.scrollHeight + borders}px`;
|
|
764
|
+
}, [autoResize]);
|
|
765
|
+
useIsomorphicLayoutEffect(fitHeight, [fitHeight, value2]);
|
|
766
|
+
const handleChange = (event) => {
|
|
767
|
+
if (value2 === void 0) setUncontrolledLength(event.target.value.length);
|
|
768
|
+
fitHeight();
|
|
769
|
+
onChange?.(event);
|
|
770
|
+
};
|
|
771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
772
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { htmlFor: textareaId, className: label, children: [
|
|
773
|
+
label3,
|
|
774
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
775
|
+
] }),
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
777
|
+
"textarea",
|
|
778
|
+
{
|
|
779
|
+
ref: mergeRefs(innerRef, ref),
|
|
780
|
+
id: textareaId,
|
|
781
|
+
rows,
|
|
782
|
+
value: value2,
|
|
783
|
+
defaultValue,
|
|
784
|
+
onChange: handleChange,
|
|
785
|
+
maxLength,
|
|
786
|
+
required,
|
|
787
|
+
"aria-invalid": error || void 0,
|
|
788
|
+
"aria-describedby": cx(helperId, ariaDescribedBy) || void 0,
|
|
789
|
+
className: cx(
|
|
790
|
+
textarea({ size, resize: autoResize ? "none" : resize }),
|
|
791
|
+
!fullWidth && defaultWidth,
|
|
792
|
+
className
|
|
793
|
+
),
|
|
794
|
+
style: autoResize ? { overflowY: "auto", ...style } : style,
|
|
795
|
+
...rest
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
(helperText2 || showCount) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: footer2, children: [
|
|
799
|
+
helperText2 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { id: helperId, className: helperText({ error }), children: helperText2 }),
|
|
800
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: cx(count, maxLength !== void 0 && length >= maxLength && countOver), children: maxLength !== void 0 ? `${length}/${maxLength}` : length })
|
|
801
|
+
] })
|
|
802
|
+
] });
|
|
803
|
+
});
|
|
804
|
+
|
|
591
805
|
// src/components/Toast/Toast.tsx
|
|
592
806
|
var RadixToast = __toESM(require("@radix-ui/react-toast"), 1);
|
|
593
|
-
var
|
|
807
|
+
var import_react11 = require("react");
|
|
594
808
|
var import_icons3 = require("@bestow-ui/icons");
|
|
595
809
|
|
|
596
810
|
// src/components/Toast/Toast.css.ts
|
|
597
|
-
var
|
|
811
|
+
var import_createRuntimeFn9 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
598
812
|
var action = "_1g11zvx7";
|
|
599
813
|
var close = "_1g11zvx8";
|
|
600
|
-
var
|
|
814
|
+
var description3 = "_1g11zvx6";
|
|
601
815
|
var title2 = "_1g11zvx5";
|
|
602
|
-
var toast = (0,
|
|
816
|
+
var toast = (0, import_createRuntimeFn9.createRuntimeFn)({ defaultClassName: "_1g11zvx1", variantClassNames: { variant: { "default": "_1g11zvx2", success: "_1g11zvx3", danger: "_1g11zvx4" } }, defaultVariants: { variant: "default" }, compoundVariants: [] });
|
|
603
817
|
var viewport2 = "_1g11zvx0";
|
|
604
818
|
|
|
605
819
|
// src/components/Toast/Toast.tsx
|
|
606
|
-
var
|
|
820
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
607
821
|
var REMOVE_DELAY = 500;
|
|
608
|
-
var ToastContext = (0,
|
|
609
|
-
function ToastProvider({ children, duration = 5e3, label:
|
|
610
|
-
const [toasts, setToasts] = (0,
|
|
611
|
-
const nextId = (0,
|
|
822
|
+
var ToastContext = (0, import_react11.createContext)(null);
|
|
823
|
+
function ToastProvider({ children, duration = 5e3, label: label3 = "\uC54C\uB9BC" }) {
|
|
824
|
+
const [toasts, setToasts] = (0, import_react11.useState)([]);
|
|
825
|
+
const nextId = (0, import_react11.useRef)(0);
|
|
612
826
|
const portal2 = usePortalProps();
|
|
613
|
-
const toast2 = (0,
|
|
827
|
+
const toast2 = (0, import_react11.useCallback)((options) => {
|
|
614
828
|
const id = nextId.current++;
|
|
615
829
|
setToasts((prev) => [...prev, { ...options, id, open: true }]);
|
|
616
830
|
return id;
|
|
617
831
|
}, []);
|
|
618
|
-
const dismiss = (0,
|
|
832
|
+
const dismiss = (0, import_react11.useCallback)((id) => {
|
|
619
833
|
const isTarget = (t) => id === void 0 || t.id === id;
|
|
620
834
|
setToasts((prev) => prev.map((t) => isTarget(t) ? { ...t, open: false } : t));
|
|
621
835
|
setTimeout(() => setToasts((prev) => prev.filter((t) => t.open || !isTarget(t))), REMOVE_DELAY);
|
|
622
836
|
}, []);
|
|
623
|
-
const value2 = (0,
|
|
624
|
-
return /* @__PURE__ */ (0,
|
|
837
|
+
const value2 = (0, import_react11.useMemo)(() => ({ toast: toast2, dismiss }), [toast2, dismiss]);
|
|
838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToastContext.Provider, { value: value2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(RadixToast.Provider, { duration, label: label3, swipeDirection: "right", children: [
|
|
625
839
|
children,
|
|
626
|
-
toasts.map(({ id, open, title: title3, description:
|
|
840
|
+
toasts.map(({ id, open, title: title3, description: description4, variant, duration: itemDuration, action: action2 }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
627
841
|
RadixToast.Root,
|
|
628
842
|
{
|
|
629
843
|
open,
|
|
@@ -633,19 +847,19 @@ function ToastProvider({ children, duration = 5e3, label: label2 = "\uC54C\uB9BC
|
|
|
633
847
|
},
|
|
634
848
|
className: toast({ variant }),
|
|
635
849
|
children: [
|
|
636
|
-
/* @__PURE__ */ (0,
|
|
637
|
-
|
|
638
|
-
action2 && /* @__PURE__ */ (0,
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixToast.Title, { className: title2, children: title3 }),
|
|
851
|
+
description4 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixToast.Description, { className: description3, children: description4 }),
|
|
852
|
+
action2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixToast.Action, { asChild: true, altText: action2.altText ?? action2.label, className: action, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { size: "sm", variant: "soft", color: "neutral", onClick: action2.onClick, children: action2.label }) }),
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixToast.Close, { className: close, "aria-label": "\uB2EB\uAE30", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons3.XIcon, { size: 16 }) })
|
|
640
854
|
]
|
|
641
855
|
},
|
|
642
856
|
id
|
|
643
857
|
)),
|
|
644
|
-
/* @__PURE__ */ (0,
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixToast.Viewport, { className: cx(portal2.className, viewport2), style: portal2.style })
|
|
645
859
|
] }) });
|
|
646
860
|
}
|
|
647
861
|
function useToast() {
|
|
648
|
-
const context = (0,
|
|
862
|
+
const context = (0, import_react11.useContext)(ToastContext);
|
|
649
863
|
if (!context) throw new Error("useToast \uB294 ToastProvider \uC548\uC5D0\uC11C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4.");
|
|
650
864
|
return context;
|
|
651
865
|
}
|
|
@@ -658,7 +872,7 @@ var arrow = "z7rufs1";
|
|
|
658
872
|
var content3 = "z7rufs0";
|
|
659
873
|
|
|
660
874
|
// src/components/Tooltip/Tooltip.tsx
|
|
661
|
-
var
|
|
875
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
662
876
|
function Tooltip({
|
|
663
877
|
content: content4,
|
|
664
878
|
children,
|
|
@@ -673,9 +887,9 @@ function Tooltip({
|
|
|
673
887
|
}) {
|
|
674
888
|
const portal2 = usePortalProps();
|
|
675
889
|
if (disabled || content4 == null || content4 === "") return children;
|
|
676
|
-
return /* @__PURE__ */ (0,
|
|
677
|
-
/* @__PURE__ */ (0,
|
|
678
|
-
/* @__PURE__ */ (0,
|
|
890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadixTooltip.Provider, { delayDuration: delay, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(RadixTooltip.Root, { open, defaultOpen, onOpenChange, children: [
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadixTooltip.Trigger, { asChild: true, children }),
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadixTooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
679
893
|
RadixTooltip.Content,
|
|
680
894
|
{
|
|
681
895
|
side,
|
|
@@ -686,7 +900,7 @@ function Tooltip({
|
|
|
686
900
|
style: portal2.style,
|
|
687
901
|
children: [
|
|
688
902
|
content4,
|
|
689
|
-
/* @__PURE__ */ (0,
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadixTooltip.Arrow, { className: arrow, width: 10, height: 5 })
|
|
690
904
|
]
|
|
691
905
|
}
|
|
692
906
|
) })
|
|
@@ -694,14 +908,14 @@ function Tooltip({
|
|
|
694
908
|
}
|
|
695
909
|
|
|
696
910
|
// src/components/Typography/Typography.tsx
|
|
697
|
-
var
|
|
911
|
+
var import_react12 = require("react");
|
|
698
912
|
|
|
699
913
|
// src/components/Typography/Typography.css.ts
|
|
700
|
-
var
|
|
701
|
-
var typography = (0,
|
|
914
|
+
var import_createRuntimeFn10 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
915
|
+
var typography = (0, import_createRuntimeFn10.createRuntimeFn)({ defaultClassName: "kiolio0", variantClassNames: { variant: { display: "kiolio1", h1: "kiolio2", h2: "kiolio3", h3: "kiolio4", h4: "kiolio5", "body-lg": "kiolio6", body: "kiolio7", "body-sm": "kiolio8", caption: "kiolio9" }, color: { "default": "kiolioa", muted: "kioliob", subtle: "kiolioc", primary: "kioliod", danger: "kiolioe", success: "kioliof", inherit: "kioliog" }, weight: { regular: "kiolioh", medium: "kiolioi", semibold: "kiolioj", bold: "kioliok" }, align: { start: "kioliol", center: "kioliom", end: "kiolion" }, truncate: { true: "kiolioo" } }, defaultVariants: { variant: "body", color: "default" }, compoundVariants: [] });
|
|
702
916
|
|
|
703
917
|
// src/components/Typography/Typography.tsx
|
|
704
|
-
var
|
|
918
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
705
919
|
var defaultElement = {
|
|
706
920
|
display: "h1",
|
|
707
921
|
h1: "h1",
|
|
@@ -713,9 +927,9 @@ var defaultElement = {
|
|
|
713
927
|
"body-sm": "p",
|
|
714
928
|
caption: "span"
|
|
715
929
|
};
|
|
716
|
-
var Typography = (0,
|
|
930
|
+
var Typography = (0, import_react12.forwardRef)(function Typography2({ variant = "body", as, color, weight, align, truncate, className, ...rest }, ref) {
|
|
717
931
|
const Component = as ?? defaultElement[variant];
|
|
718
|
-
return /* @__PURE__ */ (0,
|
|
932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
719
933
|
Component,
|
|
720
934
|
{
|
|
721
935
|
ref,
|
|
@@ -731,9 +945,12 @@ var Typography = (0, import_react9.forwardRef)(function Typography2({ variant =
|
|
|
731
945
|
Input,
|
|
732
946
|
Modal,
|
|
733
947
|
ModalClose,
|
|
948
|
+
RadioGroup,
|
|
734
949
|
Select,
|
|
735
950
|
Stack,
|
|
951
|
+
Switch,
|
|
736
952
|
TextField,
|
|
953
|
+
Textarea,
|
|
737
954
|
ThemeProvider,
|
|
738
955
|
ToastProvider,
|
|
739
956
|
Tooltip,
|