@cerberus-design/react 0.13.1-next-8c8a5ee → 0.13.1-next-394d7c4
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 +19 -0
- package/build/legacy/hooks/useRootColors.cjs +49 -0
- package/build/legacy/hooks/useRootColors.cjs.map +1 -0
- package/build/legacy/index.cjs +22 -0
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +19 -0
- package/build/modern/{chunk-5KHGTLFM.js → chunk-B3LRHIEG.js} +6 -6
- package/build/modern/{chunk-4D6VIGNQ.js → chunk-FHS7VVGN.js} +6 -6
- package/build/modern/chunk-RO4AJOVX.js +24 -0
- package/build/modern/chunk-RO4AJOVX.js.map +1 -0
- package/build/modern/{chunk-MMHCX2RG.js → chunk-S6JWPDB4.js} +6 -6
- package/build/modern/{chunk-MXMVC3ZQ.js → chunk-SRPSJGNI.js} +9 -9
- package/build/modern/context/confirm-modal.js +3 -3
- package/build/modern/context/cta-modal.js +4 -4
- package/build/modern/context/notification-center.js +3 -3
- package/build/modern/context/prompt-modal.js +3 -3
- package/build/modern/hooks/useRootColors.js +8 -0
- package/build/modern/hooks/useRootColors.js.map +1 -0
- package/build/modern/index.js +37 -33
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -3
- package/src/hooks/useRootColors.ts +49 -0
- package/src/index.ts +1 -0
- /package/build/modern/{chunk-5KHGTLFM.js.map → chunk-B3LRHIEG.js.map} +0 -0
- /package/build/modern/{chunk-4D6VIGNQ.js.map → chunk-FHS7VVGN.js.map} +0 -0
- /package/build/modern/{chunk-MMHCX2RG.js.map → chunk-S6JWPDB4.js.map} +0 -0
- /package/build/modern/{chunk-MXMVC3ZQ.js.map → chunk-SRPSJGNI.js.map} +0 -0
|
@@ -2097,6 +2097,14 @@ export { RadioRecipe as RadioRecipe_alias_1 }
|
|
|
2097
2097
|
|
|
2098
2098
|
export { rectIntersection }
|
|
2099
2099
|
|
|
2100
|
+
/**
|
|
2101
|
+
* This module provides a hook to get Cerberus colors from the document root.
|
|
2102
|
+
* @module useRootColors
|
|
2103
|
+
*/
|
|
2104
|
+
declare type RootColorsResult = Record<string, string>;
|
|
2105
|
+
export { RootColorsResult }
|
|
2106
|
+
export { RootColorsResult as RootColorsResult_alias_1 }
|
|
2107
|
+
|
|
2100
2108
|
export { ScreenReaderInstructions }
|
|
2101
2109
|
|
|
2102
2110
|
/**
|
|
@@ -3010,6 +3018,17 @@ declare function usePromptModal(): PromptModalValue;
|
|
|
3010
3018
|
export { usePromptModal }
|
|
3011
3019
|
export { usePromptModal as usePromptModal_alias_1 }
|
|
3012
3020
|
|
|
3021
|
+
/**
|
|
3022
|
+
* This hook returns a record of Cerberus colors from the document root.
|
|
3023
|
+
* This is useful when you are working with a component that uses the `<canvas>`
|
|
3024
|
+
* element.
|
|
3025
|
+
* @param colors - An array of Cerberus tokens to get from the document root (i.e. `['dataViz.diverging.50', 'dataViz.diverging.200']`).
|
|
3026
|
+
* @returns A record of Cerberus colors where the key is the token name provided and the value is the color hex.
|
|
3027
|
+
*/
|
|
3028
|
+
declare function useRootColors(colors?: string[]): RootColorsResult;
|
|
3029
|
+
export { useRootColors }
|
|
3030
|
+
export { useRootColors as useRootColors_alias_1 }
|
|
3031
|
+
|
|
3013
3032
|
export { useSensor }
|
|
3014
3033
|
|
|
3015
3034
|
export { useSensors }
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NotificationHeading
|
|
3
|
+
} from "./chunk-SXIXDXG3.js";
|
|
1
4
|
import {
|
|
2
5
|
Portal
|
|
3
6
|
} from "./chunk-K2PSHGS7.js";
|
|
@@ -8,14 +11,11 @@ import {
|
|
|
8
11
|
NotificationDescription
|
|
9
12
|
} from "./chunk-XEW6TJJ4.js";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
Button
|
|
15
|
+
} from "./chunk-EXGKZGML.js";
|
|
13
16
|
import {
|
|
14
17
|
Show
|
|
15
18
|
} from "./chunk-BUVVRQLZ.js";
|
|
16
|
-
import {
|
|
17
|
-
Button
|
|
18
|
-
} from "./chunk-EXGKZGML.js";
|
|
19
19
|
|
|
20
20
|
// src/context/notification-center.tsx
|
|
21
21
|
import {
|
|
@@ -159,4 +159,4 @@ export {
|
|
|
159
159
|
NotificationCenter,
|
|
160
160
|
useNotificationCenter
|
|
161
161
|
};
|
|
162
|
-
//# sourceMappingURL=chunk-
|
|
162
|
+
//# sourceMappingURL=chunk-B3LRHIEG.js.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Portal
|
|
3
3
|
} from "./chunk-K2PSHGS7.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalDescription
|
|
6
|
+
} from "./chunk-Q7BRMIBR.js";
|
|
4
7
|
import {
|
|
5
8
|
ModalHeader
|
|
6
9
|
} from "./chunk-XY6WL55R.js";
|
|
@@ -11,8 +14,8 @@ import {
|
|
|
11
14
|
Modal
|
|
12
15
|
} from "./chunk-BE4EOU2P.js";
|
|
13
16
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
Button
|
|
18
|
+
} from "./chunk-EXGKZGML.js";
|
|
16
19
|
import {
|
|
17
20
|
useModal
|
|
18
21
|
} from "./chunk-KGQG5JGW.js";
|
|
@@ -22,9 +25,6 @@ import {
|
|
|
22
25
|
import {
|
|
23
26
|
Show
|
|
24
27
|
} from "./chunk-BUVVRQLZ.js";
|
|
25
|
-
import {
|
|
26
|
-
Button
|
|
27
|
-
} from "./chunk-EXGKZGML.js";
|
|
28
28
|
import {
|
|
29
29
|
trapFocus
|
|
30
30
|
} from "./chunk-JIZQFTW6.js";
|
|
@@ -170,4 +170,4 @@ export {
|
|
|
170
170
|
ConfirmModal,
|
|
171
171
|
useConfirmModal
|
|
172
172
|
};
|
|
173
|
-
//# sourceMappingURL=chunk-
|
|
173
|
+
//# sourceMappingURL=chunk-FHS7VVGN.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/hooks/useRootColors.ts
|
|
2
|
+
import { useEffect, useReducer } from "react";
|
|
3
|
+
function useRootColors(colors = []) {
|
|
4
|
+
const [state, dispatch] = useReducer(rootColorsReducer, {});
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (Object.keys(state).length === colors.length) return;
|
|
7
|
+
const rootStyles = getComputedStyle(document.body);
|
|
8
|
+
const rootColors = colors.reduce((acc, color) => {
|
|
9
|
+
const formattedColor = color.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase().replaceAll(".", "-");
|
|
10
|
+
acc[color] = rootStyles.getPropertyValue(`--cerberus-colors-${formattedColor}`).trim();
|
|
11
|
+
return acc;
|
|
12
|
+
}, {});
|
|
13
|
+
dispatch(rootColors);
|
|
14
|
+
}, [colors]);
|
|
15
|
+
return state;
|
|
16
|
+
}
|
|
17
|
+
function rootColorsReducer(state, action) {
|
|
18
|
+
return { ...state, ...action };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
useRootColors
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-RO4AJOVX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useRootColors.ts"],"sourcesContent":["'use client'\n\nimport { useEffect, useReducer } from 'react'\n\n/**\n * This module provides a hook to get Cerberus colors from the document root.\n * @module useRootColors\n */\n\nexport type RootColorsResult = Record<string, string>\n\n/**\n * This hook returns a record of Cerberus colors from the document root.\n * This is useful when you are working with a component that uses the `<canvas>`\n * element.\n * @param colors - An array of Cerberus tokens to get from the document root (i.e. `['dataViz.diverging.50', 'dataViz.diverging.200']`).\n * @returns A record of Cerberus colors where the key is the token name provided and the value is the color hex.\n */\nexport function useRootColors(colors: string[] = []): RootColorsResult {\n const [state, dispatch] = useReducer(rootColorsReducer, {})\n\n useEffect(() => {\n if (Object.keys(state).length === colors.length) return\n\n const rootStyles = getComputedStyle(document.body)\n const rootColors = colors.reduce((acc, color) => {\n const formattedColor = color\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase()\n .replaceAll('.', '-')\n acc[color as keyof typeof acc] = rootStyles\n .getPropertyValue(`--cerberus-colors-${formattedColor}`)\n .trim()\n return acc\n }, {} as RootColorsResult)\n\n dispatch(rootColors)\n }, [colors])\n\n // reducer is already memoized\n return state\n}\n\nfunction rootColorsReducer(\n state: Record<string, string>,\n action: Record<string, string>,\n): Record<string, string> {\n return { ...state, ...action }\n}\n"],"mappings":";AAEA,SAAS,WAAW,kBAAkB;AAgB/B,SAAS,cAAc,SAAmB,CAAC,GAAqB;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAI,WAAW,mBAAmB,CAAC,CAAC;AAE1D,YAAU,MAAM;AACd,QAAI,OAAO,KAAK,KAAK,EAAE,WAAW,OAAO,OAAQ;AAEjD,UAAM,aAAa,iBAAiB,SAAS,IAAI;AACjD,UAAM,aAAa,OAAO,OAAO,CAAC,KAAK,UAAU;AAC/C,YAAM,iBAAiB,MACpB,QAAQ,mBAAmB,OAAO,EAClC,YAAY,EACZ,WAAW,KAAK,GAAG;AACtB,UAAI,KAAyB,IAAI,WAC9B,iBAAiB,qBAAqB,cAAc,EAAE,EACtD,KAAK;AACR,aAAO;AAAA,IACT,GAAG,CAAC,CAAqB;AAEzB,aAAS,UAAU;AAAA,EACrB,GAAG,CAAC,MAAM,CAAC;AAGX,SAAO;AACT;AAEA,SAAS,kBACP,OACA,QACwB;AACxB,SAAO,EAAE,GAAG,OAAO,GAAG,OAAO;AAC/B;","names":[]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Portal
|
|
3
3
|
} from "./chunk-K2PSHGS7.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalDescription
|
|
6
|
+
} from "./chunk-Q7BRMIBR.js";
|
|
4
7
|
import {
|
|
5
8
|
ModalHeader
|
|
6
9
|
} from "./chunk-XY6WL55R.js";
|
|
@@ -17,8 +20,8 @@ import {
|
|
|
17
20
|
Modal
|
|
18
21
|
} from "./chunk-BE4EOU2P.js";
|
|
19
22
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
Button
|
|
24
|
+
} from "./chunk-EXGKZGML.js";
|
|
22
25
|
import {
|
|
23
26
|
Field
|
|
24
27
|
} from "./chunk-UZDVOIW5.js";
|
|
@@ -31,9 +34,6 @@ import {
|
|
|
31
34
|
import {
|
|
32
35
|
Show
|
|
33
36
|
} from "./chunk-BUVVRQLZ.js";
|
|
34
|
-
import {
|
|
35
|
-
Button
|
|
36
|
-
} from "./chunk-EXGKZGML.js";
|
|
37
37
|
import {
|
|
38
38
|
trapFocus
|
|
39
39
|
} from "./chunk-JIZQFTW6.js";
|
|
@@ -240,4 +240,4 @@ export {
|
|
|
240
240
|
PromptModal,
|
|
241
241
|
usePromptModal
|
|
242
242
|
};
|
|
243
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-S6JWPDB4.js.map
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Portal
|
|
3
3
|
} from "./chunk-K2PSHGS7.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalDescription
|
|
6
|
+
} from "./chunk-Q7BRMIBR.js";
|
|
4
7
|
import {
|
|
5
8
|
ModalHeader
|
|
6
9
|
} from "./chunk-XY6WL55R.js";
|
|
7
10
|
import {
|
|
8
11
|
ModalHeading
|
|
9
12
|
} from "./chunk-2UXE5PDG.js";
|
|
13
|
+
import {
|
|
14
|
+
IconButton
|
|
15
|
+
} from "./chunk-APD6IX5R.js";
|
|
10
16
|
import {
|
|
11
17
|
Modal
|
|
12
18
|
} from "./chunk-BE4EOU2P.js";
|
|
13
19
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
IconButton
|
|
18
|
-
} from "./chunk-APD6IX5R.js";
|
|
20
|
+
Button
|
|
21
|
+
} from "./chunk-EXGKZGML.js";
|
|
19
22
|
import {
|
|
20
23
|
useModal
|
|
21
24
|
} from "./chunk-KGQG5JGW.js";
|
|
@@ -25,9 +28,6 @@ import {
|
|
|
25
28
|
import {
|
|
26
29
|
Show
|
|
27
30
|
} from "./chunk-BUVVRQLZ.js";
|
|
28
|
-
import {
|
|
29
|
-
Button
|
|
30
|
-
} from "./chunk-EXGKZGML.js";
|
|
31
31
|
import {
|
|
32
32
|
trapFocus
|
|
33
33
|
} from "./chunk-JIZQFTW6.js";
|
|
@@ -152,4 +152,4 @@ export {
|
|
|
152
152
|
CTAModal,
|
|
153
153
|
useCTAModal
|
|
154
154
|
};
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
//# sourceMappingURL=chunk-SRPSJGNI.js.map
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ConfirmModal,
|
|
4
4
|
useConfirmModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-FHS7VVGN.js";
|
|
6
6
|
import "../chunk-K2PSHGS7.js";
|
|
7
|
+
import "../chunk-Q7BRMIBR.js";
|
|
7
8
|
import "../chunk-XY6WL55R.js";
|
|
8
9
|
import "../chunk-2UXE5PDG.js";
|
|
9
10
|
import "../chunk-BE4EOU2P.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-EXGKZGML.js";
|
|
11
12
|
import "../chunk-KGQG5JGW.js";
|
|
12
13
|
import "../chunk-SPZYPRZ6.js";
|
|
13
14
|
import "../chunk-BUVVRQLZ.js";
|
|
14
|
-
import "../chunk-EXGKZGML.js";
|
|
15
15
|
import "../chunk-JIZQFTW6.js";
|
|
16
16
|
import "../chunk-VERRHMW4.js";
|
|
17
17
|
import "../chunk-F27AAKQ3.js";
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CTAModal,
|
|
4
4
|
useCTAModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-SRPSJGNI.js";
|
|
6
6
|
import "../chunk-K2PSHGS7.js";
|
|
7
|
+
import "../chunk-Q7BRMIBR.js";
|
|
7
8
|
import "../chunk-XY6WL55R.js";
|
|
8
9
|
import "../chunk-2UXE5PDG.js";
|
|
9
|
-
import "../chunk-BE4EOU2P.js";
|
|
10
|
-
import "../chunk-Q7BRMIBR.js";
|
|
11
10
|
import "../chunk-APD6IX5R.js";
|
|
11
|
+
import "../chunk-BE4EOU2P.js";
|
|
12
|
+
import "../chunk-EXGKZGML.js";
|
|
12
13
|
import "../chunk-KGQG5JGW.js";
|
|
13
14
|
import "../chunk-SPZYPRZ6.js";
|
|
14
15
|
import "../chunk-BUVVRQLZ.js";
|
|
15
|
-
import "../chunk-EXGKZGML.js";
|
|
16
16
|
import "../chunk-JIZQFTW6.js";
|
|
17
17
|
import "../chunk-VERRHMW4.js";
|
|
18
18
|
import "../chunk-F27AAKQ3.js";
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
NotificationCenter,
|
|
4
4
|
useNotificationCenter
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-B3LRHIEG.js";
|
|
6
|
+
import "../chunk-SXIXDXG3.js";
|
|
6
7
|
import "../chunk-K2PSHGS7.js";
|
|
7
8
|
import "../chunk-7SGPJM66.js";
|
|
8
9
|
import "../chunk-XEW6TJJ4.js";
|
|
9
|
-
import "../chunk-SXIXDXG3.js";
|
|
10
|
-
import "../chunk-BUVVRQLZ.js";
|
|
11
10
|
import "../chunk-EXGKZGML.js";
|
|
11
|
+
import "../chunk-BUVVRQLZ.js";
|
|
12
12
|
import "../chunk-JIZQFTW6.js";
|
|
13
13
|
import "../chunk-VERRHMW4.js";
|
|
14
14
|
import "../chunk-F27AAKQ3.js";
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PromptModal,
|
|
4
4
|
usePromptModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-S6JWPDB4.js";
|
|
6
6
|
import "../chunk-K2PSHGS7.js";
|
|
7
|
+
import "../chunk-Q7BRMIBR.js";
|
|
7
8
|
import "../chunk-XY6WL55R.js";
|
|
8
9
|
import "../chunk-2UXE5PDG.js";
|
|
9
10
|
import "../chunk-NKM6PISB.js";
|
|
10
11
|
import "../chunk-NMF2HYWO.js";
|
|
11
12
|
import "../chunk-BE4EOU2P.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-EXGKZGML.js";
|
|
13
14
|
import "../chunk-UZDVOIW5.js";
|
|
14
15
|
import "../chunk-KGQG5JGW.js";
|
|
15
16
|
import "../chunk-SPZYPRZ6.js";
|
|
16
17
|
import "../chunk-BUVVRQLZ.js";
|
|
17
|
-
import "../chunk-EXGKZGML.js";
|
|
18
18
|
import "../chunk-JIZQFTW6.js";
|
|
19
19
|
import "../chunk-VERRHMW4.js";
|
|
20
20
|
import "../chunk-F27AAKQ3.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/modern/index.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NotificationCenter,
|
|
3
|
+
useNotificationCenter
|
|
4
|
+
} from "./chunk-B3LRHIEG.js";
|
|
1
5
|
import {
|
|
2
6
|
PromptModal,
|
|
3
7
|
usePromptModal
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-S6JWPDB4.js";
|
|
5
9
|
import {
|
|
6
10
|
ThemeProvider,
|
|
7
11
|
useThemeContext
|
|
8
12
|
} from "./chunk-EB37HRCN.js";
|
|
13
|
+
import {
|
|
14
|
+
Thead
|
|
15
|
+
} from "./chunk-Y6QQCRQV.js";
|
|
9
16
|
import {
|
|
10
17
|
Toggle
|
|
11
18
|
} from "./chunk-NMNONSHU.js";
|
|
@@ -15,15 +22,14 @@ import {
|
|
|
15
22
|
import {
|
|
16
23
|
ConfirmModal,
|
|
17
24
|
useConfirmModal
|
|
18
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-FHS7VVGN.js";
|
|
19
26
|
import {
|
|
20
27
|
CTAModal,
|
|
21
28
|
useCTAModal
|
|
22
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-SRPSJGNI.js";
|
|
23
30
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from "./chunk-5KHGTLFM.js";
|
|
31
|
+
TabList
|
|
32
|
+
} from "./chunk-UKPF7JOB.js";
|
|
27
33
|
import {
|
|
28
34
|
TabPanel
|
|
29
35
|
} from "./chunk-AYIRV5CL.js";
|
|
@@ -47,8 +53,8 @@ import {
|
|
|
47
53
|
Th
|
|
48
54
|
} from "./chunk-SGKHA4EB.js";
|
|
49
55
|
import {
|
|
50
|
-
|
|
51
|
-
} from "./chunk-
|
|
56
|
+
NotificationHeading
|
|
57
|
+
} from "./chunk-SXIXDXG3.js";
|
|
52
58
|
import {
|
|
53
59
|
Portal
|
|
54
60
|
} from "./chunk-K2PSHGS7.js";
|
|
@@ -66,8 +72,8 @@ import {
|
|
|
66
72
|
Tab
|
|
67
73
|
} from "./chunk-SLF6SIPB.js";
|
|
68
74
|
import {
|
|
69
|
-
|
|
70
|
-
} from "./chunk-
|
|
75
|
+
ModalDescription
|
|
76
|
+
} from "./chunk-Q7BRMIBR.js";
|
|
71
77
|
import {
|
|
72
78
|
ModalHeader
|
|
73
79
|
} from "./chunk-XY6WL55R.js";
|
|
@@ -95,11 +101,18 @@ import {
|
|
|
95
101
|
NotificationDescription
|
|
96
102
|
} from "./chunk-XEW6TJJ4.js";
|
|
97
103
|
import {
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
FileStatus,
|
|
105
|
+
processStatus
|
|
106
|
+
} from "./chunk-7MM5KYEX.js";
|
|
107
|
+
import {
|
|
108
|
+
ProgressBar
|
|
109
|
+
} from "./chunk-KCANMM64.js";
|
|
100
110
|
import {
|
|
101
111
|
FileUploader
|
|
102
112
|
} from "./chunk-W4DXACNV.js";
|
|
113
|
+
import {
|
|
114
|
+
IconButton
|
|
115
|
+
} from "./chunk-APD6IX5R.js";
|
|
103
116
|
import {
|
|
104
117
|
Input
|
|
105
118
|
} from "./chunk-NKM6PISB.js";
|
|
@@ -122,8 +135,8 @@ import {
|
|
|
122
135
|
Modal
|
|
123
136
|
} from "./chunk-BE4EOU2P.js";
|
|
124
137
|
import {
|
|
125
|
-
|
|
126
|
-
} from "./chunk-
|
|
138
|
+
Button
|
|
139
|
+
} from "./chunk-EXGKZGML.js";
|
|
127
140
|
import {
|
|
128
141
|
Checkbox
|
|
129
142
|
} from "./chunk-NB6DV4VA.js";
|
|
@@ -140,32 +153,25 @@ import {
|
|
|
140
153
|
FeatureFlags,
|
|
141
154
|
useFeatureFlags
|
|
142
155
|
} from "./chunk-CJFW36DZ.js";
|
|
143
|
-
import {
|
|
144
|
-
Fieldset
|
|
145
|
-
} from "./chunk-3ZDFQO25.js";
|
|
146
|
-
import {
|
|
147
|
-
FieldsetLabel
|
|
148
|
-
} from "./chunk-PZAZKQMO.js";
|
|
149
|
-
import {
|
|
150
|
-
FileStatus,
|
|
151
|
-
processStatus
|
|
152
|
-
} from "./chunk-7MM5KYEX.js";
|
|
153
|
-
import {
|
|
154
|
-
ProgressBar
|
|
155
|
-
} from "./chunk-KCANMM64.js";
|
|
156
|
-
import {
|
|
157
|
-
IconButton
|
|
158
|
-
} from "./chunk-APD6IX5R.js";
|
|
159
156
|
import {
|
|
160
157
|
FieldMessage
|
|
161
158
|
} from "./chunk-JWIJHSI6.js";
|
|
159
|
+
import {
|
|
160
|
+
Fieldset
|
|
161
|
+
} from "./chunk-3ZDFQO25.js";
|
|
162
162
|
import {
|
|
163
163
|
Field,
|
|
164
164
|
useFieldContext
|
|
165
165
|
} from "./chunk-UZDVOIW5.js";
|
|
166
|
+
import {
|
|
167
|
+
FieldsetLabel
|
|
168
|
+
} from "./chunk-PZAZKQMO.js";
|
|
166
169
|
import {
|
|
167
170
|
useModal
|
|
168
171
|
} from "./chunk-KGQG5JGW.js";
|
|
172
|
+
import {
|
|
173
|
+
useRootColors
|
|
174
|
+
} from "./chunk-RO4AJOVX.js";
|
|
169
175
|
import {
|
|
170
176
|
MODE_KEY,
|
|
171
177
|
THEME_KEY,
|
|
@@ -188,9 +194,6 @@ import {
|
|
|
188
194
|
import {
|
|
189
195
|
Show
|
|
190
196
|
} from "./chunk-BUVVRQLZ.js";
|
|
191
|
-
import {
|
|
192
|
-
Button
|
|
193
|
-
} from "./chunk-EXGKZGML.js";
|
|
194
197
|
import "./chunk-55J6XMHW.js";
|
|
195
198
|
import {
|
|
196
199
|
createNavTriggerProps
|
|
@@ -309,6 +312,7 @@ export {
|
|
|
309
312
|
useNavMenuContext,
|
|
310
313
|
useNotificationCenter,
|
|
311
314
|
usePromptModal,
|
|
315
|
+
useRootColors,
|
|
312
316
|
useTabsContext,
|
|
313
317
|
useTabsKeyboardNavigation,
|
|
314
318
|
useTheme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Admonition'\nexport * from './components/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/CircularProgress'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/Fieldset'\nexport * from './components/FieldsetLabel'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Legend'\nexport * from './components/Menu'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Spinner'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Tooltip'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/cta-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useDate'\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\nexport * from './utils/index'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Admonition'\nexport * from './components/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/CircularProgress'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/Fieldset'\nexport * from './components/FieldsetLabel'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Legend'\nexport * from './components/Menu'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Spinner'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Tooltip'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/cta-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useDate'\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\nexport * from './hooks/useRootColors'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\nexport * from './utils/index'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.13.1-next-
|
|
3
|
+
"version": "0.13.1-next-394d7c4",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"react": "^18",
|
|
27
27
|
"react-dom": "^18",
|
|
28
28
|
"tsup": "^8.1.0",
|
|
29
|
-
"@cerberus-design/
|
|
30
|
-
"@cerberus-design/
|
|
29
|
+
"@cerberus-design/styled-system": "0.13.1-next-394d7c4",
|
|
30
|
+
"@cerberus-design/configs": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useEffect, useReducer } from 'react'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This module provides a hook to get Cerberus colors from the document root.
|
|
7
|
+
* @module useRootColors
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type RootColorsResult = Record<string, string>
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This hook returns a record of Cerberus colors from the document root.
|
|
14
|
+
* This is useful when you are working with a component that uses the `<canvas>`
|
|
15
|
+
* element.
|
|
16
|
+
* @param colors - An array of Cerberus tokens to get from the document root (i.e. `['dataViz.diverging.50', 'dataViz.diverging.200']`).
|
|
17
|
+
* @returns A record of Cerberus colors where the key is the token name provided and the value is the color hex.
|
|
18
|
+
*/
|
|
19
|
+
export function useRootColors(colors: string[] = []): RootColorsResult {
|
|
20
|
+
const [state, dispatch] = useReducer(rootColorsReducer, {})
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (Object.keys(state).length === colors.length) return
|
|
24
|
+
|
|
25
|
+
const rootStyles = getComputedStyle(document.body)
|
|
26
|
+
const rootColors = colors.reduce((acc, color) => {
|
|
27
|
+
const formattedColor = color
|
|
28
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
29
|
+
.toLowerCase()
|
|
30
|
+
.replaceAll('.', '-')
|
|
31
|
+
acc[color as keyof typeof acc] = rootStyles
|
|
32
|
+
.getPropertyValue(`--cerberus-colors-${formattedColor}`)
|
|
33
|
+
.trim()
|
|
34
|
+
return acc
|
|
35
|
+
}, {} as RootColorsResult)
|
|
36
|
+
|
|
37
|
+
dispatch(rootColors)
|
|
38
|
+
}, [colors])
|
|
39
|
+
|
|
40
|
+
// reducer is already memoized
|
|
41
|
+
return state
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function rootColorsReducer(
|
|
45
|
+
state: Record<string, string>,
|
|
46
|
+
action: Record<string, string>,
|
|
47
|
+
): Record<string, string> {
|
|
48
|
+
return { ...state, ...action }
|
|
49
|
+
}
|
package/src/index.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|