@cerberus-design/react 0.14.2 → 0.15.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 (241) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +374 -80
  2. package/build/legacy/components/Accordion.cjs +4 -187
  3. package/build/legacy/components/Accordion.cjs.map +1 -1
  4. package/build/legacy/components/Accordion.client.cjs +64 -0
  5. package/build/legacy/components/Accordion.client.cjs.map +1 -0
  6. package/build/legacy/components/AccordionItemGroup.cjs +41 -185
  7. package/build/legacy/components/AccordionItemGroup.cjs.map +1 -1
  8. package/build/legacy/components/Admonition.cjs +89 -239
  9. package/build/legacy/components/Admonition.cjs.map +1 -1
  10. package/build/legacy/components/Admonition.client.cjs +219 -0
  11. package/build/legacy/components/Admonition.client.cjs.map +1 -0
  12. package/build/legacy/components/AnimatingUploadIcon.cjs.map +1 -1
  13. package/build/legacy/components/Avatar.cjs +23 -174
  14. package/build/legacy/components/Avatar.cjs.map +1 -1
  15. package/build/legacy/components/Checkbox.cjs +22 -168
  16. package/build/legacy/components/Checkbox.cjs.map +1 -1
  17. package/build/legacy/components/DatePicker.client.cjs +129 -272
  18. package/build/legacy/components/DatePicker.client.cjs.map +1 -1
  19. package/build/legacy/components/DatePicker.server.cjs +17 -271
  20. package/build/legacy/components/DatePicker.server.cjs.map +1 -1
  21. package/build/legacy/components/Dialog.cjs +86 -0
  22. package/build/legacy/components/Dialog.cjs.map +1 -0
  23. package/build/legacy/components/Dialog.client.cjs +95 -0
  24. package/build/legacy/components/Dialog.client.cjs.map +1 -0
  25. package/build/legacy/components/FileStatus.cjs +62 -212
  26. package/build/legacy/components/FileStatus.cjs.map +1 -1
  27. package/build/legacy/components/FileUploader.cjs +29 -180
  28. package/build/legacy/components/FileUploader.cjs.map +1 -1
  29. package/build/legacy/components/Input.cjs +20 -172
  30. package/build/legacy/components/Input.cjs.map +1 -1
  31. package/build/legacy/components/Modal.cjs.map +1 -1
  32. package/build/legacy/components/ModalDescription.cjs.map +1 -1
  33. package/build/legacy/components/ModalHeader.cjs.map +1 -1
  34. package/build/legacy/components/ModalHeading.cjs.map +1 -1
  35. package/build/legacy/components/Notification.cjs +26 -176
  36. package/build/legacy/components/Notification.cjs.map +1 -1
  37. package/build/legacy/components/Select.cjs +26 -178
  38. package/build/legacy/components/Select.cjs.map +1 -1
  39. package/build/legacy/components/Tag.cjs +16 -167
  40. package/build/legacy/components/Tag.cjs.map +1 -1
  41. package/build/legacy/components/Toggle.cjs +20 -172
  42. package/build/legacy/components/Toggle.cjs.map +1 -1
  43. package/build/legacy/config/defineIcons.cjs +3 -39
  44. package/build/legacy/config/defineIcons.cjs.map +1 -1
  45. package/build/legacy/config/{cerbIcons.cjs → index.cjs} +22 -29
  46. package/build/legacy/config/index.cjs.map +1 -0
  47. package/build/legacy/config/types.cjs +19 -0
  48. package/build/legacy/config/types.cjs.map +1 -0
  49. package/build/legacy/context/cerberus.cjs +46 -0
  50. package/build/legacy/context/cerberus.cjs.map +1 -0
  51. package/build/legacy/context/confirm-modal.cjs +105 -321
  52. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  53. package/build/legacy/context/cta-modal.cjs +137 -336
  54. package/build/legacy/context/cta-modal.cjs.map +1 -1
  55. package/build/legacy/context/notification-center/store.cjs +66 -0
  56. package/build/legacy/context/notification-center/store.cjs.map +1 -0
  57. package/build/legacy/context/notification-center/types.cjs +19 -0
  58. package/build/legacy/context/notification-center/types.cjs.map +1 -0
  59. package/build/legacy/context/notification-center.cjs +142 -249
  60. package/build/legacy/context/notification-center.cjs.map +1 -1
  61. package/build/legacy/context/prompt-modal.cjs +185 -388
  62. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  63. package/build/legacy/index.cjs +1577 -1456
  64. package/build/legacy/index.cjs.map +1 -1
  65. package/build/modern/_tsup-dts-rollup.d.ts +374 -80
  66. package/build/modern/{chunk-BVCXVZAF.js → chunk-25HMVHLT.js} +6 -5
  67. package/build/modern/chunk-25HMVHLT.js.map +1 -0
  68. package/build/modern/chunk-36N4527B.js +1 -0
  69. package/build/modern/chunk-5EWCH7AI.js +82 -0
  70. package/build/modern/chunk-5EWCH7AI.js.map +1 -0
  71. package/build/modern/chunk-5SNLQZYP.js +25 -0
  72. package/build/modern/chunk-5SNLQZYP.js.map +1 -0
  73. package/build/modern/chunk-6BN3XKQF.js +42 -0
  74. package/build/modern/chunk-6BN3XKQF.js.map +1 -0
  75. package/build/modern/{chunk-2UXE5PDG.js → chunk-7NN3SJ7W.js} +1 -1
  76. package/build/modern/chunk-7NN3SJ7W.js.map +1 -0
  77. package/build/modern/{chunk-KWJ5FKX7.js → chunk-BAWZBF5Q.js} +5 -3
  78. package/build/modern/chunk-BAWZBF5Q.js.map +1 -0
  79. package/build/modern/{chunk-6BH5J5GF.js → chunk-BHB56M7S.js} +31 -46
  80. package/build/modern/chunk-BHB56M7S.js.map +1 -0
  81. package/build/modern/{chunk-HKJMLWVP.js → chunk-EDARV2EI.js} +5 -4
  82. package/build/modern/chunk-EDARV2EI.js.map +1 -0
  83. package/build/modern/{chunk-5OVH3INN.js → chunk-FGCO27TC.js} +25 -53
  84. package/build/modern/chunk-FGCO27TC.js.map +1 -0
  85. package/build/modern/{chunk-PVIMOXSO.js → chunk-GCQMH4QA.js} +5 -4
  86. package/build/modern/chunk-GCQMH4QA.js.map +1 -0
  87. package/build/modern/chunk-GITT5645.js +20 -0
  88. package/build/modern/chunk-GITT5645.js.map +1 -0
  89. package/build/modern/{chunk-TJCFYL5W.js → chunk-IGHMP4WA.js} +1 -20
  90. package/build/modern/chunk-IGHMP4WA.js.map +1 -0
  91. package/build/modern/chunk-ISCJ542I.js +82 -0
  92. package/build/modern/chunk-ISCJ542I.js.map +1 -0
  93. package/build/modern/{chunk-HVKM54BA.js → chunk-IW3LIRDG.js} +1 -1
  94. package/build/modern/chunk-IW3LIRDG.js.map +1 -0
  95. package/build/modern/chunk-JAROS4Q3.js +180 -0
  96. package/build/modern/chunk-JAROS4Q3.js.map +1 -0
  97. package/build/modern/{chunk-BE4EOU2P.js → chunk-JIRW4XOJ.js} +1 -1
  98. package/build/modern/chunk-JIRW4XOJ.js.map +1 -0
  99. package/build/modern/chunk-KDDPAJMR.js +9 -0
  100. package/build/modern/chunk-KDDPAJMR.js.map +1 -0
  101. package/build/modern/{chunk-XOROL3JY.js → chunk-KKHL3ZO4.js} +5 -4
  102. package/build/modern/chunk-KKHL3ZO4.js.map +1 -0
  103. package/build/modern/{chunk-U36UZJGZ.js → chunk-MZ3UCDUL.js} +5 -4
  104. package/build/modern/chunk-MZ3UCDUL.js.map +1 -0
  105. package/build/modern/{chunk-T2JOPPGL.js → chunk-N24COMHJ.js} +11 -4
  106. package/build/modern/chunk-N24COMHJ.js.map +1 -0
  107. package/build/modern/chunk-NJSETNRL.js +68 -0
  108. package/build/modern/chunk-NJSETNRL.js.map +1 -0
  109. package/build/modern/{chunk-XY6WL55R.js → chunk-NUMM4TNC.js} +1 -1
  110. package/build/modern/chunk-NUMM4TNC.js.map +1 -0
  111. package/build/modern/{chunk-FXLLRVAM.js → chunk-O6LFWUHI.js} +8 -6
  112. package/build/modern/chunk-O6LFWUHI.js.map +1 -0
  113. package/build/modern/{chunk-JJZQGR7A.js → chunk-RDRD6ACD.js} +9 -6
  114. package/build/modern/chunk-RDRD6ACD.js.map +1 -0
  115. package/build/modern/{chunk-XXWR7UGH.js → chunk-SD3OVTHT.js} +75 -103
  116. package/build/modern/chunk-SD3OVTHT.js.map +1 -0
  117. package/build/modern/chunk-TFL56AYR.js +56 -0
  118. package/build/modern/chunk-TFL56AYR.js.map +1 -0
  119. package/build/modern/chunk-V3M3ZOQI.js +38 -0
  120. package/build/modern/chunk-V3M3ZOQI.js.map +1 -0
  121. package/build/modern/{chunk-QK7R2XJM.js → chunk-XQICKZH4.js} +6 -5
  122. package/build/modern/chunk-XQICKZH4.js.map +1 -0
  123. package/build/modern/chunk-XZGXRRSQ.js +31 -0
  124. package/build/modern/chunk-XZGXRRSQ.js.map +1 -0
  125. package/build/modern/{chunk-KPUYKHLW.js → chunk-YKKNWILF.js} +71 -15
  126. package/build/modern/chunk-YKKNWILF.js.map +1 -0
  127. package/build/modern/{chunk-Q7BRMIBR.js → chunk-ZL6ZITLA.js} +1 -1
  128. package/build/modern/chunk-ZL6ZITLA.js.map +1 -0
  129. package/build/modern/components/Accordion.client.js +9 -0
  130. package/build/modern/components/Accordion.client.js.map +1 -0
  131. package/build/modern/components/Accordion.js +1 -7
  132. package/build/modern/components/AccordionItemGroup.js +4 -6
  133. package/build/modern/components/Admonition.client.js +11 -0
  134. package/build/modern/components/Admonition.client.js.map +1 -0
  135. package/build/modern/components/Admonition.js +4 -6
  136. package/build/modern/components/AnimatingUploadIcon.js +1 -1
  137. package/build/modern/components/Avatar.js +3 -5
  138. package/build/modern/components/Checkbox.js +2 -5
  139. package/build/modern/components/DatePicker.client.js +8 -7
  140. package/build/modern/components/DatePicker.server.js +3 -13
  141. package/build/modern/components/Dialog.client.js +10 -0
  142. package/build/modern/components/Dialog.client.js.map +1 -0
  143. package/build/modern/components/Dialog.js +24 -0
  144. package/build/modern/components/Dialog.js.map +1 -0
  145. package/build/modern/components/FileStatus.js +3 -6
  146. package/build/modern/components/FileUploader.js +3 -6
  147. package/build/modern/components/Input.js +2 -5
  148. package/build/modern/components/Modal.js +1 -1
  149. package/build/modern/components/ModalDescription.js +1 -1
  150. package/build/modern/components/ModalHeader.js +1 -1
  151. package/build/modern/components/ModalHeading.js +1 -1
  152. package/build/modern/components/Notification.js +2 -5
  153. package/build/modern/components/Select.js +2 -5
  154. package/build/modern/components/Tag.js +3 -5
  155. package/build/modern/components/Toggle.js +2 -5
  156. package/build/modern/config/defineIcons.js +2 -5
  157. package/build/modern/config/index.js +14 -0
  158. package/build/modern/config/index.js.map +1 -0
  159. package/build/modern/config/types.js +2 -0
  160. package/build/modern/config/types.js.map +1 -0
  161. package/build/modern/context/cerberus.js +10 -0
  162. package/build/modern/context/cerberus.js.map +1 -0
  163. package/build/modern/context/confirm-modal.js +5 -13
  164. package/build/modern/context/cta-modal.js +7 -14
  165. package/build/modern/context/notification-center/store.js +15 -0
  166. package/build/modern/context/notification-center/store.js.map +1 -0
  167. package/build/modern/context/notification-center/types.js +1 -0
  168. package/build/modern/context/notification-center/types.js.map +1 -0
  169. package/build/modern/context/notification-center.js +5 -7
  170. package/build/modern/context/prompt-modal.js +8 -15
  171. package/build/modern/index.js +111 -75
  172. package/build/modern/index.js.map +1 -1
  173. package/package.json +4 -8
  174. package/src/components/Accordion.client.tsx +46 -0
  175. package/src/components/Accordion.tsx +0 -37
  176. package/src/components/AccordionItemGroup.tsx +1 -1
  177. package/src/components/Admonition.client.tsx +73 -0
  178. package/src/components/Admonition.tsx +1 -70
  179. package/src/components/AnimatingUploadIcon.tsx +3 -3
  180. package/src/components/Avatar.tsx +5 -2
  181. package/src/components/Checkbox.tsx +10 -3
  182. package/src/components/DatePicker.client.tsx +111 -15
  183. package/src/components/DatePicker.server.tsx +2 -75
  184. package/src/components/Dialog.client.tsx +39 -0
  185. package/src/components/Dialog.tsx +165 -0
  186. package/src/components/FileStatus.tsx +5 -3
  187. package/src/components/FileUploader.tsx +3 -2
  188. package/src/components/Input.tsx +4 -2
  189. package/src/components/Modal.tsx +1 -16
  190. package/src/components/ModalDescription.tsx +1 -8
  191. package/src/components/ModalHeader.tsx +1 -10
  192. package/src/components/ModalHeading.tsx +1 -8
  193. package/src/components/Notification.tsx +9 -4
  194. package/src/components/Select.tsx +5 -2
  195. package/src/components/Tag.tsx +5 -2
  196. package/src/components/Toggle.tsx +4 -3
  197. package/src/config/defineIcons.ts +28 -16
  198. package/src/config/index.ts +28 -0
  199. package/src/config/types.ts +42 -0
  200. package/src/context/cerberus.tsx +44 -0
  201. package/src/context/confirm-modal.tsx +44 -42
  202. package/src/context/cta-modal.tsx +25 -38
  203. package/src/context/notification-center/store.ts +88 -0
  204. package/src/context/notification-center/types.ts +28 -0
  205. package/src/context/notification-center.tsx +81 -46
  206. package/src/context/prompt-modal.tsx +101 -103
  207. package/src/index.ts +15 -8
  208. package/build/legacy/config/cerbIcons.cjs.map +0 -1
  209. package/build/modern/chunk-2UXE5PDG.js.map +0 -1
  210. package/build/modern/chunk-5OVH3INN.js.map +0 -1
  211. package/build/modern/chunk-6BH5J5GF.js.map +0 -1
  212. package/build/modern/chunk-BC5SZDYY.js +0 -132
  213. package/build/modern/chunk-BC5SZDYY.js.map +0 -1
  214. package/build/modern/chunk-BE4EOU2P.js.map +0 -1
  215. package/build/modern/chunk-BVCXVZAF.js.map +0 -1
  216. package/build/modern/chunk-CRII2HNX.js +0 -55
  217. package/build/modern/chunk-CRII2HNX.js.map +0 -1
  218. package/build/modern/chunk-CVTON5DQ.js +0 -162
  219. package/build/modern/chunk-CVTON5DQ.js.map +0 -1
  220. package/build/modern/chunk-FXLLRVAM.js.map +0 -1
  221. package/build/modern/chunk-HKJMLWVP.js.map +0 -1
  222. package/build/modern/chunk-HVKM54BA.js.map +0 -1
  223. package/build/modern/chunk-JJZQGR7A.js.map +0 -1
  224. package/build/modern/chunk-KPUYKHLW.js.map +0 -1
  225. package/build/modern/chunk-KWJ5FKX7.js.map +0 -1
  226. package/build/modern/chunk-PVIMOXSO.js.map +0 -1
  227. package/build/modern/chunk-Q7BRMIBR.js.map +0 -1
  228. package/build/modern/chunk-QK7R2XJM.js.map +0 -1
  229. package/build/modern/chunk-QMF5ZNDG.js +0 -27
  230. package/build/modern/chunk-QMF5ZNDG.js.map +0 -1
  231. package/build/modern/chunk-QQOWWMZ3.js +0 -138
  232. package/build/modern/chunk-QQOWWMZ3.js.map +0 -1
  233. package/build/modern/chunk-T2JOPPGL.js.map +0 -1
  234. package/build/modern/chunk-TJCFYL5W.js.map +0 -1
  235. package/build/modern/chunk-U36UZJGZ.js.map +0 -1
  236. package/build/modern/chunk-XOROL3JY.js.map +0 -1
  237. package/build/modern/chunk-XXWR7UGH.js.map +0 -1
  238. package/build/modern/chunk-XY6WL55R.js.map +0 -1
  239. package/build/modern/config/cerbIcons.js +0 -9
  240. package/src/config/cerbIcons.ts +0 -73
  241. /package/build/modern/{config/cerbIcons.js.map → chunk-36N4527B.js.map} +0 -0
@@ -25,11 +25,7 @@ __export(cta_modal_exports, {
25
25
  useCTAModal: () => useCTAModal
26
26
  });
27
27
  module.exports = __toCommonJS(cta_modal_exports);
28
- var import_react5 = require("react");
29
-
30
- // src/components/Portal.tsx
31
- var import_react = require("@ark-ui/react");
32
- var Portal = import_react.Portal;
28
+ var import_react6 = require("react");
33
29
 
34
30
  // src/components/Button.tsx
35
31
  var import_css = require("@cerberus/styled-system/css");
@@ -53,292 +49,36 @@ function Button(props) {
53
49
  );
54
50
  }
55
51
 
56
- // src/config/cerbIcons.ts
57
- var import_icons = require("@cerberus/icons");
58
-
59
- // src/config/icons/checkbox.icons.tsx
60
- var import_jsx_runtime2 = require("react/jsx-runtime");
61
- function CheckmarkIcon(props) {
62
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
63
- "svg",
64
- {
65
- "aria-hidden": "true",
66
- xmlns: "http://www.w3.org/2000/svg",
67
- fill: "none",
68
- role: "img",
69
- viewBox: "0 0 24 24",
70
- ...props,
71
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
72
- "path",
73
- {
74
- fill: "currentColor",
75
- d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
76
- }
77
- )
78
- }
79
- );
80
- }
81
- function IndeterminateIcon(props) {
82
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
83
- "svg",
84
- {
85
- "aria-hidden": "true",
86
- xmlns: "http://www.w3.org/2000/svg",
87
- role: "img",
88
- fill: "none",
89
- viewBox: "0 0 24 24",
90
- ...props,
91
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
92
- }
93
- );
94
- }
95
-
96
- // src/components/AnimatingUploadIcon.tsx
97
- var import_jsx_runtime3 = require("react/jsx-runtime");
98
- function AnimatingUploadIcon(props) {
99
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
100
- "svg",
101
- {
102
- "aria-hidden": "true",
103
- xmlns: "http://www.w3.org/2000/svg",
104
- width: props.size ?? "1em",
105
- height: props.size ?? "1em",
106
- viewBox: "0 0 24 24",
107
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
108
- "g",
109
- {
110
- fill: "none",
111
- stroke: "currentColor",
112
- strokeLinecap: "square",
113
- strokeLinejoin: "round",
114
- strokeWidth: 1.5,
115
- children: [
116
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
117
- "path",
118
- {
119
- "data-name": "animating-trail",
120
- strokeDasharray: "2 4",
121
- strokeDashoffset: 6,
122
- d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
123
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
124
- "animate",
125
- {
126
- attributeName: "stroke-dashoffset",
127
- dur: "0.45s",
128
- repeatCount: "indefinite",
129
- values: "6;0"
130
- }
131
- )
132
- }
133
- ),
134
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
135
- "path",
136
- {
137
- "data-name": "half-circle",
138
- strokeDasharray: 32,
139
- strokeDashoffset: 32,
140
- d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
141
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
142
- "animate",
143
- {
144
- fill: "freeze",
145
- attributeName: "stroke-dashoffset",
146
- begin: "0.075s",
147
- dur: "0.3s",
148
- values: "32;0"
149
- }
150
- )
151
- }
152
- ),
153
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
154
- "svg",
155
- {
156
- "aria-hidden": "true",
157
- xmlns: "http://www.w3.org/2000/svg",
158
- width: "0.8em",
159
- height: "0.8em",
160
- x: "27%",
161
- y: "27%",
162
- viewBox: "0 0 24 24",
163
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
164
- "polygon",
165
- {
166
- fill: "currentColor",
167
- stroke: "currentColor",
168
- strokeWidth: 0.8,
169
- opacity: "1",
170
- points: "3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 ",
171
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
172
- "animate",
173
- {
174
- fill: "freeze",
175
- attributeName: "opacity",
176
- values: "1;0;1",
177
- dur: "2s",
178
- repeatCount: "indefinite"
179
- }
180
- )
181
- }
182
- )
183
- }
184
- )
185
- ]
186
- }
187
- )
188
- }
189
- );
190
- }
191
-
192
- // src/config/cerbIcons.ts
193
- var defaultIcons = {
194
- accordionIndicator: import_icons.ChevronDown,
195
- avatar: import_icons.UserFilled,
196
- calendar: import_icons.Calendar,
197
- calendarPrev: import_icons.ChevronLeft,
198
- calendarNext: import_icons.ChevronRight,
199
- checkbox: CheckmarkIcon,
200
- close: import_icons.Close,
201
- confirmModal: import_icons.Information,
202
- delete: import_icons.TrashCan,
203
- promptModal: import_icons.Information,
204
- waitingFileUploader: import_icons.CloudUpload,
205
- fileUploader: AnimatingUploadIcon,
206
- indeterminate: IndeterminateIcon,
207
- infoNotification: import_icons.Information,
208
- successNotification: import_icons.CheckmarkOutline,
209
- warningNotification: import_icons.WarningAlt,
210
- dangerNotification: import_icons.WarningFilled,
211
- invalid: import_icons.WarningFilled,
212
- invalidAlt: import_icons.Warning,
213
- redo: import_icons.Restart,
214
- selectArrow: import_icons.ChevronDown,
215
- toggleChecked: import_icons.Checkmark
216
- };
217
-
218
- // src/config/defineIcons.ts
219
- var $cerberusIcons = defaultIcons;
220
-
221
- // src/aria-helpers/trap-focus.aria.ts
222
- function trapFocus(modalRef) {
223
- var _a;
224
- const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
225
- const focusable = Array.from(
226
- ((_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(focusableElements)) ?? []
227
- );
228
- const firstFocusable = focusable[0];
229
- const lastFocusable = focusable[focusable.length - 1];
230
- return function handleKeyDown(event) {
231
- if (event.key === "Tab") {
232
- if (event.shiftKey) {
233
- if (document.activeElement === firstFocusable) {
234
- lastFocusable.focus();
235
- event.preventDefault();
236
- }
237
- } else {
238
- if (document.activeElement === lastFocusable) {
239
- firstFocusable.focus();
240
- event.preventDefault();
241
- }
242
- }
243
- }
244
- };
245
- }
246
-
247
52
  // src/components/Show.tsx
248
- var import_react2 = require("react");
53
+ var import_react = require("react");
249
54
  function Show(props) {
250
55
  const { when, children, fallback } = props;
251
- const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
252
- return (0, import_react2.useMemo)(() => {
56
+ const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
57
+ return (0, import_react.useMemo)(() => {
253
58
  if (condition) return children;
254
59
  return fallback ?? null;
255
60
  }, [condition, children, fallback]);
256
61
  }
257
62
 
258
- // src/components/Modal.tsx
63
+ // src/components/Avatar.tsx
259
64
  var import_css2 = require("@cerberus/styled-system/css");
260
- var import_recipes2 = require("@cerberus/styled-system/recipes");
261
- var import_react3 = require("react");
262
- var import_jsx_runtime4 = require("react/jsx-runtime");
263
- function ModalEl(props, ref) {
264
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
265
- "dialog",
266
- {
267
- ...props,
268
- className: (0, import_css2.cx)(props.className, (0, import_recipes2.modal)().dialog),
269
- ref
270
- }
271
- );
272
- }
273
- var Modal = (0, import_react3.forwardRef)(ModalEl);
274
-
275
- // src/hooks/useModal.ts
276
- var import_react4 = require("react");
277
- function useModal() {
278
- const modalRef = (0, import_react4.useRef)(null);
279
- const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
280
- const show = (0, import_react4.useCallback)(() => {
281
- var _a;
282
- (_a = modalRef.current) == null ? void 0 : _a.showModal();
283
- setIsOpen(true);
284
- }, []);
285
- const close = (0, import_react4.useCallback)(() => {
286
- var _a;
287
- (_a = modalRef.current) == null ? void 0 : _a.close();
288
- setIsOpen(false);
289
- }, []);
290
- return (0, import_react4.useMemo)(() => {
291
- return {
292
- modalRef,
293
- show,
294
- close,
295
- isOpen
296
- };
297
- }, [modalRef, show, close, isOpen]);
298
- }
299
-
300
- // src/components/ModalHeader.tsx
301
- var import_css3 = require("@cerberus/styled-system/css");
302
65
  var import_patterns = require("@cerberus/styled-system/patterns");
303
- var import_jsx_runtime5 = require("react/jsx-runtime");
304
- function ModalHeader(props) {
305
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
306
- "div",
307
- {
308
- ...props,
309
- className: (0, import_css3.cx)(
310
- props.className,
311
- (0, import_patterns.vstack)({
312
- alignItems: "flex-start",
313
- gap: "md",
314
- position: "relative"
315
- })
316
- )
317
- }
318
- );
319
- }
320
-
321
- // src/components/ModalHeading.tsx
322
- var import_css4 = require("@cerberus/styled-system/css");
323
- var import_recipes3 = require("@cerberus/styled-system/recipes");
324
- var import_jsx_runtime6 = require("react/jsx-runtime");
325
- function ModalHeading(props) {
326
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { ...props, className: (0, import_css4.cx)(props.className, (0, import_recipes3.modal)().heading) });
327
- }
66
+ var import_recipes2 = require("@cerberus/styled-system/recipes");
328
67
 
329
- // src/components/ModalDescription.tsx
330
- var import_css5 = require("@cerberus/styled-system/css");
331
- var import_recipes4 = require("@cerberus/styled-system/recipes");
332
- var import_jsx_runtime7 = require("react/jsx-runtime");
333
- function ModalDescription(props) {
334
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { ...props, className: (0, import_css5.cx)(props.className, (0, import_recipes4.modal)().description) });
68
+ // src/context/cerberus.tsx
69
+ var import_react2 = require("react");
70
+ var import_jsx_runtime2 = require("react/jsx-runtime");
71
+ var CerberusContext = (0, import_react2.createContext)(null);
72
+ function useCerberusContext() {
73
+ const context = (0, import_react2.useContext)(CerberusContext);
74
+ if (!context) {
75
+ throw new Error("useCerberus must be used within a CerberusProvider");
76
+ }
77
+ return context;
335
78
  }
336
79
 
337
80
  // src/components/Avatar.tsx
338
- var import_css6 = require("@cerberus/styled-system/css");
339
- var import_patterns2 = require("@cerberus/styled-system/patterns");
340
- var import_recipes5 = require("@cerberus/styled-system/recipes");
341
- var import_jsx_runtime8 = require("react/jsx-runtime");
81
+ var import_jsx_runtime3 = require("react/jsx-runtime");
342
82
  function Avatar(props) {
343
83
  const {
344
84
  ariaLabel,
@@ -351,30 +91,31 @@ function Avatar(props) {
351
91
  icon,
352
92
  ...nativeProps
353
93
  } = props;
354
- const { avatar: AvatarIcon } = $cerberusIcons;
94
+ const { icons } = useCerberusContext();
95
+ const { avatar: AvatarIcon } = icons;
355
96
  const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
356
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
97
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
357
98
  "div",
358
99
  {
359
100
  ...nativeProps,
360
- className: (0, import_css6.cx)(
101
+ className: (0, import_css2.cx)(
361
102
  nativeProps.className,
362
- (0, import_recipes5.avatar)({ gradient, size }),
363
- (0, import_patterns2.circle)()
103
+ (0, import_recipes2.avatar)({ gradient, size }),
104
+ (0, import_patterns.circle)()
364
105
  ),
365
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
106
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
366
107
  Show,
367
108
  {
368
109
  when: Boolean(src) || Boolean(as),
369
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
110
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
370
111
  Show,
371
112
  {
372
113
  when: Boolean(initials),
373
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
114
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
374
115
  Show,
375
116
  {
376
117
  when: Boolean(icon),
377
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
118
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
378
119
  AvatarIcon,
379
120
  {
380
121
  size: iconSizeMap[size]
@@ -386,15 +127,15 @@ function Avatar(props) {
386
127
  children: initials
387
128
  }
388
129
  ),
389
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
130
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
390
131
  Show,
391
132
  {
392
133
  when: Boolean(as),
393
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
134
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
394
135
  "img",
395
136
  {
396
137
  alt: props.ariaLabel,
397
- className: (0, import_css6.css)({
138
+ className: (0, import_css2.css)({
398
139
  h: "full",
399
140
  objectFit: "cover",
400
141
  w: "full"
@@ -427,21 +168,70 @@ var iconSizeMap = {
427
168
 
428
169
  // src/context/cta-modal.tsx
429
170
  var import_jsx = require("@cerberus/styled-system/jsx");
171
+ var import_css6 = require("@cerberus/styled-system/css");
172
+ var import_jsx2 = require("@cerberus/styled-system/jsx");
173
+
174
+ // src/components/Dialog.tsx
175
+ var import_react4 = require("@ark-ui/react");
176
+ var import_recipes3 = require("@cerberus/styled-system/recipes");
177
+
178
+ // src/components/Portal.tsx
179
+ var import_react3 = require("@ark-ui/react");
180
+ var Portal = import_react3.Portal;
181
+
182
+ // src/components/Dialog.tsx
183
+ var import_css3 = require("@cerberus/styled-system/css");
184
+ var import_jsx_runtime4 = require("react/jsx-runtime");
185
+ function DialogProvider(props) {
186
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react4.Dialog.Root, { ...props });
187
+ }
188
+ function Dialog(props) {
189
+ const { size, ...contentProps } = props;
190
+ const styles = (0, import_recipes3.dialog)({ size });
191
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Portal, { children: [
192
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogBackdrop, { className: styles.backdrop }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogPositioner, { className: styles.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogContent, { className: styles.content, ...contentProps }) })
194
+ ] });
195
+ }
196
+ function DialogHeading(props) {
197
+ const styles = (0, import_recipes3.dialog)();
198
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react4.Dialog.Title, { ...props, className: (0, import_css3.cx)(props.className, styles.title) });
199
+ }
200
+ function DialogDescription(props) {
201
+ const styles = (0, import_recipes3.dialog)();
202
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
203
+ import_react4.Dialog.Description,
204
+ {
205
+ ...props,
206
+ className: (0, import_css3.cx)(props.className, styles.description)
207
+ }
208
+ );
209
+ }
210
+ var DialogTrigger = import_react4.Dialog.Trigger;
211
+ var DialogCloseTrigger = import_react4.Dialog.CloseTrigger;
212
+ var DialogBackdrop = import_react4.Dialog.Backdrop;
213
+ var DialogPositioner = import_react4.Dialog.Positioner;
214
+ var DialogContent = import_react4.Dialog.Content;
215
+
216
+ // src/components/Dialog.client.tsx
217
+ var import_react5 = require("@ark-ui/react");
218
+ var import_recipes5 = require("@cerberus/styled-system/recipes");
219
+ var import_css5 = require("@cerberus/styled-system/css");
430
220
 
431
221
  // src/components/IconButton.tsx
432
- var import_css7 = require("@cerberus/styled-system/css");
433
- var import_recipes6 = require("@cerberus/styled-system/recipes");
434
- var import_jsx_runtime9 = require("react/jsx-runtime");
222
+ var import_css4 = require("@cerberus/styled-system/css");
223
+ var import_recipes4 = require("@cerberus/styled-system/recipes");
224
+ var import_jsx_runtime5 = require("react/jsx-runtime");
435
225
  function IconButton(props) {
436
226
  const { ariaLabel, palette, usage, size, ...nativeProps } = props;
437
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
227
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
438
228
  "button",
439
229
  {
440
230
  ...nativeProps,
441
231
  "aria-label": ariaLabel ?? "Icon Button",
442
- className: (0, import_css7.cx)(
232
+ className: (0, import_css4.cx)(
443
233
  nativeProps.className,
444
- (0, import_recipes6.iconButton)({
234
+ (0, import_recipes4.iconButton)({
445
235
  palette,
446
236
  usage,
447
237
  size
@@ -451,20 +241,43 @@ function IconButton(props) {
451
241
  );
452
242
  }
453
243
 
244
+ // src/components/Dialog.client.tsx
245
+ var import_jsx_runtime6 = require("react/jsx-runtime");
246
+ function DialogCloseIconTrigger(props) {
247
+ const { icons } = useCerberusContext();
248
+ const { close: CloseIcon } = icons;
249
+ const styles = (0, import_recipes5.dialog)();
250
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
251
+ import_react5.Dialog.CloseTrigger,
252
+ {
253
+ ...props,
254
+ className: (0, import_css5.cx)(props.className, styles.closeTrigger),
255
+ asChild: true,
256
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
257
+ IconButton,
258
+ {
259
+ ariaLabel: "Close dialog",
260
+ palette: "action",
261
+ size: "lg",
262
+ usage: "ghost",
263
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CloseIcon, {})
264
+ }
265
+ )
266
+ }
267
+ );
268
+ }
269
+
454
270
  // src/context/cta-modal.tsx
455
- var import_css8 = require("@cerberus/styled-system/css");
456
- var import_jsx2 = require("@cerberus/styled-system/jsx");
457
- var import_jsx_runtime10 = require("react/jsx-runtime");
458
- var CTAModalContext = (0, import_react5.createContext)(null);
271
+ var import_jsx_runtime7 = require("react/jsx-runtime");
272
+ var CTAModalContext = (0, import_react6.createContext)(null);
459
273
  function CTAModal(props) {
460
274
  var _a, _b;
461
- const { modalRef, show, close } = useModal();
462
- const [content, setContent] = (0, import_react5.useState)(null);
463
- const focusTrap = trapFocus(modalRef);
464
- const FallbackIcon = $cerberusIcons.confirmModal;
275
+ const [open, setOpen] = (0, import_react6.useState)(false);
276
+ const [content, setContent] = (0, import_react6.useState)(null);
465
277
  const confirmIcon = content == null ? void 0 : content.icon;
466
- const { close: CloseIcon } = $cerberusIcons;
467
- const handleShow = (0, import_react5.useCallback)(
278
+ const { icons } = useCerberusContext();
279
+ const { confirmModal: FallbackIcon } = icons;
280
+ const handleShow = (0, import_react6.useCallback)(
468
281
  (options) => {
469
282
  const maxActions = 2;
470
283
  if (options.actions.length > maxActions) {
@@ -473,68 +286,56 @@ function CTAModal(props) {
473
286
  );
474
287
  }
475
288
  setContent({ ...options });
476
- show();
289
+ setOpen(true);
477
290
  },
478
- [show]
291
+ [setOpen]
479
292
  );
480
- const handleActionClick = (0, import_react5.useCallback)(
293
+ const handleActionClick = (0, import_react6.useCallback)(
481
294
  (event) => {
482
295
  const index = event.currentTarget.getAttribute("data-index");
483
296
  const action = content == null ? void 0 : content.actions[Number(index)];
484
297
  const { onClick } = action || {};
485
298
  onClick == null ? void 0 : onClick(event);
486
- close();
299
+ setOpen(false);
487
300
  },
488
- [content, close]
301
+ [content, setOpen]
489
302
  );
490
- const value = (0, import_react5.useMemo)(
303
+ const value = (0, import_react6.useMemo)(
491
304
  () => ({
492
305
  show: handleShow
493
306
  }),
494
307
  [handleShow]
495
308
  );
496
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(CTAModalContext.Provider, { value, children: [
309
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(CTAModalContext.Provider, { value, children: [
497
310
  props.children,
498
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
499
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
500
- "span",
501
- {
502
- className: (0, import_css8.css)({
503
- padding: "md",
504
- position: "absolute",
505
- right: 0,
506
- top: 0,
507
- zIndex: "decorator"
508
- }),
509
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconButton, { ariaLabel: "Close modal", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CloseIcon, {}) })
510
- }
511
- ),
512
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx2.VStack, { gap: "xl", w: "full", children: [
513
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ModalHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx2.VStack, { gap: "lg", w: "full", children: [
514
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
311
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogProvider, { open, onOpenChange: (e) => setOpen(e.open), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Dialog, { size: "sm", children: [
312
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogCloseIconTrigger, {}),
313
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx2.VStack, { gap: "xl", w: "full", children: [
314
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx2.VStack, { alignItems: "flex-start", gap: "md", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx2.VStack, { gap: "lg", w: "full", children: [
315
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
515
316
  Avatar,
516
317
  {
517
318
  ariaLabel: "",
518
319
  gradient: "charon-light",
519
- icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
320
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
520
321
  Show,
521
322
  {
522
323
  when: Boolean(confirmIcon),
523
- fallback: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FallbackIcon, { size: 24 }),
324
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FallbackIcon, { size: 24 }),
524
325
  children: confirmIcon
525
326
  }
526
327
  ),
527
328
  src: ""
528
329
  }
529
330
  ),
530
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
531
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
331
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogHeading, { children: content == null ? void 0 : content.heading }),
332
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogDescription, { children: content == null ? void 0 : content.description })
532
333
  ] }) }),
533
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx.HStack, { gap: "md", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Show, { when: Boolean((_a = content == null ? void 0 : content.actions) == null ? void 0 : _a.length), children: (_b = content == null ? void 0 : content.actions) == null ? void 0 : _b.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
334
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.HStack, { gap: "md", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Show, { when: Boolean((_a = content == null ? void 0 : content.actions) == null ? void 0 : _a.length), children: (_b = content == null ? void 0 : content.actions) == null ? void 0 : _b.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
534
335
  Button,
535
336
  {
536
337
  "data-index": index,
537
- className: (0, import_css8.css)({
338
+ className: (0, import_css6.css)({
538
339
  w: "1/2"
539
340
  }),
540
341
  onClick: handleActionClick,
@@ -549,7 +350,7 @@ function CTAModal(props) {
549
350
  ] });
550
351
  }
551
352
  function useCTAModal() {
552
- const context = (0, import_react5.useContext)(CTAModalContext);
353
+ const context = (0, import_react6.useContext)(CTAModalContext);
553
354
  if (context === null) {
554
355
  throw new Error("useCTAModal must be used within a CTAModal Provider");
555
356
  }