@charcoal-ui/react 2.3.0 → 2.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/DropdownSelector/DropdownPopover.d.ts +13 -0
- package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -0
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.story.d.ts +3 -0
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/{index.cjs → index.cjs.js} +139 -117
- package/dist/index.cjs.js.map +1 -0
- package/dist/{index.js → index.esm.js} +109 -87
- package/dist/index.esm.js.map +1 -0
- package/package.json +23 -24
- package/src/components/DropdownSelector/DropdownPopover.tsx +72 -0
- package/src/components/DropdownSelector/Listbox.tsx +15 -13
- package/src/components/DropdownSelector/index.story.tsx +123 -45
- package/src/components/DropdownSelector/index.tsx +8 -11
- package/dist/components/DropdownSelector/Popover.d.ts +0 -10
- package/dist/components/DropdownSelector/Popover.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- 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
|
|
1463
|
-
import
|
|
1462
|
+
import React17, { useMemo as useMemo3, useRef as useRef7 } from "react";
|
|
1463
|
+
import styled15 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";
|
|
@@ -1469,7 +1469,7 @@ import { useButton } from "@react-aria/button";
|
|
|
1469
1469
|
|
|
1470
1470
|
// src/components/DropdownSelector/Listbox.tsx
|
|
1471
1471
|
import React15, { memo, useRef as useRef5, Fragment, useMemo as useMemo2 } from "react";
|
|
1472
|
-
import styled13
|
|
1472
|
+
import styled13 from "styled-components";
|
|
1473
1473
|
import { useListBox, useOption } from "@react-aria/listbox";
|
|
1474
1474
|
import { mergeProps } from "@react-aria/utils";
|
|
1475
1475
|
import { useFocusRing } from "@react-aria/focus";
|
|
@@ -1497,6 +1497,8 @@ var ListboxRoot = styled13.ul`
|
|
|
1497
1497
|
margin: 0;
|
|
1498
1498
|
box-sizing: border-box;
|
|
1499
1499
|
list-style: none;
|
|
1500
|
+
overflow: auto;
|
|
1501
|
+
max-height: inherit;
|
|
1500
1502
|
|
|
1501
1503
|
${theme((o) => [
|
|
1502
1504
|
o.bg.background1,
|
|
@@ -1521,7 +1523,7 @@ var Option = ({ item, state, mode }) => {
|
|
|
1521
1523
|
const ref = useRef5(null);
|
|
1522
1524
|
const { optionProps, isSelected } = useOption(item, state, ref);
|
|
1523
1525
|
const { focusProps } = useFocusRing();
|
|
1524
|
-
return /* @__PURE__ */ React15.createElement(OptionRoot, { ...mergeProps(optionProps, focusProps), ref, mode }, /* @__PURE__ */ React15.createElement(OptionCheckIcon, { name: "16/Check"
|
|
1526
|
+
return /* @__PURE__ */ React15.createElement(OptionRoot, { ...mergeProps(optionProps, focusProps), ref, mode }, isSelected && /* @__PURE__ */ React15.createElement(OptionCheckIcon, { name: "16/Check" }), /* @__PURE__ */ React15.createElement(OptionText, { isSelected }, item.rendered));
|
|
1525
1527
|
};
|
|
1526
1528
|
var OptionRoot = styled13.li`
|
|
1527
1529
|
display: flex;
|
|
@@ -1541,44 +1543,62 @@ var OptionRoot = styled13.li`
|
|
|
1541
1543
|
}
|
|
1542
1544
|
`;
|
|
1543
1545
|
var OptionCheckIcon = styled13(Icon_default)`
|
|
1544
|
-
visibility: hidden;
|
|
1545
1546
|
${theme((o) => [o.font.text2])}
|
|
1546
|
-
|
|
1547
|
-
${({ isSelected }) => isSelected && css5`
|
|
1548
|
-
visibility: visible;
|
|
1549
|
-
`}
|
|
1550
1547
|
`;
|
|
1551
1548
|
var OptionText = styled13.span`
|
|
1552
1549
|
display: block;
|
|
1553
|
-
${theme((o) => [
|
|
1550
|
+
${({ isSelected }) => theme((o) => [
|
|
1551
|
+
o.typography(14),
|
|
1552
|
+
o.font.text2,
|
|
1553
|
+
isSelected ? void 0 : o.margin.left(16),
|
|
1554
|
+
isSelected ? void 0 : o.padding.left(4)
|
|
1555
|
+
])}
|
|
1554
1556
|
`;
|
|
1555
1557
|
|
|
1556
|
-
// src/components/DropdownSelector/
|
|
1557
|
-
import {
|
|
1558
|
-
import {
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1558
|
+
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1559
|
+
import React16, { useEffect as useEffect2, useRef as useRef6 } from "react";
|
|
1560
|
+
import {
|
|
1561
|
+
DismissButton,
|
|
1562
|
+
Overlay as Overlay2,
|
|
1563
|
+
usePopover
|
|
1564
|
+
} from "@react-aria/overlays";
|
|
1565
|
+
import styled14 from "styled-components";
|
|
1566
|
+
var DropdownPopoverDiv = styled14.div`
|
|
1567
|
+
width: 100%;
|
|
1568
|
+
${theme((o) => o.margin.top(4).bottom(4))}
|
|
1569
|
+
`;
|
|
1570
|
+
function DropdownPopover({ children, state, ...props }) {
|
|
1566
1571
|
const ref = useRef6(null);
|
|
1567
|
-
const {
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
}),
|
|
1575
|
-
[onClose, open]
|
|
1576
|
-
),
|
|
1577
|
-
ref
|
|
1572
|
+
const { popoverProps, underlayProps } = usePopover(
|
|
1573
|
+
{
|
|
1574
|
+
...props,
|
|
1575
|
+
popoverRef: ref,
|
|
1576
|
+
containerPadding: 0
|
|
1577
|
+
},
|
|
1578
|
+
state
|
|
1578
1579
|
);
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1580
|
+
useEffect2(() => {
|
|
1581
|
+
if (ref.current && props.triggerRef.current) {
|
|
1582
|
+
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1583
|
+
}
|
|
1584
|
+
}, [props.triggerRef]);
|
|
1585
|
+
useEffect2(() => {
|
|
1586
|
+
if (state.isOpen && props.value !== void 0) {
|
|
1587
|
+
window.requestAnimationFrame(() => {
|
|
1588
|
+
if (props.value === void 0)
|
|
1589
|
+
return;
|
|
1590
|
+
const windowScrollY = window.scrollY;
|
|
1591
|
+
const windowScrollX = window.scrollX;
|
|
1592
|
+
const selectedElement = document.querySelector(
|
|
1593
|
+
`[data-key="${props.value.toString()}"]`
|
|
1594
|
+
);
|
|
1595
|
+
selectedElement?.scrollIntoView({ block: "center" });
|
|
1596
|
+
window.scrollTo(windowScrollX, windowScrollY);
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
}, [props.value, state.isOpen]);
|
|
1600
|
+
return /* @__PURE__ */ React16.createElement(Overlay2, null, /* @__PURE__ */ React16.createElement("div", { ...underlayProps, style: { position: "fixed", inset: 0 } }), /* @__PURE__ */ React16.createElement(DropdownPopoverDiv, { ...popoverProps, ref }, /* @__PURE__ */ React16.createElement(DismissButton, { onDismiss: () => state.close() }), children, /* @__PURE__ */ React16.createElement(DismissButton, { onDismiss: () => state.close() })));
|
|
1601
|
+
}
|
|
1582
1602
|
|
|
1583
1603
|
// src/components/DropdownSelector/index.tsx
|
|
1584
1604
|
var DropdownSelector = ({
|
|
@@ -1598,7 +1618,7 @@ var DropdownSelector = ({
|
|
|
1598
1618
|
}) => {
|
|
1599
1619
|
const { visuallyHiddenProps } = useVisuallyHidden2();
|
|
1600
1620
|
const triggerRef = useRef7(null);
|
|
1601
|
-
const selectProps =
|
|
1621
|
+
const selectProps = useMemo3(
|
|
1602
1622
|
() => ({
|
|
1603
1623
|
...props,
|
|
1604
1624
|
label,
|
|
@@ -1644,7 +1664,15 @@ var DropdownSelector = ({
|
|
|
1644
1664
|
isDisabled: disabled,
|
|
1645
1665
|
autoComplete
|
|
1646
1666
|
}
|
|
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(
|
|
1667
|
+
), /* @__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(
|
|
1668
|
+
DropdownPopover,
|
|
1669
|
+
{
|
|
1670
|
+
state,
|
|
1671
|
+
triggerRef,
|
|
1672
|
+
value: props.value ?? props.defaultValue
|
|
1673
|
+
},
|
|
1674
|
+
/* @__PURE__ */ React17.createElement(Listbox_default, { ...menuProps, state, mode })
|
|
1675
|
+
)), hasAssertiveText && /* @__PURE__ */ React17.createElement(
|
|
1648
1676
|
AssertiveText,
|
|
1649
1677
|
{
|
|
1650
1678
|
invalid,
|
|
@@ -1655,30 +1683,31 @@ var DropdownSelector = ({
|
|
|
1655
1683
|
};
|
|
1656
1684
|
var DropdownSelector_default = DropdownSelector;
|
|
1657
1685
|
var DropdownSelectorItem = Item;
|
|
1658
|
-
var DropdownSelectorRoot =
|
|
1686
|
+
var DropdownSelectorRoot = styled15.div`
|
|
1659
1687
|
position: relative;
|
|
1660
1688
|
display: inline-block;
|
|
1689
|
+
width: 100%;
|
|
1661
1690
|
|
|
1662
1691
|
${disabledSelector4} {
|
|
1663
1692
|
cursor: default;
|
|
1664
1693
|
${theme((o) => o.disabled)}
|
|
1665
1694
|
}
|
|
1666
1695
|
`;
|
|
1667
|
-
var DropdownFieldLabel =
|
|
1696
|
+
var DropdownFieldLabel = styled15(FieldLabel_default)`
|
|
1668
1697
|
width: 100%;
|
|
1669
1698
|
|
|
1670
1699
|
${theme((o) => o.margin.bottom(8))}
|
|
1671
1700
|
`;
|
|
1672
|
-
var DropdownButtonWrapper =
|
|
1701
|
+
var DropdownButtonWrapper = styled15.div`
|
|
1673
1702
|
position: relative;
|
|
1674
1703
|
`;
|
|
1675
|
-
var DropdownButton =
|
|
1704
|
+
var DropdownButton = styled15.button`
|
|
1676
1705
|
display: flex;
|
|
1677
1706
|
justify-content: space-between;
|
|
1678
1707
|
align-items: center;
|
|
1679
1708
|
|
|
1680
1709
|
height: 40px;
|
|
1681
|
-
width:
|
|
1710
|
+
width: 100%;
|
|
1682
1711
|
box-sizing: border-box;
|
|
1683
1712
|
cursor: pointer;
|
|
1684
1713
|
|
|
@@ -1695,37 +1724,30 @@ var DropdownButton = styled14.button`
|
|
|
1695
1724
|
invalid && o.outline.assertive
|
|
1696
1725
|
])}
|
|
1697
1726
|
`;
|
|
1698
|
-
var DropdownButtonText =
|
|
1727
|
+
var DropdownButtonText = styled15.span`
|
|
1699
1728
|
text-align: left;
|
|
1700
1729
|
|
|
1701
1730
|
${theme((o) => [o.typography(14), o.font.text2])}
|
|
1702
1731
|
`;
|
|
1703
|
-
var DropdownButtonIcon =
|
|
1732
|
+
var DropdownButtonIcon = styled15(Icon_default)`
|
|
1704
1733
|
${theme((o) => [o.font.text2])}
|
|
1705
1734
|
`;
|
|
1706
|
-
var AssertiveText =
|
|
1735
|
+
var AssertiveText = styled15.div`
|
|
1707
1736
|
${({ invalid }) => theme((o) => [
|
|
1708
1737
|
o.typography(14),
|
|
1709
1738
|
o.margin.top(8),
|
|
1710
1739
|
invalid ? o.font.assertive : o.font.text2
|
|
1711
1740
|
])}
|
|
1712
1741
|
`;
|
|
1713
|
-
var DropdownPopover = styled14(Popover_default)`
|
|
1714
|
-
position: absolute;
|
|
1715
|
-
width: 100%;
|
|
1716
|
-
|
|
1717
|
-
top: 100%;
|
|
1718
|
-
margin-top: 2px;
|
|
1719
|
-
`;
|
|
1720
1742
|
|
|
1721
1743
|
// src/components/SegmentedControl/index.tsx
|
|
1722
|
-
import React19, { forwardRef, memo as
|
|
1744
|
+
import React19, { forwardRef, memo as memo2, useMemo as useMemo4, useRef as useRef8 } from "react";
|
|
1723
1745
|
import { useRadioGroupState } from "react-stately";
|
|
1724
1746
|
import {
|
|
1725
1747
|
useRadio,
|
|
1726
1748
|
useRadioGroup
|
|
1727
1749
|
} from "@react-aria/radio";
|
|
1728
|
-
import
|
|
1750
|
+
import styled16 from "styled-components";
|
|
1729
1751
|
import { disabledSelector as disabledSelector5 } from "@charcoal-ui/utils";
|
|
1730
1752
|
|
|
1731
1753
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
@@ -1747,7 +1769,7 @@ var useRadioContext = () => {
|
|
|
1747
1769
|
// src/components/SegmentedControl/index.tsx
|
|
1748
1770
|
var SegmentedControl = forwardRef(
|
|
1749
1771
|
function SegmentedControlInner(props, ref) {
|
|
1750
|
-
const ariaRadioGroupProps =
|
|
1772
|
+
const ariaRadioGroupProps = useMemo4(
|
|
1751
1773
|
() => ({
|
|
1752
1774
|
...props,
|
|
1753
1775
|
isDisabled: props.disabled,
|
|
@@ -1758,7 +1780,7 @@ var SegmentedControl = forwardRef(
|
|
|
1758
1780
|
);
|
|
1759
1781
|
const state = useRadioGroupState(ariaRadioGroupProps);
|
|
1760
1782
|
const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state);
|
|
1761
|
-
const segmentedControlItems =
|
|
1783
|
+
const segmentedControlItems = useMemo4(() => {
|
|
1762
1784
|
return props.data.map(
|
|
1763
1785
|
(d) => typeof d === "string" ? { value: d, label: d } : d
|
|
1764
1786
|
);
|
|
@@ -1774,11 +1796,11 @@ var SegmentedControl = forwardRef(
|
|
|
1774
1796
|
))));
|
|
1775
1797
|
}
|
|
1776
1798
|
);
|
|
1777
|
-
var SegmentedControl_default =
|
|
1799
|
+
var SegmentedControl_default = memo2(SegmentedControl);
|
|
1778
1800
|
var Segmented = ({ children, ...props }) => {
|
|
1779
1801
|
const state = useRadioContext();
|
|
1780
1802
|
const ref = useRef8(null);
|
|
1781
|
-
const ariaRadioProps =
|
|
1803
|
+
const ariaRadioProps = useMemo4(
|
|
1782
1804
|
() => ({ ...props, isDisabled: props.disabled }),
|
|
1783
1805
|
[props]
|
|
1784
1806
|
);
|
|
@@ -1797,13 +1819,13 @@ var Segmented = ({ children, ...props }) => {
|
|
|
1797
1819
|
/* @__PURE__ */ React19.createElement(RadioLabel2, null, /* @__PURE__ */ React19.createElement(SegmentedLabelInner, null, children))
|
|
1798
1820
|
);
|
|
1799
1821
|
};
|
|
1800
|
-
var SegmentedControlRoot =
|
|
1822
|
+
var SegmentedControlRoot = styled16.div`
|
|
1801
1823
|
display: inline-flex;
|
|
1802
1824
|
align-items: center;
|
|
1803
1825
|
|
|
1804
1826
|
${theme((o) => [o.bg.surface3, o.borderRadius(16)])}
|
|
1805
1827
|
`;
|
|
1806
|
-
var SegmentedRoot =
|
|
1828
|
+
var SegmentedRoot = styled16.label`
|
|
1807
1829
|
position: relative;
|
|
1808
1830
|
display: flex;
|
|
1809
1831
|
align-items: center;
|
|
@@ -1822,7 +1844,7 @@ var SegmentedRoot = styled15.label`
|
|
|
1822
1844
|
checked === true ? o.font.text5 : o.font.text2
|
|
1823
1845
|
])}
|
|
1824
1846
|
`;
|
|
1825
|
-
var SegmentedInput =
|
|
1847
|
+
var SegmentedInput = styled16.input`
|
|
1826
1848
|
position: absolute;
|
|
1827
1849
|
|
|
1828
1850
|
height: 0px;
|
|
@@ -1836,26 +1858,26 @@ var SegmentedInput = styled15.input`
|
|
|
1836
1858
|
white-space: nowrap;
|
|
1837
1859
|
opacity: 0;
|
|
1838
1860
|
`;
|
|
1839
|
-
var RadioLabel2 =
|
|
1861
|
+
var RadioLabel2 = styled16.div`
|
|
1840
1862
|
background: transparent;
|
|
1841
1863
|
display: flex;
|
|
1842
1864
|
align-items: center;
|
|
1843
1865
|
height: 22px;
|
|
1844
1866
|
`;
|
|
1845
|
-
var SegmentedLabelInner =
|
|
1867
|
+
var SegmentedLabelInner = styled16.div`
|
|
1846
1868
|
${theme((o) => [o.typography(14)])}
|
|
1847
1869
|
`;
|
|
1848
1870
|
|
|
1849
1871
|
// src/components/Checkbox/index.tsx
|
|
1850
|
-
import React20, { forwardRef as forwardRef2, memo as
|
|
1851
|
-
import
|
|
1872
|
+
import React20, { forwardRef as forwardRef2, memo as memo3, useMemo as useMemo5 } from "react";
|
|
1873
|
+
import styled17, { css as css5 } from "styled-components";
|
|
1852
1874
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
1853
1875
|
import { useObjectRef } from "@react-aria/utils";
|
|
1854
1876
|
import { useToggleState as useToggleState2 } from "react-stately";
|
|
1855
1877
|
import { disabledSelector as disabledSelector6, px as px4 } from "@charcoal-ui/utils";
|
|
1856
1878
|
var Checkbox = forwardRef2(
|
|
1857
1879
|
function CheckboxInner(props, ref) {
|
|
1858
|
-
const ariaCheckboxProps =
|
|
1880
|
+
const ariaCheckboxProps = useMemo5(
|
|
1859
1881
|
() => ({
|
|
1860
1882
|
...props,
|
|
1861
1883
|
isSelected: props.checked,
|
|
@@ -1872,11 +1894,11 @@ var Checkbox = forwardRef2(
|
|
|
1872
1894
|
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));
|
|
1873
1895
|
}
|
|
1874
1896
|
);
|
|
1875
|
-
var Checkbox_default =
|
|
1876
|
-
var hiddenCss =
|
|
1897
|
+
var Checkbox_default = memo3(Checkbox);
|
|
1898
|
+
var hiddenCss = css5`
|
|
1877
1899
|
visibility: hidden;
|
|
1878
1900
|
`;
|
|
1879
|
-
var InputRoot =
|
|
1901
|
+
var InputRoot = styled17.label`
|
|
1880
1902
|
position: relative;
|
|
1881
1903
|
display: flex;
|
|
1882
1904
|
|
|
@@ -1888,10 +1910,10 @@ var InputRoot = styled16.label`
|
|
|
1888
1910
|
gap: ${({ theme: theme4 }) => px4(theme4.spacing[4])};
|
|
1889
1911
|
${theme((o) => [o.disabled])}
|
|
1890
1912
|
`;
|
|
1891
|
-
var CheckboxRoot =
|
|
1913
|
+
var CheckboxRoot = styled17.div`
|
|
1892
1914
|
position: relative;
|
|
1893
1915
|
`;
|
|
1894
|
-
var CheckboxInput =
|
|
1916
|
+
var CheckboxInput = styled17.input`
|
|
1895
1917
|
&[type='checkbox'] {
|
|
1896
1918
|
appearance: none;
|
|
1897
1919
|
display: block;
|
|
@@ -1911,7 +1933,7 @@ var CheckboxInput = styled16.input`
|
|
|
1911
1933
|
${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
|
|
1912
1934
|
}
|
|
1913
1935
|
`;
|
|
1914
|
-
var CheckboxInputOverlay =
|
|
1936
|
+
var CheckboxInputOverlay = styled17.div`
|
|
1915
1937
|
position: absolute;
|
|
1916
1938
|
top: -2px;
|
|
1917
1939
|
left: -2px;
|
|
@@ -1924,7 +1946,7 @@ var CheckboxInputOverlay = styled16.div`
|
|
|
1924
1946
|
|
|
1925
1947
|
${({ checked }) => checked !== true && hiddenCss};
|
|
1926
1948
|
`;
|
|
1927
|
-
var InputLabel =
|
|
1949
|
+
var InputLabel = styled17.div`
|
|
1928
1950
|
${theme((o) => [o.font.text2])}
|
|
1929
1951
|
|
|
1930
1952
|
font-size: 14px;
|
|
@@ -1935,11 +1957,11 @@ var InputLabel = styled16.div`
|
|
|
1935
1957
|
// src/components/TagItem/index.tsx
|
|
1936
1958
|
import React21, {
|
|
1937
1959
|
forwardRef as forwardRef3,
|
|
1938
|
-
memo as
|
|
1939
|
-
useMemo as
|
|
1960
|
+
memo as memo4,
|
|
1961
|
+
useMemo as useMemo6
|
|
1940
1962
|
} from "react";
|
|
1941
1963
|
import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
1942
|
-
import
|
|
1964
|
+
import styled18, { css as css6 } from "styled-components";
|
|
1943
1965
|
import { disabledSelector as disabledSelector7, px as px5 } from "@charcoal-ui/utils";
|
|
1944
1966
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
1945
1967
|
var sizeMap = {
|
|
@@ -1958,7 +1980,7 @@ var TagItem = forwardRef3(
|
|
|
1958
1980
|
...props
|
|
1959
1981
|
}, _ref) {
|
|
1960
1982
|
const ref = useObjectRef2(_ref);
|
|
1961
|
-
const ariaButtonProps =
|
|
1983
|
+
const ariaButtonProps = useMemo6(
|
|
1962
1984
|
() => ({
|
|
1963
1985
|
elementType: "a",
|
|
1964
1986
|
isDisabled: disabled,
|
|
@@ -1981,8 +2003,8 @@ var TagItem = forwardRef3(
|
|
|
1981
2003
|
);
|
|
1982
2004
|
}
|
|
1983
2005
|
);
|
|
1984
|
-
var TagItem_default =
|
|
1985
|
-
var TagItemRoot =
|
|
2006
|
+
var TagItem_default = memo4(TagItem);
|
|
2007
|
+
var TagItemRoot = styled18.a`
|
|
1986
2008
|
isolation: isolate;
|
|
1987
2009
|
position: relative;
|
|
1988
2010
|
height: ${({ size }) => sizeMap[size]}px;
|
|
@@ -2008,7 +2030,7 @@ var TagItemRoot = styled17.a`
|
|
|
2008
2030
|
cursor: default;
|
|
2009
2031
|
}
|
|
2010
2032
|
`;
|
|
2011
|
-
var Background =
|
|
2033
|
+
var Background = styled18.div`
|
|
2012
2034
|
position: absolute;
|
|
2013
2035
|
z-index: 1;
|
|
2014
2036
|
top: 0;
|
|
@@ -2018,7 +2040,7 @@ var Background = styled17.div`
|
|
|
2018
2040
|
|
|
2019
2041
|
background-color: ${({ bgColor }) => bgColor};
|
|
2020
2042
|
|
|
2021
|
-
${({ bgImage }) => bgImage !== void 0 &&
|
|
2043
|
+
${({ bgImage }) => bgImage !== void 0 && css6`
|
|
2022
2044
|
${theme((o) => [o.bg.surface4])}
|
|
2023
2045
|
&::before {
|
|
2024
2046
|
content: '';
|
|
@@ -2034,25 +2056,25 @@ var Background = styled17.div`
|
|
|
2034
2056
|
}
|
|
2035
2057
|
`}
|
|
2036
2058
|
`;
|
|
2037
|
-
var Inner =
|
|
2059
|
+
var Inner = styled18.div`
|
|
2038
2060
|
display: inline-flex;
|
|
2039
2061
|
gap: ${({ theme: theme4 }) => px5(theme4.spacing[8])};
|
|
2040
2062
|
align-items: center;
|
|
2041
2063
|
z-index: 2;
|
|
2042
2064
|
`;
|
|
2043
|
-
var labelCSS =
|
|
2065
|
+
var labelCSS = css6`
|
|
2044
2066
|
${theme((o) => [o.typography(14).bold])}
|
|
2045
2067
|
`;
|
|
2046
|
-
var translateLabelCSS =
|
|
2068
|
+
var translateLabelCSS = css6`
|
|
2047
2069
|
display: flex;
|
|
2048
2070
|
align-items: center;
|
|
2049
2071
|
flex-direction: column;
|
|
2050
2072
|
font-size: 10px;
|
|
2051
2073
|
`;
|
|
2052
|
-
var LabelWrapper =
|
|
2074
|
+
var LabelWrapper = styled18.div`
|
|
2053
2075
|
${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
|
|
2054
2076
|
`;
|
|
2055
|
-
var Label3 =
|
|
2077
|
+
var Label3 = styled18.span`
|
|
2056
2078
|
max-width: 152px;
|
|
2057
2079
|
overflow: hidden;
|
|
2058
2080
|
text-overflow: ellipsis;
|
|
@@ -2061,7 +2083,7 @@ var Label3 = styled17.span`
|
|
|
2061
2083
|
color: inherit;
|
|
2062
2084
|
line-height: inherit;
|
|
2063
2085
|
`;
|
|
2064
|
-
var TranslatedLabel =
|
|
2086
|
+
var TranslatedLabel = styled18.div`
|
|
2065
2087
|
${theme((o) => [o.typography(12).bold])}
|
|
2066
2088
|
`;
|
|
2067
2089
|
export {
|
|
@@ -2093,4 +2115,4 @@ export {
|
|
|
2093
2115
|
TextField_default as TextField,
|
|
2094
2116
|
useComponentAbstraction
|
|
2095
2117
|
};
|
|
2096
|
-
//# sourceMappingURL=index.js.map
|
|
2118
|
+
//# sourceMappingURL=index.esm.js.map
|