@cerberus-design/react 0.6.1 → 0.7.0

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 (213) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.ts +336 -4
  2. package/build/legacy/aria-helpers/tabs.aria.js +2 -2
  3. package/build/legacy/aria-helpers/trap-focus.aria.js +7 -0
  4. package/build/legacy/aria-helpers/trap-focus.aria.js.map +1 -0
  5. package/build/legacy/chunk-2F5TB2EV.js +25 -0
  6. package/build/legacy/chunk-2F5TB2EV.js.map +1 -0
  7. package/build/legacy/chunk-4CAT3FHV.js +11 -0
  8. package/build/legacy/chunk-4CAT3FHV.js.map +1 -0
  9. package/build/legacy/chunk-4M3EUP57.js +22 -0
  10. package/build/legacy/chunk-4M3EUP57.js.map +1 -0
  11. package/build/{modern/chunk-X4YQ27D5.js → legacy/chunk-5GEC53G7.js} +5 -5
  12. package/build/legacy/{chunk-YJCWUN33.js → chunk-67S42J4B.js} +5 -16
  13. package/build/legacy/chunk-67S42J4B.js.map +1 -0
  14. package/build/legacy/{chunk-3CBN7U25.js → chunk-6TXQZ3PB.js} +6 -3
  15. package/build/legacy/chunk-6TXQZ3PB.js.map +1 -0
  16. package/build/legacy/{chunk-DQOYTLGB.js → chunk-7KJIZIAU.js} +9 -5
  17. package/build/legacy/chunk-7KJIZIAU.js.map +1 -0
  18. package/build/legacy/chunk-C45DY4VE.js +17 -0
  19. package/build/legacy/chunk-C45DY4VE.js.map +1 -0
  20. package/build/{modern/chunk-HE3HFKYU.js → legacy/chunk-CU7HXAKM.js} +5 -5
  21. package/build/legacy/{chunk-HE3HFKYU.js.map → chunk-CU7HXAKM.js.map} +1 -1
  22. package/build/legacy/chunk-D3ZXZA3U.js +155 -0
  23. package/build/legacy/chunk-D3ZXZA3U.js.map +1 -0
  24. package/build/legacy/chunk-DGPLSWFJ.js +208 -0
  25. package/build/legacy/chunk-DGPLSWFJ.js.map +1 -0
  26. package/build/legacy/{chunk-5XNLWIZO.js → chunk-EVEEQRH6.js} +2 -2
  27. package/build/legacy/chunk-EVEEQRH6.js.map +1 -0
  28. package/build/legacy/chunk-G3JEWPLM.js +29 -0
  29. package/build/legacy/chunk-G3JEWPLM.js.map +1 -0
  30. package/build/legacy/chunk-JI4YTPEJ.js +47 -0
  31. package/build/legacy/chunk-JI4YTPEJ.js.map +1 -0
  32. package/build/legacy/chunk-KESKDLX6.js +30 -0
  33. package/build/legacy/chunk-KESKDLX6.js.map +1 -0
  34. package/build/legacy/{chunk-S7HBD2A7.js → chunk-KFUXGX33.js} +2 -2
  35. package/build/legacy/chunk-OGSAAB6K.js +12 -0
  36. package/build/legacy/chunk-OGSAAB6K.js.map +1 -0
  37. package/build/{modern/chunk-G2QMBSK5.js → legacy/chunk-PMCYXRAH.js} +2 -2
  38. package/build/legacy/chunk-PMCYXRAH.js.map +1 -0
  39. package/build/legacy/{chunk-734PGVLT.js → chunk-TAZI77TP.js} +2 -2
  40. package/build/legacy/chunk-TPFNVGYA.js +21 -0
  41. package/build/legacy/chunk-TPFNVGYA.js.map +1 -0
  42. package/build/legacy/chunk-TZNYJ3G7.js +25 -0
  43. package/build/legacy/chunk-TZNYJ3G7.js.map +1 -0
  44. package/build/legacy/chunk-UPODPCRD.js +12 -0
  45. package/build/legacy/chunk-UPODPCRD.js.map +1 -0
  46. package/build/legacy/chunk-VULPMZUW.js +18 -0
  47. package/build/legacy/chunk-VULPMZUW.js.map +1 -0
  48. package/build/{modern/chunk-5GSXIYD3.js → legacy/chunk-X2JMXTBH.js} +6 -8
  49. package/build/{modern/chunk-5GSXIYD3.js.map → legacy/chunk-X2JMXTBH.js.map} +1 -1
  50. package/build/legacy/components/FeatureFlag.js +10 -0
  51. package/build/legacy/components/FeatureFlag.js.map +1 -0
  52. package/build/legacy/components/Input.js +4 -4
  53. package/build/legacy/components/Label.js +2 -2
  54. package/build/legacy/components/Modal.js +7 -0
  55. package/build/legacy/components/Modal.js.map +1 -0
  56. package/build/legacy/components/ModalDescription.js +7 -0
  57. package/build/legacy/components/ModalDescription.js.map +1 -0
  58. package/build/legacy/components/ModalHeader.js +7 -0
  59. package/build/legacy/components/ModalHeader.js.map +1 -0
  60. package/build/legacy/components/ModalHeading.js +7 -0
  61. package/build/legacy/components/ModalHeading.js.map +1 -0
  62. package/build/legacy/components/ModalIcon.js +7 -0
  63. package/build/legacy/components/ModalIcon.js.map +1 -0
  64. package/build/legacy/components/NavMenuList.js +1 -1
  65. package/build/legacy/components/Portal.js +7 -0
  66. package/build/legacy/components/Portal.js.map +1 -0
  67. package/build/legacy/components/Tab.js +3 -3
  68. package/build/legacy/components/TabList.js +2 -2
  69. package/build/legacy/components/TabPanel.js +2 -2
  70. package/build/legacy/components/Tag.js +1 -1
  71. package/build/legacy/components/Toggle.js +3 -3
  72. package/build/legacy/config/cerbIcons.js +1 -1
  73. package/build/legacy/config/defineIcons.js +2 -2
  74. package/build/legacy/context/confirm-modal.js +22 -0
  75. package/build/legacy/context/confirm-modal.js.map +1 -0
  76. package/build/legacy/context/feature-flags.js +10 -0
  77. package/build/legacy/context/feature-flags.js.map +1 -0
  78. package/build/legacy/context/prompt-modal.js +25 -0
  79. package/build/legacy/context/prompt-modal.js.map +1 -0
  80. package/build/legacy/context/tabs.js +1 -1
  81. package/build/legacy/hooks/useModal.js +8 -0
  82. package/build/legacy/hooks/useModal.js.map +1 -0
  83. package/build/legacy/index.js +89 -35
  84. package/build/modern/_tsup-dts-rollup.d.ts +336 -4
  85. package/build/modern/aria-helpers/tabs.aria.js +2 -2
  86. package/build/modern/aria-helpers/trap-focus.aria.js +7 -0
  87. package/build/modern/aria-helpers/trap-focus.aria.js.map +1 -0
  88. package/build/modern/chunk-2F5TB2EV.js +25 -0
  89. package/build/modern/chunk-2F5TB2EV.js.map +1 -0
  90. package/build/modern/chunk-4CAT3FHV.js +11 -0
  91. package/build/modern/chunk-4CAT3FHV.js.map +1 -0
  92. package/build/modern/chunk-4M3EUP57.js +22 -0
  93. package/build/modern/chunk-4M3EUP57.js.map +1 -0
  94. package/build/{legacy/chunk-X4YQ27D5.js → modern/chunk-5GEC53G7.js} +5 -5
  95. package/build/modern/{chunk-YJCWUN33.js → chunk-67S42J4B.js} +5 -16
  96. package/build/modern/chunk-67S42J4B.js.map +1 -0
  97. package/build/modern/{chunk-3CBN7U25.js → chunk-6TXQZ3PB.js} +6 -3
  98. package/build/modern/chunk-6TXQZ3PB.js.map +1 -0
  99. package/build/modern/{chunk-DQOYTLGB.js → chunk-7KJIZIAU.js} +9 -5
  100. package/build/modern/chunk-7KJIZIAU.js.map +1 -0
  101. package/build/modern/chunk-C45DY4VE.js +17 -0
  102. package/build/modern/chunk-C45DY4VE.js.map +1 -0
  103. package/build/modern/chunk-C5HLLGME.js +23 -0
  104. package/build/modern/chunk-C5HLLGME.js.map +1 -0
  105. package/build/{legacy/chunk-HE3HFKYU.js → modern/chunk-CU7HXAKM.js} +5 -5
  106. package/build/modern/{chunk-HE3HFKYU.js.map → chunk-CU7HXAKM.js.map} +1 -1
  107. package/build/modern/chunk-G3JEWPLM.js +29 -0
  108. package/build/modern/chunk-G3JEWPLM.js.map +1 -0
  109. package/build/modern/chunk-HBEEHHON.js +46 -0
  110. package/build/modern/chunk-HBEEHHON.js.map +1 -0
  111. package/build/modern/chunk-JIZQFTW6.js +29 -0
  112. package/build/modern/chunk-JIZQFTW6.js.map +1 -0
  113. package/build/modern/{chunk-S7HBD2A7.js → chunk-KFUXGX33.js} +2 -2
  114. package/build/modern/chunk-OGSAAB6K.js +12 -0
  115. package/build/modern/chunk-OGSAAB6K.js.map +1 -0
  116. package/build/{legacy/chunk-G2QMBSK5.js → modern/chunk-PMCYXRAH.js} +2 -2
  117. package/build/modern/chunk-PMCYXRAH.js.map +1 -0
  118. package/build/modern/chunk-TAVCJ54A.js +154 -0
  119. package/build/modern/chunk-TAVCJ54A.js.map +1 -0
  120. package/build/modern/{chunk-734PGVLT.js → chunk-TAZI77TP.js} +2 -2
  121. package/build/modern/chunk-TPFNVGYA.js +21 -0
  122. package/build/modern/chunk-TPFNVGYA.js.map +1 -0
  123. package/build/modern/chunk-UPODPCRD.js +12 -0
  124. package/build/modern/chunk-UPODPCRD.js.map +1 -0
  125. package/build/modern/chunk-VULPMZUW.js +18 -0
  126. package/build/modern/chunk-VULPMZUW.js.map +1 -0
  127. package/build/modern/chunk-WWG5QWXY.js +207 -0
  128. package/build/modern/chunk-WWG5QWXY.js.map +1 -0
  129. package/build/{legacy/chunk-5GSXIYD3.js → modern/chunk-X2JMXTBH.js} +6 -8
  130. package/build/{legacy/chunk-5GSXIYD3.js.map → modern/chunk-X2JMXTBH.js.map} +1 -1
  131. package/build/modern/{chunk-SLIOCQBZ.js → chunk-Z6IWNVPN.js} +2 -2
  132. package/build/modern/chunk-Z6IWNVPN.js.map +1 -0
  133. package/build/modern/components/FeatureFlag.js +10 -0
  134. package/build/modern/components/FeatureFlag.js.map +1 -0
  135. package/build/modern/components/Input.js +4 -4
  136. package/build/modern/components/Label.js +2 -2
  137. package/build/modern/components/Modal.js +7 -0
  138. package/build/modern/components/Modal.js.map +1 -0
  139. package/build/modern/components/ModalDescription.js +7 -0
  140. package/build/modern/components/ModalDescription.js.map +1 -0
  141. package/build/modern/components/ModalHeader.js +7 -0
  142. package/build/modern/components/ModalHeader.js.map +1 -0
  143. package/build/modern/components/ModalHeading.js +7 -0
  144. package/build/modern/components/ModalHeading.js.map +1 -0
  145. package/build/modern/components/ModalIcon.js +7 -0
  146. package/build/modern/components/ModalIcon.js.map +1 -0
  147. package/build/modern/components/NavMenuList.js +1 -1
  148. package/build/modern/components/Portal.js +7 -0
  149. package/build/modern/components/Portal.js.map +1 -0
  150. package/build/modern/components/Tab.js +3 -3
  151. package/build/modern/components/TabList.js +2 -2
  152. package/build/modern/components/TabPanel.js +2 -2
  153. package/build/modern/components/Tag.js +1 -1
  154. package/build/modern/components/Toggle.js +3 -3
  155. package/build/modern/config/cerbIcons.js +1 -1
  156. package/build/modern/config/defineIcons.js +2 -2
  157. package/build/modern/context/confirm-modal.js +22 -0
  158. package/build/modern/context/confirm-modal.js.map +1 -0
  159. package/build/modern/context/feature-flags.js +10 -0
  160. package/build/modern/context/feature-flags.js.map +1 -0
  161. package/build/modern/context/prompt-modal.js +25 -0
  162. package/build/modern/context/prompt-modal.js.map +1 -0
  163. package/build/modern/context/tabs.js +1 -1
  164. package/build/modern/hooks/useModal.js +8 -0
  165. package/build/modern/hooks/useModal.js.map +1 -0
  166. package/build/modern/index.js +89 -35
  167. package/package.json +3 -2
  168. package/src/aria-helpers/trap-focus.aria.ts +29 -0
  169. package/src/components/FeatureFlag.tsx +14 -0
  170. package/src/components/Label.tsx +1 -1
  171. package/src/components/Modal.tsx +37 -0
  172. package/src/components/ModalDescription.tsx +23 -0
  173. package/src/components/ModalHeader.tsx +37 -0
  174. package/src/components/ModalHeading.tsx +23 -0
  175. package/src/components/ModalIcon.tsx +28 -0
  176. package/src/components/NavMenuList.tsx +1 -1
  177. package/src/components/Portal.tsx +22 -0
  178. package/src/components/Tab.tsx +3 -84
  179. package/src/components/TabList.tsx +2 -4
  180. package/src/components/TabPanel.tsx +3 -14
  181. package/src/components/Tag.tsx +1 -1
  182. package/src/config/cerbIcons.ts +11 -2
  183. package/src/config/defineIcons.ts +6 -3
  184. package/src/context/confirm-modal.tsx +185 -0
  185. package/src/context/feature-flags.tsx +60 -0
  186. package/src/context/prompt-modal.tsx +232 -0
  187. package/src/context/tabs.tsx +15 -5
  188. package/src/hooks/useModal.ts +34 -0
  189. package/src/index.ts +12 -0
  190. package/build/legacy/chunk-3CBN7U25.js.map +0 -1
  191. package/build/legacy/chunk-5MNCW677.js +0 -11
  192. package/build/legacy/chunk-5MNCW677.js.map +0 -1
  193. package/build/legacy/chunk-5XNLWIZO.js.map +0 -1
  194. package/build/legacy/chunk-DQOYTLGB.js.map +0 -1
  195. package/build/legacy/chunk-G2QMBSK5.js.map +0 -1
  196. package/build/legacy/chunk-YA2UV2AB.js +0 -126
  197. package/build/legacy/chunk-YA2UV2AB.js.map +0 -1
  198. package/build/legacy/chunk-YJCWUN33.js.map +0 -1
  199. package/build/modern/chunk-3CBN7U25.js.map +0 -1
  200. package/build/modern/chunk-5MNCW677.js +0 -11
  201. package/build/modern/chunk-5MNCW677.js.map +0 -1
  202. package/build/modern/chunk-DQOYTLGB.js.map +0 -1
  203. package/build/modern/chunk-G2QMBSK5.js.map +0 -1
  204. package/build/modern/chunk-SLIOCQBZ.js.map +0 -1
  205. package/build/modern/chunk-SUP7U42W.js +0 -125
  206. package/build/modern/chunk-SUP7U42W.js.map +0 -1
  207. package/build/modern/chunk-YJCWUN33.js.map +0 -1
  208. /package/build/legacy/{chunk-X4YQ27D5.js.map → chunk-5GEC53G7.js.map} +0 -0
  209. /package/build/legacy/{chunk-S7HBD2A7.js.map → chunk-KFUXGX33.js.map} +0 -0
  210. /package/build/legacy/{chunk-734PGVLT.js.map → chunk-TAZI77TP.js.map} +0 -0
  211. /package/build/modern/{chunk-X4YQ27D5.js.map → chunk-5GEC53G7.js.map} +0 -0
  212. /package/build/modern/{chunk-S7HBD2A7.js.map → chunk-KFUXGX33.js.map} +0 -0
  213. /package/build/modern/{chunk-734PGVLT.js.map → chunk-TAZI77TP.js.map} +0 -0
@@ -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":[]}
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import {
3
+ PromptModal,
4
+ usePromptModal
5
+ } from "../chunk-WWG5QWXY.js";
6
+ import "../chunk-4CAT3FHV.js";
7
+ import "../chunk-TPFNVGYA.js";
8
+ import "../chunk-UPODPCRD.js";
9
+ import "../chunk-2F5TB2EV.js";
10
+ import "../chunk-OGSAAB6K.js";
11
+ import "../chunk-G3JEWPLM.js";
12
+ import "../chunk-2ATICEW3.js";
13
+ import "../chunk-5GEC53G7.js";
14
+ import "../chunk-CU7HXAKM.js";
15
+ import "../chunk-4O4QFF4S.js";
16
+ import "../chunk-ZAU4JVLL.js";
17
+ import "../chunk-JIZQFTW6.js";
18
+ import "../chunk-6TXQZ3PB.js";
19
+ import "../chunk-C45DY4VE.js";
20
+ import "../chunk-C5HLLGME.js";
21
+ export {
22
+ PromptModal,
23
+ usePromptModal
24
+ };
25
+ //# sourceMappingURL=prompt-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  Tabs,
4
4
  TabsContext,
5
5
  useTabsContext
6
- } from "../chunk-DQOYTLGB.js";
6
+ } from "../chunk-7KJIZIAU.js";
7
7
  export {
8
8
  Tabs,
9
9
  TabsContext,
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import {
3
+ useModal
4
+ } from "../chunk-C5HLLGME.js";
5
+ export {
6
+ useModal
7
+ };
8
+ //# sourceMappingURL=useModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,50 +1,57 @@
1
+ import {
2
+ Toggle
3
+ } from "./chunk-TAZI77TP.js";
4
+ import {
5
+ ConfirmModal,
6
+ useConfirmModal
7
+ } from "./chunk-TAVCJ54A.js";
8
+ import {
9
+ PromptModal,
10
+ usePromptModal
11
+ } from "./chunk-WWG5QWXY.js";
12
+ import {
13
+ Portal
14
+ } from "./chunk-4CAT3FHV.js";
1
15
  import {
2
16
  Radio
3
17
  } from "./chunk-WE3JNSNO.js";
4
18
  import {
5
19
  Tab
6
- } from "./chunk-SUP7U42W.js";
20
+ } from "./chunk-HBEEHHON.js";
7
21
  import {
8
22
  TabList
9
- } from "./chunk-5GSXIYD3.js";
23
+ } from "./chunk-X2JMXTBH.js";
10
24
  import {
11
25
  TabPanel
12
- } from "./chunk-YJCWUN33.js";
26
+ } from "./chunk-67S42J4B.js";
13
27
  import {
14
28
  Tag
15
- } from "./chunk-SLIOCQBZ.js";
29
+ } from "./chunk-Z6IWNVPN.js";
16
30
  import {
17
31
  Textarea
18
32
  } from "./chunk-TCO46FK7.js";
19
33
  import {
20
- Toggle
21
- } from "./chunk-734PGVLT.js";
34
+ Modal
35
+ } from "./chunk-TPFNVGYA.js";
22
36
  import {
23
- Button
24
- } from "./chunk-2ATICEW3.js";
37
+ ModalDescription
38
+ } from "./chunk-UPODPCRD.js";
25
39
  import {
26
- FieldMessage
27
- } from "./chunk-VGHVH2T3.js";
40
+ ModalHeader
41
+ } from "./chunk-2F5TB2EV.js";
28
42
  import {
29
- IconButton
30
- } from "./chunk-SLHX5K6I.js";
43
+ ModalHeading
44
+ } from "./chunk-OGSAAB6K.js";
31
45
  import {
32
- Input
33
- } from "./chunk-X4YQ27D5.js";
34
- import {
35
- Label
36
- } from "./chunk-HE3HFKYU.js";
37
- import {
38
- Field,
39
- useFieldContext
40
- } from "./chunk-ZAU4JVLL.js";
46
+ ModalIcon
47
+ } from "./chunk-G3JEWPLM.js";
41
48
  import {
42
49
  NavMenuLink
43
50
  } from "./chunk-6DIGPXAD.js";
44
51
  import {
45
52
  NavMenuList,
46
53
  getPosition
47
- } from "./chunk-G2QMBSK5.js";
54
+ } from "./chunk-PMCYXRAH.js";
48
55
  import {
49
56
  NavMenuTrigger
50
57
  } from "./chunk-RPZAPUCF.js";
@@ -52,49 +59,91 @@ import {
52
59
  NavMenu,
53
60
  useNavMenuContext
54
61
  } from "./chunk-KJUCHZHV.js";
62
+ import {
63
+ MODE_KEY,
64
+ THEME_KEY,
65
+ ThemeProvider,
66
+ useTheme,
67
+ useThemeContext
68
+ } from "./chunk-SXXWC6UD.js";
69
+ import {
70
+ useToggle
71
+ } from "./chunk-QEA6N6TN.js";
72
+ import {
73
+ Button
74
+ } from "./chunk-2ATICEW3.js";
75
+ import {
76
+ FeatureFlag
77
+ } from "./chunk-VULPMZUW.js";
78
+ import {
79
+ FeatureFlags,
80
+ useFeatureFlags
81
+ } from "./chunk-4M3EUP57.js";
82
+ import {
83
+ FieldMessage
84
+ } from "./chunk-VGHVH2T3.js";
85
+ import {
86
+ IconButton
87
+ } from "./chunk-SLHX5K6I.js";
88
+ import {
89
+ Input
90
+ } from "./chunk-5GEC53G7.js";
91
+ import {
92
+ Label
93
+ } from "./chunk-CU7HXAKM.js";
55
94
  import {
56
95
  Show
57
96
  } from "./chunk-4O4QFF4S.js";
97
+ import {
98
+ Field,
99
+ useFieldContext
100
+ } from "./chunk-ZAU4JVLL.js";
58
101
  import "./chunk-55J6XMHW.js";
59
102
  import {
60
103
  createNavTriggerProps
61
104
  } from "./chunk-JF76VIL3.js";
62
105
  import {
63
106
  useTabsKeyboardNavigation
64
- } from "./chunk-S7HBD2A7.js";
107
+ } from "./chunk-KFUXGX33.js";
65
108
  import {
66
109
  Tabs,
67
110
  TabsContext,
68
111
  useTabsContext
69
- } from "./chunk-DQOYTLGB.js";
112
+ } from "./chunk-7KJIZIAU.js";
113
+ import {
114
+ trapFocus
115
+ } from "./chunk-JIZQFTW6.js";
70
116
  import {
71
117
  $cerberusIcons,
72
118
  defineIcons
73
- } from "./chunk-3CBN7U25.js";
74
- import "./chunk-5MNCW677.js";
75
- import {
76
- MODE_KEY,
77
- THEME_KEY,
78
- ThemeProvider,
79
- useTheme,
80
- useThemeContext
81
- } from "./chunk-SXXWC6UD.js";
119
+ } from "./chunk-6TXQZ3PB.js";
120
+ import "./chunk-C45DY4VE.js";
82
121
  import {
83
- useToggle
84
- } from "./chunk-QEA6N6TN.js";
122
+ useModal
123
+ } from "./chunk-C5HLLGME.js";
85
124
  export {
86
125
  $cerberusIcons,
87
126
  Button,
127
+ ConfirmModal,
128
+ FeatureFlag,
129
+ FeatureFlags,
88
130
  Field,
89
131
  FieldMessage,
90
132
  IconButton,
91
133
  Input,
92
134
  Label,
93
135
  MODE_KEY,
136
+ Modal,
137
+ ModalDescription,
138
+ ModalHeader,
139
+ ModalHeading,
140
+ ModalIcon,
94
141
  NavMenu,
95
142
  NavMenuLink,
96
143
  NavMenuList,
97
144
  NavMenuTrigger,
145
+ Portal,
146
+ PromptModal,
98
147
  Radio,
99
148
  Show,
100
149
  THEME_KEY,
@@ -110,8 +159,13 @@ export {
110
159
  createNavTriggerProps,
111
160
  defineIcons,
112
161
  getPosition,
162
+ trapFocus,
163
+ useConfirmModal,
164
+ useFeatureFlags,
113
165
  useFieldContext,
166
+ useModal,
114
167
  useNavMenuContext,
168
+ usePromptModal,
115
169
  useTabsContext,
116
170
  useTabsKeyboardNavigation,
117
171
  useTheme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -18,11 +18,12 @@
18
18
  "devDependencies": {
19
19
  "@microsoft/api-extractor": "^7.46.2",
20
20
  "@types/react": "^18",
21
+ "@types/react-dom": "^18",
21
22
  "react": "^18",
22
23
  "react-dom": "^18",
23
24
  "tsup": "^8.1.0",
24
25
  "@cerberus-design/configs": "0.0.0",
25
- "@cerberus-design/styled-system": "0.6.1"
26
+ "@cerberus-design/styled-system": "0.7.0"
26
27
  },
27
28
  "publishConfig": {
28
29
  "access": "public"
@@ -0,0 +1,29 @@
1
+ import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'
2
+
3
+ export function trapFocus(
4
+ modalRef: RefObject<HTMLDialogElement>,
5
+ ): KeyboardEventHandler<HTMLDialogElement> {
6
+ const focusableElements =
7
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
8
+ const focusable = Array.from(
9
+ modalRef.current?.querySelectorAll(focusableElements) ?? [],
10
+ )
11
+ const firstFocusable = focusable[0] as HTMLElement
12
+ const lastFocusable = focusable[focusable.length - 1] as HTMLElement
13
+
14
+ return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {
15
+ if (event.key === 'Tab') {
16
+ if (event.shiftKey) {
17
+ if (document.activeElement === firstFocusable) {
18
+ lastFocusable.focus()
19
+ event.preventDefault()
20
+ }
21
+ } else {
22
+ if (document.activeElement === lastFocusable) {
23
+ firstFocusable.focus()
24
+ event.preventDefault()
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+
3
+ import type { PropsWithChildren } from 'react'
4
+ import { useFeatureFlags } from '../context/feature-flags'
5
+ import { Show } from './Show'
6
+
7
+ export interface FeatureFlagProps {
8
+ flag: string
9
+ }
10
+
11
+ export function FeatureFlag(props: PropsWithChildren<FeatureFlagProps>) {
12
+ const showContent = useFeatureFlags(props.flag)
13
+ return <Show when={showContent}>{props.children}</Show>
14
+ }
@@ -51,7 +51,7 @@ export function Label(props: PropsWithChildren<LabelProps>) {
51
51
  <Show when={required}>
52
52
  <span
53
53
  className={css({
54
- color: 'neutral.text.100',
54
+ color: 'page.text.100',
55
55
  fontSize: 'inherit',
56
56
  })}
57
57
  >
@@ -0,0 +1,37 @@
1
+ import { cx } from '@cerberus-design/styled-system/css'
2
+ import { modal } from '@cerberus-design/styled-system/recipes'
3
+ import { forwardRef, type ForwardedRef, type HTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * This module contains the Modal root component for a customizable modal.
7
+ * @module
8
+ */
9
+
10
+ // Modal
11
+
12
+ export type ModalProps = HTMLAttributes<HTMLDialogElement>
13
+
14
+ function ModalEl(props: ModalProps, ref: ForwardedRef<HTMLDialogElement>) {
15
+ return (
16
+ <dialog
17
+ {...props}
18
+ className={cx(props.className, modal().dialog)}
19
+ ref={ref}
20
+ />
21
+ )
22
+ }
23
+
24
+ /**
25
+ * The Modal component is the root element for a customizable modal.
26
+ * @example
27
+ * ```tsx
28
+ * const { modalRef } = useModal()
29
+ *
30
+ * <Modal ref={modalRef}>
31
+ * <ModalIcon icon={$cerberusIcons.alert} />
32
+ * <h2>Modal Heading</h2>
33
+ * <p>Modal description</p>
34
+ * </Modal>
35
+ * ```
36
+ */
37
+ export const Modal = forwardRef(ModalEl)
@@ -0,0 +1,23 @@
1
+ import { cx } from '@cerberus-design/styled-system/css'
2
+ import { modal } from '@cerberus-design/styled-system/recipes'
3
+ import type { HTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * This module contains the ModalDescription component for a customizable modal.
7
+ * @module
8
+ */
9
+
10
+ export type ModalDescriptionProps = HTMLAttributes<HTMLParagraphElement>
11
+
12
+ /**
13
+ * The ModalDescription component is a heading element for a customizable modal.
14
+ * @example
15
+ * ```tsx
16
+ * <Modal>
17
+ * <ModalDescription>Modal Heading</ModalDescription>
18
+ * </Modal>
19
+ * ```
20
+ */
21
+ export function ModalDescription(props: ModalDescriptionProps) {
22
+ return <p {...props} className={cx(props.className, modal().description)} />
23
+ }
@@ -0,0 +1,37 @@
1
+ import { cx } from '@cerberus-design/styled-system/css'
2
+ import { vstack } from '@cerberus-design/styled-system/patterns'
3
+ import type { HTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * This module contains the ModalHeader component for a customizable modal.
7
+ * @module
8
+ */
9
+
10
+ export type ModalHeaderProps = HTMLAttributes<HTMLDivElement>
11
+
12
+ /**
13
+ * The ModalHeader component is a header element for a customizable modal.
14
+ * @example
15
+ * ```tsx
16
+ * <Modal>
17
+ * <ModalHeader>
18
+ * <h2>Modal Heading</h2>
19
+ * </ModalHeader>
20
+ * </Modal>
21
+ * ```
22
+ */
23
+ export function ModalHeader(props: ModalHeaderProps) {
24
+ return (
25
+ <div
26
+ {...props}
27
+ className={cx(
28
+ props.className,
29
+ vstack({
30
+ alignItems: 'flex-start',
31
+ gap: '4',
32
+ mb: '8',
33
+ }),
34
+ )}
35
+ />
36
+ )
37
+ }
@@ -0,0 +1,23 @@
1
+ import { cx } from '@cerberus-design/styled-system/css'
2
+ import { modal } from '@cerberus-design/styled-system/recipes'
3
+ import type { HTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * This module contains the ModalHeading component for a customizable modal.
7
+ * @module
8
+ */
9
+
10
+ export type ModalHeadingProps = HTMLAttributes<HTMLParagraphElement>
11
+
12
+ /**
13
+ * The ModalHeading component is a heading element for a customizable modal.
14
+ * @example
15
+ * ```tsx
16
+ * <Modal>
17
+ * <ModalHeading>Modal Heading</ModalHeading>
18
+ * </Modal>
19
+ * ```
20
+ */
21
+ export function ModalHeading(props: ModalHeadingProps) {
22
+ return <p {...props} className={cx(props.className, modal().heading)} />
23
+ }
@@ -0,0 +1,28 @@
1
+ import { cx } from '@cerberus-design/styled-system/css'
2
+ import { circle } from '@cerberus-design/styled-system/patterns'
3
+ import {
4
+ modalIcon,
5
+ type ModalIconVariantProps,
6
+ } from '@cerberus-design/styled-system/recipes'
7
+ import type { HTMLAttributes, PropsWithChildren } from 'react'
8
+
9
+ export type ModalIconBaseProps = HTMLAttributes<HTMLDivElement>
10
+ export type ModalIconProps = ModalIconBaseProps & ModalIconVariantProps
11
+
12
+ export function ModalIcon(props: PropsWithChildren<ModalIconProps>) {
13
+ const { palette, ...nativeProps } = props
14
+ return (
15
+ <div
16
+ {...nativeProps}
17
+ className={cx(
18
+ nativeProps.className,
19
+ modalIcon({
20
+ palette,
21
+ }),
22
+ circle(),
23
+ )}
24
+ >
25
+ {props.children}
26
+ </div>
27
+ )
28
+ }
@@ -37,7 +37,7 @@ export function getPosition(position: Positions): GetPositionResult {
37
37
 
38
38
  const navListStyles = vstack({
39
39
  alignItems: 'flex-start',
40
- bgColor: 'neutral.surface.100',
40
+ bgColor: 'page.surface.100',
41
41
  boxShadow: 'lg',
42
42
  gap: '2',
43
43
  opacity: '0',
@@ -0,0 +1,22 @@
1
+ import type { PropsWithChildren } from 'react'
2
+ import { createPortal } from 'react-dom'
3
+
4
+ /**
5
+ * This module is the Portal component.
6
+ * @module
7
+ */
8
+
9
+ export interface PortalProps {
10
+ container?: Element | DocumentFragment
11
+ key?: null | string
12
+ }
13
+
14
+ /**
15
+ * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
16
+ * @param container - The props for the Portal component.
17
+ * @returns ReactPortal
18
+ */
19
+ export function Portal(props: PropsWithChildren<PortalProps>) {
20
+ const container = props.container || document.body
21
+ return createPortal(props.children, container, props.key)
22
+ }
@@ -7,14 +7,13 @@ import {
7
7
  type MouseEvent,
8
8
  } from 'react'
9
9
  import { useTabsContext } from '../context/tabs'
10
- import { css, cx } from '@cerberus/styled-system/css'
10
+ import { cx } from '@cerberus/styled-system/css'
11
11
  import { useTabsKeyboardNavigation } from '../aria-helpers/tabs.aria'
12
12
 
13
13
  /**
14
14
  * This module provides a Tab component.
15
15
  * @module
16
16
  */
17
-
18
17
  export interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
19
18
  value: string
20
19
  }
@@ -33,7 +32,7 @@ export interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
33
32
  */
34
33
  export function Tab(props: TabProps) {
35
34
  const { value, ...nativeProps } = props
36
- const { active, onTabUpdate } = useTabsContext()
35
+ const { active, onTabUpdate, styles } = useTabsContext()
37
36
  const [isPending, startTransition] = useTransition()
38
37
  const { ref } = useTabsKeyboardNavigation()
39
38
  const isActive = useMemo(() => active === value, [active, value])
@@ -51,7 +50,7 @@ export function Tab(props: TabProps) {
51
50
  aria-busy={isPending}
52
51
  aria-selected={isActive}
53
52
  id={value}
54
- className={cx(nativeProps.className, btnStyles)}
53
+ className={cx(nativeProps.className, styles.tab)}
55
54
  onClick={handleClick}
56
55
  role="tab"
57
56
  ref={ref}
@@ -59,83 +58,3 @@ export function Tab(props: TabProps) {
59
58
  />
60
59
  )
61
60
  }
62
-
63
- const btnStyles = css({
64
- alignItems: 'center',
65
- display: 'inline-flex',
66
- borderTopLeftRadius: 'md',
67
- borderTopRightRadius: 'md',
68
- fontSize: 'sm',
69
- fontWeight: '600',
70
- gap: '2',
71
- h: '2.75rem',
72
- justifyContent: 'center',
73
- position: 'relative',
74
- pxi: '4',
75
- zIndex: 'base',
76
- _motionSafe: {
77
- transition: 'all 200ms ease-in-out',
78
- _before: {
79
- transitionProperty: 'height',
80
- transitionDuration: '200ms',
81
- transitionTimingFunction: 'ease-in-out',
82
- },
83
- _after: {
84
- transitionProperty: 'height',
85
- transitionDuration: '200ms',
86
- transitionTimingFunction: 'ease-in-out',
87
- },
88
- },
89
- _before: {
90
- bgColor: 'action.border.initial',
91
- bottom: '0',
92
- content: '""',
93
- h: '0',
94
- position: 'absolute',
95
- left: '0',
96
- right: '0',
97
- w: 'full',
98
- willChange: 'height',
99
- zIndex: 'decorator',
100
- },
101
- _after: {
102
- borderTopLeftRadius: 'md',
103
- borderTopRightRadius: 'md',
104
- bottom: '0',
105
- bgColor: 'neutral.surface.100',
106
- content: '""',
107
- left: '0',
108
- position: 'absolute',
109
- right: '0',
110
- h: '0',
111
- w: 'full',
112
- willChange: 'height',
113
- zIndex: '-1',
114
- },
115
- _hover: {
116
- _after: {
117
- h: 'full',
118
- },
119
- },
120
- _focusVisible: {
121
- boxShadow: 'none',
122
- outline: '3px solid',
123
- outlineColor: 'action.border.focus',
124
- outlineOffset: '2px',
125
- },
126
- _disabled: {
127
- cursor: 'not-allowed',
128
- opacity: '0.5',
129
- },
130
- _selected: {
131
- color: 'action.text.200',
132
- _before: {
133
- h: '3px',
134
- },
135
- _hover: {
136
- _after: {
137
- h: '0',
138
- },
139
- },
140
- },
141
- })
@@ -27,7 +27,7 @@ export interface TabListProps extends HTMLAttributes<HTMLDivElement> {
27
27
  */
28
28
  export function TabList(props: PropsWithChildren<TabListProps>) {
29
29
  const { description, ...nativeProps } = props
30
- const { id } = useTabsContext()
30
+ const { id, styles } = useTabsContext()
31
31
 
32
32
  return (
33
33
  <div
@@ -36,11 +36,9 @@ export function TabList(props: PropsWithChildren<TabListProps>) {
36
36
  className={cx(
37
37
  nativeProps.className,
38
38
  hstack({
39
- borderBottom: '1px solid',
40
- borderBottomColor: 'action.border.100',
41
39
  gap: '0',
42
- w: 'full',
43
40
  }),
41
+ styles.tabList,
44
42
  )}
45
43
  id={id ?? nativeProps.id}
46
44
  />