@charcoal-ui/react 4.3.0-beta.5 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/MultiSelect/context.d.ts +14 -0
- package/dist/components/MultiSelect/context.d.ts.map +1 -0
- package/dist/components/MultiSelect/index.d.ts +38 -0
- package/dist/components/MultiSelect/index.d.ts.map +1 -0
- package/dist/index.cjs.js +318 -216
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +111 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +281 -181
- package/dist/index.esm.js.map +1 -1
- package/dist/layered.css +111 -0
- package/dist/layered.css.map +1 -1
- package/package.json +6 -7
- package/src/components/Button/__snapshots__/index.story.storyshot +89 -71
- package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +50 -53
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +108 -102
- package/src/components/Clickable/__snapshots__/index.story.storyshot +19 -17
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +45 -54
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +238 -275
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +28 -50
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +780 -1158
- package/src/components/Icon/__snapshots__/index.story.storyshot +9 -7
- package/src/components/IconButton/__snapshots__/index.story.storyshot +43 -37
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +52 -64
- package/src/components/Modal/__snapshots__/index.story.storyshot +568 -716
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +531 -0
- package/src/components/MultiSelect/context.ts +23 -0
- package/src/components/MultiSelect/index.css +139 -0
- package/src/components/MultiSelect/index.story.tsx +118 -0
- package/src/components/MultiSelect/index.test.tsx +255 -0
- package/src/components/MultiSelect/index.tsx +153 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +313 -367
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +116 -228
- package/src/components/Switch/__snapshots__/index.story.storyshot +74 -73
- package/src/components/TagItem/__snapshots__/index.story.storyshot +177 -193
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +372 -533
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +444 -583
- package/src/index.ts +6 -0
package/dist/index.esm.js
CHANGED
|
@@ -352,31 +352,144 @@ var RadioGroup = forwardRef6(function RadioGroupInner({
|
|
|
352
352
|
return /* @__PURE__ */ jsx8(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx8("div", { role: "radiogroup", "aria-disabled": disabled, "aria-invalid": invalid, "aria-label": label, "aria-labelledby": props["aria-labelledby"], "aria-orientation": ariaOrientation, className: classNames, ref, children }) });
|
|
353
353
|
});
|
|
354
354
|
|
|
355
|
+
// src/components/MultiSelect/index.tsx
|
|
356
|
+
import { useCallback as useCallback3, useContext as useContext2, forwardRef as forwardRef8, memo as memo3 } from "react";
|
|
357
|
+
import warning2 from "warning";
|
|
358
|
+
|
|
359
|
+
// src/components/MultiSelect/context.ts
|
|
360
|
+
import { createContext as createContext2 } from "react";
|
|
361
|
+
var MultiSelectGroupContext = createContext2({
|
|
362
|
+
name: void 0,
|
|
363
|
+
selected: [],
|
|
364
|
+
disabled: false,
|
|
365
|
+
readonly: false,
|
|
366
|
+
invalid: false,
|
|
367
|
+
onChange() {
|
|
368
|
+
throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?");
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// src/components/Icon/index.tsx
|
|
373
|
+
import * as React5 from "react";
|
|
374
|
+
import "@charcoal-ui/icons";
|
|
375
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
376
|
+
var Icon = React5.forwardRef(function IconInner({
|
|
377
|
+
name,
|
|
378
|
+
scale,
|
|
379
|
+
unsafeNonGuidelineScale,
|
|
380
|
+
className,
|
|
381
|
+
...rest
|
|
382
|
+
}, ref) {
|
|
383
|
+
return /* @__PURE__ */ jsx9("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
384
|
+
});
|
|
385
|
+
var Icon_default = Icon;
|
|
386
|
+
|
|
387
|
+
// src/components/MultiSelect/index.tsx
|
|
388
|
+
import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
389
|
+
var MultiSelect = forwardRef8(function MultiSelectInner({
|
|
390
|
+
value,
|
|
391
|
+
disabled = false,
|
|
392
|
+
onChange,
|
|
393
|
+
variant = "default",
|
|
394
|
+
className,
|
|
395
|
+
children
|
|
396
|
+
}, ref) {
|
|
397
|
+
const {
|
|
398
|
+
name,
|
|
399
|
+
selected,
|
|
400
|
+
disabled: parentDisabled,
|
|
401
|
+
readonly,
|
|
402
|
+
invalid,
|
|
403
|
+
onChange: parentOnChange
|
|
404
|
+
} = useContext2(MultiSelectGroupContext);
|
|
405
|
+
warning2(
|
|
406
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
407
|
+
name !== void 0,
|
|
408
|
+
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
409
|
+
);
|
|
410
|
+
const isSelected = selected.includes(value);
|
|
411
|
+
const isDisabled = disabled || parentDisabled || readonly;
|
|
412
|
+
const handleChange = useCallback3((event) => {
|
|
413
|
+
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (onChange)
|
|
417
|
+
onChange({
|
|
418
|
+
value,
|
|
419
|
+
selected: event.currentTarget.checked
|
|
420
|
+
});
|
|
421
|
+
parentOnChange({
|
|
422
|
+
value,
|
|
423
|
+
selected: event.currentTarget.checked
|
|
424
|
+
});
|
|
425
|
+
}, [onChange, parentOnChange, value]);
|
|
426
|
+
const classNames = useClassNames("charcoal-multi-select", className);
|
|
427
|
+
return /* @__PURE__ */ jsxs2("label", { "aria-disabled": isDisabled, className: classNames, children: [
|
|
428
|
+
/* @__PURE__ */ jsx10("input", { className: "charcoal-multi-select-input", name, value, type: "checkbox", checked: isSelected, disabled: isDisabled, onChange: handleChange, "data-overlay": variant === "overlay", "aria-invalid": invalid, ref }),
|
|
429
|
+
/* @__PURE__ */ jsx10("div", { className: "charcoal-multi-select-overlay", "data-overlay": variant === "overlay", "aria-invalid": invalid, "aria-hidden": true, children: /* @__PURE__ */ jsx10(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
|
|
430
|
+
Boolean(children) && /* @__PURE__ */ jsx10("div", { className: "charcoal-multi-select-label", children })
|
|
431
|
+
] });
|
|
432
|
+
});
|
|
433
|
+
var MultiSelect_default = memo3(MultiSelect);
|
|
434
|
+
function MultiSelectGroup({
|
|
435
|
+
className,
|
|
436
|
+
style,
|
|
437
|
+
name,
|
|
438
|
+
label,
|
|
439
|
+
selected,
|
|
440
|
+
onChange,
|
|
441
|
+
disabled = false,
|
|
442
|
+
readonly = false,
|
|
443
|
+
invalid = false,
|
|
444
|
+
children
|
|
445
|
+
}) {
|
|
446
|
+
const handleChange = useCallback3((payload) => {
|
|
447
|
+
const index = selected.indexOf(payload.value);
|
|
448
|
+
if (payload.selected) {
|
|
449
|
+
if (index < 0) {
|
|
450
|
+
onChange([...selected, payload.value]);
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
if (index >= 0) {
|
|
454
|
+
onChange([...selected.slice(0, index), ...selected.slice(index + 1)]);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}, [onChange, selected]);
|
|
458
|
+
return /* @__PURE__ */ jsx10(MultiSelectGroupContext.Provider, { value: {
|
|
459
|
+
name,
|
|
460
|
+
selected: Array.from(new Set(selected)),
|
|
461
|
+
disabled,
|
|
462
|
+
readonly,
|
|
463
|
+
invalid,
|
|
464
|
+
onChange: handleChange
|
|
465
|
+
}, children: /* @__PURE__ */ jsx10("div", { className, style, "aria-label": label, "data-testid": "SelectGroup", children }) });
|
|
466
|
+
}
|
|
467
|
+
|
|
355
468
|
// src/components/Switch/index.tsx
|
|
356
|
-
import { memo as
|
|
469
|
+
import { memo as memo5, forwardRef as forwardRef10 } from "react";
|
|
357
470
|
import { useId } from "@react-aria/utils";
|
|
358
471
|
|
|
359
472
|
// src/components/Switch/SwitchInput/index.tsx
|
|
360
|
-
import { forwardRef as
|
|
361
|
-
import { jsx as
|
|
362
|
-
var SwitchInput =
|
|
473
|
+
import { forwardRef as forwardRef9, useCallback as useCallback4 } from "react";
|
|
474
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
475
|
+
var SwitchInput = forwardRef9(function SwitchInput2({
|
|
363
476
|
onChange,
|
|
364
477
|
className,
|
|
365
478
|
...props
|
|
366
479
|
}, ref) {
|
|
367
|
-
const handleChange =
|
|
480
|
+
const handleChange = useCallback4((e) => {
|
|
368
481
|
const el = e.currentTarget;
|
|
369
482
|
onChange?.(el.checked);
|
|
370
483
|
}, [onChange]);
|
|
371
484
|
const classNames = useClassNames("charcoal-switch-input", className);
|
|
372
|
-
return /* @__PURE__ */
|
|
485
|
+
return /* @__PURE__ */ jsx11("input", { ref, className: classNames, type: "checkbox", onChange: handleChange, ...props });
|
|
373
486
|
});
|
|
374
487
|
var SwitchInput_default = SwitchInput;
|
|
375
488
|
|
|
376
489
|
// src/components/Switch/SwitchWithLabel.tsx
|
|
377
|
-
import * as
|
|
378
|
-
import { jsx as
|
|
379
|
-
var SwitchWithLabel =
|
|
490
|
+
import * as React6 from "react";
|
|
491
|
+
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
492
|
+
var SwitchWithLabel = React6.memo(function SwitchWithLabel2({
|
|
380
493
|
children,
|
|
381
494
|
className,
|
|
382
495
|
disabled,
|
|
@@ -384,15 +497,15 @@ var SwitchWithLabel = React5.memo(function SwitchWithLabel2({
|
|
|
384
497
|
input
|
|
385
498
|
}) {
|
|
386
499
|
const classNames = useClassNames("charcoal-switch__label", className);
|
|
387
|
-
return /* @__PURE__ */
|
|
500
|
+
return /* @__PURE__ */ jsxs3("label", { htmlFor: id, className: classNames, "aria-disabled": disabled, children: [
|
|
388
501
|
input,
|
|
389
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ jsx12("div", { className: "charcoal-switch__label_div", children })
|
|
390
503
|
] });
|
|
391
504
|
});
|
|
392
505
|
|
|
393
506
|
// src/components/Switch/index.tsx
|
|
394
|
-
import { jsx as
|
|
395
|
-
var Switch =
|
|
507
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
508
|
+
var Switch = forwardRef10(function Switch2({
|
|
396
509
|
children,
|
|
397
510
|
onChange,
|
|
398
511
|
disabled,
|
|
@@ -402,23 +515,23 @@ var Switch = forwardRef8(function Switch2({
|
|
|
402
515
|
}, ref) {
|
|
403
516
|
const htmlId = useId(id);
|
|
404
517
|
const noChildren = children === void 0;
|
|
405
|
-
const input = /* @__PURE__ */
|
|
518
|
+
const input = /* @__PURE__ */ jsx13(SwitchInput_default, { ...props, disabled, className: noChildren ? className : void 0, id: htmlId, onChange, ref, role: "switch", type: "checkbox" });
|
|
406
519
|
if (noChildren) {
|
|
407
520
|
return input;
|
|
408
521
|
}
|
|
409
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ jsx13(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
|
|
410
523
|
});
|
|
411
|
-
var Switch_default =
|
|
524
|
+
var Switch_default = memo5(Switch);
|
|
412
525
|
|
|
413
526
|
// src/components/TextField/index.tsx
|
|
414
527
|
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
415
|
-
import { useCallback as
|
|
416
|
-
import * as
|
|
528
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useRef, useState as useState2 } from "react";
|
|
529
|
+
import * as React8 from "react";
|
|
417
530
|
|
|
418
531
|
// src/components/FieldLabel/index.tsx
|
|
419
|
-
import * as
|
|
420
|
-
import { jsx as
|
|
421
|
-
var FieldLabel =
|
|
532
|
+
import * as React7 from "react";
|
|
533
|
+
import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
534
|
+
var FieldLabel = React7.forwardRef(function FieldLabel2({
|
|
422
535
|
style,
|
|
423
536
|
className,
|
|
424
537
|
label,
|
|
@@ -428,10 +541,10 @@ var FieldLabel = React6.forwardRef(function FieldLabel2({
|
|
|
428
541
|
...labelProps
|
|
429
542
|
}, ref) {
|
|
430
543
|
const classNames = useClassNames("charcoal-field-label-root", className);
|
|
431
|
-
return /* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
required && /* @__PURE__ */
|
|
434
|
-
/* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ jsxs4("div", { style, className: classNames, children: [
|
|
545
|
+
/* @__PURE__ */ jsx14("label", { ref, className: "charcoal-field-label", ...labelProps, children: label }),
|
|
546
|
+
required && /* @__PURE__ */ jsx14("div", { className: "charcoal-field-label-required-text", children: requiredText }),
|
|
547
|
+
/* @__PURE__ */ jsx14("div", { className: "charcoal-field-label-sub-label", children: /* @__PURE__ */ jsx14("span", { children: subLabel }) })
|
|
435
548
|
] });
|
|
436
549
|
});
|
|
437
550
|
var FieldLabel_default = FieldLabel;
|
|
@@ -476,15 +589,15 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
476
589
|
import { mergeRefs as mergeRefs2, useId as useId2 } from "@react-aria/utils";
|
|
477
590
|
|
|
478
591
|
// src/_lib/createDivComponent.tsx
|
|
479
|
-
import { forwardRef as
|
|
480
|
-
import { jsx as
|
|
592
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
593
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
481
594
|
function createDivComponent(mainClassName) {
|
|
482
|
-
return
|
|
595
|
+
return forwardRef12(function DivComponent({
|
|
483
596
|
className,
|
|
484
597
|
...props
|
|
485
598
|
}, ref) {
|
|
486
599
|
const classNames = useClassNames(mainClassName, className);
|
|
487
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ jsx15("div", { className: classNames, ref, ...props });
|
|
488
601
|
});
|
|
489
602
|
}
|
|
490
603
|
|
|
@@ -492,8 +605,8 @@ function createDivComponent(mainClassName) {
|
|
|
492
605
|
var AssistiveText = createDivComponent("charcoal-text-field-assistive-text");
|
|
493
606
|
|
|
494
607
|
// src/components/TextField/index.tsx
|
|
495
|
-
import { jsx as
|
|
496
|
-
var TextField =
|
|
608
|
+
import { jsx as jsx16, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
609
|
+
var TextField = React8.forwardRef(function SingleLineTextFieldInner({
|
|
497
610
|
assistiveText,
|
|
498
611
|
className,
|
|
499
612
|
disabled = false,
|
|
@@ -512,13 +625,13 @@ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
|
|
|
512
625
|
value,
|
|
513
626
|
getCount = countCodePointsInString,
|
|
514
627
|
...props
|
|
515
|
-
},
|
|
628
|
+
}, forwardRef24) {
|
|
516
629
|
const inputRef = useRef(null);
|
|
517
630
|
const {
|
|
518
631
|
visuallyHiddenProps
|
|
519
632
|
} = useVisuallyHidden();
|
|
520
633
|
const [count, setCount] = useState2(getCount(value ?? ""));
|
|
521
|
-
const handleChange =
|
|
634
|
+
const handleChange = useCallback5((e) => {
|
|
522
635
|
const value2 = e.target.value;
|
|
523
636
|
const count2 = getCount(value2);
|
|
524
637
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -537,27 +650,27 @@ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
|
|
|
537
650
|
const labelledbyId = useId2();
|
|
538
651
|
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
539
652
|
const classNames = useClassNames("charcoal-text-field-root", className);
|
|
540
|
-
return /* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
prefix && /* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
(suffix || showCount) && /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ jsxs5("div", { className: classNames, "aria-disabled": disabled, children: [
|
|
654
|
+
/* @__PURE__ */ jsx16(FieldLabel_default, { htmlFor: inputId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
655
|
+
/* @__PURE__ */ jsxs5("div", { className: "charcoal-text-field-container", "aria-disabled": disabled === true ? true : void 0, "data-invalid": invalid === true, ref: containerRef, children: [
|
|
656
|
+
prefix && /* @__PURE__ */ jsx16("div", { className: "charcoal-text-field-prefix", children: prefix }),
|
|
657
|
+
/* @__PURE__ */ jsx16("input", { className: "charcoal-text-field-input", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: inputId, "data-invalid": invalid === true, maxLength, onChange: handleChange, disabled, ref: mergeRefs2(forwardRef24, inputRef), type, value, ...props }),
|
|
658
|
+
(suffix || showCount) && /* @__PURE__ */ jsxs5("div", { className: "charcoal-text-field-suffix", children: [
|
|
546
659
|
suffix,
|
|
547
|
-
showCount && /* @__PURE__ */
|
|
660
|
+
showCount && /* @__PURE__ */ jsx16("span", { className: "charcoal-text-field-line-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
548
661
|
] })
|
|
549
662
|
] }),
|
|
550
|
-
showAssistiveText && /* @__PURE__ */
|
|
663
|
+
showAssistiveText && /* @__PURE__ */ jsx16(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
|
|
551
664
|
] });
|
|
552
665
|
});
|
|
553
666
|
var TextField_default = TextField;
|
|
554
667
|
|
|
555
668
|
// src/components/TextArea/index.tsx
|
|
556
669
|
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
557
|
-
import { forwardRef as
|
|
670
|
+
import { forwardRef as forwardRef14, useCallback as useCallback6, useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
|
|
558
671
|
import { useId as useId3 } from "@react-aria/utils";
|
|
559
|
-
import { jsx as
|
|
560
|
-
var TextArea =
|
|
672
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
673
|
+
var TextArea = forwardRef14(function TextAreaInner({
|
|
561
674
|
onChange,
|
|
562
675
|
className,
|
|
563
676
|
value,
|
|
@@ -575,20 +688,20 @@ var TextArea = forwardRef12(function TextAreaInner({
|
|
|
575
688
|
invalid,
|
|
576
689
|
getCount = countCodePointsInString,
|
|
577
690
|
...props
|
|
578
|
-
},
|
|
691
|
+
}, forwardRef24) {
|
|
579
692
|
const {
|
|
580
693
|
visuallyHiddenProps
|
|
581
694
|
} = useVisuallyHidden2();
|
|
582
695
|
const textareaRef = useRef2(null);
|
|
583
696
|
const [count, setCount] = useState3(getCount(value ?? ""));
|
|
584
697
|
const [rows, setRows] = useState3(initialRows);
|
|
585
|
-
const syncHeight =
|
|
698
|
+
const syncHeight = useCallback6((textarea) => {
|
|
586
699
|
const rows2 = (`${textarea.value}
|
|
587
700
|
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
588
701
|
setRows(initialRows <= rows2 ? rows2 : initialRows);
|
|
589
702
|
}, [initialRows]);
|
|
590
703
|
const nonControlled = value === void 0;
|
|
591
|
-
const handleChange =
|
|
704
|
+
const handleChange = useCallback6((e) => {
|
|
592
705
|
const value2 = e.target.value;
|
|
593
706
|
const count2 = getCount(value2);
|
|
594
707
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -617,43 +730,28 @@ var TextArea = forwardRef12(function TextAreaInner({
|
|
|
617
730
|
const labelledbyId = useId3();
|
|
618
731
|
const classNames = useClassNames("charcoal-text-area-root", className);
|
|
619
732
|
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
620
|
-
return /* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
733
|
+
return /* @__PURE__ */ jsxs6("div", { className: classNames, "aria-disabled": disabled, children: [
|
|
734
|
+
/* @__PURE__ */ jsx17(FieldLabel_default, { htmlFor: textAreaId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
735
|
+
/* @__PURE__ */ jsxs6("div", { className: "charcoal-text-area-container", "aria-disabled": disabled === true ? "true" : void 0, "aria-invalid": invalid === true, ref: containerRef, style: {
|
|
623
736
|
"--charcoal-text-area-rows": `${showCount ? rows + 1 : rows}`
|
|
624
737
|
}, children: [
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
showCount && /* @__PURE__ */
|
|
738
|
+
/* @__PURE__ */ jsx17("textarea", { className: "charcoal-text-area-textarea", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: textAreaId, maxLength, "data-no-bottom-padding": showCount, onChange: handleChange, ref: mergeRefs(forwardRef24, textareaRef), rows, value, disabled, ...props }),
|
|
739
|
+
showCount && /* @__PURE__ */ jsx17("span", { className: "charcoal-text-area-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
627
740
|
] }),
|
|
628
|
-
showAssistiveText && /* @__PURE__ */
|
|
741
|
+
showAssistiveText && /* @__PURE__ */ jsx17(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
|
|
629
742
|
] });
|
|
630
743
|
});
|
|
631
744
|
var TextArea_default = TextArea;
|
|
632
745
|
|
|
633
|
-
// src/components/Icon/index.tsx
|
|
634
|
-
import * as React8 from "react";
|
|
635
|
-
import "@charcoal-ui/icons";
|
|
636
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
637
|
-
var Icon = React8.forwardRef(function IconInner({
|
|
638
|
-
name,
|
|
639
|
-
scale,
|
|
640
|
-
unsafeNonGuidelineScale,
|
|
641
|
-
className,
|
|
642
|
-
...rest
|
|
643
|
-
}, ref) {
|
|
644
|
-
return /* @__PURE__ */ jsx16("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
645
|
-
});
|
|
646
|
-
var Icon_default = Icon;
|
|
647
|
-
|
|
648
746
|
// src/components/Modal/index.tsx
|
|
649
|
-
import { useContext as
|
|
747
|
+
import { useContext as useContext3, forwardRef as forwardRef16, memo as memo6 } from "react";
|
|
650
748
|
import * as React12 from "react";
|
|
651
749
|
import { Overlay } from "@react-aria/overlays";
|
|
652
750
|
import { animated, useTransition, easings } from "react-spring";
|
|
653
751
|
import { useObjectRef } from "@react-aria/utils";
|
|
654
752
|
|
|
655
753
|
// src/components/Modal/Dialog/index.tsx
|
|
656
|
-
import { forwardRef as
|
|
754
|
+
import { forwardRef as forwardRef15 } from "react";
|
|
657
755
|
import { useDialog } from "@react-aria/dialog";
|
|
658
756
|
|
|
659
757
|
// src/_lib/useForwardedRef.tsx
|
|
@@ -673,21 +771,21 @@ function useForwardedRef(ref) {
|
|
|
673
771
|
}
|
|
674
772
|
|
|
675
773
|
// src/components/Modal/Dialog/index.tsx
|
|
676
|
-
import { jsx as
|
|
677
|
-
var Dialog =
|
|
774
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
775
|
+
var Dialog = forwardRef15(function Dialog2({
|
|
678
776
|
size,
|
|
679
777
|
bottomSheet,
|
|
680
778
|
className,
|
|
681
779
|
...props
|
|
682
|
-
},
|
|
683
|
-
const ref = useForwardedRef(
|
|
780
|
+
}, forwardRef24) {
|
|
781
|
+
const ref = useForwardedRef(forwardRef24);
|
|
684
782
|
const {
|
|
685
783
|
dialogProps
|
|
686
784
|
} = useDialog({
|
|
687
785
|
role: "dialog"
|
|
688
786
|
}, ref);
|
|
689
787
|
const classNames = useClassNames("charcoal-modal-dialog", className);
|
|
690
|
-
return /* @__PURE__ */
|
|
788
|
+
return /* @__PURE__ */ jsx18("div", { className: classNames, role: dialogProps.role, "data-bottom-sheet": bottomSheet, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, "data-size": size, ref, ...props });
|
|
691
789
|
});
|
|
692
790
|
|
|
693
791
|
// src/components/Modal/ModalBackgroundContext.tsx
|
|
@@ -756,9 +854,9 @@ function useWindowWidth() {
|
|
|
756
854
|
}
|
|
757
855
|
|
|
758
856
|
// src/components/Modal/index.tsx
|
|
759
|
-
import { jsx as
|
|
857
|
+
import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
760
858
|
var DEFAULT_Z_INDEX = 10;
|
|
761
|
-
var Modal =
|
|
859
|
+
var Modal = forwardRef16(function ModalInner({
|
|
762
860
|
children,
|
|
763
861
|
zIndex = DEFAULT_Z_INDEX,
|
|
764
862
|
portalContainer,
|
|
@@ -823,15 +921,15 @@ var Modal = forwardRef15(function ModalInner({
|
|
|
823
921
|
backgroundColor,
|
|
824
922
|
overflow,
|
|
825
923
|
transform
|
|
826
|
-
}, item) => item && /* @__PURE__ */
|
|
924
|
+
}, item) => item && /* @__PURE__ */ jsx19(Overlay, { portalContainer, children: /* @__PURE__ */ jsx19(animated.div, { className: "charcoal-modal-background", ref: bgRef, ...underlayProps, style: transitionEnabled ? {
|
|
827
925
|
backgroundColor,
|
|
828
926
|
overflow,
|
|
829
927
|
zIndex
|
|
830
928
|
} : {
|
|
831
929
|
zIndex
|
|
832
|
-
}, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */
|
|
930
|
+
}, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ jsx19(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ jsx19(AnimatedDialog, { ref, ...modalProps, style: transitionEnabled ? {
|
|
833
931
|
transform
|
|
834
|
-
} : {}, size, bottomSheet, className, children: /* @__PURE__ */
|
|
932
|
+
} : {}, size, bottomSheet, className, children: /* @__PURE__ */ jsxs7(ModalContext.Provider, { value: {
|
|
835
933
|
titleProps: {},
|
|
836
934
|
title,
|
|
837
935
|
close: onClose,
|
|
@@ -839,11 +937,11 @@ var Modal = forwardRef15(function ModalInner({
|
|
|
839
937
|
bottomSheet
|
|
840
938
|
}, children: [
|
|
841
939
|
children,
|
|
842
|
-
isDismissable === true && /* @__PURE__ */
|
|
940
|
+
isDismissable === true && /* @__PURE__ */ jsx19(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
|
|
843
941
|
] }) }) }) }) }));
|
|
844
942
|
});
|
|
845
943
|
var AnimatedDialog = animated(Dialog);
|
|
846
|
-
var Modal_default =
|
|
944
|
+
var Modal_default = memo6(Modal);
|
|
847
945
|
var ModalContext = React12.createContext({
|
|
848
946
|
titleProps: {},
|
|
849
947
|
title: "",
|
|
@@ -852,37 +950,37 @@ var ModalContext = React12.createContext({
|
|
|
852
950
|
bottomSheet: false
|
|
853
951
|
});
|
|
854
952
|
function ModalCloseButton(props) {
|
|
855
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ jsx19(IconButton_default, { className: "charcoal-modal-close-button", size: "S", icon: "24/Close", type: "button", ...props });
|
|
856
954
|
}
|
|
857
955
|
|
|
858
956
|
// src/components/Modal/ModalPlumbing.tsx
|
|
859
|
-
import { useContext as
|
|
860
|
-
import { jsx as
|
|
957
|
+
import { useContext as useContext4 } from "react";
|
|
958
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
861
959
|
function ModalHeader() {
|
|
862
|
-
const modalCtx =
|
|
863
|
-
return /* @__PURE__ */
|
|
960
|
+
const modalCtx = useContext4(ModalContext);
|
|
961
|
+
return /* @__PURE__ */ jsx20("div", { className: "charcoal-modal-header-root", "data-bottom-sheet": modalCtx.bottomSheet, children: /* @__PURE__ */ jsx20("div", { className: "charcoal-modal-header-title", children: modalCtx.title }) });
|
|
864
962
|
}
|
|
865
963
|
var ModalAlign = createDivComponent("charcoal-modal-align");
|
|
866
964
|
var ModalBody = createDivComponent("charcoal-modal-body");
|
|
867
965
|
var ModalButtons = createDivComponent("charcoal-modal-buttons");
|
|
868
966
|
|
|
869
967
|
// src/components/LoadingSpinner/index.tsx
|
|
870
|
-
import { forwardRef as
|
|
871
|
-
import { jsx as
|
|
872
|
-
var LoadingSpinner =
|
|
968
|
+
import { forwardRef as forwardRef17, useImperativeHandle, useRef as useRef5, memo as memo7 } from "react";
|
|
969
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
970
|
+
var LoadingSpinner = forwardRef17(function LoadingSpinnerInner({
|
|
873
971
|
size = 48,
|
|
874
972
|
padding = 16,
|
|
875
973
|
transparent = false,
|
|
876
974
|
...props
|
|
877
975
|
}, ref) {
|
|
878
976
|
const classNames = useClassNames("charcoal-loading-spinner", props.className);
|
|
879
|
-
return /* @__PURE__ */
|
|
977
|
+
return /* @__PURE__ */ jsx21("div", { role: "progressbar", style: {
|
|
880
978
|
"--charcoal-loading-spinner-size": `${size}px`,
|
|
881
979
|
"--charcoal-loading-spinner-padding": `${padding}px`
|
|
882
|
-
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */
|
|
980
|
+
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ jsx21(LoadingSpinnerIcon, {}) });
|
|
883
981
|
});
|
|
884
|
-
var LoadingSpinner_default =
|
|
885
|
-
var LoadingSpinnerIcon =
|
|
982
|
+
var LoadingSpinner_default = memo7(LoadingSpinner);
|
|
983
|
+
var LoadingSpinnerIcon = forwardRef17(function LoadingSpinnerIcon2({
|
|
886
984
|
once = false
|
|
887
985
|
}, ref) {
|
|
888
986
|
const iconRef = useRef5(null);
|
|
@@ -896,19 +994,19 @@ var LoadingSpinnerIcon = forwardRef16(function LoadingSpinnerIcon2({
|
|
|
896
994
|
delete iconRef.current.dataset.resetAnimation;
|
|
897
995
|
}
|
|
898
996
|
}));
|
|
899
|
-
return /* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ jsx21("div", { role: "presentation", ref: iconRef, "data-once": once, className: "charcoal-loading-spinner-icon" });
|
|
900
998
|
});
|
|
901
999
|
|
|
902
1000
|
// src/components/DropdownSelector/index.tsx
|
|
903
|
-
import { useState as useState5, useRef as useRef9, useMemo as useMemo8, useCallback as
|
|
1001
|
+
import { useState as useState5, useRef as useRef9, useMemo as useMemo8, useCallback as useCallback8 } from "react";
|
|
904
1002
|
|
|
905
1003
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
906
1004
|
import { useEffect as useEffect8, useRef as useRef7 } from "react";
|
|
907
1005
|
|
|
908
1006
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
909
|
-
import { useContext as
|
|
1007
|
+
import { useContext as useContext5, useRef as useRef6 } from "react";
|
|
910
1008
|
import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
|
|
911
|
-
import { jsx as
|
|
1009
|
+
import { jsx as jsx22, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
912
1010
|
var _empty = () => null;
|
|
913
1011
|
function Popover(props) {
|
|
914
1012
|
const defaultPopoverRef = useRef6(null);
|
|
@@ -928,28 +1026,28 @@ function Popover(props) {
|
|
|
928
1026
|
setOpen: _empty,
|
|
929
1027
|
toggle: _empty
|
|
930
1028
|
});
|
|
931
|
-
const modalBackground =
|
|
1029
|
+
const modalBackground = useContext5(ModalBackgroundContext);
|
|
932
1030
|
usePreventScroll(modalBackground, props.isOpen);
|
|
933
1031
|
if (!props.isOpen)
|
|
934
1032
|
return null;
|
|
935
|
-
return /* @__PURE__ */
|
|
936
|
-
/* @__PURE__ */
|
|
1033
|
+
return /* @__PURE__ */ jsxs8(Overlay2, { portalContainer: document.body, children: [
|
|
1034
|
+
/* @__PURE__ */ jsx22("div", { ...underlayProps, style: {
|
|
937
1035
|
position: "fixed",
|
|
938
1036
|
zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
|
|
939
1037
|
inset: 0
|
|
940
1038
|
} }),
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
1039
|
+
/* @__PURE__ */ jsxs8("div", { ...popoverProps, ref: finalPopoverRef, className: "charcoal-popover", children: [
|
|
1040
|
+
/* @__PURE__ */ jsx22(DismissButton, { onDismiss: () => props.onClose() }),
|
|
1041
|
+
/* @__PURE__ */ jsx22("div", { tabIndex: 0, onFocus: props.onClose }),
|
|
944
1042
|
props.children,
|
|
945
|
-
/* @__PURE__ */
|
|
946
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ jsx22("div", { tabIndex: 0, onFocus: props.onClose }),
|
|
1044
|
+
/* @__PURE__ */ jsx22(DismissButton, { onDismiss: () => props.onClose() })
|
|
947
1045
|
] })
|
|
948
1046
|
] });
|
|
949
1047
|
}
|
|
950
1048
|
|
|
951
1049
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
952
|
-
import { jsx as
|
|
1050
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
953
1051
|
function DropdownPopover({
|
|
954
1052
|
children,
|
|
955
1053
|
...props
|
|
@@ -976,7 +1074,7 @@ function DropdownPopover({
|
|
|
976
1074
|
}
|
|
977
1075
|
}
|
|
978
1076
|
}, [props.value, props.isOpen]);
|
|
979
|
-
return /* @__PURE__ */
|
|
1077
|
+
return /* @__PURE__ */ jsx23(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
|
|
980
1078
|
}
|
|
981
1079
|
|
|
982
1080
|
// src/components/DropdownSelector/utils/findPreviewRecursive.tsx
|
|
@@ -1007,8 +1105,8 @@ function findPreviewRecursive(children, value) {
|
|
|
1007
1105
|
import { useMemo as useMemo7, useRef as useRef8 } from "react";
|
|
1008
1106
|
|
|
1009
1107
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1010
|
-
import { createContext as
|
|
1011
|
-
var MenuListContext =
|
|
1108
|
+
import { createContext as createContext5 } from "react";
|
|
1109
|
+
var MenuListContext = createContext5({
|
|
1012
1110
|
root: void 0,
|
|
1013
1111
|
value: "",
|
|
1014
1112
|
propsArray: [],
|
|
@@ -1040,11 +1138,11 @@ function getValuesRecursive(children) {
|
|
|
1040
1138
|
}
|
|
1041
1139
|
|
|
1042
1140
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1043
|
-
import { jsx as
|
|
1141
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1044
1142
|
function MenuList(props) {
|
|
1045
1143
|
const root = useRef8(null);
|
|
1046
1144
|
const propsArray = useMemo7(() => getValuesRecursive(props.children), [props.children]);
|
|
1047
|
-
return /* @__PURE__ */
|
|
1145
|
+
return /* @__PURE__ */ jsx24("ul", { className: "charcoal-menu-list", ref: root, children: /* @__PURE__ */ jsx24(MenuListContext.Provider, { value: {
|
|
1048
1146
|
value: props.value ?? "",
|
|
1049
1147
|
root,
|
|
1050
1148
|
propsArray,
|
|
@@ -1057,7 +1155,7 @@ function MenuList(props) {
|
|
|
1057
1155
|
// src/components/DropdownSelector/index.tsx
|
|
1058
1156
|
import { useVisuallyHidden as useVisuallyHidden3 } from "@react-aria/visually-hidden";
|
|
1059
1157
|
import { useId as useId4 } from "@react-aria/utils";
|
|
1060
|
-
import { jsx as
|
|
1158
|
+
import { jsx as jsx25, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1061
1159
|
function DropdownSelector({
|
|
1062
1160
|
onChange,
|
|
1063
1161
|
showLabel = false,
|
|
@@ -1071,52 +1169,52 @@ function DropdownSelector({
|
|
|
1071
1169
|
const {
|
|
1072
1170
|
visuallyHiddenProps
|
|
1073
1171
|
} = useVisuallyHidden3();
|
|
1074
|
-
const handleChange =
|
|
1172
|
+
const handleChange = useCallback8((e) => {
|
|
1075
1173
|
onChange(e.target.value);
|
|
1076
1174
|
}, [onChange]);
|
|
1077
1175
|
const labelId = useId4();
|
|
1078
1176
|
const describedbyId = useId4();
|
|
1079
1177
|
const classNames = useClassNames("charcoal-dropdown-selector-root", props.className);
|
|
1080
|
-
return /* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
1082
|
-
/* @__PURE__ */
|
|
1083
|
-
return /* @__PURE__ */
|
|
1178
|
+
return /* @__PURE__ */ jsxs9("div", { className: classNames, "aria-disabled": props.disabled, children: [
|
|
1179
|
+
/* @__PURE__ */ jsx25(FieldLabel_default, { id: labelId, label: props.label, required: props.required, requiredText: props.requiredText, subLabel: props.subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
1180
|
+
/* @__PURE__ */ jsx25("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx25("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
|
|
1181
|
+
return /* @__PURE__ */ jsx25("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
|
|
1084
1182
|
}) }) }),
|
|
1085
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ jsxs9("button", { className: "charcoal-dropdown-selector-button", "aria-labelledby": labelId, "aria-invalid": props.invalid, "aria-describedby": props.assistiveText !== void 0 ? describedbyId : void 0, disabled: props.disabled, onClick: () => {
|
|
1086
1184
|
if (props.disabled === true)
|
|
1087
1185
|
return;
|
|
1088
1186
|
setIsOpen(true);
|
|
1089
1187
|
}, ref: triggerRef, type: "button", "data-active": isOpen, children: [
|
|
1090
|
-
/* @__PURE__ */
|
|
1091
|
-
/* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ jsx25("span", { className: "charcoal-ui-dropdown-selector-text", "data-placeholder": isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
|
|
1189
|
+
/* @__PURE__ */ jsx25(Icon_default, { className: "charcoal-ui-dropdown-selector-icon", name: "16/Menu" })
|
|
1092
1190
|
] }),
|
|
1093
|
-
isOpen && /* @__PURE__ */
|
|
1191
|
+
isOpen && /* @__PURE__ */ jsx25(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx25(MenuList, { value: props.value, onChange: (v) => {
|
|
1094
1192
|
onChange(v);
|
|
1095
1193
|
setIsOpen(false);
|
|
1096
1194
|
}, children: props.children }) }),
|
|
1097
|
-
props.assistiveText !== void 0 && /* @__PURE__ */
|
|
1195
|
+
props.assistiveText !== void 0 && /* @__PURE__ */ jsx25(AssistiveText, { "data-invalid": props.invalid === true, id: describedbyId, children: props.assistiveText })
|
|
1098
1196
|
] });
|
|
1099
1197
|
}
|
|
1100
1198
|
|
|
1101
1199
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
1102
|
-
import { forwardRef as
|
|
1200
|
+
import { forwardRef as forwardRef19 } from "react";
|
|
1103
1201
|
|
|
1104
1202
|
// src/components/DropdownSelector/ListItem/index.tsx
|
|
1105
|
-
import { forwardRef as
|
|
1106
|
-
import { jsx as
|
|
1107
|
-
var ListItem =
|
|
1203
|
+
import { forwardRef as forwardRef18, useMemo as useMemo9 } from "react";
|
|
1204
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1205
|
+
var ListItem = forwardRef18(function ListItem2({
|
|
1108
1206
|
as,
|
|
1109
1207
|
className,
|
|
1110
1208
|
...props
|
|
1111
1209
|
}, ref) {
|
|
1112
1210
|
const Component = useMemo9(() => as ?? "li", [as]);
|
|
1113
1211
|
const classNames = useClassNames("charcoal-list-item", className);
|
|
1114
|
-
return /* @__PURE__ */
|
|
1212
|
+
return /* @__PURE__ */ jsx26(Component, { className: classNames, ref, ...props });
|
|
1115
1213
|
});
|
|
1116
1214
|
var ListItem_default = ListItem;
|
|
1117
1215
|
|
|
1118
1216
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
1119
|
-
import { useCallback as
|
|
1217
|
+
import { useCallback as useCallback9, useContext as useContext6 } from "react";
|
|
1120
1218
|
|
|
1121
1219
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
1122
1220
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -1153,12 +1251,12 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1153
1251
|
setValue,
|
|
1154
1252
|
root,
|
|
1155
1253
|
propsArray
|
|
1156
|
-
} =
|
|
1157
|
-
const setContextValue =
|
|
1254
|
+
} = useContext6(MenuListContext);
|
|
1255
|
+
const setContextValue = useCallback9(() => {
|
|
1158
1256
|
if (value !== void 0)
|
|
1159
1257
|
setValue(value);
|
|
1160
1258
|
}, [value, setValue]);
|
|
1161
|
-
const handleKeyDown =
|
|
1259
|
+
const handleKeyDown = useCallback9((e) => {
|
|
1162
1260
|
if (e.key === "Enter") {
|
|
1163
1261
|
setContextValue();
|
|
1164
1262
|
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
@@ -1199,70 +1297,70 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1199
1297
|
}
|
|
1200
1298
|
|
|
1201
1299
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
1202
|
-
import { jsx as
|
|
1203
|
-
var MenuItem =
|
|
1300
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1301
|
+
var MenuItem = forwardRef19(function MenuItem2({
|
|
1204
1302
|
className,
|
|
1205
1303
|
value,
|
|
1206
1304
|
disabled,
|
|
1207
1305
|
...props
|
|
1208
1306
|
}, ref) {
|
|
1209
1307
|
const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value);
|
|
1210
|
-
return /* @__PURE__ */
|
|
1308
|
+
return /* @__PURE__ */ jsx27(ListItem_default, { ...props, ref, "data-key": value, onKeyDown: handleKeyDown, onClick: disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": disabled, role: "option", children: props.children });
|
|
1211
1309
|
});
|
|
1212
1310
|
var MenuItem_default = MenuItem;
|
|
1213
1311
|
|
|
1214
1312
|
// src/components/DropdownSelector/DropdownMenuItem/index.tsx
|
|
1215
|
-
import { useContext as
|
|
1216
|
-
import { jsx as
|
|
1313
|
+
import { useContext as useContext7 } from "react";
|
|
1314
|
+
import { jsx as jsx28, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1217
1315
|
function DropdownMenuItem(props) {
|
|
1218
1316
|
const {
|
|
1219
1317
|
value: ctxValue
|
|
1220
|
-
} =
|
|
1318
|
+
} = useContext7(MenuListContext);
|
|
1221
1319
|
const isSelected = props.value === ctxValue;
|
|
1222
1320
|
const {
|
|
1223
1321
|
children,
|
|
1224
1322
|
...rest
|
|
1225
1323
|
} = props;
|
|
1226
|
-
return /* @__PURE__ */
|
|
1227
|
-
isSelected && /* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ jsxs10(MenuItem_default, { ...rest, "aria-selected": isSelected, children: [
|
|
1325
|
+
isSelected && /* @__PURE__ */ jsx28(Icon_default, { className: "charcoal-dropdown-selector-menu-item-icon", name: "16/Check" }),
|
|
1326
|
+
/* @__PURE__ */ jsx28("span", { className: "charcoal-dropdown-selector-menu-item", "data-selected": isSelected, children: props.children })
|
|
1229
1327
|
] });
|
|
1230
1328
|
}
|
|
1231
1329
|
|
|
1232
1330
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
1233
|
-
import { jsx as
|
|
1331
|
+
import { jsx as jsx29, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1234
1332
|
function MenuItemGroup(props) {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1333
|
+
return /* @__PURE__ */ jsxs11("li", { className: "charcoal-menu-item-group", role: "presentation", children: [
|
|
1334
|
+
/* @__PURE__ */ jsx29("span", { children: props.text }),
|
|
1335
|
+
/* @__PURE__ */ jsx29("ul", { role: "group", children: props.children })
|
|
1238
1336
|
] });
|
|
1239
1337
|
}
|
|
1240
1338
|
|
|
1241
1339
|
// src/components/SegmentedControl/index.tsx
|
|
1242
|
-
import { forwardRef as
|
|
1340
|
+
import { forwardRef as forwardRef20, memo as memo8, useMemo as useMemo10, useRef as useRef10 } from "react";
|
|
1243
1341
|
import { useRadioGroupState } from "@react-stately/radio";
|
|
1244
1342
|
import { useRadio, useRadioGroup } from "@react-aria/radio";
|
|
1245
1343
|
|
|
1246
1344
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1247
|
-
import { createContext as
|
|
1248
|
-
import { jsx as
|
|
1249
|
-
var RadioContext =
|
|
1345
|
+
import { createContext as createContext6, useContext as useContext8 } from "react";
|
|
1346
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1347
|
+
var RadioContext = createContext6(null);
|
|
1250
1348
|
var RadioProvider = ({
|
|
1251
1349
|
value,
|
|
1252
1350
|
children
|
|
1253
1351
|
}) => {
|
|
1254
|
-
return /* @__PURE__ */
|
|
1352
|
+
return /* @__PURE__ */ jsx30(RadioContext.Provider, { value, children });
|
|
1255
1353
|
};
|
|
1256
1354
|
var useRadioContext = () => {
|
|
1257
|
-
const state =
|
|
1355
|
+
const state = useContext8(RadioContext);
|
|
1258
1356
|
if (state === null)
|
|
1259
1357
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1260
1358
|
return state;
|
|
1261
1359
|
};
|
|
1262
1360
|
|
|
1263
1361
|
// src/components/SegmentedControl/index.tsx
|
|
1264
|
-
import { jsx as
|
|
1265
|
-
var SegmentedControl =
|
|
1362
|
+
import { jsx as jsx31, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1363
|
+
var SegmentedControl = forwardRef20(function SegmentedControlInner(props, ref) {
|
|
1266
1364
|
const className = useClassNames("charcoal-segmented-control", props.className);
|
|
1267
1365
|
const ariaRadioGroupProps = useMemo10(() => ({
|
|
1268
1366
|
...props,
|
|
@@ -1281,9 +1379,9 @@ var SegmentedControl = forwardRef19(function SegmentedControlInner(props, ref) {
|
|
|
1281
1379
|
label: d
|
|
1282
1380
|
} : d);
|
|
1283
1381
|
}, [props.data]);
|
|
1284
|
-
return /* @__PURE__ */
|
|
1382
|
+
return /* @__PURE__ */ jsx31("div", { ref, ...radioGroupProps, className, children: /* @__PURE__ */ jsx31(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx31(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1285
1383
|
});
|
|
1286
|
-
var SegmentedControl_default =
|
|
1384
|
+
var SegmentedControl_default = memo8(SegmentedControl);
|
|
1287
1385
|
var Segmented = (props) => {
|
|
1288
1386
|
const state = useRadioContext();
|
|
1289
1387
|
const ref = useRef10(null);
|
|
@@ -1297,20 +1395,20 @@ var Segmented = (props) => {
|
|
|
1297
1395
|
isDisabled,
|
|
1298
1396
|
isSelected
|
|
1299
1397
|
} = useRadio(ariaRadioProps, state, ref);
|
|
1300
|
-
return /* @__PURE__ */
|
|
1301
|
-
/* @__PURE__ */
|
|
1398
|
+
return /* @__PURE__ */ jsxs12("label", { className: "charcoal-segmented-control-radio__label", "aria-disabled": isDisabled || state.isReadOnly, "data-checked": isSelected, children: [
|
|
1399
|
+
/* @__PURE__ */ jsx31("input", { className: "charcoal-segmented-control-radio__input", ...inputProps, ref }),
|
|
1302
1400
|
props.children
|
|
1303
1401
|
] });
|
|
1304
1402
|
};
|
|
1305
1403
|
|
|
1306
1404
|
// src/components/Checkbox/index.tsx
|
|
1307
|
-
import { forwardRef as
|
|
1405
|
+
import { forwardRef as forwardRef22, memo as memo10 } from "react";
|
|
1308
1406
|
import { useId as useId5 } from "@react-aria/utils";
|
|
1309
1407
|
|
|
1310
1408
|
// src/components/Checkbox/CheckboxInput/index.tsx
|
|
1311
|
-
import { forwardRef as
|
|
1312
|
-
import { jsx as
|
|
1313
|
-
var CheckboxInput =
|
|
1409
|
+
import { forwardRef as forwardRef21, memo as memo9, useCallback as useCallback10 } from "react";
|
|
1410
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1411
|
+
var CheckboxInput = forwardRef21(function CheckboxInput2({
|
|
1314
1412
|
onChange,
|
|
1315
1413
|
checked,
|
|
1316
1414
|
invalid,
|
|
@@ -1318,18 +1416,18 @@ var CheckboxInput = forwardRef20(function CheckboxInput2({
|
|
|
1318
1416
|
rounded,
|
|
1319
1417
|
...props
|
|
1320
1418
|
}, ref) {
|
|
1321
|
-
const handleChange =
|
|
1419
|
+
const handleChange = useCallback10((e) => {
|
|
1322
1420
|
const el = e.currentTarget;
|
|
1323
1421
|
onChange?.(el.checked);
|
|
1324
1422
|
}, [onChange]);
|
|
1325
1423
|
const classNames = useClassNames("charcoal-checkbox-input", className);
|
|
1326
|
-
return /* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsx32("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
|
|
1327
1425
|
});
|
|
1328
|
-
var CheckboxInput_default =
|
|
1426
|
+
var CheckboxInput_default = memo9(CheckboxInput);
|
|
1329
1427
|
|
|
1330
1428
|
// src/components/Checkbox/CheckboxWithLabel.tsx
|
|
1331
1429
|
import React16 from "react";
|
|
1332
|
-
import { jsx as
|
|
1430
|
+
import { jsx as jsx33, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1333
1431
|
var CheckboxWithLabel = React16.memo(function CheckboxWithLabel2({
|
|
1334
1432
|
className,
|
|
1335
1433
|
children,
|
|
@@ -1338,15 +1436,15 @@ var CheckboxWithLabel = React16.memo(function CheckboxWithLabel2({
|
|
|
1338
1436
|
disabled
|
|
1339
1437
|
}) {
|
|
1340
1438
|
const classNames = useClassNames("charcoal-checkbox__label", className);
|
|
1341
|
-
return /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ jsxs13("label", { htmlFor: id, "aria-disabled": disabled, className: classNames, children: [
|
|
1342
1440
|
input,
|
|
1343
|
-
/* @__PURE__ */
|
|
1441
|
+
/* @__PURE__ */ jsx33("div", { className: "charcoal-checkbox__label_div", children })
|
|
1344
1442
|
] });
|
|
1345
1443
|
});
|
|
1346
1444
|
|
|
1347
1445
|
// src/components/Checkbox/index.tsx
|
|
1348
|
-
import { jsx as
|
|
1349
|
-
var Checkbox =
|
|
1446
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1447
|
+
var Checkbox = forwardRef22(function Checkbox2({
|
|
1350
1448
|
disabled,
|
|
1351
1449
|
className,
|
|
1352
1450
|
id,
|
|
@@ -1355,19 +1453,19 @@ var Checkbox = forwardRef21(function Checkbox2({
|
|
|
1355
1453
|
}, ref) {
|
|
1356
1454
|
const htmlId = useId5(id);
|
|
1357
1455
|
const noChildren = children === void 0;
|
|
1358
|
-
const input = /* @__PURE__ */
|
|
1456
|
+
const input = /* @__PURE__ */ jsx34(CheckboxInput_default, { ...props, className: noChildren ? className : void 0, disabled, id: htmlId, ref });
|
|
1359
1457
|
if (noChildren) {
|
|
1360
1458
|
return input;
|
|
1361
1459
|
}
|
|
1362
|
-
return /* @__PURE__ */
|
|
1460
|
+
return /* @__PURE__ */ jsx34(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
|
|
1363
1461
|
});
|
|
1364
|
-
var Checkbox_default =
|
|
1462
|
+
var Checkbox_default = memo10(Checkbox);
|
|
1365
1463
|
|
|
1366
1464
|
// src/components/TagItem/index.tsx
|
|
1367
|
-
import { forwardRef as
|
|
1465
|
+
import { forwardRef as forwardRef23, memo as memo11, useMemo as useMemo11 } from "react";
|
|
1368
1466
|
import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
1369
|
-
import { jsx as
|
|
1370
|
-
var TagItem =
|
|
1467
|
+
import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1468
|
+
var TagItem = forwardRef23(function TagItemInner({
|
|
1371
1469
|
component,
|
|
1372
1470
|
label,
|
|
1373
1471
|
translatedLabel,
|
|
@@ -1383,17 +1481,17 @@ var TagItem = forwardRef22(function TagItemInner({
|
|
|
1383
1481
|
const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
|
|
1384
1482
|
const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
|
|
1385
1483
|
const Component = useMemo11(() => component ?? "button", [component]);
|
|
1386
|
-
return /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ jsxs14(Component, { ...props, ref, className, "data-state": status, "data-bg-variant": bgVariant, "data-size": hasTranslatedLabel ? "M" : size, style: {
|
|
1387
1485
|
"--charcoal-tag-item-bg": bg
|
|
1388
1486
|
}, children: [
|
|
1389
|
-
/* @__PURE__ */
|
|
1390
|
-
hasTranslatedLabel && /* @__PURE__ */
|
|
1391
|
-
/* @__PURE__ */
|
|
1487
|
+
/* @__PURE__ */ jsxs14("div", { className: "charcoal-tag-item__label", "data-has-translate": hasTranslatedLabel, children: [
|
|
1488
|
+
hasTranslatedLabel && /* @__PURE__ */ jsx35("span", { className: "charcoal-tag-item__label__translated", children: translatedLabel }),
|
|
1489
|
+
/* @__PURE__ */ jsx35("span", { className: "charcoal-tag-item__label__text", "data-has-translate": hasTranslatedLabel, children: label })
|
|
1392
1490
|
] }),
|
|
1393
|
-
status === "active" && /* @__PURE__ */
|
|
1491
|
+
status === "active" && /* @__PURE__ */ jsx35(Icon_default, { name: "16/Remove" })
|
|
1394
1492
|
] });
|
|
1395
1493
|
});
|
|
1396
|
-
var TagItem_default =
|
|
1494
|
+
var TagItem_default = memo11(TagItem);
|
|
1397
1495
|
export {
|
|
1398
1496
|
Button_default as Button,
|
|
1399
1497
|
CharcoalProvider,
|
|
@@ -1412,6 +1510,8 @@ export {
|
|
|
1412
1510
|
ModalButtons,
|
|
1413
1511
|
ModalCloseButton,
|
|
1414
1512
|
ModalHeader,
|
|
1513
|
+
MultiSelect_default as MultiSelect,
|
|
1514
|
+
MultiSelectGroup,
|
|
1415
1515
|
OverlayProvider,
|
|
1416
1516
|
Radio_default as Radio,
|
|
1417
1517
|
RadioGroup,
|