@bestow-ui/react 0.3.0 → 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 +309 -86
- 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 +87 -3
- package/dist/index.d.ts +87 -3
- package/dist/index.js +311 -83
- 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,
|
|
@@ -167,7 +170,11 @@ function createIntentColors(intent, color) {
|
|
|
167
170
|
subtleHover: rgba(darkSolid, 0.26),
|
|
168
171
|
text: findReadable(darkBase, Math.max(darkBase.l, 0.75), 0.02, [darkBg, darkSubtleOnBg, darkSubtleHoverOnBg])
|
|
169
172
|
};
|
|
170
|
-
|
|
173
|
+
const focus = intent === "primary" ? { light: { border: { focus: light.solid } }, dark: { border: { focus: dark.solidHover } } } : void 0;
|
|
174
|
+
return {
|
|
175
|
+
light: { color: { [intent]: light, ...focus?.light } },
|
|
176
|
+
dark: { color: { [intent]: dark, ...focus?.dark } }
|
|
177
|
+
};
|
|
171
178
|
}
|
|
172
179
|
|
|
173
180
|
// src/theme/createTheme.ts
|
|
@@ -307,7 +314,7 @@ var root2 = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1
|
|
|
307
314
|
|
|
308
315
|
// src/components/Checkbox/Checkbox.tsx
|
|
309
316
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
310
|
-
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) {
|
|
311
318
|
const innerRef = (0, import_react3.useRef)(null);
|
|
312
319
|
(0, import_react3.useEffect)(() => {
|
|
313
320
|
if (innerRef.current) innerRef.current.indeterminate = indeterminate;
|
|
@@ -328,7 +335,7 @@ var Checkbox = (0, import_react3.forwardRef)(function Checkbox2({ label: label2,
|
|
|
328
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" }) }),
|
|
329
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" }) })
|
|
330
337
|
] }),
|
|
331
|
-
|
|
338
|
+
label3
|
|
332
339
|
] });
|
|
333
340
|
});
|
|
334
341
|
|
|
@@ -376,13 +383,13 @@ var Input = (0, import_react4.forwardRef)(function Input2({ size, invalid, fullW
|
|
|
376
383
|
// src/components/Input/TextField.tsx
|
|
377
384
|
var import_react5 = require("react");
|
|
378
385
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
379
|
-
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) {
|
|
380
387
|
const generatedId = (0, import_react5.useId)();
|
|
381
388
|
const inputId = id ?? generatedId;
|
|
382
389
|
const helperId = helperText2 ? `${inputId}-helper` : void 0;
|
|
383
390
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
384
|
-
|
|
385
|
-
|
|
391
|
+
label3 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: inputId, className: label, children: [
|
|
392
|
+
label3,
|
|
386
393
|
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
387
394
|
] }),
|
|
388
395
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -425,9 +432,9 @@ function Modal({
|
|
|
425
432
|
onOpenChange,
|
|
426
433
|
trigger: trigger2,
|
|
427
434
|
title: title3,
|
|
428
|
-
description:
|
|
435
|
+
description: description4,
|
|
429
436
|
children,
|
|
430
|
-
footer:
|
|
437
|
+
footer: footer3,
|
|
431
438
|
size,
|
|
432
439
|
hideCloseButton = false,
|
|
433
440
|
closeOnOverlayClick = true,
|
|
@@ -444,17 +451,17 @@ function Modal({
|
|
|
444
451
|
className: cx(portal2.className, content({ size }), className),
|
|
445
452
|
style: portal2.style,
|
|
446
453
|
onPointerDownOutside: closeOnOverlayClick ? void 0 : (event) => event.preventDefault(),
|
|
447
|
-
...
|
|
454
|
+
...description4 ? {} : { "aria-describedby": void 0 },
|
|
448
455
|
children: [
|
|
449
456
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: header, children: [
|
|
450
457
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: headings, children: [
|
|
451
458
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog.Title, { className: title, children: title3 }),
|
|
452
|
-
|
|
459
|
+
description4 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog.Description, { className: description, children: description4 })
|
|
453
460
|
] }),
|
|
454
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 }) })
|
|
455
462
|
] }),
|
|
456
463
|
children && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: body, children }),
|
|
457
|
-
|
|
464
|
+
footer3 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: footer, children: footer3 })
|
|
458
465
|
]
|
|
459
466
|
}
|
|
460
467
|
)
|
|
@@ -463,9 +470,99 @@ function Modal({
|
|
|
463
470
|
}
|
|
464
471
|
var ModalClose = Dialog.Close;
|
|
465
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
|
+
|
|
466
563
|
// src/components/Select/Select.tsx
|
|
467
564
|
var RadixSelect = __toESM(require("@radix-ui/react-select"), 1);
|
|
468
|
-
var
|
|
565
|
+
var import_react7 = require("react");
|
|
469
566
|
var import_icons2 = require("@bestow-ui/icons");
|
|
470
567
|
|
|
471
568
|
// src/components/Select/Select.css.ts
|
|
@@ -478,45 +575,47 @@ var value = "_1kx81e81";
|
|
|
478
575
|
var viewport = "_1kx81e84";
|
|
479
576
|
|
|
480
577
|
// src/components/Select/Select.tsx
|
|
481
|
-
var
|
|
482
|
-
var Select = (0,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
578
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
579
|
+
var Select = (0, import_react7.forwardRef)(function Select2(props, ref) {
|
|
580
|
+
const {
|
|
581
|
+
options,
|
|
582
|
+
value: value2,
|
|
583
|
+
defaultValue,
|
|
584
|
+
onValueChange,
|
|
585
|
+
placeholder,
|
|
586
|
+
label: label3,
|
|
587
|
+
helperText: helperText2,
|
|
588
|
+
error,
|
|
589
|
+
size,
|
|
590
|
+
fullWidth,
|
|
591
|
+
disabled,
|
|
592
|
+
required,
|
|
593
|
+
name,
|
|
594
|
+
id,
|
|
595
|
+
"aria-label": ariaLabel,
|
|
596
|
+
className
|
|
597
|
+
} = props;
|
|
598
|
+
const isControlled = "value" in props;
|
|
599
|
+
const generatedId = (0, import_react7.useId)();
|
|
501
600
|
const triggerId = id ?? generatedId;
|
|
502
601
|
const helperId = helperText2 ? `${triggerId}-helper` : void 0;
|
|
503
602
|
const portal2 = usePortalProps();
|
|
504
|
-
return /* @__PURE__ */ (0,
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
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: "*" })
|
|
508
607
|
] }),
|
|
509
|
-
/* @__PURE__ */ (0,
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
510
609
|
RadixSelect.Root,
|
|
511
610
|
{
|
|
512
|
-
value: value2,
|
|
611
|
+
value: isControlled ? value2 ?? "" : void 0,
|
|
513
612
|
defaultValue,
|
|
514
613
|
onValueChange,
|
|
515
614
|
disabled,
|
|
516
615
|
required,
|
|
517
616
|
name,
|
|
518
617
|
children: [
|
|
519
|
-
/* @__PURE__ */ (0,
|
|
618
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
520
619
|
RadixSelect.Trigger,
|
|
521
620
|
{
|
|
522
621
|
ref,
|
|
@@ -527,12 +626,12 @@ var Select = (0, import_react6.forwardRef)(function Select2({
|
|
|
527
626
|
"data-invalid": error || void 0,
|
|
528
627
|
className: cx(root3({ size, fullWidth }), trigger, className),
|
|
529
628
|
children: [
|
|
530
|
-
/* @__PURE__ */ (0,
|
|
531
|
-
/* @__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 }) })
|
|
532
631
|
]
|
|
533
632
|
}
|
|
534
633
|
),
|
|
535
|
-
/* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadixSelect.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
536
635
|
RadixSelect.Content,
|
|
537
636
|
{
|
|
538
637
|
position: "popper",
|
|
@@ -540,39 +639,39 @@ var Select = (0, import_react6.forwardRef)(function Select2({
|
|
|
540
639
|
collisionPadding: 8,
|
|
541
640
|
className: cx(portal2.className, content2),
|
|
542
641
|
style: portal2.style,
|
|
543
|
-
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)(
|
|
544
643
|
RadixSelect.Item,
|
|
545
644
|
{
|
|
546
|
-
value:
|
|
547
|
-
disabled:
|
|
645
|
+
value: option2.value,
|
|
646
|
+
disabled: option2.disabled,
|
|
548
647
|
className: item,
|
|
549
648
|
children: [
|
|
550
|
-
/* @__PURE__ */ (0,
|
|
551
|
-
/* @__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 }) })
|
|
552
651
|
]
|
|
553
652
|
},
|
|
554
|
-
|
|
653
|
+
option2.value
|
|
555
654
|
)) })
|
|
556
655
|
}
|
|
557
656
|
) })
|
|
558
657
|
]
|
|
559
658
|
}
|
|
560
659
|
),
|
|
561
|
-
helperText2 && /* @__PURE__ */ (0,
|
|
660
|
+
helperText2 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: helperId, className: helperText({ error }), children: helperText2 })
|
|
562
661
|
] });
|
|
563
662
|
});
|
|
564
663
|
|
|
565
664
|
// src/components/Stack/Stack.tsx
|
|
566
|
-
var
|
|
665
|
+
var import_react8 = require("react");
|
|
567
666
|
|
|
568
667
|
// src/components/Stack/Stack.css.ts
|
|
569
|
-
var
|
|
570
|
-
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: [] });
|
|
571
670
|
|
|
572
671
|
// src/components/Stack/Stack.tsx
|
|
573
|
-
var
|
|
574
|
-
var Stack = (0,
|
|
575
|
-
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)(
|
|
576
675
|
Component,
|
|
577
676
|
{
|
|
578
677
|
ref,
|
|
@@ -582,42 +681,163 @@ var Stack = (0, import_react7.forwardRef)(function Stack2({ as: Component = "div
|
|
|
582
681
|
);
|
|
583
682
|
});
|
|
584
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
|
+
|
|
585
805
|
// src/components/Toast/Toast.tsx
|
|
586
806
|
var RadixToast = __toESM(require("@radix-ui/react-toast"), 1);
|
|
587
|
-
var
|
|
807
|
+
var import_react11 = require("react");
|
|
588
808
|
var import_icons3 = require("@bestow-ui/icons");
|
|
589
809
|
|
|
590
810
|
// src/components/Toast/Toast.css.ts
|
|
591
|
-
var
|
|
811
|
+
var import_createRuntimeFn9 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
592
812
|
var action = "_1g11zvx7";
|
|
593
813
|
var close = "_1g11zvx8";
|
|
594
|
-
var
|
|
814
|
+
var description3 = "_1g11zvx6";
|
|
595
815
|
var title2 = "_1g11zvx5";
|
|
596
|
-
var toast = (0,
|
|
816
|
+
var toast = (0, import_createRuntimeFn9.createRuntimeFn)({ defaultClassName: "_1g11zvx1", variantClassNames: { variant: { "default": "_1g11zvx2", success: "_1g11zvx3", danger: "_1g11zvx4" } }, defaultVariants: { variant: "default" }, compoundVariants: [] });
|
|
597
817
|
var viewport2 = "_1g11zvx0";
|
|
598
818
|
|
|
599
819
|
// src/components/Toast/Toast.tsx
|
|
600
|
-
var
|
|
820
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
601
821
|
var REMOVE_DELAY = 500;
|
|
602
|
-
var ToastContext = (0,
|
|
603
|
-
function ToastProvider({ children, duration = 5e3, label:
|
|
604
|
-
const [toasts, setToasts] = (0,
|
|
605
|
-
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);
|
|
606
826
|
const portal2 = usePortalProps();
|
|
607
|
-
const toast2 = (0,
|
|
827
|
+
const toast2 = (0, import_react11.useCallback)((options) => {
|
|
608
828
|
const id = nextId.current++;
|
|
609
829
|
setToasts((prev) => [...prev, { ...options, id, open: true }]);
|
|
610
830
|
return id;
|
|
611
831
|
}, []);
|
|
612
|
-
const dismiss = (0,
|
|
832
|
+
const dismiss = (0, import_react11.useCallback)((id) => {
|
|
613
833
|
const isTarget = (t) => id === void 0 || t.id === id;
|
|
614
834
|
setToasts((prev) => prev.map((t) => isTarget(t) ? { ...t, open: false } : t));
|
|
615
835
|
setTimeout(() => setToasts((prev) => prev.filter((t) => t.open || !isTarget(t))), REMOVE_DELAY);
|
|
616
836
|
}, []);
|
|
617
|
-
const value2 = (0,
|
|
618
|
-
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: [
|
|
619
839
|
children,
|
|
620
|
-
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)(
|
|
621
841
|
RadixToast.Root,
|
|
622
842
|
{
|
|
623
843
|
open,
|
|
@@ -627,19 +847,19 @@ function ToastProvider({ children, duration = 5e3, label: label2 = "\uC54C\uB9BC
|
|
|
627
847
|
},
|
|
628
848
|
className: toast({ variant }),
|
|
629
849
|
children: [
|
|
630
|
-
/* @__PURE__ */ (0,
|
|
631
|
-
|
|
632
|
-
action2 && /* @__PURE__ */ (0,
|
|
633
|
-
/* @__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 }) })
|
|
634
854
|
]
|
|
635
855
|
},
|
|
636
856
|
id
|
|
637
857
|
)),
|
|
638
|
-
/* @__PURE__ */ (0,
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixToast.Viewport, { className: cx(portal2.className, viewport2), style: portal2.style })
|
|
639
859
|
] }) });
|
|
640
860
|
}
|
|
641
861
|
function useToast() {
|
|
642
|
-
const context = (0,
|
|
862
|
+
const context = (0, import_react11.useContext)(ToastContext);
|
|
643
863
|
if (!context) throw new Error("useToast \uB294 ToastProvider \uC548\uC5D0\uC11C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4.");
|
|
644
864
|
return context;
|
|
645
865
|
}
|
|
@@ -652,7 +872,7 @@ var arrow = "z7rufs1";
|
|
|
652
872
|
var content3 = "z7rufs0";
|
|
653
873
|
|
|
654
874
|
// src/components/Tooltip/Tooltip.tsx
|
|
655
|
-
var
|
|
875
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
656
876
|
function Tooltip({
|
|
657
877
|
content: content4,
|
|
658
878
|
children,
|
|
@@ -667,9 +887,9 @@ function Tooltip({
|
|
|
667
887
|
}) {
|
|
668
888
|
const portal2 = usePortalProps();
|
|
669
889
|
if (disabled || content4 == null || content4 === "") return children;
|
|
670
|
-
return /* @__PURE__ */ (0,
|
|
671
|
-
/* @__PURE__ */ (0,
|
|
672
|
-
/* @__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)(
|
|
673
893
|
RadixTooltip.Content,
|
|
674
894
|
{
|
|
675
895
|
side,
|
|
@@ -680,7 +900,7 @@ function Tooltip({
|
|
|
680
900
|
style: portal2.style,
|
|
681
901
|
children: [
|
|
682
902
|
content4,
|
|
683
|
-
/* @__PURE__ */ (0,
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadixTooltip.Arrow, { className: arrow, width: 10, height: 5 })
|
|
684
904
|
]
|
|
685
905
|
}
|
|
686
906
|
) })
|
|
@@ -688,14 +908,14 @@ function Tooltip({
|
|
|
688
908
|
}
|
|
689
909
|
|
|
690
910
|
// src/components/Typography/Typography.tsx
|
|
691
|
-
var
|
|
911
|
+
var import_react12 = require("react");
|
|
692
912
|
|
|
693
913
|
// src/components/Typography/Typography.css.ts
|
|
694
|
-
var
|
|
695
|
-
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: [] });
|
|
696
916
|
|
|
697
917
|
// src/components/Typography/Typography.tsx
|
|
698
|
-
var
|
|
918
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
699
919
|
var defaultElement = {
|
|
700
920
|
display: "h1",
|
|
701
921
|
h1: "h1",
|
|
@@ -707,9 +927,9 @@ var defaultElement = {
|
|
|
707
927
|
"body-sm": "p",
|
|
708
928
|
caption: "span"
|
|
709
929
|
};
|
|
710
|
-
var Typography = (0,
|
|
930
|
+
var Typography = (0, import_react12.forwardRef)(function Typography2({ variant = "body", as, color, weight, align, truncate, className, ...rest }, ref) {
|
|
711
931
|
const Component = as ?? defaultElement[variant];
|
|
712
|
-
return /* @__PURE__ */ (0,
|
|
932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
713
933
|
Component,
|
|
714
934
|
{
|
|
715
935
|
ref,
|
|
@@ -725,9 +945,12 @@ var Typography = (0, import_react9.forwardRef)(function Typography2({ variant =
|
|
|
725
945
|
Input,
|
|
726
946
|
Modal,
|
|
727
947
|
ModalClose,
|
|
948
|
+
RadioGroup,
|
|
728
949
|
Select,
|
|
729
950
|
Stack,
|
|
951
|
+
Switch,
|
|
730
952
|
TextField,
|
|
953
|
+
Textarea,
|
|
731
954
|
ThemeProvider,
|
|
732
955
|
ToastProvider,
|
|
733
956
|
Tooltip,
|