@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.
- package/build/legacy/_tsup-dts-rollup.d.cts +374 -80
- package/build/legacy/components/Accordion.cjs +4 -187
- package/build/legacy/components/Accordion.cjs.map +1 -1
- package/build/legacy/components/Accordion.client.cjs +64 -0
- package/build/legacy/components/Accordion.client.cjs.map +1 -0
- package/build/legacy/components/AccordionItemGroup.cjs +41 -185
- package/build/legacy/components/AccordionItemGroup.cjs.map +1 -1
- package/build/legacy/components/Admonition.cjs +89 -239
- package/build/legacy/components/Admonition.cjs.map +1 -1
- package/build/legacy/components/Admonition.client.cjs +219 -0
- package/build/legacy/components/Admonition.client.cjs.map +1 -0
- package/build/legacy/components/AnimatingUploadIcon.cjs.map +1 -1
- package/build/legacy/components/Avatar.cjs +23 -174
- package/build/legacy/components/Avatar.cjs.map +1 -1
- package/build/legacy/components/Checkbox.cjs +22 -168
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/DatePicker.client.cjs +129 -272
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/components/DatePicker.server.cjs +17 -271
- package/build/legacy/components/DatePicker.server.cjs.map +1 -1
- package/build/legacy/components/Dialog.cjs +86 -0
- package/build/legacy/components/Dialog.cjs.map +1 -0
- package/build/legacy/components/Dialog.client.cjs +95 -0
- package/build/legacy/components/Dialog.client.cjs.map +1 -0
- package/build/legacy/components/FileStatus.cjs +62 -212
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs +29 -180
- package/build/legacy/components/FileUploader.cjs.map +1 -1
- package/build/legacy/components/Input.cjs +20 -172
- package/build/legacy/components/Input.cjs.map +1 -1
- package/build/legacy/components/Modal.cjs.map +1 -1
- package/build/legacy/components/ModalDescription.cjs.map +1 -1
- package/build/legacy/components/ModalHeader.cjs.map +1 -1
- package/build/legacy/components/ModalHeading.cjs.map +1 -1
- package/build/legacy/components/Notification.cjs +26 -176
- package/build/legacy/components/Notification.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +26 -178
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Tag.cjs +16 -167
- package/build/legacy/components/Tag.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs +20 -172
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/config/defineIcons.cjs +3 -39
- package/build/legacy/config/defineIcons.cjs.map +1 -1
- package/build/legacy/config/{cerbIcons.cjs → index.cjs} +22 -29
- package/build/legacy/config/index.cjs.map +1 -0
- package/build/legacy/config/types.cjs +19 -0
- package/build/legacy/config/types.cjs.map +1 -0
- package/build/legacy/context/cerberus.cjs +46 -0
- package/build/legacy/context/cerberus.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +105 -321
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +137 -336
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/notification-center/store.cjs +66 -0
- package/build/legacy/context/notification-center/store.cjs.map +1 -0
- package/build/legacy/context/notification-center/types.cjs +19 -0
- package/build/legacy/context/notification-center/types.cjs.map +1 -0
- package/build/legacy/context/notification-center.cjs +142 -249
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +185 -388
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +1577 -1456
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +374 -80
- package/build/modern/{chunk-BVCXVZAF.js → chunk-25HMVHLT.js} +6 -5
- package/build/modern/chunk-25HMVHLT.js.map +1 -0
- package/build/modern/chunk-36N4527B.js +1 -0
- package/build/modern/chunk-5EWCH7AI.js +82 -0
- package/build/modern/chunk-5EWCH7AI.js.map +1 -0
- package/build/modern/chunk-5SNLQZYP.js +25 -0
- package/build/modern/chunk-5SNLQZYP.js.map +1 -0
- package/build/modern/chunk-6BN3XKQF.js +42 -0
- package/build/modern/chunk-6BN3XKQF.js.map +1 -0
- package/build/modern/{chunk-2UXE5PDG.js → chunk-7NN3SJ7W.js} +1 -1
- package/build/modern/chunk-7NN3SJ7W.js.map +1 -0
- package/build/modern/{chunk-KWJ5FKX7.js → chunk-BAWZBF5Q.js} +5 -3
- package/build/modern/chunk-BAWZBF5Q.js.map +1 -0
- package/build/modern/{chunk-6BH5J5GF.js → chunk-BHB56M7S.js} +31 -46
- package/build/modern/chunk-BHB56M7S.js.map +1 -0
- package/build/modern/{chunk-HKJMLWVP.js → chunk-EDARV2EI.js} +5 -4
- package/build/modern/chunk-EDARV2EI.js.map +1 -0
- package/build/modern/{chunk-5OVH3INN.js → chunk-FGCO27TC.js} +25 -53
- package/build/modern/chunk-FGCO27TC.js.map +1 -0
- package/build/modern/{chunk-PVIMOXSO.js → chunk-GCQMH4QA.js} +5 -4
- package/build/modern/chunk-GCQMH4QA.js.map +1 -0
- package/build/modern/chunk-GITT5645.js +20 -0
- package/build/modern/chunk-GITT5645.js.map +1 -0
- package/build/modern/{chunk-TJCFYL5W.js → chunk-IGHMP4WA.js} +1 -20
- package/build/modern/chunk-IGHMP4WA.js.map +1 -0
- package/build/modern/chunk-ISCJ542I.js +82 -0
- package/build/modern/chunk-ISCJ542I.js.map +1 -0
- package/build/modern/{chunk-HVKM54BA.js → chunk-IW3LIRDG.js} +1 -1
- package/build/modern/chunk-IW3LIRDG.js.map +1 -0
- package/build/modern/chunk-JAROS4Q3.js +180 -0
- package/build/modern/chunk-JAROS4Q3.js.map +1 -0
- package/build/modern/{chunk-BE4EOU2P.js → chunk-JIRW4XOJ.js} +1 -1
- package/build/modern/chunk-JIRW4XOJ.js.map +1 -0
- package/build/modern/chunk-KDDPAJMR.js +9 -0
- package/build/modern/chunk-KDDPAJMR.js.map +1 -0
- package/build/modern/{chunk-XOROL3JY.js → chunk-KKHL3ZO4.js} +5 -4
- package/build/modern/chunk-KKHL3ZO4.js.map +1 -0
- package/build/modern/{chunk-U36UZJGZ.js → chunk-MZ3UCDUL.js} +5 -4
- package/build/modern/chunk-MZ3UCDUL.js.map +1 -0
- package/build/modern/{chunk-T2JOPPGL.js → chunk-N24COMHJ.js} +11 -4
- package/build/modern/chunk-N24COMHJ.js.map +1 -0
- package/build/modern/chunk-NJSETNRL.js +68 -0
- package/build/modern/chunk-NJSETNRL.js.map +1 -0
- package/build/modern/{chunk-XY6WL55R.js → chunk-NUMM4TNC.js} +1 -1
- package/build/modern/chunk-NUMM4TNC.js.map +1 -0
- package/build/modern/{chunk-FXLLRVAM.js → chunk-O6LFWUHI.js} +8 -6
- package/build/modern/chunk-O6LFWUHI.js.map +1 -0
- package/build/modern/{chunk-JJZQGR7A.js → chunk-RDRD6ACD.js} +9 -6
- package/build/modern/chunk-RDRD6ACD.js.map +1 -0
- package/build/modern/{chunk-XXWR7UGH.js → chunk-SD3OVTHT.js} +75 -103
- package/build/modern/chunk-SD3OVTHT.js.map +1 -0
- package/build/modern/chunk-TFL56AYR.js +56 -0
- package/build/modern/chunk-TFL56AYR.js.map +1 -0
- package/build/modern/chunk-V3M3ZOQI.js +38 -0
- package/build/modern/chunk-V3M3ZOQI.js.map +1 -0
- package/build/modern/{chunk-QK7R2XJM.js → chunk-XQICKZH4.js} +6 -5
- package/build/modern/chunk-XQICKZH4.js.map +1 -0
- package/build/modern/chunk-XZGXRRSQ.js +31 -0
- package/build/modern/chunk-XZGXRRSQ.js.map +1 -0
- package/build/modern/{chunk-KPUYKHLW.js → chunk-YKKNWILF.js} +71 -15
- package/build/modern/chunk-YKKNWILF.js.map +1 -0
- package/build/modern/{chunk-Q7BRMIBR.js → chunk-ZL6ZITLA.js} +1 -1
- package/build/modern/chunk-ZL6ZITLA.js.map +1 -0
- package/build/modern/components/Accordion.client.js +9 -0
- package/build/modern/components/Accordion.client.js.map +1 -0
- package/build/modern/components/Accordion.js +1 -7
- package/build/modern/components/AccordionItemGroup.js +4 -6
- package/build/modern/components/Admonition.client.js +11 -0
- package/build/modern/components/Admonition.client.js.map +1 -0
- package/build/modern/components/Admonition.js +4 -6
- package/build/modern/components/AnimatingUploadIcon.js +1 -1
- package/build/modern/components/Avatar.js +3 -5
- package/build/modern/components/Checkbox.js +2 -5
- package/build/modern/components/DatePicker.client.js +8 -7
- package/build/modern/components/DatePicker.server.js +3 -13
- package/build/modern/components/Dialog.client.js +10 -0
- package/build/modern/components/Dialog.client.js.map +1 -0
- package/build/modern/components/Dialog.js +24 -0
- package/build/modern/components/Dialog.js.map +1 -0
- package/build/modern/components/FileStatus.js +3 -6
- package/build/modern/components/FileUploader.js +3 -6
- package/build/modern/components/Input.js +2 -5
- package/build/modern/components/Modal.js +1 -1
- package/build/modern/components/ModalDescription.js +1 -1
- package/build/modern/components/ModalHeader.js +1 -1
- package/build/modern/components/ModalHeading.js +1 -1
- package/build/modern/components/Notification.js +2 -5
- package/build/modern/components/Select.js +2 -5
- package/build/modern/components/Tag.js +3 -5
- package/build/modern/components/Toggle.js +2 -5
- package/build/modern/config/defineIcons.js +2 -5
- package/build/modern/config/index.js +14 -0
- package/build/modern/config/index.js.map +1 -0
- package/build/modern/config/types.js +2 -0
- package/build/modern/config/types.js.map +1 -0
- package/build/modern/context/cerberus.js +10 -0
- package/build/modern/context/cerberus.js.map +1 -0
- package/build/modern/context/confirm-modal.js +5 -13
- package/build/modern/context/cta-modal.js +7 -14
- package/build/modern/context/notification-center/store.js +15 -0
- package/build/modern/context/notification-center/store.js.map +1 -0
- package/build/modern/context/notification-center/types.js +1 -0
- package/build/modern/context/notification-center/types.js.map +1 -0
- package/build/modern/context/notification-center.js +5 -7
- package/build/modern/context/prompt-modal.js +8 -15
- package/build/modern/index.js +111 -75
- package/build/modern/index.js.map +1 -1
- package/package.json +4 -8
- package/src/components/Accordion.client.tsx +46 -0
- package/src/components/Accordion.tsx +0 -37
- package/src/components/AccordionItemGroup.tsx +1 -1
- package/src/components/Admonition.client.tsx +73 -0
- package/src/components/Admonition.tsx +1 -70
- package/src/components/AnimatingUploadIcon.tsx +3 -3
- package/src/components/Avatar.tsx +5 -2
- package/src/components/Checkbox.tsx +10 -3
- package/src/components/DatePicker.client.tsx +111 -15
- package/src/components/DatePicker.server.tsx +2 -75
- package/src/components/Dialog.client.tsx +39 -0
- package/src/components/Dialog.tsx +165 -0
- package/src/components/FileStatus.tsx +5 -3
- package/src/components/FileUploader.tsx +3 -2
- package/src/components/Input.tsx +4 -2
- package/src/components/Modal.tsx +1 -16
- package/src/components/ModalDescription.tsx +1 -8
- package/src/components/ModalHeader.tsx +1 -10
- package/src/components/ModalHeading.tsx +1 -8
- package/src/components/Notification.tsx +9 -4
- package/src/components/Select.tsx +5 -2
- package/src/components/Tag.tsx +5 -2
- package/src/components/Toggle.tsx +4 -3
- package/src/config/defineIcons.ts +28 -16
- package/src/config/index.ts +28 -0
- package/src/config/types.ts +42 -0
- package/src/context/cerberus.tsx +44 -0
- package/src/context/confirm-modal.tsx +44 -42
- package/src/context/cta-modal.tsx +25 -38
- package/src/context/notification-center/store.ts +88 -0
- package/src/context/notification-center/types.ts +28 -0
- package/src/context/notification-center.tsx +81 -46
- package/src/context/prompt-modal.tsx +101 -103
- package/src/index.ts +15 -8
- package/build/legacy/config/cerbIcons.cjs.map +0 -1
- package/build/modern/chunk-2UXE5PDG.js.map +0 -1
- package/build/modern/chunk-5OVH3INN.js.map +0 -1
- package/build/modern/chunk-6BH5J5GF.js.map +0 -1
- package/build/modern/chunk-BC5SZDYY.js +0 -132
- package/build/modern/chunk-BC5SZDYY.js.map +0 -1
- package/build/modern/chunk-BE4EOU2P.js.map +0 -1
- package/build/modern/chunk-BVCXVZAF.js.map +0 -1
- package/build/modern/chunk-CRII2HNX.js +0 -55
- package/build/modern/chunk-CRII2HNX.js.map +0 -1
- package/build/modern/chunk-CVTON5DQ.js +0 -162
- package/build/modern/chunk-CVTON5DQ.js.map +0 -1
- package/build/modern/chunk-FXLLRVAM.js.map +0 -1
- package/build/modern/chunk-HKJMLWVP.js.map +0 -1
- package/build/modern/chunk-HVKM54BA.js.map +0 -1
- package/build/modern/chunk-JJZQGR7A.js.map +0 -1
- package/build/modern/chunk-KPUYKHLW.js.map +0 -1
- package/build/modern/chunk-KWJ5FKX7.js.map +0 -1
- package/build/modern/chunk-PVIMOXSO.js.map +0 -1
- package/build/modern/chunk-Q7BRMIBR.js.map +0 -1
- package/build/modern/chunk-QK7R2XJM.js.map +0 -1
- package/build/modern/chunk-QMF5ZNDG.js +0 -27
- package/build/modern/chunk-QMF5ZNDG.js.map +0 -1
- package/build/modern/chunk-QQOWWMZ3.js +0 -138
- package/build/modern/chunk-QQOWWMZ3.js.map +0 -1
- package/build/modern/chunk-T2JOPPGL.js.map +0 -1
- package/build/modern/chunk-TJCFYL5W.js.map +0 -1
- package/build/modern/chunk-U36UZJGZ.js.map +0 -1
- package/build/modern/chunk-XOROL3JY.js.map +0 -1
- package/build/modern/chunk-XXWR7UGH.js.map +0 -1
- package/build/modern/chunk-XY6WL55R.js.map +0 -1
- package/build/modern/config/cerbIcons.js +0 -9
- package/src/config/cerbIcons.ts +0 -73
- /package/build/modern/{config/cerbIcons.js.map → chunk-36N4527B.js.map} +0 -0
|
@@ -27,10 +27,6 @@ __export(prompt_modal_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(prompt_modal_exports);
|
|
28
28
|
var import_react6 = 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,45 +50,19 @@ function Button(props) {
|
|
|
54
50
|
}
|
|
55
51
|
|
|
56
52
|
// src/context/prompt-modal.tsx
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
// src/aria-helpers/trap-focus.aria.ts
|
|
61
|
-
function trapFocus(modalRef) {
|
|
62
|
-
var _a;
|
|
63
|
-
const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
64
|
-
const focusable = Array.from(
|
|
65
|
-
((_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(focusableElements)) ?? []
|
|
66
|
-
);
|
|
67
|
-
const firstFocusable = focusable[0];
|
|
68
|
-
const lastFocusable = focusable[focusable.length - 1];
|
|
69
|
-
return function handleKeyDown(event) {
|
|
70
|
-
if (event.key === "Tab") {
|
|
71
|
-
if (event.shiftKey) {
|
|
72
|
-
if (document.activeElement === firstFocusable) {
|
|
73
|
-
lastFocusable.focus();
|
|
74
|
-
event.preventDefault();
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
if (document.activeElement === lastFocusable) {
|
|
78
|
-
firstFocusable.focus();
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
53
|
+
var import_css6 = require("@cerberus/styled-system/css");
|
|
54
|
+
var import_patterns3 = require("@cerberus/styled-system/patterns");
|
|
85
55
|
|
|
86
56
|
// src/components/Input.tsx
|
|
87
57
|
var import_recipes2 = require("@cerberus/styled-system/recipes");
|
|
88
58
|
var import_css2 = require("@cerberus/styled-system/css");
|
|
89
59
|
|
|
90
60
|
// src/context/field.tsx
|
|
91
|
-
var
|
|
61
|
+
var import_react = require("react");
|
|
92
62
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
93
|
-
var FieldContext = (0,
|
|
63
|
+
var FieldContext = (0, import_react.createContext)(null);
|
|
94
64
|
function Field(props) {
|
|
95
|
-
const value = (0,
|
|
65
|
+
const value = (0, import_react.useMemo)(
|
|
96
66
|
() => ({
|
|
97
67
|
disabled: props.disabled,
|
|
98
68
|
readOnly: props.readOnly,
|
|
@@ -104,178 +74,25 @@ function Field(props) {
|
|
|
104
74
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldContext.Provider, { value, children: props.children });
|
|
105
75
|
}
|
|
106
76
|
function useFieldContext() {
|
|
107
|
-
const context = (0,
|
|
77
|
+
const context = (0, import_react.useContext)(FieldContext);
|
|
108
78
|
if (!context) {
|
|
109
79
|
throw new Error("useFieldContext must be used within a Field Provider.");
|
|
110
80
|
}
|
|
111
81
|
return context;
|
|
112
82
|
}
|
|
113
83
|
|
|
114
|
-
// src/
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
// src/config/icons/checkbox.icons.tsx
|
|
84
|
+
// src/context/cerberus.tsx
|
|
85
|
+
var import_react2 = require("react");
|
|
118
86
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
role: "img",
|
|
127
|
-
viewBox: "0 0 24 24",
|
|
128
|
-
...props,
|
|
129
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
130
|
-
"path",
|
|
131
|
-
{
|
|
132
|
-
fill: "currentColor",
|
|
133
|
-
d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
function IndeterminateIcon(props) {
|
|
140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
141
|
-
"svg",
|
|
142
|
-
{
|
|
143
|
-
"aria-hidden": "true",
|
|
144
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
145
|
-
role: "img",
|
|
146
|
-
fill: "none",
|
|
147
|
-
viewBox: "0 0 24 24",
|
|
148
|
-
...props,
|
|
149
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// src/components/AnimatingUploadIcon.tsx
|
|
155
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
156
|
-
function AnimatingUploadIcon(props) {
|
|
157
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
158
|
-
"svg",
|
|
159
|
-
{
|
|
160
|
-
"aria-hidden": "true",
|
|
161
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
162
|
-
width: props.size ?? "1em",
|
|
163
|
-
height: props.size ?? "1em",
|
|
164
|
-
viewBox: "0 0 24 24",
|
|
165
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
166
|
-
"g",
|
|
167
|
-
{
|
|
168
|
-
fill: "none",
|
|
169
|
-
stroke: "currentColor",
|
|
170
|
-
strokeLinecap: "square",
|
|
171
|
-
strokeLinejoin: "round",
|
|
172
|
-
strokeWidth: 1.5,
|
|
173
|
-
children: [
|
|
174
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
175
|
-
"path",
|
|
176
|
-
{
|
|
177
|
-
"data-name": "animating-trail",
|
|
178
|
-
strokeDasharray: "2 4",
|
|
179
|
-
strokeDashoffset: 6,
|
|
180
|
-
d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
|
|
181
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
182
|
-
"animate",
|
|
183
|
-
{
|
|
184
|
-
attributeName: "stroke-dashoffset",
|
|
185
|
-
dur: "0.45s",
|
|
186
|
-
repeatCount: "indefinite",
|
|
187
|
-
values: "6;0"
|
|
188
|
-
}
|
|
189
|
-
)
|
|
190
|
-
}
|
|
191
|
-
),
|
|
192
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
193
|
-
"path",
|
|
194
|
-
{
|
|
195
|
-
"data-name": "half-circle",
|
|
196
|
-
strokeDasharray: 32,
|
|
197
|
-
strokeDashoffset: 32,
|
|
198
|
-
d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
|
|
199
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
200
|
-
"animate",
|
|
201
|
-
{
|
|
202
|
-
fill: "freeze",
|
|
203
|
-
attributeName: "stroke-dashoffset",
|
|
204
|
-
begin: "0.075s",
|
|
205
|
-
dur: "0.3s",
|
|
206
|
-
values: "32;0"
|
|
207
|
-
}
|
|
208
|
-
)
|
|
209
|
-
}
|
|
210
|
-
),
|
|
211
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
212
|
-
"svg",
|
|
213
|
-
{
|
|
214
|
-
"aria-hidden": "true",
|
|
215
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
216
|
-
width: "0.8em",
|
|
217
|
-
height: "0.8em",
|
|
218
|
-
x: "27%",
|
|
219
|
-
y: "27%",
|
|
220
|
-
viewBox: "0 0 24 24",
|
|
221
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
222
|
-
"polygon",
|
|
223
|
-
{
|
|
224
|
-
fill: "currentColor",
|
|
225
|
-
stroke: "currentColor",
|
|
226
|
-
strokeWidth: 0.8,
|
|
227
|
-
opacity: "1",
|
|
228
|
-
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 ",
|
|
229
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
230
|
-
"animate",
|
|
231
|
-
{
|
|
232
|
-
fill: "freeze",
|
|
233
|
-
attributeName: "opacity",
|
|
234
|
-
values: "1;0;1",
|
|
235
|
-
dur: "2s",
|
|
236
|
-
repeatCount: "indefinite"
|
|
237
|
-
}
|
|
238
|
-
)
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
)
|
|
243
|
-
]
|
|
244
|
-
}
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
);
|
|
87
|
+
var CerberusContext = (0, import_react2.createContext)(null);
|
|
88
|
+
function useCerberusContext() {
|
|
89
|
+
const context = (0, import_react2.useContext)(CerberusContext);
|
|
90
|
+
if (!context) {
|
|
91
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
92
|
+
}
|
|
93
|
+
return context;
|
|
248
94
|
}
|
|
249
95
|
|
|
250
|
-
// src/config/cerbIcons.ts
|
|
251
|
-
var defaultIcons = {
|
|
252
|
-
accordionIndicator: import_icons.ChevronDown,
|
|
253
|
-
avatar: import_icons.UserFilled,
|
|
254
|
-
calendar: import_icons.Calendar,
|
|
255
|
-
calendarPrev: import_icons.ChevronLeft,
|
|
256
|
-
calendarNext: import_icons.ChevronRight,
|
|
257
|
-
checkbox: CheckmarkIcon,
|
|
258
|
-
close: import_icons.Close,
|
|
259
|
-
confirmModal: import_icons.Information,
|
|
260
|
-
delete: import_icons.TrashCan,
|
|
261
|
-
promptModal: import_icons.Information,
|
|
262
|
-
waitingFileUploader: import_icons.CloudUpload,
|
|
263
|
-
fileUploader: AnimatingUploadIcon,
|
|
264
|
-
indeterminate: IndeterminateIcon,
|
|
265
|
-
infoNotification: import_icons.Information,
|
|
266
|
-
successNotification: import_icons.CheckmarkOutline,
|
|
267
|
-
warningNotification: import_icons.WarningAlt,
|
|
268
|
-
dangerNotification: import_icons.WarningFilled,
|
|
269
|
-
invalid: import_icons.WarningFilled,
|
|
270
|
-
invalidAlt: import_icons.Warning,
|
|
271
|
-
redo: import_icons.Restart,
|
|
272
|
-
selectArrow: import_icons.ChevronDown,
|
|
273
|
-
toggleChecked: import_icons.Checkmark
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
// src/config/defineIcons.ts
|
|
277
|
-
var $cerberusIcons = defaultIcons;
|
|
278
|
-
|
|
279
96
|
// src/components/Show.tsx
|
|
280
97
|
var import_react3 = require("react");
|
|
281
98
|
function Show(props) {
|
|
@@ -288,16 +105,17 @@ function Show(props) {
|
|
|
288
105
|
}
|
|
289
106
|
|
|
290
107
|
// src/components/Input.tsx
|
|
291
|
-
var
|
|
108
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
292
109
|
function Input(props) {
|
|
293
110
|
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props;
|
|
294
111
|
const inputStyles = (0, import_recipes2.input)({ size });
|
|
295
112
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
296
113
|
const hasEndIcon = Boolean(endIcon);
|
|
297
|
-
const {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
/* @__PURE__ */ (0,
|
|
114
|
+
const { icons } = useCerberusContext();
|
|
115
|
+
const { invalid: InvalidIcon } = icons;
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: inputStyles.root, children: [
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: Boolean(startIcon), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: inputStyles.startIcon, children: startIcon }) }),
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
301
119
|
"input",
|
|
302
120
|
{
|
|
303
121
|
...nativeProps,
|
|
@@ -308,8 +126,8 @@ function Input(props) {
|
|
|
308
126
|
className: (0, import_css2.cx)("peer", nativeProps.className, inputStyles.input)
|
|
309
127
|
}
|
|
310
128
|
),
|
|
311
|
-
/* @__PURE__ */ (0,
|
|
312
|
-
/* @__PURE__ */ (0,
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InvalidIcon, { className: inputStyles.icon }) }),
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: hasEndIcon && !invalid, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: inputStyles.icon, children: endIcon }) })
|
|
313
131
|
] });
|
|
314
132
|
}
|
|
315
133
|
|
|
@@ -317,12 +135,12 @@ function Input(props) {
|
|
|
317
135
|
var import_recipes3 = require("@cerberus/styled-system/recipes");
|
|
318
136
|
var import_css3 = require("@cerberus/styled-system/css");
|
|
319
137
|
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
320
|
-
var
|
|
138
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
321
139
|
function Label(props) {
|
|
322
140
|
const { hidden, size, ...nativeProps } = props;
|
|
323
141
|
const { required, disabled } = useFieldContext();
|
|
324
142
|
const usage = hidden ? "hidden" : "visible";
|
|
325
|
-
return /* @__PURE__ */ (0,
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
326
144
|
"label",
|
|
327
145
|
{
|
|
328
146
|
...nativeProps,
|
|
@@ -337,7 +155,7 @@ function Label(props) {
|
|
|
337
155
|
),
|
|
338
156
|
children: [
|
|
339
157
|
props.children,
|
|
340
|
-
/* @__PURE__ */ (0,
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Show, { when: required, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
341
159
|
"span",
|
|
342
160
|
{
|
|
343
161
|
className: (0, import_css3.css)({
|
|
@@ -352,90 +170,11 @@ function Label(props) {
|
|
|
352
170
|
);
|
|
353
171
|
}
|
|
354
172
|
|
|
355
|
-
// src/
|
|
356
|
-
var import_react4 = require("react");
|
|
357
|
-
function useModal() {
|
|
358
|
-
const modalRef = (0, import_react4.useRef)(null);
|
|
359
|
-
const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
|
|
360
|
-
const show = (0, import_react4.useCallback)(() => {
|
|
361
|
-
var _a;
|
|
362
|
-
(_a = modalRef.current) == null ? void 0 : _a.showModal();
|
|
363
|
-
setIsOpen(true);
|
|
364
|
-
}, []);
|
|
365
|
-
const close = (0, import_react4.useCallback)(() => {
|
|
366
|
-
var _a;
|
|
367
|
-
(_a = modalRef.current) == null ? void 0 : _a.close();
|
|
368
|
-
setIsOpen(false);
|
|
369
|
-
}, []);
|
|
370
|
-
return (0, import_react4.useMemo)(() => {
|
|
371
|
-
return {
|
|
372
|
-
modalRef,
|
|
373
|
-
show,
|
|
374
|
-
close,
|
|
375
|
-
isOpen
|
|
376
|
-
};
|
|
377
|
-
}, [modalRef, show, close, isOpen]);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// src/components/Modal.tsx
|
|
173
|
+
// src/components/Avatar.tsx
|
|
381
174
|
var import_css4 = require("@cerberus/styled-system/css");
|
|
382
|
-
var import_recipes4 = require("@cerberus/styled-system/recipes");
|
|
383
|
-
var import_react5 = require("react");
|
|
384
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
385
|
-
function ModalEl(props, ref) {
|
|
386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
387
|
-
"dialog",
|
|
388
|
-
{
|
|
389
|
-
...props,
|
|
390
|
-
className: (0, import_css4.cx)(props.className, (0, import_recipes4.modal)().dialog),
|
|
391
|
-
ref
|
|
392
|
-
}
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
var Modal = (0, import_react5.forwardRef)(ModalEl);
|
|
396
|
-
|
|
397
|
-
// src/components/ModalHeader.tsx
|
|
398
|
-
var import_css5 = require("@cerberus/styled-system/css");
|
|
399
175
|
var import_patterns2 = require("@cerberus/styled-system/patterns");
|
|
400
|
-
var
|
|
401
|
-
|
|
402
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
403
|
-
"div",
|
|
404
|
-
{
|
|
405
|
-
...props,
|
|
406
|
-
className: (0, import_css5.cx)(
|
|
407
|
-
props.className,
|
|
408
|
-
(0, import_patterns2.vstack)({
|
|
409
|
-
alignItems: "flex-start",
|
|
410
|
-
gap: "md",
|
|
411
|
-
position: "relative"
|
|
412
|
-
})
|
|
413
|
-
)
|
|
414
|
-
}
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
// src/components/ModalHeading.tsx
|
|
419
|
-
var import_css6 = require("@cerberus/styled-system/css");
|
|
420
|
-
var import_recipes5 = require("@cerberus/styled-system/recipes");
|
|
421
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
422
|
-
function ModalHeading(props) {
|
|
423
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { ...props, className: (0, import_css6.cx)(props.className, (0, import_recipes5.modal)().heading) });
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// src/components/ModalDescription.tsx
|
|
427
|
-
var import_css7 = require("@cerberus/styled-system/css");
|
|
428
|
-
var import_recipes6 = require("@cerberus/styled-system/recipes");
|
|
429
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
430
|
-
function ModalDescription(props) {
|
|
431
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { ...props, className: (0, import_css7.cx)(props.className, (0, import_recipes6.modal)().description) });
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// src/components/Avatar.tsx
|
|
435
|
-
var import_css8 = require("@cerberus/styled-system/css");
|
|
436
|
-
var import_patterns3 = require("@cerberus/styled-system/patterns");
|
|
437
|
-
var import_recipes7 = require("@cerberus/styled-system/recipes");
|
|
438
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
176
|
+
var import_recipes4 = require("@cerberus/styled-system/recipes");
|
|
177
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
439
178
|
function Avatar(props) {
|
|
440
179
|
const {
|
|
441
180
|
ariaLabel,
|
|
@@ -448,30 +187,31 @@ function Avatar(props) {
|
|
|
448
187
|
icon,
|
|
449
188
|
...nativeProps
|
|
450
189
|
} = props;
|
|
451
|
-
const {
|
|
190
|
+
const { icons } = useCerberusContext();
|
|
191
|
+
const { avatar: AvatarIcon } = icons;
|
|
452
192
|
const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
|
|
453
|
-
return /* @__PURE__ */ (0,
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
454
194
|
"div",
|
|
455
195
|
{
|
|
456
196
|
...nativeProps,
|
|
457
|
-
className: (0,
|
|
197
|
+
className: (0, import_css4.cx)(
|
|
458
198
|
nativeProps.className,
|
|
459
|
-
(0,
|
|
460
|
-
(0,
|
|
199
|
+
(0, import_recipes4.avatar)({ gradient, size }),
|
|
200
|
+
(0, import_patterns2.circle)()
|
|
461
201
|
),
|
|
462
|
-
children: /* @__PURE__ */ (0,
|
|
202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
463
203
|
Show,
|
|
464
204
|
{
|
|
465
205
|
when: Boolean(src) || Boolean(as),
|
|
466
|
-
fallback: /* @__PURE__ */ (0,
|
|
206
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
467
207
|
Show,
|
|
468
208
|
{
|
|
469
209
|
when: Boolean(initials),
|
|
470
|
-
fallback: /* @__PURE__ */ (0,
|
|
210
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
471
211
|
Show,
|
|
472
212
|
{
|
|
473
213
|
when: Boolean(icon),
|
|
474
|
-
fallback: /* @__PURE__ */ (0,
|
|
214
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
475
215
|
AvatarIcon,
|
|
476
216
|
{
|
|
477
217
|
size: iconSizeMap[size]
|
|
@@ -483,15 +223,15 @@ function Avatar(props) {
|
|
|
483
223
|
children: initials
|
|
484
224
|
}
|
|
485
225
|
),
|
|
486
|
-
children: /* @__PURE__ */ (0,
|
|
226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
487
227
|
Show,
|
|
488
228
|
{
|
|
489
229
|
when: Boolean(as),
|
|
490
|
-
fallback: /* @__PURE__ */ (0,
|
|
230
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
491
231
|
"img",
|
|
492
232
|
{
|
|
493
233
|
alt: props.ariaLabel,
|
|
494
|
-
className: (0,
|
|
234
|
+
className: (0, import_css4.css)({
|
|
495
235
|
h: "full",
|
|
496
236
|
objectFit: "cover",
|
|
497
237
|
w: "full"
|
|
@@ -522,16 +262,91 @@ var iconSizeMap = {
|
|
|
522
262
|
"4xl": 32
|
|
523
263
|
};
|
|
524
264
|
|
|
265
|
+
// src/components/Text.tsx
|
|
266
|
+
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
267
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
268
|
+
function Text(props) {
|
|
269
|
+
const { as = "p", ...pandaJSXProps } = props;
|
|
270
|
+
switch (as) {
|
|
271
|
+
case "h1":
|
|
272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.H1, { ...pandaJSXProps });
|
|
273
|
+
case "h2":
|
|
274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.H2, { ...pandaJSXProps });
|
|
275
|
+
case "h3":
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.H3, { ...pandaJSXProps });
|
|
277
|
+
case "h4":
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.H4, { ...pandaJSXProps });
|
|
279
|
+
case "h5":
|
|
280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.H5, { ...pandaJSXProps });
|
|
281
|
+
case "h6":
|
|
282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.H6, { ...pandaJSXProps });
|
|
283
|
+
case "strong":
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.Strong, { ...pandaJSXProps });
|
|
285
|
+
case "em":
|
|
286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.Em, { ...pandaJSXProps });
|
|
287
|
+
case "small":
|
|
288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.Small, { ...pandaJSXProps });
|
|
289
|
+
case "span":
|
|
290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.Span, { ...pandaJSXProps });
|
|
291
|
+
default:
|
|
292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx.P, { ...pandaJSXProps });
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/components/Dialog.tsx
|
|
297
|
+
var import_react5 = require("@ark-ui/react");
|
|
298
|
+
var import_recipes5 = require("@cerberus/styled-system/recipes");
|
|
299
|
+
|
|
300
|
+
// src/components/Portal.tsx
|
|
301
|
+
var import_react4 = require("@ark-ui/react");
|
|
302
|
+
var Portal = import_react4.Portal;
|
|
303
|
+
|
|
304
|
+
// src/components/Dialog.tsx
|
|
305
|
+
var import_css5 = require("@cerberus/styled-system/css");
|
|
306
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
307
|
+
function DialogProvider(props) {
|
|
308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.Dialog.Root, { ...props });
|
|
309
|
+
}
|
|
310
|
+
function Dialog(props) {
|
|
311
|
+
const { size, ...contentProps } = props;
|
|
312
|
+
const styles = (0, import_recipes5.dialog)({ size });
|
|
313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Portal, { children: [
|
|
314
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogBackdrop, { className: styles.backdrop }),
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogPositioner, { className: styles.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogContent, { className: styles.content, ...contentProps }) })
|
|
316
|
+
] });
|
|
317
|
+
}
|
|
318
|
+
function DialogHeading(props) {
|
|
319
|
+
const styles = (0, import_recipes5.dialog)();
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.Dialog.Title, { ...props, className: (0, import_css5.cx)(props.className, styles.title) });
|
|
321
|
+
}
|
|
322
|
+
function DialogDescription(props) {
|
|
323
|
+
const styles = (0, import_recipes5.dialog)();
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
325
|
+
import_react5.Dialog.Description,
|
|
326
|
+
{
|
|
327
|
+
...props,
|
|
328
|
+
className: (0, import_css5.cx)(props.className, styles.description)
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
var DialogTrigger = import_react5.Dialog.Trigger;
|
|
333
|
+
var DialogCloseTrigger = import_react5.Dialog.CloseTrigger;
|
|
334
|
+
var DialogBackdrop = import_react5.Dialog.Backdrop;
|
|
335
|
+
var DialogPositioner = import_react5.Dialog.Positioner;
|
|
336
|
+
var DialogContent = import_react5.Dialog.Content;
|
|
337
|
+
|
|
525
338
|
// src/context/prompt-modal.tsx
|
|
526
|
-
var
|
|
339
|
+
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
340
|
+
var import_react7 = require("@ark-ui/react");
|
|
341
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
527
342
|
var PromptModalContext = (0, import_react6.createContext)(null);
|
|
528
343
|
function PromptModal(props) {
|
|
529
|
-
const { modalRef, show, close } = useModal();
|
|
530
344
|
const resolveRef = (0, import_react6.useRef)(null);
|
|
345
|
+
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
531
346
|
const [content, setContent] = (0, import_react6.useState)(null);
|
|
532
347
|
const [inputValue, setInputValue] = (0, import_react6.useState)("");
|
|
533
|
-
const
|
|
534
|
-
const PromptIcon =
|
|
348
|
+
const { icons } = useCerberusContext();
|
|
349
|
+
const { promptModal: PromptIcon } = icons;
|
|
535
350
|
const isValid = (0, import_react6.useMemo)(
|
|
536
351
|
() => inputValue === (content == null ? void 0 : content.key),
|
|
537
352
|
[inputValue, content]
|
|
@@ -553,19 +368,19 @@ function PromptModal(props) {
|
|
|
553
368
|
if (target.value === "true") {
|
|
554
369
|
(_a = resolveRef.current) == null ? void 0 : _a.call(resolveRef, inputValue);
|
|
555
370
|
}
|
|
556
|
-
|
|
371
|
+
setOpen(false);
|
|
557
372
|
},
|
|
558
|
-
[inputValue,
|
|
373
|
+
[inputValue, setOpen]
|
|
559
374
|
);
|
|
560
375
|
const handleShow = (0, import_react6.useCallback)(
|
|
561
376
|
(options) => {
|
|
562
377
|
return new Promise((resolve) => {
|
|
563
378
|
setContent({ ...options, kind: options.kind || "non-destructive" });
|
|
564
|
-
|
|
379
|
+
setOpen(true);
|
|
565
380
|
resolveRef.current = resolve;
|
|
566
381
|
});
|
|
567
382
|
},
|
|
568
|
-
[
|
|
383
|
+
[setOpen]
|
|
569
384
|
);
|
|
570
385
|
const value = (0, import_react6.useMemo)(
|
|
571
386
|
() => ({
|
|
@@ -573,36 +388,36 @@ function PromptModal(props) {
|
|
|
573
388
|
}),
|
|
574
389
|
[handleShow]
|
|
575
390
|
);
|
|
576
|
-
return /* @__PURE__ */ (0,
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(PromptModalContext.Provider, { value, children: [
|
|
577
392
|
props.children,
|
|
578
|
-
/* @__PURE__ */ (0,
|
|
579
|
-
/* @__PURE__ */ (0,
|
|
580
|
-
/* @__PURE__ */ (0,
|
|
581
|
-
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogProvider, { open, onOpenChange: (e) => setOpen(e.open), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx2.VStack, { gap: "xl", w: "full", children: [
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx2.VStack, { alignItems: "flex-start", gap: "md", w: "full", children: [
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
396
|
+
import_jsx2.HStack,
|
|
582
397
|
{
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
children: /* @__PURE__ */ (0,
|
|
398
|
+
alignSelf: "center",
|
|
399
|
+
justify: "center",
|
|
400
|
+
paddingBlockEnd: "md",
|
|
401
|
+
w: "full",
|
|
402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
588
403
|
Show,
|
|
589
404
|
{
|
|
590
405
|
when: palette === "danger",
|
|
591
|
-
fallback: /* @__PURE__ */ (0,
|
|
406
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
592
407
|
Avatar,
|
|
593
408
|
{
|
|
594
409
|
ariaLabel: "",
|
|
595
410
|
gradient: "charon-light",
|
|
596
|
-
icon: /* @__PURE__ */ (0,
|
|
411
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PromptIcon, { size: 24 }),
|
|
597
412
|
src: ""
|
|
598
413
|
}
|
|
599
414
|
),
|
|
600
|
-
children: /* @__PURE__ */ (0,
|
|
415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
601
416
|
Avatar,
|
|
602
417
|
{
|
|
603
418
|
ariaLabel: "",
|
|
604
419
|
gradient: "hades-dark",
|
|
605
|
-
icon: /* @__PURE__ */ (0,
|
|
420
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PromptIcon, { size: 24 }),
|
|
606
421
|
src: ""
|
|
607
422
|
}
|
|
608
423
|
)
|
|
@@ -610,43 +425,34 @@ function PromptModal(props) {
|
|
|
610
425
|
)
|
|
611
426
|
}
|
|
612
427
|
),
|
|
613
|
-
/* @__PURE__ */ (0,
|
|
614
|
-
/* @__PURE__ */ (0,
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogHeading, { children: content == null ? void 0 : content.heading }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogDescription, { children: content == null ? void 0 : content.description })
|
|
615
430
|
] }),
|
|
616
|
-
/* @__PURE__ */ (0,
|
|
617
|
-
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
432
|
+
import_jsx2.VStack,
|
|
618
433
|
{
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
434
|
+
alignItems: "flex-start",
|
|
435
|
+
marginBlockStart: "md",
|
|
436
|
+
marginBlockEnd: "lg",
|
|
437
|
+
w: "full",
|
|
438
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Field, { invalid: !isValid, children: [
|
|
439
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
626
440
|
Label,
|
|
627
441
|
{
|
|
628
|
-
className: (0,
|
|
629
|
-
gap:
|
|
630
|
-
|
|
442
|
+
className: (0, import_patterns3.hstack)({
|
|
443
|
+
gap: "xs",
|
|
444
|
+
justify: "flex-start !important"
|
|
631
445
|
}),
|
|
632
446
|
htmlFor: "confirm",
|
|
633
447
|
size: "md",
|
|
634
448
|
children: [
|
|
635
449
|
"Type",
|
|
636
|
-
/* @__PURE__ */ (0,
|
|
637
|
-
"strong",
|
|
638
|
-
{
|
|
639
|
-
className: (0, import_css9.css)({
|
|
640
|
-
textTransform: "uppercase"
|
|
641
|
-
}),
|
|
642
|
-
children: content == null ? void 0 : content.key
|
|
643
|
-
}
|
|
644
|
-
),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { as: "strong", textTransform: "uppercase", children: content == null ? void 0 : content.key }),
|
|
645
451
|
"to confirm"
|
|
646
452
|
]
|
|
647
453
|
}
|
|
648
454
|
),
|
|
649
|
-
/* @__PURE__ */ (0,
|
|
455
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
650
456
|
Input,
|
|
651
457
|
{
|
|
652
458
|
id: "confirm",
|
|
@@ -658,46 +464,37 @@ function PromptModal(props) {
|
|
|
658
464
|
] })
|
|
659
465
|
}
|
|
660
466
|
),
|
|
661
|
-
/* @__PURE__ */ (0,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
usage: "outlined",
|
|
693
|
-
value: "false",
|
|
694
|
-
children: content == null ? void 0 : content.cancelText
|
|
695
|
-
}
|
|
696
|
-
)
|
|
697
|
-
]
|
|
698
|
-
}
|
|
699
|
-
)
|
|
700
|
-
] }) })
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx2.HStack, { gap: "md", justify: "stretch", w: "full", children: [
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
469
|
+
Button,
|
|
470
|
+
{
|
|
471
|
+
autoFocus: true,
|
|
472
|
+
className: (0, import_css6.css)({
|
|
473
|
+
w: "1/2"
|
|
474
|
+
}),
|
|
475
|
+
disabled: !isValid,
|
|
476
|
+
name: "confirm",
|
|
477
|
+
onClick: handleChoice,
|
|
478
|
+
palette,
|
|
479
|
+
value: "true",
|
|
480
|
+
children: content == null ? void 0 : content.actionText
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react7.DialogCloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
484
|
+
Button,
|
|
485
|
+
{
|
|
486
|
+
className: (0, import_css6.css)({
|
|
487
|
+
w: "1/2"
|
|
488
|
+
}),
|
|
489
|
+
name: "cancel",
|
|
490
|
+
onClick: handleChoice,
|
|
491
|
+
usage: "outlined",
|
|
492
|
+
value: "false",
|
|
493
|
+
children: content == null ? void 0 : content.cancelText
|
|
494
|
+
}
|
|
495
|
+
) })
|
|
496
|
+
] })
|
|
497
|
+
] }) }) })
|
|
701
498
|
] });
|
|
702
499
|
}
|
|
703
500
|
function usePromptModal() {
|