@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
@@ -27,10 +27,6 @@ __export(confirm_modal_exports, {
27
27
  module.exports = __toCommonJS(confirm_modal_exports);
28
28
  var import_react5 = require("react");
29
29
 
30
- // src/components/Portal.tsx
31
- var import_react = require("@ark-ui/react");
32
- var Portal = import_react.Portal;
33
-
34
30
  // src/components/Button.tsx
35
31
  var import_css = require("@cerberus/styled-system/css");
36
32
  var import_recipes = require("@cerberus/styled-system/recipes");
@@ -54,295 +50,38 @@ function Button(props) {
54
50
  }
55
51
 
56
52
  // src/context/confirm-modal.tsx
57
- var import_css7 = require("@cerberus/styled-system/css");
58
- var import_patterns3 = require("@cerberus/styled-system/patterns");
59
-
60
- // src/config/cerbIcons.ts
61
- var import_icons = require("@cerberus/icons");
62
-
63
- // src/config/icons/checkbox.icons.tsx
64
- var import_jsx_runtime2 = require("react/jsx-runtime");
65
- function CheckmarkIcon(props) {
66
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
67
- "svg",
68
- {
69
- "aria-hidden": "true",
70
- xmlns: "http://www.w3.org/2000/svg",
71
- fill: "none",
72
- role: "img",
73
- viewBox: "0 0 24 24",
74
- ...props,
75
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
76
- "path",
77
- {
78
- fill: "currentColor",
79
- d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
80
- }
81
- )
82
- }
83
- );
84
- }
85
- function IndeterminateIcon(props) {
86
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
87
- "svg",
88
- {
89
- "aria-hidden": "true",
90
- xmlns: "http://www.w3.org/2000/svg",
91
- role: "img",
92
- fill: "none",
93
- viewBox: "0 0 24 24",
94
- ...props,
95
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
96
- }
97
- );
98
- }
99
-
100
- // src/components/AnimatingUploadIcon.tsx
101
- var import_jsx_runtime3 = require("react/jsx-runtime");
102
- function AnimatingUploadIcon(props) {
103
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
104
- "svg",
105
- {
106
- "aria-hidden": "true",
107
- xmlns: "http://www.w3.org/2000/svg",
108
- width: props.size ?? "1em",
109
- height: props.size ?? "1em",
110
- viewBox: "0 0 24 24",
111
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
112
- "g",
113
- {
114
- fill: "none",
115
- stroke: "currentColor",
116
- strokeLinecap: "square",
117
- strokeLinejoin: "round",
118
- strokeWidth: 1.5,
119
- children: [
120
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
121
- "path",
122
- {
123
- "data-name": "animating-trail",
124
- strokeDasharray: "2 4",
125
- strokeDashoffset: 6,
126
- d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
127
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
128
- "animate",
129
- {
130
- attributeName: "stroke-dashoffset",
131
- dur: "0.45s",
132
- repeatCount: "indefinite",
133
- values: "6;0"
134
- }
135
- )
136
- }
137
- ),
138
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
139
- "path",
140
- {
141
- "data-name": "half-circle",
142
- strokeDasharray: 32,
143
- strokeDashoffset: 32,
144
- d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
145
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
146
- "animate",
147
- {
148
- fill: "freeze",
149
- attributeName: "stroke-dashoffset",
150
- begin: "0.075s",
151
- dur: "0.3s",
152
- values: "32;0"
153
- }
154
- )
155
- }
156
- ),
157
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
158
- "svg",
159
- {
160
- "aria-hidden": "true",
161
- xmlns: "http://www.w3.org/2000/svg",
162
- width: "0.8em",
163
- height: "0.8em",
164
- x: "27%",
165
- y: "27%",
166
- viewBox: "0 0 24 24",
167
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
168
- "polygon",
169
- {
170
- fill: "currentColor",
171
- stroke: "currentColor",
172
- strokeWidth: 0.8,
173
- opacity: "1",
174
- 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 ",
175
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
176
- "animate",
177
- {
178
- fill: "freeze",
179
- attributeName: "opacity",
180
- values: "1;0;1",
181
- dur: "2s",
182
- repeatCount: "indefinite"
183
- }
184
- )
185
- }
186
- )
187
- }
188
- )
189
- ]
190
- }
191
- )
192
- }
193
- );
194
- }
195
-
196
- // src/config/cerbIcons.ts
197
- var defaultIcons = {
198
- accordionIndicator: import_icons.ChevronDown,
199
- avatar: import_icons.UserFilled,
200
- calendar: import_icons.Calendar,
201
- calendarPrev: import_icons.ChevronLeft,
202
- calendarNext: import_icons.ChevronRight,
203
- checkbox: CheckmarkIcon,
204
- close: import_icons.Close,
205
- confirmModal: import_icons.Information,
206
- delete: import_icons.TrashCan,
207
- promptModal: import_icons.Information,
208
- waitingFileUploader: import_icons.CloudUpload,
209
- fileUploader: AnimatingUploadIcon,
210
- indeterminate: IndeterminateIcon,
211
- infoNotification: import_icons.Information,
212
- successNotification: import_icons.CheckmarkOutline,
213
- warningNotification: import_icons.WarningAlt,
214
- dangerNotification: import_icons.WarningFilled,
215
- invalid: import_icons.WarningFilled,
216
- invalidAlt: import_icons.Warning,
217
- redo: import_icons.Restart,
218
- selectArrow: import_icons.ChevronDown,
219
- toggleChecked: import_icons.Checkmark
220
- };
221
-
222
- // src/config/defineIcons.ts
223
- var $cerberusIcons = defaultIcons;
224
-
225
- // src/aria-helpers/trap-focus.aria.ts
226
- function trapFocus(modalRef) {
227
- var _a;
228
- const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
229
- const focusable = Array.from(
230
- ((_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(focusableElements)) ?? []
231
- );
232
- const firstFocusable = focusable[0];
233
- const lastFocusable = focusable[focusable.length - 1];
234
- return function handleKeyDown(event) {
235
- if (event.key === "Tab") {
236
- if (event.shiftKey) {
237
- if (document.activeElement === firstFocusable) {
238
- lastFocusable.focus();
239
- event.preventDefault();
240
- }
241
- } else {
242
- if (document.activeElement === lastFocusable) {
243
- firstFocusable.focus();
244
- event.preventDefault();
245
- }
246
- }
247
- }
248
- };
249
- }
53
+ var import_css4 = require("@cerberus/styled-system/css");
250
54
 
251
55
  // src/components/Show.tsx
252
- var import_react2 = require("react");
56
+ var import_react = require("react");
253
57
  function Show(props) {
254
58
  const { when, children, fallback } = props;
255
- const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
256
- return (0, import_react2.useMemo)(() => {
59
+ const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
60
+ return (0, import_react.useMemo)(() => {
257
61
  if (condition) return children;
258
62
  return fallback ?? null;
259
63
  }, [condition, children, fallback]);
260
64
  }
261
65
 
262
- // src/components/Modal.tsx
66
+ // src/components/Avatar.tsx
263
67
  var import_css2 = require("@cerberus/styled-system/css");
264
- var import_recipes2 = require("@cerberus/styled-system/recipes");
265
- var import_react3 = require("react");
266
- var import_jsx_runtime4 = require("react/jsx-runtime");
267
- function ModalEl(props, ref) {
268
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
269
- "dialog",
270
- {
271
- ...props,
272
- className: (0, import_css2.cx)(props.className, (0, import_recipes2.modal)().dialog),
273
- ref
274
- }
275
- );
276
- }
277
- var Modal = (0, import_react3.forwardRef)(ModalEl);
278
-
279
- // src/hooks/useModal.ts
280
- var import_react4 = require("react");
281
- function useModal() {
282
- const modalRef = (0, import_react4.useRef)(null);
283
- const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
284
- const show = (0, import_react4.useCallback)(() => {
285
- var _a;
286
- (_a = modalRef.current) == null ? void 0 : _a.showModal();
287
- setIsOpen(true);
288
- }, []);
289
- const close = (0, import_react4.useCallback)(() => {
290
- var _a;
291
- (_a = modalRef.current) == null ? void 0 : _a.close();
292
- setIsOpen(false);
293
- }, []);
294
- return (0, import_react4.useMemo)(() => {
295
- return {
296
- modalRef,
297
- show,
298
- close,
299
- isOpen
300
- };
301
- }, [modalRef, show, close, isOpen]);
302
- }
303
-
304
- // src/components/ModalHeader.tsx
305
- var import_css3 = require("@cerberus/styled-system/css");
306
68
  var import_patterns = require("@cerberus/styled-system/patterns");
307
- var import_jsx_runtime5 = require("react/jsx-runtime");
308
- function ModalHeader(props) {
309
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
310
- "div",
311
- {
312
- ...props,
313
- className: (0, import_css3.cx)(
314
- props.className,
315
- (0, import_patterns.vstack)({
316
- alignItems: "flex-start",
317
- gap: "md",
318
- position: "relative"
319
- })
320
- )
321
- }
322
- );
323
- }
324
-
325
- // src/components/ModalHeading.tsx
326
- var import_css4 = require("@cerberus/styled-system/css");
327
- var import_recipes3 = require("@cerberus/styled-system/recipes");
328
- var import_jsx_runtime6 = require("react/jsx-runtime");
329
- function ModalHeading(props) {
330
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { ...props, className: (0, import_css4.cx)(props.className, (0, import_recipes3.modal)().heading) });
331
- }
69
+ var import_recipes2 = require("@cerberus/styled-system/recipes");
332
70
 
333
- // src/components/ModalDescription.tsx
334
- var import_css5 = require("@cerberus/styled-system/css");
335
- var import_recipes4 = require("@cerberus/styled-system/recipes");
336
- var import_jsx_runtime7 = require("react/jsx-runtime");
337
- function ModalDescription(props) {
338
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { ...props, className: (0, import_css5.cx)(props.className, (0, import_recipes4.modal)().description) });
71
+ // src/context/cerberus.tsx
72
+ var import_react2 = require("react");
73
+ var import_jsx_runtime2 = require("react/jsx-runtime");
74
+ var CerberusContext = (0, import_react2.createContext)(null);
75
+ function useCerberusContext() {
76
+ const context = (0, import_react2.useContext)(CerberusContext);
77
+ if (!context) {
78
+ throw new Error("useCerberus must be used within a CerberusProvider");
79
+ }
80
+ return context;
339
81
  }
340
82
 
341
83
  // src/components/Avatar.tsx
342
- var import_css6 = require("@cerberus/styled-system/css");
343
- var import_patterns2 = require("@cerberus/styled-system/patterns");
344
- var import_recipes5 = require("@cerberus/styled-system/recipes");
345
- var import_jsx_runtime8 = require("react/jsx-runtime");
84
+ var import_jsx_runtime3 = require("react/jsx-runtime");
346
85
  function Avatar(props) {
347
86
  const {
348
87
  ariaLabel,
@@ -355,30 +94,31 @@ function Avatar(props) {
355
94
  icon,
356
95
  ...nativeProps
357
96
  } = props;
358
- const { avatar: AvatarIcon } = $cerberusIcons;
97
+ const { icons } = useCerberusContext();
98
+ const { avatar: AvatarIcon } = icons;
359
99
  const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
360
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
100
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
361
101
  "div",
362
102
  {
363
103
  ...nativeProps,
364
- className: (0, import_css6.cx)(
104
+ className: (0, import_css2.cx)(
365
105
  nativeProps.className,
366
- (0, import_recipes5.avatar)({ gradient, size }),
367
- (0, import_patterns2.circle)()
106
+ (0, import_recipes2.avatar)({ gradient, size }),
107
+ (0, import_patterns.circle)()
368
108
  ),
369
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
109
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
370
110
  Show,
371
111
  {
372
112
  when: Boolean(src) || Boolean(as),
373
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
113
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
374
114
  Show,
375
115
  {
376
116
  when: Boolean(initials),
377
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
117
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
378
118
  Show,
379
119
  {
380
120
  when: Boolean(icon),
381
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
121
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
382
122
  AvatarIcon,
383
123
  {
384
124
  size: iconSizeMap[size]
@@ -390,15 +130,15 @@ function Avatar(props) {
390
130
  children: initials
391
131
  }
392
132
  ),
393
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
133
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
394
134
  Show,
395
135
  {
396
136
  when: Boolean(as),
397
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
137
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
398
138
  "img",
399
139
  {
400
140
  alt: props.ariaLabel,
401
- className: (0, import_css6.css)({
141
+ className: (0, import_css2.css)({
402
142
  h: "full",
403
143
  objectFit: "cover",
404
144
  w: "full"
@@ -431,15 +171,59 @@ var iconSizeMap = {
431
171
 
432
172
  // src/context/confirm-modal.tsx
433
173
  var import_jsx = require("@cerberus/styled-system/jsx");
434
- var import_jsx_runtime9 = require("react/jsx-runtime");
174
+
175
+ // src/components/Dialog.tsx
176
+ var import_react4 = require("@ark-ui/react");
177
+ var import_recipes3 = require("@cerberus/styled-system/recipes");
178
+
179
+ // src/components/Portal.tsx
180
+ var import_react3 = require("@ark-ui/react");
181
+ var Portal = import_react3.Portal;
182
+
183
+ // src/components/Dialog.tsx
184
+ var import_css3 = require("@cerberus/styled-system/css");
185
+ var import_jsx_runtime4 = require("react/jsx-runtime");
186
+ function DialogProvider(props) {
187
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react4.Dialog.Root, { ...props });
188
+ }
189
+ function Dialog(props) {
190
+ const { size, ...contentProps } = props;
191
+ const styles = (0, import_recipes3.dialog)({ size });
192
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Portal, { children: [
193
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogBackdrop, { className: styles.backdrop }),
194
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogPositioner, { className: styles.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogContent, { className: styles.content, ...contentProps }) })
195
+ ] });
196
+ }
197
+ function DialogHeading(props) {
198
+ const styles = (0, import_recipes3.dialog)();
199
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react4.Dialog.Title, { ...props, className: (0, import_css3.cx)(props.className, styles.title) });
200
+ }
201
+ function DialogDescription(props) {
202
+ const styles = (0, import_recipes3.dialog)();
203
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
204
+ import_react4.Dialog.Description,
205
+ {
206
+ ...props,
207
+ className: (0, import_css3.cx)(props.className, styles.description)
208
+ }
209
+ );
210
+ }
211
+ var DialogTrigger = import_react4.Dialog.Trigger;
212
+ var DialogCloseTrigger = import_react4.Dialog.CloseTrigger;
213
+ var DialogBackdrop = import_react4.Dialog.Backdrop;
214
+ var DialogPositioner = import_react4.Dialog.Positioner;
215
+ var DialogContent = import_react4.Dialog.Content;
216
+
217
+ // src/context/confirm-modal.tsx
218
+ var import_jsx_runtime5 = require("react/jsx-runtime");
435
219
  var ConfirmModalContext = (0, import_react5.createContext)(null);
436
220
  function ConfirmModal(props) {
437
- const { modalRef, show, close } = useModal();
438
- const resolveRef = (0, import_react5.useRef)(null);
221
+ const [open, setOpen] = (0, import_react5.useState)(false);
439
222
  const [content, setContent] = (0, import_react5.useState)(null);
440
- const focusTrap = trapFocus(modalRef);
441
- const ConfirmIcon = $cerberusIcons.confirmModal;
223
+ const resolveRef = (0, import_react5.useRef)(null);
442
224
  const kind = (content == null ? void 0 : content.kind) ?? "non-destructive";
225
+ const { icons } = useCerberusContext();
226
+ const { confirmModal: ConfirmIcon } = icons;
443
227
  const palette = (0, import_react5.useMemo)(
444
228
  () => kind === "destructive" ? "danger" : "action",
445
229
  [kind]
@@ -452,19 +236,19 @@ function ConfirmModal(props) {
452
236
  (_a = resolveRef.current) == null ? void 0 : _a.call(resolveRef, true);
453
237
  }
454
238
  (_b = resolveRef.current) == null ? void 0 : _b.call(resolveRef, false);
455
- close();
239
+ setOpen(false);
456
240
  },
457
- [close]
241
+ [setOpen]
458
242
  );
459
243
  const handleShow = (0, import_react5.useCallback)(
460
244
  (options) => {
461
245
  return new Promise((resolve) => {
462
246
  setContent({ ...options });
463
- show();
247
+ setOpen(true);
464
248
  resolveRef.current = resolve;
465
249
  });
466
250
  },
467
- [show]
251
+ [setOpen, setContent]
468
252
  );
469
253
  const value = (0, import_react5.useMemo)(
470
254
  () => ({
@@ -472,36 +256,36 @@ function ConfirmModal(props) {
472
256
  }),
473
257
  [handleShow]
474
258
  );
475
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ConfirmModalContext.Provider, { value, children: [
259
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(ConfirmModalContext.Provider, { value, children: [
476
260
  props.children,
477
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx.VStack, { gap: "xl", w: "full", children: [
478
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalHeader, { children: [
479
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
480
- "div",
261
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogProvider, { open, onOpenChange: (e) => setOpen(e.open), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx.VStack, { gap: "xl", w: "full", children: [
262
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx.VStack, { alignItems: "flex-start", gap: "md", w: "full", children: [
263
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
264
+ import_jsx.HStack,
481
265
  {
482
- className: (0, import_patterns3.hstack)({
483
- justify: "center",
484
- w: "full"
485
- }),
486
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
266
+ alignSelf: "center",
267
+ justify: "center",
268
+ paddingBlockEnd: "md",
269
+ w: "full",
270
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
487
271
  Show,
488
272
  {
489
273
  when: palette === "danger",
490
- fallback: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
274
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
491
275
  Avatar,
492
276
  {
493
277
  ariaLabel: "",
494
278
  gradient: "charon-light",
495
- icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ConfirmIcon, { size: 24 }),
279
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ConfirmIcon, { size: 24 }),
496
280
  src: ""
497
281
  }
498
282
  ),
499
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
283
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
500
284
  Avatar,
501
285
  {
502
286
  ariaLabel: "",
503
287
  gradient: "hades-dark",
504
- icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ConfirmIcon, { size: 24 }),
288
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ConfirmIcon, { size: 24 }),
505
289
  src: ""
506
290
  }
507
291
  )
@@ -509,15 +293,15 @@ function ConfirmModal(props) {
509
293
  )
510
294
  }
511
295
  ),
512
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
513
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
296
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogHeading, { children: content == null ? void 0 : content.heading }),
297
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogDescription, { children: content == null ? void 0 : content.description })
514
298
  ] }),
515
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx.HStack, { gap: "4", w: "full", children: [
516
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
299
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx.HStack, { gap: "4", w: "full", children: [
300
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
517
301
  Button,
518
302
  {
519
303
  autoFocus: true,
520
- className: (0, import_css7.css)({
304
+ className: (0, import_css4.css)({
521
305
  w: "1/2"
522
306
  }),
523
307
  name: "confirm",
@@ -527,10 +311,10 @@ function ConfirmModal(props) {
527
311
  children: content == null ? void 0 : content.actionText
528
312
  }
529
313
  ),
530
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
314
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogCloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
531
315
  Button,
532
316
  {
533
- className: (0, import_css7.css)({
317
+ className: (0, import_css4.css)({
534
318
  w: "1/2"
535
319
  }),
536
320
  name: "cancel",
@@ -539,7 +323,7 @@ function ConfirmModal(props) {
539
323
  value: "false",
540
324
  children: content == null ? void 0 : content.cancelText
541
325
  }
542
- )
326
+ ) })
543
327
  ] })
544
328
  ] }) }) })
545
329
  ] });