@constructive-io/ui 0.4.1 → 0.6.1
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/LICENSE +21 -0
- package/README.md +17 -22
- package/dist/button-D4vqTxhp.d.cts +20 -0
- package/dist/button-D4vqTxhp.d.ts +20 -0
- package/dist/components/alert-dialog.cjs +129 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +33 -0
- package/dist/components/alert-dialog.d.ts +23 -21
- package/dist/components/alert-dialog.js +98 -296
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +62 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +19 -0
- package/dist/components/alert.d.ts +18 -13
- package/dist/components/alert.js +49 -31
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +81 -0
- package/dist/components/app-bar.cjs.map +1 -0
- package/dist/components/app-bar.d.cts +27 -0
- package/dist/components/app-bar.d.ts +27 -0
- package/dist/components/app-bar.js +77 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-shell.cjs +267 -0
- package/dist/components/app-shell.cjs.map +1 -0
- package/dist/components/app-shell.d.cts +98 -0
- package/dist/components/app-shell.d.ts +98 -0
- package/dist/components/app-shell.js +264 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.cjs +167 -0
- package/dist/components/autocomplete.cjs.map +1 -0
- package/dist/components/autocomplete.d.cts +28 -0
- package/dist/components/autocomplete.d.ts +24 -24
- package/dist/components/autocomplete.js +146 -397
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +39 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +13 -0
- package/dist/components/avatar.d.ts +11 -11
- package/dist/components/avatar.js +24 -27
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +48 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +15 -0
- package/dist/components/badge.d.ts +13 -13
- package/dist/components/badge.js +39 -38
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +89 -0
- package/dist/components/breadcrumb.cjs.map +1 -0
- package/dist/components/breadcrumb.d.cts +15 -0
- package/dist/components/breadcrumb.d.ts +14 -13
- package/dist/components/breadcrumb.js +63 -137
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +75 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +2 -0
- package/dist/components/button.d.ts +2 -17
- package/dist/components/button.js +66 -57
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +72 -0
- package/dist/components/calendar-rac.cjs.map +1 -0
- package/dist/components/calendar-rac.d.cts +13 -0
- package/dist/components/calendar-rac.d.ts +8 -8
- package/dist/components/calendar-rac.js +49 -61
- package/dist/components/calendar-rac.js.map +1 -1
- package/dist/components/card.cjs +86 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +17 -0
- package/dist/components/card.d.ts +15 -17
- package/dist/components/card.js +58 -57
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +19 -0
- package/dist/components/checkbox-group.cjs.map +1 -0
- package/dist/components/checkbox-group.d.cts +7 -0
- package/dist/components/checkbox-group.d.ts +5 -5
- package/dist/components/checkbox-group.js +12 -10
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.cjs +67 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +8 -0
- package/dist/components/checkbox.d.ts +6 -6
- package/dist/components/checkbox.js +58 -61
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +90 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +45 -0
- package/dist/components/collapsible.d.ts +19 -28
- package/dist/components/collapsible.js +74 -112
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +257 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +44 -0
- package/dist/components/combobox.d.ts +36 -36
- package/dist/components/combobox.js +229 -515
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +139 -0
- package/dist/components/command.cjs.map +1 -0
- package/dist/components/command.d.cts +24 -0
- package/dist/components/command.d.ts +22 -22
- package/dist/components/command.js +109 -240
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +139 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +31 -0
- package/dist/components/dialog.d.ts +27 -31
- package/dist/components/dialog.js +112 -429
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +90 -0
- package/dist/components/dock.cjs.map +1 -0
- package/dist/components/dock.d.cts +30 -0
- package/dist/components/dock.d.ts +25 -26
- package/dist/components/dock.js +78 -104
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +115 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +16 -0
- package/dist/components/drawer.d.ts +15 -15
- package/dist/components/drawer.js +77 -121
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +217 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +53 -0
- package/dist/components/dropdown-menu.d.ts +49 -46
- package/dist/components/dropdown-menu.js +177 -357
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +72 -0
- package/dist/components/empty.cjs.map +1 -0
- package/dist/components/empty.d.cts +15 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +64 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.cjs +186 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +46 -0
- package/dist/components/field.d.ts +44 -49
- package/dist/components/field.js +166 -108
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +153 -0
- package/dist/components/flickering-grid.cjs.map +1 -0
- package/dist/components/flickering-grid.d.cts +16 -0
- package/dist/components/flickering-grid.d.ts +14 -13
- package/dist/components/flickering-grid.js +144 -141
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +62 -0
- package/dist/components/flow-zoom-panel.cjs.map +1 -0
- package/dist/components/flow-zoom-panel.d.cts +12 -0
- package/dist/components/flow-zoom-panel.d.ts +12 -0
- package/dist/components/flow-zoom-panel.js +61 -0
- package/dist/components/flow-zoom-panel.js.map +1 -0
- package/dist/components/form-control.cjs +65 -0
- package/dist/components/form-control.cjs.map +1 -0
- package/dist/components/form-control.d.cts +15 -0
- package/dist/components/form-control.d.ts +11 -11
- package/dist/components/form-control.js +56 -167
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +102 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +2 -0
- package/dist/components/form.d.ts +2 -37
- package/dist/components/form.js +76 -163
- package/dist/components/form.js.map +1 -1
- package/dist/components/input-group.cjs +70 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +16 -0
- package/dist/components/input-group.d.ts +14 -16
- package/dist/components/input-group.js +51 -163
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +37 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +2 -0
- package/dist/components/input.d.ts +2 -11
- package/dist/components/input.js +30 -54
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +147 -0
- package/dist/components/json-input.cjs.map +1 -0
- package/dist/components/json-input.d.cts +26 -0
- package/dist/components/json-input.d.ts +20 -19
- package/dist/components/json-input.js +132 -340
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +27 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +11 -0
- package/dist/components/label.d.ts +6 -6
- package/dist/components/label.js +17 -20
- package/dist/components/label.js.map +1 -1
- package/dist/components/motion-grid.cjs +68 -0
- package/dist/components/motion-grid.cjs.map +1 -0
- package/dist/components/motion-grid.d.cts +20 -0
- package/dist/components/motion-grid.d.ts +15 -15
- package/dist/components/motion-grid.js +59 -75
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +573 -0
- package/dist/components/multi-select.cjs.map +1 -0
- package/dist/components/multi-select.d.cts +198 -0
- package/dist/components/multi-select.d.ts +173 -173
- package/dist/components/multi-select.js +562 -874
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +30 -0
- package/dist/components/page-header.cjs.map +1 -0
- package/dist/components/page-header.d.cts +17 -0
- package/dist/components/page-header.d.ts +11 -11
- package/dist/components/page-header.js +23 -11
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.cjs +95 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +17 -0
- package/dist/components/pagination.d.ts +15 -17
- package/dist/components/pagination.js +70 -128
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +97 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +40 -0
- package/dist/components/popover.d.ts +33 -28
- package/dist/components/popover.js +78 -178
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +156 -0
- package/dist/components/portal.cjs.map +1 -0
- package/dist/components/portal.d.cts +118 -0
- package/dist/components/portal.d.ts +33 -23
- package/dist/components/portal.js +128 -57
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +30 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +10 -0
- package/dist/components/progress.d.ts +8 -8
- package/dist/components/progress.js +21 -24
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +76 -0
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.cts +25 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +19 -19
- package/dist/components/progressive-blur-scroll-container.js +70 -137
- package/dist/components/progressive-blur-scroll-container.js.map +1 -1
- package/dist/components/progressive-blur.cjs +46 -0
- package/dist/components/progressive-blur.cjs.map +1 -0
- package/dist/components/progressive-blur.d.cts +17 -0
- package/dist/components/progressive-blur.d.ts +15 -14
- package/dist/components/progressive-blur.js +38 -63
- package/dist/components/progressive-blur.js.map +1 -1
- package/dist/components/radio-group.cjs +38 -0
- package/dist/components/radio-group.cjs.map +1 -0
- package/dist/components/radio-group.d.cts +10 -0
- package/dist/components/radio-group.d.ts +8 -8
- package/dist/components/radio-group.js +28 -30
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +8 -0
- package/dist/components/record-picker.d.cts +16 -0
- package/dist/components/record-picker.d.ts +13 -13
- package/dist/components/record-picker.js +5 -364
- package/dist/components/resizable.cjs +50 -0
- package/dist/components/resizable.cjs.map +1 -0
- package/dist/components/resizable.d.cts +11 -0
- package/dist/components/resizable.d.ts +10 -10
- package/dist/components/resizable.js +29 -37
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/responsive-diagram.cjs +56 -0
- package/dist/components/responsive-diagram.cjs.map +1 -0
- package/dist/components/responsive-diagram.d.cts +10 -0
- package/dist/components/responsive-diagram.d.ts +7 -7
- package/dist/components/responsive-diagram.js +50 -60
- package/dist/components/responsive-diagram.js.map +1 -1
- package/dist/components/scroll-area.cjs +46 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +12 -0
- package/dist/components/scroll-area.d.ts +11 -11
- package/dist/components/scroll-area.js +35 -62
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.cjs +204 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +47 -0
- package/dist/components/select.d.ts +38 -38
- package/dist/components/select.js +172 -269
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +23 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +2 -0
- package/dist/components/separator.d.ts +2 -11
- package/dist/components/separator.js +14 -18
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +19 -0
- package/dist/components/sheet.d.cts +107 -0
- package/dist/components/sheet.d.ts +85 -90
- package/dist/components/sheet.js +3 -598
- package/dist/components/sidebar.cjs +29 -0
- package/dist/components/sidebar.d.cts +67 -0
- package/dist/components/sidebar.d.ts +63 -73
- package/dist/components/sidebar.js +3 -1215
- package/dist/components/skeleton.cjs +24 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +11 -0
- package/dist/components/skeleton.d.ts +10 -6
- package/dist/components/skeleton.js +15 -10
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +23 -0
- package/dist/components/sonner.cjs.map +1 -0
- package/dist/components/sonner.d.cts +10 -0
- package/dist/components/sonner.d.ts +7 -7
- package/dist/components/sonner.js +17 -18
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/stack/index.cjs +44 -0
- package/dist/components/stack/index.d.cts +2 -0
- package/dist/components/stack/index.d.ts +2 -674
- package/dist/components/stack/index.js +3 -1444
- package/dist/components/stepper.cjs +160 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +32 -0
- package/dist/components/stepper.d.ts +27 -25
- package/dist/components/stepper.js +133 -261
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +35 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +8 -0
- package/dist/components/switch.d.ts +7 -7
- package/dist/components/switch.js +26 -34
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +85 -0
- package/dist/components/table.cjs.map +1 -0
- package/dist/components/table.d.cts +23 -0
- package/dist/components/table.d.ts +23 -15
- package/dist/components/table.js +56 -46
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +49 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +10 -0
- package/dist/components/tabs.d.ts +9 -9
- package/dist/components/tabs.js +31 -36
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +132 -0
- package/dist/components/tags.cjs.map +1 -0
- package/dist/components/tags.d.cts +36 -0
- package/dist/components/tags.d.ts +24 -28
- package/dist/components/tags.js +114 -438
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +34 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +10 -0
- package/dist/components/textarea.d.ts +8 -8
- package/dist/components/textarea.js +27 -48
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast/index.cjs +9 -0
- package/dist/components/toast/index.d.cts +2 -0
- package/dist/components/toast/index.d.ts +2 -52
- package/dist/components/toast/index.js +3 -623
- package/dist/components/tooltip.cjs +67 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +2 -0
- package/dist/components/tooltip.d.ts +2 -29
- package/dist/components/tooltip.js +53 -166
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +24 -0
- package/dist/components/unlink-button.cjs.map +1 -0
- package/dist/components/unlink-button.d.cts +14 -0
- package/dist/components/unlink-button.d.ts +11 -11
- package/dist/components/unlink-button.js +18 -86
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/form-DgRTv7O7.d.ts +54 -0
- package/dist/form-DoZEWSzb.d.cts +54 -0
- package/dist/index-CjA4CENl.d.cts +684 -0
- package/dist/index-CjA4CENl.d.ts +684 -0
- package/dist/index-UnM04j0t.d.cts +58 -0
- package/dist/index-UnM04j0t.d.ts +58 -0
- package/dist/index.cjs +408 -9346
- package/dist/index.d.cts +224 -2548
- package/dist/index.d.ts +224 -2548
- package/dist/index.js +65 -9022
- package/dist/input-CBrCuMH8.d.cts +11 -0
- package/dist/input-CBrCuMH8.d.ts +11 -0
- package/dist/motion-config-COCFHq1L.cjs +271 -0
- package/dist/motion-config-COCFHq1L.cjs.map +1 -0
- package/dist/motion-config-COsZ6azM.js +241 -0
- package/dist/motion-config-COsZ6azM.js.map +1 -0
- package/dist/record-picker-BbxngCeV.js +162 -0
- package/dist/record-picker-BbxngCeV.js.map +1 -0
- package/dist/record-picker-Bz4FApxD.cjs +167 -0
- package/dist/record-picker-Bz4FApxD.cjs.map +1 -0
- package/dist/rolldown-runtime-D_qnwXdH.cjs +35 -0
- package/dist/separator-BQEsr0Rc.d.cts +11 -0
- package/dist/separator-BQEsr0Rc.d.ts +11 -0
- package/dist/sheet-BLHnhLRH.js +425 -0
- package/dist/sheet-BLHnhLRH.js.map +1 -0
- package/dist/sheet-BdA0rfIz.cjs +515 -0
- package/dist/sheet-BdA0rfIz.cjs.map +1 -0
- package/dist/sidebar-CPy_fibW.cjs +608 -0
- package/dist/sidebar-CPy_fibW.cjs.map +1 -0
- package/dist/sidebar-Cfax0g0_.js +463 -0
- package/dist/sidebar-Cfax0g0_.js.map +1 -0
- package/dist/slot-C-jEfihz.cjs +122 -0
- package/dist/slot-C-jEfihz.cjs.map +1 -0
- package/dist/slot-EL8zfLG0.js +97 -0
- package/dist/slot-EL8zfLG0.js.map +1 -0
- package/dist/stack-DKdvlOM6.cjs +1771 -0
- package/dist/stack-DKdvlOM6.cjs.map +1 -0
- package/dist/stack-jMdxDrex.js +1531 -0
- package/dist/stack-jMdxDrex.js.map +1 -0
- package/dist/toast-D6MqijT2.cjs +316 -0
- package/dist/toast-D6MqijT2.cjs.map +1 -0
- package/dist/toast-D_BOLzm3.js +287 -0
- package/dist/toast-D_BOLzm3.js.map +1 -0
- package/dist/tooltip-CTRQoN1A.d.cts +29 -0
- package/dist/tooltip-CTRQoN1A.d.ts +29 -0
- package/dist/utils-BkMLyah9.js +12 -0
- package/dist/utils-BkMLyah9.js.map +1 -0
- package/dist/utils-CzTQ3-VI.cjs +17 -0
- package/dist/utils-CzTQ3-VI.cjs.map +1 -0
- package/package.json +288 -47
- package/src/styles/globals.css +155 -203
- package/dist/components/org-chart/index.d.ts +0 -54
- package/dist/components/org-chart/index.js +0 -861
- package/dist/components/org-chart/index.js.map +0 -1
- package/dist/components/record-picker.js.map +0 -1
- package/dist/components/sheet.js.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/stack/index.js.map +0 -1
- package/dist/components/toast/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,173 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
1
|
+
'use client';
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function mergeProps(slotProps, childProps) {
|
|
19
|
-
const overrideProps = { ...childProps };
|
|
20
|
-
for (const propName in childProps) {
|
|
21
|
-
if (propName === "ref") continue;
|
|
22
|
-
const slotPropValue = slotProps[propName];
|
|
23
|
-
const childPropValue = childProps[propName];
|
|
24
|
-
if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
25
|
-
overrideProps[propName] = (...args) => {
|
|
26
|
-
childPropValue(...args);
|
|
27
|
-
slotPropValue(...args);
|
|
28
|
-
};
|
|
29
|
-
} else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
|
|
30
|
-
overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
|
|
31
|
-
} else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
|
|
32
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return { ...slotProps, ...overrideProps };
|
|
36
|
-
}
|
|
37
|
-
function isSlottable(child) {
|
|
38
|
-
return React.isValidElement(child);
|
|
39
|
-
}
|
|
40
|
-
var Slot = React.forwardRef((props, forwardedRef) => {
|
|
41
|
-
const { children, ...slotProps } = props;
|
|
42
|
-
if (isSlottable(children)) {
|
|
43
|
-
const childProps = children.props;
|
|
44
|
-
const childRef = childProps.ref;
|
|
45
|
-
return React.cloneElement(children, {
|
|
46
|
-
...mergeProps(slotProps, childProps),
|
|
47
|
-
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (React.Children.count(children) > 1) {
|
|
51
|
-
const childrenArray = React.Children.toArray(children);
|
|
52
|
-
const slottableChild = childrenArray.find(
|
|
53
|
-
(child) => React.isValidElement(child) && child.type === Slottable
|
|
54
|
-
);
|
|
55
|
-
if (slottableChild) {
|
|
56
|
-
const newElement = slottableChild.props.children;
|
|
57
|
-
if (isSlottable(newElement)) {
|
|
58
|
-
const newElementProps = newElement.props;
|
|
59
|
-
const newChildren = childrenArray.map((child) => {
|
|
60
|
-
if (child === slottableChild) {
|
|
61
|
-
return React.Children.count(newElementProps.children) > 1 ? React.Children.only(null) : newElementProps.children;
|
|
62
|
-
}
|
|
63
|
-
return child;
|
|
64
|
-
});
|
|
65
|
-
const childRef = newElementProps.ref;
|
|
66
|
-
return React.cloneElement(newElement, {
|
|
67
|
-
...mergeProps(slotProps, newElementProps),
|
|
68
|
-
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
69
|
-
children: newChildren
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
75
|
-
});
|
|
76
|
-
Slot.displayName = "Slot";
|
|
77
|
-
function Slottable({ children }) {
|
|
78
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
79
|
-
}
|
|
80
|
-
function cn(...inputs) {
|
|
81
|
-
return twMerge(clsx(inputs));
|
|
82
|
-
}
|
|
83
|
-
function Label({ className, ...props }) {
|
|
84
|
-
return /* @__PURE__ */ jsx(
|
|
85
|
-
"label",
|
|
86
|
-
{
|
|
87
|
-
"data-slot": "label",
|
|
88
|
-
className: cn(
|
|
89
|
-
`text-foreground text-sm leading-4 font-medium select-none group-data-[disabled=true]:pointer-events-none
|
|
90
|
-
group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50
|
|
91
|
-
data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,
|
|
92
|
-
className
|
|
93
|
-
),
|
|
94
|
-
...props
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
3
|
+
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
+
import { t as Slot } from "../slot-EL8zfLG0.js";
|
|
5
|
+
import { Label } from "./label.js";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/components/form-control.tsx
|
|
98
10
|
function FormControl({ children, label, id, layout = "stacked", error, className }) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// Base: centered when empty
|
|
147
|
-
"pointer-events-none absolute start-3 top-1/2 -translate-y-1/2",
|
|
148
|
-
// Small, subtle typography
|
|
149
|
-
"origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none",
|
|
150
|
-
// Snappy transition
|
|
151
|
-
"transition-[top,transform,color] duration-200 ease-out",
|
|
152
|
-
// Error state
|
|
153
|
-
error && "text-destructive"
|
|
154
|
-
),
|
|
155
|
-
children: label
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
error && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-destructive text-xs", role: "alert", children: error })
|
|
162
|
-
] });
|
|
163
|
-
}
|
|
164
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("grid gap-2", className), children: [
|
|
165
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: inputId, className: cn(error && "text-destructive"), children: label }),
|
|
166
|
-
childWithProps,
|
|
167
|
-
error && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-destructive text-sm", role: "alert", children: error })
|
|
168
|
-
] });
|
|
11
|
+
const generatedId = React$1.useId();
|
|
12
|
+
const inputId = id || generatedId;
|
|
13
|
+
const errorId = error ? `${inputId}-error` : void 0;
|
|
14
|
+
const childProps = {
|
|
15
|
+
id: inputId,
|
|
16
|
+
"aria-invalid": error ? true : void 0,
|
|
17
|
+
"aria-describedby": errorId
|
|
18
|
+
};
|
|
19
|
+
if (layout === "floating") childProps.placeholder = " ";
|
|
20
|
+
const childWithProps = React$1.cloneElement(children, childProps);
|
|
21
|
+
if (layout === "floating") return /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: cn("space-y-1", className),
|
|
23
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
24
|
+
className: cn("relative", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80", "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0", "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]", error && "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive"),
|
|
25
|
+
children: [/* @__PURE__ */ jsx(Slot, {
|
|
26
|
+
className: cn(error && "border-destructive focus-visible:ring-destructive/20"),
|
|
27
|
+
children: childWithProps
|
|
28
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
29
|
+
htmlFor: inputId,
|
|
30
|
+
"data-slot": "form-control-label",
|
|
31
|
+
className: cn("pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]", "origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none", "transition-[transform,color] duration-200 ease-out motion-reduce:transition-none", error && "text-destructive"),
|
|
32
|
+
children: label
|
|
33
|
+
})]
|
|
34
|
+
}), error && /* @__PURE__ */ jsx("p", {
|
|
35
|
+
id: errorId,
|
|
36
|
+
className: "text-destructive text-xs",
|
|
37
|
+
role: "alert",
|
|
38
|
+
children: error
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: cn("grid gap-2", className),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Label, {
|
|
45
|
+
htmlFor: inputId,
|
|
46
|
+
className: cn(error && "text-destructive"),
|
|
47
|
+
children: label
|
|
48
|
+
}),
|
|
49
|
+
childWithProps,
|
|
50
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
51
|
+
id: errorId,
|
|
52
|
+
className: "text-destructive text-sm",
|
|
53
|
+
role: "alert",
|
|
54
|
+
children: error
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
169
58
|
}
|
|
170
59
|
|
|
60
|
+
//#endregion
|
|
171
61
|
export { FormControl };
|
|
172
|
-
//# sourceMappingURL=form-control.js.map
|
|
173
62
|
//# sourceMappingURL=form-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/slot.tsx","../../src/lib/utils.ts","../../src/components/label.tsx","../../src/components/form-control.tsx"],"names":["jsx","React2"],"mappings":";;;;;AAQA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,KAAQ;AACrB,MAAA,IAAI,OAAO,QAAQ,UAAA,EAAY;AAC9B,QAAA,GAAA,CAAI,IAAI,CAAA;AAAA,MACT,CAAA,MAAA,IAAW,OAAO,IAAA,EAAM;AACvB,QAAC,IAAyC,OAAA,GAAU,IAAA;AAAA,MACrD;AAAA,IACD,CAAC,CAAA;AAAA,EACF,CAAA;AACD;AAMA,SAAS,UAAA,CACR,WACA,UAAA,EAC0B;AAC1B,EAAA,MAAM,aAAA,GAAyC,EAAE,GAAG,UAAA,EAAW;AAE/D,EAAA,KAAA,MAAW,YAAY,UAAA,EAAY;AAElC,IAAA,IAAI,aAAa,KAAA,EAAO;AAExB,IAAA,MAAM,aAAA,GAAgB,UAAU,QAAQ,CAAA;AACxC,IAAA,MAAM,cAAA,GAAiB,WAAW,QAAQ,CAAA;AAG1C,IAAA,IAAI,UAAA,CAAW,KAAK,QAAQ,CAAA,IAAK,OAAO,aAAA,KAAkB,UAAA,IAAc,OAAO,cAAA,KAAmB,UAAA,EAAY;AAC7G,MAAA,aAAA,CAAc,QAAQ,CAAA,GAAI,CAAA,GAAI,IAAA,KAAoB;AACjD,QAAA,cAAA,CAAe,GAAG,IAAI,CAAA;AACtB,QAAA,aAAA,CAAc,GAAG,IAAI,CAAA;AAAA,MACtB,CAAA;AAAA,IACD,CAAA,MAAA,IAES,aAAa,WAAA,IAAe,OAAO,kBAAkB,QAAA,IAAY,OAAO,mBAAmB,QAAA,EAAU;AAC7G,MAAA,aAAA,CAAc,QAAQ,CAAA,GAAI,CAAA,EAAG,aAAa,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A,gBACC,SAAA,EAAW,EAAA;AAAA,kBACT,KAAA,IAAS;AAAA,iBACX;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA,aACH;AAAA,4BACAA,GAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,OAAA;AAAA,gBACT,WAAA,EAAU,oBAAA;AAAA,gBACV,SAAA,EAAW,EAAA;AAAA;AAAA,kBAET,+DAAA;AAAA;AAAA,kBAEA,uFAAA;AAAA;AAAA,kBAEA,wDAAA;AAAA;AAAA,kBAEA,KAAA,IAAS;AAAA,iBACX;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA,OACF;AAAA,MACC,KAAA,oBACCA,GAAAA,CAAC,GAAA,EAAA,EAAE,EAAA,EAAI,SAAS,SAAA,EAAU,0BAAA,EAA2B,IAAA,EAAK,OAAA,EACvD,QAAA,EAAA,KAAA,EACH;AAAA,KAAA,EAEJ,CAAA;AAAA,EAEJ;AAEA,EAAA,4BACG,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,YAAA,EAAc,SAAS,CAAA,EACxC,QAAA,EAAA;AAAA,oBAAAA,GAAAA,CAAC,SAAM,OAAA,EAAS,OAAA,EAAS,WAAW,EAAA,CAAG,KAAA,IAAS,kBAAkB,CAAA,EAC/D,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,IACC,cAAA;AAAA,IACA,KAAA,oBACCA,GAAAA,CAAC,GAAA,EAAA,EAAE,EAAA,EAAI,SAAS,SAAA,EAAU,0BAAA,EAA2B,IAAA,EAAK,OAAA,EACvD,QAAA,EAAA,KAAA,EACH;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"form-control.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\ntype LabelProps = React.ComponentProps<'label'>;\n\n/**\n * Label component for form controls.\n * Uses a standard HTML label element for maximum compatibility.\n */\nfunction Label({ className, ...props }: LabelProps) {\n\treturn (\n\t\t<label\n\t\t\tdata-slot=\"label\"\n\t\t\tclassName={cn(\n\t\t\t\t`text-foreground text-sm leading-4 font-medium select-none group-data-[disabled=true]:pointer-events-none\n\t\t\t\tgroup-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-50`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Label };\nexport type { LabelProps };\n","'use client';\n\nimport * as React from 'react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\ntype FormControlLayout = 'stacked' | 'floating';\n\ninterface FormControlProps {\n children: React.ReactElement;\n label: string;\n id?: string;\n layout?: FormControlLayout;\n error?: string;\n className?: string;\n}\n\nfunction FormControl({ children, label, id, layout = 'stacked', error, className }: FormControlProps) {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const errorId = error ? `${inputId}-error` : undefined;\n\n const childProps: Record<string, unknown> = {\n id: inputId,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': errorId,\n };\n\n if (layout === 'floating') {\n childProps.placeholder = ' ';\n }\n\n const childWithProps = React.cloneElement(children, childProps);\n\n if (layout === 'floating') {\n return (\n <div className={cn('space-y-1', className)}>\n <div\n className={cn(\n 'relative',\n // Float label when focused\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:top-2',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80',\n // Float label when there's a value\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:top-2',\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n // Error\n error && 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive',\n )}\n >\n <Slot\n className={cn(\n error && 'border-destructive focus-visible:ring-destructive/20',\n )}\n >\n {childWithProps}\n </Slot>\n <Label\n htmlFor={inputId}\n data-slot=\"form-control-label\"\n className={cn(\n // Base: centered when empty\n 'pointer-events-none absolute start-3 top-1/2 -translate-y-1/2',\n // Small, subtle typography\n 'origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none',\n // Snappy transition\n 'transition-[top,transform,color] duration-200 ease-out',\n // Error state\n error && 'text-destructive',\n )}\n >\n {label}\n </Label>\n </div>\n {error && (\n <p id={errorId} className='text-destructive text-xs' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n }\n\n return (\n <div className={cn('grid gap-2', className)}>\n <Label htmlFor={inputId} className={cn(error && 'text-destructive')}>\n {label}\n </Label>\n {childWithProps}\n {error && (\n <p id={errorId} className='text-destructive text-sm' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n}\n\nexport { FormControl, type FormControlLayout };\n"]}
|
|
1
|
+
{"version":3,"file":"form-control.js","names":["React"],"sources":["../../src/components/form-control.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\ntype FormControlLayout = 'stacked' | 'floating';\n\ninterface FormControlProps {\n children: React.ReactElement;\n label: string;\n id?: string;\n layout?: FormControlLayout;\n error?: string;\n className?: string;\n}\n\nfunction FormControl({ children, label, id, layout = 'stacked', error, className }: FormControlProps) {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const errorId = error ? `${inputId}-error` : undefined;\n\n const childProps: Record<string, unknown> = {\n id: inputId,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': errorId,\n };\n\n if (layout === 'floating') {\n childProps.placeholder = ' ';\n }\n\n const childWithProps = React.cloneElement(children, childProps);\n\n if (layout === 'floating') {\n return (\n <div className={cn('space-y-1', className)}>\n <div\n className={cn(\n 'relative',\n // Float label when focused\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80',\n // Float label when there's a value\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n // Error\n error && 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive',\n )}\n >\n <Slot\n className={cn(\n error && 'border-destructive focus-visible:ring-destructive/20',\n )}\n >\n {childWithProps}\n </Slot>\n <Label\n htmlFor={inputId}\n data-slot=\"form-control-label\"\n className={cn(\n // Base: centered when empty\n 'pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]',\n // Small, subtle typography\n 'origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none',\n // Snappy transition\n 'transition-[transform,color] duration-200 ease-out motion-reduce:transition-none',\n // Error state\n error && 'text-destructive',\n )}\n >\n {label}\n </Label>\n </div>\n {error && (\n <p id={errorId} className='text-destructive text-xs' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n }\n\n return (\n <div className={cn('grid gap-2', className)}>\n <Label htmlFor={inputId} className={cn(error && 'text-destructive')}>\n {label}\n </Label>\n {childWithProps}\n {error && (\n <p id={errorId} className='text-destructive text-sm' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n}\n\nexport { FormControl, type FormControlLayout };\n"],"mappings":";;;;;;;;;AAmBA,SAAS,YAAY,EAAE,UAAU,OAAO,IAAI,SAAS,WAAW,OAAO,aAA+B;CACpG,MAAM,cAAcA,QAAM,MAAM;CAChC,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,QAAQ,GAAG,QAAQ,UAAU;CAE7C,MAAM,aAAsC;EAC1C,IAAI;EACJ,gBAAgB,QAAQ,OAAO;EAC/B,oBAAoB;CACtB;CAEA,IAAI,WAAW,YACb,WAAW,cAAc;CAG3B,MAAM,iBAAiBA,QAAM,aAAa,UAAU,UAAU;CAE9D,IAAI,WAAW,YACb,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,aAAa,SAAS;YAAzC,CACE,qBAAC,OAAD;GACE,WAAW,GACT,YAEA,8EACA,4EACA,gFAEA,wFACA,sFAEA,SAAS,+EACX;aAZF,CAcE,oBAAC,MAAD;IACE,WAAW,GACT,SAAS,sDACX;cAEC;GACG,IACN,oBAAC,OAAD;IACE,SAAS;IACT,aAAU;IACV,WAAW,GAET,oEAEA,yFAEA,oFAEA,SAAS,kBACX;cAEC;GACI,EACJ;MACJ,SACC,oBAAC,KAAD;GAAG,IAAI;GAAS,WAAU;GAA2B,MAAK;aACvD;EACA,EAEF;;CAIT,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,cAAc,SAAS;YAA1C;GACE,oBAAC,OAAD;IAAO,SAAS;IAAS,WAAW,GAAG,SAAS,kBAAkB;cAC/D;GACI;GACN;GACA,SACC,oBAAC,KAAD;IAAG,IAAI;IAAS,WAAU;IAA2B,MAAK;cACvD;GACA;EAEF;;AAET"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
5
|
+
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
|
+
const require_slot = require('../slot-C-jEfihz.cjs');
|
|
7
|
+
const require_components_label = require('./label.cjs');
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let react_hook_form = require("react-hook-form");
|
|
12
|
+
|
|
13
|
+
//#region src/components/form.tsx
|
|
14
|
+
const Form = react_hook_form.FormProvider;
|
|
15
|
+
const FormFieldContext = react.createContext({});
|
|
16
|
+
const FormField = ({ ...props }) => {
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormFieldContext.Provider, {
|
|
18
|
+
value: { name: props.name },
|
|
19
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_hook_form.Controller, { ...props })
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const useFormField = () => {
|
|
23
|
+
const fieldContext = react.useContext(FormFieldContext);
|
|
24
|
+
const itemContext = react.useContext(FormItemContext);
|
|
25
|
+
const { getFieldState } = (0, react_hook_form.useFormContext)();
|
|
26
|
+
const formState = (0, react_hook_form.useFormState)({ name: fieldContext.name });
|
|
27
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
28
|
+
if (!fieldContext) throw new Error("useFormField should be used within <FormField>");
|
|
29
|
+
const { id } = itemContext;
|
|
30
|
+
return {
|
|
31
|
+
id,
|
|
32
|
+
name: fieldContext.name,
|
|
33
|
+
formItemId: `${id}-form-item`,
|
|
34
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
35
|
+
formMessageId: `${id}-form-item-message`,
|
|
36
|
+
...fieldState
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const FormItemContext = react.createContext({});
|
|
40
|
+
function FormItem({ className, ...props }) {
|
|
41
|
+
const id = react.useId();
|
|
42
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormItemContext.Provider, {
|
|
43
|
+
value: { id },
|
|
44
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
45
|
+
"data-slot": "form-item",
|
|
46
|
+
className: require_utils.cn("grid gap-2", className),
|
|
47
|
+
...props
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function FormLabel({ className, ...props }) {
|
|
52
|
+
const { error, formItemId } = useFormField();
|
|
53
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_label.Label, {
|
|
54
|
+
"data-slot": "form-label",
|
|
55
|
+
"data-error": !!error,
|
|
56
|
+
className: require_utils.cn("data-[error=true]:text-destructive", className),
|
|
57
|
+
htmlFor: formItemId,
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function FormControl({ ...props }) {
|
|
62
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
63
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_slot.Slot, {
|
|
64
|
+
"data-slot": "form-control",
|
|
65
|
+
id: formItemId,
|
|
66
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
67
|
+
"aria-invalid": !!error,
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function FormDescription({ className, ...props }) {
|
|
72
|
+
const { formDescriptionId } = useFormField();
|
|
73
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
74
|
+
"data-slot": "form-description",
|
|
75
|
+
id: formDescriptionId,
|
|
76
|
+
className: require_utils.cn("text-muted-foreground text-sm", className),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function FormMessage({ className, ...props }) {
|
|
81
|
+
const { error, formMessageId } = useFormField();
|
|
82
|
+
const body = error ? String(error?.message ?? "") : props.children;
|
|
83
|
+
if (!body) return null;
|
|
84
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
85
|
+
"data-slot": "form-message",
|
|
86
|
+
id: formMessageId,
|
|
87
|
+
className: require_utils.cn("text-destructive text-sm", className),
|
|
88
|
+
...props,
|
|
89
|
+
children: body
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
exports.Form = Form;
|
|
95
|
+
exports.FormControl = FormControl;
|
|
96
|
+
exports.FormDescription = FormDescription;
|
|
97
|
+
exports.FormField = FormField;
|
|
98
|
+
exports.FormItem = FormItem;
|
|
99
|
+
exports.FormLabel = FormLabel;
|
|
100
|
+
exports.FormMessage = FormMessage;
|
|
101
|
+
exports.useFormField = useFormField;
|
|
102
|
+
//# sourceMappingURL=form.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.cjs","names":["FormProvider","React","Controller","cn","Label","Slot"],"sources":["../../src/components/form.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '../lib/slot';\nimport {\n\tController,\n\tFormProvider,\n\tuseFormContext,\n\tuseFormState,\n\ttype ControllerProps,\n\ttype FieldPath,\n\ttype FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n\tTFieldValues extends FieldValues = FieldValues,\n\tTName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n\tname: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <\n\tTFieldValues extends FieldValues = FieldValues,\n\tTName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n\t...props\n}: ControllerProps<TFieldValues, TName>) => {\n\treturn (\n\t\t<FormFieldContext.Provider value={{ name: props.name }}>\n\t\t\t<Controller {...props} />\n\t\t</FormFieldContext.Provider>\n\t);\n};\n\nconst useFormField = () => {\n\tconst fieldContext = React.useContext(FormFieldContext);\n\tconst itemContext = React.useContext(FormItemContext);\n\tconst { getFieldState } = useFormContext();\n\tconst formState = useFormState({ name: fieldContext.name });\n\tconst fieldState = getFieldState(fieldContext.name, formState);\n\n\tif (!fieldContext) {\n\t\tthrow new Error('useFormField should be used within <FormField>');\n\t}\n\n\tconst { id } = itemContext;\n\n\treturn {\n\t\tid,\n\t\tname: fieldContext.name,\n\t\tformItemId: `${id}-form-item`,\n\t\tformDescriptionId: `${id}-form-item-description`,\n\t\tformMessageId: `${id}-form-item-message`,\n\t\t...fieldState,\n\t};\n};\n\ntype FormItemContextValue = {\n\tid: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n\tconst id = React.useId();\n\n\treturn (\n\t\t<FormItemContext.Provider value={{ id }}>\n\t\t\t<div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n\t\t</FormItemContext.Provider>\n\t);\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n\tconst { error, formItemId } = useFormField();\n\n\treturn (\n\t\t<Label\n\t\t\tdata-slot=\"form-label\"\n\t\t\tdata-error={!!error}\n\t\t\tclassName={cn('data-[error=true]:text-destructive', className)}\n\t\t\thtmlFor={formItemId}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\n\tconst { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n\treturn (\n\t\t<Slot\n\t\t\tdata-slot=\"form-control\"\n\t\t\tid={formItemId}\n\t\t\taria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n\t\t\taria-invalid={!!error}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n\tconst { formDescriptionId } = useFormField();\n\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"form-description\"\n\t\t\tid={formDescriptionId}\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n\tconst { error, formMessageId } = useFormField();\n\tconst body = error ? String(error?.message ?? '') : props.children;\n\n\tif (!body) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n\t\t\t{body}\n\t\t</p>\n\t);\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,OAAOA;AASb,MAAM,mBAAmBC,MAAM,cAAqC,CAAC,CAA0B;AAE/F,MAAM,aAGJ,EACD,GAAG,YACwC;CAC3C,OACC,2CAAC,iBAAiB,UAAlB;EAA2B,OAAO,EAAE,MAAM,MAAM,KAAK;YACpD,2CAACC,4BAAD,EAAY,GAAI,MAAQ;CACE;AAE7B;AAEA,MAAM,qBAAqB;CAC1B,MAAM,eAAeD,MAAM,WAAW,gBA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,IAAI;EACJ,WAAWF,iBAAG,iCAAiC,SAAS;EACxD,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAoC;CACxE,MAAM,EAAE,OAAO,kBAAkB,aAAa;CAC9C,MAAM,OAAO,QAAQ,OAAO,OAAO,WAAW,EAAE,IAAI,MAAM;CAE1D,IAAI,CAAC,MACJ,OAAO;CAGR,OACC,2CAAC,KAAD;EAAG,aAAU;EAAe,IAAI;EAAe,WAAWA,iBAAG,4BAA4B,SAAS;EAAG,GAAI;YACvG;CACC;AAEL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as FormItem, c as useFormField, i as FormField, n as FormControl, o as FormLabel, r as FormDescription, s as FormMessage, t as Form } from "../form-DoZEWSzb.cjs";
|
|
2
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { Label } from './label.js';
|
|
6
|
-
|
|
7
|
-
interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Slot component - renders its child element with merged props.
|
|
12
|
-
* Used for the `asChild` pattern where parent props are passed to child.
|
|
13
|
-
* React 19 compatible - accesses ref from props instead of element.ref.
|
|
14
|
-
*/
|
|
15
|
-
declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
|
16
|
-
|
|
17
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
18
|
-
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
19
|
-
declare const useFormField: () => {
|
|
20
|
-
invalid: boolean;
|
|
21
|
-
isDirty: boolean;
|
|
22
|
-
isTouched: boolean;
|
|
23
|
-
isValidating: boolean;
|
|
24
|
-
error?: react_hook_form.FieldError;
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
formItemId: string;
|
|
28
|
-
formDescriptionId: string;
|
|
29
|
-
formMessageId: string;
|
|
30
|
-
};
|
|
31
|
-
declare function FormItem({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
32
|
-
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof Label>): react_jsx_runtime.JSX.Element;
|
|
33
|
-
declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): react_jsx_runtime.JSX.Element;
|
|
34
|
-
declare function FormDescription({ className, ...props }: React.ComponentProps<'p'>): react_jsx_runtime.JSX.Element;
|
|
35
|
-
declare function FormMessage({ className, ...props }: React.ComponentProps<'p'>): react_jsx_runtime.JSX.Element | null;
|
|
36
|
-
|
|
37
|
-
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
1
|
+
import { a as FormItem, c as useFormField, i as FormField, n as FormControl, o as FormLabel, r as FormDescription, s as FormMessage, t as Form } from "../form-DgRTv7O7.js";
|
|
2
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|