@locus-ui/components 0.0.15 → 0.0.16
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/index.css +84 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +146 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +314 -223
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -932,6 +932,44 @@ declare const Container: React$1.ForwardRefExoticComponent<{} & {
|
|
|
932
932
|
direction?: "row" | "column" | undefined;
|
|
933
933
|
} & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
934
934
|
|
|
935
|
+
interface FlexExternalProps extends MarginProps, PaddingProps, SpacingProp {
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* A versatile container used to provide layout and styling capabilities.
|
|
939
|
+
*/
|
|
940
|
+
declare const Flex: React$1.ForwardRefExoticComponent<GetPropDefTypes<{
|
|
941
|
+
readonly gap: {
|
|
942
|
+
type: "enum | string";
|
|
943
|
+
values: readonly ["0", "1", "2", "3", "4", "5", "6", "8"];
|
|
944
|
+
dataAttr: string;
|
|
945
|
+
responsive: true;
|
|
946
|
+
};
|
|
947
|
+
readonly justify: {
|
|
948
|
+
type: "enum";
|
|
949
|
+
values: readonly ["start", "end", "center", "between", "around", "evenly"];
|
|
950
|
+
dataAttr: string;
|
|
951
|
+
responsive: true;
|
|
952
|
+
};
|
|
953
|
+
readonly direction: {
|
|
954
|
+
type: "enum";
|
|
955
|
+
values: readonly ["row", "row-reverse", "column", "column-reverse"];
|
|
956
|
+
dataAttr: string;
|
|
957
|
+
responsive: true;
|
|
958
|
+
};
|
|
959
|
+
readonly align: {
|
|
960
|
+
type: "enum";
|
|
961
|
+
values: readonly ["start", "end", "center", "stretch", "baseline"];
|
|
962
|
+
dataAttr: string;
|
|
963
|
+
responsive: true;
|
|
964
|
+
};
|
|
965
|
+
readonly wrap: {
|
|
966
|
+
type: "enum";
|
|
967
|
+
values: readonly ["nowrap", "wrap", "wrap-reverse"];
|
|
968
|
+
dataAttr: string;
|
|
969
|
+
responsive: true;
|
|
970
|
+
};
|
|
971
|
+
}> & FlexExternalProps & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
972
|
+
|
|
935
973
|
interface PanelExternalProps extends MarginProps, PaddingProps, SpacingProp, RadiusProps, RoundnessProp, ColorProp {
|
|
936
974
|
}
|
|
937
975
|
/**
|
|
@@ -1483,4 +1521,4 @@ interface ThemeControlProps {
|
|
|
1483
1521
|
}
|
|
1484
1522
|
declare function ThemeControl({ position }: ThemeControlProps): react_jsx_runtime.JSX.Element;
|
|
1485
1523
|
|
|
1486
|
-
export { Accordion, Badge, Box, Button, Checkbox, Container, Panel, Portal, ProgressBar, Select, Separator, Switch, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };
|
|
1524
|
+
export { Accordion, Badge, Box, Button, Checkbox, Container, Flex, Panel, Portal, ProgressBar, Select, Separator, Switch, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -932,6 +932,44 @@ declare const Container: React$1.ForwardRefExoticComponent<{} & {
|
|
|
932
932
|
direction?: "row" | "column" | undefined;
|
|
933
933
|
} & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
934
934
|
|
|
935
|
+
interface FlexExternalProps extends MarginProps, PaddingProps, SpacingProp {
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* A versatile container used to provide layout and styling capabilities.
|
|
939
|
+
*/
|
|
940
|
+
declare const Flex: React$1.ForwardRefExoticComponent<GetPropDefTypes<{
|
|
941
|
+
readonly gap: {
|
|
942
|
+
type: "enum | string";
|
|
943
|
+
values: readonly ["0", "1", "2", "3", "4", "5", "6", "8"];
|
|
944
|
+
dataAttr: string;
|
|
945
|
+
responsive: true;
|
|
946
|
+
};
|
|
947
|
+
readonly justify: {
|
|
948
|
+
type: "enum";
|
|
949
|
+
values: readonly ["start", "end", "center", "between", "around", "evenly"];
|
|
950
|
+
dataAttr: string;
|
|
951
|
+
responsive: true;
|
|
952
|
+
};
|
|
953
|
+
readonly direction: {
|
|
954
|
+
type: "enum";
|
|
955
|
+
values: readonly ["row", "row-reverse", "column", "column-reverse"];
|
|
956
|
+
dataAttr: string;
|
|
957
|
+
responsive: true;
|
|
958
|
+
};
|
|
959
|
+
readonly align: {
|
|
960
|
+
type: "enum";
|
|
961
|
+
values: readonly ["start", "end", "center", "stretch", "baseline"];
|
|
962
|
+
dataAttr: string;
|
|
963
|
+
responsive: true;
|
|
964
|
+
};
|
|
965
|
+
readonly wrap: {
|
|
966
|
+
type: "enum";
|
|
967
|
+
values: readonly ["nowrap", "wrap", "wrap-reverse"];
|
|
968
|
+
dataAttr: string;
|
|
969
|
+
responsive: true;
|
|
970
|
+
};
|
|
971
|
+
}> & FlexExternalProps & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
972
|
+
|
|
935
973
|
interface PanelExternalProps extends MarginProps, PaddingProps, SpacingProp, RadiusProps, RoundnessProp, ColorProp {
|
|
936
974
|
}
|
|
937
975
|
/**
|
|
@@ -1483,4 +1521,4 @@ interface ThemeControlProps {
|
|
|
1483
1521
|
}
|
|
1484
1522
|
declare function ThemeControl({ position }: ThemeControlProps): react_jsx_runtime.JSX.Element;
|
|
1485
1523
|
|
|
1486
|
-
export { Accordion, Badge, Box, Button, Checkbox, Container, Panel, Portal, ProgressBar, Select, Separator, Switch, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };
|
|
1524
|
+
export { Accordion, Badge, Box, Button, Checkbox, Container, Flex, Panel, Portal, ProgressBar, Select, Separator, Switch, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -94,7 +94,7 @@ function getComponentProps(props, ...propDefs) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// src/components/accordion/accordion-context.ts
|
|
97
|
-
var _react = require('react'); var React2 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var
|
|
97
|
+
var _react = require('react'); var React2 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react); var React18 = _interopRequireWildcard(_react); var React16 = _interopRequireWildcard(_react); var React17 = _interopRequireWildcard(_react); var React20 = _interopRequireWildcard(_react); var React19 = _interopRequireWildcard(_react); var React26 = _interopRequireWildcard(_react); var React23 = _interopRequireWildcard(_react); var React24 = _interopRequireWildcard(_react); var React25 = _interopRequireWildcard(_react); var React27 = _interopRequireWildcard(_react); var React28 = _interopRequireWildcard(_react); var React29 = _interopRequireWildcard(_react); var React31 = _interopRequireWildcard(_react); var React30 = _interopRequireWildcard(_react); var React32 = _interopRequireWildcard(_react); var React37 = _interopRequireWildcard(_react);
|
|
98
98
|
var AccordionContext = React2.default.createContext(null);
|
|
99
99
|
function useAccordionContext() {
|
|
100
100
|
const context = React2.default.useContext(AccordionContext);
|
|
@@ -1671,6 +1671,96 @@ var Container = React11.forwardRef((props, ref) => {
|
|
|
1671
1671
|
});
|
|
1672
1672
|
Container.displayName = "Container";
|
|
1673
1673
|
|
|
1674
|
+
// src/components/flex/flex.tsx
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
// src/components/flex/flex.props.ts
|
|
1679
|
+
var FlexGapValues = ["0", "1", "2", "3", "4", "5", "6", "8"];
|
|
1680
|
+
var FlexDirectionValues = [
|
|
1681
|
+
"row",
|
|
1682
|
+
"row-reverse",
|
|
1683
|
+
"column",
|
|
1684
|
+
"column-reverse"
|
|
1685
|
+
];
|
|
1686
|
+
var FlexJustifyValues = [
|
|
1687
|
+
"start",
|
|
1688
|
+
"end",
|
|
1689
|
+
"center",
|
|
1690
|
+
"between",
|
|
1691
|
+
"around",
|
|
1692
|
+
"evenly"
|
|
1693
|
+
];
|
|
1694
|
+
var FlexAlignValues = [
|
|
1695
|
+
"start",
|
|
1696
|
+
"end",
|
|
1697
|
+
"center",
|
|
1698
|
+
"stretch",
|
|
1699
|
+
"baseline"
|
|
1700
|
+
];
|
|
1701
|
+
var FlexWrapValues = ["nowrap", "wrap", "wrap-reverse"];
|
|
1702
|
+
var FlexPropsDefs = {
|
|
1703
|
+
/**
|
|
1704
|
+
* Sets the gap between flex items.
|
|
1705
|
+
*/
|
|
1706
|
+
gap: {
|
|
1707
|
+
type: "enum | string",
|
|
1708
|
+
values: FlexGapValues,
|
|
1709
|
+
dataAttr: "gap",
|
|
1710
|
+
responsive: true
|
|
1711
|
+
},
|
|
1712
|
+
/**
|
|
1713
|
+
* Sets the justification of flex items along the main axis.
|
|
1714
|
+
*/
|
|
1715
|
+
justify: {
|
|
1716
|
+
type: "enum",
|
|
1717
|
+
values: FlexJustifyValues,
|
|
1718
|
+
dataAttr: "justify",
|
|
1719
|
+
responsive: true
|
|
1720
|
+
},
|
|
1721
|
+
/**
|
|
1722
|
+
* Sets the direction of flex items.
|
|
1723
|
+
*/
|
|
1724
|
+
direction: {
|
|
1725
|
+
type: "enum",
|
|
1726
|
+
values: FlexDirectionValues,
|
|
1727
|
+
dataAttr: "direction",
|
|
1728
|
+
responsive: true
|
|
1729
|
+
},
|
|
1730
|
+
/**
|
|
1731
|
+
* Sets the alignment of flex items along the cross axis.
|
|
1732
|
+
*/
|
|
1733
|
+
align: {
|
|
1734
|
+
type: "enum",
|
|
1735
|
+
values: FlexAlignValues,
|
|
1736
|
+
dataAttr: "align",
|
|
1737
|
+
responsive: true
|
|
1738
|
+
},
|
|
1739
|
+
/**
|
|
1740
|
+
* Sets the wrapping behavior of flex items.
|
|
1741
|
+
*/
|
|
1742
|
+
wrap: {
|
|
1743
|
+
type: "enum",
|
|
1744
|
+
values: FlexWrapValues,
|
|
1745
|
+
dataAttr: "wrap",
|
|
1746
|
+
responsive: true
|
|
1747
|
+
}
|
|
1748
|
+
};
|
|
1749
|
+
|
|
1750
|
+
// src/components/flex/flex.tsx
|
|
1751
|
+
|
|
1752
|
+
var Flex = React12.forwardRef((props, ref) => {
|
|
1753
|
+
const { className, dataAttrs, children, ...rest } = getComponentProps(
|
|
1754
|
+
props,
|
|
1755
|
+
FlexPropsDefs,
|
|
1756
|
+
MarginPropDefs,
|
|
1757
|
+
PaddingPropDefs,
|
|
1758
|
+
SpacingPropDef
|
|
1759
|
+
);
|
|
1760
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref, className: _clsx2.default.call(void 0, "flex", className), ...dataAttrs, ...rest, children });
|
|
1761
|
+
});
|
|
1762
|
+
Flex.displayName = "Flex";
|
|
1763
|
+
|
|
1674
1764
|
// src/components/panel/panel.tsx
|
|
1675
1765
|
|
|
1676
1766
|
|
|
@@ -1701,7 +1791,7 @@ var PanelPropsDefs = {
|
|
|
1701
1791
|
|
|
1702
1792
|
// src/components/panel/panel.tsx
|
|
1703
1793
|
|
|
1704
|
-
var Panel =
|
|
1794
|
+
var Panel = React13.forwardRef((props, ref) => {
|
|
1705
1795
|
const { className, dataAttrs, children, ...rest } = getComponentProps(
|
|
1706
1796
|
props,
|
|
1707
1797
|
PanelPropsDefs,
|
|
@@ -1731,11 +1821,11 @@ Panel.displayName = "Panel";
|
|
|
1731
1821
|
|
|
1732
1822
|
// src/components/portal/portal-context.tsx
|
|
1733
1823
|
|
|
1734
|
-
var PortalContext =
|
|
1824
|
+
var PortalContext = React14.createContext(
|
|
1735
1825
|
void 0
|
|
1736
1826
|
);
|
|
1737
1827
|
function usePortalContext() {
|
|
1738
|
-
const context =
|
|
1828
|
+
const context = React14.useContext(PortalContext);
|
|
1739
1829
|
if (!context) {
|
|
1740
1830
|
throw new Error("`usePortalContext` must be used within a `Portal.Root`");
|
|
1741
1831
|
}
|
|
@@ -1783,7 +1873,7 @@ var PortalBackdropPropsDefs = {
|
|
|
1783
1873
|
|
|
1784
1874
|
// src/components/portal/backdrop/portal-backdrop.tsx
|
|
1785
1875
|
|
|
1786
|
-
var PortalBackdrop =
|
|
1876
|
+
var PortalBackdrop = React15.forwardRef(
|
|
1787
1877
|
(props, ref) => {
|
|
1788
1878
|
const context = usePortalContext();
|
|
1789
1879
|
const { className, dataAttrs, ...rest } = getComponentProps(
|
|
@@ -1811,11 +1901,11 @@ var _reactdom = require('react-dom'); var _reactdom2 = _interopRequireDefault(_r
|
|
|
1811
1901
|
|
|
1812
1902
|
// src/components/theme/theme-context.tsx
|
|
1813
1903
|
|
|
1814
|
-
var ThemeContext =
|
|
1904
|
+
var ThemeContext = React16.createContext(
|
|
1815
1905
|
void 0
|
|
1816
1906
|
);
|
|
1817
1907
|
function useTheme() {
|
|
1818
|
-
const context =
|
|
1908
|
+
const context = React16.useContext(ThemeContext);
|
|
1819
1909
|
if (!context) {
|
|
1820
1910
|
throw new Error("`useTheme` must be used within a `Theme`");
|
|
1821
1911
|
}
|
|
@@ -1833,9 +1923,9 @@ function useAnchorPosition({
|
|
|
1833
1923
|
alignOffset = 0,
|
|
1834
1924
|
enabled = true
|
|
1835
1925
|
}) {
|
|
1836
|
-
const [position, setPosition] =
|
|
1837
|
-
const [, _forceUpdate] =
|
|
1838
|
-
const updatePosition =
|
|
1926
|
+
const [position, setPosition] = React17.useState(null);
|
|
1927
|
+
const [, _forceUpdate] = React17.useReducer((x) => x + 1, 0);
|
|
1928
|
+
const updatePosition = React17.useCallback(() => {
|
|
1839
1929
|
const anchor = anchorRef.current;
|
|
1840
1930
|
const content = contentRef.current;
|
|
1841
1931
|
if (!anchor || !content || !enabled) {
|
|
@@ -1896,7 +1986,7 @@ function useAnchorPosition({
|
|
|
1896
1986
|
);
|
|
1897
1987
|
setPosition({ top, left });
|
|
1898
1988
|
}, [anchorRef, contentRef, side, align, sideOffset, alignOffset, enabled]);
|
|
1899
|
-
|
|
1989
|
+
React17.useEffect(() => {
|
|
1900
1990
|
if (!enabled) {
|
|
1901
1991
|
setPosition(null);
|
|
1902
1992
|
return;
|
|
@@ -1978,11 +2068,11 @@ var PortalContentPropsDefs = {
|
|
|
1978
2068
|
|
|
1979
2069
|
// src/components/portal/content/portal-content.tsx
|
|
1980
2070
|
|
|
1981
|
-
var PortalContent =
|
|
2071
|
+
var PortalContent = React18.forwardRef(
|
|
1982
2072
|
(props, ref) => {
|
|
1983
2073
|
const portalContext = usePortalContext();
|
|
1984
|
-
const themeContext =
|
|
1985
|
-
const contentRef =
|
|
2074
|
+
const themeContext = React18.useContext(ThemeContext);
|
|
2075
|
+
const contentRef = React18.useRef(null);
|
|
1986
2076
|
const {
|
|
1987
2077
|
side = "bottom",
|
|
1988
2078
|
align = "center",
|
|
@@ -2004,7 +2094,7 @@ var PortalContent = React17.forwardRef(
|
|
|
2004
2094
|
alignOffset: parseInt(alignOffset, 10) || 0,
|
|
2005
2095
|
enabled: anchored && portalContext.open
|
|
2006
2096
|
});
|
|
2007
|
-
const setRefs =
|
|
2097
|
+
const setRefs = React18.useCallback(
|
|
2008
2098
|
(node) => {
|
|
2009
2099
|
contentRef.current = node;
|
|
2010
2100
|
if (typeof ref === "function") {
|
|
@@ -2015,7 +2105,7 @@ var PortalContent = React17.forwardRef(
|
|
|
2015
2105
|
},
|
|
2016
2106
|
[ref]
|
|
2017
2107
|
);
|
|
2018
|
-
|
|
2108
|
+
React18.useEffect(() => {
|
|
2019
2109
|
if (!portalContext.open) return;
|
|
2020
2110
|
function onKeyDown(e) {
|
|
2021
2111
|
if (e.key === "Escape") {
|
|
@@ -2027,7 +2117,7 @@ var PortalContent = React17.forwardRef(
|
|
|
2027
2117
|
document.removeEventListener("keydown", onKeyDown);
|
|
2028
2118
|
};
|
|
2029
2119
|
}, [portalContext.open, portalContext.onOpenChange]);
|
|
2030
|
-
|
|
2120
|
+
React18.useEffect(() => {
|
|
2031
2121
|
if (!portalContext.open || !anchored) return;
|
|
2032
2122
|
function onClickOutside(e) {
|
|
2033
2123
|
const target = e.target;
|
|
@@ -2099,11 +2189,11 @@ PortalContent.displayName = "Portal.Content";
|
|
|
2099
2189
|
// src/components/portal/trigger/portal-trigger.tsx
|
|
2100
2190
|
|
|
2101
2191
|
|
|
2102
|
-
var PortalTrigger =
|
|
2192
|
+
var PortalTrigger = React19.forwardRef(
|
|
2103
2193
|
({ children, asChild, onClick, ...props }, ref) => {
|
|
2104
2194
|
const context = usePortalContext();
|
|
2105
|
-
const internalRef =
|
|
2106
|
-
|
|
2195
|
+
const internalRef = React19.useRef(null);
|
|
2196
|
+
React19.useEffect(() => {
|
|
2107
2197
|
if (internalRef.current) {
|
|
2108
2198
|
context.triggerRef.current = internalRef.current;
|
|
2109
2199
|
}
|
|
@@ -2112,7 +2202,7 @@ var PortalTrigger = React18.forwardRef(
|
|
|
2112
2202
|
_optionalChain([context, 'access', _33 => _33.onOpenChange, 'optionalCall', _34 => _34(!context.open)]);
|
|
2113
2203
|
_optionalChain([onClick, 'optionalCall', _35 => _35(event)]);
|
|
2114
2204
|
};
|
|
2115
|
-
const setRefs =
|
|
2205
|
+
const setRefs = React19.useCallback(
|
|
2116
2206
|
(node) => {
|
|
2117
2207
|
internalRef.current = node;
|
|
2118
2208
|
if (typeof ref === "function") {
|
|
@@ -2124,8 +2214,8 @@ var PortalTrigger = React18.forwardRef(
|
|
|
2124
2214
|
},
|
|
2125
2215
|
[ref, context.triggerRef]
|
|
2126
2216
|
);
|
|
2127
|
-
if (asChild &&
|
|
2128
|
-
return
|
|
2217
|
+
if (asChild && React19.isValidElement(children)) {
|
|
2218
|
+
return React19.cloneElement(children, {
|
|
2129
2219
|
ref: setRefs,
|
|
2130
2220
|
onClick: handleClick,
|
|
2131
2221
|
...props
|
|
@@ -2189,8 +2279,8 @@ var PortalRoot = (props) => {
|
|
|
2189
2279
|
defaultValue: defaultOpen,
|
|
2190
2280
|
onChange: onOpenChange
|
|
2191
2281
|
});
|
|
2192
|
-
const triggerRef =
|
|
2193
|
-
const value =
|
|
2282
|
+
const triggerRef = React20.useRef(null);
|
|
2283
|
+
const value = React20.useMemo(
|
|
2194
2284
|
() => ({
|
|
2195
2285
|
open,
|
|
2196
2286
|
onOpenChange: setOpen,
|
|
@@ -2345,11 +2435,11 @@ var ProgressBar = Object.assign(ProgressBarRoot, {
|
|
|
2345
2435
|
|
|
2346
2436
|
// src/components/select/select-context.tsx
|
|
2347
2437
|
|
|
2348
|
-
var SelectContext =
|
|
2438
|
+
var SelectContext = React23.createContext(
|
|
2349
2439
|
null
|
|
2350
2440
|
);
|
|
2351
2441
|
function useSelectContext() {
|
|
2352
|
-
const context =
|
|
2442
|
+
const context = React23.useContext(SelectContext);
|
|
2353
2443
|
if (!context) {
|
|
2354
2444
|
throw new Error("Select components must be used within a Select.Root");
|
|
2355
2445
|
}
|
|
@@ -2359,7 +2449,7 @@ function useSelectContext() {
|
|
|
2359
2449
|
// src/components/select/utils/user-composed-refs.ts
|
|
2360
2450
|
|
|
2361
2451
|
function useComposedRefs(...refs) {
|
|
2362
|
-
return
|
|
2452
|
+
return React24.useCallback(
|
|
2363
2453
|
(node) => {
|
|
2364
2454
|
refs.forEach((ref) => {
|
|
2365
2455
|
if (typeof ref === "function") {
|
|
@@ -2377,7 +2467,7 @@ function useComposedRefs(...refs) {
|
|
|
2377
2467
|
|
|
2378
2468
|
|
|
2379
2469
|
|
|
2380
|
-
var SelectViewport =
|
|
2470
|
+
var SelectViewport = React25.forwardRef(
|
|
2381
2471
|
(props, ref) => {
|
|
2382
2472
|
const { className, children, ...rest } = props;
|
|
2383
2473
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref, className: _clsx2.default.call(void 0, "select-viewport", className), ...rest, children });
|
|
@@ -2387,7 +2477,7 @@ SelectViewport.displayName = "Select.Viewport";
|
|
|
2387
2477
|
|
|
2388
2478
|
// src/components/select/content/select-content.tsx
|
|
2389
2479
|
|
|
2390
|
-
var SelectContent =
|
|
2480
|
+
var SelectContent = React26.forwardRef(
|
|
2391
2481
|
(props, forwardedRef) => {
|
|
2392
2482
|
const {
|
|
2393
2483
|
className,
|
|
@@ -2400,10 +2490,10 @@ var SelectContent = React25.forwardRef(
|
|
|
2400
2490
|
} = props;
|
|
2401
2491
|
const context = useSelectContext();
|
|
2402
2492
|
const composedRef = useComposedRefs(forwardedRef, context.contentRef);
|
|
2403
|
-
|
|
2493
|
+
React26.useEffect(() => {
|
|
2404
2494
|
context.itemValues.current = [];
|
|
2405
2495
|
}, [context.open]);
|
|
2406
|
-
|
|
2496
|
+
React26.useEffect(() => {
|
|
2407
2497
|
if (!context.open) return;
|
|
2408
2498
|
const handleClickOutside = (event) => {
|
|
2409
2499
|
const target = event.target;
|
|
@@ -2414,7 +2504,7 @@ var SelectContent = React25.forwardRef(
|
|
|
2414
2504
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2415
2505
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2416
2506
|
}, [context.open]);
|
|
2417
|
-
|
|
2507
|
+
React26.useEffect(() => {
|
|
2418
2508
|
if (!context.open) return;
|
|
2419
2509
|
const handleKeyDown = (event) => {
|
|
2420
2510
|
const items = context.itemValues.current;
|
|
@@ -2467,10 +2557,10 @@ var SelectContent = React25.forwardRef(
|
|
|
2467
2557
|
document.addEventListener("keydown", handleKeyDown);
|
|
2468
2558
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2469
2559
|
}, [context.open, context.highlightedIndex]);
|
|
2470
|
-
const [contentWidth, setContentWidth] =
|
|
2560
|
+
const [contentWidth, setContentWidth] = React26.useState();
|
|
2471
2561
|
const labelInside = context.labelPosition === "inside";
|
|
2472
2562
|
const anchorRef = labelInside ? context.rootRef : context.triggerRef;
|
|
2473
|
-
|
|
2563
|
+
React26.useLayoutEffect(() => {
|
|
2474
2564
|
if (context.open && anchorRef.current) {
|
|
2475
2565
|
setContentWidth(anchorRef.current.getBoundingClientRect().width);
|
|
2476
2566
|
}
|
|
@@ -2518,7 +2608,7 @@ var SelectGroupsPropDefs = {
|
|
|
2518
2608
|
|
|
2519
2609
|
// src/components/select/group/select-group.tsx
|
|
2520
2610
|
|
|
2521
|
-
var SelectGroup =
|
|
2611
|
+
var SelectGroup = React27.forwardRef(
|
|
2522
2612
|
(props, ref) => {
|
|
2523
2613
|
const { className, children, dataAttrs, ...rest } = getComponentProps(
|
|
2524
2614
|
props,
|
|
@@ -2582,7 +2672,7 @@ var SelectItemPropDefs = {
|
|
|
2582
2672
|
|
|
2583
2673
|
// src/components/select/item/select-item.tsx
|
|
2584
2674
|
|
|
2585
|
-
var SelectItem =
|
|
2675
|
+
var SelectItem = React28.forwardRef(
|
|
2586
2676
|
(props, ref) => {
|
|
2587
2677
|
const context = useSelectContext();
|
|
2588
2678
|
const { value, disabled, children, className, ...rest } = getComponentProps(
|
|
@@ -2590,12 +2680,12 @@ var SelectItem = React27.forwardRef(
|
|
|
2590
2680
|
SelectItemPropDefs
|
|
2591
2681
|
);
|
|
2592
2682
|
const selected = context.value === value;
|
|
2593
|
-
|
|
2683
|
+
React28.useEffect(() => {
|
|
2594
2684
|
if (selected && children) {
|
|
2595
2685
|
context.setDisplayValue(children);
|
|
2596
2686
|
}
|
|
2597
2687
|
}, [selected]);
|
|
2598
|
-
|
|
2688
|
+
React28.useEffect(() => {
|
|
2599
2689
|
if (!value) return;
|
|
2600
2690
|
if (!disabled) {
|
|
2601
2691
|
const values = context.itemValues.current;
|
|
@@ -2672,14 +2762,14 @@ var SelectLabelPropDefs = {
|
|
|
2672
2762
|
|
|
2673
2763
|
// src/components/select/label/select-label.tsx
|
|
2674
2764
|
|
|
2675
|
-
var SelectLabel =
|
|
2765
|
+
var SelectLabel = React29.forwardRef(
|
|
2676
2766
|
(props, ref) => {
|
|
2677
2767
|
const context = useSelectContext();
|
|
2678
2768
|
const { className, children, position, dataAttrs } = getComponentProps(
|
|
2679
2769
|
props,
|
|
2680
2770
|
SelectLabelPropDefs
|
|
2681
2771
|
);
|
|
2682
|
-
|
|
2772
|
+
React29.useLayoutEffect(() => {
|
|
2683
2773
|
_optionalChain([context, 'access', _47 => _47.setLabelPosition, 'optionalCall', _48 => _48(_nullishCoalesce(position, () => ( "top")))]);
|
|
2684
2774
|
}, [position, context.setLabelPosition]);
|
|
2685
2775
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2714,7 +2804,7 @@ SelectLabel.displayName = "Select.Label";
|
|
|
2714
2804
|
|
|
2715
2805
|
|
|
2716
2806
|
|
|
2717
|
-
var SelectValue =
|
|
2807
|
+
var SelectValue = React30.forwardRef(
|
|
2718
2808
|
(props, ref) => {
|
|
2719
2809
|
const { className, placeholder: placeholderProp, ...rest } = props;
|
|
2720
2810
|
const context = useSelectContext();
|
|
@@ -2766,7 +2856,7 @@ var SelectTriggerPropsDefs = {};
|
|
|
2766
2856
|
|
|
2767
2857
|
// src/components/select/trigger/select-trigger.tsx
|
|
2768
2858
|
|
|
2769
|
-
var SelectTrigger =
|
|
2859
|
+
var SelectTrigger = React31.forwardRef(
|
|
2770
2860
|
(props, forwardedRef) => {
|
|
2771
2861
|
const {
|
|
2772
2862
|
className,
|
|
@@ -3018,7 +3108,7 @@ SelectRoot.displayName = "Select.Root";
|
|
|
3018
3108
|
|
|
3019
3109
|
|
|
3020
3110
|
|
|
3021
|
-
var SelectSeparator =
|
|
3111
|
+
var SelectSeparator = React32.forwardRef(
|
|
3022
3112
|
(props, ref) => {
|
|
3023
3113
|
const { className, ...rest } = props;
|
|
3024
3114
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3444,14 +3534,14 @@ var Switch = Object.assign(SwitchRoot, {
|
|
|
3444
3534
|
// src/components/theme/theme.tsx
|
|
3445
3535
|
|
|
3446
3536
|
|
|
3447
|
-
var Theme =
|
|
3448
|
-
const context =
|
|
3537
|
+
var Theme = React37.forwardRef((props, ref) => {
|
|
3538
|
+
const context = React37.useContext(ThemeContext);
|
|
3449
3539
|
const isRoot = context === void 0;
|
|
3450
3540
|
if (isRoot) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThemeRoot, { ...props, ref });
|
|
3451
3541
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThemeSub, { ...props, ref });
|
|
3452
3542
|
});
|
|
3453
3543
|
Theme.displayName = "Theme";
|
|
3454
|
-
var ThemeRoot =
|
|
3544
|
+
var ThemeRoot = React37.forwardRef((props, ref) => {
|
|
3455
3545
|
const {
|
|
3456
3546
|
appearance: themeAppearance,
|
|
3457
3547
|
radius: themeRadius,
|
|
@@ -3460,15 +3550,15 @@ var ThemeRoot = React36.forwardRef((props, ref) => {
|
|
|
3460
3550
|
children,
|
|
3461
3551
|
...rest
|
|
3462
3552
|
} = props;
|
|
3463
|
-
const [appearance, setAppearance] =
|
|
3553
|
+
const [appearance, setAppearance] = React37.useState(
|
|
3464
3554
|
_nullishCoalesce(themeAppearance, () => ( "light"))
|
|
3465
3555
|
);
|
|
3466
|
-
const [radius, setRadius] =
|
|
3467
|
-
const [roundness2, setRoundness] =
|
|
3556
|
+
const [radius, setRadius] = React37.useState(_nullishCoalesce(themeRadius, () => ( "md")));
|
|
3557
|
+
const [roundness2, setRoundness] = React37.useState(
|
|
3468
3558
|
_nullishCoalesce(themeRoundness, () => ( "3"))
|
|
3469
3559
|
);
|
|
3470
|
-
const [spacing, setSpacing] =
|
|
3471
|
-
const value =
|
|
3560
|
+
const [spacing, setSpacing] = React37.useState(_nullishCoalesce(themeSpacing, () => ( "md")));
|
|
3561
|
+
const value = React37.useMemo(
|
|
3472
3562
|
() => ({
|
|
3473
3563
|
appearance,
|
|
3474
3564
|
radius,
|
|
@@ -3495,8 +3585,8 @@ var ThemeRoot = React36.forwardRef((props, ref) => {
|
|
|
3495
3585
|
) });
|
|
3496
3586
|
});
|
|
3497
3587
|
ThemeRoot.displayName = "ThemeRoot";
|
|
3498
|
-
var ThemeSub =
|
|
3499
|
-
const context =
|
|
3588
|
+
var ThemeSub = React37.forwardRef((props, ref) => {
|
|
3589
|
+
const context = React37.useContext(ThemeContext);
|
|
3500
3590
|
const {
|
|
3501
3591
|
appearance,
|
|
3502
3592
|
radius,
|
|
@@ -3664,5 +3754,6 @@ function ThemeControl({ position = "bottom" }) {
|
|
|
3664
3754
|
|
|
3665
3755
|
|
|
3666
3756
|
|
|
3667
|
-
|
|
3757
|
+
|
|
3758
|
+
exports.Accordion = Accordion; exports.Badge = Badge; exports.Box = Box; exports.Button = Button; exports.Checkbox = Checkbox; exports.Container = Container; exports.Flex = Flex; exports.Panel = Panel; exports.Portal = Portal; exports.ProgressBar = ProgressBar; exports.Select = Select; exports.Separator = Separator; exports.Switch = Switch; exports.Text = Text; exports.Theme = Theme; exports.ThemeControl = ThemeControl; exports.useTheme = useTheme;
|
|
3668
3759
|
//# sourceMappingURL=index.js.map
|