@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/Input.tsx
CHANGED
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type { InputHTMLAttributes, ReactNode } from 'react'
|
|
4
|
-
import { input } from '@cerberus/styled-system/recipes'
|
|
5
|
-
import { cx
|
|
4
|
+
import { input, type InputVariantProps } from '@cerberus/styled-system/recipes'
|
|
5
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
6
6
|
import { useFieldContext } from '../context/field'
|
|
7
7
|
import { $cerberusIcons } from '../config/defineIcons'
|
|
8
8
|
import { Show } from './Show'
|
|
9
9
|
|
|
10
|
-
export type InputRecipeProps = RecipeVariantProps<typeof input>
|
|
11
10
|
export interface InputBaseProps
|
|
12
11
|
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
12
|
+
/**
|
|
13
|
+
* The id of the FieldMessage component used to describe the input. Required for accessibility.
|
|
14
|
+
*/
|
|
13
15
|
describedBy?: string
|
|
16
|
+
/**
|
|
17
|
+
* The unique identifier for the input element. Required for accessibility.
|
|
18
|
+
*/
|
|
14
19
|
id: string
|
|
20
|
+
/**
|
|
21
|
+
* An optional icon to display at the start of the input.
|
|
22
|
+
*/
|
|
15
23
|
startIcon?: ReactNode
|
|
24
|
+
/**
|
|
25
|
+
* An optional icon to display at the end of the input.
|
|
26
|
+
*/
|
|
16
27
|
endIcon?: ReactNode
|
|
17
28
|
}
|
|
18
|
-
export type InputProps = InputBaseProps &
|
|
29
|
+
export type InputProps = InputBaseProps & InputVariantProps
|
|
19
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A component that allows the user to input text. Must be wrapped in a Field
|
|
33
|
+
* component to keep track of the state for entire group of elements related to
|
|
34
|
+
* the field.
|
|
35
|
+
* @see https://cerberus.digitalu.design/react/input
|
|
36
|
+
*/
|
|
20
37
|
export function Input(props: InputProps) {
|
|
21
38
|
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props
|
|
22
39
|
const inputStyles = input({ size })
|
package/src/components/Label.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
4
|
-
import { label } from '@cerberus/styled-system/recipes'
|
|
5
|
-
import { css, cx
|
|
4
|
+
import { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'
|
|
5
|
+
import { css, cx } from '@cerberus/styled-system/css'
|
|
6
6
|
import { hstack } from '@cerberus/styled-system/patterns'
|
|
7
7
|
import { useFieldContext } from '../context/field'
|
|
8
8
|
import { Show } from './Show'
|
|
@@ -11,22 +11,27 @@ import { Show } from './Show'
|
|
|
11
11
|
* This module contains the Label component.
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
export type LabelRecipeProps = RecipeVariantProps<typeof label>
|
|
16
14
|
export interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {
|
|
15
|
+
/**
|
|
16
|
+
* The unique identifier for the input element. Required for accessibility.
|
|
17
|
+
*/
|
|
17
18
|
htmlFor: string
|
|
19
|
+
/**
|
|
20
|
+
* Used to hide the label from the UI while keeping it accessible to screen readers. Typically used for global search inputs that have no visible label.
|
|
21
|
+
*/
|
|
18
22
|
hidden?: boolean
|
|
19
23
|
}
|
|
20
|
-
export type LabelProps = LabelBaseProps &
|
|
24
|
+
export type LabelProps = LabelBaseProps & LabelVariantProps
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
|
-
* A
|
|
27
|
+
* A a11y compliant label component.
|
|
24
28
|
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
25
|
-
* @
|
|
29
|
+
* @see https://cerberus.digitalu.design/react/label
|
|
26
30
|
* @example
|
|
27
31
|
* ```tsx
|
|
28
32
|
* <Field required>
|
|
29
|
-
* <Label htmlFor="
|
|
33
|
+
* <Label htmlFor="search" hidden>Search everything</Label>
|
|
34
|
+
* <Input id="search" startIcon={Search} type="text" />
|
|
30
35
|
* </Field>
|
|
31
36
|
* ```
|
|
32
37
|
*/
|
package/src/components/Modal.tsx
CHANGED
|
@@ -23,14 +23,19 @@ function ModalEl(props: ModalProps, ref: ForwardedRef<HTMLDialogElement>) {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The Modal component is the root element for a customizable modal.
|
|
26
|
+
* @see https://cerberus.digitalu.design/react/modal
|
|
26
27
|
* @example
|
|
27
28
|
* ```tsx
|
|
28
29
|
* const { modalRef } = useModal()
|
|
29
30
|
*
|
|
30
31
|
* <Modal ref={modalRef}>
|
|
31
|
-
* <
|
|
32
|
-
* <
|
|
33
|
-
*
|
|
32
|
+
* <Avatar icon={SomeIcon} />
|
|
33
|
+
* <ModalHeader>
|
|
34
|
+
* <ModalHeading>Modal Heading</ModalHeading>
|
|
35
|
+
* <ModalDescription>Modal description</ModalDescription>
|
|
36
|
+
* </ModalHeader>
|
|
37
|
+
*
|
|
38
|
+
* {props.children}
|
|
34
39
|
* </Modal>
|
|
35
40
|
* ```
|
|
36
41
|
*/
|
|
@@ -2,11 +2,33 @@ import type { AnchorHTMLAttributes, ElementType } from 'react'
|
|
|
2
2
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
3
3
|
import { Show } from './Show'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* This module contains the NavMenuLink component.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
|
|
5
10
|
export interface NavMenuLinkProps
|
|
6
11
|
extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
12
|
+
/**
|
|
13
|
+
* The element type to render as. Recommended to use for Next apps with the
|
|
14
|
+
* `Link` component.
|
|
15
|
+
*/
|
|
7
16
|
as?: ElementType
|
|
8
17
|
}
|
|
9
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The NavMenuLink component is a link element that is used within the NavMenu.
|
|
21
|
+
* @see https://cerberus.digitalu.design/react/nav-menu
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <NavMenu>
|
|
25
|
+
* <NavMenuList id="nav-menu-list" position="bottom">
|
|
26
|
+
* <NavMenuLink href="/home">Home</NavMenuLink>
|
|
27
|
+
* <NavMenuLink href="/about">About</NavMenuLink>
|
|
28
|
+
* </NavMenuList>
|
|
29
|
+
* </NavMenu>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
10
32
|
export function NavMenuLink(props: NavMenuLinkProps): JSX.Element {
|
|
11
33
|
const { as, ...nativeProps } = props
|
|
12
34
|
const hasAs = Boolean(as)
|
|
@@ -7,13 +7,35 @@ import { useNavMenuContext } from '../context/navMenu'
|
|
|
7
7
|
import type { Positions } from '../types'
|
|
8
8
|
import { Show } from './Show'
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* This module contains the NavMenuList component.
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
|
|
10
15
|
interface GetPositionResult {
|
|
16
|
+
/**
|
|
17
|
+
* The left position of the element.
|
|
18
|
+
*/
|
|
11
19
|
left: string
|
|
20
|
+
/**
|
|
21
|
+
* The right position of the element.
|
|
22
|
+
*/
|
|
12
23
|
right: string
|
|
24
|
+
/**
|
|
25
|
+
* The top position of the element.
|
|
26
|
+
*/
|
|
13
27
|
top: string
|
|
28
|
+
/**
|
|
29
|
+
* The bottom position of the element.
|
|
30
|
+
*/
|
|
14
31
|
bottom: string
|
|
15
32
|
}
|
|
16
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Returns the position of the NavMenuList based on the position prop.
|
|
36
|
+
* @param position - The position of the NavMenuList.
|
|
37
|
+
* @returns The position of the NavMenuList.
|
|
38
|
+
*/
|
|
17
39
|
export function getPosition(position: Positions): GetPositionResult {
|
|
18
40
|
const defaultPositions = {
|
|
19
41
|
left: 'auto',
|
|
@@ -67,21 +89,31 @@ const navListStyles = vstack({
|
|
|
67
89
|
})
|
|
68
90
|
|
|
69
91
|
export interface NavMenuListProps extends HTMLAttributes<HTMLUListElement> {
|
|
92
|
+
/**
|
|
93
|
+
* The unique identifier for the NavMenuList. Required for accessibility.
|
|
94
|
+
*/
|
|
70
95
|
id: string
|
|
96
|
+
/**
|
|
97
|
+
* The position of the NavMenuList.
|
|
98
|
+
* @type 'top' | 'right' | 'bottom' | 'left'
|
|
99
|
+
* @default 'bottom'
|
|
100
|
+
*/
|
|
71
101
|
position?: Positions
|
|
72
102
|
}
|
|
73
103
|
|
|
74
104
|
/**
|
|
75
105
|
* A component that allows the user to display a menu of navigation links.
|
|
76
106
|
* @definition [Disclosure Nav](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/)
|
|
77
|
-
* @
|
|
107
|
+
* @see https://cerberus.digitalu.design/react/nav-menu
|
|
78
108
|
*
|
|
79
109
|
* @example
|
|
80
110
|
* ```tsx
|
|
81
|
-
* <
|
|
82
|
-
* <
|
|
83
|
-
*
|
|
84
|
-
* </
|
|
111
|
+
* <NavMenu>
|
|
112
|
+
* <NavMenuList id="nav-menu-list" position="bottom">
|
|
113
|
+
* <NavMenuLink href="/home">Home</NavMenuLink>
|
|
114
|
+
* <NavMenuLink href="/about">About</NavMenuLink>
|
|
115
|
+
* </NavMenuList>
|
|
116
|
+
* </NavMenu>
|
|
85
117
|
* ```
|
|
86
118
|
**/
|
|
87
119
|
export function NavMenuList(props: NavMenuListProps): JSX.Element {
|
|
@@ -16,10 +16,23 @@ import { useNavMenuContext } from '../context/navMenu'
|
|
|
16
16
|
import type { ButtonProps } from './Button'
|
|
17
17
|
import { Show } from './Show'
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* This module contains the NavMenuTrigger component.
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
|
|
19
24
|
export interface NavMenuTriggerProps
|
|
20
25
|
extends ButtonHTMLAttributes<HTMLButtonElement>,
|
|
21
26
|
ButtonProps,
|
|
22
27
|
NavTriggerAriaValues {
|
|
28
|
+
/**
|
|
29
|
+
* The element type to render as. Recommended to use for an IconButton trigger vs a standard Button.
|
|
30
|
+
* @default 'button'
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <NavMenuTrigger as={IconButton} href="/home" />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
23
36
|
as?: ElementType
|
|
24
37
|
}
|
|
25
38
|
|
|
@@ -31,22 +31,29 @@ function MatchNotificationIcon(props: NotificationVariantProps) {
|
|
|
31
31
|
|
|
32
32
|
export interface NotificationBaseProps
|
|
33
33
|
extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {
|
|
34
|
+
/**
|
|
35
|
+
* The unique id of the notification. Required for the onClose callback.
|
|
36
|
+
*/
|
|
34
37
|
id: string
|
|
38
|
+
/**
|
|
39
|
+
* Called when the close button is clicked.
|
|
40
|
+
*/
|
|
35
41
|
onClose?: (e: MouseEvent<HTMLButtonElement>) => void
|
|
36
42
|
}
|
|
37
43
|
export type NotificationProps = NotificationBaseProps & NotificationVariantProps
|
|
38
44
|
|
|
39
45
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
46
|
+
* A static Notification component that displays a message to the user. This
|
|
47
|
+
* is typically only used when not utilizing the NotificationCenter.
|
|
48
|
+
* @see https://cerberus.digitalu.design/react/notification
|
|
49
|
+
* @memberof module:NotificationCenter
|
|
43
50
|
* @example
|
|
44
51
|
* ```tsx
|
|
45
52
|
* <Notification id="info:1" open>
|
|
46
53
|
* <NotificationHeading>Info Notification</NotificationHeading>
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
54
|
+
* <NotificationDescription>
|
|
55
|
+
* This is a description with a <a href="#">link</a> in the message.
|
|
56
|
+
* </NotificationDescription>
|
|
50
57
|
* </Notification>
|
|
51
58
|
* ```
|
|
52
59
|
*/
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module exports the NotificationDescription component.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
1
|
import { cx } from '@cerberus/styled-system/css'
|
|
7
2
|
import {
|
|
8
3
|
notification,
|
|
@@ -10,13 +5,20 @@ import {
|
|
|
10
5
|
} from '@cerberus/styled-system/recipes'
|
|
11
6
|
import type { HTMLAttributes } from 'react'
|
|
12
7
|
|
|
8
|
+
/**
|
|
9
|
+
* This module exports the NotificationDescription component.
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
13
|
export interface BaseNotificationDescriptionProps
|
|
14
14
|
extends HTMLAttributes<HTMLParagraphElement> {}
|
|
15
15
|
export type NotificationDescriptionProps = BaseNotificationDescriptionProps &
|
|
16
16
|
NotificationVariantProps
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Used to render the description of a notification.
|
|
20
|
+
* @see https://cerberus.digitalu.design/react/notification
|
|
21
|
+
* @memberof module:NotificationCenter
|
|
20
22
|
* @param props - The anything a HTMLParagraphElement can accept.
|
|
21
23
|
*/
|
|
22
24
|
export function NotificationDescription(props: NotificationDescriptionProps) {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module exports the NotificationHeading component.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
1
|
import { cx } from '@cerberus/styled-system/css'
|
|
7
2
|
import {
|
|
8
3
|
notification,
|
|
@@ -10,13 +5,20 @@ import {
|
|
|
10
5
|
} from '@cerberus/styled-system/recipes'
|
|
11
6
|
import type { HTMLAttributes } from 'react'
|
|
12
7
|
|
|
8
|
+
/**
|
|
9
|
+
* This module exports the NotificationHeading component.
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
13
|
export interface BaseNotificationHeadingProps
|
|
14
14
|
extends HTMLAttributes<HTMLParagraphElement> {}
|
|
15
15
|
export type NotificationHeadingProps = BaseNotificationHeadingProps &
|
|
16
16
|
NotificationVariantProps
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Used to render the heading of a notification.
|
|
20
|
+
* @see https://cerberus.digitalu.design/react/notification
|
|
21
|
+
* @memberof module:NotificationCenter
|
|
20
22
|
* @param props - The anything a HTMLParagraphElement can accept.
|
|
21
23
|
*/
|
|
22
24
|
export function NotificationHeading(props: NotificationHeadingProps) {
|
|
@@ -7,14 +7,21 @@ import { createPortal } from 'react-dom'
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export interface PortalProps {
|
|
10
|
+
/**
|
|
11
|
+
* The root container to render the children into.
|
|
12
|
+
* @default document.body
|
|
13
|
+
*/
|
|
10
14
|
container?: Element | DocumentFragment
|
|
15
|
+
/**
|
|
16
|
+
* An optional key to use for the Portal component.
|
|
17
|
+
*/
|
|
11
18
|
key?: null | string
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
/**
|
|
15
22
|
* The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
23
|
+
* @see https://cerberus.digitalu.design/react/portal
|
|
24
|
+
* @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)
|
|
18
25
|
*/
|
|
19
26
|
export function Portal(props: PropsWithChildren<PortalProps>) {
|
|
20
27
|
const container = props.container || document.body
|
|
@@ -12,11 +12,23 @@ import type { HTMLAttributes } from 'react'
|
|
|
12
12
|
|
|
13
13
|
export interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {}
|
|
14
14
|
export type NonIndeterminateProgressBarProps = {
|
|
15
|
+
/**
|
|
16
|
+
* The state of the progress bar.
|
|
17
|
+
*/
|
|
15
18
|
indeterminate?: never
|
|
19
|
+
/**
|
|
20
|
+
* The current value of the progress bar.
|
|
21
|
+
*/
|
|
16
22
|
now: number
|
|
17
23
|
}
|
|
18
24
|
export type IndeterminateProgressBarProps = {
|
|
19
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The state of the progress bar.
|
|
27
|
+
*/
|
|
28
|
+
indeterminate?: true
|
|
29
|
+
/**
|
|
30
|
+
* The current value of the progress bar.
|
|
31
|
+
*/
|
|
20
32
|
now?: never
|
|
21
33
|
}
|
|
22
34
|
export type ProgressBarProps = ProgressBarBaseProps &
|
|
@@ -25,9 +37,7 @@ export type ProgressBarProps = ProgressBarBaseProps &
|
|
|
25
37
|
|
|
26
38
|
/**
|
|
27
39
|
* The ProgressBar component is used to display the progress of a task.
|
|
28
|
-
* @
|
|
29
|
-
* @param props.now - The current value of the progress bar
|
|
30
|
-
* @param props.indeterminate - Whether the progress bar is indeterminate
|
|
40
|
+
* @see https://cerberus.digitalu.design/react/progress-indicators
|
|
31
41
|
* @example
|
|
32
42
|
* ```tsx
|
|
33
43
|
* <ProgressBar value={75} />
|
package/src/components/Radio.tsx
CHANGED
|
@@ -7,13 +7,42 @@ import type { RecipeVariantProps } from '@cerberus/styled-system/types'
|
|
|
7
7
|
import type { InputHTMLAttributes, PropsWithChildren } from 'react'
|
|
8
8
|
import { useFieldContext } from '../context/field'
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* This module contains the Radio component.
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
|
|
10
15
|
export type RadioRecipe = RecipeVariantProps<typeof radio>
|
|
11
16
|
export interface RadioBaseProps
|
|
12
17
|
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
18
|
+
/**
|
|
19
|
+
* A unique identifier for the radio button. Required for accessibility.
|
|
20
|
+
*/
|
|
13
21
|
id: string
|
|
14
22
|
}
|
|
15
23
|
export type RadioProps = RadioBaseProps & RadioRecipe
|
|
16
24
|
|
|
25
|
+
/**
|
|
26
|
+
* The Radio component is used to allow users to select a single option from a list of options.
|
|
27
|
+
* @see https://cerberus.digitalu.design/react/radio
|
|
28
|
+
* @memberof module:Field
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Field>
|
|
32
|
+
* <fieldset name="fruit">
|
|
33
|
+
* <Radio id="radio-1" name="fruit" value="1">
|
|
34
|
+
* Option 1
|
|
35
|
+
* </Radio>
|
|
36
|
+
* <Radio id="radio-2" name="fruit" value="2">
|
|
37
|
+
* Option 2
|
|
38
|
+
* </Radio>
|
|
39
|
+
* <Radio id="radio-3" name="fruit" value="3">
|
|
40
|
+
* Option 3
|
|
41
|
+
* </Radio>
|
|
42
|
+
* </fieldset>
|
|
43
|
+
* </Field>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
17
46
|
export function Radio(props: PropsWithChildren<RadioProps>) {
|
|
18
47
|
const { children, size, ...nativeProps } = props
|
|
19
48
|
const { invalid, ...state } = useFieldContext()
|
|
@@ -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 {
|
|
@@ -6,17 +6,24 @@ import type { SVGProps } from 'react'
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export type SpinnerProps = SVGProps<SVGSVGElement> & {
|
|
9
|
+
/**
|
|
10
|
+
* The size of the spinner
|
|
11
|
+
*/
|
|
9
12
|
size?: number | string
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
|
-
* The Spinner component is used to display a loading indicator.
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
16
|
-
* @description [Spinner Docs](https://cerberus.digitalu.design/react/loading-states/)
|
|
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/
|
|
17
19
|
* @example
|
|
18
20
|
* ```tsx
|
|
19
|
-
* <
|
|
21
|
+
* <Button>
|
|
22
|
+
* <Show when={loading} fallback={<>Save</>}>
|
|
23
|
+
* Saving
|
|
24
|
+
* <Spinner size={24} />
|
|
25
|
+
* </Show>
|
|
26
|
+
* </Button>
|
|
20
27
|
* ```
|
|
21
28
|
*/
|
|
22
29
|
export function Spinner(props: SpinnerProps) {
|
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">
|