@cerberus-design/react 0.9.1 → 0.9.2

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 (46) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +0 -9
  2. package/build/legacy/components/FileStatus.cjs +147 -46
  3. package/build/legacy/components/FileStatus.cjs.map +1 -1
  4. package/build/legacy/components/FileUploader.cjs +116 -16
  5. package/build/legacy/components/FileUploader.cjs.map +1 -1
  6. package/build/legacy/context/confirm-modal.cjs +136 -43
  7. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  8. package/build/legacy/context/prompt-modal.cjs +136 -43
  9. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  10. package/build/legacy/index.cjs +290 -259
  11. package/build/legacy/index.cjs.map +1 -1
  12. package/build/modern/_tsup-dts-rollup.d.ts +0 -9
  13. package/build/modern/{chunk-MLCVO7JP.js → chunk-DGJPW76I.js} +18 -18
  14. package/build/modern/chunk-DGJPW76I.js.map +1 -0
  15. package/build/modern/{chunk-KKJKOKP7.js → chunk-O6WHVUEW.js} +4 -4
  16. package/build/modern/{chunk-CZMC77YO.js → chunk-T7TOXGZT.js} +35 -10
  17. package/build/modern/chunk-T7TOXGZT.js.map +1 -0
  18. package/build/modern/{chunk-GB3SECCO.js → chunk-WWJRKSM5.js} +35 -10
  19. package/build/modern/chunk-WWJRKSM5.js.map +1 -0
  20. package/build/modern/{chunk-TUIVLIJI.js → chunk-XOVQGPIE.js} +16 -4
  21. package/build/modern/chunk-XOVQGPIE.js.map +1 -0
  22. package/build/modern/components/FileStatus.js +3 -1
  23. package/build/modern/components/FileUploader.js +2 -1
  24. package/build/modern/context/confirm-modal.js +3 -3
  25. package/build/modern/context/notification-center.js +2 -2
  26. package/build/modern/context/prompt-modal.js +3 -3
  27. package/build/modern/index.js +14 -18
  28. package/build/modern/index.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/components/FileStatus.tsx +17 -19
  31. package/src/components/FileUploader.tsx +12 -5
  32. package/src/context/confirm-modal.tsx +25 -12
  33. package/src/context/prompt-modal.tsx +25 -12
  34. package/src/index.ts +0 -1
  35. package/build/legacy/components/ModalIcon.cjs +0 -51
  36. package/build/legacy/components/ModalIcon.cjs.map +0 -1
  37. package/build/modern/chunk-CZMC77YO.js.map +0 -1
  38. package/build/modern/chunk-GB3SECCO.js.map +0 -1
  39. package/build/modern/chunk-MLCVO7JP.js.map +0 -1
  40. package/build/modern/chunk-TUIVLIJI.js.map +0 -1
  41. package/build/modern/chunk-VCR5C6Q3.js +0 -29
  42. package/build/modern/chunk-VCR5C6Q3.js.map +0 -1
  43. package/build/modern/components/ModalIcon.js +0 -7
  44. package/build/modern/components/ModalIcon.js.map +0 -1
  45. package/src/components/ModalIcon.tsx +0 -28
  46. /package/build/modern/{chunk-KKJKOKP7.js.map → chunk-O6WHVUEW.js.map} +0 -0
@@ -77,7 +77,6 @@ import { label } from '@cerberus/styled-system/recipes';
77
77
  import { MeasuringConfiguration } from '@dnd-kit/core';
78
78
  import { MeasuringFrequency } from '@dnd-kit/core';
79
79
  import { MeasuringStrategy } from '@dnd-kit/core';
80
- import { ModalIconVariantProps } from '@cerberus/styled-system/recipes';
81
80
  import { Modifier } from '@dnd-kit/core';
82
81
  import { Modifiers } from '@dnd-kit/core';
83
82
  import { MouseEvent as MouseEvent_2 } from 'react';
@@ -808,14 +807,6 @@ declare type ModalHeadingProps = HTMLAttributes<HTMLParagraphElement>;
808
807
  export { ModalHeadingProps }
809
808
  export { ModalHeadingProps as ModalHeadingProps_alias_1 }
810
809
 
811
- declare function ModalIcon(props: PropsWithChildren<ModalIconProps>): JSX_2.Element;
812
- export { ModalIcon }
813
- export { ModalIcon as ModalIcon_alias_1 }
814
-
815
- declare type ModalIconProps = HTMLAttributes<HTMLDivElement> & ModalIconVariantProps;
816
- export { ModalIconProps }
817
- export { ModalIconProps as ModalIconProps_alias_1 }
818
-
819
810
  /**
820
811
  * This module contains the Modal root component for a customizable modal.
821
812
  * @module
@@ -25,7 +25,7 @@ __export(FileStatus_exports, {
25
25
  processStatus: () => processStatus
26
26
  });
27
27
  module.exports = __toCommonJS(FileStatus_exports);
28
- var import_react2 = require("react");
28
+ var import_react3 = require("react");
29
29
 
30
30
  // src/components/ProgressBar.tsx
31
31
  var import_css = require("@cerberus/styled-system/css");
@@ -86,9 +86,9 @@ function IconButton(props) {
86
86
  }
87
87
 
88
88
  // src/components/FileStatus.tsx
89
- var import_recipes4 = require("@cerberus/styled-system/recipes");
90
- var import_css4 = require("@cerberus/styled-system/css");
91
- var import_patterns = require("@cerberus/styled-system/patterns");
89
+ var import_recipes5 = require("@cerberus/styled-system/recipes");
90
+ var import_css5 = require("@cerberus/styled-system/css");
91
+ var import_patterns2 = require("@cerberus/styled-system/patterns");
92
92
 
93
93
  // src/config/cerbIcons.ts
94
94
  var import_icons = require("@cerberus/icons");
@@ -196,8 +196,112 @@ function FieldMessage(props) {
196
196
  );
197
197
  }
198
198
 
199
- // src/components/FileStatus.tsx
199
+ // src/components/Avatar.tsx
200
+ var import_css4 = require("@cerberus/styled-system/css");
201
+ var import_patterns = require("@cerberus/styled-system/patterns");
202
+ var import_recipes4 = require("@cerberus/styled-system/recipes");
203
+
204
+ // src/components/Show.tsx
205
+ var import_react2 = require("react");
206
+ function Show(props) {
207
+ const { when, children, fallback } = props;
208
+ const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
209
+ return (0, import_react2.useMemo)(() => {
210
+ if (condition) return children;
211
+ return fallback ?? null;
212
+ }, [condition, children, fallback]);
213
+ }
214
+
215
+ // src/components/Avatar.tsx
200
216
  var import_jsx_runtime6 = require("react/jsx-runtime");
217
+ function Avatar(props) {
218
+ const {
219
+ ariaLabel,
220
+ as,
221
+ gradient,
222
+ size,
223
+ src,
224
+ width,
225
+ height,
226
+ icon,
227
+ ...nativeProps
228
+ } = props;
229
+ const { avatar: AvatarIcon } = $cerberusIcons;
230
+ const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
231
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
232
+ "div",
233
+ {
234
+ ...nativeProps,
235
+ className: (0, import_css4.cx)(
236
+ nativeProps.className,
237
+ (0, import_recipes4.avatar)({ gradient, size }),
238
+ (0, import_patterns.circle)()
239
+ ),
240
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
241
+ Show,
242
+ {
243
+ when: Boolean(src) || Boolean(as),
244
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
245
+ Show,
246
+ {
247
+ when: Boolean(initials),
248
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
249
+ Show,
250
+ {
251
+ when: Boolean(icon),
252
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
253
+ AvatarIcon,
254
+ {
255
+ size: iconSizeMap[size]
256
+ }
257
+ ),
258
+ children: icon
259
+ }
260
+ ),
261
+ children: initials
262
+ }
263
+ ),
264
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
265
+ Show,
266
+ {
267
+ when: Boolean(as),
268
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
269
+ "img",
270
+ {
271
+ alt: props.ariaLabel,
272
+ className: (0, import_css4.css)({
273
+ h: "full",
274
+ objectFit: "cover",
275
+ w: "full"
276
+ }),
277
+ decoding: "async",
278
+ loading: "lazy",
279
+ src,
280
+ height,
281
+ width
282
+ }
283
+ ),
284
+ children: as
285
+ }
286
+ )
287
+ }
288
+ )
289
+ }
290
+ );
291
+ }
292
+ var iconSizeMap = {
293
+ xs: 16,
294
+ sm: 16,
295
+ md: 20,
296
+ lg: 34,
297
+ xl: 32,
298
+ "2xl": 32,
299
+ "3xl": 32,
300
+ "4xl": 32
301
+ };
302
+
303
+ // src/components/FileStatus.tsx
304
+ var import_jsx_runtime7 = require("react/jsx-runtime");
201
305
  var processStatus = /* @__PURE__ */ ((processStatus2) => {
202
306
  processStatus2["TODO"] = "todo";
203
307
  processStatus2["PROCESSING"] = "processing";
@@ -207,24 +311,24 @@ var processStatus = /* @__PURE__ */ ((processStatus2) => {
207
311
  })(processStatus || {});
208
312
  function FileStatus(props) {
209
313
  const { file, now, status, onClick, ...nativeProps } = props;
210
- const actionLabel = (0, import_react2.useMemo)(() => getStatusActionLabel(status), [status]);
211
- const palette = (0, import_react2.useMemo)(() => getPalette(status), [status]);
212
- const modalIconPalette = (0, import_react2.useMemo)(() => getModalIconPalette(status), [status]);
213
- const styles = (0, import_react2.useMemo)(() => {
314
+ const actionLabel = (0, import_react3.useMemo)(() => getStatusActionLabel(status), [status]);
315
+ const palette = (0, import_react3.useMemo)(() => getPalette(status), [status]);
316
+ const modalIconPalette = (0, import_react3.useMemo)(() => getModalIconPalette(status), [status]);
317
+ const styles = (0, import_react3.useMemo)(() => {
214
318
  switch (status) {
215
319
  case "todo" /* TODO */:
216
- return (0, import_recipes4.fileStatus)({ status: "todo" });
320
+ return (0, import_recipes5.fileStatus)({ status: "todo" });
217
321
  case "processing" /* PROCESSING */:
218
- return (0, import_recipes4.fileStatus)({ status: "processing" });
322
+ return (0, import_recipes5.fileStatus)({ status: "processing" });
219
323
  case "done" /* DONE */:
220
- return (0, import_recipes4.fileStatus)({ status: "done" });
324
+ return (0, import_recipes5.fileStatus)({ status: "done" });
221
325
  case "error" /* ERROR */:
222
- return (0, import_recipes4.fileStatus)({ status: "error" });
326
+ return (0, import_recipes5.fileStatus)({ status: "error" });
223
327
  default:
224
- return (0, import_recipes4.fileStatus)();
328
+ return (0, import_recipes5.fileStatus)();
225
329
  }
226
330
  }, [status]);
227
- const handleClick = (0, import_react2.useCallback)(
331
+ const handleClick = (0, import_react3.useCallback)(
228
332
  (e) => {
229
333
  const actionStatus = getStatusActionLabel(
230
334
  status
@@ -233,65 +337,62 @@ function FileStatus(props) {
233
337
  },
234
338
  [onClick]
235
339
  );
236
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
340
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
237
341
  "div",
238
342
  {
239
343
  ...nativeProps,
240
- className: (0, import_css4.cx)(nativeProps.className, styles.root, (0, import_patterns.hstack)()),
344
+ className: (0, import_css5.cx)(nativeProps.className, styles.root, (0, import_patterns2.hstack)()),
241
345
  children: [
242
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
243
- "div",
346
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
347
+ Avatar,
244
348
  {
245
- className: (0, import_css4.cx)(
246
- styles.icon,
247
- (0, import_patterns.circle)({
248
- size: "2rem"
249
- })
250
- ),
251
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MatchFileStatusIcon, { status })
349
+ ariaLabel: "",
350
+ gradient: modalIconPalette,
351
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MatchFileStatusIcon, { size: 24, status }),
352
+ src: ""
252
353
  }
253
354
  ),
254
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
355
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
255
356
  "div",
256
357
  {
257
- className: (0, import_patterns.vstack)({
358
+ className: (0, import_patterns2.vstack)({
258
359
  alignItems: "flex-start",
259
360
  gap: "0.12rem",
260
361
  w: "full"
261
362
  }),
262
363
  children: [
263
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
364
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
264
365
  "small",
265
366
  {
266
- className: (0, import_css4.css)({
367
+ className: (0, import_css5.css)({
267
368
  color: "page.text.initial",
268
369
  textStyle: "label-sm"
269
370
  }),
270
371
  children: file
271
372
  }
272
373
  ),
273
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ProgressBar, { now, size: "sm" }),
274
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { invalid: modalIconPalette === "danger", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
374
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProgressBar, { now, size: "sm" }),
375
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { invalid: modalIconPalette === "red", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
275
376
  FieldMessage,
276
377
  {
277
- className: (0, import_css4.css)({
378
+ className: (0, import_css5.css)({
278
379
  color: "page.text.100"
279
380
  }),
280
381
  id: `help:${file}`,
281
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MatchFileStatusText, { status, now })
382
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MatchFileStatusText, { status, now })
282
383
  }
283
384
  ) })
284
385
  ]
285
386
  }
286
387
  ),
287
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
388
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
288
389
  IconButton,
289
390
  {
290
391
  ariaLabel: actionLabel,
291
392
  onClick: handleClick,
292
393
  palette,
293
394
  size: "sm",
294
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MatchStatusAction, { status })
395
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MatchStatusAction, { status })
295
396
  }
296
397
  )
297
398
  ]
@@ -307,11 +408,11 @@ function MatchFileStatusIcon(props) {
307
408
  switch (props.status) {
308
409
  case "todo" /* TODO */:
309
410
  case "processing" /* PROCESSING */:
310
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FileUploaderIcon, {});
411
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FileUploaderIcon, { size: props.size });
311
412
  case "done" /* DONE */:
312
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DoneIcon, {});
413
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DoneIcon, { size: props.size });
313
414
  case "error" /* ERROR */:
314
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InvalidIcon, {});
415
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InvalidIcon, { size: props.size });
315
416
  default:
316
417
  throw new Error("Unknown status");
317
418
  }
@@ -335,11 +436,11 @@ function MatchStatusAction(props) {
335
436
  switch (props.status) {
336
437
  case "todo" /* TODO */:
337
438
  case "processing" /* PROCESSING */:
338
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CloseIcon, {});
439
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon, {});
339
440
  case "error" /* ERROR */:
340
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RedoIcon, {});
441
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RedoIcon, {});
341
442
  case "done" /* DONE */:
342
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TrashIcon, {});
443
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TrashIcon, {});
343
444
  default:
344
445
  throw new Error("Invalid status");
345
446
  }
@@ -374,13 +475,13 @@ function getModalIconPalette(status) {
374
475
  switch (status) {
375
476
  case "todo" /* TODO */:
376
477
  case "processing" /* PROCESSING */:
377
- return "action";
478
+ return "light-purple";
378
479
  case "error" /* ERROR */:
379
- return "danger";
480
+ return "red";
380
481
  case "done" /* DONE */:
381
- return "success";
482
+ return "green";
382
483
  default:
383
- return "action";
484
+ return "light-purple";
384
485
  }
385
486
  }
386
487
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/FileStatus.tsx","../../../src/components/ProgressBar.tsx","../../../src/components/IconButton.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/config/defineIcons.ts","../../../src/components/FieldMessage.tsx","../../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useMemo,\n type HTMLAttributes,\n type MouseEvent,\n} from 'react'\nimport { ProgressBar } from './ProgressBar'\nimport { IconButton } from './IconButton'\nimport {\n fileStatus,\n type FileStatusVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { circle, hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { FieldMessage } from './FieldMessage'\nimport { Field } from '../context/field'\n\n/**\n * This module contains the FileStatus component.\n * @module\n */\n\nexport type FileStatusKey = (typeof processStatus)[keyof typeof processStatus]\nexport type FileStatusActions = 'cancel' | 'retry' | 'delete'\nexport interface FileBaseStatusProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {\n file: string\n now: number\n status: processStatus\n onClick: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type FileStatusProps = FileBaseStatusProps & FileStatusVariantProps\n\n/**\n * A helper object to represent the status of a file.\n * @example\n * ```tsx\n * import { fileStatus } from '@cerberus/react'\n * processStatus.TODO // 'todo'\n * ```\n */\nexport const enum processStatus {\n TODO = 'todo',\n PROCESSING = 'processing',\n DONE = 'done',\n ERROR = 'error',\n}\n\n/**\n * This component displays the status of a file.\n * @param props - {\n * file: string,\n * now: number,\n * status: keyof typeof fileStatus,\n * action: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n * }.\n * @example\n * ```tsx\n * <FileStatus file=\"file.txt\" now={0} status={processStatus.TODO} action={(status, e) => console.log(status, e)} />\n * ```\n */\nexport function FileStatus(props: FileStatusProps) {\n const { file, now, status, onClick, ...nativeProps } = props\n const actionLabel = useMemo(() => getStatusActionLabel(status), [status])\n const palette = useMemo(() => getPalette(status), [status])\n const modalIconPalette = useMemo(() => getModalIconPalette(status), [status])\n const styles = useMemo(() => {\n switch (status) {\n case processStatus.TODO:\n return fileStatus({ status: 'todo' })\n case processStatus.PROCESSING:\n return fileStatus({ status: 'processing' })\n case processStatus.DONE:\n return fileStatus({ status: 'done' })\n case processStatus.ERROR:\n return fileStatus({ status: 'error' })\n default:\n return fileStatus()\n }\n }, [status])\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const actionStatus = getStatusActionLabel(\n status,\n ).toLocaleLowerCase() as FileStatusActions\n onClick(actionStatus, e)\n },\n [onClick],\n )\n\n return (\n <div\n {...nativeProps}\n className={cx(nativeProps.className, styles.root, hstack())}\n >\n <div\n className={cx(\n styles.icon,\n circle({\n size: '2rem',\n }),\n )}\n >\n <MatchFileStatusIcon status={status} />\n </div>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0.12rem',\n w: 'full',\n })}\n >\n <small\n className={css({\n color: 'page.text.initial',\n textStyle: 'label-sm',\n })}\n >\n {file}\n </small>\n <ProgressBar now={now} size=\"sm\" />\n <Field invalid={modalIconPalette === 'danger'}>\n <FieldMessage\n className={css({\n color: 'page.text.100',\n })}\n id={`help:${file}`}\n >\n <MatchFileStatusText status={status} now={now} />\n </FieldMessage>\n </Field>\n </div>\n\n <IconButton\n ariaLabel={actionLabel}\n onClick={handleClick}\n palette={palette}\n size=\"sm\"\n >\n <MatchStatusAction status={status} />\n </IconButton>\n </div>\n )\n}\n\ninterface FileStatusElProps {\n status: FileStatusProps['status']\n now?: number\n}\n\nfunction MatchFileStatusIcon(props: FileStatusElProps) {\n const {\n fileUploader: FileUploaderIcon,\n invalidAlt: InvalidIcon,\n successNotification: DoneIcon,\n } = $cerberusIcons\n\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <FileUploaderIcon />\n case processStatus.DONE:\n return <DoneIcon />\n case processStatus.ERROR:\n return <InvalidIcon />\n default:\n throw new Error('Unknown status')\n }\n}\n\nfunction MatchFileStatusText(props: FileStatusElProps) {\n switch (props.status) {\n case processStatus.TODO:\n return 'Waiting to upload'\n case processStatus.PROCESSING:\n return `${props.now}% Complete`\n case processStatus.DONE:\n return 'File uploaded successfully'\n case processStatus.ERROR:\n return 'There was an error uploading the file'\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction MatchStatusAction(props: FileStatusElProps) {\n const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = $cerberusIcons\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <CloseIcon />\n case processStatus.ERROR:\n return <RedoIcon />\n case processStatus.DONE:\n return <TrashIcon />\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction getStatusActionLabel(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'Cancel'\n case processStatus.ERROR:\n return 'Retry'\n case processStatus.DONE:\n return 'Delete'\n default:\n return ''\n }\n}\n\nfunction getPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'danger'\n case processStatus.ERROR:\n return 'action'\n case processStatus.DONE:\n return 'danger'\n default:\n return 'action'\n }\n}\n\nfunction getModalIconPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'action'\n case processStatus.ERROR:\n return 'danger'\n case processStatus.DONE:\n return 'success'\n default:\n return 'action'\n }\n}\n","import { cx } from '@cerberus/styled-system/css'\nimport {\n progressBar,\n type ProgressBarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ProgressBar component.\n * @module\n */\n\nexport interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {}\nexport type NonIndeterminateProgressBarProps = {\n indeterminate?: never\n now: number\n}\nexport type IndeterminateProgressBarProps = {\n indeterminate: true\n now?: never\n}\nexport type ProgressBarProps = ProgressBarBaseProps &\n ProgressBarVariantProps &\n (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps)\n\n/**\n * The ProgressBar component is used to display the progress of a task.\n * @param props - HTML div element attributes\n * @param props.now - The current value of the progress bar\n * @param props.indeterminate - Whether the progress bar is indeterminate\n * @example\n * ```tsx\n * <ProgressBar value={75} />\n * ```\n */\nexport function ProgressBar(props: ProgressBarProps) {\n const { indeterminate, size, usage, now, ...nativeProps } = props\n const styles = progressBar({ size, usage })\n const nowClamped = Math.min(100, Math.max(0, now || 0))\n const width = {\n width: indeterminate ? '50%' : `${nowClamped}%`,\n }\n\n return (\n <div\n {...nativeProps}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={indeterminate ? 0 : nowClamped}\n className={cx(nativeProps.className, styles.root)}\n role=\"meter\"\n >\n <div\n {...(indeterminate && { 'data-indeterminate': true })}\n data-complete={nowClamped === 100}\n className={styles.bar}\n style={width}\n />\n </div>\n )\n}\n","import type { ButtonHTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\nimport type { Positions } from '../types'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n tooltipPosition?: Positions\n}\nexport type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>\nexport type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/IconButton.tsx\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n data-tooltip\n data-position={props.tooltipPosition ?? 'top'}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\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'\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 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 fileUploader: CloudUpload,\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 { 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 type { HTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { fieldMessage } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the FieldMessage component.\n * @module\n */\n\nexport type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>\nexport interface FieldMessageBaseProps\n extends HTMLAttributes<HTMLParagraphElement> {\n id: string\n}\nexport type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe\n\n/**\n * A component that provides feedback about the field.\n * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)\n * @example\n * ```tsx\n * <Field>\n * <Label htmlFor=\"first_name\">First Name</Label>\n * <Input aria-describedBy=\"help:first_name\" id=\"first_name\" type=\"text\" />\n * <FieldMessage id=\"help:first_name\">\n * This will only be used in your account information.\n * </FieldMessage>\n * </Field>\n * ```\n */\nexport function FieldMessage(props: FieldMessageProps) {\n const { invalid } = useFieldContext()\n return (\n <small\n {...props}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(props.className, fieldMessage())}\n />\n )\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAKO;;;ACPP,iBAAmB;AACnB,qBAGO;AAgDD;AAjBC,SAAS,YAAY,OAAyB;AACnD,QAAM,EAAE,eAAe,MAAM,OAAO,KAAK,GAAG,YAAY,IAAI;AAC5D,QAAM,aAAS,4BAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,QAAM,aAAa,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC;AACtD,QAAM,QAAQ;AAAA,IACZ,OAAO,gBAAgB,QAAQ,GAAG,UAAU;AAAA,EAC9C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe,gBAAgB,IAAI;AAAA,MACnC,eAAW,eAAG,YAAY,WAAW,OAAO,IAAI;AAAA,MAChD,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACE,GAAI,iBAAiB,EAAE,sBAAsB,KAAK;AAAA,UACnD,iBAAe,eAAe;AAAA,UAC9B,WAAW,OAAO;AAAA,UAClB,OAAO;AAAA;AAAA,MACT;AAAA;AAAA,EACF;AAEJ;;;AC3DA,IAAAC,cAA4C;AAC5C,IAAAC,kBAA2B;AAuBvB,IAAAC,sBAAA;AAHG,SAAS,WAAW,OAAqC;AAC9D,QAAM,EAAE,WAAW,SAAS,OAAO,MAAM,GAAG,YAAY,IAAI;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,gBAAY;AAAA,MACZ,iBAAe,MAAM,mBAAmB;AAAA,MACxC,cAAY,aAAa;AAAA,MACzB,eAAW;AAAA,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AA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,WAAW,QAAuB;AACzC,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,oBAAoB,QAAuB;AAClD,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["import_react","import_css","import_recipes","import_jsx_runtime","import_recipes","import_css","import_jsx_runtime","import_css","import_recipes","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","processStatus"]}
1
+ {"version":3,"sources":["../../../src/components/FileStatus.tsx","../../../src/components/ProgressBar.tsx","../../../src/components/IconButton.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/config/defineIcons.ts","../../../src/components/FieldMessage.tsx","../../../src/context/field.tsx","../../../src/components/Avatar.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useMemo,\n type HTMLAttributes,\n type MouseEvent,\n} from 'react'\nimport { ProgressBar } from './ProgressBar'\nimport { IconButton } from './IconButton'\nimport {\n fileStatus,\n type FileStatusVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { FieldMessage } from './FieldMessage'\nimport { Field } from '../context/field'\nimport { Avatar } from './Avatar'\n\n/**\n * This module contains the FileStatus component.\n * @module\n */\n\nexport type FileStatusKey = (typeof processStatus)[keyof typeof processStatus]\nexport type FileStatusActions = 'cancel' | 'retry' | 'delete'\nexport interface FileBaseStatusProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {\n file: string\n now: number\n status: processStatus\n onClick: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type FileStatusProps = FileBaseStatusProps & FileStatusVariantProps\n\n/**\n * A helper object to represent the status of a file.\n * @example\n * ```tsx\n * import { fileStatus } from '@cerberus/react'\n * processStatus.TODO // 'todo'\n * ```\n */\nexport const enum processStatus {\n TODO = 'todo',\n PROCESSING = 'processing',\n DONE = 'done',\n ERROR = 'error',\n}\n\n/**\n * This component displays the status of a file.\n * @param props - {\n * file: string,\n * now: number,\n * status: keyof typeof fileStatus,\n * action: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n * }.\n * @example\n * ```tsx\n * <FileStatus file=\"file.txt\" now={0} status={processStatus.TODO} action={(status, e) => console.log(status, e)} />\n * ```\n */\nexport function FileStatus(props: FileStatusProps) {\n const { file, now, status, onClick, ...nativeProps } = props\n const actionLabel = useMemo(() => getStatusActionLabel(status), [status])\n const palette = useMemo(() => getPalette(status), [status])\n const modalIconPalette = useMemo(() => getModalIconPalette(status), [status])\n const styles = useMemo(() => {\n switch (status) {\n case processStatus.TODO:\n return fileStatus({ status: 'todo' })\n case processStatus.PROCESSING:\n return fileStatus({ status: 'processing' })\n case processStatus.DONE:\n return fileStatus({ status: 'done' })\n case processStatus.ERROR:\n return fileStatus({ status: 'error' })\n default:\n return fileStatus()\n }\n }, [status])\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const actionStatus = getStatusActionLabel(\n status,\n ).toLocaleLowerCase() as FileStatusActions\n onClick(actionStatus, e)\n },\n [onClick],\n )\n\n return (\n <div\n {...nativeProps}\n className={cx(nativeProps.className, styles.root, hstack())}\n >\n <Avatar\n ariaLabel=\"\"\n gradient={modalIconPalette}\n icon={<MatchFileStatusIcon size={24} status={status} />}\n src=\"\"\n />\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0.12rem',\n w: 'full',\n })}\n >\n <small\n className={css({\n color: 'page.text.initial',\n textStyle: 'label-sm',\n })}\n >\n {file}\n </small>\n <ProgressBar now={now} size=\"sm\" />\n <Field invalid={modalIconPalette === 'red'}>\n <FieldMessage\n className={css({\n color: 'page.text.100',\n })}\n id={`help:${file}`}\n >\n <MatchFileStatusText status={status} now={now} />\n </FieldMessage>\n </Field>\n </div>\n\n <IconButton\n ariaLabel={actionLabel}\n onClick={handleClick}\n palette={palette}\n size=\"sm\"\n >\n <MatchStatusAction status={status} />\n </IconButton>\n </div>\n )\n}\n\ninterface FileStatusElProps {\n status: FileStatusProps['status']\n size?: 16 | 20 | 24 | 32\n now?: number\n}\n\nfunction MatchFileStatusIcon(props: FileStatusElProps) {\n const {\n fileUploader: FileUploaderIcon,\n invalidAlt: InvalidIcon,\n successNotification: DoneIcon,\n } = $cerberusIcons\n\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <FileUploaderIcon size={props.size} />\n case processStatus.DONE:\n return <DoneIcon size={props.size} />\n case processStatus.ERROR:\n return <InvalidIcon size={props.size} />\n default:\n throw new Error('Unknown status')\n }\n}\n\nfunction MatchFileStatusText(props: FileStatusElProps) {\n switch (props.status) {\n case processStatus.TODO:\n return 'Waiting to upload'\n case processStatus.PROCESSING:\n return `${props.now}% Complete`\n case processStatus.DONE:\n return 'File uploaded successfully'\n case processStatus.ERROR:\n return 'There was an error uploading the file'\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction MatchStatusAction(props: FileStatusElProps) {\n const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = $cerberusIcons\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <CloseIcon />\n case processStatus.ERROR:\n return <RedoIcon />\n case processStatus.DONE:\n return <TrashIcon />\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction getStatusActionLabel(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'Cancel'\n case processStatus.ERROR:\n return 'Retry'\n case processStatus.DONE:\n return 'Delete'\n default:\n return ''\n }\n}\n\nfunction getPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'danger'\n case processStatus.ERROR:\n return 'action'\n case processStatus.DONE:\n return 'danger'\n default:\n return 'action'\n }\n}\n\nfunction getModalIconPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'light-purple'\n case processStatus.ERROR:\n return 'red'\n case processStatus.DONE:\n return 'green'\n default:\n return 'light-purple'\n }\n}\n","import { cx } from '@cerberus/styled-system/css'\nimport {\n progressBar,\n type ProgressBarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ProgressBar component.\n * @module\n */\n\nexport interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {}\nexport type NonIndeterminateProgressBarProps = {\n indeterminate?: never\n now: number\n}\nexport type IndeterminateProgressBarProps = {\n indeterminate: true\n now?: never\n}\nexport type ProgressBarProps = ProgressBarBaseProps &\n ProgressBarVariantProps &\n (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps)\n\n/**\n * The ProgressBar component is used to display the progress of a task.\n * @param props - HTML div element attributes\n * @param props.now - The current value of the progress bar\n * @param props.indeterminate - Whether the progress bar is indeterminate\n * @example\n * ```tsx\n * <ProgressBar value={75} />\n * ```\n */\nexport function ProgressBar(props: ProgressBarProps) {\n const { indeterminate, size, usage, now, ...nativeProps } = props\n const styles = progressBar({ size, usage })\n const nowClamped = Math.min(100, Math.max(0, now || 0))\n const width = {\n width: indeterminate ? '50%' : `${nowClamped}%`,\n }\n\n return (\n <div\n {...nativeProps}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={indeterminate ? 0 : nowClamped}\n className={cx(nativeProps.className, styles.root)}\n role=\"meter\"\n >\n <div\n {...(indeterminate && { 'data-indeterminate': true })}\n data-complete={nowClamped === 100}\n className={styles.bar}\n style={width}\n />\n </div>\n )\n}\n","import type { ButtonHTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\nimport type { Positions } from '../types'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n tooltipPosition?: Positions\n}\nexport type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>\nexport type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/IconButton.tsx\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n data-tooltip\n data-position={props.tooltipPosition ?? 'top'}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\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'\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 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 fileUploader: CloudUpload,\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 { 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 type { HTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { fieldMessage } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the FieldMessage component.\n * @module\n */\n\nexport type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>\nexport interface FieldMessageBaseProps\n extends HTMLAttributes<HTMLParagraphElement> {\n id: string\n}\nexport type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe\n\n/**\n * A component that provides feedback about the field.\n * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)\n * @example\n * ```tsx\n * <Field>\n * <Label htmlFor=\"first_name\">First Name</Label>\n * <Input aria-describedBy=\"help:first_name\" id=\"first_name\" type=\"text\" />\n * <FieldMessage id=\"help:first_name\">\n * This will only be used in your account information.\n * </FieldMessage>\n * </Field>\n * ```\n */\nexport function FieldMessage(props: FieldMessageProps) {\n const { invalid } = useFieldContext()\n return (\n <small\n {...props}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(props.className, fieldMessage())}\n />\n )\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\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 icon?: ReactNode\n width?: number\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n ariaLabel: string\n as?: never\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n as: ReactNode\n ariaLabel?: never\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 * @definition [Avatar docs](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\nexport interface ShowProps {\n when: boolean | null | undefined\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render its children or an optional fallback component\n * based on the SolidJS component.\n * @definition [Show docs](https://cerberus.digitalu.design/react/show)\n * @example\n * ```tsx\n * <Show when={condition}>\n * <div>Content</div>\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;AAEA,IAAAA,gBAKO;;;ACPP,iBAAmB;AACnB,qBAGO;AAgDD;AAjBC,SAAS,YAAY,OAAyB;AACnD,QAAM,EAAE,eAAe,MAAM,OAAO,KAAK,GAAG,YAAY,IAAI;AAC5D,QAAM,aAAS,4BAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,QAAM,aAAa,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC;AACtD,QAAM,QAAQ;AAAA,IACZ,OAAO,gBAAgB,QAAQ,GAAG,UAAU;AAAA,EAC9C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe,gB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AAA,EACX;AACF;AAEA,SAAS,WAAW,QAAuB;AACzC,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,oBAAoB,QAAuB;AAClD,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["import_react","import_css","import_recipes","import_jsx_runtime","import_recipes","import_css","import_patterns","import_jsx_runtime","import_css","import_recipes","import_jsx_runtime","import_jsx_runtime","import_css","import_recipes","import_react","import_jsx_runtime","import_jsx_runtime","processStatus"]}
@@ -24,8 +24,8 @@ __export(FileUploader_exports, {
24
24
  FileUploader: () => FileUploader
25
25
  });
26
26
  module.exports = __toCommonJS(FileUploader_exports);
27
- var import_css = require("@cerberus/styled-system/css");
28
- var import_patterns = require("@cerberus/styled-system/patterns");
27
+ var import_css2 = require("@cerberus/styled-system/css");
28
+ var import_patterns2 = require("@cerberus/styled-system/patterns");
29
29
 
30
30
  // src/components/Show.tsx
31
31
  var import_react = require("react");
@@ -39,7 +39,7 @@ function Show(props) {
39
39
  }
40
40
 
41
41
  // src/components/FileUploader.tsx
42
- var import_recipes = require("@cerberus/styled-system/recipes");
42
+ var import_recipes2 = require("@cerberus/styled-system/recipes");
43
43
 
44
44
  // src/config/cerbIcons.ts
45
45
  var import_icons = require("@cerberus/icons");
@@ -105,44 +105,144 @@ var defaultIcons = {
105
105
  // src/config/defineIcons.ts
106
106
  var $cerberusIcons = defaultIcons;
107
107
 
108
- // src/components/FileUploader.tsx
108
+ // src/components/Avatar.tsx
109
+ var import_css = require("@cerberus/styled-system/css");
110
+ var import_patterns = require("@cerberus/styled-system/patterns");
111
+ var import_recipes = require("@cerberus/styled-system/recipes");
109
112
  var import_jsx_runtime2 = require("react/jsx-runtime");
113
+ function Avatar(props) {
114
+ const {
115
+ ariaLabel,
116
+ as,
117
+ gradient,
118
+ size,
119
+ src,
120
+ width,
121
+ height,
122
+ icon,
123
+ ...nativeProps
124
+ } = props;
125
+ const { avatar: AvatarIcon } = $cerberusIcons;
126
+ const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
127
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
128
+ "div",
129
+ {
130
+ ...nativeProps,
131
+ className: (0, import_css.cx)(
132
+ nativeProps.className,
133
+ (0, import_recipes.avatar)({ gradient, size }),
134
+ (0, import_patterns.circle)()
135
+ ),
136
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
137
+ Show,
138
+ {
139
+ when: Boolean(src) || Boolean(as),
140
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
141
+ Show,
142
+ {
143
+ when: Boolean(initials),
144
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
145
+ Show,
146
+ {
147
+ when: Boolean(icon),
148
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
149
+ AvatarIcon,
150
+ {
151
+ size: iconSizeMap[size]
152
+ }
153
+ ),
154
+ children: icon
155
+ }
156
+ ),
157
+ children: initials
158
+ }
159
+ ),
160
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
161
+ Show,
162
+ {
163
+ when: Boolean(as),
164
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
165
+ "img",
166
+ {
167
+ alt: props.ariaLabel,
168
+ className: (0, import_css.css)({
169
+ h: "full",
170
+ objectFit: "cover",
171
+ w: "full"
172
+ }),
173
+ decoding: "async",
174
+ loading: "lazy",
175
+ src,
176
+ height,
177
+ width
178
+ }
179
+ ),
180
+ children: as
181
+ }
182
+ )
183
+ }
184
+ )
185
+ }
186
+ );
187
+ }
188
+ var iconSizeMap = {
189
+ xs: 16,
190
+ sm: 16,
191
+ md: 20,
192
+ lg: 34,
193
+ xl: 32,
194
+ "2xl": 32,
195
+ "3xl": 32,
196
+ "4xl": 32
197
+ };
198
+
199
+ // src/components/FileUploader.tsx
200
+ var import_jsx_runtime3 = require("react/jsx-runtime");
110
201
  function FileUploader(props) {
111
202
  var _a;
112
- const styles = (0, import_recipes.fileUploader)();
203
+ const styles = (0, import_recipes2.fileUploader)();
113
204
  const Icon = $cerberusIcons.fileUploader;
114
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
205
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
115
206
  "div",
116
207
  {
117
- className: (0, import_css.cx)(
118
- (0, import_patterns.vstack)({
208
+ className: (0, import_css2.cx)(
209
+ (0, import_patterns2.vstack)({
119
210
  justify: "center"
120
211
  }),
121
212
  styles.container
122
213
  ),
123
214
  children: [
124
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: (0, import_css.cx)(styles.icon, (0, import_recipes.modalIcon)(), (0, import_patterns.circle)()), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, {}) }),
125
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
215
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
216
+ Avatar,
217
+ {
218
+ gradient: "light-purple",
219
+ ariaLabel: "",
220
+ icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, {}),
221
+ size: "md",
222
+ src: ""
223
+ }
224
+ ) }),
225
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
126
226
  "label",
127
227
  {
128
- className: (0, import_css.cx)(
129
- (0, import_patterns.vstack)({
228
+ className: (0, import_css2.cx)(
229
+ (0, import_patterns2.vstack)({
130
230
  justify: "center"
131
231
  }),
132
232
  styles.label
133
233
  ),
134
234
  htmlFor: props.name,
135
235
  children: [
136
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: Boolean(props.heading), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: styles.heading, children: props.heading }) }),
236
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: Boolean(props.heading), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: styles.heading, children: props.heading }) }),
137
237
  "Import ",
138
238
  (_a = props.accept) == null ? void 0 : _a.replace(",", ", "),
139
239
  " files",
140
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: styles.description, children: "Click to select files" }),
141
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
240
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: styles.description, children: "Click to select files" }),
241
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
142
242
  "input",
143
243
  {
144
244
  ...props,
145
- className: (0, import_css.cx)(props.className, styles.input),
245
+ className: (0, import_css2.cx)(props.className, styles.input),
146
246
  type: "file"
147
247
  }
148
248
  )