@charcoal-ui/react 4.0.0-beta.2 → 4.0.0-beta.4
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/Button/index.d.ts +9 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts +9 -20
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/CheckboxInput/index.d.ts +9 -0
- package/dist/components/CheckboxInput/index.d.ts.map +1 -0
- package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts +1 -1
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +4 -4
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +1 -1
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +188 -418
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +86 -0
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +167 -397
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -17
- package/src/components/Button/__snapshots__/index.story.storyshot +11 -49
- package/src/components/Button/__snapshots__/index.test.tsx.snap +11 -0
- package/src/components/Button/index.story.tsx +13 -66
- package/src/components/Button/index.test.tsx +32 -0
- package/src/components/Button/index.tsx +11 -1
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +163 -517
- package/src/components/Checkbox/index.css +21 -0
- package/src/components/Checkbox/index.story.tsx +44 -79
- package/src/components/Checkbox/index.tsx +19 -157
- package/src/components/CheckboxInput/__snapshots__/index.story.storyshot +109 -0
- package/src/components/CheckboxInput/index.css +77 -0
- package/src/components/CheckboxInput/index.story.tsx +35 -0
- package/src/components/CheckboxInput/index.tsx +53 -0
- package/src/components/DropdownSelector/Popover/index.tsx +1 -2
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +15 -0
- package/src/components/DropdownSelector/index.tsx +19 -4
- package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -8
- package/src/components/IconButton/index.story.tsx +14 -37
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +139 -1
- package/src/components/LoadingSpinner/index.story.tsx +18 -7
- package/src/components/Modal/__snapshots__/index.story.storyshot +2 -0
- package/src/components/Modal/index.tsx +1 -1
- package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +32 -44
- package/src/components/MultiSelect/index.story.tsx +88 -192
- package/src/components/MultiSelect/index.tsx +2 -1
- package/src/components/Radio/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Radio/index.story.tsx +20 -21
- package/src/components/Radio/index.tsx +14 -13
- package/src/components/Switch/__snapshots__/index.story.storyshot +8 -9
- package/src/components/Switch/index.story.tsx +10 -18
- package/src/components/TagItem/__snapshots__/index.story.storyshot +791 -665
- package/src/components/TagItem/index.story.tsx +44 -161
- package/src/components/TextArea/TextArea.story.tsx +62 -24
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1858 -472
- package/src/components/TextArea/index.tsx +2 -0
- package/src/components/TextField/TextField.story.tsx +77 -67
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +2004 -786
- package/src/components/TextField/index.tsx +2 -0
- package/src/components/a11y.test.tsx +1 -1
- package/src/core/CharcoalProvider.tsx +1 -1
- package/dist/components/Button/index.story.d.ts +0 -24
- package/dist/components/Button/index.story.d.ts.map +0 -1
- package/dist/components/Checkbox/index.story.d.ts +0 -8
- package/dist/components/Checkbox/index.story.d.ts.map +0 -1
- package/dist/components/Clickable/index.story.d.ts +0 -6
- package/dist/components/Clickable/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
- package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/index.story.d.ts +0 -19
- package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
- package/dist/components/Icon/index.story.d.ts +0 -6
- package/dist/components/Icon/index.story.d.ts.map +0 -1
- package/dist/components/IconButton/index.story.d.ts +0 -9
- package/dist/components/IconButton/index.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
- package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
- package/dist/components/Modal/index.story.d.ts +0 -21
- package/dist/components/Modal/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.story.d.ts +0 -82
- package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.test.d.ts +0 -2
- package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
- package/dist/components/Radio/index.story.d.ts +0 -26
- package/dist/components/Radio/index.story.d.ts.map +0 -1
- package/dist/components/Radio/index.test.d.ts +0 -2
- package/dist/components/Radio/index.test.d.ts.map +0 -1
- package/dist/components/SegmentedControl/index.story.d.ts +0 -7
- package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
- package/dist/components/Switch/index.story.d.ts +0 -9
- package/dist/components/Switch/index.story.d.ts.map +0 -1
- package/dist/components/TagItem/index.story.d.ts +0 -16
- package/dist/components/TagItem/index.story.d.ts.map +0 -1
- package/dist/components/TextArea/TextArea.story.d.ts +0 -9
- package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
- package/dist/components/TextField/TextField.story.d.ts +0 -22
- package/dist/components/TextField/TextField.story.d.ts.map +0 -1
- package/dist/components/a11y.test.d.ts +0 -2
- package/dist/components/a11y.test.d.ts.map +0 -1
- package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
package/dist/index.cjs.js
CHANGED
|
@@ -128,11 +128,12 @@ var Button = (0, import_react3.forwardRef)(function Button2({
|
|
|
128
128
|
className,
|
|
129
129
|
as,
|
|
130
130
|
isActive,
|
|
131
|
+
componentAs,
|
|
131
132
|
...props
|
|
132
133
|
}, ref) {
|
|
133
134
|
const Component = (0, import_react3.useMemo)(() => as ?? "button", [as]);
|
|
134
135
|
const classNames = useClassNames("charcoal-button", className);
|
|
135
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ...props, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ...props, as: componentAs, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
|
|
136
137
|
});
|
|
137
138
|
var Button_default = Button;
|
|
138
139
|
|
|
@@ -359,7 +360,24 @@ var MultiSelectGroupContext = (0, import_react6.createContext)({
|
|
|
359
360
|
|
|
360
361
|
// src/components/MultiSelect/index.tsx
|
|
361
362
|
var import_styled4 = require("@charcoal-ui/styled");
|
|
363
|
+
|
|
364
|
+
// src/components/Icon/index.tsx
|
|
365
|
+
var React5 = __toESM(require("react"));
|
|
366
|
+
var import_icons = require("@charcoal-ui/icons");
|
|
362
367
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
368
|
+
var Icon = React5.forwardRef(function IconInner({
|
|
369
|
+
name,
|
|
370
|
+
scale,
|
|
371
|
+
unsafeNonGuidelineScale,
|
|
372
|
+
className,
|
|
373
|
+
...rest
|
|
374
|
+
}, ref) {
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
376
|
+
});
|
|
377
|
+
var Icon_default = Icon;
|
|
378
|
+
|
|
379
|
+
// src/components/MultiSelect/index.tsx
|
|
380
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
363
381
|
var MultiSelect = (0, import_react7.forwardRef)(function MultiSelectInner({
|
|
364
382
|
value,
|
|
365
383
|
disabled = false,
|
|
@@ -396,14 +414,14 @@ var MultiSelect = (0, import_react7.forwardRef)(function MultiSelectInner({
|
|
|
396
414
|
selected: event.currentTarget.checked
|
|
397
415
|
});
|
|
398
416
|
}, [onChange, parentOnChange, value]);
|
|
399
|
-
return /* @__PURE__ */ (0,
|
|
400
|
-
/* @__PURE__ */ (0,
|
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectInput, { ...{
|
|
401
419
|
name,
|
|
402
420
|
value,
|
|
403
421
|
invalid
|
|
404
422
|
}, checked: isSelected, disabled: isDisabled, onChange: handleChange, overlay: variant === "overlay", "aria-invalid": invalid, ref }),
|
|
405
|
-
/* @__PURE__ */ (0,
|
|
406
|
-
Boolean(children) && /* @__PURE__ */ (0,
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
|
|
424
|
+
Boolean(children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectLabel, { children })
|
|
407
425
|
] });
|
|
408
426
|
});
|
|
409
427
|
var MultiSelect_default = (0, import_react7.memo)(MultiSelect);
|
|
@@ -456,14 +474,14 @@ function MultiSelectGroup({
|
|
|
456
474
|
}
|
|
457
475
|
}
|
|
458
476
|
}, [onChange, selected]);
|
|
459
|
-
return /* @__PURE__ */ (0,
|
|
477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectGroupContext.Provider, { value: {
|
|
460
478
|
name,
|
|
461
479
|
selected: Array.from(new Set(selected)),
|
|
462
480
|
disabled,
|
|
463
481
|
readonly,
|
|
464
482
|
invalid,
|
|
465
483
|
onChange: handleChange
|
|
466
|
-
}, children: /* @__PURE__ */ (0,
|
|
484
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
|
|
467
485
|
}
|
|
468
486
|
|
|
469
487
|
// src/components/Switch/index.tsx
|
|
@@ -473,7 +491,7 @@ var import_react_stately = require("react-stately");
|
|
|
473
491
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
474
492
|
var import_utils3 = require("@react-aria/utils");
|
|
475
493
|
var import_styled5 = require("@charcoal-ui/styled");
|
|
476
|
-
var
|
|
494
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
477
495
|
var SwitchCheckbox = (0, import_react8.forwardRef)(function SwitchCheckboxInner(props, external) {
|
|
478
496
|
const {
|
|
479
497
|
disabled,
|
|
@@ -494,9 +512,9 @@ var SwitchCheckbox = (0, import_react8.forwardRef)(function SwitchCheckboxInner(
|
|
|
494
512
|
...rest
|
|
495
513
|
}
|
|
496
514
|
} = (0, import_switch.useSwitch)(ariaSwitchProps, state, ref);
|
|
497
|
-
return /* @__PURE__ */ (0,
|
|
498
|
-
/* @__PURE__ */ (0,
|
|
499
|
-
"children" in props ? /* @__PURE__ */ (0,
|
|
515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Label, { className, "aria-disabled": disabled, children: [
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchInput, { ...rest, ref }),
|
|
517
|
+
"children" in props ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LabelInner, { children: props.children }) : void 0
|
|
500
518
|
] });
|
|
501
519
|
});
|
|
502
520
|
var Switch_default = (0, import_react8.memo)(SwitchCheckbox);
|
|
@@ -516,14 +534,14 @@ var SwitchInput = import_styled_components6.default.input.attrs({
|
|
|
516
534
|
var import_textfield = require("@react-aria/textfield");
|
|
517
535
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
518
536
|
var import_react10 = require("react");
|
|
519
|
-
var
|
|
537
|
+
var React7 = __toESM(require("react"));
|
|
520
538
|
var import_styled_components8 = __toESM(require("styled-components"));
|
|
521
539
|
|
|
522
540
|
// src/components/FieldLabel/index.tsx
|
|
523
|
-
var
|
|
541
|
+
var React6 = __toESM(require("react"));
|
|
524
542
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
525
|
-
var
|
|
526
|
-
var FieldLabel =
|
|
543
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
544
|
+
var FieldLabel = React6.forwardRef(function FieldLabel2({
|
|
527
545
|
style,
|
|
528
546
|
className,
|
|
529
547
|
label,
|
|
@@ -532,10 +550,10 @@ var FieldLabel = React5.forwardRef(function FieldLabel2({
|
|
|
532
550
|
subLabel,
|
|
533
551
|
...labelProps
|
|
534
552
|
}, ref) {
|
|
535
|
-
return /* @__PURE__ */ (0,
|
|
536
|
-
/* @__PURE__ */ (0,
|
|
537
|
-
required && /* @__PURE__ */ (0,
|
|
538
|
-
/* @__PURE__ */ (0,
|
|
553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(FieldLabelWrapper, { style, className, children: [
|
|
554
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Label2, { ref, ...labelProps, children: label }),
|
|
555
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RequiredText, { children: requiredText }),
|
|
556
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SubLabelClickable, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: subLabel }) })
|
|
539
557
|
] });
|
|
540
558
|
});
|
|
541
559
|
var FieldLabel_default = FieldLabel;
|
|
@@ -593,11 +611,11 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
593
611
|
|
|
594
612
|
// src/components/TextField/index.tsx
|
|
595
613
|
var import_utils4 = require("@react-aria/utils");
|
|
596
|
-
var
|
|
597
|
-
var TextField =
|
|
614
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
615
|
+
var TextField = React7.forwardRef(function SingleLineTextFieldInner({
|
|
598
616
|
onChange,
|
|
599
617
|
...props
|
|
600
|
-
},
|
|
618
|
+
}, forwardRef19) {
|
|
601
619
|
const {
|
|
602
620
|
className,
|
|
603
621
|
showLabel = false,
|
|
@@ -608,6 +626,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
608
626
|
disabled = false,
|
|
609
627
|
required,
|
|
610
628
|
invalid = false,
|
|
629
|
+
readOnly = false,
|
|
611
630
|
assistiveText,
|
|
612
631
|
maxLength,
|
|
613
632
|
prefix = null,
|
|
@@ -642,6 +661,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
642
661
|
inputElementType: "input",
|
|
643
662
|
isDisabled: disabled,
|
|
644
663
|
isRequired: required,
|
|
664
|
+
isReadOnly: readOnly,
|
|
645
665
|
validationState: invalid ? "invalid" : "valid",
|
|
646
666
|
description: !invalid && assistiveText,
|
|
647
667
|
errorMessage: invalid && assistiveText,
|
|
@@ -651,17 +671,17 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
651
671
|
const containerRef = (0, import_react10.useRef)(null);
|
|
652
672
|
useFocusWithClick(containerRef, ariaRef);
|
|
653
673
|
const inputProps = (0, import_utils4.mergeProps)(restProps, ariaInputProps);
|
|
654
|
-
return /* @__PURE__ */ (0,
|
|
655
|
-
/* @__PURE__ */ (0,
|
|
656
|
-
/* @__PURE__ */ (0,
|
|
657
|
-
prefix && /* @__PURE__ */ (0,
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
659
|
-
(suffix || showCount) && /* @__PURE__ */ (0,
|
|
674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(StyledInputContainer, { ref: containerRef, invalid, "aria-disabled": disabled === true ? true : void 0, hasPrefix: prefix != null, hasSuffix: suffix != null || showCount, children: [
|
|
677
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PrefixContainer, { children: prefix }),
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledInput, { ref: mergeRefs(forwardRef19, ariaRef), invalid, ...inputProps }),
|
|
679
|
+
(suffix || showCount) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(SuffixContainer, { children: [
|
|
660
680
|
suffix,
|
|
661
|
-
showCount && /* @__PURE__ */ (0,
|
|
681
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
662
682
|
] })
|
|
663
683
|
] }),
|
|
664
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0,
|
|
684
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
665
685
|
] });
|
|
666
686
|
});
|
|
667
687
|
var TextField_default = TextField;
|
|
@@ -698,11 +718,11 @@ var import_visually_hidden2 = require("@react-aria/visually-hidden");
|
|
|
698
718
|
var import_react11 = require("react");
|
|
699
719
|
var import_styled_components9 = __toESM(require("styled-components"));
|
|
700
720
|
var import_utils5 = require("@react-aria/utils");
|
|
701
|
-
var
|
|
721
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
702
722
|
var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
703
723
|
onChange,
|
|
704
724
|
...props
|
|
705
|
-
},
|
|
725
|
+
}, forwardRef19) {
|
|
706
726
|
const {
|
|
707
727
|
className,
|
|
708
728
|
showCount = false,
|
|
@@ -713,6 +733,7 @@ var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
|
713
733
|
disabled = false,
|
|
714
734
|
required,
|
|
715
735
|
invalid = false,
|
|
736
|
+
readOnly = false,
|
|
716
737
|
assistiveText,
|
|
717
738
|
maxLength,
|
|
718
739
|
autoHeight = false,
|
|
@@ -757,6 +778,7 @@ var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
|
757
778
|
inputElementType: "textarea",
|
|
758
779
|
isDisabled: disabled,
|
|
759
780
|
isRequired: required,
|
|
781
|
+
isReadOnly: readOnly,
|
|
760
782
|
validationState: invalid ? "invalid" : "valid",
|
|
761
783
|
description: !invalid && assistiveText,
|
|
762
784
|
errorMessage: invalid && assistiveText,
|
|
@@ -771,13 +793,13 @@ var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
|
771
793
|
const containerRef = (0, import_react11.useRef)(null);
|
|
772
794
|
useFocusWithClick(containerRef, ariaRef);
|
|
773
795
|
const inputProps = (0, import_utils5.mergeProps)(restProps, ariaInputProps);
|
|
774
|
-
return /* @__PURE__ */ (0,
|
|
775
|
-
/* @__PURE__ */ (0,
|
|
776
|
-
/* @__PURE__ */ (0,
|
|
777
|
-
/* @__PURE__ */ (0,
|
|
778
|
-
showCount && /* @__PURE__ */ (0,
|
|
796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
797
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledTextareaContainer, { ref: containerRef, invalid, rows: showCount ? rows + 1 : rows, "aria-disabled": disabled === true ? "true" : void 0, children: [
|
|
799
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef19, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
|
|
800
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
779
801
|
] }),
|
|
780
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0,
|
|
802
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
781
803
|
] });
|
|
782
804
|
});
|
|
783
805
|
var TextArea_default = TextArea;
|
|
@@ -801,23 +823,8 @@ var MultiLineCounter = import_styled_components9.default.span.withConfig({
|
|
|
801
823
|
componentId: "ccl__sc-58waht-3"
|
|
802
824
|
})(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
803
825
|
|
|
804
|
-
// src/components/Icon/index.tsx
|
|
805
|
-
var React7 = __toESM(require("react"));
|
|
806
|
-
var import_icons = require("@charcoal-ui/icons");
|
|
807
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
808
|
-
var Icon = React7.forwardRef(function IconInner({
|
|
809
|
-
name,
|
|
810
|
-
scale,
|
|
811
|
-
unsafeNonGuidelineScale,
|
|
812
|
-
className,
|
|
813
|
-
...rest
|
|
814
|
-
}, ref) {
|
|
815
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
816
|
-
});
|
|
817
|
-
var Icon_default = Icon;
|
|
818
|
-
|
|
819
826
|
// src/components/Modal/index.tsx
|
|
820
|
-
var
|
|
827
|
+
var import_react14 = require("react");
|
|
821
828
|
var React11 = __toESM(require("react"));
|
|
822
829
|
var import_overlays3 = require("@react-aria/overlays");
|
|
823
830
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
@@ -830,15 +837,7 @@ var import_utils8 = require("@react-aria/utils");
|
|
|
830
837
|
var import_react12 = require("react");
|
|
831
838
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
832
839
|
var import_dialog = require("@react-aria/dialog");
|
|
833
|
-
|
|
834
|
-
// ../foundation/src/grid.ts
|
|
835
|
-
var COLUMN_UNIT = 80;
|
|
836
|
-
var GUTTER_UNIT = 24;
|
|
837
|
-
function columnSystem(span, column, gutter) {
|
|
838
|
-
return span * column + (span - 1) * gutter;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
// src/components/Modal/Dialog/index.tsx
|
|
840
|
+
var import_foundation = require("@charcoal-ui/foundation");
|
|
842
841
|
var import_utils6 = require("@charcoal-ui/utils");
|
|
843
842
|
var import_react_spring = require("react-spring");
|
|
844
843
|
|
|
@@ -860,8 +859,8 @@ function useForwardedRef(ref) {
|
|
|
860
859
|
|
|
861
860
|
// src/components/Modal/Dialog/index.tsx
|
|
862
861
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
863
|
-
var Dialog = (0, import_react12.forwardRef)(function Dialog2(props,
|
|
864
|
-
const ref = useForwardedRef(
|
|
862
|
+
var Dialog = (0, import_react12.forwardRef)(function Dialog2(props, forwardRef19) {
|
|
863
|
+
const ref = useForwardedRef(forwardRef19);
|
|
865
864
|
const {
|
|
866
865
|
dialogProps
|
|
867
866
|
} = (0, import_dialog.useDialog)({
|
|
@@ -874,13 +873,13 @@ var AnimatedStyledDialogDiv = (0, import_react_spring.animated)(import_styled_co
|
|
|
874
873
|
})(["margin:auto;position:relative;height:fit-content;width:", "px;background-color:var(--charcoal-surface1);border-radius:24px;@media ", "{max-width:440px;width:calc(100% - 48px);", "}:focus{outline:none;}"], (p) => {
|
|
875
874
|
switch (p.size) {
|
|
876
875
|
case "S": {
|
|
877
|
-
return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
876
|
+
return (0, import_foundation.columnSystem)(3, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
878
877
|
}
|
|
879
878
|
case "M": {
|
|
880
|
-
return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
879
|
+
return (0, import_foundation.columnSystem)(4, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
881
880
|
}
|
|
882
881
|
case "L": {
|
|
883
|
-
return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
882
|
+
return (0, import_foundation.columnSystem)(6, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
884
883
|
}
|
|
885
884
|
default: {
|
|
886
885
|
return unreachable(p.size);
|
|
@@ -897,6 +896,25 @@ var ModalBackgroundContext = React9.createContext(null);
|
|
|
897
896
|
// src/components/Modal/useCustomModalOverlay.tsx
|
|
898
897
|
var React10 = __toESM(require("react"));
|
|
899
898
|
var import_overlays2 = require("@react-aria/overlays");
|
|
899
|
+
|
|
900
|
+
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
901
|
+
var import_react13 = require("react");
|
|
902
|
+
function usePreventScroll(element, isOpen) {
|
|
903
|
+
(0, import_react13.useEffect)(() => {
|
|
904
|
+
if (isOpen && element) {
|
|
905
|
+
const defaultPaddingRight = element.style.paddingRight;
|
|
906
|
+
const defaultOverflow = element.style.overflow;
|
|
907
|
+
element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
|
|
908
|
+
element.style.overflow = "hidden";
|
|
909
|
+
return () => {
|
|
910
|
+
element.style.paddingRight = defaultPaddingRight;
|
|
911
|
+
element.style.overflow = defaultOverflow;
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
}, [element, isOpen]);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// src/components/Modal/useCustomModalOverlay.tsx
|
|
900
918
|
function useCharcoalModalOverlay(props, state, ref) {
|
|
901
919
|
const {
|
|
902
920
|
overlayProps,
|
|
@@ -907,9 +925,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
907
925
|
onClose: state.onClose,
|
|
908
926
|
shouldCloseOnInteractOutside: () => false
|
|
909
927
|
}, ref);
|
|
910
|
-
(
|
|
911
|
-
isDisabled: !state.isOpen
|
|
912
|
-
});
|
|
928
|
+
usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
|
|
913
929
|
(0, import_overlays2.useOverlayFocusContain)();
|
|
914
930
|
React10.useEffect(() => {
|
|
915
931
|
if (state.isOpen && ref.current) {
|
|
@@ -925,7 +941,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
925
941
|
// src/components/Modal/index.tsx
|
|
926
942
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
927
943
|
var DEFAULT_Z_INDEX = 10;
|
|
928
|
-
var Modal = (0,
|
|
944
|
+
var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
929
945
|
children,
|
|
930
946
|
zIndex = DEFAULT_Z_INDEX,
|
|
931
947
|
portalContainer,
|
|
@@ -1006,7 +1022,7 @@ var Modal = (0, import_react13.forwardRef)(function ModalInner({
|
|
|
1006
1022
|
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalCrossButton, { size: "S", icon: "24/Close", onClick: onClose })
|
|
1007
1023
|
] }) }) }) }) }));
|
|
1008
1024
|
});
|
|
1009
|
-
var Modal_default = (0,
|
|
1025
|
+
var Modal_default = (0, import_react14.memo)(Modal);
|
|
1010
1026
|
var ModalContext = React11.createContext({
|
|
1011
1027
|
titleProps: {},
|
|
1012
1028
|
title: "",
|
|
@@ -1028,7 +1044,7 @@ function ModalTitle(props) {
|
|
|
1028
1044
|
const {
|
|
1029
1045
|
titleProps,
|
|
1030
1046
|
title
|
|
1031
|
-
} = (0,
|
|
1047
|
+
} = (0, import_react14.useContext)(ModalContext);
|
|
1032
1048
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1033
1049
|
}
|
|
1034
1050
|
var ModalHeading = import_styled_components11.default.h3.withConfig({
|
|
@@ -1037,11 +1053,11 @@ var ModalHeading = import_styled_components11.default.h3.withConfig({
|
|
|
1037
1053
|
|
|
1038
1054
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1039
1055
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
1040
|
-
var
|
|
1056
|
+
var import_react15 = require("react");
|
|
1041
1057
|
var import_utils9 = require("@charcoal-ui/utils");
|
|
1042
1058
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1043
1059
|
function ModalHeader() {
|
|
1044
|
-
const modalCtx = (0,
|
|
1060
|
+
const modalCtx = (0, import_react15.useContext)(ModalContext);
|
|
1045
1061
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledModalTitle, {}) });
|
|
1046
1062
|
}
|
|
1047
1063
|
var ModalHeaderRoot = import_styled_components12.default.div.withConfig({
|
|
@@ -1063,10 +1079,10 @@ var ModalButtons = import_styled_components12.default.div.withConfig({
|
|
|
1063
1079
|
})(["display:grid;grid-auto-flow:row;grid-row-gap:8px;padding-top:16px;padding-left:16px;padding-right:16px;"]);
|
|
1064
1080
|
|
|
1065
1081
|
// src/components/LoadingSpinner/index.tsx
|
|
1066
|
-
var
|
|
1082
|
+
var import_react16 = require("react");
|
|
1067
1083
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
1068
1084
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1069
|
-
var LoadingSpinner = (0,
|
|
1085
|
+
var LoadingSpinner = (0, import_react16.forwardRef)(function LoadingSpinnerInner({
|
|
1070
1086
|
size = 48,
|
|
1071
1087
|
padding = 16,
|
|
1072
1088
|
transparent = false,
|
|
@@ -1074,7 +1090,7 @@ var LoadingSpinner = (0, import_react15.forwardRef)(function LoadingSpinnerInner
|
|
|
1074
1090
|
}, ref) {
|
|
1075
1091
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerRoot, { size, padding, transparent, className, ref, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerIcon, {}) });
|
|
1076
1092
|
});
|
|
1077
|
-
var LoadingSpinner_default = (0,
|
|
1093
|
+
var LoadingSpinner_default = (0, import_react16.memo)(LoadingSpinner);
|
|
1078
1094
|
var LoadingSpinnerRoot = import_styled_components13.default.div.attrs({
|
|
1079
1095
|
role: "progressbar"
|
|
1080
1096
|
}).withConfig({
|
|
@@ -1088,11 +1104,11 @@ var Icon2 = import_styled_components13.default.div.attrs({
|
|
|
1088
1104
|
}).withConfig({
|
|
1089
1105
|
componentId: "ccl__sc-1id6yz4-1"
|
|
1090
1106
|
})(["width:1em;height:1em;border-radius:1em;background-color:currentColor;animation:", " 1s both ease-out;animation-iteration-count:", ";&[data-reset-animation]{animation:none;}"], scaleOut, (p) => p.once ? 1 : "infinite");
|
|
1091
|
-
var LoadingSpinnerIcon = (0,
|
|
1107
|
+
var LoadingSpinnerIcon = (0, import_react16.forwardRef)(function LoadingSpinnerIcon2({
|
|
1092
1108
|
once = false
|
|
1093
1109
|
}, ref) {
|
|
1094
|
-
const iconRef = (0,
|
|
1095
|
-
(0,
|
|
1110
|
+
const iconRef = (0, import_react16.useRef)(null);
|
|
1111
|
+
(0, import_react16.useImperativeHandle)(ref, () => ({
|
|
1096
1112
|
restart: () => {
|
|
1097
1113
|
if (!iconRef.current) {
|
|
1098
1114
|
return;
|
|
@@ -1117,25 +1133,6 @@ var import_react18 = require("react");
|
|
|
1117
1133
|
var import_react17 = require("react");
|
|
1118
1134
|
var import_overlays4 = require("@react-aria/overlays");
|
|
1119
1135
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
1120
|
-
|
|
1121
|
-
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1122
|
-
var import_react16 = require("react");
|
|
1123
|
-
function usePreventScroll2(element, isOpen) {
|
|
1124
|
-
(0, import_react16.useEffect)(() => {
|
|
1125
|
-
if (isOpen && element) {
|
|
1126
|
-
const defaultPaddingRight = element.style.paddingRight;
|
|
1127
|
-
const defaultOverflow = element.style.overflow;
|
|
1128
|
-
element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
|
|
1129
|
-
element.style.overflow = "hidden";
|
|
1130
|
-
return () => {
|
|
1131
|
-
element.style.paddingRight = defaultPaddingRight;
|
|
1132
|
-
element.style.overflow = defaultOverflow;
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
}, [element, isOpen]);
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
// src/components/DropdownSelector/Popover/index.tsx
|
|
1139
1136
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1140
1137
|
var _empty = () => null;
|
|
1141
1138
|
function Popover(props) {
|
|
@@ -1156,7 +1153,7 @@ function Popover(props) {
|
|
|
1156
1153
|
toggle: _empty
|
|
1157
1154
|
});
|
|
1158
1155
|
const modalBackground = (0, import_react17.useContext)(ModalBackgroundContext);
|
|
1159
|
-
|
|
1156
|
+
usePreventScroll(modalBackground, props.isOpen);
|
|
1160
1157
|
if (!props.isOpen)
|
|
1161
1158
|
return null;
|
|
1162
1159
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_overlays4.Overlay, { portalContainer: document.body, children: [
|
|
@@ -1284,7 +1281,10 @@ var import_styled7 = require("@charcoal-ui/styled");
|
|
|
1284
1281
|
var import_visually_hidden3 = require("@react-aria/visually-hidden");
|
|
1285
1282
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1286
1283
|
var defaultRequiredText = "*\u5FC5\u9808";
|
|
1287
|
-
function DropdownSelector(
|
|
1284
|
+
function DropdownSelector({
|
|
1285
|
+
onChange,
|
|
1286
|
+
...props
|
|
1287
|
+
}) {
|
|
1288
1288
|
const triggerRef = (0, import_react21.useRef)(null);
|
|
1289
1289
|
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
1290
1290
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
@@ -1293,9 +1293,12 @@ function DropdownSelector(props) {
|
|
|
1293
1293
|
const {
|
|
1294
1294
|
visuallyHiddenProps
|
|
1295
1295
|
} = (0, import_visually_hidden3.useVisuallyHidden)();
|
|
1296
|
+
const handleChange = (0, import_react21.useCallback)((e) => {
|
|
1297
|
+
onChange(e.target.value);
|
|
1298
|
+
}, [onChange]);
|
|
1296
1299
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
|
|
1297
1300
|
props.showLabel === true && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownFieldLabel, { label: props.label, required: props.required, requiredText: props.requiredText ?? defaultRequiredText, subLabel: props.subLabel }),
|
|
1298
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("select", { name: props.name, value: props.value, tabIndex: -1, children: propsArray.map((itemProps) => {
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
|
|
1299
1302
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
|
|
1300
1303
|
}) }) }),
|
|
1301
1304
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownButton, { invalid: props.invalid, disabled: props.disabled, onClick: () => {
|
|
@@ -1307,7 +1310,7 @@ function DropdownSelector(props) {
|
|
|
1307
1310
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownButtonIcon, { name: "16/Menu" })
|
|
1308
1311
|
] }),
|
|
1309
1312
|
isOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuList, { value: props.value, onChange: (v) => {
|
|
1310
|
-
|
|
1313
|
+
onChange(v);
|
|
1311
1314
|
setIsOpen(false);
|
|
1312
1315
|
}, children: props.children }) }),
|
|
1313
1316
|
props.assistiveText !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
|
|
@@ -1493,240 +1496,15 @@ var StyledLi2 = import_styled_components19.default.li.withConfig({
|
|
|
1493
1496
|
})(["display:block;"]);
|
|
1494
1497
|
|
|
1495
1498
|
// src/components/SegmentedControl/index.tsx
|
|
1496
|
-
var import_react28 = require("react");
|
|
1497
|
-
|
|
1498
|
-
// ../../node_modules/@react-stately/form/dist/import.mjs
|
|
1499
|
-
var import_react24 = require("react");
|
|
1500
|
-
var $e5be200c675c3b3a$export$aca958c65c314e6c = {
|
|
1501
|
-
badInput: false,
|
|
1502
|
-
customError: false,
|
|
1503
|
-
patternMismatch: false,
|
|
1504
|
-
rangeOverflow: false,
|
|
1505
|
-
rangeUnderflow: false,
|
|
1506
|
-
stepMismatch: false,
|
|
1507
|
-
tooLong: false,
|
|
1508
|
-
tooShort: false,
|
|
1509
|
-
typeMismatch: false,
|
|
1510
|
-
valueMissing: false,
|
|
1511
|
-
valid: true
|
|
1512
|
-
};
|
|
1513
|
-
var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
|
|
1514
|
-
...$e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
1515
|
-
customError: true,
|
|
1516
|
-
valid: false
|
|
1517
|
-
};
|
|
1518
|
-
var $e5be200c675c3b3a$export$dad6ae84456c676a = {
|
|
1519
|
-
isInvalid: false,
|
|
1520
|
-
validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
1521
|
-
validationErrors: []
|
|
1522
|
-
};
|
|
1523
|
-
var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, import_react24.createContext)({});
|
|
1524
|
-
var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
|
|
1525
|
-
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
|
|
1526
|
-
if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
|
|
1527
|
-
let {
|
|
1528
|
-
realtimeValidation,
|
|
1529
|
-
displayValidation,
|
|
1530
|
-
updateValidation,
|
|
1531
|
-
resetValidation,
|
|
1532
|
-
commitValidation
|
|
1533
|
-
} = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
|
|
1534
|
-
return {
|
|
1535
|
-
realtimeValidation,
|
|
1536
|
-
displayValidation,
|
|
1537
|
-
updateValidation,
|
|
1538
|
-
resetValidation,
|
|
1539
|
-
commitValidation
|
|
1540
|
-
};
|
|
1541
|
-
}
|
|
1542
|
-
return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
|
|
1543
|
-
}
|
|
1544
|
-
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
1545
|
-
let {
|
|
1546
|
-
isInvalid,
|
|
1547
|
-
validationState,
|
|
1548
|
-
name,
|
|
1549
|
-
value,
|
|
1550
|
-
builtinValidation,
|
|
1551
|
-
validate,
|
|
1552
|
-
validationBehavior = "aria"
|
|
1553
|
-
} = props;
|
|
1554
|
-
if (validationState)
|
|
1555
|
-
isInvalid || (isInvalid = validationState === "invalid");
|
|
1556
|
-
let controlledError = isInvalid ? {
|
|
1557
|
-
isInvalid: true,
|
|
1558
|
-
validationErrors: [],
|
|
1559
|
-
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
1560
|
-
} : null;
|
|
1561
|
-
let clientError = (0, import_react24.useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [validate, value]);
|
|
1562
|
-
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
|
|
1563
|
-
builtinValidation = null;
|
|
1564
|
-
let serverErrors = (0, import_react24.useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
|
|
1565
|
-
let serverErrorMessages = (0, import_react24.useMemo)(() => {
|
|
1566
|
-
if (name)
|
|
1567
|
-
return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
|
|
1568
|
-
return [];
|
|
1569
|
-
}, [serverErrors, name]);
|
|
1570
|
-
let [lastServerErrors, setLastServerErrors] = (0, import_react24.useState)(serverErrors);
|
|
1571
|
-
let [isServerErrorCleared, setServerErrorCleared] = (0, import_react24.useState)(false);
|
|
1572
|
-
if (serverErrors !== lastServerErrors) {
|
|
1573
|
-
setLastServerErrors(serverErrors);
|
|
1574
|
-
setServerErrorCleared(false);
|
|
1575
|
-
}
|
|
1576
|
-
let serverError = (0, import_react24.useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [isServerErrorCleared, serverErrorMessages]);
|
|
1577
|
-
let nextValidation = (0, import_react24.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1578
|
-
let [currentValidity, setCurrentValidity] = (0, import_react24.useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1579
|
-
let lastError = (0, import_react24.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1580
|
-
let commitValidation = () => {
|
|
1581
|
-
if (!commitQueued)
|
|
1582
|
-
return;
|
|
1583
|
-
setCommitQueued(false);
|
|
1584
|
-
let error = clientError || builtinValidation || nextValidation.current;
|
|
1585
|
-
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
1586
|
-
lastError.current = error;
|
|
1587
|
-
setCurrentValidity(error);
|
|
1588
|
-
}
|
|
1589
|
-
};
|
|
1590
|
-
let [commitQueued, setCommitQueued] = (0, import_react24.useState)(false);
|
|
1591
|
-
(0, import_react24.useEffect)(commitValidation);
|
|
1592
|
-
let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
1593
|
-
let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
|
|
1594
|
-
return {
|
|
1595
|
-
realtimeValidation,
|
|
1596
|
-
displayValidation,
|
|
1597
|
-
updateValidation(value2) {
|
|
1598
|
-
if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
|
|
1599
|
-
setCurrentValidity(value2);
|
|
1600
|
-
else
|
|
1601
|
-
nextValidation.current = value2;
|
|
1602
|
-
},
|
|
1603
|
-
resetValidation() {
|
|
1604
|
-
let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
1605
|
-
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
1606
|
-
lastError.current = error;
|
|
1607
|
-
setCurrentValidity(error);
|
|
1608
|
-
}
|
|
1609
|
-
if (validationBehavior === "native")
|
|
1610
|
-
setCommitQueued(false);
|
|
1611
|
-
setServerErrorCleared(true);
|
|
1612
|
-
},
|
|
1613
|
-
commitValidation() {
|
|
1614
|
-
if (validationBehavior === "native")
|
|
1615
|
-
setCommitQueued(true);
|
|
1616
|
-
setServerErrorCleared(true);
|
|
1617
|
-
}
|
|
1618
|
-
};
|
|
1619
|
-
}
|
|
1620
|
-
function $e5be200c675c3b3a$var$asArray(v) {
|
|
1621
|
-
if (!v)
|
|
1622
|
-
return [];
|
|
1623
|
-
return Array.isArray(v) ? v : [v];
|
|
1624
|
-
}
|
|
1625
|
-
function $e5be200c675c3b3a$var$runValidate(validate, value) {
|
|
1626
|
-
if (typeof validate === "function") {
|
|
1627
|
-
let e = validate(value);
|
|
1628
|
-
if (e && typeof e !== "boolean")
|
|
1629
|
-
return $e5be200c675c3b3a$var$asArray(e);
|
|
1630
|
-
}
|
|
1631
|
-
return [];
|
|
1632
|
-
}
|
|
1633
|
-
function $e5be200c675c3b3a$var$getValidationResult(errors) {
|
|
1634
|
-
return errors.length ? {
|
|
1635
|
-
isInvalid: true,
|
|
1636
|
-
validationErrors: errors,
|
|
1637
|
-
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
1638
|
-
} : null;
|
|
1639
|
-
}
|
|
1640
|
-
function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
|
|
1641
|
-
if (a === b)
|
|
1642
|
-
return true;
|
|
1643
|
-
return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
// ../../node_modules/@react-stately/utils/dist/import.mjs
|
|
1647
1499
|
var import_react25 = require("react");
|
|
1648
|
-
|
|
1649
|
-
let [stateValue, setStateValue] = (0, import_react25.useState)(value || defaultValue);
|
|
1650
|
-
let isControlledRef = (0, import_react25.useRef)(value !== void 0);
|
|
1651
|
-
let isControlled = value !== void 0;
|
|
1652
|
-
(0, import_react25.useEffect)(() => {
|
|
1653
|
-
let wasControlled = isControlledRef.current;
|
|
1654
|
-
if (wasControlled !== isControlled)
|
|
1655
|
-
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
|
1656
|
-
isControlledRef.current = isControlled;
|
|
1657
|
-
}, [isControlled]);
|
|
1658
|
-
let currentValue = isControlled ? value : stateValue;
|
|
1659
|
-
let setValue = (0, import_react25.useCallback)((value2, ...args) => {
|
|
1660
|
-
let onChangeCaller = (value3, ...onChangeArgs) => {
|
|
1661
|
-
if (onChange) {
|
|
1662
|
-
if (!Object.is(currentValue, value3))
|
|
1663
|
-
onChange(value3, ...onChangeArgs);
|
|
1664
|
-
}
|
|
1665
|
-
if (!isControlled)
|
|
1666
|
-
currentValue = value3;
|
|
1667
|
-
};
|
|
1668
|
-
if (typeof value2 === "function") {
|
|
1669
|
-
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
|
1670
|
-
let updateFunction = (oldValue, ...functionArgs) => {
|
|
1671
|
-
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
1672
|
-
onChangeCaller(interceptedValue, ...args);
|
|
1673
|
-
if (!isControlled)
|
|
1674
|
-
return interceptedValue;
|
|
1675
|
-
return oldValue;
|
|
1676
|
-
};
|
|
1677
|
-
setStateValue(updateFunction);
|
|
1678
|
-
} else {
|
|
1679
|
-
if (!isControlled)
|
|
1680
|
-
setStateValue(value2);
|
|
1681
|
-
onChangeCaller(value2, ...args);
|
|
1682
|
-
}
|
|
1683
|
-
}, [isControlled, currentValue, onChange]);
|
|
1684
|
-
return [currentValue, setValue];
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
// ../../node_modules/@react-stately/radio/dist/import.mjs
|
|
1688
|
-
var import_react26 = require("react");
|
|
1689
|
-
var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
|
|
1690
|
-
var $a54cdc5c1942b639$var$i = 0;
|
|
1691
|
-
function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
|
|
1692
|
-
let name = (0, import_react26.useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [props.name]);
|
|
1693
|
-
var _props_defaultValue;
|
|
1694
|
-
let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
|
|
1695
|
-
let [lastFocusedValue, setLastFocusedValue] = (0, import_react26.useState)(null);
|
|
1696
|
-
let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
|
|
1697
|
-
...props,
|
|
1698
|
-
value: selectedValue
|
|
1699
|
-
});
|
|
1700
|
-
let setSelectedValue = (value) => {
|
|
1701
|
-
if (!props.isReadOnly && !props.isDisabled) {
|
|
1702
|
-
setSelected(value);
|
|
1703
|
-
validation.commitValidation();
|
|
1704
|
-
}
|
|
1705
|
-
};
|
|
1706
|
-
let isInvalid = validation.displayValidation.isInvalid;
|
|
1707
|
-
return {
|
|
1708
|
-
...validation,
|
|
1709
|
-
name,
|
|
1710
|
-
selectedValue,
|
|
1711
|
-
setSelectedValue,
|
|
1712
|
-
lastFocusedValue,
|
|
1713
|
-
setLastFocusedValue,
|
|
1714
|
-
isDisabled: props.isDisabled || false,
|
|
1715
|
-
isReadOnly: props.isReadOnly || false,
|
|
1716
|
-
isRequired: props.isRequired || false,
|
|
1717
|
-
validationState: props.validationState || (isInvalid ? "invalid" : null),
|
|
1718
|
-
isInvalid
|
|
1719
|
-
};
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
// src/components/SegmentedControl/index.tsx
|
|
1500
|
+
var import_radio = require("@react-stately/radio");
|
|
1723
1501
|
var import_radio2 = require("@react-aria/radio");
|
|
1724
1502
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
1725
1503
|
|
|
1726
1504
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1727
|
-
var
|
|
1505
|
+
var import_react24 = require("react");
|
|
1728
1506
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1729
|
-
var RadioContext = (0,
|
|
1507
|
+
var RadioContext = (0, import_react24.createContext)(null);
|
|
1730
1508
|
var RadioProvider = ({
|
|
1731
1509
|
value,
|
|
1732
1510
|
children
|
|
@@ -1734,7 +1512,7 @@ var RadioProvider = ({
|
|
|
1734
1512
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RadioContext.Provider, { value, children });
|
|
1735
1513
|
};
|
|
1736
1514
|
var useRadioContext = () => {
|
|
1737
|
-
const state = (0,
|
|
1515
|
+
const state = (0, import_react24.useContext)(RadioContext);
|
|
1738
1516
|
if (state === null)
|
|
1739
1517
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1740
1518
|
return state;
|
|
@@ -1742,19 +1520,19 @@ var useRadioContext = () => {
|
|
|
1742
1520
|
|
|
1743
1521
|
// src/components/SegmentedControl/index.tsx
|
|
1744
1522
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1745
|
-
var SegmentedControl = (0,
|
|
1746
|
-
const ariaRadioGroupProps = (0,
|
|
1523
|
+
var SegmentedControl = (0, import_react25.forwardRef)(function SegmentedControlInner(props, ref) {
|
|
1524
|
+
const ariaRadioGroupProps = (0, import_react25.useMemo)(() => ({
|
|
1747
1525
|
...props,
|
|
1748
1526
|
isDisabled: props.disabled,
|
|
1749
1527
|
isReadOnly: props.readonly,
|
|
1750
1528
|
isRequired: props.required,
|
|
1751
1529
|
"aria-label": props.name
|
|
1752
1530
|
}), [props]);
|
|
1753
|
-
const state =
|
|
1531
|
+
const state = (0, import_radio.useRadioGroupState)(ariaRadioGroupProps);
|
|
1754
1532
|
const {
|
|
1755
1533
|
radioGroupProps
|
|
1756
1534
|
} = (0, import_radio2.useRadioGroup)(ariaRadioGroupProps, state);
|
|
1757
|
-
const segmentedControlItems = (0,
|
|
1535
|
+
const segmentedControlItems = (0, import_react25.useMemo)(() => {
|
|
1758
1536
|
return props.data.map((d) => typeof d === "string" ? {
|
|
1759
1537
|
value: d,
|
|
1760
1538
|
label: d
|
|
@@ -1762,11 +1540,11 @@ var SegmentedControl = (0, import_react28.forwardRef)(function SegmentedControlI
|
|
|
1762
1540
|
}, [props.data]);
|
|
1763
1541
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SegmentedControlRoot, { ref, ...radioGroupProps, className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1764
1542
|
});
|
|
1765
|
-
var SegmentedControl_default = (0,
|
|
1543
|
+
var SegmentedControl_default = (0, import_react25.memo)(SegmentedControl);
|
|
1766
1544
|
var Segmented = (props) => {
|
|
1767
1545
|
const state = useRadioContext();
|
|
1768
|
-
const ref = (0,
|
|
1769
|
-
const ariaRadioProps = (0,
|
|
1546
|
+
const ref = (0, import_react25.useRef)(null);
|
|
1547
|
+
const ariaRadioProps = (0, import_react25.useMemo)(() => ({
|
|
1770
1548
|
value: props.value,
|
|
1771
1549
|
isDisabled: props.disabled,
|
|
1772
1550
|
children: props.children
|
|
@@ -1800,73 +1578,65 @@ var SegmentedLabelInner = import_styled_components20.default.div.withConfig({
|
|
|
1800
1578
|
})(["font-size:14px;line-height:22px;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
1801
1579
|
|
|
1802
1580
|
// src/components/Checkbox/index.tsx
|
|
1803
|
-
var
|
|
1804
|
-
var
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
var
|
|
1808
|
-
var import_styled8 = require("@charcoal-ui/styled");
|
|
1581
|
+
var import_react27 = require("react");
|
|
1582
|
+
var import_utils11 = require("@react-aria/utils");
|
|
1583
|
+
|
|
1584
|
+
// src/components/CheckboxInput/index.tsx
|
|
1585
|
+
var import_react26 = require("react");
|
|
1809
1586
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1810
|
-
var
|
|
1811
|
-
|
|
1587
|
+
var CheckboxInput = (0, import_react26.forwardRef)(function CheckboxInput2({
|
|
1588
|
+
onChange,
|
|
1589
|
+
checked,
|
|
1590
|
+
invalid,
|
|
1812
1591
|
...props
|
|
1813
1592
|
}, ref) {
|
|
1814
|
-
const
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
"
|
|
1821
|
-
|
|
1822
|
-
}), [invalid, props]);
|
|
1823
|
-
const state = (0, import_react_stately2.useToggleState)(ariaCheckboxProps);
|
|
1824
|
-
const objectRef = (0, import_utils12.useObjectRef)(ref);
|
|
1825
|
-
const {
|
|
1826
|
-
inputProps
|
|
1827
|
-
} = (0, import_checkbox.useCheckbox)(ariaCheckboxProps, state, objectRef);
|
|
1828
|
-
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
1829
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
1830
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CheckboxRoot, { children: [
|
|
1831
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxInput, { type: "checkbox", ...inputProps, readOnly: props.readonly }),
|
|
1832
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
1833
|
-
] }),
|
|
1834
|
-
"children" in props && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(InputLabel, { children: props.children })
|
|
1593
|
+
const handleChange = (0, import_react26.useCallback)((e) => {
|
|
1594
|
+
const el = e.currentTarget;
|
|
1595
|
+
onChange?.(el.checked);
|
|
1596
|
+
}, [onChange]);
|
|
1597
|
+
const classNames = useClassNames("charcoal-checkbox-input__root", props.className);
|
|
1598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: classNames, children: [
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { ref, className: "charcoal-checkbox-input__input", type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, ...props }),
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "charcoal-checkbox-input__overlay", "aria-hidden": true, "data-checked": checked, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
1835
1601
|
] });
|
|
1836
1602
|
});
|
|
1837
|
-
var
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1603
|
+
var CheckboxInput_default = (0, import_react26.memo)(CheckboxInput);
|
|
1604
|
+
|
|
1605
|
+
// src/components/Checkbox/index.tsx
|
|
1606
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1607
|
+
var Checkbox = (0, import_react27.forwardRef)(function CheckboxInner({
|
|
1608
|
+
disabled,
|
|
1609
|
+
className,
|
|
1610
|
+
id,
|
|
1611
|
+
children,
|
|
1612
|
+
...props
|
|
1613
|
+
}, ref) {
|
|
1614
|
+
const classNames = useClassNames("charcoal-checkbox__label", className);
|
|
1615
|
+
const htmlId = (0, import_utils11.useId)(id);
|
|
1616
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CheckboxInput_default, { ...props, id: htmlId, disabled, ref });
|
|
1617
|
+
if (children === void 0) {
|
|
1618
|
+
return input;
|
|
1619
|
+
}
|
|
1620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { htmlFor: htmlId, "aria-disabled": disabled, className: classNames, children: [
|
|
1621
|
+
input,
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "charcoal-checkbox__text", children })
|
|
1623
|
+
] });
|
|
1624
|
+
});
|
|
1625
|
+
var Checkbox_default = (0, import_react27.memo)(Checkbox);
|
|
1856
1626
|
|
|
1857
1627
|
// src/components/TagItem/index.tsx
|
|
1858
|
-
var
|
|
1859
|
-
var
|
|
1860
|
-
var
|
|
1861
|
-
var
|
|
1628
|
+
var import_react28 = require("react");
|
|
1629
|
+
var import_utils12 = require("@react-aria/utils");
|
|
1630
|
+
var import_styled_components21 = __toESM(require("styled-components"));
|
|
1631
|
+
var import_utils13 = require("@charcoal-ui/utils");
|
|
1862
1632
|
var import_button = require("@react-aria/button");
|
|
1863
|
-
var
|
|
1864
|
-
var
|
|
1633
|
+
var import_styled8 = require("@charcoal-ui/styled");
|
|
1634
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1865
1635
|
var sizeMap = {
|
|
1866
1636
|
S: 32,
|
|
1867
1637
|
M: 40
|
|
1868
1638
|
};
|
|
1869
|
-
var TagItem = (0,
|
|
1639
|
+
var TagItem = (0, import_react28.forwardRef)(function TagItemInner({
|
|
1870
1640
|
label,
|
|
1871
1641
|
translatedLabel,
|
|
1872
1642
|
bgColor = "#7ACCB1",
|
|
@@ -1877,8 +1647,8 @@ var TagItem = (0, import_react30.forwardRef)(function TagItemInner({
|
|
|
1877
1647
|
className,
|
|
1878
1648
|
...props
|
|
1879
1649
|
}, _ref) {
|
|
1880
|
-
const ref = (0,
|
|
1881
|
-
const ariaButtonProps = (0,
|
|
1650
|
+
const ref = (0, import_utils12.useObjectRef)(_ref);
|
|
1651
|
+
const ariaButtonProps = (0, import_react28.useMemo)(() => ({
|
|
1882
1652
|
elementType: "a",
|
|
1883
1653
|
isDisabled: disabled,
|
|
1884
1654
|
...props
|
|
@@ -1887,22 +1657,22 @@ var TagItem = (0, import_react30.forwardRef)(function TagItemInner({
|
|
|
1887
1657
|
buttonProps
|
|
1888
1658
|
} = (0, import_button.useButton)(ariaButtonProps, ref);
|
|
1889
1659
|
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
1890
|
-
return /* @__PURE__ */ (0,
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
1893
|
-
/* @__PURE__ */ (0,
|
|
1894
|
-
hasTranslatedLabel && /* @__PURE__ */ (0,
|
|
1895
|
-
/* @__PURE__ */ (0,
|
|
1660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(TagItemRoot, { ref, size: hasTranslatedLabel ? "M" : size, status, ...buttonProps, className, children: [
|
|
1661
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Background, { bgColor, bgImage, status }),
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Inner, { children: [
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
|
|
1664
|
+
hasTranslatedLabel && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslatedLabel, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Label3, { children: translatedLabel }) }),
|
|
1665
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Label3, { children: label })
|
|
1896
1666
|
] }),
|
|
1897
|
-
status === "active" && /* @__PURE__ */ (0,
|
|
1667
|
+
status === "active" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon_default, { name: "16/Remove" })
|
|
1898
1668
|
] })
|
|
1899
1669
|
] });
|
|
1900
1670
|
});
|
|
1901
|
-
var TagItem_default = (0,
|
|
1671
|
+
var TagItem_default = (0, import_react28.memo)(TagItem);
|
|
1902
1672
|
var horizontalPadding = ({
|
|
1903
1673
|
left,
|
|
1904
1674
|
right
|
|
1905
|
-
}) => (0,
|
|
1675
|
+
}) => (0, import_styled_components21.css)(["padding-right:", ";padding-left:", ";"], (0, import_utils13.px)(right), (0, import_utils13.px)(left));
|
|
1906
1676
|
var tagItemRootSize = (size) => {
|
|
1907
1677
|
switch (size) {
|
|
1908
1678
|
case "M":
|
|
@@ -1921,7 +1691,7 @@ var activeTagItemRoot = horizontalPadding({
|
|
|
1921
1691
|
left: 16,
|
|
1922
1692
|
right: 8
|
|
1923
1693
|
});
|
|
1924
|
-
var TagItemRoot =
|
|
1694
|
+
var TagItemRoot = import_styled_components21.default.a.withConfig({
|
|
1925
1695
|
componentId: "ccl__sc-11j9pu2-0"
|
|
1926
1696
|
})(["isolation:isolate;position:relative;height:", "px;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;cursor:pointer;overflow:hidden;border-radius:4px;", " ", " color:", ";transition:0.2s box-shadow;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", "}&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"], ({
|
|
1927
1697
|
size
|
|
@@ -1932,30 +1702,30 @@ var TagItemRoot = import_styled_components22.default.a.withConfig({
|
|
|
1932
1702
|
status
|
|
1933
1703
|
}) => status === "active" && activeTagItemRoot, ({
|
|
1934
1704
|
status
|
|
1935
|
-
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)",
|
|
1936
|
-
var Background =
|
|
1705
|
+
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", import_styled8.focusVisibleFocusRingCss);
|
|
1706
|
+
var Background = import_styled_components21.default.div.withConfig({
|
|
1937
1707
|
componentId: "ccl__sc-11j9pu2-1"
|
|
1938
1708
|
})(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background-color:", ";", " ", ""], ({
|
|
1939
1709
|
bgColor
|
|
1940
1710
|
}) => bgColor, ({
|
|
1941
1711
|
status
|
|
1942
|
-
}) => status === "inactive" && (0,
|
|
1712
|
+
}) => status === "inactive" && (0, import_styled_components21.css)(["background-color:var(--charcoal-surface3);"]), ({
|
|
1943
1713
|
bgImage
|
|
1944
|
-
}) => bgImage !== void 0 && (0,
|
|
1945
|
-
var Inner =
|
|
1714
|
+
}) => bgImage !== void 0 && (0, import_styled_components21.css)(["background-color:var(--charcoal-surface4);&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-size:cover;background-image:url(", ");mix-blend-mode:overlay;}"], bgImage));
|
|
1715
|
+
var Inner = import_styled_components21.default.div.withConfig({
|
|
1946
1716
|
componentId: "ccl__sc-11j9pu2-2"
|
|
1947
1717
|
})(["display:inline-flex;gap:8px;align-items:center;z-index:2;"]);
|
|
1948
|
-
var labelCSS = (0,
|
|
1949
|
-
var translateLabelCSS = (0,
|
|
1950
|
-
var LabelWrapper =
|
|
1718
|
+
var labelCSS = (0, import_styled_components21.css)(["font-size:14px;line-height:22px;font-weight:bold;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
1719
|
+
var translateLabelCSS = (0, import_styled_components21.css)(["display:flex;align-items:center;flex-direction:column;font-size:10px;"]);
|
|
1720
|
+
var LabelWrapper = import_styled_components21.default.div.withConfig({
|
|
1951
1721
|
componentId: "ccl__sc-11j9pu2-3"
|
|
1952
1722
|
})(["", ""], ({
|
|
1953
1723
|
isTranslate
|
|
1954
1724
|
}) => isTranslate ?? false ? translateLabelCSS : labelCSS);
|
|
1955
|
-
var Label3 =
|
|
1725
|
+
var Label3 = import_styled_components21.default.span.withConfig({
|
|
1956
1726
|
componentId: "ccl__sc-11j9pu2-4"
|
|
1957
1727
|
})(["max-width:152px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;color:inherit;line-height:inherit;"]);
|
|
1958
|
-
var TranslatedLabel =
|
|
1728
|
+
var TranslatedLabel = import_styled_components21.default.div.withConfig({
|
|
1959
1729
|
componentId: "ccl__sc-11j9pu2-5"
|
|
1960
1730
|
})(["font-size:12px;line-height:20px;font-weight:bold;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
1961
1731
|
// Annotate the CommonJS export names for ESM import in node:
|