@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,51 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { Label } from "./label.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
//#region src/components/field.d.ts
|
|
5
|
+
declare function FieldSet({ className, ...props }: React$1.ComponentProps<'fieldset'>): React$1.JSX.Element;
|
|
6
|
+
declare function FieldLegend({ className, variant, ...props }: React$1.ComponentProps<'legend'> & {
|
|
7
|
+
variant?: 'legend' | 'label';
|
|
8
|
+
}): React$1.JSX.Element;
|
|
9
|
+
declare function FieldGroup({ className, ...props }: React$1.ComponentProps<'div'>): React$1.JSX.Element;
|
|
10
|
+
declare const fieldVariants: (props?: ({
|
|
11
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
+
type StructuralFieldProps = React$1.ComponentProps<'div'> & VariantProps<typeof fieldVariants>;
|
|
14
|
+
interface LegacyFieldProps {
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
descriptionId?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
errorId?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
htmlFor?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
children: React$1.ReactNode;
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* Places label beside the control instead of above.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```tsx
|
|
40
|
-
* <FieldRow label="Enable notifications" description="Receive email updates" htmlFor="notifications">
|
|
41
|
-
* <Switch id="notifications" />
|
|
42
|
-
* </FieldRow>
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
interface FieldRowProps extends Omit<FieldProps, 'required'> {
|
|
46
|
-
/** Position of the label relative to the control */
|
|
47
|
-
labelPosition?: 'start' | 'end';
|
|
25
|
+
type FieldProps = LegacyFieldProps | StructuralFieldProps;
|
|
26
|
+
declare function Field(props: LegacyFieldProps): React$1.ReactElement;
|
|
27
|
+
declare function Field(props: StructuralFieldProps): React$1.ReactElement;
|
|
28
|
+
declare function FieldContent({ className, ...props }: React$1.ComponentProps<'div'>): React$1.JSX.Element;
|
|
29
|
+
declare function FieldLabel({ className, ...props }: React$1.ComponentProps<typeof Label>): React$1.JSX.Element;
|
|
30
|
+
declare function FieldTitle({ className, ...props }: React$1.ComponentProps<'div'>): React$1.JSX.Element;
|
|
31
|
+
declare function FieldDescription({ className, ...props }: React$1.ComponentProps<'p'>): React$1.JSX.Element;
|
|
32
|
+
declare function FieldSeparator({ children, className, ...props }: React$1.ComponentProps<'div'> & {
|
|
33
|
+
children?: React$1.ReactNode;
|
|
34
|
+
}): React$1.JSX.Element;
|
|
35
|
+
declare function FieldError({ className, children, errors, ...props }: React$1.ComponentProps<'div'> & {
|
|
36
|
+
errors?: Array<{
|
|
37
|
+
message?: string;
|
|
38
|
+
} | undefined>;
|
|
39
|
+
}): React$1.JSX.Element | null;
|
|
40
|
+
interface FieldRowProps extends Omit<LegacyFieldProps, 'required'> {
|
|
41
|
+
labelPosition?: 'start' | 'end';
|
|
48
42
|
}
|
|
49
|
-
declare function FieldRow({ label, description, error, labelPosition, htmlFor, className, children
|
|
50
|
-
|
|
51
|
-
export { Field, type FieldProps, FieldRow, type FieldRowProps };
|
|
43
|
+
declare function FieldRow({ label, description, error, labelPosition, htmlFor, className, children }: FieldRowProps): React$1.JSX.Element;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldProps, FieldRow, type FieldRowProps, FieldSeparator, FieldSet, FieldTitle, type LegacyFieldProps, type StructuralFieldProps };
|
|
46
|
+
//# sourceMappingURL=field.d.ts.map
|
package/dist/components/field.js
CHANGED
|
@@ -1,115 +1,173 @@
|
|
|
1
|
-
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
|
+
'use client';
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
+
import { Label } from "./label.js";
|
|
5
|
+
import { Separator } from "./separator.js";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
|
|
10
|
+
//#region src/components/field.tsx
|
|
11
|
+
function FieldSet({ className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
13
|
+
"data-slot": "field-set",
|
|
14
|
+
className: cn("flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
20
|
+
"data-slot": "field-legend",
|
|
21
|
+
"data-variant": variant,
|
|
22
|
+
className: cn("mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function FieldGroup({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
"data-slot": "field-group",
|
|
29
|
+
className: cn(`group/field-group @container/field-group flex w-full flex-col gap-5
|
|
30
|
+
data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`, className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const fieldVariants = cva("group/field flex w-full gap-2 data-[invalid=true]:text-destructive", {
|
|
35
|
+
variants: { orientation: {
|
|
36
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
37
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
38
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
39
|
+
} },
|
|
40
|
+
defaultVariants: { orientation: "vertical" }
|
|
41
|
+
});
|
|
42
|
+
function isLegacyFieldProps(props) {
|
|
43
|
+
return typeof props.label === "string";
|
|
44
|
+
}
|
|
45
|
+
function FieldContainer({ className, orientation = "vertical", ...props }) {
|
|
46
|
+
return /* @__PURE__ */ jsx("div", {
|
|
47
|
+
role: "group",
|
|
48
|
+
"data-slot": "field",
|
|
49
|
+
"data-orientation": orientation,
|
|
50
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function Field(props) {
|
|
55
|
+
if (!isLegacyFieldProps(props)) return /* @__PURE__ */ jsx(FieldContainer, { ...props });
|
|
56
|
+
const { label, description, descriptionId, error, errorId, required, htmlFor, className, children } = props;
|
|
57
|
+
return /* @__PURE__ */ jsxs(FieldContainer, {
|
|
58
|
+
className,
|
|
59
|
+
"data-invalid": Boolean(error),
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsxs(FieldLabel, {
|
|
62
|
+
htmlFor,
|
|
63
|
+
children: [label, required && /* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: "ml-1 text-destructive",
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
children: "*"
|
|
67
|
+
})]
|
|
68
|
+
}),
|
|
69
|
+
children,
|
|
70
|
+
description && /* @__PURE__ */ jsx(FieldDescription, {
|
|
71
|
+
id: descriptionId,
|
|
72
|
+
children: description
|
|
73
|
+
}),
|
|
74
|
+
error && /* @__PURE__ */ jsx(FieldError, {
|
|
75
|
+
id: errorId,
|
|
76
|
+
children: error
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function FieldContent({ className, ...props }) {
|
|
82
|
+
return /* @__PURE__ */ jsx("div", {
|
|
83
|
+
"data-slot": "field-content",
|
|
84
|
+
className: cn("group/field-content flex flex-1 flex-col gap-0.5 leading-snug", className),
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function FieldLabel({ className, ...props }) {
|
|
89
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
90
|
+
"data-slot": "field-label",
|
|
91
|
+
className: cn(`group/field-label peer/field-label flex w-fit gap-2 leading-snug
|
|
92
|
+
group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5
|
|
93
|
+
has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border
|
|
94
|
+
*:data-[slot=field]:p-2.5 has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`, className),
|
|
95
|
+
...props
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function FieldTitle({ className, ...props }) {
|
|
99
|
+
return /* @__PURE__ */ jsx("div", {
|
|
100
|
+
"data-slot": "field-label",
|
|
101
|
+
className: cn("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50", className),
|
|
102
|
+
...props
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function FieldDescription({ className, ...props }) {
|
|
106
|
+
return /* @__PURE__ */ jsx("p", {
|
|
107
|
+
"data-slot": "field-description",
|
|
108
|
+
className: cn(`text-left text-sm leading-normal font-normal text-muted-foreground
|
|
109
|
+
group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5 last:mt-0 nth-last-2:-mt-1
|
|
110
|
+
[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`, className),
|
|
111
|
+
...props
|
|
112
|
+
});
|
|
8
113
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
);
|
|
114
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
115
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
116
|
+
"data-slot": "field-separator",
|
|
117
|
+
"data-content": Boolean(children),
|
|
118
|
+
className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
119
|
+
...props,
|
|
120
|
+
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
121
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
122
|
+
"data-slot": "field-separator-content",
|
|
123
|
+
children
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
23
126
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
),
|
|
46
|
-
children,
|
|
47
|
-
description && /* @__PURE__ */ jsx(
|
|
48
|
-
"p",
|
|
49
|
-
{
|
|
50
|
-
"data-slot": "field-description",
|
|
51
|
-
className: "text-muted-foreground text-sm",
|
|
52
|
-
children: description
|
|
53
|
-
}
|
|
54
|
-
),
|
|
55
|
-
error && /* @__PURE__ */ jsx(
|
|
56
|
-
"p",
|
|
57
|
-
{
|
|
58
|
-
"data-slot": "field-error",
|
|
59
|
-
className: "text-destructive text-sm",
|
|
60
|
-
role: "alert",
|
|
61
|
-
children: error
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
] });
|
|
127
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
128
|
+
const content = React$1.useMemo(() => {
|
|
129
|
+
if (children) return children;
|
|
130
|
+
if (!errors?.length) return null;
|
|
131
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
|
|
132
|
+
if (uniqueErrors.length === 1) return uniqueErrors[0]?.message;
|
|
133
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
134
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
135
|
+
children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, `${error.message}-${index}`))
|
|
136
|
+
});
|
|
137
|
+
}, [children, errors]);
|
|
138
|
+
if (!content) return null;
|
|
139
|
+
return /* @__PURE__ */ jsx("div", {
|
|
140
|
+
role: "alert",
|
|
141
|
+
"data-slot": "field-error",
|
|
142
|
+
className: cn("text-sm font-normal text-destructive", className),
|
|
143
|
+
...props,
|
|
144
|
+
children: content
|
|
145
|
+
});
|
|
65
146
|
}
|
|
66
|
-
function FieldRow({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
89
|
-
labelPosition === "start" && labelElement,
|
|
90
|
-
children,
|
|
91
|
-
labelPosition === "end" && labelElement
|
|
92
|
-
] }),
|
|
93
|
-
description && /* @__PURE__ */ jsx(
|
|
94
|
-
"p",
|
|
95
|
-
{
|
|
96
|
-
"data-slot": "field-description",
|
|
97
|
-
className: "text-muted-foreground text-sm",
|
|
98
|
-
children: description
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
error && /* @__PURE__ */ jsx(
|
|
102
|
-
"p",
|
|
103
|
-
{
|
|
104
|
-
"data-slot": "field-error",
|
|
105
|
-
className: "text-destructive text-sm",
|
|
106
|
-
role: "alert",
|
|
107
|
-
children: error
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
] });
|
|
147
|
+
function FieldRow({ label, description, error, labelPosition = "end", htmlFor, className, children }) {
|
|
148
|
+
const labelElement = /* @__PURE__ */ jsx(FieldLabel, {
|
|
149
|
+
htmlFor,
|
|
150
|
+
children: label
|
|
151
|
+
});
|
|
152
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
153
|
+
"data-slot": "field-row",
|
|
154
|
+
"data-invalid": Boolean(error),
|
|
155
|
+
className: cn("group/field flex flex-col gap-2 data-[invalid=true]:text-destructive", className),
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ jsxs("div", {
|
|
158
|
+
className: "flex items-center gap-2",
|
|
159
|
+
children: [
|
|
160
|
+
labelPosition === "start" && labelElement,
|
|
161
|
+
children,
|
|
162
|
+
labelPosition === "end" && labelElement
|
|
163
|
+
]
|
|
164
|
+
}),
|
|
165
|
+
description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
|
|
166
|
+
error && /* @__PURE__ */ jsx(FieldError, { children: error })
|
|
167
|
+
]
|
|
168
|
+
});
|
|
111
169
|
}
|
|
112
170
|
|
|
113
|
-
|
|
114
|
-
|
|
171
|
+
//#endregion
|
|
172
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldRow, FieldSeparator, FieldSet, FieldTitle };
|
|
115
173
|
//# sourceMappingURL=field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/components/label.tsx","../../src/components/field.tsx"],"names":["jsx"],"mappings":";;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACOA,SAAS,KAAA,CAAM,EAAE,SAAA,EAAW,GAAG,OAAM,EAAe;AACnD,EAAA,uBACC,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,OAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACV,CAAA;AAAA;AAAA,kEAAA,CAAA;AAAA,QAGA;AAAA,OACD;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF;ACWA,SAAS,KAAA,CAAM;AAAA,EACd,KAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA;AACD,CAAA,EAAe;AACd,EAAA,uBACC,IAAA,CAAC,SAAI,WAAA,EAAU,OAAA,EAAQ,WAAW,EAAA,CAAG,YAAA,EAAc,SAAS,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AAA,EAAc,SAAS,CAAA,EAC/D,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,WAAU,yBAAA,EACb,QAAA,EAAA;AAAA,MAAA,aAAA,KAAkB,OAAA,IAAW,YAAA;AAAA,MAC7B,QAAA;AAAA,MACA,kBAAkB,KAAA,IAAS;AAAA,KAAA,EAC7B,CAAA;AAAA,IAEC,+BACAA,GAAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACA,WAAA,EAAU,mBAAA;AAAA,QACV,SAAA,EAAU,+BAAA;AAAA,QAET,QAAA,EAAA;AAAA;AAAA,KACF;AAAA,IAGA,yBACAA,GAAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACA,WAAA,EAAU,aAAA;AAAA,QACV,SAAA,EAAU,0BAAA;AAAA,QACV,IAAA,EAAK,OAAA;AAAA,QAEJ,QAAA,EAAA;AAAA;AAAA;AACF,GAAA,EAEF,CAAA;AAEF","file":"field.js","sourcesContent":["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 { cn } from '../lib/utils';\nimport { Label } from './label';\n\ninterface FieldProps {\n\t/** Field label text */\n\tlabel: string;\n\t/** Optional description text shown below the control */\n\tdescription?: string;\n\t/** Error message - shows in destructive color */\n\terror?: string;\n\t/** Shows required indicator (*) after label */\n\trequired?: boolean;\n\t/** HTML id for the form control - used for label's htmlFor */\n\thtmlFor?: string;\n\t/** Additional className for the wrapper */\n\tclassName?: string;\n\t/** The form control (InputGroup, Input, Select, etc.) */\n\tchildren: React.ReactNode;\n}\n\n/**\n * Field wraps a form control with label, description, and error message.\n * Works standalone without any form library dependency.\n *\n * @example\n * ```tsx\n * <Field label=\"Email\" required error={errors.email} htmlFor=\"email\">\n * <InputGroup>\n * <InputGroupAddon><Mail /></InputGroupAddon>\n * <InputGroupInput id=\"email\" type=\"email\" placeholder=\"name@example.com\" />\n * </InputGroup>\n * </Field>\n * ```\n */\nfunction Field({\n\tlabel,\n\tdescription,\n\terror,\n\trequired,\n\thtmlFor,\n\tclassName,\n\tchildren,\n}: FieldProps) {\n\treturn (\n\t\t<div data-slot=\"field\" className={cn('grid gap-2', className)}>\n\t\t\t<Label\n\t\t\t\thtmlFor={htmlFor}\n\t\t\t\tdata-slot=\"field-label\"\n\t\t\t\tclassName={cn(error && 'text-destructive')}\n\t\t\t>\n\t\t\t\t{label}\n\t\t\t\t{required && (\n\t\t\t\t\t<span className=\"text-destructive ml-1\" aria-hidden=\"true\">\n\t\t\t\t\t\t*\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</Label>\n\n\t\t\t{children}\n\n\t\t\t{description && (\n\t\t\t\t<p\n\t\t\t\t\tdata-slot=\"field-description\"\n\t\t\t\t\tclassName=\"text-muted-foreground text-sm\"\n\t\t\t\t>\n\t\t\t\t\t{description}\n\t\t\t\t</p>\n\t\t\t)}\n\n\t\t\t{error && (\n\t\t\t\t<p\n\t\t\t\t\tdata-slot=\"field-error\"\n\t\t\t\t\tclassName=\"text-destructive text-sm\"\n\t\t\t\t\trole=\"alert\"\n\t\t\t\t>\n\t\t\t\t\t{error}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\n/**\n * FieldRow is a horizontal layout variant for inline controls like checkboxes and switches.\n * Places label beside the control instead of above.\n *\n * @example\n * ```tsx\n * <FieldRow label=\"Enable notifications\" description=\"Receive email updates\" htmlFor=\"notifications\">\n * <Switch id=\"notifications\" />\n * </FieldRow>\n * ```\n */\ninterface FieldRowProps extends Omit<FieldProps, 'required'> {\n\t/** Position of the label relative to the control */\n\tlabelPosition?: 'start' | 'end';\n}\n\nfunction FieldRow({\n\tlabel,\n\tdescription,\n\terror,\n\tlabelPosition = 'end',\n\thtmlFor,\n\tclassName,\n\tchildren,\n}: FieldRowProps) {\n\tconst labelElement = (\n\t\t<Label\n\t\t\thtmlFor={htmlFor}\n\t\t\tdata-slot=\"field-label\"\n\t\t\tclassName={cn(\n\t\t\t\t'text-sm font-medium leading-none',\n\t\t\t\terror && 'text-destructive',\n\t\t\t)}\n\t\t>\n\t\t\t{label}\n\t\t</Label>\n\t);\n\n\treturn (\n\t\t<div data-slot=\"field-row\" className={cn('grid gap-2', className)}>\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t{labelPosition === 'start' && labelElement}\n\t\t\t\t{children}\n\t\t\t\t{labelPosition === 'end' && labelElement}\n\t\t\t</div>\n\n\t\t\t{description && (\n\t\t\t\t<p\n\t\t\t\t\tdata-slot=\"field-description\"\n\t\t\t\t\tclassName=\"text-muted-foreground text-sm\"\n\t\t\t\t>\n\t\t\t\t\t{description}\n\t\t\t\t</p>\n\t\t\t)}\n\n\t\t\t{error && (\n\t\t\t\t<p\n\t\t\t\t\tdata-slot=\"field-error\"\n\t\t\t\t\tclassName=\"text-destructive text-sm\"\n\t\t\t\t\trole=\"alert\"\n\t\t\t\t>\n\t\t\t\t\t{error}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport { Field, FieldRow, type FieldProps, type FieldRowProps };\n"]}
|
|
1
|
+
{"version":3,"file":"field.js","names":["React"],"sources":["../../src/components/field.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\nimport { Separator } from './separator';\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {\n\treturn (\n\t\t<fieldset\n\t\t\tdata-slot='field-set'\n\t\t\tclassName={cn(\n\t\t\t\t'flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FieldLegend({\n\tclassName,\n\tvariant = 'legend',\n\t...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n\treturn (\n\t\t<legend\n\t\t\tdata-slot='field-legend'\n\t\t\tdata-variant={variant}\n\t\t\tclassName={cn('mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot='field-group'\n\t\t\tclassName={cn(\n\t\t\t\t`group/field-group @container/field-group flex w-full flex-col gap-5\n\t\t\t\tdata-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst fieldVariants = cva('group/field flex w-full gap-2 data-[invalid=true]:text-destructive', {\n\tvariants: {\n\t\torientation: {\n\t\t\tvertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n\t\t\thorizontal:\n\t\t\t\t'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n\t\t\tresponsive:\n\t\t\t\t'flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\torientation: 'vertical',\n\t},\n});\n\ntype StructuralFieldProps = React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>;\n\ninterface LegacyFieldProps {\n\tlabel: string;\n\tdescription?: string;\n\tdescriptionId?: string;\n\terror?: string;\n\terrorId?: string;\n\trequired?: boolean;\n\thtmlFor?: string;\n\tclassName?: string;\n\tchildren: React.ReactNode;\n}\n\ntype FieldProps = LegacyFieldProps | StructuralFieldProps;\n\nfunction isLegacyFieldProps(props: FieldProps): props is LegacyFieldProps {\n\treturn typeof (props as LegacyFieldProps).label === 'string';\n}\n\nfunction FieldContainer({ className, orientation = 'vertical', ...props }: StructuralFieldProps) {\n\treturn (\n\t\t<div\n\t\t\trole='group'\n\t\t\tdata-slot='field'\n\t\t\tdata-orientation={orientation}\n\t\t\tclassName={cn(fieldVariants({ orientation }), className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction Field(props: LegacyFieldProps): React.ReactElement;\nfunction Field(props: StructuralFieldProps): React.ReactElement;\nfunction Field(props: FieldProps) {\n\tif (!isLegacyFieldProps(props)) {\n\t\treturn <FieldContainer {...props} />;\n\t}\n\n\tconst {\n\t\tlabel,\n\t\tdescription,\n\t\tdescriptionId,\n\t\terror,\n\t\terrorId,\n\t\trequired,\n\t\thtmlFor,\n\t\tclassName,\n\t\tchildren,\n\t} = props;\n\treturn (\n\t\t<FieldContainer className={className} data-invalid={Boolean(error)}>\n\t\t\t<FieldLabel htmlFor={htmlFor}>\n\t\t\t\t{label}\n\t\t\t\t{required && (\n\t\t\t\t\t<span className='ml-1 text-destructive' aria-hidden='true'>\n\t\t\t\t\t\t*\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</FieldLabel>\n\t\t\t{children}\n\t\t\t{description && <FieldDescription id={descriptionId}>{description}</FieldDescription>}\n\t\t\t{error && <FieldError id={errorId}>{error}</FieldError>}\n\t\t</FieldContainer>\n\t);\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot='field-content'\n\t\t\tclassName={cn('group/field-content flex flex-1 flex-col gap-0.5 leading-snug', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n\treturn (\n\t\t<Label\n\t\t\tdata-slot='field-label'\n\t\t\tclassName={cn(\n\t\t\t\t`group/field-label peer/field-label flex w-fit gap-2 leading-snug\n\t\t\t\tgroup-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5\n\t\t\t\thas-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border\n\t\t\t\t*:data-[slot=field]:p-2.5 has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot='field-label'\n\t\t\tclassName={cn(\n\t\t\t\t'flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {\n\treturn (\n\t\t<p\n\t\t\tdata-slot='field-description'\n\t\t\tclassName={cn(\n\t\t\t\t`text-left text-sm leading-normal font-normal text-muted-foreground\n\t\t\t\tgroup-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5 last:mt-0 nth-last-2:-mt-1\n\t\t\t\t[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FieldSeparator({\n\tchildren,\n\tclassName,\n\t...props\n}: React.ComponentProps<'div'> & {\n\tchildren?: React.ReactNode;\n}) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot='field-separator'\n\t\t\tdata-content={Boolean(children)}\n\t\t\tclassName={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<Separator className='absolute inset-0 top-1/2' />\n\t\t\t{children && (\n\t\t\t\t<span className='relative mx-auto block w-fit bg-background px-2 text-muted-foreground' data-slot='field-separator-content'>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nfunction FieldError({\n\tclassName,\n\tchildren,\n\terrors,\n\t...props\n}: React.ComponentProps<'div'> & {\n\terrors?: Array<{ message?: string } | undefined>;\n}) {\n\tconst content = React.useMemo(() => {\n\t\tif (children) return children;\n\t\tif (!errors?.length) return null;\n\n\t\tconst uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];\n\t\tif (uniqueErrors.length === 1) return uniqueErrors[0]?.message;\n\n\t\treturn (\n\t\t\t<ul className='ml-4 flex list-disc flex-col gap-1'>\n\t\t\t\t{uniqueErrors.map(\n\t\t\t\t\t(error, index) => error?.message && <li key={`${error.message}-${index}`}>{error.message}</li>,\n\t\t\t\t)}\n\t\t\t</ul>\n\t\t);\n\t}, [children, errors]);\n\n\tif (!content) return null;\n\n\treturn (\n\t\t<div\n\t\t\trole='alert'\n\t\t\tdata-slot='field-error'\n\t\t\tclassName={cn('text-sm font-normal text-destructive', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{content}\n\t\t</div>\n\t);\n}\n\ninterface FieldRowProps extends Omit<LegacyFieldProps, 'required'> {\n\tlabelPosition?: 'start' | 'end';\n}\n\nfunction FieldRow({\n\tlabel,\n\tdescription,\n\terror,\n\tlabelPosition = 'end',\n\thtmlFor,\n\tclassName,\n\tchildren,\n}: FieldRowProps) {\n\tconst labelElement = <FieldLabel htmlFor={htmlFor}>{label}</FieldLabel>;\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot='field-row'\n\t\t\tdata-invalid={Boolean(error)}\n\t\t\tclassName={cn('group/field flex flex-col gap-2 data-[invalid=true]:text-destructive', className)}\n\t\t>\n\t\t\t<div className='flex items-center gap-2'>\n\t\t\t\t{labelPosition === 'start' && labelElement}\n\t\t\t\t{children}\n\t\t\t\t{labelPosition === 'end' && labelElement}\n\t\t\t</div>\n\t\t\t{description && <FieldDescription>{description}</FieldDescription>}\n\t\t\t{error && <FieldError>{error}</FieldError>}\n\t\t</div>\n\t);\n}\n\nexport {\n\tField,\n\tFieldContent,\n\tFieldDescription,\n\tFieldError,\n\tFieldGroup,\n\tFieldLabel,\n\tFieldLegend,\n\tFieldRow,\n\tFieldSeparator,\n\tFieldSet,\n\tFieldTitle,\n};\nexport type { FieldProps, FieldRowProps, LegacyFieldProps, StructuralFieldProps };\n"],"mappings":";;;;;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,GAAG,SAA2C;CAC5E,OACC,oBAAC,YAAD;EACC,aAAU;EACV,WAAW,GACV,oGACA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EACpB,WACA,UAAU,UACV,GAAG,SACkE;CACrE,OACC,oBAAC,UAAD;EACC,aAAU;EACV,gBAAc;EACd,WAAW,GAAG,mFAAmF,SAAS;EAC1G,GAAI;CACJ;AAEH;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACzE,OACC,oBAAC,OAAD;EACC,aAAU;EACV,WAAW,GACV;uEAEA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,MAAM,gBAAgB,IAAI,sEAAsE;CAC/F,UAAU,EACT,aAAa;EACZ,UAAU;EACV,YACC;EACD,YACC;CACF,E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WAAU;cAAf;KACE,kBAAkB,WAAW;KAC7B;KACA,kBAAkB,SAAS;IACxB;;GACJ,eAAe,oBAAC,kBAAD,YAAmB,YAA8B;GAChE,SAAS,oBAAC,YAAD,YAAa,MAAkB;EACrC;;AAEP"}
|
|
@@ -0,0 +1,153 @@
|
|
|
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
|
+
let react = require("react");
|
|
7
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
|
|
10
|
+
//#region src/components/flickering-grid.tsx
|
|
11
|
+
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
12
|
+
function subscribeToReducedMotion(onStoreChange) {
|
|
13
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => void 0;
|
|
14
|
+
const mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);
|
|
15
|
+
mediaQuery.addEventListener("change", onStoreChange);
|
|
16
|
+
return () => mediaQuery.removeEventListener("change", onStoreChange);
|
|
17
|
+
}
|
|
18
|
+
function getReducedMotionSnapshot() {
|
|
19
|
+
return typeof window === "undefined" || typeof window.matchMedia !== "function" ? true : window.matchMedia(REDUCED_MOTION_QUERY).matches;
|
|
20
|
+
}
|
|
21
|
+
const FlickeringGrid = ({ squareSize = 4, gridGap = 6, flickerChance = .3, color = "rgb(0, 0, 0)", width, height, className, maxOpacity = .3, ...props }) => {
|
|
22
|
+
const canvasRef = (0, react.useRef)(null);
|
|
23
|
+
const containerRef = (0, react.useRef)(null);
|
|
24
|
+
const [isInView, setIsInView] = (0, react.useState)(false);
|
|
25
|
+
const [canvasSize, setCanvasSize] = (0, react.useState)({
|
|
26
|
+
width: 0,
|
|
27
|
+
height: 0
|
|
28
|
+
});
|
|
29
|
+
const prefersReducedMotion = react.default.useSyncExternalStore(subscribeToReducedMotion, getReducedMotionSnapshot, () => true);
|
|
30
|
+
const memoizedColor = (0, react.useMemo)(() => {
|
|
31
|
+
const toRGBA = (color) => {
|
|
32
|
+
if (typeof window === "undefined") return `rgba(0, 0, 0,`;
|
|
33
|
+
const canvas = document.createElement("canvas");
|
|
34
|
+
canvas.width = canvas.height = 1;
|
|
35
|
+
const ctx = canvas.getContext("2d");
|
|
36
|
+
if (!ctx) return "rgba(255, 0, 0,";
|
|
37
|
+
ctx.fillStyle = color;
|
|
38
|
+
ctx.fillRect(0, 0, 1, 1);
|
|
39
|
+
const [r, g, b] = Array.from(ctx.getImageData(0, 0, 1, 1).data);
|
|
40
|
+
return `rgba(${r}, ${g}, ${b},`;
|
|
41
|
+
};
|
|
42
|
+
return toRGBA(color);
|
|
43
|
+
}, [color]);
|
|
44
|
+
const setupCanvas = (0, react.useCallback)((canvas, width, height) => {
|
|
45
|
+
const dpr = window.devicePixelRatio || 1;
|
|
46
|
+
canvas.width = width * dpr;
|
|
47
|
+
canvas.height = height * dpr;
|
|
48
|
+
canvas.style.width = `${width}px`;
|
|
49
|
+
canvas.style.height = `${height}px`;
|
|
50
|
+
const cols = Math.floor(width / (squareSize + gridGap));
|
|
51
|
+
const rows = Math.floor(height / (squareSize + gridGap));
|
|
52
|
+
const squares = new Float32Array(cols * rows);
|
|
53
|
+
for (let i = 0; i < squares.length; i++) squares[i] = Math.random() * maxOpacity;
|
|
54
|
+
return {
|
|
55
|
+
cols,
|
|
56
|
+
rows,
|
|
57
|
+
squares,
|
|
58
|
+
dpr
|
|
59
|
+
};
|
|
60
|
+
}, [
|
|
61
|
+
squareSize,
|
|
62
|
+
gridGap,
|
|
63
|
+
maxOpacity
|
|
64
|
+
]);
|
|
65
|
+
const updateSquares = (0, react.useCallback)((squares, deltaTime) => {
|
|
66
|
+
for (let i = 0; i < squares.length; i++) if (Math.random() < flickerChance * deltaTime) squares[i] = Math.random() * maxOpacity;
|
|
67
|
+
}, [flickerChance, maxOpacity]);
|
|
68
|
+
const drawGrid = (0, react.useCallback)((ctx, width, height, cols, rows, squares, dpr) => {
|
|
69
|
+
ctx.clearRect(0, 0, width, height);
|
|
70
|
+
ctx.fillStyle = "transparent";
|
|
71
|
+
ctx.fillRect(0, 0, width, height);
|
|
72
|
+
for (let i = 0; i < cols; i++) for (let j = 0; j < rows; j++) {
|
|
73
|
+
const opacity = squares[i * rows + j];
|
|
74
|
+
ctx.fillStyle = `${memoizedColor}${opacity})`;
|
|
75
|
+
ctx.fillRect(i * (squareSize + gridGap) * dpr, j * (squareSize + gridGap) * dpr, squareSize * dpr, squareSize * dpr);
|
|
76
|
+
}
|
|
77
|
+
}, [
|
|
78
|
+
memoizedColor,
|
|
79
|
+
squareSize,
|
|
80
|
+
gridGap
|
|
81
|
+
]);
|
|
82
|
+
(0, react.useEffect)(() => {
|
|
83
|
+
const canvas = canvasRef.current;
|
|
84
|
+
const container = containerRef.current;
|
|
85
|
+
if (!canvas || !container) return;
|
|
86
|
+
const ctx = canvas.getContext("2d");
|
|
87
|
+
if (!ctx) return;
|
|
88
|
+
let animationFrameId;
|
|
89
|
+
let gridParams;
|
|
90
|
+
const updateCanvasSize = () => {
|
|
91
|
+
const newWidth = width || container.clientWidth;
|
|
92
|
+
const newHeight = height || container.clientHeight;
|
|
93
|
+
setCanvasSize({
|
|
94
|
+
width: newWidth,
|
|
95
|
+
height: newHeight
|
|
96
|
+
});
|
|
97
|
+
gridParams = setupCanvas(canvas, newWidth, newHeight);
|
|
98
|
+
drawGrid(ctx, canvas.width, canvas.height, gridParams.cols, gridParams.rows, gridParams.squares, gridParams.dpr);
|
|
99
|
+
};
|
|
100
|
+
updateCanvasSize();
|
|
101
|
+
let lastTime = 0;
|
|
102
|
+
const animate = (time) => {
|
|
103
|
+
if (!isInView) return;
|
|
104
|
+
const deltaTime = (time - lastTime) / 1e3;
|
|
105
|
+
lastTime = time;
|
|
106
|
+
updateSquares(gridParams.squares, deltaTime);
|
|
107
|
+
drawGrid(ctx, canvas.width, canvas.height, gridParams.cols, gridParams.rows, gridParams.squares, gridParams.dpr);
|
|
108
|
+
animationFrameId = requestAnimationFrame(animate);
|
|
109
|
+
};
|
|
110
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
111
|
+
updateCanvasSize();
|
|
112
|
+
});
|
|
113
|
+
resizeObserver.observe(container);
|
|
114
|
+
if (prefersReducedMotion) return () => {
|
|
115
|
+
resizeObserver.disconnect();
|
|
116
|
+
};
|
|
117
|
+
const intersectionObserver = new IntersectionObserver(([entry]) => {
|
|
118
|
+
setIsInView(entry.isIntersecting);
|
|
119
|
+
}, { threshold: 0 });
|
|
120
|
+
intersectionObserver.observe(canvas);
|
|
121
|
+
if (isInView) animationFrameId = requestAnimationFrame(animate);
|
|
122
|
+
return () => {
|
|
123
|
+
cancelAnimationFrame(animationFrameId);
|
|
124
|
+
resizeObserver.disconnect();
|
|
125
|
+
intersectionObserver.disconnect();
|
|
126
|
+
};
|
|
127
|
+
}, [
|
|
128
|
+
setupCanvas,
|
|
129
|
+
updateSquares,
|
|
130
|
+
drawGrid,
|
|
131
|
+
width,
|
|
132
|
+
height,
|
|
133
|
+
isInView,
|
|
134
|
+
prefersReducedMotion
|
|
135
|
+
]);
|
|
136
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
137
|
+
ref: containerRef,
|
|
138
|
+
className: require_utils.cn(`h-full w-full ${className}`),
|
|
139
|
+
...props,
|
|
140
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
|
|
141
|
+
ref: canvasRef,
|
|
142
|
+
className: "pointer-events-none",
|
|
143
|
+
style: {
|
|
144
|
+
width: canvasSize.width,
|
|
145
|
+
height: canvasSize.height
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
exports.FlickeringGrid = FlickeringGrid;
|
|
153
|
+
//# sourceMappingURL=flickering-grid.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flickering-grid.cjs","names":["React","cn"],"sources":["../../src/components/flickering-grid.tsx"],"sourcesContent":["'use client';\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { cn } from '../lib/utils';\n\nconst REDUCED_MOTION_QUERY = '(prefers-reduced-motion: reduce)';\n\nfunction subscribeToReducedMotion(onStoreChange: () => void) {\n\tif (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n\t\treturn () => undefined;\n\t}\n\n\tconst mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);\n\tmediaQuery.addEventListener('change', onStoreChange);\n\treturn () => mediaQuery.removeEventListener('change', onStoreChange);\n}\n\nfunction getReducedMotionSnapshot() {\n\treturn typeof window === 'undefined' || typeof window.matchMedia !== 'function'\n\t\t? true\n\t\t: window.matchMedia(REDUCED_MOTION_QUERY).matches;\n}\n\ninterface FlickeringGridProps extends React.HTMLAttributes<HTMLDivElement> {\n\tsquareSize?: number;\n\tgridGap?: number;\n\tflickerChance?: number;\n\tcolor?: string;\n\twidth?: number;\n\theight?: number;\n\tclassName?: string;\n\tmaxOpacity?: number;\n}\n\nexport const FlickeringGrid: React.FC<FlickeringGridProps> = ({\n\tsquareSize = 4,\n\tgridGap = 6,\n\tflickerChance = 0.3,\n\tcolor = 'rgb(0, 0, 0)',\n\twidth,\n\theight,\n\tclassName,\n\tmaxOpacity = 0.3,\n\t...props\n}) => {\n\tconst canvasRef = useRef<HTMLCanvasElement>(null);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\tconst [isInView, setIsInView] = useState(false);\n\tconst [canvasSize, setCanvasSize] = useState({ width: 0, height: 0 });\n\tconst prefersReducedMotion = React.useSyncExternalStore(\n\t\tsubscribeToReducedMotion,\n\t\tgetReducedMotionSnapshot,\n\t\t() => true,\n\t);\n\n\tconst memoizedColor = useMemo(() => {\n\t\tconst toRGBA = (color: string) => {\n\t\t\tif (typeof window === 'undefined') {\n\t\t\t\treturn `rgba(0, 0, 0,`;\n\t\t\t}\n\t\t\tconst canvas = document.createElement('canvas');\n\t\t\tcanvas.width = canvas.height = 1;\n\t\t\tconst ctx = canvas.getContext('2d');\n\t\t\tif (!ctx) return 'rgba(255, 0, 0,';\n\t\t\tctx.fillStyle = color;\n\t\t\tctx.fillRect(0, 0, 1, 1);\n\t\t\tconst [r, g, b] = Array.from(ctx.getImageData(0, 0, 1, 1).data);\n\t\t\treturn `rgba(${r}, ${g}, ${b},`;\n\t\t};\n\t\treturn toRGBA(color);\n\t}, [color]);\n\n\tconst setupCanvas = useCallback(\n\t\t(canvas: HTMLCanvasElement, width: number, height: number) => {\n\t\t\tconst dpr = window.devicePixelRatio || 1;\n\t\t\tcanvas.width = width * dpr;\n\t\t\tcanvas.height = height * dpr;\n\t\t\tcanvas.style.width = `${width}px`;\n\t\t\tcanvas.style.height = `${height}px`;\n\t\t\tconst cols = Math.floor(width / (squareSize + gridGap));\n\t\t\tconst rows = Math.floor(height / (squareSize + gridGap));\n\n\t\t\tconst squares = new Float32Array(cols * rows);\n\t\t\tfor (let i = 0; i < squares.length; i++) {\n\t\t\t\tsquares[i] = Math.random() * maxOpacity;\n\t\t\t}\n\n\t\t\treturn { cols, rows, squares, dpr };\n\t\t},\n\t\t[squareSize, gridGap, maxOpacity],\n\t);\n\n\tconst updateSquares = useCallback(\n\t\t(squares: Float32Array, deltaTime: number) => {\n\t\t\tfor (let i = 0; i < squares.length; i++) {\n\t\t\t\tif (Math.random() < flickerChance * deltaTime) {\n\t\t\t\t\tsquares[i] = Math.random() * maxOpacity;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[flickerChance, maxOpacity],\n\t);\n\n\tconst drawGrid = useCallback(\n\t\t(\n\t\t\tctx: CanvasRenderingContext2D,\n\t\t\twidth: number,\n\t\t\theight: number,\n\t\t\tcols: number,\n\t\t\trows: number,\n\t\t\tsquares: Float32Array,\n\t\t\tdpr: number,\n\t\t) => {\n\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\tctx.fillStyle = 'transparent';\n\t\t\tctx.fillRect(0, 0, width, height);\n\n\t\t\tfor (let i = 0; i < cols; i++) {\n\t\t\t\tfor (let j = 0; j < rows; j++) {\n\t\t\t\t\tconst opacity = squares[i * rows + j];\n\t\t\t\t\tctx.fillStyle = `${memoizedColor}${opacity})`;\n\t\t\t\t\tctx.fillRect(\n\t\t\t\t\t\ti * (squareSize + gridGap) * dpr,\n\t\t\t\t\t\tj * (squareSize + gridGap) * dpr,\n\t\t\t\t\t\tsquareSize * dpr,\n\t\t\t\t\t\tsquareSize * dpr,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[memoizedColor, squareSize, gridGap],\n\t);\n\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current;\n\t\tconst container = containerRef.current;\n\t\tif (!canvas || !container) return;\n\n\t\tconst ctx = canvas.getContext('2d');\n\t\tif (!ctx) return;\n\n\t\tlet animationFrameId: number;\n\t\tlet gridParams: ReturnType<typeof setupCanvas>;\n\n\t\tconst updateCanvasSize = () => {\n\t\t\tconst newWidth = width || container.clientWidth;\n\t\t\tconst newHeight = height || container.clientHeight;\n\t\t\tsetCanvasSize({ width: newWidth, height: newHeight });\n\t\t\tgridParams = setupCanvas(canvas, newWidth, newHeight);\n\t\t\tdrawGrid(ctx, canvas.width, canvas.height, gridParams.cols, gridParams.rows, gridParams.squares, gridParams.dpr);\n\t\t};\n\n\t\tupdateCanvasSize();\n\n\t\tlet lastTime = 0;\n\t\tconst animate = (time: number) => {\n\t\t\tif (!isInView) return;\n\n\t\t\tconst deltaTime = (time - lastTime) / 1000;\n\t\t\tlastTime = time;\n\n\t\t\tupdateSquares(gridParams.squares, deltaTime);\n\t\t\tdrawGrid(ctx, canvas.width, canvas.height, gridParams.cols, gridParams.rows, gridParams.squares, gridParams.dpr);\n\t\t\tanimationFrameId = requestAnimationFrame(animate);\n\t\t};\n\n\t\tconst resizeObserver = new ResizeObserver(() => {\n\t\t\tupdateCanvasSize();\n\t\t});\n\n\t\tresizeObserver.observe(container);\n\t\tif (prefersReducedMotion) {\n\t\t\treturn () => {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t};\n\t\t}\n\n\t\tconst intersectionObserver = new IntersectionObserver(\n\t\t\t([entry]) => {\n\t\t\t\tsetIsInView(entry.isIntersecting);\n\t\t\t},\n\t\t\t{ threshold: 0 },\n\t\t);\n\n\t\tintersectionObserver.observe(canvas);\n\n\t\tif (isInView) {\n\t\t\tanimationFrameId = requestAnimationFrame(animate);\n\t\t}\n\n\t\treturn () => {\n\t\t\tcancelAnimationFrame(animationFrameId);\n\t\t\tresizeObserver.disconnect();\n\t\t\tintersectionObserver.disconnect();\n\t\t};\n\t}, [setupCanvas, updateSquares, drawGrid, width, height, isInView, prefersReducedMotion]);\n\n\treturn (\n\t\t<div ref={containerRef} className={cn(`h-full w-full ${className}`)} {...props}>\n\t\t\t<canvas\n\t\t\t\tref={canvasRef}\n\t\t\t\tclassName='pointer-events-none'\n\t\t\t\tstyle={{\n\t\t\t\t\twidth: canvasSize.width,\n\t\t\t\t\theight: canvasSize.height,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n"],"mappings":";;;;;;;;;;AAKA,MAAM,uBAAuB;AAE7B,SAAS,yBAAyB,eAA2B;CAC5D,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YACjE,aAAa;CAGd,MAAM,aAAa,OAAO,WAAW,oBAAoB;CACzD,WAAW,iBAAiB,UAAU,aAAa;CACnD,aAAa,WAAW,oBAAoB,UAAU,aAAa;AACpE;AAEA,SAAS,2BAA2B;CACnC,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aAClE,OACA,OAAO,WAAW,oBAAoB,CAAC,CAAC;AAC5C;AAaA,MAAa,kBAAiD,EAC7D,aAAa,GACb,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jC,IAAI,CAAC,UAAU;GAEf,MAAM,aAAa,OAAO,YAAY;GACtC,WAAW;GAEX,cAAc,WAAW,SAAS,SAAS;GAC3C,SAAS,KAAK,OAAO,OAAO,OAAO,QAAQ,WAAW,MAAM,WAAW,MAAM,WAAW,SAAS,WAAW,GAAG;GAC/G,mBAAmB,sBAAsB,OAAO;EACjD;EAEA,MAAM,iBAAiB,IAAI,qBAAqB;GAC/C,iBAAiB;EAClB,CAAC;EAED,eAAe,QAAQ,SAAS;EAChC,IAAI,sBACH,aAAa;GACZ,eAAe,WAAW;EAC3B;EAGD,MAAM,uBAAuB,IAAI,sBAC/B,CAAC,WAAW;GACZ,YAAY,MAAM,cAAc;EACjC,GACA,EAAE,WAAW,EAAE,CAChB;EAEA,qBAAqB,QAAQ,MAAM;EAEnC,IAAI,UACH,mBAAmB,sBAAsB,OAAO;EAGjD,aAAa;GACZ,qBAAqB,gBAAgB;GACrC,eAAe,WAAW;GAC1B,qBAAqB,WAAW;EACjC;CACD,GAAG;EAAC;EAAa;EAAe;EAAU;EAAO;EAAQ;EAAU;CAAoB,CAAC;CAExF,OACC,2CAAC,OAAD;EAAK,KAAK;EAAc,WAAWC,iBAAG,iBAAiB,WAAW;EAAG,GAAI;YACxE,2CAAC,UAAD;GACC,KAAK;GACL,WAAU;GACV,OAAO;IACN,OAAO,WAAW;IAClB,QAAQ,WAAW;GACpB;EACA;CACG;AAEP"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
//#region src/components/flickering-grid.d.ts
|
|
3
|
+
interface FlickeringGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
squareSize?: number;
|
|
5
|
+
gridGap?: number;
|
|
6
|
+
flickerChance?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
maxOpacity?: number;
|
|
12
|
+
}
|
|
13
|
+
declare const FlickeringGrid: React.FC<FlickeringGridProps>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { FlickeringGrid };
|
|
16
|
+
//# sourceMappingURL=flickering-grid.d.cts.map
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
interface FlickeringGridProps extends
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
//#region src/components/flickering-grid.d.ts
|
|
3
|
+
interface FlickeringGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
squareSize?: number;
|
|
5
|
+
gridGap?: number;
|
|
6
|
+
flickerChance?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
maxOpacity?: number;
|
|
12
12
|
}
|
|
13
|
-
declare const FlickeringGrid:
|
|
14
|
-
|
|
13
|
+
declare const FlickeringGrid: React.FC<FlickeringGridProps>;
|
|
14
|
+
//#endregion
|
|
15
15
|
export { FlickeringGrid };
|
|
16
|
+
//# sourceMappingURL=flickering-grid.d.ts.map
|