@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.js
CHANGED
|
@@ -112,7 +112,11 @@ function createIntentColors(intent, color) {
|
|
|
112
112
|
subtleHover: rgba(darkSolid, 0.26),
|
|
113
113
|
text: findReadable(darkBase, Math.max(darkBase.l, 0.75), 0.02, [darkBg, darkSubtleOnBg, darkSubtleHoverOnBg])
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
const focus = intent === "primary" ? { light: { border: { focus: light.solid } }, dark: { border: { focus: dark.solidHover } } } : void 0;
|
|
116
|
+
return {
|
|
117
|
+
light: { color: { [intent]: light, ...focus?.light } },
|
|
118
|
+
dark: { color: { [intent]: dark, ...focus?.dark } }
|
|
119
|
+
};
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
// src/theme/createTheme.ts
|
|
@@ -252,7 +256,7 @@ var root2 = _7a4682({ defaultClassName: "_1y7mzsn0", variantClassNames: { size:
|
|
|
252
256
|
|
|
253
257
|
// src/components/Checkbox/Checkbox.tsx
|
|
254
258
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
255
|
-
var Checkbox = forwardRef3(function Checkbox2({ label:
|
|
259
|
+
var Checkbox = forwardRef3(function Checkbox2({ label: label3, size, indeterminate = false, invalid, disabled, className, ...rest }, ref) {
|
|
256
260
|
const innerRef = useRef(null);
|
|
257
261
|
useEffect(() => {
|
|
258
262
|
if (innerRef.current) innerRef.current.indeterminate = indeterminate;
|
|
@@ -273,7 +277,7 @@ var Checkbox = forwardRef3(function Checkbox2({ label: label2, size, indetermina
|
|
|
273
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" }) }),
|
|
274
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" }) })
|
|
275
279
|
] }),
|
|
276
|
-
|
|
280
|
+
label3
|
|
277
281
|
] });
|
|
278
282
|
});
|
|
279
283
|
|
|
@@ -321,13 +325,13 @@ var Input = forwardRef4(function Input2({ size, invalid, fullWidth, startAdornme
|
|
|
321
325
|
// src/components/Input/TextField.tsx
|
|
322
326
|
import { forwardRef as forwardRef5, useId } from "react";
|
|
323
327
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
324
|
-
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) {
|
|
325
329
|
const generatedId = useId();
|
|
326
330
|
const inputId = id ?? generatedId;
|
|
327
331
|
const helperId = helperText2 ? `${inputId}-helper` : void 0;
|
|
328
332
|
return /* @__PURE__ */ jsxs4("div", { className: cx(field, fullWidth && fieldFullWidth), children: [
|
|
329
|
-
|
|
330
|
-
|
|
333
|
+
label3 && /* @__PURE__ */ jsxs4("label", { htmlFor: inputId, className: label, children: [
|
|
334
|
+
label3,
|
|
331
335
|
required && /* @__PURE__ */ jsx5("span", { className: requiredMark, "aria-hidden": true, children: "*" })
|
|
332
336
|
] }),
|
|
333
337
|
/* @__PURE__ */ jsx5(
|
|
@@ -370,9 +374,9 @@ function Modal({
|
|
|
370
374
|
onOpenChange,
|
|
371
375
|
trigger: trigger2,
|
|
372
376
|
title: title3,
|
|
373
|
-
description:
|
|
377
|
+
description: description4,
|
|
374
378
|
children,
|
|
375
|
-
footer:
|
|
379
|
+
footer: footer3,
|
|
376
380
|
size,
|
|
377
381
|
hideCloseButton = false,
|
|
378
382
|
closeOnOverlayClick = true,
|
|
@@ -389,17 +393,17 @@ function Modal({
|
|
|
389
393
|
className: cx(portal2.className, content({ size }), className),
|
|
390
394
|
style: portal2.style,
|
|
391
395
|
onPointerDownOutside: closeOnOverlayClick ? void 0 : (event) => event.preventDefault(),
|
|
392
|
-
...
|
|
396
|
+
...description4 ? {} : { "aria-describedby": void 0 },
|
|
393
397
|
children: [
|
|
394
398
|
/* @__PURE__ */ jsxs5("div", { className: header, children: [
|
|
395
399
|
/* @__PURE__ */ jsxs5("div", { className: headings, children: [
|
|
396
400
|
/* @__PURE__ */ jsx6(Dialog.Title, { className: title, children: title3 }),
|
|
397
|
-
|
|
401
|
+
description4 && /* @__PURE__ */ jsx6(Dialog.Description, { className: description, children: description4 })
|
|
398
402
|
] }),
|
|
399
403
|
!hideCloseButton && /* @__PURE__ */ jsx6(Dialog.Close, { className: closeButton, "aria-label": "\uB2EB\uAE30", children: /* @__PURE__ */ jsx6(XIcon, { size: 16 }) })
|
|
400
404
|
] }),
|
|
401
405
|
children && /* @__PURE__ */ jsx6("div", { className: body, children }),
|
|
402
|
-
|
|
406
|
+
footer3 && /* @__PURE__ */ jsx6("div", { className: footer, children: footer3 })
|
|
403
407
|
]
|
|
404
408
|
}
|
|
405
409
|
)
|
|
@@ -408,9 +412,99 @@ function Modal({
|
|
|
408
412
|
}
|
|
409
413
|
var ModalClose = Dialog.Close;
|
|
410
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
|
+
|
|
411
505
|
// src/components/Select/Select.tsx
|
|
412
506
|
import * as RadixSelect from "@radix-ui/react-select";
|
|
413
|
-
import { forwardRef as
|
|
507
|
+
import { forwardRef as forwardRef7, useId as useId3 } from "react";
|
|
414
508
|
import { CheckIcon, ChevronDownIcon } from "@bestow-ui/icons";
|
|
415
509
|
|
|
416
510
|
// src/components/Select/Select.css.ts
|
|
@@ -423,45 +517,47 @@ var value = "_1kx81e81";
|
|
|
423
517
|
var viewport = "_1kx81e84";
|
|
424
518
|
|
|
425
519
|
// src/components/Select/Select.tsx
|
|
426
|
-
import { jsx as
|
|
427
|
-
var Select =
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
520
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
521
|
+
var Select = forwardRef7(function Select2(props, ref) {
|
|
522
|
+
const {
|
|
523
|
+
options,
|
|
524
|
+
value: value2,
|
|
525
|
+
defaultValue,
|
|
526
|
+
onValueChange,
|
|
527
|
+
placeholder,
|
|
528
|
+
label: label3,
|
|
529
|
+
helperText: helperText2,
|
|
530
|
+
error,
|
|
531
|
+
size,
|
|
532
|
+
fullWidth,
|
|
533
|
+
disabled,
|
|
534
|
+
required,
|
|
535
|
+
name,
|
|
536
|
+
id,
|
|
537
|
+
"aria-label": ariaLabel,
|
|
538
|
+
className
|
|
539
|
+
} = props;
|
|
540
|
+
const isControlled = "value" in props;
|
|
541
|
+
const generatedId = useId3();
|
|
446
542
|
const triggerId = id ?? generatedId;
|
|
447
543
|
const helperId = helperText2 ? `${triggerId}-helper` : void 0;
|
|
448
544
|
const portal2 = usePortalProps();
|
|
449
|
-
return /* @__PURE__ */
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
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: "*" })
|
|
453
549
|
] }),
|
|
454
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ jsxs7(
|
|
455
551
|
RadixSelect.Root,
|
|
456
552
|
{
|
|
457
|
-
value: value2,
|
|
553
|
+
value: isControlled ? value2 ?? "" : void 0,
|
|
458
554
|
defaultValue,
|
|
459
555
|
onValueChange,
|
|
460
556
|
disabled,
|
|
461
557
|
required,
|
|
462
558
|
name,
|
|
463
559
|
children: [
|
|
464
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ jsxs7(
|
|
465
561
|
RadixSelect.Trigger,
|
|
466
562
|
{
|
|
467
563
|
ref,
|
|
@@ -472,12 +568,12 @@ var Select = forwardRef6(function Select2({
|
|
|
472
568
|
"data-invalid": error || void 0,
|
|
473
569
|
className: cx(root3({ size, fullWidth }), trigger, className),
|
|
474
570
|
children: [
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
/* @__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 }) })
|
|
477
573
|
]
|
|
478
574
|
}
|
|
479
575
|
),
|
|
480
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ jsx8(RadixSelect.Portal, { children: /* @__PURE__ */ jsx8(
|
|
481
577
|
RadixSelect.Content,
|
|
482
578
|
{
|
|
483
579
|
position: "popper",
|
|
@@ -485,39 +581,39 @@ var Select = forwardRef6(function Select2({
|
|
|
485
581
|
collisionPadding: 8,
|
|
486
582
|
className: cx(portal2.className, content2),
|
|
487
583
|
style: portal2.style,
|
|
488
|
-
children: /* @__PURE__ */
|
|
584
|
+
children: /* @__PURE__ */ jsx8(RadixSelect.Viewport, { className: viewport, children: options.map((option2) => /* @__PURE__ */ jsxs7(
|
|
489
585
|
RadixSelect.Item,
|
|
490
586
|
{
|
|
491
|
-
value:
|
|
492
|
-
disabled:
|
|
587
|
+
value: option2.value,
|
|
588
|
+
disabled: option2.disabled,
|
|
493
589
|
className: item,
|
|
494
590
|
children: [
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ jsx8(RadixSelect.ItemText, { children: option2.label }),
|
|
592
|
+
/* @__PURE__ */ jsx8(RadixSelect.ItemIndicator, { className: itemIndicator, children: /* @__PURE__ */ jsx8(CheckIcon, { size: 16 }) })
|
|
497
593
|
]
|
|
498
594
|
},
|
|
499
|
-
|
|
595
|
+
option2.value
|
|
500
596
|
)) })
|
|
501
597
|
}
|
|
502
598
|
) })
|
|
503
599
|
]
|
|
504
600
|
}
|
|
505
601
|
),
|
|
506
|
-
helperText2 && /* @__PURE__ */
|
|
602
|
+
helperText2 && /* @__PURE__ */ jsx8("p", { id: helperId, className: helperText({ error }), children: helperText2 })
|
|
507
603
|
] });
|
|
508
604
|
});
|
|
509
605
|
|
|
510
606
|
// src/components/Stack/Stack.tsx
|
|
511
|
-
import { forwardRef as
|
|
607
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
512
608
|
|
|
513
609
|
// src/components/Stack/Stack.css.ts
|
|
514
|
-
import { createRuntimeFn as
|
|
515
|
-
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: [] });
|
|
516
612
|
|
|
517
613
|
// src/components/Stack/Stack.tsx
|
|
518
|
-
import { jsx as
|
|
519
|
-
var Stack =
|
|
520
|
-
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(
|
|
521
617
|
Component,
|
|
522
618
|
{
|
|
523
619
|
ref,
|
|
@@ -527,42 +623,171 @@ var Stack = forwardRef7(function Stack2({ as: Component = "div", direction, gap,
|
|
|
527
623
|
);
|
|
528
624
|
});
|
|
529
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
|
+
|
|
530
755
|
// src/components/Toast/Toast.tsx
|
|
531
756
|
import * as RadixToast from "@radix-ui/react-toast";
|
|
532
|
-
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";
|
|
533
758
|
import { XIcon as XIcon2 } from "@bestow-ui/icons";
|
|
534
759
|
|
|
535
760
|
// src/components/Toast/Toast.css.ts
|
|
536
|
-
import { createRuntimeFn as
|
|
761
|
+
import { createRuntimeFn as _7a4689 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
537
762
|
var action = "_1g11zvx7";
|
|
538
763
|
var close = "_1g11zvx8";
|
|
539
|
-
var
|
|
764
|
+
var description3 = "_1g11zvx6";
|
|
540
765
|
var title2 = "_1g11zvx5";
|
|
541
|
-
var toast =
|
|
766
|
+
var toast = _7a4689({ defaultClassName: "_1g11zvx1", variantClassNames: { variant: { "default": "_1g11zvx2", success: "_1g11zvx3", danger: "_1g11zvx4" } }, defaultVariants: { variant: "default" }, compoundVariants: [] });
|
|
542
767
|
var viewport2 = "_1g11zvx0";
|
|
543
768
|
|
|
544
769
|
// src/components/Toast/Toast.tsx
|
|
545
|
-
import { jsx as
|
|
770
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
546
771
|
var REMOVE_DELAY = 500;
|
|
547
772
|
var ToastContext = createContext2(null);
|
|
548
|
-
function ToastProvider({ children, duration = 5e3, label:
|
|
549
|
-
const [toasts, setToasts] =
|
|
550
|
-
const nextId =
|
|
773
|
+
function ToastProvider({ children, duration = 5e3, label: label3 = "\uC54C\uB9BC" }) {
|
|
774
|
+
const [toasts, setToasts] = useState2([]);
|
|
775
|
+
const nextId = useRef3(0);
|
|
551
776
|
const portal2 = usePortalProps();
|
|
552
|
-
const toast2 =
|
|
777
|
+
const toast2 = useCallback2((options) => {
|
|
553
778
|
const id = nextId.current++;
|
|
554
779
|
setToasts((prev) => [...prev, { ...options, id, open: true }]);
|
|
555
780
|
return id;
|
|
556
781
|
}, []);
|
|
557
|
-
const dismiss =
|
|
782
|
+
const dismiss = useCallback2((id) => {
|
|
558
783
|
const isTarget = (t) => id === void 0 || t.id === id;
|
|
559
784
|
setToasts((prev) => prev.map((t) => isTarget(t) ? { ...t, open: false } : t));
|
|
560
785
|
setTimeout(() => setToasts((prev) => prev.filter((t) => t.open || !isTarget(t))), REMOVE_DELAY);
|
|
561
786
|
}, []);
|
|
562
787
|
const value2 = useMemo2(() => ({ toast: toast2, dismiss }), [toast2, dismiss]);
|
|
563
|
-
return /* @__PURE__ */
|
|
788
|
+
return /* @__PURE__ */ jsx12(ToastContext.Provider, { value: value2, children: /* @__PURE__ */ jsxs10(RadixToast.Provider, { duration, label: label3, swipeDirection: "right", children: [
|
|
564
789
|
children,
|
|
565
|
-
toasts.map(({ id, open, title: title3, description:
|
|
790
|
+
toasts.map(({ id, open, title: title3, description: description4, variant, duration: itemDuration, action: action2 }) => /* @__PURE__ */ jsxs10(
|
|
566
791
|
RadixToast.Root,
|
|
567
792
|
{
|
|
568
793
|
open,
|
|
@@ -572,15 +797,15 @@ function ToastProvider({ children, duration = 5e3, label: label2 = "\uC54C\uB9BC
|
|
|
572
797
|
},
|
|
573
798
|
className: toast({ variant }),
|
|
574
799
|
children: [
|
|
575
|
-
/* @__PURE__ */
|
|
576
|
-
|
|
577
|
-
action2 && /* @__PURE__ */
|
|
578
|
-
/* @__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 }) })
|
|
579
804
|
]
|
|
580
805
|
},
|
|
581
806
|
id
|
|
582
807
|
)),
|
|
583
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ jsx12(RadixToast.Viewport, { className: cx(portal2.className, viewport2), style: portal2.style })
|
|
584
809
|
] }) });
|
|
585
810
|
}
|
|
586
811
|
function useToast() {
|
|
@@ -597,7 +822,7 @@ var arrow = "z7rufs1";
|
|
|
597
822
|
var content3 = "z7rufs0";
|
|
598
823
|
|
|
599
824
|
// src/components/Tooltip/Tooltip.tsx
|
|
600
|
-
import { jsx as
|
|
825
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
601
826
|
function Tooltip({
|
|
602
827
|
content: content4,
|
|
603
828
|
children,
|
|
@@ -612,9 +837,9 @@ function Tooltip({
|
|
|
612
837
|
}) {
|
|
613
838
|
const portal2 = usePortalProps();
|
|
614
839
|
if (disabled || content4 == null || content4 === "") return children;
|
|
615
|
-
return /* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__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(
|
|
618
843
|
RadixTooltip.Content,
|
|
619
844
|
{
|
|
620
845
|
side,
|
|
@@ -625,7 +850,7 @@ function Tooltip({
|
|
|
625
850
|
style: portal2.style,
|
|
626
851
|
children: [
|
|
627
852
|
content4,
|
|
628
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx13(RadixTooltip.Arrow, { className: arrow, width: 10, height: 5 })
|
|
629
854
|
]
|
|
630
855
|
}
|
|
631
856
|
) })
|
|
@@ -633,14 +858,14 @@ function Tooltip({
|
|
|
633
858
|
}
|
|
634
859
|
|
|
635
860
|
// src/components/Typography/Typography.tsx
|
|
636
|
-
import { forwardRef as
|
|
861
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
637
862
|
|
|
638
863
|
// src/components/Typography/Typography.css.ts
|
|
639
|
-
import { createRuntimeFn as
|
|
640
|
-
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: [] });
|
|
641
866
|
|
|
642
867
|
// src/components/Typography/Typography.tsx
|
|
643
|
-
import { jsx as
|
|
868
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
644
869
|
var defaultElement = {
|
|
645
870
|
display: "h1",
|
|
646
871
|
h1: "h1",
|
|
@@ -652,9 +877,9 @@ var defaultElement = {
|
|
|
652
877
|
"body-sm": "p",
|
|
653
878
|
caption: "span"
|
|
654
879
|
};
|
|
655
|
-
var Typography =
|
|
880
|
+
var Typography = forwardRef11(function Typography2({ variant = "body", as, color, weight, align, truncate, className, ...rest }, ref) {
|
|
656
881
|
const Component = as ?? defaultElement[variant];
|
|
657
|
-
return /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ jsx14(
|
|
658
883
|
Component,
|
|
659
884
|
{
|
|
660
885
|
ref,
|
|
@@ -669,9 +894,12 @@ export {
|
|
|
669
894
|
Input,
|
|
670
895
|
Modal,
|
|
671
896
|
ModalClose,
|
|
897
|
+
RadioGroup,
|
|
672
898
|
Select,
|
|
673
899
|
Stack,
|
|
900
|
+
Switch,
|
|
674
901
|
TextField,
|
|
902
|
+
Textarea,
|
|
675
903
|
ThemeProvider,
|
|
676
904
|
ToastProvider,
|
|
677
905
|
Tooltip,
|