@cerberus-design/react 0.15.0-next-e0ce56e → 0.15.0-next-5d7dc1e
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 +491 -119
- package/build/legacy/components/DatePicker.client.cjs +67 -89
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/components/Fieldset.cjs +4 -17
- package/build/legacy/components/Fieldset.cjs.map +1 -1
- package/build/legacy/components/FieldsetLabel.cjs.map +1 -1
- package/build/legacy/components/FileStatus.cjs +126 -79
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/Legend.cjs +10 -22
- package/build/legacy/components/Legend.cjs.map +1 -1
- package/build/legacy/components/Radio.cjs +4 -21
- package/build/legacy/components/Radio.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +19 -54
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs +17 -24
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/components/button/button.cjs +1 -1
- package/build/legacy/components/button/button.cjs.map +1 -1
- package/build/legacy/components/button/index.cjs +1 -1
- package/build/legacy/components/button/index.cjs.map +1 -1
- package/build/legacy/components/button/parts.cjs +1 -1
- package/build/legacy/components/button/parts.cjs.map +1 -1
- package/build/legacy/components/checkbox/checkbox-icon.cjs +121 -0
- package/build/legacy/components/checkbox/checkbox-icon.cjs.map +1 -0
- package/build/legacy/components/checkbox/checkbox.cjs +165 -0
- package/build/legacy/components/checkbox/checkbox.cjs.map +1 -0
- package/build/legacy/components/checkbox/index.cjs +179 -0
- package/build/legacy/components/checkbox/index.cjs.map +1 -0
- package/build/legacy/components/checkbox/parts.cjs +89 -0
- package/build/legacy/components/checkbox/parts.cjs.map +1 -0
- package/build/legacy/components/checkbox/primitives.cjs +87 -0
- package/build/legacy/components/checkbox/primitives.cjs.map +1 -0
- package/build/legacy/components/{FieldMessage.cjs → deprecated/FieldMessage.cjs} +4 -17
- package/build/legacy/components/deprecated/FieldMessage.cjs.map +1 -0
- package/build/legacy/components/{Textarea.cjs → deprecated/Label.cjs} +24 -36
- package/build/legacy/components/deprecated/Label.cjs.map +1 -0
- package/build/legacy/components/field/field.cjs +130 -0
- package/build/legacy/components/field/field.cjs.map +1 -0
- package/build/legacy/components/field/index.cjs +267 -0
- package/build/legacy/components/field/index.cjs.map +1 -0
- package/build/legacy/components/field/parts.cjs +188 -0
- package/build/legacy/components/field/parts.cjs.map +1 -0
- package/build/legacy/components/field/primitives.cjs +191 -0
- package/build/legacy/components/field/primitives.cjs.map +1 -0
- package/build/legacy/components/field/start-indicator.cjs +45 -0
- package/build/legacy/components/field/start-indicator.cjs.map +1 -0
- package/build/legacy/components/field/status-indicator.cjs +78 -0
- package/build/legacy/components/field/status-indicator.cjs.map +1 -0
- package/build/legacy/components/for.cjs +38 -0
- package/build/legacy/components/for.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +1 -1
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +1 -1
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/field.cjs +23 -4
- package/build/legacy/context/field.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +168 -166
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs.map +1 -1
- package/build/legacy/index.cjs +1274 -1123
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/utils/index.cjs +22 -2
- package/build/legacy/utils/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +491 -119
- package/build/modern/{chunk-2JX27W6Y.js → chunk-2BIHLH4V.js} +2 -2
- package/build/modern/chunk-2BIHLH4V.js.map +1 -0
- package/build/modern/{chunk-3ZDFQO25.js → chunk-6EUC3SUI.js} +4 -7
- package/build/modern/chunk-6EUC3SUI.js.map +1 -0
- package/build/modern/chunk-6I2FW4WI.js +33 -0
- package/build/modern/chunk-6I2FW4WI.js.map +1 -0
- package/build/modern/{chunk-MER66QUY.js → chunk-6KZVE4HC.js} +1 -1
- package/build/modern/{chunk-MER66QUY.js.map → chunk-6KZVE4HC.js.map} +1 -1
- package/build/modern/{chunk-FTPZHG6J.js → chunk-6WOJAMZV.js} +3 -9
- package/build/modern/chunk-6WOJAMZV.js.map +1 -0
- package/build/modern/chunk-77FJSNGD.js +13 -0
- package/build/modern/chunk-77FJSNGD.js.map +1 -0
- package/build/modern/chunk-BL7G3577.js +29 -0
- package/build/modern/chunk-BL7G3577.js.map +1 -0
- package/build/modern/chunk-BPRF34DU.js +62 -0
- package/build/modern/chunk-BPRF34DU.js.map +1 -0
- package/build/modern/{chunk-7P7OWBGV.js → chunk-CF3EHG42.js} +10 -10
- package/build/modern/chunk-CF3EHG42.js.map +1 -0
- package/build/modern/{chunk-Q4IV5NUT.js → chunk-CMYD5KWA.js} +40 -43
- package/build/modern/chunk-CMYD5KWA.js.map +1 -0
- package/build/modern/chunk-CNA2VKAH.js +43 -0
- package/build/modern/chunk-CNA2VKAH.js.map +1 -0
- package/build/modern/chunk-EL4MX2PG.js +22 -0
- package/build/modern/chunk-EL4MX2PG.js.map +1 -0
- package/build/modern/chunk-FBS7AX76.js +37 -0
- package/build/modern/chunk-FBS7AX76.js.map +1 -0
- package/build/modern/{chunk-KU2AWAK3.js → chunk-FK52US7K.js} +7 -20
- package/build/modern/chunk-FK52US7K.js.map +1 -0
- package/build/modern/{chunk-Z7FGXAND.js → chunk-FMRWRVUS.js} +2 -2
- package/build/modern/{chunk-XQICKZH4.js → chunk-GENS32QO.js} +10 -8
- package/build/modern/chunk-GENS32QO.js.map +1 -0
- package/build/modern/{chunk-7S47NSGR.js → chunk-H54FR7IP.js} +2 -2
- package/build/modern/chunk-KWZ3CEG6.js +23 -0
- package/build/modern/chunk-KWZ3CEG6.js.map +1 -0
- package/build/modern/{chunk-JWIJHSI6.js → chunk-L7N24B6B.js} +3 -6
- package/build/modern/chunk-L7N24B6B.js.map +1 -0
- package/build/modern/chunk-LT62577B.js +23 -0
- package/build/modern/chunk-LT62577B.js.map +1 -0
- package/build/modern/{chunk-3BM6MZ4A.js → chunk-MWRO5QYD.js} +1 -1
- package/build/modern/chunk-MWRO5QYD.js.map +1 -0
- package/build/modern/{chunk-PZAZKQMO.js → chunk-OYT7RGC7.js} +1 -1
- package/build/modern/chunk-OYT7RGC7.js.map +1 -0
- package/build/modern/{chunk-ILQW5VZT.js → chunk-RBNOEAWJ.js} +4 -7
- package/build/modern/chunk-RBNOEAWJ.js.map +1 -0
- package/build/modern/{chunk-5QONP7GT.js → chunk-S2X5OEPK.js} +2 -10
- package/build/modern/chunk-S2X5OEPK.js.map +1 -0
- package/build/modern/chunk-TIJAFPHQ.js +1 -0
- package/build/modern/chunk-TYPULJMJ.js +1 -0
- package/build/modern/chunk-UNN4LHRS.js +31 -0
- package/build/modern/chunk-UNN4LHRS.js.map +1 -0
- package/build/modern/chunk-VSTOSLFS.js +100 -0
- package/build/modern/chunk-VSTOSLFS.js.map +1 -0
- package/build/modern/chunk-Z52R6ABJ.js +21 -0
- package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
- package/build/modern/{chunk-3RGRHMJQ.js → chunk-ZDANBCM3.js} +2 -2
- package/build/modern/components/AccordionItemGroup.js +1 -1
- package/build/modern/components/DatePicker.client.js +4 -5
- package/build/modern/components/Fieldset.js +1 -2
- package/build/modern/components/FieldsetLabel.js +1 -1
- package/build/modern/components/FileStatus.js +10 -4
- package/build/modern/components/Legend.js +1 -2
- package/build/modern/components/Radio.js +1 -3
- package/build/modern/components/Select.js +1 -2
- package/build/modern/components/Toggle.js +1 -2
- package/build/modern/components/button/button.js +1 -1
- package/build/modern/components/button/index.js +2 -2
- package/build/modern/components/button/parts.js +2 -2
- package/build/modern/components/checkbox/checkbox-icon.js +12 -0
- package/build/modern/components/checkbox/checkbox.js +13 -0
- package/build/modern/components/checkbox/index.js +30 -0
- package/build/modern/components/checkbox/parts.js +8 -0
- package/build/modern/components/checkbox/parts.js.map +1 -0
- package/build/modern/components/checkbox/primitives.js +17 -0
- package/build/modern/components/checkbox/primitives.js.map +1 -0
- package/build/modern/components/deprecated/FieldMessage.js +8 -0
- package/build/modern/components/deprecated/FieldMessage.js.map +1 -0
- package/build/modern/components/deprecated/Label.js +17 -0
- package/build/modern/components/deprecated/Label.js.map +1 -0
- package/build/modern/components/field/field.js +14 -0
- package/build/modern/components/field/field.js.map +1 -0
- package/build/modern/components/field/index.js +44 -0
- package/build/modern/components/field/index.js.map +1 -0
- package/build/modern/components/field/parts.js +11 -0
- package/build/modern/components/field/parts.js.map +1 -0
- package/build/modern/components/field/primitives.js +26 -0
- package/build/modern/components/field/primitives.js.map +1 -0
- package/build/modern/components/field/start-indicator.js +7 -0
- package/build/modern/components/field/start-indicator.js.map +1 -0
- package/build/modern/components/field/status-indicator.js +9 -0
- package/build/modern/components/field/status-indicator.js.map +1 -0
- package/build/modern/components/for.js +7 -0
- package/build/modern/components/for.js.map +1 -0
- package/build/modern/context/confirm-modal.js +3 -3
- package/build/modern/context/cta-modal.js +4 -4
- package/build/modern/context/field.js +34 -4
- package/build/modern/context/field.js.map +1 -1
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +12 -7
- package/build/modern/hooks/useDate.js +1 -1
- package/build/modern/index.js +131 -82
- package/build/modern/index.js.map +1 -1
- package/build/modern/utils/index.js +5 -3
- package/package.json +2 -2
- package/src/components/DatePicker.client.tsx +2 -14
- package/src/components/Fieldset.tsx +3 -3
- package/src/components/FieldsetLabel.tsx +5 -2
- package/src/components/FileStatus.tsx +4 -5
- package/src/components/Legend.tsx +5 -6
- package/src/components/Radio.tsx +2 -7
- package/src/components/Select.tsx +1 -16
- package/src/components/Toggle.tsx +14 -7
- package/src/components/button/button.tsx +1 -1
- package/src/components/button/parts.ts +6 -0
- package/src/components/checkbox/checkbox-icon.tsx +39 -0
- package/src/components/checkbox/checkbox.tsx +48 -0
- package/src/components/checkbox/index.ts +3 -0
- package/src/components/checkbox/parts.ts +59 -0
- package/src/components/checkbox/primitives.tsx +104 -0
- package/src/components/{FieldMessage.tsx → deprecated/FieldMessage.tsx} +2 -13
- package/src/components/deprecated/Label.tsx +24 -0
- package/src/components/field/field.tsx +77 -0
- package/src/components/field/index.ts +5 -0
- package/src/components/field/parts.ts +77 -0
- package/src/components/field/primitives.tsx +204 -0
- package/src/components/field/start-indicator.tsx +23 -0
- package/src/components/field/status-indicator.tsx +58 -0
- package/src/components/for.tsx +43 -0
- package/src/context/field.tsx +6 -5
- package/src/context/prompt-modal.tsx +16 -18
- package/src/hooks/useDate.ts +1 -7
- package/src/index.ts +6 -7
- package/src/utils/index.ts +30 -0
- package/build/legacy/components/Checkbox.cjs +0 -113
- package/build/legacy/components/Checkbox.cjs.map +0 -1
- package/build/legacy/components/FieldMessage.cjs.map +0 -1
- package/build/legacy/components/Input.cjs +0 -95
- package/build/legacy/components/Input.cjs.map +0 -1
- package/build/legacy/components/Label.cjs +0 -93
- package/build/legacy/components/Label.cjs.map +0 -1
- package/build/legacy/components/Textarea.cjs.map +0 -1
- package/build/modern/chunk-2JX27W6Y.js.map +0 -1
- package/build/modern/chunk-3BM6MZ4A.js.map +0 -1
- package/build/modern/chunk-3ZDFQO25.js.map +0 -1
- package/build/modern/chunk-5QONP7GT.js.map +0 -1
- package/build/modern/chunk-7P7OWBGV.js.map +0 -1
- package/build/modern/chunk-C5EHJUS5.js +0 -10
- package/build/modern/chunk-C5EHJUS5.js.map +0 -1
- package/build/modern/chunk-FTPZHG6J.js.map +0 -1
- package/build/modern/chunk-ILQW5VZT.js.map +0 -1
- package/build/modern/chunk-JIJM6JFJ.js +0 -36
- package/build/modern/chunk-JIJM6JFJ.js.map +0 -1
- package/build/modern/chunk-JWIJHSI6.js.map +0 -1
- package/build/modern/chunk-KU2AWAK3.js.map +0 -1
- package/build/modern/chunk-NGOLRISW.js +0 -63
- package/build/modern/chunk-NGOLRISW.js.map +0 -1
- package/build/modern/chunk-NMF2HYWO.js +0 -50
- package/build/modern/chunk-NMF2HYWO.js.map +0 -1
- package/build/modern/chunk-PZAZKQMO.js.map +0 -1
- package/build/modern/chunk-Q4IV5NUT.js.map +0 -1
- package/build/modern/chunk-UZDVOIW5.js +0 -33
- package/build/modern/chunk-UZDVOIW5.js.map +0 -1
- package/build/modern/chunk-VYCU7I4J.js +0 -43
- package/build/modern/chunk-VYCU7I4J.js.map +0 -1
- package/build/modern/chunk-XQICKZH4.js.map +0 -1
- package/build/modern/components/Checkbox.js +0 -11
- package/build/modern/components/FieldMessage.js +0 -9
- package/build/modern/components/Input.js +0 -11
- package/build/modern/components/Label.js +0 -10
- package/build/modern/components/Textarea.js +0 -9
- package/src/components/Checkbox.tsx +0 -93
- package/src/components/Input.tsx +0 -69
- package/src/components/Label.tsx +0 -69
- package/src/components/Textarea.tsx +0 -52
- /package/build/modern/{chunk-Z7FGXAND.js.map → chunk-FMRWRVUS.js.map} +0 -0
- /package/build/modern/{chunk-7S47NSGR.js.map → chunk-H54FR7IP.js.map} +0 -0
- /package/build/modern/{components/Checkbox.js.map → chunk-TIJAFPHQ.js.map} +0 -0
- /package/build/modern/{components/FieldMessage.js.map → chunk-TYPULJMJ.js.map} +0 -0
- /package/build/modern/{chunk-3RGRHMJQ.js.map → chunk-ZDANBCM3.js.map} +0 -0
- /package/build/modern/components/{Input.js.map → checkbox/checkbox-icon.js.map} +0 -0
- /package/build/modern/components/{Label.js.map → checkbox/checkbox.js.map} +0 -0
- /package/build/modern/components/{Textarea.js.map → checkbox/index.js.map} +0 -0
|
@@ -26,40 +26,153 @@ __export(prompt_modal_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(prompt_modal_exports);
|
|
28
28
|
var import_react7 = require("react");
|
|
29
|
+
var import_react8 = require("@ark-ui/react");
|
|
30
|
+
var import_jsx3 = require("@cerberus/styled-system/jsx");
|
|
31
|
+
var import_css7 = require("@cerberus/styled-system/css");
|
|
32
|
+
var import_patterns2 = require("@cerberus/styled-system/patterns");
|
|
29
33
|
|
|
30
|
-
// src/components/
|
|
31
|
-
var
|
|
34
|
+
// src/components/field/primitives.tsx
|
|
35
|
+
var import_field = require("@ark-ui/react/field");
|
|
36
|
+
var import_css3 = require("@cerberus/styled-system/css");
|
|
37
|
+
var import_recipes3 = require("@cerberus/styled-system/recipes");
|
|
38
|
+
|
|
39
|
+
// src/components/field/status-indicator.tsx
|
|
40
|
+
var import_react2 = require("@ark-ui/react");
|
|
32
41
|
var import_css = require("@cerberus/styled-system/css");
|
|
33
42
|
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
34
43
|
|
|
35
|
-
// src/
|
|
44
|
+
// src/context/cerberus.tsx
|
|
36
45
|
var import_react = require("react");
|
|
46
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
|
+
var CerberusContext = (0, import_react.createContext)(null);
|
|
48
|
+
function useCerberusContext() {
|
|
49
|
+
const context = (0, import_react.useContext)(CerberusContext);
|
|
50
|
+
if (!context) {
|
|
51
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
52
|
+
}
|
|
53
|
+
return context;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/components/field/status-indicator.tsx
|
|
57
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
58
|
+
function FieldStatusIndicator(props) {
|
|
59
|
+
const { fallback, ...nativeProps } = props;
|
|
60
|
+
const styles = (0, import_recipes.field)();
|
|
61
|
+
const fieldContext = (0, import_react2.useFieldContext)();
|
|
62
|
+
const { icons } = useCerberusContext();
|
|
63
|
+
const { invalid: InvalidIcon } = icons;
|
|
64
|
+
if (fieldContext.invalid) {
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
...nativeProps,
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
"data-invalid": true,
|
|
71
|
+
className: (0, import_css.cx)(nativeProps.className, styles.statusIndicator),
|
|
72
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(InvalidIcon, {})
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
77
|
+
"span",
|
|
78
|
+
{
|
|
79
|
+
...nativeProps,
|
|
80
|
+
"aria-hidden": "true",
|
|
81
|
+
"data-part": "end-indicator",
|
|
82
|
+
className: (0, import_css.cx)(nativeProps.className, styles.endIndicator),
|
|
83
|
+
children: fallback
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/components/field/start-indicator.tsx
|
|
89
|
+
var import_css2 = require("@cerberus/styled-system/css");
|
|
90
|
+
var import_recipes2 = require("@cerberus/styled-system/recipes");
|
|
91
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
92
|
+
function FieldStartIndicator(props) {
|
|
93
|
+
const styles = (0, import_recipes2.field)();
|
|
94
|
+
if (!props.children) return null;
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
...props,
|
|
99
|
+
"data-part": "start-indicator",
|
|
100
|
+
className: (0, import_css2.cx)(props.className, styles.startIndicator)
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/components/field/primitives.tsx
|
|
106
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
107
|
+
function FieldRoot(props) {
|
|
108
|
+
const { size, ...fieldProps } = props;
|
|
109
|
+
const styles = (0, import_recipes3.field)({ size });
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
111
|
+
import_field.Field.Root,
|
|
112
|
+
{
|
|
113
|
+
...fieldProps,
|
|
114
|
+
className: (0, import_css3.cx)(styles.root, fieldProps.className)
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function FieldLabel(props) {
|
|
119
|
+
const { children, ...nativeProps } = props;
|
|
120
|
+
const styles = (0, import_recipes3.field)();
|
|
121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_field.Field.Label, { ...nativeProps, className: (0, import_css3.cx)(styles.label, props.className), children: [
|
|
122
|
+
children,
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_field.Field.RequiredIndicator, { children: "(required)" })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
function FieldInput(props) {
|
|
127
|
+
const { size, startIcon, endIcon, ...fieldProps } = props;
|
|
128
|
+
const styles = (0, import_recipes3.field)({ size });
|
|
129
|
+
const hasStartIcon = Boolean(startIcon);
|
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.inputRoot, children: [
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldStartIndicator, { children: startIcon }),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
133
|
+
import_field.Field.Input,
|
|
134
|
+
{
|
|
135
|
+
...fieldProps,
|
|
136
|
+
...hasStartIcon && { "data-has": "start-indicator" },
|
|
137
|
+
className: (0, import_css3.cx)(styles.input, fieldProps.className)
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldStatusIndicator, { fallback: endIcon })
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
var Input = FieldInput;
|
|
144
|
+
|
|
145
|
+
// src/components/Show.tsx
|
|
146
|
+
var import_react3 = require("react");
|
|
37
147
|
function Show(props) {
|
|
38
148
|
const { when, children, fallback } = props;
|
|
39
|
-
const condition = (0,
|
|
40
|
-
return (0,
|
|
149
|
+
const condition = (0, import_react3.useMemo)(() => when ?? false, [when]);
|
|
150
|
+
return (0, import_react3.useMemo)(() => {
|
|
41
151
|
if (condition) return children;
|
|
42
152
|
return fallback ?? null;
|
|
43
153
|
}, [condition, children, fallback]);
|
|
44
154
|
}
|
|
45
155
|
|
|
46
156
|
// src/components/button/button.tsx
|
|
157
|
+
var import_react4 = require("react");
|
|
158
|
+
var import_css4 = require("@cerberus/styled-system/css");
|
|
159
|
+
var import_recipes4 = require("@cerberus/styled-system/recipes");
|
|
47
160
|
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
48
|
-
var
|
|
49
|
-
var ButtonContext = (0,
|
|
161
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
162
|
+
var ButtonContext = (0, import_react4.createContext)({
|
|
50
163
|
pending: false
|
|
51
164
|
});
|
|
52
165
|
function Button(props) {
|
|
53
166
|
const { palette, usage, shape, size, pending = false, ...nativeProps } = props;
|
|
54
|
-
const value = (0,
|
|
55
|
-
return /* @__PURE__ */ (0,
|
|
167
|
+
const value = (0, import_react4.useMemo)(() => ({ pending }), [pending]);
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ButtonContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
56
169
|
"button",
|
|
57
170
|
{
|
|
58
171
|
...nativeProps,
|
|
59
172
|
disabled: pending || nativeProps.disabled,
|
|
60
|
-
className: (0,
|
|
173
|
+
className: (0, import_css4.cx)(
|
|
61
174
|
nativeProps.className,
|
|
62
|
-
(0,
|
|
175
|
+
(0, import_recipes4.button)({
|
|
63
176
|
palette,
|
|
64
177
|
usage,
|
|
65
178
|
shape,
|
|
@@ -70,120 +183,10 @@ function Button(props) {
|
|
|
70
183
|
) });
|
|
71
184
|
}
|
|
72
185
|
|
|
73
|
-
// src/context/prompt-modal.tsx
|
|
74
|
-
var import_css6 = require("@cerberus/styled-system/css");
|
|
75
|
-
var import_patterns3 = require("@cerberus/styled-system/patterns");
|
|
76
|
-
|
|
77
|
-
// src/components/Input.tsx
|
|
78
|
-
var import_recipes2 = require("@cerberus/styled-system/recipes");
|
|
79
|
-
var import_css2 = require("@cerberus/styled-system/css");
|
|
80
|
-
|
|
81
|
-
// src/context/field.tsx
|
|
82
|
-
var import_react3 = require("react");
|
|
83
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
84
|
-
var FieldContext = (0, import_react3.createContext)(null);
|
|
85
|
-
function Field(props) {
|
|
86
|
-
const value = (0, import_react3.useMemo)(
|
|
87
|
-
() => ({
|
|
88
|
-
disabled: props.disabled,
|
|
89
|
-
readOnly: props.readOnly,
|
|
90
|
-
required: props.required,
|
|
91
|
-
invalid: props.invalid
|
|
92
|
-
}),
|
|
93
|
-
[props.disabled, props.readOnly, props.required, props.invalid]
|
|
94
|
-
);
|
|
95
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldContext.Provider, { value, children: props.children });
|
|
96
|
-
}
|
|
97
|
-
function useFieldContext() {
|
|
98
|
-
const context = (0, import_react3.useContext)(FieldContext);
|
|
99
|
-
if (!context) {
|
|
100
|
-
throw new Error("useFieldContext must be used within a Field Provider.");
|
|
101
|
-
}
|
|
102
|
-
return context;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// src/context/cerberus.tsx
|
|
106
|
-
var import_react4 = require("react");
|
|
107
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
108
|
-
var CerberusContext = (0, import_react4.createContext)(null);
|
|
109
|
-
function useCerberusContext() {
|
|
110
|
-
const context = (0, import_react4.useContext)(CerberusContext);
|
|
111
|
-
if (!context) {
|
|
112
|
-
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
113
|
-
}
|
|
114
|
-
return context;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// src/components/Input.tsx
|
|
118
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
119
|
-
function Input(props) {
|
|
120
|
-
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props;
|
|
121
|
-
const inputStyles = (0, import_recipes2.input)({ size });
|
|
122
|
-
const { invalid, ...fieldStates } = useFieldContext();
|
|
123
|
-
const hasEndIcon = Boolean(endIcon);
|
|
124
|
-
const { icons } = useCerberusContext();
|
|
125
|
-
const { invalid: InvalidIcon } = icons;
|
|
126
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: inputStyles.root, children: [
|
|
127
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: Boolean(startIcon), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: inputStyles.startIcon, children: startIcon }) }),
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
129
|
-
"input",
|
|
130
|
-
{
|
|
131
|
-
...nativeProps,
|
|
132
|
-
...fieldStates,
|
|
133
|
-
...describedBy && { "aria-describedby": describedBy },
|
|
134
|
-
...invalid && { "aria-invalid": true },
|
|
135
|
-
"data-start-icon": Boolean(startIcon),
|
|
136
|
-
className: (0, import_css2.cx)("peer", nativeProps.className, inputStyles.input)
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InvalidIcon, { className: inputStyles.icon }) }),
|
|
140
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: hasEndIcon && !invalid, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: inputStyles.icon, children: endIcon }) })
|
|
141
|
-
] });
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// src/components/Label.tsx
|
|
145
|
-
var import_recipes3 = require("@cerberus/styled-system/recipes");
|
|
146
|
-
var import_css3 = require("@cerberus/styled-system/css");
|
|
147
|
-
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
148
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
149
|
-
function Label(props) {
|
|
150
|
-
const { hidden, size, ...nativeProps } = props;
|
|
151
|
-
const { required, disabled } = useFieldContext();
|
|
152
|
-
const usage = hidden ? "hidden" : "visible";
|
|
153
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
154
|
-
"label",
|
|
155
|
-
{
|
|
156
|
-
...nativeProps,
|
|
157
|
-
...disabled && { "data-disabled": true },
|
|
158
|
-
className: (0, import_css3.cx)(
|
|
159
|
-
nativeProps.className,
|
|
160
|
-
(0, import_recipes3.label)({ size, usage }),
|
|
161
|
-
(0, import_patterns.hstack)({
|
|
162
|
-
justify: "space-between",
|
|
163
|
-
w: "full"
|
|
164
|
-
})
|
|
165
|
-
),
|
|
166
|
-
children: [
|
|
167
|
-
props.children,
|
|
168
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Show, { when: required, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
169
|
-
"span",
|
|
170
|
-
{
|
|
171
|
-
className: (0, import_css3.css)({
|
|
172
|
-
color: "page.text.100",
|
|
173
|
-
fontSize: "inherit"
|
|
174
|
-
}),
|
|
175
|
-
children: "(required)"
|
|
176
|
-
}
|
|
177
|
-
) })
|
|
178
|
-
]
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
186
|
// src/components/Avatar.tsx
|
|
184
|
-
var
|
|
185
|
-
var
|
|
186
|
-
var
|
|
187
|
+
var import_css5 = require("@cerberus/styled-system/css");
|
|
188
|
+
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
189
|
+
var import_recipes5 = require("@cerberus/styled-system/recipes");
|
|
187
190
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
188
191
|
function Avatar(props) {
|
|
189
192
|
const {
|
|
@@ -204,10 +207,10 @@ function Avatar(props) {
|
|
|
204
207
|
"div",
|
|
205
208
|
{
|
|
206
209
|
...nativeProps,
|
|
207
|
-
className: (0,
|
|
210
|
+
className: (0, import_css5.cx)(
|
|
208
211
|
nativeProps.className,
|
|
209
|
-
(0,
|
|
210
|
-
(0,
|
|
212
|
+
(0, import_recipes5.avatar)({ gradient, size }),
|
|
213
|
+
(0, import_patterns.circle)()
|
|
211
214
|
),
|
|
212
215
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
213
216
|
Show,
|
|
@@ -241,7 +244,7 @@ function Avatar(props) {
|
|
|
241
244
|
"img",
|
|
242
245
|
{
|
|
243
246
|
alt: props.ariaLabel,
|
|
244
|
-
className: (0,
|
|
247
|
+
className: (0, import_css5.css)({
|
|
245
248
|
h: "full",
|
|
246
249
|
objectFit: "cover",
|
|
247
250
|
w: "full"
|
|
@@ -305,37 +308,37 @@ function Text(props) {
|
|
|
305
308
|
|
|
306
309
|
// src/components/Dialog.tsx
|
|
307
310
|
var import_react6 = require("@ark-ui/react");
|
|
308
|
-
var
|
|
311
|
+
var import_recipes6 = require("@cerberus/styled-system/recipes");
|
|
309
312
|
|
|
310
313
|
// src/components/Portal.tsx
|
|
311
314
|
var import_react5 = require("@ark-ui/react");
|
|
312
315
|
var Portal = import_react5.Portal;
|
|
313
316
|
|
|
314
317
|
// src/components/Dialog.tsx
|
|
315
|
-
var
|
|
318
|
+
var import_css6 = require("@cerberus/styled-system/css");
|
|
316
319
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
317
320
|
function DialogProvider(props) {
|
|
318
321
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react6.Dialog.Root, { ...props });
|
|
319
322
|
}
|
|
320
323
|
function Dialog(props) {
|
|
321
324
|
const { size, ...contentProps } = props;
|
|
322
|
-
const styles = (0,
|
|
325
|
+
const styles = (0, import_recipes6.dialog)({ size });
|
|
323
326
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Portal, { children: [
|
|
324
327
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogBackdrop, { className: styles.backdrop }),
|
|
325
328
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogPositioner, { className: styles.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogContent, { className: styles.content, ...contentProps }) })
|
|
326
329
|
] });
|
|
327
330
|
}
|
|
328
331
|
function DialogHeading(props) {
|
|
329
|
-
const styles = (0,
|
|
330
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react6.Dialog.Title, { ...props, className: (0,
|
|
332
|
+
const styles = (0, import_recipes6.dialog)();
|
|
333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react6.Dialog.Title, { ...props, className: (0, import_css6.cx)(props.className, styles.title) });
|
|
331
334
|
}
|
|
332
335
|
function DialogDescription(props) {
|
|
333
|
-
const styles = (0,
|
|
336
|
+
const styles = (0, import_recipes6.dialog)();
|
|
334
337
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
335
338
|
import_react6.Dialog.Description,
|
|
336
339
|
{
|
|
337
340
|
...props,
|
|
338
|
-
className: (0,
|
|
341
|
+
className: (0, import_css6.cx)(props.className, styles.description)
|
|
339
342
|
}
|
|
340
343
|
);
|
|
341
344
|
}
|
|
@@ -346,8 +349,6 @@ var DialogPositioner = import_react6.Dialog.Positioner;
|
|
|
346
349
|
var DialogContent = import_react6.Dialog.Content;
|
|
347
350
|
|
|
348
351
|
// src/context/prompt-modal.tsx
|
|
349
|
-
var import_jsx3 = require("@cerberus/styled-system/jsx");
|
|
350
|
-
var import_react8 = require("@ark-ui/react");
|
|
351
352
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
352
353
|
var PromptModalContext = (0, import_react7.createContext)(null);
|
|
353
354
|
function PromptModal(props) {
|
|
@@ -445,33 +446,34 @@ function PromptModal(props) {
|
|
|
445
446
|
marginBlockStart: "md",
|
|
446
447
|
marginBlockEnd: "lg",
|
|
447
448
|
w: "full",
|
|
448
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
{
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
449
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
450
|
+
FieldRoot,
|
|
451
|
+
{
|
|
452
|
+
ids: {
|
|
453
|
+
control: "confirm"
|
|
454
|
+
},
|
|
455
|
+
invalid: !isValid,
|
|
456
|
+
children: [
|
|
457
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
458
|
+
FieldLabel,
|
|
459
|
+
{
|
|
460
|
+
className: (0, import_patterns2.hstack)({
|
|
461
|
+
gap: "xs",
|
|
462
|
+
justify: "flex-start !important",
|
|
463
|
+
marginBlockEnd: "xs",
|
|
464
|
+
textStyle: "label-md"
|
|
465
|
+
}),
|
|
466
|
+
children: [
|
|
467
|
+
"Type",
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { as: "strong", textTransform: "uppercase", children: content == null ? void 0 : content.key }),
|
|
469
|
+
"to confirm"
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Input, { name: "confirm", onChange: handleChange, type: "text" })
|
|
474
|
+
]
|
|
475
|
+
}
|
|
476
|
+
)
|
|
475
477
|
}
|
|
476
478
|
),
|
|
477
479
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx3.HStack, { gap: "md", justify: "stretch", w: "full", children: [
|
|
@@ -479,7 +481,7 @@ function PromptModal(props) {
|
|
|
479
481
|
Button,
|
|
480
482
|
{
|
|
481
483
|
autoFocus: true,
|
|
482
|
-
className: (0,
|
|
484
|
+
className: (0, import_css7.css)({
|
|
483
485
|
w: "1/2"
|
|
484
486
|
}),
|
|
485
487
|
disabled: !isValid,
|
|
@@ -493,7 +495,7 @@ function PromptModal(props) {
|
|
|
493
495
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react8.DialogCloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
494
496
|
Button,
|
|
495
497
|
{
|
|
496
|
-
className: (0,
|
|
498
|
+
className: (0, import_css7.css)({
|
|
497
499
|
w: "1/2"
|
|
498
500
|
}),
|
|
499
501
|
name: "cancel",
|