@cerberus-design/react 0.8.0-next-4b2aad4 → 0.8.1-next-956775c
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/aria-helpers/nav-menu.aria.cjs +36 -0
- package/build/legacy/aria-helpers/nav-menu.aria.cjs.map +1 -0
- package/build/legacy/aria-helpers/tabs.aria.cjs +100 -0
- package/build/legacy/aria-helpers/tabs.aria.cjs.map +1 -0
- package/build/legacy/aria-helpers/trap-focus.aria.cjs +54 -0
- package/build/legacy/aria-helpers/trap-focus.aria.cjs.map +1 -0
- package/build/legacy/components/Button.cjs +50 -0
- package/build/legacy/components/Button.cjs.map +1 -0
- package/build/legacy/components/Checkbox.cjs +157 -0
- package/build/legacy/components/Checkbox.cjs.map +1 -0
- package/build/legacy/components/Droppable.cjs +54 -0
- package/build/legacy/components/Droppable.cjs.map +1 -0
- package/build/legacy/components/FeatureFlag.cjs +63 -0
- package/build/legacy/components/FeatureFlag.cjs.map +1 -0
- package/build/legacy/components/FieldMessage.cjs +59 -0
- package/build/legacy/components/FieldMessage.cjs.map +1 -0
- package/build/legacy/components/FileStatus.cjs +390 -0
- package/build/legacy/components/FileStatus.cjs.map +1 -0
- package/build/legacy/components/FileUploader.cjs +159 -0
- package/build/legacy/components/FileUploader.cjs.map +1 -0
- package/build/legacy/components/IconButton.cjs +53 -0
- package/build/legacy/components/IconButton.cjs.map +1 -0
- package/build/legacy/components/Input.cjs +145 -0
- package/build/legacy/components/Input.cjs.map +1 -0
- package/build/legacy/components/Label.cjs +93 -0
- package/build/legacy/components/Label.cjs.map +1 -0
- package/build/legacy/components/Modal.cjs +45 -0
- package/build/legacy/components/Modal.cjs.map +1 -0
- package/build/legacy/components/ModalDescription.cjs +36 -0
- package/build/legacy/components/ModalDescription.cjs.map +1 -0
- package/build/legacy/components/ModalHeader.cjs +49 -0
- package/build/legacy/components/ModalHeader.cjs.map +1 -0
- package/build/legacy/components/ModalHeading.cjs +36 -0
- package/build/legacy/components/ModalHeading.cjs.map +1 -0
- package/build/legacy/components/ModalIcon.cjs +51 -0
- package/build/legacy/components/ModalIcon.cjs.map +1 -0
- package/build/legacy/components/NavMenuLink.cjs +81 -0
- package/build/legacy/components/NavMenuLink.cjs.map +1 -0
- package/build/legacy/components/NavMenuList.cjs +131 -0
- package/build/legacy/components/NavMenuList.cjs.map +1 -0
- package/build/legacy/components/NavMenuTrigger.cjs +128 -0
- package/build/legacy/components/NavMenuTrigger.cjs.map +1 -0
- package/build/legacy/components/Notification.cjs +181 -0
- package/build/legacy/components/Notification.cjs.map +1 -0
- package/build/legacy/components/NotificationDescription.cjs +44 -0
- package/build/legacy/components/NotificationDescription.cjs.map +1 -0
- package/build/legacy/components/NotificationHeading.cjs +38 -0
- package/build/legacy/components/NotificationHeading.cjs.map +1 -0
- package/build/legacy/components/Portal.cjs +35 -0
- package/build/legacy/components/Portal.cjs.map +1 -0
- package/build/legacy/components/ProgressBar.cjs +61 -0
- package/build/legacy/components/ProgressBar.cjs.map +1 -0
- package/build/legacy/components/Radio.cjs +68 -0
- package/build/legacy/components/Radio.cjs.map +1 -0
- package/build/legacy/components/Select.cjs +170 -0
- package/build/legacy/components/Select.cjs.map +1 -0
- package/build/legacy/components/Show.cjs +40 -0
- package/build/legacy/components/Show.cjs.map +1 -0
- package/build/legacy/components/Tab.cjs +135 -0
- package/build/legacy/components/Tab.cjs.map +1 -0
- package/build/legacy/components/TabList.cjs +68 -0
- package/build/legacy/components/TabList.cjs.map +1 -0
- package/build/legacy/components/TabPanel.cjs +76 -0
- package/build/legacy/components/TabPanel.cjs.map +1 -0
- package/build/legacy/components/Table.cjs +53 -0
- package/build/legacy/components/Table.cjs.map +1 -0
- package/build/legacy/components/Tag.cjs +91 -0
- package/build/legacy/components/Tag.cjs.map +1 -0
- package/build/legacy/components/Tbody.cjs +48 -0
- package/build/legacy/components/Tbody.cjs.map +1 -0
- package/build/legacy/components/Td.cjs +48 -0
- package/build/legacy/components/Td.cjs.map +1 -0
- package/build/legacy/components/Textarea.cjs +71 -0
- package/build/legacy/components/Textarea.cjs.map +1 -0
- package/build/legacy/components/Th.cjs +80 -0
- package/build/legacy/components/Th.cjs.map +1 -0
- package/build/legacy/components/Thead.cjs +36 -0
- package/build/legacy/components/Thead.cjs.map +1 -0
- package/build/legacy/components/Toggle.cjs +151 -0
- package/build/legacy/components/Toggle.cjs.map +1 -0
- package/build/legacy/config/cerbIcons.cjs +88 -0
- package/build/legacy/config/cerbIcons.cjs.map +1 -0
- package/build/legacy/config/defineIcons.cjs +110 -0
- package/build/legacy/config/defineIcons.cjs.map +1 -0
- package/build/legacy/config/icons/checkbox.icons.cjs +67 -0
- package/build/legacy/config/icons/checkbox.icons.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +371 -0
- package/build/legacy/context/confirm-modal.cjs.map +1 -0
- package/build/legacy/context/feature-flags.cjs +48 -0
- package/build/legacy/context/feature-flags.cjs.map +1 -0
- package/build/legacy/context/field.cjs +55 -0
- package/build/legacy/context/field.cjs.map +1 -0
- package/build/legacy/context/navMenu.cjs +70 -0
- package/build/legacy/context/navMenu.cjs.map +1 -0
- package/build/legacy/context/notification-center.cjs +347 -0
- package/build/legacy/context/notification-center.cjs.map +1 -0
- package/build/legacy/context/prompt-modal.cjs +508 -0
- package/build/legacy/context/prompt-modal.cjs.map +1 -0
- package/build/legacy/context/tabs.cjs +78 -0
- package/build/legacy/context/tabs.cjs.map +1 -0
- package/build/legacy/context/theme.cjs +104 -0
- package/build/legacy/context/theme.cjs.map +1 -0
- package/build/legacy/hooks/useModal.cjs +50 -0
- package/build/legacy/hooks/useModal.cjs.map +1 -0
- package/build/legacy/hooks/useTheme.cjs +87 -0
- package/build/legacy/hooks/useTheme.cjs.map +1 -0
- package/build/legacy/hooks/useToggle.cjs +47 -0
- package/build/legacy/hooks/useToggle.cjs.map +1 -0
- package/build/legacy/index.cjs +2165 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/types.cjs +19 -0
- package/build/legacy/types.cjs.map +1 -0
- package/package.json +7 -7
- package/build/legacy/aria-helpers/nav-menu.aria.js +0 -7
- package/build/legacy/aria-helpers/nav-menu.aria.js.map +0 -1
- package/build/legacy/aria-helpers/tabs.aria.js +0 -9
- package/build/legacy/aria-helpers/tabs.aria.js.map +0 -1
- package/build/legacy/aria-helpers/trap-focus.aria.js +0 -7
- package/build/legacy/aria-helpers/trap-focus.aria.js.map +0 -1
- package/build/legacy/chunk-23UPROCG.js +0 -63
- package/build/legacy/chunk-23UPROCG.js.map +0 -1
- package/build/legacy/chunk-2FK7NR7Y.js +0 -50
- package/build/legacy/chunk-2FK7NR7Y.js.map +0 -1
- package/build/legacy/chunk-2UFNQM55.js +0 -21
- package/build/legacy/chunk-2UFNQM55.js.map +0 -1
- package/build/legacy/chunk-3C2DJSEE.js +0 -16
- package/build/legacy/chunk-3C2DJSEE.js.map +0 -1
- package/build/legacy/chunk-3GXISGPS.js +0 -47
- package/build/legacy/chunk-3GXISGPS.js.map +0 -1
- package/build/legacy/chunk-3RRNMPFC.js +0 -122
- package/build/legacy/chunk-3RRNMPFC.js.map +0 -1
- package/build/legacy/chunk-4CAT3FHV.js +0 -11
- package/build/legacy/chunk-4CAT3FHV.js.map +0 -1
- package/build/legacy/chunk-4FD33RTW.js +0 -56
- package/build/legacy/chunk-4FD33RTW.js.map +0 -1
- package/build/legacy/chunk-4M3EUP57.js +0 -22
- package/build/legacy/chunk-4M3EUP57.js.map +0 -1
- package/build/legacy/chunk-4M4LCQ43.js +0 -12
- package/build/legacy/chunk-4M4LCQ43.js.map +0 -1
- package/build/legacy/chunk-4O4QFF4S.js +0 -15
- package/build/legacy/chunk-4O4QFF4S.js.map +0 -1
- package/build/legacy/chunk-53QBTZZF.js +0 -42
- package/build/legacy/chunk-53QBTZZF.js.map +0 -1
- package/build/legacy/chunk-55J6XMHW.js +0 -1
- package/build/legacy/chunk-55J6XMHW.js.map +0 -1
- package/build/legacy/chunk-5WVXIAG2.js +0 -27
- package/build/legacy/chunk-5WVXIAG2.js.map +0 -1
- package/build/legacy/chunk-6DIGPXAD.js +0 -48
- package/build/legacy/chunk-6DIGPXAD.js.map +0 -1
- package/build/legacy/chunk-6F34A7NZ.js +0 -28
- package/build/legacy/chunk-6F34A7NZ.js.map +0 -1
- package/build/legacy/chunk-7NX4RGDB.js +0 -218
- package/build/legacy/chunk-7NX4RGDB.js.map +0 -1
- package/build/legacy/chunk-7VJOPJVX.js +0 -29
- package/build/legacy/chunk-7VJOPJVX.js.map +0 -1
- package/build/legacy/chunk-A5WYZVUR.js +0 -28
- package/build/legacy/chunk-A5WYZVUR.js.map +0 -1
- package/build/legacy/chunk-CP7OUC2Q.js +0 -42
- package/build/legacy/chunk-CP7OUC2Q.js.map +0 -1
- package/build/legacy/chunk-EVEEQRH6.js +0 -58
- package/build/legacy/chunk-EVEEQRH6.js.map +0 -1
- package/build/legacy/chunk-GKUDLVOV.js +0 -64
- package/build/legacy/chunk-GKUDLVOV.js.map +0 -1
- package/build/legacy/chunk-GUECLKHY.js +0 -43
- package/build/legacy/chunk-GUECLKHY.js.map +0 -1
- package/build/legacy/chunk-HW76XVA3.js +0 -22
- package/build/legacy/chunk-HW76XVA3.js.map +0 -1
- package/build/legacy/chunk-ID3XWGLY.js +0 -58
- package/build/legacy/chunk-ID3XWGLY.js.map +0 -1
- package/build/legacy/chunk-ISPTI4GC.js +0 -32
- package/build/legacy/chunk-ISPTI4GC.js.map +0 -1
- package/build/legacy/chunk-JB7IQ2BM.js +0 -12
- package/build/legacy/chunk-JB7IQ2BM.js.map +0 -1
- package/build/legacy/chunk-JF76VIL3.js +0 -12
- package/build/legacy/chunk-JF76VIL3.js.map +0 -1
- package/build/legacy/chunk-JHAI4ZHG.js +0 -76
- package/build/legacy/chunk-JHAI4ZHG.js.map +0 -1
- package/build/legacy/chunk-KESKDLX6.js +0 -30
- package/build/legacy/chunk-KESKDLX6.js.map +0 -1
- package/build/legacy/chunk-KF24CS4S.js +0 -58
- package/build/legacy/chunk-KF24CS4S.js.map +0 -1
- package/build/legacy/chunk-KJUCHZHV.js +0 -51
- package/build/legacy/chunk-KJUCHZHV.js.map +0 -1
- package/build/legacy/chunk-KUQZECNS.js +0 -155
- package/build/legacy/chunk-KUQZECNS.js.map +0 -1
- package/build/legacy/chunk-N3FUF4TB.js +0 -12
- package/build/legacy/chunk-N3FUF4TB.js.map +0 -1
- package/build/legacy/chunk-NE5NHILF.js +0 -47
- package/build/legacy/chunk-NE5NHILF.js.map +0 -1
- package/build/legacy/chunk-PH64POOB.js +0 -33
- package/build/legacy/chunk-PH64POOB.js.map +0 -1
- package/build/legacy/chunk-PJ3744I6.js +0 -24
- package/build/legacy/chunk-PJ3744I6.js.map +0 -1
- package/build/legacy/chunk-PMCYXRAH.js +0 -86
- package/build/legacy/chunk-PMCYXRAH.js.map +0 -1
- package/build/legacy/chunk-QU7UV5DB.js +0 -25
- package/build/legacy/chunk-QU7UV5DB.js.map +0 -1
- package/build/legacy/chunk-RHG26FYL.js +0 -68
- package/build/legacy/chunk-RHG26FYL.js.map +0 -1
- package/build/legacy/chunk-RPZAPUCF.js +0 -81
- package/build/legacy/chunk-RPZAPUCF.js.map +0 -1
- package/build/legacy/chunk-SCQVXJBT.js +0 -22
- package/build/legacy/chunk-SCQVXJBT.js.map +0 -1
- package/build/legacy/chunk-SLHX5K6I.js +0 -29
- package/build/legacy/chunk-SLHX5K6I.js.map +0 -1
- package/build/legacy/chunk-SXXWC6UD.js +0 -83
- package/build/legacy/chunk-SXXWC6UD.js.map +0 -1
- package/build/legacy/chunk-TCO46FK7.js +0 -36
- package/build/legacy/chunk-TCO46FK7.js.map +0 -1
- package/build/legacy/chunk-TJI2SJCZ.js +0 -208
- package/build/legacy/chunk-TJI2SJCZ.js.map +0 -1
- package/build/legacy/chunk-TYTEREKZ.js +0 -39
- package/build/legacy/chunk-TYTEREKZ.js.map +0 -1
- package/build/legacy/chunk-TZNYJ3G7.js +0 -25
- package/build/legacy/chunk-TZNYJ3G7.js.map +0 -1
- package/build/legacy/chunk-U72VPIZA.js +0 -32
- package/build/legacy/chunk-U72VPIZA.js.map +0 -1
- package/build/legacy/chunk-VCR5C6Q3.js +0 -29
- package/build/legacy/chunk-VCR5C6Q3.js.map +0 -1
- package/build/legacy/chunk-VGHVH2T3.js +0 -24
- package/build/legacy/chunk-VGHVH2T3.js.map +0 -1
- package/build/legacy/chunk-VULPMZUW.js +0 -18
- package/build/legacy/chunk-VULPMZUW.js.map +0 -1
- package/build/legacy/chunk-XREC5IJE.js +0 -24
- package/build/legacy/chunk-XREC5IJE.js.map +0 -1
- package/build/legacy/chunk-ZAU4JVLL.js +0 -33
- package/build/legacy/chunk-ZAU4JVLL.js.map +0 -1
- package/build/legacy/components/Button.js +0 -7
- package/build/legacy/components/Button.js.map +0 -1
- package/build/legacy/components/Checkbox.js +0 -13
- package/build/legacy/components/Checkbox.js.map +0 -1
- package/build/legacy/components/Droppable.js +0 -8
- package/build/legacy/components/Droppable.js.map +0 -1
- package/build/legacy/components/FeatureFlag.js +0 -10
- package/build/legacy/components/FeatureFlag.js.map +0 -1
- package/build/legacy/components/FieldMessage.js +0 -9
- package/build/legacy/components/FieldMessage.js.map +0 -1
- package/build/legacy/components/FileStatus.js +0 -17
- package/build/legacy/components/FileStatus.js.map +0 -1
- package/build/legacy/components/FileUploader.js +0 -12
- package/build/legacy/components/FileUploader.js.map +0 -1
- package/build/legacy/components/IconButton.js +0 -7
- package/build/legacy/components/IconButton.js.map +0 -1
- package/build/legacy/components/Input.js +0 -13
- package/build/legacy/components/Input.js.map +0 -1
- package/build/legacy/components/Label.js +0 -10
- package/build/legacy/components/Label.js.map +0 -1
- package/build/legacy/components/Modal.js +0 -7
- package/build/legacy/components/Modal.js.map +0 -1
- package/build/legacy/components/ModalDescription.js +0 -7
- package/build/legacy/components/ModalDescription.js.map +0 -1
- package/build/legacy/components/ModalHeader.js +0 -7
- package/build/legacy/components/ModalHeader.js.map +0 -1
- package/build/legacy/components/ModalHeading.js +0 -7
- package/build/legacy/components/ModalHeading.js.map +0 -1
- package/build/legacy/components/ModalIcon.js +0 -7
- package/build/legacy/components/ModalIcon.js.map +0 -1
- package/build/legacy/components/NavMenuLink.js +0 -8
- package/build/legacy/components/NavMenuLink.js.map +0 -1
- package/build/legacy/components/NavMenuList.js +0 -12
- package/build/legacy/components/NavMenuList.js.map +0 -1
- package/build/legacy/components/NavMenuTrigger.js +0 -11
- package/build/legacy/components/NavMenuTrigger.js.map +0 -1
- package/build/legacy/components/Notification.js +0 -12
- package/build/legacy/components/Notification.js.map +0 -1
- package/build/legacy/components/NotificationDescription.js +0 -7
- package/build/legacy/components/NotificationDescription.js.map +0 -1
- package/build/legacy/components/NotificationHeading.js +0 -7
- package/build/legacy/components/NotificationHeading.js.map +0 -1
- package/build/legacy/components/Portal.js +0 -7
- package/build/legacy/components/Portal.js.map +0 -1
- package/build/legacy/components/ProgressBar.js +0 -7
- package/build/legacy/components/ProgressBar.js.map +0 -1
- package/build/legacy/components/Radio.js +0 -9
- package/build/legacy/components/Radio.js.map +0 -1
- package/build/legacy/components/Select.js +0 -15
- package/build/legacy/components/Select.js.map +0 -1
- package/build/legacy/components/Show.js +0 -8
- package/build/legacy/components/Show.js.map +0 -1
- package/build/legacy/components/Tab.js +0 -10
- package/build/legacy/components/Tab.js.map +0 -1
- package/build/legacy/components/TabList.js +0 -9
- package/build/legacy/components/TabList.js.map +0 -1
- package/build/legacy/components/TabPanel.js +0 -10
- package/build/legacy/components/TabPanel.js.map +0 -1
- package/build/legacy/components/Table.js +0 -9
- package/build/legacy/components/Table.js.map +0 -1
- package/build/legacy/components/Tag.js +0 -8
- package/build/legacy/components/Tag.js.map +0 -1
- package/build/legacy/components/Tbody.js +0 -7
- package/build/legacy/components/Tbody.js.map +0 -1
- package/build/legacy/components/Td.js +0 -7
- package/build/legacy/components/Td.js.map +0 -1
- package/build/legacy/components/Textarea.js +0 -9
- package/build/legacy/components/Textarea.js.map +0 -1
- package/build/legacy/components/Th.js +0 -8
- package/build/legacy/components/Th.js.map +0 -1
- package/build/legacy/components/Thead.js +0 -7
- package/build/legacy/components/Thead.js.map +0 -1
- package/build/legacy/components/Toggle.js +0 -12
- package/build/legacy/components/Toggle.js.map +0 -1
- package/build/legacy/config/cerbIcons.js +0 -8
- package/build/legacy/config/cerbIcons.js.map +0 -1
- package/build/legacy/config/defineIcons.js +0 -11
- package/build/legacy/config/defineIcons.js.map +0 -1
- package/build/legacy/config/icons/checkbox.icons.js +0 -9
- package/build/legacy/config/icons/checkbox.icons.js.map +0 -1
- package/build/legacy/context/confirm-modal.js +0 -23
- package/build/legacy/context/confirm-modal.js.map +0 -1
- package/build/legacy/context/feature-flags.js +0 -10
- package/build/legacy/context/feature-flags.js.map +0 -1
- package/build/legacy/context/field.js +0 -10
- package/build/legacy/context/field.js.map +0 -1
- package/build/legacy/context/navMenu.js +0 -10
- package/build/legacy/context/navMenu.js.map +0 -1
- package/build/legacy/context/notification-center.js +0 -20
- package/build/legacy/context/notification-center.js.map +0 -1
- package/build/legacy/context/prompt-modal.js +0 -26
- package/build/legacy/context/prompt-modal.js.map +0 -1
- package/build/legacy/context/tabs.js +0 -12
- package/build/legacy/context/tabs.js.map +0 -1
- package/build/legacy/context/theme.js +0 -14
- package/build/legacy/context/theme.js.map +0 -1
- package/build/legacy/hooks/useModal.js +0 -8
- package/build/legacy/hooks/useModal.js.map +0 -1
- package/build/legacy/hooks/useTheme.js +0 -8
- package/build/legacy/hooks/useTheme.js.map +0 -1
- package/build/legacy/hooks/useToggle.js +0 -8
- package/build/legacy/hooks/useToggle.js.map +0 -1
- package/build/legacy/index.js +0 -247
- package/build/legacy/index.js.map +0 -1
- package/build/legacy/types.js +0 -2
- package/build/legacy/types.js.map +0 -1
- /package/build/legacy/{_tsup-dts-rollup.d.ts → _tsup-dts-rollup.d.cts} +0 -0
- /package/build/legacy/{noExternals.d.ts → noExternals.d.cts} +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useTabsContext
|
|
3
|
-
} from "./chunk-KF24CS4S.js";
|
|
4
|
-
|
|
5
|
-
// src/components/TabList.tsx
|
|
6
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
7
|
-
import { hstack } from "@cerberus/styled-system/patterns";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
function TabList(props) {
|
|
10
|
-
const { description, ...nativeProps } = props;
|
|
11
|
-
const { id, styles } = useTabsContext();
|
|
12
|
-
return /* @__PURE__ */ jsx(
|
|
13
|
-
"div",
|
|
14
|
-
{
|
|
15
|
-
...nativeProps,
|
|
16
|
-
"aria-describedby": description,
|
|
17
|
-
className: cx(
|
|
18
|
-
nativeProps.className,
|
|
19
|
-
hstack({
|
|
20
|
-
gap: "0"
|
|
21
|
-
}),
|
|
22
|
-
styles.tabList
|
|
23
|
-
),
|
|
24
|
-
id: id ?? nativeProps.id
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
TabList
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=chunk-ISPTI4GC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/TabList.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { useTabsContext } from '../context/tabs'\n\n/**\n * This module provides a TabList component.\n * @module\n */\n\nexport interface TabListProps extends HTMLAttributes<HTMLDivElement> {\n description: string\n}\n\n/**\n * The TabList component provides a container for tab elements.\n * @param description - a description of what the tab list contains\n * @example\n * ```tsx\n * <TabList description=\"Button details\">\n * <Tab id=\"overview\">Overview</Tab>\n * <Tab id=\"guidelines\">Guidelines</Tab>\n * </TabList>\n * ```\n */\nexport function TabList(props: PropsWithChildren<TabListProps>) {\n const { description, ...nativeProps } = props\n const { id, styles } = useTabsContext()\n\n return (\n <div\n {...nativeProps}\n aria-describedby={description}\n className={cx(\n nativeProps.className,\n hstack({\n gap: '0',\n }),\n styles.tabList,\n )}\n id={id ?? nativeProps.id}\n />\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,UAAU;AACnB,SAAS,cAAc;AA6BnB;AALG,SAAS,QAAQ,OAAwC;AAC9D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,QAAM,EAAE,IAAI,OAAO,IAAI,eAAe;AAEtC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,oBAAkB;AAAA,MAClB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,KAAK;AAAA,QACP,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MACA,IAAI,MAAM,YAAY;AAAA;AAAA,EACxB;AAEJ;","names":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/components/ModalHeading.tsx
|
|
2
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
3
|
-
import { modal } from "@cerberus/styled-system/recipes";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
function ModalHeading(props) {
|
|
6
|
-
return /* @__PURE__ */ jsx("p", { ...props, className: cx(props.className, modal().heading) });
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
ModalHeading
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=chunk-JB7IQ2BM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 * The ModalHeading component is a heading element for a customizable modal.\n * @example\n * ```tsx\n * <Modal>\n * <ModalHeading>Modal Heading</ModalHeading>\n * </Modal>\n * ```\n */\nexport function ModalHeading(props: ModalHeadingProps) {\n return <p {...props} className={cx(props.className, modal().heading)} />\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AAoBb;AADF,SAAS,aAAa,OAA0B;AACrD,SAAO,oBAAC,OAAG,GAAG,OAAO,WAAW,GAAG,MAAM,WAAW,MAAM,EAAE,OAAO,GAAG;AACxE;","names":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/aria-helpers/nav-menu.aria.ts
|
|
2
|
-
function createNavTriggerProps(values) {
|
|
3
|
-
return {
|
|
4
|
-
["aria-controls"]: values.controls,
|
|
5
|
-
["aria-expanded"]: values.expanded ?? false
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
createNavTriggerProps
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=chunk-JF76VIL3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aria-helpers/nav-menu.aria.ts"],"sourcesContent":["export interface NavTriggerAriaValues {\n controls: string\n expanded?: boolean\n}\n\ninterface NavTriggerAriaReturn {\n ['aria-controls']: string\n ['aria-expanded']: boolean\n}\n\nexport function createNavTriggerProps(\n values: NavTriggerAriaValues,\n): NavTriggerAriaReturn {\n return {\n ['aria-controls']: values.controls,\n ['aria-expanded']: values.expanded ?? false,\n }\n}\n"],"mappings":";AAUO,SAAS,sBACd,QACsB;AACtB,SAAO;AAAA,IACL,CAAC,eAAe,GAAG,OAAO;AAAA,IAC1B,CAAC,eAAe,GAAG,OAAO,YAAY;AAAA,EACxC;AACF;","names":[]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
trapFocus
|
|
3
|
-
} from "./chunk-KESKDLX6.js";
|
|
4
|
-
import {
|
|
5
|
-
$cerberusIcons
|
|
6
|
-
} from "./chunk-5WVXIAG2.js";
|
|
7
|
-
|
|
8
|
-
// src/components/Notification.tsx
|
|
9
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
10
|
-
import { hstack, vstack } from "@cerberus/styled-system/patterns";
|
|
11
|
-
import {
|
|
12
|
-
notification
|
|
13
|
-
} from "@cerberus/styled-system/recipes";
|
|
14
|
-
import {
|
|
15
|
-
useRef
|
|
16
|
-
} from "react";
|
|
17
|
-
import { Close } from "@cerberus/icons";
|
|
18
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
-
function MatchNotificationIcon(props) {
|
|
20
|
-
const palette = props.palette || "info";
|
|
21
|
-
const key = `${palette}Notification`;
|
|
22
|
-
const Icon = $cerberusIcons[key];
|
|
23
|
-
return /* @__PURE__ */ jsx(Icon, {});
|
|
24
|
-
}
|
|
25
|
-
function Notification(props) {
|
|
26
|
-
const { children, palette, onClose, ...nativeProps } = props;
|
|
27
|
-
const ref = useRef(null);
|
|
28
|
-
const onKeyDown = trapFocus(ref);
|
|
29
|
-
const styles = notification({ palette });
|
|
30
|
-
return /* @__PURE__ */ jsxs(
|
|
31
|
-
"dialog",
|
|
32
|
-
{
|
|
33
|
-
...nativeProps,
|
|
34
|
-
className: cx(
|
|
35
|
-
nativeProps.className,
|
|
36
|
-
hstack({
|
|
37
|
-
position: "relative",
|
|
38
|
-
gap: "4"
|
|
39
|
-
}),
|
|
40
|
-
styles.dialog
|
|
41
|
-
),
|
|
42
|
-
onKeyDown,
|
|
43
|
-
ref,
|
|
44
|
-
role: "alert",
|
|
45
|
-
children: [
|
|
46
|
-
/* @__PURE__ */ jsx("span", { className: styles.icon, children: /* @__PURE__ */ jsx(MatchNotificationIcon, { palette }) }),
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
48
|
-
"div",
|
|
49
|
-
{
|
|
50
|
-
className: vstack({
|
|
51
|
-
alignItems: "flex-start",
|
|
52
|
-
gap: "0",
|
|
53
|
-
py: "2"
|
|
54
|
-
}),
|
|
55
|
-
children
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
"button",
|
|
60
|
-
{
|
|
61
|
-
"aria-label": "Close",
|
|
62
|
-
className: styles.close,
|
|
63
|
-
onClick: onClose,
|
|
64
|
-
value: props.id,
|
|
65
|
-
children: /* @__PURE__ */ jsx(Close, {})
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
Notification
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=chunk-JHAI4ZHG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Notification.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 { 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 <button\n aria-label=\"Close\"\n className={styles.close}\n onClick={onClose}\n value={props.id}\n >\n <Close />\n </button>\n </dialog>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,OAIK;AACP,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;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,OAAO;AAAA,YAClB,SAAS;AAAA,YACT,OAAO,MAAM;AAAA,YAEb,8BAAC,SAAM;AAAA;AAAA,QACT;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// src/aria-helpers/trap-focus.aria.ts
|
|
2
|
-
function trapFocus(modalRef) {
|
|
3
|
-
var _a;
|
|
4
|
-
const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
5
|
-
const focusable = Array.from(
|
|
6
|
-
((_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(focusableElements)) ?? []
|
|
7
|
-
);
|
|
8
|
-
const firstFocusable = focusable[0];
|
|
9
|
-
const lastFocusable = focusable[focusable.length - 1];
|
|
10
|
-
return function handleKeyDown(event) {
|
|
11
|
-
if (event.key === "Tab") {
|
|
12
|
-
if (event.shiftKey) {
|
|
13
|
-
if (document.activeElement === firstFocusable) {
|
|
14
|
-
lastFocusable.focus();
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
}
|
|
17
|
-
} else {
|
|
18
|
-
if (document.activeElement === lastFocusable) {
|
|
19
|
-
firstFocusable.focus();
|
|
20
|
-
event.preventDefault();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
trapFocus
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=chunk-KESKDLX6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aria-helpers/trap-focus.aria.ts"],"sourcesContent":["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":";AAEO,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;","names":[]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// src/context/tabs.tsx
|
|
2
|
-
import { tabs } from "@cerberus/styled-system/recipes";
|
|
3
|
-
import {
|
|
4
|
-
createContext,
|
|
5
|
-
useContext,
|
|
6
|
-
useEffect,
|
|
7
|
-
useMemo,
|
|
8
|
-
useRef,
|
|
9
|
-
useState
|
|
10
|
-
} from "react";
|
|
11
|
-
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
var TabsContext = createContext(null);
|
|
13
|
-
function Tabs(props) {
|
|
14
|
-
const { cache, active, id, palette } = props;
|
|
15
|
-
const [activeTab, setActiveTab] = useState(() => cache ? "" : active ?? "");
|
|
16
|
-
const tabsList = useRef([]);
|
|
17
|
-
const uuid = useMemo(() => {
|
|
18
|
-
return id ? `cerberus-tabs-${id}` : "cerberus-tabs";
|
|
19
|
-
}, [id]);
|
|
20
|
-
const value = useMemo(
|
|
21
|
-
() => ({
|
|
22
|
-
tabs: tabsList,
|
|
23
|
-
id: uuid,
|
|
24
|
-
active: activeTab,
|
|
25
|
-
styles: tabs({ palette }),
|
|
26
|
-
onTabUpdate: setActiveTab
|
|
27
|
-
}),
|
|
28
|
-
[activeTab, setActiveTab, palette, uuid, tabsList]
|
|
29
|
-
);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (cache) {
|
|
32
|
-
const cachedTab = window.localStorage.getItem(uuid);
|
|
33
|
-
setActiveTab(
|
|
34
|
-
cache ? cachedTab || (props.active ?? "") : props.active ?? ""
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}, [cache, active, uuid]);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (cache && activeTab) {
|
|
40
|
-
window.localStorage.setItem(uuid, activeTab);
|
|
41
|
-
}
|
|
42
|
-
}, [activeTab, cache]);
|
|
43
|
-
return /* @__PURE__ */ jsx(TabsContext.Provider, { value, children: props.children });
|
|
44
|
-
}
|
|
45
|
-
function useTabsContext() {
|
|
46
|
-
const context = useContext(TabsContext);
|
|
47
|
-
if (!context) {
|
|
48
|
-
throw new Error("useTabsContext must be used within a Tabs Provider.");
|
|
49
|
-
}
|
|
50
|
-
return context;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export {
|
|
54
|
-
TabsContext,
|
|
55
|
-
Tabs,
|
|
56
|
-
useTabsContext
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=chunk-KF24CS4S.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/tabs.tsx"],"sourcesContent":["'use client'\n\nimport { tabs, type TabsVariantProps } from '@cerberus/styled-system/recipes'\nimport type { Pretty } from '@cerberus/styled-system/types'\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type MutableRefObject,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a Tabs component and a hook to access its context.\n * @module\n */\n\nexport interface TabsContextValue {\n tabs: MutableRefObject<HTMLButtonElement[]>\n id: string\n active: string\n styles: Pretty<Record<'tabList' | 'tab' | 'tabPanel', string>>\n onTabUpdate: (active: string) => void\n}\n\nexport const TabsContext = createContext<TabsContextValue | null>(null)\n\nexport interface TabsProps {\n id?: string\n active?: string\n cache?: boolean\n}\n\n/**\n * The Tabs component provides a context to manage tab state.\n * @param id - the id of the tabs component,\n * @param active - the default active tab id,\n * @param cache - whether to cache the active tab state in local storage\n * @example\n * ```tsx\n * <Tabs cache>\n * <TabList description=\"Button details\">\n * <Tab id=\"overview\">Overview</Tab>\n * <Tab id=\"guidelines\">Guidelines</Tab>\n * </TabList>\n * <TabPanels>\n * <TabPanel id=\"overview\">Overview content</TabPanel>\n * <TabPanel id=\"guidelines\">Guidelines content</TabPanel>\n * </TabPanels>\n * </Tabs>\n * ```\n */\nexport function Tabs(\n props: PropsWithChildren<TabsProps & TabsVariantProps>,\n): JSX.Element {\n const { cache, active, id, palette } = props\n const [activeTab, setActiveTab] = useState(() => (cache ? '' : active ?? ''))\n const tabsList = useRef<HTMLButtonElement[]>([])\n const uuid = useMemo(() => {\n return id ? `cerberus-tabs-${id}` : 'cerberus-tabs'\n }, [id])\n\n const value = useMemo(\n () => ({\n tabs: tabsList,\n id: uuid,\n active: activeTab,\n styles: tabs({ palette }),\n onTabUpdate: setActiveTab,\n }),\n [activeTab, setActiveTab, palette, uuid, tabsList],\n )\n\n // Get the active tab from local storage\n useEffect(() => {\n if (cache) {\n const cachedTab = window.localStorage.getItem(uuid)\n setActiveTab(\n cache ? cachedTab || (props.active ?? '') : props.active ?? '',\n )\n }\n }, [cache, active, uuid])\n\n // Update the active tab in local storage\n useEffect(() => {\n if (cache && activeTab) {\n window.localStorage.setItem(uuid, activeTab)\n }\n }, [activeTab, cache])\n\n return (\n <TabsContext.Provider value={value}>{props.children}</TabsContext.Provider>\n )\n}\n\nexport function useTabsContext(): TabsContextValue {\n const context = useContext(TabsContext)\n if (!context) {\n throw new Error('useTabsContext must be used within a Tabs Provider.')\n }\n return context\n}\n"],"mappings":";AAEA,SAAS,YAAmC;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAiFH;AAlEG,IAAM,cAAc,cAAuC,IAAI;AA2B/D,SAAS,KACd,OACa;AACb,QAAM,EAAE,OAAO,QAAQ,IAAI,QAAQ,IAAI;AACvC,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,MAAO,QAAQ,KAAK,UAAU,EAAG;AAC5E,QAAM,WAAW,OAA4B,CAAC,CAAC;AAC/C,QAAM,OAAO,QAAQ,MAAM;AACzB,WAAO,KAAK,iBAAiB,EAAE,KAAK;AAAA,EACtC,GAAG,CAAC,EAAE,CAAC;AAEP,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,QAAQ,KAAK,EAAE,QAAQ,CAAC;AAAA,MACxB,aAAa;AAAA,IACf;AAAA,IACA,CAAC,WAAW,cAAc,SAAS,MAAM,QAAQ;AAAA,EACnD;AAGA,YAAU,MAAM;AACd,QAAI,OAAO;AACT,YAAM,YAAY,OAAO,aAAa,QAAQ,IAAI;AAClD;AAAA,QACE,QAAQ,cAAc,MAAM,UAAU,MAAM,MAAM,UAAU;AAAA,MAC9D;AAAA,IACF;AAAA,EACF,GAAG,CAAC,OAAO,QAAQ,IAAI,CAAC;AAGxB,YAAU,MAAM;AACd,QAAI,SAAS,WAAW;AACtB,aAAO,aAAa,QAAQ,MAAM,SAAS;AAAA,IAC7C;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC;AAErB,SACE,oBAAC,YAAY,UAAZ,EAAqB,OAAe,gBAAM,UAAS;AAExD;AAEO,SAAS,iBAAmC;AACjD,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// src/context/navMenu.tsx
|
|
2
|
-
import { css } from "@cerberus/styled-system/css";
|
|
3
|
-
import {
|
|
4
|
-
createContext,
|
|
5
|
-
useCallback,
|
|
6
|
-
useContext,
|
|
7
|
-
useMemo,
|
|
8
|
-
useRef,
|
|
9
|
-
useState
|
|
10
|
-
} from "react";
|
|
11
|
-
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
var NavMenuContext = createContext(null);
|
|
13
|
-
function NavMenu(props) {
|
|
14
|
-
const triggerRef = useRef(null);
|
|
15
|
-
const menuRef = useRef(null);
|
|
16
|
-
const [expanded, setExpanded] = useState(false);
|
|
17
|
-
const handleToggle = useCallback(() => {
|
|
18
|
-
setExpanded((prev) => !prev);
|
|
19
|
-
}, []);
|
|
20
|
-
const value = useMemo(
|
|
21
|
-
() => ({
|
|
22
|
-
triggerRef,
|
|
23
|
-
menuRef,
|
|
24
|
-
expanded,
|
|
25
|
-
onToggle: handleToggle
|
|
26
|
-
}),
|
|
27
|
-
[expanded, handleToggle]
|
|
28
|
-
);
|
|
29
|
-
return /* @__PURE__ */ jsx(NavMenuContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
30
|
-
"nav",
|
|
31
|
-
{
|
|
32
|
-
className: css({
|
|
33
|
-
position: "relative"
|
|
34
|
-
}),
|
|
35
|
-
children: props.children
|
|
36
|
-
}
|
|
37
|
-
) });
|
|
38
|
-
}
|
|
39
|
-
function useNavMenuContext() {
|
|
40
|
-
const context = useContext(NavMenuContext);
|
|
41
|
-
if (!context) {
|
|
42
|
-
throw new Error("useNavMenuContext must be used within a NavMenu.");
|
|
43
|
-
}
|
|
44
|
-
return context;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export {
|
|
48
|
-
NavMenu,
|
|
49
|
-
useNavMenuContext
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=chunk-KJUCHZHV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/navMenu.tsx"],"sourcesContent":["'use client'\n\nimport { css } from '@cerberus/styled-system/css'\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n type RefObject,\n} from 'react'\n\nexport type NavTriggerRef = RefObject<HTMLButtonElement>\nexport type NavMenuRef = RefObject<HTMLUListElement>\n\nexport interface NavMenuContextValue {\n triggerRef: NavTriggerRef | null\n menuRef: NavMenuRef | null\n expanded: boolean\n onToggle: () => void\n}\n\nconst NavMenuContext = createContext<NavMenuContextValue | null>(null)\n\nexport function NavMenu(props: PropsWithChildren): JSX.Element {\n const triggerRef = useRef<HTMLButtonElement>(null)\n const menuRef = useRef<HTMLUListElement>(null)\n const [expanded, setExpanded] = useState<boolean>(false)\n\n const handleToggle = useCallback(() => {\n setExpanded((prev) => !prev)\n }, [])\n\n const value = useMemo(\n () => ({\n triggerRef,\n menuRef,\n expanded,\n onToggle: handleToggle,\n }),\n [expanded, handleToggle],\n )\n\n return (\n <NavMenuContext.Provider value={value}>\n <nav\n className={css({\n position: 'relative',\n })}\n >\n {props.children}\n </nav>\n </NavMenuContext.Provider>\n )\n}\n\nexport function useNavMenuContext(): NavMenuContextValue {\n const context = useContext(NavMenuContext)\n if (!context) {\n throw new Error('useNavMenuContext must be used within a NavMenu.')\n }\n return context\n}\n"],"mappings":";AAEA,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAmCD;AAvBN,IAAM,iBAAiB,cAA0C,IAAI;AAE9D,SAAS,QAAQ,OAAuC;AAC7D,QAAM,aAAa,OAA0B,IAAI;AACjD,QAAM,UAAU,OAAyB,IAAI;AAC7C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB,KAAK;AAEvD,QAAM,eAAe,YAAY,MAAM;AACrC,gBAAY,CAAC,SAAS,CAAC,IAAI;AAAA,EAC7B,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IACZ;AAAA,IACA,CAAC,UAAU,YAAY;AAAA,EACzB;AAEA,SACE,oBAAC,eAAe,UAAf,EAAwB,OACvB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,IAAI;AAAA,QACb,UAAU;AAAA,MACZ,CAAC;AAAA,MAEA,gBAAM;AAAA;AAAA,EACT,GACF;AAEJ;AAEO,SAAS,oBAAyC;AACvD,QAAM,UAAU,WAAW,cAAc;AACzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ModalIcon
|
|
3
|
-
} from "./chunk-VCR5C6Q3.js";
|
|
4
|
-
import {
|
|
5
|
-
Portal
|
|
6
|
-
} from "./chunk-4CAT3FHV.js";
|
|
7
|
-
import {
|
|
8
|
-
Modal
|
|
9
|
-
} from "./chunk-2UFNQM55.js";
|
|
10
|
-
import {
|
|
11
|
-
ModalDescription
|
|
12
|
-
} from "./chunk-4M4LCQ43.js";
|
|
13
|
-
import {
|
|
14
|
-
ModalHeader
|
|
15
|
-
} from "./chunk-QU7UV5DB.js";
|
|
16
|
-
import {
|
|
17
|
-
ModalHeading
|
|
18
|
-
} from "./chunk-JB7IQ2BM.js";
|
|
19
|
-
import {
|
|
20
|
-
Button
|
|
21
|
-
} from "./chunk-6F34A7NZ.js";
|
|
22
|
-
import {
|
|
23
|
-
Show
|
|
24
|
-
} from "./chunk-4O4QFF4S.js";
|
|
25
|
-
import {
|
|
26
|
-
trapFocus
|
|
27
|
-
} from "./chunk-KESKDLX6.js";
|
|
28
|
-
import {
|
|
29
|
-
$cerberusIcons
|
|
30
|
-
} from "./chunk-5WVXIAG2.js";
|
|
31
|
-
import {
|
|
32
|
-
useModal
|
|
33
|
-
} from "./chunk-TZNYJ3G7.js";
|
|
34
|
-
|
|
35
|
-
// src/context/confirm-modal.tsx
|
|
36
|
-
import {
|
|
37
|
-
createContext,
|
|
38
|
-
useCallback,
|
|
39
|
-
useContext,
|
|
40
|
-
useMemo,
|
|
41
|
-
useRef,
|
|
42
|
-
useState
|
|
43
|
-
} from "react";
|
|
44
|
-
import { css } from "@cerberus/styled-system/css";
|
|
45
|
-
import { hstack } from "@cerberus/styled-system/patterns";
|
|
46
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
47
|
-
var ConfirmModalContext = createContext(null);
|
|
48
|
-
function ConfirmModal(props) {
|
|
49
|
-
const { modalRef, show, close } = useModal();
|
|
50
|
-
const resolveRef = useRef(null);
|
|
51
|
-
const [content, setContent] = useState(null);
|
|
52
|
-
const focusTrap = trapFocus(modalRef);
|
|
53
|
-
const ConfirmIcon = $cerberusIcons.confirmModal;
|
|
54
|
-
const palette = useMemo(
|
|
55
|
-
() => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
|
|
56
|
-
[content]
|
|
57
|
-
);
|
|
58
|
-
const handleChoice = useCallback(
|
|
59
|
-
(e) => {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
const target = e.currentTarget;
|
|
62
|
-
if (target.value === "true") {
|
|
63
|
-
(_a = resolveRef.current) == null ? void 0 : _a.call(resolveRef, true);
|
|
64
|
-
}
|
|
65
|
-
(_b = resolveRef.current) == null ? void 0 : _b.call(resolveRef, false);
|
|
66
|
-
close();
|
|
67
|
-
},
|
|
68
|
-
[close]
|
|
69
|
-
);
|
|
70
|
-
const handleShow = useCallback(
|
|
71
|
-
(options) => {
|
|
72
|
-
return new Promise((resolve) => {
|
|
73
|
-
setContent({ ...options, kind: options.kind || "non-destructive" });
|
|
74
|
-
show();
|
|
75
|
-
resolveRef.current = resolve;
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
[show]
|
|
79
|
-
);
|
|
80
|
-
const value = useMemo(
|
|
81
|
-
() => ({
|
|
82
|
-
show: handleShow
|
|
83
|
-
}),
|
|
84
|
-
[handleShow]
|
|
85
|
-
);
|
|
86
|
-
return /* @__PURE__ */ jsxs(ConfirmModalContext.Provider, { value, children: [
|
|
87
|
-
props.children,
|
|
88
|
-
/* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
89
|
-
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
90
|
-
/* @__PURE__ */ jsx(
|
|
91
|
-
Show,
|
|
92
|
-
{
|
|
93
|
-
when: palette === "danger",
|
|
94
|
-
fallback: /* @__PURE__ */ jsx(ModalIcon, { palette: "action", children: /* @__PURE__ */ jsx(ConfirmIcon, { size: 24 }) }),
|
|
95
|
-
children: /* @__PURE__ */ jsx(ModalIcon, { palette: "danger", children: /* @__PURE__ */ jsx(ConfirmIcon, { size: 24 }) })
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
/* @__PURE__ */ jsx(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
99
|
-
/* @__PURE__ */ jsx(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
100
|
-
] }),
|
|
101
|
-
/* @__PURE__ */ jsxs(
|
|
102
|
-
"div",
|
|
103
|
-
{
|
|
104
|
-
className: hstack({
|
|
105
|
-
gap: "4"
|
|
106
|
-
}),
|
|
107
|
-
children: [
|
|
108
|
-
/* @__PURE__ */ jsx(
|
|
109
|
-
Button,
|
|
110
|
-
{
|
|
111
|
-
autoFocus: true,
|
|
112
|
-
className: css({
|
|
113
|
-
w: "1/2"
|
|
114
|
-
}),
|
|
115
|
-
name: "confirm",
|
|
116
|
-
onClick: handleChoice,
|
|
117
|
-
palette,
|
|
118
|
-
value: "true",
|
|
119
|
-
children: content == null ? void 0 : content.actionText
|
|
120
|
-
}
|
|
121
|
-
),
|
|
122
|
-
/* @__PURE__ */ jsx(
|
|
123
|
-
Button,
|
|
124
|
-
{
|
|
125
|
-
className: css({
|
|
126
|
-
w: "1/2"
|
|
127
|
-
}),
|
|
128
|
-
name: "cancel",
|
|
129
|
-
onClick: handleChoice,
|
|
130
|
-
usage: "outlined",
|
|
131
|
-
value: "false",
|
|
132
|
-
children: content == null ? void 0 : content.cancelText
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
] }) })
|
|
139
|
-
] });
|
|
140
|
-
}
|
|
141
|
-
function useConfirmModal() {
|
|
142
|
-
const context = useContext(ConfirmModalContext);
|
|
143
|
-
if (context === null) {
|
|
144
|
-
throw new Error(
|
|
145
|
-
"useConfirmModal must be used within a ConfirmModal Provider"
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
return context;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export {
|
|
152
|
-
ConfirmModal,
|
|
153
|
-
useConfirmModal
|
|
154
|
-
};
|
|
155
|
-
//# sourceMappingURL=chunk-KUQZECNS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/confirm-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { ModalIcon } from '../components/ModalIcon'\nimport { Show } from '../components/Show'\nimport { Modal } from '../components/Modal'\nimport { useModal } from '../hooks/useModal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\n\n/**\n * This module provides a context and hook for the confirm modal.\n * @module\n */\n\nexport interface ShowConfirmModalOptions {\n kind?: 'destructive' | 'non-destructive'\n heading: string\n description?: string\n actionText: string\n cancelText: string\n}\nexport type ShowResult =\n | ((value: boolean | PromiseLike<boolean>) => void)\n | null\n\nexport interface ConfirmModalValue {\n show: (options: ShowConfirmModalOptions) => Promise<boolean>\n}\n\nconst ConfirmModalContext = createContext<ConfirmModalValue | null>(null)\n\nexport interface ConfirmModalProviderProps {}\n\n/**\n * Provides a confirm modal to the app.\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <ConfirmModal>\n * <SomeFeatureSection />\n * </ConfirmModal>\n *\n * // Use the hook to show the confirm modal.\n * const confirm = useConfirmModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await confirm.show({\n * heading: 'Add new payment method?',\n * description:\n * 'This will add a new payment method to your account to be billed for future purchases.',\n * actionText: 'Yes, add payment method',\n * cancelText: 'No, cancel',\n * })\n * setConsent(userConsent)\n * }, [confirm])\n * ```\n */\nexport function ConfirmModal(\n props: PropsWithChildren<ConfirmModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<ShowResult>(null)\n const [content, setContent] = useState<ShowConfirmModalOptions | null>(null)\n const focusTrap = trapFocus(modalRef)\n const ConfirmIcon = $cerberusIcons.confirmModal\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(true)\n }\n resolveRef.current?.(false)\n close()\n },\n [close],\n )\n\n const handleShow = useCallback(\n (options: ShowConfirmModalOptions) => {\n return new Promise<boolean>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <ConfirmModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <ModalHeader>\n <Show\n when={palette === 'danger'}\n fallback={\n <ModalIcon palette=\"action\">\n <ConfirmIcon size={24} />\n </ModalIcon>\n }\n >\n <ModalIcon palette=\"danger\">\n <ConfirmIcon size={24} />\n </ModalIcon>\n </Show>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <div\n className={hstack({\n gap: '4',\n })}\n >\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </div>\n </Modal>\n </Portal>\n </ConfirmModalContext.Provider>\n )\n}\n\nexport function useConfirmModal(): ConfirmModalValue {\n const context = useContext(ConfirmModalContext)\n if (context === null) {\n throw new Error(\n 'useConfirmModal must be used within a ConfirmModal Provider',\n )\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAGP,SAAS,WAAW;AACpB,SAAS,cAAc;AA6Gb,SAKQ,KALR;AA9EV,IAAM,sBAAsB,cAAwC,IAAI;AA4BjE,SAAS,aACd,OACA;AACA,QAAM,EAAE,UAAU,MAAM,MAAM,IAAI,SAAS;AAC3C,QAAM,aAAa,OAAmB,IAAI;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAyC,IAAI;AAC3E,QAAM,YAAY,UAAU,QAAQ;AACpC,QAAM,cAAc,eAAe;AAEnC,QAAM,UAAU;AAAA,IACd,OAAO,mCAAS,UAAS,gBAAgB,WAAW;AAAA,IACpD,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AAzF1C;AA0FM,YAAM,SAAS,EAAE;AACjB,UAAI,OAAO,UAAU,QAAQ;AAC3B,yBAAW,YAAX,oCAAqB;AAAA,MACvB;AACA,uBAAW,YAAX,oCAAqB;AACrB,YAAM;AAAA,IACR;AAAA,IACA,CAAC,KAAK;AAAA,EACR;AAEA,QAAM,aAAa;AAAA,IACjB,CAAC,YAAqC;AACpC,aAAO,IAAI,QAAiB,CAAC,YAAY;AACvC,mBAAW,EAAE,GAAG,SAAS,MAAM,QAAQ,QAAQ,kBAAkB,CAAC;AAClE,aAAK;AACL,mBAAW,UAAU;AAAA,MACvB,CAAC;AAAA,IACH;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM;AAAA,IACR;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,SACE,qBAAC,oBAAoB,UAApB,EAA6B,OAC3B;AAAA,UAAM;AAAA,IAEP,oBAAC,UACC,+BAAC,SAAM,WAAW,WAAW,KAAK,UAChC;AAAA,2BAAC,eACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,YAAY;AAAA,YAClB,UACE,oBAAC,aAAU,SAAQ,UACjB,8BAAC,eAAY,MAAM,IAAI,GACzB;AAAA,YAGF,8BAAC,aAAU,SAAQ,UACjB,8BAAC,eAAY,MAAM,IAAI,GACzB;AAAA;AAAA,QACF;AAAA,QACA,oBAAC,gBAAc,6CAAS,SAAQ;AAAA,QAChC,oBAAC,oBAAkB,6CAAS,aAAY;AAAA,SAC1C;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,OAAO;AAAA,YAChB,KAAK;AAAA,UACP,CAAC;AAAA,UAED;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAS;AAAA,gBACT,WAAW,IAAI;AAAA,kBACb,GAAG;AAAA,gBACL,CAAC;AAAA,gBACD,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT;AAAA,gBACA,OAAM;AAAA,gBAEL,6CAAS;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,IAAI;AAAA,kBACb,GAAG;AAAA,gBACL,CAAC;AAAA,gBACD,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,OAAM;AAAA,gBACN,OAAM;AAAA,gBAEL,6CAAS;AAAA;AAAA,YACZ;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,mBAAmB;AAC9C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/components/Thead.tsx
|
|
2
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
3
|
-
import { thead } from "@cerberus/styled-system/recipes";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
function Thead(props) {
|
|
6
|
-
return /* @__PURE__ */ jsx("thead", { ...props, className: cx(props.className, thead()) });
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
Thead
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=chunk-N3FUF4TB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Thead.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { thead } from '@cerberus/styled-system/recipes'\nimport type { TableHTMLAttributes } from 'react'\n\n/**\n * This module contains the Thead component.\n * @module\n */\n\nexport type TheadProps = TableHTMLAttributes<HTMLTableSectionElement>\n\n/**\n * The Thead component is used to render a table header.\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @example\n * ```tsx\n * <Thead>\n * {children}\n * </Thead>\n * ```\n */\nexport function Thead(props: TheadProps) {\n return <thead {...props} className={cx(props.className, thead())} />\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AAqBb;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,oBAAC,WAAO,GAAG,OAAO,WAAW,GAAG,MAAM,WAAW,MAAM,CAAC,GAAG;AACpE;","names":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useTabsKeyboardNavigation
|
|
3
|
-
} from "./chunk-GKUDLVOV.js";
|
|
4
|
-
import {
|
|
5
|
-
useTabsContext
|
|
6
|
-
} from "./chunk-KF24CS4S.js";
|
|
7
|
-
|
|
8
|
-
// src/components/Tab.tsx
|
|
9
|
-
import {
|
|
10
|
-
useMemo,
|
|
11
|
-
useTransition
|
|
12
|
-
} from "react";
|
|
13
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
14
|
-
import { jsx } from "react/jsx-runtime";
|
|
15
|
-
function Tab(props) {
|
|
16
|
-
const { value, ...nativeProps } = props;
|
|
17
|
-
const { active, onTabUpdate, styles } = useTabsContext();
|
|
18
|
-
const [isPending, startTransition] = useTransition();
|
|
19
|
-
const { ref } = useTabsKeyboardNavigation();
|
|
20
|
-
const isActive = useMemo(() => active === value, [active, value]);
|
|
21
|
-
function handleClick(e) {
|
|
22
|
-
var _a;
|
|
23
|
-
(_a = props.onClick) == null ? void 0 : _a.call(props, e);
|
|
24
|
-
startTransition(() => onTabUpdate(e.currentTarget.value));
|
|
25
|
-
}
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
"button",
|
|
28
|
-
{
|
|
29
|
-
...nativeProps,
|
|
30
|
-
...!isActive && { tabIndex: -1 },
|
|
31
|
-
"aria-controls": `panel:${value}`,
|
|
32
|
-
"aria-busy": isPending,
|
|
33
|
-
"aria-selected": isActive,
|
|
34
|
-
id: value,
|
|
35
|
-
className: cx(nativeProps.className, styles.tab),
|
|
36
|
-
onClick: handleClick,
|
|
37
|
-
role: "tab",
|
|
38
|
-
ref,
|
|
39
|
-
value
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
Tab
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=chunk-NE5NHILF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Tab.tsx"],"sourcesContent":["'use client'\n\nimport {\n useMemo,\n useTransition,\n type ButtonHTMLAttributes,\n type MouseEvent,\n} from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { cx } from '@cerberus/styled-system/css'\nimport { useTabsKeyboardNavigation } from '../aria-helpers/tabs.aria'\n\n/**\n * This module provides a Tab component.\n * @module\n */\nexport interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n value: string\n}\n\n/**\n * The Tab component provides a tab element to be used in a TabList.\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [Tab docs](https://cerberus.digitalu.design/react/tabs)\n * @param value - the id of the tab that will be tracked as the active tab and used for aria attributes\n * @example\n * ```tsx\n * <Tab value=\"overview\">\n * Overview\n * </Tab>\n * ```\n */\nexport function Tab(props: TabProps) {\n const { value, ...nativeProps } = props\n const { active, onTabUpdate, styles } = useTabsContext()\n const [isPending, startTransition] = useTransition()\n const { ref } = useTabsKeyboardNavigation()\n const isActive = useMemo(() => active === value, [active, value])\n\n function handleClick(e: MouseEvent<HTMLButtonElement>) {\n props.onClick?.(e)\n startTransition(() => onTabUpdate(e.currentTarget.value))\n }\n\n return (\n <button\n {...nativeProps}\n {...(!isActive && { tabIndex: -1 })}\n aria-controls={`panel:${value}`}\n aria-busy={isPending}\n aria-selected={isActive}\n id={value}\n className={cx(nativeProps.className, styles.tab)}\n onClick={handleClick}\n role=\"tab\"\n ref={ref}\n value={value}\n />\n )\n}\n"],"mappings":";;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAEP,SAAS,UAAU;AAoCf;AAbG,SAAS,IAAI,OAAiB;AACnC,QAAM,EAAE,OAAO,GAAG,YAAY,IAAI;AAClC,QAAM,EAAE,QAAQ,aAAa,OAAO,IAAI,eAAe;AACvD,QAAM,CAAC,WAAW,eAAe,IAAI,cAAc;AACnD,QAAM,EAAE,IAAI,IAAI,0BAA0B;AAC1C,QAAM,WAAW,QAAQ,MAAM,WAAW,OAAO,CAAC,QAAQ,KAAK,CAAC;AAEhE,WAAS,YAAY,GAAkC;AAvCzD;AAwCI,gBAAM,YAAN,+BAAgB;AAChB,oBAAgB,MAAM,YAAY,EAAE,cAAc,KAAK,CAAC;AAAA,EAC1D;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,CAAC,YAAY,EAAE,UAAU,GAAG;AAAA,MACjC,iBAAe,SAAS,KAAK;AAAA,MAC7B,aAAW;AAAA,MACX,iBAAe;AAAA,MACf,IAAI;AAAA,MACJ,WAAW,GAAG,YAAY,WAAW,OAAO,GAAG;AAAA,MAC/C,SAAS;AAAA,MACT,MAAK;AAAA,MACL;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useFieldContext
|
|
3
|
-
} from "./chunk-ZAU4JVLL.js";
|
|
4
|
-
|
|
5
|
-
// src/components/Radio.tsx
|
|
6
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
7
|
-
import { hstack } from "@cerberus/styled-system/patterns";
|
|
8
|
-
import { radio } from "@cerberus/styled-system/recipes";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
function Radio(props) {
|
|
11
|
-
const { children, size, ...nativeProps } = props;
|
|
12
|
-
const { invalid, ...state } = useFieldContext();
|
|
13
|
-
const styles = radio({ size });
|
|
14
|
-
return /* @__PURE__ */ jsxs("div", { className: cx("group", hstack(), styles.root), tabIndex: 0, children: [
|
|
15
|
-
/* @__PURE__ */ jsx(
|
|
16
|
-
"input",
|
|
17
|
-
{
|
|
18
|
-
...nativeProps,
|
|
19
|
-
...state,
|
|
20
|
-
...invalid && { "aria-invalid": true },
|
|
21
|
-
className: cx(nativeProps.className, styles.input),
|
|
22
|
-
tabIndex: -1,
|
|
23
|
-
type: "radio"
|
|
24
|
-
}
|
|
25
|
-
),
|
|
26
|
-
children
|
|
27
|
-
] });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
Radio
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=chunk-PH64POOB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Radio.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { radio } from '@cerberus/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus/styled-system/types'\nimport type { InputHTMLAttributes, PropsWithChildren } from 'react'\nimport { useFieldContext } from '../context/field'\n\nexport type RadioRecipe = RecipeVariantProps<typeof radio>\nexport interface RadioBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n id: string\n}\nexport type RadioProps = RadioBaseProps & RadioRecipe\n\nexport function Radio(props: PropsWithChildren<RadioProps>) {\n const { children, size, ...nativeProps } = props\n const { invalid, ...state } = useFieldContext()\n const styles = radio({ size })\n\n return (\n <div className={cx('group', hstack(), styles.root)} tabIndex={0}>\n <input\n {...nativeProps}\n {...state}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(nativeProps.className, styles.input)}\n tabIndex={-1}\n type=\"radio\"\n />\n {children}\n </div>\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,aAAa;AAkBlB,SACE,KADF;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,UAAU,MAAM,GAAG,YAAY,IAAI;AAC3C,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,SAAS,MAAM,EAAE,KAAK,CAAC;AAE7B,SACE,qBAAC,SAAI,WAAW,GAAG,SAAS,OAAO,GAAG,OAAO,IAAI,GAAG,UAAU,GAC5D;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,GAAG,YAAY,WAAW,OAAO,KAAK;AAAA,QACjD,UAAU;AAAA,QACV,MAAK;AAAA;AAAA,IACP;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/components/Tbody.tsx
|
|
2
|
-
import { tbody } from "@cerberus/styled-system/recipes";
|
|
3
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
function Tbody(props) {
|
|
6
|
-
const { decoration, ...nativeProps } = props;
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
"tbody",
|
|
9
|
-
{
|
|
10
|
-
...nativeProps,
|
|
11
|
-
className: cx(
|
|
12
|
-
nativeProps.className,
|
|
13
|
-
tbody({
|
|
14
|
-
decoration
|
|
15
|
-
})
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
Tbody
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=chunk-PJ3744I6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Tbody.tsx"],"sourcesContent":["import { tbody, type TbodyVariantProps } from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport type { TableHTMLAttributes } from 'react'\n\nexport type TbodyBaseProps = TableHTMLAttributes<HTMLTableSectionElement>\nexport type TbodyProps = TbodyBaseProps & TbodyVariantProps\n\n/**\n * The TBody component is used to render a table body.\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @example\n * ```tsx\n * <TBody>\n * {children}\n * </TBody>\n * ```\n */\nexport function Tbody(props: TbodyProps) {\n const { decoration, ...nativeProps } = props\n return (\n <tbody\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tbody({\n decoration,\n }),\n )}\n />\n )\n}\n"],"mappings":";AAAA,SAAS,aAAqC;AAC9C,SAAS,UAAU;AAmBf;AAHG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,YAAY,GAAG,YAAY,IAAI;AACvC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM;AAAA,UACJ;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|