@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
|
@@ -25,7 +25,7 @@ __export(notification_center_exports, {
|
|
|
25
25
|
useNotificationCenter: () => useNotificationCenter
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(notification_center_exports);
|
|
28
|
-
var
|
|
28
|
+
var import_react5 = require("react");
|
|
29
29
|
|
|
30
30
|
// src/components/Show.tsx
|
|
31
31
|
var import_react = require("react");
|
|
@@ -68,172 +68,7 @@ function NotificationDescription(props) {
|
|
|
68
68
|
var import_css3 = require("@cerberus/styled-system/css");
|
|
69
69
|
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
70
70
|
var import_recipes3 = require("@cerberus/styled-system/recipes");
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
// src/config/cerbIcons.ts
|
|
74
|
-
var import_icons = require("@cerberus/icons");
|
|
75
|
-
|
|
76
|
-
// src/config/icons/checkbox.icons.tsx
|
|
77
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
78
|
-
function CheckmarkIcon(props) {
|
|
79
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
80
|
-
"svg",
|
|
81
|
-
{
|
|
82
|
-
"aria-hidden": "true",
|
|
83
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
84
|
-
fill: "none",
|
|
85
|
-
role: "img",
|
|
86
|
-
viewBox: "0 0 24 24",
|
|
87
|
-
...props,
|
|
88
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
89
|
-
"path",
|
|
90
|
-
{
|
|
91
|
-
fill: "currentColor",
|
|
92
|
-
d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
function IndeterminateIcon(props) {
|
|
99
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
100
|
-
"svg",
|
|
101
|
-
{
|
|
102
|
-
"aria-hidden": "true",
|
|
103
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
104
|
-
role: "img",
|
|
105
|
-
fill: "none",
|
|
106
|
-
viewBox: "0 0 24 24",
|
|
107
|
-
...props,
|
|
108
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// src/components/AnimatingUploadIcon.tsx
|
|
114
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
115
|
-
function AnimatingUploadIcon(props) {
|
|
116
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
117
|
-
"svg",
|
|
118
|
-
{
|
|
119
|
-
"aria-hidden": "true",
|
|
120
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
121
|
-
width: props.size ?? "1em",
|
|
122
|
-
height: props.size ?? "1em",
|
|
123
|
-
viewBox: "0 0 24 24",
|
|
124
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
125
|
-
"g",
|
|
126
|
-
{
|
|
127
|
-
fill: "none",
|
|
128
|
-
stroke: "currentColor",
|
|
129
|
-
strokeLinecap: "square",
|
|
130
|
-
strokeLinejoin: "round",
|
|
131
|
-
strokeWidth: 1.5,
|
|
132
|
-
children: [
|
|
133
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
134
|
-
"path",
|
|
135
|
-
{
|
|
136
|
-
"data-name": "animating-trail",
|
|
137
|
-
strokeDasharray: "2 4",
|
|
138
|
-
strokeDashoffset: 6,
|
|
139
|
-
d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
|
|
140
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
141
|
-
"animate",
|
|
142
|
-
{
|
|
143
|
-
attributeName: "stroke-dashoffset",
|
|
144
|
-
dur: "0.45s",
|
|
145
|
-
repeatCount: "indefinite",
|
|
146
|
-
values: "6;0"
|
|
147
|
-
}
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
152
|
-
"path",
|
|
153
|
-
{
|
|
154
|
-
"data-name": "half-circle",
|
|
155
|
-
strokeDasharray: 32,
|
|
156
|
-
strokeDashoffset: 32,
|
|
157
|
-
d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
|
|
158
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
159
|
-
"animate",
|
|
160
|
-
{
|
|
161
|
-
fill: "freeze",
|
|
162
|
-
attributeName: "stroke-dashoffset",
|
|
163
|
-
begin: "0.075s",
|
|
164
|
-
dur: "0.3s",
|
|
165
|
-
values: "32;0"
|
|
166
|
-
}
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
171
|
-
"svg",
|
|
172
|
-
{
|
|
173
|
-
"aria-hidden": "true",
|
|
174
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
175
|
-
width: "0.8em",
|
|
176
|
-
height: "0.8em",
|
|
177
|
-
x: "27%",
|
|
178
|
-
y: "27%",
|
|
179
|
-
viewBox: "0 0 24 24",
|
|
180
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
181
|
-
"polygon",
|
|
182
|
-
{
|
|
183
|
-
fill: "currentColor",
|
|
184
|
-
stroke: "currentColor",
|
|
185
|
-
strokeWidth: 0.8,
|
|
186
|
-
opacity: "1",
|
|
187
|
-
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 ",
|
|
188
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
189
|
-
"animate",
|
|
190
|
-
{
|
|
191
|
-
fill: "freeze",
|
|
192
|
-
attributeName: "opacity",
|
|
193
|
-
values: "1;0;1",
|
|
194
|
-
dur: "2s",
|
|
195
|
-
repeatCount: "indefinite"
|
|
196
|
-
}
|
|
197
|
-
)
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// src/config/cerbIcons.ts
|
|
210
|
-
var defaultIcons = {
|
|
211
|
-
accordionIndicator: import_icons.ChevronDown,
|
|
212
|
-
avatar: import_icons.UserFilled,
|
|
213
|
-
calendar: import_icons.Calendar,
|
|
214
|
-
calendarPrev: import_icons.ChevronLeft,
|
|
215
|
-
calendarNext: import_icons.ChevronRight,
|
|
216
|
-
checkbox: CheckmarkIcon,
|
|
217
|
-
close: import_icons.Close,
|
|
218
|
-
confirmModal: import_icons.Information,
|
|
219
|
-
delete: import_icons.TrashCan,
|
|
220
|
-
promptModal: import_icons.Information,
|
|
221
|
-
waitingFileUploader: import_icons.CloudUpload,
|
|
222
|
-
fileUploader: AnimatingUploadIcon,
|
|
223
|
-
indeterminate: IndeterminateIcon,
|
|
224
|
-
infoNotification: import_icons.Information,
|
|
225
|
-
successNotification: import_icons.CheckmarkOutline,
|
|
226
|
-
warningNotification: import_icons.WarningAlt,
|
|
227
|
-
dangerNotification: import_icons.WarningFilled,
|
|
228
|
-
invalid: import_icons.WarningFilled,
|
|
229
|
-
invalidAlt: import_icons.Warning,
|
|
230
|
-
redo: import_icons.Restart,
|
|
231
|
-
selectArrow: import_icons.ChevronDown,
|
|
232
|
-
toggleChecked: import_icons.Checkmark
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
// src/config/defineIcons.ts
|
|
236
|
-
var $cerberusIcons = defaultIcons;
|
|
71
|
+
var import_react3 = require("react");
|
|
237
72
|
|
|
238
73
|
// src/aria-helpers/trap-focus.aria.ts
|
|
239
74
|
function trapFocus(modalRef) {
|
|
@@ -261,24 +96,39 @@ function trapFocus(modalRef) {
|
|
|
261
96
|
};
|
|
262
97
|
}
|
|
263
98
|
|
|
99
|
+
// src/context/cerberus.tsx
|
|
100
|
+
var import_react2 = require("react");
|
|
101
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
102
|
+
var CerberusContext = (0, import_react2.createContext)(null);
|
|
103
|
+
function useCerberusContext() {
|
|
104
|
+
const context = (0, import_react2.useContext)(CerberusContext);
|
|
105
|
+
if (!context) {
|
|
106
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
107
|
+
}
|
|
108
|
+
return context;
|
|
109
|
+
}
|
|
110
|
+
|
|
264
111
|
// src/components/Notification.tsx
|
|
265
|
-
var
|
|
112
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
266
113
|
function MatchNotificationIcon(props) {
|
|
114
|
+
const { icons } = useCerberusContext();
|
|
267
115
|
const palette = props.palette || "info";
|
|
268
116
|
const key = `${palette}Notification`;
|
|
269
|
-
const Icon =
|
|
270
|
-
return /* @__PURE__ */ (0,
|
|
117
|
+
const Icon = icons[key];
|
|
118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, {});
|
|
271
119
|
}
|
|
272
120
|
function Notification(props) {
|
|
273
121
|
const { children, palette, onClose, ...nativeProps } = props;
|
|
274
|
-
const ref = (0,
|
|
122
|
+
const ref = (0, import_react3.useRef)(null);
|
|
275
123
|
const onKeyDown = trapFocus(ref);
|
|
276
124
|
const styles = (0, import_recipes3.notification)({ palette });
|
|
277
|
-
const {
|
|
278
|
-
|
|
125
|
+
const { icons } = useCerberusContext();
|
|
126
|
+
const { close: CloseIcon } = icons;
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
279
128
|
"dialog",
|
|
280
129
|
{
|
|
281
130
|
...nativeProps,
|
|
131
|
+
"data-placement": "left",
|
|
282
132
|
className: (0, import_css3.cx)(
|
|
283
133
|
nativeProps.className,
|
|
284
134
|
(0, import_patterns.hstack)({
|
|
@@ -290,8 +140,8 @@ function Notification(props) {
|
|
|
290
140
|
onKeyDown,
|
|
291
141
|
ref,
|
|
292
142
|
children: [
|
|
293
|
-
/* @__PURE__ */ (0,
|
|
294
|
-
/* @__PURE__ */ (0,
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MatchNotificationIcon, { palette }) }),
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
295
145
|
"div",
|
|
296
146
|
{
|
|
297
147
|
className: (0, import_patterns.vstack)({
|
|
@@ -302,14 +152,14 @@ function Notification(props) {
|
|
|
302
152
|
children
|
|
303
153
|
}
|
|
304
154
|
),
|
|
305
|
-
/* @__PURE__ */ (0,
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
306
156
|
"button",
|
|
307
157
|
{
|
|
308
158
|
"aria-label": "Close",
|
|
309
159
|
className: styles.close,
|
|
310
160
|
onClick: onClose,
|
|
311
161
|
value: props.id,
|
|
312
|
-
children: /* @__PURE__ */ (0,
|
|
162
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CloseIcon, {})
|
|
313
163
|
}
|
|
314
164
|
)
|
|
315
165
|
]
|
|
@@ -321,8 +171,8 @@ function Notification(props) {
|
|
|
321
171
|
var import_patterns2 = require("@cerberus/styled-system/patterns");
|
|
322
172
|
|
|
323
173
|
// src/components/Portal.tsx
|
|
324
|
-
var
|
|
325
|
-
var Portal =
|
|
174
|
+
var import_react4 = require("@ark-ui/react");
|
|
175
|
+
var Portal = import_react4.Portal;
|
|
326
176
|
|
|
327
177
|
// src/context/notification-center.tsx
|
|
328
178
|
var import_recipes5 = require("@cerberus/styled-system/recipes");
|
|
@@ -330,10 +180,10 @@ var import_recipes5 = require("@cerberus/styled-system/recipes");
|
|
|
330
180
|
// src/components/Button.tsx
|
|
331
181
|
var import_css4 = require("@cerberus/styled-system/css");
|
|
332
182
|
var import_recipes4 = require("@cerberus/styled-system/recipes");
|
|
333
|
-
var
|
|
183
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
334
184
|
function Button(props) {
|
|
335
185
|
const { palette, usage, shape, ...nativeProps } = props;
|
|
336
|
-
return /* @__PURE__ */ (0,
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
337
187
|
"button",
|
|
338
188
|
{
|
|
339
189
|
...nativeProps,
|
|
@@ -351,43 +201,96 @@ function Button(props) {
|
|
|
351
201
|
|
|
352
202
|
// src/context/notification-center.tsx
|
|
353
203
|
var import_css5 = require("@cerberus/styled-system/css");
|
|
354
|
-
|
|
355
|
-
|
|
204
|
+
|
|
205
|
+
// src/context/notification-center/store.ts
|
|
206
|
+
function notificationCenterReducer(state, action) {
|
|
207
|
+
switch (action.type) {
|
|
208
|
+
case "ADD_NOTIFICATION":
|
|
209
|
+
return [...state, action.payload];
|
|
210
|
+
case "REMOVE_NOTIFICATION":
|
|
211
|
+
return state.filter((n) => n.id !== action.payload.id);
|
|
212
|
+
case "UPDATE_NOTIFICATION":
|
|
213
|
+
return state.map(
|
|
214
|
+
(n) => n.id === action.payload.id ? { ...n, ...action.payload } : n
|
|
215
|
+
);
|
|
216
|
+
case "CLEAR_NOTIFICATIONS":
|
|
217
|
+
return [];
|
|
218
|
+
default:
|
|
219
|
+
return state;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function addNotification(dispatch, options) {
|
|
223
|
+
dispatch({ type: "ADD_NOTIFICATION", payload: { ...options } });
|
|
224
|
+
}
|
|
225
|
+
function removeNotification(dispatch, id) {
|
|
226
|
+
dispatch({ type: "REMOVE_NOTIFICATION", payload: { id } });
|
|
227
|
+
}
|
|
228
|
+
function updateNotificationState(dispatch, options) {
|
|
229
|
+
dispatch({ type: "UPDATE_NOTIFICATION", payload: { ...options } });
|
|
230
|
+
}
|
|
231
|
+
function clearNotificationState(dispatch) {
|
|
232
|
+
dispatch({ type: "CLEAR_NOTIFICATIONS" });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/context/notification-center.tsx
|
|
236
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
237
|
+
var NotificationsContext = (0, import_react5.createContext)(null);
|
|
356
238
|
function NotificationCenter(props) {
|
|
357
|
-
const [
|
|
239
|
+
const [state, dispatch] = (0, import_react5.useReducer)(notificationCenterReducer, []);
|
|
358
240
|
const styles = (0, import_recipes5.notification)();
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const item = prev.find((option) => option.id === target.value);
|
|
369
|
-
if (item == null ? void 0 : item.onClose) item.onClose();
|
|
370
|
-
return prev.filter((option) => option.id !== target.value);
|
|
371
|
-
});
|
|
372
|
-
}, []);
|
|
373
|
-
const handleCloseAll = (0, import_react4.useCallback)(() => {
|
|
374
|
-
setActiveNotifications((prev) => {
|
|
375
|
-
prev.forEach((item) => {
|
|
376
|
-
if (item.onClose) item.onClose();
|
|
241
|
+
const timeout = (0, import_react5.useMemo)(
|
|
242
|
+
() => props.duration || 6e3,
|
|
243
|
+
[props.duration]
|
|
244
|
+
);
|
|
245
|
+
const closeNotification = (0, import_react5.useCallback)(
|
|
246
|
+
(id) => {
|
|
247
|
+
updateNotificationState(dispatch, {
|
|
248
|
+
id,
|
|
249
|
+
state: "closed"
|
|
377
250
|
});
|
|
378
|
-
|
|
251
|
+
window.setTimeout(() => {
|
|
252
|
+
removeNotification(dispatch, id);
|
|
253
|
+
}, 150);
|
|
254
|
+
},
|
|
255
|
+
[dispatch]
|
|
256
|
+
);
|
|
257
|
+
const handleNotify = (0, import_react5.useCallback)(
|
|
258
|
+
(options) => {
|
|
259
|
+
const id = `${options.palette}:${state.length + 1}`;
|
|
260
|
+
addNotification(dispatch, {
|
|
261
|
+
...options,
|
|
262
|
+
id,
|
|
263
|
+
state: "open"
|
|
264
|
+
});
|
|
265
|
+
window.setTimeout(() => {
|
|
266
|
+
closeNotification(id);
|
|
267
|
+
}, timeout);
|
|
268
|
+
},
|
|
269
|
+
[dispatch, state, timeout, closeNotification]
|
|
270
|
+
);
|
|
271
|
+
const handleClose = (0, import_react5.useCallback)(
|
|
272
|
+
(e) => {
|
|
273
|
+
const target = e.currentTarget;
|
|
274
|
+
closeNotification(target.value);
|
|
275
|
+
},
|
|
276
|
+
[closeNotification]
|
|
277
|
+
);
|
|
278
|
+
const handleCloseAll = (0, import_react5.useCallback)(() => {
|
|
279
|
+
state.forEach((item) => {
|
|
280
|
+
if (item.onClose) item.onClose();
|
|
379
281
|
});
|
|
380
|
-
|
|
381
|
-
|
|
282
|
+
clearNotificationState(dispatch);
|
|
283
|
+
}, [state, dispatch]);
|
|
284
|
+
const value = (0, import_react5.useMemo)(
|
|
382
285
|
() => ({
|
|
383
286
|
notify: handleNotify
|
|
384
287
|
}),
|
|
385
288
|
[handleNotify]
|
|
386
289
|
);
|
|
387
|
-
return /* @__PURE__ */ (0,
|
|
290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(NotificationsContext.Provider, { value, children: [
|
|
388
291
|
props.children,
|
|
389
|
-
/* @__PURE__ */ (0,
|
|
390
|
-
/* @__PURE__ */ (0,
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Show, { when: state.length > 0, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Portal, { container: props.container, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles.center, children: [
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Show, { when: state.length >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
391
294
|
Button,
|
|
392
295
|
{
|
|
393
296
|
className: (0, import_css5.cx)(styles.closeAll, (0, import_patterns2.animateIn)()),
|
|
@@ -399,7 +302,7 @@ function NotificationCenter(props) {
|
|
|
399
302
|
children: "Close all"
|
|
400
303
|
}
|
|
401
304
|
) }),
|
|
402
|
-
/* @__PURE__ */ (0,
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
403
306
|
"div",
|
|
404
307
|
{
|
|
405
308
|
className: (0, import_patterns2.vstack)({
|
|
@@ -409,11 +312,12 @@ function NotificationCenter(props) {
|
|
|
409
312
|
style: {
|
|
410
313
|
alignItems: "flex-end"
|
|
411
314
|
},
|
|
412
|
-
children:
|
|
315
|
+
children: state.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
413
316
|
MatchNotification,
|
|
414
317
|
{
|
|
415
318
|
...option,
|
|
416
|
-
onClose: handleClose
|
|
319
|
+
onClose: handleClose,
|
|
320
|
+
open: option.state
|
|
417
321
|
},
|
|
418
322
|
option.id
|
|
419
323
|
))
|
|
@@ -423,53 +327,42 @@ function NotificationCenter(props) {
|
|
|
423
327
|
] });
|
|
424
328
|
}
|
|
425
329
|
function MatchNotification(props) {
|
|
426
|
-
const { palette, id, onClose, heading, description } = props;
|
|
330
|
+
const { palette, id, onClose, heading, description, open } = props;
|
|
331
|
+
const sharedProps = (0, import_react5.useMemo)(
|
|
332
|
+
() => ({
|
|
333
|
+
id,
|
|
334
|
+
open: true,
|
|
335
|
+
onClose,
|
|
336
|
+
"data-state": open
|
|
337
|
+
}),
|
|
338
|
+
[id, open, onClose]
|
|
339
|
+
);
|
|
427
340
|
switch (palette) {
|
|
428
341
|
case "success":
|
|
429
|
-
return /* @__PURE__ */ (0,
|
|
430
|
-
|
|
431
|
-
{
|
|
432
|
-
|
|
433
|
-
onClose,
|
|
434
|
-
open: true,
|
|
435
|
-
palette: "success",
|
|
436
|
-
children: [
|
|
437
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(NotificationHeading, { palette: "success", children: heading }),
|
|
438
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(NotificationDescription, { palette: "success", children: description })
|
|
439
|
-
]
|
|
440
|
-
},
|
|
441
|
-
id
|
|
442
|
-
);
|
|
342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Notification, { ...sharedProps, palette: "success", children: [
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationHeading, { palette: "success", children: heading }),
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationDescription, { palette: "success", children: description })
|
|
345
|
+
] });
|
|
443
346
|
case "warning":
|
|
444
|
-
return /* @__PURE__ */ (0,
|
|
445
|
-
|
|
446
|
-
{
|
|
447
|
-
|
|
448
|
-
onClose,
|
|
449
|
-
open: true,
|
|
450
|
-
palette: "warning",
|
|
451
|
-
children: [
|
|
452
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(NotificationHeading, { palette: "warning", children: heading }),
|
|
453
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(NotificationDescription, { palette: "warning", children: description })
|
|
454
|
-
]
|
|
455
|
-
},
|
|
456
|
-
id
|
|
457
|
-
);
|
|
347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Notification, { ...sharedProps, palette: "warning", children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationHeading, { palette: "warning", children: heading }),
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationDescription, { palette: "warning", children: description })
|
|
350
|
+
] });
|
|
458
351
|
case "danger":
|
|
459
|
-
return /* @__PURE__ */ (0,
|
|
460
|
-
/* @__PURE__ */ (0,
|
|
461
|
-
/* @__PURE__ */ (0,
|
|
462
|
-
] }
|
|
352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Notification, { ...sharedProps, palette: "danger", children: [
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationHeading, { palette: "danger", children: heading }),
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationDescription, { palette: "danger", children: description })
|
|
355
|
+
] });
|
|
463
356
|
case "info":
|
|
464
357
|
default:
|
|
465
|
-
return /* @__PURE__ */ (0,
|
|
466
|
-
/* @__PURE__ */ (0,
|
|
467
|
-
/* @__PURE__ */ (0,
|
|
468
|
-
] }
|
|
358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Notification, { ...sharedProps, palette: "info", children: [
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationHeading, { palette: "info", children: heading }),
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NotificationDescription, { palette: "info", children: description })
|
|
361
|
+
] });
|
|
469
362
|
}
|
|
470
363
|
}
|
|
471
364
|
function useNotificationCenter() {
|
|
472
|
-
const context = (0,
|
|
365
|
+
const context = (0, import_react5.useContext)(NotificationsContext);
|
|
473
366
|
if (!context) {
|
|
474
367
|
throw new Error(
|
|
475
368
|
"useNotificationCenter must be used within a NotificationsProvider"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/notification-center.tsx","../../../src/components/Show.tsx","../../../src/components/NotificationHeading.tsx","../../../src/components/NotificationDescription.tsx","../../../src/components/Notification.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts","../../../src/aria-helpers/trap-focus.aria.ts","../../../src/components/Portal.tsx","../../../src/components/Button.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Show } from '../components/Show'\nimport { NotificationHeading } from '../components/NotificationHeading'\nimport { NotificationDescription } from '../components/NotificationDescription'\nimport { Notification } from '../components/Notification'\nimport { animateIn, vstack } from '@cerberus/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n /**\n * The palette of the notification.\n * @default 'info'\n */\n palette: 'info' | 'success' | 'warning' | 'danger'\n /**\n * The heading of the notification.\n */\n heading: string\n /**\n * The unique id of the notification.\n */\n id?: string\n /**\n * The description of the notification.\n */\n description?: ReactNode\n /**\n * The action to take when the notification is closed\n */\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport type NotificationsProviderProps = PortalProps\n\n/**\n * Provides a notification center to the app.\n * @see https://cerberus.digitalu.design/react/notification\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <Notifications>\n * <SomeFeatureSection />\n * </Notifications>\n *\n * // Use the hook to show a notification.\n * const notify = useNotifications()\n *\n * const handleClick = useCallback(() => {\n * notify({\n * palette: 'info',\n * heading: 'New feature!',\n * description: 'We have added a new feature to the app.',\n * })\n * }, [notify])\n * ```\n */\nexport function NotificationCenter(\n props: PropsWithChildren<NotificationsProviderProps>,\n) {\n const [activeNotifications, setActiveNotifications] = useState<\n NotifyOptions[]\n >([])\n const styles = notification()\n\n const handleNotify = useCallback((options: NotifyOptions) => {\n setActiveNotifications((prev) => {\n const id = `${options.palette}:${prev.length + 1}`\n return [...prev, { ...options, id }]\n })\n }, [])\n\n const handleClose = useCallback((e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n setActiveNotifications((prev) => {\n const item = prev.find((option) => option.id === target.value)\n if (item?.onClose) item.onClose()\n return prev.filter((option) => option.id !== target.value)\n })\n }, [])\n\n const handleCloseAll = useCallback(() => {\n setActiveNotifications((prev) => {\n prev.forEach((item) => {\n if (item.onClose) item.onClose()\n })\n return []\n })\n }, [])\n\n const value = useMemo(\n () => ({\n notify: handleNotify,\n }),\n [handleNotify],\n )\n\n // For some reason, the vstack pattern alignItems is not registering here.\n // So we are forcing it with the style prop.\n\n return (\n <NotificationsContext.Provider value={value}>\n {props.children}\n\n <Show when={activeNotifications.length > 0}>\n <Portal container={props.container}>\n <div className={styles.center}>\n <Show when={activeNotifications.length >= 4}>\n <Button\n className={cx(styles.closeAll, animateIn())}\n onClick={handleCloseAll}\n palette=\"action\"\n shape=\"rounded\"\n size=\"sm\"\n usage=\"ghost\"\n >\n Close all\n </Button>\n </Show>\n\n <div\n className={vstack({\n alignItems: 'flex-end',\n gap: '4',\n })}\n style={{\n alignItems: 'flex-end',\n }}\n >\n {activeNotifications.map((option) => (\n <MatchNotification\n key={option.id}\n {...option}\n onClose={handleClose}\n />\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\n )\n}\n\ninterface MatchNotificationProps extends Omit<NotifyOptions, 'onClose'> {\n onClose: (e: MouseEvent<HTMLButtonElement>) => void\n key: string | undefined\n}\n\nfunction MatchNotification(props: MatchNotificationProps) {\n const { palette, id, onClose, heading, description } = props\n\n switch (palette) {\n case 'success':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"success\"\n >\n <NotificationHeading palette=\"success\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"success\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'warning':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"warning\"\n >\n <NotificationHeading palette=\"warning\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"warning\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'danger':\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"danger\">\n <NotificationHeading palette=\"danger\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"danger\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'info':\n default:\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"info\">\n <NotificationHeading palette=\"info\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"info\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n }\n}\n\n/**\n * The hook to use the NotificationCenter.\n * @returns The notify method to trigger a notification.\n * @example\n * ```tsx\n * const {notify} = useNotificationCenter()\n * notify({\n * palette: 'info',\n * heading: 'New feature',\n * description: 'We have added a new feature to the app.',\n * })\n * ```\n */\nexport function useNotificationCenter(): NotificationsValue {\n const context = useContext(NotificationsContext)\n if (!context) {\n throw new Error(\n 'useNotificationCenter must be used within a NotificationsProvider',\n )\n }\n return context\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","import { cx } from '@cerberus/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module exports the NotificationHeading component.\n * @module\n */\n\nexport type BaseNotificationHeadingProps = HTMLAttributes<HTMLParagraphElement>\nexport type NotificationHeadingProps = BaseNotificationHeadingProps &\n NotificationVariantProps\n\n/**\n * Used to render the heading of a notification.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationHeading(props: NotificationHeadingProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p className={cx(nativeProps.className, styles.heading)} {...nativeProps} />\n )\n}\n","import { cx } from '@cerberus/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module exports the NotificationDescription component.\n * @module\n */\n\nexport type BaseNotificationDescriptionProps =\n HTMLAttributes<HTMLParagraphElement>\nexport type NotificationDescriptionProps = BaseNotificationDescriptionProps &\n NotificationVariantProps\n\n/**\n * Used to render the description of a notification.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationDescription(props: NotificationDescriptionProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p\n className={cx(nativeProps.className, styles.description)}\n {...nativeProps}\n />\n )\n}\n","'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport {\n useRef,\n type DialogHTMLAttributes,\n type PropsWithChildren,\n type MouseEvent,\n} from 'react'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\n\n/**\n * This module exports the Notification component.\n * @module\n */\n\nfunction MatchNotificationIcon(props: NotificationVariantProps) {\n const palette = (props.palette || 'info') as\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n const key = `${palette}Notification` as keyof typeof $cerberusIcons\n const Icon = $cerberusIcons[key]\n return <Icon />\n}\n\nexport interface NotificationBaseProps\n extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {\n /**\n * The unique id of the notification. Required for the onClose callback.\n */\n id: string\n /**\n * Called when the close button is clicked.\n */\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * A static Notification component that displays a message to the user. This\n * is typically only used when not utilizing the NotificationCenter.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @example\n * ```tsx\n * <Notification id=\"info:1\" open>\n * <NotificationHeading>Info Notification</NotificationHeading>\n * <NotificationDescription>\n * This is a description with a <a href=\"#\">link</a> in the message.\n * </NotificationDescription>\n * </Notification>\n * ```\n */\nexport function Notification(props: PropsWithChildren<NotificationProps>) {\n const { children, palette, onClose, ...nativeProps } = props\n const ref = useRef<HTMLDialogElement>(null)\n const onKeyDown = trapFocus(ref)\n const styles = notification({ palette })\n const { close: CloseIcon } = $cerberusIcons\n\n return (\n <dialog\n {...nativeProps}\n className={cx(\n nativeProps.className,\n hstack({\n position: 'relative',\n gap: '4',\n }),\n styles.dialog,\n )}\n onKeyDown={onKeyDown}\n ref={ref}\n >\n <span className={styles.icon}>\n <MatchNotificationIcon palette={palette} />\n </span>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0',\n py: '2',\n })}\n >\n {children}\n </div>\n\n <button\n aria-label=\"Close\"\n className={styles.close}\n onClick={onClose}\n value={props.id}\n >\n <CloseIcon />\n </button>\n </dialog>\n )\n}\n","import {\n Calendar,\n Checkmark,\n CheckmarkOutline,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n Close,\n CloudUpload,\n Information,\n Restart,\n TrashCan,\n UserFilled,\n Warning,\n WarningAlt,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\nimport { AnimatingUploadIcon } from '../components/AnimatingUploadIcon'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n accordionIndicator?: IconType\n avatar?: IconType\n calendar?: IconType\n calendarPrev?: IconType\n calendarNext?: IconType\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n waitingFileUploader?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n accordionIndicator: ChevronDown,\n avatar: UserFilled,\n calendar: Calendar,\n calendarPrev: ChevronLeft,\n calendarNext: ChevronRight,\n checkbox: CheckmarkIcon,\n close: Close,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n waitingFileUploader: CloudUpload,\n fileUploader: AnimatingUploadIcon,\n indeterminate: IndeterminateIcon,\n infoNotification: Information,\n successNotification: CheckmarkOutline,\n warningNotification: WarningAlt,\n dangerNotification: WarningFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n","import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\nexport type CheckboxIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Checkmark icon for Checkbox component\n */\nexport function CheckmarkIcon(props: CheckboxIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n role=\"img\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z\"\n />\n </svg>\n )\n}\n\nexport type IndeterminateIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Indeterminate icon for Checkbox component\n */\nexport function IndeterminateIcon(props: IndeterminateIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path fill=\"currentColor\" d=\"M4 11h16v2.667H4z\" />\n </svg>\n )\n}\n","import { type CarbonIconProps } from '@cerberus/icons'\n\n/**\n * This module contains an animating icon to use for the FileStatus component.\n * @module\n */\n\nexport type AnimatingUploadIconProps = CarbonIconProps\n\nexport function AnimatingUploadIcon(props: AnimatingUploadIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width={props.size ?? '1em'}\n height={props.size ?? '1em'}\n viewBox=\"0 0 24 24\"\n >\n <g\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n strokeWidth={1.5}\n >\n <path\n data-name=\"animating-trail\"\n strokeDasharray=\"2 4\"\n strokeDashoffset={6}\n d=\"M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9\"\n >\n <animate\n attributeName=\"stroke-dashoffset\"\n dur=\"0.45s\"\n repeatCount=\"indefinite\"\n values=\"6;0\"\n ></animate>\n </path>\n\n <path\n data-name=\"half-circle\"\n strokeDasharray={32}\n strokeDashoffset={32}\n d=\"M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9\"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"stroke-dashoffset\"\n begin=\"0.075s\"\n dur=\"0.3s\"\n values=\"32;0\"\n ></animate>\n </path>\n\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"0.8em\"\n height=\"0.8em\"\n x=\"27%\"\n y=\"27%\"\n viewBox=\"0 0 24 24\"\n >\n <polygon\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth={0.8}\n opacity=\"1\"\n 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 \"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"opacity\"\n values=\"1;0;1\"\n dur=\"2s\"\n repeatCount=\"indefinite\"\n ></animate>\n </polygon>\n </svg>\n </g>\n </svg>\n )\n}\n","import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {\n _validateIconsProperties(icons)\n $cerberusIcons = {\n ...defaultIcons,\n ...icons,\n } as Required<DefinedIcons>\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons = defaultIcons as Required<DefinedIcons>\n","import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'\n\nexport function trapFocus(\n modalRef: RefObject<HTMLDialogElement>,\n): KeyboardEventHandler<HTMLDialogElement> {\n const focusableElements =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n const focusable = Array.from(\n modalRef.current?.querySelectorAll(focusableElements) ?? [],\n )\n const firstFocusable = focusable[0] as HTMLElement\n const lastFocusable = focusable[focusable.length - 1] as HTMLElement\n\n return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstFocusable) {\n lastFocusable.focus()\n event.preventDefault()\n }\n } else {\n if (document.activeElement === lastFocusable) {\n firstFocusable.focus()\n event.preventDefault()\n }\n }\n }\n }\n}\n","import {\n Portal as ArkPortal,\n type PortalProps as ArkPortalProps,\n} from '@ark-ui/react'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport type PortalProps = ArkPortalProps\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @see https://cerberus.digitalu.design/react/portal\n * @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)\n * @example\n * ```tsx\n * 'use client'\n *\n * import { Portal } from '@cerberus/react'\n *\n * function SomeFeatureWithinSSRPage() {\n * return (\n * <Portal>\n * <div>Portal Content outside of the React VDom tree</div>\n * </Portal>\n * )\n * }\n */\nexport const Portal = ArkPortal\n","import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n button,\n type ButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Button component.\n * @module\n */\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n ButtonVariantProps\n\n/**\n * A component that allows the user to perform actions\n * @see https://cerberus.digitalu.design/react/button\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const { palette, usage, shape, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBASO;;;ACTP,mBAAgE;AA4B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EA;AAAA,UACA,MAAI;AAAA,UACJ,SAAQ;AAAA,UAER;AAAA,yDAAC,uBAAoB,SAAQ,WAAW,mBAAQ;AAAA,YAChD,6CAAC,2BAAwB,SAAQ,WAC9B,uBACH;AAAA;AAAA;AAAA,QARK;AAAA,MASP;AAAA,IAGJ,KAAK;AACH,aACE,8CAAC,gBAAa,IAAkB,SAAkB,MAAI,MAAC,SAAQ,UAC7D;AAAA,qDAAC,uBAAoB,SAAQ,UAAU,mBAAQ;AAAA,QAC/C,6CAAC,2BAAwB,SAAQ,UAC9B,uBACH;AAAA,WAJ0B,EAK5B;AAAA,IAGJ,KAAK;AAAA,IACL;AACE,aACE,8CAAC,gBAAa,IAAkB,SAAkB,MAAI,MAAC,SAAQ,QAC7D;AAAA,qDAAC,uBAAoB,SAAQ,QAAQ,mBAAQ;AAAA,QAC7C,6CAAC,2BAAwB,SAAQ,QAC9B,uBACH;AAAA,WAJ0B,EAK5B;AAAA,EAEN;AACF;AAeO,SAAS,wBAA4C;AAC1D,QAAM,cAAU,0BAAW,oBAAoB;AAC/C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":["import_react","import_css","import_recipes","import_jsx_runtime","import_css","import_recipes","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_patterns","import_react","ArkPortal","import_recipes","import_css","import_recipes","import_jsx_runtime","import_css","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/context/notification-center.tsx","../../../src/components/Show.tsx","../../../src/components/NotificationHeading.tsx","../../../src/components/NotificationDescription.tsx","../../../src/components/Notification.tsx","../../../src/aria-helpers/trap-focus.aria.ts","../../../src/context/cerberus.tsx","../../../src/components/Portal.tsx","../../../src/components/Button.tsx","../../../src/context/notification-center/store.ts"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useReducer,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Show } from '../components/Show'\nimport { NotificationHeading } from '../components/NotificationHeading'\nimport { NotificationDescription } from '../components/NotificationDescription'\nimport { Notification } from '../components/Notification'\nimport { animateIn, vstack } from '@cerberus/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n addNotification,\n clearNotificationState,\n notificationCenterReducer,\n removeNotification,\n updateNotificationState,\n} from './notification-center/store'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n /**\n * The palette of the notification.\n * @default 'info'\n */\n palette: 'info' | 'success' | 'warning' | 'danger'\n /**\n * The heading of the notification.\n */\n heading: string\n /**\n * The unique id of the notification.\n */\n id?: string\n /**\n * The description of the notification.\n */\n description?: ReactNode\n /**\n * The action to take when the notification is closed\n */\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport type NotificationsProviderProps = PortalProps & {\n /**\n * The duration in milliseconds to show the notification.\n * @default 6000\n */\n duration?: number\n}\n\n/**\n * Provides a notification center to the app.\n * @see https://cerberus.digitalu.design/react/notification\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <Notifications>\n * <SomeFeatureSection />\n * </Notifications>\n *\n * // Use the hook to show a notification.\n * const notify = useNotifications()\n *\n * const handleClick = useCallback(() => {\n * notify({\n * palette: 'info',\n * heading: 'New feature!',\n * description: 'We have added a new feature to the app.',\n * })\n * }, [notify])\n * ```\n */\nexport function NotificationCenter(\n props: PropsWithChildren<NotificationsProviderProps>,\n) {\n const [state, dispatch] = useReducer(notificationCenterReducer, [])\n const styles = notification()\n\n const timeout = useMemo<number>(\n () => props.duration || 6000,\n [props.duration],\n )\n\n const closeNotification = useCallback(\n (id: string) => {\n updateNotificationState(dispatch, {\n id,\n state: 'closed',\n })\n window.setTimeout(() => {\n removeNotification(dispatch, id)\n }, 150)\n },\n [dispatch],\n )\n\n const handleNotify = useCallback(\n (options: NotifyOptions) => {\n const id = `${options.palette}:${state.length + 1}`\n addNotification(dispatch, {\n ...options,\n id,\n state: 'open',\n })\n\n window.setTimeout(() => {\n closeNotification(id)\n }, timeout)\n },\n [dispatch, state, timeout, closeNotification],\n )\n\n const handleClose = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n closeNotification(target.value)\n },\n [closeNotification],\n )\n\n const handleCloseAll = useCallback(() => {\n state.forEach((item) => {\n if (item.onClose) item.onClose()\n })\n // we don't want to animate out for this one\n clearNotificationState(dispatch)\n }, [state, dispatch])\n\n const value = useMemo(\n () => ({\n notify: handleNotify,\n }),\n [handleNotify],\n )\n\n // For some reason, the vstack pattern alignItems is not registering here.\n // So we are forcing it with the style prop.\n\n return (\n <NotificationsContext.Provider value={value}>\n {props.children}\n\n <Show when={state.length > 0}>\n <Portal container={props.container}>\n <div className={styles.center}>\n <Show when={state.length >= 4}>\n <Button\n className={cx(styles.closeAll, animateIn())}\n onClick={handleCloseAll}\n palette=\"action\"\n shape=\"rounded\"\n size=\"sm\"\n usage=\"ghost\"\n >\n Close all\n </Button>\n </Show>\n\n <div\n className={vstack({\n alignItems: 'flex-end',\n gap: '4',\n })}\n style={{\n alignItems: 'flex-end',\n }}\n >\n {state.map((option) => (\n <MatchNotification\n key={option.id}\n {...option}\n onClose={handleClose}\n open={option.state}\n />\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\n )\n}\n\ninterface MatchNotificationProps extends Omit<NotifyOptions, 'onClose'> {\n open: 'open' | 'closed'\n onClose: (e: MouseEvent<HTMLButtonElement>) => void\n key: string | undefined\n}\n\nfunction MatchNotification(props: MatchNotificationProps) {\n const { palette, id, onClose, heading, description, open } = props\n const sharedProps = useMemo(\n () => ({\n id: id!,\n open: true,\n onClose,\n 'data-state': open,\n }),\n [id, open, onClose],\n )\n\n switch (palette) {\n case 'success':\n return (\n <Notification {...sharedProps} palette=\"success\">\n <NotificationHeading palette=\"success\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"success\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'warning':\n return (\n <Notification {...sharedProps} palette=\"warning\">\n <NotificationHeading palette=\"warning\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"warning\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'danger':\n return (\n <Notification {...sharedProps} palette=\"danger\">\n <NotificationHeading palette=\"danger\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"danger\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'info':\n default:\n return (\n <Notification {...sharedProps} palette=\"info\">\n <NotificationHeading palette=\"info\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"info\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n }\n}\n\n/**\n * The hook to use the NotificationCenter.\n * @returns The notify method to trigger a notification.\n * @example\n * ```tsx\n * const {notify} = useNotificationCenter()\n * notify({\n * palette: 'info',\n * heading: 'New feature',\n * description: 'We have added a new feature to the app.',\n * })\n * ```\n */\nexport function useNotificationCenter(): NotificationsValue {\n const context = useContext(NotificationsContext)\n if (!context) {\n throw new Error(\n 'useNotificationCenter must be used within a NotificationsProvider',\n )\n }\n return context\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","import { cx } from '@cerberus/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module exports the NotificationHeading component.\n * @module\n */\n\nexport type BaseNotificationHeadingProps = HTMLAttributes<HTMLParagraphElement>\nexport type NotificationHeadingProps = BaseNotificationHeadingProps &\n NotificationVariantProps\n\n/**\n * Used to render the heading of a notification.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationHeading(props: NotificationHeadingProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p className={cx(nativeProps.className, styles.heading)} {...nativeProps} />\n )\n}\n","import { cx } from '@cerberus/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module exports the NotificationDescription component.\n * @module\n */\n\nexport type BaseNotificationDescriptionProps =\n HTMLAttributes<HTMLParagraphElement>\nexport type NotificationDescriptionProps = BaseNotificationDescriptionProps &\n NotificationVariantProps\n\n/**\n * Used to render the description of a notification.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationDescription(props: NotificationDescriptionProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p\n className={cx(nativeProps.className, styles.description)}\n {...nativeProps}\n />\n )\n}\n","'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport {\n useRef,\n type DialogHTMLAttributes,\n type PropsWithChildren,\n type MouseEvent,\n} from 'react'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module exports the Notification component.\n * @module\n */\n\nfunction MatchNotificationIcon(props: NotificationVariantProps) {\n const { icons } = useCerberusContext()\n const palette = (props.palette || 'info') as\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n const key = `${palette}Notification` as keyof typeof icons\n const Icon = icons[key]\n return <Icon />\n}\n\nexport interface NotificationBaseProps\n extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {\n /**\n * The unique id of the notification. Required for the onClose callback.\n */\n id: string\n /**\n * Called when the close button is clicked.\n */\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * A static Notification component that displays a message to the user. This\n * is typically only used when not utilizing the NotificationCenter.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @example\n * ```tsx\n * <Notification id=\"info:1\" open>\n * <NotificationHeading>Info Notification</NotificationHeading>\n * <NotificationDescription>\n * This is a description with a <a href=\"#\">link</a> in the message.\n * </NotificationDescription>\n * </Notification>\n * ```\n */\nexport function Notification(props: PropsWithChildren<NotificationProps>) {\n const { children, palette, onClose, ...nativeProps } = props\n const ref = useRef<HTMLDialogElement>(null)\n\n const onKeyDown = trapFocus(ref)\n const styles = notification({ palette })\n\n const { icons } = useCerberusContext()\n const { close: CloseIcon } = icons\n\n return (\n <dialog\n {...nativeProps}\n data-placement=\"left\"\n className={cx(\n nativeProps.className,\n hstack({\n position: 'relative',\n gap: '4',\n }),\n styles.dialog,\n )}\n onKeyDown={onKeyDown}\n ref={ref}\n >\n <span className={styles.icon}>\n <MatchNotificationIcon palette={palette} />\n </span>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0',\n py: '2',\n })}\n >\n {children}\n </div>\n\n <button\n aria-label=\"Close\"\n className={styles.close}\n onClick={onClose}\n value={props.id}\n >\n <CloseIcon />\n </button>\n </dialog>\n )\n}\n","import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'\n\nexport function trapFocus(\n modalRef: RefObject<HTMLDialogElement>,\n): KeyboardEventHandler<HTMLDialogElement> {\n const focusableElements =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n const focusable = Array.from(\n modalRef.current?.querySelectorAll(focusableElements) ?? [],\n )\n const firstFocusable = focusable[0] as HTMLElement\n const lastFocusable = focusable[focusable.length - 1] as HTMLElement\n\n return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstFocusable) {\n lastFocusable.focus()\n event.preventDefault()\n }\n } else {\n if (document.activeElement === lastFocusable) {\n firstFocusable.focus()\n event.preventDefault()\n }\n }\n }\n }\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","import {\n Portal as ArkPortal,\n type PortalProps as ArkPortalProps,\n} from '@ark-ui/react'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport type PortalProps = ArkPortalProps\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @see https://cerberus.digitalu.design/react/portal\n * @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)\n * @example\n * ```tsx\n * 'use client'\n *\n * import { Portal } from '@cerberus/react'\n *\n * function SomeFeatureWithinSSRPage() {\n * return (\n * <Portal>\n * <div>Portal Content outside of the React VDom tree</div>\n * </Portal>\n * )\n * }\n */\nexport const Portal = ArkPortal\n","import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n button,\n type ButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Button component.\n * @module\n */\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n ButtonVariantProps\n\n/**\n * A component that allows the user to perform actions\n * @see https://cerberus.digitalu.design/react/button\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const { palette, usage, shape, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n />\n )\n}\n","import type { Dispatch } from 'react'\nimport type {\n AddNotifyAction,\n ClearNotifyAction,\n NotificationsStore,\n RemoveNotifyAction,\n UpdateNotifyAction,\n} from './types'\n\n/**\n * This module contains the reducer store and actions for the notification\n * center.\n * @module notification-center/store\n */\n\n/**\n * The reducer for the notification center.\n * @param state An array of notifications.\n * @param action An action to take on the notifications.\n * @returns The new state of the notifications.\n */\nexport function notificationCenterReducer(\n state: NotificationsStore,\n action:\n | AddNotifyAction\n | RemoveNotifyAction\n | UpdateNotifyAction\n | ClearNotifyAction,\n): NotificationsStore {\n switch (action.type) {\n case 'ADD_NOTIFICATION':\n return [...state, action.payload]\n case 'REMOVE_NOTIFICATION':\n return state.filter((n) => n.id !== action.payload.id)\n case 'UPDATE_NOTIFICATION':\n return state.map((n) =>\n n.id === action.payload.id ? { ...n, ...action.payload } : n,\n )\n case 'CLEAR_NOTIFICATIONS':\n return []\n default:\n return state\n }\n}\n\n/**\n * Adds a notification to the notification center.\n * @param dispatch The dispatch function.\n * @param options The notification options.\n */\nexport function addNotification(\n dispatch: Dispatch<AddNotifyAction>,\n options: AddNotifyAction['payload'],\n) {\n dispatch({ type: 'ADD_NOTIFICATION', payload: { ...options } })\n}\n\n/**\n * Removes a notification from the notification center.\n * @param dispatch The dispatch function.\n * @param id The id of the notification to remove.\n */\nexport function removeNotification(\n dispatch: Dispatch<RemoveNotifyAction>,\n id: RemoveNotifyAction['payload']['id'],\n) {\n dispatch({ type: 'REMOVE_NOTIFICATION', payload: { id } })\n}\n\n/**\n * Updates a notification in the notification center.\n * @param dispatch The dispatch function.\n * @param options The notification options.\n */\nexport function updateNotificationState(\n dispatch: Dispatch<UpdateNotifyAction>,\n options: UpdateNotifyAction['payload'],\n) {\n dispatch({ type: 'UPDATE_NOTIFICATION', payload: { ...options } })\n}\n\n/**\n * Clears the notification state.\n * @param dispatch The dispatch function.\n */\nexport function clearNotificationState(dispatch: Dispatch<ClearNotifyAction>) {\n dispatch({ type: 'CLEAR_NOTIFICATIONS' })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBASO;;;ACTP,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,sBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,sBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;ACtCA,iBAAmB;AACnB,qBAGO;AAsBH;AAJG,SAAS,oBAAoB,OAAiC;AACnE,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,QAAM,aAAS,6BAAa,EAAE,QAAQ,CAAC;AACvC,SACE,4CAAC,OAAE,eAAW,eAAG,YAAY,WAAW,OAAO,OAAO,GAAI,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AAC,gBAAc,GAAG,aAAa,SAAQ,UACrC;AAAA,qDAAC,uBAAoB,SAAQ,UAAU,mBAAQ;AAAA,QAC/C,6CAAC,2BAAwB,SAAQ,UAC9B,uBACH;AAAA,SACF;AAAA,IAGJ,KAAK;AAAA,IACL;AACE,aACE,8CAAC,gBAAc,GAAG,aAAa,SAAQ,QACrC;AAAA,qDAAC,uBAAoB,SAAQ,QAAQ,mBAAQ;AAAA,QAC7C,6CAAC,2BAAwB,SAAQ,QAC9B,uBACH;AAAA,SACF;AAAA,EAEN;AACF;AAeO,SAAS,wBAA4C;AAC1D,QAAM,cAAU,0BAAW,oBAAoB;AAC/C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":["import_react","import_css","import_recipes","import_jsx_runtime","import_css","import_recipes","import_react","import_react","import_jsx_runtime","import_jsx_runtime","import_patterns","import_react","ArkPortal","import_recipes","import_css","import_recipes","import_jsx_runtime","import_css","import_jsx_runtime"]}
|