@cerberus-design/react 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +83 -40
  2. package/build/legacy/components/ModalHeader.cjs +0 -1
  3. package/build/legacy/components/ModalHeader.cjs.map +1 -1
  4. package/build/legacy/components/Portal.cjs +2 -6
  5. package/build/legacy/components/Portal.cjs.map +1 -1
  6. package/build/legacy/context/confirm-modal.cjs +58 -68
  7. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  8. package/build/legacy/context/cta-modal.cjs +54 -58
  9. package/build/legacy/context/cta-modal.cjs.map +1 -1
  10. package/build/legacy/context/notification-center.cjs +10 -13
  11. package/build/legacy/context/notification-center.cjs.map +1 -1
  12. package/build/legacy/context/prompt-modal.cjs +29 -33
  13. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  14. package/build/legacy/hooks/useRootColors.cjs +64 -0
  15. package/build/legacy/hooks/useRootColors.cjs.map +1 -0
  16. package/build/legacy/index.cjs +191 -164
  17. package/build/legacy/index.cjs.map +1 -1
  18. package/build/modern/_tsup-dts-rollup.d.ts +83 -40
  19. package/build/modern/{chunk-KUT2YEEQ.js → chunk-3XGLNXJJ.js} +7 -7
  20. package/build/modern/chunk-3XGLNXJJ.js.map +1 -0
  21. package/build/modern/{chunk-NCUHRVW2.js → chunk-FBSESDWJ.js} +8 -8
  22. package/build/modern/{chunk-KFGI37CO.js → chunk-GRUXP3NG.js} +44 -50
  23. package/build/modern/chunk-GRUXP3NG.js.map +1 -0
  24. package/build/modern/chunk-IQJDVFPP.js +10 -0
  25. package/build/modern/chunk-IQJDVFPP.js.map +1 -0
  26. package/build/modern/chunk-RMVJK26W.js +39 -0
  27. package/build/modern/chunk-RMVJK26W.js.map +1 -0
  28. package/build/modern/{chunk-J4LOSTEP.js → chunk-WFJWCZ7E.js} +45 -45
  29. package/build/modern/{chunk-J4LOSTEP.js.map → chunk-WFJWCZ7E.js.map} +1 -1
  30. package/build/modern/{chunk-ZFAIE47A.js → chunk-XY6WL55R.js} +1 -2
  31. package/build/modern/{chunk-ZFAIE47A.js.map → chunk-XY6WL55R.js.map} +1 -1
  32. package/build/modern/components/ModalHeader.js +1 -1
  33. package/build/modern/components/Portal.js +1 -2
  34. package/build/modern/context/confirm-modal.js +5 -5
  35. package/build/modern/context/cta-modal.js +6 -6
  36. package/build/modern/context/notification-center.js +4 -4
  37. package/build/modern/context/prompt-modal.js +5 -5
  38. package/build/modern/hooks/useRootColors.js +8 -0
  39. package/build/modern/hooks/useRootColors.js.map +1 -0
  40. package/build/modern/index.js +39 -35
  41. package/build/modern/index.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/components/ModalHeader.tsx +0 -1
  44. package/src/components/Portal.tsx +6 -19
  45. package/src/context/confirm-modal.tsx +89 -66
  46. package/src/context/cta-modal.tsx +38 -38
  47. package/src/context/notification-center.tsx +1 -0
  48. package/src/hooks/useRootColors.ts +73 -0
  49. package/src/index.ts +1 -0
  50. package/build/modern/chunk-K2PSHGS7.js +0 -11
  51. package/build/modern/chunk-K2PSHGS7.js.map +0 -1
  52. package/build/modern/chunk-KFGI37CO.js.map +0 -1
  53. package/build/modern/chunk-KUT2YEEQ.js.map +0 -1
  54. /package/build/modern/{chunk-NCUHRVW2.js.map → chunk-FBSESDWJ.js.map} +0 -0
@@ -99,12 +99,12 @@ import { PointerSensor } from '@dnd-kit/core';
99
99
  import { PointerSensorOptions } from '@dnd-kit/core';
100
100
  import { PointerSensorProps } from '@dnd-kit/core';
101
101
  import { pointerWithin } from '@dnd-kit/core';
102
+ import { PortalProps as PortalProps_2 } from '@ark-ui/react';
102
103
  import type { Pretty } from '@cerberus/styled-system/types';
103
104
  import { ProgressBarVariantProps } from '@cerberus/styled-system/recipes';
104
105
  import { PropsWithChildren } from 'react';
105
106
  import { radio } from '@cerberus/styled-system/recipes';
106
107
  import { ReactNode } from 'react';
107
- import { ReactPortal } from 'react';
108
108
  import type { RecipeVariantProps } from '@cerberus/styled-system/types';
109
109
  import { rectIntersection } from '@dnd-kit/core';
110
110
  import { RefAttributes } from 'react';
@@ -299,6 +299,27 @@ declare type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> & AvatarVariantPr
299
299
  export { AvatarProps }
300
300
  export { AvatarProps as AvatarProps_alias_1 }
301
301
 
302
+ /**
303
+ * This module provides a context and hook for the confirm modal.
304
+ * @module
305
+ */
306
+ declare interface BaseConfirmOptions {
307
+ /**
308
+ * The heading of the confirm modal.
309
+ */
310
+ heading: string;
311
+ /**
312
+ * The text for the action button.
313
+ */
314
+ actionText: string;
315
+ /**
316
+ * The text for the cancel button.
317
+ */
318
+ cancelText: string;
319
+ }
320
+ export { BaseConfirmOptions }
321
+ export { BaseConfirmOptions as BaseConfirmOptions_alias_1 }
322
+
302
323
  /**
303
324
  * This module exports the NotificationDescription component.
304
325
  * @module
@@ -640,6 +661,19 @@ declare function defineIcons(icons: DefinedIcons): Required<DefinedIcons>;
640
661
  export { defineIcons }
641
662
  export { defineIcons as defineIcons_alias_1 }
642
663
 
664
+ declare interface DestructiveConfirmOptions extends BaseConfirmOptions {
665
+ /**
666
+ * The kind of confirm modal to show.
667
+ */
668
+ kind?: 'destructive';
669
+ /**
670
+ * The description of the confirm modal. Can only be a string for destructive confirm modals.
671
+ */
672
+ description?: string;
673
+ }
674
+ export { DestructiveConfirmOptions }
675
+ export { DestructiveConfirmOptions as DestructiveConfirmOptions_alias_1 }
676
+
643
677
  export { DistanceMeasurement }
644
678
 
645
679
  export { DndContext }
@@ -1669,6 +1703,23 @@ declare type NavTriggerRef = RefObject<HTMLButtonElement>;
1669
1703
  export { NavTriggerRef }
1670
1704
  export { NavTriggerRef as NavTriggerRef_alias_1 }
1671
1705
 
1706
+ declare interface NonDestructiveConfirmModalOptions extends BaseConfirmOptions {
1707
+ /**
1708
+ * The kind of confirm modal to show.
1709
+ * @default 'non-destructive'
1710
+ */
1711
+ kind?: 'non-destructive';
1712
+ /**
1713
+ * The description of the confirm modal. Can be a ReactNode for non-destructive kind if you need to display text links.
1714
+ * @example
1715
+ * ```tsx
1716
+ * description: <>Use a Fragment because we put the content within a Paragraph tag.</>
1717
+ */
1718
+ description?: ReactNode;
1719
+ }
1720
+ export { NonDestructiveConfirmModalOptions }
1721
+ export { NonDestructiveConfirmModalOptions as NonDestructiveConfirmModalOptions_alias_1 }
1722
+
1672
1723
  declare type NonIndeterminateProgressBarProps = {
1673
1724
  /**
1674
1725
  * A unique identifier for the progress bar. Required for accessibility.
@@ -1869,7 +1920,7 @@ export { pointerWithin }
1869
1920
  * )
1870
1921
  * }
1871
1922
  */
1872
- declare function Portal(props: PropsWithChildren<PortalProps>): ReactPortal;
1923
+ declare const Portal: (props: PropsWithChildren<PortalProps_2>) => JSX_2.Element;
1873
1924
  export { Portal }
1874
1925
  export { Portal as Portal_alias_1 }
1875
1926
 
@@ -1877,17 +1928,7 @@ export { Portal as Portal_alias_1 }
1877
1928
  * This module is the Portal component.
1878
1929
  * @module
1879
1930
  */
1880
- declare interface PortalProps {
1881
- /**
1882
- * The root container to render the children into.
1883
- * @default document.body
1884
- */
1885
- container?: Element | DocumentFragment;
1886
- /**
1887
- * An optional key to use for the Portal component.
1888
- */
1889
- key?: null | string;
1890
- }
1931
+ declare type PortalProps = PortalProps_2;
1891
1932
  export { PortalProps }
1892
1933
  export { PortalProps as PortalProps_alias_1 }
1893
1934
 
@@ -2046,6 +2087,23 @@ export { RadioRecipe as RadioRecipe_alias_1 }
2046
2087
 
2047
2088
  export { rectIntersection }
2048
2089
 
2090
+ /**
2091
+ * This module provides a hook to get Cerberus colors from the document root.
2092
+ * @module useRootColors
2093
+ */
2094
+ declare interface RootColorsResult {
2095
+ /**
2096
+ * A record of Cerberus colors where the key is the token name provided and the value is the color hex.
2097
+ */
2098
+ colors: Record<string, string>;
2099
+ /**
2100
+ * A function to refetch the Cerberus colors from the document root. Useful when you need the latest colors after a theme/mode change.
2101
+ */
2102
+ refetch: () => Promise<void>;
2103
+ }
2104
+ export { RootColorsResult }
2105
+ export { RootColorsResult as RootColorsResult_alias_1 }
2106
+
2049
2107
  export { ScreenReaderInstructions }
2050
2108
 
2051
2109
  /**
@@ -2138,33 +2196,7 @@ declare function Show(props: PropsWithChildren<ShowProps>): ReactNode;
2138
2196
  export { Show }
2139
2197
  export { Show as Show_alias_1 }
2140
2198
 
2141
- /**
2142
- * This module provides a context and hook for the confirm modal.
2143
- * @module
2144
- */
2145
- declare interface ShowConfirmModalOptions {
2146
- /**
2147
- * The kind of confirm modal to show.
2148
- * @default 'non-destructive'
2149
- */
2150
- kind?: 'destructive' | 'non-destructive';
2151
- /**
2152
- * The heading of the confirm modal.
2153
- */
2154
- heading: string;
2155
- /**
2156
- * The description of the confirm modal.
2157
- */
2158
- description?: string;
2159
- /**
2160
- * The text for the action button.
2161
- */
2162
- actionText: string;
2163
- /**
2164
- * The text for the cancel button.
2165
- */
2166
- cancelText: string;
2167
- }
2199
+ declare type ShowConfirmModalOptions = NonDestructiveConfirmModalOptions | DestructiveConfirmOptions;
2168
2200
  export { ShowConfirmModalOptions }
2169
2201
  export { ShowConfirmModalOptions as ShowConfirmModalOptions_alias_1 }
2170
2202
 
@@ -2985,6 +3017,17 @@ declare function usePromptModal(): PromptModalValue;
2985
3017
  export { usePromptModal }
2986
3018
  export { usePromptModal as usePromptModal_alias_1 }
2987
3019
 
3020
+ /**
3021
+ * This hook returns a record of Cerberus colors from the document root.
3022
+ * This is useful when you are working with a component that uses the `<canvas>`
3023
+ * element.
3024
+ * @param colors - An array of Cerberus tokens to get from the document root (i.e. `['dataViz.diverging.50', 'dataViz.diverging.200']`).
3025
+ * @returns A record of Cerberus colors where the key is the token name provided and the value is the color hex.
3026
+ */
3027
+ declare function useRootColors(colors?: string[]): RootColorsResult;
3028
+ export { useRootColors }
3029
+ export { useRootColors as useRootColors_alias_1 }
3030
+
2988
3031
  export { useSensor }
2989
3032
 
2990
3033
  export { useSensors }
@@ -1,6 +1,9 @@
1
+ import {
2
+ NotificationHeading
3
+ } from "./chunk-SXIXDXG3.js";
1
4
  import {
2
5
  Portal
3
- } from "./chunk-K2PSHGS7.js";
6
+ } from "./chunk-IQJDVFPP.js";
4
7
  import {
5
8
  Notification
6
9
  } from "./chunk-7SGPJM66.js";
@@ -8,14 +11,11 @@ import {
8
11
  NotificationDescription
9
12
  } from "./chunk-XEW6TJJ4.js";
10
13
  import {
11
- NotificationHeading
12
- } from "./chunk-SXIXDXG3.js";
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-KUT2YEEQ.js.map
162
+ //# sourceMappingURL=chunk-3XGLNXJJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/notification-center.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Show } from '../components/Show'\nimport { NotificationHeading } from '../components/NotificationHeading'\nimport { NotificationDescription } from '../components/NotificationDescription'\nimport { Notification } from '../components/Notification'\nimport { animateIn, vstack } from '@cerberus/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n /**\n * The palette of the notification.\n * @default 'info'\n */\n palette: 'info' | 'success' | 'warning' | 'danger'\n /**\n * The heading of the notification.\n */\n heading: string\n /**\n * The unique id of the notification.\n */\n id?: string\n /**\n * The description of the notification.\n */\n description?: ReactNode\n /**\n * The action to take when the notification is closed\n */\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport interface NotificationsProviderProps extends PortalProps {}\n\n/**\n * Provides a notification center to the app.\n * @see https://cerberus.digitalu.design/react/notification\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <Notifications>\n * <SomeFeatureSection />\n * </Notifications>\n *\n * // Use the hook to show a notification.\n * const notify = useNotifications()\n *\n * const handleClick = useCallback(() => {\n * notify({\n * palette: 'info',\n * heading: 'New feature!',\n * description: 'We have added a new feature to the app.',\n * })\n * }, [notify])\n * ```\n */\nexport function NotificationCenter(\n props: PropsWithChildren<NotificationsProviderProps>,\n) {\n const [activeNotifications, setActiveNotifications] = useState<\n NotifyOptions[]\n >([])\n const styles = notification()\n\n const handleNotify = useCallback((options: NotifyOptions) => {\n setActiveNotifications((prev) => {\n const id = `${options.palette}:${prev.length + 1}`\n return [...prev, { ...options, id }]\n })\n }, [])\n\n const handleClose = useCallback((e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n setActiveNotifications((prev) => {\n const item = prev.find((option) => option.id === target.value)\n if (item?.onClose) item.onClose()\n return prev.filter((option) => option.id !== target.value)\n })\n }, [])\n\n const handleCloseAll = useCallback(() => {\n setActiveNotifications((prev) => {\n prev.forEach((item) => {\n if (item.onClose) item.onClose()\n })\n return []\n })\n }, [])\n\n const value = useMemo(\n () => ({\n notify: handleNotify,\n }),\n [handleNotify],\n )\n\n // For some reason, the vstack pattern alignItems is not registering here.\n // So we are forcing it with the style prop.\n\n return (\n <NotificationsContext.Provider value={value}>\n {props.children}\n\n <Show when={activeNotifications.length > 0}>\n <Portal container={props.container}>\n <div className={styles.center}>\n <Show when={activeNotifications.length >= 4}>\n <Button\n className={cx(styles.closeAll, animateIn())}\n onClick={handleCloseAll}\n palette=\"action\"\n shape=\"rounded\"\n size=\"sm\"\n usage=\"ghost\"\n >\n Close all\n </Button>\n </Show>\n\n <div\n className={vstack({\n alignItems: 'flex-end',\n gap: '4',\n })}\n style={{\n alignItems: 'flex-end',\n }}\n >\n {activeNotifications.map((option) => (\n <MatchNotification\n key={option.id}\n {...option}\n onClose={handleClose}\n />\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\n )\n}\n\ninterface MatchNotificationProps extends Omit<NotifyOptions, 'onClose'> {\n onClose: (e: MouseEvent<HTMLButtonElement>) => void\n key: string | undefined\n}\n\nfunction MatchNotification(props: MatchNotificationProps) {\n const { palette, id, onClose, heading, description } = props\n\n switch (palette) {\n case 'success':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"success\"\n >\n <NotificationHeading palette=\"success\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"success\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'warning':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"warning\"\n >\n <NotificationHeading palette=\"warning\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"warning\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'danger':\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"danger\">\n <NotificationHeading palette=\"danger\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"danger\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'info':\n default:\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"info\">\n <NotificationHeading palette=\"info\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"info\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n }\n}\n\n/**\n * The hook to use the NotificationCenter.\n * @returns The notify method to trigger a notification.\n * @example\n * ```tsx\n * const {notify} = useNotificationCenter()\n * notify({\n * palette: 'info',\n * heading: 'New feature',\n * description: 'We have added a new feature to the app.',\n * })\n * ```\n */\nexport function useNotificationCenter(): NotificationsValue {\n const context = useContext(NotificationsContext)\n if (!context) {\n throw new Error(\n 'useNotificationCenter must be used within a NotificationsProvider',\n )\n }\n return context\n}\n"],"mappings":"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","names":[]}
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  Portal
3
- } from "./chunk-K2PSHGS7.js";
3
+ } from "./chunk-IQJDVFPP.js";
4
+ import {
5
+ ModalDescription
6
+ } from "./chunk-Q7BRMIBR.js";
4
7
  import {
5
8
  ModalHeader
6
- } from "./chunk-ZFAIE47A.js";
9
+ } from "./chunk-XY6WL55R.js";
7
10
  import {
8
11
  ModalHeading
9
12
  } from "./chunk-2UXE5PDG.js";
@@ -17,8 +20,8 @@ import {
17
20
  Modal
18
21
  } from "./chunk-BE4EOU2P.js";
19
22
  import {
20
- ModalDescription
21
- } from "./chunk-Q7BRMIBR.js";
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-NCUHRVW2.js.map
243
+ //# sourceMappingURL=chunk-FBSESDWJ.js.map
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  Portal
3
- } from "./chunk-K2PSHGS7.js";
3
+ } from "./chunk-IQJDVFPP.js";
4
+ import {
5
+ ModalDescription
6
+ } from "./chunk-Q7BRMIBR.js";
4
7
  import {
5
8
  ModalHeader
6
- } from "./chunk-ZFAIE47A.js";
9
+ } from "./chunk-XY6WL55R.js";
7
10
  import {
8
11
  ModalHeading
9
12
  } from "./chunk-2UXE5PDG.js";
@@ -11,8 +14,8 @@ import {
11
14
  Modal
12
15
  } from "./chunk-BE4EOU2P.js";
13
16
  import {
14
- ModalDescription
15
- } from "./chunk-Q7BRMIBR.js";
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";
@@ -43,6 +43,7 @@ import {
43
43
  } from "react";
44
44
  import { css } from "@cerberus/styled-system/css";
45
45
  import { hstack } from "@cerberus/styled-system/patterns";
46
+ import { HStack, VStack } from "@cerberus/styled-system/jsx";
46
47
  import { jsx, jsxs } from "react/jsx-runtime";
47
48
  var ConfirmModalContext = createContext(null);
48
49
  function ConfirmModal(props) {
@@ -51,9 +52,10 @@ function ConfirmModal(props) {
51
52
  const [content, setContent] = useState(null);
52
53
  const focusTrap = trapFocus(modalRef);
53
54
  const ConfirmIcon = $cerberusIcons.confirmModal;
55
+ const kind = content?.kind ?? "non-destructive";
54
56
  const palette = useMemo(
55
- () => content?.kind === "destructive" ? "danger" : "action",
56
- [content]
57
+ () => kind === "destructive" ? "danger" : "action",
58
+ [kind]
57
59
  );
58
60
  const handleChoice = useCallback(
59
61
  (e) => {
@@ -69,7 +71,7 @@ function ConfirmModal(props) {
69
71
  const handleShow = useCallback(
70
72
  (options) => {
71
73
  return new Promise((resolve) => {
72
- setContent({ ...options, kind: options.kind || "non-destructive" });
74
+ setContent({ ...options });
73
75
  show();
74
76
  resolveRef.current = resolve;
75
77
  });
@@ -84,7 +86,7 @@ function ConfirmModal(props) {
84
86
  );
85
87
  return /* @__PURE__ */ jsxs(ConfirmModalContext.Provider, { value, children: [
86
88
  props.children,
87
- /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
89
+ /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Modal, { onKeyDown: focusTrap, ref: modalRef, children: /* @__PURE__ */ jsxs(VStack, { gap: "xl", w: "full", children: [
88
90
  /* @__PURE__ */ jsxs(ModalHeader, { children: [
89
91
  /* @__PURE__ */ jsx(
90
92
  "div",
@@ -122,44 +124,36 @@ function ConfirmModal(props) {
122
124
  /* @__PURE__ */ jsx(ModalHeading, { children: content?.heading }),
123
125
  /* @__PURE__ */ jsx(ModalDescription, { children: content?.description })
124
126
  ] }),
125
- /* @__PURE__ */ jsxs(
126
- "div",
127
- {
128
- className: hstack({
129
- gap: "4"
130
- }),
131
- children: [
132
- /* @__PURE__ */ jsx(
133
- Button,
134
- {
135
- autoFocus: true,
136
- className: css({
137
- w: "1/2"
138
- }),
139
- name: "confirm",
140
- onClick: handleChoice,
141
- palette,
142
- value: "true",
143
- children: content?.actionText
144
- }
145
- ),
146
- /* @__PURE__ */ jsx(
147
- Button,
148
- {
149
- className: css({
150
- w: "1/2"
151
- }),
152
- name: "cancel",
153
- onClick: handleChoice,
154
- usage: "outlined",
155
- value: "false",
156
- children: content?.cancelText
157
- }
158
- )
159
- ]
160
- }
161
- )
162
- ] }) })
127
+ /* @__PURE__ */ jsxs(HStack, { gap: "4", w: "full", children: [
128
+ /* @__PURE__ */ jsx(
129
+ Button,
130
+ {
131
+ autoFocus: true,
132
+ className: css({
133
+ w: "1/2"
134
+ }),
135
+ name: "confirm",
136
+ onClick: handleChoice,
137
+ palette,
138
+ value: "true",
139
+ children: content?.actionText
140
+ }
141
+ ),
142
+ /* @__PURE__ */ jsx(
143
+ Button,
144
+ {
145
+ className: css({
146
+ w: "1/2"
147
+ }),
148
+ name: "cancel",
149
+ onClick: handleChoice,
150
+ usage: "outlined",
151
+ value: "false",
152
+ children: content?.cancelText
153
+ }
154
+ )
155
+ ] })
156
+ ] }) }) })
163
157
  ] });
164
158
  }
165
159
  function useConfirmModal() {
@@ -176,4 +170,4 @@ export {
176
170
  ConfirmModal,
177
171
  useConfirmModal
178
172
  };
179
- //# sourceMappingURL=chunk-KFGI37CO.js.map
173
+ //# sourceMappingURL=chunk-GRUXP3NG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/confirm-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Show } from '../components/Show'\nimport { Modal } from '../components/Modal'\nimport { useModal } from '../hooks/useModal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\nimport { Avatar } from '../components/Avatar'\nimport { HStack, VStack } from '@cerberus/styled-system/jsx'\n\n/**\n * This module provides a context and hook for the confirm modal.\n * @module\n */\n\nexport interface BaseConfirmOptions {\n /**\n * The heading of the confirm modal.\n */\n heading: string\n /**\n * The text for the action button.\n */\n actionText: string\n /**\n * The text for the cancel button.\n */\n cancelText: string\n}\n\nexport interface DestructiveConfirmOptions extends BaseConfirmOptions {\n /**\n * The kind of confirm modal to show.\n */\n kind?: 'destructive'\n /**\n * The description of the confirm modal. Can only be a string for destructive confirm modals.\n */\n description?: string\n}\n\nexport interface NonDestructiveConfirmModalOptions extends BaseConfirmOptions {\n /**\n * The kind of confirm modal to show.\n * @default 'non-destructive'\n */\n kind?: 'non-destructive'\n /**\n * The description of the confirm modal. Can be a ReactNode for non-destructive kind if you need to display text links.\n * @example\n * ```tsx\n * description: <>Use a Fragment because we put the content within a Paragraph tag.</>\n */\n description?: ReactNode\n}\n\nexport type ShowConfirmModalOptions =\n | NonDestructiveConfirmModalOptions\n | DestructiveConfirmOptions\n\nexport type ShowResult =\n | ((value: boolean | PromiseLike<boolean>) => void)\n | null\n\nexport interface ConfirmModalValue {\n show: (options: ShowConfirmModalOptions) => Promise<boolean>\n}\n\nconst ConfirmModalContext = createContext<ConfirmModalValue | null>(null)\n\nexport interface ConfirmModalProviderProps {}\n\n/**\n * Provides a confirm modal to the app.\n * @see https://cerberus.digitalu.design/react/confirm-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <ConfirmModal>\n * <SomeFeatureSection />\n * </ConfirmModal>\n *\n * // Use the hook to show the confirm modal.\n * const confirm = useConfirmModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await confirm.show({\n * heading: 'Add new payment method?',\n * description:\n * 'This will add a new payment method to your account to be billed for future purchases.',\n * actionText: 'Yes, add payment method',\n * cancelText: 'No, cancel',\n * })\n * setConsent(userConsent)\n * }, [confirm])\n * ```\n */\nexport function ConfirmModal(\n props: PropsWithChildren<ConfirmModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<ShowResult>(null)\n const [content, setContent] = useState<ShowConfirmModalOptions | null>(null)\n const focusTrap = trapFocus(modalRef)\n const ConfirmIcon = $cerberusIcons.confirmModal\n const kind = content?.kind ?? 'non-destructive'\n\n const palette = useMemo(\n () => (kind === 'destructive' ? 'danger' : 'action'),\n [kind],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(true)\n }\n resolveRef.current?.(false)\n close()\n },\n [close],\n )\n\n const handleShow = useCallback(\n (options: ShowConfirmModalOptions) => {\n return new Promise<boolean>((resolve) => {\n setContent({ ...options })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <ConfirmModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <VStack gap=\"xl\" w=\"full\">\n <ModalHeader>\n <div\n className={hstack({\n justify: 'center',\n w: 'full',\n })}\n >\n <Show\n when={palette === 'danger'}\n fallback={\n <Avatar\n ariaLabel=\"\"\n gradient=\"charon-light\"\n icon={<ConfirmIcon size={24} />}\n src=\"\"\n />\n }\n >\n <Avatar\n ariaLabel=\"\"\n gradient=\"hades-dark\"\n icon={<ConfirmIcon size={24} />}\n src=\"\"\n />\n </Show>\n </div>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <HStack gap=\"4\" w=\"full\">\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </HStack>\n </VStack>\n </Modal>\n </Portal>\n </ConfirmModalContext.Provider>\n )\n}\n\nexport function useConfirmModal(): ConfirmModalValue {\n const context = useContext(ConfirmModalContext)\n if (context === null) {\n throw new Error(\n 'useConfirmModal must be used within a ConfirmModal Provider',\n )\n }\n return context\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,10 @@
1
+ // src/components/Portal.tsx
2
+ import {
3
+ Portal as ArkPortal
4
+ } from "@ark-ui/react";
5
+ var Portal = ArkPortal;
6
+
7
+ export {
8
+ Portal
9
+ };
10
+ //# sourceMappingURL=chunk-IQJDVFPP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Portal.tsx"],"sourcesContent":["import {\n Portal as ArkPortal,\n type PortalProps as ArkPortalProps,\n} from '@ark-ui/react'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport type PortalProps = ArkPortalProps\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @see https://cerberus.digitalu.design/react/portal\n * @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)\n * @example\n * ```tsx\n * 'use client'\n *\n * import { Portal } from '@cerberus/react'\n *\n * function SomeFeatureWithinSSRPage() {\n * return (\n * <Portal>\n * <div>Portal Content outside of the React VDom tree</div>\n * </Portal>\n * )\n * }\n */\nexport const Portal = ArkPortal\n"],"mappings":";AAAA;AAAA,EACE,UAAU;AAAA,OAEL;AA2BA,IAAM,SAAS;","names":[]}
@@ -0,0 +1,39 @@
1
+ // src/hooks/useRootColors.ts
2
+ import { useCallback, useEffect, useMemo, useReducer } from "react";
3
+ function useRootColors(colors = []) {
4
+ const [state, dispatch] = useReducer(rootColorsReducer, {});
5
+ const handleRefetch = useCallback(() => {
6
+ return new Promise((resolve) => {
7
+ dispatch(formatColors(colors));
8
+ resolve();
9
+ });
10
+ }, []);
11
+ useEffect(() => {
12
+ if (Object.keys(state).length === colors.length) return;
13
+ dispatch(formatColors(colors));
14
+ console.log("updating colors in root hook");
15
+ }, [colors]);
16
+ return useMemo(
17
+ () => ({ colors: state, refetch: handleRefetch }),
18
+ [state, handleRefetch]
19
+ );
20
+ }
21
+ function formatColors(colors) {
22
+ const rootStyles = getComputedStyle(document.body);
23
+ return colors.reduce(
24
+ (acc, color) => {
25
+ const formattedColor = color.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase().replaceAll(".", "-");
26
+ acc[color] = rootStyles.getPropertyValue(`--cerberus-colors-${formattedColor}`).trim();
27
+ return acc;
28
+ },
29
+ {}
30
+ );
31
+ }
32
+ function rootColorsReducer(state, action) {
33
+ return { ...state, ...action };
34
+ }
35
+
36
+ export {
37
+ useRootColors
38
+ };
39
+ //# sourceMappingURL=chunk-RMVJK26W.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/useRootColors.ts"],"sourcesContent":["'use client'\n\nimport { useCallback, useEffect, useMemo, 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 interface RootColorsResult {\n /**\n * A record of Cerberus colors where the key is the token name provided and the value is the color hex.\n */\n colors: Record<string, string>\n /**\n * A function to refetch the Cerberus colors from the document root. Useful when you need the latest colors after a theme/mode change.\n */\n refetch: () => Promise<void>\n}\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 const handleRefetch = useCallback(() => {\n return new Promise<void>((resolve) => {\n dispatch(formatColors(colors))\n resolve()\n })\n }, [])\n\n useEffect(() => {\n if (Object.keys(state).length === colors.length) return\n dispatch(formatColors(colors))\n console.log('updating colors in root hook')\n }, [colors])\n\n // reducer is already memoized\n return useMemo(\n () => ({ colors: state, refetch: handleRefetch }),\n [state, handleRefetch],\n )\n}\n\nfunction formatColors(colors: string[]): Record<string, string> {\n const rootStyles = getComputedStyle(document.body)\n return colors.reduce(\n (acc, color) => {\n const formattedColor = color\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase()\n .replaceAll('.', '-')\n acc[color] = rootStyles\n .getPropertyValue(`--cerberus-colors-${formattedColor}`)\n .trim()\n return acc\n },\n {} as Record<string, string>,\n )\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,aAAa,WAAW,SAAS,kBAAkB;AAyBrD,SAAS,cAAc,SAAmB,CAAC,GAAqB;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAI,WAAW,mBAAmB,CAAC,CAAC;AAE1D,QAAM,gBAAgB,YAAY,MAAM;AACtC,WAAO,IAAI,QAAc,CAAC,YAAY;AACpC,eAAS,aAAa,MAAM,CAAC;AAC7B,cAAQ;AAAA,IACV,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,QAAI,OAAO,KAAK,KAAK,EAAE,WAAW,OAAO,OAAQ;AACjD,aAAS,aAAa,MAAM,CAAC;AAC7B,YAAQ,IAAI,8BAA8B;AAAA,EAC5C,GAAG,CAAC,MAAM,CAAC;AAGX,SAAO;AAAA,IACL,OAAO,EAAE,QAAQ,OAAO,SAAS,cAAc;AAAA,IAC/C,CAAC,OAAO,aAAa;AAAA,EACvB;AACF;AAEA,SAAS,aAAa,QAA0C;AAC9D,QAAM,aAAa,iBAAiB,SAAS,IAAI;AACjD,SAAO,OAAO;AAAA,IACZ,CAAC,KAAK,UAAU;AACd,YAAM,iBAAiB,MACpB,QAAQ,mBAAmB,OAAO,EAClC,YAAY,EACZ,WAAW,KAAK,GAAG;AACtB,UAAI,KAAK,IAAI,WACV,iBAAiB,qBAAqB,cAAc,EAAE,EACtD,KAAK;AACR,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAEA,SAAS,kBACP,OACA,QACwB;AACxB,SAAO,EAAE,GAAG,OAAO,GAAG,OAAO;AAC/B;","names":[]}
@@ -1,21 +1,24 @@
1
1
  import {
2
2
  Portal
3
- } from "./chunk-K2PSHGS7.js";
3
+ } from "./chunk-IQJDVFPP.js";
4
+ import {
5
+ ModalDescription
6
+ } from "./chunk-Q7BRMIBR.js";
4
7
  import {
5
8
  ModalHeader
6
- } from "./chunk-ZFAIE47A.js";
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
- ModalDescription
15
- } from "./chunk-Q7BRMIBR.js";
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";
@@ -101,42 +101,42 @@ function CTAModal(props) {
101
101
  children: /* @__PURE__ */ jsx(IconButton, { ariaLabel: "Close modal", onClick: close, children: /* @__PURE__ */ jsx(CloseIcon, {}) })
102
102
  }
103
103
  ),
104
- /* @__PURE__ */ jsxs(ModalHeader, { children: [
105
- /* @__PURE__ */ jsx(HStack, { justify: "center", w: "full", children: /* @__PURE__ */ jsx(
106
- Avatar,
107
- {
108
- ariaLabel: "",
109
- gradient: "charon-light",
110
- icon: /* @__PURE__ */ jsx(
111
- Show,
112
- {
113
- when: Boolean(confirmIcon),
114
- fallback: /* @__PURE__ */ jsx(FallbackIcon, { size: 24 }),
115
- children: confirmIcon
116
- }
117
- ),
118
- src: ""
119
- }
120
- ) }),
121
- /* @__PURE__ */ jsxs(VStack, { gap: "lg", w: "full", children: [
104
+ /* @__PURE__ */ jsxs(VStack, { gap: "xl", w: "full", children: [
105
+ /* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", w: "full", children: [
106
+ /* @__PURE__ */ jsx(
107
+ Avatar,
108
+ {
109
+ ariaLabel: "",
110
+ gradient: "charon-light",
111
+ icon: /* @__PURE__ */ jsx(
112
+ Show,
113
+ {
114
+ when: Boolean(confirmIcon),
115
+ fallback: /* @__PURE__ */ jsx(FallbackIcon, { size: 24 }),
116
+ children: confirmIcon
117
+ }
118
+ ),
119
+ src: ""
120
+ }
121
+ ),
122
122
  /* @__PURE__ */ jsx(ModalHeading, { children: content?.heading }),
123
123
  /* @__PURE__ */ jsx(ModalDescription, { children: content?.description })
124
- ] })
125
- ] }),
126
- /* @__PURE__ */ jsx(HStack, { gap: "md", pt: "sm", w: "full", children: /* @__PURE__ */ jsx(Show, { when: Boolean(content?.actions?.length), children: content?.actions?.map((action, index) => /* @__PURE__ */ jsx(
127
- Button,
128
- {
129
- "data-index": index,
130
- className: css({
131
- w: "1/2"
132
- }),
133
- onClick: handleActionClick,
134
- shape: "rounded",
135
- usage: "outlined",
136
- children: action.text
137
- },
138
- index
139
- )) }) })
124
+ ] }) }),
125
+ /* @__PURE__ */ jsx(HStack, { gap: "md", w: "full", children: /* @__PURE__ */ jsx(Show, { when: Boolean(content?.actions?.length), children: content?.actions?.map((action, index) => /* @__PURE__ */ jsx(
126
+ Button,
127
+ {
128
+ "data-index": index,
129
+ className: css({
130
+ w: "1/2"
131
+ }),
132
+ onClick: handleActionClick,
133
+ shape: "rounded",
134
+ usage: "outlined",
135
+ children: action.text
136
+ },
137
+ index
138
+ )) }) })
139
+ ] })
140
140
  ] }) })
141
141
  ] });
142
142
  }
@@ -152,4 +152,4 @@ export {
152
152
  CTAModal,
153
153
  useCTAModal
154
154
  };
155
- //# sourceMappingURL=chunk-J4LOSTEP.js.map
155
+ //# sourceMappingURL=chunk-WFJWCZ7E.js.map