@cerberus-design/react 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/_tsup-dts-rollup.d.cts +374 -80
- package/build/legacy/components/Accordion.cjs +4 -187
- package/build/legacy/components/Accordion.cjs.map +1 -1
- package/build/legacy/components/Accordion.client.cjs +64 -0
- package/build/legacy/components/Accordion.client.cjs.map +1 -0
- package/build/legacy/components/AccordionItemGroup.cjs +41 -185
- package/build/legacy/components/AccordionItemGroup.cjs.map +1 -1
- package/build/legacy/components/Admonition.cjs +89 -239
- package/build/legacy/components/Admonition.cjs.map +1 -1
- package/build/legacy/components/Admonition.client.cjs +219 -0
- package/build/legacy/components/Admonition.client.cjs.map +1 -0
- package/build/legacy/components/AnimatingUploadIcon.cjs.map +1 -1
- package/build/legacy/components/Avatar.cjs +23 -174
- package/build/legacy/components/Avatar.cjs.map +1 -1
- package/build/legacy/components/Checkbox.cjs +22 -168
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/DatePicker.client.cjs +129 -272
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/components/DatePicker.server.cjs +17 -271
- package/build/legacy/components/DatePicker.server.cjs.map +1 -1
- package/build/legacy/components/Dialog.cjs +86 -0
- package/build/legacy/components/Dialog.cjs.map +1 -0
- package/build/legacy/components/Dialog.client.cjs +95 -0
- package/build/legacy/components/Dialog.client.cjs.map +1 -0
- package/build/legacy/components/FileStatus.cjs +62 -212
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs +29 -180
- package/build/legacy/components/FileUploader.cjs.map +1 -1
- package/build/legacy/components/Input.cjs +20 -172
- package/build/legacy/components/Input.cjs.map +1 -1
- package/build/legacy/components/Modal.cjs.map +1 -1
- package/build/legacy/components/ModalDescription.cjs.map +1 -1
- package/build/legacy/components/ModalHeader.cjs.map +1 -1
- package/build/legacy/components/ModalHeading.cjs.map +1 -1
- package/build/legacy/components/Notification.cjs +26 -176
- package/build/legacy/components/Notification.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +26 -178
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Tag.cjs +16 -167
- package/build/legacy/components/Tag.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs +20 -172
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/config/defineIcons.cjs +3 -39
- package/build/legacy/config/defineIcons.cjs.map +1 -1
- package/build/legacy/config/{cerbIcons.cjs → index.cjs} +22 -29
- package/build/legacy/config/index.cjs.map +1 -0
- package/build/legacy/config/types.cjs +19 -0
- package/build/legacy/config/types.cjs.map +1 -0
- package/build/legacy/context/cerberus.cjs +46 -0
- package/build/legacy/context/cerberus.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +105 -321
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +137 -336
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/notification-center/store.cjs +66 -0
- package/build/legacy/context/notification-center/store.cjs.map +1 -0
- package/build/legacy/context/notification-center/types.cjs +19 -0
- package/build/legacy/context/notification-center/types.cjs.map +1 -0
- package/build/legacy/context/notification-center.cjs +142 -249
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +185 -388
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +1577 -1456
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +374 -80
- package/build/modern/{chunk-BVCXVZAF.js → chunk-25HMVHLT.js} +6 -5
- package/build/modern/chunk-25HMVHLT.js.map +1 -0
- package/build/modern/chunk-36N4527B.js +1 -0
- package/build/modern/chunk-5EWCH7AI.js +82 -0
- package/build/modern/chunk-5EWCH7AI.js.map +1 -0
- package/build/modern/chunk-5SNLQZYP.js +25 -0
- package/build/modern/chunk-5SNLQZYP.js.map +1 -0
- package/build/modern/chunk-6BN3XKQF.js +42 -0
- package/build/modern/chunk-6BN3XKQF.js.map +1 -0
- package/build/modern/{chunk-2UXE5PDG.js → chunk-7NN3SJ7W.js} +1 -1
- package/build/modern/chunk-7NN3SJ7W.js.map +1 -0
- package/build/modern/{chunk-KWJ5FKX7.js → chunk-BAWZBF5Q.js} +5 -3
- package/build/modern/chunk-BAWZBF5Q.js.map +1 -0
- package/build/modern/{chunk-6BH5J5GF.js → chunk-BHB56M7S.js} +31 -46
- package/build/modern/chunk-BHB56M7S.js.map +1 -0
- package/build/modern/{chunk-HKJMLWVP.js → chunk-EDARV2EI.js} +5 -4
- package/build/modern/chunk-EDARV2EI.js.map +1 -0
- package/build/modern/{chunk-5OVH3INN.js → chunk-FGCO27TC.js} +25 -53
- package/build/modern/chunk-FGCO27TC.js.map +1 -0
- package/build/modern/{chunk-PVIMOXSO.js → chunk-GCQMH4QA.js} +5 -4
- package/build/modern/chunk-GCQMH4QA.js.map +1 -0
- package/build/modern/chunk-GITT5645.js +20 -0
- package/build/modern/chunk-GITT5645.js.map +1 -0
- package/build/modern/{chunk-TJCFYL5W.js → chunk-IGHMP4WA.js} +1 -20
- package/build/modern/chunk-IGHMP4WA.js.map +1 -0
- package/build/modern/chunk-ISCJ542I.js +82 -0
- package/build/modern/chunk-ISCJ542I.js.map +1 -0
- package/build/modern/{chunk-HVKM54BA.js → chunk-IW3LIRDG.js} +1 -1
- package/build/modern/chunk-IW3LIRDG.js.map +1 -0
- package/build/modern/chunk-JAROS4Q3.js +180 -0
- package/build/modern/chunk-JAROS4Q3.js.map +1 -0
- package/build/modern/{chunk-BE4EOU2P.js → chunk-JIRW4XOJ.js} +1 -1
- package/build/modern/chunk-JIRW4XOJ.js.map +1 -0
- package/build/modern/chunk-KDDPAJMR.js +9 -0
- package/build/modern/chunk-KDDPAJMR.js.map +1 -0
- package/build/modern/{chunk-XOROL3JY.js → chunk-KKHL3ZO4.js} +5 -4
- package/build/modern/chunk-KKHL3ZO4.js.map +1 -0
- package/build/modern/{chunk-U36UZJGZ.js → chunk-MZ3UCDUL.js} +5 -4
- package/build/modern/chunk-MZ3UCDUL.js.map +1 -0
- package/build/modern/{chunk-T2JOPPGL.js → chunk-N24COMHJ.js} +11 -4
- package/build/modern/chunk-N24COMHJ.js.map +1 -0
- package/build/modern/chunk-NJSETNRL.js +68 -0
- package/build/modern/chunk-NJSETNRL.js.map +1 -0
- package/build/modern/{chunk-XY6WL55R.js → chunk-NUMM4TNC.js} +1 -1
- package/build/modern/chunk-NUMM4TNC.js.map +1 -0
- package/build/modern/{chunk-FXLLRVAM.js → chunk-O6LFWUHI.js} +8 -6
- package/build/modern/chunk-O6LFWUHI.js.map +1 -0
- package/build/modern/{chunk-JJZQGR7A.js → chunk-RDRD6ACD.js} +9 -6
- package/build/modern/chunk-RDRD6ACD.js.map +1 -0
- package/build/modern/{chunk-XXWR7UGH.js → chunk-SD3OVTHT.js} +75 -103
- package/build/modern/chunk-SD3OVTHT.js.map +1 -0
- package/build/modern/chunk-TFL56AYR.js +56 -0
- package/build/modern/chunk-TFL56AYR.js.map +1 -0
- package/build/modern/chunk-V3M3ZOQI.js +38 -0
- package/build/modern/chunk-V3M3ZOQI.js.map +1 -0
- package/build/modern/{chunk-QK7R2XJM.js → chunk-XQICKZH4.js} +6 -5
- package/build/modern/chunk-XQICKZH4.js.map +1 -0
- package/build/modern/chunk-XZGXRRSQ.js +31 -0
- package/build/modern/chunk-XZGXRRSQ.js.map +1 -0
- package/build/modern/{chunk-KPUYKHLW.js → chunk-YKKNWILF.js} +71 -15
- package/build/modern/chunk-YKKNWILF.js.map +1 -0
- package/build/modern/{chunk-Q7BRMIBR.js → chunk-ZL6ZITLA.js} +1 -1
- package/build/modern/chunk-ZL6ZITLA.js.map +1 -0
- package/build/modern/components/Accordion.client.js +9 -0
- package/build/modern/components/Accordion.client.js.map +1 -0
- package/build/modern/components/Accordion.js +1 -7
- package/build/modern/components/AccordionItemGroup.js +4 -6
- package/build/modern/components/Admonition.client.js +11 -0
- package/build/modern/components/Admonition.client.js.map +1 -0
- package/build/modern/components/Admonition.js +4 -6
- package/build/modern/components/AnimatingUploadIcon.js +1 -1
- package/build/modern/components/Avatar.js +3 -5
- package/build/modern/components/Checkbox.js +2 -5
- package/build/modern/components/DatePicker.client.js +8 -7
- package/build/modern/components/DatePicker.server.js +3 -13
- package/build/modern/components/Dialog.client.js +10 -0
- package/build/modern/components/Dialog.client.js.map +1 -0
- package/build/modern/components/Dialog.js +24 -0
- package/build/modern/components/Dialog.js.map +1 -0
- package/build/modern/components/FileStatus.js +3 -6
- package/build/modern/components/FileUploader.js +3 -6
- package/build/modern/components/Input.js +2 -5
- package/build/modern/components/Modal.js +1 -1
- package/build/modern/components/ModalDescription.js +1 -1
- package/build/modern/components/ModalHeader.js +1 -1
- package/build/modern/components/ModalHeading.js +1 -1
- package/build/modern/components/Notification.js +2 -5
- package/build/modern/components/Select.js +2 -5
- package/build/modern/components/Tag.js +3 -5
- package/build/modern/components/Toggle.js +2 -5
- package/build/modern/config/defineIcons.js +2 -5
- package/build/modern/config/index.js +14 -0
- package/build/modern/config/index.js.map +1 -0
- package/build/modern/config/types.js +2 -0
- package/build/modern/config/types.js.map +1 -0
- package/build/modern/context/cerberus.js +10 -0
- package/build/modern/context/cerberus.js.map +1 -0
- package/build/modern/context/confirm-modal.js +5 -13
- package/build/modern/context/cta-modal.js +7 -14
- package/build/modern/context/notification-center/store.js +15 -0
- package/build/modern/context/notification-center/store.js.map +1 -0
- package/build/modern/context/notification-center/types.js +1 -0
- package/build/modern/context/notification-center/types.js.map +1 -0
- package/build/modern/context/notification-center.js +5 -7
- package/build/modern/context/prompt-modal.js +8 -15
- package/build/modern/index.js +111 -75
- package/build/modern/index.js.map +1 -1
- package/package.json +4 -8
- package/src/components/Accordion.client.tsx +46 -0
- package/src/components/Accordion.tsx +0 -37
- package/src/components/AccordionItemGroup.tsx +1 -1
- package/src/components/Admonition.client.tsx +73 -0
- package/src/components/Admonition.tsx +1 -70
- package/src/components/AnimatingUploadIcon.tsx +3 -3
- package/src/components/Avatar.tsx +5 -2
- package/src/components/Checkbox.tsx +10 -3
- package/src/components/DatePicker.client.tsx +111 -15
- package/src/components/DatePicker.server.tsx +2 -75
- package/src/components/Dialog.client.tsx +39 -0
- package/src/components/Dialog.tsx +165 -0
- package/src/components/FileStatus.tsx +5 -3
- package/src/components/FileUploader.tsx +3 -2
- package/src/components/Input.tsx +4 -2
- package/src/components/Modal.tsx +1 -16
- package/src/components/ModalDescription.tsx +1 -8
- package/src/components/ModalHeader.tsx +1 -10
- package/src/components/ModalHeading.tsx +1 -8
- package/src/components/Notification.tsx +9 -4
- package/src/components/Select.tsx +5 -2
- package/src/components/Tag.tsx +5 -2
- package/src/components/Toggle.tsx +4 -3
- package/src/config/defineIcons.ts +28 -16
- package/src/config/index.ts +28 -0
- package/src/config/types.ts +42 -0
- package/src/context/cerberus.tsx +44 -0
- package/src/context/confirm-modal.tsx +44 -42
- package/src/context/cta-modal.tsx +25 -38
- package/src/context/notification-center/store.ts +88 -0
- package/src/context/notification-center/types.ts +28 -0
- package/src/context/notification-center.tsx +81 -46
- package/src/context/prompt-modal.tsx +101 -103
- package/src/index.ts +15 -8
- package/build/legacy/config/cerbIcons.cjs.map +0 -1
- package/build/modern/chunk-2UXE5PDG.js.map +0 -1
- package/build/modern/chunk-5OVH3INN.js.map +0 -1
- package/build/modern/chunk-6BH5J5GF.js.map +0 -1
- package/build/modern/chunk-BC5SZDYY.js +0 -132
- package/build/modern/chunk-BC5SZDYY.js.map +0 -1
- package/build/modern/chunk-BE4EOU2P.js.map +0 -1
- package/build/modern/chunk-BVCXVZAF.js.map +0 -1
- package/build/modern/chunk-CRII2HNX.js +0 -55
- package/build/modern/chunk-CRII2HNX.js.map +0 -1
- package/build/modern/chunk-CVTON5DQ.js +0 -162
- package/build/modern/chunk-CVTON5DQ.js.map +0 -1
- package/build/modern/chunk-FXLLRVAM.js.map +0 -1
- package/build/modern/chunk-HKJMLWVP.js.map +0 -1
- package/build/modern/chunk-HVKM54BA.js.map +0 -1
- package/build/modern/chunk-JJZQGR7A.js.map +0 -1
- package/build/modern/chunk-KPUYKHLW.js.map +0 -1
- package/build/modern/chunk-KWJ5FKX7.js.map +0 -1
- package/build/modern/chunk-PVIMOXSO.js.map +0 -1
- package/build/modern/chunk-Q7BRMIBR.js.map +0 -1
- package/build/modern/chunk-QK7R2XJM.js.map +0 -1
- package/build/modern/chunk-QMF5ZNDG.js +0 -27
- package/build/modern/chunk-QMF5ZNDG.js.map +0 -1
- package/build/modern/chunk-QQOWWMZ3.js +0 -138
- package/build/modern/chunk-QQOWWMZ3.js.map +0 -1
- package/build/modern/chunk-T2JOPPGL.js.map +0 -1
- package/build/modern/chunk-TJCFYL5W.js.map +0 -1
- package/build/modern/chunk-U36UZJGZ.js.map +0 -1
- package/build/modern/chunk-XOROL3JY.js.map +0 -1
- package/build/modern/chunk-XXWR7UGH.js.map +0 -1
- package/build/modern/chunk-XY6WL55R.js.map +0 -1
- package/build/modern/config/cerbIcons.js +0 -9
- package/src/config/cerbIcons.ts +0 -73
- /package/build/modern/{config/cerbIcons.js.map → chunk-36N4527B.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Modal.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport { forwardRef, type ForwardedRef, type HTMLAttributes } from 'react'\n\n/**\n * This module contains the Modal root component for a customizable modal.\n * @module\n */\n\n// Modal\n\nexport type ModalProps = HTMLAttributes<HTMLDialogElement>\n\nfunction ModalEl(props: ModalProps, ref: ForwardedRef<HTMLDialogElement>) {\n return (\n <dialog\n {...props}\n className={cx(props.className, modal().dialog)}\n ref={ref}\n />\n )\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Modal.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport { forwardRef, type ForwardedRef, type HTMLAttributes } from 'react'\n\n/**\n * This module contains the Modal root component for a customizable modal.\n * @module\n */\n\n// Modal\n\nexport type ModalProps = HTMLAttributes<HTMLDialogElement>\n\nfunction ModalEl(props: ModalProps, ref: ForwardedRef<HTMLDialogElement>) {\n return (\n <dialog\n {...props}\n className={cx(props.className, modal().dialog)}\n ref={ref}\n />\n )\n}\n\n/**\n * @deprecated use `Dialog` instead\n */\nexport const Modal = forwardRef(ModalEl)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,qBAAsB;AACtB,mBAAmE;AAa/D;AAFJ,SAAS,QAAQ,OAAmB,KAAsC;AACxE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,MAAM,eAAW,sBAAM,EAAE,MAAM;AAAA,MAC7C;AAAA;AAAA,EACF;AAEJ;AAKO,IAAM,YAAQ,yBAAW,OAAO;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ModalDescription.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalDescription component for a customizable modal.\n * @module\n */\n\nexport type ModalDescriptionProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ModalDescription.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalDescription component for a customizable modal.\n * @module\n */\n\nexport type ModalDescriptionProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n * @deprecated use `DialogDescription` instead\n */\nexport function ModalDescription(props: ModalDescriptionProps) {\n return <p {...props} className={cx(props.className, modal().description)} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,qBAAsB;AAcb;AADF,SAAS,iBAAiB,OAA8B;AAC7D,SAAO,4CAAC,OAAG,GAAG,OAAO,eAAW,eAAG,MAAM,eAAW,sBAAM,EAAE,WAAW,GAAG;AAC5E;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ModalHeader.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeader component for a customizable modal.\n * @module\n */\n\nexport type ModalHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ModalHeader.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeader component for a customizable modal.\n * @module\n */\n\nexport type ModalHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/**\n * @deprecated there is no replacement for this component\n */\nexport function ModalHeader(props: ModalHeaderProps) {\n return (\n <div\n {...props}\n className={cx(\n props.className,\n vstack({\n alignItems: 'flex-start',\n gap: 'md',\n position: 'relative',\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,sBAAuB;AAenB;AAFG,SAAS,YAAY,OAAyB;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,MAAM;AAAA,YACN,wBAAO;AAAA,UACL,YAAY;AAAA,UACZ,KAAK;AAAA,UACL,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ModalHeading.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeading component for a customizable modal.\n * @module\n */\n\nexport type ModalHeadingProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ModalHeading.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeading component for a customizable modal.\n * @module\n */\n\nexport type ModalHeadingProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n * @deprecated use `DialogHeading` instead\n */\nexport function ModalHeading(props: ModalHeadingProps) {\n return <p {...props} className={cx(props.className, modal().heading)} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,qBAAsB;AAcb;AADF,SAAS,aAAa,OAA0B;AACrD,SAAO,4CAAC,OAAG,GAAG,OAAO,eAAW,eAAG,MAAM,eAAW,sBAAM,EAAE,OAAO,GAAG;AACxE;","names":[]}
|
|
@@ -27,172 +27,7 @@ module.exports = __toCommonJS(Notification_exports);
|
|
|
27
27
|
var import_css = require("@cerberus/styled-system/css");
|
|
28
28
|
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
29
29
|
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
30
|
-
var
|
|
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
|
-
accordionIndicator: import_icons.ChevronDown,
|
|
171
|
-
avatar: import_icons.UserFilled,
|
|
172
|
-
calendar: import_icons.Calendar,
|
|
173
|
-
calendarPrev: import_icons.ChevronLeft,
|
|
174
|
-
calendarNext: import_icons.ChevronRight,
|
|
175
|
-
checkbox: CheckmarkIcon,
|
|
176
|
-
close: import_icons.Close,
|
|
177
|
-
confirmModal: import_icons.Information,
|
|
178
|
-
delete: import_icons.TrashCan,
|
|
179
|
-
promptModal: import_icons.Information,
|
|
180
|
-
waitingFileUploader: import_icons.CloudUpload,
|
|
181
|
-
fileUploader: AnimatingUploadIcon,
|
|
182
|
-
indeterminate: IndeterminateIcon,
|
|
183
|
-
infoNotification: import_icons.Information,
|
|
184
|
-
successNotification: import_icons.CheckmarkOutline,
|
|
185
|
-
warningNotification: import_icons.WarningAlt,
|
|
186
|
-
dangerNotification: import_icons.WarningFilled,
|
|
187
|
-
invalid: import_icons.WarningFilled,
|
|
188
|
-
invalidAlt: import_icons.Warning,
|
|
189
|
-
redo: import_icons.Restart,
|
|
190
|
-
selectArrow: import_icons.ChevronDown,
|
|
191
|
-
toggleChecked: import_icons.Checkmark
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// src/config/defineIcons.ts
|
|
195
|
-
var $cerberusIcons = defaultIcons;
|
|
30
|
+
var import_react2 = require("react");
|
|
196
31
|
|
|
197
32
|
// src/aria-helpers/trap-focus.aria.ts
|
|
198
33
|
function trapFocus(modalRef) {
|
|
@@ -220,24 +55,39 @@ function trapFocus(modalRef) {
|
|
|
220
55
|
};
|
|
221
56
|
}
|
|
222
57
|
|
|
58
|
+
// src/context/cerberus.tsx
|
|
59
|
+
var import_react = require("react");
|
|
60
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
61
|
+
var CerberusContext = (0, import_react.createContext)(null);
|
|
62
|
+
function useCerberusContext() {
|
|
63
|
+
const context = (0, import_react.useContext)(CerberusContext);
|
|
64
|
+
if (!context) {
|
|
65
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
66
|
+
}
|
|
67
|
+
return context;
|
|
68
|
+
}
|
|
69
|
+
|
|
223
70
|
// src/components/Notification.tsx
|
|
224
|
-
var
|
|
71
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
225
72
|
function MatchNotificationIcon(props) {
|
|
73
|
+
const { icons } = useCerberusContext();
|
|
226
74
|
const palette = props.palette || "info";
|
|
227
75
|
const key = `${palette}Notification`;
|
|
228
|
-
const Icon =
|
|
229
|
-
return /* @__PURE__ */ (0,
|
|
76
|
+
const Icon = icons[key];
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, {});
|
|
230
78
|
}
|
|
231
79
|
function Notification(props) {
|
|
232
80
|
const { children, palette, onClose, ...nativeProps } = props;
|
|
233
|
-
const ref = (0,
|
|
81
|
+
const ref = (0, import_react2.useRef)(null);
|
|
234
82
|
const onKeyDown = trapFocus(ref);
|
|
235
83
|
const styles = (0, import_recipes.notification)({ palette });
|
|
236
|
-
const {
|
|
237
|
-
|
|
84
|
+
const { icons } = useCerberusContext();
|
|
85
|
+
const { close: CloseIcon } = icons;
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
238
87
|
"dialog",
|
|
239
88
|
{
|
|
240
89
|
...nativeProps,
|
|
90
|
+
"data-placement": "left",
|
|
241
91
|
className: (0, import_css.cx)(
|
|
242
92
|
nativeProps.className,
|
|
243
93
|
(0, import_patterns.hstack)({
|
|
@@ -249,8 +99,8 @@ function Notification(props) {
|
|
|
249
99
|
onKeyDown,
|
|
250
100
|
ref,
|
|
251
101
|
children: [
|
|
252
|
-
/* @__PURE__ */ (0,
|
|
253
|
-
/* @__PURE__ */ (0,
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MatchNotificationIcon, { palette }) }),
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
254
104
|
"div",
|
|
255
105
|
{
|
|
256
106
|
className: (0, import_patterns.vstack)({
|
|
@@ -261,14 +111,14 @@ function Notification(props) {
|
|
|
261
111
|
children
|
|
262
112
|
}
|
|
263
113
|
),
|
|
264
|
-
/* @__PURE__ */ (0,
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
265
115
|
"button",
|
|
266
116
|
{
|
|
267
117
|
"aria-label": "Close",
|
|
268
118
|
className: styles.close,
|
|
269
119
|
onClick: onClose,
|
|
270
120
|
value: props.id,
|
|
271
|
-
children: /* @__PURE__ */ (0,
|
|
121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CloseIcon, {})
|
|
272
122
|
}
|
|
273
123
|
)
|
|
274
124
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Notification.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts","../../../src/aria-helpers/trap-focus.aria.ts"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport {\n useRef,\n type DialogHTMLAttributes,\n type PropsWithChildren,\n type MouseEvent,\n} from 'react'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\n\n/**\n * This module exports the Notification component.\n * @module\n */\n\nfunction MatchNotificationIcon(props: NotificationVariantProps) {\n const palette = (props.palette || 'info') as\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n const key = `${palette}Notification` as keyof typeof $cerberusIcons\n const Icon = $cerberusIcons[key]\n return <Icon />\n}\n\nexport interface NotificationBaseProps\n extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {\n /**\n * The unique id of the notification. Required for the onClose callback.\n */\n id: string\n /**\n * Called when the close button is clicked.\n */\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * A static Notification component that displays a message to the user. This\n * is typically only used when not utilizing the NotificationCenter.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @example\n * ```tsx\n * <Notification id=\"info:1\" open>\n * <NotificationHeading>Info Notification</NotificationHeading>\n * <NotificationDescription>\n * This is a description with a <a href=\"#\">link</a> in the message.\n * </NotificationDescription>\n * </Notification>\n * ```\n */\nexport function Notification(props: PropsWithChildren<NotificationProps>) {\n const { children, palette, onClose, ...nativeProps } = props\n const ref = useRef<HTMLDialogElement>(null)\n const onKeyDown = trapFocus(ref)\n const styles = notification({ palette })\n const { close: CloseIcon } = $cerberusIcons\n\n return (\n <dialog\n {...nativeProps}\n className={cx(\n nativeProps.className,\n hstack({\n position: 'relative',\n gap: '4',\n }),\n styles.dialog,\n )}\n onKeyDown={onKeyDown}\n ref={ref}\n >\n <span className={styles.icon}>\n <MatchNotificationIcon palette={palette} />\n </span>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0',\n py: '2',\n })}\n >\n {children}\n </div>\n\n <button\n aria-label=\"Close\"\n className={styles.close}\n onClick={onClose}\n value={props.id}\n >\n <CloseIcon />\n </button>\n </dialog>\n )\n}\n","import {\n Calendar,\n Checkmark,\n CheckmarkOutline,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n Close,\n CloudUpload,\n Information,\n Restart,\n TrashCan,\n UserFilled,\n Warning,\n WarningAlt,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\nimport { AnimatingUploadIcon } from '../components/AnimatingUploadIcon'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n accordionIndicator?: IconType\n avatar?: IconType\n calendar?: IconType\n calendarPrev?: IconType\n calendarNext?: IconType\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n waitingFileUploader?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n accordionIndicator: ChevronDown,\n avatar: UserFilled,\n calendar: Calendar,\n calendarPrev: ChevronLeft,\n calendarNext: ChevronRight,\n checkbox: CheckmarkIcon,\n close: Close,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n waitingFileUploader: CloudUpload,\n fileUploader: AnimatingUploadIcon,\n indeterminate: IndeterminateIcon,\n infoNotification: Information,\n successNotification: CheckmarkOutline,\n warningNotification: WarningAlt,\n dangerNotification: WarningFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n","import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\nexport type CheckboxIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Checkmark icon for Checkbox component\n */\nexport function CheckmarkIcon(props: CheckboxIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n role=\"img\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z\"\n />\n </svg>\n )\n}\n\nexport type IndeterminateIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Indeterminate icon for Checkbox component\n */\nexport function IndeterminateIcon(props: IndeterminateIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path fill=\"currentColor\" d=\"M4 11h16v2.667H4z\" />\n </svg>\n )\n}\n","import { type CarbonIconProps } from '@cerberus/icons'\n\n/**\n * This module contains an animating icon to use for the FileStatus component.\n * @module\n */\n\nexport type AnimatingUploadIconProps = CarbonIconProps\n\nexport function AnimatingUploadIcon(props: AnimatingUploadIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width={props.size ?? '1em'}\n height={props.size ?? '1em'}\n viewBox=\"0 0 24 24\"\n >\n <g\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n strokeWidth={1.5}\n >\n <path\n data-name=\"animating-trail\"\n strokeDasharray=\"2 4\"\n strokeDashoffset={6}\n d=\"M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9\"\n >\n <animate\n attributeName=\"stroke-dashoffset\"\n dur=\"0.45s\"\n repeatCount=\"indefinite\"\n values=\"6;0\"\n ></animate>\n </path>\n\n <path\n data-name=\"half-circle\"\n strokeDasharray={32}\n strokeDashoffset={32}\n d=\"M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9\"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"stroke-dashoffset\"\n begin=\"0.075s\"\n dur=\"0.3s\"\n values=\"32;0\"\n ></animate>\n </path>\n\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"0.8em\"\n height=\"0.8em\"\n x=\"27%\"\n y=\"27%\"\n viewBox=\"0 0 24 24\"\n >\n <polygon\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth={0.8}\n opacity=\"1\"\n points=\"3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 \"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"opacity\"\n values=\"1;0;1\"\n dur=\"2s\"\n repeatCount=\"indefinite\"\n ></animate>\n </polygon>\n </svg>\n </g>\n </svg>\n )\n}\n","import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {\n _validateIconsProperties(icons)\n $cerberusIcons = {\n ...defaultIcons,\n ...icons,\n } as Required<DefinedIcons>\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons = defaultIcons as Required<DefinedIcons>\n","import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'\n\nexport function trapFocus(\n modalRef: RefObject<HTMLDialogElement>,\n): KeyboardEventHandler<HTMLDialogElement> {\n const focusableElements =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n const focusable = Array.from(\n modalRef.current?.querySelectorAll(focusableElements) ?? [],\n )\n const firstFocusable = focusable[0] as HTMLElement\n const lastFocusable = focusable[focusable.length - 1] as HTMLElement\n\n return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstFocusable) {\n lastFocusable.focus()\n event.preventDefault()\n }\n } else {\n if (document.activeElement === lastFocusable) {\n firstFocusable.focus()\n event.preventDefault()\n }\n }\n }\n }\n}\n"],"mappings":"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","names":["import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Notification.tsx","../../../src/aria-helpers/trap-focus.aria.ts","../../../src/context/cerberus.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport {\n useRef,\n type DialogHTMLAttributes,\n type PropsWithChildren,\n type MouseEvent,\n} from 'react'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module exports the Notification component.\n * @module\n */\n\nfunction MatchNotificationIcon(props: NotificationVariantProps) {\n const { icons } = useCerberusContext()\n const palette = (props.palette || 'info') as\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n const key = `${palette}Notification` as keyof typeof icons\n const Icon = icons[key]\n return <Icon />\n}\n\nexport interface NotificationBaseProps\n extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {\n /**\n * The unique id of the notification. Required for the onClose callback.\n */\n id: string\n /**\n * Called when the close button is clicked.\n */\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * A static Notification component that displays a message to the user. This\n * is typically only used when not utilizing the NotificationCenter.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @example\n * ```tsx\n * <Notification id=\"info:1\" open>\n * <NotificationHeading>Info Notification</NotificationHeading>\n * <NotificationDescription>\n * This is a description with a <a href=\"#\">link</a> in the message.\n * </NotificationDescription>\n * </Notification>\n * ```\n */\nexport function Notification(props: PropsWithChildren<NotificationProps>) {\n const { children, palette, onClose, ...nativeProps } = props\n const ref = useRef<HTMLDialogElement>(null)\n\n const onKeyDown = trapFocus(ref)\n const styles = notification({ palette })\n\n const { icons } = useCerberusContext()\n const { close: CloseIcon } = icons\n\n return (\n <dialog\n {...nativeProps}\n data-placement=\"left\"\n className={cx(\n nativeProps.className,\n hstack({\n position: 'relative',\n gap: '4',\n }),\n styles.dialog,\n )}\n onKeyDown={onKeyDown}\n ref={ref}\n >\n <span className={styles.icon}>\n <MatchNotificationIcon palette={palette} />\n </span>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0',\n py: '2',\n })}\n >\n {children}\n </div>\n\n <button\n aria-label=\"Close\"\n className={styles.close}\n onClick={onClose}\n value={props.id}\n >\n <CloseIcon />\n </button>\n </dialog>\n )\n}\n","import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'\n\nexport function trapFocus(\n modalRef: RefObject<HTMLDialogElement>,\n): KeyboardEventHandler<HTMLDialogElement> {\n const focusableElements =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n const focusable = Array.from(\n modalRef.current?.querySelectorAll(focusableElements) ?? [],\n )\n const firstFocusable = focusable[0] as HTMLElement\n const lastFocusable = focusable[focusable.length - 1] as HTMLElement\n\n return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstFocusable) {\n lastFocusable.focus()\n event.preventDefault()\n }\n } else {\n if (document.activeElement === lastFocusable) {\n firstFocusable.focus()\n event.preventDefault()\n }\n }\n }\n }\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,sBAA+B;AAC/B,qBAGO;AACP,IAAAA,gBAKO;;;ACXA,SAAS,UACd,UACyC;AAJ3C;AAKE,QAAM,oBACJ;AACF,QAAM,YAAY,MAAM;AAAA,MACtB,cAAS,YAAT,mBAAkB,iBAAiB,uBAAsB,CAAC;AAAA,EAC5D;AACA,QAAM,iBAAiB,UAAU,CAAC;AAClC,QAAM,gBAAgB,UAAU,UAAU,SAAS,CAAC;AAEpD,SAAO,SAAS,cAAc,OAAyC;AACrE,QAAI,MAAM,QAAQ,OAAO;AACvB,UAAI,MAAM,UAAU;AAClB,YAAI,SAAS,kBAAkB,gBAAgB;AAC7C,wBAAc,MAAM;AACpB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF,OAAO;AACL,YAAI,SAAS,kBAAkB,eAAe;AAC5C,yBAAe,MAAM;AACrB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AC1BA,mBAAkE;AAyB9D;AAfJ,IAAM,sBAAkB,4BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,yBAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;AFZS,IAAAC,sBAAA;AATT,SAAS,sBAAsB,OAAiC;AAC9D,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,UAAW,MAAM,WAAW;AAKlC,QAAM,MAAM,GAAG,OAAO;AACtB,QAAM,OAAO,MAAM,GAAG;AACtB,SAAO,6CAAC,QAAK;AACf;AA8BO,SAAS,aAAa,OAA6C;AACxE,QAAM,EAAE,UAAU,SAAS,SAAS,GAAG,YAAY,IAAI;AACvD,QAAM,UAAM,sBAA0B,IAAI;AAE1C,QAAM,YAAY,UAAU,GAAG;AAC/B,QAAM,aAAS,6BAAa,EAAE,QAAQ,CAAC;AAEvC,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,kBAAe;AAAA,MACf,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,wBAAO;AAAA,UACL,UAAU;AAAA,UACV,KAAK;AAAA,QACP,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,qDAAC,UAAK,WAAW,OAAO,MACtB,uDAAC,yBAAsB,SAAkB,GAC3C;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,wBAAO;AAAA,cAChB,YAAY;AAAA,cACZ,KAAK;AAAA,cACL,IAAI;AAAA,YACN,CAAC;AAAA,YAEA;AAAA;AAAA,QACH;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,OAAO;AAAA,YAClB,SAAS;AAAA,YACT,OAAO,MAAM;AAAA,YAEb,uDAAC,aAAU;AAAA;AAAA,QACb;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","import_jsx_runtime"]}
|
|
@@ -29,174 +29,9 @@ var import_css = require("@cerberus/styled-system/css");
|
|
|
29
29
|
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
30
30
|
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
31
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
|
-
accordionIndicator: import_icons.ChevronDown,
|
|
171
|
-
avatar: import_icons.UserFilled,
|
|
172
|
-
calendar: import_icons.Calendar,
|
|
173
|
-
calendarPrev: import_icons.ChevronLeft,
|
|
174
|
-
calendarNext: import_icons.ChevronRight,
|
|
175
|
-
checkbox: CheckmarkIcon,
|
|
176
|
-
close: import_icons.Close,
|
|
177
|
-
confirmModal: import_icons.Information,
|
|
178
|
-
delete: import_icons.TrashCan,
|
|
179
|
-
promptModal: import_icons.Information,
|
|
180
|
-
waitingFileUploader: import_icons.CloudUpload,
|
|
181
|
-
fileUploader: AnimatingUploadIcon,
|
|
182
|
-
indeterminate: IndeterminateIcon,
|
|
183
|
-
infoNotification: import_icons.Information,
|
|
184
|
-
successNotification: import_icons.CheckmarkOutline,
|
|
185
|
-
warningNotification: import_icons.WarningAlt,
|
|
186
|
-
dangerNotification: import_icons.WarningFilled,
|
|
187
|
-
invalid: import_icons.WarningFilled,
|
|
188
|
-
invalidAlt: import_icons.Warning,
|
|
189
|
-
redo: import_icons.Restart,
|
|
190
|
-
selectArrow: import_icons.ChevronDown,
|
|
191
|
-
toggleChecked: import_icons.Checkmark
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// src/config/defineIcons.ts
|
|
195
|
-
var $cerberusIcons = defaultIcons;
|
|
196
|
-
|
|
197
32
|
// src/context/field.tsx
|
|
198
33
|
var import_react = require("react");
|
|
199
|
-
var
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
200
35
|
var FieldContext = (0, import_react.createContext)(null);
|
|
201
36
|
function useFieldContext() {
|
|
202
37
|
const context = (0, import_react.useContext)(FieldContext);
|
|
@@ -206,28 +41,41 @@ function useFieldContext() {
|
|
|
206
41
|
return context;
|
|
207
42
|
}
|
|
208
43
|
|
|
209
|
-
// src/
|
|
44
|
+
// src/context/cerberus.tsx
|
|
210
45
|
var import_react2 = require("react");
|
|
46
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
47
|
+
var CerberusContext = (0, import_react2.createContext)(null);
|
|
48
|
+
function useCerberusContext() {
|
|
49
|
+
const context = (0, import_react2.useContext)(CerberusContext);
|
|
50
|
+
if (!context) {
|
|
51
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
52
|
+
}
|
|
53
|
+
return context;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/components/Show.tsx
|
|
57
|
+
var import_react3 = require("react");
|
|
211
58
|
function Show(props) {
|
|
212
59
|
const { when, children, fallback } = props;
|
|
213
|
-
const condition = (0,
|
|
214
|
-
return (0,
|
|
60
|
+
const condition = (0, import_react3.useMemo)(() => when ?? false, [when]);
|
|
61
|
+
return (0, import_react3.useMemo)(() => {
|
|
215
62
|
if (condition) return children;
|
|
216
63
|
return fallback ?? null;
|
|
217
64
|
}, [condition, children, fallback]);
|
|
218
65
|
}
|
|
219
66
|
|
|
220
67
|
// src/components/Select.tsx
|
|
221
|
-
var
|
|
68
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
222
69
|
function Select(props) {
|
|
223
70
|
const { describedBy, size, ...nativeProps } = props;
|
|
224
71
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
225
|
-
const {
|
|
72
|
+
const { icons } = useCerberusContext();
|
|
73
|
+
const { invalid: InvalidIcon, selectArrow: SelectArrow } = icons;
|
|
226
74
|
const styles = (0, import_recipes.select)({
|
|
227
75
|
size
|
|
228
76
|
});
|
|
229
|
-
return /* @__PURE__ */ (0,
|
|
230
|
-
/* @__PURE__ */ (0,
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: styles.root, children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
231
79
|
"select",
|
|
232
80
|
{
|
|
233
81
|
...nativeProps,
|
|
@@ -237,7 +85,7 @@ function Select(props) {
|
|
|
237
85
|
className: styles.input
|
|
238
86
|
}
|
|
239
87
|
),
|
|
240
|
-
/* @__PURE__ */ (0,
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
241
89
|
"span",
|
|
242
90
|
{
|
|
243
91
|
className: (0, import_css.cx)(
|
|
@@ -247,22 +95,22 @@ function Select(props) {
|
|
|
247
95
|
})
|
|
248
96
|
),
|
|
249
97
|
children: [
|
|
250
|
-
/* @__PURE__ */ (0,
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
251
99
|
"span",
|
|
252
100
|
{
|
|
253
101
|
...invalid && { "data-invalid": true },
|
|
254
102
|
className: styles.stateIcon,
|
|
255
|
-
children: /* @__PURE__ */ (0,
|
|
103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InvalidIcon, {})
|
|
256
104
|
}
|
|
257
105
|
) }),
|
|
258
|
-
/* @__PURE__ */ (0,
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.arrowIcon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectArrow, {}) })
|
|
259
107
|
]
|
|
260
108
|
}
|
|
261
109
|
)
|
|
262
110
|
] });
|
|
263
111
|
}
|
|
264
112
|
function Option(props) {
|
|
265
|
-
return /* @__PURE__ */ (0,
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { ...props });
|
|
266
114
|
}
|
|
267
115
|
// Annotate the CommonJS export names for ESM import in node:
|
|
268
116
|
0 && (module.exports = {
|