@hexclave/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/dist/chunk-BE-pF4vm.js +34 -0
- package/dist/components/action-dialog.d.ts +33 -0
- package/dist/components/action-dialog.d.ts.map +1 -0
- package/dist/components/action-dialog.js +93 -0
- package/dist/components/action-dialog.js.map +1 -0
- package/dist/components/brand-icons.d.ts +78 -0
- package/dist/components/brand-icons.d.ts.map +1 -0
- package/dist/components/brand-icons.js +336 -0
- package/dist/components/brand-icons.js.map +1 -0
- package/dist/components/browser-frame/index.d.ts +21 -0
- package/dist/components/browser-frame/index.d.ts.map +1 -0
- package/dist/components/browser-frame/index.js +48 -0
- package/dist/components/browser-frame/index.js.map +1 -0
- package/dist/components/copy-button.d.ts +22 -0
- package/dist/components/copy-button.d.ts.map +1 -0
- package/dist/components/copy-button.js +42 -0
- package/dist/components/copy-button.js.map +1 -0
- package/dist/components/copy-field.d.ts +18 -0
- package/dist/components/copy-field.d.ts.map +1 -0
- package/dist/components/copy-field.js +42 -0
- package/dist/components/copy-field.js.map +1 -0
- package/dist/components/data-table/cells.d.ts +35 -0
- package/dist/components/data-table/cells.d.ts.map +1 -0
- package/dist/components/data-table/cells.js +114 -0
- package/dist/components/data-table/cells.js.map +1 -0
- package/dist/components/data-table/column-header.d.ts +16 -0
- package/dist/components/data-table/column-header.d.ts.map +1 -0
- package/dist/components/data-table/column-header.js +48 -0
- package/dist/components/data-table/column-header.js.map +1 -0
- package/dist/components/data-table/data-table.d.ts +59 -0
- package/dist/components/data-table/data-table.d.ts.map +1 -0
- package/dist/components/data-table/data-table.js +193 -0
- package/dist/components/data-table/data-table.js.map +1 -0
- package/dist/components/data-table/faceted-filter.d.ts +24 -0
- package/dist/components/data-table/faceted-filter.d.ts.map +1 -0
- package/dist/components/data-table/faceted-filter.js +88 -0
- package/dist/components/data-table/faceted-filter.js.map +1 -0
- package/dist/components/data-table/index.d.ts +10 -0
- package/dist/components/data-table/index.js +73 -0
- package/dist/components/data-table/pagination.d.ts +13 -0
- package/dist/components/data-table/pagination.d.ts.map +1 -0
- package/dist/components/data-table/pagination.js +78 -0
- package/dist/components/data-table/pagination.js.map +1 -0
- package/dist/components/data-table/toolbar-items.d.ts +13 -0
- package/dist/components/data-table/toolbar-items.d.ts.map +1 -0
- package/dist/components/data-table/toolbar-items.js +18 -0
- package/dist/components/data-table/toolbar-items.js.map +1 -0
- package/dist/components/data-table/toolbar.d.ts +23 -0
- package/dist/components/data-table/toolbar.d.ts.map +1 -0
- package/dist/components/data-table/toolbar.js +71 -0
- package/dist/components/data-table/toolbar.js.map +1 -0
- package/dist/components/data-table/utils.d.ts +6 -0
- package/dist/components/data-table/utils.d.ts.map +1 -0
- package/dist/components/data-table/utils.js +14 -0
- package/dist/components/data-table/utils.js.map +1 -0
- package/dist/components/data-table/view-options.d.ts +19 -0
- package/dist/components/data-table/view-options.d.ts.map +1 -0
- package/dist/components/data-table/view-options.js +39 -0
- package/dist/components/data-table/view-options.js.map +1 -0
- package/dist/components/simple-tooltip.d.ts +14 -0
- package/dist/components/simple-tooltip.d.ts.map +1 -0
- package/dist/components/simple-tooltip.js +32 -0
- package/dist/components/simple-tooltip.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +17 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +48 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert.d.ts +19 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +43 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +8 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +13 -0
- package/dist/components/ui/aspect-ratio.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +16 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +37 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +17 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +32 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +41 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +75 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/button.d.ts +32 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +71 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +18 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +52 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +27 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +58 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +10 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +28 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +10 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +17 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +28 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +91 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +51 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +103 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +45 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +77 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +54 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +156 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/form.d.ts +42 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +107 -0
- package/dist/components/ui/form.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +12 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +29 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/inline-code.d.ts +9 -0
- package/dist/components/ui/inline-code.d.ts.map +1 -0
- package/dist/components/ui/inline-code.js +48 -0
- package/dist/components/ui/inline-code.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +20 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +53 -0
- package/dist/components/ui/input-otp.js.map +1 -0
- package/dist/components/ui/input.d.ts +24 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +57 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +15 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +32 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +38 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +118 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +29 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +79 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/password-input.d.ts +11 -0
- package/dist/components/ui/password-input.d.ts.map +1 -0
- package/dist/components/ui/password-input.js +46 -0
- package/dist/components/ui/password-input.js.map +1 -0
- package/dist/components/ui/popover.d.ts +13 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +31 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +10 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +27 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +13 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +39 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +36 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +30 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +13 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +40 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +33 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +91 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +10 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +25 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +44 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +82 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +12 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +24 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +10 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +27 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +11 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +27 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +14 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +54 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +30 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +71 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +17 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +39 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +21 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toast.d.ts +32 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +74 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toaster.d.ts +7 -0
- package/dist/components/ui/toaster.d.ts.map +1 -0
- package/dist/components/ui/toaster.js +29 -0
- package/dist/components/ui/toaster.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +21 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +49 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +19 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +46 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +15 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +34 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/typography.d.ts +14 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/components/ui/typography.js +50 -0
- package/dist/components/ui/typography.js.map +1 -0
- package/dist/components/ui/use-toast.d.ts +50 -0
- package/dist/components/ui/use-toast.d.ts.map +1 -0
- package/dist/components/ui/use-toast.js +127 -0
- package/dist/components/ui/use-toast.js.map +1 -0
- package/dist/esm/components/action-dialog.d.ts +33 -0
- package/dist/esm/components/action-dialog.d.ts.map +1 -0
- package/dist/esm/components/action-dialog.js +90 -0
- package/dist/esm/components/action-dialog.js.map +1 -0
- package/dist/esm/components/brand-icons.d.ts +75 -0
- package/dist/esm/components/brand-icons.d.ts.map +1 -0
- package/dist/esm/components/brand-icons.js +320 -0
- package/dist/esm/components/brand-icons.js.map +1 -0
- package/dist/esm/components/browser-frame/index.d.ts +21 -0
- package/dist/esm/components/browser-frame/index.d.ts.map +1 -0
- package/dist/esm/components/browser-frame/index.js +45 -0
- package/dist/esm/components/browser-frame/index.js.map +1 -0
- package/dist/esm/components/copy-button.d.ts +22 -0
- package/dist/esm/components/copy-button.d.ts.map +1 -0
- package/dist/esm/components/copy-button.js +39 -0
- package/dist/esm/components/copy-button.js.map +1 -0
- package/dist/esm/components/copy-field.d.ts +18 -0
- package/dist/esm/components/copy-field.d.ts.map +1 -0
- package/dist/esm/components/copy-field.js +40 -0
- package/dist/esm/components/copy-field.js.map +1 -0
- package/dist/esm/components/data-table/cells.d.ts +35 -0
- package/dist/esm/components/data-table/cells.d.ts.map +1 -0
- package/dist/esm/components/data-table/cells.js +107 -0
- package/dist/esm/components/data-table/cells.js.map +1 -0
- package/dist/esm/components/data-table/column-header.d.ts +16 -0
- package/dist/esm/components/data-table/column-header.d.ts.map +1 -0
- package/dist/esm/components/data-table/column-header.js +46 -0
- package/dist/esm/components/data-table/column-header.js.map +1 -0
- package/dist/esm/components/data-table/data-table.d.ts +59 -0
- package/dist/esm/components/data-table/data-table.d.ts.map +1 -0
- package/dist/esm/components/data-table/data-table.js +188 -0
- package/dist/esm/components/data-table/data-table.js.map +1 -0
- package/dist/esm/components/data-table/faceted-filter.d.ts +24 -0
- package/dist/esm/components/data-table/faceted-filter.d.ts.map +1 -0
- package/dist/esm/components/data-table/faceted-filter.js +85 -0
- package/dist/esm/components/data-table/faceted-filter.js.map +1 -0
- package/dist/esm/components/data-table/index.d.ts +9 -0
- package/dist/esm/components/data-table/index.js +19 -0
- package/dist/esm/components/data-table/pagination.d.ts +13 -0
- package/dist/esm/components/data-table/pagination.d.ts.map +1 -0
- package/dist/esm/components/data-table/pagination.js +76 -0
- package/dist/esm/components/data-table/pagination.js.map +1 -0
- package/dist/esm/components/data-table/toolbar-items.d.ts +13 -0
- package/dist/esm/components/data-table/toolbar-items.d.ts.map +1 -0
- package/dist/esm/components/data-table/toolbar-items.js +16 -0
- package/dist/esm/components/data-table/toolbar-items.js.map +1 -0
- package/dist/esm/components/data-table/toolbar.d.ts +23 -0
- package/dist/esm/components/data-table/toolbar.d.ts.map +1 -0
- package/dist/esm/components/data-table/toolbar.js +69 -0
- package/dist/esm/components/data-table/toolbar.js.map +1 -0
- package/dist/esm/components/data-table/utils.d.ts +6 -0
- package/dist/esm/components/data-table/utils.d.ts.map +1 -0
- package/dist/esm/components/data-table/utils.js +11 -0
- package/dist/esm/components/data-table/utils.js.map +1 -0
- package/dist/esm/components/data-table/view-options.d.ts +19 -0
- package/dist/esm/components/data-table/view-options.d.ts.map +1 -0
- package/dist/esm/components/data-table/view-options.js +37 -0
- package/dist/esm/components/data-table/view-options.js.map +1 -0
- package/dist/esm/components/simple-tooltip.d.ts +14 -0
- package/dist/esm/components/simple-tooltip.d.ts.map +1 -0
- package/dist/esm/components/simple-tooltip.js +30 -0
- package/dist/esm/components/simple-tooltip.js.map +1 -0
- package/dist/esm/components/ui/accordion.d.ts +17 -0
- package/dist/esm/components/ui/accordion.d.ts.map +1 -0
- package/dist/esm/components/ui/accordion.js +41 -0
- package/dist/esm/components/ui/accordion.js.map +1 -0
- package/dist/esm/components/ui/alert.d.ts +19 -0
- package/dist/esm/components/ui/alert.d.ts.map +1 -0
- package/dist/esm/components/ui/alert.js +38 -0
- package/dist/esm/components/ui/alert.js.map +1 -0
- package/dist/esm/components/ui/aspect-ratio.d.ts +8 -0
- package/dist/esm/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/esm/components/ui/aspect-ratio.js +10 -0
- package/dist/esm/components/ui/aspect-ratio.js.map +1 -0
- package/dist/esm/components/ui/avatar.d.ts +16 -0
- package/dist/esm/components/ui/avatar.d.ts.map +1 -0
- package/dist/esm/components/ui/avatar.js +31 -0
- package/dist/esm/components/ui/avatar.js.map +1 -0
- package/dist/esm/components/ui/badge.d.ts +17 -0
- package/dist/esm/components/ui/badge.d.ts.map +1 -0
- package/dist/esm/components/ui/badge.js +28 -0
- package/dist/esm/components/ui/badge.js.map +1 -0
- package/dist/esm/components/ui/breadcrumb.d.ts +41 -0
- package/dist/esm/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/esm/components/ui/breadcrumb.js +66 -0
- package/dist/esm/components/ui/breadcrumb.js.map +1 -0
- package/dist/esm/components/ui/button.d.ts +32 -0
- package/dist/esm/components/ui/button.d.ts.map +1 -0
- package/dist/esm/components/ui/button.js +67 -0
- package/dist/esm/components/ui/button.js.map +1 -0
- package/dist/esm/components/ui/calendar.d.ts +18 -0
- package/dist/esm/components/ui/calendar.d.ts.map +1 -0
- package/dist/esm/components/ui/calendar.js +49 -0
- package/dist/esm/components/ui/calendar.js.map +1 -0
- package/dist/esm/components/ui/card.d.ts +27 -0
- package/dist/esm/components/ui/card.d.ts.map +1 -0
- package/dist/esm/components/ui/card.js +50 -0
- package/dist/esm/components/ui/card.js.map +1 -0
- package/dist/esm/components/ui/checkbox.d.ts +10 -0
- package/dist/esm/components/ui/checkbox.d.ts.map +1 -0
- package/dist/esm/components/ui/checkbox.js +24 -0
- package/dist/esm/components/ui/checkbox.js.map +1 -0
- package/dist/esm/components/ui/collapsible.d.ts +10 -0
- package/dist/esm/components/ui/collapsible.d.ts.map +1 -0
- package/dist/esm/components/ui/collapsible.js +12 -0
- package/dist/esm/components/ui/collapsible.js.map +1 -0
- package/dist/esm/components/ui/command.d.ts +28 -0
- package/dist/esm/components/ui/command.d.ts.map +1 -0
- package/dist/esm/components/ui/command.js +80 -0
- package/dist/esm/components/ui/command.js.map +1 -0
- package/dist/esm/components/ui/context-menu.d.ts +51 -0
- package/dist/esm/components/ui/context-menu.d.ts.map +1 -0
- package/dist/esm/components/ui/context-menu.js +85 -0
- package/dist/esm/components/ui/context-menu.js.map +1 -0
- package/dist/esm/components/ui/dialog.d.ts +45 -0
- package/dist/esm/components/ui/dialog.d.ts.map +1 -0
- package/dist/esm/components/ui/dialog.js +63 -0
- package/dist/esm/components/ui/dialog.js.map +1 -0
- package/dist/esm/components/ui/dropdown-menu.d.ts +54 -0
- package/dist/esm/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/esm/components/ui/dropdown-menu.js +138 -0
- package/dist/esm/components/ui/dropdown-menu.js.map +1 -0
- package/dist/esm/components/ui/form.d.ts +42 -0
- package/dist/esm/components/ui/form.d.ts.map +1 -0
- package/dist/esm/components/ui/form.js +97 -0
- package/dist/esm/components/ui/form.js.map +1 -0
- package/dist/esm/components/ui/hover-card.d.ts +12 -0
- package/dist/esm/components/ui/hover-card.d.ts.map +1 -0
- package/dist/esm/components/ui/hover-card.js +23 -0
- package/dist/esm/components/ui/hover-card.js.map +1 -0
- package/dist/esm/components/ui/inline-code.d.ts +9 -0
- package/dist/esm/components/ui/inline-code.d.ts.map +1 -0
- package/dist/esm/components/ui/inline-code.js +45 -0
- package/dist/esm/components/ui/inline-code.js.map +1 -0
- package/dist/esm/components/ui/input-otp.d.ts +20 -0
- package/dist/esm/components/ui/input-otp.d.ts.map +1 -0
- package/dist/esm/components/ui/input-otp.js +47 -0
- package/dist/esm/components/ui/input-otp.js.map +1 -0
- package/dist/esm/components/ui/input.d.ts +24 -0
- package/dist/esm/components/ui/input.d.ts.map +1 -0
- package/dist/esm/components/ui/input.js +53 -0
- package/dist/esm/components/ui/input.js.map +1 -0
- package/dist/esm/components/ui/label.d.ts +15 -0
- package/dist/esm/components/ui/label.d.ts.map +1 -0
- package/dist/esm/components/ui/label.js +27 -0
- package/dist/esm/components/ui/label.js.map +1 -0
- package/dist/esm/components/ui/menubar.d.ts +38 -0
- package/dist/esm/components/ui/menubar.d.ts.map +1 -0
- package/dist/esm/components/ui/menubar.js +99 -0
- package/dist/esm/components/ui/menubar.js.map +1 -0
- package/dist/esm/components/ui/navigation-menu.d.ts +29 -0
- package/dist/esm/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/esm/components/ui/navigation-menu.js +67 -0
- package/dist/esm/components/ui/navigation-menu.js.map +1 -0
- package/dist/esm/components/ui/password-input.d.ts +11 -0
- package/dist/esm/components/ui/password-input.d.ts.map +1 -0
- package/dist/esm/components/ui/password-input.js +44 -0
- package/dist/esm/components/ui/password-input.js.map +1 -0
- package/dist/esm/components/ui/popover.d.ts +13 -0
- package/dist/esm/components/ui/popover.d.ts.map +1 -0
- package/dist/esm/components/ui/popover.js +24 -0
- package/dist/esm/components/ui/popover.js.map +1 -0
- package/dist/esm/components/ui/progress.d.ts +10 -0
- package/dist/esm/components/ui/progress.d.ts.map +1 -0
- package/dist/esm/components/ui/progress.js +23 -0
- package/dist/esm/components/ui/progress.js.map +1 -0
- package/dist/esm/components/ui/radio-group.d.ts +13 -0
- package/dist/esm/components/ui/radio-group.d.ts.map +1 -0
- package/dist/esm/components/ui/radio-group.js +34 -0
- package/dist/esm/components/ui/radio-group.js.map +1 -0
- package/dist/esm/components/ui/resizable.d.ts +36 -0
- package/dist/esm/components/ui/resizable.d.ts.map +1 -0
- package/dist/esm/components/ui/resizable.js +25 -0
- package/dist/esm/components/ui/resizable.js.map +1 -0
- package/dist/esm/components/ui/scroll-area.d.ts +13 -0
- package/dist/esm/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/esm/components/ui/scroll-area.js +35 -0
- package/dist/esm/components/ui/scroll-area.js.map +1 -0
- package/dist/esm/components/ui/select.d.ts +33 -0
- package/dist/esm/components/ui/select.d.ts.map +1 -0
- package/dist/esm/components/ui/select.js +78 -0
- package/dist/esm/components/ui/select.js.map +1 -0
- package/dist/esm/components/ui/separator.d.ts +10 -0
- package/dist/esm/components/ui/separator.d.ts.map +1 -0
- package/dist/esm/components/ui/separator.js +21 -0
- package/dist/esm/components/ui/separator.js.map +1 -0
- package/dist/esm/components/ui/sheet.d.ts +44 -0
- package/dist/esm/components/ui/sheet.d.ts.map +1 -0
- package/dist/esm/components/ui/sheet.js +69 -0
- package/dist/esm/components/ui/sheet.js.map +1 -0
- package/dist/esm/components/ui/skeleton.d.ts +12 -0
- package/dist/esm/components/ui/skeleton.d.ts.map +1 -0
- package/dist/esm/components/ui/skeleton.js +21 -0
- package/dist/esm/components/ui/skeleton.js.map +1 -0
- package/dist/esm/components/ui/slider.d.ts +10 -0
- package/dist/esm/components/ui/slider.d.ts.map +1 -0
- package/dist/esm/components/ui/slider.js +23 -0
- package/dist/esm/components/ui/slider.js.map +1 -0
- package/dist/esm/components/ui/spinner.d.ts +11 -0
- package/dist/esm/components/ui/spinner.d.ts.map +1 -0
- package/dist/esm/components/ui/spinner.js +24 -0
- package/dist/esm/components/ui/spinner.js.map +1 -0
- package/dist/esm/components/ui/switch.d.ts +14 -0
- package/dist/esm/components/ui/switch.d.ts.map +1 -0
- package/dist/esm/components/ui/switch.js +50 -0
- package/dist/esm/components/ui/switch.js.map +1 -0
- package/dist/esm/components/ui/table.d.ts +30 -0
- package/dist/esm/components/ui/table.d.ts.map +1 -0
- package/dist/esm/components/ui/table.js +61 -0
- package/dist/esm/components/ui/table.js.map +1 -0
- package/dist/esm/components/ui/tabs.d.ts +17 -0
- package/dist/esm/components/ui/tabs.d.ts.map +1 -0
- package/dist/esm/components/ui/tabs.js +32 -0
- package/dist/esm/components/ui/tabs.js.map +1 -0
- package/dist/esm/components/ui/textarea.d.ts +10 -0
- package/dist/esm/components/ui/textarea.d.ts.map +1 -0
- package/dist/esm/components/ui/textarea.js +18 -0
- package/dist/esm/components/ui/textarea.js.map +1 -0
- package/dist/esm/components/ui/toast.d.ts +32 -0
- package/dist/esm/components/ui/toast.d.ts.map +1 -0
- package/dist/esm/components/ui/toast.js +64 -0
- package/dist/esm/components/ui/toast.js.map +1 -0
- package/dist/esm/components/ui/toaster.d.ts +7 -0
- package/dist/esm/components/ui/toaster.d.ts.map +1 -0
- package/dist/esm/components/ui/toaster.js +27 -0
- package/dist/esm/components/ui/toaster.js.map +1 -0
- package/dist/esm/components/ui/toggle-group.d.ts +21 -0
- package/dist/esm/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/esm/components/ui/toggle-group.js +44 -0
- package/dist/esm/components/ui/toggle-group.js.map +1 -0
- package/dist/esm/components/ui/toggle.d.ts +19 -0
- package/dist/esm/components/ui/toggle.d.ts.map +1 -0
- package/dist/esm/components/ui/toggle.js +41 -0
- package/dist/esm/components/ui/toggle.js.map +1 -0
- package/dist/esm/components/ui/tooltip.d.ts +15 -0
- package/dist/esm/components/ui/tooltip.d.ts.map +1 -0
- package/dist/esm/components/ui/tooltip.js +27 -0
- package/dist/esm/components/ui/tooltip.js.map +1 -0
- package/dist/esm/components/ui/typography.d.ts +14 -0
- package/dist/esm/components/ui/typography.d.ts.map +1 -0
- package/dist/esm/components/ui/typography.js +47 -0
- package/dist/esm/components/ui/typography.js.map +1 -0
- package/dist/esm/components/ui/use-toast.d.ts +50 -0
- package/dist/esm/components/ui/use-toast.d.ts.map +1 -0
- package/dist/esm/components/ui/use-toast.js +122 -0
- package/dist/esm/components/ui/use-toast.js.map +1 -0
- package/dist/esm/index.d.ts +54 -0
- package/dist/esm/index.js +106 -0
- package/dist/esm/lib/utils.d.ts +7 -0
- package/dist/esm/lib/utils.d.ts.map +1 -0
- package/dist/esm/lib/utils.js +11 -0
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +425 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +13 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { throwErr } from "@hexclave/shared/dist/utils/errors";
|
|
6
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
7
|
+
import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "@radix-ui/react-icons";
|
|
8
|
+
import { cn } from "../../lib/utils.js";
|
|
9
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
10
|
+
import { useAsyncCallback } from "@hexclave/shared/dist/hooks/use-async-callback";
|
|
11
|
+
import { Spinner } from "./spinner.js";
|
|
12
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
13
|
+
|
|
14
|
+
//#region src/components/ui/dropdown-menu.tsx
|
|
15
|
+
const DropdownMenuContext = React.createContext(void 0);
|
|
16
|
+
const DropdownMenu = forwardRefIfNeeded(({ ...props }, ref) => {
|
|
17
|
+
const [open, setOpen] = React.useState(!!props.open);
|
|
18
|
+
return /* @__PURE__ */ jsx(DropdownMenuContext.Provider, {
|
|
19
|
+
value: {
|
|
20
|
+
open,
|
|
21
|
+
setOpen: (o) => {
|
|
22
|
+
props.onOpenChange?.(o);
|
|
23
|
+
setOpen(o);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, {
|
|
27
|
+
...props,
|
|
28
|
+
open: props.open ?? open,
|
|
29
|
+
onOpenChange: (o) => {
|
|
30
|
+
props.onOpenChange?.(o);
|
|
31
|
+
setOpen(o);
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
DropdownMenu.displayName = DropdownMenuPrimitive.Root.displayName;
|
|
37
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
38
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
39
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
40
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
41
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
42
|
+
const DropdownMenuSubTrigger = forwardRefIfNeeded(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
43
|
+
ref,
|
|
44
|
+
className: cn("stack-scope flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent", inset && "pl-8", className),
|
|
45
|
+
...props,
|
|
46
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })]
|
|
47
|
+
}));
|
|
48
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
49
|
+
const DropdownMenuSubContent = forwardRefIfNeeded(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
50
|
+
ref,
|
|
51
|
+
className: cn("stack-scope z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
52
|
+
...props
|
|
53
|
+
}));
|
|
54
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
55
|
+
const DropdownMenuContent = forwardRefIfNeeded(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
56
|
+
ref,
|
|
57
|
+
sideOffset,
|
|
58
|
+
className: cn("stack-scope z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
59
|
+
...props
|
|
60
|
+
}) }));
|
|
61
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
62
|
+
const DropdownMenuItem = forwardRefIfNeeded(({ className, inset, ...props }, ref) => {
|
|
63
|
+
const { setOpen } = React.useContext(DropdownMenuContext) ?? throwErr("No DropdownMenuContext found");
|
|
64
|
+
const [handleClick, isLoading] = useAsyncCallback(async (e) => {
|
|
65
|
+
await props.onClick?.(e);
|
|
66
|
+
setOpen(false);
|
|
67
|
+
}, [props.onClick]);
|
|
68
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.Item, {
|
|
69
|
+
ref,
|
|
70
|
+
className: cn("stack-scope relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className),
|
|
71
|
+
...props,
|
|
72
|
+
disabled: isLoading || props.disabled,
|
|
73
|
+
onClick: props.onClick ? (e) => {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
runAsynchronouslyWithAlert(handleClick(e));
|
|
77
|
+
} : void 0,
|
|
78
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
79
|
+
style: {
|
|
80
|
+
visibility: isLoading ? "visible" : "hidden",
|
|
81
|
+
position: "absolute",
|
|
82
|
+
inset: 0,
|
|
83
|
+
display: "flex",
|
|
84
|
+
justifyContent: "center",
|
|
85
|
+
alignItems: "center"
|
|
86
|
+
},
|
|
87
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
88
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
89
|
+
style: { visibility: isLoading ? "hidden" : "visible" },
|
|
90
|
+
children: props.children
|
|
91
|
+
})]
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
95
|
+
const DropdownMenuCheckboxItem = forwardRefIfNeeded(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
96
|
+
ref,
|
|
97
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
98
|
+
checked,
|
|
99
|
+
...props,
|
|
100
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
101
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
102
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }) })
|
|
103
|
+
}), children]
|
|
104
|
+
}));
|
|
105
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
106
|
+
const DropdownMenuRadioItem = forwardRefIfNeeded(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
107
|
+
ref,
|
|
108
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
109
|
+
...props,
|
|
110
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
111
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
112
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(DotFilledIcon, { className: "h-4 w-4 fill-current" }) })
|
|
113
|
+
}), children]
|
|
114
|
+
}));
|
|
115
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
116
|
+
const DropdownMenuLabel = forwardRefIfNeeded(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
117
|
+
ref,
|
|
118
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
119
|
+
...props
|
|
120
|
+
}));
|
|
121
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
122
|
+
const DropdownMenuSeparator = forwardRefIfNeeded(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
123
|
+
ref,
|
|
124
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
125
|
+
...props
|
|
126
|
+
}));
|
|
127
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
128
|
+
const DropdownMenuShortcut = ({ className, ...props }) => {
|
|
129
|
+
return /* @__PURE__ */ jsx("span", {
|
|
130
|
+
className: cn("stack-scope ml-auto text-xs tracking-widest opacity-60", className),
|
|
131
|
+
...props
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
138
|
+
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","names":[],"sources":["../../../../src/components/ui/dropdown-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { CheckIcon, ChevronRightIcon, DotFilledIcon } from \"@radix-ui/react-icons\";\nimport { forwardRefIfNeeded } from \"@stackframe/stack-shared/dist/utils/react\";\nimport React from \"react\";\n\nimport { useAsyncCallback } from \"@stackframe/stack-shared/dist/hooks/use-async-callback\";\nimport { throwErr } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { runAsynchronouslyWithAlert } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { cn } from \"../../lib/utils\";\nimport { Spinner } from \"./spinner\";\n\nconst DropdownMenuContext = React.createContext<{\n open: boolean,\n setOpen: (open: boolean) => void,\n} | undefined>(undefined);\n\nconst DropdownMenu = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root>\n>(({ ...props }, ref) => {\n const [open, setOpen] = React.useState(!!props.open);\n\n return (\n <DropdownMenuContext.Provider value={{\n open,\n setOpen: (o) => {\n props.onOpenChange?.(o);\n setOpen(o);\n }\n }}>\n <DropdownMenuPrimitive.Root\n {...props}\n open={props.open ?? open}\n onOpenChange={o => {\n props.onOpenChange?.(o);\n setOpen(o);\n }}\n />\n </DropdownMenuContext.Provider>\n );\n});\nDropdownMenu.displayName = DropdownMenuPrimitive.Root.displayName;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean,\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"stack-scope flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto h-4 w-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"stack-scope z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"stack-scope z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n Omit<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>, \"onClick\"> & {\n inset?: boolean,\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void | Promise<void>,\n }\n>(({ className, inset, ...props }, ref) => {\n const { setOpen } = React.useContext(DropdownMenuContext) ?? throwErr(\"No DropdownMenuContext found\");\n const [handleClick, isLoading] = useAsyncCallback(async (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n await props.onClick?.(e);\n setOpen(false);\n }, [props.onClick]);\n\n return <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"stack-scope relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n disabled={isLoading || props.disabled}\n onClick={props.onClick ? (e) => {\n e.preventDefault();\n e.stopPropagation();\n runAsynchronouslyWithAlert(handleClick(e));\n } : undefined}\n >\n <div style={{ visibility: isLoading ? \"visible\" : \"hidden\", position: \"absolute\", inset: 0, display: \"flex\", justifyContent: \"center\", alignItems: \"center\" }}>\n <Spinner />\n </div>\n <div style={{ visibility: isLoading ? \"hidden\" : \"visible\" }}>\n {props.children}\n </div>\n </DropdownMenuPrimitive.Item>;\n});\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"h-4 w-4 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean,\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = forwardRefIfNeeded<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\"stack-scope ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator,\n DropdownMenuShortcut, DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger, DropdownMenuTrigger\n};\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,sBAAsB,MAAM,cAGnB,OAAU;AAEzB,MAAM,eAAe,oBAGlB,EAAE,GAAG,SAAS,QAAQ;CACvB,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,CAAC,CAAC,MAAM,KAAK;AAEpD,QACE,oBAAC,oBAAoB;EAAS,OAAO;GACnC;GACA,UAAU,MAAM;AACd,UAAM,eAAe,EAAE;AACvB,YAAQ,EAAE;;GAEb;YACC,oBAAC,sBAAsB;GACrB,GAAI;GACJ,MAAM,MAAM,QAAQ;GACpB,eAAc,MAAK;AACjB,UAAM,eAAe,EAAE;AACvB,YAAQ,EAAE;;IAEZ;GAC2B;EAEjC;AACF,aAAa,cAAc,sBAAsB,KAAK;AAEtD,MAAM,sBAAsB,sBAAsB;AAElD,MAAM,oBAAoB,sBAAsB;AAEhD,MAAM,qBAAqB,sBAAsB;AAEjD,MAAM,kBAAkB,sBAAsB;AAE9C,MAAM,yBAAyB,sBAAsB;AAErD,MAAM,yBAAyB,oBAK5B,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,QAC3C,qBAAC,sBAAsB;CAChB;CACL,WAAW,GACT,oJACA,SAAS,QACT,UACD;CACD,GAAI;YAEH,UACD,oBAAC,oBAAiB,WAAU,oBAAoB;EACf,CACnC;AACF,uBAAuB,cACrB,sBAAsB,WAAW;AAEnC,MAAM,yBAAyB,oBAG5B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,sBAAsB;CAChB;CACL,WAAW,GACT,qcACA,UACD;CACD,GAAI;EACJ,CACF;AACF,uBAAuB,cACrB,sBAAsB,WAAW;AAEnC,MAAM,sBAAsB,oBAGzB,EAAE,WAAW,aAAa,GAAG,GAAG,SAAS,QAC1C,oBAAC,sBAAsB,oBACrB,oBAAC,sBAAsB;CAChB;CACO;CACZ,WAAW,GACT,oHACA,oVACA,UACD;CACD,GAAI;EACJ,GAC2B,CAC/B;AACF,oBAAoB,cAAc,sBAAsB,QAAQ;AAEhE,MAAM,mBAAmB,oBAMtB,EAAE,WAAW,OAAO,GAAG,SAAS,QAAQ;CACzC,MAAM,EAAE,YAAY,MAAM,WAAW,oBAAoB,IAAI,SAAS,+BAA+B;CACrG,MAAM,CAAC,aAAa,aAAa,iBAAiB,OAAO,MAAoD;AAC3G,QAAM,MAAM,UAAU,EAAE;AACxB,UAAQ,MAAM;IACb,CAAC,MAAM,QAAQ,CAAC;AAEnB,QAAO,qBAAC,sBAAsB;EACvB;EACL,WAAW,GACT,6NACA,SAAS,QACT,UACD;EACD,GAAI;EACJ,UAAU,aAAa,MAAM;EAC7B,SAAS,MAAM,WAAW,MAAM;AAC9B,KAAE,gBAAgB;AAClB,KAAE,iBAAiB;AACnB,8BAA2B,YAAY,EAAE,CAAC;MACxC;aAEJ,oBAAC;GAAI,OAAO;IAAE,YAAY,YAAY,YAAY;IAAU,UAAU;IAAY,OAAO;IAAG,SAAS;IAAQ,gBAAgB;IAAU,YAAY;IAAU;aAC3J,oBAAC,YAAU;IACP,EACN,oBAAC;GAAI,OAAO,EAAE,YAAY,YAAY,WAAW,WAAW;aACzD,MAAM;IACH;GACqB;EAC7B;AACF,iBAAiB,cAAc,sBAAsB,KAAK;AAE1D,MAAM,2BAA2B,oBAG9B,EAAE,WAAW,UAAU,SAAS,GAAG,SAAS,QAC7C,qBAAC,sBAAsB;CAChB;CACL,WAAW,GACT,sNACA,UACD;CACQ;CACT,GAAI;YAEJ,oBAAC;EAAK,WAAU;YACd,oBAAC,sBAAsB,2BACrB,oBAAC,aAAU,WAAU,YAAY,GACG;GACjC,EACN;EACkC,CACrC;AACF,yBAAyB,cACvB,sBAAsB,aAAa;AAErC,MAAM,wBAAwB,oBAG3B,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,qBAAC,sBAAsB;CAChB;CACL,WAAW,GACT,sNACA,UACD;CACD,GAAI;YAEJ,oBAAC;EAAK,WAAU;YACd,oBAAC,sBAAsB,2BACrB,oBAAC,iBAAc,WAAU,yBAAyB,GACd;GACjC,EACN;EAC+B,CAClC;AACF,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,MAAM,oBAAoB,oBAKvB,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC,oBAAC,sBAAsB;CAChB;CACL,WAAW,GACT,qCACA,SAAS,QACT,UACD;CACD,GAAI;EACJ,CACF;AACF,kBAAkB,cAAc,sBAAsB,MAAM;AAE5D,MAAM,wBAAwB,oBAG3B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,sBAAsB;CAChB;CACL,WAAW,GAAG,4BAA4B,UAAU;CACpD,GAAI;EACJ,CACF;AACF,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,MAAM,wBAAwB,EAC5B,WACA,GAAG,YACwC;AAC3C,QACE,oBAAC;EACC,WAAW,GAAG,0DAA0D,UAAU;EAClF,GAAI;GACJ;;AAGN,qBAAqB,cAAc"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import * as _radix_ui_react_slot0 from "@radix-ui/react-slot";
|
|
4
|
+
import * as react_hook_form0 from "react-hook-form";
|
|
5
|
+
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
6
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
7
|
+
|
|
8
|
+
//#region src/components/ui/form.d.ts
|
|
9
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues | undefined = undefined>(props: react_hook_form0.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
10
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
11
|
+
...props
|
|
12
|
+
}: ControllerProps<TFieldValues, TName>) => react_jsx_runtime0.JSX.Element;
|
|
13
|
+
declare const useFormField: () => {
|
|
14
|
+
invalid: boolean;
|
|
15
|
+
isDirty: boolean;
|
|
16
|
+
isTouched: boolean;
|
|
17
|
+
isValidating: boolean;
|
|
18
|
+
error?: react_hook_form0.FieldError;
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
formItemId: string;
|
|
22
|
+
formDescriptionId: string;
|
|
23
|
+
formMessageId: string;
|
|
24
|
+
};
|
|
25
|
+
declare const FormItem: React.FC<React.HTMLAttributes<HTMLDivElement> & {
|
|
26
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
declare const FormLabel: React.FC<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & {
|
|
29
|
+
ref?: React.Ref<HTMLLabelElement> | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
declare const FormControl: React.FC<Omit<_radix_ui_react_slot0.SlotProps & React.RefAttributes<HTMLElement>, "ref"> & {
|
|
32
|
+
ref?: React.Ref<HTMLElement> | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
declare const FormDescription: React.FC<React.HTMLAttributes<HTMLParagraphElement> & {
|
|
35
|
+
ref?: React.Ref<HTMLParagraphElement> | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
declare const FormMessage: React.FC<React.HTMLAttributes<HTMLParagraphElement> & {
|
|
38
|
+
ref?: React.Ref<HTMLParagraphElement> | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
42
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","names":[],"sources":["../../../../src/components/ui/form.tsx"],"mappings":";;;;;;;;cAmBM,IAAA,wBAAI,WAAA,6CAAA,WAAA,0BAAA,KAAA,EAAA,gBAAA,CAAA,iBAAA,CAAA,YAAA,EAAA,QAAA,EAAA,kBAAA,MAAA,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAWJ,SAAA,wBACiB,WAAA,GAAc,WAAA,gBACrB,SAAA,CAAU,YAAA,IAAgB,SAAA,CAAU,YAAA;EAAA,GAClD;AAAA,GAEG,eAAA,CAAgB,YAAA,EAAc,KAAA,MAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAQnC,YAAA;;;;;UAsBL,gBAAA,CAAA,UAAA;;;;;;;cAUK,QAAA,EAAQ,KAAA,CAAA,EAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA;;;cAcR,SAAA,EAAS,KAAA,CAAA,EAAA,CAAA,IAAA,CAAA,cAAA,CAAA,UAAA,GAAA,KAAA,CAAA,aAAA,CAAA,gBAAA;;;cAgBT,WAAA,EAAW,KAAA,CAAA,EAAA,CAAA,IAAA,CAmBf,qBAAA,CAnBe,SAAA,GAAA,KAAA,CAAA,aAAA,CAAA,WAAA;;;cAsBX,eAAA,EAAe,KAAA,CAAA,EAAA,CAAA,KAAA,CAAA,cAAA,CAAA,oBAAA;;;cAiBf,WAAA,EAAW,KAAA,CAAA,EAAA,CAAA,KAAA,CAAA,cAAA,CAAA,oBAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { HexclaveAssertionError } from "@hexclave/shared/dist/utils/errors";
|
|
6
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
7
|
+
import { cn } from "../../lib/utils.js";
|
|
8
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
9
|
+
import { Controller, FormProvider, useFormContext } from "react-hook-form";
|
|
10
|
+
import { SpanLabel } from "./label.js";
|
|
11
|
+
|
|
12
|
+
//#region src/components/ui/form.tsx
|
|
13
|
+
const Form = FormProvider;
|
|
14
|
+
const FormFieldContext = React.createContext(null);
|
|
15
|
+
const FormField = ({ ...props }) => {
|
|
16
|
+
return /* @__PURE__ */ jsx(FormFieldContext.Provider, {
|
|
17
|
+
value: { name: props.name },
|
|
18
|
+
children: /* @__PURE__ */ jsx(Controller, { ...props })
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const useFormField = () => {
|
|
22
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
23
|
+
const itemContext = React.useContext(FormItemContext);
|
|
24
|
+
const { getFieldState, formState } = useFormContext();
|
|
25
|
+
if (!fieldContext) throw new HexclaveAssertionError("useFormField should be used within <FormField>");
|
|
26
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
27
|
+
const { id } = itemContext;
|
|
28
|
+
const formItemId = React.useId();
|
|
29
|
+
return {
|
|
30
|
+
id,
|
|
31
|
+
name: fieldContext.name,
|
|
32
|
+
formItemId: `${formItemId}-form-item`,
|
|
33
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
34
|
+
formMessageId: `${id}-form-item-message`,
|
|
35
|
+
...fieldState
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const FormItemContext = React.createContext({});
|
|
39
|
+
const FormItem = forwardRefIfNeeded(({ className, ...props }, ref) => {
|
|
40
|
+
const id = React.useId();
|
|
41
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, {
|
|
42
|
+
value: { id },
|
|
43
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
44
|
+
ref,
|
|
45
|
+
className: cn("space-y-2", className),
|
|
46
|
+
...props
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
FormItem.displayName = "FormItem";
|
|
51
|
+
const FormLabel = forwardRefIfNeeded(({ className, ...props }, ref) => {
|
|
52
|
+
const { error } = useFormField();
|
|
53
|
+
return /* @__PURE__ */ jsx(SpanLabel, {
|
|
54
|
+
ref,
|
|
55
|
+
className: cn(error && "text-destructive", className),
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
FormLabel.displayName = "FormLabel";
|
|
60
|
+
const FormControl = forwardRefIfNeeded(({ ...props }, ref) => {
|
|
61
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
62
|
+
return /* @__PURE__ */ jsx(Slot, {
|
|
63
|
+
ref,
|
|
64
|
+
id: formItemId,
|
|
65
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
66
|
+
"aria-invalid": !!error,
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
FormControl.displayName = "FormControl";
|
|
71
|
+
const FormDescription = forwardRefIfNeeded(({ className, ...props }, ref) => {
|
|
72
|
+
const { formDescriptionId } = useFormField();
|
|
73
|
+
return /* @__PURE__ */ jsx("p", {
|
|
74
|
+
ref,
|
|
75
|
+
id: formDescriptionId,
|
|
76
|
+
className: cn("text-[0.8rem] text-muted-foreground", className),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
FormDescription.displayName = "FormDescription";
|
|
81
|
+
const FormMessage = forwardRefIfNeeded(({ className, children, ...props }, ref) => {
|
|
82
|
+
const { error, formMessageId } = useFormField();
|
|
83
|
+
const body = error ? String(error.message) : children;
|
|
84
|
+
if (!body) return null;
|
|
85
|
+
return /* @__PURE__ */ jsx("p", {
|
|
86
|
+
ref,
|
|
87
|
+
id: formMessageId,
|
|
88
|
+
className: cn("text-[0.8rem] font-medium text-destructive", className),
|
|
89
|
+
...props,
|
|
90
|
+
children: body
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
FormMessage.displayName = "FormMessage";
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
97
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","names":[],"sources":["../../../../src/components/ui/form.tsx"],"sourcesContent":["'use client';\n\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport React from \"react\";\nimport { forwardRefIfNeeded } from \"@stackframe/stack-shared/dist/utils/react\";\nimport {\n Controller,\n ControllerProps,\n FieldPath,\n FieldValues,\n FormProvider,\n useFormContext,\n} from \"react-hook-form\";\n\nimport { HexclaveAssertionError } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { cn } from \"../../lib/utils\";\nimport { SpanLabel } from \"./label\";\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName,\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(null);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n }: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n if (!fieldContext) {\n throw new HexclaveAssertionError(\"useFormField should be used within <FormField>\");\n }\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n const { id } = itemContext;\n const formItemId = React.useId();\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${formItemId}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string,\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue\n);\n\nconst FormItem = forwardRefIfNeeded<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = forwardRefIfNeeded<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error } = useFormField();\n\n return (\n <SpanLabel\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n {...props}\n />\n );\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = forwardRefIfNeeded<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n !error\n ? `${formDescriptionId}`\n : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = forwardRefIfNeeded<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-[0.8rem] text-muted-foreground\", className)}\n {...props}\n />\n );\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = forwardRefIfNeeded<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-[0.8rem] font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport {\n Form, FormControl,\n FormDescription, FormField, FormItem,\n FormLabel, FormMessage, useFormField\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,OAAO;AASb,MAAM,mBAAmB,MAAM,cAA4C,KAAK;AAEhF,MAAM,aAGJ,EACE,GAAG,YACuC;AAC5C,QACE,oBAAC,iBAAiB;EAAS,OAAO,EAAE,MAAM,MAAM,MAAM;YACpD,oBAAC,cAAW,GAAI,QAAS;GACC;;AAIhC,MAAM,qBAAqB;CACzB,MAAM,eAAe,MAAM,WAAW,iBAAiB;CACvD,MAAM,cAAc,MAAM,WAAW,gBAAgB;CACrD,MAAM,EAAE,eAAe,cAAc,gBAAgB;AAErD,KAAI,CAAC,aACH,OAAM,IAAI,uBAAuB,iDAAiD;CAGpF,MAAM,aAAa,cAAc,aAAa,MAAM,UAAU;CAE9D,MAAM,EAAE,OAAO;CACf,MAAM,aAAa,MAAM,OAAO;AAEhC,QAAO;EACL;EACA,MAAM,aAAa;EACnB,YAAY,GAAG,WAAW;EAC1B,mBAAmB,GAAG,GAAG;EACzB,eAAe,GAAG,GAAG;EACrB,GAAG;EACJ;;AAOH,MAAM,kBAAkB,MAAM,cAC5B,EAAE,CACH;AAED,MAAM,WAAW,oBAGd,EAAE,WAAW,GAAG,SAAS,QAAQ;CAClC,MAAM,KAAK,MAAM,OAAO;AAExB,QACE,oBAAC,gBAAgB;EAAS,OAAO,EAAE,IAAI;YACrC,oBAAC;GAAS;GAAK,WAAW,GAAG,aAAa,UAAU;GAAE,GAAI;IAAS;GAC1C;EAE7B;AACF,SAAS,cAAc;AAEvB,MAAM,YAAY,oBAGf,EAAE,WAAW,GAAG,SAAS,QAAQ;CAClC,MAAM,EAAE,UAAU,cAAc;AAEhC,QACE,oBAAC;EACM;EACL,WAAW,GAAG,SAAS,oBAAoB,UAAU;EACrD,GAAI;GACJ;EAEJ;AACF,UAAU,cAAc;AAExB,MAAM,cAAc,oBAGjB,EAAE,GAAG,SAAS,QAAQ;CACvB,MAAM,EAAE,OAAO,YAAY,mBAAmB,kBAAkB,cAAc;AAE9E,QACE,oBAAC;EACM;EACL,IAAI;EACJ,oBACE,CAAC,QACG,GAAG,sBACH,GAAG,kBAAkB,GAAG;EAE9B,gBAAc,CAAC,CAAC;EAChB,GAAI;GACJ;EAEJ;AACF,YAAY,cAAc;AAE1B,MAAM,kBAAkB,oBAGrB,EAAE,WAAW,GAAG,SAAS,QAAQ;CAClC,MAAM,EAAE,sBAAsB,cAAc;AAE5C,QACE,oBAAC;EACM;EACL,IAAI;EACJ,WAAW,GAAG,uCAAuC,UAAU;EAC/D,GAAI;GACJ;EAEJ;AACF,gBAAgB,cAAc;AAE9B,MAAM,cAAc,oBAGjB,EAAE,WAAW,UAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,EAAE,OAAO,kBAAkB,cAAc;CAC/C,MAAM,OAAO,QAAQ,OAAO,MAAM,QAAQ,GAAG;AAE7C,KAAI,CAAC,KACH,QAAO;AAGT,QACE,oBAAC;EACM;EACL,IAAI;EACJ,WAAW,GAAG,8CAA8C,UAAU;EACtE,GAAI;YAEH;GACC;EAEN;AACF,YAAY,cAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ui/hover-card.d.ts
|
|
5
|
+
declare const HoverCard: React.FC<HoverCardPrimitive.HoverCardProps>;
|
|
6
|
+
declare const HoverCardTrigger: React.ForwardRefExoticComponent<HoverCardPrimitive.HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
7
|
+
declare const HoverCardContent: React.FC<Omit<HoverCardPrimitive.HoverCardContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
8
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
12
|
+
//# sourceMappingURL=hover-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-card.d.ts","names":[],"sources":["../../../../src/components/ui/hover-card.tsx"],"mappings":";;;;cAQM,SAAA,EAAS,KAAA,CAAA,EAAA,CAAA,kBAAA,CAAA,cAAA;AAAA,cAET,gBAAA,EAAgB,KAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,qBAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA;AAAA,cAEhB,gBAAA,EAAgB,KAAA,CAAA,EAAA,CAAA,IAAA,CAAA,kBAAA,CAAA,qBAAA,GAAA,KAAA,CAAA,aAAA,CAAA,cAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
8
|
+
|
|
9
|
+
//#region src/components/ui/hover-card.tsx
|
|
10
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
11
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
12
|
+
const HoverCardContent = forwardRefIfNeeded(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(HoverCardPrimitive.Content, {
|
|
13
|
+
ref,
|
|
14
|
+
align,
|
|
15
|
+
sideOffset,
|
|
16
|
+
className: cn("stack-scope z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
17
|
+
...props
|
|
18
|
+
}));
|
|
19
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
23
|
+
//# sourceMappingURL=hover-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-card.js","names":[],"sources":["../../../../src/components/ui/hover-card.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { forwardRefIfNeeded } from \"@stackframe/stack-shared/dist/utils/react\";\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst HoverCard = HoverCardPrimitive.Root;\n\nconst HoverCardTrigger = HoverCardPrimitive.Trigger;\n\nconst HoverCardContent = forwardRefIfNeeded<\n React.ElementRef<typeof HoverCardPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <HoverCardPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"stack-scope z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n));\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName;\n\nexport { HoverCard, HoverCardTrigger, HoverCardContent };\n"],"mappings":";;;;;;;;;AAQA,MAAM,YAAY,mBAAmB;AAErC,MAAM,mBAAmB,mBAAmB;AAE5C,MAAM,mBAAmB,oBAGtB,EAAE,WAAW,QAAQ,UAAU,aAAa,GAAG,GAAG,SAAS,QAC5D,oBAAC,mBAAmB;CACb;CACE;CACK;CACZ,WAAW,GACT,0bACA,UACD;CACD,GAAI;EACJ,CACF;AACF,iBAAiB,cAAc,mBAAmB,QAAQ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ui/inline-code.d.ts
|
|
4
|
+
declare const InlineCode: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
5
|
+
ref?: React.Ref<HTMLElement> | undefined;
|
|
6
|
+
}>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { InlineCode };
|
|
9
|
+
//# sourceMappingURL=inline-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-code.d.ts","names":[],"sources":["../../../../src/components/ui/inline-code.tsx"],"mappings":";;;cAUM,UAAA,EAAU,KAAA,CAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,iBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,WAAA,GAAA,WAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { forwardRefIfNeeded, getNodeText } from "@hexclave/shared/dist/utils/react";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
8
|
+
import { hasClickableParent } from "@hexclave/shared/dist/utils/dom";
|
|
9
|
+
import { useToast } from "./use-toast.js";
|
|
10
|
+
|
|
11
|
+
//#region src/components/ui/inline-code.tsx
|
|
12
|
+
const InlineCode = forwardRefIfNeeded((props, ref) => {
|
|
13
|
+
const { toast } = useToast();
|
|
14
|
+
return /* @__PURE__ */ jsx("code", {
|
|
15
|
+
ref,
|
|
16
|
+
...props,
|
|
17
|
+
className: cn("stack-scope bg-zinc-200 text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 rounded-sm px-1 cursor-pointer", props.className),
|
|
18
|
+
onClick: (e) => {
|
|
19
|
+
props.onClick?.(e);
|
|
20
|
+
if (!hasClickableParent(e.currentTarget)) {
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
runAsynchronously(async () => {
|
|
24
|
+
try {
|
|
25
|
+
await navigator.clipboard.writeText(getNodeText(props.children));
|
|
26
|
+
toast({
|
|
27
|
+
description: "Copied to clipboard!",
|
|
28
|
+
variant: "success"
|
|
29
|
+
});
|
|
30
|
+
} catch (e) {
|
|
31
|
+
toast({
|
|
32
|
+
description: "Failed to copy to clipboard",
|
|
33
|
+
variant: "destructive"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
InlineCode.displayName = "Code";
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { InlineCode };
|
|
45
|
+
//# sourceMappingURL=inline-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-code.js","names":[],"sources":["../../../../src/components/ui/inline-code.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"../../lib/utils\";\nimport React from \"react\";\nimport { forwardRefIfNeeded } from \"@stackframe/stack-shared/dist/utils/react\";\nimport { hasClickableParent } from \"@stackframe/stack-shared/dist/utils/dom\";\nimport { getNodeText } from \"@stackframe/stack-shared/dist/utils/react\";\nimport { runAsynchronously } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { useToast } from \"./use-toast\";\n\nconst InlineCode = forwardRefIfNeeded<\n React.ElementRef<\"code\">,\n React.ComponentPropsWithoutRef<\"code\">\n>((props, ref) => {\n const { toast } = useToast();\n\n return <code\n ref={ref}\n {...props}\n className={cn(\"stack-scope bg-zinc-200 text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 rounded-sm px-1 cursor-pointer\", props.className)}\n onClick={(e: React.MouseEvent<HTMLElement>) => {\n props.onClick?.(e);\n if (!hasClickableParent(e.currentTarget)) {\n e.stopPropagation();\n e.preventDefault();\n runAsynchronously(async () => {\n try {\n await navigator.clipboard.writeText(getNodeText(props.children));\n toast({ description: 'Copied to clipboard!', variant: 'success' });\n } catch (e) {\n toast({ description: 'Failed to copy to clipboard', variant: 'destructive' });\n }\n });\n }\n }}\n />;\n});\nInlineCode.displayName = \"Code\";\n\nexport { InlineCode };\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,aAAa,oBAGhB,OAAO,QAAQ;CAChB,MAAM,EAAE,UAAW,UAAU;AAE7B,QAAO,oBAAC;EACD;EACL,GAAI;EACJ,WAAW,GAAG,4GAA4G,MAAM,UAAU;EAC1I,UAAU,MAAqC;AAC7C,SAAM,UAAU,EAAE;AAClB,OAAI,CAAC,mBAAmB,EAAE,cAAc,EAAE;AACxC,MAAE,iBAAiB;AACnB,MAAE,gBAAgB;AAClB,sBAAkB,YAAY;AAC5B,SAAI;AACF,YAAM,UAAU,UAAU,UAAU,YAAY,MAAM,SAAS,CAAC;AAChE,YAAM;OAAE,aAAa;OAAwB,SAAS;OAAW,CAAC;cAC3D,GAAG;AACV,YAAM;OAAE,aAAa;OAA+B,SAAS;OAAe,CAAC;;MAE/E;;;GAGN;EACF;AACF,WAAW,cAAc"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OTPInput } from "input-otp";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ui/input-otp.d.ts
|
|
5
|
+
declare const InputOTP: React.FC<React.ComponentPropsWithoutRef<typeof OTPInput>>;
|
|
6
|
+
declare const InputOTPGroup: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
declare const InputOTPSlot: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
|
+
index: number;
|
|
11
|
+
size?: "default" | "lg";
|
|
12
|
+
} & {
|
|
13
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
declare const InputOTPSeparator: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
16
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
20
|
+
//# sourceMappingURL=input-otp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-otp.d.ts","names":[],"sources":["../../../../src/components/ui/input-otp.tsx"],"mappings":";;;;cASM,QAAA,EAAU,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,wBAAA,QAAgC,QAAA;AAAA,cAgBzD,aAAA,EAAa,KAAA,CAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,iBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA,GAAA,cAAA;;;cAQb,YAAA,EAAY,KAAA,CAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,iBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA,GAAA,cAAA;;;;;;cA6BZ,iBAAA,EAAiB,KAAA,CAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,iBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA,GAAA,cAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
6
|
+
import { DashIcon } from "@radix-ui/react-icons";
|
|
7
|
+
import { cn } from "../../lib/utils.js";
|
|
8
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
9
|
+
|
|
10
|
+
//#region src/components/ui/input-otp.tsx
|
|
11
|
+
const InputOTP = forwardRefIfNeeded(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ jsx(OTPInput, {
|
|
12
|
+
ref,
|
|
13
|
+
containerClassName: cn("stack-scope flex items-center gap-2 has-[:disabled]:opacity-50", containerClassName),
|
|
14
|
+
className: cn("disabled:cursor-not-allowed", className),
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
InputOTP.displayName = "InputOTP";
|
|
18
|
+
const InputOTPGroup = forwardRefIfNeeded(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
19
|
+
ref,
|
|
20
|
+
className: cn("flex items-center gap-1", className),
|
|
21
|
+
...props
|
|
22
|
+
}));
|
|
23
|
+
InputOTPGroup.displayName = "InputOTPGroup";
|
|
24
|
+
const InputOTPSlot = forwardRefIfNeeded(({ index, className, size = "default", ...props }, ref) => {
|
|
25
|
+
const { char, hasFakeCaret, isActive } = React.useContext(OTPInputContext).slots[index];
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
ref,
|
|
28
|
+
className: cn("relative flex h-9 w-9 items-center justify-center border border-input text-sm rounded-md", size === "lg" ? "h-10 w-10 text-lg font-medium" : "", isActive && "z-10 ring-1 ring-ring", className),
|
|
29
|
+
...props,
|
|
30
|
+
children: [char, hasFakeCaret && /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
32
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" })
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
InputOTPSlot.displayName = "InputOTPSlot";
|
|
37
|
+
const InputOTPSeparator = forwardRefIfNeeded(({ ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
38
|
+
ref,
|
|
39
|
+
role: "separator",
|
|
40
|
+
...props,
|
|
41
|
+
children: /* @__PURE__ */ jsx(DashIcon, {})
|
|
42
|
+
}));
|
|
43
|
+
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
47
|
+
//# sourceMappingURL=input-otp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-otp.js","names":[],"sources":["../../../../src/components/ui/input-otp.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { forwardRefIfNeeded } from \"@stackframe/stack-shared/dist/utils/react\";\nimport { DashIcon } from \"@radix-ui/react-icons\";\nimport { OTPInput, OTPInputContext } from \"input-otp\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst InputOTP: React.FC<React.ComponentPropsWithoutRef<typeof OTPInput>> = forwardRefIfNeeded<\n React.ElementRef<typeof OTPInput>,\n React.ComponentPropsWithoutRef<typeof OTPInput>\n>(({ className, containerClassName, ...props }, ref) => (\n <OTPInput\n ref={ref}\n containerClassName={cn(\n \"stack-scope flex items-center gap-2 has-[:disabled]:opacity-50\",\n containerClassName\n )}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n));\nInputOTP.displayName = \"InputOTP\";\n\nconst InputOTPGroup = forwardRefIfNeeded<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex items-center gap-1\", className)} {...props} />\n));\nInputOTPGroup.displayName = \"InputOTPGroup\";\n\nconst InputOTPSlot = forwardRefIfNeeded<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\"> & { index: number, size?: 'default' | 'lg' }\n>(({ index, className, size = 'default', ...props }, ref) => {\n const inputOTPContext = React.useContext(OTPInputContext);\n const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];\n\n return (\n <div\n ref={ref}\n className={cn(\n \"relative flex h-9 w-9 items-center justify-center border border-input text-sm rounded-md\",\n size === 'lg' ? 'h-10 w-10 text-lg font-medium' : '',\n isActive && \"z-10 ring-1 ring-ring\",\n className\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"h-4 w-px animate-caret-blink bg-foreground duration-1000\" />\n </div>\n )}\n </div>\n );\n});\nInputOTPSlot.displayName = \"InputOTPSlot\";\n\nconst InputOTPSeparator = forwardRefIfNeeded<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ ...props }, ref) => (\n <div ref={ref} role=\"separator\" {...props}>\n <DashIcon />\n </div>\n));\nInputOTPSeparator.displayName = \"InputOTPSeparator\";\n\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };\n"],"mappings":";;;;;;;;;;AASA,MAAM,WAAsE,oBAGzE,EAAE,WAAW,oBAAoB,GAAG,SAAS,QAC9C,oBAAC;CACM;CACL,oBAAoB,GAClB,kEACA,mBACD;CACD,WAAW,GAAG,+BAA+B,UAAU;CACvD,GAAI;EACJ,CACF;AACF,SAAS,cAAc;AAEvB,MAAM,gBAAgB,oBAGnB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC;CAAS;CAAK,WAAW,GAAG,2BAA2B,UAAU;CAAE,GAAI;EAAS,CACjF;AACF,cAAc,cAAc;AAE5B,MAAM,eAAe,oBAGlB,EAAE,OAAO,WAAW,OAAO,WAAW,GAAG,SAAS,QAAQ;CAE3D,MAAM,EAAE,MAAM,cAAc,aADJ,MAAM,WAAW,gBAAgB,CACA,MAAM;AAE/D,QACE,qBAAC;EACM;EACL,WAAW,GACT,4FACA,SAAS,OAAO,kCAAkC,IAClD,YAAY,yBACZ,UACD;EACD,GAAI;aAEH,MACA,gBACC,oBAAC;GAAI,WAAU;aACb,oBAAC,SAAI,WAAU,6DAA6D;IACxE;GAEJ;EAER;AACF,aAAa,cAAc;AAE3B,MAAM,oBAAoB,oBAGvB,EAAE,GAAG,SAAS,QACf,oBAAC;CAAS;CAAK,MAAK;CAAY,GAAI;WAClC,oBAAC,aAAW;EACR,CACN;AACF,kBAAkB,cAAc"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ui/input.d.ts
|
|
4
|
+
type InputProps = {
|
|
5
|
+
prefixItem?: React.ReactNode;
|
|
6
|
+
} & React.InputHTMLAttributes<HTMLInputElement>;
|
|
7
|
+
declare const Input: React.FC<{
|
|
8
|
+
prefixItem?: React.ReactNode;
|
|
9
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & {
|
|
10
|
+
ref?: React.Ref<HTMLInputElement> | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
type DelayedInputProps = {
|
|
13
|
+
delay?: number;
|
|
14
|
+
} & InputProps;
|
|
15
|
+
declare const DelayedInput: React.FC<{
|
|
16
|
+
delay?: number;
|
|
17
|
+
} & {
|
|
18
|
+
prefixItem?: React.ReactNode;
|
|
19
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & {
|
|
20
|
+
ref?: React.Ref<HTMLInputElement> | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { DelayedInput, DelayedInputProps, Input, InputProps };
|
|
24
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","names":[],"sources":["../../../../src/components/ui/input.tsx"],"mappings":";;;KAKY,UAAA;EACV,UAAA,GAAa,KAAA,CAAM,SAAA;AAAA,IACjB,KAAA,CAAM,mBAAA,CAAoB,gBAAA;AAAA,cAEjB,KAAA,EAAK,KAAA,CAAA,EAAA;eAHH,KAAA,CAAM,SAAA;AAAA;;;KAsCT,iBAAA;EACV,KAAA;AAAA,IACE,UAAA;AAAA,cAES,YAAA,EAAY,KAAA,CAAA,EAAA;;;eA1CV,KAAA,CAAM,SAAA;AAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
//#region src/components/ui/input.tsx
|
|
7
|
+
const Input = forwardRefIfNeeded(({ className, type, prefixItem, ...props }, ref) => {
|
|
8
|
+
const baseClasses = "stack-scope flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";
|
|
9
|
+
if (prefixItem) return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: "flex flex-row items-center backdrop-blur-md bg-white/20 dark:bg-black/20 flex-1",
|
|
11
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: "flex self-stretch justify-center items-center text-muted-foreground pl-3 select-none bg-muted/70 pr-3 border-r border-input rounded-l-md",
|
|
13
|
+
children: prefixItem
|
|
14
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
15
|
+
type,
|
|
16
|
+
className: cn(baseClasses, "rounded-l-none", className),
|
|
17
|
+
ref,
|
|
18
|
+
...props
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
else return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "flex flex-row items-center backdrop-blur-md bg-white/20 dark:bg-black/20 flex-1",
|
|
23
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
24
|
+
type,
|
|
25
|
+
className: cn(baseClasses, className),
|
|
26
|
+
ref,
|
|
27
|
+
...props
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
Input.displayName = "Input";
|
|
32
|
+
const DelayedInput = forwardRefIfNeeded(({ delay = 500, defaultValue, ...props }, ref) => {
|
|
33
|
+
const [value, setValue] = React.useState(defaultValue ?? "");
|
|
34
|
+
const timeout = React.useRef(null);
|
|
35
|
+
const onChange = (e) => {
|
|
36
|
+
setValue(e.target.value);
|
|
37
|
+
if (timeout.current) clearTimeout(timeout.current);
|
|
38
|
+
timeout.current = setTimeout(() => {
|
|
39
|
+
props.onChange?.(e);
|
|
40
|
+
}, delay);
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
43
|
+
ref,
|
|
44
|
+
...props,
|
|
45
|
+
value,
|
|
46
|
+
onChange
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
DelayedInput.displayName = "DelayedInput";
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { DelayedInput, Input };
|
|
53
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../../../src/components/ui/input.tsx"],"sourcesContent":["import { forwardRefIfNeeded } from \"@stackframe/stack-shared/dist/utils/react\";\nimport React from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nexport type InputProps = {\n prefixItem?: React.ReactNode,\n} & React.InputHTMLAttributes<HTMLInputElement>\n\nexport const Input = forwardRefIfNeeded<HTMLInputElement, InputProps>(\n ({ className, type, prefixItem, ...props }, ref) => {\n const baseClasses = \"stack-scope flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n\n if (prefixItem) {\n return (\n <div className=\"flex flex-row items-center backdrop-blur-md bg-white/20 dark:bg-black/20 flex-1\">\n <div className={'flex self-stretch justify-center items-center text-muted-foreground pl-3 select-none bg-muted/70 pr-3 border-r border-input rounded-l-md'}>\n {prefixItem}\n </div>\n <input\n type={type}\n className={cn(baseClasses, 'rounded-l-none', className)}\n ref={ref}\n {...props}\n />\n </div>\n );\n } else {\n return (\n <div className=\"flex flex-row items-center backdrop-blur-md bg-white/20 dark:bg-black/20 flex-1\">\n <input\n type={type}\n className={cn(baseClasses, className)}\n ref={ref}\n {...props}\n />\n </div>\n );\n }\n }\n);\nInput.displayName = \"Input\";\n\n\nexport type DelayedInputProps = {\n delay?: number,\n} & InputProps\n\nexport const DelayedInput = forwardRefIfNeeded<HTMLInputElement, DelayedInputProps>(\n ({ delay = 500, defaultValue, ...props }, ref) => {\n const [value, setValue] = React.useState(defaultValue ?? \"\");\n\n const timeout = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n timeout.current = setTimeout(() => {\n props.onChange?.(e);\n }, delay);\n };\n\n return <Input ref={ref} {...props} value={value} onChange={onChange} />;\n }\n);\nDelayedInput.displayName = \"DelayedInput\";\n"],"mappings":";;;;;;AASA,MAAa,QAAQ,oBAClB,EAAE,WAAW,MAAM,YAAY,GAAG,SAAS,QAAQ;CAClD,MAAM,cAAe;AAErB,KAAI,WACF,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC;GAAI,WAAW;aACb;IACG,EACN,oBAAC;GACO;GACN,WAAW,GAAG,aAAa,kBAAkB,UAAU;GAClD;GACL,GAAI;IACJ;GACE;KAGR,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GACO;GACN,WAAW,GAAG,aAAa,UAAU;GAChC;GACL,GAAI;IACJ;GACE;EAIb;AACD,MAAM,cAAc;AAOpB,MAAa,eAAe,oBACzB,EAAE,QAAQ,KAAK,cAAc,GAAG,SAAS,QAAQ;CAChD,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,gBAAgB,GAAG;CAE5D,MAAM,UAAU,MAAM,OAA6C,KAAK;CAExE,MAAM,YAAY,MAA2C;AAC3D,WAAS,EAAE,OAAO,MAAM;AACxB,MAAI,QAAQ,QACV,cAAa,QAAQ,QAAQ;AAE/B,UAAQ,UAAU,iBAAiB;AACjC,SAAM,WAAW,EAAE;KAClB,MAAM;;AAGX,QAAO,oBAAC;EAAW;EAAK,GAAI;EAAc;EAAiB;GAAY;EAE1E;AACD,aAAa,cAAc"}
|