@cerberus-design/react 0.15.0 → 0.16.0-next-4f6c716
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 +1329 -360
- package/build/legacy/components/Accordion.cjs.map +1 -1
- package/build/legacy/components/AccordionItemGroup.cjs.map +1 -1
- package/build/legacy/components/DatePicker.client.cjs +63 -77
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/components/FileStatus.cjs +126 -79
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/Legend.cjs +10 -22
- package/build/legacy/components/Legend.cjs.map +1 -1
- package/build/legacy/components/button/button.cjs +154 -0
- package/build/legacy/components/button/button.cjs.map +1 -0
- package/build/legacy/components/button/index.cjs +163 -0
- package/build/legacy/components/button/index.cjs.map +1 -0
- package/build/legacy/components/button/parts.cjs +159 -0
- package/build/legacy/components/button/parts.cjs.map +1 -0
- package/build/legacy/components/checkbox/checkbox-icon.cjs +121 -0
- package/build/legacy/components/checkbox/checkbox-icon.cjs.map +1 -0
- package/build/legacy/components/checkbox/checkbox.cjs +165 -0
- package/build/legacy/components/checkbox/checkbox.cjs.map +1 -0
- package/build/legacy/components/checkbox/index.cjs +179 -0
- package/build/legacy/components/checkbox/index.cjs.map +1 -0
- package/build/legacy/components/checkbox/parts.cjs +89 -0
- package/build/legacy/components/checkbox/parts.cjs.map +1 -0
- package/build/legacy/components/checkbox/primitives.cjs +87 -0
- package/build/legacy/components/checkbox/primitives.cjs.map +1 -0
- package/build/legacy/components/{FieldMessage.cjs → deprecated/FieldMessage.cjs} +4 -17
- package/build/legacy/components/deprecated/FieldMessage.cjs.map +1 -0
- package/build/legacy/components/{FieldsetLabel.cjs → deprecated/FieldsetLabel.cjs} +1 -1
- package/build/legacy/components/deprecated/FieldsetLabel.cjs.map +1 -0
- package/build/legacy/components/{Textarea.cjs → deprecated/Label.cjs} +24 -36
- package/build/legacy/components/deprecated/Label.cjs.map +1 -0
- package/build/legacy/components/{Modal.cjs → deprecated/Modal.cjs} +1 -1
- package/build/legacy/components/deprecated/Modal.cjs.map +1 -0
- package/build/legacy/components/{ModalDescription.cjs → deprecated/ModalDescription.cjs} +1 -1
- package/build/legacy/components/deprecated/ModalDescription.cjs.map +1 -0
- package/build/legacy/components/{ModalHeader.cjs → deprecated/ModalHeader.cjs} +1 -1
- package/build/legacy/components/deprecated/ModalHeader.cjs.map +1 -0
- package/build/legacy/components/{ModalHeading.cjs → deprecated/ModalHeading.cjs} +1 -1
- package/build/legacy/components/deprecated/ModalHeading.cjs.map +1 -0
- package/build/legacy/components/{NavMenuLink.cjs → deprecated/NavMenuLink.cjs} +2 -2
- package/build/legacy/components/deprecated/NavMenuLink.cjs.map +1 -0
- package/build/legacy/components/{NavMenuList.cjs → deprecated/NavMenuList.cjs} +2 -2
- package/build/legacy/components/deprecated/NavMenuList.cjs.map +1 -0
- package/build/legacy/components/{NavMenuTrigger.cjs → deprecated/NavMenuTrigger.cjs} +2 -2
- package/build/legacy/components/deprecated/NavMenuTrigger.cjs.map +1 -0
- package/build/legacy/components/field/field.cjs +130 -0
- package/build/legacy/components/field/field.cjs.map +1 -0
- package/build/legacy/components/field/index.cjs +267 -0
- package/build/legacy/components/field/index.cjs.map +1 -0
- package/build/legacy/components/field/parts.cjs +188 -0
- package/build/legacy/components/field/parts.cjs.map +1 -0
- package/build/legacy/components/field/primitives.cjs +191 -0
- package/build/legacy/components/field/primitives.cjs.map +1 -0
- package/build/legacy/components/{Button.cjs → field/start-indicator.cjs} +14 -19
- package/build/legacy/components/field/start-indicator.cjs.map +1 -0
- package/build/legacy/components/field/status-indicator.cjs +78 -0
- package/build/legacy/components/field/status-indicator.cjs.map +1 -0
- package/build/legacy/components/fieldset/fieldset.cjs +116 -0
- package/build/legacy/components/fieldset/fieldset.cjs.map +1 -0
- package/build/legacy/components/fieldset/index.cjs +126 -0
- package/build/legacy/components/fieldset/index.cjs.map +1 -0
- package/build/legacy/components/fieldset/parts.cjs +80 -0
- package/build/legacy/components/fieldset/parts.cjs.map +1 -0
- package/build/legacy/components/fieldset/primitives.cjs +76 -0
- package/build/legacy/components/fieldset/primitives.cjs.map +1 -0
- package/build/legacy/components/for.cjs +38 -0
- package/build/legacy/components/for.cjs.map +1 -0
- package/build/legacy/components/radio/index.cjs +143 -0
- package/build/legacy/components/radio/index.cjs.map +1 -0
- package/build/legacy/components/radio/parts.cjs +113 -0
- package/build/legacy/components/radio/parts.cjs.map +1 -0
- package/build/legacy/components/radio/primitives.cjs +115 -0
- package/build/legacy/components/radio/primitives.cjs.map +1 -0
- package/build/legacy/components/radio/radio.cjs +82 -0
- package/build/legacy/components/radio/radio.cjs.map +1 -0
- package/build/legacy/components/select/index.cjs +265 -0
- package/build/legacy/components/select/index.cjs.map +1 -0
- package/build/legacy/components/select/option-group.cjs +60 -0
- package/build/legacy/components/select/option-group.cjs.map +1 -0
- package/build/legacy/components/select/parts.cjs +153 -0
- package/build/legacy/components/select/parts.cjs.map +1 -0
- package/build/legacy/components/select/primitives.cjs +167 -0
- package/build/legacy/components/select/primitives.cjs.map +1 -0
- package/build/legacy/components/select/select.cjs +212 -0
- package/build/legacy/components/select/select.cjs.map +1 -0
- package/build/legacy/components/switch/index.cjs +118 -0
- package/build/legacy/components/switch/index.cjs.map +1 -0
- package/build/legacy/components/switch/parts.cjs +75 -0
- package/build/legacy/components/switch/parts.cjs.map +1 -0
- package/build/legacy/components/switch/primitives.cjs +72 -0
- package/build/legacy/components/switch/primitives.cjs.map +1 -0
- package/build/legacy/components/{Fieldset.cjs → switch/switch-indicator.cjs} +17 -32
- package/build/legacy/components/switch/switch-indicator.cjs.map +1 -0
- package/build/legacy/components/switch/switch.cjs +106 -0
- package/build/legacy/components/switch/switch.cjs.map +1 -0
- package/build/legacy/components/toggle/index.cjs +45 -0
- package/build/legacy/components/toggle/index.cjs.map +1 -0
- package/build/legacy/components/toggle/parts.cjs +41 -0
- package/build/legacy/components/toggle/parts.cjs.map +1 -0
- package/build/legacy/components/toggle/primitives.cjs +35 -0
- package/build/legacy/components/toggle/primitives.cjs.map +1 -0
- package/build/legacy/config/types.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs +55 -45
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +55 -45
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/field.cjs +23 -4
- package/build/legacy/context/field.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs +24 -16
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +206 -194
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs.map +1 -1
- package/build/legacy/hooks/useRootColors.cjs +0 -1
- package/build/legacy/hooks/useRootColors.cjs.map +1 -1
- package/build/legacy/hooks/useToggle.cjs.map +1 -1
- package/build/legacy/index.cjs +1831 -1330
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/utils/index.cjs +22 -2
- package/build/legacy/utils/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +1329 -360
- package/build/modern/{chunk-PM7CWT3N.js → chunk-245SMQ45.js} +2 -2
- package/build/modern/chunk-245SMQ45.js.map +1 -0
- package/build/modern/chunk-2BIHLH4V.js +15 -0
- package/build/modern/chunk-2BIHLH4V.js.map +1 -0
- package/build/modern/chunk-2CVGNLIM.js +15 -0
- package/build/modern/chunk-2CVGNLIM.js.map +1 -0
- package/build/modern/{chunk-ISCJ542I.js → chunk-2HOUQ2DX.js} +2 -2
- package/build/modern/chunk-2LF3HPNA.js +1 -0
- package/build/modern/chunk-5RTNSVYU.js +88 -0
- package/build/modern/chunk-5RTNSVYU.js.map +1 -0
- package/build/modern/chunk-6I2FW4WI.js +33 -0
- package/build/modern/chunk-6I2FW4WI.js.map +1 -0
- package/build/modern/chunk-6KZVE4HC.js +52 -0
- package/build/modern/chunk-6KZVE4HC.js.map +1 -0
- package/build/modern/{chunk-25HMVHLT.js → chunk-7SU6FCTJ.js} +5 -5
- package/build/modern/chunk-7TQRTBUP.js +19 -0
- package/build/modern/chunk-7TQRTBUP.js.map +1 -0
- package/build/modern/{chunk-UZVQ4INR.js → chunk-AIJ75ENY.js} +2 -2
- package/build/modern/chunk-AIJ75ENY.js.map +1 -0
- package/build/modern/chunk-AO3GB72J.js +27 -0
- package/build/modern/chunk-AO3GB72J.js.map +1 -0
- package/build/modern/{chunk-NUMM4TNC.js → chunk-AUALRL3U.js} +2 -2
- package/build/modern/chunk-AUALRL3U.js.map +1 -0
- package/build/modern/{chunk-IGHMP4WA.js → chunk-AZRFYQO7.js} +1 -1
- package/build/modern/chunk-AZRFYQO7.js.map +1 -0
- package/build/modern/chunk-BL7G3577.js +29 -0
- package/build/modern/chunk-BL7G3577.js.map +1 -0
- package/build/modern/chunk-BPRF34DU.js +62 -0
- package/build/modern/chunk-BPRF34DU.js.map +1 -0
- package/build/modern/chunk-CAZ3EICD.js +16 -0
- package/build/modern/chunk-CAZ3EICD.js.map +1 -0
- package/build/modern/chunk-CIMY2U22.js +10 -0
- package/build/modern/chunk-CIMY2U22.js.map +1 -0
- package/build/modern/{chunk-SD3OVTHT.js → chunk-CMYD5KWA.js} +43 -46
- package/build/modern/chunk-CMYD5KWA.js.map +1 -0
- package/build/modern/chunk-CNA2VKAH.js +43 -0
- package/build/modern/chunk-CNA2VKAH.js.map +1 -0
- package/build/modern/chunk-CYC2YUKU.js +1 -0
- package/build/modern/{chunk-PZAZKQMO.js → chunk-DRDNNRU3.js} +2 -2
- package/build/modern/chunk-DRDNNRU3.js.map +1 -0
- package/build/modern/{chunk-NJSETNRL.js → chunk-DXBZ3HMY.js} +2 -2
- package/build/modern/chunk-EL4MX2PG.js +22 -0
- package/build/modern/chunk-EL4MX2PG.js.map +1 -0
- package/build/modern/chunk-FBS7AX76.js +37 -0
- package/build/modern/chunk-FBS7AX76.js.map +1 -0
- package/build/modern/{chunk-JAROS4Q3.js → chunk-FMRWRVUS.js} +7 -7
- package/build/modern/chunk-FMRWRVUS.js.map +1 -0
- package/build/modern/chunk-FUL2VRDU.js +25 -0
- package/build/modern/chunk-FUL2VRDU.js.map +1 -0
- package/build/modern/{chunk-BHB56M7S.js → chunk-H54FR7IP.js} +6 -6
- package/build/modern/chunk-H54FR7IP.js.map +1 -0
- package/build/modern/chunk-IASVL7CW.js +19 -0
- package/build/modern/chunk-IASVL7CW.js.map +1 -0
- package/build/modern/{chunk-REO5GUNC.js → chunk-ICTISECN.js} +1 -1
- package/build/modern/chunk-ICTISECN.js.map +1 -0
- package/build/modern/chunk-IDTAB2UJ.js +1 -0
- package/build/modern/chunk-IIH363FO.js +13 -0
- package/build/modern/chunk-IIH363FO.js.map +1 -0
- package/build/modern/chunk-KQQPZJEI.js +21 -0
- package/build/modern/chunk-KQQPZJEI.js.map +1 -0
- package/build/modern/chunk-KWZ3CEG6.js +23 -0
- package/build/modern/chunk-KWZ3CEG6.js.map +1 -0
- package/build/modern/{chunk-JWIJHSI6.js → chunk-L7N24B6B.js} +3 -6
- package/build/modern/chunk-L7N24B6B.js.map +1 -0
- package/build/modern/chunk-LT62577B.js +23 -0
- package/build/modern/chunk-LT62577B.js.map +1 -0
- package/build/modern/chunk-LZWNHXRP.js +48 -0
- package/build/modern/chunk-LZWNHXRP.js.map +1 -0
- package/build/modern/{chunk-EDARV2EI.js → chunk-MISIUX63.js} +4 -4
- package/build/modern/{chunk-3BM6MZ4A.js → chunk-MWRO5QYD.js} +1 -1
- package/build/modern/chunk-MWRO5QYD.js.map +1 -0
- package/build/modern/chunk-OGYMMATX.js +1 -0
- package/build/modern/chunk-OVHCXBBI.js +22 -0
- package/build/modern/chunk-OVHCXBBI.js.map +1 -0
- package/build/modern/chunk-P3SF56LT.js +47 -0
- package/build/modern/chunk-P3SF56LT.js.map +1 -0
- package/build/modern/{chunk-JIRW4XOJ.js → chunk-Q3I4H6EC.js} +2 -2
- package/build/modern/chunk-Q3I4H6EC.js.map +1 -0
- package/build/modern/chunk-QCBLRACK.js +133 -0
- package/build/modern/chunk-QCBLRACK.js.map +1 -0
- package/build/modern/{chunk-ILQW5VZT.js → chunk-RBNOEAWJ.js} +4 -7
- package/build/modern/chunk-RBNOEAWJ.js.map +1 -0
- package/build/modern/{chunk-YKKNWILF.js → chunk-RHCTPSKT.js} +2 -15
- package/build/modern/chunk-RHCTPSKT.js.map +1 -0
- package/build/modern/chunk-STLN7BMJ.js +22 -0
- package/build/modern/chunk-STLN7BMJ.js.map +1 -0
- package/build/modern/{chunk-7NN3SJ7W.js → chunk-SWX5JWZR.js} +2 -2
- package/build/modern/chunk-SWX5JWZR.js.map +1 -0
- package/build/modern/{chunk-GCQMH4QA.js → chunk-SXLPDPOZ.js} +4 -4
- package/build/modern/chunk-TIJAFPHQ.js +1 -0
- package/build/modern/chunk-TYPULJMJ.js +1 -0
- package/build/modern/chunk-UDY6USHW.js +1 -0
- package/build/modern/chunk-V4YYGGMH.js +1 -0
- package/build/modern/chunk-VSTOSLFS.js +100 -0
- package/build/modern/chunk-VSTOSLFS.js.map +1 -0
- package/build/modern/{chunk-ZL6ZITLA.js → chunk-WECB67DC.js} +2 -2
- package/build/modern/chunk-WECB67DC.js.map +1 -0
- package/build/modern/{chunk-BAWZBF5Q.js → chunk-WN7TJX6J.js} +2 -2
- package/build/modern/{chunk-RMVJK26W.js → chunk-XJQXHSH7.js} +1 -2
- package/build/modern/chunk-XJQXHSH7.js.map +1 -0
- package/build/modern/chunk-XTNGF4D6.js +41 -0
- package/build/modern/chunk-XTNGF4D6.js.map +1 -0
- package/build/modern/chunk-Y4ZEJ2EF.js +31 -0
- package/build/modern/chunk-Y4ZEJ2EF.js.map +1 -0
- package/build/modern/{chunk-WPVDQRRF.js → chunk-YOTXFCCC.js} +2 -2
- package/build/modern/chunk-YOTXFCCC.js.map +1 -0
- package/build/modern/chunk-Z3FDG263.js +53 -0
- package/build/modern/chunk-Z3FDG263.js.map +1 -0
- package/build/modern/chunk-Z52R6ABJ.js +21 -0
- package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
- package/build/modern/{chunk-FGCO27TC.js → chunk-ZDANBCM3.js} +6 -6
- package/build/modern/chunk-ZDANBCM3.js.map +1 -0
- package/build/modern/{chunk-O6LFWUHI.js → chunk-ZFFW5ELD.js} +10 -10
- package/build/modern/chunk-ZFFW5ELD.js.map +1 -0
- package/build/modern/components/Accordion.js +1 -1
- package/build/modern/components/AccordionItemGroup.js +3 -3
- package/build/modern/components/Admonition.client.js +3 -3
- package/build/modern/components/Admonition.js +4 -4
- package/build/modern/components/Avatar.js +2 -2
- package/build/modern/components/DatePicker.client.js +4 -3
- package/build/modern/components/FileStatus.js +11 -5
- package/build/modern/components/FileUploader.js +3 -3
- package/build/modern/components/Legend.js +1 -2
- package/build/modern/components/Tag.js +2 -2
- package/build/modern/components/button/button.js +12 -0
- package/build/modern/components/button/index.js +16 -0
- package/build/modern/components/button/parts.js +10 -0
- package/build/modern/components/checkbox/checkbox-icon.js +12 -0
- package/build/modern/components/checkbox/checkbox.js +13 -0
- package/build/modern/components/checkbox/index.js +30 -0
- package/build/modern/components/checkbox/parts.js +8 -0
- package/build/modern/components/checkbox/primitives.js +17 -0
- package/build/modern/components/deprecated/FieldMessage.js +8 -0
- package/build/modern/components/deprecated/FieldsetLabel.js +7 -0
- package/build/modern/components/deprecated/Label.js +17 -0
- package/build/modern/components/deprecated/Label.js.map +1 -0
- package/build/modern/components/deprecated/Modal.js +7 -0
- package/build/modern/components/deprecated/Modal.js.map +1 -0
- package/build/modern/components/deprecated/ModalDescription.js +7 -0
- package/build/modern/components/deprecated/ModalDescription.js.map +1 -0
- package/build/modern/components/deprecated/ModalHeader.js +7 -0
- package/build/modern/components/deprecated/ModalHeader.js.map +1 -0
- package/build/modern/components/deprecated/ModalHeading.js +7 -0
- package/build/modern/components/deprecated/ModalHeading.js.map +1 -0
- package/build/modern/components/deprecated/NavMenuLink.js +8 -0
- package/build/modern/components/deprecated/NavMenuLink.js.map +1 -0
- package/build/modern/components/deprecated/NavMenuList.js +12 -0
- package/build/modern/components/deprecated/NavMenuList.js.map +1 -0
- package/build/modern/components/deprecated/NavMenuTrigger.js +11 -0
- package/build/modern/components/deprecated/NavMenuTrigger.js.map +1 -0
- package/build/modern/components/field/field.js +14 -0
- package/build/modern/components/field/field.js.map +1 -0
- package/build/modern/components/field/index.js +44 -0
- package/build/modern/components/field/index.js.map +1 -0
- package/build/modern/components/field/parts.js +11 -0
- package/build/modern/components/field/parts.js.map +1 -0
- package/build/modern/components/field/primitives.js +26 -0
- package/build/modern/components/field/primitives.js.map +1 -0
- package/build/modern/components/field/start-indicator.js +7 -0
- package/build/modern/components/field/start-indicator.js.map +1 -0
- package/build/modern/components/field/status-indicator.js +9 -0
- package/build/modern/components/field/status-indicator.js.map +1 -0
- package/build/modern/components/fieldset/fieldset.js +11 -0
- package/build/modern/components/fieldset/fieldset.js.map +1 -0
- package/build/modern/components/fieldset/index.js +24 -0
- package/build/modern/components/fieldset/index.js.map +1 -0
- package/build/modern/components/fieldset/parts.js +8 -0
- package/build/modern/components/fieldset/parts.js.map +1 -0
- package/build/modern/components/fieldset/primitives.js +13 -0
- package/build/modern/components/fieldset/primitives.js.map +1 -0
- package/build/modern/components/for.js +7 -0
- package/build/modern/components/for.js.map +1 -0
- package/build/modern/components/radio/index.js +30 -0
- package/build/modern/components/radio/index.js.map +1 -0
- package/build/modern/components/radio/parts.js +8 -0
- package/build/modern/components/radio/parts.js.map +1 -0
- package/build/modern/components/radio/primitives.js +21 -0
- package/build/modern/components/radio/primitives.js.map +1 -0
- package/build/modern/components/radio/radio.js +8 -0
- package/build/modern/components/radio/radio.js.map +1 -0
- package/build/modern/components/select/index.js +57 -0
- package/build/modern/components/select/index.js.map +1 -0
- package/build/modern/components/select/option-group.js +10 -0
- package/build/modern/components/select/option-group.js.map +1 -0
- package/build/modern/components/select/parts.js +8 -0
- package/build/modern/components/select/parts.js.map +1 -0
- package/build/modern/components/select/primitives.js +37 -0
- package/build/modern/components/select/primitives.js.map +1 -0
- package/build/modern/components/select/select.js +15 -0
- package/build/modern/components/select/select.js.map +1 -0
- package/build/modern/components/switch/index.js +26 -0
- package/build/modern/components/switch/index.js.map +1 -0
- package/build/modern/components/switch/parts.js +8 -0
- package/build/modern/components/switch/parts.js.map +1 -0
- package/build/modern/components/switch/primitives.js +15 -0
- package/build/modern/components/switch/primitives.js.map +1 -0
- package/build/modern/components/switch/switch-indicator.js +9 -0
- package/build/modern/components/switch/switch-indicator.js.map +1 -0
- package/build/modern/components/switch/switch.js +11 -0
- package/build/modern/components/switch/switch.js.map +1 -0
- package/build/modern/components/toggle/index.js +14 -0
- package/build/modern/components/toggle/index.js.map +1 -0
- package/build/modern/components/toggle/parts.js +8 -0
- package/build/modern/components/toggle/parts.js.map +1 -0
- package/build/modern/components/toggle/primitives.js +9 -0
- package/build/modern/components/toggle/primitives.js.map +1 -0
- package/build/modern/context/confirm-modal.js +5 -4
- package/build/modern/context/cta-modal.js +6 -5
- package/build/modern/context/field.js +34 -4
- package/build/modern/context/field.js.map +1 -1
- package/build/modern/context/notification-center.js +5 -4
- package/build/modern/context/prompt-modal.js +14 -8
- package/build/modern/hooks/useDate.js +1 -1
- package/build/modern/hooks/useRootColors.js +1 -1
- package/build/modern/hooks/useToggle.js +1 -1
- package/build/modern/index.js +284 -116
- package/build/modern/index.js.map +1 -1
- package/build/modern/utils/index.js +5 -3
- package/package.json +2 -2
- package/src/components/Accordion.tsx +1 -0
- package/src/components/DatePicker.client.tsx +3 -15
- package/src/components/FileStatus.tsx +4 -5
- package/src/components/Legend.tsx +5 -6
- package/src/components/button/button.tsx +77 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/button/parts.ts +32 -0
- package/src/components/checkbox/checkbox-icon.tsx +39 -0
- package/src/components/checkbox/checkbox.tsx +42 -0
- package/src/components/checkbox/index.ts +3 -0
- package/src/components/checkbox/parts.ts +59 -0
- package/src/components/checkbox/primitives.tsx +104 -0
- package/src/components/{FieldMessage.tsx → deprecated/FieldMessage.tsx} +2 -13
- package/src/components/deprecated/FieldsetLabel.tsx +32 -0
- package/src/components/deprecated/Label.tsx +24 -0
- package/src/components/{NavMenuLink.tsx → deprecated/NavMenuLink.tsx} +1 -1
- package/src/components/{NavMenuList.tsx → deprecated/NavMenuList.tsx} +3 -3
- package/src/components/{NavMenuTrigger.tsx → deprecated/NavMenuTrigger.tsx} +4 -4
- package/src/components/field/field.tsx +77 -0
- package/src/components/field/index.ts +5 -0
- package/src/components/field/parts.ts +77 -0
- package/src/components/field/primitives.tsx +204 -0
- package/src/components/field/start-indicator.tsx +23 -0
- package/src/components/field/status-indicator.tsx +58 -0
- package/src/components/fieldset/fieldset.tsx +55 -0
- package/src/components/fieldset/index.ts +3 -0
- package/src/components/fieldset/parts.ts +47 -0
- package/src/components/fieldset/primitives.tsx +79 -0
- package/src/components/for.tsx +43 -0
- package/src/components/radio/index.ts +3 -0
- package/src/components/radio/parts.ts +65 -0
- package/src/components/radio/primitives.tsx +123 -0
- package/src/components/radio/radio.tsx +35 -0
- package/src/components/select/index.ts +4 -0
- package/src/components/select/option-group.tsx +34 -0
- package/src/components/select/parts.ts +113 -0
- package/src/components/select/primitives.tsx +205 -0
- package/src/components/select/select.tsx +135 -0
- package/src/components/switch/index.ts +3 -0
- package/src/components/switch/parts.ts +53 -0
- package/src/components/switch/primitives.tsx +69 -0
- package/src/components/switch/switch-indicator.tsx +9 -0
- package/src/components/switch/switch.tsx +30 -0
- package/src/components/toggle/index.ts +2 -0
- package/src/components/toggle/parts.ts +32 -0
- package/src/components/toggle/primitives.tsx +17 -0
- package/src/config/types.ts +1 -0
- package/src/context/confirm-modal.tsx +1 -1
- package/src/context/cta-modal.tsx +1 -1
- package/src/context/field.tsx +6 -5
- package/src/context/notification-center.tsx +1 -1
- package/src/context/prompt-modal.tsx +16 -18
- package/src/hooks/useDate.ts +1 -7
- package/src/hooks/useRootColors.ts +0 -1
- package/src/hooks/useToggle.ts +1 -3
- package/src/index.ts +23 -23
- package/src/utils/index.ts +30 -0
- package/build/legacy/components/Button.cjs.map +0 -1
- package/build/legacy/components/Checkbox.cjs +0 -113
- package/build/legacy/components/Checkbox.cjs.map +0 -1
- package/build/legacy/components/FieldMessage.cjs.map +0 -1
- package/build/legacy/components/Fieldset.cjs.map +0 -1
- package/build/legacy/components/FieldsetLabel.cjs.map +0 -1
- package/build/legacy/components/Input.cjs +0 -95
- package/build/legacy/components/Input.cjs.map +0 -1
- package/build/legacy/components/Label.cjs +0 -93
- package/build/legacy/components/Label.cjs.map +0 -1
- package/build/legacy/components/Modal.cjs.map +0 -1
- package/build/legacy/components/ModalDescription.cjs.map +0 -1
- package/build/legacy/components/ModalHeader.cjs.map +0 -1
- package/build/legacy/components/ModalHeading.cjs.map +0 -1
- package/build/legacy/components/NavMenuLink.cjs.map +0 -1
- package/build/legacy/components/NavMenuList.cjs.map +0 -1
- package/build/legacy/components/NavMenuTrigger.cjs.map +0 -1
- package/build/legacy/components/Radio.cjs +0 -81
- package/build/legacy/components/Radio.cjs.map +0 -1
- package/build/legacy/components/Select.cjs +0 -120
- package/build/legacy/components/Select.cjs.map +0 -1
- package/build/legacy/components/Textarea.cjs.map +0 -1
- package/build/legacy/components/Toggle.cjs +0 -101
- package/build/legacy/components/Toggle.cjs.map +0 -1
- package/build/modern/chunk-3BM6MZ4A.js.map +0 -1
- package/build/modern/chunk-3ZDFQO25.js +0 -31
- package/build/modern/chunk-3ZDFQO25.js.map +0 -1
- package/build/modern/chunk-7NN3SJ7W.js.map +0 -1
- package/build/modern/chunk-BHB56M7S.js.map +0 -1
- package/build/modern/chunk-C5EHJUS5.js +0 -10
- package/build/modern/chunk-C5EHJUS5.js.map +0 -1
- package/build/modern/chunk-EXGKZGML.js +0 -28
- package/build/modern/chunk-EXGKZGML.js.map +0 -1
- package/build/modern/chunk-FGCO27TC.js.map +0 -1
- package/build/modern/chunk-FTPZHG6J.js +0 -46
- package/build/modern/chunk-FTPZHG6J.js.map +0 -1
- package/build/modern/chunk-IGHMP4WA.js.map +0 -1
- package/build/modern/chunk-ILQW5VZT.js.map +0 -1
- package/build/modern/chunk-JAROS4Q3.js.map +0 -1
- package/build/modern/chunk-JIJM6JFJ.js +0 -36
- package/build/modern/chunk-JIJM6JFJ.js.map +0 -1
- package/build/modern/chunk-JIRW4XOJ.js.map +0 -1
- package/build/modern/chunk-JWIJHSI6.js.map +0 -1
- package/build/modern/chunk-KKHL3ZO4.js +0 -69
- package/build/modern/chunk-KKHL3ZO4.js.map +0 -1
- package/build/modern/chunk-MZ3UCDUL.js +0 -43
- package/build/modern/chunk-MZ3UCDUL.js.map +0 -1
- package/build/modern/chunk-N24COMHJ.js +0 -63
- package/build/modern/chunk-N24COMHJ.js.map +0 -1
- package/build/modern/chunk-NMF2HYWO.js +0 -50
- package/build/modern/chunk-NMF2HYWO.js.map +0 -1
- package/build/modern/chunk-NUMM4TNC.js.map +0 -1
- package/build/modern/chunk-O6LFWUHI.js.map +0 -1
- package/build/modern/chunk-PM7CWT3N.js.map +0 -1
- package/build/modern/chunk-PZAZKQMO.js.map +0 -1
- package/build/modern/chunk-REO5GUNC.js.map +0 -1
- package/build/modern/chunk-RMVJK26W.js.map +0 -1
- package/build/modern/chunk-SD3OVTHT.js.map +0 -1
- package/build/modern/chunk-UZDVOIW5.js +0 -33
- package/build/modern/chunk-UZDVOIW5.js.map +0 -1
- package/build/modern/chunk-UZVQ4INR.js.map +0 -1
- package/build/modern/chunk-WPVDQRRF.js.map +0 -1
- package/build/modern/chunk-XQICKZH4.js +0 -59
- package/build/modern/chunk-XQICKZH4.js.map +0 -1
- package/build/modern/chunk-YKKNWILF.js.map +0 -1
- package/build/modern/chunk-ZL6ZITLA.js.map +0 -1
- package/build/modern/components/Button.js +0 -7
- package/build/modern/components/Checkbox.js +0 -11
- package/build/modern/components/FieldMessage.js +0 -9
- package/build/modern/components/Fieldset.js +0 -9
- package/build/modern/components/FieldsetLabel.js +0 -7
- package/build/modern/components/Input.js +0 -11
- package/build/modern/components/Label.js +0 -10
- package/build/modern/components/Modal.js +0 -7
- package/build/modern/components/ModalDescription.js +0 -7
- package/build/modern/components/ModalHeader.js +0 -7
- package/build/modern/components/ModalHeading.js +0 -7
- package/build/modern/components/NavMenuLink.js +0 -8
- package/build/modern/components/NavMenuList.js +0 -12
- package/build/modern/components/NavMenuTrigger.js +0 -11
- package/build/modern/components/Radio.js +0 -9
- package/build/modern/components/Select.js +0 -13
- package/build/modern/components/Textarea.js +0 -9
- package/build/modern/components/Toggle.js +0 -10
- package/src/components/Button.tsx +0 -35
- package/src/components/Checkbox.tsx +0 -93
- package/src/components/Fieldset.tsx +0 -65
- package/src/components/FieldsetLabel.tsx +0 -59
- package/src/components/Input.tsx +0 -69
- package/src/components/Label.tsx +0 -69
- package/src/components/Radio.tsx +0 -73
- package/src/components/Select.tsx +0 -108
- package/src/components/Textarea.tsx +0 -52
- package/src/components/Toggle.tsx +0 -91
- /package/build/modern/{chunk-ISCJ542I.js.map → chunk-2HOUQ2DX.js.map} +0 -0
- /package/build/modern/{components/Button.js.map → chunk-2LF3HPNA.js.map} +0 -0
- /package/build/modern/{chunk-25HMVHLT.js.map → chunk-7SU6FCTJ.js.map} +0 -0
- /package/build/modern/{components/Checkbox.js.map → chunk-CYC2YUKU.js.map} +0 -0
- /package/build/modern/{chunk-NJSETNRL.js.map → chunk-DXBZ3HMY.js.map} +0 -0
- /package/build/modern/{components/FieldMessage.js.map → chunk-IDTAB2UJ.js.map} +0 -0
- /package/build/modern/{chunk-EDARV2EI.js.map → chunk-MISIUX63.js.map} +0 -0
- /package/build/modern/{components/Fieldset.js.map → chunk-OGYMMATX.js.map} +0 -0
- /package/build/modern/{chunk-GCQMH4QA.js.map → chunk-SXLPDPOZ.js.map} +0 -0
- /package/build/modern/{components/FieldsetLabel.js.map → chunk-TIJAFPHQ.js.map} +0 -0
- /package/build/modern/{components/Input.js.map → chunk-TYPULJMJ.js.map} +0 -0
- /package/build/modern/{components/Label.js.map → chunk-UDY6USHW.js.map} +0 -0
- /package/build/modern/{components/Modal.js.map → chunk-V4YYGGMH.js.map} +0 -0
- /package/build/modern/{chunk-BAWZBF5Q.js.map → chunk-WN7TJX6J.js.map} +0 -0
- /package/build/modern/components/{ModalDescription.js.map → button/button.js.map} +0 -0
- /package/build/modern/components/{ModalHeader.js.map → button/index.js.map} +0 -0
- /package/build/modern/components/{ModalHeading.js.map → button/parts.js.map} +0 -0
- /package/build/modern/components/{NavMenuLink.js.map → checkbox/checkbox-icon.js.map} +0 -0
- /package/build/modern/components/{NavMenuList.js.map → checkbox/checkbox.js.map} +0 -0
- /package/build/modern/components/{NavMenuTrigger.js.map → checkbox/index.js.map} +0 -0
- /package/build/modern/components/{Radio.js.map → checkbox/parts.js.map} +0 -0
- /package/build/modern/components/{Select.js.map → checkbox/primitives.js.map} +0 -0
- /package/build/modern/components/{Textarea.js.map → deprecated/FieldMessage.js.map} +0 -0
- /package/build/modern/components/{Toggle.js.map → deprecated/FieldsetLabel.js.map} +0 -0
- /package/src/components/{Modal.tsx → deprecated/Modal.tsx} +0 -0
- /package/src/components/{ModalDescription.tsx → deprecated/ModalDescription.tsx} +0 -0
- /package/src/components/{ModalHeader.tsx → deprecated/ModalHeader.tsx} +0 -0
- /package/src/components/{ModalHeading.tsx → deprecated/ModalHeading.tsx} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type FieldRootProps } from '@ark-ui/react/field'
|
|
2
|
+
import { splitProps } from '../../utils/index'
|
|
3
|
+
import {
|
|
4
|
+
FieldErrorText,
|
|
5
|
+
FieldHelperText,
|
|
6
|
+
FieldLabel,
|
|
7
|
+
FieldRoot,
|
|
8
|
+
} from './primitives'
|
|
9
|
+
import { HStack } from '@cerberus/styled-system/jsx'
|
|
10
|
+
import { Show } from '../Show'
|
|
11
|
+
|
|
12
|
+
export interface FieldProps extends FieldRootProps {
|
|
13
|
+
/**
|
|
14
|
+
* The label of the field.
|
|
15
|
+
*/
|
|
16
|
+
label?: string
|
|
17
|
+
/**
|
|
18
|
+
* The helper text of the field.
|
|
19
|
+
*/
|
|
20
|
+
helperText?: string
|
|
21
|
+
/**
|
|
22
|
+
* A helper text positioned at the end of the field. Good for Textarea fields.
|
|
23
|
+
*/
|
|
24
|
+
secondaryHelperText?: string
|
|
25
|
+
/**
|
|
26
|
+
* The error text of the field. Shown when the field is invalid.
|
|
27
|
+
*/
|
|
28
|
+
errorText?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The Field component is the context provider for all FieldParts and displays
|
|
33
|
+
* the label, helperText, and ErrorText.
|
|
34
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Field
|
|
38
|
+
* ids={{
|
|
39
|
+
* control: 'firstName',
|
|
40
|
+
* }}
|
|
41
|
+
* label="Label"
|
|
42
|
+
* helperText="This is what people will see on your profile."
|
|
43
|
+
* errorText="A first name is required to create an account."
|
|
44
|
+
* required
|
|
45
|
+
* >
|
|
46
|
+
* <Input name="firstName" type="text" />
|
|
47
|
+
* </Field>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export function Field(props: FieldProps) {
|
|
51
|
+
const [statusProps, fieldProps, rootProps] = splitProps(
|
|
52
|
+
props,
|
|
53
|
+
['disabled', 'required', 'readOnly', 'invalid'],
|
|
54
|
+
['label', 'helperText', 'secondaryHelperText', 'errorText', 'children'],
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<FieldRoot {...statusProps} {...rootProps}>
|
|
59
|
+
<Show when={Boolean(fieldProps.label)}>
|
|
60
|
+
<FieldLabel>{fieldProps.label}</FieldLabel>
|
|
61
|
+
</Show>
|
|
62
|
+
|
|
63
|
+
{fieldProps.children}
|
|
64
|
+
|
|
65
|
+
<Show when={Boolean(fieldProps.helperText && !statusProps.invalid)}>
|
|
66
|
+
<HStack justifyContent="space-between" w="full">
|
|
67
|
+
<FieldHelperText>{fieldProps.helperText}</FieldHelperText>
|
|
68
|
+
<Show when={Boolean(fieldProps.secondaryHelperText)}>
|
|
69
|
+
<FieldHelperText>{fieldProps.secondaryHelperText}</FieldHelperText>
|
|
70
|
+
</Show>
|
|
71
|
+
</HStack>
|
|
72
|
+
</Show>
|
|
73
|
+
|
|
74
|
+
<FieldErrorText>{fieldProps.errorText}</FieldErrorText>
|
|
75
|
+
</FieldRoot>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ElementType } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
FieldErrorText,
|
|
4
|
+
FieldHelperText,
|
|
5
|
+
FieldInput,
|
|
6
|
+
FieldLabel,
|
|
7
|
+
FieldRequiredIndicator,
|
|
8
|
+
FieldRoot,
|
|
9
|
+
FieldTextarea,
|
|
10
|
+
} from './primitives'
|
|
11
|
+
import { FieldStatusIndicator } from './status-indicator'
|
|
12
|
+
import { FieldStartIndicator } from './start-indicator'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This module contains the parts of the Field component.
|
|
16
|
+
* @module 'field/parts'
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface FieldPartsValue {
|
|
20
|
+
/**
|
|
21
|
+
* The container of the field.
|
|
22
|
+
*/
|
|
23
|
+
Root: ElementType
|
|
24
|
+
/**
|
|
25
|
+
* The label of the field.
|
|
26
|
+
*/
|
|
27
|
+
Label: ElementType
|
|
28
|
+
/**
|
|
29
|
+
* The input of the field.
|
|
30
|
+
*/
|
|
31
|
+
Input: ElementType
|
|
32
|
+
/**
|
|
33
|
+
* The textarea of the field.
|
|
34
|
+
*/
|
|
35
|
+
Textarea: ElementType
|
|
36
|
+
/**
|
|
37
|
+
* The text that displays when the field is valid.
|
|
38
|
+
*/
|
|
39
|
+
HelperText: ElementType
|
|
40
|
+
/**
|
|
41
|
+
* The text that displays when the field is invalid.
|
|
42
|
+
*/
|
|
43
|
+
ErrorText: ElementType
|
|
44
|
+
/**
|
|
45
|
+
* The indicator that appears at the start of the field.
|
|
46
|
+
*/
|
|
47
|
+
StartIndicator: ElementType
|
|
48
|
+
/**
|
|
49
|
+
* The status indicator of the field.
|
|
50
|
+
*/
|
|
51
|
+
StatusIndicator: ElementType
|
|
52
|
+
/**
|
|
53
|
+
* The indicator that appears at the end of the field.
|
|
54
|
+
*/
|
|
55
|
+
RequiredIndicator: ElementType
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* An Object containing the parts of the Field component. For users that
|
|
60
|
+
* prefer Object component syntax.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
*
|
|
64
|
+
* When using object component syntax, you import the FieldParts object and
|
|
65
|
+
* the entire family of components vs. only what you use.
|
|
66
|
+
*/
|
|
67
|
+
export const FieldParts: FieldPartsValue = {
|
|
68
|
+
Root: FieldRoot,
|
|
69
|
+
Label: FieldLabel,
|
|
70
|
+
Input: FieldInput,
|
|
71
|
+
Textarea: FieldTextarea,
|
|
72
|
+
HelperText: FieldHelperText,
|
|
73
|
+
ErrorText: FieldErrorText,
|
|
74
|
+
StartIndicator: FieldStartIndicator,
|
|
75
|
+
StatusIndicator: FieldStatusIndicator,
|
|
76
|
+
RequiredIndicator: FieldRequiredIndicator,
|
|
77
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Field,
|
|
3
|
+
type FieldHelperTextProps,
|
|
4
|
+
type FieldInputProps as ArkFieldInputProps,
|
|
5
|
+
type FieldLabelProps,
|
|
6
|
+
type FieldRootProps as ArkFieldRootProps,
|
|
7
|
+
type FieldTextareaProps,
|
|
8
|
+
} from '@ark-ui/react/field'
|
|
9
|
+
import type { ReactNode } from 'react'
|
|
10
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
11
|
+
import { field, type FieldVariantProps } from '@cerberus/styled-system/recipes'
|
|
12
|
+
import { FieldStatusIndicator } from './status-indicator'
|
|
13
|
+
import { FieldStartIndicator } from './start-indicator'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This module contains all the primitives of the Field component.
|
|
17
|
+
* @module 'field'
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export type FieldRootProps = ArkFieldRootProps & FieldVariantProps
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The context & container for the Field components.
|
|
24
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <FieldRoot required ids={{ input: 'exampleId' }}>
|
|
28
|
+
* <FieldLabel>Label</FieldLabel>
|
|
29
|
+
* <FieldInput />
|
|
30
|
+
* </FieldRoot>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function FieldRoot(props: FieldRootProps) {
|
|
34
|
+
const { size, ...fieldProps } = props
|
|
35
|
+
const styles = field({ size })
|
|
36
|
+
return (
|
|
37
|
+
<Field.Root
|
|
38
|
+
{...fieldProps}
|
|
39
|
+
className={cx(styles.root, fieldProps.className)}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The label for the Field component.
|
|
46
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <FieldRoot>
|
|
50
|
+
* <FieldLabel>Label</FieldLabel>
|
|
51
|
+
* </FieldRoot>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function FieldLabel(props: FieldLabelProps) {
|
|
55
|
+
const { children, ...nativeProps } = props
|
|
56
|
+
const styles = field()
|
|
57
|
+
return (
|
|
58
|
+
<Field.Label {...nativeProps} className={cx(styles.label, props.className)}>
|
|
59
|
+
{children}
|
|
60
|
+
<Field.RequiredIndicator>(required)</Field.RequiredIndicator>
|
|
61
|
+
</Field.Label>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The required indicator for the Field component.
|
|
67
|
+
*/
|
|
68
|
+
export function FieldRequiredIndicator() {
|
|
69
|
+
return <Field.RequiredIndicator>(required)</Field.RequiredIndicator>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface FieldInputProps
|
|
73
|
+
extends Omit<ArkFieldInputProps, 'size'>,
|
|
74
|
+
FieldVariantProps {
|
|
75
|
+
/**
|
|
76
|
+
* An optional icon to display at the start of the input.
|
|
77
|
+
*/
|
|
78
|
+
startIcon?: ReactNode
|
|
79
|
+
/**
|
|
80
|
+
* An optional icon to display at the end of the input.
|
|
81
|
+
*/
|
|
82
|
+
endIcon?: ReactNode
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The input for the Field component.
|
|
87
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <FieldRoot>
|
|
91
|
+
* <FieldInput />
|
|
92
|
+
* </FieldRoot>
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export function FieldInput(props: FieldInputProps) {
|
|
96
|
+
const { size, startIcon, endIcon, ...fieldProps } = props
|
|
97
|
+
const styles = field({ size })
|
|
98
|
+
const hasStartIcon = Boolean(startIcon)
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className={styles.inputRoot}>
|
|
102
|
+
<FieldStartIndicator>{startIcon}</FieldStartIndicator>
|
|
103
|
+
<Field.Input
|
|
104
|
+
{...fieldProps}
|
|
105
|
+
{...(hasStartIcon && { 'data-has': 'start-indicator' })}
|
|
106
|
+
className={cx(styles.input, fieldProps.className)}
|
|
107
|
+
/>
|
|
108
|
+
<FieldStatusIndicator fallback={endIcon} />
|
|
109
|
+
</div>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The helper text for the Field component that is shown when the field is
|
|
115
|
+
* valid.
|
|
116
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <FieldRoot>
|
|
120
|
+
* <FieldInput />
|
|
121
|
+
* <FieldHelperText>Helper text</FieldHelperText>
|
|
122
|
+
* </FieldRoot>
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export function FieldHelperText(props: FieldHelperTextProps) {
|
|
126
|
+
const styles = field()
|
|
127
|
+
|
|
128
|
+
if (!props.children) return null
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Field.HelperText
|
|
132
|
+
{...props}
|
|
133
|
+
className={cx(styles.helperText, props.className)}
|
|
134
|
+
/>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The error text for the Field component that is shown when the field is
|
|
140
|
+
* invalid.
|
|
141
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
142
|
+
* @example
|
|
143
|
+
* ```tsx
|
|
144
|
+
* <FieldRoot>
|
|
145
|
+
* <FieldInput />
|
|
146
|
+
* <FieldErrorText>Error text</FieldErrorText>
|
|
147
|
+
* </FieldRoot>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export function FieldErrorText(props: FieldHelperTextProps) {
|
|
151
|
+
const styles = field()
|
|
152
|
+
|
|
153
|
+
if (!props.children) return null
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<Field.ErrorText
|
|
157
|
+
{...props}
|
|
158
|
+
className={cx(styles.errorText, props.className)}
|
|
159
|
+
/>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The textarea for the Field component.
|
|
165
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* <FieldRoot>
|
|
169
|
+
* <FieldTextarea />
|
|
170
|
+
* </FieldRoot>
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export function FieldTextarea(props: FieldTextareaProps) {
|
|
174
|
+
const styles = field()
|
|
175
|
+
return (
|
|
176
|
+
<Field.Textarea
|
|
177
|
+
{...props}
|
|
178
|
+
className={cx(styles.textarea, props.className)}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A named export for the FieldInput component.
|
|
185
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
186
|
+
* @example
|
|
187
|
+
* ```tsx
|
|
188
|
+
* import { Input } from '@cerberus/react'
|
|
189
|
+
*
|
|
190
|
+
* <Field
|
|
191
|
+
* ids={{
|
|
192
|
+
* control: 'email',
|
|
193
|
+
* }}
|
|
194
|
+
* label="Enter your email"
|
|
195
|
+
* helperText="We'll never share your email with anyone else."
|
|
196
|
+
* errorText="Email is required."
|
|
197
|
+
* required
|
|
198
|
+
* >
|
|
199
|
+
* <Input type="email" />
|
|
200
|
+
* </Field>
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export const Input = FieldInput
|
|
204
|
+
export const Textarea = FieldTextarea
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
2
|
+
import { field } from '@cerberus/styled-system/recipes'
|
|
3
|
+
import type { HTMLAttributes } from 'react'
|
|
4
|
+
|
|
5
|
+
export type FieldIndicatorProps = HTMLAttributes<HTMLSpanElement>
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The start indicator displays an indicator at the start of the Input.
|
|
9
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
10
|
+
*/
|
|
11
|
+
export function FieldStartIndicator(props: FieldIndicatorProps) {
|
|
12
|
+
const styles = field()
|
|
13
|
+
|
|
14
|
+
if (!props.children) return null
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<span
|
|
18
|
+
{...props}
|
|
19
|
+
data-part="start-indicator"
|
|
20
|
+
className={cx(props.className, styles.startIndicator)}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useFieldContext } from '@ark-ui/react'
|
|
4
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
5
|
+
import { field } from '@cerberus/styled-system/recipes'
|
|
6
|
+
import { useCerberusContext } from '../../context/cerberus'
|
|
7
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
8
|
+
|
|
9
|
+
export interface FieldStatusIndicatorProps
|
|
10
|
+
extends HTMLAttributes<HTMLSpanElement> {
|
|
11
|
+
/**
|
|
12
|
+
* The fallback content to display when the field is valid.
|
|
13
|
+
*/
|
|
14
|
+
fallback?: ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The invalid status indicator for the Field component.
|
|
19
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <FieldRoot>
|
|
23
|
+
* <FieldStatusIndicator />
|
|
24
|
+
* </FieldRoot>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function FieldStatusIndicator(props: FieldStatusIndicatorProps) {
|
|
28
|
+
const { fallback, ...nativeProps } = props
|
|
29
|
+
const styles = field()
|
|
30
|
+
const fieldContext = useFieldContext()
|
|
31
|
+
|
|
32
|
+
const { icons } = useCerberusContext()
|
|
33
|
+
const { invalid: InvalidIcon } = icons
|
|
34
|
+
|
|
35
|
+
if (fieldContext.invalid) {
|
|
36
|
+
return (
|
|
37
|
+
<span
|
|
38
|
+
{...nativeProps}
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
data-invalid
|
|
41
|
+
className={cx(nativeProps.className, styles.statusIndicator)}
|
|
42
|
+
>
|
|
43
|
+
<InvalidIcon />
|
|
44
|
+
</span>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<span
|
|
50
|
+
{...nativeProps}
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
data-part="end-indicator"
|
|
53
|
+
className={cx(nativeProps.className, styles.endIndicator)}
|
|
54
|
+
>
|
|
55
|
+
{fallback}
|
|
56
|
+
</span>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { FieldsetRootProps } from '@ark-ui/react'
|
|
2
|
+
import { splitProps } from '../../utils'
|
|
3
|
+
import { FieldsetParts } from './parts'
|
|
4
|
+
import type { FieldsetVariantProps } from '@cerberus/styled-system/recipes'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This module contains the Fieldset component.
|
|
8
|
+
* @module Fieldset
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface FieldsetProps extends FieldsetRootProps, FieldsetVariantProps {
|
|
12
|
+
/**
|
|
13
|
+
* The legend/title/label of the fieldset group.
|
|
14
|
+
*/
|
|
15
|
+
legend?: string
|
|
16
|
+
/**
|
|
17
|
+
* The description text for the fieldset group.
|
|
18
|
+
*/
|
|
19
|
+
helperText?: string
|
|
20
|
+
/**
|
|
21
|
+
* The error text for the fieldset group shown when the field is invalid.
|
|
22
|
+
*/
|
|
23
|
+
errorText?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A component used for grouping related fields in a form that is an
|
|
28
|
+
* abstraction of the Fieldset primitives.
|
|
29
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
30
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
31
|
+
*/
|
|
32
|
+
export function Fieldset(props: FieldsetProps) {
|
|
33
|
+
const [fieldsetProps, { usage }, rootProps] = splitProps(
|
|
34
|
+
props,
|
|
35
|
+
['legend', 'helperText', 'errorText', 'children'],
|
|
36
|
+
['usage'],
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<FieldsetParts.Root {...rootProps}>
|
|
41
|
+
<FieldsetParts.Legend usage={usage}>
|
|
42
|
+
{fieldsetProps.legend}
|
|
43
|
+
</FieldsetParts.Legend>
|
|
44
|
+
<FieldsetParts.HelperText usage={usage}>
|
|
45
|
+
{fieldsetProps.helperText}
|
|
46
|
+
</FieldsetParts.HelperText>
|
|
47
|
+
|
|
48
|
+
{fieldsetProps.children}
|
|
49
|
+
|
|
50
|
+
<FieldsetParts.ErrorText>
|
|
51
|
+
{fieldsetProps.errorText}
|
|
52
|
+
</FieldsetParts.ErrorText>
|
|
53
|
+
</FieldsetParts.Root>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ElementType } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
FieldsetErrorText,
|
|
4
|
+
FieldsetHelperText,
|
|
5
|
+
FieldsetLegend,
|
|
6
|
+
FieldsetRoot,
|
|
7
|
+
} from './primitives'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This module contains the parts of the Field component.
|
|
11
|
+
* @module 'field/parts'
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface FieldsetPartsValue {
|
|
15
|
+
/**
|
|
16
|
+
* The container of the field.
|
|
17
|
+
*/
|
|
18
|
+
Root: ElementType
|
|
19
|
+
/**
|
|
20
|
+
* The label of the field.
|
|
21
|
+
*/
|
|
22
|
+
Legend: ElementType
|
|
23
|
+
/**
|
|
24
|
+
* The text that displays when the field is valid.
|
|
25
|
+
*/
|
|
26
|
+
HelperText: ElementType
|
|
27
|
+
/**
|
|
28
|
+
* The text that displays when the field is invalid.
|
|
29
|
+
*/
|
|
30
|
+
ErrorText: ElementType
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An Object containing the parts of the Field component. For users that
|
|
35
|
+
* prefer Object component syntax.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
*
|
|
39
|
+
* When using object component syntax, you import the FieldParts object and
|
|
40
|
+
* the entire family of components vs. only what you use.
|
|
41
|
+
*/
|
|
42
|
+
export const FieldsetParts: FieldsetPartsValue = {
|
|
43
|
+
Root: FieldsetRoot,
|
|
44
|
+
Legend: FieldsetLegend,
|
|
45
|
+
HelperText: FieldsetHelperText,
|
|
46
|
+
ErrorText: FieldsetErrorText,
|
|
47
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Fieldset,
|
|
3
|
+
type FieldsetHelperTextProps,
|
|
4
|
+
type FieldsetLegendProps,
|
|
5
|
+
type FieldsetRootProps,
|
|
6
|
+
} from '@ark-ui/react/fieldset'
|
|
7
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
8
|
+
import {
|
|
9
|
+
fieldset,
|
|
10
|
+
type FieldsetVariantProps,
|
|
11
|
+
} from '@cerberus/styled-system/recipes'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This module contains all the primitives of the Fieldset component.
|
|
15
|
+
* @module 'react/fieldset'
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The context & container for the Fieldset components.
|
|
20
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
21
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
22
|
+
*/
|
|
23
|
+
export function FieldsetRoot(props: FieldsetRootProps) {
|
|
24
|
+
const styles = fieldset()
|
|
25
|
+
return (
|
|
26
|
+
<Fieldset.Root {...props} className={cx(styles.root, props.className)} />
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The legend element for the Fieldset group.
|
|
32
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
33
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
34
|
+
*/
|
|
35
|
+
export function FieldsetLegend(
|
|
36
|
+
props: FieldsetLegendProps & FieldsetVariantProps,
|
|
37
|
+
) {
|
|
38
|
+
const { usage, ...legendProps } = props
|
|
39
|
+
const styles = fieldset({ usage })
|
|
40
|
+
return (
|
|
41
|
+
<Fieldset.Legend
|
|
42
|
+
{...legendProps}
|
|
43
|
+
className={cx(styles.legend, legendProps.className)}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The description element for the Fieldset group.
|
|
50
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
51
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
52
|
+
*/
|
|
53
|
+
export function FieldsetHelperText(
|
|
54
|
+
props: FieldsetHelperTextProps & FieldsetVariantProps,
|
|
55
|
+
) {
|
|
56
|
+
const { usage, ...helperTextProps } = props
|
|
57
|
+
const styles = fieldset({ usage })
|
|
58
|
+
return (
|
|
59
|
+
<Fieldset.HelperText
|
|
60
|
+
{...helperTextProps}
|
|
61
|
+
className={cx(styles.helperText, helperTextProps.className)}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The error text element for the Fieldset group.
|
|
68
|
+
* @description [Fieldset Docs](https://cerberus.digitalu.design/react/fieldset)
|
|
69
|
+
* @description [Primitive Docs](https://ark-ui.com/react/docs/components/fieldset)
|
|
70
|
+
*/
|
|
71
|
+
export function FieldsetErrorText(props: FieldsetHelperTextProps) {
|
|
72
|
+
const styles = fieldset()
|
|
73
|
+
return (
|
|
74
|
+
<Fieldset.ErrorText
|
|
75
|
+
{...props}
|
|
76
|
+
className={cx(styles.errorText, props.className)}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
export interface ForProps<T> {
|
|
4
|
+
/**
|
|
5
|
+
* The array to iterate over
|
|
6
|
+
*/
|
|
7
|
+
each: T[]
|
|
8
|
+
/**
|
|
9
|
+
* The fallback content to render when the array is empty
|
|
10
|
+
*/
|
|
11
|
+
fallback?: ReactNode
|
|
12
|
+
/**
|
|
13
|
+
* The render function to render each item in the array
|
|
14
|
+
*/
|
|
15
|
+
children: (item: Exclude<T, undefined>, index: number) => ReactNode
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The For component is used to iterate over an array and render a list of
|
|
20
|
+
* components or display a fallback when the array is empty.
|
|
21
|
+
* Inspired by the `<For>` component from SolidJS.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <For each={['a', 'b', 'c']}>
|
|
26
|
+
* {(item, index) => <div key={index}>{item}</div>}
|
|
27
|
+
* </For>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function For<
|
|
31
|
+
T extends string | number | Record<string, unknown> | object | undefined,
|
|
32
|
+
>(props: ForProps<T>) {
|
|
33
|
+
const mappableChildren = props.children as unknown as (
|
|
34
|
+
item: T,
|
|
35
|
+
index: number,
|
|
36
|
+
) => ReactNode
|
|
37
|
+
|
|
38
|
+
if (props.each?.length === 0) {
|
|
39
|
+
return props.fallback || null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return props.each?.map(mappableChildren) as ReactNode
|
|
43
|
+
}
|