@constructive-io/ui 0.3.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +17 -22
- package/dist/components/alert-dialog.cjs +333 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +32 -0
- package/dist/components/alert-dialog.d.ts +16 -15
- package/dist/components/alert-dialog.js +89 -102
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +119 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +19 -0
- package/dist/components/alert.d.ts +10 -5
- package/dist/components/alert.js +62 -6
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +367 -0
- package/dist/components/app-bar.cjs.map +1 -0
- package/dist/components/app-bar.d.cts +26 -0
- package/dist/components/app-bar.d.ts +26 -0
- package/dist/components/app-bar.js +344 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-shell.cjs +1792 -0
- package/dist/components/app-shell.cjs.map +1 -0
- package/dist/components/app-shell.d.cts +106 -0
- package/dist/components/app-shell.d.ts +106 -0
- package/dist/components/app-shell.js +1771 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.cjs +418 -0
- package/dist/components/autocomplete.cjs.map +1 -0
- package/dist/components/autocomplete.d.cts +28 -0
- package/dist/components/autocomplete.d.ts +15 -15
- package/dist/components/autocomplete.js +9 -30
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +51 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +12 -0
- package/dist/components/avatar.d.ts +3 -4
- package/dist/components/avatar.js +11 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +66 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +15 -0
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +118 -0
- package/dist/components/breadcrumb.cjs.map +1 -0
- package/dist/components/breadcrumb.d.cts +14 -0
- package/dist/components/breadcrumb.d.ts +9 -9
- package/dist/components/breadcrumb.js +19 -83
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +169 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +20 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +105 -21
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +85 -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 +3 -3
- package/dist/components/card.cjs +99 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +18 -0
- package/dist/components/card.d.ts +7 -8
- package/dist/components/card.js +23 -8
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +18 -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 +2 -2
- package/dist/components/checkbox.cjs +121 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +8 -0
- package/dist/components/checkbox.d.ts +3 -3
- package/dist/components/checkbox.js +73 -41
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +127 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +44 -0
- package/dist/components/collapsible.d.ts +8 -18
- package/dist/components/collapsible.js +7 -27
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +551 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +43 -0
- package/dist/components/combobox.d.ts +17 -18
- package/dist/components/combobox.js +37 -48
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +236 -0
- package/dist/components/command.cjs.map +1 -0
- package/dist/components/command.d.cts +23 -0
- package/dist/components/command.d.ts +14 -15
- package/dist/components/command.js +5 -38
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +431 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +30 -0
- package/dist/components/dialog.d.ts +13 -18
- package/dist/components/dialog.js +75 -119
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +121 -0
- package/dist/components/dock.cjs.map +1 -0
- package/dist/components/dock.d.cts +30 -0
- package/dist/components/dock.d.ts +1 -2
- package/dist/components/dock.js +7 -5
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +149 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +15 -0
- package/dist/components/drawer.d.ts +10 -11
- package/dist/components/drawer.js +11 -40
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +292 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +52 -0
- package/dist/components/dropdown-menu.d.ts +23 -21
- package/dist/components/dropdown-menu.js +67 -191
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +106 -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 +99 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.cjs +295 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +46 -0
- package/dist/components/field.d.ts +34 -39
- package/dist/components/field.js +220 -72
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +176 -0
- package/dist/components/flickering-grid.cjs.map +1 -0
- package/dist/components/flickering-grid.d.cts +15 -0
- package/dist/components/flickering-grid.js +25 -2
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +194 -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 +173 -0
- package/dist/components/flow-zoom-panel.js.map +1 -0
- package/dist/components/form-control.cjs +193 -0
- package/dist/components/form-control.cjs.map +1 -0
- package/dist/components/form-control.d.cts +14 -0
- package/dist/components/form-control.d.ts +1 -2
- package/dist/components/form-control.js +2 -4
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +208 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +36 -0
- package/dist/components/form.d.ts +7 -8
- package/dist/components/input-group.cjs +184 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +17 -0
- package/dist/components/input-group.d.ts +6 -7
- package/dist/components/input-group.js +3 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +62 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +10 -0
- package/dist/components/input.d.ts +1 -2
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +351 -0
- package/dist/components/json-input.cjs.map +1 -0
- package/dist/components/json-input.d.cts +25 -0
- package/dist/components/json-input.d.ts +3 -3
- package/dist/components/json-input.js +89 -112
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +29 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +10 -0
- package/dist/components/label.d.ts +1 -2
- package/dist/components/motion-grid.cjs +108 -0
- package/dist/components/motion-grid.cjs.map +1 -0
- package/dist/components/motion-grid.d.cts +19 -0
- package/dist/components/motion-grid.d.ts +1 -2
- package/dist/components/motion-grid.js +9 -4
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +796 -0
- package/dist/components/multi-select.cjs.map +1 -0
- package/dist/components/multi-select.d.cts +198 -0
- package/dist/components/multi-select.js +54 -162
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +19 -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 +2 -2
- package/dist/components/pagination.cjs +295 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +18 -0
- package/dist/components/pagination.d.ts +7 -8
- package/dist/components/pagination.js +152 -29
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +140 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +39 -0
- package/dist/components/popover.d.ts +13 -9
- package/dist/components/popover.js +56 -132
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +109 -0
- package/dist/components/portal.cjs.map +1 -0
- package/dist/components/portal.d.cts +117 -0
- package/dist/components/portal.d.ts +16 -7
- package/dist/components/portal.js +13 -8
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +31 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +9 -0
- package/dist/components/progress.d.ts +1 -2
- package/dist/components/progress.js +1 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +144 -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 +2 -2
- package/dist/components/progressive-blur.cjs +70 -0
- package/dist/components/progressive-blur.cjs.map +1 -0
- package/dist/components/progressive-blur.d.cts +16 -0
- package/dist/components/progressive-blur.d.ts +2 -2
- package/dist/components/radio-group.cjs +52 -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 +3 -3
- package/dist/components/radio-group.js +21 -10
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +420 -0
- package/dist/components/record-picker.cjs.map +1 -0
- package/dist/components/record-picker.d.cts +16 -0
- package/dist/components/record-picker.d.ts +2 -2
- package/dist/components/record-picker.js +76 -43
- package/dist/components/record-picker.js.map +1 -1
- package/dist/components/resizable.cjs +76 -0
- package/dist/components/resizable.cjs.map +1 -0
- package/dist/components/resizable.d.cts +10 -0
- package/dist/components/resizable.d.ts +3 -4
- package/dist/components/responsive-diagram.cjs +67 -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 +2 -2
- package/dist/components/scroll-area.cjs +92 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +11 -0
- package/dist/components/scroll-area.d.ts +5 -6
- package/dist/components/select.cjs +329 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +46 -0
- package/dist/components/select.d.ts +13 -14
- package/dist/components/select.js +76 -67
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +26 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +10 -0
- package/dist/components/separator.d.ts +1 -2
- package/dist/components/sheet.cjs +489 -0
- package/dist/components/sheet.cjs.map +1 -0
- package/dist/components/sheet.d.cts +107 -0
- package/dist/components/sheet.d.ts +14 -19
- package/dist/components/sheet.js +119 -264
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.cjs +1300 -0
- package/dist/components/sidebar.cjs.map +1 -0
- package/dist/components/sidebar.d.cts +70 -0
- package/dist/components/sidebar.d.ts +32 -39
- package/dist/components/sidebar.js +401 -362
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.cjs +36 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +10 -0
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +19 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +25 -0
- package/dist/components/sonner.cjs.map +1 -0
- package/dist/components/sonner.d.cts +10 -0
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/stack/index.cjs +1516 -0
- package/dist/components/stack/index.cjs.map +1 -0
- package/dist/components/stack/index.d.cts +672 -0
- package/dist/components/stack/index.d.ts +36 -38
- package/dist/components/stack/index.js +42 -31
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/stepper.cjs +314 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +31 -0
- package/dist/components/stepper.d.ts +9 -8
- package/dist/components/stepper.js +22 -15
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +46 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +7 -0
- package/dist/components/switch.d.ts +1 -2
- package/dist/components/switch.js +9 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +133 -0
- package/dist/components/table.cjs.map +1 -0
- package/dist/components/table.d.cts +22 -0
- package/dist/components/table.d.ts +19 -12
- package/dist/components/table.js +72 -13
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +53 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +9 -0
- package/dist/components/tabs.d.ts +4 -5
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +451 -0
- package/dist/components/tags.cjs.map +1 -0
- package/dist/components/tags.d.cts +40 -0
- package/dist/components/tags.d.ts +10 -10
- package/dist/components/tags.js +129 -154
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +56 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +9 -0
- package/dist/components/textarea.d.ts +1 -2
- package/dist/components/toast/index.cjs +612 -0
- package/dist/components/toast/index.cjs.map +1 -0
- package/dist/components/toast/index.d.cts +52 -0
- package/dist/components/toast/index.js +90 -127
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/tooltip.cjs +92 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +28 -0
- package/dist/components/tooltip.d.ts +5 -6
- package/dist/components/tooltip.js +23 -130
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +197 -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 +2 -2
- package/dist/components/unlink-button.js +105 -21
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/index.cjs +2040 -1577
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +492 -509
- package/dist/index.d.ts +492 -509
- package/dist/index.js +1862 -1443
- package/dist/index.js.map +1 -1
- package/package.json +286 -45
- 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
|
@@ -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,EAAQ,CAAA,EAA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AEnC,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,"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;ACAA,IAAM,oBAAA,GAAuB,kCAAA;AAE7B,SAAS,yBAAyB,aAAA,EAA2B;AAC5D,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,MAAA,CAAO,eAAe,UAAA,EAAY;AAC7E,IAAA,OAA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;AACZ,QAAA,WAAA,CAAY,MAAM,cAAc,CAAA;AAAA,MACjC,CAAA;AAAA,MACA,EAAE,WAAW,CAAA;AAAE,KAChB;AAEA,IAAA,oBAAA,CAAqB,QAAQ,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,QAAA,EAAU,oBAAoB,CAAC,CAAA;AAExF,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';\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"]}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var react = require('@xyflow/react');
|
|
6
|
+
var react$1 = require('@remixicon/react');
|
|
7
|
+
var clsx = require('clsx');
|
|
8
|
+
var tailwindMerge = require('tailwind-merge');
|
|
9
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
31
|
+
|
|
32
|
+
function cn(...inputs) {
|
|
33
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
34
|
+
}
|
|
35
|
+
function composeRefs(...refs) {
|
|
36
|
+
return (node) => {
|
|
37
|
+
refs.forEach((ref) => {
|
|
38
|
+
if (typeof ref === "function") {
|
|
39
|
+
ref(node);
|
|
40
|
+
} else if (ref != null) {
|
|
41
|
+
ref.current = node;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function mergeProps(slotProps, childProps) {
|
|
47
|
+
const overrideProps = { ...childProps };
|
|
48
|
+
for (const propName in childProps) {
|
|
49
|
+
if (propName === "ref") continue;
|
|
50
|
+
const slotPropValue = slotProps[propName];
|
|
51
|
+
const childPropValue = childProps[propName];
|
|
52
|
+
if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
53
|
+
overrideProps[propName] = (...args) => {
|
|
54
|
+
childPropValue(...args);
|
|
55
|
+
slotPropValue(...args);
|
|
56
|
+
};
|
|
57
|
+
} else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
|
|
58
|
+
overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
|
|
59
|
+
} else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
|
|
60
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { ...slotProps, ...overrideProps };
|
|
64
|
+
}
|
|
65
|
+
function isSlottable(child) {
|
|
66
|
+
return React__namespace.isValidElement(child);
|
|
67
|
+
}
|
|
68
|
+
var Slot = React__namespace.forwardRef((props, forwardedRef) => {
|
|
69
|
+
const { children, ...slotProps } = props;
|
|
70
|
+
if (isSlottable(children)) {
|
|
71
|
+
const childProps = children.props;
|
|
72
|
+
const childRef = childProps.ref;
|
|
73
|
+
return React__namespace.cloneElement(children, {
|
|
74
|
+
...mergeProps(slotProps, childProps),
|
|
75
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (React__namespace.Children.count(children) > 1) {
|
|
79
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
80
|
+
const slottableChild = childrenArray.find(
|
|
81
|
+
(child) => React__namespace.isValidElement(child) && child.type === Slottable
|
|
82
|
+
);
|
|
83
|
+
if (slottableChild) {
|
|
84
|
+
const newElement = slottableChild.props.children;
|
|
85
|
+
if (isSlottable(newElement)) {
|
|
86
|
+
const newElementProps = newElement.props;
|
|
87
|
+
const newChildren = childrenArray.map((child) => {
|
|
88
|
+
if (child === slottableChild) {
|
|
89
|
+
return React__namespace.Children.count(newElementProps.children) > 1 ? React__namespace.Children.only(null) : newElementProps.children;
|
|
90
|
+
}
|
|
91
|
+
return child;
|
|
92
|
+
});
|
|
93
|
+
const childRef = newElementProps.ref;
|
|
94
|
+
return React__namespace.cloneElement(newElement, {
|
|
95
|
+
...mergeProps(slotProps, newElementProps),
|
|
96
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
97
|
+
children: newChildren
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
103
|
+
});
|
|
104
|
+
Slot.displayName = "Slot";
|
|
105
|
+
function Slottable({ children }) {
|
|
106
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
107
|
+
}
|
|
108
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
109
|
+
"[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-sm outline-none transition-[box-shadow,scale] duration-150 ease-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 motion-reduce:transition-shadow [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
110
|
+
{
|
|
111
|
+
defaultVariants: {
|
|
112
|
+
size: "default",
|
|
113
|
+
static: false,
|
|
114
|
+
variant: "default"
|
|
115
|
+
},
|
|
116
|
+
variants: {
|
|
117
|
+
static: {
|
|
118
|
+
false: "motion-safe:active:not-disabled:scale-[0.96]",
|
|
119
|
+
true: null
|
|
120
|
+
},
|
|
121
|
+
size: {
|
|
122
|
+
default: "h-10 min-w-10 px-[calc(--spacing(3)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
123
|
+
icon: "size-10 pointer-coarse:size-11",
|
|
124
|
+
"icon-lg": "size-11",
|
|
125
|
+
"icon-sm": "size-8 pointer-coarse:size-11",
|
|
126
|
+
"icon-xl": 'size-11 [&_svg:not([class*="size-"])]:size-5',
|
|
127
|
+
"icon-xs": 'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:size-11 not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-4',
|
|
128
|
+
lg: "h-11 min-w-11 px-[calc(--spacing(3.5)-1px)]",
|
|
129
|
+
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
130
|
+
xl: 'h-12 min-w-12 px-[calc(--spacing(4)-1px)] text-lg [&_svg:not([class*="size-"])]:size-5',
|
|
131
|
+
xs: 'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-xs before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11 [&_svg:not([class*="size-"])]:size-3.5'
|
|
132
|
+
},
|
|
133
|
+
variant: {
|
|
134
|
+
default: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
135
|
+
destructive: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
136
|
+
"destructive-outline": "border-destructive/40 bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/60 [:hover,[data-pressed]]:bg-destructive/8",
|
|
137
|
+
ghost: "border-transparent hover:bg-accent data-pressed:bg-accent",
|
|
138
|
+
link: "border-transparent underline-offset-4 hover:underline",
|
|
139
|
+
outline: "border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
|
|
140
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
var Button = React__namespace.forwardRef(
|
|
146
|
+
({ className, variant, size, static: isStatic, asChild, children, type = "button", ...props }, ref) => {
|
|
147
|
+
const buttonClasses = cn(buttonVariants({ className, size, static: isStatic, variant }));
|
|
148
|
+
const Comp = asChild ? Slot : "button";
|
|
149
|
+
if (asChild) {
|
|
150
|
+
const SlottedComp = Comp;
|
|
151
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
152
|
+
SlottedComp,
|
|
153
|
+
{
|
|
154
|
+
ref,
|
|
155
|
+
className: buttonClasses,
|
|
156
|
+
"data-slot": "button",
|
|
157
|
+
...props,
|
|
158
|
+
children
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { ref, type, className: buttonClasses, "data-slot": "button", ...props, children });
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
Button.displayName = "Button";
|
|
166
|
+
var 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";
|
|
167
|
+
function FlowZoomPanel({
|
|
168
|
+
className,
|
|
169
|
+
position = "bottom-right",
|
|
170
|
+
fitViewIcon = /* @__PURE__ */ jsxRuntime.jsx(react$1.RiFocus3Line, { className: "size-5", "aria-hidden": "true" }),
|
|
171
|
+
fitViewOptions
|
|
172
|
+
}) {
|
|
173
|
+
const { zoomIn, zoomOut, fitView } = react.useReactFlow();
|
|
174
|
+
const onFitView = React.useCallback(() => {
|
|
175
|
+
fitView(fitViewOptions);
|
|
176
|
+
}, [fitView, fitViewOptions]);
|
|
177
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
178
|
+
react.Panel,
|
|
179
|
+
{
|
|
180
|
+
"data-slot": "flow-zoom-panel",
|
|
181
|
+
position,
|
|
182
|
+
className: cn("inline-flex -space-x-px rounded-md shadow-xs rtl:space-x-reverse", className),
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: () => zoomIn(), "aria-label": "Zoom in", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.RiAddLine, { className: "size-5", "aria-hidden": "true" }) }),
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: () => zoomOut(), "aria-label": "Zoom out", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.RiSubtractLine, { className: "size-5", "aria-hidden": "true" }) }),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: onFitView, "aria-label": "Fit view", children: fitViewIcon })
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
exports.FlowZoomPanel = FlowZoomPanel;
|
|
193
|
+
//# sourceMappingURL=flow-zoom-panel.cjs.map
|
|
194
|
+
//# sourceMappingURL=flow-zoom-panel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/lib/slot.tsx","../../src/components/button.tsx","../../src/components/flow-zoom-panel.tsx"],"names":["twMerge","clsx","React","cva","React2","jsx","RiFocus3Line","useReactFlow","useCallback","jsxs","Panel","RiAddLine","RiSubtractLine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAOA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACGA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,KAAQ;AACrB,MAAA,IAAI,OAAO,QAAQ,UAAA,EAAY;AAC9B,QAAA,GAAA,CAAI,IAAI,CAAA;AAA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"flow-zoom-panel.cjs","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\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { Slot } from '../lib/slot';\nimport { cn } from '../lib/utils';\n\nconst buttonVariants = cva(\n\t\"[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-sm outline-none transition-[box-shadow,scale] duration-150 ease-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 motion-reduce:transition-shadow [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n\t{\n\t\tdefaultVariants: {\n\t\t\tsize: 'default',\n\t\t\tstatic: false,\n\t\t\tvariant: 'default',\n\t\t},\n\t\tvariants: {\n\t\t\tstatic: {\n\t\t\t\tfalse: 'motion-safe:active:not-disabled:scale-[0.96]',\n\t\t\t\ttrue: null,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: 'h-10 min-w-10 px-[calc(--spacing(3)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11',\n\t\t\t\ticon: 'size-10 pointer-coarse:size-11',\n\t\t\t\t'icon-lg': 'size-11',\n\t\t\t\t'icon-sm': 'size-8 pointer-coarse:size-11',\n\t\t\t\t'icon-xl': 'size-11 [&_svg:not([class*=\"size-\"])]:size-5',\n\t\t\t\t'icon-xs':\n\t\t\t\t\t'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:size-11 not-in-data-[slot=input-group]:[&_svg:not([class*=\"size-\"])]:size-4',\n\t\t\t\tlg: 'h-11 min-w-11 px-[calc(--spacing(3.5)-1px)]',\n\t\t\t\tsm:\n\t\t\t\t\t'h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11',\n\t\t\t\txl: 'h-12 min-w-12 px-[calc(--spacing(4)-1px)] text-lg [&_svg:not([class*=\"size-\"])]:size-5',\n\t\t\t\txs:\n\t\t\t\t\t'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-xs before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11 [&_svg:not([class*=\"size-\"])]:size-3.5',\n\t\t\t},\n\t\t\tvariant: {\n\t\t\t\tdefault:\n\t\t\t\t\t'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',\n\t\t\t\tdestructive:\n\t\t\t\t\t'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',\n\t\t\t\t'destructive-outline':\n\t\t\t\t\t'border-destructive/40 bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/60 [:hover,[data-pressed]]:bg-destructive/8',\n\t\t\t\tghost: 'border-transparent hover:bg-accent data-pressed:bg-accent',\n\t\t\t\tlink: 'border-transparent underline-offset-4 hover:underline',\n\t\t\t\toutline:\n\t\t\t\t\t'border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64',\n\t\t\t\tsecondary:\n\t\t\t\t\t'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80',\n\t\t\t},\n\t\t},\n\t},\n);\n\ninterface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\tvariant?: VariantProps<typeof buttonVariants>['variant'];\n\tsize?: VariantProps<typeof buttonVariants>['size'];\n\t/** Disables tactile press scaling when motion would distract from the interaction. */\n\tstatic?: boolean;\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n\t({ className, variant, size, static: isStatic, asChild, children, type = 'button', ...props }, ref) => {\n\t\tconst buttonClasses = cn(buttonVariants({ className, size, static: isStatic, variant }));\n\t\tconst Comp = asChild ? Slot : 'button';\n\n\t\tif (asChild) {\n\t\t\tconst SlottedComp = Comp as typeof Slot;\n\t\t\treturn (\n\t\t\t\t<SlottedComp\n\t\t\t\t\tref={ref as React.Ref<HTMLElement>}\n\t\t\t\t\tclassName={buttonClasses}\n\t\t\t\t\tdata-slot=\"button\"\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</SlottedComp>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<button ref={ref} type={type} className={buttonClasses} data-slot=\"button\" {...props}>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t},\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\nexport type { ButtonProps };\n","'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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { PanelPosition, FitViewOptions } from '@xyflow/react';
|
|
3
|
+
|
|
4
|
+
interface FlowZoomPanelProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
position?: PanelPosition;
|
|
7
|
+
fitViewIcon?: React.ReactNode;
|
|
8
|
+
fitViewOptions?: FitViewOptions;
|
|
9
|
+
}
|
|
10
|
+
declare function FlowZoomPanel({ className, position, fitViewIcon, fitViewOptions, }: FlowZoomPanelProps): React$1.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { FlowZoomPanel };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { PanelPosition, FitViewOptions } from '@xyflow/react';
|
|
3
|
+
|
|
4
|
+
interface FlowZoomPanelProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
position?: PanelPosition;
|
|
7
|
+
fitViewIcon?: React.ReactNode;
|
|
8
|
+
fitViewOptions?: FitViewOptions;
|
|
9
|
+
}
|
|
10
|
+
declare function FlowZoomPanel({ className, position, fitViewIcon, fitViewOptions, }: FlowZoomPanelProps): React$1.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { FlowZoomPanel };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { useReactFlow, Panel } from '@xyflow/react';
|
|
5
|
+
import { RiAddLine, RiSubtractLine, RiFocus3Line } from '@remixicon/react';
|
|
6
|
+
import { clsx } from 'clsx';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { cva } from 'class-variance-authority';
|
|
9
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
function cn(...inputs) {
|
|
12
|
+
return twMerge(clsx(inputs));
|
|
13
|
+
}
|
|
14
|
+
function composeRefs(...refs) {
|
|
15
|
+
return (node) => {
|
|
16
|
+
refs.forEach((ref) => {
|
|
17
|
+
if (typeof ref === "function") {
|
|
18
|
+
ref(node);
|
|
19
|
+
} else if (ref != null) {
|
|
20
|
+
ref.current = node;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function mergeProps(slotProps, childProps) {
|
|
26
|
+
const overrideProps = { ...childProps };
|
|
27
|
+
for (const propName in childProps) {
|
|
28
|
+
if (propName === "ref") continue;
|
|
29
|
+
const slotPropValue = slotProps[propName];
|
|
30
|
+
const childPropValue = childProps[propName];
|
|
31
|
+
if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
32
|
+
overrideProps[propName] = (...args) => {
|
|
33
|
+
childPropValue(...args);
|
|
34
|
+
slotPropValue(...args);
|
|
35
|
+
};
|
|
36
|
+
} else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
|
|
37
|
+
overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
|
|
38
|
+
} else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
|
|
39
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { ...slotProps, ...overrideProps };
|
|
43
|
+
}
|
|
44
|
+
function isSlottable(child) {
|
|
45
|
+
return React.isValidElement(child);
|
|
46
|
+
}
|
|
47
|
+
var Slot = React.forwardRef((props, forwardedRef) => {
|
|
48
|
+
const { children, ...slotProps } = props;
|
|
49
|
+
if (isSlottable(children)) {
|
|
50
|
+
const childProps = children.props;
|
|
51
|
+
const childRef = childProps.ref;
|
|
52
|
+
return React.cloneElement(children, {
|
|
53
|
+
...mergeProps(slotProps, childProps),
|
|
54
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (React.Children.count(children) > 1) {
|
|
58
|
+
const childrenArray = React.Children.toArray(children);
|
|
59
|
+
const slottableChild = childrenArray.find(
|
|
60
|
+
(child) => React.isValidElement(child) && child.type === Slottable
|
|
61
|
+
);
|
|
62
|
+
if (slottableChild) {
|
|
63
|
+
const newElement = slottableChild.props.children;
|
|
64
|
+
if (isSlottable(newElement)) {
|
|
65
|
+
const newElementProps = newElement.props;
|
|
66
|
+
const newChildren = childrenArray.map((child) => {
|
|
67
|
+
if (child === slottableChild) {
|
|
68
|
+
return React.Children.count(newElementProps.children) > 1 ? React.Children.only(null) : newElementProps.children;
|
|
69
|
+
}
|
|
70
|
+
return child;
|
|
71
|
+
});
|
|
72
|
+
const childRef = newElementProps.ref;
|
|
73
|
+
return React.cloneElement(newElement, {
|
|
74
|
+
...mergeProps(slotProps, newElementProps),
|
|
75
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
76
|
+
children: newChildren
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
82
|
+
});
|
|
83
|
+
Slot.displayName = "Slot";
|
|
84
|
+
function Slottable({ children }) {
|
|
85
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
86
|
+
}
|
|
87
|
+
var buttonVariants = cva(
|
|
88
|
+
"[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-sm outline-none transition-[box-shadow,scale] duration-150 ease-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 motion-reduce:transition-shadow [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
89
|
+
{
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
size: "default",
|
|
92
|
+
static: false,
|
|
93
|
+
variant: "default"
|
|
94
|
+
},
|
|
95
|
+
variants: {
|
|
96
|
+
static: {
|
|
97
|
+
false: "motion-safe:active:not-disabled:scale-[0.96]",
|
|
98
|
+
true: null
|
|
99
|
+
},
|
|
100
|
+
size: {
|
|
101
|
+
default: "h-10 min-w-10 px-[calc(--spacing(3)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
102
|
+
icon: "size-10 pointer-coarse:size-11",
|
|
103
|
+
"icon-lg": "size-11",
|
|
104
|
+
"icon-sm": "size-8 pointer-coarse:size-11",
|
|
105
|
+
"icon-xl": 'size-11 [&_svg:not([class*="size-"])]:size-5',
|
|
106
|
+
"icon-xs": 'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:size-11 not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-4',
|
|
107
|
+
lg: "h-11 min-w-11 px-[calc(--spacing(3.5)-1px)]",
|
|
108
|
+
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
109
|
+
xl: 'h-12 min-w-12 px-[calc(--spacing(4)-1px)] text-lg [&_svg:not([class*="size-"])]:size-5',
|
|
110
|
+
xs: 'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-xs before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11 [&_svg:not([class*="size-"])]:size-3.5'
|
|
111
|
+
},
|
|
112
|
+
variant: {
|
|
113
|
+
default: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
114
|
+
destructive: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
115
|
+
"destructive-outline": "border-destructive/40 bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/60 [:hover,[data-pressed]]:bg-destructive/8",
|
|
116
|
+
ghost: "border-transparent hover:bg-accent data-pressed:bg-accent",
|
|
117
|
+
link: "border-transparent underline-offset-4 hover:underline",
|
|
118
|
+
outline: "border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
|
|
119
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
var Button = React.forwardRef(
|
|
125
|
+
({ className, variant, size, static: isStatic, asChild, children, type = "button", ...props }, ref) => {
|
|
126
|
+
const buttonClasses = cn(buttonVariants({ className, size, static: isStatic, variant }));
|
|
127
|
+
const Comp = asChild ? Slot : "button";
|
|
128
|
+
if (asChild) {
|
|
129
|
+
const SlottedComp = Comp;
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
131
|
+
SlottedComp,
|
|
132
|
+
{
|
|
133
|
+
ref,
|
|
134
|
+
className: buttonClasses,
|
|
135
|
+
"data-slot": "button",
|
|
136
|
+
...props,
|
|
137
|
+
children
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
return /* @__PURE__ */ jsx("button", { ref, type, className: buttonClasses, "data-slot": "button", ...props, children });
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
Button.displayName = "Button";
|
|
145
|
+
var 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";
|
|
146
|
+
function FlowZoomPanel({
|
|
147
|
+
className,
|
|
148
|
+
position = "bottom-right",
|
|
149
|
+
fitViewIcon = /* @__PURE__ */ jsx(RiFocus3Line, { className: "size-5", "aria-hidden": "true" }),
|
|
150
|
+
fitViewOptions
|
|
151
|
+
}) {
|
|
152
|
+
const { zoomIn, zoomOut, fitView } = useReactFlow();
|
|
153
|
+
const onFitView = useCallback(() => {
|
|
154
|
+
fitView(fitViewOptions);
|
|
155
|
+
}, [fitView, fitViewOptions]);
|
|
156
|
+
return /* @__PURE__ */ jsxs(
|
|
157
|
+
Panel,
|
|
158
|
+
{
|
|
159
|
+
"data-slot": "flow-zoom-panel",
|
|
160
|
+
position,
|
|
161
|
+
className: cn("inline-flex -space-x-px rounded-md shadow-xs rtl:space-x-reverse", className),
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: () => zoomIn(), "aria-label": "Zoom in", children: /* @__PURE__ */ jsx(RiAddLine, { className: "size-5", "aria-hidden": "true" }) }),
|
|
164
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: () => zoomOut(), "aria-label": "Zoom out", children: /* @__PURE__ */ jsx(RiSubtractLine, { className: "size-5", "aria-hidden": "true" }) }),
|
|
165
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", className: BUTTON_CLASS, onClick: onFitView, "aria-label": "Fit view", children: fitViewIcon })
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { FlowZoomPanel };
|
|
172
|
+
//# sourceMappingURL=flow-zoom-panel.js.map
|
|
173
|
+
//# sourceMappingURL=flow-zoom-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/lib/slot.tsx","../../src/components/button.tsx","../../src/components/flow-zoom-panel.tsx"],"names":["React2","jsx"],"mappings":";;;;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACGA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,I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OAAA,EAAS,SAAA,EAAW,YAAA,EAAW,YAC3F,QAAA,EAAA,WAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"flow-zoom-panel.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\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { Slot } from '../lib/slot';\nimport { cn } from '../lib/utils';\n\nconst buttonVariants = cva(\n\t\"[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-sm outline-none transition-[box-shadow,scale] duration-150 ease-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 motion-reduce:transition-shadow [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n\t{\n\t\tdefaultVariants: {\n\t\t\tsize: 'default',\n\t\t\tstatic: false,\n\t\t\tvariant: 'default',\n\t\t},\n\t\tvariants: {\n\t\t\tstatic: {\n\t\t\t\tfalse: 'motion-safe:active:not-disabled:scale-[0.96]',\n\t\t\t\ttrue: null,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: 'h-10 min-w-10 px-[calc(--spacing(3)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11',\n\t\t\t\ticon: 'size-10 pointer-coarse:size-11',\n\t\t\t\t'icon-lg': 'size-11',\n\t\t\t\t'icon-sm': 'size-8 pointer-coarse:size-11',\n\t\t\t\t'icon-xl': 'size-11 [&_svg:not([class*=\"size-\"])]:size-5',\n\t\t\t\t'icon-xs':\n\t\t\t\t\t'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:size-11 not-in-data-[slot=input-group]:[&_svg:not([class*=\"size-\"])]:size-4',\n\t\t\t\tlg: 'h-11 min-w-11 px-[calc(--spacing(3.5)-1px)]',\n\t\t\t\tsm:\n\t\t\t\t\t'h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11',\n\t\t\t\txl: 'h-12 min-w-12 px-[calc(--spacing(4)-1px)] text-lg [&_svg:not([class*=\"size-\"])]:size-5',\n\t\t\t\txs:\n\t\t\t\t\t'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-xs before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11 [&_svg:not([class*=\"size-\"])]:size-3.5',\n\t\t\t},\n\t\t\tvariant: {\n\t\t\t\tdefault:\n\t\t\t\t\t'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',\n\t\t\t\tdestructive:\n\t\t\t\t\t'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',\n\t\t\t\t'destructive-outline':\n\t\t\t\t\t'border-destructive/40 bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/60 [:hover,[data-pressed]]:bg-destructive/8',\n\t\t\t\tghost: 'border-transparent hover:bg-accent data-pressed:bg-accent',\n\t\t\t\tlink: 'border-transparent underline-offset-4 hover:underline',\n\t\t\t\toutline:\n\t\t\t\t\t'border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64',\n\t\t\t\tsecondary:\n\t\t\t\t\t'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80',\n\t\t\t},\n\t\t},\n\t},\n);\n\ninterface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\tvariant?: VariantProps<typeof buttonVariants>['variant'];\n\tsize?: VariantProps<typeof buttonVariants>['size'];\n\t/** Disables tactile press scaling when motion would distract from the interaction. */\n\tstatic?: boolean;\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n\t({ className, variant, size, static: isStatic, asChild, children, type = 'button', ...props }, ref) => {\n\t\tconst buttonClasses = cn(buttonVariants({ className, size, static: isStatic, variant }));\n\t\tconst Comp = asChild ? Slot : 'button';\n\n\t\tif (asChild) {\n\t\t\tconst SlottedComp = Comp as typeof Slot;\n\t\t\treturn (\n\t\t\t\t<SlottedComp\n\t\t\t\t\tref={ref as React.Ref<HTMLElement>}\n\t\t\t\t\tclassName={buttonClasses}\n\t\t\t\t\tdata-slot=\"button\"\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</SlottedComp>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<button ref={ref} type={type} className={buttonClasses} data-slot=\"button\" {...props}>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t},\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\nexport type { ButtonProps };\n","'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"]}
|