@charcoal-ui/react 2.3.0 → 2.5.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.
Files changed (33) hide show
  1. package/dist/components/DropdownSelector/Divider.d.ts +4 -0
  2. package/dist/components/DropdownSelector/Divider.d.ts.map +1 -0
  3. package/dist/components/DropdownSelector/DropdownPopover.d.ts +13 -0
  4. package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -0
  5. package/dist/components/DropdownSelector/ListBoxSection.d.ts +7 -0
  6. package/dist/components/DropdownSelector/ListBoxSection.d.ts.map +1 -0
  7. package/dist/components/DropdownSelector/Listbox.d.ts +1 -1
  8. package/dist/components/DropdownSelector/Listbox.d.ts.map +1 -1
  9. package/dist/components/DropdownSelector/Option.d.ts +11 -0
  10. package/dist/components/DropdownSelector/Option.d.ts.map +1 -0
  11. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  12. package/dist/components/DropdownSelector/index.story.d.ts +3 -0
  13. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  14. package/dist/{index.cjs → index.cjs.js} +250 -184
  15. package/dist/index.cjs.js.map +1 -0
  16. package/dist/{index.js → index.esm.js} +203 -137
  17. package/dist/index.esm.js.map +1 -0
  18. package/dist/styled.d.ts +75 -73
  19. package/dist/styled.d.ts.map +1 -1
  20. package/package.json +24 -24
  21. package/src/components/DropdownSelector/Divider.tsx +13 -0
  22. package/src/components/DropdownSelector/DropdownPopover.tsx +72 -0
  23. package/src/components/DropdownSelector/ListBoxSection.tsx +60 -0
  24. package/src/components/DropdownSelector/Listbox.tsx +14 -75
  25. package/src/components/DropdownSelector/Option.tsx +66 -0
  26. package/src/components/DropdownSelector/index.story.tsx +118 -45
  27. package/src/components/DropdownSelector/index.tsx +8 -11
  28. package/src/components/TagItem/index.tsx +5 -3
  29. package/dist/components/DropdownSelector/Popover.d.ts +0 -10
  30. package/dist/components/DropdownSelector/Popover.d.ts.map +0 -1
  31. package/dist/index.cjs.map +0 -1
  32. package/dist/index.js.map +0 -1
  33. package/src/components/DropdownSelector/Popover.tsx +0 -46
@@ -1459,8 +1459,8 @@ var LoadingSpinnerIcon = React14.forwardRef(function LoadingSpinnerIcon2({ once
1459
1459
  });
1460
1460
 
1461
1461
  // src/components/DropdownSelector/index.tsx
1462
- import React17, { useMemo as useMemo4, useRef as useRef7 } from "react";
1463
- import styled14 from "styled-components";
1462
+ import React19, { useMemo as useMemo3, useRef as useRef8 } from "react";
1463
+ import styled18 from "styled-components";
1464
1464
  import { Item, useSelectState } from "react-stately";
1465
1465
  import { disabledSelector as disabledSelector4 } from "@charcoal-ui/utils";
1466
1466
  import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
@@ -1468,61 +1468,29 @@ import { useSelect, HiddenSelect } from "@react-aria/select";
1468
1468
  import { useButton } from "@react-aria/button";
1469
1469
 
1470
1470
  // src/components/DropdownSelector/Listbox.tsx
1471
- import React15, { memo, useRef as useRef5, Fragment, useMemo as useMemo2 } from "react";
1471
+ import React17, { memo, useRef as useRef6, Fragment, useMemo as useMemo2 } from "react";
1472
+ import styled16 from "styled-components";
1473
+ import { useListBox } from "@react-aria/listbox";
1474
+
1475
+ // src/components/DropdownSelector/ListBoxSection.tsx
1476
+ import { useListBoxSection } from "@react-aria/listbox";
1477
+ import { useSeparator } from "@react-aria/separator";
1478
+ import React16 from "react";
1479
+ import styled15 from "styled-components";
1480
+
1481
+ // src/components/DropdownSelector/Option.tsx
1482
+ import React15, { useRef as useRef5 } from "react";
1472
1483
  import styled13, { css as css5 } from "styled-components";
1473
- import { useListBox, useOption } from "@react-aria/listbox";
1484
+ import { useOption } from "@react-aria/listbox";
1474
1485
  import { mergeProps } from "@react-aria/utils";
1475
1486
  import { useFocusRing } from "@react-aria/focus";
1476
1487
  import { px as px3 } from "@charcoal-ui/utils";
1477
- var Listbox = ({
1478
- state,
1479
- mode = "default",
1480
- ...props
1481
- }) => {
1482
- const ref = useRef5(null);
1483
- const { listBoxProps } = useListBox(props, state, ref);
1484
- const collection = useMemo2(
1485
- () => [...state.collection].map((node, index, self) => ({
1486
- node,
1487
- first: index === 0,
1488
- last: index === self.length - 1
1489
- })),
1490
- [state.collection]
1491
- );
1492
- return /* @__PURE__ */ React15.createElement(ListboxRoot, { ref, ...listBoxProps }, collection.map(({ node, last }) => /* @__PURE__ */ React15.createElement(Fragment, { key: node.key }, /* @__PURE__ */ React15.createElement(Option, { item: node, state, mode }), !last && mode === "separator" && /* @__PURE__ */ React15.createElement(Divider, null))));
1493
- };
1494
- var Listbox_default = memo(Listbox);
1495
- var ListboxRoot = styled13.ul`
1496
- padding-left: 0;
1497
- margin: 0;
1498
- box-sizing: border-box;
1499
- list-style: none;
1500
-
1501
- ${theme((o) => [
1502
- o.bg.background1,
1503
- o.border.default,
1504
- o.borderRadius(8),
1505
- o.outline.default.focus
1506
- ])}
1507
- `;
1508
- var Divider = styled13.div.attrs({ role: "separator" })`
1509
- display: flex;
1510
- ${theme((o) => [o.padding.horizontal(8)])}
1511
-
1512
- &:before {
1513
- content: '';
1514
- display: block;
1515
- width: 100%;
1516
- height: 1px;
1517
- background: #00000014;
1518
- }
1519
- `;
1520
- var Option = ({ item, state, mode }) => {
1488
+ function Option({ item, state, mode }) {
1521
1489
  const ref = useRef5(null);
1522
1490
  const { optionProps, isSelected } = useOption(item, state, ref);
1523
1491
  const { focusProps } = useFocusRing();
1524
1492
  return /* @__PURE__ */ React15.createElement(OptionRoot, { ...mergeProps(optionProps, focusProps), ref, mode }, /* @__PURE__ */ React15.createElement(OptionCheckIcon, { name: "16/Check", isSelected }), /* @__PURE__ */ React15.createElement(OptionText, null, item.rendered));
1525
- };
1493
+ }
1526
1494
  var OptionRoot = styled13.li`
1527
1495
  display: flex;
1528
1496
  align-items: center;
@@ -1553,32 +1521,128 @@ var OptionText = styled13.span`
1553
1521
  ${theme((o) => [o.typography(14), o.font.text2])}
1554
1522
  `;
1555
1523
 
1556
- // src/components/DropdownSelector/Popover.tsx
1557
- import { FocusScope as FocusScope2 } from "@react-aria/focus";
1558
- import { DismissButton, useOverlay as useOverlay2 } from "@react-aria/overlays";
1559
- import React16, {
1560
- useRef as useRef6,
1561
- useMemo as useMemo3,
1562
- memo as memo2
1563
- } from "react";
1564
- import { mergeProps as mergeProps2 } from "@react-aria/utils";
1565
- var Popover = ({ open, onClose, children, ...props }) => {
1524
+ // src/components/DropdownSelector/Divider.tsx
1525
+ import styled14 from "styled-components";
1526
+ var Divider = styled14.div.attrs({ role: "separator" })`
1527
+ display: flex;
1528
+
1529
+ &:before {
1530
+ content: '';
1531
+ display: block;
1532
+ width: 100%;
1533
+ height: 1px;
1534
+ background: #00000014;
1535
+ }
1536
+ `;
1537
+
1538
+ // src/components/DropdownSelector/ListBoxSection.tsx
1539
+ function ListBoxSection(props) {
1540
+ const { state } = props;
1541
+ const { itemProps, headingProps, groupProps } = useListBoxSection({
1542
+ heading: props.section.rendered,
1543
+ "aria-label": props.section["aria-label"]
1544
+ });
1545
+ const { separatorProps } = useSeparator({
1546
+ elementType: "li"
1547
+ });
1548
+ return /* @__PURE__ */ React16.createElement(React16.Fragment, null, props.section.key !== props.state.collection.getFirstKey() && /* @__PURE__ */ React16.createElement(Divider, { ...separatorProps, role: "separator" }), /* @__PURE__ */ React16.createElement(StyledLi, { ...itemProps }, props.section.rendered != null && /* @__PURE__ */ React16.createElement(SectionSpan, { ...headingProps }, props.section.rendered), /* @__PURE__ */ React16.createElement(StyledUl, { ...groupProps }, [...props.section.childNodes].map((node) => /* @__PURE__ */ React16.createElement(Option, { key: node.key, item: node, state })))));
1549
+ }
1550
+ var SectionSpan = styled15.span`
1551
+ ${theme((o) => [
1552
+ o.font.text3,
1553
+ o.typography(12).bold,
1554
+ o.margin.bottom(8).left(16).top(16)
1555
+ ])}
1556
+ `;
1557
+ var StyledUl = styled15.ul`
1558
+ padding-left: 0;
1559
+ margin: 0;
1560
+ box-sizing: border-box;
1561
+ list-style: none;
1562
+ overflow: hidden;
1563
+ `;
1564
+ var StyledLi = styled15.li``;
1565
+
1566
+ // src/components/DropdownSelector/Listbox.tsx
1567
+ var Listbox = ({
1568
+ state,
1569
+ mode = "default",
1570
+ ...props
1571
+ }) => {
1566
1572
  const ref = useRef6(null);
1567
- const { overlayProps } = useOverlay2(
1568
- useMemo3(
1569
- () => ({
1570
- isOpen: open,
1571
- onClose,
1572
- shouldCloseOnBlur: true,
1573
- isDismissable: true
1574
- }),
1575
- [onClose, open]
1576
- ),
1577
- ref
1573
+ const { listBoxProps } = useListBox(props, state, ref);
1574
+ const collection = useMemo2(
1575
+ () => [...state.collection].map((node, index, self) => ({
1576
+ node,
1577
+ first: index === 0,
1578
+ last: index === self.length - 1
1579
+ })),
1580
+ [state.collection]
1578
1581
  );
1579
- return /* @__PURE__ */ React16.createElement(FocusScope2, { restoreFocus: true }, /* @__PURE__ */ React16.createElement("div", { ...mergeProps2(overlayProps, props), ref }, children, /* @__PURE__ */ React16.createElement(DismissButton, { onDismiss: onClose })));
1582
+ return /* @__PURE__ */ React17.createElement(ListboxRoot, { ref, ...listBoxProps }, collection.map(({ node, last }) => /* @__PURE__ */ React17.createElement(Fragment, { key: node.key }, node.type === "section" ? /* @__PURE__ */ React17.createElement(ListBoxSection, { section: node, state }) : /* @__PURE__ */ React17.createElement(Option, { item: node, state, mode }), !last && mode === "separator" && /* @__PURE__ */ React17.createElement(Divider, null))));
1580
1583
  };
1581
- var Popover_default = memo2(Popover);
1584
+ var Listbox_default = memo(Listbox);
1585
+ var ListboxRoot = styled16.ul`
1586
+ padding-left: 0;
1587
+ margin: 0;
1588
+ box-sizing: border-box;
1589
+ list-style: none;
1590
+ overflow: auto;
1591
+ max-height: inherit;
1592
+
1593
+ ${theme((o) => [
1594
+ o.bg.background1,
1595
+ o.border.default,
1596
+ o.borderRadius(8),
1597
+ o.padding.vertical(8),
1598
+ o.outline.default.focus
1599
+ ])}
1600
+ `;
1601
+
1602
+ // src/components/DropdownSelector/DropdownPopover.tsx
1603
+ import React18, { useEffect as useEffect2, useRef as useRef7 } from "react";
1604
+ import {
1605
+ DismissButton,
1606
+ Overlay as Overlay2,
1607
+ usePopover
1608
+ } from "@react-aria/overlays";
1609
+ import styled17 from "styled-components";
1610
+ var DropdownPopoverDiv = styled17.div`
1611
+ width: 100%;
1612
+ ${theme((o) => o.margin.top(4).bottom(4))}
1613
+ `;
1614
+ function DropdownPopover({ children, state, ...props }) {
1615
+ const ref = useRef7(null);
1616
+ const { popoverProps, underlayProps } = usePopover(
1617
+ {
1618
+ ...props,
1619
+ popoverRef: ref,
1620
+ containerPadding: 0
1621
+ },
1622
+ state
1623
+ );
1624
+ useEffect2(() => {
1625
+ if (ref.current && props.triggerRef.current) {
1626
+ ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
1627
+ }
1628
+ }, [props.triggerRef]);
1629
+ useEffect2(() => {
1630
+ if (state.isOpen && props.value !== void 0) {
1631
+ window.requestAnimationFrame(() => {
1632
+ if (props.value === void 0)
1633
+ return;
1634
+ const windowScrollY = window.scrollY;
1635
+ const windowScrollX = window.scrollX;
1636
+ const selectedElement = document.querySelector(
1637
+ `[data-key="${props.value.toString()}"]`
1638
+ );
1639
+ selectedElement?.scrollIntoView({ block: "center" });
1640
+ window.scrollTo(windowScrollX, windowScrollY);
1641
+ });
1642
+ }
1643
+ }, [props.value, state.isOpen]);
1644
+ return /* @__PURE__ */ React18.createElement(Overlay2, { portalContainer: document.body }, /* @__PURE__ */ React18.createElement("div", { ...underlayProps, style: { position: "fixed", inset: 0 } }), /* @__PURE__ */ React18.createElement(DropdownPopoverDiv, { ...popoverProps, ref }, /* @__PURE__ */ React18.createElement(DismissButton, { onDismiss: () => state.close() }), children, /* @__PURE__ */ React18.createElement(DismissButton, { onDismiss: () => state.close() })));
1645
+ }
1582
1646
 
1583
1647
  // src/components/DropdownSelector/index.tsx
1584
1648
  var DropdownSelector = ({
@@ -1597,8 +1661,8 @@ var DropdownSelector = ({
1597
1661
  ...props
1598
1662
  }) => {
1599
1663
  const { visuallyHiddenProps } = useVisuallyHidden2();
1600
- const triggerRef = useRef7(null);
1601
- const selectProps = useMemo4(
1664
+ const triggerRef = useRef8(null);
1665
+ const selectProps = useMemo3(
1602
1666
  () => ({
1603
1667
  ...props,
1604
1668
  label,
@@ -1624,7 +1688,7 @@ var DropdownSelector = ({
1624
1688
  } = useSelect(selectProps, state, triggerRef);
1625
1689
  const { buttonProps } = useButton(triggerProps, triggerRef);
1626
1690
  const hasAssertiveText = assertiveText !== void 0 && assertiveText.length > 0;
1627
- return /* @__PURE__ */ React17.createElement(DropdownSelectorRoot, { "aria-disabled": disabled, className }, /* @__PURE__ */ React17.createElement(
1691
+ return /* @__PURE__ */ React19.createElement(DropdownSelectorRoot, { "aria-disabled": disabled, className }, /* @__PURE__ */ React19.createElement(
1628
1692
  DropdownFieldLabel,
1629
1693
  {
1630
1694
  label,
@@ -1634,7 +1698,7 @@ var DropdownSelector = ({
1634
1698
  ...labelProps,
1635
1699
  ...!showLabel ? visuallyHiddenProps : {}
1636
1700
  }
1637
- ), /* @__PURE__ */ React17.createElement(
1701
+ ), /* @__PURE__ */ React19.createElement(
1638
1702
  HiddenSelect,
1639
1703
  {
1640
1704
  state,
@@ -1644,7 +1708,15 @@ var DropdownSelector = ({
1644
1708
  isDisabled: disabled,
1645
1709
  autoComplete
1646
1710
  }
1647
- ), /* @__PURE__ */ React17.createElement(DropdownButtonWrapper, null, /* @__PURE__ */ React17.createElement(DropdownButton, { ...buttonProps, ref: triggerRef, invalid }, /* @__PURE__ */ React17.createElement(DropdownButtonText, { ...valueProps }, state.selectedItem ? state.selectedItem.rendered : props.placeholder), /* @__PURE__ */ React17.createElement(DropdownButtonIcon, { name: "16/Menu" })), state.isOpen && /* @__PURE__ */ React17.createElement(DropdownPopover, { open: state.isOpen, onClose: () => state.close() }, /* @__PURE__ */ React17.createElement(Listbox_default, { ...menuProps, state, mode }))), hasAssertiveText && /* @__PURE__ */ React17.createElement(
1711
+ ), /* @__PURE__ */ React19.createElement(DropdownButtonWrapper, null, /* @__PURE__ */ React19.createElement(DropdownButton, { ...buttonProps, ref: triggerRef, invalid }, /* @__PURE__ */ React19.createElement(DropdownButtonText, { ...valueProps }, state.selectedItem ? state.selectedItem.rendered : props.placeholder), /* @__PURE__ */ React19.createElement(DropdownButtonIcon, { name: "16/Menu" })), state.isOpen && /* @__PURE__ */ React19.createElement(
1712
+ DropdownPopover,
1713
+ {
1714
+ state,
1715
+ triggerRef,
1716
+ value: props.value ?? props.defaultValue
1717
+ },
1718
+ /* @__PURE__ */ React19.createElement(Listbox_default, { ...menuProps, state, mode })
1719
+ )), hasAssertiveText && /* @__PURE__ */ React19.createElement(
1648
1720
  AssertiveText,
1649
1721
  {
1650
1722
  invalid,
@@ -1655,30 +1727,31 @@ var DropdownSelector = ({
1655
1727
  };
1656
1728
  var DropdownSelector_default = DropdownSelector;
1657
1729
  var DropdownSelectorItem = Item;
1658
- var DropdownSelectorRoot = styled14.div`
1730
+ var DropdownSelectorRoot = styled18.div`
1659
1731
  position: relative;
1660
1732
  display: inline-block;
1733
+ width: 100%;
1661
1734
 
1662
1735
  ${disabledSelector4} {
1663
1736
  cursor: default;
1664
1737
  ${theme((o) => o.disabled)}
1665
1738
  }
1666
1739
  `;
1667
- var DropdownFieldLabel = styled14(FieldLabel_default)`
1740
+ var DropdownFieldLabel = styled18(FieldLabel_default)`
1668
1741
  width: 100%;
1669
1742
 
1670
1743
  ${theme((o) => o.margin.bottom(8))}
1671
1744
  `;
1672
- var DropdownButtonWrapper = styled14.div`
1745
+ var DropdownButtonWrapper = styled18.div`
1673
1746
  position: relative;
1674
1747
  `;
1675
- var DropdownButton = styled14.button`
1748
+ var DropdownButton = styled18.button`
1676
1749
  display: flex;
1677
1750
  justify-content: space-between;
1678
1751
  align-items: center;
1679
1752
 
1680
1753
  height: 40px;
1681
- width: 288px;
1754
+ width: 100%;
1682
1755
  box-sizing: border-box;
1683
1756
  cursor: pointer;
1684
1757
 
@@ -1695,47 +1768,40 @@ var DropdownButton = styled14.button`
1695
1768
  invalid && o.outline.assertive
1696
1769
  ])}
1697
1770
  `;
1698
- var DropdownButtonText = styled14.span`
1771
+ var DropdownButtonText = styled18.span`
1699
1772
  text-align: left;
1700
1773
 
1701
1774
  ${theme((o) => [o.typography(14), o.font.text2])}
1702
1775
  `;
1703
- var DropdownButtonIcon = styled14(Icon_default)`
1776
+ var DropdownButtonIcon = styled18(Icon_default)`
1704
1777
  ${theme((o) => [o.font.text2])}
1705
1778
  `;
1706
- var AssertiveText = styled14.div`
1779
+ var AssertiveText = styled18.div`
1707
1780
  ${({ invalid }) => theme((o) => [
1708
1781
  o.typography(14),
1709
1782
  o.margin.top(8),
1710
1783
  invalid ? o.font.assertive : o.font.text2
1711
1784
  ])}
1712
1785
  `;
1713
- var DropdownPopover = styled14(Popover_default)`
1714
- position: absolute;
1715
- width: 100%;
1716
-
1717
- top: 100%;
1718
- margin-top: 2px;
1719
- `;
1720
1786
 
1721
1787
  // src/components/SegmentedControl/index.tsx
1722
- import React19, { forwardRef, memo as memo3, useMemo as useMemo5, useRef as useRef8 } from "react";
1788
+ import React21, { forwardRef, memo as memo2, useMemo as useMemo4, useRef as useRef9 } from "react";
1723
1789
  import { useRadioGroupState } from "react-stately";
1724
1790
  import {
1725
1791
  useRadio,
1726
1792
  useRadioGroup
1727
1793
  } from "@react-aria/radio";
1728
- import styled15 from "styled-components";
1794
+ import styled19 from "styled-components";
1729
1795
  import { disabledSelector as disabledSelector5 } from "@charcoal-ui/utils";
1730
1796
 
1731
1797
  // src/components/SegmentedControl/RadioGroupContext.tsx
1732
- import React18, { createContext as createContext2, useContext as useContext5 } from "react";
1798
+ import React20, { createContext as createContext2, useContext as useContext5 } from "react";
1733
1799
  var RadioContext = createContext2(null);
1734
1800
  var RadioProvider = ({
1735
1801
  value,
1736
1802
  children
1737
1803
  }) => {
1738
- return /* @__PURE__ */ React18.createElement(RadioContext.Provider, { value }, children);
1804
+ return /* @__PURE__ */ React20.createElement(RadioContext.Provider, { value }, children);
1739
1805
  };
1740
1806
  var useRadioContext = () => {
1741
1807
  const state = useContext5(RadioContext);
@@ -1747,7 +1813,7 @@ var useRadioContext = () => {
1747
1813
  // src/components/SegmentedControl/index.tsx
1748
1814
  var SegmentedControl = forwardRef(
1749
1815
  function SegmentedControlInner(props, ref) {
1750
- const ariaRadioGroupProps = useMemo5(
1816
+ const ariaRadioGroupProps = useMemo4(
1751
1817
  () => ({
1752
1818
  ...props,
1753
1819
  isDisabled: props.disabled,
@@ -1758,12 +1824,12 @@ var SegmentedControl = forwardRef(
1758
1824
  );
1759
1825
  const state = useRadioGroupState(ariaRadioGroupProps);
1760
1826
  const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state);
1761
- const segmentedControlItems = useMemo5(() => {
1827
+ const segmentedControlItems = useMemo4(() => {
1762
1828
  return props.data.map(
1763
1829
  (d) => typeof d === "string" ? { value: d, label: d } : d
1764
1830
  );
1765
1831
  }, [props.data]);
1766
- return /* @__PURE__ */ React19.createElement(SegmentedControlRoot, { ref, ...radioGroupProps }, /* @__PURE__ */ React19.createElement(RadioProvider, { value: state }, segmentedControlItems.map((item) => /* @__PURE__ */ React19.createElement(
1832
+ return /* @__PURE__ */ React21.createElement(SegmentedControlRoot, { ref, ...radioGroupProps }, /* @__PURE__ */ React21.createElement(RadioProvider, { value: state }, segmentedControlItems.map((item) => /* @__PURE__ */ React21.createElement(
1767
1833
  Segmented,
1768
1834
  {
1769
1835
  key: item.value,
@@ -1774,11 +1840,11 @@ var SegmentedControl = forwardRef(
1774
1840
  ))));
1775
1841
  }
1776
1842
  );
1777
- var SegmentedControl_default = memo3(SegmentedControl);
1843
+ var SegmentedControl_default = memo2(SegmentedControl);
1778
1844
  var Segmented = ({ children, ...props }) => {
1779
1845
  const state = useRadioContext();
1780
- const ref = useRef8(null);
1781
- const ariaRadioProps = useMemo5(
1846
+ const ref = useRef9(null);
1847
+ const ariaRadioProps = useMemo4(
1782
1848
  () => ({ ...props, isDisabled: props.disabled }),
1783
1849
  [props]
1784
1850
  );
@@ -1787,23 +1853,23 @@ var Segmented = ({ children, ...props }) => {
1787
1853
  state,
1788
1854
  ref
1789
1855
  );
1790
- return /* @__PURE__ */ React19.createElement(
1856
+ return /* @__PURE__ */ React21.createElement(
1791
1857
  SegmentedRoot,
1792
1858
  {
1793
1859
  "aria-disabled": isDisabled || state.isReadOnly,
1794
1860
  checked: isSelected
1795
1861
  },
1796
- /* @__PURE__ */ React19.createElement(SegmentedInput, { ...inputProps, ref }),
1797
- /* @__PURE__ */ React19.createElement(RadioLabel2, null, /* @__PURE__ */ React19.createElement(SegmentedLabelInner, null, children))
1862
+ /* @__PURE__ */ React21.createElement(SegmentedInput, { ...inputProps, ref }),
1863
+ /* @__PURE__ */ React21.createElement(RadioLabel2, null, /* @__PURE__ */ React21.createElement(SegmentedLabelInner, null, children))
1798
1864
  );
1799
1865
  };
1800
- var SegmentedControlRoot = styled15.div`
1866
+ var SegmentedControlRoot = styled19.div`
1801
1867
  display: inline-flex;
1802
1868
  align-items: center;
1803
1869
 
1804
1870
  ${theme((o) => [o.bg.surface3, o.borderRadius(16)])}
1805
1871
  `;
1806
- var SegmentedRoot = styled15.label`
1872
+ var SegmentedRoot = styled19.label`
1807
1873
  position: relative;
1808
1874
  display: flex;
1809
1875
  align-items: center;
@@ -1822,7 +1888,7 @@ var SegmentedRoot = styled15.label`
1822
1888
  checked === true ? o.font.text5 : o.font.text2
1823
1889
  ])}
1824
1890
  `;
1825
- var SegmentedInput = styled15.input`
1891
+ var SegmentedInput = styled19.input`
1826
1892
  position: absolute;
1827
1893
 
1828
1894
  height: 0px;
@@ -1836,26 +1902,26 @@ var SegmentedInput = styled15.input`
1836
1902
  white-space: nowrap;
1837
1903
  opacity: 0;
1838
1904
  `;
1839
- var RadioLabel2 = styled15.div`
1905
+ var RadioLabel2 = styled19.div`
1840
1906
  background: transparent;
1841
1907
  display: flex;
1842
1908
  align-items: center;
1843
1909
  height: 22px;
1844
1910
  `;
1845
- var SegmentedLabelInner = styled15.div`
1911
+ var SegmentedLabelInner = styled19.div`
1846
1912
  ${theme((o) => [o.typography(14)])}
1847
1913
  `;
1848
1914
 
1849
1915
  // src/components/Checkbox/index.tsx
1850
- import React20, { forwardRef as forwardRef2, memo as memo4, useMemo as useMemo6 } from "react";
1851
- import styled16, { css as css6 } from "styled-components";
1916
+ import React22, { forwardRef as forwardRef2, memo as memo3, useMemo as useMemo5 } from "react";
1917
+ import styled20, { css as css6 } from "styled-components";
1852
1918
  import { useCheckbox } from "@react-aria/checkbox";
1853
1919
  import { useObjectRef } from "@react-aria/utils";
1854
1920
  import { useToggleState as useToggleState2 } from "react-stately";
1855
1921
  import { disabledSelector as disabledSelector6, px as px4 } from "@charcoal-ui/utils";
1856
1922
  var Checkbox = forwardRef2(
1857
1923
  function CheckboxInner(props, ref) {
1858
- const ariaCheckboxProps = useMemo6(
1924
+ const ariaCheckboxProps = useMemo5(
1859
1925
  () => ({
1860
1926
  ...props,
1861
1927
  isSelected: props.checked,
@@ -1869,14 +1935,14 @@ var Checkbox = forwardRef2(
1869
1935
  const objectRef = useObjectRef(ref);
1870
1936
  const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef);
1871
1937
  const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
1872
- return /* @__PURE__ */ React20.createElement(InputRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React20.createElement(CheckboxRoot, null, /* @__PURE__ */ React20.createElement(CheckboxInput, { type: "checkbox", ...inputProps }), /* @__PURE__ */ React20.createElement(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked }, /* @__PURE__ */ React20.createElement(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }))), "children" in props && /* @__PURE__ */ React20.createElement(InputLabel, null, props.children));
1938
+ return /* @__PURE__ */ React22.createElement(InputRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React22.createElement(CheckboxRoot, null, /* @__PURE__ */ React22.createElement(CheckboxInput, { type: "checkbox", ...inputProps }), /* @__PURE__ */ React22.createElement(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked }, /* @__PURE__ */ React22.createElement(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }))), "children" in props && /* @__PURE__ */ React22.createElement(InputLabel, null, props.children));
1873
1939
  }
1874
1940
  );
1875
- var Checkbox_default = memo4(Checkbox);
1941
+ var Checkbox_default = memo3(Checkbox);
1876
1942
  var hiddenCss = css6`
1877
1943
  visibility: hidden;
1878
1944
  `;
1879
- var InputRoot = styled16.label`
1945
+ var InputRoot = styled20.label`
1880
1946
  position: relative;
1881
1947
  display: flex;
1882
1948
 
@@ -1888,10 +1954,10 @@ var InputRoot = styled16.label`
1888
1954
  gap: ${({ theme: theme4 }) => px4(theme4.spacing[4])};
1889
1955
  ${theme((o) => [o.disabled])}
1890
1956
  `;
1891
- var CheckboxRoot = styled16.div`
1957
+ var CheckboxRoot = styled20.div`
1892
1958
  position: relative;
1893
1959
  `;
1894
- var CheckboxInput = styled16.input`
1960
+ var CheckboxInput = styled20.input`
1895
1961
  &[type='checkbox'] {
1896
1962
  appearance: none;
1897
1963
  display: block;
@@ -1911,7 +1977,7 @@ var CheckboxInput = styled16.input`
1911
1977
  ${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
1912
1978
  }
1913
1979
  `;
1914
- var CheckboxInputOverlay = styled16.div`
1980
+ var CheckboxInputOverlay = styled20.div`
1915
1981
  position: absolute;
1916
1982
  top: -2px;
1917
1983
  left: -2px;
@@ -1924,7 +1990,7 @@ var CheckboxInputOverlay = styled16.div`
1924
1990
 
1925
1991
  ${({ checked }) => checked !== true && hiddenCss};
1926
1992
  `;
1927
- var InputLabel = styled16.div`
1993
+ var InputLabel = styled20.div`
1928
1994
  ${theme((o) => [o.font.text2])}
1929
1995
 
1930
1996
  font-size: 14px;
@@ -1933,13 +1999,13 @@ var InputLabel = styled16.div`
1933
1999
  `;
1934
2000
 
1935
2001
  // src/components/TagItem/index.tsx
1936
- import React21, {
2002
+ import React23, {
1937
2003
  forwardRef as forwardRef3,
1938
- memo as memo5,
1939
- useMemo as useMemo7
2004
+ memo as memo4,
2005
+ useMemo as useMemo6
1940
2006
  } from "react";
1941
2007
  import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
1942
- import styled17, { css as css7 } from "styled-components";
2008
+ import styled21, { css as css7 } from "styled-components";
1943
2009
  import { disabledSelector as disabledSelector7, px as px5 } from "@charcoal-ui/utils";
1944
2010
  import { useButton as useButton2 } from "@react-aria/button";
1945
2011
  var sizeMap = {
@@ -1958,7 +2024,7 @@ var TagItem = forwardRef3(
1958
2024
  ...props
1959
2025
  }, _ref) {
1960
2026
  const ref = useObjectRef2(_ref);
1961
- const ariaButtonProps = useMemo7(
2027
+ const ariaButtonProps = useMemo6(
1962
2028
  () => ({
1963
2029
  elementType: "a",
1964
2030
  isDisabled: disabled,
@@ -1968,7 +2034,7 @@ var TagItem = forwardRef3(
1968
2034
  );
1969
2035
  const { buttonProps } = useButton2(ariaButtonProps, ref);
1970
2036
  const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
1971
- return /* @__PURE__ */ React21.createElement(
2037
+ return /* @__PURE__ */ React23.createElement(
1972
2038
  TagItemRoot,
1973
2039
  {
1974
2040
  ref,
@@ -1976,13 +2042,13 @@ var TagItem = forwardRef3(
1976
2042
  status,
1977
2043
  ...buttonProps
1978
2044
  },
1979
- /* @__PURE__ */ React21.createElement(Background, { bgColor, bgImage }),
1980
- /* @__PURE__ */ React21.createElement(Inner, null, /* @__PURE__ */ React21.createElement(LabelWrapper, { isTranslate: hasTranslatedLabel }, hasTranslatedLabel && /* @__PURE__ */ React21.createElement(TranslatedLabel, null, /* @__PURE__ */ React21.createElement(Label3, null, translatedLabel)), /* @__PURE__ */ React21.createElement(Label3, null, label)), status === "active" && /* @__PURE__ */ React21.createElement(Icon_default, { name: "16/Remove" }))
2045
+ /* @__PURE__ */ React23.createElement(Background, { bgColor, bgImage, status }),
2046
+ /* @__PURE__ */ React23.createElement(Inner, null, /* @__PURE__ */ React23.createElement(LabelWrapper, { isTranslate: hasTranslatedLabel }, hasTranslatedLabel && /* @__PURE__ */ React23.createElement(TranslatedLabel, null, /* @__PURE__ */ React23.createElement(Label3, null, translatedLabel)), /* @__PURE__ */ React23.createElement(Label3, null, label)), status === "active" && /* @__PURE__ */ React23.createElement(Icon_default, { name: "16/Remove" }))
1981
2047
  );
1982
2048
  }
1983
2049
  );
1984
- var TagItem_default = memo5(TagItem);
1985
- var TagItemRoot = styled17.a`
2050
+ var TagItem_default = memo4(TagItem);
2051
+ var TagItemRoot = styled21.a`
1986
2052
  isolation: isolate;
1987
2053
  position: relative;
1988
2054
  height: ${({ size }) => sizeMap[size]}px;
@@ -1998,7 +2064,6 @@ var TagItemRoot = styled17.a`
1998
2064
  o.borderRadius(4),
1999
2065
  status !== "active" && size === "M" && o.padding.horizontal(24),
2000
2066
  status !== "active" && size === "S" && o.padding.horizontal(16),
2001
- status === "inactive" && o.bg.surface3,
2002
2067
  status === "inactive" ? o.font.text2 : o.font.text5,
2003
2068
  ...status === "active" ? [o.padding.left(16), o.padding.right(8)] : []
2004
2069
  ])}
@@ -2008,7 +2073,7 @@ var TagItemRoot = styled17.a`
2008
2073
  cursor: default;
2009
2074
  }
2010
2075
  `;
2011
- var Background = styled17.div`
2076
+ var Background = styled21.div`
2012
2077
  position: absolute;
2013
2078
  z-index: 1;
2014
2079
  top: 0;
@@ -2017,6 +2082,7 @@ var Background = styled17.div`
2017
2082
  height: 100%;
2018
2083
 
2019
2084
  background-color: ${({ bgColor }) => bgColor};
2085
+ ${({ status }) => status === "inactive" && theme((o) => o.bg.surface3)}
2020
2086
 
2021
2087
  ${({ bgImage }) => bgImage !== void 0 && css7`
2022
2088
  ${theme((o) => [o.bg.surface4])}
@@ -2034,7 +2100,7 @@ var Background = styled17.div`
2034
2100
  }
2035
2101
  `}
2036
2102
  `;
2037
- var Inner = styled17.div`
2103
+ var Inner = styled21.div`
2038
2104
  display: inline-flex;
2039
2105
  gap: ${({ theme: theme4 }) => px5(theme4.spacing[8])};
2040
2106
  align-items: center;
@@ -2049,10 +2115,10 @@ var translateLabelCSS = css7`
2049
2115
  flex-direction: column;
2050
2116
  font-size: 10px;
2051
2117
  `;
2052
- var LabelWrapper = styled17.div`
2118
+ var LabelWrapper = styled21.div`
2053
2119
  ${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
2054
2120
  `;
2055
- var Label3 = styled17.span`
2121
+ var Label3 = styled21.span`
2056
2122
  max-width: 152px;
2057
2123
  overflow: hidden;
2058
2124
  text-overflow: ellipsis;
@@ -2061,7 +2127,7 @@ var Label3 = styled17.span`
2061
2127
  color: inherit;
2062
2128
  line-height: inherit;
2063
2129
  `;
2064
- var TranslatedLabel = styled17.div`
2130
+ var TranslatedLabel = styled21.div`
2065
2131
  ${theme((o) => [o.typography(12).bold])}
2066
2132
  `;
2067
2133
  export {
@@ -2093,4 +2159,4 @@ export {
2093
2159
  TextField_default as TextField,
2094
2160
  useComponentAbstraction
2095
2161
  };
2096
- //# sourceMappingURL=index.js.map
2162
+ //# sourceMappingURL=index.esm.js.map