@tulip-systems/core 0.6.0 → 0.7.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 +662 -0
- package/dist/commands/client.d.mts +2 -1
- package/dist/commands/client.mjs +2 -1
- package/dist/components/client.d.mts +19 -3
- package/dist/components/client.mjs +18 -2
- package/dist/components/editor/components/menu-nodes.client.mjs +3 -3
- package/dist/components/editor/components/menu-nodes.client.mjs.map +1 -1
- package/dist/components/editor/components/menu.client.mjs +3 -3
- package/dist/components/editor/components/menu.client.mjs.map +1 -1
- package/dist/components/emails/forget-password-email.mjs +6 -6
- package/dist/components/emails/forget-password-email.mjs.map +1 -1
- package/dist/components/header/back-button.client.mjs +2 -2
- package/dist/components/header/back-button.client.mjs.map +1 -1
- package/dist/components/header/bottom-bar.client.mjs +2 -2
- package/dist/components/header/bottom-bar.client.mjs.map +1 -1
- package/dist/components/header/breadcrumbs.client.mjs +1 -1
- package/dist/components/header/breadcrumbs.client.mjs.map +1 -1
- package/dist/components/header/header.client.mjs +1 -1
- package/dist/components/header/header.client.mjs.map +1 -1
- package/dist/components/layouts/empty-page.mjs +2 -2
- package/dist/components/layouts/empty-page.mjs.map +1 -1
- package/dist/components/layouts/error-page.mjs +3 -3
- package/dist/components/layouts/error-page.mjs.map +1 -1
- package/dist/components/layouts/providers.client.d.mts.map +1 -1
- package/dist/components/layouts/providers.client.mjs +3 -2
- package/dist/components/layouts/providers.client.mjs.map +1 -1
- package/dist/components/layouts/root-loading.mjs +2 -2
- package/dist/components/layouts/root-loading.mjs.map +1 -1
- package/dist/components/layouts/tab-layout.mjs +1 -1
- package/dist/components/layouts/tab-layout.mjs.map +1 -1
- package/dist/components/lists/data-list.mjs +1 -1
- package/dist/components/lists/data-list.mjs.map +1 -1
- package/dist/components/lists/data-stack.mjs +1 -1
- package/dist/components/lists/data-stack.mjs.map +1 -1
- package/dist/components/navigation/admin-sidebar-header.client.mjs +3 -3
- package/dist/components/navigation/admin-sidebar-header.client.mjs.map +1 -1
- package/dist/components/navigation/admin-sidebar-skeleton.mjs +1 -1
- package/dist/components/navigation/admin-sidebar-skeleton.mjs.map +1 -1
- package/dist/components/ui/accordion.client.d.mts +26 -0
- package/dist/components/ui/accordion.client.d.mts.map +1 -0
- package/dist/components/ui/accordion.client.mjs +58 -0
- package/dist/components/ui/accordion.client.mjs.map +1 -0
- package/dist/components/ui/alert-dialog.client.d.mts +61 -0
- package/dist/components/ui/alert-dialog.client.d.mts.map +1 -0
- package/dist/components/ui/alert-dialog.client.mjs +104 -0
- package/dist/components/ui/alert-dialog.client.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +5 -1
- package/dist/components/ui/alert.d.mts.map +1 -1
- package/dist/components/ui/alert.mjs +13 -6
- package/dist/components/ui/alert.mjs.map +1 -1
- package/dist/components/ui/aspect-ratio.client.d.mts +10 -0
- package/dist/components/ui/aspect-ratio.client.d.mts.map +1 -0
- package/dist/components/ui/aspect-ratio.client.mjs +16 -0
- package/dist/components/ui/aspect-ratio.client.mjs.map +1 -0
- package/dist/components/ui/avatar.client.d.mts +21 -6
- package/dist/components/ui/avatar.client.d.mts.map +1 -1
- package/dist/components/ui/avatar.client.mjs +31 -9
- package/dist/components/ui/avatar.client.mjs.map +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/badge.d.mts.map +1 -1
- package/dist/components/ui/badge.mjs +11 -8
- package/dist/components/ui/badge.mjs.map +1 -1
- package/dist/components/ui/breadcrumb.d.mts +3 -1
- package/dist/components/ui/breadcrumb.d.mts.map +1 -1
- package/dist/components/ui/breadcrumb.mjs +7 -7
- package/dist/components/ui/breadcrumb.mjs.map +1 -1
- package/dist/components/ui/button-group.d.mts +29 -0
- package/dist/components/ui/button-group.d.mts.map +1 -0
- package/dist/components/ui/button-group.mjs +41 -0
- package/dist/components/ui/button-group.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +1 -1
- package/dist/components/ui/button.d.mts.map +1 -1
- package/dist/components/ui/button.mjs +19 -13
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/{calendar.d.mts → calendar.client.d.mts} +7 -4
- package/dist/components/ui/calendar.client.d.mts.map +1 -0
- package/dist/components/ui/{calendar.mjs → calendar.client.mjs} +22 -19
- package/dist/components/ui/calendar.client.mjs.map +1 -0
- package/dist/components/ui/card.d.mts +9 -2
- package/dist/components/ui/card.d.mts.map +1 -1
- package/dist/components/ui/card.mjs +15 -7
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/{carousel.d.mts → carousel.client.d.mts} +12 -3
- package/dist/components/ui/carousel.client.d.mts.map +1 -0
- package/dist/components/ui/{carousel.mjs → carousel.client.mjs} +10 -10
- package/dist/components/ui/carousel.client.mjs.map +1 -0
- package/dist/components/ui/chart.client.d.mts.map +1 -1
- package/dist/components/ui/chart.client.mjs +11 -11
- package/dist/components/ui/chart.client.mjs.map +1 -1
- package/dist/components/ui/checkbox.client.d.mts +12 -0
- package/dist/components/ui/checkbox.client.d.mts.map +1 -0
- package/dist/components/ui/checkbox.client.mjs +24 -0
- package/dist/components/ui/checkbox.client.mjs.map +1 -0
- package/dist/components/ui/collapsible.client.d.mts +6 -6
- package/dist/components/ui/collapsible.client.d.mts.map +1 -1
- package/dist/components/ui/collapsible.client.mjs +6 -6
- package/dist/components/ui/collapsible.client.mjs.map +1 -1
- package/dist/components/ui/combobox-dropdown.client.d.mts +1 -1
- package/dist/components/ui/combobox-dropdown.client.mjs +2 -2
- package/dist/components/ui/combobox-dropdown.client.mjs.map +1 -1
- package/dist/components/ui/combobox.client.mjs +4 -4
- package/dist/components/ui/combobox.client.mjs.map +1 -1
- package/dist/components/ui/{command.d.mts → command.client.d.mts} +8 -2
- package/dist/components/ui/command.client.d.mts.map +1 -0
- package/dist/components/ui/command.client.mjs +91 -0
- package/dist/components/ui/command.client.mjs.map +1 -0
- package/dist/components/ui/context-menu.client.d.mts +86 -0
- package/dist/components/ui/context-menu.client.d.mts.map +1 -0
- package/dist/components/ui/context-menu.client.mjs +128 -0
- package/dist/components/ui/context-menu.client.mjs.map +1 -0
- package/dist/components/ui/date-picker.client.mjs +2 -2
- package/dist/components/ui/date-picker.client.mjs.map +1 -1
- package/dist/components/ui/dialog.client.d.mts +19 -12
- package/dist/components/ui/dialog.client.d.mts.map +1 -1
- package/dist/components/ui/dialog.client.mjs +40 -29
- package/dist/components/ui/dialog.client.mjs.map +1 -1
- package/dist/components/ui/drawer.client.d.mts.map +1 -1
- package/dist/components/ui/drawer.client.mjs +5 -5
- package/dist/components/ui/drawer.client.mjs.map +1 -1
- package/dist/components/ui/dropdown-menu.client.d.mts +85 -0
- package/dist/components/ui/dropdown-menu.client.d.mts.map +1 -0
- package/dist/components/ui/dropdown-menu.client.mjs +131 -0
- package/dist/components/ui/dropdown-menu.client.mjs.map +1 -0
- package/dist/components/ui/empty.d.mts +36 -0
- package/dist/components/ui/empty.d.mts.map +1 -0
- package/dist/components/ui/empty.mjs +62 -0
- package/dist/components/ui/empty.mjs.map +1 -0
- package/dist/components/ui/field.client.d.mts +65 -0
- package/dist/components/ui/field.client.d.mts.map +1 -0
- package/dist/components/ui/field.client.mjs +114 -0
- package/dist/components/ui/field.client.mjs.map +1 -0
- package/dist/components/ui/form.client.d.mts +3 -4
- package/dist/components/ui/form.client.d.mts.map +1 -1
- package/dist/components/ui/form.client.mjs +4 -4
- package/dist/components/ui/form.client.mjs.map +1 -1
- package/dist/components/ui/hover-card.client.d.mts +6 -6
- package/dist/components/ui/hover-card.client.d.mts.map +1 -1
- package/dist/components/ui/hover-card.client.mjs +14 -11
- package/dist/components/ui/hover-card.client.mjs.map +1 -1
- package/dist/components/ui/{input-date-time.d.mts → input-date-time.client.d.mts} +7 -7
- package/dist/components/ui/input-date-time.client.d.mts.map +1 -0
- package/dist/components/ui/{input-date-time.mjs → input-date-time.client.mjs} +8 -8
- package/dist/components/ui/input-date-time.client.mjs.map +1 -0
- package/dist/components/ui/input-date.d.mts +1 -1
- package/dist/components/ui/input-date.d.mts.map +1 -1
- package/dist/components/ui/input-date.mjs.map +1 -1
- package/dist/components/ui/input-group.client.d.mts +59 -0
- package/dist/components/ui/input-group.client.d.mts.map +1 -0
- package/dist/components/ui/input-group.client.mjs +106 -0
- package/dist/components/ui/input-group.client.mjs.map +1 -0
- package/dist/components/ui/input-recipient.mjs +11 -11
- package/dist/components/ui/input-recipient.mjs.map +1 -1
- package/dist/components/ui/input-time.d.mts +1 -1
- package/dist/components/ui/input-time.d.mts.map +1 -1
- package/dist/components/ui/input-time.mjs.map +1 -1
- package/dist/components/ui/input.d.mts.map +1 -1
- package/dist/components/ui/input.mjs +1 -1
- package/dist/components/ui/input.mjs.map +1 -1
- package/dist/components/ui/item.d.mts +63 -0
- package/dist/components/ui/item.d.mts.map +1 -0
- package/dist/components/ui/item.mjs +119 -0
- package/dist/components/ui/item.mjs.map +1 -0
- package/dist/components/ui/kbd.d.mts +14 -0
- package/dist/components/ui/kbd.d.mts.map +1 -0
- package/dist/components/ui/kbd.mjs +22 -0
- package/dist/components/ui/kbd.mjs.map +1 -0
- package/dist/components/ui/label.d.mts +4 -4
- package/dist/components/ui/label.d.mts.map +1 -1
- package/dist/components/ui/label.mjs +5 -5
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/loader.d.mts +7 -0
- package/dist/components/ui/loader.d.mts.map +1 -0
- package/dist/components/ui/loader.mjs +63 -0
- package/dist/components/ui/loader.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +11 -11
- package/dist/components/ui/navigation-menu.d.mts.map +1 -1
- package/dist/components/ui/navigation-menu.mjs +18 -20
- package/dist/components/ui/navigation-menu.mjs.map +1 -1
- package/dist/components/ui/pagination.d.mts +8 -2
- package/dist/components/ui/pagination.d.mts.map +1 -1
- package/dist/components/ui/pagination.mjs +29 -21
- package/dist/components/ui/pagination.mjs.map +1 -1
- package/dist/components/ui/popover.client.d.mts +35 -0
- package/dist/components/ui/popover.client.d.mts.map +1 -0
- package/dist/components/ui/popover.client.mjs +59 -0
- package/dist/components/ui/popover.client.mjs.map +1 -0
- package/dist/components/ui/progress.client.d.mts +4 -4
- package/dist/components/ui/progress.client.d.mts.map +1 -1
- package/dist/components/ui/progress.client.mjs +7 -7
- package/dist/components/ui/progress.client.mjs.map +1 -1
- package/dist/components/ui/radio-group.d.mts +5 -5
- package/dist/components/ui/radio-group.d.mts.map +1 -1
- package/dist/components/ui/radio-group.mjs +10 -11
- package/dist/components/ui/radio-group.mjs.map +1 -1
- package/dist/components/ui/resizable.client.d.mts +3 -4
- package/dist/components/ui/resizable.client.d.mts.map +1 -1
- package/dist/components/ui/resizable.client.mjs +5 -9
- package/dist/components/ui/resizable.client.mjs.map +1 -1
- package/dist/components/ui/scroll-area.d.mts +5 -5
- package/dist/components/ui/scroll-area.d.mts.map +1 -1
- package/dist/components/ui/scroll-area.mjs +12 -11
- package/dist/components/ui/scroll-area.mjs.map +1 -1
- package/dist/components/ui/select.client.d.mts +18 -13
- package/dist/components/ui/select.client.d.mts.map +1 -1
- package/dist/components/ui/select.client.mjs +37 -32
- package/dist/components/ui/select.client.mjs.map +1 -1
- package/dist/components/ui/separator.d.mts +4 -4
- package/dist/components/ui/separator.d.mts.map +1 -1
- package/dist/components/ui/separator.mjs +6 -6
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/sheet.client.d.mts +9 -7
- package/dist/components/ui/sheet.client.d.mts.map +1 -1
- package/dist/components/ui/sheet.client.mjs +30 -20
- package/dist/components/ui/sheet.client.mjs.map +1 -1
- package/dist/components/ui/sidebar.client.mjs +28 -28
- package/dist/components/ui/sidebar.client.mjs.map +1 -1
- package/dist/components/ui/skeleton.mjs +1 -1
- package/dist/components/ui/skeleton.mjs.map +1 -1
- package/dist/components/ui/slider.d.mts +4 -4
- package/dist/components/ui/slider.d.mts.map +1 -1
- package/dist/components/ui/slider.mjs +11 -11
- package/dist/components/ui/slider.mjs.map +1 -1
- package/dist/components/ui/spinner.d.mts +10 -0
- package/dist/components/ui/spinner.d.mts.map +1 -0
- package/dist/components/ui/spinner.mjs +9 -55
- package/dist/components/ui/spinner.mjs.map +1 -1
- package/dist/components/ui/switch.client.d.mts +15 -0
- package/dist/components/ui/switch.client.d.mts.map +1 -0
- package/dist/components/ui/switch.client.mjs +23 -0
- package/dist/components/ui/switch.client.mjs.map +1 -0
- package/dist/components/ui/tabs.client.d.mts +31 -0
- package/dist/components/ui/tabs.client.d.mts.map +1 -0
- package/dist/components/ui/tabs.client.mjs +49 -0
- package/dist/components/ui/tabs.client.mjs.map +1 -0
- package/dist/components/ui/textarea.d.mts.map +1 -1
- package/dist/components/ui/textarea.mjs +1 -1
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/components/ui/toggle-group.client.d.mts +11 -6
- package/dist/components/ui/toggle-group.client.d.mts.map +1 -1
- package/dist/components/ui/toggle-group.client.mjs +20 -12
- package/dist/components/ui/toggle-group.client.mjs.map +1 -1
- package/dist/components/ui/{toggle.d.mts → toggle.client.d.mts} +6 -6
- package/dist/components/ui/toggle.client.d.mts.map +1 -0
- package/dist/components/ui/toggle.client.mjs +40 -0
- package/dist/components/ui/toggle.client.mjs.map +1 -0
- package/dist/components/ui/tooltip.client.d.mts +7 -7
- package/dist/components/ui/tooltip.client.d.mts.map +1 -1
- package/dist/components/ui/tooltip.client.mjs +10 -10
- package/dist/components/ui/tooltip.client.mjs.map +1 -1
- package/dist/components.d.mts +12 -20
- package/dist/components.mjs +12 -20
- package/dist/inline-edit/client.d.mts +3 -3
- package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
- package/dist/lib/hooks/use-indicator.mjs +11 -8
- package/dist/lib/hooks/use-indicator.mjs.map +1 -1
- package/dist/modules/auth/components/auth-layout.server.mjs +3 -3
- package/dist/modules/auth/components/auth-layout.server.mjs.map +1 -1
- package/dist/modules/auth/components/create-first-user-page.client.mjs +3 -3
- package/dist/modules/auth/components/create-first-user-page.client.mjs.map +1 -1
- package/dist/modules/auth/components/forget-password-page.client.mjs +1 -1
- package/dist/modules/auth/components/forget-password-page.client.mjs.map +1 -1
- package/dist/modules/auth/components/login-page.client.mjs +5 -5
- package/dist/modules/auth/components/login-page.client.mjs.map +1 -1
- package/dist/modules/auth/components/reset-password-page.client.mjs +5 -5
- package/dist/modules/auth/components/reset-password-page.client.mjs.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts +9 -9
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.mjs +3 -3
- package/dist/modules/commands/components/alert-dialog-command.client.mjs.map +1 -1
- package/dist/modules/commands/components/click-command.client.mjs +2 -2
- package/dist/modules/commands/components/click-command.client.mjs.map +1 -1
- package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
- package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/dialog-command.client.mjs +2 -2
- package/dist/modules/commands/components/dialog-command.client.mjs.map +1 -1
- package/dist/modules/commands/components/dropdown-command.client.mjs +2 -2
- package/dist/modules/commands/components/dropdown-command.client.mjs.map +1 -1
- package/dist/modules/commands/components/empty-command.client.mjs +2 -2
- package/dist/modules/commands/components/empty-command.client.mjs.map +1 -1
- package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -9
- package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/form-dialog-command.client.mjs +8 -6
- package/dist/modules/commands/components/form-dialog-command.client.mjs.map +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.d.mts +8 -1
- package/dist/modules/commands/hooks/use-command-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.mjs.map +1 -1
- package/dist/modules/commands/menus/context-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/context-menu.client.mjs +1 -1
- package/dist/modules/commands/menus/context-menu.client.mjs.map +1 -1
- package/dist/modules/commands/menus/dropdown-menu.client.mjs +2 -2
- package/dist/modules/commands/menus/dropdown-menu.client.mjs.map +1 -1
- package/dist/modules/commands/menus/floating-menu.client.d.mts +19 -0
- package/dist/modules/commands/menus/floating-menu.client.d.mts.map +1 -0
- package/dist/modules/commands/menus/{data-table-menu.client.mjs → floating-menu.client.mjs} +11 -11
- package/dist/modules/commands/menus/floating-menu.client.mjs.map +1 -0
- package/dist/modules/commands/utils/archive-command.client.mjs +1 -1
- package/dist/modules/commands/utils/archive-command.client.mjs.map +1 -1
- package/dist/modules/commands/utils/delete-command.client.mjs +1 -1
- package/dist/modules/commands/utils/delete-command.client.mjs.map +1 -1
- package/dist/modules/data-tables/components/cell/select.client.mjs +1 -1
- package/dist/modules/data-tables/components/cell/select.client.mjs.map +1 -1
- package/dist/modules/data-tables/components/column-header.mjs +5 -5
- package/dist/modules/data-tables/components/column-header.mjs.map +1 -1
- package/dist/modules/data-tables/components/filters/combobox.client.mjs +6 -6
- package/dist/modules/data-tables/components/filters/combobox.client.mjs.map +1 -1
- package/dist/modules/data-tables/components/filters/slider.client.mjs +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.mjs.map +1 -1
- package/dist/modules/data-tables/components/header.mjs +1 -1
- package/dist/modules/data-tables/components/header.mjs.map +1 -1
- package/dist/modules/data-tables/components/skeleton.mjs +2 -2
- package/dist/modules/data-tables/components/skeleton.mjs.map +1 -1
- package/dist/modules/data-tables/components/table.mjs +3 -3
- package/dist/modules/data-tables/components/table.mjs.map +1 -1
- package/dist/modules/data-tables/components/toolbar.mjs +1 -1
- package/dist/modules/data-tables/components/toolbar.mjs.map +1 -1
- package/dist/modules/data-tables/strategies/pagination/components.mjs +3 -3
- package/dist/modules/data-tables/strategies/pagination/components.mjs.map +1 -1
- package/dist/modules/data-tables/tables/data-table/components/table.mjs +8 -2
- package/dist/modules/data-tables/tables/data-table/components/table.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.mjs +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.mjs +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.mjs +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.mjs +8 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.mjs.map +1 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs +5 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.mjs +5 -1
- package/dist/modules/inline-edit/components/combobox.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.mjs +8 -4
- package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.mjs +7 -3
- package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-time.client.d.mts +1 -1
- package/dist/modules/inline-edit/components/date-time.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-time.client.mjs +7 -2
- package/dist/modules/inline-edit/components/date-time.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.mjs +5 -1
- package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-recipient.client.mjs +5 -1
- package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.mjs +7 -3
- package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input.client.mjs +18 -6
- package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/select.client.d.mts +8 -11
- package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/select.client.mjs +5 -1
- package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.d.mts +3 -2
- package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.mjs +6 -2
- package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.mjs +6 -2
- package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.d.mts +20 -5
- package/dist/modules/inline-edit/hooks/use-inline.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs +11 -8
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
- package/dist/modules/inline-edit/lib/variants.mjs +1 -1
- package/dist/modules/inline-edit/lib/variants.mjs.map +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +2 -2
- package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/dropzone.client.mjs +8 -8
- package/dist/modules/storage/components/dropzone.client.mjs.map +1 -1
- package/dist/modules/storage/components/image-grid.client.mjs +5 -5
- package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.d.mts +1 -0
- package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +2 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.mjs +6 -4
- package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
- package/package.json +6 -31
- package/src/components/editor/components/menu-nodes.client.tsx +3 -3
- package/src/components/editor/components/menu.client.tsx +3 -3
- package/src/components/emails/forget-password-email.tsx +6 -6
- package/src/components/entry.client.ts +16 -0
- package/src/components/entry.ts +6 -14
- package/src/components/header/back-button.client.tsx +2 -2
- package/src/components/header/bottom-bar.client.tsx +2 -2
- package/src/components/header/breadcrumbs.client.tsx +1 -1
- package/src/components/header/header.client.tsx +1 -1
- package/src/components/layouts/empty-page.tsx +2 -2
- package/src/components/layouts/error-page.tsx +3 -3
- package/src/components/layouts/providers.client.tsx +8 -5
- package/src/components/layouts/root-loading.tsx +2 -2
- package/src/components/layouts/tab-layout.tsx +1 -1
- package/src/components/lists/data-list.tsx +1 -1
- package/src/components/lists/data-stack.tsx +1 -1
- package/src/components/navigation/admin-sidebar-header.client.tsx +3 -3
- package/src/components/navigation/admin-sidebar-skeleton.tsx +1 -1
- package/src/components/navigation/admin-sidebar.client.tsx +1 -0
- package/src/components/ui/accordion.client.tsx +83 -0
- package/src/components/ui/alert-dialog.client.tsx +181 -0
- package/src/components/ui/alert.tsx +15 -7
- package/src/components/ui/aspect-ratio.client.tsx +9 -0
- package/src/components/ui/avatar.client.tsx +61 -6
- package/src/components/ui/badge.tsx +17 -11
- package/src/components/ui/breadcrumb.tsx +9 -10
- package/src/components/ui/button-group.tsx +78 -0
- package/src/components/ui/button.tsx +26 -16
- package/src/components/ui/{calendar.tsx → calendar.client.tsx} +27 -20
- package/src/components/ui/card.tsx +41 -8
- package/src/components/ui/{carousel.tsx → carousel.client.tsx} +12 -12
- package/src/components/ui/chart.client.tsx +105 -103
- package/src/components/ui/checkbox.client.tsx +28 -0
- package/src/components/ui/collapsible.client.tsx +2 -2
- package/src/components/ui/combobox-dropdown.client.tsx +2 -2
- package/src/components/ui/combobox.client.tsx +6 -6
- package/src/components/ui/command.client.tsx +179 -0
- package/src/components/ui/{context-menu.tsx → context-menu.client.tsx} +86 -64
- package/src/components/ui/date-picker.client.tsx +2 -2
- package/src/components/ui/dialog.client.tsx +43 -20
- package/src/components/ui/drawer.client.tsx +13 -15
- package/src/components/ui/{dropdown-menu.tsx → dropdown-menu.client.tsx} +45 -24
- package/src/components/ui/empty.tsx +93 -0
- package/src/components/ui/field.client.tsx +224 -0
- package/src/components/ui/form.client.tsx +4 -4
- package/src/components/ui/hover-card.client.tsx +14 -13
- package/src/components/ui/{input-date-time.tsx → input-date-time.client.tsx} +18 -11
- package/src/components/ui/input-date.tsx +1 -1
- package/src/components/ui/input-group.client.tsx +191 -0
- package/src/components/ui/input-recipient.tsx +12 -12
- package/src/components/ui/input-time.tsx +1 -1
- package/src/components/ui/input.tsx +2 -4
- package/src/components/ui/item.tsx +182 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +2 -3
- package/src/components/ui/loader.tsx +51 -0
- package/src/components/ui/navigation-menu.tsx +14 -17
- package/src/components/ui/pagination.tsx +31 -26
- package/src/components/ui/popover.client.tsx +73 -0
- package/src/components/ui/progress.client.tsx +6 -4
- package/src/components/ui/radio-group.tsx +5 -7
- package/src/components/ui/resizable.client.tsx +9 -19
- package/src/components/ui/scroll-area.tsx +5 -7
- package/src/components/ui/select.client.tsx +40 -22
- package/src/components/ui/separator.tsx +3 -4
- package/src/components/ui/sheet.client.tsx +19 -18
- package/src/components/ui/sidebar.client.tsx +27 -27
- package/src/components/ui/skeleton.tsx +1 -1
- package/src/components/ui/slider.tsx +5 -10
- package/src/components/ui/spinner.tsx +12 -48
- package/src/components/ui/switch.client.tsx +32 -0
- package/src/components/ui/tabs.client.tsx +79 -0
- package/src/components/ui/textarea.tsx +1 -2
- package/src/components/ui/toggle-group.client.tsx +26 -10
- package/src/components/ui/toggle.client.tsx +44 -0
- package/src/components/ui/tooltip.client.tsx +4 -9
- package/src/lib/hooks/use-indicator.tsx +14 -8
- package/src/modules/auth/components/auth-layout.server.tsx +3 -3
- package/src/modules/auth/components/create-first-user-page.client.tsx +4 -4
- package/src/modules/auth/components/forget-password-page.client.tsx +1 -1
- package/src/modules/auth/components/login-page.client.tsx +6 -6
- package/src/modules/auth/components/reset-password-page.client.tsx +7 -7
- package/src/modules/commands/components/alert-dialog-command.client.tsx +20 -16
- package/src/modules/commands/components/click-command.client.tsx +2 -2
- package/src/modules/commands/components/dialog-command.client.tsx +11 -10
- package/src/modules/commands/components/dropdown-command.client.tsx +2 -2
- package/src/modules/commands/components/empty-command.client.tsx +2 -2
- package/src/modules/commands/components/form-dialog-command.client.tsx +29 -13
- package/src/modules/commands/entry.client.ts +16 -0
- package/src/modules/commands/hooks/use-command-menu.client.tsx +2 -0
- package/src/modules/commands/menus/context-menu.client.tsx +3 -4
- package/src/modules/commands/menus/dropdown-menu.client.tsx +2 -2
- package/src/modules/commands/menus/floating-menu.client.tsx +54 -0
- package/src/modules/commands/utils/archive-command.client.tsx +1 -1
- package/src/modules/commands/utils/delete-command.client.tsx +1 -1
- package/src/modules/data-tables/components/cell/select.client.tsx +1 -1
- package/src/modules/data-tables/components/column-header.tsx +5 -5
- package/src/modules/data-tables/components/filters/combobox.client.tsx +6 -6
- package/src/modules/data-tables/components/filters/slider.client.tsx +2 -2
- package/src/modules/data-tables/components/header.tsx +1 -1
- package/src/modules/data-tables/components/skeleton.tsx +2 -2
- package/src/modules/data-tables/components/table.tsx +3 -3
- package/src/modules/data-tables/components/toolbar.tsx +1 -1
- package/src/modules/data-tables/strategies/pagination/components.tsx +3 -3
- package/src/modules/data-tables/tables/data-table/components/table.tsx +11 -2
- package/src/modules/data-tables/tables/inline-table/components/cells/common.tsx +1 -1
- package/src/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.tsx +1 -1
- package/src/modules/data-tables/tables/inline-table/components/cells/read-only.tsx +1 -1
- package/src/modules/data-tables/tables/inline-table/components/table.tsx +11 -2
- package/src/modules/inline-edit/components/combobox-dropdown.client.tsx +4 -0
- package/src/modules/inline-edit/components/combobox.client.tsx +4 -0
- package/src/modules/inline-edit/components/date-input.client.tsx +7 -3
- package/src/modules/inline-edit/components/date-picker.client.tsx +6 -2
- package/src/modules/inline-edit/components/date-time.client.tsx +16 -2
- package/src/modules/inline-edit/components/editor.client.tsx +4 -0
- package/src/modules/inline-edit/components/input-recipient.client.tsx +4 -0
- package/src/modules/inline-edit/components/input-toggle.client.tsx +6 -2
- package/src/modules/inline-edit/components/input.client.tsx +15 -3
- package/src/modules/inline-edit/components/select.client.tsx +10 -20
- package/src/modules/inline-edit/components/switch.client.tsx +7 -3
- package/src/modules/inline-edit/components/toggle.client.tsx +5 -1
- package/src/modules/inline-edit/hooks/use-inline.client.tsx +37 -13
- package/src/modules/inline-edit/lib/parsers.ts +9 -0
- package/src/modules/inline-edit/lib/variants.ts +1 -1
- package/src/modules/storage/components/dropzone.client.tsx +8 -8
- package/src/modules/storage/components/image-grid.client.tsx +5 -5
- package/src/modules/storage/components/upload-zone-context.client.tsx +1 -0
- package/src/modules/storage/components/upload-zone.client.tsx +9 -3
- package/src/styles.css +1 -3
- package/dist/components/ui/accordion.d.mts +0 -25
- package/dist/components/ui/accordion.d.mts.map +0 -1
- package/dist/components/ui/accordion.mjs +0 -46
- package/dist/components/ui/accordion.mjs.map +0 -1
- package/dist/components/ui/alert-dialog.d.mts +0 -43
- package/dist/components/ui/alert-dialog.d.mts.map +0 -1
- package/dist/components/ui/alert-dialog.mjs +0 -84
- package/dist/components/ui/alert-dialog.mjs.map +0 -1
- package/dist/components/ui/aspect-ratio.d.mts +0 -8
- package/dist/components/ui/aspect-ratio.d.mts.map +0 -1
- package/dist/components/ui/aspect-ratio.mjs +0 -16
- package/dist/components/ui/aspect-ratio.mjs.map +0 -1
- package/dist/components/ui/calendar.d.mts.map +0 -1
- package/dist/components/ui/calendar.mjs.map +0 -1
- package/dist/components/ui/carousel.d.mts.map +0 -1
- package/dist/components/ui/carousel.mjs.map +0 -1
- package/dist/components/ui/checkbox.d.mts +0 -12
- package/dist/components/ui/checkbox.d.mts.map +0 -1
- package/dist/components/ui/checkbox.mjs +0 -24
- package/dist/components/ui/checkbox.mjs.map +0 -1
- package/dist/components/ui/command.d.mts.map +0 -1
- package/dist/components/ui/command.mjs +0 -88
- package/dist/components/ui/command.mjs.map +0 -1
- package/dist/components/ui/context-menu.d.mts +0 -77
- package/dist/components/ui/context-menu.d.mts.map +0 -1
- package/dist/components/ui/context-menu.mjs +0 -125
- package/dist/components/ui/context-menu.mjs.map +0 -1
- package/dist/components/ui/dropdown-menu.d.mts +0 -78
- package/dist/components/ui/dropdown-menu.d.mts.map +0 -1
- package/dist/components/ui/dropdown-menu.mjs +0 -126
- package/dist/components/ui/dropdown-menu.mjs.map +0 -1
- package/dist/components/ui/input-date-time.d.mts.map +0 -1
- package/dist/components/ui/input-date-time.mjs.map +0 -1
- package/dist/components/ui/popover.d.mts +0 -23
- package/dist/components/ui/popover.d.mts.map +0 -1
- package/dist/components/ui/popover.mjs +0 -38
- package/dist/components/ui/popover.mjs.map +0 -1
- package/dist/components/ui/switch.d.mts +0 -12
- package/dist/components/ui/switch.d.mts.map +0 -1
- package/dist/components/ui/switch.mjs +0 -22
- package/dist/components/ui/switch.mjs.map +0 -1
- package/dist/components/ui/tabs.d.mts +0 -24
- package/dist/components/ui/tabs.d.mts.map +0 -1
- package/dist/components/ui/tabs.mjs +0 -39
- package/dist/components/ui/tabs.mjs.map +0 -1
- package/dist/components/ui/toggle.d.mts.map +0 -1
- package/dist/components/ui/toggle.mjs +0 -40
- package/dist/components/ui/toggle.mjs.map +0 -1
- package/dist/modules/commands/menus/data-table-menu.client.mjs.map +0 -1
- package/src/components/ui/accordion.tsx +0 -63
- package/src/components/ui/alert-dialog.tsx +0 -133
- package/src/components/ui/aspect-ratio.tsx +0 -9
- package/src/components/ui/checkbox.tsx +0 -29
- package/src/components/ui/command.tsx +0 -154
- package/src/components/ui/popover.tsx +0 -42
- package/src/components/ui/switch.tsx +0 -28
- package/src/components/ui/tabs.tsx +0 -54
- package/src/components/ui/toggle.tsx +0 -46
- package/src/modules/commands/menus/data-table-menu.client.tsx +0 -46
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.client.mjs";
|
|
1
2
|
import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
|
|
2
3
|
import { InlineEditVariantsProps } from "../lib/variants.mjs";
|
|
3
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
5
|
+
import { ComponentProps } from "react";
|
|
5
6
|
|
|
6
7
|
//#region src/modules/inline-edit/components/select.client.d.ts
|
|
7
8
|
declare function InlineSelect<Required extends boolean = false>({
|
|
@@ -12,19 +13,15 @@ declare function InlineSelect<Required extends boolean = false>({
|
|
|
12
13
|
isRequired,
|
|
13
14
|
disabled,
|
|
14
15
|
...props
|
|
15
|
-
}:
|
|
16
|
-
type InlineSelectTriggerProps = SelectTriggerProps;
|
|
16
|
+
}: ComponentProps<typeof Select> & useInlineEditOptions<string, Required>): react_jsx_runtime0.JSX.Element;
|
|
17
17
|
declare function InlineSelectTrigger({
|
|
18
18
|
variant,
|
|
19
19
|
className,
|
|
20
20
|
...props
|
|
21
|
-
}:
|
|
22
|
-
|
|
23
|
-
declare function
|
|
24
|
-
|
|
25
|
-
declare function InlineSelectValue(props: InlineSelectValueProps): react_jsx_runtime0.JSX.Element;
|
|
26
|
-
type InlineSelectItenProps = SelectItemProps;
|
|
27
|
-
declare function InlineSelectItem(props: InlineSelectItenProps): react_jsx_runtime0.JSX.Element;
|
|
21
|
+
}: ComponentProps<typeof SelectTrigger> & InlineEditVariantsProps): react_jsx_runtime0.JSX.Element;
|
|
22
|
+
declare function InlineSelectContent(props: ComponentProps<typeof SelectContent>): react_jsx_runtime0.JSX.Element;
|
|
23
|
+
declare function InlineSelectValue(props: ComponentProps<typeof SelectValue>): react_jsx_runtime0.JSX.Element;
|
|
24
|
+
declare function InlineSelectItem(props: ComponentProps<typeof SelectItem>): react_jsx_runtime0.JSX.Element;
|
|
28
25
|
//#endregion
|
|
29
|
-
export { InlineSelect, InlineSelectContent,
|
|
26
|
+
export { InlineSelect, InlineSelectContent, InlineSelectItem, InlineSelectTrigger, InlineSelectValue };
|
|
30
27
|
//# sourceMappingURL=select.client.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"mappings":";;;;;;;iBAegB,YAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,MAAA,IAAU,oBAAA,SAA6B,QAAA,IAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA0BzD,mBAAA,CAAA;EACd,OAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,aAAA,IAAiB,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAQjD,mBAAA,CAAoB,KAAA,EAAO,cAAA,QAAsB,aAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI/D,iBAAA,CAAkB,KAAA,EAAO,cAAA,QAAsB,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI3D,gBAAA,CAAiB,KAAA,EAAO,cAAA,QAAsB,UAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -14,7 +14,11 @@ function InlineSelect({ initialValue, action, permission, updateStrategy, isRequ
|
|
|
14
14
|
action,
|
|
15
15
|
permission,
|
|
16
16
|
updateStrategy,
|
|
17
|
-
isRequired
|
|
17
|
+
isRequired,
|
|
18
|
+
parser: {
|
|
19
|
+
decode: (value) => value,
|
|
20
|
+
encode: (value) => value
|
|
21
|
+
}
|
|
18
22
|
});
|
|
19
23
|
return /* @__PURE__ */ jsx(Select, {
|
|
20
24
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type {
|
|
1
|
+
{"version":3,"file":"select.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select.client\";\nimport { useIndicator } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\nexport function InlineSelect<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: ComponentProps<typeof Select> & useInlineEditOptions<string, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Select\n {...props}\n disabled={disabled || !isAllowed}\n defaultValue={value ?? undefined}\n onValueChange={(value) => {\n handleChange(value ? value : null);\n handleBlur(value ? value : null);\n }}\n />\n );\n}\n\nexport function InlineSelectTrigger({\n variant,\n className,\n ...props\n}: ComponentProps<typeof SelectTrigger> & InlineEditVariantsProps) {\n const { status } = useIndicator();\n\n return (\n <SelectTrigger {...props} className={cn(inlineEditVariants({ variant, status }), className)} />\n );\n}\n\nexport function InlineSelectContent(props: ComponentProps<typeof SelectContent>) {\n return <SelectContent {...props} />;\n}\n\nexport function InlineSelectValue(props: ComponentProps<typeof SelectValue>) {\n return <SelectValue {...props} />;\n}\n\nexport function InlineSelectItem(props: ComponentProps<typeof SelectItem>) {\n return <SelectItem {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACsE;CACzE,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,cAAc,SAAS;EACvB,gBAAgB,UAAU;AACxB,gBAAa,QAAQ,QAAQ,KAAK;AAClC,cAAW,QAAQ,QAAQ,KAAK;;GAElC;;AAIN,SAAgB,oBAAoB,EAClC,SACA,WACA,GAAG,SAC8D;CACjE,MAAM,EAAE,WAAW,cAAc;AAEjC,QACE,oBAAC;EAAc,GAAI;EAAO,WAAW,GAAG,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EAAE,UAAU;GAAI;;AAInG,SAAgB,oBAAoB,OAA6C;AAC/E,QAAO,oBAAC,iBAAc,GAAI,QAAS;;AAGrC,SAAgB,kBAAkB,OAA2C;AAC3E,QAAO,oBAAC,eAAY,GAAI,QAAS;;AAGnC,SAAgB,iBAAiB,OAA0C;AACzE,QAAO,oBAAC,cAAW,GAAI,QAAS"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Switch } from "../../../components/ui/switch.client.mjs";
|
|
1
2
|
import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
|
|
2
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
+
import { ComponentProps } from "react";
|
|
4
5
|
|
|
5
6
|
//#region src/modules/inline-edit/components/switch.client.d.ts
|
|
6
7
|
declare function InlineSwitch<Required extends boolean = false>({
|
|
@@ -11,7 +12,7 @@ declare function InlineSwitch<Required extends boolean = false>({
|
|
|
11
12
|
isRequired,
|
|
12
13
|
disabled,
|
|
13
14
|
...props
|
|
14
|
-
}:
|
|
15
|
+
}: ComponentProps<typeof Switch> & useInlineEditOptions<boolean, Required>): react_jsx_runtime0.JSX.Element;
|
|
15
16
|
//#endregion
|
|
16
17
|
export { InlineSwitch };
|
|
17
18
|
//# sourceMappingURL=switch.client.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"switch.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"mappings":";;;;;;iBAMgB,YAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,MAAA,IAAU,oBAAA,UAA8B,QAAA,IAAS,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { Switch } from "../../../components/ui/switch.mjs";
|
|
3
|
+
import { Switch } from "../../../components/ui/switch.client.mjs";
|
|
4
4
|
import { useInlineEdit } from "../hooks/use-inline.client.mjs";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
|
|
@@ -11,7 +11,11 @@ function InlineSwitch({ initialValue, action, permission, updateStrategy, isRequ
|
|
|
11
11
|
action,
|
|
12
12
|
permission,
|
|
13
13
|
updateStrategy,
|
|
14
|
-
isRequired
|
|
14
|
+
isRequired,
|
|
15
|
+
parser: {
|
|
16
|
+
decode: (value) => value,
|
|
17
|
+
encode: (value) => value
|
|
18
|
+
}
|
|
15
19
|
});
|
|
16
20
|
return /* @__PURE__ */ jsx(Switch, {
|
|
17
21
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type {
|
|
1
|
+
{"version":3,"file":"switch.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { Switch } from \"@/components/ui/switch.client\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport function InlineSwitch<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: ComponentProps<typeof Switch> & useInlineEditOptions<boolean, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Switch\n {...props}\n disabled={disabled || !isAllowed}\n defaultChecked={value ?? undefined}\n onCheckedChange={(checked) => {\n handleChange(checked ?? null);\n handleBlur(checked ?? null);\n }}\n />\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACuE;CAC1E,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,gBAAgB,SAAS;EACzB,kBAAkB,YAAY;AAC5B,gBAAa,WAAW,KAAK;AAC7B,cAAW,WAAW,KAAK;;GAE7B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../lib/utils/cn.mjs";
|
|
4
|
-
import { Toggle } from "../../../components/ui/toggle.mjs";
|
|
4
|
+
import { Toggle } from "../../../components/ui/toggle.client.mjs";
|
|
5
5
|
import { useInlineEdit } from "../hooks/use-inline.client.mjs";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
|
|
@@ -12,7 +12,11 @@ function InlineToggle({ initialValue, action, children, permission, updateStrate
|
|
|
12
12
|
action,
|
|
13
13
|
permission,
|
|
14
14
|
updateStrategy,
|
|
15
|
-
isRequired
|
|
15
|
+
isRequired,
|
|
16
|
+
parser: {
|
|
17
|
+
decode: (value) => value,
|
|
18
|
+
encode: (value) => value
|
|
19
|
+
}
|
|
16
20
|
});
|
|
17
21
|
return /* @__PURE__ */ jsx("div", {
|
|
18
22
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport { Toggle } from \"@/components/ui/toggle\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport type InlineEditToggleProps<Required extends boolean = false> =\n React.HTMLAttributes<HTMLDivElement> & useInlineEditOptions<boolean, Required>;\n\nexport function InlineToggle<Required extends boolean = false>({\n initialValue,\n action,\n children,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineEditToggleProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <div {...props} className={cn(\"flex flex-wrap items-center justify-start gap-1\", className)}>\n <Toggle\n disabled={!isAllowed}\n variant=\"outline\"\n pressed={value ?? undefined}\n defaultChecked={initialValue ?? undefined}\n onPressedChange={(value) => {\n handleChange(value);\n handleBlur(value);\n }}\n >\n {children}\n </Toggle>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,aAA+C,EAC7D,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SAC+B;CAClC,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport { Toggle } from \"@/components/ui/toggle.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport type InlineEditToggleProps<Required extends boolean = false> =\n React.HTMLAttributes<HTMLDivElement> & useInlineEditOptions<boolean, Required>;\n\nexport function InlineToggle<Required extends boolean = false>({\n initialValue,\n action,\n children,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineEditToggleProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <div {...props} className={cn(\"flex flex-wrap items-center justify-start gap-1\", className)}>\n <Toggle\n disabled={!isAllowed}\n variant=\"outline\"\n pressed={value ?? undefined}\n defaultChecked={initialValue ?? undefined}\n onPressedChange={(value) => {\n handleChange(value);\n handleBlur(value);\n }}\n >\n {children}\n </Toggle>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,aAA+C,EAC7D,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SAC+B;CAClC,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EAAI,GAAI;EAAO,WAAW,GAAG,mDAAmD,UAAU;YACzF,oBAAC;GACC,UAAU,CAAC;GACX,SAAQ;GACR,SAAS,SAAS;GAClB,gBAAgB,gBAAgB;GAChC,kBAAkB,UAAU;AAC1B,iBAAa,MAAM;AACnB,eAAW,MAAM;;GAGlB;IACM;GACL"}
|
|
@@ -16,17 +16,17 @@ type MaybeValue<TValue, Required extends boolean> = Required extends true ? TVal
|
|
|
16
16
|
/**
|
|
17
17
|
* Use the inline edit hook options.
|
|
18
18
|
*/
|
|
19
|
-
type useInlineEditOptions<
|
|
19
|
+
type useInlineEditOptions<TResult, Required extends boolean = false> = {
|
|
20
20
|
/**
|
|
21
21
|
* Initial value
|
|
22
22
|
*/
|
|
23
|
-
initialValue?: MaybeValue<
|
|
23
|
+
initialValue?: MaybeValue<TResult, Required>;
|
|
24
24
|
/**
|
|
25
25
|
* Action to execute on update
|
|
26
26
|
*/
|
|
27
27
|
action: (value: {
|
|
28
28
|
id: string;
|
|
29
|
-
value: MaybeValue<
|
|
29
|
+
value: MaybeValue<TResult, Required>;
|
|
30
30
|
}) => Promise<unknown>;
|
|
31
31
|
/**
|
|
32
32
|
* Permission required to edit
|
|
@@ -45,10 +45,25 @@ type useInlineEditOptions<TValue, Required extends boolean = false> = {
|
|
|
45
45
|
*/
|
|
46
46
|
isRequired?: Required;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Inline edit hook props
|
|
50
|
+
*/
|
|
51
|
+
type UseInlineEditProps<TValue extends string | number | Date | boolean | JSON | EditorJSONContent, TResult extends string | number | Date | boolean | JSON | EditorJSONContent, Required extends boolean = false> = useInlineEditOptions<TResult, Required> & {
|
|
52
|
+
parser: {
|
|
53
|
+
/**
|
|
54
|
+
* Transform the value from the result type to the value type
|
|
55
|
+
*/
|
|
56
|
+
decode: (value: TResult) => TValue;
|
|
57
|
+
/**
|
|
58
|
+
* Transform the value from the value type to the result type
|
|
59
|
+
*/
|
|
60
|
+
encode: (value: TValue) => TResult;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
48
63
|
/**
|
|
49
64
|
* Use the inline edit hook.
|
|
50
65
|
*/
|
|
51
|
-
declare function useInlineEdit<TValue extends string | number | Date | boolean | JSON | EditorJSONContent, Required extends boolean = false>(props:
|
|
66
|
+
declare function useInlineEdit<TValue extends string | number | Date | boolean | JSON | EditorJSONContent, TResult extends string | number | Date | boolean | JSON | EditorJSONContent = TValue, Required extends boolean = false>(props: UseInlineEditProps<TValue, TResult, Required>): {
|
|
52
67
|
value: MaybeValue<TValue, Required> | undefined;
|
|
53
68
|
setValue: react.Dispatch<react.SetStateAction<MaybeValue<TValue, Required> | undefined>>;
|
|
54
69
|
handleChange: (next: MaybeValue<TValue, Required> | null) => void;
|
|
@@ -57,5 +72,5 @@ declare function useInlineEdit<TValue extends string | number | Date | boolean |
|
|
|
57
72
|
isAllowed: boolean;
|
|
58
73
|
};
|
|
59
74
|
//#endregion
|
|
60
|
-
export { useInlineEdit, useInlineEditOptions };
|
|
75
|
+
export { UseInlineEditProps, useInlineEdit, useInlineEditOptions };
|
|
61
76
|
//# sourceMappingURL=use-inline.client.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-inline.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"mappings":";;;;;;;;KAYK,cAAA;EAEC,IAAA;EACA,KAAA;AAAA;EAGA,IAAA;AAAA;AAAA,KAOD,UAAA,qCAA+C,QAAA,gBAAwB,MAAA,GAAS,MAAA;;;;KAKzE,oBAAA;EAfN;;;EAmBJ,YAAA,GAAe,UAAA,CAAW,
|
|
1
|
+
{"version":3,"file":"use-inline.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"mappings":";;;;;;;;KAYK,cAAA;EAEC,IAAA;EACA,KAAA;AAAA;EAGA,IAAA;AAAA;AAAA,KAOD,UAAA,qCAA+C,QAAA,gBAAwB,MAAA,GAAS,MAAA;;;;KAKzE,oBAAA;EAfN;;;EAmBJ,YAAA,GAAe,UAAA,CAAW,OAAA,EAAS,QAAA;EAThC;;;EAaH,MAAA,GAAS,KAAA;IAAS,EAAA;IAAY,KAAA,EAAO,UAAA,CAAW,OAAA,EAAS,QAAA;EAAA,MAAgB,OAAA;EAbgB;;;EAiBzF,UAAA,GAAa,UAAA;EAjB6D;;;;AAK5E;;EAmBE,cAAA,GAAiB,cAAA;EAfS;;;;EAoB1B,UAAA,GAAa,QAAA;AAAA;;;;KAMH,kBAAA,kCACuB,IAAA,aAAiB,IAAA,GAAO,iBAAA,oCACvB,IAAA,aAAiB,IAAA,GAAO,iBAAA,sCAExD,oBAAA,CAAqB,OAAA,EAAS,QAAA;EAChC,MAAA;IAXqB;;;IAenB,MAAA,GAAS,KAAA,EAAO,OAAA,KAAY,MAAA;IAnCf;;;IAuCb,MAAA,GAAS,KAAA,EAAO,MAAA,KAAW,OAAA;EAAA;AAAA;;;;iBAOf,aAAA,kCACmB,IAAA,aAAiB,IAAA,GAAO,iBAAA,oCACvB,IAAA,aAAiB,IAAA,GAAO,iBAAA,GAAoB,MAAA,mCAAA,CAE9E,KAAA,EAAO,kBAAA,CAAmB,MAAA,EAAQ,OAAA,EAAS,QAAA;;;uBA8Ef,UAAA,CAAW,MAAA,EAAQ,QAAA;qBAsBrB,UAAA,CAAW,MAAA,EAAQ,QAAA;UAAT,eAAA"}
|
|
@@ -19,6 +19,7 @@ function useInlineEdit(props) {
|
|
|
19
19
|
*/
|
|
20
20
|
const strategy = props.updateStrategy ?? defaultUpdateStrategy;
|
|
21
21
|
const delay = strategy.mode === "change" ? strategy.delay ?? 0 : 0;
|
|
22
|
+
const initialValue = props.parser.decode(props.initialValue) ?? void 0;
|
|
22
23
|
/**
|
|
23
24
|
* The inline edit context.
|
|
24
25
|
*/
|
|
@@ -26,7 +27,7 @@ function useInlineEdit(props) {
|
|
|
26
27
|
/**
|
|
27
28
|
* The current value of the inline edit.
|
|
28
29
|
*/
|
|
29
|
-
const [value, setValue] = useState(
|
|
30
|
+
const [value, setValue] = useState(initialValue);
|
|
30
31
|
/**
|
|
31
32
|
* The indicator status.
|
|
32
33
|
*/
|
|
@@ -44,28 +45,30 @@ function useInlineEdit(props) {
|
|
|
44
45
|
setStatus("success");
|
|
45
46
|
},
|
|
46
47
|
onError: (error) => {
|
|
47
|
-
setValue(
|
|
48
|
+
setValue(initialValue);
|
|
48
49
|
toast.error("Er is iets misgegaan", { description: error instanceof Error ? error.message : void 0 });
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
/**
|
|
52
53
|
* Handle instant mutate
|
|
53
54
|
*/
|
|
54
|
-
const handleMutateInstant = useCallback((
|
|
55
|
+
const handleMutateInstant = useCallback((input) => {
|
|
55
56
|
if (!isAllowed) {
|
|
56
57
|
toast.error("Je hebt geen toestemming om dit te bewerken");
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
if (
|
|
60
|
+
if (input === initialValue) return;
|
|
61
|
+
const value = props.parser.encode(input);
|
|
60
62
|
return mutation.mutate({
|
|
61
63
|
id: context.id,
|
|
62
64
|
value
|
|
63
65
|
});
|
|
64
66
|
}, [
|
|
65
67
|
isAllowed,
|
|
66
|
-
|
|
68
|
+
initialValue,
|
|
67
69
|
mutation,
|
|
68
|
-
context.id
|
|
70
|
+
context.id,
|
|
71
|
+
props.parser
|
|
69
72
|
]);
|
|
70
73
|
/**
|
|
71
74
|
* Handle mutate with debounce
|
|
@@ -78,7 +81,7 @@ function useInlineEdit(props) {
|
|
|
78
81
|
setValue(next ?? void 0);
|
|
79
82
|
if (strategy.mode !== "change") return;
|
|
80
83
|
if (props.isRequired && next === null) {
|
|
81
|
-
setValue(
|
|
84
|
+
setValue(initialValue ?? void 0);
|
|
82
85
|
setStatus("error");
|
|
83
86
|
toast.error("Dit veld is verplicht");
|
|
84
87
|
return;
|
|
@@ -92,7 +95,7 @@ function useInlineEdit(props) {
|
|
|
92
95
|
setValue(next ?? void 0);
|
|
93
96
|
if (strategy.mode !== "blur") return;
|
|
94
97
|
if (props.isRequired && next === null) {
|
|
95
|
-
setValue(
|
|
98
|
+
setValue(initialValue ?? void 0);
|
|
96
99
|
setStatus("error");
|
|
97
100
|
toast.error("Dit veld is verplicht");
|
|
98
101
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-inline.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport type { EditorJSONContent } from \"@/components/entry\";\nimport { useLocalIndicator } from \"@/lib/entry.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { usePermission } from \"@/modules/auth/hooks/use-permission\";\nimport type { Permission } from \"@/modules/auth/lib/permissions\";\nimport { useInlineEditContext } from \"./context.client\";\n\ntype UpdateStrategy =\n | {\n mode: \"change\";\n delay?: number;\n }\n | {\n mode: \"blur\";\n };\n\nconst defaultUpdateStrategy: UpdateStrategy = {\n mode: \"blur\",\n};\n\ntype MaybeValue<TValue, Required extends boolean> = Required extends true ? TValue : TValue | null;\n\n/**\n * Use the inline edit hook options.\n */\nexport type useInlineEditOptions<
|
|
1
|
+
{"version":3,"file":"use-inline.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport type { EditorJSONContent } from \"@/components/entry\";\nimport { useLocalIndicator } from \"@/lib/entry.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { usePermission } from \"@/modules/auth/hooks/use-permission\";\nimport type { Permission } from \"@/modules/auth/lib/permissions\";\nimport { useInlineEditContext } from \"./context.client\";\n\ntype UpdateStrategy =\n | {\n mode: \"change\";\n delay?: number;\n }\n | {\n mode: \"blur\";\n };\n\nconst defaultUpdateStrategy: UpdateStrategy = {\n mode: \"blur\",\n};\n\ntype MaybeValue<TValue, Required extends boolean> = Required extends true ? TValue : TValue | null;\n\n/**\n * Use the inline edit hook options.\n */\nexport type useInlineEditOptions<TResult, Required extends boolean = false> = {\n /**\n * Initial value\n */\n initialValue?: MaybeValue<TResult, Required>;\n /**\n * Action to execute on update\n */\n action: (value: { id: string; value: MaybeValue<TResult, Required> }) => Promise<unknown>;\n /**\n * Permission required to edit\n */\n permission?: Permission;\n /**\n * Update strategy\n * - trigger: when to update the value (default: \"blur\")\n * - delay: delay in milliseconds before updating the value (only for \"change\" trigger)\n * @default { trigger: \"blur\" }\n */\n updateStrategy?: UpdateStrategy;\n /**\n * Is the value required\n * @default false\n */\n isRequired?: Required;\n};\n\n/**\n * Inline edit hook props\n */\nexport type UseInlineEditProps<\n TValue extends string | number | Date | boolean | JSON | EditorJSONContent,\n TResult extends string | number | Date | boolean | JSON | EditorJSONContent,\n Required extends boolean = false,\n> = useInlineEditOptions<TResult, Required> & {\n parser: {\n /**\n * Transform the value from the result type to the value type\n */\n decode: (value: TResult) => TValue;\n /**\n * Transform the value from the value type to the result type\n */\n encode: (value: TValue) => TResult;\n };\n};\n\n/**\n * Use the inline edit hook.\n */\nexport function useInlineEdit<\n TValue extends string | number | Date | boolean | JSON | EditorJSONContent,\n TResult extends string | number | Date | boolean | JSON | EditorJSONContent = TValue,\n Required extends boolean = false,\n>(props: UseInlineEditProps<TValue, TResult, Required>) {\n /**\n * The update strategy.\n */\n const strategy = props.updateStrategy ?? defaultUpdateStrategy;\n const delay = strategy.mode === \"change\" ? (strategy.delay ?? 0) : 0;\n const initialValue = props.parser.decode(props.initialValue as TResult) ?? undefined;\n\n /**\n * The inline edit context.\n */\n const context = useInlineEditContext();\n\n /**\n * The current value of the inline edit.\n */\n const [value, setValue] = useState<MaybeValue<TValue, Required> | undefined>(initialValue);\n\n /**\n * The indicator status.\n */\n const { status, setStatus } = useLocalIndicator();\n\n /**\n * Permission guard\n */\n const data = usePermission(props.permission ?? context.permission ?? {});\n const isAllowed = data?.success;\n\n /**\n * Execute the action to update the value.\n */\n const mutation = useAction({\n mutationFn: props.action,\n onMutate: () => {\n setStatus(\"pending\");\n },\n onSuccess: () => {\n setStatus(\"success\");\n },\n onError: (error) => {\n setValue(initialValue);\n toast.error(\"Er is iets misgegaan\", {\n description: error instanceof Error ? error.message : undefined,\n });\n },\n });\n\n /**\n * Handle instant mutate\n */\n const handleMutateInstant = useCallback(\n (input: TValue) => {\n // Permission guard\n if (!isAllowed) {\n toast.error(\"Je hebt geen toestemming om dit te bewerken\");\n return;\n }\n\n // If the value is the same as the initial value, do nothing\n if (input === initialValue) return;\n\n const value = props.parser.encode(input as TValue);\n\n // Update the value\n return mutation.mutate({ id: context.id, value });\n },\n [isAllowed, initialValue, mutation, context.id, props.parser],\n );\n\n /**\n * Handle mutate with debounce\n */\n const handleMutateDebounced = useDebouncedCallback(handleMutateInstant, delay);\n\n /**\n * Handle change updates\n */\n function handleChange(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not change, exit\n if (strategy.mode !== \"change\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is change, update the value after the delay\n handleMutateDebounced(next as TValue);\n }\n\n /**\n * Handle blur updates\n */\n function handleBlur(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not blur, exit\n if (strategy.mode !== \"blur\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is blur, update the value\n handleMutateInstant(next as TValue);\n }\n\n return { value, setValue, handleChange, handleBlur, status, isAllowed };\n}\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,wBAAwC,EAC5C,MAAM,QACP;;;;AAyDD,SAAgB,cAId,OAAsD;;;;CAItD,MAAM,WAAW,MAAM,kBAAkB;CACzC,MAAM,QAAQ,SAAS,SAAS,WAAY,SAAS,SAAS,IAAK;CACnE,MAAM,eAAe,MAAM,OAAO,OAAO,MAAM,aAAwB,IAAI;;;;CAK3E,MAAM,UAAU,sBAAsB;;;;CAKtC,MAAM,CAAC,OAAO,YAAY,SAAmD,aAAa;;;;CAK1F,MAAM,EAAE,QAAQ,cAAc,mBAAmB;CAMjD,MAAM,YADO,cAAc,MAAM,cAAc,QAAQ,cAAc,EAAE,CAAC,EAChD;;;;CAKxB,MAAM,WAAW,UAAU;EACzB,YAAY,MAAM;EAClB,gBAAgB;AACd,aAAU,UAAU;;EAEtB,iBAAiB;AACf,aAAU,UAAU;;EAEtB,UAAU,UAAU;AAClB,YAAS,aAAa;AACtB,SAAM,MAAM,wBAAwB,EAClC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;;EAEL,CAAC;;;;CAKF,MAAM,sBAAsB,aACzB,UAAkB;AAEjB,MAAI,CAAC,WAAW;AACd,SAAM,MAAM,8CAA8C;AAC1D;;AAIF,MAAI,UAAU,aAAc;EAE5B,MAAM,QAAQ,MAAM,OAAO,OAAO,MAAgB;AAGlD,SAAO,SAAS,OAAO;GAAE,IAAI,QAAQ;GAAI;GAAO,CAAC;IAEnD;EAAC;EAAW;EAAc;EAAU,QAAQ;EAAI,MAAM;EAAO,CAC9D;;;;CAKD,MAAM,wBAAwB,qBAAqB,qBAAqB,MAAM;;;;CAK9E,SAAS,aAAa,MAA2C;AAE/D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,SAAU;AAGhC,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,gBAAgB,OAAU;AACnC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,wBAAsB,KAAe;;;;;CAMvC,SAAS,WAAW,MAA2C;AAE7D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,OAAQ;AAG9B,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,gBAAgB,OAAU;AACnC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,sBAAoB,KAAe;;AAGrC,QAAO;EAAE;EAAO;EAAU;EAAc;EAAY;EAAQ;EAAW"}
|
|
@@ -5,7 +5,7 @@ const inlineEditVariants = cva("", {
|
|
|
5
5
|
variants: {
|
|
6
6
|
variant: {
|
|
7
7
|
default: "",
|
|
8
|
-
table: "min-h-
|
|
8
|
+
table: "min-h-8 px-3 py-1 text-base md:text-sm rounded-none h-full w-full border-none outline-none ring-0 focus:border-0 focus:outline-none focus:ring-0 focus:ring-offset-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
9
9
|
},
|
|
10
10
|
status: {
|
|
11
11
|
idle: "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants.mjs","names":[],"sources":["../../../../src/modules/inline-edit/lib/variants.ts"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\n\nexport const inlineEditVariants = cva(\"\", {\n variants: {\n variant: {\n default: \"\",\n table:\n \"min-h-
|
|
1
|
+
{"version":3,"file":"variants.mjs","names":[],"sources":["../../../../src/modules/inline-edit/lib/variants.ts"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\n\nexport const inlineEditVariants = cva(\"\", {\n variants: {\n variant: {\n default: \"\",\n table:\n \"min-h-8 px-3 py-1 text-base md:text-sm rounded-none h-full w-full border-none outline-none ring-0 focus:border-0 focus:outline-none focus:ring-0 focus:ring-offset-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0\",\n },\n status: {\n idle: \"\",\n pending: \"opacity-70 animate-pulse\",\n success: \"\",\n error: \"border-destructive text-destructive\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n // status: \"idle\",\n },\n});\n\nexport type InlineEditVariantsProps = VariantProps<typeof inlineEditVariants>;\n"],"mappings":";;;AAEA,MAAa,qBAAqB,IAAI,IAAI;CACxC,UAAU;EACR,SAAS;GACP,SAAS;GACT,OACE;GACH;EACD,QAAQ;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO;GACR;EACF;CACD,iBAAiB,EACf,SAAS,WAEV;CACF,CAAC"}
|
|
@@ -36,7 +36,7 @@ type DropzoneContentProps = {
|
|
|
36
36
|
declare function DropzoneContent({
|
|
37
37
|
children,
|
|
38
38
|
className
|
|
39
|
-
}: DropzoneContentProps): string | number | bigint | true |
|
|
39
|
+
}: DropzoneContentProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null;
|
|
40
40
|
/**
|
|
41
41
|
* DropzoneEmptyState
|
|
42
42
|
*/
|
|
@@ -47,7 +47,7 @@ type DropzoneEmptyStateProps = {
|
|
|
47
47
|
declare function DropzoneEmptyState({
|
|
48
48
|
children,
|
|
49
49
|
className
|
|
50
|
-
}: DropzoneEmptyStateProps): string | number | bigint | true |
|
|
50
|
+
}: DropzoneEmptyStateProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null;
|
|
51
51
|
//#endregion
|
|
52
52
|
export { Dropzone, DropzoneContent, DropzoneContentProps, DropzoneEmptyState, DropzoneEmptyStateProps, DropzoneProps };
|
|
53
53
|
//# sourceMappingURL=dropzone.client.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"mappings":";;;;;;;;;KAcY,aAAA,GAAgB,IAAA,CAAK,eAAA;EAC/B,GAAA,GAAM,IAAA;EACN,SAAA;EACA,MAAA,IAAU,aAAA,EAAe,IAAA,IAAQ,cAAA,EAAgB,aAAA,IAAiB,KAAA,EAAO,SAAA;EACzE,QAAA,GAAW,SAAA;AAAA;AAAA,iBAGG,QAAA,CAAA;EACd,MAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA;EACA,GAAA;EACA,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KA0CJ,oBAAA;EACV,QAAA,GAAW,SAAA;EACX,SAAA;AAAA;AAAA,iBAKc,eAAA,CAAA;EAAkB,QAAA;EAAU;AAAA,GAAa,oBAAA,qCAAoB,
|
|
1
|
+
{"version":3,"file":"dropzone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"mappings":";;;;;;;;;KAcY,aAAA,GAAgB,IAAA,CAAK,eAAA;EAC/B,GAAA,GAAM,IAAA;EACN,SAAA;EACA,MAAA,IAAU,aAAA,EAAe,IAAA,IAAQ,cAAA,EAAgB,aAAA,IAAiB,KAAA,EAAO,SAAA;EACzE,QAAA,GAAW,SAAA;AAAA;AAAA,iBAGG,QAAA,CAAA;EACd,MAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA;EACA,GAAA;EACA,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KA0CJ,oBAAA;EACV,QAAA,GAAW,SAAA;EACX,SAAA;AAAA;AAAA,iBAKc,eAAA,CAAA;EAAkB,QAAA;EAAU;AAAA,GAAa,oBAAA,qCAAoB,QAAA,CAAA,SAAA,IAAA,OAAA,sCAAA,KAAA,CAAA,WAAA,GAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,wBAAA,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KA8BjE,uBAAA;EACV,QAAA,GAAW,SAAA;EACX,SAAA;AAAA;AAAA,iBAGc,kBAAA,CAAA;EAAqB,QAAA;EAAU;AAAA,GAAa,uBAAA,qCAAuB,QAAA,CAAA,SAAA,IAAA,OAAA,sCAAA,KAAA,CAAA,WAAA,GAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,wBAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -36,7 +36,7 @@ function Dropzone({ accept, maxFiles = 1, maxSize, minSize, onDrop, onError, dis
|
|
|
36
36
|
maxFiles
|
|
37
37
|
},
|
|
38
38
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
39
|
-
className: cn("relative h-auto w-full flex-col overflow-hidden p-8", isDragActive && "
|
|
39
|
+
className: cn("relative h-auto w-full flex-col overflow-hidden p-8", isDragActive && "outline-none ring-1 ring-ring", className),
|
|
40
40
|
disabled,
|
|
41
41
|
type: "button",
|
|
42
42
|
variant: "outline",
|
|
@@ -57,15 +57,15 @@ function DropzoneContent({ children, className }) {
|
|
|
57
57
|
className: cn("flex flex-col items-center justify-center", className),
|
|
58
58
|
children: [
|
|
59
59
|
/* @__PURE__ */ jsx("div", {
|
|
60
|
-
className: "
|
|
60
|
+
className: "flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground",
|
|
61
61
|
children: /* @__PURE__ */ jsx(UploadIcon, { size: 16 })
|
|
62
62
|
}),
|
|
63
63
|
/* @__PURE__ */ jsx("p", {
|
|
64
|
-
className: "my-2 w-full truncate text-sm
|
|
64
|
+
className: "my-2 w-full truncate font-medium text-sm",
|
|
65
65
|
children: src.length > maxLabelItems ? `${new Intl.ListFormat("en").format(src.slice(0, maxLabelItems).map((file) => file.name))} and ${src.length - maxLabelItems} more` : new Intl.ListFormat("en").format(src.map((file) => file.name))
|
|
66
66
|
}),
|
|
67
67
|
/* @__PURE__ */ jsx("p", {
|
|
68
|
-
className: "
|
|
68
|
+
className: "w-full text-wrap text-muted-foreground text-xs",
|
|
69
69
|
children: "Drag and drop or click to replace"
|
|
70
70
|
})
|
|
71
71
|
]
|
|
@@ -87,19 +87,19 @@ function DropzoneEmptyState({ children, className }) {
|
|
|
87
87
|
className: cn("flex flex-col items-center justify-center", className),
|
|
88
88
|
children: [
|
|
89
89
|
/* @__PURE__ */ jsx("div", {
|
|
90
|
-
className: "
|
|
90
|
+
className: "flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground",
|
|
91
91
|
children: /* @__PURE__ */ jsx(UploadIcon, { size: 16 })
|
|
92
92
|
}),
|
|
93
93
|
/* @__PURE__ */ jsxs("p", {
|
|
94
|
-
className: "my-2 w-full truncate text-wrap text-sm
|
|
94
|
+
className: "my-2 w-full truncate text-wrap font-medium text-sm",
|
|
95
95
|
children: ["Upload ", maxFiles === 1 ? "a file" : "files"]
|
|
96
96
|
}),
|
|
97
97
|
/* @__PURE__ */ jsx("p", {
|
|
98
|
-
className: "
|
|
98
|
+
className: "w-full truncate text-wrap text-muted-foreground text-xs",
|
|
99
99
|
children: "Drag and drop or click to upload"
|
|
100
100
|
}),
|
|
101
101
|
caption && /* @__PURE__ */ jsxs("p", {
|
|
102
|
-
className: "text-muted-foreground text-
|
|
102
|
+
className: "text-wrap text-muted-foreground text-xs",
|
|
103
103
|
children: [caption, "."]
|
|
104
104
|
})
|
|
105
105
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { UploadIcon } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport type { DropEvent, DropzoneOptions, FileRejection } from \"react-dropzone\";\nimport { useDropzone } from \"react-dropzone\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { renderBytes } from \"@/modules/storage/lib/helpers\";\nimport { DropzoneContext, useDropzoneContext } from \"./dropzone-context.client\";\n\n/**\n * Dropzone\n */\nexport type DropzoneProps = Omit<DropzoneOptions, \"onDrop\"> & {\n src?: File[];\n className?: string;\n onDrop?: (acceptedFiles: File[], fileRejections: FileRejection[], event: DropEvent) => void;\n children?: ReactNode;\n};\n\nexport function Dropzone({\n accept,\n maxFiles = 1,\n maxSize,\n minSize,\n onDrop,\n onError,\n disabled,\n src,\n className,\n children,\n ...props\n}: DropzoneProps) {\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n accept,\n maxFiles,\n maxSize,\n minSize,\n onError,\n disabled,\n onDrop: (acceptedFiles, fileRejections, event) => {\n if (fileRejections.length > 0) {\n const message = fileRejections.at(0)?.errors.at(0)?.message;\n onError?.(new Error(message));\n return;\n }\n onDrop?.(acceptedFiles, fileRejections, event);\n },\n ...props,\n });\n\n return (\n <DropzoneContext key={JSON.stringify(src)} value={{ src, accept, maxSize, minSize, maxFiles }}>\n <Button\n className={cn(\n \"relative h-auto w-full flex-col overflow-hidden p-8\",\n isDragActive && \"
|
|
1
|
+
{"version":3,"file":"dropzone.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { UploadIcon } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport type { DropEvent, DropzoneOptions, FileRejection } from \"react-dropzone\";\nimport { useDropzone } from \"react-dropzone\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { renderBytes } from \"@/modules/storage/lib/helpers\";\nimport { DropzoneContext, useDropzoneContext } from \"./dropzone-context.client\";\n\n/**\n * Dropzone\n */\nexport type DropzoneProps = Omit<DropzoneOptions, \"onDrop\"> & {\n src?: File[];\n className?: string;\n onDrop?: (acceptedFiles: File[], fileRejections: FileRejection[], event: DropEvent) => void;\n children?: ReactNode;\n};\n\nexport function Dropzone({\n accept,\n maxFiles = 1,\n maxSize,\n minSize,\n onDrop,\n onError,\n disabled,\n src,\n className,\n children,\n ...props\n}: DropzoneProps) {\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n accept,\n maxFiles,\n maxSize,\n minSize,\n onError,\n disabled,\n onDrop: (acceptedFiles, fileRejections, event) => {\n if (fileRejections.length > 0) {\n const message = fileRejections.at(0)?.errors.at(0)?.message;\n onError?.(new Error(message));\n return;\n }\n onDrop?.(acceptedFiles, fileRejections, event);\n },\n ...props,\n });\n\n return (\n <DropzoneContext key={JSON.stringify(src)} value={{ src, accept, maxSize, minSize, maxFiles }}>\n <Button\n className={cn(\n \"relative h-auto w-full flex-col overflow-hidden p-8\",\n isDragActive && \"outline-none ring-1 ring-ring\",\n className,\n )}\n disabled={disabled}\n type=\"button\"\n variant=\"outline\"\n {...getRootProps()}\n >\n <input {...getInputProps()} disabled={disabled} />\n {children}\n </Button>\n </DropzoneContext>\n );\n}\n\n/**\n * DropzoneContent\n */\nexport type DropzoneContentProps = {\n children?: ReactNode;\n className?: string;\n};\n\nconst maxLabelItems = 3;\n\nexport function DropzoneContent({ children, className }: DropzoneContentProps) {\n const { src } = useDropzoneContext();\n if (!src) return null;\n\n if (children) return children;\n\n return (\n <div className={cn(\"flex flex-col items-center justify-center\", className)}>\n <div className=\"flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground\">\n <UploadIcon size={16} />\n </div>\n\n <p className=\"my-2 w-full truncate font-medium text-sm\">\n {src.length > maxLabelItems\n ? `${new Intl.ListFormat(\"en\").format(\n src.slice(0, maxLabelItems).map((file) => file.name),\n )} and ${src.length - maxLabelItems} more`\n : new Intl.ListFormat(\"en\").format(src.map((file) => file.name))}\n </p>\n\n <p className=\"w-full text-wrap text-muted-foreground text-xs\">\n Drag and drop or click to replace\n </p>\n </div>\n );\n}\n\n/**\n * DropzoneEmptyState\n */\nexport type DropzoneEmptyStateProps = {\n children?: ReactNode;\n className?: string;\n};\n\nexport function DropzoneEmptyState({ children, className }: DropzoneEmptyStateProps) {\n const { src, accept, maxSize, minSize, maxFiles } = useDropzoneContext();\n if (src) {\n return null;\n }\n if (children) {\n return children;\n }\n let caption = \"\";\n if (accept) {\n caption += \"Accepts \";\n caption += new Intl.ListFormat(\"en\").format(Object.keys(accept));\n }\n if (minSize && maxSize) {\n caption += ` between ${renderBytes(minSize)} and ${renderBytes(maxSize)}`;\n } else if (minSize) {\n caption += ` at least ${renderBytes(minSize)}`;\n } else if (maxSize) {\n caption += ` less than ${renderBytes(maxSize)}`;\n }\n return (\n <div className={cn(\"flex flex-col items-center justify-center\", className)}>\n <div className=\"flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground\">\n <UploadIcon size={16} />\n </div>\n <p className=\"my-2 w-full truncate text-wrap font-medium text-sm\">\n Upload {maxFiles === 1 ? \"a file\" : \"files\"}\n </p>\n <p className=\"w-full truncate text-wrap text-muted-foreground text-xs\">\n Drag and drop or click to upload\n </p>\n {caption && <p className=\"text-wrap text-muted-foreground text-xs\">{caption}.</p>}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAqBA,SAAgB,SAAS,EACvB,QACA,WAAW,GACX,SACA,SACA,QACA,SACA,UACA,KACA,WACA,UACA,GAAG,SACa;CAChB,MAAM,EAAE,cAAc,eAAe,iBAAiB,YAAY;EAChE;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,eAAe,gBAAgB,UAAU;AAChD,OAAI,eAAe,SAAS,GAAG;IAC7B,MAAM,UAAU,eAAe,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE;AACpD,cAAU,IAAI,MAAM,QAAQ,CAAC;AAC7B;;AAEF,YAAS,eAAe,gBAAgB,MAAM;;EAEhD,GAAG;EACJ,CAAC;AAEF,QACE,oBAAC;EAA0C,OAAO;GAAE;GAAK;GAAQ;GAAS;GAAS;GAAU;YAC3F,qBAAC;GACC,WAAW,GACT,uDACA,gBAAgB,iCAChB,UACD;GACS;GACV,MAAK;GACL,SAAQ;GACR,GAAI,cAAc;cAElB,oBAAC;IAAM,GAAI,eAAe;IAAY;KAAY,EACjD;IACM;IAdW,KAAK,UAAU,IAAI,CAevB;;AAYtB,MAAM,gBAAgB;AAEtB,SAAgB,gBAAgB,EAAE,UAAU,aAAmC;CAC7E,MAAM,EAAE,QAAQ,oBAAoB;AACpC,KAAI,CAAC,IAAK,QAAO;AAEjB,KAAI,SAAU,QAAO;AAErB,QACE,qBAAC;EAAI,WAAW,GAAG,6CAA6C,UAAU;;GACxE,oBAAC;IAAI,WAAU;cACb,oBAAC,cAAW,MAAM,KAAM;KACpB;GAEN,oBAAC;IAAE,WAAU;cACV,IAAI,SAAS,gBACV,GAAG,IAAI,KAAK,WAAW,KAAK,CAAC,OAC3B,IAAI,MAAM,GAAG,cAAc,CAAC,KAAK,SAAS,KAAK,KAAK,CACrD,CAAC,OAAO,IAAI,SAAS,cAAc,SACpC,IAAI,KAAK,WAAW,KAAK,CAAC,OAAO,IAAI,KAAK,SAAS,KAAK,KAAK,CAAC;KAChE;GAEJ,oBAAC;IAAE,WAAU;cAAiD;KAE1D;;GACA;;AAYV,SAAgB,mBAAmB,EAAE,UAAU,aAAsC;CACnF,MAAM,EAAE,KAAK,QAAQ,SAAS,SAAS,aAAa,oBAAoB;AACxE,KAAI,IACF,QAAO;AAET,KAAI,SACF,QAAO;CAET,IAAI,UAAU;AACd,KAAI,QAAQ;AACV,aAAW;AACX,aAAW,IAAI,KAAK,WAAW,KAAK,CAAC,OAAO,OAAO,KAAK,OAAO,CAAC;;AAElE,KAAI,WAAW,QACb,YAAW,YAAY,YAAY,QAAQ,CAAC,OAAO,YAAY,QAAQ;UAC9D,QACT,YAAW,aAAa,YAAY,QAAQ;UACnC,QACT,YAAW,cAAc,YAAY,QAAQ;AAE/C,QACE,qBAAC;EAAI,WAAW,GAAG,6CAA6C,UAAU;;GACxE,oBAAC;IAAI,WAAU;cACb,oBAAC,cAAW,MAAM,KAAM;KACpB;GACN,qBAAC;IAAE,WAAU;eAAqD,WACxD,aAAa,IAAI,WAAW;KAClC;GACJ,oBAAC;IAAE,WAAU;cAA0D;KAEnE;GACH,WAAW,qBAAC;IAAE,WAAU;eAA2C,SAAQ;KAAK;;GAC7E"}
|
|
@@ -6,9 +6,9 @@ import { Button } from "../../../components/ui/button.mjs";
|
|
|
6
6
|
import { getFileUrl, imageLoader } from "../lib/helpers.mjs";
|
|
7
7
|
import { Skeleton } from "../../../components/ui/skeleton.mjs";
|
|
8
8
|
import { Input } from "../../../components/ui/input.mjs";
|
|
9
|
+
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "../../../components/ui/carousel.client.mjs";
|
|
9
10
|
import { Dialog, DialogContent, DialogTrigger } from "../../../components/ui/dialog.client.mjs";
|
|
10
11
|
import { Card } from "../../../components/ui/card.mjs";
|
|
11
|
-
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "../../../components/ui/carousel.mjs";
|
|
12
12
|
import { useAction } from "../../../lib/hooks/use-action.mjs";
|
|
13
13
|
import { useUploadZone } from "./upload-zone-context.client.mjs";
|
|
14
14
|
import { GripIcon, UploadIcon } from "lucide-react";
|
|
@@ -72,7 +72,7 @@ function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }) {
|
|
|
72
72
|
setCurrent
|
|
73
73
|
}, node.id)), !disabled && /* @__PURE__ */ jsxs("label", {
|
|
74
74
|
htmlFor: "file-upload",
|
|
75
|
-
className: "
|
|
75
|
+
className: "relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-muted-foreground border-dashed bg-muted hover:border-primary",
|
|
76
76
|
children: [/* @__PURE__ */ jsx(UploadIcon, { className: "h-8 w-8" }), /* @__PURE__ */ jsx(Input, {
|
|
77
77
|
id: "file-upload",
|
|
78
78
|
type: "file",
|
|
@@ -133,7 +133,7 @@ function ImageGridItem({ node, index, setCurrent }) {
|
|
|
133
133
|
alt: "Image Preview",
|
|
134
134
|
width: 100,
|
|
135
135
|
height: 100,
|
|
136
|
-
className: "
|
|
136
|
+
className: "absolute inset-0 h-full w-full cursor-pointer rounded-lg bg-muted object-contain",
|
|
137
137
|
loader: imageLoader
|
|
138
138
|
})
|
|
139
139
|
}),
|
|
@@ -143,7 +143,7 @@ function ImageGridItem({ node, index, setCurrent }) {
|
|
|
143
143
|
type: "button",
|
|
144
144
|
variant: "secondary",
|
|
145
145
|
size: "icon",
|
|
146
|
-
className: "absolute
|
|
146
|
+
className: "absolute top-2 right-2 hidden p-1 group-hover:flex",
|
|
147
147
|
children: /* @__PURE__ */ jsx(GripIcon, { className: "size-4" })
|
|
148
148
|
}),
|
|
149
149
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -151,7 +151,7 @@ function ImageGridItem({ node, index, setCurrent }) {
|
|
|
151
151
|
variant: "destructive",
|
|
152
152
|
size: "icon",
|
|
153
153
|
onClick: () => uploadZone.onRemove([node.id]),
|
|
154
|
-
className: "absolute
|
|
154
|
+
className: "absolute top-2 left-2 hidden p-1 group-hover:flex",
|
|
155
155
|
children: /* @__PURE__ */ jsx(Icons.trash, { className: "size-4" })
|
|
156
156
|
})
|
|
157
157
|
] }) : /* @__PURE__ */ jsx(Skeleton, { className: "absolute inset-0 h-full w-full rounded-lg" })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-grid.client.mjs","names":["Image"],"sources":["../../../../src/modules/storage/components/image-grid.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useDroppable,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport {\n rectSortingStrategy,\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { GripIcon, UploadIcon } from \"lucide-react\";\nimport Image from \"next/image\";\nimport React, { type ComponentProps } from \"react\";\nimport { Icons } from \"@/components/common/icons\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card } from \"@/components/ui/card\";\nimport {\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselNext,\n CarouselPrevious,\n} from \"@/components/ui/carousel\";\nimport { Dialog, DialogContent, DialogTrigger } from \"@/components/ui/dialog.client\";\nimport { Input } from \"@/components/ui/input\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { useAction } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { getFileUrl, imageLoader } from \"../lib/helpers\";\nimport type { FileNode } from \"../lib/validators\";\nimport { useUploadZone } from \"./upload-zone-context.client\";\n\n/**\n * Image Grid\n */\ntype ImageGridProps = ComponentProps<\"div\"> & {\n nodes: FileNode[];\n disabled?: boolean;\n moveAction: (params: { fromIndex: number; toIndex: number }) => Promise<void>;\n optimistic?: {\n move?: (params: { fromIndex: number; toIndex: number }) => Promise<void> | void;\n };\n};\n\nexport function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }: ImageGridProps) {\n const uploadZone = useUploadZone();\n\n const images = nodes.flatMap((node) => ({ ...node, url: getFileUrl(node.id) }));\n\n const [current, setCurrent] = React.useState<number>(0);\n\n const { setNodeRef } = useDroppable({ id: \"image-grid\" });\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n const moveMuration = useAction({\n mutationFn: async ({ active, over }: DragEndEvent) => {\n if (!moveAction) return Promise.resolve();\n\n const activeId = active.id;\n const overId = over?.id;\n if (!activeId || !overId || activeId === overId) return Promise.resolve();\n\n const fromIndex = images.findIndex((image) => image.id === activeId);\n const toIndex = images.findIndex((image) => image.id === overId);\n\n await optimistic?.move?.({ fromIndex, toIndex });\n await moveAction({ fromIndex, toIndex });\n },\n onSuccess: async () => {\n setCurrent(0);\n await uploadZone.optimistic?.invalidate?.();\n },\n onError: (error) => {\n console.error(\"Error moving image:\", error);\n },\n });\n\n return (\n <Dialog {...props}>\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={moveMuration.mutate}\n >\n <div\n ref={setNodeRef}\n className=\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\"\n >\n <SortableContext items={images.map((image) => image.id)} strategy={rectSortingStrategy}>\n {images.map((node, index) => (\n <ImageGridItem key={node.id} node={node} index={index} setCurrent={setCurrent} />\n ))}\n\n {!disabled && (\n <label\n htmlFor=\"file-upload\"\n className=\"border-muted-foreground bg-muted hover:border-primary relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-dashed\"\n >\n <UploadIcon className=\"h-8 w-8\" />\n <Input\n id=\"file-upload\"\n type=\"file\"\n accept=\"image/jpeg, image/png, image/webp, image/gif\"\n className=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n multiple\n onChange={(e) => {\n if (!e.target.files) return;\n return Array.from(e.target.files).map(uploadZone.onUpload);\n }}\n />\n </label>\n )}\n </SortableContext>\n </div>\n </DndContext>\n\n <Carousel className=\"w-full\" opts={{ startIndex: current }}>\n <DialogContent className=\"border-none bg-transparent p-0 shadow-none md:max-w-[80vw] xl:max-w-[60vw]\">\n <CarouselContent className=\"md:max-h-[80vh]\">\n {images.map(({ id, url }) => (\n <CarouselItem key={id} className=\"overflow-hidden rounded-xl\">\n <Image\n src={url}\n alt=\"Image Preview\"\n width={1920}\n height={1080}\n className=\"h-full w-full rounded-xl object-contain\"\n loader={imageLoader}\n />\n </CarouselItem>\n ))}\n </CarouselContent>\n <CarouselPrevious />\n <CarouselNext />\n </DialogContent>\n </Carousel>\n </Dialog>\n );\n}\n\n/**\n * Image Grid Item\n */\ntype ImageGridItemProps = {\n node: FileNode & { url: string };\n index: number;\n setCurrent: React.Dispatch<React.SetStateAction<number>>;\n};\n\nfunction ImageGridItem({ node, index, setCurrent }: ImageGridItemProps) {\n const uploadZone = useUploadZone();\n\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: node.id });\n\n return (\n <Card\n id={node.id}\n ref={setNodeRef}\n style={{\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n className={cn(\"group relative aspect-square w-full\", node.isPending && \"opacity-30\")}\n >\n {!node.isPending ? (\n <>\n <DialogTrigger onClick={() => setCurrent(index)}>\n <Image\n src={node.url}\n alt=\"Image Preview\"\n width={100}\n height={100}\n className=\"bg-muted absolute inset-0 h-full w-full cursor-pointer rounded-lg object-contain\"\n loader={imageLoader}\n />\n </DialogTrigger>\n\n <Button\n {...attributes}\n {...listeners}\n type=\"button\"\n variant=\"secondary\"\n size=\"icon\"\n className=\"absolute right-2 top-2 hidden p-1 group-hover:flex\"\n >\n <GripIcon className=\"size-4\" />\n </Button>\n\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"icon\"\n onClick={() => uploadZone.onRemove([node.id])}\n className=\"absolute left-2 top-2 hidden p-1 group-hover:flex\"\n >\n <Icons.trash className=\"size-4\" />\n </Button>\n </>\n ) : (\n <Skeleton className=\"absolute inset-0 h-full w-full rounded-lg\" />\n )}\n </Card>\n );\n}\n\nexport function ImageGridSkeleton(props: ComponentProps<\"div\">) {\n return (\n <div\n {...props}\n className={cn(\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\", props.className)}\n >\n {Array.from({ length: 12 }).map((_, index) => (\n <Skeleton key={index} className=\"aspect-square w-full rounded-lg\" />\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqDA,SAAgB,UAAU,EAAE,OAAO,YAAY,YAAY,UAAU,GAAG,SAAyB;CAC/F,MAAM,aAAa,eAAe;CAElC,MAAM,SAAS,MAAM,SAAS,UAAU;EAAE,GAAG;EAAM,KAAK,WAAW,KAAK,GAAG;EAAE,EAAE;CAE/E,MAAM,CAAC,SAAS,cAAc,MAAM,SAAiB,EAAE;CAEvD,MAAM,EAAE,eAAe,aAAa,EAAE,IAAI,cAAc,CAAC;CACzD,MAAM,UAAU,WACd,UAAU,cAAc,EACxB,UAAU,gBAAgB,EACxB,kBAAkB,6BACnB,CAAC,CACH;CAED,MAAM,eAAe,UAAU;EAC7B,YAAY,OAAO,EAAE,QAAQ,WAAyB;AACpD,OAAI,CAAC,WAAY,QAAO,QAAQ,SAAS;GAEzC,MAAM,WAAW,OAAO;GACxB,MAAM,SAAS,MAAM;AACrB,OAAI,CAAC,YAAY,CAAC,UAAU,aAAa,OAAQ,QAAO,QAAQ,SAAS;GAEzE,MAAM,YAAY,OAAO,WAAW,UAAU,MAAM,OAAO,SAAS;GACpE,MAAM,UAAU,OAAO,WAAW,UAAU,MAAM,OAAO,OAAO;AAEhE,SAAM,YAAY,OAAO;IAAE;IAAW;IAAS,CAAC;AAChD,SAAM,WAAW;IAAE;IAAW;IAAS,CAAC;;EAE1C,WAAW,YAAY;AACrB,cAAW,EAAE;AACb,SAAM,WAAW,YAAY,cAAc;;EAE7C,UAAU,UAAU;AAClB,WAAQ,MAAM,uBAAuB,MAAM;;EAE9C,CAAC;AAEF,QACE,qBAAC;EAAO,GAAI;aACV,oBAAC;GACU;GACT,oBAAoB;GACpB,WAAW,aAAa;aAExB,oBAAC;IACC,KAAK;IACL,WAAU;cAEV,qBAAC;KAAgB,OAAO,OAAO,KAAK,UAAU,MAAM,GAAG;KAAE,UAAU;gBAChE,OAAO,KAAK,MAAM,UACjB,oBAAC;MAAkC;MAAa;MAAmB;QAA/C,KAAK,GAAwD,CACjF,EAED,CAAC,YACA,qBAAC;MACC,SAAQ;MACR,WAAU;iBAEV,oBAAC,cAAW,WAAU,YAAY,EAClC,oBAAC;OACC,IAAG;OACH,MAAK;OACL,QAAO;OACP,WAAU;OACV;OACA,WAAW,MAAM;AACf,YAAI,CAAC,EAAE,OAAO,MAAO;AACrB,eAAO,MAAM,KAAK,EAAE,OAAO,MAAM,CAAC,IAAI,WAAW,SAAS;;QAE5D;OACI;MAEM;KACd;IACK,EAEb,oBAAC;GAAS,WAAU;GAAS,MAAM,EAAE,YAAY,SAAS;aACxD,qBAAC;IAAc,WAAU;;KACvB,oBAAC;MAAgB,WAAU;gBACxB,OAAO,KAAK,EAAE,IAAI,UACjB,oBAAC;OAAsB,WAAU;iBAC/B,oBAACA;QACC,KAAK;QACL,KAAI;QACJ,OAAO;QACP,QAAQ;QACR,WAAU;QACV,QAAQ;SACR;SARe,GASJ,CACf;OACc;KAClB,oBAAC,qBAAmB;KACpB,oBAAC,iBAAe;;KACF;IACP;GACJ;;AAab,SAAS,cAAc,EAAE,MAAM,OAAO,cAAkC;CACtE,MAAM,aAAa,eAAe;CAElC,MAAM,EAAE,YAAY,WAAW,YAAY,WAAW,eAAe,YAAY,EAAE,IAAI,KAAK,IAAI,CAAC;AAEjG,QACE,oBAAC;EACC,IAAI,KAAK;EACT,KAAK;EACL,OAAO;GACL,WAAW,IAAI,UAAU,SAAS,UAAU;GAC5C;GACD;EACD,WAAW,GAAG,uCAAuC,KAAK,aAAa,aAAa;YAEnF,CAAC,KAAK,YACL;GACE,oBAAC;IAAc,eAAe,WAAW,MAAM;cAC7C,oBAACA;KACC,KAAK,KAAK;KACV,KAAI;KACJ,OAAO;KACP,QAAQ;KACR,WAAU;KACV,QAAQ;MACR;KACY;GAEhB,oBAAC;IACC,GAAI;IACJ,GAAI;IACJ,MAAK;IACL,SAAQ;IACR,MAAK;IACL,WAAU;cAEV,oBAAC,YAAS,WAAU,WAAW;KACxB;GAET,oBAAC;IACC,MAAK;IACL,SAAQ;IACR,MAAK;IACL,eAAe,WAAW,SAAS,CAAC,KAAK,GAAG,CAAC;IAC7C,WAAU;cAEV,oBAAC,MAAM,SAAM,WAAU,WAAW;KAC3B;MACR,GAEH,oBAAC,YAAS,WAAU,8CAA8C;GAE/D;;AAIX,SAAgB,kBAAkB,OAA8B;AAC9D,QACE,oBAAC;EACC,GAAI;EACJ,WAAW,GAAG,8DAA8D,MAAM,UAAU;YAE3F,MAAM,KAAK,EAAE,QAAQ,IAAI,CAAC,CAAC,KAAK,GAAG,UAClC,oBAAC,YAAqB,WAAU,qCAAjB,MAAqD,CACpE;GACE"}
|
|
1
|
+
{"version":3,"file":"image-grid.client.mjs","names":["Image"],"sources":["../../../../src/modules/storage/components/image-grid.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useDroppable,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport {\n rectSortingStrategy,\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { GripIcon, UploadIcon } from \"lucide-react\";\nimport Image from \"next/image\";\nimport React, { type ComponentProps } from \"react\";\nimport { Icons } from \"@/components/common/icons\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card } from \"@/components/ui/card\";\nimport {\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselNext,\n CarouselPrevious,\n} from \"@/components/ui/carousel.client\";\nimport { Dialog, DialogContent, DialogTrigger } from \"@/components/ui/dialog.client\";\nimport { Input } from \"@/components/ui/input\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { useAction } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { getFileUrl, imageLoader } from \"../lib/helpers\";\nimport type { FileNode } from \"../lib/validators\";\nimport { useUploadZone } from \"./upload-zone-context.client\";\n\n/**\n * Image Grid\n */\ntype ImageGridProps = ComponentProps<\"div\"> & {\n nodes: FileNode[];\n disabled?: boolean;\n moveAction: (params: { fromIndex: number; toIndex: number }) => Promise<void>;\n optimistic?: {\n move?: (params: { fromIndex: number; toIndex: number }) => Promise<void> | void;\n };\n};\n\nexport function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }: ImageGridProps) {\n const uploadZone = useUploadZone();\n\n const images = nodes.flatMap((node) => ({ ...node, url: getFileUrl(node.id) }));\n\n const [current, setCurrent] = React.useState<number>(0);\n\n const { setNodeRef } = useDroppable({ id: \"image-grid\" });\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n const moveMuration = useAction({\n mutationFn: async ({ active, over }: DragEndEvent) => {\n if (!moveAction) return Promise.resolve();\n\n const activeId = active.id;\n const overId = over?.id;\n if (!activeId || !overId || activeId === overId) return Promise.resolve();\n\n const fromIndex = images.findIndex((image) => image.id === activeId);\n const toIndex = images.findIndex((image) => image.id === overId);\n\n await optimistic?.move?.({ fromIndex, toIndex });\n await moveAction({ fromIndex, toIndex });\n },\n onSuccess: async () => {\n setCurrent(0);\n await uploadZone.optimistic?.invalidate?.();\n },\n onError: (error) => {\n console.error(\"Error moving image:\", error);\n },\n });\n\n return (\n <Dialog {...props}>\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={moveMuration.mutate}\n >\n <div\n ref={setNodeRef}\n className=\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\"\n >\n <SortableContext items={images.map((image) => image.id)} strategy={rectSortingStrategy}>\n {images.map((node, index) => (\n <ImageGridItem key={node.id} node={node} index={index} setCurrent={setCurrent} />\n ))}\n\n {!disabled && (\n <label\n htmlFor=\"file-upload\"\n className=\"relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-muted-foreground border-dashed bg-muted hover:border-primary\"\n >\n <UploadIcon className=\"h-8 w-8\" />\n <Input\n id=\"file-upload\"\n type=\"file\"\n accept=\"image/jpeg, image/png, image/webp, image/gif\"\n className=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n multiple\n onChange={(e) => {\n if (!e.target.files) return;\n return Array.from(e.target.files).map(uploadZone.onUpload);\n }}\n />\n </label>\n )}\n </SortableContext>\n </div>\n </DndContext>\n\n <Carousel className=\"w-full\" opts={{ startIndex: current }}>\n <DialogContent className=\"border-none bg-transparent p-0 shadow-none md:max-w-[80vw] xl:max-w-[60vw]\">\n <CarouselContent className=\"md:max-h-[80vh]\">\n {images.map(({ id, url }) => (\n <CarouselItem key={id} className=\"overflow-hidden rounded-xl\">\n <Image\n src={url}\n alt=\"Image Preview\"\n width={1920}\n height={1080}\n className=\"h-full w-full rounded-xl object-contain\"\n loader={imageLoader}\n />\n </CarouselItem>\n ))}\n </CarouselContent>\n <CarouselPrevious />\n <CarouselNext />\n </DialogContent>\n </Carousel>\n </Dialog>\n );\n}\n\n/**\n * Image Grid Item\n */\ntype ImageGridItemProps = {\n node: FileNode & { url: string };\n index: number;\n setCurrent: React.Dispatch<React.SetStateAction<number>>;\n};\n\nfunction ImageGridItem({ node, index, setCurrent }: ImageGridItemProps) {\n const uploadZone = useUploadZone();\n\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: node.id });\n\n return (\n <Card\n id={node.id}\n ref={setNodeRef}\n style={{\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n className={cn(\"group relative aspect-square w-full\", node.isPending && \"opacity-30\")}\n >\n {!node.isPending ? (\n <>\n <DialogTrigger onClick={() => setCurrent(index)}>\n <Image\n src={node.url}\n alt=\"Image Preview\"\n width={100}\n height={100}\n className=\"absolute inset-0 h-full w-full cursor-pointer rounded-lg bg-muted object-contain\"\n loader={imageLoader}\n />\n </DialogTrigger>\n\n <Button\n {...attributes}\n {...listeners}\n type=\"button\"\n variant=\"secondary\"\n size=\"icon\"\n className=\"absolute top-2 right-2 hidden p-1 group-hover:flex\"\n >\n <GripIcon className=\"size-4\" />\n </Button>\n\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"icon\"\n onClick={() => uploadZone.onRemove([node.id])}\n className=\"absolute top-2 left-2 hidden p-1 group-hover:flex\"\n >\n <Icons.trash className=\"size-4\" />\n </Button>\n </>\n ) : (\n <Skeleton className=\"absolute inset-0 h-full w-full rounded-lg\" />\n )}\n </Card>\n );\n}\n\nexport function ImageGridSkeleton(props: ComponentProps<\"div\">) {\n return (\n <div\n {...props}\n className={cn(\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\", props.className)}\n >\n {Array.from({ length: 12 }).map((_, index) => (\n <Skeleton key={index} className=\"aspect-square w-full rounded-lg\" />\n ))}\n </div>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-zone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"mappings":";;;;;;;AASA;KAAY,sBAAA;EACV,YAAA,EAAc,YAAA;EACd,QAAA,GAAW,IAAA,EAAM,IAAA,KAAS,OAAA,CAAQ,IAAA;EAClC,QAAA,GAAW,GAAA,eAAkB,OAAA;EAC7B,UAAA;IACE,GAAA,IAAO,QAAA,EAAU,QAAA,KAAa,OAAA;IAC9B,MAAA,IAAU,GAAA,eAAkB,OAAA;IAC5B,UAAA,SAAmB,OAAA;IACnB,MAAA,SAAe,OAAA;EAAA;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"upload-zone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"mappings":";;;;;;;AASA;KAAY,sBAAA;EACV,YAAA,EAAc,YAAA;EACd,QAAA,GAAW,IAAA,EAAM,IAAA,KAAS,OAAA,CAAQ,IAAA;EAClC,QAAA,GAAW,GAAA,eAAkB,OAAA;EAC7B,UAAA;IACE,GAAA,IAAO,QAAA,EAAU,QAAA,KAAa,OAAA;IAC9B,MAAA,IAAU,GAAA,eAAkB,OAAA;IAC5B,UAAA,SAAmB,OAAA;IACnB,MAAA,SAAe,OAAA;EAAA;EAEjB,QAAA;AAAA;;;;cAQW,iBAAA,EAAiB,KAAA,CAAA,OAAA,CAAA,sBAAA;;;;iBAKd,aAAA,CAAA,GAAa,sBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-zone-context.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { UploadClient } from \"../lib/create-upload.client\";\nimport type { FileNode, Node } from \"../lib/validators\";\n\n/**\n * Upload Zone Context Value\n */\nexport type UploadZoneContextValue = {\n uploadClient: UploadClient;\n onUpload: (file: File) => Promise<Node>;\n onRemove: (ids: string[]) => Promise<void>;\n optimistic?: {\n add?: (newValue: FileNode) => Promise<void> | void;\n remove?: (ids: string[]) => Promise<void> | void;\n invalidate?: () => Promise<void> | void;\n cancel?: () => Promise<void> | void;\n };\n // updateData: (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => Promise<void>;\n // invalidateQuery: () => Promise<void> | void;\n};\n\n/**\n * Upload Zone Context\n */\nexport const UploadZoneContext = React.createContext({} as UploadZoneContextValue);\n\n/**\n * Upload Zone Hook\n */\nexport function useUploadZone() {\n const context = React.useContext(UploadZoneContext);\n if (!context) {\n throw new Error(\"useUploadZone must be used within an UploadZoneProvider\");\n }\n return context;\n}\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"upload-zone-context.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { UploadClient } from \"../lib/create-upload.client\";\nimport type { FileNode, Node } from \"../lib/validators\";\n\n/**\n * Upload Zone Context Value\n */\nexport type UploadZoneContextValue = {\n uploadClient: UploadClient;\n onUpload: (file: File) => Promise<Node>;\n onRemove: (ids: string[]) => Promise<void>;\n optimistic?: {\n add?: (newValue: FileNode) => Promise<void> | void;\n remove?: (ids: string[]) => Promise<void> | void;\n invalidate?: () => Promise<void> | void;\n cancel?: () => Promise<void> | void;\n };\n disabled?: boolean;\n // updateData: (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => Promise<void>;\n // invalidateQuery: () => Promise<void> | void;\n};\n\n/**\n * Upload Zone Context\n */\nexport const UploadZoneContext = React.createContext({} as UploadZoneContextValue);\n\n/**\n * Upload Zone Hook\n */\nexport function useUploadZone() {\n const context = React.useContext(UploadZoneContext);\n if (!context) {\n throw new Error(\"useUploadZone must be used within an UploadZoneProvider\");\n }\n return context;\n}\n"],"mappings":";;;;;;;;AA2BA,MAAa,oBAAoB,MAAM,cAAc,EAAE,CAA2B;;;;AAKlF,SAAgB,gBAAgB;CAC9B,MAAM,UAAU,MAAM,WAAW,kBAAkB;AACnD,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,0DAA0D;AAE5E,QAAO"}
|