@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.js
CHANGED
|
@@ -256,7 +256,7 @@ var root2 = _7a4682({ defaultClassName: "_1y7mzsn0", variantClassNames: { size:
|
|
|
256
256
|
|
|
257
257
|
// src/components/Checkbox/Checkbox.tsx
|
|
258
258
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
259
|
-
var Checkbox = forwardRef3(function Checkbox2({ label:
|
|
259
|
+
var Checkbox = forwardRef3(function Checkbox2({ label: label3, size, indeterminate = false, invalid, disabled, className, ...rest }, ref) {
|
|
260
260
|
const innerRef = useRef(null);
|
|
261
261
|
useEffect(() => {
|
|
262
262
|
if (innerRef.current) innerRef.current.indeterminate = indeterminate;
|
|
@@ -277,7 +277,7 @@ var Checkbox = forwardRef3(function Checkbox2({ label: label2, size, indetermina
|
|
|
277
277
|
/* @__PURE__ */ jsx3("svg", { className: checkIcon, viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx3("path", { d: "M5 10.5l3.2 3L15 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
278
278
|
/* @__PURE__ */ jsx3("svg", { className: indeterminateIcon, viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx3("path", { d: "M6 10h8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })
|
|
279
279
|
] }),
|
|
280
|
-
|
|
280
|
+
label3
|
|
281
281
|
] });
|
|
282
282
|
});
|
|
283
283
|
|
|
@@ -325,13 +325,13 @@ var Input = forwardRef4(function Input2({ size, invalid, fullWidth, startAdornme
|
|
|
325
325
|
// src/components/Input/TextField.tsx
|
|
326
326
|
import { forwardRef as forwardRef5, useId } from "react";
|
|
327
327
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
328
|
-
var TextField = forwardRef5(function TextField2({ label:
|
|
328
|
+
var TextField = forwardRef5(function TextField2({ label: label3, helperText: helperText2, error, required, fullWidth, id, "aria-describedby": ariaDescribedBy, ...rest }, ref) {
|
|
329
329
|
const generatedId = useId();
|
|
330
330
|
const inputId = id ?? generatedId;
|
|
331
331
|
const helperId = helperText2 ? `${inputId}-helper` : void 0;
|
|
332
332
|
return /* @__PURE__ */ jsxs4("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
label3 && /* @__PURE__ */ jsxs4("label", { htmlFor: inputId, className: label, children: [
|
|
334
|
+
label3,
|
|
335
335
|
required && /* @__PURE__ */ jsx5("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
336
336
|
] }),
|
|
337
337
|
/* @__PURE__ */ jsx5(
|
|
@@ -374,9 +374,9 @@ function Modal({
|
|
|
374
374
|
onOpenChange,
|
|
375
375
|
trigger: trigger2,
|
|
376
376
|
title: title3,
|
|
377
|
-
description:
|
|
377
|
+
description: description4,
|
|
378
378
|
children,
|
|
379
|
-
footer:
|
|
379
|
+
footer: footer3,
|
|
380
380
|
size,
|
|
381
381
|
hideCloseButton = false,
|
|
382
382
|
closeOnOverlayClick = true,
|
|
@@ -393,17 +393,17 @@ function Modal({
|
|
|
393
393
|
className: cx(portal2.className, content({ size }), className),
|
|
394
394
|
style: portal2.style,
|
|
395
395
|
onPointerDownOutside: closeOnOverlayClick ? void 0 : (event) => event.preventDefault(),
|
|
396
|
-
...
|
|
396
|
+
...description4 ? {} : { "aria-describedby": void 0 },
|
|
397
397
|
children: [
|
|
398
398
|
/* @__PURE__ */ jsxs5("div", { className: header, children: [
|
|
399
399
|
/* @__PURE__ */ jsxs5("div", { className: headings, children: [
|
|
400
400
|
/* @__PURE__ */ jsx6(Dialog.Title, { className: title, children: title3 }),
|
|
401
|
-
|
|
401
|
+
description4 && /* @__PURE__ */ jsx6(Dialog.Description, { className: description, children: description4 })
|
|
402
402
|
] }),
|
|
403
403
|
!hideCloseButton && /* @__PURE__ */ jsx6(Dialog.Close, { className: closeButton, "aria-label": "\uB2EB\uAE30", children: /* @__PURE__ */ jsx6(XIcon, { size: 16 }) })
|
|
404
404
|
] }),
|
|
405
405
|
children && /* @__PURE__ */ jsx6("div", { className: body, children }),
|
|
406
|
-
|
|
406
|
+
footer3 && /* @__PURE__ */ jsx6("div", { className: footer, children: footer3 })
|
|
407
407
|
]
|
|
408
408
|
}
|
|
409
409
|
)
|
|
@@ -412,9 +412,99 @@ function Modal({
|
|
|
412
412
|
}
|
|
413
413
|
var ModalClose = Dialog.Close;
|
|
414
414
|
|
|
415
|
+
// src/components/RadioGroup/RadioGroup.tsx
|
|
416
|
+
import * as RadixRadioGroup from "@radix-ui/react-radio-group";
|
|
417
|
+
import { forwardRef as forwardRef6, useId as useId2 } from "react";
|
|
418
|
+
|
|
419
|
+
// src/components/RadioGroup/RadioGroup.css.ts
|
|
420
|
+
import { createRuntimeFn as _7a4685 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
421
|
+
var description2 = "_1w9iwjmd";
|
|
422
|
+
var groupLabel = "_1w9iwjme";
|
|
423
|
+
var indicator = "_1w9iwjma";
|
|
424
|
+
var items = _7a4685({ defaultClassName: "_1w9iwjm0", variantClassNames: { orientation: { vertical: "_1w9iwjm1", horizontal: "_1w9iwjm2" } }, defaultVariants: { orientation: "vertical" }, compoundVariants: [] });
|
|
425
|
+
var labelText = "_1w9iwjmc";
|
|
426
|
+
var option = _7a4685({ defaultClassName: "_1w9iwjm3", variantClassNames: { size: { sm: "_1w9iwjm4", md: "_1w9iwjm5" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
427
|
+
var radio = _7a4685({ defaultClassName: "_1w9iwjm7", variantClassNames: { size: { sm: "_1w9iwjm8", md: "_1w9iwjm9" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
428
|
+
var text = "_1w9iwjmb";
|
|
429
|
+
|
|
430
|
+
// src/components/RadioGroup/RadioGroup.tsx
|
|
431
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
432
|
+
var RadioGroup = forwardRef6(function RadioGroup2(props, ref) {
|
|
433
|
+
const {
|
|
434
|
+
options,
|
|
435
|
+
value: value2,
|
|
436
|
+
defaultValue,
|
|
437
|
+
onValueChange,
|
|
438
|
+
label: label3,
|
|
439
|
+
helperText: helperText2,
|
|
440
|
+
error,
|
|
441
|
+
orientation = "vertical",
|
|
442
|
+
size,
|
|
443
|
+
disabled,
|
|
444
|
+
required,
|
|
445
|
+
name,
|
|
446
|
+
id,
|
|
447
|
+
"aria-label": ariaLabel,
|
|
448
|
+
className
|
|
449
|
+
} = props;
|
|
450
|
+
const isControlled = "value" in props;
|
|
451
|
+
const generatedId = useId2();
|
|
452
|
+
const baseId = id ?? generatedId;
|
|
453
|
+
const labelId = label3 ? `${baseId}-label` : void 0;
|
|
454
|
+
const helperId = helperText2 ? `${baseId}-helper` : void 0;
|
|
455
|
+
return /* @__PURE__ */ jsxs6("div", { className: cx(field, className), children: [
|
|
456
|
+
label3 && /* @__PURE__ */ jsxs6("span", { id: labelId, className: cx(label, groupLabel), children: [
|
|
457
|
+
label3,
|
|
458
|
+
required && /* @__PURE__ */ jsx7("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
459
|
+
] }),
|
|
460
|
+
/* @__PURE__ */ jsx7(
|
|
461
|
+
RadixRadioGroup.Root,
|
|
462
|
+
{
|
|
463
|
+
ref,
|
|
464
|
+
id: baseId,
|
|
465
|
+
value: isControlled ? value2 ?? "" : void 0,
|
|
466
|
+
defaultValue,
|
|
467
|
+
onValueChange,
|
|
468
|
+
orientation,
|
|
469
|
+
disabled,
|
|
470
|
+
required,
|
|
471
|
+
name,
|
|
472
|
+
"aria-label": ariaLabel,
|
|
473
|
+
"aria-labelledby": labelId,
|
|
474
|
+
"aria-describedby": helperId,
|
|
475
|
+
"aria-invalid": error || void 0,
|
|
476
|
+
className: items({ orientation }),
|
|
477
|
+
children: options.map((option2) => {
|
|
478
|
+
const itemId = `${baseId}-${option2.value}`;
|
|
479
|
+
const descriptionId = option2.description ? `${itemId}-description` : void 0;
|
|
480
|
+
const itemDisabled = disabled || option2.disabled;
|
|
481
|
+
return /* @__PURE__ */ jsxs6("div", { className: option({ size }), "data-disabled": itemDisabled || void 0, children: [
|
|
482
|
+
/* @__PURE__ */ jsx7(
|
|
483
|
+
RadixRadioGroup.Item,
|
|
484
|
+
{
|
|
485
|
+
id: itemId,
|
|
486
|
+
value: option2.value,
|
|
487
|
+
disabled: option2.disabled,
|
|
488
|
+
"aria-describedby": descriptionId,
|
|
489
|
+
className: radio({ size }),
|
|
490
|
+
children: /* @__PURE__ */ jsx7(RadixRadioGroup.Indicator, { className: indicator })
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
/* @__PURE__ */ jsxs6("span", { className: text, children: [
|
|
494
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: itemId, className: labelText, children: option2.label }),
|
|
495
|
+
option2.description && /* @__PURE__ */ jsx7("span", { id: descriptionId, className: description2, children: option2.description })
|
|
496
|
+
] })
|
|
497
|
+
] }, option2.value);
|
|
498
|
+
})
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
helperText2 && /* @__PURE__ */ jsx7("p", { id: helperId, className: helperText({ error }), children: helperText2 })
|
|
502
|
+
] });
|
|
503
|
+
});
|
|
504
|
+
|
|
415
505
|
// src/components/Select/Select.tsx
|
|
416
506
|
import * as RadixSelect from "@radix-ui/react-select";
|
|
417
|
-
import { forwardRef as
|
|
507
|
+
import { forwardRef as forwardRef7, useId as useId3 } from "react";
|
|
418
508
|
import { CheckIcon, ChevronDownIcon } from "@bestow-ui/icons";
|
|
419
509
|
|
|
420
510
|
// src/components/Select/Select.css.ts
|
|
@@ -427,15 +517,15 @@ var value = "_1kx81e81";
|
|
|
427
517
|
var viewport = "_1kx81e84";
|
|
428
518
|
|
|
429
519
|
// src/components/Select/Select.tsx
|
|
430
|
-
import { jsx as
|
|
431
|
-
var Select =
|
|
520
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
521
|
+
var Select = forwardRef7(function Select2(props, ref) {
|
|
432
522
|
const {
|
|
433
523
|
options,
|
|
434
524
|
value: value2,
|
|
435
525
|
defaultValue,
|
|
436
526
|
onValueChange,
|
|
437
527
|
placeholder,
|
|
438
|
-
label:
|
|
528
|
+
label: label3,
|
|
439
529
|
helperText: helperText2,
|
|
440
530
|
error,
|
|
441
531
|
size,
|
|
@@ -448,16 +538,16 @@ var Select = forwardRef6(function Select2(props, ref) {
|
|
|
448
538
|
className
|
|
449
539
|
} = props;
|
|
450
540
|
const isControlled = "value" in props;
|
|
451
|
-
const generatedId =
|
|
541
|
+
const generatedId = useId3();
|
|
452
542
|
const triggerId = id ?? generatedId;
|
|
453
543
|
const helperId = helperText2 ? `${triggerId}-helper` : void 0;
|
|
454
544
|
const portal2 = usePortalProps();
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
required && /* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ jsxs7("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
546
|
+
label3 && /* @__PURE__ */ jsxs7("label", { htmlFor: triggerId, className: label, children: [
|
|
547
|
+
label3,
|
|
548
|
+
required && /* @__PURE__ */ jsx8("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
459
549
|
] }),
|
|
460
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ jsxs7(
|
|
461
551
|
RadixSelect.Root,
|
|
462
552
|
{
|
|
463
553
|
value: isControlled ? value2 ?? "" : void 0,
|
|
@@ -467,7 +557,7 @@ var Select = forwardRef6(function Select2(props, ref) {
|
|
|
467
557
|
required,
|
|
468
558
|
name,
|
|
469
559
|
children: [
|
|
470
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ jsxs7(
|
|
471
561
|
RadixSelect.Trigger,
|
|
472
562
|
{
|
|
473
563
|
ref,
|
|
@@ -478,12 +568,12 @@ var Select = forwardRef6(function Select2(props, ref) {
|
|
|
478
568
|
"data-invalid": error || void 0,
|
|
479
569
|
className: cx(root3({ size, fullWidth }), trigger, className),
|
|
480
570
|
children: [
|
|
481
|
-
/* @__PURE__ */
|
|
482
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ jsx8("span", { className: value, children: /* @__PURE__ */ jsx8(RadixSelect.Value, { placeholder }) }),
|
|
572
|
+
/* @__PURE__ */ jsx8(RadixSelect.Icon, { className: icon2, children: /* @__PURE__ */ jsx8(ChevronDownIcon, { size: 16 }) })
|
|
483
573
|
]
|
|
484
574
|
}
|
|
485
575
|
),
|
|
486
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ jsx8(RadixSelect.Portal, { children: /* @__PURE__ */ jsx8(
|
|
487
577
|
RadixSelect.Content,
|
|
488
578
|
{
|
|
489
579
|
position: "popper",
|
|
@@ -491,39 +581,39 @@ var Select = forwardRef6(function Select2(props, ref) {
|
|
|
491
581
|
collisionPadding: 8,
|
|
492
582
|
className: cx(portal2.className, content2),
|
|
493
583
|
style: portal2.style,
|
|
494
|
-
children: /* @__PURE__ */
|
|
584
|
+
children: /* @__PURE__ */ jsx8(RadixSelect.Viewport, { className: viewport, children: options.map((option2) => /* @__PURE__ */ jsxs7(
|
|
495
585
|
RadixSelect.Item,
|
|
496
586
|
{
|
|
497
|
-
value:
|
|
498
|
-
disabled:
|
|
587
|
+
value: option2.value,
|
|
588
|
+
disabled: option2.disabled,
|
|
499
589
|
className: item,
|
|
500
590
|
children: [
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ jsx8(RadixSelect.ItemText, { children: option2.label }),
|
|
592
|
+
/* @__PURE__ */ jsx8(RadixSelect.ItemIndicator, { className: itemIndicator, children: /* @__PURE__ */ jsx8(CheckIcon, { size: 16 }) })
|
|
503
593
|
]
|
|
504
594
|
},
|
|
505
|
-
|
|
595
|
+
option2.value
|
|
506
596
|
)) })
|
|
507
597
|
}
|
|
508
598
|
) })
|
|
509
599
|
]
|
|
510
600
|
}
|
|
511
601
|
),
|
|
512
|
-
helperText2 && /* @__PURE__ */
|
|
602
|
+
helperText2 && /* @__PURE__ */ jsx8("p", { id: helperId, className: helperText({ error }), children: helperText2 })
|
|
513
603
|
] });
|
|
514
604
|
});
|
|
515
605
|
|
|
516
606
|
// src/components/Stack/Stack.tsx
|
|
517
|
-
import { forwardRef as
|
|
607
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
518
608
|
|
|
519
609
|
// src/components/Stack/Stack.css.ts
|
|
520
|
-
import { createRuntimeFn as
|
|
521
|
-
var stack =
|
|
610
|
+
import { createRuntimeFn as _7a4686 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
611
|
+
var stack = _7a4686({ 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: [] });
|
|
522
612
|
|
|
523
613
|
// src/components/Stack/Stack.tsx
|
|
524
|
-
import { jsx as
|
|
525
|
-
var Stack =
|
|
526
|
-
return /* @__PURE__ */
|
|
614
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
615
|
+
var Stack = forwardRef8(function Stack2({ as: Component = "div", direction, gap, align, justify, wrap, className, ...rest }, ref) {
|
|
616
|
+
return /* @__PURE__ */ jsx9(
|
|
527
617
|
Component,
|
|
528
618
|
{
|
|
529
619
|
ref,
|
|
@@ -533,42 +623,171 @@ var Stack = forwardRef7(function Stack2({ as: Component = "div", direction, gap,
|
|
|
533
623
|
);
|
|
534
624
|
});
|
|
535
625
|
|
|
626
|
+
// src/components/Switch/Switch.tsx
|
|
627
|
+
import * as RadixSwitch from "@radix-ui/react-switch";
|
|
628
|
+
import { forwardRef as forwardRef9, useId as useId4 } from "react";
|
|
629
|
+
|
|
630
|
+
// src/components/Switch/Switch.css.ts
|
|
631
|
+
import { createRuntimeFn as _7a4687 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
632
|
+
var label2 = "o33ul29";
|
|
633
|
+
var root4 = _7a4687({ defaultClassName: "o33ul20", variantClassNames: { size: { sm: "o33ul21", md: "o33ul22" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
634
|
+
var thumb = _7a4687({ defaultClassName: "o33ul26", variantClassNames: { size: { sm: "o33ul27", md: "o33ul28" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
635
|
+
var track = _7a4687({ defaultClassName: "o33ul23", variantClassNames: { size: { sm: "o33ul24", md: "o33ul25" } }, defaultVariants: { size: "md" }, compoundVariants: [] });
|
|
636
|
+
|
|
637
|
+
// src/components/Switch/Switch.tsx
|
|
638
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
639
|
+
var Switch = forwardRef9(function Switch2({ label: label3, size, id, className, disabled, "aria-label": ariaLabel, ...rest }, ref) {
|
|
640
|
+
const generatedId = useId4();
|
|
641
|
+
const switchId = id ?? generatedId;
|
|
642
|
+
return /* @__PURE__ */ jsxs8("span", { className: cx(root4({ size }), className), "data-disabled": disabled || void 0, children: [
|
|
643
|
+
/* @__PURE__ */ jsx10(
|
|
644
|
+
RadixSwitch.Root,
|
|
645
|
+
{
|
|
646
|
+
ref,
|
|
647
|
+
id: switchId,
|
|
648
|
+
disabled,
|
|
649
|
+
"aria-label": ariaLabel,
|
|
650
|
+
className: track({ size }),
|
|
651
|
+
...rest,
|
|
652
|
+
children: /* @__PURE__ */ jsx10(RadixSwitch.Thumb, { className: thumb({ size }) })
|
|
653
|
+
}
|
|
654
|
+
),
|
|
655
|
+
label3 && /* @__PURE__ */ jsx10("label", { htmlFor: switchId, className: label2, children: label3 })
|
|
656
|
+
] });
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
// src/components/Textarea/Textarea.tsx
|
|
660
|
+
import {
|
|
661
|
+
forwardRef as forwardRef10,
|
|
662
|
+
useCallback,
|
|
663
|
+
useEffect as useEffect2,
|
|
664
|
+
useId as useId5,
|
|
665
|
+
useLayoutEffect,
|
|
666
|
+
useRef as useRef2,
|
|
667
|
+
useState
|
|
668
|
+
} from "react";
|
|
669
|
+
|
|
670
|
+
// src/components/Textarea/Textarea.css.ts
|
|
671
|
+
import { createRuntimeFn as _7a4688 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
672
|
+
var count = "_1koawa9";
|
|
673
|
+
var countOver = "_1koawaa";
|
|
674
|
+
var defaultWidth = "_1koawa7";
|
|
675
|
+
var footer2 = "_1koawa8";
|
|
676
|
+
var textarea = _7a4688({ defaultClassName: "_1koawa0", variantClassNames: { size: { sm: "_1koawa1", md: "_1koawa2", lg: "_1koawa3" }, resize: { none: "_1koawa4", vertical: "_1koawa5", both: "_1koawa6" } }, defaultVariants: { size: "md", resize: "vertical" }, compoundVariants: [] });
|
|
677
|
+
|
|
678
|
+
// src/components/Textarea/Textarea.tsx
|
|
679
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
680
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect2;
|
|
681
|
+
var Textarea = forwardRef10(function Textarea2({
|
|
682
|
+
label: label3,
|
|
683
|
+
helperText: helperText2,
|
|
684
|
+
error,
|
|
685
|
+
size,
|
|
686
|
+
fullWidth,
|
|
687
|
+
resize,
|
|
688
|
+
autoResize,
|
|
689
|
+
showCount,
|
|
690
|
+
required,
|
|
691
|
+
id,
|
|
692
|
+
rows = 3,
|
|
693
|
+
value: value2,
|
|
694
|
+
defaultValue,
|
|
695
|
+
onChange,
|
|
696
|
+
maxLength,
|
|
697
|
+
className,
|
|
698
|
+
style,
|
|
699
|
+
"aria-describedby": ariaDescribedBy,
|
|
700
|
+
...rest
|
|
701
|
+
}, ref) {
|
|
702
|
+
const generatedId = useId5();
|
|
703
|
+
const textareaId = id ?? generatedId;
|
|
704
|
+
const helperId = helperText2 ? `${textareaId}-helper` : void 0;
|
|
705
|
+
const innerRef = useRef2(null);
|
|
706
|
+
const [uncontrolledLength, setUncontrolledLength] = useState(() => String(defaultValue ?? "").length);
|
|
707
|
+
const length = value2 !== void 0 ? String(value2).length : uncontrolledLength;
|
|
708
|
+
const fitHeight = useCallback(() => {
|
|
709
|
+
const el = innerRef.current;
|
|
710
|
+
if (!autoResize || !el) return;
|
|
711
|
+
el.style.height = "auto";
|
|
712
|
+
const borders = el.offsetHeight - el.clientHeight;
|
|
713
|
+
el.style.height = `${el.scrollHeight + borders}px`;
|
|
714
|
+
}, [autoResize]);
|
|
715
|
+
useIsomorphicLayoutEffect(fitHeight, [fitHeight, value2]);
|
|
716
|
+
const handleChange = (event) => {
|
|
717
|
+
if (value2 === void 0) setUncontrolledLength(event.target.value.length);
|
|
718
|
+
fitHeight();
|
|
719
|
+
onChange?.(event);
|
|
720
|
+
};
|
|
721
|
+
return /* @__PURE__ */ jsxs9("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
722
|
+
label3 && /* @__PURE__ */ jsxs9("label", { htmlFor: textareaId, className: label, children: [
|
|
723
|
+
label3,
|
|
724
|
+
required && /* @__PURE__ */ jsx11("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
725
|
+
] }),
|
|
726
|
+
/* @__PURE__ */ jsx11(
|
|
727
|
+
"textarea",
|
|
728
|
+
{
|
|
729
|
+
ref: mergeRefs(innerRef, ref),
|
|
730
|
+
id: textareaId,
|
|
731
|
+
rows,
|
|
732
|
+
value: value2,
|
|
733
|
+
defaultValue,
|
|
734
|
+
onChange: handleChange,
|
|
735
|
+
maxLength,
|
|
736
|
+
required,
|
|
737
|
+
"aria-invalid": error || void 0,
|
|
738
|
+
"aria-describedby": cx(helperId, ariaDescribedBy) || void 0,
|
|
739
|
+
className: cx(
|
|
740
|
+
textarea({ size, resize: autoResize ? "none" : resize }),
|
|
741
|
+
!fullWidth && defaultWidth,
|
|
742
|
+
className
|
|
743
|
+
),
|
|
744
|
+
style: autoResize ? { overflowY: "auto", ...style } : style,
|
|
745
|
+
...rest
|
|
746
|
+
}
|
|
747
|
+
),
|
|
748
|
+
(helperText2 || showCount) && /* @__PURE__ */ jsxs9("div", { className: footer2, children: [
|
|
749
|
+
helperText2 && /* @__PURE__ */ jsx11("p", { id: helperId, className: helperText({ error }), children: helperText2 }),
|
|
750
|
+
showCount && /* @__PURE__ */ jsx11("span", { className: cx(count, maxLength !== void 0 && length >= maxLength && countOver), children: maxLength !== void 0 ? `${length}/${maxLength}` : length })
|
|
751
|
+
] })
|
|
752
|
+
] });
|
|
753
|
+
});
|
|
754
|
+
|
|
536
755
|
// src/components/Toast/Toast.tsx
|
|
537
756
|
import * as RadixToast from "@radix-ui/react-toast";
|
|
538
|
-
import { createContext as createContext2, useCallback, useContext as useContext2, useMemo as useMemo2, useRef as
|
|
757
|
+
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useMemo as useMemo2, useRef as useRef3, useState as useState2 } from "react";
|
|
539
758
|
import { XIcon as XIcon2 } from "@bestow-ui/icons";
|
|
540
759
|
|
|
541
760
|
// src/components/Toast/Toast.css.ts
|
|
542
|
-
import { createRuntimeFn as
|
|
761
|
+
import { createRuntimeFn as _7a4689 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
543
762
|
var action = "_1g11zvx7";
|
|
544
763
|
var close = "_1g11zvx8";
|
|
545
|
-
var
|
|
764
|
+
var description3 = "_1g11zvx6";
|
|
546
765
|
var title2 = "_1g11zvx5";
|
|
547
|
-
var toast =
|
|
766
|
+
var toast = _7a4689({ defaultClassName: "_1g11zvx1", variantClassNames: { variant: { "default": "_1g11zvx2", success: "_1g11zvx3", danger: "_1g11zvx4" } }, defaultVariants: { variant: "default" }, compoundVariants: [] });
|
|
548
767
|
var viewport2 = "_1g11zvx0";
|
|
549
768
|
|
|
550
769
|
// src/components/Toast/Toast.tsx
|
|
551
|
-
import { jsx as
|
|
770
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
552
771
|
var REMOVE_DELAY = 500;
|
|
553
772
|
var ToastContext = createContext2(null);
|
|
554
|
-
function ToastProvider({ children, duration = 5e3, label:
|
|
555
|
-
const [toasts, setToasts] =
|
|
556
|
-
const nextId =
|
|
773
|
+
function ToastProvider({ children, duration = 5e3, label: label3 = "\uC54C\uB9BC" }) {
|
|
774
|
+
const [toasts, setToasts] = useState2([]);
|
|
775
|
+
const nextId = useRef3(0);
|
|
557
776
|
const portal2 = usePortalProps();
|
|
558
|
-
const toast2 =
|
|
777
|
+
const toast2 = useCallback2((options) => {
|
|
559
778
|
const id = nextId.current++;
|
|
560
779
|
setToasts((prev) => [...prev, { ...options, id, open: true }]);
|
|
561
780
|
return id;
|
|
562
781
|
}, []);
|
|
563
|
-
const dismiss =
|
|
782
|
+
const dismiss = useCallback2((id) => {
|
|
564
783
|
const isTarget = (t) => id === void 0 || t.id === id;
|
|
565
784
|
setToasts((prev) => prev.map((t) => isTarget(t) ? { ...t, open: false } : t));
|
|
566
785
|
setTimeout(() => setToasts((prev) => prev.filter((t) => t.open || !isTarget(t))), REMOVE_DELAY);
|
|
567
786
|
}, []);
|
|
568
787
|
const value2 = useMemo2(() => ({ toast: toast2, dismiss }), [toast2, dismiss]);
|
|
569
|
-
return /* @__PURE__ */
|
|
788
|
+
return /* @__PURE__ */ jsx12(ToastContext.Provider, { value: value2, children: /* @__PURE__ */ jsxs10(RadixToast.Provider, { duration, label: label3, swipeDirection: "right", children: [
|
|
570
789
|
children,
|
|
571
|
-
toasts.map(({ id, open, title: title3, description:
|
|
790
|
+
toasts.map(({ id, open, title: title3, description: description4, variant, duration: itemDuration, action: action2 }) => /* @__PURE__ */ jsxs10(
|
|
572
791
|
RadixToast.Root,
|
|
573
792
|
{
|
|
574
793
|
open,
|
|
@@ -578,15 +797,15 @@ function ToastProvider({ children, duration = 5e3, label: label2 = "\uC54C\uB9BC
|
|
|
578
797
|
},
|
|
579
798
|
className: toast({ variant }),
|
|
580
799
|
children: [
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
|
|
583
|
-
action2 && /* @__PURE__ */
|
|
584
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsx12(RadixToast.Title, { className: title2, children: title3 }),
|
|
801
|
+
description4 && /* @__PURE__ */ jsx12(RadixToast.Description, { className: description3, children: description4 }),
|
|
802
|
+
action2 && /* @__PURE__ */ jsx12(RadixToast.Action, { asChild: true, altText: action2.altText ?? action2.label, className: action, children: /* @__PURE__ */ jsx12(Button, { size: "sm", variant: "soft", color: "neutral", onClick: action2.onClick, children: action2.label }) }),
|
|
803
|
+
/* @__PURE__ */ jsx12(RadixToast.Close, { className: close, "aria-label": "\uB2EB\uAE30", children: /* @__PURE__ */ jsx12(XIcon2, { size: 16 }) })
|
|
585
804
|
]
|
|
586
805
|
},
|
|
587
806
|
id
|
|
588
807
|
)),
|
|
589
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ jsx12(RadixToast.Viewport, { className: cx(portal2.className, viewport2), style: portal2.style })
|
|
590
809
|
] }) });
|
|
591
810
|
}
|
|
592
811
|
function useToast() {
|
|
@@ -603,7 +822,7 @@ var arrow = "z7rufs1";
|
|
|
603
822
|
var content3 = "z7rufs0";
|
|
604
823
|
|
|
605
824
|
// src/components/Tooltip/Tooltip.tsx
|
|
606
|
-
import { jsx as
|
|
825
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
607
826
|
function Tooltip({
|
|
608
827
|
content: content4,
|
|
609
828
|
children,
|
|
@@ -618,9 +837,9 @@ function Tooltip({
|
|
|
618
837
|
}) {
|
|
619
838
|
const portal2 = usePortalProps();
|
|
620
839
|
if (disabled || content4 == null || content4 === "") return children;
|
|
621
|
-
return /* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ jsx13(RadixTooltip.Provider, { delayDuration: delay, children: /* @__PURE__ */ jsxs11(RadixTooltip.Root, { open, defaultOpen, onOpenChange, children: [
|
|
841
|
+
/* @__PURE__ */ jsx13(RadixTooltip.Trigger, { asChild: true, children }),
|
|
842
|
+
/* @__PURE__ */ jsx13(RadixTooltip.Portal, { children: /* @__PURE__ */ jsxs11(
|
|
624
843
|
RadixTooltip.Content,
|
|
625
844
|
{
|
|
626
845
|
side,
|
|
@@ -631,7 +850,7 @@ function Tooltip({
|
|
|
631
850
|
style: portal2.style,
|
|
632
851
|
children: [
|
|
633
852
|
content4,
|
|
634
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx13(RadixTooltip.Arrow, { className: arrow, width: 10, height: 5 })
|
|
635
854
|
]
|
|
636
855
|
}
|
|
637
856
|
) })
|
|
@@ -639,14 +858,14 @@ function Tooltip({
|
|
|
639
858
|
}
|
|
640
859
|
|
|
641
860
|
// src/components/Typography/Typography.tsx
|
|
642
|
-
import { forwardRef as
|
|
861
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
643
862
|
|
|
644
863
|
// src/components/Typography/Typography.css.ts
|
|
645
|
-
import { createRuntimeFn as
|
|
646
|
-
var typography =
|
|
864
|
+
import { createRuntimeFn as _7a46810 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
865
|
+
var typography = _7a46810({ 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: [] });
|
|
647
866
|
|
|
648
867
|
// src/components/Typography/Typography.tsx
|
|
649
|
-
import { jsx as
|
|
868
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
650
869
|
var defaultElement = {
|
|
651
870
|
display: "h1",
|
|
652
871
|
h1: "h1",
|
|
@@ -658,9 +877,9 @@ var defaultElement = {
|
|
|
658
877
|
"body-sm": "p",
|
|
659
878
|
caption: "span"
|
|
660
879
|
};
|
|
661
|
-
var Typography =
|
|
880
|
+
var Typography = forwardRef11(function Typography2({ variant = "body", as, color, weight, align, truncate, className, ...rest }, ref) {
|
|
662
881
|
const Component = as ?? defaultElement[variant];
|
|
663
|
-
return /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ jsx14(
|
|
664
883
|
Component,
|
|
665
884
|
{
|
|
666
885
|
ref,
|
|
@@ -675,9 +894,12 @@ export {
|
|
|
675
894
|
Input,
|
|
676
895
|
Modal,
|
|
677
896
|
ModalClose,
|
|
897
|
+
RadioGroup,
|
|
678
898
|
Select,
|
|
679
899
|
Stack,
|
|
900
|
+
Switch,
|
|
680
901
|
TextField,
|
|
902
|
+
Textarea,
|
|
681
903
|
ThemeProvider,
|
|
682
904
|
ToastProvider,
|
|
683
905
|
Tooltip,
|