@cerberus-design/react 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/_tsup-dts-rollup.d.cts +811 -126
- 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 +180 -0
- package/build/legacy/components/CircularProgress.cjs.map +1 -0
- 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 +75 -79
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs +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 +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 +104 -0
- package/build/legacy/components/Spinner.cjs.map +1 -0
- 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 +2 -2
- 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 +50 -10
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +2 -2
- 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 +37 -23
- package/build/legacy/context/theme.cjs.map +1 -1
- package/build/legacy/hooks/useModal.cjs.map +1 -1
- package/build/legacy/hooks/useTheme.cjs +41 -32
- package/build/legacy/hooks/useTheme.cjs.map +1 -1
- package/build/legacy/hooks/useToggle.cjs.map +1 -1
- package/build/legacy/index.cjs +605 -316
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +811 -126
- package/build/modern/aria-helpers/tabs.aria.js +2 -2
- package/build/modern/{chunk-DGJPW76I.js → chunk-2RPWSVRX.js} +13 -13
- 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-3O6UTN3J.js +155 -0
- 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-7SYJFI5E.js +80 -0
- package/build/modern/chunk-7SYJFI5E.js.map +1 -0
- package/build/modern/{chunk-ZCIJRM2X.js → chunk-AUAPBPGW.js} +5 -5
- 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-T7TOXGZT.js → chunk-E6QFLLXH.js} +21 -21
- package/build/modern/chunk-E6QFLLXH.js.map +1 -0
- package/build/modern/chunk-EB37HRCN.js +31 -0
- package/build/modern/chunk-EB37HRCN.js.map +1 -0
- package/build/modern/chunk-EJOXOICK.js +75 -0
- 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-2FK7NR7Y.js → chunk-I35HMGJQ.js} +5 -5
- package/build/modern/chunk-I35HMGJQ.js.map +1 -0
- package/build/modern/{chunk-WWJRKSM5.js → chunk-ILZKQP6R.js} +16 -16
- package/build/modern/chunk-ILZKQP6R.js.map +1 -0
- package/build/modern/{chunk-GKUDLVOV.js → chunk-ITOIXNJS.js} +2 -2
- package/build/modern/{chunk-XOVQGPIE.js → chunk-JCGWTIR4.js} +4 -4
- 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-O6WHVUEW.js → chunk-NUGDTZCL.js} +59 -19
- package/build/modern/chunk-NUGDTZCL.js.map +1 -0
- package/build/modern/{chunk-VRPAW76S.js → chunk-O6JYYVO7.js} +5 -5
- 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-Z6IWNVPN.js → chunk-S7XGIQY6.js} +10 -4
- 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-FMFKM2AB.js → chunk-WZOYPFUU.js} +5 -5
- 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-TYTEREKZ.js → chunk-ZFK33MVD.js} +2 -2
- 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 +8 -0
- package/build/modern/components/CircularProgress.js.map +1 -0
- 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 +7 -0
- package/build/modern/components/Spinner.js.map +1 -0
- 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 -5
- package/build/modern/hooks/useModal.js +1 -1
- package/build/modern/hooks/useTheme.js +5 -1
- package/build/modern/hooks/useToggle.js +1 -1
- package/build/modern/index.js +78 -68
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -4
- 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 +170 -0
- 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 +43 -16
- package/src/components/FileUploader.tsx +11 -1
- 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 +15 -5
- 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 +82 -0
- 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 +34 -7
- 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 +19 -2
- 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 +84 -12
- package/src/context/prompt-modal.tsx +41 -3
- package/src/context/tabs.tsx +31 -4
- package/src/context/theme.tsx +47 -10
- package/src/hooks/useModal.ts +14 -0
- package/src/hooks/useTheme.ts +66 -17
- package/src/hooks/useToggle.ts +22 -0
- package/src/index.ts +2 -0
- package/build/modern/chunk-2FK7NR7Y.js.map +0 -1
- 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-C5HLLGME.js.map +0 -1
- package/build/modern/chunk-DGJPW76I.js.map +0 -1
- package/build/modern/chunk-FMFKM2AB.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-JB7IQ2BM.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-N3FUF4TB.js.map +0 -1
- package/build/modern/chunk-O6WHVUEW.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-RPZAPUCF.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-SXXWC6UD.js +0 -83
- package/build/modern/chunk-SXXWC6UD.js.map +0 -1
- package/build/modern/chunk-T7TOXGZT.js.map +0 -1
- package/build/modern/chunk-TCO46FK7.js.map +0 -1
- package/build/modern/chunk-TYTEREKZ.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-VRPAW76S.js.map +0 -1
- package/build/modern/chunk-VULPMZUW.js.map +0 -1
- package/build/modern/chunk-WWJRKSM5.js.map +0 -1
- package/build/modern/chunk-XOVQGPIE.js.map +0 -1
- package/build/modern/chunk-XREC5IJE.js.map +0 -1
- package/build/modern/chunk-Z6IWNVPN.js.map +0 -1
- package/build/modern/chunk-ZAU4JVLL.js.map +0 -1
- package/build/modern/chunk-ZCIJRM2X.js.map +0 -1
- /package/build/modern/{chunk-GKUDLVOV.js.map → chunk-ITOIXNJS.js.map} +0 -0
|
@@ -21,21 +21,30 @@ export type SelectProps = Omit<
|
|
|
21
21
|
'size'
|
|
22
22
|
> &
|
|
23
23
|
SelectVariantProps & {
|
|
24
|
+
/**
|
|
25
|
+
* The unique id of the select element. Required for accessibility.
|
|
26
|
+
*/
|
|
24
27
|
id: string
|
|
28
|
+
/**
|
|
29
|
+
* The id of the FieldMessage that describes the select element.
|
|
30
|
+
*/
|
|
25
31
|
describedBy?: string
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
35
|
+
* Used to allow users to select a single option from a list of options.
|
|
36
|
+
* @see https://cerberus.digitalu.design/react/select
|
|
37
|
+
* @memberof module:Field
|
|
31
38
|
* @example
|
|
32
39
|
* ```tsx
|
|
33
|
-
* <
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* </
|
|
40
|
+
* <Field>
|
|
41
|
+
* <Select describedby="help:fruit" id="fruit">
|
|
42
|
+
* <Option value="">Choose option</Option>
|
|
43
|
+
* <Option value="one">Option 1</Option>
|
|
44
|
+
* <Option value="two">Option 2</Option>
|
|
45
|
+
* <Option value="three">Option 3</Option>
|
|
46
|
+
* </Select>
|
|
47
|
+
* </Field>
|
|
39
48
|
* ```
|
|
40
49
|
*/
|
|
41
50
|
export function Select(props: SelectProps) {
|
package/src/components/Show.tsx
CHANGED
|
@@ -2,19 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, type PropsWithChildren, type ReactNode } from 'react'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* This module contains the Show component.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
|
|
5
10
|
export interface ShowProps {
|
|
11
|
+
/**
|
|
12
|
+
* The condition to render memoized children or the fallback content.
|
|
13
|
+
*/
|
|
6
14
|
when: boolean | null | undefined
|
|
15
|
+
/**
|
|
16
|
+
* The children to render when the condition is false.
|
|
17
|
+
*/
|
|
7
18
|
fallback?: ReactNode
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
/**
|
|
11
|
-
* Conditionally render
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
22
|
+
* Conditionally render a memoized version of the children or optional fallback
|
|
23
|
+
* content.
|
|
24
|
+
* @see https://cerberus.digitalu.design/react/show
|
|
14
25
|
* @example
|
|
15
26
|
* ```tsx
|
|
16
|
-
* <Show when={
|
|
17
|
-
*
|
|
27
|
+
* <Show when={isLoggedIn} fallback={<Navigate to="/login" />}>
|
|
28
|
+
* <Dashboard />
|
|
18
29
|
* </Show>
|
|
19
30
|
*/
|
|
20
31
|
export function Show(props: PropsWithChildren<ShowProps>): ReactNode {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { SVGProps } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This module contains the Spinner component.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type SpinnerProps = SVGProps<SVGSVGElement> & {
|
|
9
|
+
/**
|
|
10
|
+
* The size of the spinner
|
|
11
|
+
*/
|
|
12
|
+
size?: number | string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The Spinner component is used to display a loading indicator. Typically used
|
|
17
|
+
* in buttons, modals, and other components that require a loading state.
|
|
18
|
+
* @see https://cerberus.digitalu.design/react/loading-states/
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Button>
|
|
22
|
+
* <Show when={loading} fallback={<>Save</>}>
|
|
23
|
+
* Saving
|
|
24
|
+
* <Spinner size={24} />
|
|
25
|
+
* </Show>
|
|
26
|
+
* </Button>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function Spinner(props: SpinnerProps) {
|
|
30
|
+
return (
|
|
31
|
+
<svg
|
|
32
|
+
aria-busy="true"
|
|
33
|
+
role="status"
|
|
34
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
35
|
+
height={props.size}
|
|
36
|
+
width={props.size}
|
|
37
|
+
viewBox="0 0 24 24"
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
<g
|
|
41
|
+
fill="none"
|
|
42
|
+
stroke="currentColor"
|
|
43
|
+
strokeLinecap="round"
|
|
44
|
+
strokeLinejoin="round"
|
|
45
|
+
strokeWidth={2}
|
|
46
|
+
>
|
|
47
|
+
<path
|
|
48
|
+
strokeDasharray={16}
|
|
49
|
+
strokeDashoffset={16}
|
|
50
|
+
d="M12 3c4.97 0 9 4.03 9 9"
|
|
51
|
+
>
|
|
52
|
+
<animate
|
|
53
|
+
fill="freeze"
|
|
54
|
+
attributeName="stroke-dashoffset"
|
|
55
|
+
dur="0.15s"
|
|
56
|
+
values="16;0"
|
|
57
|
+
></animate>
|
|
58
|
+
<animateTransform
|
|
59
|
+
attributeName="transform"
|
|
60
|
+
dur="0.75s"
|
|
61
|
+
repeatCount="indefinite"
|
|
62
|
+
type="rotate"
|
|
63
|
+
values="0 12 12;360 12 12"
|
|
64
|
+
></animateTransform>
|
|
65
|
+
</path>
|
|
66
|
+
<path
|
|
67
|
+
strokeDasharray={64}
|
|
68
|
+
strokeDashoffset={64}
|
|
69
|
+
strokeOpacity={0.3}
|
|
70
|
+
d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"
|
|
71
|
+
>
|
|
72
|
+
<animate
|
|
73
|
+
fill="freeze"
|
|
74
|
+
attributeName="stroke-dashoffset"
|
|
75
|
+
dur="0.6s"
|
|
76
|
+
values="64;0"
|
|
77
|
+
></animate>
|
|
78
|
+
</path>
|
|
79
|
+
</g>
|
|
80
|
+
</svg>
|
|
81
|
+
)
|
|
82
|
+
}
|
package/src/components/Tab.tsx
CHANGED
|
@@ -14,20 +14,28 @@ import { useTabsKeyboardNavigation } from '../aria-helpers/tabs.aria'
|
|
|
14
14
|
* This module provides a Tab component.
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
|
+
|
|
17
18
|
export interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
19
|
+
/**
|
|
20
|
+
* The id of the tab that will be tracked as the active tab and used for aria
|
|
21
|
+
* attributes.
|
|
22
|
+
*/
|
|
18
23
|
value: string
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
* The Tab component provides a tab element to be used in a TabList.
|
|
23
28
|
* @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)
|
|
24
|
-
* @
|
|
25
|
-
* @
|
|
29
|
+
* @see https://cerberus.digitalu.design/react/tabs
|
|
30
|
+
* @memberof module:Tabs
|
|
26
31
|
* @example
|
|
27
32
|
* ```tsx
|
|
28
|
-
* <
|
|
29
|
-
*
|
|
30
|
-
* </Tab>
|
|
33
|
+
* <Tabs>
|
|
34
|
+
* <TabList description="Profile settings">
|
|
35
|
+
* <Tab value="overview">Overview</Tab>
|
|
36
|
+
* </TabList>
|
|
37
|
+
* <TabPanel tab="overview">...</TabPanel>
|
|
38
|
+
* </Tabs>
|
|
31
39
|
* ```
|
|
32
40
|
*/
|
|
33
41
|
export function Tab(props: TabProps) {
|
|
@@ -11,12 +11,16 @@ import { useTabsContext } from '../context/tabs'
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
export interface TabListProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
/**
|
|
15
|
+
* A description of what the tab list contains. Required for accessibility.
|
|
16
|
+
*/
|
|
14
17
|
description: string
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* The TabList component provides a container for tab elements.
|
|
19
|
-
* @
|
|
22
|
+
* @see https://cerberus.digitalu.design/react/tabs
|
|
23
|
+
* @memberof module:Tabs
|
|
20
24
|
* @example
|
|
21
25
|
* ```tsx
|
|
22
26
|
* <TabList description="Button details">
|
|
@@ -11,12 +11,17 @@ import { Show } from './Show'
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
export interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
/**
|
|
15
|
+
* The unique value of the Tab that is associated with the TabPanel.
|
|
16
|
+
*/
|
|
14
17
|
tab: string
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
|
-
* The TabPanel component provides a panel element to be used in a Tabs
|
|
19
|
-
*
|
|
21
|
+
* The TabPanel component provides a panel element to be used in a Tabs
|
|
22
|
+
* provider.
|
|
23
|
+
* @see https://cerberus.digitalu.design/react/tabs
|
|
24
|
+
* @memberof module:Tabs
|
|
20
25
|
* @example
|
|
21
26
|
* ```tsx
|
|
22
27
|
* <TabPanel tab="overview">
|
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,27 +1,53 @@
|
|
|
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
|
-
import {
|
|
6
|
-
|
|
4
|
+
import {
|
|
5
|
+
iconButton,
|
|
6
|
+
tag,
|
|
7
|
+
type TagVariantProps,
|
|
8
|
+
} from '@cerberus/styled-system/recipes'
|
|
9
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* This module contains the tag component.
|
|
10
13
|
* @module
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
|
-
export type TagRecipeProps = RecipeVariantProps<typeof tag>
|
|
14
|
-
|
|
15
16
|
export type StaticTagProps = HTMLAttributes<HTMLSpanElement> &
|
|
16
|
-
|
|
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
|
+
*/
|
|
17
22
|
onClick?: never
|
|
18
23
|
}
|
|
19
24
|
|
|
20
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
|
+
*/
|
|
21
30
|
gradient?: never
|
|
31
|
+
/**
|
|
32
|
+
* The palette to use for the tag. Not available when the onClick prop is
|
|
33
|
+
* provided.
|
|
34
|
+
*/
|
|
22
35
|
palette?: never
|
|
36
|
+
/**
|
|
37
|
+
* The action to be performed when the tag is clicked.
|
|
38
|
+
*/
|
|
23
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
|
+
*/
|
|
24
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
|
+
*/
|
|
25
51
|
usage: 'filled'
|
|
26
52
|
}
|
|
27
53
|
|
|
@@ -29,7 +55,7 @@ export type TagProps = StaticTagProps | ClickableTagProps
|
|
|
29
55
|
|
|
30
56
|
/**
|
|
31
57
|
* The Tag component is used to display a meta descriptions.
|
|
32
|
-
* @
|
|
58
|
+
* @see https://cerberus.digitalu.design/react/tag
|
|
33
59
|
* @example
|
|
34
60
|
* ```tsx
|
|
35
61
|
* <Tag>Tag</Tag>
|
|
@@ -41,6 +67,7 @@ export function Tag(props: PropsWithChildren<TagProps>): JSX.Element {
|
|
|
41
67
|
const isClosable = Boolean(onClick)
|
|
42
68
|
const shape = isClosable ? 'pill' : initShape
|
|
43
69
|
const closableStyles = isClosable ? closableCss : ''
|
|
70
|
+
const { close: Close } = $cerberusIcons
|
|
44
71
|
|
|
45
72
|
return (
|
|
46
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.
|
|
@@ -134,7 +151,7 @@ export function ConfirmModal(
|
|
|
134
151
|
fallback={
|
|
135
152
|
<Avatar
|
|
136
153
|
ariaLabel=""
|
|
137
|
-
gradient="light
|
|
154
|
+
gradient="charon-light"
|
|
138
155
|
icon={<ConfirmIcon size={24} />}
|
|
139
156
|
src=""
|
|
140
157
|
/>
|
|
@@ -142,7 +159,7 @@ export function ConfirmModal(
|
|
|
142
159
|
>
|
|
143
160
|
<Avatar
|
|
144
161
|
ariaLabel=""
|
|
145
|
-
gradient="
|
|
162
|
+
gradient="hades-dark"
|
|
146
163
|
icon={<ConfirmIcon size={24} />}
|
|
147
164
|
src=""
|
|
148
165
|
/>
|
|
@@ -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) {
|