@questpie/admin 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -474
- package/dist/_virtual/rolldown_runtime.mjs +18 -0
- package/dist/augmentation.d.mts +315 -0
- package/dist/augmentation.d.mts.map +1 -0
- package/dist/client/blocks/block-registry.d.mts +199 -0
- package/dist/client/blocks/block-registry.d.mts.map +1 -0
- package/dist/client/blocks/block-registry.mjs +88 -0
- package/dist/client/blocks/block-registry.mjs.map +1 -0
- package/dist/client/blocks/block-renderer.d.mts +52 -0
- package/dist/client/blocks/block-renderer.d.mts.map +1 -0
- package/dist/client/blocks/block-renderer.mjs +71 -0
- package/dist/client/blocks/block-renderer.mjs.map +1 -0
- package/dist/client/blocks/index.d.mts +4 -0
- package/dist/client/blocks/prefetch.d.mts +45 -0
- package/dist/client/blocks/prefetch.d.mts.map +1 -0
- package/dist/client/blocks/prefetch.mjs +26 -0
- package/dist/client/blocks/prefetch.mjs.map +1 -0
- package/dist/client/blocks/types.d.mts +69 -0
- package/dist/client/blocks/types.d.mts.map +1 -0
- package/dist/client/blocks/types.mjs +20 -0
- package/dist/client/blocks/types.mjs.map +1 -0
- package/dist/client/builder/admin-builder.d.mts +112 -0
- package/dist/client/builder/admin-builder.d.mts.map +1 -0
- package/dist/client/builder/admin-builder.mjs +185 -0
- package/dist/client/builder/admin-builder.mjs.map +1 -0
- package/dist/client/builder/admin-types.d.mts +73 -0
- package/dist/client/builder/admin-types.d.mts.map +1 -0
- package/dist/client/builder/admin.d.mts +121 -0
- package/dist/client/builder/admin.d.mts.map +1 -0
- package/dist/client/builder/admin.mjs +160 -0
- package/dist/client/builder/admin.mjs.map +1 -0
- package/dist/client/builder/defaults/components.mjs +20 -0
- package/dist/client/builder/defaults/components.mjs.map +1 -0
- package/dist/client/builder/defaults/core.d.mts +354 -0
- package/dist/client/builder/defaults/core.d.mts.map +1 -0
- package/dist/client/builder/defaults/core.mjs +49 -0
- package/dist/client/builder/defaults/core.mjs.map +1 -0
- package/dist/client/builder/defaults/fields.mjs +328 -0
- package/dist/client/builder/defaults/fields.mjs.map +1 -0
- package/dist/client/builder/defaults/pages.mjs +58 -0
- package/dist/client/builder/defaults/pages.mjs.map +1 -0
- package/dist/client/builder/defaults/starter.d.mts +351 -0
- package/dist/client/builder/defaults/starter.d.mts.map +1 -0
- package/dist/client/builder/defaults/starter.mjs +28 -0
- package/dist/client/builder/defaults/starter.mjs.map +1 -0
- package/dist/client/builder/defaults/views.mjs +27 -0
- package/dist/client/builder/defaults/views.mjs.map +1 -0
- package/dist/client/builder/defaults/widgets.mjs +31 -0
- package/dist/client/builder/defaults/widgets.mjs.map +1 -0
- package/dist/client/builder/field/field.d.mts +229 -0
- package/dist/client/builder/field/field.d.mts.map +1 -0
- package/dist/client/builder/field/field.mjs +83 -0
- package/dist/client/builder/field/field.mjs.map +1 -0
- package/dist/client/builder/index.d.mts +36 -0
- package/dist/client/builder/index.d.mts.map +1 -0
- package/dist/client/builder/page/page.d.mts +36 -0
- package/dist/client/builder/page/page.d.mts.map +1 -0
- package/dist/client/builder/page/page.mjs +27 -0
- package/dist/client/builder/page/page.mjs.map +1 -0
- package/dist/client/builder/proxies.d.mts +2 -0
- package/dist/client/builder/proxies.mjs +24 -0
- package/dist/client/builder/proxies.mjs.map +1 -0
- package/dist/client/builder/qa.d.mts +50 -0
- package/dist/client/builder/qa.d.mts.map +1 -0
- package/dist/client/builder/qa.mjs +42 -0
- package/dist/client/builder/qa.mjs.map +1 -0
- package/dist/client/builder/registry.d.mts +70 -0
- package/dist/client/builder/registry.d.mts.map +1 -0
- package/dist/client/builder/types/action-registry.d.mts +2 -0
- package/dist/client/builder/types/action-registry.mjs +142 -0
- package/dist/client/builder/types/action-registry.mjs.map +1 -0
- package/dist/client/builder/types/action-types.d.mts +253 -0
- package/dist/client/builder/types/action-types.d.mts.map +1 -0
- package/dist/client/builder/types/collection-types.d.mts +199 -0
- package/dist/client/builder/types/collection-types.d.mts.map +1 -0
- package/dist/client/builder/types/collection-types.mjs +11 -0
- package/dist/client/builder/types/collection-types.mjs.map +1 -0
- package/dist/client/builder/types/common.d.mts +60 -0
- package/dist/client/builder/types/common.d.mts.map +1 -0
- package/dist/client/builder/types/field-types.d.mts +593 -0
- package/dist/client/builder/types/field-types.d.mts.map +1 -0
- package/dist/client/builder/types/field-types.mjs +19 -0
- package/dist/client/builder/types/field-types.mjs.map +1 -0
- package/dist/client/builder/types/global-types.d.mts +22 -0
- package/dist/client/builder/types/global-types.d.mts.map +1 -0
- package/dist/client/builder/types/ui-config.d.mts +160 -0
- package/dist/client/builder/types/ui-config.d.mts.map +1 -0
- package/dist/client/builder/types/views.d.mts +89 -0
- package/dist/client/builder/types/views.d.mts.map +1 -0
- package/dist/client/builder/types/widget-types.d.mts +563 -0
- package/dist/client/builder/types/widget-types.d.mts.map +1 -0
- package/dist/client/builder/validation.d.mts +3 -0
- package/dist/client/builder/validation.mjs +208 -0
- package/dist/client/builder/validation.mjs.map +1 -0
- package/dist/client/builder/view/view.d.mts +129 -0
- package/dist/client/builder/view/view.d.mts.map +1 -0
- package/dist/client/builder/view/view.mjs +109 -0
- package/dist/client/builder/view/view.mjs.map +1 -0
- package/dist/client/builder/widget/widget.d.mts +33 -0
- package/dist/client/builder/widget/widget.d.mts.map +1 -0
- package/dist/client/builder/widget/widget.mjs +26 -0
- package/dist/client/builder/widget/widget.mjs.map +1 -0
- package/dist/client/components/actions/action-button.d.mts +2 -0
- package/dist/client/components/actions/action-button.mjs +135 -0
- package/dist/client/components/actions/action-button.mjs.map +1 -0
- package/dist/client/components/actions/action-dialog.d.mts +2 -0
- package/dist/client/components/actions/action-dialog.mjs +264 -0
- package/dist/client/components/actions/action-dialog.mjs.map +1 -0
- package/dist/client/components/actions/confirmation-dialog.d.mts +2 -0
- package/dist/client/components/actions/confirmation-dialog.mjs +82 -0
- package/dist/client/components/actions/confirmation-dialog.mjs.map +1 -0
- package/dist/client/components/actions/header-actions.d.mts +2 -0
- package/dist/client/components/actions/header-actions.mjs +117 -0
- package/dist/client/components/actions/header-actions.mjs.map +1 -0
- package/dist/client/components/actions/index.d.mts +4 -0
- package/dist/client/components/admin-link.d.mts +67 -0
- package/dist/client/components/admin-link.d.mts.map +1 -0
- package/dist/client/components/admin-link.mjs +92 -0
- package/dist/client/components/admin-link.mjs.map +1 -0
- package/dist/client/components/auth/auth-guard.d.mts +51 -0
- package/dist/client/components/auth/auth-guard.d.mts.map +1 -0
- package/dist/client/components/auth/auth-guard.mjs +60 -0
- package/dist/client/components/auth/auth-guard.mjs.map +1 -0
- package/dist/client/components/auth/auth-loading.d.mts +36 -0
- package/dist/client/components/auth/auth-loading.d.mts.map +1 -0
- package/dist/client/components/auth/auth-loading.mjs +27 -0
- package/dist/client/components/auth/auth-loading.mjs.map +1 -0
- package/dist/client/components/auth/index.d.mts +2 -0
- package/dist/client/components/blocks/block-canvas.mjs +90 -0
- package/dist/client/components/blocks/block-canvas.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-context.mjs +58 -0
- package/dist/client/components/blocks/block-editor-context.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-layout.mjs +82 -0
- package/dist/client/components/blocks/block-editor-layout.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-provider.mjs +155 -0
- package/dist/client/components/blocks/block-editor-provider.mjs.map +1 -0
- package/dist/client/components/blocks/block-fields-renderer.mjs +70 -0
- package/dist/client/components/blocks/block-fields-renderer.mjs.map +1 -0
- package/dist/client/components/blocks/block-insert-button.mjs +72 -0
- package/dist/client/components/blocks/block-insert-button.mjs.map +1 -0
- package/dist/client/components/blocks/block-item-menu.mjs +161 -0
- package/dist/client/components/blocks/block-item-menu.mjs.map +1 -0
- package/dist/client/components/blocks/block-item.mjs +187 -0
- package/dist/client/components/blocks/block-item.mjs.map +1 -0
- package/dist/client/components/blocks/block-library-sidebar.mjs +190 -0
- package/dist/client/components/blocks/block-library-sidebar.mjs.map +1 -0
- package/dist/client/components/blocks/block-tree.mjs +45 -0
- package/dist/client/components/blocks/block-tree.mjs.map +1 -0
- package/dist/client/components/blocks/block-type-icon.mjs +50 -0
- package/dist/client/components/blocks/block-type-icon.mjs.map +1 -0
- package/dist/client/components/blocks/utils/tree-utils.mjs +186 -0
- package/dist/client/components/blocks/utils/tree-utils.mjs.map +1 -0
- package/dist/client/components/component-renderer.d.mts +125 -0
- package/dist/client/components/component-renderer.d.mts.map +1 -0
- package/dist/client/components/component-renderer.mjs +145 -0
- package/dist/client/components/component-renderer.mjs.map +1 -0
- package/dist/client/components/error-boundary.mjs +92 -0
- package/dist/client/components/error-boundary.mjs.map +1 -0
- package/dist/client/components/fields/array-field.d.mts +44 -0
- package/dist/client/components/fields/array-field.d.mts.map +1 -0
- package/dist/client/components/fields/array-field.mjs +231 -0
- package/dist/client/components/fields/array-field.mjs.map +1 -0
- package/dist/client/components/fields/asset-preview-field.d.mts +52 -0
- package/dist/client/components/fields/asset-preview-field.d.mts.map +1 -0
- package/dist/client/components/fields/asset-preview-field.mjs +60 -0
- package/dist/client/components/fields/asset-preview-field.mjs.map +1 -0
- package/dist/client/components/fields/blocks-field/blocks-field.d.mts +41 -0
- package/dist/client/components/fields/blocks-field/blocks-field.d.mts.map +1 -0
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +101 -0
- package/dist/client/components/fields/blocks-field/blocks-field.mjs.map +1 -0
- package/dist/client/components/fields/blocks-field/index.d.mts +1 -0
- package/dist/client/components/fields/boolean-field.d.mts +30 -0
- package/dist/client/components/fields/boolean-field.d.mts.map +1 -0
- package/dist/client/components/fields/boolean-field.mjs +47 -0
- package/dist/client/components/fields/boolean-field.mjs.map +1 -0
- package/dist/client/components/fields/custom-field.d.mts +3 -0
- package/dist/client/components/fields/date-field.d.mts +22 -0
- package/dist/client/components/fields/date-field.d.mts.map +1 -0
- package/dist/client/components/fields/date-field.mjs +42 -0
- package/dist/client/components/fields/date-field.mjs.map +1 -0
- package/dist/client/components/fields/datetime-field.d.mts +23 -0
- package/dist/client/components/fields/datetime-field.d.mts.map +1 -0
- package/dist/client/components/fields/datetime-field.mjs +43 -0
- package/dist/client/components/fields/datetime-field.mjs.map +1 -0
- package/dist/client/components/fields/email-field.d.mts +19 -0
- package/dist/client/components/fields/email-field.d.mts.map +1 -0
- package/dist/client/components/fields/email-field.mjs +38 -0
- package/dist/client/components/fields/email-field.mjs.map +1 -0
- package/dist/client/components/fields/embedded-collection.d.mts +3 -0
- package/dist/client/components/fields/field-types.d.mts +571 -0
- package/dist/client/components/fields/field-types.d.mts.map +1 -0
- package/dist/client/components/fields/field-utils.d.mts +1 -0
- package/dist/client/components/fields/field-utils.mjs +65 -0
- package/dist/client/components/fields/field-utils.mjs.map +1 -0
- package/dist/client/components/fields/field-wrapper.d.mts +3 -0
- package/dist/client/components/fields/field-wrapper.mjs +49 -0
- package/dist/client/components/fields/field-wrapper.mjs.map +1 -0
- package/dist/client/components/fields/index.d.mts +33 -0
- package/dist/client/components/fields/json-field.d.mts +84 -0
- package/dist/client/components/fields/json-field.d.mts.map +1 -0
- package/dist/client/components/fields/json-field.mjs +248 -0
- package/dist/client/components/fields/json-field.mjs.map +1 -0
- package/dist/client/components/fields/locale-badge.d.mts +1 -0
- package/dist/client/components/fields/locale-badge.mjs +17 -0
- package/dist/client/components/fields/locale-badge.mjs.map +1 -0
- package/dist/client/components/fields/number-field.d.mts +23 -0
- package/dist/client/components/fields/number-field.d.mts.map +1 -0
- package/dist/client/components/fields/number-field.mjs +40 -0
- package/dist/client/components/fields/number-field.mjs.map +1 -0
- package/dist/client/components/fields/object-array-field.d.mts +2 -0
- package/dist/client/components/fields/object-array-field.mjs +313 -0
- package/dist/client/components/fields/object-array-field.mjs.map +1 -0
- package/dist/client/components/fields/object-field.d.mts +32 -0
- package/dist/client/components/fields/object-field.d.mts.map +1 -0
- package/dist/client/components/fields/object-field.mjs +128 -0
- package/dist/client/components/fields/object-field.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/cards-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/cards-display.mjs +140 -0
- package/dist/client/components/fields/relation/displays/cards-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/chips-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/chips-display.mjs +100 -0
- package/dist/client/components/fields/relation/displays/chips-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/grid-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/grid-display.mjs +114 -0
- package/dist/client/components/fields/relation/displays/grid-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/index.d.mts +6 -0
- package/dist/client/components/fields/relation/displays/list-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/list-display.mjs +128 -0
- package/dist/client/components/fields/relation/displays/list-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/table-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/table-display.mjs +134 -0
- package/dist/client/components/fields/relation/displays/table-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/types.d.mts +22 -0
- package/dist/client/components/fields/relation/displays/types.d.mts.map +1 -0
- package/dist/client/components/fields/relation/displays/types.mjs +73 -0
- package/dist/client/components/fields/relation/displays/types.mjs.map +1 -0
- package/dist/client/components/fields/relation/index.d.mts +3 -0
- package/dist/client/components/fields/relation/relation-items-display.d.mts +5 -0
- package/dist/client/components/fields/relation/relation-items-display.mjs +47 -0
- package/dist/client/components/fields/relation/relation-items-display.mjs.map +1 -0
- package/dist/client/components/fields/relation-field.d.mts +134 -0
- package/dist/client/components/fields/relation-field.d.mts.map +1 -0
- package/dist/client/components/fields/relation-field.mjs +106 -0
- package/dist/client/components/fields/relation-field.mjs.map +1 -0
- package/dist/client/components/fields/relation-picker.d.mts +4 -0
- package/dist/client/components/fields/relation-picker.mjs +301 -0
- package/dist/client/components/fields/relation-picker.mjs.map +1 -0
- package/dist/client/components/fields/relation-select.d.mts +3 -0
- package/dist/client/components/fields/relation-select.mjs +219 -0
- package/dist/client/components/fields/relation-select.mjs.map +1 -0
- package/dist/client/components/fields/reverse-relation-field.d.mts +2 -0
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +56 -0
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +118 -0
- package/dist/client/components/fields/rich-text-editor/extensions.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +196 -0
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +4 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +187 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +86 -0
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +11 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-editor/presets.mjs +124 -0
- package/dist/client/components/fields/rich-text-editor/presets.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +145 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +124 -0
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +280 -0
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/types.d.mts +78 -0
- package/dist/client/components/fields/rich-text-editor/types.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-editor/types.mjs +31 -0
- package/dist/client/components/fields/rich-text-editor/types.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/utils.mjs +51 -0
- package/dist/client/components/fields/rich-text-editor/utils.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/variants.d.mts +2 -0
- package/dist/client/components/fields/rich-text-field.d.mts +14 -0
- package/dist/client/components/fields/rich-text-field.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-field.mjs +26 -0
- package/dist/client/components/fields/rich-text-field.mjs.map +1 -0
- package/dist/client/components/fields/select-field.d.mts +25 -0
- package/dist/client/components/fields/select-field.d.mts.map +1 -0
- package/dist/client/components/fields/select-field.mjs +53 -0
- package/dist/client/components/fields/select-field.mjs.map +1 -0
- package/dist/client/components/fields/status-field.d.mts +2 -0
- package/dist/client/components/fields/text-field.d.mts +22 -0
- package/dist/client/components/fields/text-field.d.mts.map +1 -0
- package/dist/client/components/fields/text-field.mjs +39 -0
- package/dist/client/components/fields/text-field.mjs.map +1 -0
- package/dist/client/components/fields/textarea-field.d.mts +22 -0
- package/dist/client/components/fields/textarea-field.d.mts.map +1 -0
- package/dist/client/components/fields/textarea-field.mjs +39 -0
- package/dist/client/components/fields/textarea-field.mjs.map +1 -0
- package/dist/client/components/fields/time-field.d.mts +20 -0
- package/dist/client/components/fields/time-field.d.mts.map +1 -0
- package/dist/client/components/fields/time-field.mjs +39 -0
- package/dist/client/components/fields/time-field.mjs.map +1 -0
- package/dist/client/components/fields/upload-field.d.mts +97 -0
- package/dist/client/components/fields/upload-field.d.mts.map +1 -0
- package/dist/client/components/fields/upload-field.mjs +497 -0
- package/dist/client/components/fields/upload-field.mjs.map +1 -0
- package/dist/client/components/filter-builder/columns-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/columns-tab.mjs +131 -0
- package/dist/client/components/filter-builder/columns-tab.mjs.map +1 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.d.mts +1 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +157 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs.map +1 -0
- package/dist/client/components/filter-builder/filters-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/filters-tab.mjs +380 -0
- package/dist/client/components/filter-builder/filters-tab.mjs.map +1 -0
- package/dist/client/components/filter-builder/index.d.mts +5 -0
- package/dist/client/components/filter-builder/saved-views-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/saved-views-tab.mjs +125 -0
- package/dist/client/components/filter-builder/saved-views-tab.mjs.map +1 -0
- package/dist/client/components/index.d.mts +80 -0
- package/dist/client/components/locale-switcher.d.mts +2 -0
- package/dist/client/components/locale-switcher.mjs +128 -0
- package/dist/client/components/locale-switcher.mjs.map +1 -0
- package/dist/client/components/media/media-grid.mjs +139 -0
- package/dist/client/components/media/media-grid.mjs.map +1 -0
- package/dist/client/components/media/media-picker-dialog.mjs +255 -0
- package/dist/client/components/media/media-picker-dialog.mjs.map +1 -0
- package/dist/client/components/preview/live-preview-mode.mjs +211 -0
- package/dist/client/components/preview/live-preview-mode.mjs.map +1 -0
- package/dist/client/components/preview/preview-pane.mjs +179 -0
- package/dist/client/components/preview/preview-pane.mjs.map +1 -0
- package/dist/client/components/primitives/asset-preview.mjs +363 -0
- package/dist/client/components/primitives/asset-preview.mjs.map +1 -0
- package/dist/client/components/primitives/checkbox-input.mjs +33 -0
- package/dist/client/components/primitives/checkbox-input.mjs.map +1 -0
- package/dist/client/components/primitives/date-input.mjs +218 -0
- package/dist/client/components/primitives/date-input.mjs.map +1 -0
- package/dist/client/components/primitives/dropzone.mjs +239 -0
- package/dist/client/components/primitives/dropzone.mjs.map +1 -0
- package/dist/client/components/primitives/number-input.mjs +113 -0
- package/dist/client/components/primitives/number-input.mjs.map +1 -0
- package/dist/client/components/primitives/select-multi.mjs +256 -0
- package/dist/client/components/primitives/select-multi.mjs.map +1 -0
- package/dist/client/components/primitives/select-single.mjs +183 -0
- package/dist/client/components/primitives/select-single.mjs.map +1 -0
- package/dist/client/components/primitives/text-input.mjs +40 -0
- package/dist/client/components/primitives/text-input.mjs.map +1 -0
- package/dist/client/components/primitives/textarea-input.mjs +38 -0
- package/dist/client/components/primitives/textarea-input.mjs.map +1 -0
- package/dist/client/components/primitives/time-input.mjs +72 -0
- package/dist/client/components/primitives/time-input.mjs.map +1 -0
- package/dist/client/components/primitives/toggle-input.mjs +31 -0
- package/dist/client/components/primitives/toggle-input.mjs.map +1 -0
- package/dist/client/components/primitives/types.d.mts +14 -0
- package/dist/client/components/primitives/types.d.mts.map +1 -0
- package/dist/client/components/primitives/types.mjs +13 -0
- package/dist/client/components/primitives/types.mjs.map +1 -0
- package/dist/client/components/sheets/index.d.mts +1 -0
- package/dist/client/components/sheets/resource-sheet.d.mts +1 -0
- package/dist/client/components/sheets/resource-sheet.mjs +78 -0
- package/dist/client/components/sheets/resource-sheet.mjs.map +1 -0
- package/dist/client/components/ui/accordion.d.mts +2 -0
- package/dist/client/components/ui/accordion.mjs +50 -0
- package/dist/client/components/ui/accordion.mjs.map +1 -0
- package/dist/client/components/ui/alert.mjs +32 -0
- package/dist/client/components/ui/alert.mjs.map +1 -0
- package/dist/client/components/ui/avatar.d.mts +3 -0
- package/dist/client/components/ui/badge.d.mts +3 -0
- package/dist/client/components/ui/badge.mjs +35 -0
- package/dist/client/components/ui/badge.mjs.map +1 -0
- package/dist/client/components/ui/button.d.mts +3 -0
- package/dist/client/components/ui/button.mjs +49 -0
- package/dist/client/components/ui/button.mjs.map +1 -0
- package/dist/client/components/ui/card.d.mts +2 -0
- package/dist/{card-BKHjBQfw.mjs → client/components/ui/card.mjs} +3 -10
- package/dist/{card-BKHjBQfw.mjs.map → client/components/ui/card.mjs.map} +1 -1
- package/dist/client/components/ui/checkbox.d.mts +2 -0
- package/dist/client/components/ui/checkbox.mjs +27 -0
- package/dist/client/components/ui/checkbox.mjs.map +1 -0
- package/dist/client/components/ui/combobox.d.mts +3 -0
- package/dist/client/components/ui/command.mjs +69 -0
- package/dist/client/components/ui/command.mjs.map +1 -0
- package/dist/client/components/ui/dialog.d.mts +3 -0
- package/dist/client/components/ui/dialog.mjs +83 -0
- package/dist/client/components/ui/dialog.mjs.map +1 -0
- package/dist/client/components/ui/drawer.mjs +75 -0
- package/dist/client/components/ui/drawer.mjs.map +1 -0
- package/dist/client/components/ui/dropdown-menu.d.mts +3 -0
- package/dist/client/components/ui/dropdown-menu.mjs +89 -0
- package/dist/client/components/ui/dropdown-menu.mjs.map +1 -0
- package/dist/client/components/ui/empty-state.mjs +53 -0
- package/dist/client/components/ui/empty-state.mjs.map +1 -0
- package/dist/client/components/ui/field.d.mts +3 -0
- package/dist/client/components/ui/field.mjs +78 -0
- package/dist/client/components/ui/field.mjs.map +1 -0
- package/dist/client/components/ui/input-group.d.mts +4 -0
- package/dist/client/components/ui/input-group.mjs +68 -0
- package/dist/client/components/ui/input-group.mjs.map +1 -0
- package/dist/client/components/ui/input.d.mts +2 -0
- package/dist/client/components/ui/input.mjs +17 -0
- package/dist/client/components/ui/input.mjs.map +1 -0
- package/dist/client/components/ui/kbd.mjs +24 -0
- package/dist/client/components/ui/kbd.mjs.map +1 -0
- package/dist/client/components/ui/label.d.mts +2 -0
- package/dist/client/components/ui/label.mjs +15 -0
- package/dist/client/components/ui/label.mjs.map +1 -0
- package/dist/client/components/ui/popover.d.mts +3 -0
- package/dist/client/components/ui/popover.mjs +49 -0
- package/dist/client/components/ui/popover.mjs.map +1 -0
- package/dist/client/components/ui/responsive-dialog.mjs +102 -0
- package/dist/client/components/ui/responsive-dialog.mjs.map +1 -0
- package/dist/client/components/ui/scroll-area.d.mts +2 -0
- package/dist/client/components/ui/search-input.mjs +74 -0
- package/dist/client/components/ui/search-input.mjs.map +1 -0
- package/dist/client/components/ui/select.d.mts +3 -0
- package/dist/client/components/ui/select.mjs +85 -0
- package/dist/client/components/ui/select.mjs.map +1 -0
- package/dist/client/components/ui/separator.d.mts +2 -0
- package/dist/client/components/ui/separator.mjs +17 -0
- package/dist/client/components/ui/separator.mjs.map +1 -0
- package/dist/client/components/ui/sheet.d.mts +3 -0
- package/dist/client/components/ui/sheet.mjs +78 -0
- package/dist/client/components/ui/sheet.mjs.map +1 -0
- package/dist/client/components/ui/sidebar.d.mts +8 -0
- package/dist/client/components/ui/sidebar.mjs +256 -0
- package/dist/client/components/ui/sidebar.mjs.map +1 -0
- package/dist/client/components/ui/skeleton.d.mts +1 -0
- package/dist/client/components/ui/skeleton.mjs +15 -0
- package/dist/client/components/ui/skeleton.mjs.map +1 -0
- package/dist/client/components/ui/sonner.d.mts +14 -0
- package/dist/client/components/ui/sonner.d.mts.map +1 -0
- package/dist/client/components/ui/sonner.mjs +55 -0
- package/dist/client/components/ui/sonner.mjs.map +1 -0
- package/dist/client/components/ui/spinner.d.mts +1 -0
- package/dist/client/components/ui/spinner.mjs +18 -0
- package/dist/client/components/ui/spinner.mjs.map +1 -0
- package/dist/client/components/ui/switch.d.mts +2 -0
- package/dist/client/components/ui/switch.mjs +23 -0
- package/dist/client/components/ui/switch.mjs.map +1 -0
- package/dist/client/components/ui/table.d.mts +2 -0
- package/dist/client/components/ui/table.mjs +66 -0
- package/dist/client/components/ui/table.mjs.map +1 -0
- package/dist/client/components/ui/tabs.d.mts +3 -0
- package/dist/client/components/ui/tabs.mjs +49 -0
- package/dist/client/components/ui/tabs.mjs.map +1 -0
- package/dist/client/components/ui/textarea.d.mts +2 -0
- package/dist/client/components/ui/textarea.mjs +15 -0
- package/dist/client/components/ui/textarea.mjs.map +1 -0
- package/dist/client/components/ui/toolbar.mjs +54 -0
- package/dist/client/components/ui/toolbar.mjs.map +1 -0
- package/dist/client/components/ui/tooltip.d.mts +2 -0
- package/dist/client/components/ui/tooltip.mjs +45 -0
- package/dist/client/components/ui/tooltip.mjs.map +1 -0
- package/dist/client/components/widgets/chart-widget.d.mts +57 -0
- package/dist/client/components/widgets/chart-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/chart-widget.mjs +282 -0
- package/dist/client/components/widgets/chart-widget.mjs.map +1 -0
- package/dist/client/components/widgets/progress-widget.d.mts +41 -0
- package/dist/client/components/widgets/progress-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/progress-widget.mjs +110 -0
- package/dist/client/components/widgets/progress-widget.mjs.map +1 -0
- package/dist/client/components/widgets/quick-actions-widget.d.mts +29 -0
- package/dist/client/components/widgets/quick-actions-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/quick-actions-widget.mjs +121 -0
- package/dist/client/components/widgets/quick-actions-widget.mjs.map +1 -0
- package/dist/client/components/widgets/recent-items-widget.d.mts +51 -0
- package/dist/client/components/widgets/recent-items-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/recent-items-widget.mjs +101 -0
- package/dist/client/components/widgets/recent-items-widget.mjs.map +1 -0
- package/dist/client/components/widgets/stats-widget.d.mts +55 -0
- package/dist/client/components/widgets/stats-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/stats-widget.mjs +150 -0
- package/dist/client/components/widgets/stats-widget.mjs.map +1 -0
- package/dist/client/components/widgets/table-widget.d.mts +31 -0
- package/dist/client/components/widgets/table-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/table-widget.mjs +139 -0
- package/dist/client/components/widgets/table-widget.mjs.map +1 -0
- package/dist/client/components/widgets/timeline-widget.d.mts +51 -0
- package/dist/client/components/widgets/timeline-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/timeline-widget.mjs +168 -0
- package/dist/client/components/widgets/timeline-widget.mjs.map +1 -0
- package/dist/client/components/widgets/value-widget.d.mts +39 -0
- package/dist/client/components/widgets/value-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/value-widget.mjs +111 -0
- package/dist/client/components/widgets/value-widget.mjs.map +1 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +145 -0
- package/dist/client/components/widgets/widget-skeletons.mjs.map +1 -0
- package/dist/client/context/focus-context.d.mts +88 -0
- package/dist/client/context/focus-context.d.mts.map +1 -0
- package/dist/client/context/focus-context.mjs +178 -0
- package/dist/client/context/focus-context.mjs.map +1 -0
- package/dist/client/contexts/breadcrumb-context.mjs +32 -0
- package/dist/client/contexts/breadcrumb-context.mjs.map +1 -0
- package/dist/client/hooks/typed-hooks.d.mts +84 -0
- package/dist/client/hooks/typed-hooks.d.mts.map +1 -0
- package/dist/client/hooks/typed-hooks.mjs +272 -0
- package/dist/client/hooks/typed-hooks.mjs.map +1 -0
- package/dist/client/hooks/use-action.mjs +201 -0
- package/dist/client/hooks/use-action.mjs.map +1 -0
- package/dist/client/hooks/use-admin-config.mjs +40 -0
- package/dist/client/hooks/use-admin-config.mjs.map +1 -0
- package/dist/client/hooks/use-admin-preferences.mjs +68 -0
- package/dist/client/hooks/use-admin-preferences.mjs.map +1 -0
- package/dist/client/hooks/use-admin-routes.mjs +97 -0
- package/dist/client/hooks/use-admin-routes.mjs.map +1 -0
- package/dist/client/hooks/use-auth.d.mts +98 -0
- package/dist/client/hooks/use-auth.d.mts.map +1 -0
- package/dist/{use-auth-BoLmWtmU.mjs → client/hooks/use-auth.mjs} +3 -3
- package/dist/client/hooks/use-auth.mjs.map +1 -0
- package/dist/client/hooks/use-collection-fields.mjs +32 -0
- package/dist/client/hooks/use-collection-fields.mjs.map +1 -0
- package/dist/client/hooks/use-collection-meta.mjs +121 -0
- package/dist/client/hooks/use-collection-meta.mjs.map +1 -0
- package/dist/client/hooks/use-collection-schema.mjs +67 -0
- package/dist/client/hooks/use-collection-schema.mjs.map +1 -0
- package/dist/client/hooks/use-collection-validation.mjs +74 -0
- package/dist/client/hooks/use-collection-validation.mjs.map +1 -0
- package/dist/client/hooks/use-collection.d.mts +86 -0
- package/dist/client/hooks/use-collection.d.mts.map +1 -0
- package/dist/client/hooks/use-collection.mjs +214 -0
- package/dist/client/hooks/use-collection.mjs.map +1 -0
- package/dist/client/hooks/use-current-user.d.mts +57 -0
- package/dist/client/hooks/use-current-user.d.mts.map +1 -0
- package/dist/client/hooks/use-current-user.mjs +79 -0
- package/dist/client/hooks/use-current-user.mjs.map +1 -0
- package/dist/client/hooks/use-field-hooks.mjs +191 -0
- package/dist/client/hooks/use-field-hooks.mjs.map +1 -0
- package/dist/client/hooks/use-field-options.d.mts +90 -0
- package/dist/client/hooks/use-field-options.d.mts.map +1 -0
- package/dist/client/hooks/use-field-options.mjs +184 -0
- package/dist/client/hooks/use-field-options.mjs.map +1 -0
- package/dist/client/hooks/use-global-fields.mjs +27 -0
- package/dist/client/hooks/use-global-fields.mjs.map +1 -0
- package/dist/client/hooks/use-global-meta.mjs +59 -0
- package/dist/client/hooks/use-global-meta.mjs.map +1 -0
- package/dist/client/hooks/use-global-schema.mjs +33 -0
- package/dist/client/hooks/use-global-schema.mjs.map +1 -0
- package/dist/client/hooks/use-global.d.mts +40 -0
- package/dist/client/hooks/use-global.d.mts.map +1 -0
- package/dist/client/hooks/use-global.mjs +74 -0
- package/dist/client/hooks/use-global.mjs.map +1 -0
- package/dist/client/hooks/use-locks.mjs +245 -0
- package/dist/client/hooks/use-locks.mjs.map +1 -0
- package/dist/client/hooks/use-media-query.d.mts +23 -0
- package/dist/client/hooks/use-media-query.d.mts.map +1 -0
- package/dist/client/hooks/use-media-query.mjs +62 -0
- package/dist/client/hooks/use-media-query.mjs.map +1 -0
- package/dist/client/hooks/use-prefill-params.mjs +47 -0
- package/dist/client/hooks/use-prefill-params.mjs.map +1 -0
- package/dist/client/hooks/use-questpie-query-options.mjs +28 -0
- package/dist/client/hooks/use-questpie-query-options.mjs.map +1 -0
- package/dist/client/hooks/use-reactive-fields.d.mts +75 -0
- package/dist/client/hooks/use-reactive-fields.d.mts.map +1 -0
- package/dist/client/hooks/use-reactive-fields.mjs +164 -0
- package/dist/client/hooks/use-reactive-fields.mjs.map +1 -0
- package/dist/client/hooks/use-realtime-highlight.mjs +96 -0
- package/dist/client/hooks/use-realtime-highlight.mjs.map +1 -0
- package/dist/client/hooks/use-saved-views.mjs +65 -0
- package/dist/client/hooks/use-saved-views.mjs.map +1 -0
- package/dist/client/hooks/use-search.mjs +147 -0
- package/dist/client/hooks/use-search.mjs.map +1 -0
- package/dist/client/hooks/use-server-validation.mjs +199 -0
- package/dist/client/hooks/use-server-validation.mjs.map +1 -0
- package/dist/client/hooks/use-server-widget-data.d.mts +26 -0
- package/dist/client/hooks/use-server-widget-data.d.mts.map +1 -0
- package/dist/client/hooks/use-server-widget-data.mjs +40 -0
- package/dist/client/hooks/use-server-widget-data.mjs.map +1 -0
- package/dist/client/hooks/use-setup-status.d.mts +39 -0
- package/dist/client/hooks/use-setup-status.d.mts.map +1 -0
- package/dist/client/hooks/use-setup-status.mjs +50 -0
- package/dist/client/hooks/use-setup-status.mjs.map +1 -0
- package/dist/client/hooks/use-upload-collection.mjs +32 -0
- package/dist/client/hooks/use-upload-collection.mjs.map +1 -0
- package/dist/client/hooks/use-upload.d.mts +23 -0
- package/dist/client/hooks/use-upload.d.mts.map +1 -0
- package/dist/client/hooks/use-upload.mjs +145 -0
- package/dist/client/hooks/use-upload.mjs.map +1 -0
- package/dist/client/hooks/use-validation-error-map.mjs +53 -0
- package/dist/client/hooks/use-validation-error-map.mjs.map +1 -0
- package/dist/client/hooks/use-view-state.mjs +261 -0
- package/dist/client/hooks/use-view-state.mjs.map +1 -0
- package/dist/client/i18n/hooks.mjs +160 -0
- package/dist/client/i18n/hooks.mjs.map +1 -0
- package/dist/client/i18n/intl-cache.mjs +65 -0
- package/dist/client/i18n/intl-cache.mjs.map +1 -0
- package/dist/client/i18n/messages.mjs +7 -0
- package/dist/client/i18n/messages.mjs.map +1 -0
- package/dist/client/i18n/simple.d.mts +22 -0
- package/dist/client/i18n/simple.d.mts.map +1 -0
- package/dist/client/i18n/simple.mjs +157 -0
- package/dist/client/i18n/simple.mjs.map +1 -0
- package/dist/client/i18n/types.d.mts +110 -0
- package/dist/client/i18n/types.d.mts.map +1 -0
- package/dist/client/lib/utils.d.mts +1 -0
- package/dist/client/lib/utils.mjs +28 -0
- package/dist/client/lib/utils.mjs.map +1 -0
- package/dist/client/preview/block-scope-context.d.mts +74 -0
- package/dist/client/preview/block-scope-context.d.mts.map +1 -0
- package/dist/client/preview/block-scope-context.mjs +93 -0
- package/dist/client/preview/block-scope-context.mjs.map +1 -0
- package/dist/client/preview/index.d.mts +5 -0
- package/dist/client/preview/preview-banner.d.mts +46 -0
- package/dist/client/preview/preview-banner.d.mts.map +1 -0
- package/dist/client/preview/preview-banner.mjs +95 -0
- package/dist/client/preview/preview-banner.mjs.map +1 -0
- package/dist/client/preview/preview-field.d.mts +108 -0
- package/dist/client/preview/preview-field.d.mts.map +1 -0
- package/dist/client/preview/preview-field.mjs +125 -0
- package/dist/client/preview/preview-field.mjs.map +1 -0
- package/dist/client/preview/types.d.mts +115 -0
- package/dist/client/preview/types.d.mts.map +1 -0
- package/dist/client/preview/types.mjs +21 -0
- package/dist/client/preview/types.mjs.map +1 -0
- package/dist/client/preview/use-collection-preview.d.mts +71 -0
- package/dist/client/preview/use-collection-preview.d.mts.map +1 -0
- package/dist/client/preview/use-collection-preview.mjs +114 -0
- package/dist/client/preview/use-collection-preview.mjs.map +1 -0
- package/dist/client/runtime/content-locales-provider.d.mts +1 -0
- package/dist/client/runtime/content-locales-provider.mjs +85 -0
- package/dist/client/runtime/content-locales-provider.mjs.map +1 -0
- package/dist/client/runtime/index.d.mts +7 -0
- package/dist/client/runtime/index.mjs +8 -0
- package/dist/client/runtime/locale-scope.d.mts +2 -0
- package/dist/{runtime-6VZM878K.mjs → client/runtime/locale-scope.mjs} +3 -4
- package/dist/client/runtime/locale-scope.mjs.map +1 -0
- package/dist/client/runtime/provider.d.mts +10107 -0
- package/dist/client/runtime/provider.d.mts.map +1 -0
- package/dist/client/runtime/provider.mjs +229 -0
- package/dist/client/runtime/provider.mjs.map +1 -0
- package/dist/client/runtime/routes.d.mts +49 -0
- package/dist/client/runtime/routes.d.mts.map +1 -0
- package/dist/client/runtime/routes.mjs +107 -0
- package/dist/client/runtime/routes.mjs.map +1 -0
- package/dist/client/runtime/translations-provider.d.mts +2 -0
- package/dist/client/runtime/translations-provider.mjs +181 -0
- package/dist/client/runtime/translations-provider.mjs.map +1 -0
- package/dist/client/scope/index.d.mts +3 -0
- package/dist/client/scope/picker.d.mts +54 -0
- package/dist/client/scope/picker.d.mts.map +1 -0
- package/dist/client/scope/picker.mjs +161 -0
- package/dist/client/scope/picker.mjs.map +1 -0
- package/dist/client/scope/provider.d.mts +104 -0
- package/dist/client/scope/provider.d.mts.map +1 -0
- package/dist/client/scope/provider.mjs +159 -0
- package/dist/client/scope/provider.mjs.map +1 -0
- package/dist/client/scope/types.d.mts +112 -0
- package/dist/client/scope/types.d.mts.map +1 -0
- package/dist/client/styles/index.css +80 -0
- package/dist/client/utils/auto-expand-fields.mjs +65 -0
- package/dist/client/utils/auto-expand-fields.mjs.map +1 -0
- package/dist/client/utils/build-field-definitions-from-schema.mjs +256 -0
- package/dist/client/utils/build-field-definitions-from-schema.mjs.map +1 -0
- package/dist/client/utils/detect-relations.mjs +46 -0
- package/dist/client/utils/detect-relations.mjs.map +1 -0
- package/dist/client/utils/locale-to-flag.d.mts +118 -0
- package/dist/client/utils/locale-to-flag.d.mts.map +1 -0
- package/dist/client/utils/locale-to-flag.mjs +130 -0
- package/dist/client/utils/locale-to-flag.mjs.map +1 -0
- package/dist/client/utils/routes.mjs +196 -0
- package/dist/client/utils/routes.mjs.map +1 -0
- package/dist/client/views/auth/accept-invite-form.d.mts +73 -0
- package/dist/client/views/auth/accept-invite-form.d.mts.map +1 -0
- package/dist/client/views/auth/accept-invite-form.mjs +180 -0
- package/dist/client/views/auth/accept-invite-form.mjs.map +1 -0
- package/dist/client/views/auth/auth-layout.d.mts +44 -0
- package/dist/client/views/auth/auth-layout.d.mts.map +1 -0
- package/dist/client/views/auth/auth-layout.mjs +53 -0
- package/dist/client/views/auth/auth-layout.mjs.map +1 -0
- package/dist/client/views/auth/forgot-password-form.d.mts +59 -0
- package/dist/client/views/auth/forgot-password-form.d.mts.map +1 -0
- package/dist/{forgot-password-page-Bcp-An4Y.mjs → client/views/auth/forgot-password-form.mjs} +22 -89
- package/dist/client/views/auth/forgot-password-form.mjs.map +1 -0
- package/dist/client/views/auth/index.d.mts +7 -0
- package/dist/client/views/auth/invite-form.d.mts +1 -0
- package/dist/client/views/auth/invite-form.mjs +155 -0
- package/dist/client/views/auth/invite-form.mjs.map +1 -0
- package/dist/client/views/auth/login-form.d.mts +76 -0
- package/dist/client/views/auth/login-form.d.mts.map +1 -0
- package/dist/client/views/auth/login-form.mjs +167 -0
- package/dist/client/views/auth/login-form.mjs.map +1 -0
- package/dist/client/views/auth/reset-password-form.d.mts +66 -0
- package/dist/client/views/auth/reset-password-form.d.mts.map +1 -0
- package/dist/client/views/auth/reset-password-form.mjs +188 -0
- package/dist/client/views/auth/reset-password-form.mjs.map +1 -0
- package/dist/client/views/auth/setup-form.d.mts +61 -0
- package/dist/client/views/auth/setup-form.d.mts.map +1 -0
- package/dist/{setup-page-YAP_fzqh.mjs → client/views/auth/setup-form.mjs} +46 -124
- package/dist/client/views/auth/setup-form.mjs.map +1 -0
- package/dist/client/views/collection/auto-form-fields.d.mts +4 -0
- package/dist/client/views/collection/auto-form-fields.mjs +453 -0
- package/dist/client/views/collection/auto-form-fields.mjs.map +1 -0
- package/dist/client/views/collection/bulk-action-toolbar.mjs +291 -0
- package/dist/client/views/collection/bulk-action-toolbar.mjs.map +1 -0
- package/dist/client/views/collection/cells/complex-cells.d.mts +46 -0
- package/dist/client/views/collection/cells/complex-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/complex-cells.mjs +327 -0
- package/dist/client/views/collection/cells/complex-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/index.d.mts +7 -0
- package/dist/client/views/collection/cells/primitive-cells.d.mts +76 -0
- package/dist/client/views/collection/cells/primitive-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/primitive-cells.mjs +165 -0
- package/dist/client/views/collection/cells/primitive-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/relation-cells.d.mts +21 -0
- package/dist/client/views/collection/cells/relation-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/relation-cells.mjs +105 -0
- package/dist/client/views/collection/cells/relation-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.d.mts +1 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +189 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.d.mts +2 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs +78 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/relation-chip.d.mts +1 -0
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +37 -0
- package/dist/client/views/collection/cells/shared/relation-chip.mjs.map +1 -0
- package/dist/client/views/collection/cells/upload-cells.d.mts +25 -0
- package/dist/client/views/collection/cells/upload-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/upload-cells.mjs +20 -0
- package/dist/client/views/collection/cells/upload-cells.mjs.map +1 -0
- package/dist/client/views/collection/columns/build-columns.d.mts +2 -0
- package/dist/client/views/collection/columns/build-columns.mjs +156 -0
- package/dist/client/views/collection/columns/build-columns.mjs.map +1 -0
- package/dist/client/views/collection/columns/column-defaults.d.mts +2 -0
- package/dist/client/views/collection/columns/column-defaults.mjs +108 -0
- package/dist/client/views/collection/columns/column-defaults.mjs.map +1 -0
- package/dist/client/views/collection/columns/index.d.mts +3 -0
- package/dist/client/views/collection/columns/types.d.mts +2 -0
- package/dist/client/views/collection/field-context.mjs +127 -0
- package/dist/client/views/collection/field-context.mjs.map +1 -0
- package/dist/client/views/collection/field-renderer.mjs +171 -0
- package/dist/client/views/collection/field-renderer.mjs.map +1 -0
- package/dist/client/views/collection/form-view.d.mts +112 -0
- package/dist/client/views/collection/form-view.d.mts.map +1 -0
- package/dist/client/views/collection/form-view.mjs +903 -0
- package/dist/client/views/collection/form-view.mjs.map +1 -0
- package/dist/client/views/collection/index.d.mts +9 -0
- package/dist/client/views/collection/table-view.d.mts +102 -0
- package/dist/client/views/collection/table-view.d.mts.map +1 -0
- package/dist/client/views/collection/table-view.mjs +695 -0
- package/dist/client/views/collection/table-view.mjs.map +1 -0
- package/dist/client/views/collection/view-skeletons.mjs +121 -0
- package/dist/client/views/collection/view-skeletons.mjs.map +1 -0
- package/dist/client/views/common/global-search.d.mts +1 -0
- package/dist/client/views/common/global-search.mjs +376 -0
- package/dist/client/views/common/global-search.mjs.map +1 -0
- package/dist/client/views/common/index.d.mts +1 -0
- package/dist/client/views/dashboard/dashboard-grid.mjs +385 -0
- package/dist/client/views/dashboard/dashboard-grid.mjs.map +1 -0
- package/dist/client/views/dashboard/dashboard-widget.mjs +178 -0
- package/dist/client/views/dashboard/dashboard-widget.mjs.map +1 -0
- package/dist/client/views/dashboard/widget-card.mjs +159 -0
- package/dist/client/views/dashboard/widget-card.mjs.map +1 -0
- package/dist/client/views/globals/global-form-view.d.mts +74 -0
- package/dist/client/views/globals/global-form-view.d.mts.map +1 -0
- package/dist/client/views/globals/global-form-view.mjs +181 -0
- package/dist/client/views/globals/global-form-view.mjs.map +1 -0
- package/dist/client/views/index.d.mts +28 -0
- package/dist/client/views/layout/admin-layout-provider.d.mts +140 -0
- package/dist/client/views/layout/admin-layout-provider.d.mts.map +1 -0
- package/dist/client/views/layout/admin-layout-provider.mjs +90 -0
- package/dist/client/views/layout/admin-layout-provider.mjs.map +1 -0
- package/dist/client/views/layout/admin-layout.d.mts +151 -0
- package/dist/client/views/layout/admin-layout.d.mts.map +1 -0
- package/dist/client/views/layout/admin-layout.mjs +144 -0
- package/dist/client/views/layout/admin-layout.mjs.map +1 -0
- package/dist/client/views/layout/admin-root.d.mts +7 -0
- package/dist/client/views/layout/admin-router.d.mts +125 -0
- package/dist/client/views/layout/admin-router.d.mts.map +1 -0
- package/dist/client/views/layout/admin-router.mjs +594 -0
- package/dist/client/views/layout/admin-router.mjs.map +1 -0
- package/dist/client/views/layout/admin-sidebar.d.mts +105 -0
- package/dist/client/views/layout/admin-sidebar.d.mts.map +1 -0
- package/dist/client/views/layout/admin-sidebar.mjs +550 -0
- package/dist/client/views/layout/admin-sidebar.mjs.map +1 -0
- package/dist/client/views/layout/admin-topbar.mjs +128 -0
- package/dist/client/views/layout/admin-topbar.mjs.map +1 -0
- package/dist/client/views/layout/index.d.mts +5 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +67 -0
- package/dist/client/views/pages/accept-invite-page.d.mts.map +1 -0
- package/dist/client/views/pages/accept-invite-page.mjs +143 -0
- package/dist/client/views/pages/accept-invite-page.mjs.map +1 -0
- package/dist/client/views/pages/dashboard-page.d.mts +52 -0
- package/dist/client/views/pages/dashboard-page.d.mts.map +1 -0
- package/dist/client/views/pages/dashboard-page.mjs +45 -0
- package/dist/client/views/pages/dashboard-page.mjs.map +1 -0
- package/dist/client/views/pages/forgot-password-page.d.mts +59 -0
- package/dist/client/views/pages/forgot-password-page.d.mts.map +1 -0
- package/dist/client/views/pages/forgot-password-page.mjs +80 -0
- package/dist/client/views/pages/forgot-password-page.mjs.map +1 -0
- package/dist/client/views/pages/index.d.mts +7 -0
- package/dist/client/views/pages/invite-page.d.mts +71 -0
- package/dist/client/views/pages/invite-page.d.mts.map +1 -0
- package/dist/client/views/pages/invite-page.mjs +86 -0
- package/dist/client/views/pages/invite-page.mjs.map +1 -0
- package/dist/client/views/pages/login-page.d.mts +76 -0
- package/dist/client/views/pages/login-page.d.mts.map +1 -0
- package/dist/client/views/pages/login-page.mjs +98 -0
- package/dist/client/views/pages/login-page.mjs.map +1 -0
- package/dist/client/views/pages/reset-password-page.d.mts +66 -0
- package/dist/client/views/pages/reset-password-page.d.mts.map +1 -0
- package/dist/client/views/pages/reset-password-page.mjs +105 -0
- package/dist/client/views/pages/reset-password-page.mjs.map +1 -0
- package/dist/client/views/pages/setup-page.d.mts +64 -0
- package/dist/client/views/pages/setup-page.d.mts.map +1 -0
- package/dist/client/views/pages/setup-page.mjs +91 -0
- package/dist/client/views/pages/setup-page.mjs.map +1 -0
- package/dist/client.d.mts +92 -3
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +54 -12
- package/dist/components/rich-text/index.d.mts +1 -0
- package/dist/components/rich-text/rich-text-renderer.d.mts +104 -0
- package/dist/components/rich-text/rich-text-renderer.d.mts.map +1 -0
- package/dist/components/rich-text/rich-text-renderer.mjs +210 -0
- package/dist/components/rich-text/rich-text-renderer.mjs.map +1 -0
- package/dist/index.d.mts +62 -3
- package/dist/index.mjs +54 -12
- package/dist/server/adapters/nextjs.d.mts +121 -0
- package/dist/server/adapters/nextjs.d.mts.map +1 -0
- package/dist/server/adapters/nextjs.mjs +111 -0
- package/dist/server/adapters/nextjs.mjs.map +1 -0
- package/dist/server/adapters/tanstack.d.mts +133 -0
- package/dist/server/adapters/tanstack.d.mts.map +1 -0
- package/dist/server/adapters/tanstack.mjs +90 -0
- package/dist/server/adapters/tanstack.mjs.map +1 -0
- package/dist/server/augmentation.d.mts +1523 -0
- package/dist/server/augmentation.d.mts.map +1 -0
- package/dist/server/auth-helpers.d.mts +143 -0
- package/dist/server/auth-helpers.d.mts.map +1 -0
- package/dist/server/auth-helpers.mjs +108 -0
- package/dist/server/auth-helpers.mjs.map +1 -0
- package/dist/server/block/block-builder.d.mts +319 -0
- package/dist/server/block/block-builder.d.mts.map +1 -0
- package/dist/server/block/block-builder.mjs +217 -0
- package/dist/server/block/block-builder.mjs.map +1 -0
- package/dist/server/block/index.d.mts +3 -0
- package/dist/server/block/introspection.d.mts +84 -0
- package/dist/server/block/introspection.d.mts.map +1 -0
- package/dist/server/block/introspection.mjs +89 -0
- package/dist/server/block/introspection.mjs.map +1 -0
- package/dist/server/block/prefetch.d.mts +78 -0
- package/dist/server/block/prefetch.d.mts.map +1 -0
- package/dist/server/block/prefetch.mjs +240 -0
- package/dist/server/block/prefetch.mjs.map +1 -0
- package/dist/server/fields/blocks.d.mts +139 -0
- package/dist/server/fields/blocks.d.mts.map +1 -0
- package/dist/server/fields/blocks.mjs +192 -0
- package/dist/server/fields/blocks.mjs.map +1 -0
- package/dist/server/fields/index.d.mts +48 -0
- package/dist/server/fields/index.d.mts.map +1 -0
- package/dist/server/fields/index.mjs +16 -0
- package/dist/server/fields/index.mjs.map +1 -0
- package/dist/server/fields/rich-text.d.mts +135 -0
- package/dist/server/fields/rich-text.d.mts.map +1 -0
- package/dist/server/fields/rich-text.mjs +188 -0
- package/dist/server/fields/rich-text.mjs.map +1 -0
- package/dist/server/i18n/index.d.mts +16 -0
- package/dist/server/i18n/index.d.mts.map +1 -0
- package/dist/server/i18n/index.mjs +44 -0
- package/dist/server/i18n/index.mjs.map +1 -0
- package/dist/server/i18n/messages/cs.mjs +461 -0
- package/dist/server/i18n/messages/cs.mjs.map +1 -0
- package/dist/server/i18n/messages/de.mjs +461 -0
- package/dist/server/i18n/messages/de.mjs.map +1 -0
- package/dist/server/i18n/messages/en.mjs +493 -0
- package/dist/server/i18n/messages/en.mjs.map +1 -0
- package/dist/server/i18n/messages/es.mjs +461 -0
- package/dist/server/i18n/messages/es.mjs.map +1 -0
- package/dist/server/i18n/messages/fr.mjs +461 -0
- package/dist/server/i18n/messages/fr.mjs.map +1 -0
- package/dist/server/i18n/messages/index.mjs +24 -0
- package/dist/server/i18n/messages/index.mjs.map +1 -0
- package/dist/server/i18n/messages/pl.mjs +461 -0
- package/dist/server/i18n/messages/pl.mjs.map +1 -0
- package/dist/server/i18n/messages/pt.mjs +464 -0
- package/dist/server/i18n/messages/pt.mjs.map +1 -0
- package/dist/server/i18n/messages/sk.mjs +490 -0
- package/dist/server/i18n/messages/sk.mjs.map +1 -0
- package/dist/server/index.d.mts +20 -0
- package/dist/server/modules/admin/functions/admin-config.mjs +348 -0
- package/dist/server/modules/admin/functions/admin-config.mjs.map +1 -0
- package/dist/server/modules/admin/functions/execute-action.d.mts +107 -0
- package/dist/server/modules/admin/functions/execute-action.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/execute-action.mjs +331 -0
- package/dist/server/modules/admin/functions/execute-action.mjs.map +1 -0
- package/dist/server/modules/admin/functions/locales.mjs +80 -0
- package/dist/server/modules/admin/functions/locales.mjs.map +1 -0
- package/dist/server/modules/admin/functions/preview.d.mts +70 -0
- package/dist/server/modules/admin/functions/preview.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/preview.mjs +243 -0
- package/dist/server/modules/admin/functions/preview.mjs.map +1 -0
- package/dist/server/modules/admin/functions/reactive.d.mts +99 -0
- package/dist/server/modules/admin/functions/reactive.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/reactive.mjs +378 -0
- package/dist/server/modules/admin/functions/reactive.mjs.map +1 -0
- package/dist/server/modules/admin/functions/setup.d.mts +84 -0
- package/dist/server/modules/admin/functions/setup.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/setup.mjs +131 -0
- package/dist/server/modules/admin/functions/setup.mjs.map +1 -0
- package/dist/server/modules/admin/functions/translations.mjs +125 -0
- package/dist/server/modules/admin/functions/translations.mjs.map +1 -0
- package/dist/server/modules/admin/functions/widget-data.d.mts +33 -0
- package/dist/server/modules/admin/functions/widget-data.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/widget-data.mjs +70 -0
- package/dist/server/modules/admin/functions/widget-data.mjs.map +1 -0
- package/dist/server/modules/admin/index.d.mts +16879 -0
- package/dist/server/modules/admin/index.d.mts.map +1 -0
- package/dist/server/modules/admin/index.mjs +249 -0
- package/dist/server/modules/admin/index.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.d.mts +3 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs +48 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.d.mts +3 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.mjs +79 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts +1490 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts.map +1 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs +57 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs.map +1 -0
- package/dist/server/patch.d.mts +100 -0
- package/dist/server/patch.d.mts.map +1 -0
- package/dist/server/patch.mjs +1062 -0
- package/dist/server/patch.mjs.map +1 -0
- package/dist/server.d.mts +21 -250
- package/dist/server.mjs +19 -832
- package/dist/shared/preview-utils.d.mts +54 -0
- package/dist/shared/preview-utils.d.mts.map +1 -0
- package/dist/{preview-utils-BKQ9-TMa.mjs → shared/preview-utils.mjs} +2 -2
- package/dist/shared/preview-utils.mjs.map +1 -0
- package/dist/{saved-views.types-BMsz5mCy.d.mts → shared/types/saved-views.types.d.mts} +7 -2
- package/dist/shared/types/saved-views.types.d.mts.map +1 -0
- package/dist/shared.d.mts +3 -57
- package/dist/shared.mjs +1 -1
- package/package.json +12 -17
- package/dist/auth-layout-M8K8_q5R.mjs +0 -181
- package/dist/auth-layout-M8K8_q5R.mjs.map +0 -1
- package/dist/bulk-upload-dialog-D7w7W1Hl.mjs +0 -273
- package/dist/bulk-upload-dialog-D7w7W1Hl.mjs.map +0 -1
- package/dist/client-B7r47hEd.d.mts +0 -13403
- package/dist/client-B7r47hEd.d.mts.map +0 -1
- package/dist/client-njX1rZmi.mjs +0 -22612
- package/dist/client-njX1rZmi.mjs.map +0 -1
- package/dist/content-locales-provider-BXvuIgfg.mjs +0 -1650
- package/dist/content-locales-provider-BXvuIgfg.mjs.map +0 -1
- package/dist/dashboard-page-B4PGEdc2.mjs +0 -2500
- package/dist/dashboard-page-B4PGEdc2.mjs.map +0 -1
- package/dist/dashboard-page-mCY0pgZv.mjs +0 -3
- package/dist/dropzone-Do3awXKd.mjs +0 -634
- package/dist/dropzone-Do3awXKd.mjs.map +0 -1
- package/dist/forgot-password-page-Bcp-An4Y.mjs.map +0 -1
- package/dist/forgot-password-page-CEwsdLwn.mjs +0 -3
- package/dist/index-BYyqkWtn.d.mts +0 -2753
- package/dist/index-BYyqkWtn.d.mts.map +0 -1
- package/dist/login-page-BUnpCbCa.mjs +0 -3
- package/dist/login-page-CP4gA-dl.mjs +0 -298
- package/dist/login-page-CP4gA-dl.mjs.map +0 -1
- package/dist/preview-utils-BKQ9-TMa.mjs.map +0 -1
- package/dist/reset-password-page-BqfDmLxA.mjs +0 -281
- package/dist/reset-password-page-BqfDmLxA.mjs.map +0 -1
- package/dist/reset-password-page-CufHz3h3.mjs +0 -3
- package/dist/runtime-6VZM878K.mjs.map +0 -1
- package/dist/saved-views.types-BMsz5mCy.d.mts.map +0 -1
- package/dist/server.d.mts.map +0 -1
- package/dist/server.mjs.map +0 -1
- package/dist/setup-page-BNNzt_Z6.mjs +0 -3
- package/dist/setup-page-YAP_fzqh.mjs.map +0 -1
- package/dist/shared.d.mts.map +0 -1
- package/dist/use-auth-BoLmWtmU.mjs.map +0 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useResolveText } from "../../i18n/hooks.mjs";
|
|
4
|
+
import { selectAuthClient, useAdminStore } from "../../runtime/provider.mjs";
|
|
5
|
+
import { resolveIconElement } from "../component-renderer.mjs";
|
|
6
|
+
import { Button } from "../ui/button.mjs";
|
|
7
|
+
import { ConfirmationDialog } from "./confirmation-dialog.mjs";
|
|
8
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
//#region src/client/components/actions/action-button.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Action Button
|
|
15
|
+
*
|
|
16
|
+
* A button component that renders an action with optional confirmation dialog.
|
|
17
|
+
* Handles different action types (navigate, api, custom, dialog, form).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* ActionButton - Renders an action button with confirmation support
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <ActionButton
|
|
25
|
+
* action={deleteAction}
|
|
26
|
+
* collection="posts"
|
|
27
|
+
* item={post}
|
|
28
|
+
* helpers={actionHelpers}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function ActionButton({ action, collection, item, items, helpers, size = "default", className, iconOnly = false, onOpenDialog }) {
|
|
33
|
+
const resolveText = useResolveText();
|
|
34
|
+
const authClient = useAdminStore(selectAuthClient);
|
|
35
|
+
const queryClient = useQueryClient();
|
|
36
|
+
const [showConfirm, setShowConfirm] = React$1.useState(false);
|
|
37
|
+
const [isLoading, setIsLoading] = React$1.useState(false);
|
|
38
|
+
const actionQueryClient = React$1.useMemo(() => ({
|
|
39
|
+
invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
|
|
40
|
+
refetchQueries: (filters) => queryClient.refetchQueries(filters),
|
|
41
|
+
resetQueries: (filters) => queryClient.resetQueries(filters)
|
|
42
|
+
}), [queryClient]);
|
|
43
|
+
const ctx = React$1.useMemo(() => ({
|
|
44
|
+
item,
|
|
45
|
+
items,
|
|
46
|
+
collection,
|
|
47
|
+
helpers,
|
|
48
|
+
queryClient: actionQueryClient,
|
|
49
|
+
authClient
|
|
50
|
+
}), [
|
|
51
|
+
item,
|
|
52
|
+
items,
|
|
53
|
+
collection,
|
|
54
|
+
helpers,
|
|
55
|
+
actionQueryClient,
|
|
56
|
+
authClient
|
|
57
|
+
]);
|
|
58
|
+
const isVisible = React$1.useMemo(() => {
|
|
59
|
+
if (action.visible === void 0) return true;
|
|
60
|
+
if (typeof action.visible === "function") return action.visible(ctx);
|
|
61
|
+
return action.visible;
|
|
62
|
+
}, [action.visible, ctx]);
|
|
63
|
+
const isDisabled = React$1.useMemo(() => {
|
|
64
|
+
if (action.disabled === void 0) return false;
|
|
65
|
+
if (typeof action.disabled === "function") return action.disabled(ctx);
|
|
66
|
+
return action.disabled;
|
|
67
|
+
}, [action.disabled, ctx]);
|
|
68
|
+
if (!isVisible) return null;
|
|
69
|
+
const executeAction = async () => {
|
|
70
|
+
const { handler } = action;
|
|
71
|
+
switch (handler.type) {
|
|
72
|
+
case "navigate": {
|
|
73
|
+
const path = typeof handler.path === "function" ? handler.path(item) : handler.path;
|
|
74
|
+
helpers.navigate(`${helpers.basePath}/collections/${collection}/${path}`);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case "api":
|
|
78
|
+
setIsLoading(true);
|
|
79
|
+
try {
|
|
80
|
+
const endpoint = handler.endpoint.replace("{id}", String(item?.id || ""));
|
|
81
|
+
helpers.toast.info(`API call: ${handler.method || "POST"} ${endpoint}`);
|
|
82
|
+
helpers.refresh();
|
|
83
|
+
} catch (error) {
|
|
84
|
+
helpers.toast.error("Action failed");
|
|
85
|
+
} finally {
|
|
86
|
+
setIsLoading(false);
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case "custom":
|
|
90
|
+
setIsLoading(true);
|
|
91
|
+
try {
|
|
92
|
+
await handler.fn(ctx);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
helpers.toast.error("Action failed");
|
|
95
|
+
} finally {
|
|
96
|
+
setIsLoading(false);
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case "dialog":
|
|
100
|
+
case "form":
|
|
101
|
+
onOpenDialog?.(action);
|
|
102
|
+
break;
|
|
103
|
+
case "server":
|
|
104
|
+
onOpenDialog?.(action);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const handleClick = (e) => {
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
if (action.confirmation) setShowConfirm(true);
|
|
111
|
+
else executeAction();
|
|
112
|
+
};
|
|
113
|
+
const handleConfirm = async () => {
|
|
114
|
+
await executeAction();
|
|
115
|
+
};
|
|
116
|
+
const iconElement = resolveIconElement(action.icon, { "data-icon": "inline-start" });
|
|
117
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
118
|
+
variant: action.variant || "default",
|
|
119
|
+
size: iconOnly ? "icon-sm" : size,
|
|
120
|
+
onClick: handleClick,
|
|
121
|
+
disabled: isDisabled || isLoading,
|
|
122
|
+
className,
|
|
123
|
+
children: [iconElement, !iconOnly && resolveText(action.label)]
|
|
124
|
+
}), action.confirmation && /* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
125
|
+
open: showConfirm,
|
|
126
|
+
onOpenChange: setShowConfirm,
|
|
127
|
+
config: action.confirmation,
|
|
128
|
+
onConfirm: handleConfirm,
|
|
129
|
+
loading: isLoading
|
|
130
|
+
})] });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
export { ActionButton };
|
|
135
|
+
//# sourceMappingURL=action-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-button.mjs","names":["React","actionQueryClient: ActionQueryClient","ctx: ActionContext<TItem>"],"sources":["../../../../src/client/components/actions/action-button.tsx"],"sourcesContent":["/**\n * Action Button\n *\n * A button component that renders an action with optional confirmation dialog.\n * Handles different action types (navigate, api, custom, dialog, form).\n */\n\n\"use client\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport * as React from \"react\";\nimport type {\n ActionContext,\n ActionDefinition,\n ActionHelpers,\n ActionQueryClient,\n} from \"../../builder/types/action-types\";\nimport { resolveIconElement } from \"../../components/component-renderer\";\nimport { useResolveText } from \"../../i18n/hooks\";\nimport { selectAuthClient, useAdminStore } from \"../../runtime/provider\";\nimport { Button } from \"../ui/button\";\nimport { ConfirmationDialog } from \"./confirmation-dialog\";\n\nexport interface ActionButtonProps<TItem = any> {\n /** Action definition */\n action: ActionDefinition<TItem>;\n /** Collection name */\n collection: string;\n /** Item for row actions */\n item?: TItem;\n /** Items for bulk actions */\n items?: TItem[];\n /** Action helpers */\n helpers: ActionHelpers;\n /** Button size */\n size?: \"default\" | \"sm\" | \"lg\" | \"icon\" | \"icon-sm\" | \"icon-lg\" | \"xs\";\n /** Additional class names */\n className?: string;\n /** Show icon only */\n iconOnly?: boolean;\n /** Callback when action dialog should open */\n onOpenDialog?: (action: ActionDefinition<TItem>) => void;\n}\n\n/**\n * ActionButton - Renders an action button with confirmation support\n *\n * @example\n * ```tsx\n * <ActionButton\n * action={deleteAction}\n * collection=\"posts\"\n * item={post}\n * helpers={actionHelpers}\n * />\n * ```\n */\nexport function ActionButton<TItem = any>({\n action,\n collection,\n item,\n items,\n helpers,\n size = \"default\",\n className,\n iconOnly = false,\n onOpenDialog,\n}: ActionButtonProps<TItem>): React.ReactElement | null {\n const resolveText = useResolveText();\n const authClient = useAdminStore(selectAuthClient);\n const queryClient = useQueryClient();\n const [showConfirm, setShowConfirm] = React.useState(false);\n const [isLoading, setIsLoading] = React.useState(false);\n\n // Wrapped query client for action context\n const actionQueryClient: ActionQueryClient = React.useMemo(\n () => ({\n invalidateQueries: (filters) => queryClient.invalidateQueries(filters),\n refetchQueries: (filters) => queryClient.refetchQueries(filters),\n resetQueries: (filters) => queryClient.resetQueries(filters),\n }),\n [queryClient],\n );\n\n // Build action context\n const ctx: ActionContext<TItem> = React.useMemo(\n () => ({\n item,\n items,\n collection,\n helpers,\n queryClient: actionQueryClient,\n authClient,\n }),\n [item, items, collection, helpers, actionQueryClient, authClient],\n );\n\n // Check visibility\n const isVisible = React.useMemo(() => {\n if (action.visible === undefined) return true;\n if (typeof action.visible === \"function\") {\n return action.visible(ctx);\n }\n return action.visible;\n }, [action.visible, ctx]);\n\n // Check disabled state\n const isDisabled = React.useMemo(() => {\n if (action.disabled === undefined) return false;\n if (typeof action.disabled === \"function\") {\n return action.disabled(ctx);\n }\n return action.disabled;\n }, [action.disabled, ctx]);\n\n if (!isVisible) return null;\n\n // Handle action execution\n const executeAction = async () => {\n const { handler } = action;\n\n switch (handler.type) {\n case \"navigate\": {\n const path =\n typeof handler.path === \"function\"\n ? handler.path(item!)\n : handler.path;\n helpers.navigate(\n `${helpers.basePath}/collections/${collection}/${path}`,\n );\n break;\n }\n\n case \"api\": {\n setIsLoading(true);\n try {\n // Build endpoint - replace {id} placeholder\n const endpoint = handler.endpoint.replace(\n \"{id}\",\n String((item as any)?.id || \"\"),\n );\n\n // This would need actual API implementation\n // For now, we'll show a placeholder\n helpers.toast.info(\n `API call: ${handler.method || \"POST\"} ${endpoint}`,\n );\n helpers.refresh();\n } catch (error) {\n helpers.toast.error(\"Action failed\");\n } finally {\n setIsLoading(false);\n }\n break;\n }\n\n case \"custom\": {\n setIsLoading(true);\n try {\n await handler.fn(ctx);\n } catch (error) {\n helpers.toast.error(\"Action failed\");\n } finally {\n setIsLoading(false);\n }\n break;\n }\n\n case \"dialog\":\n case \"form\": {\n // Open dialog through parent component\n onOpenDialog?.(action);\n break;\n }\n\n case \"server\": {\n // Server actions are handled as form/dialog if they have a form config,\n // otherwise execute directly via the action execution hook\n onOpenDialog?.(action);\n break;\n }\n }\n };\n\n // Handle button click\n const handleClick = (e: React.MouseEvent) => {\n e.stopPropagation(); // Prevent row click propagation\n\n if (action.confirmation) {\n setShowConfirm(true);\n } else {\n executeAction();\n }\n };\n\n // Handle confirmation\n const handleConfirm = async () => {\n await executeAction();\n };\n\n const iconElement = resolveIconElement(action.icon, {\n \"data-icon\": \"inline-start\",\n });\n\n return (\n <>\n <Button\n variant={action.variant || \"default\"}\n size={iconOnly ? \"icon-sm\" : size}\n onClick={handleClick}\n disabled={isDisabled || isLoading}\n className={className}\n >\n {iconElement}\n {!iconOnly && resolveText(action.label)}\n </Button>\n\n {action.confirmation && (\n <ConfirmationDialog\n open={showConfirm}\n onOpenChange={setShowConfirm}\n config={action.confirmation}\n onConfirm={handleConfirm}\n loading={isLoading}\n />\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,SAAgB,aAA0B,EACxC,QACA,YACA,MACA,OACA,SACA,OAAO,WACP,WACA,WAAW,OACX,gBACsD;CACtD,MAAM,cAAc,gBAAgB;CACpC,MAAM,aAAa,cAAc,iBAAiB;CAClD,MAAM,cAAc,gBAAgB;CACpC,MAAM,CAAC,aAAa,kBAAkBA,QAAM,SAAS,MAAM;CAC3D,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,MAAM;CAGvD,MAAMC,oBAAuCD,QAAM,eAC1C;EACL,oBAAoB,YAAY,YAAY,kBAAkB,QAAQ;EACtE,iBAAiB,YAAY,YAAY,eAAe,QAAQ;EAChE,eAAe,YAAY,YAAY,aAAa,QAAQ;EAC7D,GACD,CAAC,YAAY,CACd;CAGD,MAAME,MAA4BF,QAAM,eAC/B;EACL;EACA;EACA;EACA;EACA,aAAa;EACb;EACD,GACD;EAAC;EAAM;EAAO;EAAY;EAAS;EAAmB;EAAW,CAClE;CAGD,MAAM,YAAYA,QAAM,cAAc;AACpC,MAAI,OAAO,YAAY,OAAW,QAAO;AACzC,MAAI,OAAO,OAAO,YAAY,WAC5B,QAAO,OAAO,QAAQ,IAAI;AAE5B,SAAO,OAAO;IACb,CAAC,OAAO,SAAS,IAAI,CAAC;CAGzB,MAAM,aAAaA,QAAM,cAAc;AACrC,MAAI,OAAO,aAAa,OAAW,QAAO;AAC1C,MAAI,OAAO,OAAO,aAAa,WAC7B,QAAO,OAAO,SAAS,IAAI;AAE7B,SAAO,OAAO;IACb,CAAC,OAAO,UAAU,IAAI,CAAC;AAE1B,KAAI,CAAC,UAAW,QAAO;CAGvB,MAAM,gBAAgB,YAAY;EAChC,MAAM,EAAE,YAAY;AAEpB,UAAQ,QAAQ,MAAhB;GACE,KAAK,YAAY;IACf,MAAM,OACJ,OAAO,QAAQ,SAAS,aACpB,QAAQ,KAAK,KAAM,GACnB,QAAQ;AACd,YAAQ,SACN,GAAG,QAAQ,SAAS,eAAe,WAAW,GAAG,OAClD;AACD;;GAGF,KAAK;AACH,iBAAa,KAAK;AAClB,QAAI;KAEF,MAAM,WAAW,QAAQ,SAAS,QAChC,QACA,OAAQ,MAAc,MAAM,GAAG,CAChC;AAID,aAAQ,MAAM,KACZ,aAAa,QAAQ,UAAU,OAAO,GAAG,WAC1C;AACD,aAAQ,SAAS;aACV,OAAO;AACd,aAAQ,MAAM,MAAM,gBAAgB;cAC5B;AACR,kBAAa,MAAM;;AAErB;GAGF,KAAK;AACH,iBAAa,KAAK;AAClB,QAAI;AACF,WAAM,QAAQ,GAAG,IAAI;aACd,OAAO;AACd,aAAQ,MAAM,MAAM,gBAAgB;cAC5B;AACR,kBAAa,MAAM;;AAErB;GAGF,KAAK;GACL,KAAK;AAEH,mBAAe,OAAO;AACtB;GAGF,KAAK;AAGH,mBAAe,OAAO;AACtB;;;CAMN,MAAM,eAAe,MAAwB;AAC3C,IAAE,iBAAiB;AAEnB,MAAI,OAAO,aACT,gBAAe,KAAK;MAEpB,gBAAe;;CAKnB,MAAM,gBAAgB,YAAY;AAChC,QAAM,eAAe;;CAGvB,MAAM,cAAc,mBAAmB,OAAO,MAAM,EAClD,aAAa,gBACd,CAAC;AAEF,QACE,4CACE,qBAAC;EACC,SAAS,OAAO,WAAW;EAC3B,MAAM,WAAW,YAAY;EAC7B,SAAS;EACT,UAAU,cAAc;EACb;aAEV,aACA,CAAC,YAAY,YAAY,OAAO,MAAM;GAChC,EAER,OAAO,gBACN,oBAAC;EACC,MAAM;EACN,cAAc;EACd,QAAQ,OAAO;EACf,WAAW;EACX,SAAS;GACT,IAEH"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useResolveText, useTranslation } from "../../i18n/hooks.mjs";
|
|
4
|
+
import { selectAdmin, useAdminStore } from "../../runtime/provider.mjs";
|
|
5
|
+
import { Button } from "../ui/button.mjs";
|
|
6
|
+
import { buildValidationSchema } from "../../builder/validation.mjs";
|
|
7
|
+
import { AutoFormFields } from "../../views/collection/auto-form-fields.mjs";
|
|
8
|
+
import { ResponsiveDialog, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle } from "../ui/responsive-dialog.mjs";
|
|
9
|
+
import { Icon } from "@iconify/react";
|
|
10
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
11
|
+
import * as React$1 from "react";
|
|
12
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
13
|
+
import { toast } from "sonner";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
|
|
16
|
+
//#region src/client/components/actions/action-dialog.tsx
|
|
17
|
+
/**
|
|
18
|
+
* Action Dialog
|
|
19
|
+
*
|
|
20
|
+
* Renders dialog-type and form-type actions.
|
|
21
|
+
* Supports lazy-loaded components and inline form definitions.
|
|
22
|
+
* Form actions use AutoFormFields for full field system support.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Create a custom resolver for action form validation
|
|
26
|
+
* Uses buildValidationSchema and handles Zod v4 compatibility
|
|
27
|
+
*/
|
|
28
|
+
function createActionFormResolver(fields, registry) {
|
|
29
|
+
const schema = buildValidationSchema(fields, registry);
|
|
30
|
+
return async (values) => {
|
|
31
|
+
const result = schema.safeParse(values);
|
|
32
|
+
if (result.success) return {
|
|
33
|
+
values: result.data,
|
|
34
|
+
errors: {}
|
|
35
|
+
};
|
|
36
|
+
const errors = {};
|
|
37
|
+
for (const issue of result.error.issues) {
|
|
38
|
+
const path = issue.path.join(".");
|
|
39
|
+
if (path && !errors[path]) errors[path] = {
|
|
40
|
+
type: issue.code,
|
|
41
|
+
message: issue.message
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
values: {},
|
|
46
|
+
errors
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Form Dialog content - renders form fields using AutoFormFields
|
|
52
|
+
*
|
|
53
|
+
* Uses buildValidationSchema for automatic Zod schema generation
|
|
54
|
+
* from field definitions, providing full field system support.
|
|
55
|
+
*/
|
|
56
|
+
function FormDialogContent({ action, ctx, onClose }) {
|
|
57
|
+
const { config } = action.handler;
|
|
58
|
+
const resolveText = useResolveText();
|
|
59
|
+
const { t } = useTranslation();
|
|
60
|
+
const admin = useAdminStore(selectAdmin);
|
|
61
|
+
const resolver = React$1.useMemo(() => {
|
|
62
|
+
if (!admin) return void 0;
|
|
63
|
+
return createActionFormResolver(config.fields, admin.getFields());
|
|
64
|
+
}, [admin, config.fields]);
|
|
65
|
+
const form = useForm({
|
|
66
|
+
defaultValues: config.defaultValues || {},
|
|
67
|
+
resolver
|
|
68
|
+
});
|
|
69
|
+
const [isSubmitting, setIsSubmitting] = React$1.useState(false);
|
|
70
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
71
|
+
setIsSubmitting(true);
|
|
72
|
+
const submitPromise = async () => {
|
|
73
|
+
await config.onSubmit(data, ctx);
|
|
74
|
+
return data;
|
|
75
|
+
};
|
|
76
|
+
toast.promise(submitPromise(), {
|
|
77
|
+
loading: t("toast.processing"),
|
|
78
|
+
success: () => {
|
|
79
|
+
onClose();
|
|
80
|
+
return t("toast.actionSuccess");
|
|
81
|
+
},
|
|
82
|
+
error: (error) => {
|
|
83
|
+
return error instanceof Error ? error.message : t("toast.actionFailed");
|
|
84
|
+
},
|
|
85
|
+
finally: () => {
|
|
86
|
+
setIsSubmitting(false);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
const collectionConfig = React$1.useMemo(() => ({ fields: config.fields }), [config.fields]);
|
|
91
|
+
return /* @__PURE__ */ jsxs(FormProvider, {
|
|
92
|
+
...form,
|
|
93
|
+
children: [/* @__PURE__ */ jsxs(ResponsiveDialogHeader, { children: [/* @__PURE__ */ jsx(ResponsiveDialogTitle, { children: resolveText(config.title) }), config.description && /* @__PURE__ */ jsx(ResponsiveDialogDescription, { children: resolveText(config.description) })] }), /* @__PURE__ */ jsxs("form", {
|
|
94
|
+
onSubmit: handleSubmit,
|
|
95
|
+
className: "space-y-4",
|
|
96
|
+
children: [/* @__PURE__ */ jsx(AutoFormFields, {
|
|
97
|
+
collection: "__action__",
|
|
98
|
+
config: collectionConfig
|
|
99
|
+
}), /* @__PURE__ */ jsxs(ResponsiveDialogFooter, {
|
|
100
|
+
className: "mt-6",
|
|
101
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
102
|
+
type: "button",
|
|
103
|
+
variant: "outline",
|
|
104
|
+
onClick: onClose,
|
|
105
|
+
disabled: isSubmitting,
|
|
106
|
+
children: resolveText(config.cancelLabel, t("common.cancel"))
|
|
107
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
108
|
+
type: "submit",
|
|
109
|
+
disabled: isSubmitting,
|
|
110
|
+
children: isSubmitting ? t("common.loading") : resolveText(config.submitLabel, t("common.submit"))
|
|
111
|
+
})]
|
|
112
|
+
})]
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Custom Dialog content - renders lazy-loaded component
|
|
118
|
+
*/
|
|
119
|
+
function CustomDialogContent({ action, ctx, onClose }) {
|
|
120
|
+
const handler = action.handler;
|
|
121
|
+
const [Component, setComponent] = React$1.useState(null);
|
|
122
|
+
const [loading, setLoading] = React$1.useState(true);
|
|
123
|
+
const [error, setError] = React$1.useState(null);
|
|
124
|
+
React$1.useEffect(() => {
|
|
125
|
+
let mounted = true;
|
|
126
|
+
async function loadComponent() {
|
|
127
|
+
try {
|
|
128
|
+
const comp = handler.component;
|
|
129
|
+
if (typeof comp === "function") {
|
|
130
|
+
const lazyComp = comp;
|
|
131
|
+
if (lazyComp._payload !== void 0) {
|
|
132
|
+
const resolved = await lazyComp._payload();
|
|
133
|
+
if (mounted) setComponent(() => resolved.default || resolved);
|
|
134
|
+
} else {
|
|
135
|
+
const result = comp();
|
|
136
|
+
if (result?.then) {
|
|
137
|
+
const mod = await result;
|
|
138
|
+
if (mounted) setComponent(() => mod.default || mod);
|
|
139
|
+
} else if (mounted) setComponent(() => comp);
|
|
140
|
+
}
|
|
141
|
+
} else if (mounted) setComponent(() => comp);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
if (mounted) setError(err instanceof Error ? err : /* @__PURE__ */ new Error("Failed to load"));
|
|
144
|
+
} finally {
|
|
145
|
+
if (mounted) setLoading(false);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
loadComponent();
|
|
149
|
+
return () => {
|
|
150
|
+
mounted = false;
|
|
151
|
+
};
|
|
152
|
+
}, [handler.component]);
|
|
153
|
+
if (loading) return /* @__PURE__ */ jsx("div", {
|
|
154
|
+
className: "flex h-32 items-center justify-center",
|
|
155
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
156
|
+
icon: "ph:spinner-gap",
|
|
157
|
+
className: "size-6 animate-spin text-muted-foreground"
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
if (error) return /* @__PURE__ */ jsxs("div", {
|
|
161
|
+
className: "p-4 text-center",
|
|
162
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
163
|
+
className: "text-destructive",
|
|
164
|
+
children: error.message
|
|
165
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
166
|
+
variant: "outline",
|
|
167
|
+
onClick: onClose,
|
|
168
|
+
className: "mt-4",
|
|
169
|
+
children: "Close"
|
|
170
|
+
})]
|
|
171
|
+
});
|
|
172
|
+
if (!Component) return /* @__PURE__ */ jsxs("div", {
|
|
173
|
+
className: "p-4 text-center",
|
|
174
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
175
|
+
className: "text-muted-foreground",
|
|
176
|
+
children: "Component not found"
|
|
177
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
178
|
+
variant: "outline",
|
|
179
|
+
onClick: onClose,
|
|
180
|
+
className: "mt-4",
|
|
181
|
+
children: "Close"
|
|
182
|
+
})]
|
|
183
|
+
});
|
|
184
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
185
|
+
item: ctx.item,
|
|
186
|
+
items: ctx.items,
|
|
187
|
+
collection: ctx.collection,
|
|
188
|
+
onClose,
|
|
189
|
+
onSuccess: () => {
|
|
190
|
+
ctx.helpers.refresh();
|
|
191
|
+
onClose();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* ActionDialog - Renders dialog-type and form-type actions
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```tsx
|
|
200
|
+
* <ActionDialog
|
|
201
|
+
* open={!!activeAction}
|
|
202
|
+
* onOpenChange={(open) => !open && setActiveAction(null)}
|
|
203
|
+
* action={activeAction}
|
|
204
|
+
* collection="users"
|
|
205
|
+
* item={selectedUser}
|
|
206
|
+
* helpers={actionHelpers}
|
|
207
|
+
* />
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
function ActionDialog({ open, onOpenChange, action, collection, item, items, helpers }) {
|
|
211
|
+
const queryClient = useQueryClient();
|
|
212
|
+
const ctx = React$1.useMemo(() => ({
|
|
213
|
+
item,
|
|
214
|
+
items,
|
|
215
|
+
collection,
|
|
216
|
+
helpers: {
|
|
217
|
+
...helpers,
|
|
218
|
+
closeDialog: () => onOpenChange(false)
|
|
219
|
+
},
|
|
220
|
+
queryClient: {
|
|
221
|
+
invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
|
|
222
|
+
resetQueries: (filters) => queryClient.resetQueries(filters),
|
|
223
|
+
refetchQueries: (filters) => queryClient.refetchQueries(filters)
|
|
224
|
+
}
|
|
225
|
+
}), [
|
|
226
|
+
item,
|
|
227
|
+
items,
|
|
228
|
+
collection,
|
|
229
|
+
helpers,
|
|
230
|
+
onOpenChange,
|
|
231
|
+
queryClient
|
|
232
|
+
]);
|
|
233
|
+
const handleClose = () => onOpenChange(false);
|
|
234
|
+
const getDialogClassName = () => {
|
|
235
|
+
if (action.handler.type === "form") return {
|
|
236
|
+
sm: "sm:max-w-sm",
|
|
237
|
+
md: "sm:max-w-md",
|
|
238
|
+
lg: "sm:max-w-lg",
|
|
239
|
+
xl: "sm:max-w-xl"
|
|
240
|
+
}[action.handler.config.width || "md"];
|
|
241
|
+
if (action.handler.type === "dialog") return "sm:max-w-lg";
|
|
242
|
+
return "sm:max-w-md";
|
|
243
|
+
};
|
|
244
|
+
return /* @__PURE__ */ jsx(ResponsiveDialog, {
|
|
245
|
+
open,
|
|
246
|
+
onOpenChange,
|
|
247
|
+
children: /* @__PURE__ */ jsxs(ResponsiveDialogContent, {
|
|
248
|
+
className: getDialogClassName(),
|
|
249
|
+
children: [action.handler.type === "form" && /* @__PURE__ */ jsx(FormDialogContent, {
|
|
250
|
+
action,
|
|
251
|
+
ctx,
|
|
252
|
+
onClose: handleClose
|
|
253
|
+
}), action.handler.type === "dialog" && /* @__PURE__ */ jsx(CustomDialogContent, {
|
|
254
|
+
action,
|
|
255
|
+
ctx,
|
|
256
|
+
onClose: handleClose
|
|
257
|
+
})]
|
|
258
|
+
})
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
//#endregion
|
|
263
|
+
export { ActionDialog };
|
|
264
|
+
//# sourceMappingURL=action-dialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-dialog.mjs","names":["errors: FieldErrors","React","ctx: ActionContext<TItem>"],"sources":["../../../../src/client/components/actions/action-dialog.tsx"],"sourcesContent":["/**\n * Action Dialog\n *\n * Renders dialog-type and form-type actions.\n * Supports lazy-loaded components and inline form definitions.\n * Form actions use AutoFormFields for full field system support.\n */\n\n\"use client\";\n\nimport { Icon } from \"@iconify/react\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport * as React from \"react\";\nimport {\n type FieldErrors,\n FormProvider,\n type Resolver,\n useForm,\n} from \"react-hook-form\";\nimport { toast } from \"sonner\";\nimport type {\n ActionContext,\n ActionDefinition,\n ActionHelpers,\n DialogHandler,\n FormHandler,\n} from \"../../builder/types/action-types\";\nimport type { FieldDefinition } from \"../../builder/field/field\";\nimport { buildValidationSchema } from \"../../builder/validation\";\nimport { useResolveText, useTranslation } from \"../../i18n/hooks\";\nimport { selectAdmin, useAdminStore } from \"../../runtime/provider\";\nimport { AutoFormFields } from \"../../views/collection/auto-form-fields\";\nimport { Button } from \"../ui/button\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n} from \"../ui/responsive-dialog\";\n\nexport interface ActionDialogProps<TItem = any> {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback when dialog should close */\n onOpenChange: (open: boolean) => void;\n /** The action being rendered */\n action: ActionDefinition<TItem>;\n /** Collection name */\n collection: string;\n /** Item for row actions */\n item?: TItem;\n /** Items for bulk actions */\n items?: TItem[];\n /** Action helpers */\n helpers: ActionHelpers;\n}\n\n/**\n * Create a custom resolver for action form validation\n * Uses buildValidationSchema and handles Zod v4 compatibility\n */\nfunction createActionFormResolver(\n fields: Record<string, FieldDefinition>,\n registry: Record<string, FieldDefinition>,\n): Resolver<Record<string, any>> {\n const schema = buildValidationSchema(fields, registry);\n\n return async (values) => {\n const result = schema.safeParse(values);\n\n if (result.success) {\n return {\n values: result.data,\n errors: {},\n };\n }\n\n const errors: FieldErrors = {};\n for (const issue of result.error.issues) {\n const path = issue.path.join(\".\");\n if (path && !errors[path]) {\n errors[path] = {\n type: issue.code,\n message: issue.message,\n };\n }\n }\n\n return {\n values: {},\n errors,\n };\n };\n}\n\n/**\n * Form Dialog content - renders form fields using AutoFormFields\n *\n * Uses buildValidationSchema for automatic Zod schema generation\n * from field definitions, providing full field system support.\n */\nfunction FormDialogContent<TItem>({\n action,\n ctx,\n onClose,\n}: {\n action: ActionDefinition<TItem>;\n ctx: ActionContext<TItem>;\n onClose: () => void;\n}) {\n const handler = action.handler as FormHandler<TItem>;\n const { config } = handler;\n const resolveText = useResolveText();\n const { t } = useTranslation();\n const admin = useAdminStore(selectAdmin);\n\n // Create resolver from field definitions\n const resolver = React.useMemo(() => {\n if (!admin) return undefined;\n return createActionFormResolver(config.fields, admin.getFields());\n }, [admin, config.fields]);\n\n const form = useForm({\n defaultValues: config.defaultValues || {},\n resolver,\n });\n\n const [isSubmitting, setIsSubmitting] = React.useState(false);\n\n const handleSubmit = form.handleSubmit(async (data) => {\n setIsSubmitting(true);\n\n const submitPromise = async () => {\n await config.onSubmit(data, ctx);\n return data;\n };\n\n toast.promise(submitPromise(), {\n loading: t(\"toast.processing\"),\n success: () => {\n onClose();\n return t(\"toast.actionSuccess\");\n },\n error: (error) => {\n return error instanceof Error ? error.message : t(\"toast.actionFailed\");\n },\n finally: () => {\n setIsSubmitting(false);\n },\n });\n });\n\n // Build collection config for AutoFormFields\n const collectionConfig = React.useMemo(\n () => ({\n fields: config.fields,\n }),\n [config.fields],\n );\n\n return (\n <FormProvider {...form}>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>\n {resolveText(config.title)}\n </ResponsiveDialogTitle>\n {config.description && (\n <ResponsiveDialogDescription>\n {resolveText(config.description)}\n </ResponsiveDialogDescription>\n )}\n </ResponsiveDialogHeader>\n\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <AutoFormFields collection=\"__action__\" config={collectionConfig} />\n\n <ResponsiveDialogFooter className=\"mt-6\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onClose}\n disabled={isSubmitting}\n >\n {resolveText(config.cancelLabel, t(\"common.cancel\"))}\n </Button>\n <Button type=\"submit\" disabled={isSubmitting}>\n {isSubmitting\n ? t(\"common.loading\")\n : resolveText(config.submitLabel, t(\"common.submit\"))}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </FormProvider>\n );\n}\n\n/**\n * Custom Dialog content - renders lazy-loaded component\n */\nfunction CustomDialogContent<TItem>({\n action,\n ctx,\n onClose,\n}: {\n action: ActionDefinition<TItem>;\n ctx: ActionContext<TItem>;\n onClose: () => void;\n}) {\n const handler = action.handler as DialogHandler<TItem>;\n const [Component, setComponent] =\n React.useState<React.ComponentType<any> | null>(null);\n const [loading, setLoading] = React.useState(true);\n const [error, setError] = React.useState<Error | null>(null);\n\n React.useEffect(() => {\n let mounted = true;\n\n async function loadComponent() {\n try {\n const comp = handler.component;\n\n // Handle lazy-loaded components\n if (typeof comp === \"function\") {\n // Check if it's a React.lazy component by looking for _payload\n const lazyComp = comp as any;\n if (lazyComp._payload !== undefined) {\n // It's a lazy component, resolve it\n const resolved = await lazyComp._payload();\n if (mounted) {\n setComponent(() => resolved.default || resolved);\n }\n } else {\n // It's a direct component function or import\n const result = (comp as () => any)();\n if (result?.then) {\n const mod = await result;\n if (mounted) {\n setComponent(() => mod.default || mod);\n }\n } else {\n // Direct component\n if (mounted) {\n setComponent(() => comp as React.ComponentType<any>);\n }\n }\n }\n } else {\n // Direct component\n if (mounted) {\n setComponent(() => comp as React.ComponentType<any>);\n }\n }\n } catch (err) {\n if (mounted) {\n setError(err instanceof Error ? err : new Error(\"Failed to load\"));\n }\n } finally {\n if (mounted) {\n setLoading(false);\n }\n }\n }\n\n loadComponent();\n return () => {\n mounted = false;\n };\n }, [handler.component]);\n\n if (loading) {\n return (\n <div className=\"flex h-32 items-center justify-center\">\n <Icon\n icon=\"ph:spinner-gap\"\n className=\"size-6 animate-spin text-muted-foreground\"\n />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"p-4 text-center\">\n <p className=\"text-destructive\">{error.message}</p>\n <Button variant=\"outline\" onClick={onClose} className=\"mt-4\">\n Close\n </Button>\n </div>\n );\n }\n\n if (!Component) {\n return (\n <div className=\"p-4 text-center\">\n <p className=\"text-muted-foreground\">Component not found</p>\n <Button variant=\"outline\" onClick={onClose} className=\"mt-4\">\n Close\n </Button>\n </div>\n );\n }\n\n return (\n <Component\n item={ctx.item}\n items={ctx.items}\n collection={ctx.collection}\n onClose={onClose}\n onSuccess={() => {\n ctx.helpers.refresh();\n onClose();\n }}\n />\n );\n}\n\n/**\n * ActionDialog - Renders dialog-type and form-type actions\n *\n * @example\n * ```tsx\n * <ActionDialog\n * open={!!activeAction}\n * onOpenChange={(open) => !open && setActiveAction(null)}\n * action={activeAction}\n * collection=\"users\"\n * item={selectedUser}\n * helpers={actionHelpers}\n * />\n * ```\n */\nexport function ActionDialog<TItem = any>({\n open,\n onOpenChange,\n action,\n collection,\n item,\n items,\n helpers,\n}: ActionDialogProps<TItem>): React.ReactElement | null {\n const queryClient = useQueryClient();\n\n // Build action context\n const ctx: ActionContext<TItem> = React.useMemo(\n () => ({\n item,\n items,\n collection,\n helpers: {\n ...helpers,\n closeDialog: () => onOpenChange(false),\n },\n queryClient: {\n invalidateQueries: (filters) => queryClient.invalidateQueries(filters),\n resetQueries: (filters) => queryClient.resetQueries(filters),\n refetchQueries: (filters) => queryClient.refetchQueries(filters),\n },\n }),\n [item, items, collection, helpers, onOpenChange, queryClient],\n );\n\n const handleClose = () => onOpenChange(false);\n\n // Determine dialog size based on handler type and config\n const getDialogClassName = () => {\n if (action.handler.type === \"form\") {\n const width = (action.handler as FormHandler).config.width || \"md\";\n const widthMap = {\n sm: \"sm:max-w-sm\",\n md: \"sm:max-w-md\",\n lg: \"sm:max-w-lg\",\n xl: \"sm:max-w-xl\",\n };\n return widthMap[width];\n }\n if (action.handler.type === \"dialog\") {\n return \"sm:max-w-lg\";\n }\n return \"sm:max-w-md\";\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent className={getDialogClassName()}>\n {action.handler.type === \"form\" && (\n <FormDialogContent action={action} ctx={ctx} onClose={handleClose} />\n )}\n {action.handler.type === \"dialog\" && (\n <CustomDialogContent\n action={action}\n ctx={ctx}\n onClose={handleClose}\n />\n )}\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,SAAS,yBACP,QACA,UAC+B;CAC/B,MAAM,SAAS,sBAAsB,QAAQ,SAAS;AAEtD,QAAO,OAAO,WAAW;EACvB,MAAM,SAAS,OAAO,UAAU,OAAO;AAEvC,MAAI,OAAO,QACT,QAAO;GACL,QAAQ,OAAO;GACf,QAAQ,EAAE;GACX;EAGH,MAAMA,SAAsB,EAAE;AAC9B,OAAK,MAAM,SAAS,OAAO,MAAM,QAAQ;GACvC,MAAM,OAAO,MAAM,KAAK,KAAK,IAAI;AACjC,OAAI,QAAQ,CAAC,OAAO,MAClB,QAAO,QAAQ;IACb,MAAM,MAAM;IACZ,SAAS,MAAM;IAChB;;AAIL,SAAO;GACL,QAAQ,EAAE;GACV;GACD;;;;;;;;;AAUL,SAAS,kBAAyB,EAChC,QACA,KACA,WAKC;CAED,MAAM,EAAE,WADQ,OAAO;CAEvB,MAAM,cAAc,gBAAgB;CACpC,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,QAAQ,cAAc,YAAY;CAGxC,MAAM,WAAWC,QAAM,cAAc;AACnC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,yBAAyB,OAAO,QAAQ,MAAM,WAAW,CAAC;IAChE,CAAC,OAAO,OAAO,OAAO,CAAC;CAE1B,MAAM,OAAO,QAAQ;EACnB,eAAe,OAAO,iBAAiB,EAAE;EACzC;EACD,CAAC;CAEF,MAAM,CAAC,cAAc,mBAAmBA,QAAM,SAAS,MAAM;CAE7D,MAAM,eAAe,KAAK,aAAa,OAAO,SAAS;AACrD,kBAAgB,KAAK;EAErB,MAAM,gBAAgB,YAAY;AAChC,SAAM,OAAO,SAAS,MAAM,IAAI;AAChC,UAAO;;AAGT,QAAM,QAAQ,eAAe,EAAE;GAC7B,SAAS,EAAE,mBAAmB;GAC9B,eAAe;AACb,aAAS;AACT,WAAO,EAAE,sBAAsB;;GAEjC,QAAQ,UAAU;AAChB,WAAO,iBAAiB,QAAQ,MAAM,UAAU,EAAE,qBAAqB;;GAEzE,eAAe;AACb,oBAAgB,MAAM;;GAEzB,CAAC;GACF;CAGF,MAAM,mBAAmBA,QAAM,eACtB,EACL,QAAQ,OAAO,QAChB,GACD,CAAC,OAAO,OAAO,CAChB;AAED,QACE,qBAAC;EAAa,GAAI;aAChB,qBAAC,qCACC,oBAAC,mCACE,YAAY,OAAO,MAAM,GACJ,EACvB,OAAO,eACN,oBAAC,yCACE,YAAY,OAAO,YAAY,GACJ,IAET,EAEzB,qBAAC;GAAK,UAAU;GAAc,WAAU;cACtC,oBAAC;IAAe,YAAW;IAAa,QAAQ;KAAoB,EAEpE,qBAAC;IAAuB,WAAU;eAChC,oBAAC;KACC,MAAK;KACL,SAAQ;KACR,SAAS;KACT,UAAU;eAET,YAAY,OAAO,aAAa,EAAE,gBAAgB,CAAC;MAC7C,EACT,oBAAC;KAAO,MAAK;KAAS,UAAU;eAC7B,eACG,EAAE,iBAAiB,GACnB,YAAY,OAAO,aAAa,EAAE,gBAAgB,CAAC;MAChD;KACc;IACpB;GACM;;;;;AAOnB,SAAS,oBAA2B,EAClC,QACA,KACA,WAKC;CACD,MAAM,UAAU,OAAO;CACvB,MAAM,CAAC,WAAW,gBAChBA,QAAM,SAA0C,KAAK;CACvD,MAAM,CAAC,SAAS,cAAcA,QAAM,SAAS,KAAK;CAClD,MAAM,CAAC,OAAO,YAAYA,QAAM,SAAuB,KAAK;AAE5D,SAAM,gBAAgB;EACpB,IAAI,UAAU;EAEd,eAAe,gBAAgB;AAC7B,OAAI;IACF,MAAM,OAAO,QAAQ;AAGrB,QAAI,OAAO,SAAS,YAAY;KAE9B,MAAM,WAAW;AACjB,SAAI,SAAS,aAAa,QAAW;MAEnC,MAAM,WAAW,MAAM,SAAS,UAAU;AAC1C,UAAI,QACF,oBAAmB,SAAS,WAAW,SAAS;YAE7C;MAEL,MAAM,SAAU,MAAoB;AACpC,UAAI,QAAQ,MAAM;OAChB,MAAM,MAAM,MAAM;AAClB,WAAI,QACF,oBAAmB,IAAI,WAAW,IAAI;iBAIpC,QACF,oBAAmB,KAAiC;;eAMtD,QACF,oBAAmB,KAAiC;YAGjD,KAAK;AACZ,QAAI,QACF,UAAS,eAAe,QAAQ,sBAAM,IAAI,MAAM,iBAAiB,CAAC;aAE5D;AACR,QAAI,QACF,YAAW,MAAM;;;AAKvB,iBAAe;AACf,eAAa;AACX,aAAU;;IAEX,CAAC,QAAQ,UAAU,CAAC;AAEvB,KAAI,QACF,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GACC,MAAK;GACL,WAAU;IACV;GACE;AAIV,KAAI,MACF,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC;GAAE,WAAU;aAAoB,MAAM;IAAY,EACnD,oBAAC;GAAO,SAAQ;GAAU,SAAS;GAAS,WAAU;aAAO;IAEpD;GACL;AAIV,KAAI,CAAC,UACH,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC;GAAE,WAAU;aAAwB;IAAuB,EAC5D,oBAAC;GAAO,SAAQ;GAAU,SAAS;GAAS,WAAU;aAAO;IAEpD;GACL;AAIV,QACE,oBAAC;EACC,MAAM,IAAI;EACV,OAAO,IAAI;EACX,YAAY,IAAI;EACP;EACT,iBAAiB;AACf,OAAI,QAAQ,SAAS;AACrB,YAAS;;GAEX;;;;;;;;;;;;;;;;;AAmBN,SAAgB,aAA0B,EACxC,MACA,cACA,QACA,YACA,MACA,OACA,WACsD;CACtD,MAAM,cAAc,gBAAgB;CAGpC,MAAMC,MAA4BD,QAAM,eAC/B;EACL;EACA;EACA;EACA,SAAS;GACP,GAAG;GACH,mBAAmB,aAAa,MAAM;GACvC;EACD,aAAa;GACX,oBAAoB,YAAY,YAAY,kBAAkB,QAAQ;GACtE,eAAe,YAAY,YAAY,aAAa,QAAQ;GAC5D,iBAAiB,YAAY,YAAY,eAAe,QAAQ;GACjE;EACF,GACD;EAAC;EAAM;EAAO;EAAY;EAAS;EAAc;EAAY,CAC9D;CAED,MAAM,oBAAoB,aAAa,MAAM;CAG7C,MAAM,2BAA2B;AAC/B,MAAI,OAAO,QAAQ,SAAS,OAQ1B,QANiB;GACf,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACL,CANc,OAAO,QAAwB,OAAO,SAAS;AAShE,MAAI,OAAO,QAAQ,SAAS,SAC1B,QAAO;AAET,SAAO;;AAGT,QACE,oBAAC;EAAuB;EAAoB;YAC1C,qBAAC;GAAwB,WAAW,oBAAoB;cACrD,OAAO,QAAQ,SAAS,UACvB,oBAAC;IAA0B;IAAa;IAAK,SAAS;KAAe,EAEtE,OAAO,QAAQ,SAAS,YACvB,oBAAC;IACS;IACH;IACL,SAAS;KACT;IAEoB;GACT"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Button } from "../ui/button.mjs";
|
|
4
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../ui/dialog.mjs";
|
|
5
|
+
import { Icon } from "@iconify/react";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/client/components/actions/confirmation-dialog.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Confirmation Dialog
|
|
12
|
+
*
|
|
13
|
+
* Reusable confirmation dialog for destructive or important actions.
|
|
14
|
+
* Uses base-ui dialog primitives with responsive design.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* ConfirmationDialog - Prompts user to confirm an action
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <ConfirmationDialog
|
|
22
|
+
* open={showConfirm}
|
|
23
|
+
* onOpenChange={setShowConfirm}
|
|
24
|
+
* config={{
|
|
25
|
+
* title: "Delete item?",
|
|
26
|
+
* description: "This action cannot be undone.",
|
|
27
|
+
* destructive: true,
|
|
28
|
+
* }}
|
|
29
|
+
* onConfirm={handleDelete}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function ConfirmationDialog({ open, onOpenChange, config, onConfirm, loading = false }) {
|
|
34
|
+
const [isProcessing, setIsProcessing] = React$1.useState(false);
|
|
35
|
+
const handleConfirm = async () => {
|
|
36
|
+
setIsProcessing(true);
|
|
37
|
+
try {
|
|
38
|
+
await onConfirm();
|
|
39
|
+
onOpenChange(false);
|
|
40
|
+
} finally {
|
|
41
|
+
setIsProcessing(false);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const isLoading = loading || isProcessing;
|
|
45
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
46
|
+
open,
|
|
47
|
+
onOpenChange,
|
|
48
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
49
|
+
className: "sm:max-w-[425px]",
|
|
50
|
+
children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: "flex items-start gap-3",
|
|
52
|
+
children: [config.destructive && /* @__PURE__ */ jsx("div", {
|
|
53
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-full bg-destructive/10",
|
|
54
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
55
|
+
icon: "ph:warning",
|
|
56
|
+
className: "size-5 text-destructive"
|
|
57
|
+
})
|
|
58
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: "space-y-1",
|
|
60
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: config.title }), config.description && /* @__PURE__ */ jsx(DialogDescription, { children: config.description })]
|
|
61
|
+
})]
|
|
62
|
+
}) }), /* @__PURE__ */ jsxs(DialogFooter, {
|
|
63
|
+
className: "mt-4",
|
|
64
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
65
|
+
variant: "outline",
|
|
66
|
+
onClick: () => onOpenChange(false),
|
|
67
|
+
disabled: isLoading,
|
|
68
|
+
children: config.cancelLabel || "Cancel"
|
|
69
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
70
|
+
variant: config.destructive ? "destructive" : "default",
|
|
71
|
+
onClick: handleConfirm,
|
|
72
|
+
disabled: isLoading,
|
|
73
|
+
children: isLoading ? "Processing..." : config.confirmLabel || "Confirm"
|
|
74
|
+
})]
|
|
75
|
+
})]
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { ConfirmationDialog };
|
|
82
|
+
//# sourceMappingURL=confirmation-dialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-dialog.mjs","names":["React"],"sources":["../../../../src/client/components/actions/confirmation-dialog.tsx"],"sourcesContent":["/**\n * Confirmation Dialog\n *\n * Reusable confirmation dialog for destructive or important actions.\n * Uses base-ui dialog primitives with responsive design.\n */\n\n\"use client\";\n\nimport { Icon } from \"@iconify/react\";\nimport * as React from \"react\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"../ui/dialog\";\nimport { Button } from \"../ui/button\";\nimport type { ConfirmationConfig } from \"../../builder/types/action-types\";\n\nexport interface ConfirmationDialogProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback when dialog should close */\n onOpenChange: (open: boolean) => void;\n /** Confirmation configuration */\n config: ConfirmationConfig;\n /** Callback when user confirms */\n onConfirm: () => void | Promise<void>;\n /** Whether the action is currently loading */\n loading?: boolean;\n}\n\n/**\n * ConfirmationDialog - Prompts user to confirm an action\n *\n * @example\n * ```tsx\n * <ConfirmationDialog\n * open={showConfirm}\n * onOpenChange={setShowConfirm}\n * config={{\n * title: \"Delete item?\",\n * description: \"This action cannot be undone.\",\n * destructive: true,\n * }}\n * onConfirm={handleDelete}\n * />\n * ```\n */\nexport function ConfirmationDialog({\n open,\n onOpenChange,\n config,\n onConfirm,\n loading = false,\n}: ConfirmationDialogProps): React.ReactElement {\n const [isProcessing, setIsProcessing] = React.useState(false);\n\n const handleConfirm = async () => {\n setIsProcessing(true);\n try {\n await onConfirm();\n onOpenChange(false);\n } finally {\n setIsProcessing(false);\n }\n };\n\n const isLoading = loading || isProcessing;\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"sm:max-w-[425px]\">\n <DialogHeader>\n <div className=\"flex items-start gap-3\">\n {config.destructive && (\n <div className=\"flex size-10 shrink-0 items-center justify-center rounded-full bg-destructive/10\">\n <Icon icon=\"ph:warning\" className=\"size-5 text-destructive\" />\n </div>\n )}\n <div className=\"space-y-1\">\n <DialogTitle>{config.title}</DialogTitle>\n {config.description && (\n <DialogDescription>{config.description}</DialogDescription>\n )}\n </div>\n </div>\n </DialogHeader>\n <DialogFooter className=\"mt-4\">\n <Button\n variant=\"outline\"\n onClick={() => onOpenChange(false)}\n disabled={isLoading}\n >\n {config.cancelLabel || \"Cancel\"}\n </Button>\n <Button\n variant={config.destructive ? \"destructive\" : \"default\"}\n onClick={handleConfirm}\n disabled={isLoading}\n >\n {isLoading ? \"Processing...\" : config.confirmLabel || \"Confirm\"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,mBAAmB,EACjC,MACA,cACA,QACA,WACA,UAAU,SACoC;CAC9C,MAAM,CAAC,cAAc,mBAAmBA,QAAM,SAAS,MAAM;CAE7D,MAAM,gBAAgB,YAAY;AAChC,kBAAgB,KAAK;AACrB,MAAI;AACF,SAAM,WAAW;AACjB,gBAAa,MAAM;YACX;AACR,mBAAgB,MAAM;;;CAI1B,MAAM,YAAY,WAAW;AAE7B,QACE,oBAAC;EAAa;EAAoB;YAChC,qBAAC;GAAc,WAAU;cACvB,oBAAC,0BACC,qBAAC;IAAI,WAAU;eACZ,OAAO,eACN,oBAAC;KAAI,WAAU;eACb,oBAAC;MAAK,MAAK;MAAa,WAAU;OAA4B;MAC1D,EAER,qBAAC;KAAI,WAAU;gBACb,oBAAC,yBAAa,OAAO,QAAoB,EACxC,OAAO,eACN,oBAAC,+BAAmB,OAAO,cAAgC;MAEzD;KACF,GACO,EACf,qBAAC;IAAa,WAAU;eACtB,oBAAC;KACC,SAAQ;KACR,eAAe,aAAa,MAAM;KAClC,UAAU;eAET,OAAO,eAAe;MAChB,EACT,oBAAC;KACC,SAAS,OAAO,cAAc,gBAAgB;KAC9C,SAAS;KACT,UAAU;eAET,YAAY,kBAAkB,OAAO,gBAAgB;MAC/C;KACI;IACD;GACT"}
|