@charcoal-ui/react 4.0.0-beta.3 → 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/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/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 +177 -414
- 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 +152 -389
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -17
- 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/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/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 -22
- package/dist/components/Button/index.story.d.ts.map +0 -1
- package/dist/components/Button/index.test.d.ts +0 -2
- package/dist/components/Button/index.test.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.esm.js
CHANGED
|
@@ -280,7 +280,7 @@ function RadioGroup({
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
// src/components/MultiSelect/index.tsx
|
|
283
|
-
import { useCallback as useCallback2, useContext as useContext3, forwardRef as
|
|
283
|
+
import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef7, memo as memo2 } from "react";
|
|
284
284
|
import styled4, { css as css2 } from "styled-components";
|
|
285
285
|
import warning2 from "warning";
|
|
286
286
|
import { px } from "@charcoal-ui/utils";
|
|
@@ -300,8 +300,25 @@ var MultiSelectGroupContext = createContext3({
|
|
|
300
300
|
|
|
301
301
|
// src/components/MultiSelect/index.tsx
|
|
302
302
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss3 } from "@charcoal-ui/styled";
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
|
|
304
|
+
// src/components/Icon/index.tsx
|
|
305
|
+
import * as React5 from "react";
|
|
306
|
+
import "@charcoal-ui/icons";
|
|
307
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
308
|
+
var Icon = React5.forwardRef(function IconInner({
|
|
309
|
+
name,
|
|
310
|
+
scale,
|
|
311
|
+
unsafeNonGuidelineScale,
|
|
312
|
+
className,
|
|
313
|
+
...rest
|
|
314
|
+
}, ref) {
|
|
315
|
+
return /* @__PURE__ */ jsx7("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
316
|
+
});
|
|
317
|
+
var Icon_default = Icon;
|
|
318
|
+
|
|
319
|
+
// src/components/MultiSelect/index.tsx
|
|
320
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
321
|
+
var MultiSelect = forwardRef7(function MultiSelectInner({
|
|
305
322
|
value,
|
|
306
323
|
disabled = false,
|
|
307
324
|
onChange,
|
|
@@ -338,13 +355,13 @@ var MultiSelect = forwardRef6(function MultiSelectInner({
|
|
|
338
355
|
});
|
|
339
356
|
}, [onChange, parentOnChange, value]);
|
|
340
357
|
return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
|
|
341
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ jsx8(MultiSelectInput, { ...{
|
|
342
359
|
name,
|
|
343
360
|
value,
|
|
344
361
|
invalid
|
|
345
362
|
}, checked: isSelected, disabled: isDisabled, onChange: handleChange, overlay: variant === "overlay", "aria-invalid": invalid, ref }),
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
Boolean(children) && /* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ jsx8(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ jsx8(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
|
|
364
|
+
Boolean(children) && /* @__PURE__ */ jsx8(MultiSelectLabel, { children })
|
|
348
365
|
] });
|
|
349
366
|
});
|
|
350
367
|
var MultiSelect_default = memo2(MultiSelect);
|
|
@@ -397,25 +414,25 @@ function MultiSelectGroup({
|
|
|
397
414
|
}
|
|
398
415
|
}
|
|
399
416
|
}, [onChange, selected]);
|
|
400
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ jsx8(MultiSelectGroupContext.Provider, { value: {
|
|
401
418
|
name,
|
|
402
419
|
selected: Array.from(new Set(selected)),
|
|
403
420
|
disabled,
|
|
404
421
|
readonly,
|
|
405
422
|
invalid,
|
|
406
423
|
onChange: handleChange
|
|
407
|
-
}, children: /* @__PURE__ */
|
|
424
|
+
}, children: /* @__PURE__ */ jsx8("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
|
|
408
425
|
}
|
|
409
426
|
|
|
410
427
|
// src/components/Switch/index.tsx
|
|
411
428
|
import { useSwitch } from "@react-aria/switch";
|
|
412
|
-
import { useMemo as useMemo3, memo as memo3, forwardRef as
|
|
429
|
+
import { useMemo as useMemo3, memo as memo3, forwardRef as forwardRef8 } from "react";
|
|
413
430
|
import { useToggleState } from "react-stately";
|
|
414
431
|
import styled5 from "styled-components";
|
|
415
432
|
import { useObjectRef } from "@react-aria/utils";
|
|
416
433
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss4 } from "@charcoal-ui/styled";
|
|
417
|
-
import { jsx as
|
|
418
|
-
var SwitchCheckbox =
|
|
434
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
435
|
+
var SwitchCheckbox = forwardRef8(function SwitchCheckboxInner(props, external) {
|
|
419
436
|
const {
|
|
420
437
|
disabled,
|
|
421
438
|
className
|
|
@@ -436,8 +453,8 @@ var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
|
|
|
436
453
|
}
|
|
437
454
|
} = useSwitch(ariaSwitchProps, state, ref);
|
|
438
455
|
return /* @__PURE__ */ jsxs4(Label, { className, "aria-disabled": disabled, children: [
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
"children" in props ? /* @__PURE__ */
|
|
456
|
+
/* @__PURE__ */ jsx9(SwitchInput, { ...rest, ref }),
|
|
457
|
+
"children" in props ? /* @__PURE__ */ jsx9(LabelInner, { children: props.children }) : void 0
|
|
441
458
|
] });
|
|
442
459
|
});
|
|
443
460
|
var Switch_default = memo3(SwitchCheckbox);
|
|
@@ -457,14 +474,14 @@ var SwitchInput = styled5.input.attrs({
|
|
|
457
474
|
import { useTextField } from "@react-aria/textfield";
|
|
458
475
|
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
459
476
|
import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState } from "react";
|
|
460
|
-
import * as
|
|
477
|
+
import * as React7 from "react";
|
|
461
478
|
import styled7, { css as css3 } from "styled-components";
|
|
462
479
|
|
|
463
480
|
// src/components/FieldLabel/index.tsx
|
|
464
|
-
import * as
|
|
481
|
+
import * as React6 from "react";
|
|
465
482
|
import styled6 from "styled-components";
|
|
466
|
-
import { jsx as
|
|
467
|
-
var FieldLabel =
|
|
483
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
484
|
+
var FieldLabel = React6.forwardRef(function FieldLabel2({
|
|
468
485
|
style,
|
|
469
486
|
className,
|
|
470
487
|
label,
|
|
@@ -474,9 +491,9 @@ var FieldLabel = React5.forwardRef(function FieldLabel2({
|
|
|
474
491
|
...labelProps
|
|
475
492
|
}, ref) {
|
|
476
493
|
return /* @__PURE__ */ jsxs5(FieldLabelWrapper, { style, className, children: [
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
-
required && /* @__PURE__ */
|
|
479
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ jsx10(Label2, { ref, ...labelProps, children: label }),
|
|
495
|
+
required && /* @__PURE__ */ jsx10(RequiredText, { children: requiredText }),
|
|
496
|
+
/* @__PURE__ */ jsx10(SubLabelClickable, { children: /* @__PURE__ */ jsx10("span", { children: subLabel }) })
|
|
480
497
|
] });
|
|
481
498
|
});
|
|
482
499
|
var FieldLabel_default = FieldLabel;
|
|
@@ -534,11 +551,11 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
534
551
|
|
|
535
552
|
// src/components/TextField/index.tsx
|
|
536
553
|
import { mergeProps } from "@react-aria/utils";
|
|
537
|
-
import { jsx as
|
|
538
|
-
var TextField =
|
|
554
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
555
|
+
var TextField = React7.forwardRef(function SingleLineTextFieldInner({
|
|
539
556
|
onChange,
|
|
540
557
|
...props
|
|
541
|
-
},
|
|
558
|
+
}, forwardRef19) {
|
|
542
559
|
const {
|
|
543
560
|
className,
|
|
544
561
|
showLabel = false,
|
|
@@ -549,6 +566,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
549
566
|
disabled = false,
|
|
550
567
|
required,
|
|
551
568
|
invalid = false,
|
|
569
|
+
readOnly = false,
|
|
552
570
|
assistiveText,
|
|
553
571
|
maxLength,
|
|
554
572
|
prefix = null,
|
|
@@ -583,6 +601,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
583
601
|
inputElementType: "input",
|
|
584
602
|
isDisabled: disabled,
|
|
585
603
|
isRequired: required,
|
|
604
|
+
isReadOnly: readOnly,
|
|
586
605
|
validationState: invalid ? "invalid" : "valid",
|
|
587
606
|
description: !invalid && assistiveText,
|
|
588
607
|
errorMessage: invalid && assistiveText,
|
|
@@ -593,16 +612,16 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
593
612
|
useFocusWithClick(containerRef, ariaRef);
|
|
594
613
|
const inputProps = mergeProps(restProps, ariaInputProps);
|
|
595
614
|
return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
596
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ jsx11(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
597
616
|
/* @__PURE__ */ jsxs6(StyledInputContainer, { ref: containerRef, invalid, "aria-disabled": disabled === true ? true : void 0, hasPrefix: prefix != null, hasSuffix: suffix != null || showCount, children: [
|
|
598
|
-
prefix && /* @__PURE__ */
|
|
599
|
-
/* @__PURE__ */
|
|
617
|
+
prefix && /* @__PURE__ */ jsx11(PrefixContainer, { children: prefix }),
|
|
618
|
+
/* @__PURE__ */ jsx11(StyledInput, { ref: mergeRefs(forwardRef19, ariaRef), invalid, ...inputProps }),
|
|
600
619
|
(suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
|
|
601
620
|
suffix,
|
|
602
|
-
showCount && /* @__PURE__ */
|
|
621
|
+
showCount && /* @__PURE__ */ jsx11(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
603
622
|
] })
|
|
604
623
|
] }),
|
|
605
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */
|
|
624
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
606
625
|
] });
|
|
607
626
|
});
|
|
608
627
|
var TextField_default = TextField;
|
|
@@ -636,14 +655,14 @@ var AssistiveText = styled7.p.withConfig({
|
|
|
636
655
|
// src/components/TextArea/index.tsx
|
|
637
656
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
638
657
|
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
639
|
-
import { forwardRef as
|
|
658
|
+
import { forwardRef as forwardRef11, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
640
659
|
import styled8, { css as css4 } from "styled-components";
|
|
641
660
|
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
642
|
-
import { jsx as
|
|
643
|
-
var TextArea =
|
|
661
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
662
|
+
var TextArea = forwardRef11(function TextAreaInner({
|
|
644
663
|
onChange,
|
|
645
664
|
...props
|
|
646
|
-
},
|
|
665
|
+
}, forwardRef19) {
|
|
647
666
|
const {
|
|
648
667
|
className,
|
|
649
668
|
showCount = false,
|
|
@@ -654,6 +673,7 @@ var TextArea = forwardRef10(function TextAreaInner({
|
|
|
654
673
|
disabled = false,
|
|
655
674
|
required,
|
|
656
675
|
invalid = false,
|
|
676
|
+
readOnly = false,
|
|
657
677
|
assistiveText,
|
|
658
678
|
maxLength,
|
|
659
679
|
autoHeight = false,
|
|
@@ -698,6 +718,7 @@ var TextArea = forwardRef10(function TextAreaInner({
|
|
|
698
718
|
inputElementType: "textarea",
|
|
699
719
|
isDisabled: disabled,
|
|
700
720
|
isRequired: required,
|
|
721
|
+
isReadOnly: readOnly,
|
|
701
722
|
validationState: invalid ? "invalid" : "valid",
|
|
702
723
|
description: !invalid && assistiveText,
|
|
703
724
|
errorMessage: invalid && assistiveText,
|
|
@@ -713,12 +734,12 @@ var TextArea = forwardRef10(function TextAreaInner({
|
|
|
713
734
|
useFocusWithClick(containerRef, ariaRef);
|
|
714
735
|
const inputProps = mergeProps2(restProps, ariaInputProps);
|
|
715
736
|
return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
716
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ jsx12(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
717
738
|
/* @__PURE__ */ jsxs7(StyledTextareaContainer, { ref: containerRef, invalid, rows: showCount ? rows + 1 : rows, "aria-disabled": disabled === true ? "true" : void 0, children: [
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
showCount && /* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ jsx12(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef19, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
|
|
740
|
+
showCount && /* @__PURE__ */ jsx12(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
720
741
|
] }),
|
|
721
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */
|
|
742
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx12(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
722
743
|
] });
|
|
723
744
|
});
|
|
724
745
|
var TextArea_default = TextArea;
|
|
@@ -742,21 +763,6 @@ var MultiLineCounter = styled8.span.withConfig({
|
|
|
742
763
|
componentId: "ccl__sc-58waht-3"
|
|
743
764
|
})(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
744
765
|
|
|
745
|
-
// src/components/Icon/index.tsx
|
|
746
|
-
import * as React7 from "react";
|
|
747
|
-
import "@charcoal-ui/icons";
|
|
748
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
749
|
-
var Icon = React7.forwardRef(function IconInner({
|
|
750
|
-
name,
|
|
751
|
-
scale,
|
|
752
|
-
unsafeNonGuidelineScale,
|
|
753
|
-
className,
|
|
754
|
-
...rest
|
|
755
|
-
}, ref) {
|
|
756
|
-
return /* @__PURE__ */ jsx12("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
757
|
-
});
|
|
758
|
-
var Icon_default = Icon;
|
|
759
|
-
|
|
760
766
|
// src/components/Modal/index.tsx
|
|
761
767
|
import { useContext as useContext4, forwardRef as forwardRef13, memo as memo4 } from "react";
|
|
762
768
|
import * as React11 from "react";
|
|
@@ -771,15 +777,7 @@ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
|
771
777
|
import { forwardRef as forwardRef12 } from "react";
|
|
772
778
|
import styled9, { css as css5 } from "styled-components";
|
|
773
779
|
import { useDialog } from "@react-aria/dialog";
|
|
774
|
-
|
|
775
|
-
// ../foundation/src/grid.ts
|
|
776
|
-
var COLUMN_UNIT = 80;
|
|
777
|
-
var GUTTER_UNIT = 24;
|
|
778
|
-
function columnSystem(span, column, gutter) {
|
|
779
|
-
return span * column + (span - 1) * gutter;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
// src/components/Modal/Dialog/index.tsx
|
|
780
|
+
import { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from "@charcoal-ui/foundation";
|
|
783
781
|
import { maxWidth } from "@charcoal-ui/utils";
|
|
784
782
|
import { animated } from "react-spring";
|
|
785
783
|
|
|
@@ -801,8 +799,8 @@ function useForwardedRef(ref) {
|
|
|
801
799
|
|
|
802
800
|
// src/components/Modal/Dialog/index.tsx
|
|
803
801
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
804
|
-
var Dialog = forwardRef12(function Dialog2(props,
|
|
805
|
-
const ref = useForwardedRef(
|
|
802
|
+
var Dialog = forwardRef12(function Dialog2(props, forwardRef19) {
|
|
803
|
+
const ref = useForwardedRef(forwardRef19);
|
|
806
804
|
const {
|
|
807
805
|
dialogProps
|
|
808
806
|
} = useDialog({
|
|
@@ -837,7 +835,26 @@ var ModalBackgroundContext = React9.createContext(null);
|
|
|
837
835
|
|
|
838
836
|
// src/components/Modal/useCustomModalOverlay.tsx
|
|
839
837
|
import * as React10 from "react";
|
|
840
|
-
import { ariaHideOutside, useOverlay, useOverlayFocusContain
|
|
838
|
+
import { ariaHideOutside, useOverlay, useOverlayFocusContain } from "@react-aria/overlays";
|
|
839
|
+
|
|
840
|
+
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
841
|
+
import { useEffect as useEffect5 } from "react";
|
|
842
|
+
function usePreventScroll(element, isOpen) {
|
|
843
|
+
useEffect5(() => {
|
|
844
|
+
if (isOpen && element) {
|
|
845
|
+
const defaultPaddingRight = element.style.paddingRight;
|
|
846
|
+
const defaultOverflow = element.style.overflow;
|
|
847
|
+
element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
|
|
848
|
+
element.style.overflow = "hidden";
|
|
849
|
+
return () => {
|
|
850
|
+
element.style.paddingRight = defaultPaddingRight;
|
|
851
|
+
element.style.overflow = defaultOverflow;
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
}, [element, isOpen]);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// src/components/Modal/useCustomModalOverlay.tsx
|
|
841
858
|
function useCharcoalModalOverlay(props, state, ref) {
|
|
842
859
|
const {
|
|
843
860
|
overlayProps,
|
|
@@ -848,9 +865,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
848
865
|
onClose: state.onClose,
|
|
849
866
|
shouldCloseOnInteractOutside: () => false
|
|
850
867
|
}, ref);
|
|
851
|
-
usePreventScroll(
|
|
852
|
-
isDisabled: !state.isOpen
|
|
853
|
-
});
|
|
868
|
+
usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
|
|
854
869
|
useOverlayFocusContain();
|
|
855
870
|
React10.useEffect(() => {
|
|
856
871
|
if (state.isOpen && ref.current) {
|
|
@@ -1058,25 +1073,6 @@ import { useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
|
1058
1073
|
import { useContext as useContext6, useRef as useRef6 } from "react";
|
|
1059
1074
|
import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
|
|
1060
1075
|
import styled13 from "styled-components";
|
|
1061
|
-
|
|
1062
|
-
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1063
|
-
import { useEffect as useEffect6 } from "react";
|
|
1064
|
-
function usePreventScroll2(element, isOpen) {
|
|
1065
|
-
useEffect6(() => {
|
|
1066
|
-
if (isOpen && element) {
|
|
1067
|
-
const defaultPaddingRight = element.style.paddingRight;
|
|
1068
|
-
const defaultOverflow = element.style.overflow;
|
|
1069
|
-
element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
|
|
1070
|
-
element.style.overflow = "hidden";
|
|
1071
|
-
return () => {
|
|
1072
|
-
element.style.paddingRight = defaultPaddingRight;
|
|
1073
|
-
element.style.overflow = defaultOverflow;
|
|
1074
|
-
};
|
|
1075
|
-
}
|
|
1076
|
-
}, [element, isOpen]);
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
// src/components/DropdownSelector/Popover/index.tsx
|
|
1080
1076
|
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1081
1077
|
var _empty = () => null;
|
|
1082
1078
|
function Popover(props) {
|
|
@@ -1097,7 +1093,7 @@ function Popover(props) {
|
|
|
1097
1093
|
toggle: _empty
|
|
1098
1094
|
});
|
|
1099
1095
|
const modalBackground = useContext6(ModalBackgroundContext);
|
|
1100
|
-
|
|
1096
|
+
usePreventScroll(modalBackground, props.isOpen);
|
|
1101
1097
|
if (!props.isOpen)
|
|
1102
1098
|
return null;
|
|
1103
1099
|
return /* @__PURE__ */ jsxs9(Overlay2, { portalContainer: document.body, children: [
|
|
@@ -1441,232 +1437,7 @@ var StyledLi2 = styled18.li.withConfig({
|
|
|
1441
1437
|
|
|
1442
1438
|
// src/components/SegmentedControl/index.tsx
|
|
1443
1439
|
import { forwardRef as forwardRef15, memo as memo6, useMemo as useMemo6, useRef as useRef10 } from "react";
|
|
1444
|
-
|
|
1445
|
-
// ../../node_modules/@react-stately/form/dist/import.mjs
|
|
1446
|
-
import { createContext as $jcIOw$createContext, useMemo as $jcIOw$useMemo, useContext as $jcIOw$useContext, useState as $jcIOw$useState, useRef as $jcIOw$useRef, useEffect as $jcIOw$useEffect } from "react";
|
|
1447
|
-
var $e5be200c675c3b3a$export$aca958c65c314e6c = {
|
|
1448
|
-
badInput: false,
|
|
1449
|
-
customError: false,
|
|
1450
|
-
patternMismatch: false,
|
|
1451
|
-
rangeOverflow: false,
|
|
1452
|
-
rangeUnderflow: false,
|
|
1453
|
-
stepMismatch: false,
|
|
1454
|
-
tooLong: false,
|
|
1455
|
-
tooShort: false,
|
|
1456
|
-
typeMismatch: false,
|
|
1457
|
-
valueMissing: false,
|
|
1458
|
-
valid: true
|
|
1459
|
-
};
|
|
1460
|
-
var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
|
|
1461
|
-
...$e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
1462
|
-
customError: true,
|
|
1463
|
-
valid: false
|
|
1464
|
-
};
|
|
1465
|
-
var $e5be200c675c3b3a$export$dad6ae84456c676a = {
|
|
1466
|
-
isInvalid: false,
|
|
1467
|
-
validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
1468
|
-
validationErrors: []
|
|
1469
|
-
};
|
|
1470
|
-
var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, $jcIOw$createContext)({});
|
|
1471
|
-
var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
|
|
1472
|
-
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
|
|
1473
|
-
if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
|
|
1474
|
-
let {
|
|
1475
|
-
realtimeValidation,
|
|
1476
|
-
displayValidation,
|
|
1477
|
-
updateValidation,
|
|
1478
|
-
resetValidation,
|
|
1479
|
-
commitValidation
|
|
1480
|
-
} = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
|
|
1481
|
-
return {
|
|
1482
|
-
realtimeValidation,
|
|
1483
|
-
displayValidation,
|
|
1484
|
-
updateValidation,
|
|
1485
|
-
resetValidation,
|
|
1486
|
-
commitValidation
|
|
1487
|
-
};
|
|
1488
|
-
}
|
|
1489
|
-
return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
|
|
1490
|
-
}
|
|
1491
|
-
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
1492
|
-
let {
|
|
1493
|
-
isInvalid,
|
|
1494
|
-
validationState,
|
|
1495
|
-
name,
|
|
1496
|
-
value,
|
|
1497
|
-
builtinValidation,
|
|
1498
|
-
validate,
|
|
1499
|
-
validationBehavior = "aria"
|
|
1500
|
-
} = props;
|
|
1501
|
-
if (validationState)
|
|
1502
|
-
isInvalid || (isInvalid = validationState === "invalid");
|
|
1503
|
-
let controlledError = isInvalid ? {
|
|
1504
|
-
isInvalid: true,
|
|
1505
|
-
validationErrors: [],
|
|
1506
|
-
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
1507
|
-
} : null;
|
|
1508
|
-
let clientError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [validate, value]);
|
|
1509
|
-
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
|
|
1510
|
-
builtinValidation = null;
|
|
1511
|
-
let serverErrors = (0, $jcIOw$useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
|
|
1512
|
-
let serverErrorMessages = (0, $jcIOw$useMemo)(() => {
|
|
1513
|
-
if (name)
|
|
1514
|
-
return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
|
|
1515
|
-
return [];
|
|
1516
|
-
}, [serverErrors, name]);
|
|
1517
|
-
let [lastServerErrors, setLastServerErrors] = (0, $jcIOw$useState)(serverErrors);
|
|
1518
|
-
let [isServerErrorCleared, setServerErrorCleared] = (0, $jcIOw$useState)(false);
|
|
1519
|
-
if (serverErrors !== lastServerErrors) {
|
|
1520
|
-
setLastServerErrors(serverErrors);
|
|
1521
|
-
setServerErrorCleared(false);
|
|
1522
|
-
}
|
|
1523
|
-
let serverError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [isServerErrorCleared, serverErrorMessages]);
|
|
1524
|
-
let nextValidation = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1525
|
-
let [currentValidity, setCurrentValidity] = (0, $jcIOw$useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1526
|
-
let lastError = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1527
|
-
let commitValidation = () => {
|
|
1528
|
-
if (!commitQueued)
|
|
1529
|
-
return;
|
|
1530
|
-
setCommitQueued(false);
|
|
1531
|
-
let error = clientError || builtinValidation || nextValidation.current;
|
|
1532
|
-
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
1533
|
-
lastError.current = error;
|
|
1534
|
-
setCurrentValidity(error);
|
|
1535
|
-
}
|
|
1536
|
-
};
|
|
1537
|
-
let [commitQueued, setCommitQueued] = (0, $jcIOw$useState)(false);
|
|
1538
|
-
(0, $jcIOw$useEffect)(commitValidation);
|
|
1539
|
-
let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
1540
|
-
let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
|
|
1541
|
-
return {
|
|
1542
|
-
realtimeValidation,
|
|
1543
|
-
displayValidation,
|
|
1544
|
-
updateValidation(value2) {
|
|
1545
|
-
if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
|
|
1546
|
-
setCurrentValidity(value2);
|
|
1547
|
-
else
|
|
1548
|
-
nextValidation.current = value2;
|
|
1549
|
-
},
|
|
1550
|
-
resetValidation() {
|
|
1551
|
-
let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
1552
|
-
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
1553
|
-
lastError.current = error;
|
|
1554
|
-
setCurrentValidity(error);
|
|
1555
|
-
}
|
|
1556
|
-
if (validationBehavior === "native")
|
|
1557
|
-
setCommitQueued(false);
|
|
1558
|
-
setServerErrorCleared(true);
|
|
1559
|
-
},
|
|
1560
|
-
commitValidation() {
|
|
1561
|
-
if (validationBehavior === "native")
|
|
1562
|
-
setCommitQueued(true);
|
|
1563
|
-
setServerErrorCleared(true);
|
|
1564
|
-
}
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
function $e5be200c675c3b3a$var$asArray(v) {
|
|
1568
|
-
if (!v)
|
|
1569
|
-
return [];
|
|
1570
|
-
return Array.isArray(v) ? v : [v];
|
|
1571
|
-
}
|
|
1572
|
-
function $e5be200c675c3b3a$var$runValidate(validate, value) {
|
|
1573
|
-
if (typeof validate === "function") {
|
|
1574
|
-
let e = validate(value);
|
|
1575
|
-
if (e && typeof e !== "boolean")
|
|
1576
|
-
return $e5be200c675c3b3a$var$asArray(e);
|
|
1577
|
-
}
|
|
1578
|
-
return [];
|
|
1579
|
-
}
|
|
1580
|
-
function $e5be200c675c3b3a$var$getValidationResult(errors) {
|
|
1581
|
-
return errors.length ? {
|
|
1582
|
-
isInvalid: true,
|
|
1583
|
-
validationErrors: errors,
|
|
1584
|
-
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
1585
|
-
} : null;
|
|
1586
|
-
}
|
|
1587
|
-
function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
|
|
1588
|
-
if (a === b)
|
|
1589
|
-
return true;
|
|
1590
|
-
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);
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
// ../../node_modules/@react-stately/utils/dist/import.mjs
|
|
1594
|
-
import { useState as $6imuh$useState, useRef as $6imuh$useRef, useEffect as $6imuh$useEffect, useCallback as $6imuh$useCallback } from "react";
|
|
1595
|
-
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
|
1596
|
-
let [stateValue, setStateValue] = (0, $6imuh$useState)(value || defaultValue);
|
|
1597
|
-
let isControlledRef = (0, $6imuh$useRef)(value !== void 0);
|
|
1598
|
-
let isControlled = value !== void 0;
|
|
1599
|
-
(0, $6imuh$useEffect)(() => {
|
|
1600
|
-
let wasControlled = isControlledRef.current;
|
|
1601
|
-
if (wasControlled !== isControlled)
|
|
1602
|
-
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
|
1603
|
-
isControlledRef.current = isControlled;
|
|
1604
|
-
}, [isControlled]);
|
|
1605
|
-
let currentValue = isControlled ? value : stateValue;
|
|
1606
|
-
let setValue = (0, $6imuh$useCallback)((value2, ...args) => {
|
|
1607
|
-
let onChangeCaller = (value3, ...onChangeArgs) => {
|
|
1608
|
-
if (onChange) {
|
|
1609
|
-
if (!Object.is(currentValue, value3))
|
|
1610
|
-
onChange(value3, ...onChangeArgs);
|
|
1611
|
-
}
|
|
1612
|
-
if (!isControlled)
|
|
1613
|
-
currentValue = value3;
|
|
1614
|
-
};
|
|
1615
|
-
if (typeof value2 === "function") {
|
|
1616
|
-
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
|
1617
|
-
let updateFunction = (oldValue, ...functionArgs) => {
|
|
1618
|
-
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
1619
|
-
onChangeCaller(interceptedValue, ...args);
|
|
1620
|
-
if (!isControlled)
|
|
1621
|
-
return interceptedValue;
|
|
1622
|
-
return oldValue;
|
|
1623
|
-
};
|
|
1624
|
-
setStateValue(updateFunction);
|
|
1625
|
-
} else {
|
|
1626
|
-
if (!isControlled)
|
|
1627
|
-
setStateValue(value2);
|
|
1628
|
-
onChangeCaller(value2, ...args);
|
|
1629
|
-
}
|
|
1630
|
-
}, [isControlled, currentValue, onChange]);
|
|
1631
|
-
return [currentValue, setValue];
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
// ../../node_modules/@react-stately/radio/dist/import.mjs
|
|
1635
|
-
import { useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState } from "react";
|
|
1636
|
-
var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
|
|
1637
|
-
var $a54cdc5c1942b639$var$i = 0;
|
|
1638
|
-
function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
|
|
1639
|
-
let name = (0, $fQ2SF$useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [props.name]);
|
|
1640
|
-
var _props_defaultValue;
|
|
1641
|
-
let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
|
|
1642
|
-
let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
|
|
1643
|
-
let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
|
|
1644
|
-
...props,
|
|
1645
|
-
value: selectedValue
|
|
1646
|
-
});
|
|
1647
|
-
let setSelectedValue = (value) => {
|
|
1648
|
-
if (!props.isReadOnly && !props.isDisabled) {
|
|
1649
|
-
setSelected(value);
|
|
1650
|
-
validation.commitValidation();
|
|
1651
|
-
}
|
|
1652
|
-
};
|
|
1653
|
-
let isInvalid = validation.displayValidation.isInvalid;
|
|
1654
|
-
return {
|
|
1655
|
-
...validation,
|
|
1656
|
-
name,
|
|
1657
|
-
selectedValue,
|
|
1658
|
-
setSelectedValue,
|
|
1659
|
-
lastFocusedValue,
|
|
1660
|
-
setLastFocusedValue,
|
|
1661
|
-
isDisabled: props.isDisabled || false,
|
|
1662
|
-
isReadOnly: props.isReadOnly || false,
|
|
1663
|
-
isRequired: props.isRequired || false,
|
|
1664
|
-
validationState: props.validationState || (isInvalid ? "invalid" : null),
|
|
1665
|
-
isInvalid
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
// src/components/SegmentedControl/index.tsx
|
|
1440
|
+
import { useRadioGroupState } from "@react-stately/radio";
|
|
1670
1441
|
import { useRadio, useRadioGroup } from "@react-aria/radio";
|
|
1671
1442
|
import styled19, { css as css9 } from "styled-components";
|
|
1672
1443
|
|
|
@@ -1697,7 +1468,7 @@ var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
|
|
|
1697
1468
|
isRequired: props.required,
|
|
1698
1469
|
"aria-label": props.name
|
|
1699
1470
|
}), [props]);
|
|
1700
|
-
const state =
|
|
1471
|
+
const state = useRadioGroupState(ariaRadioGroupProps);
|
|
1701
1472
|
const {
|
|
1702
1473
|
radioGroupProps
|
|
1703
1474
|
} = useRadioGroup(ariaRadioGroupProps, state);
|
|
@@ -1747,73 +1518,65 @@ var SegmentedLabelInner = styled19.div.withConfig({
|
|
|
1747
1518
|
})(["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;}"]);
|
|
1748
1519
|
|
|
1749
1520
|
// src/components/Checkbox/index.tsx
|
|
1750
|
-
import { forwardRef as
|
|
1751
|
-
import
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
import {
|
|
1755
|
-
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
|
|
1521
|
+
import { forwardRef as forwardRef17, memo as memo8 } from "react";
|
|
1522
|
+
import { useId } from "@react-aria/utils";
|
|
1523
|
+
|
|
1524
|
+
// src/components/CheckboxInput/index.tsx
|
|
1525
|
+
import { forwardRef as forwardRef16, memo as memo7, useCallback as useCallback8 } from "react";
|
|
1756
1526
|
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1757
|
-
var
|
|
1758
|
-
|
|
1527
|
+
var CheckboxInput = forwardRef16(function CheckboxInput2({
|
|
1528
|
+
onChange,
|
|
1529
|
+
checked,
|
|
1530
|
+
invalid,
|
|
1759
1531
|
...props
|
|
1760
1532
|
}, ref) {
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
"
|
|
1768
|
-
|
|
1769
|
-
}), [invalid, props]);
|
|
1770
|
-
const state = useToggleState2(ariaCheckboxProps);
|
|
1771
|
-
const objectRef = useObjectRef3(ref);
|
|
1772
|
-
const {
|
|
1773
|
-
inputProps
|
|
1774
|
-
} = useCheckbox(ariaCheckboxProps, state, objectRef);
|
|
1775
|
-
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
1776
|
-
return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
1777
|
-
/* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
|
|
1778
|
-
/* @__PURE__ */ jsx27(CheckboxInput, { type: "checkbox", ...inputProps, readOnly: props.readonly }),
|
|
1779
|
-
/* @__PURE__ */ jsx27(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx27(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
1780
|
-
] }),
|
|
1781
|
-
"children" in props && /* @__PURE__ */ jsx27(InputLabel, { children: props.children })
|
|
1533
|
+
const handleChange = useCallback8((e) => {
|
|
1534
|
+
const el = e.currentTarget;
|
|
1535
|
+
onChange?.(el.checked);
|
|
1536
|
+
}, [onChange]);
|
|
1537
|
+
const classNames = useClassNames("charcoal-checkbox-input__root", props.className);
|
|
1538
|
+
return /* @__PURE__ */ jsxs14("div", { className: classNames, children: [
|
|
1539
|
+
/* @__PURE__ */ jsx27("input", { ref, className: "charcoal-checkbox-input__input", type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, ...props }),
|
|
1540
|
+
/* @__PURE__ */ jsx27("div", { className: "charcoal-checkbox-input__overlay", "aria-hidden": true, "data-checked": checked, children: /* @__PURE__ */ jsx27(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
1782
1541
|
] });
|
|
1783
1542
|
});
|
|
1784
|
-
var
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1543
|
+
var CheckboxInput_default = memo7(CheckboxInput);
|
|
1544
|
+
|
|
1545
|
+
// src/components/Checkbox/index.tsx
|
|
1546
|
+
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1547
|
+
var Checkbox = forwardRef17(function CheckboxInner({
|
|
1548
|
+
disabled,
|
|
1549
|
+
className,
|
|
1550
|
+
id,
|
|
1551
|
+
children,
|
|
1552
|
+
...props
|
|
1553
|
+
}, ref) {
|
|
1554
|
+
const classNames = useClassNames("charcoal-checkbox__label", className);
|
|
1555
|
+
const htmlId = useId(id);
|
|
1556
|
+
const input = /* @__PURE__ */ jsx28(CheckboxInput_default, { ...props, id: htmlId, disabled, ref });
|
|
1557
|
+
if (children === void 0) {
|
|
1558
|
+
return input;
|
|
1559
|
+
}
|
|
1560
|
+
return /* @__PURE__ */ jsxs15("label", { htmlFor: htmlId, "aria-disabled": disabled, className: classNames, children: [
|
|
1561
|
+
input,
|
|
1562
|
+
/* @__PURE__ */ jsx28("div", { className: "charcoal-checkbox__text", children })
|
|
1563
|
+
] });
|
|
1564
|
+
});
|
|
1565
|
+
var Checkbox_default = memo8(Checkbox);
|
|
1803
1566
|
|
|
1804
1567
|
// src/components/TagItem/index.tsx
|
|
1805
|
-
import { forwardRef as
|
|
1806
|
-
import { useObjectRef as
|
|
1807
|
-
import
|
|
1568
|
+
import { forwardRef as forwardRef18, memo as memo9, useMemo as useMemo7 } from "react";
|
|
1569
|
+
import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
1570
|
+
import styled20, { css as css10 } from "styled-components";
|
|
1808
1571
|
import { px as px2 } from "@charcoal-ui/utils";
|
|
1809
1572
|
import { useButton } from "@react-aria/button";
|
|
1810
|
-
import { focusVisibleFocusRingCss as
|
|
1811
|
-
import { jsx as
|
|
1573
|
+
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
|
|
1574
|
+
import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1812
1575
|
var sizeMap = {
|
|
1813
1576
|
S: 32,
|
|
1814
1577
|
M: 40
|
|
1815
1578
|
};
|
|
1816
|
-
var TagItem =
|
|
1579
|
+
var TagItem = forwardRef18(function TagItemInner({
|
|
1817
1580
|
label,
|
|
1818
1581
|
translatedLabel,
|
|
1819
1582
|
bgColor = "#7ACCB1",
|
|
@@ -1824,8 +1587,8 @@ var TagItem = forwardRef17(function TagItemInner({
|
|
|
1824
1587
|
className,
|
|
1825
1588
|
...props
|
|
1826
1589
|
}, _ref) {
|
|
1827
|
-
const ref =
|
|
1828
|
-
const ariaButtonProps =
|
|
1590
|
+
const ref = useObjectRef3(_ref);
|
|
1591
|
+
const ariaButtonProps = useMemo7(() => ({
|
|
1829
1592
|
elementType: "a",
|
|
1830
1593
|
isDisabled: disabled,
|
|
1831
1594
|
...props
|
|
@@ -1834,22 +1597,22 @@ var TagItem = forwardRef17(function TagItemInner({
|
|
|
1834
1597
|
buttonProps
|
|
1835
1598
|
} = useButton(ariaButtonProps, ref);
|
|
1836
1599
|
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
1837
|
-
return /* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
hasTranslatedLabel && /* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1600
|
+
return /* @__PURE__ */ jsxs16(TagItemRoot, { ref, size: hasTranslatedLabel ? "M" : size, status, ...buttonProps, className, children: [
|
|
1601
|
+
/* @__PURE__ */ jsx29(Background, { bgColor, bgImage, status }),
|
|
1602
|
+
/* @__PURE__ */ jsxs16(Inner, { children: [
|
|
1603
|
+
/* @__PURE__ */ jsxs16(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
|
|
1604
|
+
hasTranslatedLabel && /* @__PURE__ */ jsx29(TranslatedLabel, { children: /* @__PURE__ */ jsx29(Label3, { children: translatedLabel }) }),
|
|
1605
|
+
/* @__PURE__ */ jsx29(Label3, { children: label })
|
|
1843
1606
|
] }),
|
|
1844
|
-
status === "active" && /* @__PURE__ */
|
|
1607
|
+
status === "active" && /* @__PURE__ */ jsx29(Icon_default, { name: "16/Remove" })
|
|
1845
1608
|
] })
|
|
1846
1609
|
] });
|
|
1847
1610
|
});
|
|
1848
|
-
var TagItem_default =
|
|
1611
|
+
var TagItem_default = memo9(TagItem);
|
|
1849
1612
|
var horizontalPadding = ({
|
|
1850
1613
|
left,
|
|
1851
1614
|
right
|
|
1852
|
-
}) =>
|
|
1615
|
+
}) => css10(["padding-right:", ";padding-left:", ";"], px2(right), px2(left));
|
|
1853
1616
|
var tagItemRootSize = (size) => {
|
|
1854
1617
|
switch (size) {
|
|
1855
1618
|
case "M":
|
|
@@ -1868,7 +1631,7 @@ var activeTagItemRoot = horizontalPadding({
|
|
|
1868
1631
|
left: 16,
|
|
1869
1632
|
right: 8
|
|
1870
1633
|
});
|
|
1871
|
-
var TagItemRoot =
|
|
1634
|
+
var TagItemRoot = styled20.a.withConfig({
|
|
1872
1635
|
componentId: "ccl__sc-11j9pu2-0"
|
|
1873
1636
|
})(["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;}"], ({
|
|
1874
1637
|
size
|
|
@@ -1879,30 +1642,30 @@ var TagItemRoot = styled21.a.withConfig({
|
|
|
1879
1642
|
status
|
|
1880
1643
|
}) => status === "active" && activeTagItemRoot, ({
|
|
1881
1644
|
status
|
|
1882
|
-
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)",
|
|
1883
|
-
var Background =
|
|
1645
|
+
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", focusVisibleFocusRingCss6);
|
|
1646
|
+
var Background = styled20.div.withConfig({
|
|
1884
1647
|
componentId: "ccl__sc-11j9pu2-1"
|
|
1885
1648
|
})(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background-color:", ";", " ", ""], ({
|
|
1886
1649
|
bgColor
|
|
1887
1650
|
}) => bgColor, ({
|
|
1888
1651
|
status
|
|
1889
|
-
}) => status === "inactive" &&
|
|
1652
|
+
}) => status === "inactive" && css10(["background-color:var(--charcoal-surface3);"]), ({
|
|
1890
1653
|
bgImage
|
|
1891
|
-
}) => bgImage !== void 0 &&
|
|
1892
|
-
var Inner =
|
|
1654
|
+
}) => bgImage !== void 0 && css10(["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));
|
|
1655
|
+
var Inner = styled20.div.withConfig({
|
|
1893
1656
|
componentId: "ccl__sc-11j9pu2-2"
|
|
1894
1657
|
})(["display:inline-flex;gap:8px;align-items:center;z-index:2;"]);
|
|
1895
|
-
var labelCSS =
|
|
1896
|
-
var translateLabelCSS =
|
|
1897
|
-
var LabelWrapper =
|
|
1658
|
+
var labelCSS = css10(["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;}"]);
|
|
1659
|
+
var translateLabelCSS = css10(["display:flex;align-items:center;flex-direction:column;font-size:10px;"]);
|
|
1660
|
+
var LabelWrapper = styled20.div.withConfig({
|
|
1898
1661
|
componentId: "ccl__sc-11j9pu2-3"
|
|
1899
1662
|
})(["", ""], ({
|
|
1900
1663
|
isTranslate
|
|
1901
1664
|
}) => isTranslate ?? false ? translateLabelCSS : labelCSS);
|
|
1902
|
-
var Label3 =
|
|
1665
|
+
var Label3 = styled20.span.withConfig({
|
|
1903
1666
|
componentId: "ccl__sc-11j9pu2-4"
|
|
1904
1667
|
})(["max-width:152px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;color:inherit;line-height:inherit;"]);
|
|
1905
|
-
var TranslatedLabel =
|
|
1668
|
+
var TranslatedLabel = styled20.div.withConfig({
|
|
1906
1669
|
componentId: "ccl__sc-11j9pu2-5"
|
|
1907
1670
|
})(["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;}"]);
|
|
1908
1671
|
export {
|