@charcoal-ui/react 4.3.0-beta.5 → 4.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/components/MultiSelect/context.d.ts +14 -0
- package/dist/components/MultiSelect/context.d.ts.map +1 -0
- package/dist/components/MultiSelect/index.d.ts +38 -0
- package/dist/components/MultiSelect/index.d.ts.map +1 -0
- package/dist/index.cjs.js +318 -216
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +111 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +281 -181
- package/dist/index.esm.js.map +1 -1
- package/dist/layered.css +111 -0
- package/dist/layered.css.map +1 -1
- package/package.json +6 -7
- package/src/components/Button/__snapshots__/index.story.storyshot +89 -71
- package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +50 -53
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +108 -102
- package/src/components/Clickable/__snapshots__/index.story.storyshot +19 -17
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +45 -54
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +238 -275
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +28 -50
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +780 -1158
- package/src/components/Icon/__snapshots__/index.story.storyshot +9 -7
- package/src/components/IconButton/__snapshots__/index.story.storyshot +43 -37
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +52 -64
- package/src/components/Modal/__snapshots__/index.story.storyshot +568 -716
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +531 -0
- package/src/components/MultiSelect/context.ts +23 -0
- package/src/components/MultiSelect/index.css +139 -0
- package/src/components/MultiSelect/index.story.tsx +118 -0
- package/src/components/MultiSelect/index.test.tsx +255 -0
- package/src/components/MultiSelect/index.tsx +153 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +313 -367
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +116 -228
- package/src/components/Switch/__snapshots__/index.story.storyshot +74 -73
- package/src/components/TagItem/__snapshots__/index.story.storyshot +177 -193
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +372 -533
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +444 -583
- package/src/index.ts +6 -0
package/dist/index.cjs.js
CHANGED
|
@@ -48,6 +48,8 @@ __export(src_exports, {
|
|
|
48
48
|
ModalButtons: () => ModalButtons,
|
|
49
49
|
ModalCloseButton: () => ModalCloseButton,
|
|
50
50
|
ModalHeader: () => ModalHeader,
|
|
51
|
+
MultiSelect: () => MultiSelect_default,
|
|
52
|
+
MultiSelectGroup: () => MultiSelectGroup,
|
|
51
53
|
OverlayProvider: () => import_overlays.OverlayProvider,
|
|
52
54
|
Radio: () => Radio_default,
|
|
53
55
|
RadioGroup: () => RadioGroup,
|
|
@@ -422,31 +424,144 @@ var RadioGroup = (0, import_react9.forwardRef)(function RadioGroupInner({
|
|
|
422
424
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { role: "radiogroup", "aria-disabled": disabled, "aria-invalid": invalid, "aria-label": label, "aria-labelledby": props["aria-labelledby"], "aria-orientation": ariaOrientation, className: classNames, ref, children }) });
|
|
423
425
|
});
|
|
424
426
|
|
|
425
|
-
// src/components/
|
|
427
|
+
// src/components/MultiSelect/index.tsx
|
|
426
428
|
var import_react11 = require("react");
|
|
427
|
-
var
|
|
429
|
+
var import_warning2 = __toESM(require("warning"));
|
|
428
430
|
|
|
429
|
-
// src/components/
|
|
431
|
+
// src/components/MultiSelect/context.ts
|
|
430
432
|
var import_react10 = require("react");
|
|
433
|
+
var MultiSelectGroupContext = (0, import_react10.createContext)({
|
|
434
|
+
name: void 0,
|
|
435
|
+
selected: [],
|
|
436
|
+
disabled: false,
|
|
437
|
+
readonly: false,
|
|
438
|
+
invalid: false,
|
|
439
|
+
onChange() {
|
|
440
|
+
throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?");
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
// src/components/Icon/index.tsx
|
|
445
|
+
var React5 = __toESM(require("react"));
|
|
446
|
+
var import_icons = require("@charcoal-ui/icons");
|
|
431
447
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
432
|
-
var
|
|
448
|
+
var Icon = React5.forwardRef(function IconInner({
|
|
449
|
+
name,
|
|
450
|
+
scale,
|
|
451
|
+
unsafeNonGuidelineScale,
|
|
452
|
+
className,
|
|
453
|
+
...rest
|
|
454
|
+
}, ref) {
|
|
455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
456
|
+
});
|
|
457
|
+
var Icon_default = Icon;
|
|
458
|
+
|
|
459
|
+
// src/components/MultiSelect/index.tsx
|
|
460
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
461
|
+
var MultiSelect = (0, import_react11.forwardRef)(function MultiSelectInner({
|
|
462
|
+
value,
|
|
463
|
+
disabled = false,
|
|
464
|
+
onChange,
|
|
465
|
+
variant = "default",
|
|
466
|
+
className,
|
|
467
|
+
children
|
|
468
|
+
}, ref) {
|
|
469
|
+
const {
|
|
470
|
+
name,
|
|
471
|
+
selected,
|
|
472
|
+
disabled: parentDisabled,
|
|
473
|
+
readonly,
|
|
474
|
+
invalid,
|
|
475
|
+
onChange: parentOnChange
|
|
476
|
+
} = (0, import_react11.useContext)(MultiSelectGroupContext);
|
|
477
|
+
(0, import_warning2.default)(
|
|
478
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
479
|
+
name !== void 0,
|
|
480
|
+
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
481
|
+
);
|
|
482
|
+
const isSelected = selected.includes(value);
|
|
483
|
+
const isDisabled = disabled || parentDisabled || readonly;
|
|
484
|
+
const handleChange = (0, import_react11.useCallback)((event) => {
|
|
485
|
+
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (onChange)
|
|
489
|
+
onChange({
|
|
490
|
+
value,
|
|
491
|
+
selected: event.currentTarget.checked
|
|
492
|
+
});
|
|
493
|
+
parentOnChange({
|
|
494
|
+
value,
|
|
495
|
+
selected: event.currentTarget.checked
|
|
496
|
+
});
|
|
497
|
+
}, [onChange, parentOnChange, value]);
|
|
498
|
+
const classNames = useClassNames("charcoal-multi-select", className);
|
|
499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { "aria-disabled": isDisabled, className: classNames, children: [
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "charcoal-multi-select-input", name, value, type: "checkbox", checked: isSelected, disabled: isDisabled, onChange: handleChange, "data-overlay": variant === "overlay", "aria-invalid": invalid, ref }),
|
|
501
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "charcoal-multi-select-overlay", "data-overlay": variant === "overlay", "aria-invalid": invalid, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
|
|
502
|
+
Boolean(children) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "charcoal-multi-select-label", children })
|
|
503
|
+
] });
|
|
504
|
+
});
|
|
505
|
+
var MultiSelect_default = (0, import_react11.memo)(MultiSelect);
|
|
506
|
+
function MultiSelectGroup({
|
|
507
|
+
className,
|
|
508
|
+
style,
|
|
509
|
+
name,
|
|
510
|
+
label,
|
|
511
|
+
selected,
|
|
512
|
+
onChange,
|
|
513
|
+
disabled = false,
|
|
514
|
+
readonly = false,
|
|
515
|
+
invalid = false,
|
|
516
|
+
children
|
|
517
|
+
}) {
|
|
518
|
+
const handleChange = (0, import_react11.useCallback)((payload) => {
|
|
519
|
+
const index = selected.indexOf(payload.value);
|
|
520
|
+
if (payload.selected) {
|
|
521
|
+
if (index < 0) {
|
|
522
|
+
onChange([...selected, payload.value]);
|
|
523
|
+
}
|
|
524
|
+
} else {
|
|
525
|
+
if (index >= 0) {
|
|
526
|
+
onChange([...selected.slice(0, index), ...selected.slice(index + 1)]);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}, [onChange, selected]);
|
|
530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MultiSelectGroupContext.Provider, { value: {
|
|
531
|
+
name,
|
|
532
|
+
selected: Array.from(new Set(selected)),
|
|
533
|
+
disabled,
|
|
534
|
+
readonly,
|
|
535
|
+
invalid,
|
|
536
|
+
onChange: handleChange
|
|
537
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, style, "aria-label": label, "data-testid": "SelectGroup", children }) });
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// src/components/Switch/index.tsx
|
|
541
|
+
var import_react13 = require("react");
|
|
542
|
+
var import_utils = require("@react-aria/utils");
|
|
543
|
+
|
|
544
|
+
// src/components/Switch/SwitchInput/index.tsx
|
|
545
|
+
var import_react12 = require("react");
|
|
546
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
547
|
+
var SwitchInput = (0, import_react12.forwardRef)(function SwitchInput2({
|
|
433
548
|
onChange,
|
|
434
549
|
className,
|
|
435
550
|
...props
|
|
436
551
|
}, ref) {
|
|
437
|
-
const handleChange = (0,
|
|
552
|
+
const handleChange = (0, import_react12.useCallback)((e) => {
|
|
438
553
|
const el = e.currentTarget;
|
|
439
554
|
onChange?.(el.checked);
|
|
440
555
|
}, [onChange]);
|
|
441
556
|
const classNames = useClassNames("charcoal-switch-input", className);
|
|
442
|
-
return /* @__PURE__ */ (0,
|
|
557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { ref, className: classNames, type: "checkbox", onChange: handleChange, ...props });
|
|
443
558
|
});
|
|
444
559
|
var SwitchInput_default = SwitchInput;
|
|
445
560
|
|
|
446
561
|
// src/components/Switch/SwitchWithLabel.tsx
|
|
447
|
-
var
|
|
448
|
-
var
|
|
449
|
-
var SwitchWithLabel =
|
|
562
|
+
var React6 = __toESM(require("react"));
|
|
563
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
564
|
+
var SwitchWithLabel = React6.memo(function SwitchWithLabel2({
|
|
450
565
|
children,
|
|
451
566
|
className,
|
|
452
567
|
disabled,
|
|
@@ -454,15 +569,15 @@ var SwitchWithLabel = React5.memo(function SwitchWithLabel2({
|
|
|
454
569
|
input
|
|
455
570
|
}) {
|
|
456
571
|
const classNames = useClassNames("charcoal-switch__label", className);
|
|
457
|
-
return /* @__PURE__ */ (0,
|
|
572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: id, className: classNames, "aria-disabled": disabled, children: [
|
|
458
573
|
input,
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "charcoal-switch__label_div", children })
|
|
460
575
|
] });
|
|
461
576
|
});
|
|
462
577
|
|
|
463
578
|
// src/components/Switch/index.tsx
|
|
464
|
-
var
|
|
465
|
-
var Switch = (0,
|
|
579
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
580
|
+
var Switch = (0, import_react13.forwardRef)(function Switch2({
|
|
466
581
|
children,
|
|
467
582
|
onChange,
|
|
468
583
|
disabled,
|
|
@@ -472,23 +587,23 @@ var Switch = (0, import_react11.forwardRef)(function Switch2({
|
|
|
472
587
|
}, ref) {
|
|
473
588
|
const htmlId = (0, import_utils.useId)(id);
|
|
474
589
|
const noChildren = children === void 0;
|
|
475
|
-
const input = /* @__PURE__ */ (0,
|
|
590
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SwitchInput_default, { ...props, disabled, className: noChildren ? className : void 0, id: htmlId, onChange, ref, role: "switch", type: "checkbox" });
|
|
476
591
|
if (noChildren) {
|
|
477
592
|
return input;
|
|
478
593
|
}
|
|
479
|
-
return /* @__PURE__ */ (0,
|
|
594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
|
|
480
595
|
});
|
|
481
|
-
var Switch_default = (0,
|
|
596
|
+
var Switch_default = (0, import_react13.memo)(Switch);
|
|
482
597
|
|
|
483
598
|
// src/components/TextField/index.tsx
|
|
484
599
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
485
|
-
var
|
|
486
|
-
var
|
|
600
|
+
var import_react16 = require("react");
|
|
601
|
+
var React8 = __toESM(require("react"));
|
|
487
602
|
|
|
488
603
|
// src/components/FieldLabel/index.tsx
|
|
489
|
-
var
|
|
490
|
-
var
|
|
491
|
-
var FieldLabel =
|
|
604
|
+
var React7 = __toESM(require("react"));
|
|
605
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
606
|
+
var FieldLabel = React7.forwardRef(function FieldLabel2({
|
|
492
607
|
style,
|
|
493
608
|
className,
|
|
494
609
|
label,
|
|
@@ -498,10 +613,10 @@ var FieldLabel = React6.forwardRef(function FieldLabel2({
|
|
|
498
613
|
...labelProps
|
|
499
614
|
}, ref) {
|
|
500
615
|
const classNames = useClassNames("charcoal-field-label-root", className);
|
|
501
|
-
return /* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
503
|
-
required && /* @__PURE__ */ (0,
|
|
504
|
-
/* @__PURE__ */ (0,
|
|
616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style, className: classNames, children: [
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { ref, className: "charcoal-field-label", ...labelProps, children: label }),
|
|
618
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "charcoal-field-label-required-text", children: requiredText }),
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "charcoal-field-label-sub-label", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: subLabel }) })
|
|
505
620
|
] });
|
|
506
621
|
});
|
|
507
622
|
var FieldLabel_default = FieldLabel;
|
|
@@ -524,9 +639,9 @@ function countCodePointsInString(string) {
|
|
|
524
639
|
}
|
|
525
640
|
|
|
526
641
|
// src/components/TextField/useFocusWithClick.tsx
|
|
527
|
-
var
|
|
642
|
+
var import_react14 = require("react");
|
|
528
643
|
function useFocusWithClick(containerRef, inputRef) {
|
|
529
|
-
(0,
|
|
644
|
+
(0, import_react14.useEffect)(() => {
|
|
530
645
|
const el = containerRef.current;
|
|
531
646
|
if (el) {
|
|
532
647
|
const handleDown = (e) => {
|
|
@@ -546,15 +661,15 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
546
661
|
var import_utils2 = require("@react-aria/utils");
|
|
547
662
|
|
|
548
663
|
// src/_lib/createDivComponent.tsx
|
|
549
|
-
var
|
|
550
|
-
var
|
|
664
|
+
var import_react15 = require("react");
|
|
665
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
551
666
|
function createDivComponent(mainClassName) {
|
|
552
|
-
return (0,
|
|
667
|
+
return (0, import_react15.forwardRef)(function DivComponent({
|
|
553
668
|
className,
|
|
554
669
|
...props
|
|
555
670
|
}, ref) {
|
|
556
671
|
const classNames = useClassNames(mainClassName, className);
|
|
557
|
-
return /* @__PURE__ */ (0,
|
|
672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: classNames, ref, ...props });
|
|
558
673
|
});
|
|
559
674
|
}
|
|
560
675
|
|
|
@@ -562,8 +677,8 @@ function createDivComponent(mainClassName) {
|
|
|
562
677
|
var AssistiveText = createDivComponent("charcoal-text-field-assistive-text");
|
|
563
678
|
|
|
564
679
|
// src/components/TextField/index.tsx
|
|
565
|
-
var
|
|
566
|
-
var TextField =
|
|
680
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
681
|
+
var TextField = React8.forwardRef(function SingleLineTextFieldInner({
|
|
567
682
|
assistiveText,
|
|
568
683
|
className,
|
|
569
684
|
disabled = false,
|
|
@@ -582,13 +697,13 @@ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
|
|
|
582
697
|
value,
|
|
583
698
|
getCount = countCodePointsInString,
|
|
584
699
|
...props
|
|
585
|
-
},
|
|
586
|
-
const inputRef = (0,
|
|
700
|
+
}, forwardRef24) {
|
|
701
|
+
const inputRef = (0, import_react16.useRef)(null);
|
|
587
702
|
const {
|
|
588
703
|
visuallyHiddenProps
|
|
589
704
|
} = (0, import_visually_hidden.useVisuallyHidden)();
|
|
590
|
-
const [count, setCount] = (0,
|
|
591
|
-
const handleChange = (0,
|
|
705
|
+
const [count, setCount] = (0, import_react16.useState)(getCount(value ?? ""));
|
|
706
|
+
const handleChange = (0, import_react16.useCallback)((e) => {
|
|
592
707
|
const value2 = e.target.value;
|
|
593
708
|
const count2 = getCount(value2);
|
|
594
709
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -597,37 +712,37 @@ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
|
|
|
597
712
|
setCount(count2);
|
|
598
713
|
onChange?.(value2);
|
|
599
714
|
}, [getCount, maxLength, onChange]);
|
|
600
|
-
(0,
|
|
715
|
+
(0, import_react16.useEffect)(() => {
|
|
601
716
|
setCount(getCount(value ?? ""));
|
|
602
717
|
}, [getCount, value]);
|
|
603
|
-
const containerRef = (0,
|
|
718
|
+
const containerRef = (0, import_react16.useRef)(null);
|
|
604
719
|
useFocusWithClick(containerRef, inputRef);
|
|
605
720
|
const inputId = (0, import_utils2.useId)(props.id);
|
|
606
721
|
const describedbyId = (0, import_utils2.useId)();
|
|
607
722
|
const labelledbyId = (0, import_utils2.useId)();
|
|
608
723
|
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
609
724
|
const classNames = useClassNames("charcoal-text-field-root", className);
|
|
610
|
-
return /* @__PURE__ */ (0,
|
|
611
|
-
/* @__PURE__ */ (0,
|
|
612
|
-
/* @__PURE__ */ (0,
|
|
613
|
-
prefix && /* @__PURE__ */ (0,
|
|
614
|
-
/* @__PURE__ */ (0,
|
|
615
|
-
(suffix || showCount) && /* @__PURE__ */ (0,
|
|
725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: classNames, "aria-disabled": disabled, children: [
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FieldLabel_default, { htmlFor: inputId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
727
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "charcoal-text-field-container", "aria-disabled": disabled === true ? true : void 0, "data-invalid": invalid === true, ref: containerRef, children: [
|
|
728
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "charcoal-text-field-prefix", children: prefix }),
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "charcoal-text-field-input", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: inputId, "data-invalid": invalid === true, maxLength, onChange: handleChange, disabled, ref: (0, import_utils2.mergeRefs)(forwardRef24, inputRef), type, value, ...props }),
|
|
730
|
+
(suffix || showCount) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "charcoal-text-field-suffix", children: [
|
|
616
731
|
suffix,
|
|
617
|
-
showCount && /* @__PURE__ */ (0,
|
|
732
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "charcoal-text-field-line-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
618
733
|
] })
|
|
619
734
|
] }),
|
|
620
|
-
showAssistiveText && /* @__PURE__ */ (0,
|
|
735
|
+
showAssistiveText && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
|
|
621
736
|
] });
|
|
622
737
|
});
|
|
623
738
|
var TextField_default = TextField;
|
|
624
739
|
|
|
625
740
|
// src/components/TextArea/index.tsx
|
|
626
741
|
var import_visually_hidden2 = require("@react-aria/visually-hidden");
|
|
627
|
-
var
|
|
742
|
+
var import_react17 = require("react");
|
|
628
743
|
var import_utils3 = require("@react-aria/utils");
|
|
629
|
-
var
|
|
630
|
-
var TextArea = (0,
|
|
744
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
745
|
+
var TextArea = (0, import_react17.forwardRef)(function TextAreaInner({
|
|
631
746
|
onChange,
|
|
632
747
|
className,
|
|
633
748
|
value,
|
|
@@ -645,20 +760,20 @@ var TextArea = (0, import_react15.forwardRef)(function TextAreaInner({
|
|
|
645
760
|
invalid,
|
|
646
761
|
getCount = countCodePointsInString,
|
|
647
762
|
...props
|
|
648
|
-
},
|
|
763
|
+
}, forwardRef24) {
|
|
649
764
|
const {
|
|
650
765
|
visuallyHiddenProps
|
|
651
766
|
} = (0, import_visually_hidden2.useVisuallyHidden)();
|
|
652
|
-
const textareaRef = (0,
|
|
653
|
-
const [count, setCount] = (0,
|
|
654
|
-
const [rows, setRows] = (0,
|
|
655
|
-
const syncHeight = (0,
|
|
767
|
+
const textareaRef = (0, import_react17.useRef)(null);
|
|
768
|
+
const [count, setCount] = (0, import_react17.useState)(getCount(value ?? ""));
|
|
769
|
+
const [rows, setRows] = (0, import_react17.useState)(initialRows);
|
|
770
|
+
const syncHeight = (0, import_react17.useCallback)((textarea) => {
|
|
656
771
|
const rows2 = (`${textarea.value}
|
|
657
772
|
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
658
773
|
setRows(initialRows <= rows2 ? rows2 : initialRows);
|
|
659
774
|
}, [initialRows]);
|
|
660
775
|
const nonControlled = value === void 0;
|
|
661
|
-
const handleChange = (0,
|
|
776
|
+
const handleChange = (0, import_react17.useCallback)((e) => {
|
|
662
777
|
const value2 = e.target.value;
|
|
663
778
|
const count2 = getCount(value2);
|
|
664
779
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -672,58 +787,43 @@ var TextArea = (0, import_react15.forwardRef)(function TextAreaInner({
|
|
|
672
787
|
}
|
|
673
788
|
onChange?.(value2);
|
|
674
789
|
}, [autoHeight, getCount, maxLength, nonControlled, onChange, syncHeight]);
|
|
675
|
-
(0,
|
|
790
|
+
(0, import_react17.useEffect)(() => {
|
|
676
791
|
setCount(getCount(value ?? ""));
|
|
677
792
|
}, [getCount, value]);
|
|
678
|
-
(0,
|
|
793
|
+
(0, import_react17.useEffect)(() => {
|
|
679
794
|
if (autoHeight && textareaRef.current !== null) {
|
|
680
795
|
syncHeight(textareaRef.current);
|
|
681
796
|
}
|
|
682
797
|
}, [autoHeight, syncHeight]);
|
|
683
|
-
const containerRef = (0,
|
|
798
|
+
const containerRef = (0, import_react17.useRef)(null);
|
|
684
799
|
useFocusWithClick(containerRef, textareaRef);
|
|
685
800
|
const textAreaId = (0, import_utils3.useId)(props.id);
|
|
686
801
|
const describedbyId = (0, import_utils3.useId)();
|
|
687
802
|
const labelledbyId = (0, import_utils3.useId)();
|
|
688
803
|
const classNames = useClassNames("charcoal-text-area-root", className);
|
|
689
804
|
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
690
|
-
return /* @__PURE__ */ (0,
|
|
691
|
-
/* @__PURE__ */ (0,
|
|
692
|
-
/* @__PURE__ */ (0,
|
|
805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: classNames, "aria-disabled": disabled, children: [
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FieldLabel_default, { htmlFor: textAreaId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "charcoal-text-area-container", "aria-disabled": disabled === true ? "true" : void 0, "aria-invalid": invalid === true, ref: containerRef, style: {
|
|
693
808
|
"--charcoal-text-area-rows": `${showCount ? rows + 1 : rows}`
|
|
694
809
|
}, children: [
|
|
695
|
-
/* @__PURE__ */ (0,
|
|
696
|
-
showCount && /* @__PURE__ */ (0,
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("textarea", { className: "charcoal-text-area-textarea", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: textAreaId, maxLength, "data-no-bottom-padding": showCount, onChange: handleChange, ref: mergeRefs(forwardRef24, textareaRef), rows, value, disabled, ...props }),
|
|
811
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "charcoal-text-area-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
697
812
|
] }),
|
|
698
|
-
showAssistiveText && /* @__PURE__ */ (0,
|
|
813
|
+
showAssistiveText && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
|
|
699
814
|
] });
|
|
700
815
|
});
|
|
701
816
|
var TextArea_default = TextArea;
|
|
702
817
|
|
|
703
|
-
// src/components/Icon/index.tsx
|
|
704
|
-
var React8 = __toESM(require("react"));
|
|
705
|
-
var import_icons = require("@charcoal-ui/icons");
|
|
706
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
707
|
-
var Icon = React8.forwardRef(function IconInner({
|
|
708
|
-
name,
|
|
709
|
-
scale,
|
|
710
|
-
unsafeNonGuidelineScale,
|
|
711
|
-
className,
|
|
712
|
-
...rest
|
|
713
|
-
}, ref) {
|
|
714
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
715
|
-
});
|
|
716
|
-
var Icon_default = Icon;
|
|
717
|
-
|
|
718
818
|
// src/components/Modal/index.tsx
|
|
719
|
-
var
|
|
819
|
+
var import_react20 = require("react");
|
|
720
820
|
var React12 = __toESM(require("react"));
|
|
721
821
|
var import_overlays3 = require("@react-aria/overlays");
|
|
722
822
|
var import_react_spring = require("react-spring");
|
|
723
823
|
var import_utils4 = require("@react-aria/utils");
|
|
724
824
|
|
|
725
825
|
// src/components/Modal/Dialog/index.tsx
|
|
726
|
-
var
|
|
826
|
+
var import_react18 = require("react");
|
|
727
827
|
var import_dialog = require("@react-aria/dialog");
|
|
728
828
|
|
|
729
829
|
// src/_lib/useForwardedRef.tsx
|
|
@@ -743,21 +843,21 @@ function useForwardedRef(ref) {
|
|
|
743
843
|
}
|
|
744
844
|
|
|
745
845
|
// src/components/Modal/Dialog/index.tsx
|
|
746
|
-
var
|
|
747
|
-
var Dialog = (0,
|
|
846
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
847
|
+
var Dialog = (0, import_react18.forwardRef)(function Dialog2({
|
|
748
848
|
size,
|
|
749
849
|
bottomSheet,
|
|
750
850
|
className,
|
|
751
851
|
...props
|
|
752
|
-
},
|
|
753
|
-
const ref = useForwardedRef(
|
|
852
|
+
}, forwardRef24) {
|
|
853
|
+
const ref = useForwardedRef(forwardRef24);
|
|
754
854
|
const {
|
|
755
855
|
dialogProps
|
|
756
856
|
} = (0, import_dialog.useDialog)({
|
|
757
857
|
role: "dialog"
|
|
758
858
|
}, ref);
|
|
759
859
|
const classNames = useClassNames("charcoal-modal-dialog", className);
|
|
760
|
-
return /* @__PURE__ */ (0,
|
|
860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: classNames, role: dialogProps.role, "data-bottom-sheet": bottomSheet, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, "data-size": size, ref, ...props });
|
|
761
861
|
});
|
|
762
862
|
|
|
763
863
|
// src/components/Modal/ModalBackgroundContext.tsx
|
|
@@ -769,9 +869,9 @@ var React11 = __toESM(require("react"));
|
|
|
769
869
|
var import_overlays2 = require("@react-aria/overlays");
|
|
770
870
|
|
|
771
871
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
772
|
-
var
|
|
872
|
+
var import_react19 = require("react");
|
|
773
873
|
function usePreventScroll(element, isOpen) {
|
|
774
|
-
(0,
|
|
874
|
+
(0, import_react19.useEffect)(() => {
|
|
775
875
|
if (isOpen && element) {
|
|
776
876
|
const defaultPaddingRight = element.style.paddingRight;
|
|
777
877
|
const defaultOverflow = element.style.overflow;
|
|
@@ -826,9 +926,9 @@ function useWindowWidth() {
|
|
|
826
926
|
}
|
|
827
927
|
|
|
828
928
|
// src/components/Modal/index.tsx
|
|
829
|
-
var
|
|
929
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
830
930
|
var DEFAULT_Z_INDEX = 10;
|
|
831
|
-
var Modal = (0,
|
|
931
|
+
var Modal = (0, import_react20.forwardRef)(function ModalInner({
|
|
832
932
|
children,
|
|
833
933
|
zIndex = DEFAULT_Z_INDEX,
|
|
834
934
|
portalContainer,
|
|
@@ -893,15 +993,15 @@ var Modal = (0, import_react18.forwardRef)(function ModalInner({
|
|
|
893
993
|
backgroundColor,
|
|
894
994
|
overflow,
|
|
895
995
|
transform
|
|
896
|
-
}, item) => item && /* @__PURE__ */ (0,
|
|
996
|
+
}, item) => item && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_overlays3.Overlay, { portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_spring.animated.div, { className: "charcoal-modal-background", ref: bgRef, ...underlayProps, style: transitionEnabled ? {
|
|
897
997
|
backgroundColor,
|
|
898
998
|
overflow,
|
|
899
999
|
zIndex
|
|
900
1000
|
} : {
|
|
901
1001
|
zIndex
|
|
902
|
-
}, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ (0,
|
|
1002
|
+
}, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AnimatedDialog, { ref, ...modalProps, style: transitionEnabled ? {
|
|
903
1003
|
transform
|
|
904
|
-
} : {}, size, bottomSheet, className, children: /* @__PURE__ */ (0,
|
|
1004
|
+
} : {}, size, bottomSheet, className, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ModalContext.Provider, { value: {
|
|
905
1005
|
titleProps: {},
|
|
906
1006
|
title,
|
|
907
1007
|
close: onClose,
|
|
@@ -909,11 +1009,11 @@ var Modal = (0, import_react18.forwardRef)(function ModalInner({
|
|
|
909
1009
|
bottomSheet
|
|
910
1010
|
}, children: [
|
|
911
1011
|
children,
|
|
912
|
-
isDismissable === true && /* @__PURE__ */ (0,
|
|
1012
|
+
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
|
|
913
1013
|
] }) }) }) }) }));
|
|
914
1014
|
});
|
|
915
1015
|
var AnimatedDialog = (0, import_react_spring.animated)(Dialog);
|
|
916
|
-
var Modal_default = (0,
|
|
1016
|
+
var Modal_default = (0, import_react20.memo)(Modal);
|
|
917
1017
|
var ModalContext = React12.createContext({
|
|
918
1018
|
titleProps: {},
|
|
919
1019
|
title: "",
|
|
@@ -922,41 +1022,41 @@ var ModalContext = React12.createContext({
|
|
|
922
1022
|
bottomSheet: false
|
|
923
1023
|
});
|
|
924
1024
|
function ModalCloseButton(props) {
|
|
925
|
-
return /* @__PURE__ */ (0,
|
|
1025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton_default, { className: "charcoal-modal-close-button", size: "S", icon: "24/Close", type: "button", ...props });
|
|
926
1026
|
}
|
|
927
1027
|
|
|
928
1028
|
// src/components/Modal/ModalPlumbing.tsx
|
|
929
|
-
var
|
|
930
|
-
var
|
|
1029
|
+
var import_react21 = require("react");
|
|
1030
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
931
1031
|
function ModalHeader() {
|
|
932
|
-
const modalCtx = (0,
|
|
933
|
-
return /* @__PURE__ */ (0,
|
|
1032
|
+
const modalCtx = (0, import_react21.useContext)(ModalContext);
|
|
1033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "charcoal-modal-header-root", "data-bottom-sheet": modalCtx.bottomSheet, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "charcoal-modal-header-title", children: modalCtx.title }) });
|
|
934
1034
|
}
|
|
935
1035
|
var ModalAlign = createDivComponent("charcoal-modal-align");
|
|
936
1036
|
var ModalBody = createDivComponent("charcoal-modal-body");
|
|
937
1037
|
var ModalButtons = createDivComponent("charcoal-modal-buttons");
|
|
938
1038
|
|
|
939
1039
|
// src/components/LoadingSpinner/index.tsx
|
|
940
|
-
var
|
|
941
|
-
var
|
|
942
|
-
var LoadingSpinner = (0,
|
|
1040
|
+
var import_react22 = require("react");
|
|
1041
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1042
|
+
var LoadingSpinner = (0, import_react22.forwardRef)(function LoadingSpinnerInner({
|
|
943
1043
|
size = 48,
|
|
944
1044
|
padding = 16,
|
|
945
1045
|
transparent = false,
|
|
946
1046
|
...props
|
|
947
1047
|
}, ref) {
|
|
948
1048
|
const classNames = useClassNames("charcoal-loading-spinner", props.className);
|
|
949
|
-
return /* @__PURE__ */ (0,
|
|
1049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "progressbar", style: {
|
|
950
1050
|
"--charcoal-loading-spinner-size": `${size}px`,
|
|
951
1051
|
"--charcoal-loading-spinner-padding": `${padding}px`
|
|
952
|
-
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ (0,
|
|
1052
|
+
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LoadingSpinnerIcon, {}) });
|
|
953
1053
|
});
|
|
954
|
-
var LoadingSpinner_default = (0,
|
|
955
|
-
var LoadingSpinnerIcon = (0,
|
|
1054
|
+
var LoadingSpinner_default = (0, import_react22.memo)(LoadingSpinner);
|
|
1055
|
+
var LoadingSpinnerIcon = (0, import_react22.forwardRef)(function LoadingSpinnerIcon2({
|
|
956
1056
|
once = false
|
|
957
1057
|
}, ref) {
|
|
958
|
-
const iconRef = (0,
|
|
959
|
-
(0,
|
|
1058
|
+
const iconRef = (0, import_react22.useRef)(null);
|
|
1059
|
+
(0, import_react22.useImperativeHandle)(ref, () => ({
|
|
960
1060
|
restart: () => {
|
|
961
1061
|
if (!iconRef.current) {
|
|
962
1062
|
return;
|
|
@@ -966,22 +1066,22 @@ var LoadingSpinnerIcon = (0, import_react20.forwardRef)(function LoadingSpinnerI
|
|
|
966
1066
|
delete iconRef.current.dataset.resetAnimation;
|
|
967
1067
|
}
|
|
968
1068
|
}));
|
|
969
|
-
return /* @__PURE__ */ (0,
|
|
1069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "presentation", ref: iconRef, "data-once": once, className: "charcoal-loading-spinner-icon" });
|
|
970
1070
|
});
|
|
971
1071
|
|
|
972
1072
|
// src/components/DropdownSelector/index.tsx
|
|
973
|
-
var
|
|
1073
|
+
var import_react27 = require("react");
|
|
974
1074
|
|
|
975
1075
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
976
|
-
var
|
|
1076
|
+
var import_react24 = require("react");
|
|
977
1077
|
|
|
978
1078
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
979
|
-
var
|
|
1079
|
+
var import_react23 = require("react");
|
|
980
1080
|
var import_overlays4 = require("@react-aria/overlays");
|
|
981
|
-
var
|
|
1081
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
982
1082
|
var _empty = () => null;
|
|
983
1083
|
function Popover(props) {
|
|
984
|
-
const defaultPopoverRef = (0,
|
|
1084
|
+
const defaultPopoverRef = (0, import_react23.useRef)(null);
|
|
985
1085
|
const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
|
|
986
1086
|
const {
|
|
987
1087
|
popoverProps,
|
|
@@ -998,39 +1098,39 @@ function Popover(props) {
|
|
|
998
1098
|
setOpen: _empty,
|
|
999
1099
|
toggle: _empty
|
|
1000
1100
|
});
|
|
1001
|
-
const modalBackground = (0,
|
|
1101
|
+
const modalBackground = (0, import_react23.useContext)(ModalBackgroundContext);
|
|
1002
1102
|
usePreventScroll(modalBackground, props.isOpen);
|
|
1003
1103
|
if (!props.isOpen)
|
|
1004
1104
|
return null;
|
|
1005
|
-
return /* @__PURE__ */ (0,
|
|
1006
|
-
/* @__PURE__ */ (0,
|
|
1105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_overlays4.Overlay, { portalContainer: document.body, children: [
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ...underlayProps, style: {
|
|
1007
1107
|
position: "fixed",
|
|
1008
1108
|
zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
|
|
1009
1109
|
inset: 0
|
|
1010
1110
|
} }),
|
|
1011
|
-
/* @__PURE__ */ (0,
|
|
1012
|
-
/* @__PURE__ */ (0,
|
|
1013
|
-
/* @__PURE__ */ (0,
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { ...popoverProps, ref: finalPopoverRef, className: "charcoal-popover", children: [
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_overlays4.DismissButton, { onDismiss: () => props.onClose() }),
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { tabIndex: 0, onFocus: props.onClose }),
|
|
1014
1114
|
props.children,
|
|
1015
|
-
/* @__PURE__ */ (0,
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1115
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { tabIndex: 0, onFocus: props.onClose }),
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_overlays4.DismissButton, { onDismiss: () => props.onClose() })
|
|
1017
1117
|
] })
|
|
1018
1118
|
] });
|
|
1019
1119
|
}
|
|
1020
1120
|
|
|
1021
1121
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1022
|
-
var
|
|
1122
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1023
1123
|
function DropdownPopover({
|
|
1024
1124
|
children,
|
|
1025
1125
|
...props
|
|
1026
1126
|
}) {
|
|
1027
|
-
const ref = (0,
|
|
1028
|
-
(0,
|
|
1127
|
+
const ref = (0, import_react24.useRef)(null);
|
|
1128
|
+
(0, import_react24.useEffect)(() => {
|
|
1029
1129
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1030
1130
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1031
1131
|
}
|
|
1032
1132
|
}, [props.triggerRef, props.isOpen]);
|
|
1033
|
-
(0,
|
|
1133
|
+
(0, import_react24.useEffect)(() => {
|
|
1034
1134
|
if (props.isOpen) {
|
|
1035
1135
|
if (props.value !== void 0 && props.value !== "") {
|
|
1036
1136
|
const windowScrollY = window.scrollY;
|
|
@@ -1046,7 +1146,7 @@ function DropdownPopover({
|
|
|
1046
1146
|
}
|
|
1047
1147
|
}
|
|
1048
1148
|
}, [props.value, props.isOpen]);
|
|
1049
|
-
return /* @__PURE__ */ (0,
|
|
1149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
|
|
1050
1150
|
}
|
|
1051
1151
|
|
|
1052
1152
|
// src/components/DropdownSelector/utils/findPreviewRecursive.tsx
|
|
@@ -1074,11 +1174,11 @@ function findPreviewRecursive(children, value) {
|
|
|
1074
1174
|
}
|
|
1075
1175
|
|
|
1076
1176
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1077
|
-
var
|
|
1177
|
+
var import_react26 = require("react");
|
|
1078
1178
|
|
|
1079
1179
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1080
|
-
var
|
|
1081
|
-
var MenuListContext = (0,
|
|
1180
|
+
var import_react25 = require("react");
|
|
1181
|
+
var MenuListContext = (0, import_react25.createContext)({
|
|
1082
1182
|
root: void 0,
|
|
1083
1183
|
value: "",
|
|
1084
1184
|
propsArray: [],
|
|
@@ -1110,11 +1210,11 @@ function getValuesRecursive(children) {
|
|
|
1110
1210
|
}
|
|
1111
1211
|
|
|
1112
1212
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1113
|
-
var
|
|
1213
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1114
1214
|
function MenuList(props) {
|
|
1115
|
-
const root = (0,
|
|
1116
|
-
const propsArray = (0,
|
|
1117
|
-
return /* @__PURE__ */ (0,
|
|
1215
|
+
const root = (0, import_react26.useRef)(null);
|
|
1216
|
+
const propsArray = (0, import_react26.useMemo)(() => getValuesRecursive(props.children), [props.children]);
|
|
1217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "charcoal-menu-list", ref: root, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MenuListContext.Provider, { value: {
|
|
1118
1218
|
value: props.value ?? "",
|
|
1119
1219
|
root,
|
|
1120
1220
|
propsArray,
|
|
@@ -1127,66 +1227,66 @@ function MenuList(props) {
|
|
|
1127
1227
|
// src/components/DropdownSelector/index.tsx
|
|
1128
1228
|
var import_visually_hidden3 = require("@react-aria/visually-hidden");
|
|
1129
1229
|
var import_utils5 = require("@react-aria/utils");
|
|
1130
|
-
var
|
|
1230
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1131
1231
|
function DropdownSelector({
|
|
1132
1232
|
onChange,
|
|
1133
1233
|
showLabel = false,
|
|
1134
1234
|
...props
|
|
1135
1235
|
}) {
|
|
1136
|
-
const triggerRef = (0,
|
|
1137
|
-
const [isOpen, setIsOpen] = (0,
|
|
1236
|
+
const triggerRef = (0, import_react27.useRef)(null);
|
|
1237
|
+
const [isOpen, setIsOpen] = (0, import_react27.useState)(false);
|
|
1138
1238
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
1139
|
-
const isPlaceholder = (0,
|
|
1239
|
+
const isPlaceholder = (0, import_react27.useMemo)(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
|
|
1140
1240
|
const propsArray = getValuesRecursive(props.children);
|
|
1141
1241
|
const {
|
|
1142
1242
|
visuallyHiddenProps
|
|
1143
1243
|
} = (0, import_visually_hidden3.useVisuallyHidden)();
|
|
1144
|
-
const handleChange = (0,
|
|
1244
|
+
const handleChange = (0, import_react27.useCallback)((e) => {
|
|
1145
1245
|
onChange(e.target.value);
|
|
1146
1246
|
}, [onChange]);
|
|
1147
1247
|
const labelId = (0, import_utils5.useId)();
|
|
1148
1248
|
const describedbyId = (0, import_utils5.useId)();
|
|
1149
1249
|
const classNames = useClassNames("charcoal-dropdown-selector-root", props.className);
|
|
1150
|
-
return /* @__PURE__ */ (0,
|
|
1151
|
-
/* @__PURE__ */ (0,
|
|
1152
|
-
/* @__PURE__ */ (0,
|
|
1153
|
-
return /* @__PURE__ */ (0,
|
|
1250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: classNames, "aria-disabled": props.disabled, children: [
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FieldLabel_default, { id: labelId, label: props.label, required: props.required, requiredText: props.requiredText, subLabel: props.subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
|
|
1253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
|
|
1154
1254
|
}) }) }),
|
|
1155
|
-
/* @__PURE__ */ (0,
|
|
1255
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("button", { className: "charcoal-dropdown-selector-button", "aria-labelledby": labelId, "aria-invalid": props.invalid, "aria-describedby": props.assistiveText !== void 0 ? describedbyId : void 0, disabled: props.disabled, onClick: () => {
|
|
1156
1256
|
if (props.disabled === true)
|
|
1157
1257
|
return;
|
|
1158
1258
|
setIsOpen(true);
|
|
1159
1259
|
}, ref: triggerRef, type: "button", "data-active": isOpen, children: [
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "charcoal-ui-dropdown-selector-text", "data-placeholder": isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon_default, { className: "charcoal-ui-dropdown-selector-icon", name: "16/Menu" })
|
|
1162
1262
|
] }),
|
|
1163
|
-
isOpen && /* @__PURE__ */ (0,
|
|
1263
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MenuList, { value: props.value, onChange: (v) => {
|
|
1164
1264
|
onChange(v);
|
|
1165
1265
|
setIsOpen(false);
|
|
1166
1266
|
}, children: props.children }) }),
|
|
1167
|
-
props.assistiveText !== void 0 && /* @__PURE__ */ (0,
|
|
1267
|
+
props.assistiveText !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AssistiveText, { "data-invalid": props.invalid === true, id: describedbyId, children: props.assistiveText })
|
|
1168
1268
|
] });
|
|
1169
1269
|
}
|
|
1170
1270
|
|
|
1171
1271
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
1172
|
-
var
|
|
1272
|
+
var import_react30 = require("react");
|
|
1173
1273
|
|
|
1174
1274
|
// src/components/DropdownSelector/ListItem/index.tsx
|
|
1175
|
-
var
|
|
1176
|
-
var
|
|
1177
|
-
var ListItem = (0,
|
|
1275
|
+
var import_react28 = require("react");
|
|
1276
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1277
|
+
var ListItem = (0, import_react28.forwardRef)(function ListItem2({
|
|
1178
1278
|
as,
|
|
1179
1279
|
className,
|
|
1180
1280
|
...props
|
|
1181
1281
|
}, ref) {
|
|
1182
|
-
const Component = (0,
|
|
1282
|
+
const Component = (0, import_react28.useMemo)(() => as ?? "li", [as]);
|
|
1183
1283
|
const classNames = useClassNames("charcoal-list-item", className);
|
|
1184
|
-
return /* @__PURE__ */ (0,
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Component, { className: classNames, ref, ...props });
|
|
1185
1285
|
});
|
|
1186
1286
|
var ListItem_default = ListItem;
|
|
1187
1287
|
|
|
1188
1288
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
1189
|
-
var
|
|
1289
|
+
var import_react29 = require("react");
|
|
1190
1290
|
|
|
1191
1291
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
1192
1292
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -1223,12 +1323,12 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1223
1323
|
setValue,
|
|
1224
1324
|
root,
|
|
1225
1325
|
propsArray
|
|
1226
|
-
} = (0,
|
|
1227
|
-
const setContextValue = (0,
|
|
1326
|
+
} = (0, import_react29.useContext)(MenuListContext);
|
|
1327
|
+
const setContextValue = (0, import_react29.useCallback)(() => {
|
|
1228
1328
|
if (value !== void 0)
|
|
1229
1329
|
setValue(value);
|
|
1230
1330
|
}, [value, setValue]);
|
|
1231
|
-
const handleKeyDown = (0,
|
|
1331
|
+
const handleKeyDown = (0, import_react29.useCallback)((e) => {
|
|
1232
1332
|
if (e.key === "Enter") {
|
|
1233
1333
|
setContextValue();
|
|
1234
1334
|
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
@@ -1269,72 +1369,72 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1269
1369
|
}
|
|
1270
1370
|
|
|
1271
1371
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
1272
|
-
var
|
|
1273
|
-
var MenuItem = (0,
|
|
1372
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1373
|
+
var MenuItem = (0, import_react30.forwardRef)(function MenuItem2({
|
|
1274
1374
|
className,
|
|
1275
1375
|
value,
|
|
1276
1376
|
disabled,
|
|
1277
1377
|
...props
|
|
1278
1378
|
}, ref) {
|
|
1279
1379
|
const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value);
|
|
1280
|
-
return /* @__PURE__ */ (0,
|
|
1380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ListItem_default, { ...props, ref, "data-key": value, onKeyDown: handleKeyDown, onClick: disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": disabled, role: "option", children: props.children });
|
|
1281
1381
|
});
|
|
1282
1382
|
var MenuItem_default = MenuItem;
|
|
1283
1383
|
|
|
1284
1384
|
// src/components/DropdownSelector/DropdownMenuItem/index.tsx
|
|
1285
|
-
var
|
|
1286
|
-
var
|
|
1385
|
+
var import_react31 = require("react");
|
|
1386
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1287
1387
|
function DropdownMenuItem(props) {
|
|
1288
1388
|
const {
|
|
1289
1389
|
value: ctxValue
|
|
1290
|
-
} = (0,
|
|
1390
|
+
} = (0, import_react31.useContext)(MenuListContext);
|
|
1291
1391
|
const isSelected = props.value === ctxValue;
|
|
1292
1392
|
const {
|
|
1293
1393
|
children,
|
|
1294
1394
|
...rest
|
|
1295
1395
|
} = props;
|
|
1296
|
-
return /* @__PURE__ */ (0,
|
|
1297
|
-
isSelected && /* @__PURE__ */ (0,
|
|
1298
|
-
/* @__PURE__ */ (0,
|
|
1396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(MenuItem_default, { ...rest, "aria-selected": isSelected, children: [
|
|
1397
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { className: "charcoal-dropdown-selector-menu-item-icon", name: "16/Check" }),
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "charcoal-dropdown-selector-menu-item", "data-selected": isSelected, children: props.children })
|
|
1299
1399
|
] });
|
|
1300
1400
|
}
|
|
1301
1401
|
|
|
1302
1402
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
1303
|
-
var
|
|
1403
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1304
1404
|
function MenuItemGroup(props) {
|
|
1305
|
-
return /* @__PURE__ */ (0,
|
|
1306
|
-
/* @__PURE__ */ (0,
|
|
1307
|
-
/* @__PURE__ */ (0,
|
|
1405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("li", { className: "charcoal-menu-item-group", role: "presentation", children: [
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: props.text }),
|
|
1407
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { role: "group", children: props.children })
|
|
1308
1408
|
] });
|
|
1309
1409
|
}
|
|
1310
1410
|
|
|
1311
1411
|
// src/components/SegmentedControl/index.tsx
|
|
1312
|
-
var
|
|
1412
|
+
var import_react33 = require("react");
|
|
1313
1413
|
var import_radio = require("@react-stately/radio");
|
|
1314
1414
|
var import_radio2 = require("@react-aria/radio");
|
|
1315
1415
|
|
|
1316
1416
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1317
|
-
var
|
|
1318
|
-
var
|
|
1319
|
-
var RadioContext = (0,
|
|
1417
|
+
var import_react32 = require("react");
|
|
1418
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1419
|
+
var RadioContext = (0, import_react32.createContext)(null);
|
|
1320
1420
|
var RadioProvider = ({
|
|
1321
1421
|
value,
|
|
1322
1422
|
children
|
|
1323
1423
|
}) => {
|
|
1324
|
-
return /* @__PURE__ */ (0,
|
|
1424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RadioContext.Provider, { value, children });
|
|
1325
1425
|
};
|
|
1326
1426
|
var useRadioContext = () => {
|
|
1327
|
-
const state = (0,
|
|
1427
|
+
const state = (0, import_react32.useContext)(RadioContext);
|
|
1328
1428
|
if (state === null)
|
|
1329
1429
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1330
1430
|
return state;
|
|
1331
1431
|
};
|
|
1332
1432
|
|
|
1333
1433
|
// src/components/SegmentedControl/index.tsx
|
|
1334
|
-
var
|
|
1335
|
-
var SegmentedControl = (0,
|
|
1434
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1435
|
+
var SegmentedControl = (0, import_react33.forwardRef)(function SegmentedControlInner(props, ref) {
|
|
1336
1436
|
const className = useClassNames("charcoal-segmented-control", props.className);
|
|
1337
|
-
const ariaRadioGroupProps = (0,
|
|
1437
|
+
const ariaRadioGroupProps = (0, import_react33.useMemo)(() => ({
|
|
1338
1438
|
...props,
|
|
1339
1439
|
isDisabled: props.disabled,
|
|
1340
1440
|
isReadOnly: props.readonly,
|
|
@@ -1345,19 +1445,19 @@ var SegmentedControl = (0, import_react31.forwardRef)(function SegmentedControlI
|
|
|
1345
1445
|
const {
|
|
1346
1446
|
radioGroupProps
|
|
1347
1447
|
} = (0, import_radio2.useRadioGroup)(ariaRadioGroupProps, state);
|
|
1348
|
-
const segmentedControlItems = (0,
|
|
1448
|
+
const segmentedControlItems = (0, import_react33.useMemo)(() => {
|
|
1349
1449
|
return props.data.map((d) => typeof d === "string" ? {
|
|
1350
1450
|
value: d,
|
|
1351
1451
|
label: d
|
|
1352
1452
|
} : d);
|
|
1353
1453
|
}, [props.data]);
|
|
1354
|
-
return /* @__PURE__ */ (0,
|
|
1454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { ref, ...radioGroupProps, className, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1355
1455
|
});
|
|
1356
|
-
var SegmentedControl_default = (0,
|
|
1456
|
+
var SegmentedControl_default = (0, import_react33.memo)(SegmentedControl);
|
|
1357
1457
|
var Segmented = (props) => {
|
|
1358
1458
|
const state = useRadioContext();
|
|
1359
|
-
const ref = (0,
|
|
1360
|
-
const ariaRadioProps = (0,
|
|
1459
|
+
const ref = (0, import_react33.useRef)(null);
|
|
1460
|
+
const ariaRadioProps = (0, import_react33.useMemo)(() => ({
|
|
1361
1461
|
value: props.value,
|
|
1362
1462
|
isDisabled: props.disabled,
|
|
1363
1463
|
children: props.children
|
|
@@ -1367,20 +1467,20 @@ var Segmented = (props) => {
|
|
|
1367
1467
|
isDisabled,
|
|
1368
1468
|
isSelected
|
|
1369
1469
|
} = (0, import_radio2.useRadio)(ariaRadioProps, state, ref);
|
|
1370
|
-
return /* @__PURE__ */ (0,
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "charcoal-segmented-control-radio__label", "aria-disabled": isDisabled || state.isReadOnly, "data-checked": isSelected, children: [
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { className: "charcoal-segmented-control-radio__input", ...inputProps, ref }),
|
|
1372
1472
|
props.children
|
|
1373
1473
|
] });
|
|
1374
1474
|
};
|
|
1375
1475
|
|
|
1376
1476
|
// src/components/Checkbox/index.tsx
|
|
1377
|
-
var
|
|
1477
|
+
var import_react36 = require("react");
|
|
1378
1478
|
var import_utils6 = require("@react-aria/utils");
|
|
1379
1479
|
|
|
1380
1480
|
// src/components/Checkbox/CheckboxInput/index.tsx
|
|
1381
|
-
var
|
|
1382
|
-
var
|
|
1383
|
-
var CheckboxInput = (0,
|
|
1481
|
+
var import_react34 = require("react");
|
|
1482
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1483
|
+
var CheckboxInput = (0, import_react34.forwardRef)(function CheckboxInput2({
|
|
1384
1484
|
onChange,
|
|
1385
1485
|
checked,
|
|
1386
1486
|
invalid,
|
|
@@ -1388,19 +1488,19 @@ var CheckboxInput = (0, import_react32.forwardRef)(function CheckboxInput2({
|
|
|
1388
1488
|
rounded,
|
|
1389
1489
|
...props
|
|
1390
1490
|
}, ref) {
|
|
1391
|
-
const handleChange = (0,
|
|
1491
|
+
const handleChange = (0, import_react34.useCallback)((e) => {
|
|
1392
1492
|
const el = e.currentTarget;
|
|
1393
1493
|
onChange?.(el.checked);
|
|
1394
1494
|
}, [onChange]);
|
|
1395
1495
|
const classNames = useClassNames("charcoal-checkbox-input", className);
|
|
1396
|
-
return /* @__PURE__ */ (0,
|
|
1496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
|
|
1397
1497
|
});
|
|
1398
|
-
var CheckboxInput_default = (0,
|
|
1498
|
+
var CheckboxInput_default = (0, import_react34.memo)(CheckboxInput);
|
|
1399
1499
|
|
|
1400
1500
|
// src/components/Checkbox/CheckboxWithLabel.tsx
|
|
1401
|
-
var
|
|
1402
|
-
var
|
|
1403
|
-
var CheckboxWithLabel =
|
|
1501
|
+
var import_react35 = __toESM(require("react"));
|
|
1502
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1503
|
+
var CheckboxWithLabel = import_react35.default.memo(function CheckboxWithLabel2({
|
|
1404
1504
|
className,
|
|
1405
1505
|
children,
|
|
1406
1506
|
input,
|
|
@@ -1408,15 +1508,15 @@ var CheckboxWithLabel = import_react33.default.memo(function CheckboxWithLabel2(
|
|
|
1408
1508
|
disabled
|
|
1409
1509
|
}) {
|
|
1410
1510
|
const classNames = useClassNames("charcoal-checkbox__label", className);
|
|
1411
|
-
return /* @__PURE__ */ (0,
|
|
1511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { htmlFor: id, "aria-disabled": disabled, className: classNames, children: [
|
|
1412
1512
|
input,
|
|
1413
|
-
/* @__PURE__ */ (0,
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "charcoal-checkbox__label_div", children })
|
|
1414
1514
|
] });
|
|
1415
1515
|
});
|
|
1416
1516
|
|
|
1417
1517
|
// src/components/Checkbox/index.tsx
|
|
1418
|
-
var
|
|
1419
|
-
var Checkbox = (0,
|
|
1518
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1519
|
+
var Checkbox = (0, import_react36.forwardRef)(function Checkbox2({
|
|
1420
1520
|
disabled,
|
|
1421
1521
|
className,
|
|
1422
1522
|
id,
|
|
@@ -1425,19 +1525,19 @@ var Checkbox = (0, import_react34.forwardRef)(function Checkbox2({
|
|
|
1425
1525
|
}, ref) {
|
|
1426
1526
|
const htmlId = (0, import_utils6.useId)(id);
|
|
1427
1527
|
const noChildren = children === void 0;
|
|
1428
|
-
const input = /* @__PURE__ */ (0,
|
|
1528
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CheckboxInput_default, { ...props, className: noChildren ? className : void 0, disabled, id: htmlId, ref });
|
|
1429
1529
|
if (noChildren) {
|
|
1430
1530
|
return input;
|
|
1431
1531
|
}
|
|
1432
|
-
return /* @__PURE__ */ (0,
|
|
1532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
|
|
1433
1533
|
});
|
|
1434
|
-
var Checkbox_default = (0,
|
|
1534
|
+
var Checkbox_default = (0, import_react36.memo)(Checkbox);
|
|
1435
1535
|
|
|
1436
1536
|
// src/components/TagItem/index.tsx
|
|
1437
|
-
var
|
|
1537
|
+
var import_react37 = require("react");
|
|
1438
1538
|
var import_utils7 = require("@react-aria/utils");
|
|
1439
|
-
var
|
|
1440
|
-
var TagItem = (0,
|
|
1539
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1540
|
+
var TagItem = (0, import_react37.forwardRef)(function TagItemInner({
|
|
1441
1541
|
component,
|
|
1442
1542
|
label,
|
|
1443
1543
|
translatedLabel,
|
|
@@ -1452,18 +1552,18 @@ var TagItem = (0, import_react35.forwardRef)(function TagItemInner({
|
|
|
1452
1552
|
const className = useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
|
|
1453
1553
|
const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
|
|
1454
1554
|
const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
|
|
1455
|
-
const Component = (0,
|
|
1456
|
-
return /* @__PURE__ */ (0,
|
|
1555
|
+
const Component = (0, import_react37.useMemo)(() => component ?? "button", [component]);
|
|
1556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Component, { ...props, ref, className, "data-state": status, "data-bg-variant": bgVariant, "data-size": hasTranslatedLabel ? "M" : size, style: {
|
|
1457
1557
|
"--charcoal-tag-item-bg": bg
|
|
1458
1558
|
}, children: [
|
|
1459
|
-
/* @__PURE__ */ (0,
|
|
1460
|
-
hasTranslatedLabel && /* @__PURE__ */ (0,
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "charcoal-tag-item__label", "data-has-translate": hasTranslatedLabel, children: [
|
|
1560
|
+
hasTranslatedLabel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "charcoal-tag-item__label__translated", children: translatedLabel }),
|
|
1561
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "charcoal-tag-item__label__text", "data-has-translate": hasTranslatedLabel, children: label })
|
|
1462
1562
|
] }),
|
|
1463
|
-
status === "active" && /* @__PURE__ */ (0,
|
|
1563
|
+
status === "active" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Icon_default, { name: "16/Remove" })
|
|
1464
1564
|
] });
|
|
1465
1565
|
});
|
|
1466
|
-
var TagItem_default = (0,
|
|
1566
|
+
var TagItem_default = (0, import_react37.memo)(TagItem);
|
|
1467
1567
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1468
1568
|
0 && (module.exports = {
|
|
1469
1569
|
Button,
|
|
@@ -1483,6 +1583,8 @@ var TagItem_default = (0, import_react35.memo)(TagItem);
|
|
|
1483
1583
|
ModalButtons,
|
|
1484
1584
|
ModalCloseButton,
|
|
1485
1585
|
ModalHeader,
|
|
1586
|
+
MultiSelect,
|
|
1587
|
+
MultiSelectGroup,
|
|
1486
1588
|
OverlayProvider,
|
|
1487
1589
|
Radio,
|
|
1488
1590
|
RadioGroup,
|