@cerberus-design/react 0.7.4-next-92f76bb → 0.7.4-next-9a605c3
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.ts +144 -5
- package/build/legacy/{chunk-7BB66W4A.js → chunk-4EMJR2AY.js} +2 -2
- package/build/legacy/{chunk-OLQQB53X.js → chunk-BEYPMC73.js} +2 -2
- package/build/legacy/{chunk-3RZUW5KH.js → chunk-DB2OA5PU.js} +3 -3
- package/build/legacy/{chunk-GIHAFJYX.js → chunk-GVNPFXKL.js} +9 -2
- package/build/legacy/chunk-GVNPFXKL.js.map +1 -0
- package/build/legacy/{chunk-ANXV7JDK.js → chunk-IL5ELPTT.js} +2 -2
- package/build/legacy/chunk-NWMNEJGU.js +16 -0
- package/build/legacy/chunk-NWMNEJGU.js.map +1 -0
- package/build/legacy/chunk-SINTHADQ.js +22 -0
- package/build/legacy/chunk-SINTHADQ.js.map +1 -0
- package/build/legacy/chunk-SPGBCV6A.js +70 -0
- package/build/legacy/chunk-SPGBCV6A.js.map +1 -0
- package/build/legacy/chunk-TAJBSUS7.js +99 -0
- package/build/legacy/chunk-TAJBSUS7.js.map +1 -0
- package/build/legacy/{chunk-DCI4IKCI.js → chunk-X5JR5LSC.js} +2 -2
- package/build/legacy/{chunk-DED42MIR.js → chunk-XB4ZRAH4.js} +2 -2
- package/build/legacy/components/FileUploader.js +3 -3
- package/build/legacy/components/Input.js +3 -3
- package/build/legacy/components/Notification.js +12 -0
- package/build/legacy/components/Notification.js.map +1 -0
- package/build/legacy/components/NotificationDescription.js +7 -0
- package/build/legacy/components/NotificationDescription.js.map +1 -0
- package/build/legacy/components/NotificationHeading.js +7 -0
- package/build/legacy/components/NotificationHeading.js.map +1 -0
- package/build/legacy/components/Toggle.js +3 -3
- package/build/legacy/config/cerbIcons.js +1 -1
- package/build/legacy/config/defineIcons.js +2 -2
- package/build/legacy/context/confirm-modal.js +3 -3
- package/build/legacy/context/notification-center.js +19 -0
- package/build/legacy/context/notification-center.js.map +1 -0
- package/build/legacy/context/prompt-modal.js +4 -4
- package/build/legacy/index.js +37 -19
- package/build/legacy/index.js.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +144 -5
- package/build/modern/chunk-32E6OUMD.js +99 -0
- package/build/modern/chunk-32E6OUMD.js.map +1 -0
- package/build/modern/{chunk-2NSXMFKX.js → chunk-3YORUZIQ.js} +2 -2
- package/build/modern/{chunk-OLQQB53X.js → chunk-BEYPMC73.js} +2 -2
- package/build/modern/{chunk-DKHQ5GBY.js → chunk-BMQ7I2PL.js} +3 -3
- package/build/modern/{chunk-GIHAFJYX.js → chunk-GVNPFXKL.js} +9 -2
- package/build/modern/chunk-GVNPFXKL.js.map +1 -0
- package/build/modern/{chunk-ANXV7JDK.js → chunk-IL5ELPTT.js} +2 -2
- package/build/modern/chunk-NWMNEJGU.js +16 -0
- package/build/modern/chunk-NWMNEJGU.js.map +1 -0
- package/build/modern/chunk-OCBED5GL.js +70 -0
- package/build/modern/chunk-OCBED5GL.js.map +1 -0
- package/build/modern/chunk-SINTHADQ.js +22 -0
- package/build/modern/chunk-SINTHADQ.js.map +1 -0
- package/build/modern/{chunk-DED42MIR.js → chunk-XB4ZRAH4.js} +2 -2
- package/build/modern/{chunk-SHNZS357.js → chunk-ZPWSMCZ5.js} +2 -2
- package/build/modern/components/FileUploader.js +3 -3
- package/build/modern/components/Input.js +3 -3
- package/build/modern/components/Notification.js +12 -0
- package/build/modern/components/Notification.js.map +1 -0
- package/build/modern/components/NotificationDescription.js +7 -0
- package/build/modern/components/NotificationDescription.js.map +1 -0
- package/build/modern/components/NotificationHeading.js +7 -0
- package/build/modern/components/NotificationHeading.js.map +1 -0
- package/build/modern/components/Toggle.js +3 -3
- package/build/modern/config/cerbIcons.js +1 -1
- package/build/modern/config/defineIcons.js +2 -2
- package/build/modern/context/confirm-modal.js +3 -3
- package/build/modern/context/notification-center.js +19 -0
- package/build/modern/context/notification-center.js.map +1 -0
- package/build/modern/context/prompt-modal.js +4 -4
- package/build/modern/index.js +37 -19
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Notification.tsx +94 -0
- package/src/components/NotificationDescription.tsx +31 -0
- package/src/components/NotificationHeading.tsx +28 -0
- package/src/config/cerbIcons.ts +19 -6
- package/src/context/notification-center.tsx +159 -0
- package/src/index.ts +4 -0
- package/build/legacy/chunk-GIHAFJYX.js.map +0 -1
- package/build/modern/chunk-GIHAFJYX.js.map +0 -1
- /package/build/legacy/{chunk-7BB66W4A.js.map → chunk-4EMJR2AY.js.map} +0 -0
- /package/build/legacy/{chunk-OLQQB53X.js.map → chunk-BEYPMC73.js.map} +0 -0
- /package/build/legacy/{chunk-3RZUW5KH.js.map → chunk-DB2OA5PU.js.map} +0 -0
- /package/build/legacy/{chunk-ANXV7JDK.js.map → chunk-IL5ELPTT.js.map} +0 -0
- /package/build/legacy/{chunk-DCI4IKCI.js.map → chunk-X5JR5LSC.js.map} +0 -0
- /package/build/legacy/{chunk-DED42MIR.js.map → chunk-XB4ZRAH4.js.map} +0 -0
- /package/build/modern/{chunk-2NSXMFKX.js.map → chunk-3YORUZIQ.js.map} +0 -0
- /package/build/modern/{chunk-OLQQB53X.js.map → chunk-BEYPMC73.js.map} +0 -0
- /package/build/modern/{chunk-DKHQ5GBY.js.map → chunk-BMQ7I2PL.js.map} +0 -0
- /package/build/modern/{chunk-ANXV7JDK.js.map → chunk-IL5ELPTT.js.map} +0 -0
- /package/build/modern/{chunk-DED42MIR.js.map → chunk-XB4ZRAH4.js.map} +0 -0
- /package/build/modern/{chunk-SHNZS357.js.map → chunk-ZPWSMCZ5.js.map} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconButton
|
|
3
|
+
} from "./chunk-SLHX5K6I.js";
|
|
4
|
+
import {
|
|
5
|
+
trapFocus
|
|
6
|
+
} from "./chunk-JIZQFTW6.js";
|
|
7
|
+
import {
|
|
8
|
+
$cerberusIcons
|
|
9
|
+
} from "./chunk-BEYPMC73.js";
|
|
10
|
+
|
|
11
|
+
// src/components/Notification.tsx
|
|
12
|
+
import { cx } from "@cerberus-design/styled-system/css";
|
|
13
|
+
import { hstack, vstack } from "@cerberus-design/styled-system/patterns";
|
|
14
|
+
import {
|
|
15
|
+
notification
|
|
16
|
+
} from "@cerberus-design/styled-system/recipes";
|
|
17
|
+
import {
|
|
18
|
+
useRef
|
|
19
|
+
} from "react";
|
|
20
|
+
import { Close } from "@cerberus/icons";
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
function MatchNotificationIcon(props) {
|
|
23
|
+
const palette = props.palette || "info";
|
|
24
|
+
const key = `${palette}Notification`;
|
|
25
|
+
const Icon = $cerberusIcons[key];
|
|
26
|
+
return /* @__PURE__ */ jsx(Icon, {});
|
|
27
|
+
}
|
|
28
|
+
function Notification(props) {
|
|
29
|
+
const { children, palette, onClose, ...nativeProps } = props;
|
|
30
|
+
const ref = useRef(null);
|
|
31
|
+
const onKeyDown = trapFocus(ref);
|
|
32
|
+
const styles = notification({ palette });
|
|
33
|
+
return /* @__PURE__ */ jsxs(
|
|
34
|
+
"dialog",
|
|
35
|
+
{
|
|
36
|
+
...nativeProps,
|
|
37
|
+
className: cx(
|
|
38
|
+
nativeProps.className,
|
|
39
|
+
hstack({
|
|
40
|
+
position: "relative",
|
|
41
|
+
gap: "4"
|
|
42
|
+
}),
|
|
43
|
+
styles.dialog
|
|
44
|
+
),
|
|
45
|
+
onKeyDown,
|
|
46
|
+
ref,
|
|
47
|
+
role: "alert",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx("span", { className: styles.icon, children: /* @__PURE__ */ jsx(MatchNotificationIcon, { palette }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: vstack({
|
|
54
|
+
alignItems: "flex-start",
|
|
55
|
+
gap: "0",
|
|
56
|
+
py: "2"
|
|
57
|
+
}),
|
|
58
|
+
children
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ jsx(IconButton, { ariaLabel: "Close", onClick: onClose, value: props.id, children: /* @__PURE__ */ jsx(Close, {}) })
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
Notification
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=chunk-OCBED5GL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Notification.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { hstack, vstack } from '@cerberus-design/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport {\n useRef,\n type DialogHTMLAttributes,\n type PropsWithChildren,\n type MouseEvent,\n} from 'react'\nimport { IconButton } from './IconButton'\nimport { Close } from '@cerberus/icons'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport type { IconType } from '../config/cerbIcons'\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'\n const key = `${palette}Notification` as keyof typeof $cerberusIcons\n const Icon = $cerberusIcons[key] as IconType\n return <Icon />\n}\n\nexport interface NotificationBaseProps\n extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {\n id: string\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * The info notification component.\n * @param props - The component props.\n * @returns The info notification component.\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\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 role=\"alert\"\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 <IconButton ariaLabel=\"Close\" onClick={onClose} value={props.id}>\n <Close />\n </IconButton>\n </dialog>\n )\n}\n"],"mappings":";;;;;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,OAIK;AAEP,SAAS,aAAa;AAcb,cA+BL,YA/BK;AAJT,SAAS,sBAAsB,OAAiC;AAC9D,QAAM,UAAU,MAAM,WAAW;AACjC,QAAM,MAAM,GAAG,OAAO;AACtB,QAAM,OAAO,eAAe,GAAG;AAC/B,SAAO,oBAAC,QAAK;AACf;AAuBO,SAAS,aAAa,OAA6C;AACxE,QAAM,EAAE,UAAU,SAAS,SAAS,GAAG,YAAY,IAAI;AACvD,QAAM,MAAM,OAA0B,IAAI;AAC1C,QAAM,YAAY,UAAU,GAAG;AAC/B,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AAEvC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,UAAU;AAAA,UACV,KAAK;AAAA,QACP,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MAEL;AAAA,4BAAC,UAAK,WAAW,OAAO,MACtB,8BAAC,yBAAsB,SAAkB,GAC3C;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,OAAO;AAAA,cAChB,YAAY;AAAA,cACZ,KAAK;AAAA,cACL,IAAI;AAAA,YACN,CAAC;AAAA,YAEA;AAAA;AAAA,QACH;AAAA,QAEA,oBAAC,cAAW,WAAU,SAAQ,SAAS,SAAS,OAAO,MAAM,IAC3D,8BAAC,SAAM,GACT;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/components/NotificationDescription.tsx
|
|
2
|
+
import { cx } from "@cerberus-design/styled-system/css";
|
|
3
|
+
import {
|
|
4
|
+
notification
|
|
5
|
+
} from "@cerberus-design/styled-system/recipes";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function NotificationDescription(props) {
|
|
8
|
+
const { palette, ...nativeProps } = props;
|
|
9
|
+
const styles = notification({ palette });
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"p",
|
|
12
|
+
{
|
|
13
|
+
className: cx(nativeProps.className, styles.description),
|
|
14
|
+
...nativeProps
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
NotificationDescription
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-SINTHADQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/NotificationDescription.tsx"],"sourcesContent":["/**\n * This module exports the NotificationDescription component.\n * @module\n */\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\nexport interface BaseNotificationDescriptionProps\n extends HTMLAttributes<HTMLParagraphElement> {}\nexport type NotificationDescriptionProps = BaseNotificationDescriptionProps &\n NotificationVariantProps\n\n/**\n * The NotificationDescription component is used to render the description of a notification.\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationDescription(props: NotificationDescriptionProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p\n className={cx(nativeProps.className, styles.description)}\n {...nativeProps}\n />\n )\n}\n"],"mappings":";AAKA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgBH;AAJG,SAAS,wBAAwB,OAAqC;AAC3E,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AACvC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,YAAY,WAAW,OAAO,WAAW;AAAA,MACtD,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-4O4QFF4S.js";
|
|
7
7
|
import {
|
|
8
8
|
$cerberusIcons
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BEYPMC73.js";
|
|
10
10
|
|
|
11
11
|
// src/components/Input.tsx
|
|
12
12
|
import { input } from "@cerberus/styled-system/recipes";
|
|
@@ -39,4 +39,4 @@ function Input(props) {
|
|
|
39
39
|
export {
|
|
40
40
|
Input
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-XB4ZRAH4.js.map
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "./chunk-JIZQFTW6.js";
|
|
28
28
|
import {
|
|
29
29
|
$cerberusIcons
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-BEYPMC73.js";
|
|
31
31
|
import {
|
|
32
32
|
useModal
|
|
33
33
|
} from "./chunk-C5HLLGME.js";
|
|
@@ -151,4 +151,4 @@ export {
|
|
|
151
151
|
ConfirmModal,
|
|
152
152
|
useConfirmModal
|
|
153
153
|
};
|
|
154
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-ZPWSMCZ5.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
FileUploader
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-3YORUZIQ.js";
|
|
5
5
|
import "../chunk-4O4QFF4S.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-BEYPMC73.js";
|
|
7
|
+
import "../chunk-GVNPFXKL.js";
|
|
8
8
|
export {
|
|
9
9
|
FileUploader
|
|
10
10
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Input
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XB4ZRAH4.js";
|
|
5
5
|
import "../chunk-ZAU4JVLL.js";
|
|
6
6
|
import "../chunk-4O4QFF4S.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-BEYPMC73.js";
|
|
8
|
+
import "../chunk-GVNPFXKL.js";
|
|
9
9
|
export {
|
|
10
10
|
Input
|
|
11
11
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Notification
|
|
4
|
+
} from "../chunk-OCBED5GL.js";
|
|
5
|
+
import "../chunk-SLHX5K6I.js";
|
|
6
|
+
import "../chunk-JIZQFTW6.js";
|
|
7
|
+
import "../chunk-BEYPMC73.js";
|
|
8
|
+
import "../chunk-GVNPFXKL.js";
|
|
9
|
+
export {
|
|
10
|
+
Notification
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=Notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Toggle
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-IL5ELPTT.js";
|
|
5
5
|
import "../chunk-ZAU4JVLL.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-BEYPMC73.js";
|
|
7
|
+
import "../chunk-GVNPFXKL.js";
|
|
8
8
|
export {
|
|
9
9
|
Toggle
|
|
10
10
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ConfirmModal,
|
|
4
4
|
useConfirmModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-ZPWSMCZ5.js";
|
|
6
6
|
import "../chunk-4CAT3FHV.js";
|
|
7
7
|
import "../chunk-2UFNQM55.js";
|
|
8
8
|
import "../chunk-4M4LCQ43.js";
|
|
@@ -12,8 +12,8 @@ import "../chunk-JJP2TFTU.js";
|
|
|
12
12
|
import "../chunk-2ATICEW3.js";
|
|
13
13
|
import "../chunk-4O4QFF4S.js";
|
|
14
14
|
import "../chunk-JIZQFTW6.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-BEYPMC73.js";
|
|
16
|
+
import "../chunk-GVNPFXKL.js";
|
|
17
17
|
import "../chunk-C5HLLGME.js";
|
|
18
18
|
export {
|
|
19
19
|
ConfirmModal,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
NotificationCenter,
|
|
4
|
+
useNotificationCenter
|
|
5
|
+
} from "../chunk-32E6OUMD.js";
|
|
6
|
+
import "../chunk-OCBED5GL.js";
|
|
7
|
+
import "../chunk-SINTHADQ.js";
|
|
8
|
+
import "../chunk-NWMNEJGU.js";
|
|
9
|
+
import "../chunk-4CAT3FHV.js";
|
|
10
|
+
import "../chunk-4O4QFF4S.js";
|
|
11
|
+
import "../chunk-SLHX5K6I.js";
|
|
12
|
+
import "../chunk-JIZQFTW6.js";
|
|
13
|
+
import "../chunk-BEYPMC73.js";
|
|
14
|
+
import "../chunk-GVNPFXKL.js";
|
|
15
|
+
export {
|
|
16
|
+
NotificationCenter,
|
|
17
|
+
useNotificationCenter
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=notification-center.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PromptModal,
|
|
4
4
|
usePromptModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-BMQ7I2PL.js";
|
|
6
6
|
import "../chunk-4CAT3FHV.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-XB4ZRAH4.js";
|
|
8
8
|
import "../chunk-JJGZRBIR.js";
|
|
9
9
|
import "../chunk-2UFNQM55.js";
|
|
10
10
|
import "../chunk-4M4LCQ43.js";
|
|
@@ -15,8 +15,8 @@ import "../chunk-2ATICEW3.js";
|
|
|
15
15
|
import "../chunk-ZAU4JVLL.js";
|
|
16
16
|
import "../chunk-4O4QFF4S.js";
|
|
17
17
|
import "../chunk-JIZQFTW6.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-BEYPMC73.js";
|
|
19
|
+
import "../chunk-GVNPFXKL.js";
|
|
20
20
|
import "../chunk-C5HLLGME.js";
|
|
21
21
|
export {
|
|
22
22
|
PromptModal,
|
package/build/modern/index.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NotificationCenter,
|
|
3
|
+
useNotificationCenter
|
|
4
|
+
} from "./chunk-32E6OUMD.js";
|
|
5
|
+
import {
|
|
6
|
+
PromptModal,
|
|
7
|
+
usePromptModal
|
|
8
|
+
} from "./chunk-BMQ7I2PL.js";
|
|
9
|
+
import {
|
|
10
|
+
Tab
|
|
11
|
+
} from "./chunk-SONHHNYQ.js";
|
|
12
|
+
import {
|
|
13
|
+
TabList
|
|
14
|
+
} from "./chunk-ISPTI4GC.js";
|
|
15
|
+
import {
|
|
16
|
+
TabPanel
|
|
17
|
+
} from "./chunk-U72VPIZA.js";
|
|
1
18
|
import {
|
|
2
19
|
Tag
|
|
3
20
|
} from "./chunk-Z6IWNVPN.js";
|
|
@@ -6,15 +23,11 @@ import {
|
|
|
6
23
|
} from "./chunk-TCO46FK7.js";
|
|
7
24
|
import {
|
|
8
25
|
Toggle
|
|
9
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IL5ELPTT.js";
|
|
10
27
|
import {
|
|
11
28
|
ConfirmModal,
|
|
12
29
|
useConfirmModal
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
PromptModal,
|
|
16
|
-
usePromptModal
|
|
17
|
-
} from "./chunk-DKHQ5GBY.js";
|
|
30
|
+
} from "./chunk-ZPWSMCZ5.js";
|
|
18
31
|
import {
|
|
19
32
|
NavMenuList,
|
|
20
33
|
getPosition
|
|
@@ -26,24 +39,24 @@ import {
|
|
|
26
39
|
NavMenu,
|
|
27
40
|
useNavMenuContext
|
|
28
41
|
} from "./chunk-KJUCHZHV.js";
|
|
42
|
+
import {
|
|
43
|
+
Notification
|
|
44
|
+
} from "./chunk-OCBED5GL.js";
|
|
45
|
+
import {
|
|
46
|
+
NotificationDescription
|
|
47
|
+
} from "./chunk-SINTHADQ.js";
|
|
48
|
+
import {
|
|
49
|
+
NotificationHeading
|
|
50
|
+
} from "./chunk-NWMNEJGU.js";
|
|
29
51
|
import {
|
|
30
52
|
Portal
|
|
31
53
|
} from "./chunk-4CAT3FHV.js";
|
|
32
54
|
import {
|
|
33
55
|
Radio
|
|
34
56
|
} from "./chunk-PH64POOB.js";
|
|
35
|
-
import {
|
|
36
|
-
Tab
|
|
37
|
-
} from "./chunk-SONHHNYQ.js";
|
|
38
|
-
import {
|
|
39
|
-
TabList
|
|
40
|
-
} from "./chunk-ISPTI4GC.js";
|
|
41
|
-
import {
|
|
42
|
-
TabPanel
|
|
43
|
-
} from "./chunk-U72VPIZA.js";
|
|
44
57
|
import {
|
|
45
58
|
Input
|
|
46
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-XB4ZRAH4.js";
|
|
47
60
|
import {
|
|
48
61
|
Label
|
|
49
62
|
} from "./chunk-JJGZRBIR.js";
|
|
@@ -97,7 +110,7 @@ import {
|
|
|
97
110
|
} from "./chunk-ZAU4JVLL.js";
|
|
98
111
|
import {
|
|
99
112
|
FileUploader
|
|
100
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-3YORUZIQ.js";
|
|
101
114
|
import {
|
|
102
115
|
Show
|
|
103
116
|
} from "./chunk-4O4QFF4S.js";
|
|
@@ -122,8 +135,8 @@ import {
|
|
|
122
135
|
import {
|
|
123
136
|
$cerberusIcons,
|
|
124
137
|
defineIcons
|
|
125
|
-
} from "./chunk-
|
|
126
|
-
import "./chunk-
|
|
138
|
+
} from "./chunk-BEYPMC73.js";
|
|
139
|
+
import "./chunk-GVNPFXKL.js";
|
|
127
140
|
import {
|
|
128
141
|
useModal
|
|
129
142
|
} from "./chunk-C5HLLGME.js";
|
|
@@ -153,6 +166,10 @@ export {
|
|
|
153
166
|
NavMenuLink,
|
|
154
167
|
NavMenuList,
|
|
155
168
|
NavMenuTrigger,
|
|
169
|
+
Notification,
|
|
170
|
+
NotificationCenter,
|
|
171
|
+
NotificationDescription,
|
|
172
|
+
NotificationHeading,
|
|
156
173
|
Portal,
|
|
157
174
|
PromptModal,
|
|
158
175
|
Radio,
|
|
@@ -176,6 +193,7 @@ export {
|
|
|
176
193
|
useFieldContext,
|
|
177
194
|
useModal,
|
|
178
195
|
useNavMenuContext,
|
|
196
|
+
useNotificationCenter,
|
|
179
197
|
usePromptModal,
|
|
180
198
|
useTabsContext,
|
|
181
199
|
useTabsKeyboardNavigation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Portal'\nexport * from './components/Radio'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/Radio'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.7.4-next-
|
|
3
|
+
"version": "0.7.4-next-9a605c3",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"react": "^18",
|
|
26
26
|
"react-dom": "^18",
|
|
27
27
|
"tsup": "^8.1.0",
|
|
28
|
-
"@cerberus-design/
|
|
29
|
-
"@cerberus-design/
|
|
28
|
+
"@cerberus-design/styled-system": "0.7.4-next-9a605c3",
|
|
29
|
+
"@cerberus-design/configs": "0.0.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { cx } from '@cerberus-design/styled-system/css'
|
|
4
|
+
import { hstack, vstack } from '@cerberus-design/styled-system/patterns'
|
|
5
|
+
import {
|
|
6
|
+
notification,
|
|
7
|
+
type NotificationVariantProps,
|
|
8
|
+
} from '@cerberus-design/styled-system/recipes'
|
|
9
|
+
import {
|
|
10
|
+
useRef,
|
|
11
|
+
type DialogHTMLAttributes,
|
|
12
|
+
type PropsWithChildren,
|
|
13
|
+
type MouseEvent,
|
|
14
|
+
} from 'react'
|
|
15
|
+
import { IconButton } from './IconButton'
|
|
16
|
+
import { Close } from '@cerberus/icons'
|
|
17
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
18
|
+
import type { IconType } from '../config/cerbIcons'
|
|
19
|
+
import { trapFocus } from '../aria-helpers/trap-focus.aria'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This module exports the Notification component.
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
function MatchNotificationIcon(props: NotificationVariantProps) {
|
|
27
|
+
const palette = props.palette || 'info'
|
|
28
|
+
const key = `${palette}Notification` as keyof typeof $cerberusIcons
|
|
29
|
+
const Icon = $cerberusIcons[key] as IconType
|
|
30
|
+
return <Icon />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NotificationBaseProps
|
|
34
|
+
extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {
|
|
35
|
+
id: string
|
|
36
|
+
onClose?: (e: MouseEvent<HTMLButtonElement>) => void
|
|
37
|
+
}
|
|
38
|
+
export type NotificationProps = NotificationBaseProps & NotificationVariantProps
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The info notification component.
|
|
42
|
+
* @param props - The component props.
|
|
43
|
+
* @returns The info notification component.
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <Notification id="info:1" open>
|
|
47
|
+
* <NotificationHeading>Info Notification</NotificationHeading>
|
|
48
|
+
* <NotificationDescription>
|
|
49
|
+
* This is a description with a <a href="#">link</a> in the message.
|
|
50
|
+
* </NotificationDescription>
|
|
51
|
+
* </Notification>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function Notification(props: PropsWithChildren<NotificationProps>) {
|
|
55
|
+
const { children, palette, onClose, ...nativeProps } = props
|
|
56
|
+
const ref = useRef<HTMLDialogElement>(null)
|
|
57
|
+
const onKeyDown = trapFocus(ref)
|
|
58
|
+
const styles = notification({ palette })
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<dialog
|
|
62
|
+
{...nativeProps}
|
|
63
|
+
className={cx(
|
|
64
|
+
nativeProps.className,
|
|
65
|
+
hstack({
|
|
66
|
+
position: 'relative',
|
|
67
|
+
gap: '4',
|
|
68
|
+
}),
|
|
69
|
+
styles.dialog,
|
|
70
|
+
)}
|
|
71
|
+
onKeyDown={onKeyDown}
|
|
72
|
+
ref={ref}
|
|
73
|
+
role="alert"
|
|
74
|
+
>
|
|
75
|
+
<span className={styles.icon}>
|
|
76
|
+
<MatchNotificationIcon palette={palette} />
|
|
77
|
+
</span>
|
|
78
|
+
|
|
79
|
+
<div
|
|
80
|
+
className={vstack({
|
|
81
|
+
alignItems: 'flex-start',
|
|
82
|
+
gap: '0',
|
|
83
|
+
py: '2',
|
|
84
|
+
})}
|
|
85
|
+
>
|
|
86
|
+
{children}
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<IconButton ariaLabel="Close" onClick={onClose} value={props.id}>
|
|
90
|
+
<Close />
|
|
91
|
+
</IconButton>
|
|
92
|
+
</dialog>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module exports the NotificationDescription component.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { cx } from '@cerberus-design/styled-system/css'
|
|
7
|
+
import {
|
|
8
|
+
notification,
|
|
9
|
+
type NotificationVariantProps,
|
|
10
|
+
} from '@cerberus-design/styled-system/recipes'
|
|
11
|
+
import type { HTMLAttributes } from 'react'
|
|
12
|
+
|
|
13
|
+
export interface BaseNotificationDescriptionProps
|
|
14
|
+
extends HTMLAttributes<HTMLParagraphElement> {}
|
|
15
|
+
export type NotificationDescriptionProps = BaseNotificationDescriptionProps &
|
|
16
|
+
NotificationVariantProps
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The NotificationDescription component is used to render the description of a notification.
|
|
20
|
+
* @param props - The anything a HTMLParagraphElement can accept.
|
|
21
|
+
*/
|
|
22
|
+
export function NotificationDescription(props: NotificationDescriptionProps) {
|
|
23
|
+
const { palette, ...nativeProps } = props
|
|
24
|
+
const styles = notification({ palette })
|
|
25
|
+
return (
|
|
26
|
+
<p
|
|
27
|
+
className={cx(nativeProps.className, styles.description)}
|
|
28
|
+
{...nativeProps}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module exports the NotificationHeading component.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { cx } from '@cerberus-design/styled-system/css'
|
|
7
|
+
import {
|
|
8
|
+
notification,
|
|
9
|
+
type NotificationVariantProps,
|
|
10
|
+
} from '@cerberus-design/styled-system/recipes'
|
|
11
|
+
import type { HTMLAttributes } from 'react'
|
|
12
|
+
|
|
13
|
+
export interface BaseNotificationHeadingProps
|
|
14
|
+
extends HTMLAttributes<HTMLParagraphElement> {}
|
|
15
|
+
export type NotificationHeadingProps = BaseNotificationHeadingProps &
|
|
16
|
+
NotificationVariantProps
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The NotificationHeading component is used to render the heading of a notification.
|
|
20
|
+
* @param props - The anything a HTMLParagraphElement can accept.
|
|
21
|
+
*/
|
|
22
|
+
export function NotificationHeading(props: NotificationHeadingProps) {
|
|
23
|
+
const { palette, ...nativeProps } = props
|
|
24
|
+
const styles = notification({ palette })
|
|
25
|
+
return (
|
|
26
|
+
<p className={cx(nativeProps.className, styles.heading)} {...nativeProps} />
|
|
27
|
+
)
|
|
28
|
+
}
|
package/src/config/cerbIcons.ts
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkmark,
|
|
3
|
+
CheckmarkFilled,
|
|
3
4
|
CloudUpload,
|
|
5
|
+
ErrorFilled,
|
|
4
6
|
Information,
|
|
7
|
+
InformationFilled,
|
|
5
8
|
WarningFilled,
|
|
6
9
|
type CarbonIconType,
|
|
7
10
|
} from '@cerberus/icons'
|
|
8
11
|
import type { ElementType } from 'react'
|
|
9
12
|
|
|
13
|
+
export type IconType = CarbonIconType | ElementType
|
|
14
|
+
|
|
10
15
|
export interface DefinedIcons {
|
|
11
|
-
confirmModal?:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
confirmModal?: IconType
|
|
17
|
+
promptModal?: IconType
|
|
18
|
+
fileUploader?: IconType
|
|
19
|
+
infoNotification?: IconType
|
|
20
|
+
successNotification?: IconType
|
|
21
|
+
warningNotification?: IconType
|
|
22
|
+
dangerNotification?: IconType
|
|
23
|
+
invalid: IconType
|
|
24
|
+
toggleChecked?: IconType
|
|
16
25
|
}
|
|
17
26
|
|
|
18
27
|
export const defaultIcons: DefinedIcons = {
|
|
19
28
|
confirmModal: Information,
|
|
20
|
-
fileUploader: CloudUpload,
|
|
21
29
|
promptModal: Information,
|
|
30
|
+
fileUploader: CloudUpload,
|
|
31
|
+
infoNotification: InformationFilled,
|
|
32
|
+
successNotification: CheckmarkFilled,
|
|
33
|
+
warningNotification: WarningFilled,
|
|
34
|
+
dangerNotification: ErrorFilled,
|
|
22
35
|
invalid: WarningFilled,
|
|
23
36
|
toggleChecked: Checkmark,
|
|
24
37
|
}
|