@cerberus-design/react 0.10.4-next-271fee4 → 0.10.4-next-57d0ee2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +75 -0
  2. package/build/legacy/components/Admonition.cjs +419 -0
  3. package/build/legacy/components/Admonition.cjs.map +1 -0
  4. package/build/legacy/components/Avatar.cjs +4 -4
  5. package/build/legacy/components/Avatar.cjs.map +1 -1
  6. package/build/legacy/components/Checkbox.cjs +4 -4
  7. package/build/legacy/components/Checkbox.cjs.map +1 -1
  8. package/build/legacy/components/FileStatus.cjs +4 -4
  9. package/build/legacy/components/FileStatus.cjs.map +1 -1
  10. package/build/legacy/components/FileUploader.cjs +4 -4
  11. package/build/legacy/components/FileUploader.cjs.map +1 -1
  12. package/build/legacy/components/Input.cjs +4 -4
  13. package/build/legacy/components/Input.cjs.map +1 -1
  14. package/build/legacy/components/Notification.cjs +4 -4
  15. package/build/legacy/components/Notification.cjs.map +1 -1
  16. package/build/legacy/components/Select.cjs +4 -4
  17. package/build/legacy/components/Select.cjs.map +1 -1
  18. package/build/legacy/components/Tag.cjs +4 -4
  19. package/build/legacy/components/Tag.cjs.map +1 -1
  20. package/build/legacy/components/Toggle.cjs +4 -4
  21. package/build/legacy/components/Toggle.cjs.map +1 -1
  22. package/build/legacy/config/cerbIcons.cjs +4 -4
  23. package/build/legacy/config/cerbIcons.cjs.map +1 -1
  24. package/build/legacy/config/defineIcons.cjs +4 -4
  25. package/build/legacy/config/defineIcons.cjs.map +1 -1
  26. package/build/legacy/context/confirm-modal.cjs +4 -4
  27. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  28. package/build/legacy/context/notification-center.cjs +4 -4
  29. package/build/legacy/context/notification-center.cjs.map +1 -1
  30. package/build/legacy/context/prompt-modal.cjs +4 -4
  31. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  32. package/build/legacy/index.cjs +552 -424
  33. package/build/legacy/index.cjs.map +1 -1
  34. package/build/modern/_tsup-dts-rollup.d.ts +75 -0
  35. package/build/modern/{chunk-QHVJAPSD.js → chunk-243VUIA6.js} +2 -2
  36. package/build/modern/{chunk-BADJ7VVO.js → chunk-3NE6C66J.js} +6 -6
  37. package/build/modern/{chunk-5NELG2TB.js → chunk-FT7DFRHQ.js} +2 -2
  38. package/build/modern/{chunk-P3THICWW.js → chunk-HCB5NQ5J.js} +3 -3
  39. package/build/modern/{chunk-A42MQEHJ.js → chunk-KLUBAM4U.js} +2 -2
  40. package/build/modern/{chunk-DH57GIIW.js → chunk-MDIUFBDX.js} +2 -2
  41. package/build/modern/{chunk-3XZRRGFQ.js → chunk-PA5EB7EO.js} +2 -2
  42. package/build/modern/{chunk-ZUQ2MHMQ.js → chunk-RDQHHCFR.js} +2 -2
  43. package/build/modern/{chunk-V7YG7JUJ.js → chunk-TMR7JGMP.js} +7 -8
  44. package/build/modern/chunk-TMR7JGMP.js.map +1 -0
  45. package/build/modern/{chunk-WSGQZZVU.js → chunk-UJKS4DDN.js} +2 -2
  46. package/build/modern/{chunk-XFKPALXB.js → chunk-X4Y4WTRU.js} +3 -3
  47. package/build/modern/{chunk-XREDYSAP.js → chunk-YMJMB6OP.js} +3 -3
  48. package/build/modern/{chunk-SRGQQYBQ.js → chunk-YWCTMLLO.js} +2 -2
  49. package/build/modern/chunk-ZW3FFE37.js +138 -0
  50. package/build/modern/chunk-ZW3FFE37.js.map +1 -0
  51. package/build/modern/{chunk-XWQEINEL.js → chunk-ZX6DBC2Z.js} +2 -2
  52. package/build/modern/components/Admonition.js +17 -0
  53. package/build/modern/components/Admonition.js.map +1 -0
  54. package/build/modern/components/Avatar.js +3 -3
  55. package/build/modern/components/Checkbox.js +3 -3
  56. package/build/modern/components/FileStatus.js +4 -4
  57. package/build/modern/components/FileUploader.js +4 -4
  58. package/build/modern/components/Input.js +3 -3
  59. package/build/modern/components/Notification.js +3 -3
  60. package/build/modern/components/Select.js +3 -3
  61. package/build/modern/components/Tag.js +3 -3
  62. package/build/modern/components/Toggle.js +3 -3
  63. package/build/modern/config/cerbIcons.js +1 -1
  64. package/build/modern/config/defineIcons.js +2 -2
  65. package/build/modern/context/confirm-modal.js +4 -4
  66. package/build/modern/context/notification-center.js +4 -4
  67. package/build/modern/context/prompt-modal.js +5 -5
  68. package/build/modern/index.js +38 -30
  69. package/build/modern/index.js.map +1 -1
  70. package/package.json +3 -3
  71. package/src/components/Admonition.tsx +186 -0
  72. package/src/config/cerbIcons.ts +6 -7
  73. package/src/index.ts +1 -0
  74. package/build/modern/chunk-V7YG7JUJ.js.map +0 -1
  75. /package/build/modern/{chunk-QHVJAPSD.js.map → chunk-243VUIA6.js.map} +0 -0
  76. /package/build/modern/{chunk-BADJ7VVO.js.map → chunk-3NE6C66J.js.map} +0 -0
  77. /package/build/modern/{chunk-5NELG2TB.js.map → chunk-FT7DFRHQ.js.map} +0 -0
  78. /package/build/modern/{chunk-P3THICWW.js.map → chunk-HCB5NQ5J.js.map} +0 -0
  79. /package/build/modern/{chunk-A42MQEHJ.js.map → chunk-KLUBAM4U.js.map} +0 -0
  80. /package/build/modern/{chunk-DH57GIIW.js.map → chunk-MDIUFBDX.js.map} +0 -0
  81. /package/build/modern/{chunk-3XZRRGFQ.js.map → chunk-PA5EB7EO.js.map} +0 -0
  82. /package/build/modern/{chunk-ZUQ2MHMQ.js.map → chunk-RDQHHCFR.js.map} +0 -0
  83. /package/build/modern/{chunk-WSGQZZVU.js.map → chunk-UJKS4DDN.js.map} +0 -0
  84. /package/build/modern/{chunk-XFKPALXB.js.map → chunk-X4Y4WTRU.js.map} +0 -0
  85. /package/build/modern/{chunk-XREDYSAP.js.map → chunk-YMJMB6OP.js.map} +0 -0
  86. /package/build/modern/{chunk-SRGQQYBQ.js.map → chunk-YWCTMLLO.js.map} +0 -0
  87. /package/build/modern/{chunk-XWQEINEL.js.map → chunk-ZX6DBC2Z.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { Activator } from '@dnd-kit/core';
2
2
  import { Activators } from '@dnd-kit/core';
3
3
  import { Active } from '@dnd-kit/core';
4
+ import { AdmonitionVariantProps } from '@cerberus/styled-system/recipes';
4
5
  import type { AnchorHTMLAttributes } from 'react';
5
6
  import { Announcements } from '@dnd-kit/core';
6
7
  import { applyModifiers } from '@dnd-kit/core';
@@ -151,6 +152,80 @@ export { Activators }
151
152
 
152
153
  export { Active }
153
154
 
155
+ /**
156
+ * The `Admonition` component is used to create an admonition.
157
+ * @example
158
+ * ```tsx
159
+ * <Admonition palette="page">
160
+ * <AdmonitionHeading palette="page">Page</AdmonitionHeading>
161
+ * <AdmonitionDescription palette="page">
162
+ * This is a page admonition.
163
+ * </AdmonitionDescription>
164
+ * </Admonition>
165
+ * ```
166
+ * @see https://cerberus.digitalu.design/react/admonition
167
+ */
168
+ declare function Admonition(props: AdmonitionProps): JSX_2.Element;
169
+ export { Admonition }
170
+ export { Admonition as Admonition_alias_1 }
171
+
172
+ /**
173
+ * The `AdmonitionDescription` component is used to create a description within
174
+ * an admonition.
175
+ * @example
176
+ * ```tsx
177
+ * <Admonition palette="page">
178
+ * <AdmonitionHeading palette="page">Page</AdmonitionHeading>
179
+ * <AdmonitionDescription palette="page">
180
+ * This is a page admonition.
181
+ * </AdmonitionDescription>
182
+ * </Admonition>
183
+ * ```
184
+ * @see https://cerberus.digitalu.design/react/admonition
185
+ */
186
+ declare function AdmonitionDescription(props: AdmonitionDescriptionProps): JSX_2.Element;
187
+ export { AdmonitionDescription }
188
+ export { AdmonitionDescription as AdmonitionDescription_alias_1 }
189
+
190
+ declare type AdmonitionDescriptionProps = HTMLAttributes<HTMLParagraphElement> & AdmonitionVariantProps;
191
+ export { AdmonitionDescriptionProps }
192
+ export { AdmonitionDescriptionProps as AdmonitionDescriptionProps_alias_1 }
193
+
194
+ /**
195
+ * The `AdmonitionHeading` component is used to create a heading within an
196
+ * admonition.
197
+ * @example
198
+ * ```tsx
199
+ * <Admonition palette="page">
200
+ * <AdmonitionHeading palette="page">Page</AdmonitionHeading>
201
+ * <AdmonitionDescription palette="page">
202
+ * This is a page admonition.
203
+ * </AdmonitionDescription>
204
+ * </Admonition>
205
+ * ```
206
+ * @see https://cerberus.digitalu.design/react/admonition
207
+ */
208
+ declare function AdmonitionHeading(props: AdmonitionHeadingProps): JSX_2.Element;
209
+ export { AdmonitionHeading }
210
+ export { AdmonitionHeading as AdmonitionHeading_alias_1 }
211
+
212
+ declare type AdmonitionHeadingProps = HTMLAttributes<HTMLParagraphElement> & AdmonitionVariantProps;
213
+ export { AdmonitionHeadingProps }
214
+ export { AdmonitionHeadingProps as AdmonitionHeadingProps_alias_1 }
215
+
216
+ /**
217
+ * This module provides a set of components for creating admonitions.
218
+ * @module Admonition
219
+ */
220
+ declare type AdmonitionProps = HTMLAttributes<HTMLDivElement> & AdmonitionVariantProps & {
221
+ /**
222
+ * One off replacement for the icon.
223
+ */
224
+ icon?: ReactNode;
225
+ };
226
+ export { AdmonitionProps }
227
+ export { AdmonitionProps as AdmonitionProps_alias_1 }
228
+
154
229
  export declare function AnimatingUploadIcon(props: AnimatingUploadIconProps): JSX_2.Element;
155
230
 
156
231
  /**
@@ -0,0 +1,419 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Admonition.tsx
21
+ var Admonition_exports = {};
22
+ __export(Admonition_exports, {
23
+ Admonition: () => Admonition,
24
+ AdmonitionDescription: () => AdmonitionDescription,
25
+ AdmonitionHeading: () => AdmonitionHeading
26
+ });
27
+ module.exports = __toCommonJS(Admonition_exports);
28
+ var import_recipes2 = require("@cerberus/styled-system/recipes");
29
+ var import_css2 = require("@cerberus-design/styled-system/css");
30
+ var import_patterns2 = require("@cerberus/styled-system/patterns");
31
+
32
+ // src/config/cerbIcons.ts
33
+ var import_icons = require("@cerberus/icons");
34
+
35
+ // src/config/icons/checkbox.icons.tsx
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ function CheckmarkIcon(props) {
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
+ "svg",
40
+ {
41
+ "aria-hidden": "true",
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ fill: "none",
44
+ role: "img",
45
+ viewBox: "0 0 24 24",
46
+ ...props,
47
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
+ "path",
49
+ {
50
+ fill: "currentColor",
51
+ d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
52
+ }
53
+ )
54
+ }
55
+ );
56
+ }
57
+ function IndeterminateIcon(props) {
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ "svg",
60
+ {
61
+ "aria-hidden": "true",
62
+ xmlns: "http://www.w3.org/2000/svg",
63
+ role: "img",
64
+ fill: "none",
65
+ viewBox: "0 0 24 24",
66
+ ...props,
67
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
68
+ }
69
+ );
70
+ }
71
+
72
+ // src/components/AnimatingUploadIcon.tsx
73
+ var import_jsx_runtime2 = require("react/jsx-runtime");
74
+ function AnimatingUploadIcon(props) {
75
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
76
+ "svg",
77
+ {
78
+ "aria-hidden": "true",
79
+ xmlns: "http://www.w3.org/2000/svg",
80
+ width: props.size ?? "1em",
81
+ height: props.size ?? "1em",
82
+ viewBox: "0 0 24 24",
83
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
84
+ "g",
85
+ {
86
+ fill: "none",
87
+ stroke: "currentColor",
88
+ strokeLinecap: "square",
89
+ strokeLinejoin: "round",
90
+ strokeWidth: 1.5,
91
+ children: [
92
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
93
+ "path",
94
+ {
95
+ "data-name": "animating-trail",
96
+ strokeDasharray: "2 4",
97
+ strokeDashoffset: 6,
98
+ d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
99
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
100
+ "animate",
101
+ {
102
+ attributeName: "stroke-dashoffset",
103
+ dur: "0.45s",
104
+ repeatCount: "indefinite",
105
+ values: "6;0"
106
+ }
107
+ )
108
+ }
109
+ ),
110
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
111
+ "path",
112
+ {
113
+ "data-name": "half-circle",
114
+ strokeDasharray: 32,
115
+ strokeDashoffset: 32,
116
+ d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
117
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
118
+ "animate",
119
+ {
120
+ fill: "freeze",
121
+ attributeName: "stroke-dashoffset",
122
+ begin: "0.075s",
123
+ dur: "0.3s",
124
+ values: "32;0"
125
+ }
126
+ )
127
+ }
128
+ ),
129
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
130
+ "svg",
131
+ {
132
+ "aria-hidden": "true",
133
+ xmlns: "http://www.w3.org/2000/svg",
134
+ width: "0.8em",
135
+ height: "0.8em",
136
+ x: "27%",
137
+ y: "27%",
138
+ viewBox: "0 0 24 24",
139
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
140
+ "polygon",
141
+ {
142
+ fill: "currentColor",
143
+ stroke: "currentColor",
144
+ strokeWidth: 0.8,
145
+ opacity: "1",
146
+ 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 ",
147
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
148
+ "animate",
149
+ {
150
+ fill: "freeze",
151
+ attributeName: "opacity",
152
+ values: "1;0;1",
153
+ dur: "2s",
154
+ repeatCount: "indefinite"
155
+ }
156
+ )
157
+ }
158
+ )
159
+ }
160
+ )
161
+ ]
162
+ }
163
+ )
164
+ }
165
+ );
166
+ }
167
+
168
+ // src/config/cerbIcons.ts
169
+ var defaultIcons = {
170
+ avatar: import_icons.UserFilled,
171
+ checkbox: CheckmarkIcon,
172
+ close: import_icons.CloseFilled,
173
+ confirmModal: import_icons.Information,
174
+ delete: import_icons.TrashCan,
175
+ promptModal: import_icons.Information,
176
+ waitingFileUploader: import_icons.CloudUpload,
177
+ fileUploader: AnimatingUploadIcon,
178
+ indeterminate: IndeterminateIcon,
179
+ infoNotification: import_icons.Information,
180
+ successNotification: import_icons.CheckmarkOutline,
181
+ warningNotification: import_icons.WarningAlt,
182
+ dangerNotification: import_icons.WarningFilled,
183
+ invalid: import_icons.WarningFilled,
184
+ invalidAlt: import_icons.Warning,
185
+ redo: import_icons.Restart,
186
+ selectArrow: import_icons.ChevronDown,
187
+ toggleChecked: import_icons.Checkmark
188
+ };
189
+
190
+ // src/config/defineIcons.ts
191
+ var $cerberusIcons = defaultIcons;
192
+
193
+ // src/components/Avatar.tsx
194
+ var import_css = require("@cerberus/styled-system/css");
195
+ var import_patterns = require("@cerberus/styled-system/patterns");
196
+ var import_recipes = require("@cerberus/styled-system/recipes");
197
+
198
+ // src/components/Show.tsx
199
+ var import_react = require("react");
200
+ function Show(props) {
201
+ const { when, children, fallback } = props;
202
+ const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
203
+ return (0, import_react.useMemo)(() => {
204
+ if (condition) return children;
205
+ return fallback ?? null;
206
+ }, [condition, children, fallback]);
207
+ }
208
+
209
+ // src/components/Avatar.tsx
210
+ var import_jsx_runtime3 = require("react/jsx-runtime");
211
+ function Avatar(props) {
212
+ const {
213
+ ariaLabel,
214
+ as,
215
+ gradient,
216
+ size,
217
+ src,
218
+ width,
219
+ height,
220
+ icon,
221
+ ...nativeProps
222
+ } = props;
223
+ const { avatar: AvatarIcon } = $cerberusIcons;
224
+ const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
225
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
226
+ "div",
227
+ {
228
+ ...nativeProps,
229
+ className: (0, import_css.cx)(
230
+ nativeProps.className,
231
+ (0, import_recipes.avatar)({ gradient, size }),
232
+ (0, import_patterns.circle)()
233
+ ),
234
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
235
+ Show,
236
+ {
237
+ when: Boolean(src) || Boolean(as),
238
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
239
+ Show,
240
+ {
241
+ when: Boolean(initials),
242
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
243
+ Show,
244
+ {
245
+ when: Boolean(icon),
246
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
247
+ AvatarIcon,
248
+ {
249
+ size: iconSizeMap[size]
250
+ }
251
+ ),
252
+ children: icon
253
+ }
254
+ ),
255
+ children: initials
256
+ }
257
+ ),
258
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
259
+ Show,
260
+ {
261
+ when: Boolean(as),
262
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
263
+ "img",
264
+ {
265
+ alt: props.ariaLabel,
266
+ className: (0, import_css.css)({
267
+ h: "full",
268
+ objectFit: "cover",
269
+ w: "full"
270
+ }),
271
+ decoding: "async",
272
+ loading: "lazy",
273
+ src,
274
+ height,
275
+ width
276
+ }
277
+ ),
278
+ children: as
279
+ }
280
+ )
281
+ }
282
+ )
283
+ }
284
+ );
285
+ }
286
+ var iconSizeMap = {
287
+ xs: 16,
288
+ sm: 16,
289
+ md: 20,
290
+ lg: 34,
291
+ xl: 32,
292
+ "2xl": 32,
293
+ "3xl": 32,
294
+ "4xl": 32
295
+ };
296
+
297
+ // src/components/Admonition.tsx
298
+ var import_jsx_runtime4 = require("react/jsx-runtime");
299
+ function Admonition(props) {
300
+ const { children, palette = "page", usage, icon, ...nativeProps } = props;
301
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
302
+ "aside",
303
+ {
304
+ ...nativeProps,
305
+ className: (0, import_css2.cx)(
306
+ nativeProps.className,
307
+ (0, import_patterns2.hstack)({
308
+ gap: "md",
309
+ w: "full"
310
+ }),
311
+ (0, import_recipes2.admonition)({ palette, usage }).root
312
+ ),
313
+ children: [
314
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: Boolean(icon), fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MatchAvatar, { palette }), children: icon }),
315
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children })
316
+ ]
317
+ }
318
+ );
319
+ }
320
+ function AdmonitionHeading(props) {
321
+ const { palette, usage, ...nativeProps } = props;
322
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
323
+ "p",
324
+ {
325
+ ...nativeProps,
326
+ className: (0, import_css2.cx)(
327
+ nativeProps.className,
328
+ (0, import_recipes2.admonition)({ palette, usage }).heading
329
+ )
330
+ }
331
+ );
332
+ }
333
+ function AdmonitionDescription(props) {
334
+ const { palette, usage, ...nativeProps } = props;
335
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
336
+ "p",
337
+ {
338
+ ...nativeProps,
339
+ className: (0, import_css2.cx)(
340
+ nativeProps.className,
341
+ (0, import_recipes2.admonition)({ palette, usage }).description
342
+ )
343
+ }
344
+ );
345
+ }
346
+ function MatchAvatar(props) {
347
+ const {
348
+ infoNotification: InfoIcon,
349
+ successNotification: SuccessIcon,
350
+ warningNotification: WarningIcon,
351
+ dangerNotification: DangerIcon
352
+ } = $cerberusIcons;
353
+ switch (props.palette) {
354
+ case "page":
355
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
356
+ Avatar,
357
+ {
358
+ gradient: "charon-light",
359
+ ariaLabel: "",
360
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon, {}),
361
+ size: "sm",
362
+ src: ""
363
+ }
364
+ );
365
+ case "info":
366
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
367
+ Avatar,
368
+ {
369
+ gradient: "amphiaraus-dark",
370
+ ariaLabel: "",
371
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon, {}),
372
+ size: "sm",
373
+ src: ""
374
+ }
375
+ );
376
+ case "success":
377
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
378
+ Avatar,
379
+ {
380
+ gradient: "thanatos-dark",
381
+ ariaLabel: "",
382
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SuccessIcon, {}),
383
+ size: "sm",
384
+ src: ""
385
+ }
386
+ );
387
+ case "warning":
388
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
389
+ Avatar,
390
+ {
391
+ gradient: "asphodel-light",
392
+ ariaLabel: "",
393
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(WarningIcon, {}),
394
+ size: "sm",
395
+ src: ""
396
+ }
397
+ );
398
+ case "danger":
399
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
400
+ Avatar,
401
+ {
402
+ gradient: "hades-light",
403
+ ariaLabel: "",
404
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DangerIcon, {}),
405
+ size: "sm",
406
+ src: ""
407
+ }
408
+ );
409
+ default:
410
+ throw new Error("Unsupported admonition palette");
411
+ }
412
+ }
413
+ // Annotate the CommonJS export names for ESM import in node:
414
+ 0 && (module.exports = {
415
+ Admonition,
416
+ AdmonitionDescription,
417
+ AdmonitionHeading
418
+ });
419
+ //# sourceMappingURL=Admonition.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Admonition.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts","../../../src/components/Avatar.tsx","../../../src/components/Show.tsx"],"sourcesContent":["import {\n admonition,\n type AdmonitionVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport { Avatar } from './Avatar'\nimport { Show } from './Show'\n\n/**\n * This module provides a set of components for creating admonitions.\n * @module Admonition\n */\n\nexport type AdmonitionProps = HTMLAttributes<HTMLDivElement> &\n AdmonitionVariantProps & {\n /**\n * One off replacement for the icon.\n */\n icon?: ReactNode\n }\n\n/**\n * The `Admonition` component is used to create an admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function Admonition(props: AdmonitionProps) {\n const { children, palette = 'page', usage, icon, ...nativeProps } = props\n return (\n <aside\n {...nativeProps}\n className={cx(\n nativeProps.className,\n hstack({\n gap: 'md',\n w: 'full',\n }),\n admonition({ palette, usage }).root,\n )}\n >\n <Show when={Boolean(icon)} fallback={<MatchAvatar palette={palette} />}>\n {icon}\n </Show>\n <div>{children}</div>\n </aside>\n )\n}\n\nexport type AdmonitionHeadingProps = HTMLAttributes<HTMLParagraphElement> &\n AdmonitionVariantProps\n\n/**\n * The `AdmonitionHeading` component is used to create a heading within an\n * admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function AdmonitionHeading(props: AdmonitionHeadingProps) {\n const { palette, usage, ...nativeProps } = props\n return (\n <p\n {...nativeProps}\n className={cx(\n nativeProps.className,\n admonition({ palette, usage }).heading,\n )}\n />\n )\n}\n\nexport type AdmonitionDescriptionProps = HTMLAttributes<HTMLParagraphElement> &\n AdmonitionVariantProps\n\n/**\n * The `AdmonitionDescription` component is used to create a description within\n * an admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function AdmonitionDescription(props: AdmonitionDescriptionProps) {\n const { palette, usage, ...nativeProps } = props\n return (\n <p\n {...nativeProps}\n className={cx(\n nativeProps.className,\n admonition({ palette, usage }).description,\n )}\n />\n )\n}\n\n// Private components\n\ntype MatchAvatarProps = AdmonitionVariantProps\n\nfunction MatchAvatar(props: MatchAvatarProps) {\n const {\n infoNotification: InfoIcon,\n successNotification: SuccessIcon,\n warningNotification: WarningIcon,\n dangerNotification: DangerIcon,\n } = $cerberusIcons\n switch (props.palette) {\n case 'page':\n return (\n <Avatar\n gradient=\"charon-light\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'info':\n return (\n <Avatar\n gradient=\"amphiaraus-dark\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'success':\n return (\n <Avatar\n gradient=\"thanatos-dark\"\n ariaLabel=\"\"\n icon={<SuccessIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'warning':\n return (\n <Avatar\n gradient=\"asphodel-light\"\n ariaLabel=\"\"\n icon={<WarningIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'danger':\n return (\n <Avatar\n gradient=\"hades-light\"\n ariaLabel=\"\"\n icon={<DangerIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n\n default:\n throw new Error('Unsupported admonition palette')\n }\n}\n","import {\n Checkmark,\n CheckmarkOutline,\n ChevronDown,\n CloseFilled,\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 avatar?: 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 avatar: UserFilled,\n checkbox: CheckmarkIcon,\n close: CloseFilled,\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\ninterface CheckboxIconProps extends 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\ninterface IndeterminateIconProps extends 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 { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { avatar: AvatarIcon } = $cerberusIcons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,kBAGO;AACP,IAAAC,cAAmB;AACnB,IAAAC,mBAAuB;;;ACLvB,mBAcO;;;ACQD;AAVC,SAAS,cAAc,OAA0B;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,GAAE;AAAA;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ;AAOO,SAAS,kBAAkB,OAA+B;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;A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UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,6CAAC,YAAS;AAAA,UAChB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,6CAAC,eAAY;AAAA,UACnB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,6CAAC,eAAY;AAAA,UACnB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,6CAAC,cAAW;AAAA,UAClB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAGJ;AACE,YAAM,IAAI,MAAM,gCAAgC;AAAA,EACpD;AACF;","names":["import_recipes","import_css","import_patterns","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
@@ -174,10 +174,10 @@ var defaultIcons = {
174
174
  waitingFileUploader: import_icons.CloudUpload,
175
175
  fileUploader: AnimatingUploadIcon,
176
176
  indeterminate: IndeterminateIcon,
177
- infoNotification: import_icons.InformationFilled,
178
- successNotification: import_icons.CheckmarkFilled,
179
- warningNotification: import_icons.WarningFilled,
180
- dangerNotification: import_icons.ErrorFilled,
177
+ infoNotification: import_icons.Information,
178
+ successNotification: import_icons.CheckmarkOutline,
179
+ warningNotification: import_icons.WarningAlt,
180
+ dangerNotification: import_icons.WarningFilled,
181
181
  invalid: import_icons.WarningFilled,
182
182
  invalidAlt: import_icons.Warning,
183
183
  redo: import_icons.Restart,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Avatar.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts","../../../src/components/Show.tsx"],"sourcesContent":["import { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { avatar: AvatarIcon } = $cerberusIcons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\n}\n","import {\n Checkmark,\n CheckmarkFilled,\n ChevronDown,\n CloseFilled,\n CloudUpload,\n ErrorFilled,\n Information,\n InformationFilled,\n Restart,\n TrashCan,\n UserFilled,\n Warning,\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 avatar?: 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 avatar: UserFilled,\n checkbox: CheckmarkIcon,\n close: CloseFilled,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n waitingFileUploader: CloudUpload,\n fileUploader: AnimatingUploadIcon,\n indeterminate: IndeterminateIcon,\n infoNotification: InformationFilled,\n successNotification: CheckmarkFilled,\n warningNotification: WarningFilled,\n dangerNotification: ErrorFilled,\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\ninterface CheckboxIconProps extends 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\ninterface IndeterminateIconProps extends 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","'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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAwB;AACxB,sBAAuB;AACvB,qBAGO;;;ACLP,mBAeO;;;ACOD;AAVC,SAAS,cAAc,OAA0B;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,GAAE;AAAA;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ;AAOO,SAAS,kBAAkB,OAA+B;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ,sDAAC,UAAK,MAAK,gBAAe,GAAE,qBAAoB;AAAA;AAAA,EAClD;AAEJ;;;AC9BM,IAAAA,sBAAA;AATC,SAAS,oBAAoB,OAAiC;AACnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC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,GAAG,KAAK,QAAQ,EAAE;AAAA,UAChC,UACE;AAAA,YAAC;AAAA;AAAA,cACC,MAAM,QAAQ,QAAQ;AAAA,cACtB,UACE;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,QAAQ,IAAI;AAAA,kBAClB,UACE;AAAA,oBAAC;AAAA;AAAA,sBACC,MAAM,YAAY,IAAgC;AAAA;AAAA,kBACpD;AAAA,kBAGD;AAAA;AAAA,cACH;AAAA,cAGD;AAAA;AAAA,UACH;AAAA,UAGF;AAAA,YAAC;AAAA;AAAA,cACC,MAAM,QAAQ,EAAE;AAAA,cAChB,UACE;AAAA,gBAAC;AAAA;AAAA,kBACC,KAAK,MAAM;AAAA,kBACX,eAAW,gBAAI;AAAA,oBACb,GAAG;AAAA,oBACH,WAAW;AAAA,oBACX,GAAG;AAAA,kBACL,CAAC;AAAA,kBACD,UAAS;AAAA,kBACT,SAAQ;AAAA,kBACR;AAAA,kBACA;AAAA,kBACA;AAAA;AAAA,cACF;AAAA,cAGD;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,cAAc;AAAA,EAClB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;","names":["import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/Avatar.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts","../../../src/components/Show.tsx"],"sourcesContent":["import { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { avatar: AvatarIcon } = $cerberusIcons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\n}\n","import {\n Checkmark,\n CheckmarkOutline,\n ChevronDown,\n CloseFilled,\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 avatar?: 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 avatar: UserFilled,\n checkbox: CheckmarkIcon,\n close: CloseFilled,\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\ninterface CheckboxIconProps extends 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\ninterface IndeterminateIconProps extends 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","'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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAwB;AACxB,sBAAuB;AACvB,qBAGO;;;ACLP,mBAcO;;;ACQD;AAVC,SAAS,cAAc,OAA0B;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,GAAE;AAAA;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ;AAOO,SAAS,kBAAkB,OAA+B;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ,sDAAC,UAAK,MAAK,gBAAe,GAAE,qBAAoB;AAAA;AAAA,EAClD;AAEJ;;;AC9BM,IAAAA,sBAAA;AATC,SAAS,oBAAoB,OAAiC;AACnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,OAAO,MAAM,QAAQ;AAAA,MACrB,QAAQ,MAAM,QAAQ;AAAA,MACtB,SAAQ;AAAA,MAER;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,QAAO;AAAA,UACP,eAAc;AAAA,UACd,gBAAe;AAAA,UACf,aAAa;AAAA,UAEb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,aAAU;AAAA,gBAC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AGD;AAAA;AAAA,UACH;AAAA,UAGF;AAAA,YAAC;AAAA;AAAA,cACC,MAAM,QAAQ,EAAE;AAAA,cAChB,UACE;AAAA,gBAAC;AAAA;AAAA,kBACC,KAAK,MAAM;AAAA,kBACX,eAAW,gBAAI;AAAA,oBACb,GAAG;AAAA,oBACH,WAAW;AAAA,oBACX,GAAG;AAAA,kBACL,CAAC;AAAA,kBACD,UAAS;AAAA,kBACT,SAAQ;AAAA,kBACR;AAAA,kBACA;AAAA,kBACA;AAAA;AAAA,cACF;AAAA,cAGD;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,cAAc;AAAA,EAClB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;","names":["import_jsx_runtime","import_jsx_runtime"]}
@@ -198,10 +198,10 @@ var defaultIcons = {
198
198
  waitingFileUploader: import_icons.CloudUpload,
199
199
  fileUploader: AnimatingUploadIcon,
200
200
  indeterminate: IndeterminateIcon,
201
- infoNotification: import_icons.InformationFilled,
202
- successNotification: import_icons.CheckmarkFilled,
203
- warningNotification: import_icons.WarningFilled,
204
- dangerNotification: import_icons.ErrorFilled,
201
+ infoNotification: import_icons.Information,
202
+ successNotification: import_icons.CheckmarkOutline,
203
+ warningNotification: import_icons.WarningAlt,
204
+ dangerNotification: import_icons.WarningFilled,
205
205
  invalid: import_icons.WarningFilled,
206
206
  invalidAlt: import_icons.Warning,
207
207
  redo: import_icons.Restart,