@cerberus-design/react 0.14.2-next-d5ed509 → 0.14.2-next-81321e7
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/build/legacy/_tsup-dts-rollup.d.cts +14 -1
- package/build/legacy/components/DatePicker.client.cjs +8 -2
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs +2 -2
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/index.cjs +125 -119
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +14 -1
- package/build/modern/{chunk-D252JE4V.js → chunk-Q4JXWPU7.js} +9 -3
- package/build/modern/chunk-Q4JXWPU7.js.map +1 -0
- package/build/modern/{chunk-YLMGZAKU.js → chunk-XHM46FXT.js} +3 -3
- package/build/modern/chunk-XHM46FXT.js.map +1 -0
- package/build/modern/components/DatePicker.client.js +1 -1
- package/build/modern/context/notification-center.js +1 -1
- package/build/modern/index.js +2 -2
- package/package.json +2 -2
- package/src/components/DatePicker.client.tsx +23 -3
- package/src/context/notification-center.tsx +2 -2
- package/build/modern/chunk-D252JE4V.js.map +0 -1
- package/build/modern/chunk-YLMGZAKU.js.map +0 -1
package/build/legacy/index.cjs
CHANGED
|
@@ -834,6 +834,7 @@ function IconButton(props) {
|
|
|
834
834
|
}
|
|
835
835
|
|
|
836
836
|
// src/components/DatePicker.client.tsx
|
|
837
|
+
var import_react9 = require("react");
|
|
837
838
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
838
839
|
var datePickerStyles2 = (0, import_recipes9.datePicker)();
|
|
839
840
|
function DatePicker(props) {
|
|
@@ -908,15 +909,19 @@ function DatePickerInput(props) {
|
|
|
908
909
|
}
|
|
909
910
|
function RangePickerInput(props) {
|
|
910
911
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
912
|
+
const { defaultValue, ...nativeProps } = props;
|
|
913
|
+
const startDate = (0, import_react9.useMemo)(() => defaultValue == null ? void 0 : defaultValue[0], [defaultValue]);
|
|
914
|
+
const endDate = (0, import_react9.useMemo)(() => defaultValue == null ? void 0 : defaultValue[1], [defaultValue]);
|
|
911
915
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react8.DatePicker.Control, { "data-range": true, className: datePickerStyles2.control, children: [
|
|
912
916
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DatePickerTrigger, {}),
|
|
913
917
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
914
918
|
import_react8.DatePicker.Input,
|
|
915
919
|
{
|
|
916
|
-
...
|
|
920
|
+
...nativeProps,
|
|
917
921
|
...fieldStates,
|
|
918
922
|
...invalid && { "aria-invalid": true },
|
|
919
923
|
"data-range-input": true,
|
|
924
|
+
defaultValue: startDate,
|
|
920
925
|
className: (0, import_css11.cx)(props.className, datePickerStyles2.input),
|
|
921
926
|
placeholder: props.placeholder ?? "DD MMM YYYY",
|
|
922
927
|
maxLength: 11,
|
|
@@ -926,10 +931,11 @@ function RangePickerInput(props) {
|
|
|
926
931
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
927
932
|
import_react8.DatePicker.Input,
|
|
928
933
|
{
|
|
929
|
-
...
|
|
934
|
+
...nativeProps,
|
|
930
935
|
...fieldStates,
|
|
931
936
|
...invalid && { "aria-invalid": true },
|
|
932
937
|
"data-range-input": true,
|
|
938
|
+
defaultValue: endDate,
|
|
933
939
|
"data-range-end-input": true,
|
|
934
940
|
className: (0, import_css11.cx)(props.className, datePickerStyles2.input),
|
|
935
941
|
placeholder: props.placeholder ?? "DD MMM YYYY",
|
|
@@ -1003,11 +1009,11 @@ function DatePickerCalendar() {
|
|
|
1003
1009
|
|
|
1004
1010
|
// src/components/Droppable.tsx
|
|
1005
1011
|
var import_core = require("@dnd-kit/core");
|
|
1006
|
-
var
|
|
1012
|
+
var import_react10 = require("react");
|
|
1007
1013
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1008
1014
|
function Droppable(props) {
|
|
1009
1015
|
const { dropped, id, disabled, data, resizeObserverConfig, ...nativeProps } = props;
|
|
1010
|
-
const uuid = (0,
|
|
1016
|
+
const uuid = (0, import_react10.useId)();
|
|
1011
1017
|
const { isOver, setNodeRef } = (0, import_core.useDroppable)({
|
|
1012
1018
|
data,
|
|
1013
1019
|
disabled,
|
|
@@ -1043,14 +1049,14 @@ function FieldMessage(props) {
|
|
|
1043
1049
|
}
|
|
1044
1050
|
|
|
1045
1051
|
// src/context/feature-flags.tsx
|
|
1046
|
-
var
|
|
1052
|
+
var import_react11 = require("react");
|
|
1047
1053
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1048
|
-
var FeatureFlagContext = (0,
|
|
1054
|
+
var FeatureFlagContext = (0, import_react11.createContext)(null);
|
|
1049
1055
|
function FeatureFlags(props) {
|
|
1050
1056
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FeatureFlagContext.Provider, { value: props.flags, children: props.children });
|
|
1051
1057
|
}
|
|
1052
1058
|
function useFeatureFlags(key) {
|
|
1053
|
-
const context = (0,
|
|
1059
|
+
const context = (0, import_react11.useContext)(FeatureFlagContext);
|
|
1054
1060
|
if (context === null) {
|
|
1055
1061
|
throw new Error(
|
|
1056
1062
|
"useFeatureFlag must be used within a FeatureFlags Provider"
|
|
@@ -1111,7 +1117,7 @@ function FieldsetLabel(props) {
|
|
|
1111
1117
|
}
|
|
1112
1118
|
|
|
1113
1119
|
// src/components/FileStatus.tsx
|
|
1114
|
-
var
|
|
1120
|
+
var import_react12 = require("react");
|
|
1115
1121
|
var import_recipes13 = require("@cerberus/styled-system/recipes");
|
|
1116
1122
|
var import_css16 = require("@cerberus/styled-system/css");
|
|
1117
1123
|
var import_patterns5 = require("@cerberus/styled-system/patterns");
|
|
@@ -1161,10 +1167,10 @@ var processStatus = /* @__PURE__ */ ((processStatus2) => {
|
|
|
1161
1167
|
})(processStatus || {});
|
|
1162
1168
|
function FileStatus(props) {
|
|
1163
1169
|
const { file, now, status, onClick, ...nativeProps } = props;
|
|
1164
|
-
const actionLabel = (0,
|
|
1165
|
-
const palette = (0,
|
|
1166
|
-
const modalIconPalette = (0,
|
|
1167
|
-
const styles = (0,
|
|
1170
|
+
const actionLabel = (0, import_react12.useMemo)(() => getStatusActionLabel(status), [status]);
|
|
1171
|
+
const palette = (0, import_react12.useMemo)(() => getPalette(status), [status]);
|
|
1172
|
+
const modalIconPalette = (0, import_react12.useMemo)(() => getModalIconPalette(status), [status]);
|
|
1173
|
+
const styles = (0, import_react12.useMemo)(() => {
|
|
1168
1174
|
switch (status) {
|
|
1169
1175
|
case "todo" /* TODO */:
|
|
1170
1176
|
return (0, import_recipes13.fileStatus)({ status: "todo" });
|
|
@@ -1178,7 +1184,7 @@ function FileStatus(props) {
|
|
|
1178
1184
|
return (0, import_recipes13.fileStatus)();
|
|
1179
1185
|
}
|
|
1180
1186
|
}, [status]);
|
|
1181
|
-
const handleClick = (0,
|
|
1187
|
+
const handleClick = (0, import_react12.useCallback)(
|
|
1182
1188
|
(e) => {
|
|
1183
1189
|
const actionStatus = getStatusActionLabel(
|
|
1184
1190
|
status
|
|
@@ -1520,18 +1526,18 @@ function Legend(props) {
|
|
|
1520
1526
|
}
|
|
1521
1527
|
|
|
1522
1528
|
// src/components/Menu.tsx
|
|
1523
|
-
var
|
|
1529
|
+
var import_react13 = require("@ark-ui/react");
|
|
1524
1530
|
var import_recipes18 = require("@cerberus/styled-system/recipes");
|
|
1525
1531
|
var import_css21 = require("@cerberus/styled-system/css");
|
|
1526
1532
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1527
1533
|
var menuStyles = (0, import_recipes18.menu)();
|
|
1528
|
-
var Menu =
|
|
1534
|
+
var Menu = import_react13.Menu.Root;
|
|
1529
1535
|
function MenuTrigger(props) {
|
|
1530
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react13.Menu.Trigger, { ...props, asChild: true });
|
|
1531
1537
|
}
|
|
1532
1538
|
function MenuContent(props) {
|
|
1533
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1534
|
-
|
|
1539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react13.Menu.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1540
|
+
import_react13.Menu.Content,
|
|
1535
1541
|
{
|
|
1536
1542
|
...props,
|
|
1537
1543
|
className: (0, import_css21.cx)(props.className, menuStyles.content)
|
|
@@ -1539,12 +1545,12 @@ function MenuContent(props) {
|
|
|
1539
1545
|
) });
|
|
1540
1546
|
}
|
|
1541
1547
|
function MenuItem(props) {
|
|
1542
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react13.Menu.Item, { ...props, className: (0, import_css21.cx)(props.className, menuStyles.item) });
|
|
1543
1549
|
}
|
|
1544
|
-
var MenuItemGroup =
|
|
1550
|
+
var MenuItemGroup = import_react13.Menu.ItemGroup;
|
|
1545
1551
|
function MenuGroupLabel(props) {
|
|
1546
1552
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1547
|
-
|
|
1553
|
+
import_react13.Menu.ItemGroupLabel,
|
|
1548
1554
|
{
|
|
1549
1555
|
...props,
|
|
1550
1556
|
className: (0, import_css21.cx)(props.className, menuStyles.itemGroupLabel)
|
|
@@ -1553,7 +1559,7 @@ function MenuGroupLabel(props) {
|
|
|
1553
1559
|
}
|
|
1554
1560
|
function MenuSeparator(props) {
|
|
1555
1561
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1556
|
-
|
|
1562
|
+
import_react13.Menu.Separator,
|
|
1557
1563
|
{
|
|
1558
1564
|
...props,
|
|
1559
1565
|
className: (0, import_css21.cx)(props.className, menuStyles.separator)
|
|
@@ -1564,7 +1570,7 @@ function MenuSeparator(props) {
|
|
|
1564
1570
|
// src/components/Modal.tsx
|
|
1565
1571
|
var import_css22 = require("@cerberus/styled-system/css");
|
|
1566
1572
|
var import_recipes19 = require("@cerberus/styled-system/recipes");
|
|
1567
|
-
var
|
|
1573
|
+
var import_react14 = require("react");
|
|
1568
1574
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1569
1575
|
function ModalEl(props, ref) {
|
|
1570
1576
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -1576,7 +1582,7 @@ function ModalEl(props, ref) {
|
|
|
1576
1582
|
}
|
|
1577
1583
|
);
|
|
1578
1584
|
}
|
|
1579
|
-
var Modal = (0,
|
|
1585
|
+
var Modal = (0, import_react14.forwardRef)(ModalEl);
|
|
1580
1586
|
|
|
1581
1587
|
// src/components/ModalHeader.tsx
|
|
1582
1588
|
var import_css23 = require("@cerberus/styled-system/css");
|
|
@@ -1616,7 +1622,7 @@ function ModalDescription(props) {
|
|
|
1616
1622
|
}
|
|
1617
1623
|
|
|
1618
1624
|
// src/components/NavMenuTrigger.tsx
|
|
1619
|
-
var
|
|
1625
|
+
var import_react16 = require("react");
|
|
1620
1626
|
var import_css27 = require("@cerberus/styled-system/css");
|
|
1621
1627
|
var import_recipes22 = require("@cerberus/styled-system/recipes");
|
|
1622
1628
|
|
|
@@ -1630,17 +1636,17 @@ function createNavTriggerProps(values) {
|
|
|
1630
1636
|
|
|
1631
1637
|
// src/context/navMenu.tsx
|
|
1632
1638
|
var import_css26 = require("@cerberus/styled-system/css");
|
|
1633
|
-
var
|
|
1639
|
+
var import_react15 = require("react");
|
|
1634
1640
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1635
|
-
var NavMenuContext = (0,
|
|
1641
|
+
var NavMenuContext = (0, import_react15.createContext)(null);
|
|
1636
1642
|
function NavMenu(props) {
|
|
1637
|
-
const triggerRef = (0,
|
|
1638
|
-
const menuRef = (0,
|
|
1639
|
-
const [expanded, setExpanded] = (0,
|
|
1640
|
-
const handleToggle = (0,
|
|
1643
|
+
const triggerRef = (0, import_react15.useRef)(null);
|
|
1644
|
+
const menuRef = (0, import_react15.useRef)(null);
|
|
1645
|
+
const [expanded, setExpanded] = (0, import_react15.useState)(false);
|
|
1646
|
+
const handleToggle = (0, import_react15.useCallback)(() => {
|
|
1641
1647
|
setExpanded((prev) => !prev);
|
|
1642
1648
|
}, []);
|
|
1643
|
-
const value = (0,
|
|
1649
|
+
const value = (0, import_react15.useMemo)(
|
|
1644
1650
|
() => ({
|
|
1645
1651
|
triggerRef,
|
|
1646
1652
|
menuRef,
|
|
@@ -1660,7 +1666,7 @@ function NavMenu(props) {
|
|
|
1660
1666
|
) });
|
|
1661
1667
|
}
|
|
1662
1668
|
function useNavMenuContext() {
|
|
1663
|
-
const context = (0,
|
|
1669
|
+
const context = (0, import_react15.useContext)(NavMenuContext);
|
|
1664
1670
|
if (!context) {
|
|
1665
1671
|
throw new Error("useNavMenuContext must be used within a NavMenu.");
|
|
1666
1672
|
}
|
|
@@ -1687,7 +1693,7 @@ function NavMenuTrigger(props) {
|
|
|
1687
1693
|
});
|
|
1688
1694
|
const hasAs = Boolean(as);
|
|
1689
1695
|
const AsSub = as;
|
|
1690
|
-
const handleClick = (0,
|
|
1696
|
+
const handleClick = (0, import_react16.useCallback)(
|
|
1691
1697
|
(e) => {
|
|
1692
1698
|
if (onClick) return onClick(e);
|
|
1693
1699
|
onToggle();
|
|
@@ -1730,7 +1736,7 @@ function NavMenuTrigger(props) {
|
|
|
1730
1736
|
}
|
|
1731
1737
|
|
|
1732
1738
|
// src/components/NavMenuList.tsx
|
|
1733
|
-
var
|
|
1739
|
+
var import_react17 = require("react");
|
|
1734
1740
|
var import_css28 = require("@cerberus/styled-system/css");
|
|
1735
1741
|
var import_patterns10 = require("@cerberus/styled-system/patterns");
|
|
1736
1742
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
@@ -1787,7 +1793,7 @@ var navListStyles = (0, import_patterns10.vstack)({
|
|
|
1787
1793
|
function NavMenuList(props) {
|
|
1788
1794
|
const { position, ...nativeProps } = props;
|
|
1789
1795
|
const { menuRef, expanded } = useNavMenuContext();
|
|
1790
|
-
const locationStyles = (0,
|
|
1796
|
+
const locationStyles = (0, import_react17.useMemo)(
|
|
1791
1797
|
() => getPosition(position ?? "bottom"),
|
|
1792
1798
|
[position]
|
|
1793
1799
|
);
|
|
@@ -1847,7 +1853,7 @@ function NavMenuLink(props) {
|
|
|
1847
1853
|
var import_css30 = require("@cerberus/styled-system/css");
|
|
1848
1854
|
var import_patterns11 = require("@cerberus/styled-system/patterns");
|
|
1849
1855
|
var import_recipes23 = require("@cerberus/styled-system/recipes");
|
|
1850
|
-
var
|
|
1856
|
+
var import_react18 = require("react");
|
|
1851
1857
|
|
|
1852
1858
|
// src/aria-helpers/trap-focus.aria.ts
|
|
1853
1859
|
function trapFocus(modalRef) {
|
|
@@ -1886,7 +1892,7 @@ function MatchNotificationIcon(props) {
|
|
|
1886
1892
|
}
|
|
1887
1893
|
function Notification(props) {
|
|
1888
1894
|
const { children, palette, onClose, ...nativeProps } = props;
|
|
1889
|
-
const ref = (0,
|
|
1895
|
+
const ref = (0, import_react18.useRef)(null);
|
|
1890
1896
|
const onKeyDown = trapFocus(ref);
|
|
1891
1897
|
const styles = (0, import_recipes23.notification)({ palette });
|
|
1892
1898
|
const { icons } = useCerberusContext();
|
|
@@ -2133,7 +2139,7 @@ var import_css35 = require("@cerberus/styled-system/css");
|
|
|
2133
2139
|
// src/context/tabs.tsx
|
|
2134
2140
|
var import_tabs = require("@ark-ui/react/tabs");
|
|
2135
2141
|
var import_recipes28 = require("@cerberus/styled-system/recipes");
|
|
2136
|
-
var
|
|
2142
|
+
var import_react19 = require("react");
|
|
2137
2143
|
|
|
2138
2144
|
// src/utils/localStorage.ts
|
|
2139
2145
|
function getLocalStorage(key, defaultValue) {
|
|
@@ -2150,18 +2156,18 @@ function setLocalStorage(key, value) {
|
|
|
2150
2156
|
|
|
2151
2157
|
// src/context/tabs.tsx
|
|
2152
2158
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2153
|
-
var TabsContext = (0,
|
|
2159
|
+
var TabsContext = (0, import_react19.createContext)(null);
|
|
2154
2160
|
function Tabs(props) {
|
|
2155
2161
|
const { cache, defaultValue, palette, uuid, ...arkProps } = props;
|
|
2156
|
-
const [activeTab, setActiveTab] = (0,
|
|
2162
|
+
const [activeTab, setActiveTab] = (0, import_react19.useState)(
|
|
2157
2163
|
() => cache ? "" : defaultValue
|
|
2158
2164
|
);
|
|
2159
2165
|
const styles = (0, import_recipes28.tabs)({ palette });
|
|
2160
|
-
const cacheKey = (0,
|
|
2166
|
+
const cacheKey = (0, import_react19.useMemo)(
|
|
2161
2167
|
() => uuid ? `cerberus-tabs-${uuid}` : "cerberus-tabs",
|
|
2162
2168
|
[uuid]
|
|
2163
2169
|
);
|
|
2164
|
-
const handleValueChange = (0,
|
|
2170
|
+
const handleValueChange = (0, import_react19.useCallback)(
|
|
2165
2171
|
(details) => {
|
|
2166
2172
|
if (cache) {
|
|
2167
2173
|
setLocalStorage(cacheKey, details.value);
|
|
@@ -2170,13 +2176,13 @@ function Tabs(props) {
|
|
|
2170
2176
|
},
|
|
2171
2177
|
[cache]
|
|
2172
2178
|
);
|
|
2173
|
-
(0,
|
|
2179
|
+
(0, import_react19.useEffect)(() => {
|
|
2174
2180
|
if (cache && !activeTab) {
|
|
2175
2181
|
const cachedTab = getLocalStorage(cacheKey, defaultValue ?? "");
|
|
2176
2182
|
setActiveTab(cachedTab);
|
|
2177
2183
|
}
|
|
2178
2184
|
}, [cache, defaultValue, activeTab]);
|
|
2179
|
-
const value = (0,
|
|
2185
|
+
const value = (0, import_react19.useMemo)(
|
|
2180
2186
|
() => ({
|
|
2181
2187
|
active: activeTab,
|
|
2182
2188
|
styles
|
|
@@ -2197,7 +2203,7 @@ function Tabs(props) {
|
|
|
2197
2203
|
) });
|
|
2198
2204
|
}
|
|
2199
2205
|
function useTabsContext() {
|
|
2200
|
-
const context = (0,
|
|
2206
|
+
const context = (0, import_react19.useContext)(TabsContext);
|
|
2201
2207
|
if (!context) {
|
|
2202
2208
|
throw new Error("useTabsContext must be used within a Tabs Provider.");
|
|
2203
2209
|
}
|
|
@@ -2550,26 +2556,26 @@ function Tooltip(props) {
|
|
|
2550
2556
|
}
|
|
2551
2557
|
|
|
2552
2558
|
// src/context/confirm-modal.tsx
|
|
2553
|
-
var
|
|
2559
|
+
var import_react21 = require("react");
|
|
2554
2560
|
var import_css45 = require("@cerberus/styled-system/css");
|
|
2555
2561
|
var import_patterns15 = require("@cerberus/styled-system/patterns");
|
|
2556
2562
|
|
|
2557
2563
|
// src/hooks/useModal.ts
|
|
2558
|
-
var
|
|
2564
|
+
var import_react20 = require("react");
|
|
2559
2565
|
function useModal() {
|
|
2560
|
-
const modalRef = (0,
|
|
2561
|
-
const [isOpen, setIsOpen] = (0,
|
|
2562
|
-
const show = (0,
|
|
2566
|
+
const modalRef = (0, import_react20.useRef)(null);
|
|
2567
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
2568
|
+
const show = (0, import_react20.useCallback)(() => {
|
|
2563
2569
|
var _a;
|
|
2564
2570
|
(_a = modalRef.current) == null ? void 0 : _a.showModal();
|
|
2565
2571
|
setIsOpen(true);
|
|
2566
2572
|
}, []);
|
|
2567
|
-
const close = (0,
|
|
2573
|
+
const close = (0, import_react20.useCallback)(() => {
|
|
2568
2574
|
var _a;
|
|
2569
2575
|
(_a = modalRef.current) == null ? void 0 : _a.close();
|
|
2570
2576
|
setIsOpen(false);
|
|
2571
2577
|
}, []);
|
|
2572
|
-
return (0,
|
|
2578
|
+
return (0, import_react20.useMemo)(() => {
|
|
2573
2579
|
return {
|
|
2574
2580
|
modalRef,
|
|
2575
2581
|
show,
|
|
@@ -2582,20 +2588,20 @@ function useModal() {
|
|
|
2582
2588
|
// src/context/confirm-modal.tsx
|
|
2583
2589
|
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
2584
2590
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2585
|
-
var ConfirmModalContext = (0,
|
|
2591
|
+
var ConfirmModalContext = (0, import_react21.createContext)(null);
|
|
2586
2592
|
function ConfirmModal(props) {
|
|
2587
2593
|
const { modalRef, show, close } = useModal();
|
|
2588
|
-
const resolveRef = (0,
|
|
2589
|
-
const [content, setContent] = (0,
|
|
2594
|
+
const resolveRef = (0, import_react21.useRef)(null);
|
|
2595
|
+
const [content, setContent] = (0, import_react21.useState)(null);
|
|
2590
2596
|
const focusTrap = trapFocus(modalRef);
|
|
2591
2597
|
const kind = (content == null ? void 0 : content.kind) ?? "non-destructive";
|
|
2592
2598
|
const { icons } = useCerberusContext();
|
|
2593
2599
|
const { confirmModal: ConfirmIcon } = icons;
|
|
2594
|
-
const palette = (0,
|
|
2600
|
+
const palette = (0, import_react21.useMemo)(
|
|
2595
2601
|
() => kind === "destructive" ? "danger" : "action",
|
|
2596
2602
|
[kind]
|
|
2597
2603
|
);
|
|
2598
|
-
const handleChoice = (0,
|
|
2604
|
+
const handleChoice = (0, import_react21.useCallback)(
|
|
2599
2605
|
(e) => {
|
|
2600
2606
|
var _a, _b;
|
|
2601
2607
|
const target = e.currentTarget;
|
|
@@ -2607,7 +2613,7 @@ function ConfirmModal(props) {
|
|
|
2607
2613
|
},
|
|
2608
2614
|
[close]
|
|
2609
2615
|
);
|
|
2610
|
-
const handleShow = (0,
|
|
2616
|
+
const handleShow = (0, import_react21.useCallback)(
|
|
2611
2617
|
(options) => {
|
|
2612
2618
|
return new Promise((resolve) => {
|
|
2613
2619
|
setContent({ ...options });
|
|
@@ -2617,7 +2623,7 @@ function ConfirmModal(props) {
|
|
|
2617
2623
|
},
|
|
2618
2624
|
[show]
|
|
2619
2625
|
);
|
|
2620
|
-
const value = (0,
|
|
2626
|
+
const value = (0, import_react21.useMemo)(
|
|
2621
2627
|
() => ({
|
|
2622
2628
|
show: handleShow
|
|
2623
2629
|
}),
|
|
@@ -2696,7 +2702,7 @@ function ConfirmModal(props) {
|
|
|
2696
2702
|
] });
|
|
2697
2703
|
}
|
|
2698
2704
|
function useConfirmModal() {
|
|
2699
|
-
const context = (0,
|
|
2705
|
+
const context = (0, import_react21.useContext)(ConfirmModalContext);
|
|
2700
2706
|
if (context === null) {
|
|
2701
2707
|
throw new Error(
|
|
2702
2708
|
"useConfirmModal must be used within a ConfirmModal Provider"
|
|
@@ -2706,21 +2712,21 @@ function useConfirmModal() {
|
|
|
2706
2712
|
}
|
|
2707
2713
|
|
|
2708
2714
|
// src/context/cta-modal.tsx
|
|
2709
|
-
var
|
|
2715
|
+
var import_react22 = require("react");
|
|
2710
2716
|
var import_jsx3 = require("@cerberus/styled-system/jsx");
|
|
2711
2717
|
var import_css46 = require("@cerberus/styled-system/css");
|
|
2712
2718
|
var import_jsx4 = require("@cerberus/styled-system/jsx");
|
|
2713
2719
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2714
|
-
var CTAModalContext = (0,
|
|
2720
|
+
var CTAModalContext = (0, import_react22.createContext)(null);
|
|
2715
2721
|
function CTAModal(props) {
|
|
2716
2722
|
var _a, _b;
|
|
2717
2723
|
const { modalRef, show, close } = useModal();
|
|
2718
|
-
const [content, setContent] = (0,
|
|
2724
|
+
const [content, setContent] = (0, import_react22.useState)(null);
|
|
2719
2725
|
const focusTrap = trapFocus(modalRef);
|
|
2720
2726
|
const confirmIcon = content == null ? void 0 : content.icon;
|
|
2721
2727
|
const { icons } = useCerberusContext();
|
|
2722
2728
|
const { close: CloseIcon, confirmModal: FallbackIcon } = icons;
|
|
2723
|
-
const handleShow = (0,
|
|
2729
|
+
const handleShow = (0, import_react22.useCallback)(
|
|
2724
2730
|
(options) => {
|
|
2725
2731
|
const maxActions = 2;
|
|
2726
2732
|
if (options.actions.length > maxActions) {
|
|
@@ -2733,7 +2739,7 @@ function CTAModal(props) {
|
|
|
2733
2739
|
},
|
|
2734
2740
|
[show]
|
|
2735
2741
|
);
|
|
2736
|
-
const handleActionClick = (0,
|
|
2742
|
+
const handleActionClick = (0, import_react22.useCallback)(
|
|
2737
2743
|
(event) => {
|
|
2738
2744
|
const index = event.currentTarget.getAttribute("data-index");
|
|
2739
2745
|
const action = content == null ? void 0 : content.actions[Number(index)];
|
|
@@ -2743,7 +2749,7 @@ function CTAModal(props) {
|
|
|
2743
2749
|
},
|
|
2744
2750
|
[content, close]
|
|
2745
2751
|
);
|
|
2746
|
-
const value = (0,
|
|
2752
|
+
const value = (0, import_react22.useMemo)(
|
|
2747
2753
|
() => ({
|
|
2748
2754
|
show: handleShow
|
|
2749
2755
|
}),
|
|
@@ -2805,7 +2811,7 @@ function CTAModal(props) {
|
|
|
2805
2811
|
] });
|
|
2806
2812
|
}
|
|
2807
2813
|
function useCTAModal() {
|
|
2808
|
-
const context = (0,
|
|
2814
|
+
const context = (0, import_react22.useContext)(CTAModalContext);
|
|
2809
2815
|
if (context === null) {
|
|
2810
2816
|
throw new Error("useCTAModal must be used within a CTAModal Provider");
|
|
2811
2817
|
}
|
|
@@ -2813,7 +2819,7 @@ function useCTAModal() {
|
|
|
2813
2819
|
}
|
|
2814
2820
|
|
|
2815
2821
|
// src/context/notification-center.tsx
|
|
2816
|
-
var
|
|
2822
|
+
var import_react23 = require("react");
|
|
2817
2823
|
var import_patterns16 = require("@cerberus/styled-system/patterns");
|
|
2818
2824
|
var import_recipes38 = require("@cerberus/styled-system/recipes");
|
|
2819
2825
|
var import_css47 = require("@cerberus/styled-system/css");
|
|
@@ -2850,27 +2856,27 @@ function clearNotificationState(dispatch) {
|
|
|
2850
2856
|
|
|
2851
2857
|
// src/context/notification-center.tsx
|
|
2852
2858
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2853
|
-
var NotificationsContext = (0,
|
|
2859
|
+
var NotificationsContext = (0, import_react23.createContext)(null);
|
|
2854
2860
|
function NotificationCenter(props) {
|
|
2855
|
-
const [state, dispatch] = (0,
|
|
2861
|
+
const [state, dispatch] = (0, import_react23.useReducer)(notificationCenterReducer, []);
|
|
2856
2862
|
const styles = (0, import_recipes38.notification)();
|
|
2857
|
-
const timeout = (0,
|
|
2863
|
+
const timeout = (0, import_react23.useMemo)(
|
|
2858
2864
|
() => props.duration || 6e3,
|
|
2859
2865
|
[props.duration]
|
|
2860
2866
|
);
|
|
2861
|
-
const closeNotification = (0,
|
|
2867
|
+
const closeNotification = (0, import_react23.useCallback)(
|
|
2862
2868
|
(id) => {
|
|
2863
2869
|
updateNotificationState(dispatch, {
|
|
2864
2870
|
id,
|
|
2865
2871
|
state: "closed"
|
|
2866
2872
|
});
|
|
2867
|
-
setTimeout(() => {
|
|
2873
|
+
window.setTimeout(() => {
|
|
2868
2874
|
removeNotification(dispatch, id);
|
|
2869
2875
|
}, 150);
|
|
2870
2876
|
},
|
|
2871
2877
|
[dispatch]
|
|
2872
2878
|
);
|
|
2873
|
-
const handleNotify = (0,
|
|
2879
|
+
const handleNotify = (0, import_react23.useCallback)(
|
|
2874
2880
|
(options) => {
|
|
2875
2881
|
const id = `${options.palette}:${state.length + 1}`;
|
|
2876
2882
|
addNotification(dispatch, {
|
|
@@ -2878,26 +2884,26 @@ function NotificationCenter(props) {
|
|
|
2878
2884
|
id,
|
|
2879
2885
|
state: "open"
|
|
2880
2886
|
});
|
|
2881
|
-
setTimeout(() => {
|
|
2887
|
+
window.setTimeout(() => {
|
|
2882
2888
|
closeNotification(id);
|
|
2883
2889
|
}, timeout);
|
|
2884
2890
|
},
|
|
2885
2891
|
[dispatch, state, timeout, closeNotification]
|
|
2886
2892
|
);
|
|
2887
|
-
const handleClose = (0,
|
|
2893
|
+
const handleClose = (0, import_react23.useCallback)(
|
|
2888
2894
|
(e) => {
|
|
2889
2895
|
const target = e.currentTarget;
|
|
2890
2896
|
closeNotification(target.value);
|
|
2891
2897
|
},
|
|
2892
2898
|
[closeNotification]
|
|
2893
2899
|
);
|
|
2894
|
-
const handleCloseAll = (0,
|
|
2900
|
+
const handleCloseAll = (0, import_react23.useCallback)(() => {
|
|
2895
2901
|
state.forEach((item) => {
|
|
2896
2902
|
if (item.onClose) item.onClose();
|
|
2897
2903
|
});
|
|
2898
2904
|
clearNotificationState(dispatch);
|
|
2899
2905
|
}, [state, dispatch]);
|
|
2900
|
-
const value = (0,
|
|
2906
|
+
const value = (0, import_react23.useMemo)(
|
|
2901
2907
|
() => ({
|
|
2902
2908
|
notify: handleNotify
|
|
2903
2909
|
}),
|
|
@@ -2944,7 +2950,7 @@ function NotificationCenter(props) {
|
|
|
2944
2950
|
}
|
|
2945
2951
|
function MatchNotification(props) {
|
|
2946
2952
|
const { palette, id, onClose, heading, description, open } = props;
|
|
2947
|
-
const sharedProps = (0,
|
|
2953
|
+
const sharedProps = (0, import_react23.useMemo)(
|
|
2948
2954
|
() => ({
|
|
2949
2955
|
id,
|
|
2950
2956
|
open: true,
|
|
@@ -2978,7 +2984,7 @@ function MatchNotification(props) {
|
|
|
2978
2984
|
}
|
|
2979
2985
|
}
|
|
2980
2986
|
function useNotificationCenter() {
|
|
2981
|
-
const context = (0,
|
|
2987
|
+
const context = (0, import_react23.useContext)(NotificationsContext);
|
|
2982
2988
|
if (!context) {
|
|
2983
2989
|
throw new Error(
|
|
2984
2990
|
"useNotificationCenter must be used within a NotificationsProvider"
|
|
@@ -2988,34 +2994,34 @@ function useNotificationCenter() {
|
|
|
2988
2994
|
}
|
|
2989
2995
|
|
|
2990
2996
|
// src/context/prompt-modal.tsx
|
|
2991
|
-
var
|
|
2997
|
+
var import_react24 = require("react");
|
|
2992
2998
|
var import_css48 = require("@cerberus/styled-system/css");
|
|
2993
2999
|
var import_patterns17 = require("@cerberus/styled-system/patterns");
|
|
2994
3000
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2995
|
-
var PromptModalContext = (0,
|
|
3001
|
+
var PromptModalContext = (0, import_react24.createContext)(null);
|
|
2996
3002
|
function PromptModal(props) {
|
|
2997
3003
|
const { modalRef, show, close } = useModal();
|
|
2998
|
-
const resolveRef = (0,
|
|
2999
|
-
const [content, setContent] = (0,
|
|
3000
|
-
const [inputValue, setInputValue] = (0,
|
|
3004
|
+
const resolveRef = (0, import_react24.useRef)(null);
|
|
3005
|
+
const [content, setContent] = (0, import_react24.useState)(null);
|
|
3006
|
+
const [inputValue, setInputValue] = (0, import_react24.useState)("");
|
|
3001
3007
|
const focusTrap = trapFocus(modalRef);
|
|
3002
3008
|
const { icons } = useCerberusContext();
|
|
3003
3009
|
const { promptModal: PromptIcon } = icons;
|
|
3004
|
-
const isValid = (0,
|
|
3010
|
+
const isValid = (0, import_react24.useMemo)(
|
|
3005
3011
|
() => inputValue === (content == null ? void 0 : content.key),
|
|
3006
3012
|
[inputValue, content]
|
|
3007
3013
|
);
|
|
3008
|
-
const palette = (0,
|
|
3014
|
+
const palette = (0, import_react24.useMemo)(
|
|
3009
3015
|
() => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
|
|
3010
3016
|
[content]
|
|
3011
3017
|
);
|
|
3012
|
-
const handleChange = (0,
|
|
3018
|
+
const handleChange = (0, import_react24.useCallback)(
|
|
3013
3019
|
(e) => {
|
|
3014
3020
|
setInputValue(e.currentTarget.value);
|
|
3015
3021
|
},
|
|
3016
3022
|
[content]
|
|
3017
3023
|
);
|
|
3018
|
-
const handleChoice = (0,
|
|
3024
|
+
const handleChoice = (0, import_react24.useCallback)(
|
|
3019
3025
|
(e) => {
|
|
3020
3026
|
var _a;
|
|
3021
3027
|
const target = e.currentTarget;
|
|
@@ -3026,7 +3032,7 @@ function PromptModal(props) {
|
|
|
3026
3032
|
},
|
|
3027
3033
|
[inputValue, close]
|
|
3028
3034
|
);
|
|
3029
|
-
const handleShow = (0,
|
|
3035
|
+
const handleShow = (0, import_react24.useCallback)(
|
|
3030
3036
|
(options) => {
|
|
3031
3037
|
return new Promise((resolve) => {
|
|
3032
3038
|
setContent({ ...options, kind: options.kind || "non-destructive" });
|
|
@@ -3036,7 +3042,7 @@ function PromptModal(props) {
|
|
|
3036
3042
|
},
|
|
3037
3043
|
[show]
|
|
3038
3044
|
);
|
|
3039
|
-
const value = (0,
|
|
3045
|
+
const value = (0, import_react24.useMemo)(
|
|
3040
3046
|
() => ({
|
|
3041
3047
|
show: handleShow
|
|
3042
3048
|
}),
|
|
@@ -3170,7 +3176,7 @@ function PromptModal(props) {
|
|
|
3170
3176
|
] });
|
|
3171
3177
|
}
|
|
3172
3178
|
function usePromptModal() {
|
|
3173
|
-
const context = (0,
|
|
3179
|
+
const context = (0, import_react24.useContext)(PromptModalContext);
|
|
3174
3180
|
if (context === null) {
|
|
3175
3181
|
throw new Error("usePromptModal must be used within a PromptModal Provider");
|
|
3176
3182
|
}
|
|
@@ -3178,50 +3184,50 @@ function usePromptModal() {
|
|
|
3178
3184
|
}
|
|
3179
3185
|
|
|
3180
3186
|
// src/context/theme.tsx
|
|
3181
|
-
var
|
|
3187
|
+
var import_react26 = require("react");
|
|
3182
3188
|
|
|
3183
3189
|
// src/hooks/useTheme.ts
|
|
3184
|
-
var
|
|
3190
|
+
var import_react25 = require("react");
|
|
3185
3191
|
var THEME_KEY = "cerberus-theme";
|
|
3186
3192
|
var MODE_KEY = "cerberus-mode";
|
|
3187
3193
|
function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options = {}) {
|
|
3188
3194
|
const { updateMode, updateTheme, cache } = options;
|
|
3189
|
-
const [theme, setTheme] = (0,
|
|
3190
|
-
const [colorMode, setColorMode] = (0,
|
|
3191
|
-
const handleThemeChange = (0,
|
|
3195
|
+
const [theme, setTheme] = (0, import_react25.useState)(defaultTheme);
|
|
3196
|
+
const [colorMode, setColorMode] = (0, import_react25.useState)(defaultColorMode);
|
|
3197
|
+
const handleThemeChange = (0, import_react25.useCallback)(
|
|
3192
3198
|
(newTheme) => {
|
|
3193
3199
|
setTheme(newTheme);
|
|
3194
3200
|
updateTheme == null ? void 0 : updateTheme(newTheme);
|
|
3195
3201
|
},
|
|
3196
3202
|
[updateTheme]
|
|
3197
3203
|
);
|
|
3198
|
-
const handleColorModeChange = (0,
|
|
3204
|
+
const handleColorModeChange = (0, import_react25.useCallback)(
|
|
3199
3205
|
(newMode) => {
|
|
3200
3206
|
setColorMode(newMode);
|
|
3201
3207
|
updateMode == null ? void 0 : updateMode(newMode);
|
|
3202
3208
|
},
|
|
3203
3209
|
[updateMode]
|
|
3204
3210
|
);
|
|
3205
|
-
(0,
|
|
3211
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
3206
3212
|
const theme2 = localStorage.getItem(THEME_KEY);
|
|
3207
3213
|
if (theme2) {
|
|
3208
3214
|
setTheme(theme2);
|
|
3209
3215
|
}
|
|
3210
3216
|
}, []);
|
|
3211
|
-
(0,
|
|
3217
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
3212
3218
|
const mode = localStorage.getItem(MODE_KEY);
|
|
3213
3219
|
if (mode) {
|
|
3214
3220
|
setColorMode(mode);
|
|
3215
3221
|
}
|
|
3216
3222
|
}, []);
|
|
3217
|
-
(0,
|
|
3223
|
+
(0, import_react25.useEffect)(() => {
|
|
3218
3224
|
const root = document.documentElement;
|
|
3219
3225
|
root.dataset.pandaTheme = theme;
|
|
3220
3226
|
if (cache) {
|
|
3221
3227
|
localStorage.setItem(THEME_KEY, theme);
|
|
3222
3228
|
}
|
|
3223
3229
|
}, [theme, cache]);
|
|
3224
|
-
(0,
|
|
3230
|
+
(0, import_react25.useEffect)(() => {
|
|
3225
3231
|
const root = document.documentElement;
|
|
3226
3232
|
if (colorMode === "system") {
|
|
3227
3233
|
root.dataset.colorMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -3232,7 +3238,7 @@ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options
|
|
|
3232
3238
|
localStorage.setItem(MODE_KEY, colorMode);
|
|
3233
3239
|
}
|
|
3234
3240
|
}, [colorMode, cache]);
|
|
3235
|
-
return (0,
|
|
3241
|
+
return (0, import_react25.useMemo)(
|
|
3236
3242
|
() => ({
|
|
3237
3243
|
theme,
|
|
3238
3244
|
mode: colorMode,
|
|
@@ -3245,7 +3251,7 @@ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options
|
|
|
3245
3251
|
|
|
3246
3252
|
// src/context/theme.tsx
|
|
3247
3253
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3248
|
-
var ThemeContext = (0,
|
|
3254
|
+
var ThemeContext = (0, import_react26.createContext)(
|
|
3249
3255
|
null
|
|
3250
3256
|
);
|
|
3251
3257
|
function ThemeProvider(props) {
|
|
@@ -3257,7 +3263,7 @@ function ThemeProvider(props) {
|
|
|
3257
3263
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ThemeContext.Provider, { value: state, children: props.children });
|
|
3258
3264
|
}
|
|
3259
3265
|
function useThemeContext() {
|
|
3260
|
-
const context = (0,
|
|
3266
|
+
const context = (0, import_react26.useContext)(ThemeContext);
|
|
3261
3267
|
if (!context) {
|
|
3262
3268
|
throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
3263
3269
|
}
|
|
@@ -3265,13 +3271,13 @@ function useThemeContext() {
|
|
|
3265
3271
|
}
|
|
3266
3272
|
|
|
3267
3273
|
// src/hooks/useDate.ts
|
|
3268
|
-
var
|
|
3274
|
+
var import_react27 = require("react");
|
|
3269
3275
|
function useDate(options) {
|
|
3270
3276
|
const initialValue = (options == null ? void 0 : options.initialValue) ?? "";
|
|
3271
3277
|
const format = (options == null ? void 0 : options.format) ?? DateFormats.USMilitary;
|
|
3272
3278
|
const onChange = options == null ? void 0 : options.onChange;
|
|
3273
|
-
const [value, setValue] = (0,
|
|
3274
|
-
const handleChange = (0,
|
|
3279
|
+
const [value, setValue] = (0, import_react27.useState)(initialValue);
|
|
3280
|
+
const handleChange = (0, import_react27.useCallback)(
|
|
3275
3281
|
(e) => {
|
|
3276
3282
|
const newValue = formatMilitaryDate(e.currentTarget.value);
|
|
3277
3283
|
if (onChange) onChange(e);
|
|
@@ -3279,7 +3285,7 @@ function useDate(options) {
|
|
|
3279
3285
|
},
|
|
3280
3286
|
[onChange]
|
|
3281
3287
|
);
|
|
3282
|
-
return (0,
|
|
3288
|
+
return (0, import_react27.useMemo)(
|
|
3283
3289
|
() => ({
|
|
3284
3290
|
format,
|
|
3285
3291
|
value,
|
|
@@ -3358,11 +3364,11 @@ var MONTHS = [
|
|
|
3358
3364
|
];
|
|
3359
3365
|
|
|
3360
3366
|
// src/hooks/useToggle.ts
|
|
3361
|
-
var
|
|
3367
|
+
var import_react28 = require("react");
|
|
3362
3368
|
function useToggle(options) {
|
|
3363
|
-
const [checked, setChecked] = (0,
|
|
3369
|
+
const [checked, setChecked] = (0, import_react28.useState)((options == null ? void 0 : options.checked) ?? "");
|
|
3364
3370
|
const onChange = options == null ? void 0 : options.onChange;
|
|
3365
|
-
const handleChange = (0,
|
|
3371
|
+
const handleChange = (0, import_react28.useCallback)(
|
|
3366
3372
|
(e) => {
|
|
3367
3373
|
const target = e.currentTarget;
|
|
3368
3374
|
setChecked((prev) => {
|
|
@@ -3372,25 +3378,25 @@ function useToggle(options) {
|
|
|
3372
3378
|
},
|
|
3373
3379
|
[onChange]
|
|
3374
3380
|
);
|
|
3375
|
-
return (0,
|
|
3381
|
+
return (0, import_react28.useMemo)(() => ({ checked, handleChange }), [checked, handleChange]);
|
|
3376
3382
|
}
|
|
3377
3383
|
|
|
3378
3384
|
// src/hooks/useRootColors.ts
|
|
3379
|
-
var
|
|
3385
|
+
var import_react29 = require("react");
|
|
3380
3386
|
function useRootColors(colors = []) {
|
|
3381
|
-
const [state, dispatch] = (0,
|
|
3382
|
-
const handleRefetch = (0,
|
|
3387
|
+
const [state, dispatch] = (0, import_react29.useReducer)(rootColorsReducer, {});
|
|
3388
|
+
const handleRefetch = (0, import_react29.useCallback)(() => {
|
|
3383
3389
|
return new Promise((resolve) => {
|
|
3384
3390
|
dispatch(formatColors(colors));
|
|
3385
3391
|
resolve();
|
|
3386
3392
|
});
|
|
3387
3393
|
}, []);
|
|
3388
|
-
(0,
|
|
3394
|
+
(0, import_react29.useEffect)(() => {
|
|
3389
3395
|
if (Object.keys(state).length === colors.length) return;
|
|
3390
3396
|
dispatch(formatColors(colors));
|
|
3391
3397
|
console.log("updating colors in root hook");
|
|
3392
3398
|
}, [colors]);
|
|
3393
|
-
return (0,
|
|
3399
|
+
return (0, import_react29.useMemo)(
|
|
3394
3400
|
() => ({ colors: state, refetch: handleRefetch }),
|
|
3395
3401
|
[state, handleRefetch]
|
|
3396
3402
|
);
|