@spark-ui/components 14.0.0-beta.1 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-B6rA3-e5.js +2 -0
- package/dist/{Button-C3xHNaGl.js.map → Button-B6rA3-e5.js.map} +1 -1
- package/dist/{Button-D32Avk2j.mjs → Button-C3C0aixy.mjs} +4 -4
- package/dist/{Button-D32Avk2j.mjs.map → Button-C3C0aixy.mjs.map} +1 -1
- package/dist/DialogContent.styles-BSfXHt21.mjs +61 -0
- package/dist/DialogContent.styles-BSfXHt21.mjs.map +1 -0
- package/dist/DialogContent.styles-bBs6l8Cy.js +2 -0
- package/dist/DialogContent.styles-bBs6l8Cy.js.map +1 -0
- package/dist/Icon-CF0W0LKr.js +2 -0
- package/dist/{Icon-Bf0XrmiR.js.map → Icon-CF0W0LKr.js.map} +1 -1
- package/dist/{Icon-D1RueiPY.mjs → Icon-Ck-dhfLd.mjs} +6 -6
- package/dist/{Icon-D1RueiPY.mjs.map → Icon-Ck-dhfLd.mjs.map} +1 -1
- package/dist/{IconButton-BY3gYXtU.mjs → IconButton-C62-axzv.mjs} +6 -6
- package/dist/{IconButton-BY3gYXtU.mjs.map → IconButton-C62-axzv.mjs.map} +1 -1
- package/dist/IconButton-D3g86WpZ.js +2 -0
- package/dist/{IconButton-Bf-EDzpI.js.map → IconButton-D3g86WpZ.js.map} +1 -1
- package/dist/Slot-D2Bbf8Gw.mjs +14 -0
- package/dist/{Slot-C98rL4yy.mjs.map → Slot-D2Bbf8Gw.mjs.map} +1 -1
- package/dist/Slot-DQ8z2zsy.js +2 -0
- package/dist/{Slot-ghrohQLA.js.map → Slot-DQ8z2zsy.js.map} +1 -1
- package/dist/Spinner-_Kffli3B.js +2 -0
- package/dist/{Spinner-DK8VEsaR.js.map → Spinner-_Kffli3B.js.map} +1 -1
- package/dist/{Spinner-CYL5kyzM.mjs → Spinner-jF3-zoh_.mjs} +3 -3
- package/dist/{Spinner-CYL5kyzM.mjs.map → Spinner-jF3-zoh_.mjs.map} +1 -1
- package/dist/{TextLink-3MEVs3No.mjs → TextLink-BuzFRWO6.mjs} +3 -3
- package/dist/{TextLink-3MEVs3No.mjs.map → TextLink-BuzFRWO6.mjs.map} +1 -1
- package/dist/TextLink-C3xDLsbC.js +2 -0
- package/dist/{TextLink-DD0VO37q.js.map → TextLink-C3xDLsbC.js.map} +1 -1
- package/dist/{VisuallyHidden-AoRh4WRK.js → VisuallyHidden-CB6Nx76j.js} +2 -2
- package/dist/{VisuallyHidden-AoRh4WRK.js.map → VisuallyHidden-CB6Nx76j.js.map} +1 -1
- package/dist/{VisuallyHidden-ByNP7ZUI.mjs → VisuallyHidden-KH1biLx-.mjs} +2 -2
- package/dist/{VisuallyHidden-ByNP7ZUI.mjs.map → VisuallyHidden-KH1biLx-.mjs.map} +1 -1
- package/dist/accordion/index.d.mts +15 -0
- package/dist/accordion/index.js +1 -1
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +90 -608
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/AlertDialogPortal.d.ts +1 -1
- package/dist/alert-dialog/index.d.mts +38 -0
- package/dist/alert-dialog/index.js +1 -34
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +139 -2475
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/avatar/index.d.mts +15 -0
- package/dist/avatar/index.js +1 -1
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar/index.mjs +4 -4
- package/dist/badge/index.d.mts +1 -0
- package/dist/badge/index.js +1 -1
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +6 -6
- package/dist/breadcrumb/index.d.mts +12 -0
- package/dist/breadcrumb/index.js +1 -1
- package/dist/breadcrumb/index.js.map +1 -1
- package/dist/breadcrumb/index.mjs +21 -21
- package/dist/button/Button.d.ts +1 -1
- package/dist/button/index.d.mts +1 -0
- package/dist/button/index.js +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/button/variants/index.d.mts +5 -0
- package/dist/card/index.d.mts +8 -0
- package/dist/card/index.js +1 -1
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +2 -2
- package/dist/carousel/index.d.mts +19 -0
- package/dist/carousel/index.js +1 -1
- package/dist/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs +3 -3
- package/dist/checkbox/index.d.mts +2 -0
- package/dist/checkbox/index.js +1 -1
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +128 -364
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/chip/index.d.mts +15 -0
- package/dist/chip/index.js +1 -1
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/index.mjs +196 -370
- package/dist/chip/index.mjs.map +1 -1
- package/dist/chip/variants/index.d.mts +3 -0
- package/dist/collapsible/index.d.mts +7 -0
- package/dist/collapsible/index.js +1 -1
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs +38 -213
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/combobox/index.d.mts +35 -0
- package/dist/combobox/index.js +1 -1
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +7 -7
- package/dist/combobox/utils/index.d.mts +14 -0
- package/dist/dialog/Dialog.d.ts +13 -13
- package/dist/dialog/DialogClose.d.ts +9 -8
- package/dist/dialog/DialogContent.d.ts +4 -4
- package/dist/dialog/DialogDescription.d.ts +3 -3
- package/dist/dialog/DialogOverlay.d.ts +5 -5
- package/dist/dialog/DialogPortal.d.ts +4 -4
- package/dist/dialog/DialogTitle.d.ts +3 -3
- package/dist/dialog/DialogTrigger.d.ts +5 -9
- package/dist/dialog/index.d.mts +37 -0
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +149 -159
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/divider/index.d.mts +6 -0
- package/dist/divider/index.js +1 -1
- package/dist/divider/index.js.map +1 -1
- package/dist/divider/index.mjs +58 -76
- package/dist/divider/index.mjs.map +1 -1
- package/dist/drawer/Drawer.d.ts +12 -19
- package/dist/drawer/DrawerClose.d.ts +9 -5
- package/dist/drawer/DrawerContent.d.ts +5 -5
- package/dist/drawer/DrawerDescription.d.ts +4 -4
- package/dist/drawer/DrawerOverlay.d.ts +5 -5
- package/dist/drawer/DrawerPortal.d.ts +4 -4
- package/dist/drawer/DrawerTitle.d.ts +5 -5
- package/dist/drawer/DrawerTrigger.d.ts +5 -5
- package/dist/drawer/index.d.mts +37 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/index.js +1 -1
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +143 -114
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/drawer/useRenderSlot.d.ts +3 -0
- package/dist/dropdown/index.d.mts +29 -0
- package/dist/dropdown/index.js +1 -1
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +5 -5
- package/dist/file-upload/index.d.mts +22 -0
- package/dist/file-upload/index.js +1 -1
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs +6 -6
- package/dist/form-field/index.d.mts +31 -0
- package/dist/form-field/index.js +1 -1
- package/dist/form-field/index.js.map +1 -1
- package/dist/form-field/index.mjs +47 -47
- package/dist/icon/index.d.mts +1 -0
- package/dist/icon/index.js +1 -1
- package/dist/icon/index.mjs +1 -1
- package/dist/icon-button/index.d.mts +1 -0
- package/dist/icon-button/index.js +1 -1
- package/dist/icon-button/index.mjs +1 -1
- package/dist/input/index.d.mts +21 -0
- package/dist/input/index.js +1 -1
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +4 -4
- package/dist/input-otp/index.d.mts +14 -0
- package/dist/input-otp/index.js +1 -1
- package/dist/input-otp/index.js.map +1 -1
- package/dist/input-otp/index.mjs +139 -137
- package/dist/input-otp/index.mjs.map +1 -1
- package/dist/kbd/index.d.mts +1 -0
- package/dist/label/index.d.mts +7 -0
- package/dist/label/index.js +1 -1
- package/dist/label/index.js.map +1 -1
- package/dist/label/index.mjs +37 -2
- package/dist/label/index.mjs.map +1 -1
- package/dist/link-box/index.d.mts +9 -0
- package/dist/link-box/index.js +1 -1
- package/dist/link-box/index.js.map +1 -1
- package/dist/link-box/index.mjs +7 -7
- package/dist/pagination/index.d.mts +18 -0
- package/dist/pagination/index.js +1 -1
- package/dist/pagination/index.js.map +1 -1
- package/dist/pagination/index.mjs +126 -844
- package/dist/pagination/index.mjs.map +1 -1
- package/dist/popover/index.d.mts +17 -0
- package/dist/popover/index.js +1 -1
- package/dist/popover/index.js.map +1 -1
- package/dist/popover/index.mjs +119 -1748
- package/dist/popover/index.mjs.map +1 -1
- package/dist/portal/index.d.mts +1 -0
- package/dist/portal/index.js +1 -1
- package/dist/portal/index.js.map +1 -1
- package/dist/portal/index.mjs +3 -3
- package/dist/portal/index.mjs.map +1 -1
- package/dist/progress/index.d.mts +13 -0
- package/dist/progress/index.js +1 -6
- package/dist/progress/index.js.map +1 -1
- package/dist/progress/index.mjs +87 -162
- package/dist/progress/index.mjs.map +1 -1
- package/dist/progress-tracker/index.d.mts +10 -0
- package/dist/progress-tracker/index.js +1 -1
- package/dist/progress-tracker/index.js.map +1 -1
- package/dist/progress-tracker/index.mjs +14 -14
- package/dist/radio-group/index.d.mts +7 -0
- package/dist/radio-group/index.js +1 -1
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +85 -312
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/index.d.mts +1 -0
- package/dist/rating/index.js +1 -1
- package/dist/rating/index.js.map +1 -1
- package/dist/rating/index.mjs +11 -11
- package/dist/scrolling-list/index.d.mts +15 -0
- package/dist/scrolling-list/index.js +1 -1
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs +168 -333
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/segmented-gauge/index.d.mts +13 -0
- package/dist/segmented-gauge/index.js +1 -1
- package/dist/segmented-gauge/index.js.map +1 -1
- package/dist/segmented-gauge/index.mjs +1 -1
- package/dist/select/index.d.mts +21 -0
- package/dist/select/index.js +1 -1
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +21 -21
- package/dist/skeleton/index.d.mts +8 -0
- package/dist/skeleton/index.js +1 -1
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +2 -2
- package/dist/slider/Slider.d.ts +6 -1
- package/dist/slider/SliderContext.d.ts +4 -1
- package/dist/slider/index.d.mts +8 -0
- package/dist/slider/index.js +1 -1
- package/dist/slider/index.js.map +1 -1
- package/dist/slider/index.mjs +96 -496
- package/dist/slider/index.mjs.map +1 -1
- package/dist/slot/index.d.mts +1 -0
- package/dist/slot/index.js +1 -1
- package/dist/slot/index.mjs +1 -1
- package/dist/snackbar/index.d.mts +13 -0
- package/dist/snackbar/index.js +1 -1
- package/dist/snackbar/index.js.map +1 -1
- package/dist/snackbar/index.mjs +189 -1105
- package/dist/snackbar/index.mjs.map +1 -1
- package/dist/spinner/index.d.mts +1 -0
- package/dist/spinner/index.js +1 -1
- package/dist/spinner/index.mjs +1 -1
- package/dist/stepper/index.d.mts +9 -0
- package/dist/stepper/index.js +1 -7
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +137 -2317
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/switch/index.d.mts +1 -0
- package/dist/switch/index.js +1 -1
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +85 -208
- package/dist/switch/index.mjs.map +1 -1
- package/dist/tabs/index.d.mts +13 -0
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +179 -329
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tag/index.d.mts +1 -0
- package/dist/tag/index.js +1 -1
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/index.mjs +2 -2
- package/dist/tag/variants/index.d.mts +3 -0
- package/dist/text-link/index.d.mts +1 -0
- package/dist/text-link/index.js +1 -1
- package/dist/text-link/index.mjs +1 -1
- package/dist/textarea/index.d.mts +14 -0
- package/dist/textarea/index.js +1 -1
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +6 -6
- package/dist/toast/index.d.mts +20 -0
- package/dist/toast/index.js +1 -1
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/index.mjs +146 -1008
- package/dist/toast/index.mjs.map +1 -1
- package/dist/useRenderSlot-DATwjgpo.js +2 -0
- package/dist/useRenderSlot-DATwjgpo.js.map +1 -0
- package/dist/useRenderSlot-LwWj8QbC.mjs +10 -0
- package/dist/useRenderSlot-LwWj8QbC.mjs.map +1 -0
- package/dist/visually-hidden/index.d.mts +1 -0
- package/dist/visually-hidden/index.js +1 -1
- package/dist/visually-hidden/index.mjs +1 -1
- package/package.json +7 -6
- package/dist/Button-C3xHNaGl.js +0 -2
- package/dist/DialogContent.styles-BrhKaHc_.js +0 -2
- package/dist/DialogContent.styles-BrhKaHc_.js.map +0 -1
- package/dist/DialogContent.styles-WGWJS9dj.mjs +0 -48
- package/dist/DialogContent.styles-WGWJS9dj.mjs.map +0 -1
- package/dist/Icon-Bf0XrmiR.js +0 -2
- package/dist/IconButton-Bf-EDzpI.js +0 -2
- package/dist/Slot-C98rL4yy.mjs +0 -14
- package/dist/Slot-ghrohQLA.js +0 -2
- package/dist/Spinner-DK8VEsaR.js +0 -2
- package/dist/TextLink-DD0VO37q.js +0 -2
- package/dist/composite-Br3kM5N9.mjs +0 -40
- package/dist/composite-Br3kM5N9.mjs.map +0 -1
- package/dist/composite-fJD9R7R0.js +0 -2
- package/dist/composite-fJD9R7R0.js.map +0 -1
- package/dist/detectBrowser-Bc7rk5fI.mjs +0 -44
- package/dist/detectBrowser-Bc7rk5fI.mjs.map +0 -1
- package/dist/detectBrowser-DTbs_30X.js +0 -2
- package/dist/detectBrowser-DTbs_30X.js.map +0 -1
- package/dist/downshift.esm-Ncwetv0s.mjs +0 -3038
- package/dist/downshift.esm-Ncwetv0s.mjs.map +0 -1
- package/dist/downshift.esm-PfCOUbxq.js +0 -37
- package/dist/downshift.esm-PfCOUbxq.js.map +0 -1
- package/dist/floating-ui.utils.dom-CCN4I08l.js +0 -2
- package/dist/floating-ui.utils.dom-CCN4I08l.js.map +0 -1
- package/dist/floating-ui.utils.dom-uiDUZc_y.mjs +0 -136
- package/dist/floating-ui.utils.dom-uiDUZc_y.mjs.map +0 -1
- package/dist/index-0KYGKeVg.js +0 -2
- package/dist/index-0KYGKeVg.js.map +0 -1
- package/dist/index-1WIgmEZh.js +0 -2
- package/dist/index-1WIgmEZh.js.map +0 -1
- package/dist/index-BRi38DTc.mjs +0 -21
- package/dist/index-BRi38DTc.mjs.map +0 -1
- package/dist/index-BZAtNKwE.mjs +0 -71
- package/dist/index-BZAtNKwE.mjs.map +0 -1
- package/dist/index-BZPx6jYI.mjs +0 -9
- package/dist/index-BZPx6jYI.mjs.map +0 -1
- package/dist/index-BlkdpEIe.mjs +0 -55
- package/dist/index-BlkdpEIe.mjs.map +0 -1
- package/dist/index-BmAFn37q.mjs +0 -49
- package/dist/index-BmAFn37q.mjs.map +0 -1
- package/dist/index-C-J_tHdS.js +0 -6
- package/dist/index-C-J_tHdS.js.map +0 -1
- package/dist/index-C1qb0595.mjs +0 -28
- package/dist/index-C1qb0595.mjs.map +0 -1
- package/dist/index-C34GgsKQ.mjs +0 -54
- package/dist/index-C34GgsKQ.mjs.map +0 -1
- package/dist/index-CCKe-Mpx.mjs +0 -7
- package/dist/index-CCKe-Mpx.mjs.map +0 -1
- package/dist/index-CDBBjNXc.js +0 -2
- package/dist/index-CDBBjNXc.js.map +0 -1
- package/dist/index-CYjGhVvU.mjs +0 -243
- package/dist/index-CYjGhVvU.mjs.map +0 -1
- package/dist/index-ChLwd62c.js +0 -2
- package/dist/index-ChLwd62c.js.map +0 -1
- package/dist/index-Cjj_rUPu.js +0 -2
- package/dist/index-Cjj_rUPu.js.map +0 -1
- package/dist/index-CyMbLkj0.js +0 -2
- package/dist/index-CyMbLkj0.js.map +0 -1
- package/dist/index-DFZozV_h.mjs +0 -69
- package/dist/index-DFZozV_h.mjs.map +0 -1
- package/dist/index-DKuHkHFX.js +0 -2
- package/dist/index-DKuHkHFX.js.map +0 -1
- package/dist/index-DLHLIYPI.mjs +0 -16
- package/dist/index-DLHLIYPI.mjs.map +0 -1
- package/dist/index-DO-atGp-.js +0 -2
- package/dist/index-DO-atGp-.js.map +0 -1
- package/dist/index-DWlg8lkk.mjs +0 -179
- package/dist/index-DWlg8lkk.mjs.map +0 -1
- package/dist/index-DYxWvftI.js +0 -2
- package/dist/index-DYxWvftI.js.map +0 -1
- package/dist/index-D_lWkK39.mjs +0 -803
- package/dist/index-D_lWkK39.mjs.map +0 -1
- package/dist/index-DdkVj7D0.js +0 -18
- package/dist/index-DdkVj7D0.js.map +0 -1
- package/dist/index-De-6atSi.js +0 -2
- package/dist/index-De-6atSi.js.map +0 -1
- package/dist/index-DhGWNzsz.mjs +0 -83
- package/dist/index-DhGWNzsz.mjs.map +0 -1
- package/dist/index-Dkj4QRX8.js +0 -2
- package/dist/index-Dkj4QRX8.js.map +0 -1
- package/dist/index-DlIFg0Eu.mjs +0 -60
- package/dist/index-DlIFg0Eu.mjs.map +0 -1
- package/dist/index-DnaHaH_0.js +0 -2
- package/dist/index-DnaHaH_0.js.map +0 -1
- package/dist/index-MHF2-CYX.js +0 -2
- package/dist/index-MHF2-CYX.js.map +0 -1
- package/dist/index-MQ0c3ZX_.js +0 -2
- package/dist/index-MQ0c3ZX_.js.map +0 -1
- package/dist/index-MSR-vgWR.mjs +0 -37
- package/dist/index-MSR-vgWR.mjs.map +0 -1
- package/dist/index-VL0YEmOW.mjs +0 -125
- package/dist/index-VL0YEmOW.mjs.map +0 -1
- package/dist/index-tXqxYME3.js +0 -42
- package/dist/index-tXqxYME3.js.map +0 -1
- package/dist/inertValue-Bif5Sqs6.mjs +0 -522
- package/dist/inertValue-Bif5Sqs6.mjs.map +0 -1
- package/dist/inertValue-ShwihJSN.js +0 -5
- package/dist/inertValue-ShwihJSN.js.map +0 -1
- package/dist/useCollapsiblePanel-D1dCo0lf.js +0 -4
- package/dist/useCollapsiblePanel-D1dCo0lf.js.map +0 -1
- package/dist/useCollapsiblePanel-kbMNl4Z4.mjs +0 -287
- package/dist/useCollapsiblePanel-kbMNl4Z4.mjs.map +0 -1
- package/dist/useFocusWithin-CFNEka2I.js +0 -2
- package/dist/useFocusWithin-CFNEka2I.js.map +0 -1
- package/dist/useFocusWithin-CoL4390f.mjs +0 -796
- package/dist/useFocusWithin-CoL4390f.mjs.map +0 -1
- package/dist/useOpenChangeComplete-Dk-u_f2y.js +0 -2
- package/dist/useOpenChangeComplete-Dk-u_f2y.js.map +0 -1
- package/dist/useOpenChangeComplete-RUbg6RBw.mjs +0 -582
- package/dist/useOpenChangeComplete-RUbg6RBw.mjs.map +0 -1
- package/dist/useTransitionStatus-CktVVKxz.mjs +0 -46
- package/dist/useTransitionStatus-CktVVKxz.mjs.map +0 -1
- package/dist/useTransitionStatus-CqbEyvIj.js +0 -2
- package/dist/useTransitionStatus-CqbEyvIj.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/form-field/FormFieldContext.tsx","../../src/form-field/FormFieldProvider.tsx","../../src/form-field/FormField.tsx","../../src/form-field/FormFieldMessage.tsx","../../src/form-field/FormFieldStateMessage.tsx","../../src/form-field/FormFieldAlertMessage.tsx","../../src/form-field/FormFieldCharactersCount.tsx","../../src/form-field/FormFieldControl.tsx","../../src/form-field/FormFieldErrorMessage.tsx","../../src/form-field/FormFieldHelperMessage.tsx","../../src/form-field/FormFieldRequiredIndicator.tsx","../../src/form-field/FormFieldLabel.tsx","../../src/form-field/FormFieldSuccessMessage.tsx","../../src/form-field/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface FormFieldContextState {\n /**\n * Generated id for the input component.\n */\n id: string\n /**\n * Generated id for the label component.\n */\n labelId?: string\n /**\n * The name of the input. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * Disables the field and its associated input\n */\n disabled?: boolean\n /**\n * Marks the field and its associated input as read only\n */\n readOnly?: boolean\n /**\n * The validation state of the input.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the form field will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the form field will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to store a descriptive message.\n */\n onMessageIdAdd: (id: string) => void\n /**\n * Callback used to remove a descriptive message.\n */\n onMessageIdRemove: (id: string) => void\n}\n\nexport const FormFieldContext = createContext<FormFieldContextState | null>(null)\n\nexport const ID_PREFIX = ':form-field'\n\nexport const useFormField = () => {\n const context = useContext(FormFieldContext)\n\n if (!context) {\n throw Error('useFormField must be used within a FormField provider')\n }\n\n return context\n}\n","import { ReactNode, useCallback, useId, useMemo, useState } from 'react'\n\nimport { FormFieldContext, FormFieldContextState, ID_PREFIX } from './FormFieldContext'\n\nexport interface FormFieldProviderProps\n extends Pick<\n FormFieldContextState,\n 'id' | 'name' | 'disabled' | 'readOnly' | 'state' | 'isRequired'\n > {\n children: ReactNode\n}\n\nexport const FormFieldProvider = ({\n id,\n name,\n disabled = false,\n readOnly = false,\n state,\n isRequired,\n children,\n}: FormFieldProviderProps) => {\n const labelId = `${ID_PREFIX}-label-${useId()}`\n const [messageIds, setMessageIds] = useState<string[]>([])\n const description = messageIds.length > 0 ? messageIds.join(' ') : undefined\n\n const handleMessageIdAdd = useCallback((msgId: string) => {\n setMessageIds(ids => [...ids, msgId])\n }, [])\n\n const handleMessageIdRemove = useCallback((msgId: string) => {\n setMessageIds(ids => ids.filter(current => current !== msgId))\n }, [])\n\n const value = useMemo(() => {\n const isInvalid = state === 'error'\n\n return {\n id,\n labelId,\n name,\n disabled,\n readOnly,\n state,\n isRequired,\n isInvalid,\n description,\n onMessageIdAdd: handleMessageIdAdd,\n onMessageIdRemove: handleMessageIdRemove,\n }\n }, [\n id,\n labelId,\n name,\n disabled,\n readOnly,\n description,\n state,\n isRequired,\n handleMessageIdAdd,\n handleMessageIdRemove,\n ])\n\n return <FormFieldContext.Provider value={value}>{children}</FormFieldContext.Provider>\n}\n\nFormFieldProvider.displayName = 'FormFieldProvider'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useId } from 'react'\n\nimport { Slot } from '../slot'\nimport { FormFieldContextState, ID_PREFIX } from './FormFieldContext'\nimport { FormFieldProvider } from './FormFieldProvider'\n\nexport interface FormFieldProps\n extends ComponentPropsWithoutRef<'div'>,\n Pick<FormFieldContextState, 'name' | 'state' | 'isRequired'> {\n /**\n * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n */\n asChild?: boolean\n /**\n * When `true`, prevents the user from interacting.\n */\n disabled?: boolean\n /**\n * Sets the component as interactive or not.\n */\n readOnly?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const FormField = ({\n className,\n disabled = false,\n readOnly = false,\n name,\n state,\n isRequired = false,\n asChild = false,\n ref,\n ...others\n}: FormFieldProps) => {\n const id = `${ID_PREFIX}-${useId()}`\n const Component = asChild ? Slot : 'div'\n\n return (\n <FormFieldProvider\n id={id}\n name={name}\n isRequired={isRequired}\n disabled={disabled}\n readOnly={readOnly}\n state={state}\n >\n <Component\n ref={ref}\n data-spark-component=\"form-field\"\n className={cx(className, 'gap-sm flex flex-col')}\n {...others}\n />\n </FormFieldProvider>\n )\n}\n\nFormField.displayName = 'FormField'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useId } from 'react'\n\nimport { ID_PREFIX, useFormField } from './FormFieldContext'\n\nexport type FormFieldMessageProps = ComponentPropsWithoutRef<'span'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldMessage = ({\n id: idProp,\n className,\n ref,\n ...others\n}: FormFieldMessageProps) => {\n const { onMessageIdAdd, onMessageIdRemove } = useFormField()\n const currentId = `${ID_PREFIX}-message-${useId()}`\n const id = idProp || currentId\n\n useEffect(() => {\n onMessageIdAdd(id)\n\n return () => {\n onMessageIdRemove(id)\n }\n }, [id, onMessageIdAdd, onMessageIdRemove])\n\n return (\n <span\n ref={ref}\n id={id}\n data-spark-component=\"form-field-message\"\n className={cx(className, 'text-caption')}\n {...others}\n />\n )\n}\n\nFormFieldMessage.displayName = 'FormField.Message'\n","import { AlertOutline } from '@spark-ui/icons/AlertOutline'\nimport { Check } from '@spark-ui/icons/Check'\nimport { WarningOutline } from '@spark-ui/icons/WarningOutline'\nimport { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useFormField } from './FormFieldContext'\nimport { FormFieldMessage, FormFieldMessageProps } from './FormFieldMessage'\n\nexport interface FormFieldStateMessageProps extends FormFieldMessageProps {\n state: 'error' | 'alert' | 'success'\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldStateMessage = ({\n className,\n state,\n children,\n ref,\n ...others\n}: FormFieldStateMessageProps) => {\n const field = useFormField()\n\n if (field.state !== state) {\n return null\n }\n\n return (\n <FormFieldMessage\n ref={ref}\n data-spark-component=\"form-field-state-message\"\n className={cx(\n 'gap-sm flex items-center',\n state === 'error' ? 'text-error' : 'text-on-surface/dim-1',\n className\n )}\n {...others}\n >\n {state === 'alert' && (\n <Icon size=\"sm\">\n <WarningOutline />\n </Icon>\n )}\n {state === 'error' && (\n <Icon size=\"sm\" intent=\"error\">\n <AlertOutline />\n </Icon>\n )}\n {state === 'success' && (\n <Icon size=\"sm\">\n <Check />\n </Icon>\n )}\n\n {children}\n </FormFieldMessage>\n )\n}\n\nFormFieldStateMessage.displayName = 'FormField.StateMessage'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldAlertMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldAlertMessage = ({ ref, ...props }: FormFieldAlertMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-alert-message\"\n state=\"alert\"\n {...props}\n />\n )\n}\n\nFormFieldAlertMessage.displayName = 'FormField.AlertMessage'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useState } from 'react'\n\nimport { FormFieldMessage } from './FormFieldMessage'\n\nexport type FormFieldCharactersCountProps = ComponentPropsWithoutRef<'span'> & {\n /**\n * This description is for the screen reader, read when the input is focused.\n */\n description?: string\n /**\n * The live announcement is for the screen read after a delay once the input value changes.\n */\n liveAnnouncement?: ({ remainingChars }: { remainingChars: number }) => string\n /**\n * Current value for the input this component belongs to.\n */\n value?: string\n /**\n * Maximum numeric value to be displayed.\n */\n maxLength: number\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldCharactersCount = ({\n className,\n value = '',\n maxLength,\n description,\n liveAnnouncement,\n ref,\n ...others\n}: FormFieldCharactersCountProps) => {\n const [throttledValue, setThrottledValue] = useState(value)\n\n /**\n * The value is throttled to avoid spamming the aria-live region (and consequently the screen reader).\n */\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setThrottledValue(value)\n }, 1000)\n\n return () => clearTimeout(timeoutId)\n }, [value])\n\n return (\n <span className=\"ml-auto self-start\">\n {description && (\n <FormFieldMessage className=\"default:sr-only\">{description}</FormFieldMessage>\n )}\n <span\n ref={ref}\n aria-hidden\n data-spark-component=\"form-field-characters-count\"\n className={cx(className, 'text-caption', 'text-neutral')}\n {...others}\n >\n {`${value.length}/${maxLength}`}\n </span>\n\n {liveAnnouncement && (\n <span className=\"sr-only\" aria-live=\"polite\">\n {liveAnnouncement({ remainingChars: maxLength - throttledValue.length })}\n </span>\n )}\n </span>\n )\n}\n\nFormFieldCharactersCount.displayName = 'FormField.CharactersCount'\n","import { ReactNode, useContext } from 'react'\n\nimport { FormFieldContext, FormFieldContextState } from './FormFieldContext'\n\ntype State = Partial<\n Pick<\n FormFieldContextState,\n | 'id'\n | 'name'\n | 'description'\n | 'labelId'\n | 'disabled'\n | 'readOnly'\n | 'state'\n | 'isInvalid'\n | 'isRequired'\n >\n>\n\nexport interface FormFieldControlProps {\n children: (state: State) => ReactNode\n}\n\nexport const useFormFieldControl = () => {\n const { id, name, description, disabled, readOnly, state, labelId, isInvalid, isRequired } =\n useContext(FormFieldContext) || {}\n\n return {\n id,\n name,\n description,\n disabled,\n readOnly,\n state,\n labelId,\n isInvalid,\n isRequired,\n } as State\n}\n\nexport const FormFieldControl = ({ children }: FormFieldControlProps) => {\n const props = useFormFieldControl()\n\n return <>{children(props)}</>\n}\n\nFormFieldControl.displayName = 'FormField.Control'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldErrorMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldErrorMessage = ({ ref, ...props }: FormFieldErrorMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-error-message\"\n state=\"error\"\n {...props}\n />\n )\n}\n\nFormFieldErrorMessage.displayName = 'FormField.ErrorMessage'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { FormFieldMessage, FormFieldMessageProps } from './FormFieldMessage'\n\nexport type FormFieldHelperMessageProps = FormFieldMessageProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldHelperMessage = ({\n className,\n ref,\n ...others\n}: FormFieldHelperMessageProps) => {\n return (\n <FormFieldMessage\n ref={ref}\n data-spark-component=\"form-field-helper-message\"\n className={cx('text-on-surface/dim-1', className)}\n {...others}\n />\n )\n}\n\nFormFieldHelperMessage.displayName = 'FormField.HelperMessage'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Label, LabelRequiredIndicatorProps } from '../label'\n\nexport type FormFieldRequiredIndicatorProps = LabelRequiredIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldRequiredIndicator = ({\n className,\n ref,\n ...props\n}: FormFieldRequiredIndicatorProps) => {\n return <Label.RequiredIndicator ref={ref} className={cx('ml-sm', className)} {...props} />\n}\n\nFormFieldRequiredIndicator.displayName = 'FormField.RequiredIndicator'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { Label, LabelProps } from '../label'\nimport { Slottable } from '../slot'\nimport { useFormField } from './FormFieldContext'\nimport { FormFieldRequiredIndicator } from './FormFieldRequiredIndicator'\n\nexport interface FormFieldLabelProps extends LabelProps {\n /**\n * Element shown when the input is required inside the label.\n */\n requiredIndicator?: ReactNode\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const FormFieldLabel = ({\n htmlFor: htmlForProp,\n className,\n children,\n requiredIndicator = <FormFieldRequiredIndicator />,\n asChild,\n ref,\n ...others\n}: FormFieldLabelProps) => {\n const control = useFormField()\n\n const { disabled, labelId, isRequired } = control\n const htmlFor = asChild ? undefined : htmlForProp || control.id\n\n return (\n <Label\n ref={ref}\n id={labelId}\n data-spark-component=\"form-field-label\"\n htmlFor={htmlFor}\n className={cx(className, disabled ? 'text-on-surface/dim-3 pointer-events-none' : undefined)}\n asChild={asChild}\n {...others}\n >\n <>\n <Slottable>{children}</Slottable>\n {isRequired && requiredIndicator}\n </>\n </Label>\n )\n}\n\nFormFieldLabel.displayName = 'FormField.Label'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldSuccessMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldSuccessMessage = ({ ref, ...props }: FormFieldSuccessMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-success-message\"\n state=\"success\"\n {...props}\n />\n )\n}\n\nFormFieldSuccessMessage.displayName = 'FormField.SuccessMessage'\n","import { FormField as Root } from './FormField'\nimport { FormFieldAlertMessage } from './FormFieldAlertMessage'\nimport { FormFieldCharactersCount } from './FormFieldCharactersCount'\nimport { FormFieldControl } from './FormFieldControl'\nimport { FormFieldErrorMessage } from './FormFieldErrorMessage'\nimport { FormFieldHelperMessage } from './FormFieldHelperMessage'\nimport { FormFieldLabel } from './FormFieldLabel'\nimport { FormFieldRequiredIndicator } from './FormFieldRequiredIndicator'\nimport { FormFieldStateMessage } from './FormFieldStateMessage'\nimport { FormFieldSuccessMessage } from './FormFieldSuccessMessage'\n\nexport const FormField: typeof Root & {\n Label: typeof FormFieldLabel\n Control: typeof FormFieldControl\n StateMessage: typeof FormFieldStateMessage\n SuccessMessage: typeof FormFieldSuccessMessage\n AlertMessage: typeof FormFieldAlertMessage\n ErrorMessage: typeof FormFieldErrorMessage\n HelperMessage: typeof FormFieldHelperMessage\n RequiredIndicator: typeof FormFieldRequiredIndicator\n CharactersCount: typeof FormFieldCharactersCount\n} = Object.assign(Root, {\n Label: FormFieldLabel,\n Control: FormFieldControl,\n StateMessage: FormFieldStateMessage,\n SuccessMessage: FormFieldSuccessMessage,\n AlertMessage: FormFieldAlertMessage,\n ErrorMessage: FormFieldErrorMessage,\n HelperMessage: FormFieldHelperMessage,\n RequiredIndicator: FormFieldRequiredIndicator,\n CharactersCount: FormFieldCharactersCount,\n})\n\nFormField.displayName = 'FormField'\nFormFieldLabel.displayName = 'FormField.Label'\nFormFieldControl.displayName = 'FormField.Control'\nFormFieldStateMessage.displayName = 'FormField.StateMessage'\nFormFieldSuccessMessage.displayName = 'FormField.SuccessMessage'\nFormFieldAlertMessage.displayName = 'FormField.AlertMessage'\nFormFieldErrorMessage.displayName = 'FormField.ErrorMessage'\nFormFieldHelperMessage.displayName = 'FormField.HelperMessage'\nFormFieldRequiredIndicator.displayName = 'FormField.RequiredIndicator'\nFormFieldCharactersCount.displayName = 'FormField.CharactersCount'\n\nexport { type FormFieldProps } from './FormField'\nexport { type FormFieldStateMessageProps } from './FormFieldStateMessage'\nexport { type FormFieldControl, useFormFieldControl } from './FormFieldControl'\nexport { type FormFieldHelperMessageProps } from './FormFieldHelperMessage'\nexport { type FormFieldSuccessMessageProps } from './FormFieldSuccessMessage'\nexport { type FormFieldAlertMessageProps } from './FormFieldAlertMessage'\nexport { type FormFieldErrorMessageProps } from './FormFieldErrorMessage'\nexport { type FormFieldLabelProps } from './FormFieldLabel'\nexport { type FormFieldRequiredIndicatorProps } from './FormFieldRequiredIndicator'\nexport { type FormFieldCharactersCountProps } from './FormFieldCharactersCount'\n"],"names":["FormFieldContext","createContext","ID_PREFIX","useFormField","context","useContext","FormFieldProvider","id","name","disabled","readOnly","state","isRequired","children","labelId","useId","messageIds","setMessageIds","useState","description","handleMessageIdAdd","useCallback","msgId","ids","handleMessageIdRemove","current","value","useMemo","jsx","FormField","className","asChild","ref","others","Component","Slot","cx","FormFieldMessage","idProp","onMessageIdAdd","onMessageIdRemove","currentId","useEffect","FormFieldStateMessage","jsxs","Icon","WarningOutline","AlertOutline","Check","FormFieldAlertMessage","props","FormFieldCharactersCount","maxLength","liveAnnouncement","throttledValue","setThrottledValue","timeoutId","useFormFieldControl","isInvalid","FormFieldControl","Fragment","FormFieldErrorMessage","FormFieldHelperMessage","FormFieldRequiredIndicator","Label","FormFieldLabel","htmlForProp","requiredIndicator","control","htmlFor","Slottable","FormFieldSuccessMessage","Root"],"mappings":"uYAiDaA,EAAmBC,EAAAA,cAA4C,IAAI,EAEnEC,EAAY,cAEZC,EAAe,IAAM,CAChC,MAAMC,EAAUC,EAAAA,WAAWL,CAAgB,EAE3C,GAAI,CAACI,EACH,MAAM,MAAM,uDAAuD,EAGrE,OAAOA,CACT,ECjDaE,EAAoB,CAAC,CAChC,GAAAC,EACA,KAAAC,EACA,SAAAC,EAAW,GACX,SAAAC,EAAW,GACX,MAAAC,EACA,W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,EAAU,OAAYmC,GAAeE,EAAQ,GAE7D,OACExC,EAAAA,IAACoC,EAAAA,MAAA,CACC,IAAAhC,EACA,GAAIlB,EACJ,uBAAqB,mBACrB,QAAAuD,EACA,UAAWjC,EAAAA,GAAGN,EAAWrB,EAAW,4CAA8C,MAAS,EAC3F,QAAAsB,EACC,GAAGE,EAEJ,SAAAW,EAAAA,KAAAgB,WAAA,CACE,SAAA,CAAAhC,MAAC0C,EAAAA,WAAW,SAAAzD,EAAS,EACpBD,GAAcuD,CAAA,CAAA,CACjB,CAAA,CAAA,CAGN,EAEAF,EAAe,YAAc,kBCxCtB,MAAMM,EAA0B,CAAC,CAAE,IAAAvC,EAAK,GAAGkB,KAE9CtB,EAAAA,IAACe,EAAA,CACC,IAAAX,EACA,uBAAqB,6BACrB,MAAM,UACL,GAAGkB,CAAA,CAAA,EAKVqB,EAAwB,YAAc,2BCR/B,MAAM1C,EAUT,OAAO,OAAO2C,EAAM,CACtB,MAAOP,EACP,QAASN,EACT,aAAchB,EACd,eAAgB4B,EAChB,aAActB,EACd,aAAcY,EACd,cAAeC,EACf,kBAAmBC,EACnB,gBAAiBZ,CACnB,CAAC,EAEDtB,EAAU,YAAc,YACxBoC,EAAe,YAAc,kBAC7BN,EAAiB,YAAc,oBAC/BhB,EAAsB,YAAc,yBACpC4B,EAAwB,YAAc,2BACtCtB,EAAsB,YAAc,yBACpCY,EAAsB,YAAc,yBACpCC,EAAuB,YAAc,0BACrCC,EAA2B,YAAc,8BACzCZ,EAAyB,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/form-field/FormFieldContext.tsx","../../src/form-field/FormFieldProvider.tsx","../../src/form-field/FormField.tsx","../../src/form-field/FormFieldMessage.tsx","../../src/form-field/FormFieldStateMessage.tsx","../../src/form-field/FormFieldAlertMessage.tsx","../../src/form-field/FormFieldCharactersCount.tsx","../../src/form-field/FormFieldControl.tsx","../../src/form-field/FormFieldErrorMessage.tsx","../../src/form-field/FormFieldHelperMessage.tsx","../../src/form-field/FormFieldRequiredIndicator.tsx","../../src/form-field/FormFieldLabel.tsx","../../src/form-field/FormFieldSuccessMessage.tsx","../../src/form-field/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface FormFieldContextState {\n /**\n * Generated id for the input component.\n */\n id: string\n /**\n * Generated id for the label component.\n */\n labelId?: string\n /**\n * The name of the input. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * Disables the field and its associated input\n */\n disabled?: boolean\n /**\n * Marks the field and its associated input as read only\n */\n readOnly?: boolean\n /**\n * The validation state of the input.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the form field will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the form field will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to store a descriptive message.\n */\n onMessageIdAdd: (id: string) => void\n /**\n * Callback used to remove a descriptive message.\n */\n onMessageIdRemove: (id: string) => void\n}\n\nexport const FormFieldContext = createContext<FormFieldContextState | null>(null)\n\nexport const ID_PREFIX = ':form-field'\n\nexport const useFormField = () => {\n const context = useContext(FormFieldContext)\n\n if (!context) {\n throw Error('useFormField must be used within a FormField provider')\n }\n\n return context\n}\n","import { ReactNode, useCallback, useId, useMemo, useState } from 'react'\n\nimport { FormFieldContext, FormFieldContextState, ID_PREFIX } from './FormFieldContext'\n\nexport interface FormFieldProviderProps\n extends Pick<\n FormFieldContextState,\n 'id' | 'name' | 'disabled' | 'readOnly' | 'state' | 'isRequired'\n > {\n children: ReactNode\n}\n\nexport const FormFieldProvider = ({\n id,\n name,\n disabled = false,\n readOnly = false,\n state,\n isRequired,\n children,\n}: FormFieldProviderProps) => {\n const labelId = `${ID_PREFIX}-label-${useId()}`\n const [messageIds, setMessageIds] = useState<string[]>([])\n const description = messageIds.length > 0 ? messageIds.join(' ') : undefined\n\n const handleMessageIdAdd = useCallback((msgId: string) => {\n setMessageIds(ids => [...ids, msgId])\n }, [])\n\n const handleMessageIdRemove = useCallback((msgId: string) => {\n setMessageIds(ids => ids.filter(current => current !== msgId))\n }, [])\n\n const value = useMemo(() => {\n const isInvalid = state === 'error'\n\n return {\n id,\n labelId,\n name,\n disabled,\n readOnly,\n state,\n isRequired,\n isInvalid,\n description,\n onMessageIdAdd: handleMessageIdAdd,\n onMessageIdRemove: handleMessageIdRemove,\n }\n }, [\n id,\n labelId,\n name,\n disabled,\n readOnly,\n description,\n state,\n isRequired,\n handleMessageIdAdd,\n handleMessageIdRemove,\n ])\n\n return <FormFieldContext.Provider value={value}>{children}</FormFieldContext.Provider>\n}\n\nFormFieldProvider.displayName = 'FormFieldProvider'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useId } from 'react'\n\nimport { Slot } from '../slot'\nimport { FormFieldContextState, ID_PREFIX } from './FormFieldContext'\nimport { FormFieldProvider } from './FormFieldProvider'\n\nexport interface FormFieldProps\n extends ComponentPropsWithoutRef<'div'>,\n Pick<FormFieldContextState, 'name' | 'state' | 'isRequired'> {\n /**\n * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n */\n asChild?: boolean\n /**\n * When `true`, prevents the user from interacting.\n */\n disabled?: boolean\n /**\n * Sets the component as interactive or not.\n */\n readOnly?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const FormField = ({\n className,\n disabled = false,\n readOnly = false,\n name,\n state,\n isRequired = false,\n asChild = false,\n ref,\n ...others\n}: FormFieldProps) => {\n const id = `${ID_PREFIX}-${useId()}`\n const Component = asChild ? Slot : 'div'\n\n return (\n <FormFieldProvider\n id={id}\n name={name}\n isRequired={isRequired}\n disabled={disabled}\n readOnly={readOnly}\n state={state}\n >\n <Component\n ref={ref}\n data-spark-component=\"form-field\"\n className={cx(className, 'gap-sm flex flex-col')}\n {...others}\n />\n </FormFieldProvider>\n )\n}\n\nFormField.displayName = 'FormField'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useId } from 'react'\n\nimport { ID_PREFIX, useFormField } from './FormFieldContext'\n\nexport type FormFieldMessageProps = ComponentPropsWithoutRef<'span'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldMessage = ({\n id: idProp,\n className,\n ref,\n ...others\n}: FormFieldMessageProps) => {\n const { onMessageIdAdd, onMessageIdRemove } = useFormField()\n const currentId = `${ID_PREFIX}-message-${useId()}`\n const id = idProp || currentId\n\n useEffect(() => {\n onMessageIdAdd(id)\n\n return () => {\n onMessageIdRemove(id)\n }\n }, [id, onMessageIdAdd, onMessageIdRemove])\n\n return (\n <span\n ref={ref}\n id={id}\n data-spark-component=\"form-field-message\"\n className={cx(className, 'text-caption')}\n {...others}\n />\n )\n}\n\nFormFieldMessage.displayName = 'FormField.Message'\n","import { AlertOutline } from '@spark-ui/icons/AlertOutline'\nimport { Check } from '@spark-ui/icons/Check'\nimport { WarningOutline } from '@spark-ui/icons/WarningOutline'\nimport { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useFormField } from './FormFieldContext'\nimport { FormFieldMessage, FormFieldMessageProps } from './FormFieldMessage'\n\nexport interface FormFieldStateMessageProps extends FormFieldMessageProps {\n state: 'error' | 'alert' | 'success'\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldStateMessage = ({\n className,\n state,\n children,\n ref,\n ...others\n}: FormFieldStateMessageProps) => {\n const field = useFormField()\n\n if (field.state !== state) {\n return null\n }\n\n return (\n <FormFieldMessage\n ref={ref}\n data-spark-component=\"form-field-state-message\"\n className={cx(\n 'gap-sm flex items-center',\n state === 'error' ? 'text-error' : 'text-on-surface/dim-1',\n className\n )}\n {...others}\n >\n {state === 'alert' && (\n <Icon size=\"sm\">\n <WarningOutline />\n </Icon>\n )}\n {state === 'error' && (\n <Icon size=\"sm\" intent=\"error\">\n <AlertOutline />\n </Icon>\n )}\n {state === 'success' && (\n <Icon size=\"sm\">\n <Check />\n </Icon>\n )}\n\n {children}\n </FormFieldMessage>\n )\n}\n\nFormFieldStateMessage.displayName = 'FormField.StateMessage'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldAlertMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldAlertMessage = ({ ref, ...props }: FormFieldAlertMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-alert-message\"\n state=\"alert\"\n {...props}\n />\n )\n}\n\nFormFieldAlertMessage.displayName = 'FormField.AlertMessage'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useState } from 'react'\n\nimport { FormFieldMessage } from './FormFieldMessage'\n\nexport type FormFieldCharactersCountProps = ComponentPropsWithoutRef<'span'> & {\n /**\n * This description is for the screen reader, read when the input is focused.\n */\n description?: string\n /**\n * The live announcement is for the screen read after a delay once the input value changes.\n */\n liveAnnouncement?: ({ remainingChars }: { remainingChars: number }) => string\n /**\n * Current value for the input this component belongs to.\n */\n value?: string\n /**\n * Maximum numeric value to be displayed.\n */\n maxLength: number\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldCharactersCount = ({\n className,\n value = '',\n maxLength,\n description,\n liveAnnouncement,\n ref,\n ...others\n}: FormFieldCharactersCountProps) => {\n const [throttledValue, setThrottledValue] = useState(value)\n\n /**\n * The value is throttled to avoid spamming the aria-live region (and consequently the screen reader).\n */\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setThrottledValue(value)\n }, 1000)\n\n return () => clearTimeout(timeoutId)\n }, [value])\n\n return (\n <span className=\"ml-auto self-start\">\n {description && (\n <FormFieldMessage className=\"default:sr-only\">{description}</FormFieldMessage>\n )}\n <span\n ref={ref}\n aria-hidden\n data-spark-component=\"form-field-characters-count\"\n className={cx(className, 'text-caption', 'text-neutral')}\n {...others}\n >\n {`${value.length}/${maxLength}`}\n </span>\n\n {liveAnnouncement && (\n <span className=\"sr-only\" aria-live=\"polite\">\n {liveAnnouncement({ remainingChars: maxLength - throttledValue.length })}\n </span>\n )}\n </span>\n )\n}\n\nFormFieldCharactersCount.displayName = 'FormField.CharactersCount'\n","import { ReactNode, useContext } from 'react'\n\nimport { FormFieldContext, FormFieldContextState } from './FormFieldContext'\n\ntype State = Partial<\n Pick<\n FormFieldContextState,\n | 'id'\n | 'name'\n | 'description'\n | 'labelId'\n | 'disabled'\n | 'readOnly'\n | 'state'\n | 'isInvalid'\n | 'isRequired'\n >\n>\n\nexport interface FormFieldControlProps {\n children: (state: State) => ReactNode\n}\n\nexport const useFormFieldControl = () => {\n const { id, name, description, disabled, readOnly, state, labelId, isInvalid, isRequired } =\n useContext(FormFieldContext) || {}\n\n return {\n id,\n name,\n description,\n disabled,\n readOnly,\n state,\n labelId,\n isInvalid,\n isRequired,\n } as State\n}\n\nexport const FormFieldControl = ({ children }: FormFieldControlProps) => {\n const props = useFormFieldControl()\n\n return <>{children(props)}</>\n}\n\nFormFieldControl.displayName = 'FormField.Control'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldErrorMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldErrorMessage = ({ ref, ...props }: FormFieldErrorMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-error-message\"\n state=\"error\"\n {...props}\n />\n )\n}\n\nFormFieldErrorMessage.displayName = 'FormField.ErrorMessage'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { FormFieldMessage, FormFieldMessageProps } from './FormFieldMessage'\n\nexport type FormFieldHelperMessageProps = FormFieldMessageProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldHelperMessage = ({\n className,\n ref,\n ...others\n}: FormFieldHelperMessageProps) => {\n return (\n <FormFieldMessage\n ref={ref}\n data-spark-component=\"form-field-helper-message\"\n className={cx('text-on-surface/dim-1', className)}\n {...others}\n />\n )\n}\n\nFormFieldHelperMessage.displayName = 'FormField.HelperMessage'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Label, LabelRequiredIndicatorProps } from '../label'\n\nexport type FormFieldRequiredIndicatorProps = LabelRequiredIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldRequiredIndicator = ({\n className,\n ref,\n ...props\n}: FormFieldRequiredIndicatorProps) => {\n return <Label.RequiredIndicator ref={ref} className={cx('ml-sm', className)} {...props} />\n}\n\nFormFieldRequiredIndicator.displayName = 'FormField.RequiredIndicator'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { Label, LabelProps } from '../label'\nimport { Slottable } from '../slot'\nimport { useFormField } from './FormFieldContext'\nimport { FormFieldRequiredIndicator } from './FormFieldRequiredIndicator'\n\nexport interface FormFieldLabelProps extends LabelProps {\n /**\n * Element shown when the input is required inside the label.\n */\n requiredIndicator?: ReactNode\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const FormFieldLabel = ({\n htmlFor: htmlForProp,\n className,\n children,\n requiredIndicator = <FormFieldRequiredIndicator />,\n asChild,\n ref,\n ...others\n}: FormFieldLabelProps) => {\n const control = useFormField()\n\n const { disabled, labelId, isRequired } = control\n const htmlFor = asChild ? undefined : htmlForProp || control.id\n\n return (\n <Label\n ref={ref}\n id={labelId}\n data-spark-component=\"form-field-label\"\n htmlFor={htmlFor}\n className={cx(className, disabled ? 'text-on-surface/dim-3 pointer-events-none' : undefined)}\n asChild={asChild}\n {...others}\n >\n <>\n <Slottable>{children}</Slottable>\n {isRequired && requiredIndicator}\n </>\n </Label>\n )\n}\n\nFormFieldLabel.displayName = 'FormField.Label'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldSuccessMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldSuccessMessage = ({ ref, ...props }: FormFieldSuccessMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-success-message\"\n state=\"success\"\n {...props}\n />\n )\n}\n\nFormFieldSuccessMessage.displayName = 'FormField.SuccessMessage'\n","import { FormField as Root } from './FormField'\nimport { FormFieldAlertMessage } from './FormFieldAlertMessage'\nimport { FormFieldCharactersCount } from './FormFieldCharactersCount'\nimport { FormFieldControl } from './FormFieldControl'\nimport { FormFieldErrorMessage } from './FormFieldErrorMessage'\nimport { FormFieldHelperMessage } from './FormFieldHelperMessage'\nimport { FormFieldLabel } from './FormFieldLabel'\nimport { FormFieldRequiredIndicator } from './FormFieldRequiredIndicator'\nimport { FormFieldStateMessage } from './FormFieldStateMessage'\nimport { FormFieldSuccessMessage } from './FormFieldSuccessMessage'\n\nexport const FormField: typeof Root & {\n Label: typeof FormFieldLabel\n Control: typeof FormFieldControl\n StateMessage: typeof FormFieldStateMessage\n SuccessMessage: typeof FormFieldSuccessMessage\n AlertMessage: typeof FormFieldAlertMessage\n ErrorMessage: typeof FormFieldErrorMessage\n HelperMessage: typeof FormFieldHelperMessage\n RequiredIndicator: typeof FormFieldRequiredIndicator\n CharactersCount: typeof FormFieldCharactersCount\n} = Object.assign(Root, {\n Label: FormFieldLabel,\n Control: FormFieldControl,\n StateMessage: FormFieldStateMessage,\n SuccessMessage: FormFieldSuccessMessage,\n AlertMessage: FormFieldAlertMessage,\n ErrorMessage: FormFieldErrorMessage,\n HelperMessage: FormFieldHelperMessage,\n RequiredIndicator: FormFieldRequiredIndicator,\n CharactersCount: FormFieldCharactersCount,\n})\n\nFormField.displayName = 'FormField'\nFormFieldLabel.displayName = 'FormField.Label'\nFormFieldControl.displayName = 'FormField.Control'\nFormFieldStateMessage.displayName = 'FormField.StateMessage'\nFormFieldSuccessMessage.displayName = 'FormField.SuccessMessage'\nFormFieldAlertMessage.displayName = 'FormField.AlertMessage'\nFormFieldErrorMessage.displayName = 'FormField.ErrorMessage'\nFormFieldHelperMessage.displayName = 'FormField.HelperMessage'\nFormFieldRequiredIndicator.displayName = 'FormField.RequiredIndicator'\nFormFieldCharactersCount.displayName = 'FormField.CharactersCount'\n\nexport { type FormFieldProps } from './FormField'\nexport { type FormFieldStateMessageProps } from './FormFieldStateMessage'\nexport { type FormFieldControl, useFormFieldControl } from './FormFieldControl'\nexport { type FormFieldHelperMessageProps } from './FormFieldHelperMessage'\nexport { type FormFieldSuccessMessageProps } from './FormFieldSuccessMessage'\nexport { type FormFieldAlertMessageProps } from './FormFieldAlertMessage'\nexport { type FormFieldErrorMessageProps } from './FormFieldErrorMessage'\nexport { type FormFieldLabelProps } from './FormFieldLabel'\nexport { type FormFieldRequiredIndicatorProps } from './FormFieldRequiredIndicator'\nexport { type FormFieldCharactersCountProps } from './FormFieldCharactersCount'\n"],"names":["FormFieldContext","createContext","ID_PREFIX","useFormField","context","useContext","FormFieldProvider","id","name","disabled","readOnly","state","isRequired","children","labelId","useId","messageIds","setMessageIds","useState","description","handleMessageIdAdd","useCallback","msgId","ids","handleMessageIdRemove","current","value","useMemo","jsx","FormField","className","asChild","ref","others","Component","Slot","cx","FormFieldMessage","idProp","onMessageIdAdd","onMessageIdRemove","currentId","useEffect","FormFieldStateMessage","jsxs","Icon","WarningOutline","AlertOutline","Check","FormFieldAlertMessage","props","FormFieldCharactersCount","maxLength","liveAnnouncement","throttledValue","setThrottledValue","timeoutId","useFormFieldControl","isInvalid","FormFieldControl","Fragment","FormFieldErrorMessage","FormFieldHelperMessage","FormFieldRequiredIndicator","Label","FormFieldLabel","htmlForProp","requiredIndicator","control","htmlFor","Slottable","FormFieldSuccessMessage","Root"],"mappings":"wYAiDaA,EAAmBC,EAAAA,cAA4C,IAAI,EAEnEC,EAAY,cAEZC,EAAe,IAAM,CAChC,MAAMC,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createContext as W, useContext as
|
|
4
|
-
import { a as _, S as B } from "../Slot-
|
|
1
|
+
import { jsx as r, jsxs as I, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { cx as c } from "class-variance-authority";
|
|
3
|
+
import { createContext as W, useContext as L, useId as y, useState as P, useCallback as j, useMemo as X, useEffect as z } from "react";
|
|
4
|
+
import { a as _, S as B } from "../Slot-D2Bbf8Gw.mjs";
|
|
5
5
|
import { AlertOutline as G } from "@spark-ui/icons/AlertOutline";
|
|
6
6
|
import { Check as J } from "@spark-ui/icons/Check";
|
|
7
7
|
import { WarningOutline as K } from "@spark-ui/icons/WarningOutline";
|
|
8
|
-
import { I as M } from "../Icon-
|
|
9
|
-
import {
|
|
8
|
+
import { I as M } from "../Icon-Ck-dhfLd.mjs";
|
|
9
|
+
import { Label as O } from "../label/index.mjs";
|
|
10
10
|
const C = W(null), x = ":form-field", b = () => {
|
|
11
|
-
const s =
|
|
11
|
+
const s = L(C);
|
|
12
12
|
if (!s)
|
|
13
13
|
throw Error("useFormField must be used within a FormField provider");
|
|
14
14
|
return s;
|
|
15
15
|
}, T = ({
|
|
16
16
|
id: s,
|
|
17
17
|
name: e,
|
|
18
|
-
disabled:
|
|
18
|
+
disabled: o = !1,
|
|
19
19
|
readOnly: l = !1,
|
|
20
|
-
state:
|
|
20
|
+
state: a,
|
|
21
21
|
isRequired: i,
|
|
22
22
|
children: d
|
|
23
23
|
}) => {
|
|
24
|
-
const t = `${x}-label-${y()}`, [n, m] = P([]), p = n.length > 0 ? n.join(" ") : void 0, u =
|
|
24
|
+
const t = `${x}-label-${y()}`, [n, m] = P([]), p = n.length > 0 ? n.join(" ") : void 0, u = j((f) => {
|
|
25
25
|
m((h) => [...h, f]);
|
|
26
|
-
}, []), q =
|
|
26
|
+
}, []), q = j((f) => {
|
|
27
27
|
m((h) => h.filter((D) => D !== f));
|
|
28
28
|
}, []), V = X(() => ({
|
|
29
29
|
id: s,
|
|
30
30
|
labelId: t,
|
|
31
31
|
name: e,
|
|
32
|
-
disabled:
|
|
32
|
+
disabled: o,
|
|
33
33
|
readOnly: l,
|
|
34
|
-
state:
|
|
34
|
+
state: a,
|
|
35
35
|
isRequired: i,
|
|
36
|
-
isInvalid:
|
|
36
|
+
isInvalid: a === "error",
|
|
37
37
|
description: p,
|
|
38
38
|
onMessageIdAdd: u,
|
|
39
39
|
onMessageIdRemove: q
|
|
@@ -41,10 +41,10 @@ const C = W(null), x = ":form-field", b = () => {
|
|
|
41
41
|
s,
|
|
42
42
|
t,
|
|
43
43
|
e,
|
|
44
|
-
|
|
44
|
+
o,
|
|
45
45
|
l,
|
|
46
46
|
p,
|
|
47
|
-
|
|
47
|
+
a,
|
|
48
48
|
i,
|
|
49
49
|
u,
|
|
50
50
|
q
|
|
@@ -55,9 +55,9 @@ T.displayName = "FormFieldProvider";
|
|
|
55
55
|
const w = ({
|
|
56
56
|
className: s,
|
|
57
57
|
disabled: e = !1,
|
|
58
|
-
readOnly:
|
|
58
|
+
readOnly: o = !1,
|
|
59
59
|
name: l,
|
|
60
|
-
state:
|
|
60
|
+
state: a,
|
|
61
61
|
isRequired: i = !1,
|
|
62
62
|
asChild: d = !1,
|
|
63
63
|
ref: t,
|
|
@@ -71,8 +71,8 @@ const w = ({
|
|
|
71
71
|
name: l,
|
|
72
72
|
isRequired: i,
|
|
73
73
|
disabled: e,
|
|
74
|
-
readOnly:
|
|
75
|
-
state:
|
|
74
|
+
readOnly: o,
|
|
75
|
+
state: a,
|
|
76
76
|
children: /* @__PURE__ */ r(
|
|
77
77
|
d ? _ : "div",
|
|
78
78
|
{
|
|
@@ -89,16 +89,16 @@ w.displayName = "FormField";
|
|
|
89
89
|
const g = ({
|
|
90
90
|
id: s,
|
|
91
91
|
className: e,
|
|
92
|
-
ref:
|
|
92
|
+
ref: o,
|
|
93
93
|
...l
|
|
94
94
|
}) => {
|
|
95
|
-
const { onMessageIdAdd:
|
|
96
|
-
return z(() => (
|
|
95
|
+
const { onMessageIdAdd: a, onMessageIdRemove: i } = b(), d = `${x}-message-${y()}`, t = s || d;
|
|
96
|
+
return z(() => (a(t), () => {
|
|
97
97
|
i(t);
|
|
98
|
-
}), [t,
|
|
98
|
+
}), [t, a, i]), /* @__PURE__ */ r(
|
|
99
99
|
"span",
|
|
100
100
|
{
|
|
101
|
-
ref:
|
|
101
|
+
ref: o,
|
|
102
102
|
id: t,
|
|
103
103
|
"data-spark-component": "form-field-message",
|
|
104
104
|
className: c(e, "text-caption"),
|
|
@@ -110,9 +110,9 @@ g.displayName = "FormField.Message";
|
|
|
110
110
|
const F = ({
|
|
111
111
|
className: s,
|
|
112
112
|
state: e,
|
|
113
|
-
children:
|
|
113
|
+
children: o,
|
|
114
114
|
ref: l,
|
|
115
|
-
...
|
|
115
|
+
...a
|
|
116
116
|
}) => b().state !== e ? null : /* @__PURE__ */ I(
|
|
117
117
|
g,
|
|
118
118
|
{
|
|
@@ -123,12 +123,12 @@ const F = ({
|
|
|
123
123
|
e === "error" ? "text-error" : "text-on-surface/dim-1",
|
|
124
124
|
s
|
|
125
125
|
),
|
|
126
|
-
...
|
|
126
|
+
...a,
|
|
127
127
|
children: [
|
|
128
128
|
e === "alert" && /* @__PURE__ */ r(M, { size: "sm", children: /* @__PURE__ */ r(K, {}) }),
|
|
129
129
|
e === "error" && /* @__PURE__ */ r(M, { size: "sm", intent: "error", children: /* @__PURE__ */ r(G, {}) }),
|
|
130
130
|
e === "success" && /* @__PURE__ */ r(M, { size: "sm", children: /* @__PURE__ */ r(J, {}) }),
|
|
131
|
-
|
|
131
|
+
o
|
|
132
132
|
]
|
|
133
133
|
}
|
|
134
134
|
);
|
|
@@ -146,9 +146,9 @@ v.displayName = "FormField.AlertMessage";
|
|
|
146
146
|
const S = ({
|
|
147
147
|
className: s,
|
|
148
148
|
value: e = "",
|
|
149
|
-
maxLength:
|
|
149
|
+
maxLength: o,
|
|
150
150
|
description: l,
|
|
151
|
-
liveAnnouncement:
|
|
151
|
+
liveAnnouncement: a,
|
|
152
152
|
ref: i,
|
|
153
153
|
...d
|
|
154
154
|
}) => {
|
|
@@ -168,21 +168,21 @@ const S = ({
|
|
|
168
168
|
"data-spark-component": "form-field-characters-count",
|
|
169
169
|
className: c(s, "text-caption", "text-neutral"),
|
|
170
170
|
...d,
|
|
171
|
-
children: `${e.length}/${
|
|
171
|
+
children: `${e.length}/${o}`
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
|
|
174
|
+
a && /* @__PURE__ */ r("span", { className: "sr-only", "aria-live": "polite", children: a({ remainingChars: o - t.length }) })
|
|
175
175
|
] });
|
|
176
176
|
};
|
|
177
177
|
S.displayName = "FormField.CharactersCount";
|
|
178
178
|
const Q = () => {
|
|
179
|
-
const { id: s, name: e, description:
|
|
179
|
+
const { id: s, name: e, description: o, disabled: l, readOnly: a, state: i, labelId: d, isInvalid: t, isRequired: n } = L(C) || {};
|
|
180
180
|
return {
|
|
181
181
|
id: s,
|
|
182
182
|
name: e,
|
|
183
|
-
description:
|
|
183
|
+
description: o,
|
|
184
184
|
disabled: l,
|
|
185
|
-
readOnly:
|
|
185
|
+
readOnly: a,
|
|
186
186
|
state: i,
|
|
187
187
|
labelId: d,
|
|
188
188
|
isInvalid: t,
|
|
@@ -190,7 +190,7 @@ const Q = () => {
|
|
|
190
190
|
};
|
|
191
191
|
}, k = ({ children: s }) => {
|
|
192
192
|
const e = Q();
|
|
193
|
-
return /* @__PURE__ */ r(
|
|
193
|
+
return /* @__PURE__ */ r(H, { children: s(e) });
|
|
194
194
|
};
|
|
195
195
|
k.displayName = "FormField.Control";
|
|
196
196
|
const R = ({ ref: s, ...e }) => /* @__PURE__ */ r(
|
|
@@ -206,33 +206,33 @@ R.displayName = "FormField.ErrorMessage";
|
|
|
206
206
|
const $ = ({
|
|
207
207
|
className: s,
|
|
208
208
|
ref: e,
|
|
209
|
-
...
|
|
209
|
+
...o
|
|
210
210
|
}) => /* @__PURE__ */ r(
|
|
211
211
|
g,
|
|
212
212
|
{
|
|
213
213
|
ref: e,
|
|
214
214
|
"data-spark-component": "form-field-helper-message",
|
|
215
215
|
className: c("text-on-surface/dim-1", s),
|
|
216
|
-
...
|
|
216
|
+
...o
|
|
217
217
|
}
|
|
218
218
|
);
|
|
219
219
|
$.displayName = "FormField.HelperMessage";
|
|
220
220
|
const N = ({
|
|
221
221
|
className: s,
|
|
222
222
|
ref: e,
|
|
223
|
-
...
|
|
224
|
-
}) => /* @__PURE__ */ r(O.RequiredIndicator, { ref: e, className: c("ml-sm", s), ...
|
|
223
|
+
...o
|
|
224
|
+
}) => /* @__PURE__ */ r(O.RequiredIndicator, { ref: e, className: c("ml-sm", s), ...o });
|
|
225
225
|
N.displayName = "FormField.RequiredIndicator";
|
|
226
226
|
const A = ({
|
|
227
227
|
htmlFor: s,
|
|
228
228
|
className: e,
|
|
229
|
-
children:
|
|
229
|
+
children: o,
|
|
230
230
|
requiredIndicator: l = /* @__PURE__ */ r(N, {}),
|
|
231
|
-
asChild:
|
|
231
|
+
asChild: a,
|
|
232
232
|
ref: i,
|
|
233
233
|
...d
|
|
234
234
|
}) => {
|
|
235
|
-
const t = b(), { disabled: n, labelId: m, isRequired: p } = t, u =
|
|
235
|
+
const t = b(), { disabled: n, labelId: m, isRequired: p } = t, u = a ? void 0 : s || t.id;
|
|
236
236
|
return /* @__PURE__ */ r(
|
|
237
237
|
O,
|
|
238
238
|
{
|
|
@@ -241,10 +241,10 @@ const A = ({
|
|
|
241
241
|
"data-spark-component": "form-field-label",
|
|
242
242
|
htmlFor: u,
|
|
243
243
|
className: c(e, n ? "text-on-surface/dim-3 pointer-events-none" : void 0),
|
|
244
|
-
asChild:
|
|
244
|
+
asChild: a,
|
|
245
245
|
...d,
|
|
246
|
-
children: /* @__PURE__ */ I(
|
|
247
|
-
/* @__PURE__ */ r(B, { children:
|
|
246
|
+
children: /* @__PURE__ */ I(H, { children: [
|
|
247
|
+
/* @__PURE__ */ r(B, { children: o }),
|
|
248
248
|
p && l
|
|
249
249
|
] })
|
|
250
250
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Icon';
|
package/dist/icon/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Icon-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Icon-CF0W0LKr.js");exports.Icon=e.Icon;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/icon/index.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './IconButton';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../IconButton-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../IconButton-D3g86WpZ.js");exports.IconButton=t.IconButton;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InputClearButton } from './InputClearButton';
|
|
2
|
+
import { InputGroup as Root } from './InputGroup';
|
|
3
|
+
import { InputLeadingAddon } from './InputLeadingAddon';
|
|
4
|
+
import { InputLeadingIcon } from './InputLeadingIcon';
|
|
5
|
+
import { InputTrailingAddon } from './InputTrailingAddon';
|
|
6
|
+
import { InputTrailingIcon } from './InputTrailingIcon';
|
|
7
|
+
export * from './Input';
|
|
8
|
+
export declare const InputGroup: typeof Root & {
|
|
9
|
+
LeadingAddon: typeof InputLeadingAddon;
|
|
10
|
+
TrailingAddon: typeof InputTrailingAddon;
|
|
11
|
+
LeadingIcon: typeof InputLeadingIcon;
|
|
12
|
+
TrailingIcon: typeof InputTrailingIcon;
|
|
13
|
+
ClearButton: typeof InputClearButton;
|
|
14
|
+
};
|
|
15
|
+
export { useInputGroup } from './InputGroupContext';
|
|
16
|
+
export { type InputGroupProps } from './InputGroup';
|
|
17
|
+
export { type InputLeadingIconProps } from './InputLeadingIcon';
|
|
18
|
+
export { type InputTrailingIconProps } from './InputTrailingIcon';
|
|
19
|
+
export { type InputLeadingAddonProps } from './InputLeadingAddon';
|
|
20
|
+
export { type InputTrailingAddonProps } from './InputTrailingAddon';
|
|
21
|
+
export { type InputClearButtonProps } from './InputClearButton';
|
package/dist/input/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),re=require("@spark-ui/icons/DeleteOutline"),u=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),re=require("@spark-ui/icons/DeleteOutline"),u=require("class-variance-authority"),_=require("../Icon-CF0W0LKr.js"),d=require("react"),$=require("@spark-ui/components/form-field"),oe=require("@spark-ui/hooks/use-combined-state"),le=require("@spark-ui/hooks/use-merge-refs"),P=require("../Slot-DQ8z2zsy.js"),K=d.createContext(null),v=()=>d.useContext(K)||{isStandalone:!0},H=({className:n,tabIndex:e=-1,onClick:t,inline:o=!1,ref:l,...s})=>{const{onClear:i,hasTrailingIcon:b}=v(),c=a=>{t&&t(a),i&&i()};return r.jsx("button",{ref:l,"data-spark-component":"input-clear-button",className:u.cx(n,"pointer-events-auto absolute",o?"h-sz-44 top-0 -translate-y-0":"top-1/2 -translate-y-1/2","inline-flex h-full items-center justify-center outline-hidden","text-neutral hover:text-neutral-hovered",b?"right-3xl px-sz-12":"pl-md pr-lg right-0"),tabIndex:e,onClick:c,type:"button",...s,children:r.jsx(_.Icon,{size:"sm",children:r.jsx(re.DeleteOutline,{})})})},J=Object.assign(H,{id:"ClearButton"});H.displayName="InputGroup.ClearButton";const ie=u.cva(["relative inline-flex w-full"],{variants:{disabled:{true:["cursor-not-allowed","relative","after:absolute","after:top-0","after:h-full","after:w-full","after:border-sm after:border-outline","after:rounded-lg"],false:"after:hidden"},readOnly:{true:["relative","after:absolute","after:top-0","after:h-full","after:w-full","after:border-sm after:border-outline","after:rounded-lg"],false:"after:hidden"}}}),Q=({className:n,children:e,state:t,disabled:o,readOnly:l,onClear:s,ref:i,...b})=>{const c=y=>y?y.type.id:"",a=(...y)=>f.find(se=>y.includes(c(se)||"")),f=d.Children.toArray(e).filter(d.isValidElement),g=a("Input"),h=g?.props||{},I=d.useRef(null),C=d.useRef(s),S=le.useMergeRefs(g?.ref,I),[j,A]=oe.useCombinedState(h.value,h.defaultValue,h.onValueChange),N=$.useFormFieldControl(),O=N.state??t,m=N.disabled||!!o,x=N.readOnly||!!l,G=a("LeadingAddon"),L=a("LeadingIcon"),B=a("ClearButton"),R=a("TrailingIcon"),w=a("TrailingAddon"),T=!!G,p=!!w,D=!!L,F=!!R,V=!!j&&!!B&&!m&&!x,ne=y=>{h.onChange&&h.onChange(y),A(y.target.value)},M=d.useCallback(()=>{C.current&&C.current(),A(""),I.current.focus()},[A]),te=d.useMemo(()=>({state:O,disabled:m,readOnly:x,hasLeadingIcon:D,hasTrailingIcon:F,hasLeadingAddon:T,hasTrailingAddon:p,hasClearButton:V,onClear:M}),[O,m,x,D,F,T,p,V,M]);d.useEffect(()=>{C.current=s},[s]);const ae=I.current?.value;return r.jsx(K.Provider,{value:te,children:r.jsxs("div",{"data-spark-component":"input-group",ref:i,className:ie({disabled:m,readOnly:x,className:n}),...b,children:[T&&G,r.jsxs("div",{className:"relative inline-flex w-full",children:[g&&d.cloneElement(g,{value:j??ae??"",ref:S,defaultValue:void 0,onChange:ne}),L,V&&B,R]}),p&&w]})})};Q.displayName="InputGroup";const de=u.cva(["overflow-hidden","border-sm","shrink-0","h-full","focus-visible:relative focus-visible:z-raised","mx-0"],{variants:{asChild:{false:["flex","items-center","px-lg"]},intent:{neutral:"border-outline",error:"border-error",alert:"border-alert",success:"border-success"},disabled:{true:["pointer-events-none border-outline!"]},readOnly:{true:["pointer-events-none"]},design:{text:"",solid:"",inline:""}},compoundVariants:[{disabled:!1,readOnly:!1,design:"text",class:["bg-surface","text-on-surface"]},{disabled:!0,design:"text",class:["text-on-surface/dim-3"]},{disabled:!0,design:["solid","inline"],class:["opacity-dim-3"]}],defaultVariants:{intent:"neutral"}}),z=({asChild:n,className:e,children:t,ref:o,...l})=>{const{state:s,disabled:i,readOnly:b}=v(),c=typeof t=="string",a=!!(!c&&n),f=c?t:d.Children.only(t),g=a&&!c?P.Slot:"div",I=c?"text":a?"solid":"inline";return r.jsx(g,{ref:o,"data-spark-component":"input-addon",className:de({className:e,intent:s,disabled:i,readOnly:b,asChild:a,design:I}),...i&&{tabIndex:-1},...l,children:f})};z.displayName="InputGroup.Addon";const U=({className:n,ref:e,...t})=>{const{disabled:o,readOnly:l}=v(),s=o||l;return r.jsx("div",{className:u.cx("rounded-l-lg",s?"bg-on-surface/dim-5":null),children:r.jsx(z,{ref:e,className:u.cx(n,"rounded-r-0! mr-[-1px] rounded-l-lg"),...t})})},W=Object.assign(U,{id:"LeadingAddon"});U.displayName="InputGroup.LeadingAddon";const E=({className:n,intent:e,children:t,...o})=>{const{disabled:l,readOnly:s}=v(),i=l||s;return r.jsx(_.Icon,{"data-spark-component":"input-icon",intent:e,className:u.cx(n,"pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2",e?void 0:"text-neutral peer-focus:text-outline-high",i?"opacity-dim-3":void 0),...o,children:t})};E.displayName="InputGroup.Icon";const k=({className:n,...e})=>r.jsx(E,{className:u.cx(n,"left-lg text-body-1"),...e});k.id="LeadingIcon";k.displayName="InputGroup.LeadingIcon";const X=({className:n,ref:e,...t})=>{const{disabled:o,readOnly:l}=v(),s=o||l;return r.jsx("div",{className:u.cx("rounded-r-lg",s?"bg-on-surface/dim-5":null),children:r.jsx(z,{ref:e,className:u.cx(n,"rounded-l-0! ml-[-1px] rounded-r-lg"),...t})})},Y=Object.assign(X,{id:"TrailingAddon"});X.displayName="InputGroup.TrailingAddon";const q=({className:n,...e})=>r.jsx(E,{className:u.cx(n,"right-lg text-body-1"),...e});q.id="TrailingIcon";q.displayName="InputGroup.TrailingIcon";const ue=u.cva(["relative","border-sm","peer","w-full","appearance-none outline-hidden","bg-surface","text-ellipsis text-body-1 text-on-surface","caret-neutral","[&:-webkit-autofill]:[-webkit-text-fill-color:var(--color-on-surface)]","autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]","disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3","read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5","focus:ring-1 focus:ring-inset focus:ring-focus focus:border-focus"],{variants:{asChild:{true:["min-h-sz-44"],false:["h-sz-44"]},intent:{neutral:["border-outline","default:hover:border-outline-high"],success:["default:border-success"],alert:["default:border-alert"],error:["default:border-error"]},hasLeadingAddon:{true:["rounded-l-0"],false:["rounded-l-lg"]},hasTrailingAddon:{true:["rounded-r-0"],false:["rounded-r-lg"]},hasLeadingIcon:{true:["pl-3xl"],false:["pl-lg"]},hasTrailingIcon:{true:""},hasClearButton:{true:""}},compoundVariants:[{hasTrailingIcon:!1,hasClearButton:!1,class:"pr-lg"},{hasTrailingIcon:!0,hasClearButton:!1,class:"pr-3xl"},{hasTrailingIcon:!1,hasClearButton:!0,class:"pr-3xl"},{hasTrailingIcon:!0,hasClearButton:!0,class:"pr-[calc(var(--spacing-3xl)*2)]"}],defaultVariants:{intent:"neutral"}}),Z=({className:n,asChild:e=!1,onValueChange:t,onChange:o,onKeyDown:l,disabled:s,readOnly:i,ref:b,...c})=>{const a=$.useFormFieldControl(),f=v(),{id:g,name:h,isInvalid:I,isRequired:C,description:S}=a,{hasLeadingAddon:j,hasTrailingAddon:A,hasLeadingIcon:N,hasTrailingIcon:O,hasClearButton:m,onClear:x}=f,G=e?P.Slot:"input",L=a.state||f.state,B=a.disabled||f.disabled||s,R=a.readOnly||f.readOnly||i,w=p=>{o&&o(p),t&&t(p.target.value)},T=p=>{l&&l(p),m&&x&&p.key==="Escape"&&x()};return r.jsx(G,{"data-spark-component":"input",ref:b,id:g,name:h,className:ue({asChild:e,className:n,intent:L,hasLeadingAddon:!!j,hasTrailingAddon:!!A,hasLeadingIcon:!!N,hasTrailingIcon:!!O,hasClearButton:!!m}),disabled:B,readOnly:R,required:C,"aria-describedby":S,"aria-invalid":I,onChange:w,onKeyDown:T,...c})},ce=Object.assign(Z,{id:"Input"});Z.displayName="Input";const ee=Object.assign(Q,{LeadingAddon:W,TrailingAddon:Y,LeadingIcon:k,TrailingIcon:q,ClearButton:J});ee.displayName="InputGroup";W.displayName="InputGroup.LeadingAddon";Y.displayName="InputGroup.TrailingAddon";k.displayName="InputGroup.LeadingIcon";q.displayName="InputGroup.TrailingIcon";J.displayName="InputGroup.ClearButton";exports.Input=ce;exports.InputGroup=ee;exports.useInputGroup=v;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|