@cerberus-design/react 0.9.2-next-5604236 → 0.9.2-next-74f2c67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/_tsup-dts-rollup.d.cts +730 -117
- package/build/legacy/aria-helpers/tabs.aria.cjs.map +1 -1
- package/build/legacy/components/Avatar.cjs.map +1 -1
- package/build/legacy/components/Button.cjs.map +1 -1
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/CircularProgress.cjs.map +1 -1
- package/build/legacy/components/Droppable.cjs.map +1 -1
- package/build/legacy/components/FeatureFlag.cjs.map +1 -1
- package/build/legacy/components/FieldMessage.cjs.map +1 -1
- package/build/legacy/components/FileStatus.cjs +70 -74
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs.map +1 -1
- package/build/legacy/components/IconButton.cjs.map +1 -1
- package/build/legacy/components/Input.cjs.map +1 -1
- package/build/legacy/components/Label.cjs.map +1 -1
- package/build/legacy/components/Modal.cjs.map +1 -1
- package/build/legacy/components/ModalDescription.cjs.map +1 -1
- package/build/legacy/components/ModalHeader.cjs.map +1 -1
- package/build/legacy/components/ModalHeading.cjs.map +1 -1
- package/build/legacy/components/NavMenuLink.cjs.map +1 -1
- package/build/legacy/components/NavMenuList.cjs.map +1 -1
- package/build/legacy/components/NavMenuTrigger.cjs.map +1 -1
- package/build/legacy/components/Notification.cjs.map +1 -1
- package/build/legacy/components/NotificationDescription.cjs.map +1 -1
- package/build/legacy/components/NotificationHeading.cjs.map +1 -1
- package/build/legacy/components/Portal.cjs.map +1 -1
- package/build/legacy/components/ProgressBar.cjs.map +1 -1
- package/build/legacy/components/Radio.cjs.map +1 -1
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Show.cjs.map +1 -1
- package/build/legacy/components/Spinner.cjs.map +1 -1
- package/build/legacy/components/Tab.cjs.map +1 -1
- package/build/legacy/components/TabList.cjs.map +1 -1
- package/build/legacy/components/TabPanel.cjs.map +1 -1
- package/build/legacy/components/Table.cjs.map +1 -1
- package/build/legacy/components/Tag.cjs +70 -4
- package/build/legacy/components/Tag.cjs.map +1 -1
- package/build/legacy/components/Tbody.cjs.map +1 -1
- package/build/legacy/components/Td.cjs.map +1 -1
- package/build/legacy/components/Textarea.cjs.map +1 -1
- package/build/legacy/components/Th.cjs.map +1 -1
- package/build/legacy/components/Thead.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/feature-flags.cjs.map +1 -1
- package/build/legacy/context/field.cjs.map +1 -1
- package/build/legacy/context/navMenu.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/context/tabs.cjs.map +1 -1
- package/build/legacy/context/theme.cjs.map +1 -1
- package/build/legacy/hooks/useModal.cjs.map +1 -1
- package/build/legacy/hooks/useTheme.cjs.map +1 -1
- package/build/legacy/hooks/useToggle.cjs.map +1 -1
- package/build/legacy/index.cjs +5 -5
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +730 -117
- package/build/modern/aria-helpers/tabs.aria.js +2 -2
- package/build/modern/{chunk-LAOQSNMN.js → chunk-2RPWSVRX.js} +6 -6
- package/build/modern/chunk-2RPWSVRX.js.map +1 -0
- package/build/modern/{chunk-JB7IQ2BM.js → chunk-2UXE5PDG.js} +1 -1
- package/build/modern/chunk-2UXE5PDG.js.map +1 -0
- package/build/modern/{chunk-4CAT3FHV.js → chunk-2VX52EEJ.js} +1 -1
- package/build/modern/chunk-2VX52EEJ.js.map +1 -0
- package/build/modern/{chunk-A6CLBPFE.js → chunk-3O6UTN3J.js} +1 -1
- package/build/modern/chunk-3O6UTN3J.js.map +1 -0
- package/build/modern/{chunk-UN3OAW56.js → chunk-477G5ZEL.js} +2 -2
- package/build/modern/chunk-477G5ZEL.js.map +1 -0
- package/build/modern/{chunk-PMCYXRAH.js → chunk-5V5MBSM3.js} +3 -3
- package/build/modern/chunk-5V5MBSM3.js.map +1 -0
- package/build/modern/{chunk-3GXISGPS.js → chunk-7K6PZBHN.js} +2 -2
- package/build/modern/chunk-7K6PZBHN.js.map +1 -0
- package/build/modern/{chunk-IXOJLCNO.js → chunk-7SYJFI5E.js} +1 -1
- package/build/modern/chunk-7SYJFI5E.js.map +1 -0
- package/build/modern/{chunk-GABTVDSB.js → chunk-AUAPBPGW.js} +3 -3
- package/build/modern/chunk-AUAPBPGW.js.map +1 -0
- package/build/modern/{chunk-A5WYZVUR.js → chunk-B4CVET74.js} +1 -1
- package/build/modern/chunk-B4CVET74.js.map +1 -0
- package/build/modern/{chunk-2UFNQM55.js → chunk-BE4EOU2P.js} +1 -1
- package/build/modern/{chunk-2UFNQM55.js.map → chunk-BE4EOU2P.js.map} +1 -1
- package/build/modern/{chunk-VULPMZUW.js → chunk-BIDE4IJG.js} +3 -3
- package/build/modern/chunk-BIDE4IJG.js.map +1 -0
- package/build/modern/{chunk-4O4QFF4S.js → chunk-BUVVRQLZ.js} +1 -1
- package/build/modern/chunk-BUVVRQLZ.js.map +1 -0
- package/build/modern/{chunk-4M3EUP57.js → chunk-CJFW36DZ.js} +1 -1
- package/build/modern/chunk-CJFW36DZ.js.map +1 -0
- package/build/modern/{chunk-ZBEHDXFT.js → chunk-E6QFLLXH.js} +13 -13
- package/build/modern/chunk-E6QFLLXH.js.map +1 -0
- package/build/modern/{chunk-S3MTABYX.js → chunk-EB37HRCN.js} +2 -2
- package/build/modern/chunk-EB37HRCN.js.map +1 -0
- package/build/modern/{chunk-JXJ6VFZO.js → chunk-EJOXOICK.js} +1 -1
- package/build/modern/chunk-EJOXOICK.js.map +1 -0
- package/build/modern/{chunk-6F34A7NZ.js → chunk-EXGKZGML.js} +1 -1
- package/build/modern/chunk-EXGKZGML.js.map +1 -0
- package/build/modern/{chunk-ISPTI4GC.js → chunk-EZYCKM7R.js} +2 -2
- package/build/modern/chunk-EZYCKM7R.js.map +1 -0
- package/build/modern/{chunk-4YJOK7JJ.js → chunk-GMG3B34U.js} +2 -2
- package/build/modern/chunk-GMG3B34U.js.map +1 -0
- package/build/modern/{chunk-U72VPIZA.js → chunk-HHVQ6LCA.js} +3 -3
- package/build/modern/chunk-HHVQ6LCA.js.map +1 -0
- package/build/modern/{chunk-XREC5IJE.js → chunk-HPM2XRWT.js} +1 -1
- package/build/modern/chunk-HPM2XRWT.js.map +1 -0
- package/build/modern/{chunk-RQPDRHRP.js → chunk-I35HMGJQ.js} +3 -3
- package/build/modern/chunk-I35HMGJQ.js.map +1 -0
- package/build/modern/{chunk-CMKBUSGN.js → chunk-ILZKQP6R.js} +10 -10
- package/build/modern/chunk-ILZKQP6R.js.map +1 -0
- package/build/modern/{chunk-GKUDLVOV.js → chunk-ITOIXNJS.js} +2 -2
- package/build/modern/{chunk-BTEEBIVN.js → chunk-JCGWTIR4.js} +3 -3
- package/build/modern/chunk-JCGWTIR4.js.map +1 -0
- package/build/modern/{chunk-TCO46FK7.js → chunk-JIJM6JFJ.js} +2 -2
- package/build/modern/chunk-JIJM6JFJ.js.map +1 -0
- package/build/modern/{chunk-VGHVH2T3.js → chunk-JWIJHSI6.js} +5 -3
- package/build/modern/chunk-JWIJHSI6.js.map +1 -0
- package/build/modern/{chunk-6DIGPXAD.js → chunk-KBBASJIY.js} +2 -2
- package/build/modern/chunk-KBBASJIY.js.map +1 -0
- package/build/modern/{chunk-SONHHNYQ.js → chunk-LFWAJ5DX.js} +3 -3
- package/build/modern/chunk-LFWAJ5DX.js.map +1 -0
- package/build/modern/{chunk-PH64POOB.js → chunk-LJYCFFX7.js} +2 -2
- package/build/modern/chunk-LJYCFFX7.js.map +1 -0
- package/build/modern/{chunk-AEDGCR25.js → chunk-NUGDTZCL.js} +7 -7
- package/build/modern/chunk-NUGDTZCL.js.map +1 -0
- package/build/modern/{chunk-XPVDT4VF.js → chunk-O6JYYVO7.js} +3 -3
- package/build/modern/chunk-O6JYYVO7.js.map +1 -0
- package/build/modern/{chunk-KJUCHZHV.js → chunk-O75QAT4Z.js} +1 -1
- package/build/modern/chunk-O75QAT4Z.js.map +1 -0
- package/build/modern/{chunk-C5HLLGME.js → chunk-OW62FLJ6.js} +1 -1
- package/build/modern/chunk-OW62FLJ6.js.map +1 -0
- package/build/modern/{chunk-RPZAPUCF.js → chunk-OWKN5IV7.js} +3 -3
- package/build/modern/chunk-OWKN5IV7.js.map +1 -0
- package/build/modern/{chunk-PJ3744I6.js → chunk-PKQTTFWA.js} +1 -1
- package/build/modern/chunk-PKQTTFWA.js.map +1 -0
- package/build/modern/{chunk-N3FUF4TB.js → chunk-PKY46RRA.js} +1 -1
- package/build/modern/chunk-PKY46RRA.js.map +1 -0
- package/build/modern/{chunk-4M4LCQ43.js → chunk-Q7BRMIBR.js} +1 -1
- package/build/modern/{chunk-4M4LCQ43.js.map → chunk-Q7BRMIBR.js.map} +1 -1
- package/build/modern/{chunk-QEA6N6TN.js → chunk-REO5GUNC.js} +1 -1
- package/build/modern/chunk-REO5GUNC.js.map +1 -0
- package/build/modern/{chunk-KF24CS4S.js → chunk-RIFQSCHT.js} +1 -1
- package/build/modern/chunk-RIFQSCHT.js.map +1 -0
- package/build/modern/{chunk-RBZAEOKN.js → chunk-S7XGIQY6.js} +6 -3
- package/build/modern/chunk-S7XGIQY6.js.map +1 -0
- package/build/modern/{chunk-3C2DJSEE.js → chunk-SXIXDXG3.js} +1 -1
- package/build/modern/chunk-SXIXDXG3.js.map +1 -0
- package/build/modern/{chunk-7VJOPJVX.js → chunk-TKI2CKHH.js} +1 -1
- package/build/modern/chunk-TKI2CKHH.js.map +1 -0
- package/build/modern/{chunk-SLHX5K6I.js → chunk-UBJBMOG7.js} +4 -2
- package/build/modern/chunk-UBJBMOG7.js.map +1 -0
- package/build/modern/{chunk-ZAU4JVLL.js → chunk-UZDVOIW5.js} +1 -1
- package/build/modern/chunk-UZDVOIW5.js.map +1 -0
- package/build/modern/{chunk-QZ6NS6VN.js → chunk-VG46RHBJ.js} +1 -1
- package/build/modern/chunk-VG46RHBJ.js.map +1 -0
- package/build/modern/{chunk-QU7UV5DB.js → chunk-WLEX22KS.js} +1 -1
- package/build/modern/chunk-WLEX22KS.js.map +1 -0
- package/build/modern/{chunk-SSY3KX3F.js → chunk-WZOYPFUU.js} +3 -3
- package/build/modern/chunk-WZOYPFUU.js.map +1 -0
- package/build/modern/{chunk-HW76XVA3.js → chunk-XEW6TJJ4.js} +1 -1
- package/build/modern/chunk-XEW6TJJ4.js.map +1 -0
- package/build/modern/{chunk-G6O7KRQ6.js → chunk-ZFK33MVD.js} +1 -1
- package/build/modern/chunk-ZFK33MVD.js.map +1 -0
- package/build/modern/components/Avatar.js +2 -2
- package/build/modern/components/Button.js +1 -1
- package/build/modern/components/Checkbox.js +3 -3
- package/build/modern/components/CircularProgress.js +1 -1
- package/build/modern/components/Droppable.js +1 -1
- package/build/modern/components/FeatureFlag.js +3 -3
- package/build/modern/components/FieldMessage.js +2 -2
- package/build/modern/components/FileStatus.js +7 -7
- package/build/modern/components/FileUploader.js +3 -3
- package/build/modern/components/IconButton.js +1 -1
- package/build/modern/components/Input.js +3 -3
- package/build/modern/components/Label.js +3 -3
- package/build/modern/components/Modal.js +1 -1
- package/build/modern/components/ModalDescription.js +1 -1
- package/build/modern/components/ModalHeader.js +1 -1
- package/build/modern/components/ModalHeading.js +1 -1
- package/build/modern/components/NavMenuLink.js +2 -2
- package/build/modern/components/NavMenuList.js +3 -3
- package/build/modern/components/NavMenuTrigger.js +3 -3
- package/build/modern/components/Notification.js +1 -1
- package/build/modern/components/NotificationDescription.js +1 -1
- package/build/modern/components/NotificationHeading.js +1 -1
- package/build/modern/components/Portal.js +1 -1
- package/build/modern/components/ProgressBar.js +1 -1
- package/build/modern/components/Radio.js +2 -2
- package/build/modern/components/Select.js +3 -3
- package/build/modern/components/Show.js +1 -1
- package/build/modern/components/Spinner.js +1 -1
- package/build/modern/components/Tab.js +3 -3
- package/build/modern/components/TabList.js +2 -2
- package/build/modern/components/TabPanel.js +3 -3
- package/build/modern/components/Table.js +1 -1
- package/build/modern/components/Tag.js +5 -2
- package/build/modern/components/Tbody.js +1 -1
- package/build/modern/components/Td.js +1 -1
- package/build/modern/components/Textarea.js +2 -2
- package/build/modern/components/Th.js +2 -2
- package/build/modern/components/Thead.js +1 -1
- package/build/modern/components/Toggle.js +2 -2
- package/build/modern/context/confirm-modal.js +10 -10
- package/build/modern/context/feature-flags.js +1 -1
- package/build/modern/context/field.js +1 -1
- package/build/modern/context/navMenu.js +1 -1
- package/build/modern/context/notification-center.js +7 -7
- package/build/modern/context/prompt-modal.js +13 -13
- package/build/modern/context/tabs.js +1 -1
- package/build/modern/context/theme.js +2 -2
- package/build/modern/hooks/useModal.js +1 -1
- package/build/modern/hooks/useTheme.js +1 -1
- package/build/modern/hooks/useToggle.js +1 -1
- package/build/modern/index.js +51 -51
- package/package.json +2 -2
- package/src/components/Avatar.tsx +28 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Checkbox.tsx +11 -1
- package/src/components/CircularProgress.tsx +1 -1
- package/src/components/Droppable.tsx +13 -0
- package/src/components/FeatureFlag.tsx +7 -0
- package/src/components/FieldMessage.tsx +13 -6
- package/src/components/FileStatus.tsx +38 -11
- package/src/components/FileUploader.tsx +10 -0
- package/src/components/IconButton.tsx +15 -5
- package/src/components/Input.tsx +21 -4
- package/src/components/Label.tsx +13 -8
- package/src/components/Modal.tsx +8 -3
- package/src/components/ModalDescription.tsx +1 -0
- package/src/components/ModalHeader.tsx +1 -0
- package/src/components/ModalHeading.tsx +1 -0
- package/src/components/NavMenuLink.tsx +22 -0
- package/src/components/NavMenuList.tsx +37 -5
- package/src/components/NavMenuTrigger.tsx +13 -0
- package/src/components/Notification.tsx +13 -6
- package/src/components/NotificationDescription.tsx +8 -6
- package/src/components/NotificationHeading.tsx +8 -6
- package/src/components/Portal.tsx +9 -2
- package/src/components/ProgressBar.tsx +14 -4
- package/src/components/Radio.tsx +29 -0
- package/src/components/Select.tsx +17 -8
- package/src/components/Show.tsx +16 -5
- package/src/components/Spinner.tsx +12 -5
- package/src/components/Tab.tsx +13 -5
- package/src/components/TabList.tsx +5 -1
- package/src/components/TabPanel.tsx +7 -2
- package/src/components/Table.tsx +6 -3
- package/src/components/Tag.tsx +28 -2
- package/src/components/Tbody.tsx +7 -1
- package/src/components/Td.tsx +2 -1
- package/src/components/Textarea.tsx +9 -4
- package/src/components/Th.tsx +13 -1
- package/src/components/Thead.tsx +2 -1
- package/src/components/Toggle.tsx +35 -0
- package/src/context/confirm-modal.tsx +17 -0
- package/src/context/feature-flags.tsx +4 -1
- package/src/context/field.tsx +26 -0
- package/src/context/navMenu.tsx +25 -0
- package/src/context/notification-center.tsx +17 -0
- package/src/context/prompt-modal.tsx +39 -1
- package/src/context/tabs.tsx +31 -4
- package/src/context/theme.tsx +29 -1
- package/src/hooks/useModal.ts +14 -0
- package/src/hooks/useTheme.ts +21 -0
- package/src/hooks/useToggle.ts +22 -0
- package/build/modern/chunk-3C2DJSEE.js.map +0 -1
- package/build/modern/chunk-3GXISGPS.js.map +0 -1
- package/build/modern/chunk-4CAT3FHV.js.map +0 -1
- package/build/modern/chunk-4M3EUP57.js.map +0 -1
- package/build/modern/chunk-4O4QFF4S.js.map +0 -1
- package/build/modern/chunk-4YJOK7JJ.js.map +0 -1
- package/build/modern/chunk-6DIGPXAD.js.map +0 -1
- package/build/modern/chunk-6F34A7NZ.js.map +0 -1
- package/build/modern/chunk-7VJOPJVX.js.map +0 -1
- package/build/modern/chunk-A5WYZVUR.js.map +0 -1
- package/build/modern/chunk-A6CLBPFE.js.map +0 -1
- package/build/modern/chunk-AEDGCR25.js.map +0 -1
- package/build/modern/chunk-BTEEBIVN.js.map +0 -1
- package/build/modern/chunk-C5HLLGME.js.map +0 -1
- package/build/modern/chunk-CMKBUSGN.js.map +0 -1
- package/build/modern/chunk-G6O7KRQ6.js.map +0 -1
- package/build/modern/chunk-GABTVDSB.js.map +0 -1
- package/build/modern/chunk-HW76XVA3.js.map +0 -1
- package/build/modern/chunk-ISPTI4GC.js.map +0 -1
- package/build/modern/chunk-IXOJLCNO.js.map +0 -1
- package/build/modern/chunk-JB7IQ2BM.js.map +0 -1
- package/build/modern/chunk-JXJ6VFZO.js.map +0 -1
- package/build/modern/chunk-KF24CS4S.js.map +0 -1
- package/build/modern/chunk-KJUCHZHV.js.map +0 -1
- package/build/modern/chunk-LAOQSNMN.js.map +0 -1
- package/build/modern/chunk-N3FUF4TB.js.map +0 -1
- package/build/modern/chunk-PH64POOB.js.map +0 -1
- package/build/modern/chunk-PJ3744I6.js.map +0 -1
- package/build/modern/chunk-PMCYXRAH.js.map +0 -1
- package/build/modern/chunk-QEA6N6TN.js.map +0 -1
- package/build/modern/chunk-QU7UV5DB.js.map +0 -1
- package/build/modern/chunk-QZ6NS6VN.js.map +0 -1
- package/build/modern/chunk-RBZAEOKN.js.map +0 -1
- package/build/modern/chunk-RPZAPUCF.js.map +0 -1
- package/build/modern/chunk-RQPDRHRP.js.map +0 -1
- package/build/modern/chunk-S3MTABYX.js.map +0 -1
- package/build/modern/chunk-SLHX5K6I.js.map +0 -1
- package/build/modern/chunk-SONHHNYQ.js.map +0 -1
- package/build/modern/chunk-SSY3KX3F.js.map +0 -1
- package/build/modern/chunk-TCO46FK7.js.map +0 -1
- package/build/modern/chunk-U72VPIZA.js.map +0 -1
- package/build/modern/chunk-UN3OAW56.js.map +0 -1
- package/build/modern/chunk-VGHVH2T3.js.map +0 -1
- package/build/modern/chunk-VULPMZUW.js.map +0 -1
- package/build/modern/chunk-XPVDT4VF.js.map +0 -1
- package/build/modern/chunk-XREC5IJE.js.map +0 -1
- package/build/modern/chunk-ZAU4JVLL.js.map +0 -1
- package/build/modern/chunk-ZBEHDXFT.js.map +0 -1
- /package/build/modern/{chunk-GKUDLVOV.js.map → chunk-ITOIXNJS.js.map} +0 -0
package/src/components/Table.tsx
CHANGED
|
@@ -8,13 +8,16 @@ import type { PropsWithChildren, TableHTMLAttributes } from 'react'
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
11
|
+
/**
|
|
12
|
+
* An easy to understand description of the table. Required for accessibility.
|
|
13
|
+
*/
|
|
11
14
|
caption: string
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @definition [Table
|
|
17
|
-
* @
|
|
18
|
+
* An accessible table component.
|
|
19
|
+
* @definition [ARIA Table pattern](https://www.w3.org/WAI/ARIA/apg/patterns/table/)
|
|
20
|
+
* @see https://cerberus.digitalu.design/react/table.
|
|
18
21
|
* @example
|
|
19
22
|
* ```tsx
|
|
20
23
|
* <Table caption="Basic Table">
|
package/src/components/Tag.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
2
|
-
import { Close } from '@cerberus/icons'
|
|
3
2
|
import { Show } from './Show'
|
|
4
3
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
5
4
|
import {
|
|
@@ -7,6 +6,7 @@ import {
|
|
|
7
6
|
tag,
|
|
8
7
|
type TagVariantProps,
|
|
9
8
|
} from '@cerberus/styled-system/recipes'
|
|
9
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* This module contains the tag component.
|
|
@@ -15,14 +15,39 @@ import {
|
|
|
15
15
|
|
|
16
16
|
export type StaticTagProps = HTMLAttributes<HTMLSpanElement> &
|
|
17
17
|
TagVariantProps & {
|
|
18
|
+
/**
|
|
19
|
+
* The action to be performed when the tag is clicked. Not available when
|
|
20
|
+
* the palette or gradient props are provided.
|
|
21
|
+
*/
|
|
18
22
|
onClick?: never
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
26
|
+
/**
|
|
27
|
+
* The gradient to apply to the tag. Not available when the onClick prop is
|
|
28
|
+
* provided.
|
|
29
|
+
*/
|
|
22
30
|
gradient?: never
|
|
31
|
+
/**
|
|
32
|
+
* The palette to use for the tag. Not available when the onClick prop is
|
|
33
|
+
* provided.
|
|
34
|
+
*/
|
|
23
35
|
palette?: never
|
|
36
|
+
/**
|
|
37
|
+
* The action to be performed when the tag is clicked.
|
|
38
|
+
*/
|
|
24
39
|
onClick: () => void
|
|
40
|
+
/**
|
|
41
|
+
* The shape of the tag. Not available when the onClick prop is provided.
|
|
42
|
+
* @type 'pill' | 'rounded'
|
|
43
|
+
* @default 'pill'
|
|
44
|
+
*/
|
|
25
45
|
shape: 'pill'
|
|
46
|
+
/**
|
|
47
|
+
* The usage of the tag. Not available when the onClick prop is provided.
|
|
48
|
+
* @type 'filled' | 'outlined'
|
|
49
|
+
* @default 'filled'
|
|
50
|
+
*/
|
|
26
51
|
usage: 'filled'
|
|
27
52
|
}
|
|
28
53
|
|
|
@@ -30,7 +55,7 @@ export type TagProps = StaticTagProps | ClickableTagProps
|
|
|
30
55
|
|
|
31
56
|
/**
|
|
32
57
|
* The Tag component is used to display a meta descriptions.
|
|
33
|
-
* @
|
|
58
|
+
* @see https://cerberus.digitalu.design/react/tag
|
|
34
59
|
* @example
|
|
35
60
|
* ```tsx
|
|
36
61
|
* <Tag>Tag</Tag>
|
|
@@ -42,6 +67,7 @@ export function Tag(props: PropsWithChildren<TagProps>): JSX.Element {
|
|
|
42
67
|
const isClosable = Boolean(onClick)
|
|
43
68
|
const shape = isClosable ? 'pill' : initShape
|
|
44
69
|
const closableStyles = isClosable ? closableCss : ''
|
|
70
|
+
const { close: Close } = $cerberusIcons
|
|
45
71
|
|
|
46
72
|
return (
|
|
47
73
|
<span
|
package/src/components/Tbody.tsx
CHANGED
|
@@ -2,12 +2,18 @@ import { tbody, type TbodyVariantProps } from '@cerberus/styled-system/recipes'
|
|
|
2
2
|
import { cx } from '@cerberus/styled-system/css'
|
|
3
3
|
import type { TableHTMLAttributes } from 'react'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* This module provides a TBody component.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
|
|
5
10
|
export type TbodyBaseProps = TableHTMLAttributes<HTMLTableSectionElement>
|
|
6
11
|
export type TbodyProps = TbodyBaseProps & TbodyVariantProps
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* The TBody component is used to render a table body.
|
|
10
|
-
* @
|
|
15
|
+
* @see https://cerberus.digitalu.design/react/table
|
|
16
|
+
* @memberof module:Table
|
|
11
17
|
* @example
|
|
12
18
|
* ```tsx
|
|
13
19
|
* <TBody>
|
package/src/components/Td.tsx
CHANGED
|
@@ -12,7 +12,8 @@ export type TdProps = TdBaseProps & TdVariantProps
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Styles for the Th component
|
|
15
|
-
* @
|
|
15
|
+
* @see https://cerberus.digitalu.design/react/table
|
|
16
|
+
* @memberof module:Table
|
|
16
17
|
* @example
|
|
17
18
|
* ```tsx
|
|
18
19
|
* <Td>Data cell</Td>
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import type { TextareaHTMLAttributes } from 'react'
|
|
4
4
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
5
|
-
import { input } from '@cerberus/styled-system/recipes'
|
|
5
|
+
import { input, type InputVariantProps } from '@cerberus/styled-system/recipes'
|
|
6
6
|
import { useFieldContext } from '../context/field'
|
|
7
|
-
import type { InputRecipeProps } from './Input'
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* This module contains the Textarea component.
|
|
@@ -13,14 +12,20 @@ import type { InputRecipeProps } from './Input'
|
|
|
13
12
|
|
|
14
13
|
export interface TextareaBaseProps
|
|
15
14
|
extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
15
|
+
/**
|
|
16
|
+
* The ID of the FieldMessage that describes the textarea.
|
|
17
|
+
*/
|
|
16
18
|
describedBy?: string
|
|
19
|
+
/**
|
|
20
|
+
* The unique id of the textarea.
|
|
21
|
+
*/
|
|
17
22
|
id: string
|
|
18
23
|
}
|
|
19
|
-
export type TextareaProps =
|
|
24
|
+
export type TextareaProps = InputVariantProps & TextareaBaseProps
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
* A component that allows the user to input large blocks of text.
|
|
23
|
-
* @
|
|
28
|
+
* @see https://cerberus.digitalu.design/react/textarea
|
|
24
29
|
*/
|
|
25
30
|
export function Textarea(props: TextareaProps): JSX.Element {
|
|
26
31
|
const { describedBy, ...nativeProps } = props
|
package/src/components/Th.tsx
CHANGED
|
@@ -9,17 +9,29 @@ import { Show } from './Show'
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export type ThBaseProps = TableHTMLAttributes<HTMLTableCellElement> & {
|
|
12
|
+
/**
|
|
13
|
+
* Converts the Th into a actionable button. Called when the user clicks on
|
|
14
|
+
* the Th.
|
|
15
|
+
*/
|
|
12
16
|
onClick?: (e: MouseEvent<HTMLButtonElement>) => void
|
|
13
17
|
}
|
|
14
18
|
export type ThProps = ThBaseProps & ThVariantProps
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* Styles for the Th component
|
|
18
|
-
* @
|
|
22
|
+
* @see https://cerberus.digitalu.design/react/table
|
|
23
|
+
* @memberof module:Table
|
|
19
24
|
* @example
|
|
20
25
|
* ```tsx
|
|
21
26
|
* <Th>Header 1</Th>
|
|
22
27
|
* ```
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Th onClick={handleClick}>
|
|
31
|
+
* Names
|
|
32
|
+
* <SortIcon />
|
|
33
|
+
* </Th>
|
|
34
|
+
* ```
|
|
23
35
|
*/
|
|
24
36
|
export function Th(props: ThProps) {
|
|
25
37
|
const { size, onClick, ...nativeProps } = props
|
package/src/components/Thead.tsx
CHANGED
|
@@ -11,7 +11,8 @@ export type TheadProps = TableHTMLAttributes<HTMLTableSectionElement>
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The Thead component is used to render a table header.
|
|
14
|
-
* @
|
|
14
|
+
* @see https://cerberus.digitalu.design/react/table
|
|
15
|
+
* @memberof module:Table
|
|
15
16
|
* @example
|
|
16
17
|
* ```tsx
|
|
17
18
|
* <Thead>
|
|
@@ -10,16 +10,51 @@ import type { InputHTMLAttributes } from 'react'
|
|
|
10
10
|
import { $cerberusIcons } from '../config/defineIcons'
|
|
11
11
|
import { useFieldContext } from '../context/field'
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* This module provides a toggle component.
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
|
|
13
18
|
export type ToggleBase = Omit<
|
|
14
19
|
InputHTMLAttributes<HTMLInputElement>,
|
|
15
20
|
'size' | 'id' | 'value'
|
|
16
21
|
> & {
|
|
22
|
+
/**
|
|
23
|
+
* The FieldMessage providing context for the Toggle.
|
|
24
|
+
*/
|
|
17
25
|
describedBy?: string
|
|
26
|
+
/**
|
|
27
|
+
* A unique identifier for the Toggle. Required for accessibility.
|
|
28
|
+
*/
|
|
18
29
|
id: string
|
|
30
|
+
/**
|
|
31
|
+
* The value of the Toggle.
|
|
32
|
+
*/
|
|
19
33
|
value: string
|
|
20
34
|
}
|
|
21
35
|
export type ToggleProps = ToggleBase & ToggleVariantProps
|
|
22
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The Toggle component is used to switch between two states. Optionally
|
|
39
|
+
* combine with the `useToggle` hook.
|
|
40
|
+
* @see https://cerberus.digitalu.design/react/toggle
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* const { checked, handleChange } = useToggle({ checked: 'toggle' })
|
|
44
|
+
*
|
|
45
|
+
* <Hstack justify="space-between" w="full">
|
|
46
|
+
* <Field>
|
|
47
|
+
* <Label htmlFor="toggle">Show notifications</Label>
|
|
48
|
+
* <Toggle
|
|
49
|
+
* checked={checked === 'toggle'}
|
|
50
|
+
* id="toggle"
|
|
51
|
+
* onChange={handleChange}
|
|
52
|
+
* value="toggle"
|
|
53
|
+
* />
|
|
54
|
+
* </Field>
|
|
55
|
+
* </Hstack>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
23
58
|
export function Toggle(props: ToggleProps) {
|
|
24
59
|
const { size, describedBy, ...nativeProps } = props
|
|
25
60
|
const styles = toggle({ size })
|
|
@@ -30,10 +30,26 @@ import { Avatar } from '../components/Avatar'
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
export interface ShowConfirmModalOptions {
|
|
33
|
+
/**
|
|
34
|
+
* The kind of confirm modal to show.
|
|
35
|
+
* @default 'non-destructive'
|
|
36
|
+
*/
|
|
33
37
|
kind?: 'destructive' | 'non-destructive'
|
|
38
|
+
/**
|
|
39
|
+
* The heading of the confirm modal.
|
|
40
|
+
*/
|
|
34
41
|
heading: string
|
|
42
|
+
/**
|
|
43
|
+
* The description of the confirm modal.
|
|
44
|
+
*/
|
|
35
45
|
description?: string
|
|
46
|
+
/**
|
|
47
|
+
* The text for the action button.
|
|
48
|
+
*/
|
|
36
49
|
actionText: string
|
|
50
|
+
/**
|
|
51
|
+
* The text for the cancel button.
|
|
52
|
+
*/
|
|
37
53
|
cancelText: string
|
|
38
54
|
}
|
|
39
55
|
export type ShowResult =
|
|
@@ -50,6 +66,7 @@ export interface ConfirmModalProviderProps {}
|
|
|
50
66
|
|
|
51
67
|
/**
|
|
52
68
|
* Provides a confirm modal to the app.
|
|
69
|
+
* @see https://cerberus.digitalu.design/react/confirm-modal
|
|
53
70
|
* @example
|
|
54
71
|
* ```tsx
|
|
55
72
|
* // Wrap the Provider around the root of the feature.
|
|
@@ -19,7 +19,7 @@ export interface FeatureFlagProviderProps {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Provides feature flags to the application.
|
|
22
|
-
* @
|
|
22
|
+
* @see https://cerberus.digitalu.design/react/feature-flags
|
|
23
23
|
* @example
|
|
24
24
|
* ```tsx
|
|
25
25
|
* // This should be a JSON file or a server response.
|
|
@@ -49,6 +49,9 @@ export function FeatureFlags(
|
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Used to retrieve the context of the FeatureFlags provider.
|
|
54
|
+
*/
|
|
52
55
|
export function useFeatureFlags(key: string): boolean {
|
|
53
56
|
const context = useContext(FeatureFlagContext)
|
|
54
57
|
if (context === null) {
|
package/src/context/field.tsx
CHANGED
|
@@ -7,15 +7,37 @@ import {
|
|
|
7
7
|
type PropsWithChildren,
|
|
8
8
|
} from 'react'
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* This module provides a context and hook for the field.
|
|
12
|
+
* @module Field
|
|
13
|
+
*/
|
|
14
|
+
|
|
10
15
|
export interface FieldContextValue {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the field is disabled.
|
|
18
|
+
* @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)
|
|
19
|
+
*/
|
|
11
20
|
disabled?: boolean
|
|
21
|
+
/**
|
|
22
|
+
* Whether the field is read-only.
|
|
23
|
+
*/
|
|
12
24
|
readOnly?: boolean
|
|
25
|
+
/**
|
|
26
|
+
* Whether the field is required.
|
|
27
|
+
*/
|
|
13
28
|
required?: boolean
|
|
29
|
+
/**
|
|
30
|
+
* Whether the field is invalid.
|
|
31
|
+
*/
|
|
14
32
|
invalid?: boolean
|
|
15
33
|
}
|
|
16
34
|
|
|
17
35
|
const FieldContext = createContext<FieldContextValue | null>(null)
|
|
18
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Provides the field state for a all related components used within a group.
|
|
39
|
+
* @see https://cerberus.digitalu.design/react/input
|
|
40
|
+
*/
|
|
19
41
|
export function Field(
|
|
20
42
|
props: PropsWithChildren<FieldContextValue>,
|
|
21
43
|
): JSX.Element {
|
|
@@ -36,6 +58,10 @@ export function Field(
|
|
|
36
58
|
)
|
|
37
59
|
}
|
|
38
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Used to access the field context.
|
|
63
|
+
* @returns The field context.
|
|
64
|
+
*/
|
|
39
65
|
export function useFieldContext(): FieldContextValue {
|
|
40
66
|
const context = useContext(FieldContext)
|
|
41
67
|
if (!context) {
|
package/src/context/navMenu.tsx
CHANGED
|
@@ -12,18 +12,39 @@ import {
|
|
|
12
12
|
type RefObject,
|
|
13
13
|
} from 'react'
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* This module provides a context and hook for the nav menu.
|
|
17
|
+
* @module NavMenu
|
|
18
|
+
*/
|
|
19
|
+
|
|
15
20
|
export type NavTriggerRef = RefObject<HTMLButtonElement>
|
|
16
21
|
export type NavMenuRef = RefObject<HTMLUListElement>
|
|
17
22
|
|
|
18
23
|
export interface NavMenuContextValue {
|
|
24
|
+
/**
|
|
25
|
+
* The ref for the trigger button.
|
|
26
|
+
*/
|
|
19
27
|
triggerRef: NavTriggerRef | null
|
|
28
|
+
/**
|
|
29
|
+
* The ref for the menu.
|
|
30
|
+
*/
|
|
20
31
|
menuRef: NavMenuRef | null
|
|
32
|
+
/**
|
|
33
|
+
* Whether the menu is expanded.
|
|
34
|
+
*/
|
|
21
35
|
expanded: boolean
|
|
36
|
+
/**
|
|
37
|
+
* Called when the menu button is clicked.
|
|
38
|
+
*/
|
|
22
39
|
onToggle: () => void
|
|
23
40
|
}
|
|
24
41
|
|
|
25
42
|
const NavMenuContext = createContext<NavMenuContextValue | null>(null)
|
|
26
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Provides the nav menu state for all the NavMenu family components.
|
|
46
|
+
* @see https://cerberus.digitalu.design/react/nav-menu
|
|
47
|
+
*/
|
|
27
48
|
export function NavMenu(props: PropsWithChildren): JSX.Element {
|
|
28
49
|
const triggerRef = useRef<HTMLButtonElement>(null)
|
|
29
50
|
const menuRef = useRef<HTMLUListElement>(null)
|
|
@@ -56,6 +77,10 @@ export function NavMenu(props: PropsWithChildren): JSX.Element {
|
|
|
56
77
|
)
|
|
57
78
|
}
|
|
58
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Used to access the nav menu context.
|
|
82
|
+
* @returns The nav menu context.
|
|
83
|
+
*/
|
|
59
84
|
export function useNavMenuContext(): NavMenuContextValue {
|
|
60
85
|
const context = useContext(NavMenuContext)
|
|
61
86
|
if (!context) {
|
|
@@ -26,10 +26,26 @@ import { cx } from '@cerberus/styled-system/css'
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
export interface NotifyOptions {
|
|
29
|
+
/**
|
|
30
|
+
* The palette of the notification.
|
|
31
|
+
* @default 'info'
|
|
32
|
+
*/
|
|
29
33
|
palette: 'info' | 'success' | 'warning' | 'danger'
|
|
34
|
+
/**
|
|
35
|
+
* The heading of the notification.
|
|
36
|
+
*/
|
|
30
37
|
heading: string
|
|
38
|
+
/**
|
|
39
|
+
* The unique id of the notification.
|
|
40
|
+
*/
|
|
31
41
|
id?: string
|
|
42
|
+
/**
|
|
43
|
+
* The description of the notification.
|
|
44
|
+
*/
|
|
32
45
|
description?: ReactNode
|
|
46
|
+
/**
|
|
47
|
+
* The action to take when the notification is closed
|
|
48
|
+
*/
|
|
33
49
|
onClose?: () => void
|
|
34
50
|
}
|
|
35
51
|
|
|
@@ -43,6 +59,7 @@ export interface NotificationsProviderProps extends PortalProps {}
|
|
|
43
59
|
|
|
44
60
|
/**
|
|
45
61
|
* Provides a notification center to the app.
|
|
62
|
+
* @see https://cerberus.digitalu.design/react/notification
|
|
46
63
|
* @example
|
|
47
64
|
* ```tsx
|
|
48
65
|
* // Wrap the Provider around the root of the feature.
|
|
@@ -30,15 +30,34 @@ import { Avatar } from '../components/Avatar'
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* This module provides a context and hook for the prompt modal.
|
|
33
|
-
* @module
|
|
33
|
+
* @module PromptModal
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
export interface ShowPromptModalOptions {
|
|
37
|
+
/**
|
|
38
|
+
* The kind of prompt modal to show.
|
|
39
|
+
* @default 'non-destructive'
|
|
40
|
+
*/
|
|
37
41
|
kind?: 'destructive' | 'non-destructive'
|
|
42
|
+
/**
|
|
43
|
+
* The heading of the prompt modal.
|
|
44
|
+
*/
|
|
38
45
|
heading: string
|
|
46
|
+
/**
|
|
47
|
+
* The description of the prompt modal.
|
|
48
|
+
*/
|
|
39
49
|
description?: string
|
|
50
|
+
/**
|
|
51
|
+
* The key to confirm the action.
|
|
52
|
+
*/
|
|
40
53
|
key: string
|
|
54
|
+
/**
|
|
55
|
+
* The text for the action button.
|
|
56
|
+
*/
|
|
41
57
|
actionText: string
|
|
58
|
+
/**
|
|
59
|
+
* The text for the cancel button.
|
|
60
|
+
*/
|
|
42
61
|
cancelText: string
|
|
43
62
|
}
|
|
44
63
|
export type PromptShowResult =
|
|
@@ -46,6 +65,21 @@ export type PromptShowResult =
|
|
|
46
65
|
| null
|
|
47
66
|
|
|
48
67
|
export interface PromptModalValue {
|
|
68
|
+
/**
|
|
69
|
+
* The method to trigger the prompt modal.
|
|
70
|
+
* @returns the value of the key if the action is confirmed.
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const accepted = await prompt.show({
|
|
74
|
+
* kind: 'destructive',
|
|
75
|
+
* heading: 'Delete channel?',
|
|
76
|
+
* description:
|
|
77
|
+
* 'This will permanently delete a channel on your account. There is no going back.',
|
|
78
|
+
* key: CHANNEL_NAME,
|
|
79
|
+
* actionText: 'Yes, delete channel',
|
|
80
|
+
* cancelText: 'No, cancel',
|
|
81
|
+
* })
|
|
82
|
+
*/
|
|
49
83
|
show: (options: ShowPromptModalOptions) => Promise<string>
|
|
50
84
|
}
|
|
51
85
|
|
|
@@ -55,6 +89,7 @@ export interface PromptModalProviderProps {}
|
|
|
55
89
|
|
|
56
90
|
/**
|
|
57
91
|
* Provides a prompt modal to the app.
|
|
92
|
+
* @see https://cerberus.digitalu.design/react/prompt-modal
|
|
58
93
|
* @example
|
|
59
94
|
* ```tsx
|
|
60
95
|
* // Wrap the Provider around the root of the feature.
|
|
@@ -236,6 +271,9 @@ export function PromptModal(
|
|
|
236
271
|
)
|
|
237
272
|
}
|
|
238
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Used to retrieve the context of the PromptModal provider.
|
|
276
|
+
*/
|
|
239
277
|
export function usePromptModal(): PromptModalValue {
|
|
240
278
|
const context = useContext(PromptModalContext)
|
|
241
279
|
if (context === null) {
|
package/src/context/tabs.tsx
CHANGED
|
@@ -15,30 +15,53 @@ import {
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* This module provides a Tabs component and a hook to access its context.
|
|
18
|
-
* @module
|
|
18
|
+
* @module Tabs
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
export interface TabsContextValue {
|
|
22
|
+
/**
|
|
23
|
+
* The ref for the tabs.
|
|
24
|
+
*/
|
|
22
25
|
tabs: MutableRefObject<HTMLButtonElement[]>
|
|
26
|
+
/**
|
|
27
|
+
* The id of the tabs component.
|
|
28
|
+
*/
|
|
23
29
|
id: string
|
|
30
|
+
/**
|
|
31
|
+
* The active tab id.
|
|
32
|
+
*/
|
|
24
33
|
active: string
|
|
34
|
+
/**
|
|
35
|
+
* The styles for the tabs.
|
|
36
|
+
*/
|
|
25
37
|
styles: Pretty<Record<'tabList' | 'tab' | 'tabPanel', string>>
|
|
38
|
+
/**
|
|
39
|
+
* Called when the active tab is updated.
|
|
40
|
+
*/
|
|
26
41
|
onTabUpdate: (active: string) => void
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
export const TabsContext = createContext<TabsContextValue | null>(null)
|
|
30
45
|
|
|
31
46
|
export interface TabsProps {
|
|
47
|
+
/**
|
|
48
|
+
* A unique identifier for the Tabs component. Typically used when there are
|
|
49
|
+
* multiple Tabs components on the same page.
|
|
50
|
+
*/
|
|
32
51
|
id?: string
|
|
52
|
+
/**
|
|
53
|
+
* The default active tab id.
|
|
54
|
+
*/
|
|
33
55
|
active?: string
|
|
56
|
+
/**
|
|
57
|
+
* Whether to cache the active tab state in local storage.
|
|
58
|
+
*/
|
|
34
59
|
cache?: boolean
|
|
35
60
|
}
|
|
36
61
|
|
|
37
62
|
/**
|
|
38
63
|
* The Tabs component provides a context to manage tab state.
|
|
39
|
-
* @
|
|
40
|
-
* @param active - the default active tab id,
|
|
41
|
-
* @param cache - whether to cache the active tab state in local storage
|
|
64
|
+
* @see https://cerberus.digitalu.design/react/tabs
|
|
42
65
|
* @example
|
|
43
66
|
* ```tsx
|
|
44
67
|
* <Tabs cache>
|
|
@@ -96,6 +119,10 @@ export function Tabs(
|
|
|
96
119
|
)
|
|
97
120
|
}
|
|
98
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Used to access the tabs context.
|
|
124
|
+
* @returns The tabs context.
|
|
125
|
+
*/
|
|
99
126
|
export function useTabsContext(): TabsContextValue {
|
|
100
127
|
const context = useContext(TabsContext)
|
|
101
128
|
if (!context) {
|
package/src/context/theme.tsx
CHANGED
|
@@ -3,14 +3,31 @@
|
|
|
3
3
|
import { createContext, useContext, type PropsWithChildren } from 'react'
|
|
4
4
|
import { useTheme, type UseThemeOptions } from '../hooks/useTheme'
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* This module provides a context and hook for the theme.
|
|
8
|
+
* @module Theme
|
|
9
|
+
*/
|
|
10
|
+
|
|
6
11
|
export type DefaultThemes = 'cerberus' | 'acheron'
|
|
7
12
|
export type CustomThemes<K extends string = DefaultThemes> = 'cerberus' | K
|
|
8
13
|
export type ColorModes = 'light' | 'dark' | 'system'
|
|
9
14
|
|
|
10
15
|
export interface ThemeContextValue<T extends string = DefaultThemes> {
|
|
16
|
+
/**
|
|
17
|
+
* The current theme.
|
|
18
|
+
*/
|
|
11
19
|
theme: CustomThemes<T>
|
|
20
|
+
/**
|
|
21
|
+
* The current color mode.
|
|
22
|
+
*/
|
|
12
23
|
mode: ColorModes
|
|
24
|
+
/**
|
|
25
|
+
* Called when the theme is updated.
|
|
26
|
+
*/
|
|
13
27
|
updateTheme: (theme: T) => void
|
|
28
|
+
/**
|
|
29
|
+
* Called when the color mode is updated.
|
|
30
|
+
*/
|
|
14
31
|
updateMode: (mode: ColorModes) => void
|
|
15
32
|
}
|
|
16
33
|
|
|
@@ -19,12 +36,20 @@ const ThemeContext = createContext<ThemeContextValue<DefaultThemes> | null>(
|
|
|
19
36
|
)
|
|
20
37
|
|
|
21
38
|
export interface ThemeProviderProps extends UseThemeOptions {
|
|
39
|
+
/**
|
|
40
|
+
* The default theme.
|
|
41
|
+
*/
|
|
22
42
|
defaultTheme?: DefaultThemes
|
|
43
|
+
/**
|
|
44
|
+
* The default color mode.
|
|
45
|
+
*/
|
|
23
46
|
defaultColorMode?: ColorModes
|
|
24
47
|
}
|
|
25
48
|
|
|
26
49
|
/**
|
|
27
|
-
* A context provider that allows the user to set the theme and mode of the
|
|
50
|
+
* A context provider that allows the user to set the theme and mode of the
|
|
51
|
+
* application.
|
|
52
|
+
* @see https://cerberus.digitalu.design/react/use-theme-context
|
|
28
53
|
* @example
|
|
29
54
|
* ```tsx
|
|
30
55
|
* <ThemeProvider>
|
|
@@ -48,6 +73,9 @@ export function ThemeProvider(
|
|
|
48
73
|
)
|
|
49
74
|
}
|
|
50
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Used to access the theme context.
|
|
78
|
+
*/
|
|
51
79
|
export function useThemeContext(): ThemeContextValue<DefaultThemes> {
|
|
52
80
|
const context = useContext(ThemeContext)
|
|
53
81
|
if (!context) {
|
package/src/hooks/useModal.ts
CHANGED
|
@@ -8,11 +8,25 @@ import { useCallback, useMemo, useRef, type RefObject } from 'react'
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
interface UseModalReturnValue {
|
|
11
|
+
/**
|
|
12
|
+
* The ref for the modal.
|
|
13
|
+
*/
|
|
11
14
|
modalRef: RefObject<HTMLDialogElement>
|
|
15
|
+
/**
|
|
16
|
+
* Shows the modal.
|
|
17
|
+
*/
|
|
12
18
|
show: () => void
|
|
19
|
+
/**
|
|
20
|
+
* Closes the modal.
|
|
21
|
+
*/
|
|
13
22
|
close: () => void
|
|
14
23
|
}
|
|
15
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Provides a hook for using a custom modal.
|
|
27
|
+
* @memberof module:Modal
|
|
28
|
+
* @returns The modal hook.
|
|
29
|
+
*/
|
|
16
30
|
export function useModal(): UseModalReturnValue {
|
|
17
31
|
const modalRef = useRef<HTMLDialogElement | null>(null)
|
|
18
32
|
|