@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,147 +1,150 @@
|
|
|
1
|
-
|
|
2
|
-
import { useRef, useState, useMemo, useCallback, useEffect } from 'react';
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
'use client';
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/flickering-grid.tsx
|
|
8
|
+
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
9
|
+
function subscribeToReducedMotion(onStoreChange) {
|
|
10
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => void 0;
|
|
11
|
+
const mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);
|
|
12
|
+
mediaQuery.addEventListener("change", onStoreChange);
|
|
13
|
+
return () => mediaQuery.removeEventListener("change", onStoreChange);
|
|
14
|
+
}
|
|
15
|
+
function getReducedMotionSnapshot() {
|
|
16
|
+
return typeof window === "undefined" || typeof window.matchMedia !== "function" ? true : window.matchMedia(REDUCED_MOTION_QUERY).matches;
|
|
9
17
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
width: canvasSize.width,
|
|
139
|
-
height: canvasSize.height
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
) });
|
|
18
|
+
const FlickeringGrid = ({ squareSize = 4, gridGap = 6, flickerChance = .3, color = "rgb(0, 0, 0)", width, height, className, maxOpacity = .3, ...props }) => {
|
|
19
|
+
const canvasRef = useRef(null);
|
|
20
|
+
const containerRef = useRef(null);
|
|
21
|
+
const [isInView, setIsInView] = useState(false);
|
|
22
|
+
const [canvasSize, setCanvasSize] = useState({
|
|
23
|
+
width: 0,
|
|
24
|
+
height: 0
|
|
25
|
+
});
|
|
26
|
+
const prefersReducedMotion = React.useSyncExternalStore(subscribeToReducedMotion, getReducedMotionSnapshot, () => true);
|
|
27
|
+
const memoizedColor = useMemo(() => {
|
|
28
|
+
const toRGBA = (color) => {
|
|
29
|
+
if (typeof window === "undefined") return `rgba(0, 0, 0,`;
|
|
30
|
+
const canvas = document.createElement("canvas");
|
|
31
|
+
canvas.width = canvas.height = 1;
|
|
32
|
+
const ctx = canvas.getContext("2d");
|
|
33
|
+
if (!ctx) return "rgba(255, 0, 0,";
|
|
34
|
+
ctx.fillStyle = color;
|
|
35
|
+
ctx.fillRect(0, 0, 1, 1);
|
|
36
|
+
const [r, g, b] = Array.from(ctx.getImageData(0, 0, 1, 1).data);
|
|
37
|
+
return `rgba(${r}, ${g}, ${b},`;
|
|
38
|
+
};
|
|
39
|
+
return toRGBA(color);
|
|
40
|
+
}, [color]);
|
|
41
|
+
const setupCanvas = useCallback((canvas, width, height) => {
|
|
42
|
+
const dpr = window.devicePixelRatio || 1;
|
|
43
|
+
canvas.width = width * dpr;
|
|
44
|
+
canvas.height = height * dpr;
|
|
45
|
+
canvas.style.width = `${width}px`;
|
|
46
|
+
canvas.style.height = `${height}px`;
|
|
47
|
+
const cols = Math.floor(width / (squareSize + gridGap));
|
|
48
|
+
const rows = Math.floor(height / (squareSize + gridGap));
|
|
49
|
+
const squares = new Float32Array(cols * rows);
|
|
50
|
+
for (let i = 0; i < squares.length; i++) squares[i] = Math.random() * maxOpacity;
|
|
51
|
+
return {
|
|
52
|
+
cols,
|
|
53
|
+
rows,
|
|
54
|
+
squares,
|
|
55
|
+
dpr
|
|
56
|
+
};
|
|
57
|
+
}, [
|
|
58
|
+
squareSize,
|
|
59
|
+
gridGap,
|
|
60
|
+
maxOpacity
|
|
61
|
+
]);
|
|
62
|
+
const updateSquares = useCallback((squares, deltaTime) => {
|
|
63
|
+
for (let i = 0; i < squares.length; i++) if (Math.random() < flickerChance * deltaTime) squares[i] = Math.random() * maxOpacity;
|
|
64
|
+
}, [flickerChance, maxOpacity]);
|
|
65
|
+
const drawGrid = useCallback((ctx, width, height, cols, rows, squares, dpr) => {
|
|
66
|
+
ctx.clearRect(0, 0, width, height);
|
|
67
|
+
ctx.fillStyle = "transparent";
|
|
68
|
+
ctx.fillRect(0, 0, width, height);
|
|
69
|
+
for (let i = 0; i < cols; i++) for (let j = 0; j < rows; j++) {
|
|
70
|
+
const opacity = squares[i * rows + j];
|
|
71
|
+
ctx.fillStyle = `${memoizedColor}${opacity})`;
|
|
72
|
+
ctx.fillRect(i * (squareSize + gridGap) * dpr, j * (squareSize + gridGap) * dpr, squareSize * dpr, squareSize * dpr);
|
|
73
|
+
}
|
|
74
|
+
}, [
|
|
75
|
+
memoizedColor,
|
|
76
|
+
squareSize,
|
|
77
|
+
gridGap
|
|
78
|
+
]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const canvas = canvasRef.current;
|
|
81
|
+
const container = containerRef.current;
|
|
82
|
+
if (!canvas || !container) return;
|
|
83
|
+
const ctx = canvas.getContext("2d");
|
|
84
|
+
if (!ctx) return;
|
|
85
|
+
let animationFrameId;
|
|
86
|
+
let gridParams;
|
|
87
|
+
const updateCanvasSize = () => {
|
|
88
|
+
const newWidth = width || container.clientWidth;
|
|
89
|
+
const newHeight = height || container.clientHeight;
|
|
90
|
+
setCanvasSize({
|
|
91
|
+
width: newWidth,
|
|
92
|
+
height: newHeight
|
|
93
|
+
});
|
|
94
|
+
gridParams = setupCanvas(canvas, newWidth, newHeight);
|
|
95
|
+
drawGrid(ctx, canvas.width, canvas.height, gridParams.cols, gridParams.rows, gridParams.squares, gridParams.dpr);
|
|
96
|
+
};
|
|
97
|
+
updateCanvasSize();
|
|
98
|
+
let lastTime = 0;
|
|
99
|
+
const animate = (time) => {
|
|
100
|
+
if (!isInView) return;
|
|
101
|
+
const deltaTime = (time - lastTime) / 1e3;
|
|
102
|
+
lastTime = time;
|
|
103
|
+
updateSquares(gridParams.squares, deltaTime);
|
|
104
|
+
drawGrid(ctx, canvas.width, canvas.height, gridParams.cols, gridParams.rows, gridParams.squares, gridParams.dpr);
|
|
105
|
+
animationFrameId = requestAnimationFrame(animate);
|
|
106
|
+
};
|
|
107
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
108
|
+
updateCanvasSize();
|
|
109
|
+
});
|
|
110
|
+
resizeObserver.observe(container);
|
|
111
|
+
if (prefersReducedMotion) return () => {
|
|
112
|
+
resizeObserver.disconnect();
|
|
113
|
+
};
|
|
114
|
+
const intersectionObserver = new IntersectionObserver(([entry]) => {
|
|
115
|
+
setIsInView(entry.isIntersecting);
|
|
116
|
+
}, { threshold: 0 });
|
|
117
|
+
intersectionObserver.observe(canvas);
|
|
118
|
+
if (isInView) animationFrameId = requestAnimationFrame(animate);
|
|
119
|
+
return () => {
|
|
120
|
+
cancelAnimationFrame(animationFrameId);
|
|
121
|
+
resizeObserver.disconnect();
|
|
122
|
+
intersectionObserver.disconnect();
|
|
123
|
+
};
|
|
124
|
+
}, [
|
|
125
|
+
setupCanvas,
|
|
126
|
+
updateSquares,
|
|
127
|
+
drawGrid,
|
|
128
|
+
width,
|
|
129
|
+
height,
|
|
130
|
+
isInView,
|
|
131
|
+
prefersReducedMotion
|
|
132
|
+
]);
|
|
133
|
+
return /* @__PURE__ */ jsx("div", {
|
|
134
|
+
ref: containerRef,
|
|
135
|
+
className: cn(`h-full w-full ${className}`),
|
|
136
|
+
...props,
|
|
137
|
+
children: /* @__PURE__ */ jsx("canvas", {
|
|
138
|
+
ref: canvasRef,
|
|
139
|
+
className: "pointer-events-none",
|
|
140
|
+
style: {
|
|
141
|
+
width: canvasSize.width,
|
|
142
|
+
height: canvasSize.height
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
});
|
|
143
146
|
};
|
|
144
147
|
|
|
148
|
+
//#endregion
|
|
145
149
|
export { FlickeringGrid };
|
|
146
|
-
//# sourceMappingURL=flickering-grid.js.map
|
|
147
150
|
//# sourceMappingURL=flickering-grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/components/flickering-grid.tsx"],"names":["color","width","height"],"mappings":";;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACYO,IAAM,iBAAgD,CAAC;AAAA,EAC7D,UAAA,GAAa,CAAA;AAAA,EACb,OAAA,GAAU,CAAA;AAAA,EACV,aAAA,GAAgB,GAAA;AAAA,EAChB,KAAA,GAAQ,cAAA;AAAA,EACR,KAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA,GAAa,GAAA;AAAA,EACb,GAAG;AACJ,CAAA,KAAM;AACL,EAAA,MAAM,SAAA,GAAY,OAA0B,IAAI,CAAA;AAChD,EAAA,MAAM,YAAA,GAAe,OAAuB,IAAI,CAAA;AAChD,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA;AAC9C,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,QAAA,CAAS,EAAE,KAAA,EAAO,CAAA,EAAG,MAAA,EAA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MAAM,CAAA;AAEnC,IAAA,IAAI,QAAA,EAAU;AACb,MAAA,gBAAA,GAAmB,sBAAsB,OAAO,CAAA;AAAA,IACjD;AAEA,IAAA,OAAO,MAAM;AACZ,MAAA,oBAAA,CAAqB,gBAAgB,CAAA;AACrC,MAAA,cAAA,CAAe,UAAA,EAAW;AAC1B,MAAA,oBAAA,CAAqB,UAAA,EAAW;AAAA,IACjC,CAAA;AAAA,EACD,CAAA,EAAG,CAAC,WAAA,EAAa,aAAA,EAAe,UAAU,KAAA,EAAO,MAAA,EAAQ,QAAQ,CAAC,CAAA;AAElE,EAAA,uBACC,GAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAK,YAAA,EAAc,SAAA,EAAW,EAAA,CAAG,CAAA,cAAA,EAAiB,SAAS,CAAA,CAAE,CAAA,EAAI,GAAG,KAAA,EACxE,QAAA,kBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACA,GAAA,EAAK,SAAA;AAAA,MACL,SAAA,EAAU,qBAAA;AAAA,MACV,KAAA,EAAO;AAAA,QACN,OAAO,UAAA,CAAW,KAAA;AAAA,QAClB,QAAQ,UAAA,CAAW;AAAA;AACpB;AAAA,GACD,EACD,CAAA;AAEF","file":"flickering-grid.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 React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { cn } from '../lib/utils';\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\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};\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\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]);\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"]}
|
|
1
|
+
{"version":3,"file":"flickering-grid.js","names":[],"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,UAAU,GACV,gBAAgB,IAChB,QAAQ,gBACR,OACA,QACA,WACA,aAAa,IACb,GAAG,YACE;CACL,MAAM,YAAY,OAA0B,IAAI;CAChD,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,YAAY,iBAAiB,SAAS;EAAE,OAAO;EAAG,QAAQ;CAAE,CAAC;CACpE,MAAM,uBAAuB,MAAM,qBAClC,0BACA,gCACM,IACP;CAEA,MAAM,gBAAgB,cAAc;EACnC,MAAM,UAAU,UAAkB;GACjC,IAAI,OAAO,WAAW,aACrB,OAAO;GAER,MAAM,SAAS,SAAS,cAAc,QAAQ;GAC9C,OAAO,QAAQ,OA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AAY,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,oBAAC,OAAD;EAAK,KAAK;EAAc,WAAW,GAAG,iBAAiB,WAAW;EAAG,GAAI;YACxE,oBAAC,UAAD;GACC,KAAK;GACL,WAAU;GACV,OAAO;IACN,OAAO,WAAW;IAClB,QAAQ,WAAW;GACpB;EACA;CACG;AAEP"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
5
|
+
const require_components_button = require('./button.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _xyflow_react = require("@xyflow/react");
|
|
9
|
+
let _remixicon_react = require("@remixicon/react");
|
|
10
|
+
|
|
11
|
+
//#region src/components/flow-zoom-panel.tsx
|
|
12
|
+
const BUTTON_CLASS = "text-muted-foreground/80 hover:text-muted-foreground bg-card size-10 rounded-none shadow-none first:rounded-s-lg last:rounded-e-lg focus-visible:z-10";
|
|
13
|
+
function FlowZoomPanel({ className, position = "bottom-right", fitViewIcon = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_remixicon_react.RiFocus3Line, {
|
|
14
|
+
className: "size-5",
|
|
15
|
+
"aria-hidden": "true"
|
|
16
|
+
}), fitViewOptions }) {
|
|
17
|
+
const { zoomIn, zoomOut, fitView } = (0, _xyflow_react.useReactFlow)();
|
|
18
|
+
const onFitView = (0, react.useCallback)(() => {
|
|
19
|
+
fitView(fitViewOptions);
|
|
20
|
+
}, [fitView, fitViewOptions]);
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_xyflow_react.Panel, {
|
|
22
|
+
"data-slot": "flow-zoom-panel",
|
|
23
|
+
position,
|
|
24
|
+
className: require_utils.cn("inline-flex -space-x-px rounded-md shadow-xs rtl:space-x-reverse", className),
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
|
|
27
|
+
variant: "outline",
|
|
28
|
+
size: "icon",
|
|
29
|
+
className: BUTTON_CLASS,
|
|
30
|
+
onClick: () => zoomIn(),
|
|
31
|
+
"aria-label": "Zoom in",
|
|
32
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_remixicon_react.RiAddLine, {
|
|
33
|
+
className: "size-5",
|
|
34
|
+
"aria-hidden": "true"
|
|
35
|
+
})
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
|
|
38
|
+
variant: "outline",
|
|
39
|
+
size: "icon",
|
|
40
|
+
className: BUTTON_CLASS,
|
|
41
|
+
onClick: () => zoomOut(),
|
|
42
|
+
"aria-label": "Zoom out",
|
|
43
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_remixicon_react.RiSubtractLine, {
|
|
44
|
+
className: "size-5",
|
|
45
|
+
"aria-hidden": "true"
|
|
46
|
+
})
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
|
|
49
|
+
variant: "outline",
|
|
50
|
+
size: "icon",
|
|
51
|
+
className: BUTTON_CLASS,
|
|
52
|
+
onClick: onFitView,
|
|
53
|
+
"aria-label": "Fit view",
|
|
54
|
+
children: fitViewIcon
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.FlowZoomPanel = FlowZoomPanel;
|
|
62
|
+
//# sourceMappingURL=flow-zoom-panel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-zoom-panel.cjs","names":["RiFocus3Line","Panel","cn","Button","RiAddLine","RiSubtractLine"],"sources":["../../src/components/flow-zoom-panel.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback } from 'react';\nimport { Panel, useReactFlow, type PanelPosition, type FitViewOptions } from '@xyflow/react';\nimport { RiAddLine, RiFocus3Line, RiSubtractLine } from '@remixicon/react';\n\nimport { cn } from '../lib/utils';\nimport { Button } from './button';\n\ninterface FlowZoomPanelProps {\n className?: string;\n position?: PanelPosition;\n fitViewIcon?: React.ReactNode;\n fitViewOptions?: FitViewOptions;\n}\n\nconst BUTTON_CLASS =\n 'text-muted-foreground/80 hover:text-muted-foreground bg-card size-10 rounded-none shadow-none first:rounded-s-lg last:rounded-e-lg focus-visible:z-10';\n\nexport function FlowZoomPanel({\n className,\n position = 'bottom-right',\n fitViewIcon = <RiFocus3Line className='size-5' aria-hidden='true' />,\n fitViewOptions,\n}: FlowZoomPanelProps) {\n const { zoomIn, zoomOut, fitView } = useReactFlow();\n\n const onFitView = useCallback(() => {\n fitView(fitViewOptions);\n }, [fitView, fitViewOptions]);\n\n return (\n <Panel\n data-slot='flow-zoom-panel'\n position={position}\n className={cn('inline-flex -space-x-px rounded-md shadow-xs rtl:space-x-reverse', className)}\n >\n <Button variant='outline' size='icon' className={BUTTON_CLASS} onClick={() => zoomIn()} aria-label='Zoom in'>\n <RiAddLine className='size-5' aria-hidden='true' />\n </Button>\n <Button variant='outline' size='icon' className={BUTTON_CLASS} onClick={() => zoomOut()} aria-label='Zoom out'>\n <RiSubtractLine className='size-5' aria-hidden='true' />\n </Button>\n <Button variant='outline' size='icon' className={BUTTON_CLASS} onClick={onFitView} aria-label='Fit view'>\n {fitViewIcon}\n </Button>\n </Panel>\n );\n}\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,eACJ;AAEF,SAAgB,cAAc,EAC5B,WACA,WAAW,gBACX,cAAc,2CAACA,+BAAD;CAAc,WAAU;CAAS,eAAY;AAAQ,IACnE,kBACqB;CACrB,MAAM,EAAE,QAAQ,SAAS,4CAAyB;CAElD,MAAM,yCAA8B;EAClC,QAAQ,cAAc;CACxB,GAAG,CAAC,SAAS,cAAc,CAAC;CAE5B,OACE,4CAACC,qBAAD;EACE,aAAU;EACA;EACV,WAAWC,iBAAG,oEAAoE,SAAS;YAH7F;GAKE,2CAACC,kCAAD;IAAQ,SAAQ;IAAU,MAAK;IAAO,WAAW;IAAc,eAAe,OAAO;IAAG,cAAW;cACjG,2CAACC,4BAAD;KAAW,WAAU;KAAS,eAAY;IAAQ;GAC5C;GACR,2CAACD,kCAAD;IAAQ,SAAQ;IAAU,MAAK;IAAO,WAAW;IAAc,eAAe,QAAQ;IAAG,cAAW;cAClG,2CAACE,iCAAD;KAAgB,WAAU;KAAS,eAAY;IAAQ;GACjD;GACR,2CAACF,kCAAD;IAAQ,SAAQ;IAAU,MAAK;IAAO,WAAW;IAAc,SAAS;IAAW,cAAW;cAC3F;GACK;EACH;;AAEX"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FitViewOptions, PanelPosition } from "@xyflow/react";
|
|
2
|
+
//#region src/components/flow-zoom-panel.d.ts
|
|
3
|
+
interface FlowZoomPanelProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
position?: PanelPosition;
|
|
6
|
+
fitViewIcon?: React.ReactNode;
|
|
7
|
+
fitViewOptions?: FitViewOptions;
|
|
8
|
+
}
|
|
9
|
+
declare function FlowZoomPanel({ className, position, fitViewIcon, fitViewOptions }: FlowZoomPanelProps): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { FlowZoomPanel };
|
|
12
|
+
//# sourceMappingURL=flow-zoom-panel.d.cts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FitViewOptions, PanelPosition } from "@xyflow/react";
|
|
2
|
+
//#region src/components/flow-zoom-panel.d.ts
|
|
3
|
+
interface FlowZoomPanelProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
position?: PanelPosition;
|
|
6
|
+
fitViewIcon?: React.ReactNode;
|
|
7
|
+
fitViewOptions?: FitViewOptions;
|
|
8
|
+
}
|
|
9
|
+
declare function FlowZoomPanel({ className, position, fitViewIcon, fitViewOptions }: FlowZoomPanelProps): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { FlowZoomPanel };
|
|
12
|
+
//# sourceMappingURL=flow-zoom-panel.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { useCallback } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Panel, useReactFlow } from "@xyflow/react";
|
|
8
|
+
import { RiAddLine, RiFocus3Line, RiSubtractLine } from "@remixicon/react";
|
|
9
|
+
|
|
10
|
+
//#region src/components/flow-zoom-panel.tsx
|
|
11
|
+
const BUTTON_CLASS = "text-muted-foreground/80 hover:text-muted-foreground bg-card size-10 rounded-none shadow-none first:rounded-s-lg last:rounded-e-lg focus-visible:z-10";
|
|
12
|
+
function FlowZoomPanel({ className, position = "bottom-right", fitViewIcon = /* @__PURE__ */ jsx(RiFocus3Line, {
|
|
13
|
+
className: "size-5",
|
|
14
|
+
"aria-hidden": "true"
|
|
15
|
+
}), fitViewOptions }) {
|
|
16
|
+
const { zoomIn, zoomOut, fitView } = useReactFlow();
|
|
17
|
+
const onFitView = useCallback(() => {
|
|
18
|
+
fitView(fitViewOptions);
|
|
19
|
+
}, [fitView, fitViewOptions]);
|
|
20
|
+
return /* @__PURE__ */ jsxs(Panel, {
|
|
21
|
+
"data-slot": "flow-zoom-panel",
|
|
22
|
+
position,
|
|
23
|
+
className: cn("inline-flex -space-x-px rounded-md shadow-xs rtl:space-x-reverse", className),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Button, {
|
|
26
|
+
variant: "outline",
|
|
27
|
+
size: "icon",
|
|
28
|
+
className: BUTTON_CLASS,
|
|
29
|
+
onClick: () => zoomIn(),
|
|
30
|
+
"aria-label": "Zoom in",
|
|
31
|
+
children: /* @__PURE__ */ jsx(RiAddLine, {
|
|
32
|
+
className: "size-5",
|
|
33
|
+
"aria-hidden": "true"
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsx(Button, {
|
|
37
|
+
variant: "outline",
|
|
38
|
+
size: "icon",
|
|
39
|
+
className: BUTTON_CLASS,
|
|
40
|
+
onClick: () => zoomOut(),
|
|
41
|
+
"aria-label": "Zoom out",
|
|
42
|
+
children: /* @__PURE__ */ jsx(RiSubtractLine, {
|
|
43
|
+
className: "size-5",
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsx(Button, {
|
|
48
|
+
variant: "outline",
|
|
49
|
+
size: "icon",
|
|
50
|
+
className: BUTTON_CLASS,
|
|
51
|
+
onClick: onFitView,
|
|
52
|
+
"aria-label": "Fit view",
|
|
53
|
+
children: fitViewIcon
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { FlowZoomPanel };
|
|
61
|
+
//# sourceMappingURL=flow-zoom-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-zoom-panel.js","names":[],"sources":["../../src/components/flow-zoom-panel.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback } from 'react';\nimport { Panel, useReactFlow, type PanelPosition, type FitViewOptions } from '@xyflow/react';\nimport { RiAddLine, RiFocus3Line, RiSubtractLine } from '@remixicon/react';\n\nimport { cn } from '../lib/utils';\nimport { Button } from './button';\n\ninterface FlowZoomPanelProps {\n className?: string;\n position?: PanelPosition;\n fitViewIcon?: React.ReactNode;\n fitViewOptions?: FitViewOptions;\n}\n\nconst BUTTON_CLASS =\n 'text-muted-foreground/80 hover:text-muted-foreground bg-card size-10 rounded-none shadow-none first:rounded-s-lg last:rounded-e-lg focus-visible:z-10';\n\nexport function FlowZoomPanel({\n className,\n position = 'bottom-right',\n fitViewIcon = <RiFocus3Line className='size-5' aria-hidden='true' />,\n fitViewOptions,\n}: FlowZoomPanelProps) {\n const { zoomIn, zoomOut, fitView } = useReactFlow();\n\n const onFitView = useCallback(() => {\n fitView(fitViewOptions);\n }, [fitView, fitViewOptions]);\n\n return (\n <Panel\n data-slot='flow-zoom-panel'\n position={position}\n className={cn('inline-flex -space-x-px rounded-md shadow-xs rtl:space-x-reverse', className)}\n >\n <Button variant='outline' size='icon' className={BUTTON_CLASS} onClick={() => zoomIn()} aria-label='Zoom in'>\n <RiAddLine className='size-5' aria-hidden='true' />\n </Button>\n <Button variant='outline' size='icon' className={BUTTON_CLASS} onClick={() => zoomOut()} aria-label='Zoom out'>\n <RiSubtractLine className='size-5' aria-hidden='true' />\n </Button>\n <Button variant='outline' size='icon' className={BUTTON_CLASS} onClick={onFitView} aria-label='Fit view'>\n {fitViewIcon}\n </Button>\n </Panel>\n );\n}\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,eACJ;AAEF,SAAgB,cAAc,EAC5B,WACA,WAAW,gBACX,cAAc,oBAAC,cAAD;CAAc,WAAU;CAAS,eAAY;AAAQ,IACnE,kBACqB;CACrB,MAAM,EAAE,QAAQ,SAAS,YAAY,aAAa;CAElD,MAAM,YAAY,kBAAkB;EAClC,QAAQ,cAAc;CACxB,GAAG,CAAC,SAAS,cAAc,CAAC;CAE5B,OACE,qBAAC,OAAD;EACE,aAAU;EACA;EACV,WAAW,GAAG,oEAAoE,SAAS;YAH7F;GAKE,oBAAC,QAAD;IAAQ,SAAQ;IAAU,MAAK;IAAO,WAAW;IAAc,eAAe,OAAO;IAAG,cAAW;cACjG,oBAAC,WAAD;KAAW,WAAU;KAAS,eAAY;IAAQ;GAC5C;GACR,oBAAC,QAAD;IAAQ,SAAQ;IAAU,MAAK;IAAO,WAAW;IAAc,eAAe,QAAQ;IAAG,cAAW;cAClG,oBAAC,gBAAD;KAAgB,WAAU;KAAS,eAAY;IAAQ;GACjD;GACR,oBAAC,QAAD;IAAQ,SAAQ;IAAU,MAAK;IAAO,WAAW;IAAc,SAAS;IAAW,cAAW;cAC3F;GACK;EACH;;AAEX"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
|
|
12
|
+
//#region src/components/form-control.tsx
|
|
13
|
+
function FormControl({ children, label, id, layout = "stacked", error, className }) {
|
|
14
|
+
const generatedId = react.useId();
|
|
15
|
+
const inputId = id || generatedId;
|
|
16
|
+
const errorId = error ? `${inputId}-error` : void 0;
|
|
17
|
+
const childProps = {
|
|
18
|
+
id: inputId,
|
|
19
|
+
"aria-invalid": error ? true : void 0,
|
|
20
|
+
"aria-describedby": errorId
|
|
21
|
+
};
|
|
22
|
+
if (layout === "floating") childProps.placeholder = " ";
|
|
23
|
+
const childWithProps = react.cloneElement(children, childProps);
|
|
24
|
+
if (layout === "floating") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25
|
+
className: require_utils.cn("space-y-1", className),
|
|
26
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
27
|
+
className: require_utils.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"),
|
|
28
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_slot.Slot, {
|
|
29
|
+
className: require_utils.cn(error && "border-destructive focus-visible:ring-destructive/20"),
|
|
30
|
+
children: childWithProps
|
|
31
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_label.Label, {
|
|
32
|
+
htmlFor: inputId,
|
|
33
|
+
"data-slot": "form-control-label",
|
|
34
|
+
className: require_utils.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"),
|
|
35
|
+
children: label
|
|
36
|
+
})]
|
|
37
|
+
}), error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
38
|
+
id: errorId,
|
|
39
|
+
className: "text-destructive text-xs",
|
|
40
|
+
role: "alert",
|
|
41
|
+
children: error
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
45
|
+
className: require_utils.cn("grid gap-2", className),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_label.Label, {
|
|
48
|
+
htmlFor: inputId,
|
|
49
|
+
className: require_utils.cn(error && "text-destructive"),
|
|
50
|
+
children: label
|
|
51
|
+
}),
|
|
52
|
+
childWithProps,
|
|
53
|
+
error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
54
|
+
id: errorId,
|
|
55
|
+
className: "text-destructive text-sm",
|
|
56
|
+
role: "alert",
|
|
57
|
+
children: error
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.FormControl = FormControl;
|
|
65
|
+
//# sourceMappingURL=form-control.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control.cjs","names":["React","cn","Slot","Label"],"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,MAAM,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,MAAM,aAAa,UAAU,UAAU;CAE9D,IAAI,WAAW,YACb,OACE,4CAAC,OAAD;EAAK,WAAWC,iBAAG,aAAa,SAAS;YAAzC,CACE,4CAAC,OAAD;GACE,WAAWA,iBACT,YAEA,8EACA,4EACA,gFAEA,wFACA,sFAEA,SAAS,+EACX;aAZF,CAcE,2CAACC,mBAAD;IACE,WAAWD,iBACT,SAAS,sDACX;cAEC;GACG,IACN,2CAACE,gCAAD;IACE,SAAS;IACT,aAAU;IACV,WAAWF,iBAET,oEAEA,yFAEA,oFAEA,SAAS,kBACX;cAEC;GACI,EACJ;MACJ,SACC,2CAAC,KAAD;GAAG,IAAI;GAAS,WAAU;GAA2B,MAAK;aACvD;EACA,EAEF;;CAIT,OACE,4CAAC,OAAD;EAAK,WAAWA,iBAAG,cAAc,SAAS;YAA1C;GACE,2CAACE,gCAAD;IAAO,SAAS;IAAS,WAAWF,iBAAG,SAAS,kBAAkB;cAC/D;GACI;GACN;GACA,SACC,2CAAC,KAAD;IAAG,IAAI;IAAS,WAAU;IAA2B,MAAK;cACvD;GACA;EAEF;;AAET"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/form-control.d.ts
|
|
3
|
+
type FormControlLayout = 'stacked' | 'floating';
|
|
4
|
+
interface FormControlProps {
|
|
5
|
+
children: React$1.ReactElement;
|
|
6
|
+
label: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
layout?: FormControlLayout;
|
|
9
|
+
error?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React$1.JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { FormControl, type FormControlLayout };
|
|
15
|
+
//# sourceMappingURL=form-control.d.cts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/form-control.d.ts
|
|
4
3
|
type FormControlLayout = 'stacked' | 'floating';
|
|
5
4
|
interface FormControlProps {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
children: React$1.ReactElement;
|
|
6
|
+
label: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
layout?: FormControlLayout;
|
|
9
|
+
error?: string;
|
|
10
|
+
className?: string;
|
|
12
11
|
}
|
|
13
|
-
declare function FormControl({ children, label, id, layout, error, className }: FormControlProps):
|
|
14
|
-
|
|
12
|
+
declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React$1.JSX.Element;
|
|
13
|
+
//#endregion
|
|
15
14
|
export { FormControl, type FormControlLayout };
|
|
15
|
+
//# sourceMappingURL=form-control.d.ts.map
|