@cerberus-design/react 0.6.1-next-0345599 → 0.6.1-next-1315bf2

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 (108) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.ts +147 -3
  2. package/build/legacy/aria-helpers/trap-focus.aria.js +7 -0
  3. package/build/legacy/aria-helpers/trap-focus.aria.js.map +1 -0
  4. package/build/legacy/{chunk-3CBN7U25.js → chunk-3TYUA4C7.js} +6 -3
  5. package/build/legacy/chunk-3TYUA4C7.js.map +1 -0
  6. package/build/legacy/chunk-4CAT3FHV.js +11 -0
  7. package/build/legacy/chunk-4CAT3FHV.js.map +1 -0
  8. package/build/legacy/chunk-4M3EUP57.js +22 -0
  9. package/build/legacy/chunk-4M3EUP57.js.map +1 -0
  10. package/build/{modern/chunk-X4YQ27D5.js → legacy/chunk-5RA3ZIXA.js} +2 -2
  11. package/build/legacy/{chunk-5XNLWIZO.js → chunk-EVEEQRH6.js} +2 -2
  12. package/build/legacy/chunk-EVEEQRH6.js.map +1 -0
  13. package/build/{modern/chunk-HE3HFKYU.js → legacy/chunk-JJGZRBIR.js} +2 -2
  14. package/build/legacy/{chunk-HE3HFKYU.js.map → chunk-JJGZRBIR.js.map} +1 -1
  15. package/build/legacy/chunk-KESKDLX6.js +30 -0
  16. package/build/legacy/chunk-KESKDLX6.js.map +1 -0
  17. package/build/{modern/chunk-G2QMBSK5.js → legacy/chunk-PMCYXRAH.js} +2 -2
  18. package/build/legacy/chunk-PMCYXRAH.js.map +1 -0
  19. package/build/legacy/chunk-SCAVVE6E.js +16 -0
  20. package/build/legacy/chunk-SCAVVE6E.js.map +1 -0
  21. package/build/legacy/{chunk-734PGVLT.js → chunk-VLVKNEA5.js} +2 -2
  22. package/build/legacy/chunk-VULPMZUW.js +18 -0
  23. package/build/legacy/chunk-VULPMZUW.js.map +1 -0
  24. package/build/legacy/chunk-YRUUO4AP.js +166 -0
  25. package/build/legacy/chunk-YRUUO4AP.js.map +1 -0
  26. package/build/legacy/components/FeatureFlag.js +10 -0
  27. package/build/legacy/components/FeatureFlag.js.map +1 -0
  28. package/build/legacy/components/Input.js +3 -3
  29. package/build/legacy/components/Label.js +1 -1
  30. package/build/legacy/components/NavMenuList.js +1 -1
  31. package/build/legacy/components/Portal.js +7 -0
  32. package/build/legacy/components/Portal.js.map +1 -0
  33. package/build/legacy/components/Tag.js +1 -1
  34. package/build/legacy/components/Toggle.js +3 -3
  35. package/build/legacy/config/cerbIcons.js +1 -1
  36. package/build/legacy/config/defineIcons.js +2 -2
  37. package/build/legacy/context/confirm-modal.js +16 -0
  38. package/build/legacy/context/confirm-modal.js.map +1 -0
  39. package/build/legacy/context/feature-flags.js +10 -0
  40. package/build/legacy/context/feature-flags.js.map +1 -0
  41. package/build/legacy/index.js +50 -26
  42. package/build/modern/_tsup-dts-rollup.d.ts +147 -3
  43. package/build/modern/aria-helpers/trap-focus.aria.js +7 -0
  44. package/build/modern/aria-helpers/trap-focus.aria.js.map +1 -0
  45. package/build/modern/{chunk-3CBN7U25.js → chunk-3TYUA4C7.js} +6 -3
  46. package/build/modern/chunk-3TYUA4C7.js.map +1 -0
  47. package/build/modern/chunk-4CAT3FHV.js +11 -0
  48. package/build/modern/chunk-4CAT3FHV.js.map +1 -0
  49. package/build/modern/chunk-4M3EUP57.js +22 -0
  50. package/build/modern/chunk-4M3EUP57.js.map +1 -0
  51. package/build/{legacy/chunk-X4YQ27D5.js → modern/chunk-5RA3ZIXA.js} +2 -2
  52. package/build/modern/chunk-BVK6GEDZ.js +164 -0
  53. package/build/modern/chunk-BVK6GEDZ.js.map +1 -0
  54. package/build/modern/chunk-JIZQFTW6.js +29 -0
  55. package/build/modern/chunk-JIZQFTW6.js.map +1 -0
  56. package/build/{legacy/chunk-HE3HFKYU.js → modern/chunk-JJGZRBIR.js} +2 -2
  57. package/build/modern/{chunk-HE3HFKYU.js.map → chunk-JJGZRBIR.js.map} +1 -1
  58. package/build/{legacy/chunk-G2QMBSK5.js → modern/chunk-PMCYXRAH.js} +2 -2
  59. package/build/modern/chunk-PMCYXRAH.js.map +1 -0
  60. package/build/modern/chunk-SCAVVE6E.js +16 -0
  61. package/build/modern/chunk-SCAVVE6E.js.map +1 -0
  62. package/build/modern/{chunk-734PGVLT.js → chunk-VLVKNEA5.js} +2 -2
  63. package/build/modern/chunk-VULPMZUW.js +18 -0
  64. package/build/modern/chunk-VULPMZUW.js.map +1 -0
  65. package/build/modern/{chunk-SLIOCQBZ.js → chunk-Z6IWNVPN.js} +2 -2
  66. package/build/modern/chunk-Z6IWNVPN.js.map +1 -0
  67. package/build/modern/components/FeatureFlag.js +10 -0
  68. package/build/modern/components/FeatureFlag.js.map +1 -0
  69. package/build/modern/components/Input.js +3 -3
  70. package/build/modern/components/Label.js +1 -1
  71. package/build/modern/components/NavMenuList.js +1 -1
  72. package/build/modern/components/Portal.js +7 -0
  73. package/build/modern/components/Portal.js.map +1 -0
  74. package/build/modern/components/Tag.js +1 -1
  75. package/build/modern/components/Toggle.js +3 -3
  76. package/build/modern/config/cerbIcons.js +1 -1
  77. package/build/modern/config/defineIcons.js +2 -2
  78. package/build/modern/context/confirm-modal.js +16 -0
  79. package/build/modern/context/confirm-modal.js.map +1 -0
  80. package/build/modern/context/feature-flags.js +10 -0
  81. package/build/modern/context/feature-flags.js.map +1 -0
  82. package/build/modern/index.js +50 -26
  83. package/package.json +3 -2
  84. package/src/aria-helpers/trap-focus.aria.ts +29 -0
  85. package/src/components/FeatureFlag.tsx +14 -0
  86. package/src/components/Label.tsx +1 -1
  87. package/src/components/NavMenuList.tsx +1 -1
  88. package/src/components/Portal.tsx +22 -0
  89. package/src/components/Tag.tsx +1 -1
  90. package/src/config/cerbIcons.ts +9 -2
  91. package/src/config/defineIcons.ts +6 -3
  92. package/src/context/confirm-modal.tsx +205 -0
  93. package/src/context/feature-flags.tsx +60 -0
  94. package/src/index.ts +5 -0
  95. package/build/legacy/chunk-3CBN7U25.js.map +0 -1
  96. package/build/legacy/chunk-5MNCW677.js +0 -11
  97. package/build/legacy/chunk-5MNCW677.js.map +0 -1
  98. package/build/legacy/chunk-5XNLWIZO.js.map +0 -1
  99. package/build/legacy/chunk-G2QMBSK5.js.map +0 -1
  100. package/build/modern/chunk-3CBN7U25.js.map +0 -1
  101. package/build/modern/chunk-5MNCW677.js +0 -11
  102. package/build/modern/chunk-5MNCW677.js.map +0 -1
  103. package/build/modern/chunk-G2QMBSK5.js.map +0 -1
  104. package/build/modern/chunk-SLIOCQBZ.js.map +0 -1
  105. /package/build/legacy/{chunk-X4YQ27D5.js.map → chunk-5RA3ZIXA.js.map} +0 -0
  106. /package/build/legacy/{chunk-734PGVLT.js.map → chunk-VLVKNEA5.js.map} +0 -0
  107. /package/build/modern/{chunk-X4YQ27D5.js.map → chunk-5RA3ZIXA.js.map} +0 -0
  108. /package/build/modern/{chunk-734PGVLT.js.map → chunk-VLVKNEA5.js.map} +0 -0
@@ -0,0 +1,166 @@
1
+ import {
2
+ Portal
3
+ } from "./chunk-4CAT3FHV.js";
4
+ import {
5
+ Button
6
+ } from "./chunk-2ATICEW3.js";
7
+ import {
8
+ Show
9
+ } from "./chunk-4O4QFF4S.js";
10
+ import {
11
+ trapFocus
12
+ } from "./chunk-KESKDLX6.js";
13
+ import {
14
+ $cerberusIcons
15
+ } from "./chunk-3TYUA4C7.js";
16
+
17
+ // src/context/confirm-modal.tsx
18
+ import {
19
+ createContext,
20
+ useCallback,
21
+ useContext,
22
+ useMemo,
23
+ useRef,
24
+ useState
25
+ } from "react";
26
+ import { css, cx } from "@cerberus-design/styled-system/css";
27
+ import { circle, hstack, vstack } from "@cerberus-design/styled-system/patterns";
28
+ import {
29
+ confirmModal
30
+ } from "@cerberus-design/styled-system/recipes";
31
+ import { jsx, jsxs } from "react/jsx-runtime";
32
+ var ConfirmModalContext = createContext(null);
33
+ function ConfirmModal(props) {
34
+ const dialogRef = useRef(null);
35
+ const resolveRef = useRef(null);
36
+ const [content, setContent] = useState(null);
37
+ const focusTrap = trapFocus(dialogRef);
38
+ const palette = useMemo(
39
+ () => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
40
+ [content]
41
+ );
42
+ const styles = confirmModal({ palette });
43
+ const handleChoice = useCallback((e) => {
44
+ var _a, _b, _c;
45
+ const target = e.currentTarget;
46
+ if (target.value === "true") {
47
+ (_a = resolveRef.current) == null ? void 0 : _a.call(resolveRef, true);
48
+ }
49
+ (_b = resolveRef.current) == null ? void 0 : _b.call(resolveRef, false);
50
+ (_c = dialogRef == null ? void 0 : dialogRef.current) == null ? void 0 : _c.close();
51
+ }, []);
52
+ const handleShow = useCallback((options) => {
53
+ return new Promise((resolve) => {
54
+ var _a;
55
+ setContent({ ...options, kind: options.kind || "non-destructive" });
56
+ (_a = dialogRef == null ? void 0 : dialogRef.current) == null ? void 0 : _a.showModal();
57
+ resolveRef.current = resolve;
58
+ });
59
+ }, []);
60
+ const value = useMemo(
61
+ () => ({
62
+ show: handleShow
63
+ }),
64
+ [handleShow]
65
+ );
66
+ return /* @__PURE__ */ jsxs(ConfirmModalContext.Provider, { value, children: [
67
+ props.children,
68
+ /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs("dialog", { className: styles.dialog, onKeyDown: focusTrap, ref: dialogRef, children: [
69
+ /* @__PURE__ */ jsxs(
70
+ "div",
71
+ {
72
+ className: vstack({
73
+ alignItems: "flex-start",
74
+ gap: "4",
75
+ mb: "8"
76
+ }),
77
+ children: [
78
+ /* @__PURE__ */ jsx(ConfirmModalIcon, { palette }),
79
+ /* @__PURE__ */ jsx("h2", { className: styles.heading, children: content == null ? void 0 : content.heading }),
80
+ /* @__PURE__ */ jsx("p", { className: styles.description, children: content == null ? void 0 : content.description })
81
+ ]
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsxs(
85
+ "div",
86
+ {
87
+ className: hstack({
88
+ justifyContent: "stretch",
89
+ gap: "4"
90
+ }),
91
+ children: [
92
+ /* @__PURE__ */ jsx(
93
+ Button,
94
+ {
95
+ autoFocus: true,
96
+ className: css({
97
+ w: "1/2"
98
+ }),
99
+ name: "confirm",
100
+ onClick: handleChoice,
101
+ palette,
102
+ value: "true",
103
+ children: content == null ? void 0 : content.actionText
104
+ }
105
+ ),
106
+ /* @__PURE__ */ jsx(
107
+ Button,
108
+ {
109
+ className: css({
110
+ w: "1/2"
111
+ }),
112
+ name: "cancel",
113
+ onClick: handleChoice,
114
+ usage: "outlined",
115
+ value: "false",
116
+ children: content == null ? void 0 : content.cancelText
117
+ }
118
+ )
119
+ ]
120
+ }
121
+ )
122
+ ] }) })
123
+ ] });
124
+ }
125
+ function ConfirmModalIcon(props) {
126
+ const InfoIcon = $cerberusIcons.confirmModal;
127
+ return /* @__PURE__ */ jsx(
128
+ Show,
129
+ {
130
+ when: props.palette === "danger",
131
+ fallback: /* @__PURE__ */ jsx("div", { className: cx(confirmModal().icon, circle()), children: /* @__PURE__ */ jsx(InfoIcon, {}) }),
132
+ children: /* @__PURE__ */ jsx(
133
+ "div",
134
+ {
135
+ className: cx(
136
+ confirmModal({
137
+ palette: "danger"
138
+ }).icon,
139
+ circle({
140
+ bgColor: "danger.surface.initial"
141
+ })
142
+ ),
143
+ style: {
144
+ color: "var(--cerberus-colors-danger-text-100)"
145
+ },
146
+ children: /* @__PURE__ */ jsx(InfoIcon, {})
147
+ }
148
+ )
149
+ }
150
+ );
151
+ }
152
+ function useConfirmModal() {
153
+ const context = useContext(ConfirmModalContext);
154
+ if (context === null) {
155
+ throw new Error(
156
+ "useConfirmModal must be used within a ConfirmModal Provider"
157
+ );
158
+ }
159
+ return context;
160
+ }
161
+
162
+ export {
163
+ ConfirmModal,
164
+ useConfirmModal
165
+ };
166
+ //# sourceMappingURL=chunk-YRUUO4AP.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} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css, cx } from '@cerberus-design/styled-system/css'\nimport { circle, hstack, vstack } from '@cerberus-design/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport {\n confirmModal,\n type ConfirmModalVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Show } from '../components/Show'\n\n/**\n * This module provides a context and hook for the confirm modal.\n * @module\n */\n\nexport interface ShowConfirmModalOptions {\n kind?: 'destructive' | 'non-destructive'\n heading: string\n description?: string\n actionText: string\n cancelText: string\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 * @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 dialogRef = useRef<HTMLDialogElement>(null)\n const resolveRef = useRef<ShowResult>(null)\n const [content, setContent] = useState<ShowConfirmModalOptions | null>(null)\n const focusTrap = trapFocus(dialogRef)\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n const styles = confirmModal({ palette })\n\n const handleChoice = useCallback((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 dialogRef?.current?.close()\n }, [])\n\n const handleShow = useCallback((options: ShowConfirmModalOptions) => {\n return new Promise<boolean>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n dialogRef?.current?.showModal()\n resolveRef.current = resolve\n })\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 <dialog className={styles.dialog} onKeyDown={focusTrap} ref={dialogRef}>\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '4',\n mb: '8',\n })}\n >\n <ConfirmModalIcon palette={palette} />\n <h2 className={styles.heading}>{content?.heading}</h2>\n <p className={styles.description}>{content?.description}</p>\n </div>\n\n <div\n className={hstack({\n justifyContent: 'stretch',\n gap: '4',\n })}\n >\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 </div>\n </dialog>\n </Portal>\n </ConfirmModalContext.Provider>\n )\n}\n\n// This is to help show the variant styles for the icon since Panda is\n// not syncing correctly for the danger variant.\nfunction ConfirmModalIcon(props: ConfirmModalVariantProps) {\n const InfoIcon = $cerberusIcons.confirmModal\n return (\n <Show\n when={props.palette === 'danger'}\n fallback={\n <div className={cx(confirmModal().icon, circle())}>\n <InfoIcon />\n </div>\n }\n >\n <div\n className={cx(\n confirmModal({\n palette: 'danger',\n }).icon,\n circle({\n bgColor: 'danger.surface.initial',\n }),\n )}\n style={{\n color: 'var(--cerberus-colors-danger-text-100)',\n }}\n >\n <InfoIcon />\n </div>\n </Show>\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
+ "use client";
2
+ import {
3
+ FeatureFlag
4
+ } from "../chunk-VULPMZUW.js";
5
+ import "../chunk-4M3EUP57.js";
6
+ import "../chunk-4O4QFF4S.js";
7
+ export {
8
+ FeatureFlag
9
+ };
10
+ //# sourceMappingURL=FeatureFlag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  Input
4
- } from "../chunk-X4YQ27D5.js";
4
+ } from "../chunk-5RA3ZIXA.js";
5
5
  import "../chunk-ZAU4JVLL.js";
6
6
  import "../chunk-4O4QFF4S.js";
7
- import "../chunk-3CBN7U25.js";
8
- import "../chunk-5MNCW677.js";
7
+ import "../chunk-3TYUA4C7.js";
8
+ import "../chunk-SCAVVE6E.js";
9
9
  export {
10
10
  Input
11
11
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Label
4
- } from "../chunk-HE3HFKYU.js";
4
+ } from "../chunk-JJGZRBIR.js";
5
5
  import "../chunk-ZAU4JVLL.js";
6
6
  import "../chunk-4O4QFF4S.js";
7
7
  export {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  NavMenuList,
4
4
  getPosition
5
- } from "../chunk-G2QMBSK5.js";
5
+ } from "../chunk-PMCYXRAH.js";
6
6
  import "../chunk-KJUCHZHV.js";
7
7
  import "../chunk-4O4QFF4S.js";
8
8
  export {
@@ -0,0 +1,7 @@
1
+ import {
2
+ Portal
3
+ } from "../chunk-4CAT3FHV.js";
4
+ export {
5
+ Portal
6
+ };
7
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Tag
3
- } from "../chunk-5XNLWIZO.js";
3
+ } from "../chunk-EVEEQRH6.js";
4
4
  import "../chunk-4O4QFF4S.js";
5
5
  export {
6
6
  Tag
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  Toggle
4
- } from "../chunk-734PGVLT.js";
4
+ } from "../chunk-VLVKNEA5.js";
5
5
  import "../chunk-ZAU4JVLL.js";
6
- import "../chunk-3CBN7U25.js";
7
- import "../chunk-5MNCW677.js";
6
+ import "../chunk-3TYUA4C7.js";
7
+ import "../chunk-SCAVVE6E.js";
8
8
  export {
9
9
  Toggle
10
10
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defaultIcons
3
- } from "../chunk-5MNCW677.js";
3
+ } from "../chunk-SCAVVE6E.js";
4
4
  export {
5
5
  defaultIcons
6
6
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  $cerberusIcons,
3
3
  defineIcons
4
- } from "../chunk-3CBN7U25.js";
5
- import "../chunk-5MNCW677.js";
4
+ } from "../chunk-3TYUA4C7.js";
5
+ import "../chunk-SCAVVE6E.js";
6
6
  export {
7
7
  $cerberusIcons,
8
8
  defineIcons
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ ConfirmModal,
4
+ useConfirmModal
5
+ } from "../chunk-YRUUO4AP.js";
6
+ import "../chunk-4CAT3FHV.js";
7
+ import "../chunk-2ATICEW3.js";
8
+ import "../chunk-4O4QFF4S.js";
9
+ import "../chunk-KESKDLX6.js";
10
+ import "../chunk-3TYUA4C7.js";
11
+ import "../chunk-SCAVVE6E.js";
12
+ export {
13
+ ConfirmModal,
14
+ useConfirmModal
15
+ };
16
+ //# sourceMappingURL=confirm-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ FeatureFlags,
4
+ useFeatureFlags
5
+ } from "../chunk-4M3EUP57.js";
6
+ export {
7
+ FeatureFlags,
8
+ useFeatureFlags
9
+ };
10
+ //# sourceMappingURL=feature-flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,3 +1,30 @@
1
+ import {
2
+ Tag
3
+ } from "./chunk-EVEEQRH6.js";
4
+ import {
5
+ Textarea
6
+ } from "./chunk-TCO46FK7.js";
7
+ import {
8
+ Toggle
9
+ } from "./chunk-VLVKNEA5.js";
10
+ import {
11
+ ConfirmModal,
12
+ useConfirmModal
13
+ } from "./chunk-YRUUO4AP.js";
14
+ import {
15
+ NavMenuList,
16
+ getPosition
17
+ } from "./chunk-PMCYXRAH.js";
18
+ import {
19
+ NavMenuTrigger
20
+ } from "./chunk-RPZAPUCF.js";
21
+ import {
22
+ NavMenu,
23
+ useNavMenuContext
24
+ } from "./chunk-KJUCHZHV.js";
25
+ import {
26
+ Portal
27
+ } from "./chunk-4CAT3FHV.js";
1
28
  import {
2
29
  Radio
3
30
  } from "./chunk-WE3JNSNO.js";
@@ -11,17 +38,18 @@ import {
11
38
  TabPanel
12
39
  } from "./chunk-67S42J4B.js";
13
40
  import {
14
- Tag
15
- } from "./chunk-5XNLWIZO.js";
16
- import {
17
- Textarea
18
- } from "./chunk-TCO46FK7.js";
19
- import {
20
- Toggle
21
- } from "./chunk-734PGVLT.js";
41
+ useToggle
42
+ } from "./chunk-SCQVXJBT.js";
22
43
  import {
23
44
  Button
24
45
  } from "./chunk-2ATICEW3.js";
46
+ import {
47
+ FeatureFlag
48
+ } from "./chunk-VULPMZUW.js";
49
+ import {
50
+ FeatureFlags,
51
+ useFeatureFlags
52
+ } from "./chunk-4M3EUP57.js";
25
53
  import {
26
54
  FieldMessage
27
55
  } from "./chunk-VGHVH2T3.js";
@@ -30,10 +58,10 @@ import {
30
58
  } from "./chunk-SLHX5K6I.js";
31
59
  import {
32
60
  Input
33
- } from "./chunk-X4YQ27D5.js";
61
+ } from "./chunk-5RA3ZIXA.js";
34
62
  import {
35
63
  Label
36
- } from "./chunk-HE3HFKYU.js";
64
+ } from "./chunk-JJGZRBIR.js";
37
65
  import {
38
66
  Field,
39
67
  useFieldContext
@@ -41,17 +69,6 @@ import {
41
69
  import {
42
70
  NavMenuLink
43
71
  } from "./chunk-6DIGPXAD.js";
44
- import {
45
- NavMenuList,
46
- getPosition
47
- } from "./chunk-G2QMBSK5.js";
48
- import {
49
- NavMenuTrigger
50
- } from "./chunk-RPZAPUCF.js";
51
- import {
52
- NavMenu,
53
- useNavMenuContext
54
- } from "./chunk-KJUCHZHV.js";
55
72
  import {
56
73
  Show
57
74
  } from "./chunk-4O4QFF4S.js";
@@ -67,11 +84,14 @@ import {
67
84
  TabsContext,
68
85
  useTabsContext
69
86
  } from "./chunk-7KJIZIAU.js";
87
+ import {
88
+ trapFocus
89
+ } from "./chunk-KESKDLX6.js";
70
90
  import {
71
91
  $cerberusIcons,
72
92
  defineIcons
73
- } from "./chunk-3CBN7U25.js";
74
- import "./chunk-5MNCW677.js";
93
+ } from "./chunk-3TYUA4C7.js";
94
+ import "./chunk-SCAVVE6E.js";
75
95
  import {
76
96
  MODE_KEY,
77
97
  THEME_KEY,
@@ -79,12 +99,12 @@ import {
79
99
  useTheme,
80
100
  useThemeContext
81
101
  } from "./chunk-SXXWC6UD.js";
82
- import {
83
- useToggle
84
- } from "./chunk-SCQVXJBT.js";
85
102
  export {
86
103
  $cerberusIcons,
87
104
  Button,
105
+ ConfirmModal,
106
+ FeatureFlag,
107
+ FeatureFlags,
88
108
  Field,
89
109
  FieldMessage,
90
110
  IconButton,
@@ -95,6 +115,7 @@ export {
95
115
  NavMenuLink,
96
116
  NavMenuList,
97
117
  NavMenuTrigger,
118
+ Portal,
98
119
  Radio,
99
120
  Show,
100
121
  THEME_KEY,
@@ -110,6 +131,9 @@ export {
110
131
  createNavTriggerProps,
111
132
  defineIcons,
112
133
  getPosition,
134
+ trapFocus,
135
+ useConfirmModal,
136
+ useFeatureFlags,
113
137
  useFieldContext,
114
138
  useNavMenuContext,
115
139
  useTabsContext,
@@ -11,12 +11,14 @@ import { iconButton } from '@cerberus/styled-system/recipes';
11
11
  import { input } from '@cerberus/styled-system/recipes';
12
12
  import type { InputHTMLAttributes } from 'react';
13
13
  import { JSX as JSX_2 } from 'react/jsx-runtime';
14
+ import type { KeyboardEventHandler } from 'react';
14
15
  import { label } from '@cerberus/styled-system/recipes';
15
16
  import { MutableRefObject } from 'react';
16
17
  import type { Pretty } from '@cerberus-design/styled-system/types';
17
18
  import { PropsWithChildren } from 'react';
18
19
  import { radio } from '@cerberus-design/styled-system/recipes';
19
20
  import { ReactNode } from 'react';
21
+ import { ReactPortal } from 'react';
20
22
  import { RecipeVariantProps } from '@cerberus/styled-system/css';
21
23
  import type { RecipeVariantProps as RecipeVariantProps_2 } from '@cerberus-design/styled-system/types';
22
24
  import type { RecipeVariantProps as RecipeVariantProps_3 } from '@cerberus/styled-system/types';
@@ -26,7 +28,7 @@ import { tag } from '@cerberus/styled-system/recipes';
26
28
  import type { TextareaHTMLAttributes } from 'react';
27
29
  import { ToggleVariantProps } from '@cerberus-design/styled-system/recipes';
28
30
 
29
- declare let $cerberusIcons: DefinedIcons;
31
+ declare let $cerberusIcons: Required<DefinedIcons>;
30
32
  export { $cerberusIcons }
31
33
  export { $cerberusIcons as $cerberusIcons_alias_1 }
32
34
 
@@ -60,6 +62,45 @@ declare type ColorModes = 'light' | 'dark';
60
62
  export { ColorModes }
61
63
  export { ColorModes as ColorModes_alias_1 }
62
64
 
65
+ /**
66
+ * Provides a confirm modal to the app.
67
+ * @example
68
+ * ```tsx
69
+ * // Wrap the Provider around the root of the feature.
70
+ * <ConfirmModal>
71
+ * <SomeFeatureSection />
72
+ * </ConfirmModal>
73
+ *
74
+ * // Use the hook to show the confirm modal.
75
+ * const confirm = useConfirmModal()
76
+ *
77
+ * const handleClick = useCallback(async () => {
78
+ * const userConsent = await confirm.show({
79
+ * heading: 'Add new payment method?',
80
+ * description:
81
+ * 'This will add a new payment method to your account to be billed for future purchases.',
82
+ * actionText: 'Yes, add payment method',
83
+ * cancelText: 'No, cancel',
84
+ * })
85
+ * setConsent(userConsent)
86
+ * }, [confirm])
87
+ * ```
88
+ */
89
+ declare function ConfirmModal(props: PropsWithChildren<ConfirmModalProviderProps>): JSX_2.Element;
90
+ export { ConfirmModal }
91
+ export { ConfirmModal as ConfirmModal_alias_1 }
92
+
93
+ declare interface ConfirmModalProviderProps {
94
+ }
95
+ export { ConfirmModalProviderProps }
96
+ export { ConfirmModalProviderProps as ConfirmModalProviderProps_alias_1 }
97
+
98
+ declare interface ConfirmModalValue {
99
+ show: (options: ShowConfirmModalOptions) => Promise<boolean>;
100
+ }
101
+ export { ConfirmModalValue }
102
+ export { ConfirmModalValue as ConfirmModalValue_alias_1 }
103
+
63
104
  declare function createNavTriggerProps(values: NavTriggerAriaValues): NavTriggerAriaReturn;
64
105
  export { createNavTriggerProps }
65
106
  export { createNavTriggerProps as createNavTriggerProps_alias_1 }
@@ -75,14 +116,67 @@ export { DefaultThemes }
75
116
  export { DefaultThemes as DefaultThemes_alias_1 }
76
117
 
77
118
  export declare interface DefinedIcons {
119
+ confirmModal?: CarbonIconType | ElementType;
78
120
  invalid: CarbonIconType | ElementType;
79
- toggleChecked: CarbonIconType | ElementType;
121
+ toggleChecked?: CarbonIconType | ElementType;
80
122
  }
81
123
 
82
- declare function defineIcons(icons: DefinedIcons): DefinedIcons;
124
+ declare function defineIcons(icons: DefinedIcons): Required<DefinedIcons>;
83
125
  export { defineIcons }
84
126
  export { defineIcons as defineIcons_alias_1 }
85
127
 
128
+ declare function FeatureFlag(props: PropsWithChildren<FeatureFlagProps>): JSX_2.Element;
129
+ export { FeatureFlag }
130
+ export { FeatureFlag as FeatureFlag_alias_1 }
131
+
132
+ declare interface FeatureFlagProps {
133
+ flag: string;
134
+ }
135
+ export { FeatureFlagProps }
136
+ export { FeatureFlagProps as FeatureFlagProps_alias_1 }
137
+
138
+ declare interface FeatureFlagProviderProps {
139
+ flags: FeatureFlagValue;
140
+ }
141
+ export { FeatureFlagProviderProps }
142
+ export { FeatureFlagProviderProps as FeatureFlagProviderProps_alias_1 }
143
+
144
+ /**
145
+ * Provides feature flags to the application.
146
+ * @param flags - The flags data for the provider.
147
+ * @example
148
+ * ```tsx
149
+ * // This should be a JSON file or a server response.
150
+ * const flags = {
151
+ * featureOne: true,
152
+ * featureTwo: false
153
+ * }
154
+ *
155
+ * // Wrap the Provider around the root of your application.
156
+ * <FeatureFlags flags={flags}>
157
+ * <FeatureFlag flag="featureOne">
158
+ * This is visible.
159
+ * </FeatureFlag>
160
+ * <FeatureFlag flag="featureTwo">
161
+ * This is hidden.
162
+ * </FeatureFlag>
163
+ * </FeatureFlags>
164
+ * ```
165
+ */
166
+ declare function FeatureFlags(props: PropsWithChildren<FeatureFlagProviderProps>): JSX_2.Element;
167
+ export { FeatureFlags }
168
+ export { FeatureFlags as FeatureFlags_alias_1 }
169
+
170
+ /**
171
+ * This module provides a context and hook for feature flags.
172
+ * @module
173
+ */
174
+ declare interface FeatureFlagValue {
175
+ [key: string]: boolean;
176
+ }
177
+ export { FeatureFlagValue }
178
+ export { FeatureFlagValue as FeatureFlagValue_alias_1 }
179
+
86
180
  declare function Field(props: PropsWithChildren<FieldContextValue>): JSX.Element;
87
181
  export { Field }
88
182
  export { Field as Field_alias_1 }
@@ -318,6 +412,26 @@ declare type NavTriggerRef = RefObject<HTMLButtonElement>;
318
412
  export { NavTriggerRef }
319
413
  export { NavTriggerRef as NavTriggerRef_alias_1 }
320
414
 
415
+ /**
416
+ * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
417
+ * @param container - The props for the Portal component.
418
+ * @returns ReactPortal
419
+ */
420
+ declare function Portal(props: PropsWithChildren<PortalProps>): ReactPortal;
421
+ export { Portal }
422
+ export { Portal as Portal_alias_1 }
423
+
424
+ /**
425
+ * This module is the Portal component.
426
+ * @module
427
+ */
428
+ declare interface PortalProps {
429
+ container?: Element | DocumentFragment;
430
+ key?: null | string;
431
+ }
432
+ export { PortalProps }
433
+ export { PortalProps as PortalProps_alias_1 }
434
+
321
435
  declare type Positions = 'top' | 'right' | 'bottom' | 'left';
322
436
  export { Positions }
323
437
  export { Positions as Positions_alias_1 }
@@ -354,6 +468,20 @@ declare function Show(props: PropsWithChildren<ShowProps>): ReactNode;
354
468
  export { Show }
355
469
  export { Show as Show_alias_1 }
356
470
 
471
+ /**
472
+ * This module provides a context and hook for the confirm modal.
473
+ * @module
474
+ */
475
+ declare interface ShowConfirmModalOptions {
476
+ kind?: 'destructive' | 'non-destructive';
477
+ heading: string;
478
+ description?: string;
479
+ actionText: string;
480
+ cancelText: string;
481
+ }
482
+ export { ShowConfirmModalOptions }
483
+ export { ShowConfirmModalOptions as ShowConfirmModalOptions_alias_1 }
484
+
357
485
  declare interface ShowProps {
358
486
  when: boolean | null | undefined;
359
487
  fallback?: ReactNode;
@@ -361,6 +489,10 @@ declare interface ShowProps {
361
489
  export { ShowProps }
362
490
  export { ShowProps as ShowProps_alias_1 }
363
491
 
492
+ declare type ShowResult = ((value: boolean | PromiseLike<boolean>) => void) | null;
493
+ export { ShowResult }
494
+ export { ShowResult as ShowResult_alias_1 }
495
+
364
496
  declare type StaticTagProps = HTMLAttributes<HTMLSpanElement> & TagRecipeProps & {
365
497
  onClick?: never;
366
498
  };
@@ -587,6 +719,18 @@ declare type ToggleProps = ToggleBase & ToggleVariantProps;
587
719
  export { ToggleProps }
588
720
  export { ToggleProps as ToggleProps_alias_1 }
589
721
 
722
+ declare function trapFocus(modalRef: RefObject<HTMLDialogElement>): KeyboardEventHandler<HTMLDialogElement>;
723
+ export { trapFocus }
724
+ export { trapFocus as trapFocus_alias_1 }
725
+
726
+ declare function useConfirmModal(): ConfirmModalValue;
727
+ export { useConfirmModal }
728
+ export { useConfirmModal as useConfirmModal_alias_1 }
729
+
730
+ declare function useFeatureFlags(key: string): boolean;
731
+ export { useFeatureFlags }
732
+ export { useFeatureFlags as useFeatureFlags_alias_1 }
733
+
590
734
  declare function useFieldContext(): FieldContextValue;
591
735
  export { useFieldContext }
592
736
  export { useFieldContext as useFieldContext_alias_1 }