@lattice-php/lattice 0.1.0 → 0.3.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 +3 -1
- package/dist/action/components/action-form.d.ts +24 -0
- package/dist/action/components/action-form.js +238 -0
- package/dist/action/components/action-form.js.map +1 -0
- package/dist/action/components/action-group.d.ts +1 -8
- package/dist/action/components/action-group.js +34 -64
- package/dist/action/components/action-group.js.map +1 -1
- package/dist/action/components/action-menu-context.d.ts +6 -0
- package/dist/action/components/action-menu-context.js +18 -0
- package/dist/action/components/action-menu-context.js.map +1 -0
- package/dist/action/components/action.d.ts +1 -24
- package/dist/action/components/action.js +73 -51
- package/dist/action/components/action.js.map +1 -1
- package/dist/action/index.d.ts +1 -1
- package/dist/action/index.js.map +1 -1
- package/dist/appearance/index.js +7 -2
- package/dist/appearance/index.js.map +1 -1
- package/dist/chat/components/chat-box.d.ts +3 -0
- package/dist/chat/components/chat-box.js +53 -0
- package/dist/chat/components/chat-box.js.map +1 -0
- package/dist/chat/components/message-list.d.ts +5 -0
- package/dist/chat/components/message-list.js +22 -0
- package/dist/chat/components/message-list.js.map +1 -0
- package/dist/chat/components/message.d.ts +5 -0
- package/dist/chat/components/message.js +20 -0
- package/dist/chat/components/message.js.map +1 -0
- package/dist/chat/components/prompt-input.d.ts +8 -0
- package/dist/chat/components/prompt-input.js +49 -0
- package/dist/chat/components/prompt-input.js.map +1 -0
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.js +15 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/parts/text.d.ts +3 -0
- package/dist/chat/parts/text.js +12 -0
- package/dist/chat/parts/text.js.map +1 -0
- package/dist/chat/parts/tool-call.d.ts +3 -0
- package/dist/chat/parts/tool-call.js +20 -0
- package/dist/chat/parts/tool-call.js.map +1 -0
- package/dist/chat/transport.d.ts +2 -0
- package/dist/chat/transport.js +47 -0
- package/dist/chat/transport.js.map +1 -0
- package/dist/chat/types.d.ts +39 -0
- package/dist/chat/use-chat.d.ts +15 -0
- package/dist/chat/use-chat.js +161 -0
- package/dist/chat/use-chat.js.map +1 -0
- package/dist/core/api.d.ts +18 -0
- package/dist/core/api.js +51 -0
- package/dist/core/api.js.map +1 -0
- package/dist/core/collapsed-context.d.ts +2 -0
- package/dist/core/collapsed-context.js +10 -0
- package/dist/core/collapsed-context.js.map +1 -0
- package/dist/core/column-sizing.d.ts +17 -0
- package/dist/core/column-sizing.js +61 -0
- package/dist/core/column-sizing.js.map +1 -0
- package/dist/core/components/badge.d.ts +1 -8
- package/dist/core/components/badge.js +2 -3
- package/dist/core/components/badge.js.map +1 -1
- package/dist/core/components/button.d.ts +5 -13
- package/dist/core/components/button.js +10 -9
- package/dist/core/components/button.js.map +1 -1
- package/dist/core/components/card.d.ts +1 -9
- package/dist/core/components/card.js +1 -3
- package/dist/core/components/card.js.map +1 -1
- package/dist/core/components/chart.d.ts +3 -0
- package/dist/core/components/chart.js +175 -0
- package/dist/core/components/chart.js.map +1 -0
- package/dist/{form/components/base → core/components}/checkbox.js +7 -4
- package/dist/core/components/checkbox.js.map +1 -0
- package/dist/core/components/combobox.d.ts +33 -0
- package/dist/core/components/combobox.js +99 -0
- package/dist/core/components/combobox.js.map +1 -0
- package/dist/core/components/confirm-dialog.d.ts +2 -3
- package/dist/core/components/confirm-dialog.js +17 -17
- package/dist/core/components/confirm-dialog.js.map +1 -1
- package/dist/core/components/control.d.ts +13 -0
- package/dist/core/components/control.js +27 -0
- package/dist/core/components/control.js.map +1 -0
- package/dist/core/components/dialog.d.ts +19 -0
- package/dist/core/components/dialog.js +75 -0
- package/dist/core/components/dialog.js.map +1 -0
- package/dist/core/components/dropdown-menu.d.ts +14 -0
- package/dist/core/components/dropdown-menu.js +42 -0
- package/dist/core/components/dropdown-menu.js.map +1 -0
- package/dist/core/components/floating-panel.d.ts +3 -0
- package/dist/core/components/floating-panel.js +65 -0
- package/dist/core/components/floating-panel.js.map +1 -0
- package/dist/core/components/fragment.d.ts +1 -10
- package/dist/core/components/fragment.js +29 -18
- package/dist/core/components/fragment.js.map +1 -1
- package/dist/core/components/grid.d.ts +1 -8
- package/dist/core/components/grid.js +1 -2
- package/dist/core/components/grid.js.map +1 -1
- package/dist/core/components/heading.d.ts +1 -9
- package/dist/core/components/heading.js +2 -3
- package/dist/core/components/heading.js.map +1 -1
- package/dist/core/components/icon.d.ts +3 -0
- package/dist/core/components/icon.js +31 -0
- package/dist/core/components/icon.js.map +1 -0
- package/dist/core/components/index.d.ts +1 -1
- package/dist/core/components/index.js +12 -1
- package/dist/core/components/index.js.map +1 -1
- package/dist/core/components/info-tooltip.d.ts +3 -0
- package/dist/core/components/info-tooltip.js +26 -0
- package/dist/core/components/info-tooltip.js.map +1 -0
- package/dist/core/components/link.d.ts +1 -12
- package/dist/core/components/link.js +12 -11
- package/dist/core/components/link.js.map +1 -1
- package/dist/core/components/modal.d.ts +1 -11
- package/dist/core/components/modal.js +16 -42
- package/dist/core/components/modal.js.map +1 -1
- package/dist/core/components/popover.d.ts +8 -0
- package/dist/core/components/popover.js +37 -0
- package/dist/core/components/popover.js.map +1 -0
- package/dist/core/components/raw-block.d.ts +3 -0
- package/dist/core/components/raw-block.js +10 -0
- package/dist/core/components/raw-block.js.map +1 -0
- package/dist/core/components/section.d.ts +3 -0
- package/dist/core/components/section.js +75 -0
- package/dist/core/components/section.js.map +1 -0
- package/dist/core/components/segmented-control.d.ts +1 -14
- package/dist/core/components/segmented-control.js +4 -7
- package/dist/core/components/segmented-control.js.map +1 -1
- package/dist/core/components/segmented-pills.d.ts +4 -2
- package/dist/core/components/segmented-pills.js +10 -1
- package/dist/core/components/segmented-pills.js.map +1 -1
- package/dist/core/components/skeleton.d.ts +3 -0
- package/dist/core/components/skeleton.js +16 -0
- package/dist/core/components/skeleton.js.map +1 -0
- package/dist/core/components/spinner.js +8 -4
- package/dist/core/components/spinner.js.map +1 -1
- package/dist/core/components/stack.d.ts +1 -11
- package/dist/core/components/stack.js +24 -13
- package/dist/core/components/stack.js.map +1 -1
- package/dist/core/components/tabs.d.ts +1 -19
- package/dist/core/components/tabs.js +45 -21
- package/dist/core/components/tabs.js.map +1 -1
- package/dist/core/components/text.d.ts +1 -9
- package/dist/core/components/text.js +18 -3
- package/dist/core/components/text.js.map +1 -1
- package/dist/core/headers.d.ts +1 -0
- package/dist/core/headers.js +14 -0
- package/dist/core/headers.js.map +1 -0
- package/dist/core/registry-context.d.ts +21 -0
- package/dist/core/registry-context.js +40 -0
- package/dist/core/registry-context.js.map +1 -0
- package/dist/core/registry.d.ts +12 -3
- package/dist/core/registry.js +30 -5
- package/dist/core/registry.js.map +1 -1
- package/dist/core/renderer.d.ts +8 -14
- package/dist/core/renderer.js +20 -36
- package/dist/core/renderer.js.map +1 -1
- package/dist/core/test-id.d.ts +8 -0
- package/dist/core/test-id.js +21 -0
- package/dist/core/test-id.js.map +1 -0
- package/dist/core/types.d.ts +68 -26
- package/dist/core/use-column-resizing.d.ts +27 -0
- package/dist/core/use-column-resizing.js +228 -0
- package/dist/core/use-column-resizing.js.map +1 -0
- package/dist/effects/dispatch.d.ts +20 -0
- package/dist/effects/dispatch.js +39 -0
- package/dist/effects/dispatch.js.map +1 -0
- package/dist/effects/registry.d.ts +38 -0
- package/dist/effects/registry.js +51 -0
- package/dist/effects/registry.js.map +1 -0
- package/dist/effects/use-effect-dispatcher.d.ts +8 -0
- package/dist/effects/use-effect-dispatcher.js +20 -0
- package/dist/effects/use-effect-dispatcher.js.map +1 -0
- package/dist/effects/use-flash-effects.d.ts +5 -0
- package/dist/effects/use-flash-effects.js +22 -0
- package/dist/effects/use-flash-effects.js.map +1 -0
- package/dist/events/event-bridge.d.ts +3 -7
- package/dist/events/event-bridge.js +17 -47
- package/dist/events/event-bridge.js.map +1 -1
- package/dist/events/event-names.d.ts +3 -1
- package/dist/events/event-names.js +3 -1
- package/dist/events/event-names.js.map +1 -1
- package/dist/form/components/base/field.d.ts +3 -1
- package/dist/form/components/base/field.js +21 -2
- package/dist/form/components/base/field.js.map +1 -1
- package/dist/form/components/base/input-error.js +1 -1
- package/dist/form/components/base/input-error.js.map +1 -1
- package/dist/form/components/base/input.js +2 -1
- package/dist/form/components/base/input.js.map +1 -1
- package/dist/form/components/base/label.js.map +1 -1
- package/dist/form/components/base/password-input.js +9 -2
- package/dist/form/components/base/password-input.js.map +1 -1
- package/dist/form/components/base/submit-button.d.ts +4 -4
- package/dist/form/components/base/submit-button.js +5 -3
- package/dist/form/components/base/submit-button.js.map +1 -1
- package/dist/form/components/base/textarea.js +2 -1
- package/dist/form/components/base/textarea.js.map +1 -1
- package/dist/form/components/conditions.d.ts +6 -9
- package/dist/form/components/conditions.js +10 -2
- package/dist/form/components/conditions.js.map +1 -1
- package/dist/form/components/context.d.ts +1 -4
- package/dist/form/components/context.js +2 -5
- package/dist/form/components/context.js.map +1 -1
- package/dist/form/components/field-props.d.ts +28 -0
- package/dist/form/components/field-props.js +15 -0
- package/dist/form/components/field-props.js.map +1 -0
- package/dist/form/components/field-scope.d.ts +21 -0
- package/dist/form/components/field-scope.js +54 -0
- package/dist/form/components/field-scope.js.map +1 -0
- package/dist/form/components/fields/block-add-menu.d.ts +9 -0
- package/dist/form/components/fields/block-add-menu.js +27 -0
- package/dist/form/components/fields/block-add-menu.js.map +1 -0
- package/dist/form/components/fields/builder.d.ts +2 -0
- package/dist/form/components/fields/builder.js +124 -0
- package/dist/form/components/fields/builder.js.map +1 -0
- package/dist/form/components/fields/checkbox.d.ts +2 -16
- package/dist/form/components/fields/checkbox.js +28 -30
- package/dist/form/components/fields/checkbox.js.map +1 -1
- package/dist/form/components/fields/choice.d.ts +2 -14
- package/dist/form/components/fields/choice.js +14 -20
- package/dist/form/components/fields/choice.js.map +1 -1
- package/dist/form/components/fields/date-input.d.ts +2 -20
- package/dist/form/components/fields/date-input.js +12 -16
- package/dist/form/components/fields/date-input.js.map +1 -1
- package/dist/form/components/fields/file-upload.d.ts +2 -0
- package/dist/form/components/fields/file-upload.js +250 -0
- package/dist/form/components/fields/file-upload.js.map +1 -0
- package/dist/form/components/fields/hidden-input.d.ts +2 -10
- package/dist/form/components/fields/hidden-input.js +11 -6
- package/dist/form/components/fields/hidden-input.js.map +1 -1
- package/dist/form/components/fields/number-input.d.ts +2 -23
- package/dist/form/components/fields/number-input.js +40 -41
- package/dist/form/components/fields/number-input.js.map +1 -1
- package/dist/form/components/fields/password-input.d.ts +2 -29
- package/dist/form/components/fields/password-input.js +41 -41
- package/dist/form/components/fields/password-input.js.map +1 -1
- package/dist/form/components/fields/repeater-rows.d.ts +12 -0
- package/dist/form/components/fields/repeater-rows.js +46 -0
- package/dist/form/components/fields/repeater-rows.js.map +1 -0
- package/dist/form/components/fields/repeater.d.ts +2 -0
- package/dist/form/components/fields/repeater.js +97 -0
- package/dist/form/components/fields/repeater.js.map +1 -0
- package/dist/form/components/fields/rich-editor.d.ts +2 -17
- package/dist/form/components/fields/rich-editor.js +90 -52
- package/dist/form/components/fields/rich-editor.js.map +1 -1
- package/dist/form/components/fields/row-action-menu.d.ts +17 -0
- package/dist/form/components/fields/row-action-menu.js +61 -0
- package/dist/form/components/fields/row-action-menu.js.map +1 -0
- package/dist/form/components/fields/row-actions.d.ts +10 -0
- package/dist/form/components/fields/row-actions.js +45 -0
- package/dist/form/components/fields/row-actions.js.map +1 -0
- package/dist/form/components/fields/row-item.d.ts +27 -0
- package/dist/form/components/fields/row-item.js +69 -0
- package/dist/form/components/fields/row-item.js.map +1 -0
- package/dist/form/components/fields/select.d.ts +2 -23
- package/dist/form/components/fields/select.js +97 -121
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/simple-field.d.ts +9 -0
- package/dist/form/components/fields/simple-field.js +23 -0
- package/dist/form/components/fields/simple-field.js.map +1 -0
- package/dist/form/components/fields/table-rows.d.ts +32 -0
- package/dist/form/components/fields/table-rows.js +188 -0
- package/dist/form/components/fields/table-rows.js.map +1 -0
- package/dist/form/components/fields/text-input.d.ts +2 -21
- package/dist/form/components/fields/text-input.js +13 -17
- package/dist/form/components/fields/text-input.js.map +1 -1
- package/dist/form/components/fields/textarea.d.ts +2 -20
- package/dist/form/components/fields/textarea.js +12 -16
- package/dist/form/components/fields/textarea.js.map +1 -1
- package/dist/form/components/fields/use-flip-reorder.d.ts +6 -0
- package/dist/form/components/fields/use-flip-reorder.js +51 -0
- package/dist/form/components/fields/use-flip-reorder.js.map +1 -0
- package/dist/form/components/fields/use-row-collection.d.ts +11 -0
- package/dist/form/components/fields/use-row-collection.js +44 -0
- package/dist/form/components/fields/use-row-collection.js.map +1 -0
- package/dist/form/components/form-path.d.ts +5 -0
- package/dist/form/components/form-path.js +40 -0
- package/dist/form/components/form-path.js.map +1 -0
- package/dist/form/components/form-transport.d.ts +3 -4
- package/dist/form/components/form-transport.js +17 -18
- package/dist/form/components/form-transport.js.map +1 -1
- package/dist/form/components/form.d.ts +1 -20
- package/dist/form/components/form.js +47 -48
- package/dist/form/components/form.js.map +1 -1
- package/dist/form/components/index.d.ts +3 -1
- package/dist/form/components/index.js +4 -2
- package/dist/form/components/override-keys.d.ts +2 -0
- package/dist/form/components/override-keys.js +12 -0
- package/dist/form/components/override-keys.js.map +1 -0
- package/dist/form/components/prefill-context.d.ts +5 -0
- package/dist/form/components/prefill-context.js +11 -0
- package/dist/form/components/prefill-context.js.map +1 -0
- package/dist/form/components/prefill-targets.d.ts +17 -0
- package/dist/form/components/prefill-targets.js +73 -0
- package/dist/form/components/prefill-targets.js.map +1 -0
- package/dist/form/components/resolved-nodes.d.ts +1 -1
- package/dist/form/components/resolved-nodes.js +6 -3
- package/dist/form/components/resolved-nodes.js.map +1 -1
- package/dist/form/components/row-layout-context.d.ts +5 -0
- package/dist/form/components/row-layout-context.js +18 -0
- package/dist/form/components/row-layout-context.js.map +1 -0
- package/dist/form/components/types.d.ts +1 -0
- package/dist/form/components/use-controlled-field.d.ts +5 -9
- package/dist/form/components/use-controlled-field.js +17 -13
- package/dist/form/components/use-controlled-field.js.map +1 -1
- package/dist/form/components/use-dependent-field.d.ts +1 -1
- package/dist/form/components/use-dependent-field.js +14 -8
- package/dist/form/components/use-dependent-field.js.map +1 -1
- package/dist/form/components/use-field-commit.d.ts +4 -0
- package/dist/form/components/use-field-commit.js +21 -7
- package/dist/form/components/use-field-commit.js.map +1 -1
- package/dist/form/components/use-form-resolver.d.ts +7 -2
- package/dist/form/components/use-form-resolver.js +57 -17
- package/dist/form/components/use-form-resolver.js.map +1 -1
- package/dist/form/components/use-seed-default.d.ts +5 -0
- package/dist/form/components/use-seed-default.js +28 -0
- package/dist/form/components/use-seed-default.js.map +1 -0
- package/dist/form/components/values.js +20 -5
- package/dist/form/components/values.js.map +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +13 -11
- package/dist/form/index.js.map +1 -1
- package/dist/form/skeleton.d.ts +1 -1
- package/dist/form/skeleton.js +5 -4
- package/dist/form/skeleton.js.map +1 -1
- package/dist/i18n/backend.d.ts +26 -0
- package/dist/i18n/backend.js +54 -0
- package/dist/i18n/backend.js.map +1 -0
- package/dist/i18n/config.d.ts +6 -0
- package/dist/i18n/config.js +36 -0
- package/dist/i18n/config.js.map +1 -0
- package/dist/i18n/index.d.ts +9 -0
- package/dist/i18n/index.js +7 -0
- package/dist/i18n/instance.d.ts +27 -0
- package/dist/i18n/instance.js +95 -0
- package/dist/i18n/instance.js.map +1 -0
- package/dist/i18n/locale-reload.d.ts +3 -0
- package/dist/i18n/locale-reload.js +17 -0
- package/dist/i18n/locale-reload.js.map +1 -0
- package/dist/i18n/locale-switcher.d.ts +21 -0
- package/dist/i18n/locale-switcher.js +25 -0
- package/dist/i18n/locale-switcher.js.map +1 -0
- package/dist/i18n/locale.d.ts +9 -0
- package/dist/i18n/locale.js +93 -0
- package/dist/i18n/locale.js.map +1 -0
- package/dist/i18n/page-props.d.ts +3 -0
- package/dist/i18n/page-props.js +24 -0
- package/dist/i18n/page-props.js.map +1 -0
- package/dist/icons/icon-renderer.js +30 -5
- package/dist/icons/icon-renderer.js.map +1 -1
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -1
- package/dist/icons/sprite.d.ts +30 -0
- package/dist/icons/sprite.js +40 -0
- package/dist/icons/sprite.js.map +1 -0
- package/dist/index.d.ts +23 -9
- package/dist/index.js +22 -7
- package/dist/inertia.d.ts +3 -7
- package/dist/inertia.js +13 -10
- package/dist/inertia.js.map +1 -1
- package/dist/lattice.css +172 -15
- package/dist/layout/breadcrumbs.d.ts +3 -0
- package/dist/layout/breadcrumbs.js +34 -0
- package/dist/layout/breadcrumbs.js.map +1 -0
- package/dist/layout/callouts.d.ts +3 -0
- package/dist/layout/callouts.js +67 -0
- package/dist/layout/callouts.js.map +1 -0
- package/dist/layout/components.d.ts +1 -0
- package/dist/layout/components.js +25 -0
- package/dist/layout/components.js.map +1 -0
- package/dist/layout/context.d.ts +4 -0
- package/dist/layout/context.js +8 -0
- package/dist/layout/context.js.map +1 -0
- package/dist/layout/dropdown.d.ts +3 -0
- package/dist/layout/dropdown.js +23 -0
- package/dist/layout/dropdown.js.map +1 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +6 -0
- package/dist/layout/menu-item.d.ts +3 -0
- package/dist/layout/menu-item.js +101 -0
- package/dist/layout/menu-item.js.map +1 -0
- package/dist/layout/menu.d.ts +3 -0
- package/dist/layout/menu.js +13 -0
- package/dist/layout/menu.js.map +1 -0
- package/dist/layout/outlet.d.ts +6 -0
- package/dist/layout/outlet.js +14 -0
- package/dist/layout/outlet.js.map +1 -0
- package/dist/layout/popover.d.ts +17 -0
- package/dist/layout/popover.js +46 -0
- package/dist/layout/popover.js.map +1 -0
- package/dist/layout/schema-layout.d.ts +10 -0
- package/dist/layout/schema-layout.js +23 -0
- package/dist/layout/schema-layout.js.map +1 -0
- package/dist/layout/sidebar.d.ts +3 -0
- package/dist/layout/sidebar.js +48 -0
- package/dist/layout/sidebar.js.map +1 -0
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +1 -4
- package/dist/lib/utils.js.map +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/page.js +4 -10
- package/dist/page.js.map +1 -1
- package/dist/provider.d.ts +7 -4
- package/dist/provider.js +15 -11
- package/dist/provider.js.map +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +3 -1
- package/dist/registry.js.map +1 -1
- package/dist/svg-sprite-client/index.d.ts +1 -0
- package/dist/svg-sprite-client/index.js +0 -0
- package/dist/svg-sprite-client.d.ts +1 -0
- package/dist/table/align.d.ts +4 -0
- package/dist/table/align.js +23 -0
- package/dist/table/align.js.map +1 -0
- package/dist/table/bulk.d.ts +6 -10
- package/dist/table/bulk.js +13 -35
- package/dist/table/bulk.js.map +1 -1
- package/dist/table/components/bulk-bar.js +40 -6
- package/dist/table/components/bulk-bar.js.map +1 -1
- package/dist/table/components/cells/badge-cell.d.ts +2 -0
- package/dist/table/components/cells/badge-cell.js +16 -0
- package/dist/table/components/cells/badge-cell.js.map +1 -0
- package/dist/table/components/cells/boolean-cell.d.ts +3 -0
- package/dist/table/components/cells/boolean-cell.js +23 -0
- package/dist/table/components/cells/boolean-cell.js.map +1 -0
- package/dist/table/components/cells/icon-cell.d.ts +2 -0
- package/dist/table/components/cells/icon-cell.js +21 -0
- package/dist/table/components/cells/icon-cell.js.map +1 -0
- package/dist/table/components/cells/image-cell.d.ts +2 -0
- package/dist/table/components/cells/image-cell.js +23 -0
- package/dist/table/components/cells/image-cell.js.map +1 -0
- package/dist/table/components/cells/money-cell.d.ts +2 -0
- package/dist/table/components/cells/money-cell.js +28 -0
- package/dist/table/components/cells/money-cell.js.map +1 -0
- package/dist/table/components/cells/number-cell.d.ts +2 -0
- package/dist/table/components/cells/number-cell.js +25 -0
- package/dist/table/components/cells/number-cell.js.map +1 -0
- package/dist/table/components/cells/numeric.d.ts +2 -0
- package/dist/table/components/cells/numeric.js +10 -0
- package/dist/table/components/cells/numeric.js.map +1 -0
- package/dist/table/components/cells/stack-cell.d.ts +3 -0
- package/dist/table/components/cells/stack-cell.js +17 -0
- package/dist/table/components/cells/stack-cell.js.map +1 -0
- package/dist/table/components/cells/text-cell.d.ts +2 -0
- package/dist/table/components/cells/text-cell.js +49 -0
- package/dist/table/components/cells/text-cell.js.map +1 -0
- package/dist/table/components/column-filter-control.d.ts +3 -1
- package/dist/table/components/column-filter-control.js +125 -100
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/column-header.d.ts +3 -1
- package/dist/table/components/column-header.js +28 -14
- package/dist/table/components/column-header.js.map +1 -1
- package/dist/table/components/filter-bar.d.ts +15 -0
- package/dist/table/components/filter-bar.js +81 -0
- package/dist/table/components/filter-bar.js.map +1 -0
- package/dist/table/components/filter-controls.d.ts +18 -0
- package/dist/table/components/filter-controls.js +256 -0
- package/dist/table/components/filter-controls.js.map +1 -0
- package/dist/table/components/filter-stack-bar.d.ts +2 -2
- package/dist/table/components/filter-stack-bar.js +10 -8
- package/dist/table/components/filter-stack-bar.js.map +1 -1
- package/dist/table/components/filter-value-input.d.ts +6 -3
- package/dist/table/components/filter-value-input.js +27 -17
- package/dist/table/components/filter-value-input.js.map +1 -1
- package/dist/table/components/pagination.d.ts +1 -1
- package/dist/table/components/pagination.js +20 -8
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/components/sort-bar.d.ts +2 -2
- package/dist/table/components/sort-bar.js +12 -10
- package/dist/table/components/sort-bar.js.map +1 -1
- package/dist/table/components/table-action-node.d.ts +1 -1
- package/dist/table/components/table-action-node.js +1 -1
- package/dist/table/components/table-action-node.js.map +1 -1
- package/dist/table/components/table-cell.js +23 -52
- package/dist/table/components/table-cell.js.map +1 -1
- package/dist/table/components/table.d.ts +6 -2
- package/dist/table/components/table.js +198 -136
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/filter-values.d.ts +13 -0
- package/dist/table/filter-values.js +30 -0
- package/dist/table/filter-values.js.map +1 -0
- package/dist/table/format.js +5 -3
- package/dist/table/format.js.map +1 -1
- package/dist/table/index.d.ts +1 -1
- package/dist/table/index.js.map +1 -1
- package/dist/table/payload.d.ts +1 -1
- package/dist/table/payload.js +24 -3
- package/dist/table/payload.js.map +1 -1
- package/dist/table/query.d.ts +10 -2
- package/dist/table/query.js +64 -11
- package/dist/table/query.js.map +1 -1
- package/dist/table/registry.d.ts +19 -0
- package/dist/table/registry.js +14 -0
- package/dist/table/registry.js.map +1 -0
- package/dist/table/types.d.ts +43 -57
- package/dist/table/use-table.d.ts +9 -5
- package/dist/table/use-table.js +66 -27
- package/dist/table/use-table.js.map +1 -1
- package/dist/toast/callout.d.ts +6 -0
- package/dist/toast/callout.js +31 -0
- package/dist/toast/callout.js.map +1 -0
- package/dist/toast/index.d.ts +5 -0
- package/dist/toast/index.js +4 -0
- package/dist/toast/toast.d.ts +14 -0
- package/dist/toast/toast.js +51 -0
- package/dist/toast/toast.js.map +1 -0
- package/dist/toast/toaster.d.ts +3 -0
- package/dist/toast/toaster.js +62 -0
- package/dist/toast/toaster.js.map +1 -0
- package/dist/toast/variant-styles.d.ts +6 -0
- package/dist/toast/variant-styles.js +37 -0
- package/dist/toast/variant-styles.js.map +1 -0
- package/dist/types/generated.d.ts +1037 -0
- package/dist/types/generated.js +0 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/vite-env.d.ts +1 -0
- package/dist/vite.d.ts +25 -0
- package/dist/vite.js +72 -0
- package/dist/vite.js.map +1 -0
- package/package.json +125 -12
- package/resources/icons/align-center.svg +17 -0
- package/resources/icons/align-justify.svg +17 -0
- package/resources/icons/align-left.svg +17 -0
- package/resources/icons/align-right.svg +17 -0
- package/resources/icons/arrow-down.svg +16 -0
- package/resources/icons/arrow-up.svg +16 -0
- package/resources/icons/bold.svg +15 -0
- package/resources/icons/check.svg +15 -0
- package/resources/icons/chevron-down.svg +15 -0
- package/resources/icons/chevron-right.svg +15 -0
- package/resources/icons/chevrons-up-down.svg +16 -0
- package/resources/icons/circle-alert.svg +17 -0
- package/resources/icons/circle-check.svg +16 -0
- package/resources/icons/circle-help.svg +17 -0
- package/resources/icons/circle-x.svg +17 -0
- package/resources/icons/code.svg +16 -0
- package/resources/icons/columns-3.svg +17 -0
- package/resources/icons/copy.svg +16 -0
- package/resources/icons/external-link.svg +17 -0
- package/resources/icons/eye-off.svg +18 -0
- package/resources/icons/eye.svg +16 -0
- package/resources/icons/filter.svg +15 -0
- package/resources/icons/heading-1.svg +18 -0
- package/resources/icons/heading-2.svg +18 -0
- package/resources/icons/heading-3.svg +19 -0
- package/resources/icons/highlighter.svg +16 -0
- package/resources/icons/info.svg +17 -0
- package/resources/icons/italic.svg +17 -0
- package/resources/icons/layout-dashboard.svg +18 -0
- package/resources/icons/link.svg +16 -0
- package/resources/icons/list-ordered.svg +20 -0
- package/resources/icons/list.svg +20 -0
- package/resources/icons/loader-2.svg +15 -0
- package/resources/icons/minus.svg +15 -0
- package/resources/icons/more-horizontal.svg +17 -0
- package/resources/icons/panel-left.svg +16 -0
- package/resources/icons/pencil-line.svg +17 -0
- package/resources/icons/pencil.svg +16 -0
- package/resources/icons/plus.svg +16 -0
- package/resources/icons/quote.svg +16 -0
- package/resources/icons/rotate-ccw.svg +16 -0
- package/resources/icons/rows-3.svg +17 -0
- package/resources/icons/search.svg +16 -0
- package/resources/icons/send.svg +16 -0
- package/resources/icons/settings.svg +16 -0
- package/resources/icons/smile.svg +18 -0
- package/resources/icons/strikethrough.svg +17 -0
- package/resources/icons/table.svg +18 -0
- package/resources/icons/trash-2.svg +19 -0
- package/resources/icons/underline.svg +16 -0
- package/resources/icons/x.svg +16 -0
- package/dist/action/effects.d.ts +0 -30
- package/dist/action/effects.js +0 -44
- package/dist/action/effects.js.map +0 -1
- package/dist/core/props.d.ts +0 -14
- package/dist/core/props.js +0 -30
- package/dist/core/props.js.map +0 -1
- package/dist/form/components/base/checkbox.js.map +0 -1
- package/dist/form/components/fields/submit-button.d.ts +0 -10
- package/dist/form/components/fields/submit-button.js +0 -14
- package/dist/form/components/fields/submit-button.js.map +0 -1
- package/dist/generated/types.d.ts +0 -17
- package/dist/icons/default-icons.d.ts +0 -3
- package/dist/icons/default-icons.js +0 -44
- package/dist/icons/default-icons.js.map +0 -1
- package/dist/icons/dynamic-lucide-renderer.d.ts +0 -2
- package/dist/icons/dynamic-lucide-renderer.js +0 -18
- package/dist/icons/dynamic-lucide-renderer.js.map +0 -1
- package/dist/menu/index.d.ts +0 -1
- package/dist/menu/index.js +0 -2
- package/dist/menu/use-menu.d.ts +0 -2
- package/dist/menu/use-menu.js +0 -9
- package/dist/menu/use-menu.js.map +0 -1
- /package/dist/{generated → chat}/types.js +0 -0
- /package/dist/{form/components/base → core/components}/checkbox.d.ts +0 -0
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { testIdentity } from "../../../core/test-id.js";
|
|
2
2
|
import { useFormContext } from "../context.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useFieldScope } from "../field-scope.js";
|
|
4
4
|
import { FormFieldFrame } from "../base/field.js";
|
|
5
5
|
import { useFieldCommit } from "../use-field-commit.js";
|
|
6
|
+
import { useControlledField } from "../use-controlled-field.js";
|
|
6
7
|
import PasswordInput from "../base/password-input.js";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
//#region resources/js/form/components/fields/password-input.tsx
|
|
9
|
-
function getPasswordConfirmation(props) {
|
|
10
|
-
const value = props?.confirmation;
|
|
11
|
-
if (typeof value !== "object" || value === null) return;
|
|
12
|
-
const confirmation = value;
|
|
13
|
-
return {
|
|
14
|
-
label: typeof confirmation.label === "string" ? confirmation.label : void 0,
|
|
15
|
-
name: typeof confirmation.name === "string" ? confirmation.name : void 0,
|
|
16
|
-
placeholder: typeof confirmation.placeholder === "string" ? confirmation.placeholder : void 0
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
10
|
var PasswordInputComponent = ({ node }) => {
|
|
11
|
+
const props = node.props;
|
|
20
12
|
const { errors } = useFormContext();
|
|
21
|
-
const
|
|
13
|
+
const field = useControlledField(node);
|
|
22
14
|
const { commit } = useFieldCommit();
|
|
23
|
-
const
|
|
24
|
-
const confirmation =
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
};
|
|
15
|
+
const scope = useFieldScope();
|
|
16
|
+
const confirmation = props.confirmation;
|
|
17
|
+
const confirmationLocalName = confirmation?.name ?? `${field.localName}_confirmation`;
|
|
18
|
+
const confirmationName = scope ? scope.scopedName(confirmationLocalName) : confirmationLocalName;
|
|
19
|
+
const confirmationErrorKey = scope ? scope.errorKey(confirmationLocalName) : confirmationLocalName;
|
|
20
|
+
const passwordRules = (props.passwordRules ?? "") || void 0;
|
|
21
|
+
if (field.hidden) return null;
|
|
31
22
|
return /* @__PURE__ */ jsxs("div", {
|
|
32
23
|
className: "grid gap-6",
|
|
33
24
|
children: [/* @__PURE__ */ jsx(FormFieldFrame, {
|
|
34
|
-
error:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
error: field.error,
|
|
26
|
+
helperText: props.helperText ?? void 0,
|
|
27
|
+
tooltip: props.tooltip ?? void 0,
|
|
28
|
+
label: props.label ?? "",
|
|
29
|
+
labelAction: props.labelAction ?? void 0,
|
|
30
|
+
name: field.name,
|
|
31
|
+
required: field.required,
|
|
39
32
|
children: /* @__PURE__ */ jsx(PasswordInput, {
|
|
40
|
-
autoComplete:
|
|
41
|
-
autoFocus:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
name,
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
autoComplete: props.autoComplete ?? "",
|
|
34
|
+
autoFocus: props.autoFocus ?? false,
|
|
35
|
+
"data-test": field.testId,
|
|
36
|
+
disabled: field.disabled,
|
|
37
|
+
id: field.name,
|
|
38
|
+
name: field.name,
|
|
39
|
+
onChange: (event) => {
|
|
40
|
+
field.commit(event.target.value);
|
|
41
|
+
},
|
|
42
|
+
placeholder: props.placeholder ?? "",
|
|
47
43
|
passwordrules: passwordRules,
|
|
48
|
-
readOnly:
|
|
49
|
-
tabIndex:
|
|
44
|
+
readOnly: field.readOnly,
|
|
45
|
+
tabIndex: props.tabIndex ?? void 0,
|
|
46
|
+
value: field.value
|
|
50
47
|
})
|
|
51
48
|
}), confirmation && /* @__PURE__ */ jsx(FormFieldFrame, {
|
|
52
|
-
error: errors[
|
|
49
|
+
error: errors[confirmationErrorKey],
|
|
53
50
|
label: confirmation.label ?? "Confirm password",
|
|
54
51
|
name: confirmationName,
|
|
55
|
-
required,
|
|
52
|
+
required: field.required,
|
|
56
53
|
children: /* @__PURE__ */ jsx(PasswordInput, {
|
|
57
54
|
autoComplete: "new-password",
|
|
58
|
-
|
|
55
|
+
"data-test": testIdentity(confirmationLocalName),
|
|
56
|
+
disabled: field.disabled,
|
|
59
57
|
id: confirmationName,
|
|
60
58
|
name: confirmationName,
|
|
61
|
-
onChange:
|
|
59
|
+
onChange: (event) => {
|
|
60
|
+
commit(confirmationLocalName, event.target.value);
|
|
61
|
+
},
|
|
62
62
|
placeholder: confirmation.placeholder ?? confirmation.label ?? "Confirm password",
|
|
63
63
|
passwordrules: passwordRules,
|
|
64
|
-
readOnly:
|
|
65
|
-
tabIndex:
|
|
64
|
+
readOnly: field.readOnly,
|
|
65
|
+
tabIndex: props.tabIndex ?? void 0
|
|
66
66
|
})
|
|
67
67
|
})]
|
|
68
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-input.js","names":[],"sources":["../../../../resources/js/form/components/fields/password-input.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"password-input.js","names":[],"sources":["../../../../resources/js/form/components/fields/password-input.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { testIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { FormFieldFrame } from \"../base/field\";\nimport PasswordInput from \"../base/password-input\";\nimport { useFieldScope } from \"../field-scope\";\nimport { useControlledField } from \"../use-controlled-field\";\nimport { useFieldCommit } from \"../use-field-commit\";\nimport { useFormContext } from \"../context\";\n\nexport const PasswordInputComponent: RendererComponent<\"field.password-input\"> = ({ node }) => {\n const props = node.props;\n const { errors } = useFormContext();\n const field = useControlledField(node);\n const { commit } = useFieldCommit();\n const scope = useFieldScope();\n const confirmation = props.confirmation;\n const confirmationLocalName = confirmation?.name ?? `${field.localName}_confirmation`;\n const confirmationName = scope ? scope.scopedName(confirmationLocalName) : confirmationLocalName;\n const confirmationErrorKey = scope\n ? scope.errorKey(confirmationLocalName)\n : confirmationLocalName;\n const passwordRules = (props.passwordRules ?? \"\") || undefined;\n\n if (field.hidden) {\n return null;\n }\n\n return (\n <div className=\"grid gap-6\">\n <FormFieldFrame\n error={field.error}\n helperText={props.helperText ?? undefined}\n tooltip={props.tooltip ?? undefined}\n label={props.label ?? \"\"}\n labelAction={props.labelAction ?? undefined}\n name={field.name}\n required={field.required}\n >\n <PasswordInput\n autoComplete={props.autoComplete ?? \"\"}\n autoFocus={props.autoFocus ?? false}\n data-test={field.testId}\n disabled={field.disabled}\n id={field.name}\n name={field.name}\n onChange={(event) => {\n field.commit(event.target.value);\n }}\n placeholder={props.placeholder ?? \"\"}\n passwordrules={passwordRules}\n readOnly={field.readOnly}\n tabIndex={props.tabIndex ?? undefined}\n value={field.value}\n />\n </FormFieldFrame>\n\n {confirmation && (\n <FormFieldFrame\n error={errors[confirmationErrorKey]}\n label={confirmation.label ?? \"Confirm password\"}\n name={confirmationName}\n required={field.required}\n >\n <PasswordInput\n autoComplete=\"new-password\"\n data-test={testIdentity(confirmationLocalName)}\n disabled={field.disabled}\n id={confirmationName}\n name={confirmationName}\n onChange={(event) => {\n commit(confirmationLocalName, event.target.value);\n }}\n placeholder={confirmation.placeholder ?? confirmation.label ?? \"Confirm password\"}\n passwordrules={passwordRules}\n readOnly={field.readOnly}\n tabIndex={props.tabIndex ?? undefined}\n />\n </FormFieldFrame>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AASA,IAAa,0BAAqE,EAAE,WAAW;CAC7F,MAAM,QAAQ,KAAK;CACnB,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,QAAQ,mBAAmB,IAAI;CACrC,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,QAAQ,cAAc;CAC5B,MAAM,eAAe,MAAM;CAC3B,MAAM,wBAAwB,cAAc,QAAQ,GAAG,MAAM,UAAU;CACvE,MAAM,mBAAmB,QAAQ,MAAM,WAAW,qBAAqB,IAAI;CAC3E,MAAM,uBAAuB,QACzB,MAAM,SAAS,qBAAqB,IACpC;CACJ,MAAM,iBAAiB,MAAM,iBAAiB,OAAO,KAAA;CAErD,IAAI,MAAM,QACR,OAAO;CAGT,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,gBAAD;GACE,OAAO,MAAM;GACb,YAAY,MAAM,cAAc,KAAA;GAChC,SAAS,MAAM,WAAW,KAAA;GAC1B,OAAO,MAAM,SAAS;GACtB,aAAa,MAAM,eAAe,KAAA;GAClC,MAAM,MAAM;GACZ,UAAU,MAAM;aAEhB,oBAAC,eAAD;IACE,cAAc,MAAM,gBAAgB;IACpC,WAAW,MAAM,aAAa;IAC9B,aAAW,MAAM;IACjB,UAAU,MAAM;IAChB,IAAI,MAAM;IACV,MAAM,MAAM;IACZ,WAAW,UAAU;KACnB,MAAM,OAAO,MAAM,OAAO,KAAK;IACjC;IACA,aAAa,MAAM,eAAe;IAClC,eAAe;IACf,UAAU,MAAM;IAChB,UAAU,MAAM,YAAY,KAAA;IAC5B,OAAO,MAAM;GACd,CAAA;EACa,CAAA,GAEf,gBACC,oBAAC,gBAAD;GACE,OAAO,OAAO;GACd,OAAO,aAAa,SAAS;GAC7B,MAAM;GACN,UAAU,MAAM;aAEhB,oBAAC,eAAD;IACE,cAAa;IACb,aAAW,aAAa,qBAAqB;IAC7C,UAAU,MAAM;IAChB,IAAI;IACJ,MAAM;IACN,WAAW,UAAU;KACnB,OAAO,uBAAuB,MAAM,OAAO,KAAK;IAClD;IACA,aAAa,aAAa,eAAe,aAAa,SAAS;IAC/D,eAAe;IACf,UAAU,MAAM;IAChB,UAAU,MAAM,YAAY,KAAA;GAC7B,CAAA;EACa,CAAA,CAEf;;AAET"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type RepeaterRow = Record<string, unknown>;
|
|
2
|
+
export declare const ROW_ID_KEY = "__rowId";
|
|
3
|
+
/** Stamp a stable client-only id on a row (no-op if it already has one). */
|
|
4
|
+
export declare function withRowId(row: RepeaterRow): RepeaterRow;
|
|
5
|
+
/** Ensure every row has a stable id; returns the SAME array reference if none were missing. */
|
|
6
|
+
export declare function ensureRowIds(rows: RepeaterRow[]): RepeaterRow[];
|
|
7
|
+
/** Seed the row list from a stored value, falling back to `defaultItems` blank rows. */
|
|
8
|
+
export declare function seedRows(value: unknown, defaultItems: number): RepeaterRow[];
|
|
9
|
+
export declare function addRow(rows: RepeaterRow[]): RepeaterRow[];
|
|
10
|
+
export declare function removeRow(rows: RepeaterRow[], index: number): RepeaterRow[];
|
|
11
|
+
export declare function duplicateRow(rows: RepeaterRow[], index: number): RepeaterRow[];
|
|
12
|
+
export declare function moveRow(rows: RepeaterRow[], from: number, to: number): RepeaterRow[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region resources/js/form/components/fields/repeater-rows.ts
|
|
2
|
+
var ROW_ID_KEY = "__rowId";
|
|
3
|
+
var rowIdCounter = 0;
|
|
4
|
+
/** Stamp a stable client-only id on a row (no-op if it already has one). */
|
|
5
|
+
function withRowId(row) {
|
|
6
|
+
return row["__rowId"] ? row : {
|
|
7
|
+
...row,
|
|
8
|
+
[ROW_ID_KEY]: `r${rowIdCounter++}`
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** Ensure every row has a stable id; returns the SAME array reference if none were missing. */
|
|
12
|
+
function ensureRowIds(rows) {
|
|
13
|
+
if (rows.every((row) => Boolean(row["__rowId"]))) return rows;
|
|
14
|
+
return rows.map(withRowId);
|
|
15
|
+
}
|
|
16
|
+
/** Seed the row list from a stored value, falling back to `defaultItems` blank rows. */
|
|
17
|
+
function seedRows(value, defaultItems) {
|
|
18
|
+
if (Array.isArray(value) && value.length > 0) return value.map((row) => row && typeof row === "object" ? { ...row } : {});
|
|
19
|
+
return Array.from({ length: Math.max(0, defaultItems) }, () => ({}));
|
|
20
|
+
}
|
|
21
|
+
function addRow(rows) {
|
|
22
|
+
return [...rows, {}];
|
|
23
|
+
}
|
|
24
|
+
function removeRow(rows, index) {
|
|
25
|
+
return rows.filter((_, i) => i !== index);
|
|
26
|
+
}
|
|
27
|
+
function duplicateRow(rows, index) {
|
|
28
|
+
const source = rows[index];
|
|
29
|
+
if (!source) return rows;
|
|
30
|
+
const { [ROW_ID_KEY]: _id, ...copy } = source;
|
|
31
|
+
return [
|
|
32
|
+
...rows.slice(0, index + 1),
|
|
33
|
+
withRowId(copy),
|
|
34
|
+
...rows.slice(index + 1)
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
function moveRow(rows, from, to) {
|
|
38
|
+
const next = [...rows];
|
|
39
|
+
const [moved] = next.splice(from, 1);
|
|
40
|
+
next.splice(to, 0, moved);
|
|
41
|
+
return next;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { ROW_ID_KEY, addRow, duplicateRow, ensureRowIds, moveRow, removeRow, seedRows, withRowId };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=repeater-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeater-rows.js","names":[],"sources":["../../../../resources/js/form/components/fields/repeater-rows.ts"],"sourcesContent":["export type RepeaterRow = Record<string, unknown>;\n\nexport const ROW_ID_KEY = \"__rowId\";\n\nlet rowIdCounter = 0;\n\n/** Stamp a stable client-only id on a row (no-op if it already has one). */\nexport function withRowId(row: RepeaterRow): RepeaterRow {\n return row[ROW_ID_KEY] ? row : { ...row, [ROW_ID_KEY]: `r${rowIdCounter++}` };\n}\n\n/** Ensure every row has a stable id; returns the SAME array reference if none were missing. */\nexport function ensureRowIds(rows: RepeaterRow[]): RepeaterRow[] {\n if (rows.every((row) => Boolean(row[ROW_ID_KEY]))) {\n return rows;\n }\n return rows.map(withRowId);\n}\n\n/** Seed the row list from a stored value, falling back to `defaultItems` blank rows. */\nexport function seedRows(value: unknown, defaultItems: number): RepeaterRow[] {\n if (Array.isArray(value) && value.length > 0) {\n return value.map((row) => (row && typeof row === \"object\" ? { ...(row as RepeaterRow) } : {}));\n }\n\n return Array.from({ length: Math.max(0, defaultItems) }, () => ({}));\n}\n\nexport function addRow(rows: RepeaterRow[]): RepeaterRow[] {\n return [...rows, {}];\n}\n\nexport function removeRow(rows: RepeaterRow[], index: number): RepeaterRow[] {\n return rows.filter((_, i) => i !== index);\n}\n\nexport function duplicateRow(rows: RepeaterRow[], index: number): RepeaterRow[] {\n const source = rows[index];\n if (!source) {\n return rows;\n }\n\n const { [ROW_ID_KEY]: _id, ...copy } = source;\n return [...rows.slice(0, index + 1), withRowId(copy), ...rows.slice(index + 1)];\n}\n\nexport function moveRow(rows: RepeaterRow[], from: number, to: number): RepeaterRow[] {\n const next = [...rows];\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n return next;\n}\n"],"mappings":";AAEA,IAAa,aAAa;AAE1B,IAAI,eAAe;;AAGnB,SAAgB,UAAU,KAA+B;CACvD,OAAO,IAAA,aAAkB,MAAM;EAAE,GAAG;GAAM,aAAa,IAAI;CAAiB;AAC9E;;AAGA,SAAgB,aAAa,MAAoC;CAC/D,IAAI,KAAK,OAAO,QAAQ,QAAQ,IAAA,UAAe,CAAC,GAC9C,OAAO;CAET,OAAO,KAAK,IAAI,SAAS;AAC3B;;AAGA,SAAgB,SAAS,OAAgB,cAAqC;CAC5E,IAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,GACzC,OAAO,MAAM,KAAK,QAAS,OAAO,OAAO,QAAQ,WAAW,EAAE,GAAI,IAAoB,IAAI,CAAC,CAAE;CAG/F,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,YAAY,EAAE,UAAU,CAAC,EAAE;AACrE;AAEA,SAAgB,OAAO,MAAoC;CACzD,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;AACrB;AAEA,SAAgB,UAAU,MAAqB,OAA8B;CAC3E,OAAO,KAAK,QAAQ,GAAG,MAAM,MAAM,KAAK;AAC1C;AAEA,SAAgB,aAAa,MAAqB,OAA8B;CAC9E,MAAM,SAAS,KAAK;CACpB,IAAI,CAAC,QACH,OAAO;CAGT,MAAM,GAAG,aAAa,KAAK,GAAG,SAAS;CACvC,OAAO;EAAC,GAAG,KAAK,MAAM,GAAG,QAAQ,CAAC;EAAG,UAAU,IAAI;EAAG,GAAG,KAAK,MAAM,QAAQ,CAAC;CAAC;AAChF;AAEA,SAAgB,QAAQ,MAAqB,MAAc,IAA2B;CACpF,MAAM,OAAO,CAAC,GAAG,IAAI;CACrB,MAAM,CAAC,SAAS,KAAK,OAAO,MAAM,CAAC;CACnC,KAAK,OAAO,IAAI,GAAG,KAAK;CACxB,OAAO;AACT"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Icon } from "../../../icons/sprite.js";
|
|
2
|
+
import { useFormContext } from "../context.js";
|
|
3
|
+
import "./repeater-rows.js";
|
|
4
|
+
import { FormFieldFrame } from "../base/field.js";
|
|
5
|
+
import { useDependentField } from "../use-dependent-field.js";
|
|
6
|
+
import { RowItem } from "./row-item.js";
|
|
7
|
+
import { TableRows, columnsFromSchema } from "./table-rows.js";
|
|
8
|
+
import { useFlipReorder } from "./use-flip-reorder.js";
|
|
9
|
+
import { useRowCollection } from "./use-row-collection.js";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region resources/js/form/components/fields/repeater.tsx
|
|
12
|
+
var EMPTY_TEMPLATE = [];
|
|
13
|
+
var RepeaterComponent = ({ node }) => {
|
|
14
|
+
const props = node.props;
|
|
15
|
+
const name = props.name;
|
|
16
|
+
const { errors } = useFormContext();
|
|
17
|
+
const { hidden, required } = useDependentField(node);
|
|
18
|
+
const { path, rows, onField, onRemove, onMove, onDuplicate, append } = useRowCollection(name, props.defaultItems ?? 1);
|
|
19
|
+
const template = node.schema ?? EMPTY_TEMPLATE;
|
|
20
|
+
const registerRow = useFlipReorder(rows.map((r) => String(r["__rowId"] ?? "")).join(","));
|
|
21
|
+
const atMax = props.maxItems != null && rows.length >= props.maxItems;
|
|
22
|
+
const atMin = props.minItems != null && rows.length <= props.minItems;
|
|
23
|
+
const isTable = props.layout === "table";
|
|
24
|
+
const itemLabels = props.itemLabels;
|
|
25
|
+
const rowHeading = (index) => {
|
|
26
|
+
const label = itemLabels?.[index];
|
|
27
|
+
if (typeof label === "string" && label !== "") return label;
|
|
28
|
+
return props.itemLabel ? `${props.itemLabel} ${index + 1}` : `#${index + 1}`;
|
|
29
|
+
};
|
|
30
|
+
if (hidden) return null;
|
|
31
|
+
const tableRows = rows.map((row, index) => ({
|
|
32
|
+
key: String(row["__rowId"] ?? index),
|
|
33
|
+
index,
|
|
34
|
+
row,
|
|
35
|
+
template,
|
|
36
|
+
span: false,
|
|
37
|
+
heading: rowHeading(index)
|
|
38
|
+
}));
|
|
39
|
+
return /* @__PURE__ */ jsx(FormFieldFrame, {
|
|
40
|
+
error: errors[path],
|
|
41
|
+
helperText: props.helperText ?? void 0,
|
|
42
|
+
tooltip: props.tooltip ?? void 0,
|
|
43
|
+
label: props.label ?? "",
|
|
44
|
+
name: path,
|
|
45
|
+
required,
|
|
46
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: "flex flex-col gap-3",
|
|
48
|
+
children: [isTable ? /* @__PURE__ */ jsx(TableRows, {
|
|
49
|
+
base: path,
|
|
50
|
+
columns: columnsFromSchema(template),
|
|
51
|
+
rows: tableRows,
|
|
52
|
+
reorderable: props.reorderable ?? false,
|
|
53
|
+
removable: () => !atMin,
|
|
54
|
+
rowActions: props.rowActions,
|
|
55
|
+
onField,
|
|
56
|
+
onMove,
|
|
57
|
+
onRemove,
|
|
58
|
+
onDuplicate,
|
|
59
|
+
registerRow,
|
|
60
|
+
resizableColumns: props.resizableColumns === true,
|
|
61
|
+
resizeIndicator: props.resizeIndicator === true
|
|
62
|
+
}) : rows.map((row, index) => {
|
|
63
|
+
const key = String(row["__rowId"] ?? index);
|
|
64
|
+
return /* @__PURE__ */ jsx("div", {
|
|
65
|
+
ref: (el) => registerRow(key, el),
|
|
66
|
+
"data-flip-key": key,
|
|
67
|
+
children: /* @__PURE__ */ jsx(RowItem, {
|
|
68
|
+
base: path,
|
|
69
|
+
index,
|
|
70
|
+
row,
|
|
71
|
+
template,
|
|
72
|
+
heading: rowHeading(index),
|
|
73
|
+
reorderable: props.reorderable ?? false,
|
|
74
|
+
isFirst: index === 0,
|
|
75
|
+
isLast: index === rows.length - 1,
|
|
76
|
+
removable: !atMin,
|
|
77
|
+
rowActions: props.rowActions,
|
|
78
|
+
onField,
|
|
79
|
+
onRemove,
|
|
80
|
+
onMove,
|
|
81
|
+
onDuplicate
|
|
82
|
+
})
|
|
83
|
+
}, key);
|
|
84
|
+
}), !atMax && /* @__PURE__ */ jsxs("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
"data-test": `repeater-${name}-add`,
|
|
87
|
+
className: "inline-flex items-center gap-1.5 self-start rounded-lt-sm border border-lt-border px-3 py-1.5 text-sm hover:bg-lt-accent [&_svg]:size-lt-icon-sm",
|
|
88
|
+
onClick: () => append({}),
|
|
89
|
+
children: [/* @__PURE__ */ jsx(Icon, { name: "plus" }), props.addLabel ?? "Add"]
|
|
90
|
+
})]
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { RepeaterComponent };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=repeater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeater.js","names":[],"sources":["../../../../resources/js/form/components/fields/repeater.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport type { Node, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { FormFieldFrame } from \"../base/field\";\nimport { useFormContext } from \"../context\";\nimport { useDependentField } from \"../use-dependent-field\";\nimport { ROW_ID_KEY } from \"./repeater-rows\";\nimport { RowItem } from \"./row-item\";\nimport { columnsFromSchema, TableRows } from \"./table-rows\";\nimport { useFlipReorder } from \"./use-flip-reorder\";\nimport { useRowCollection } from \"./use-row-collection\";\n\nconst EMPTY_TEMPLATE: Node[] = [];\n\nexport const RepeaterComponent: RendererComponent<\"field.repeater\"> = ({ node }) => {\n const props = node.props;\n const name = props.name;\n const { errors } = useFormContext();\n const { hidden, required } = useDependentField(node);\n const { path, rows, onField, onRemove, onMove, onDuplicate, append } = useRowCollection(\n name,\n props.defaultItems ?? 1,\n );\n const template = node.schema ?? EMPTY_TEMPLATE;\n const orderSignature = rows.map((r) => String(r[ROW_ID_KEY] ?? \"\")).join(\",\");\n const registerRow = useFlipReorder(orderSignature);\n const atMax = props.maxItems != null && rows.length >= props.maxItems;\n const atMin = props.minItems != null && rows.length <= props.minItems;\n const isTable = props.layout === \"table\";\n const itemLabels = (props as { itemLabels?: Array<string | null> | null }).itemLabels;\n const rowHeading = (index: number) => {\n const label = itemLabels?.[index];\n\n if (typeof label === \"string\" && label !== \"\") {\n return label;\n }\n\n return props.itemLabel ? `${props.itemLabel} ${index + 1}` : `#${index + 1}`;\n };\n\n if (hidden) {\n return null;\n }\n\n const tableRows = rows.map((row, index) => ({\n key: String(row[ROW_ID_KEY] ?? index),\n index,\n row,\n template,\n span: false,\n heading: rowHeading(index),\n }));\n\n return (\n <FormFieldFrame\n error={errors[path]}\n helperText={props.helperText ?? undefined}\n tooltip={props.tooltip ?? undefined}\n label={props.label ?? \"\"}\n name={path}\n required={required}\n >\n <div className=\"flex flex-col gap-3\">\n {isTable ? (\n <TableRows\n base={path}\n columns={columnsFromSchema(template)}\n rows={tableRows}\n reorderable={props.reorderable ?? false}\n removable={() => !atMin}\n rowActions={props.rowActions}\n onField={onField}\n onMove={onMove}\n onRemove={onRemove}\n onDuplicate={onDuplicate}\n registerRow={registerRow}\n resizableColumns={props.resizableColumns === true}\n resizeIndicator={props.resizeIndicator === true}\n />\n ) : (\n rows.map((row, index) => {\n const key = String(row[ROW_ID_KEY] ?? index);\n return (\n <div key={key} ref={(el) => registerRow(key, el)} data-flip-key={key}>\n <RowItem\n base={path}\n index={index}\n row={row}\n template={template}\n heading={rowHeading(index)}\n reorderable={props.reorderable ?? false}\n isFirst={index === 0}\n isLast={index === rows.length - 1}\n removable={!atMin}\n rowActions={props.rowActions}\n onField={onField}\n onRemove={onRemove}\n onMove={onMove}\n onDuplicate={onDuplicate}\n />\n </div>\n );\n })\n )}\n\n {!atMax && (\n <button\n type=\"button\"\n data-test={`repeater-${name}-add`}\n className=\"inline-flex items-center gap-1.5 self-start rounded-lt-sm border border-lt-border px-3 py-1.5 text-sm hover:bg-lt-accent [&_svg]:size-lt-icon-sm\"\n onClick={() => append({})}\n >\n <Icon name=\"plus\" />\n {props.addLabel ?? \"Add\"}\n </button>\n )}\n </div>\n </FormFieldFrame>\n );\n};\n"],"mappings":";;;;;;;;;;;AAWA,IAAM,iBAAyB,CAAC;AAEhC,IAAa,qBAA0D,EAAE,WAAW;CAClF,MAAM,QAAQ,KAAK;CACnB,MAAM,OAAO,MAAM;CACnB,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,EAAE,QAAQ,aAAa,kBAAkB,IAAI;CACnD,MAAM,EAAE,MAAM,MAAM,SAAS,UAAU,QAAQ,aAAa,WAAW,iBACrE,MACA,MAAM,gBAAgB,CACxB;CACA,MAAM,WAAW,KAAK,UAAU;CAEhC,MAAM,cAAc,eADG,KAAK,KAAK,MAAM,OAAO,EAAA,cAAiB,EAAE,CAAC,EAAE,KAAK,GACtC,CAAc;CACjD,MAAM,QAAQ,MAAM,YAAY,QAAQ,KAAK,UAAU,MAAM;CAC7D,MAAM,QAAQ,MAAM,YAAY,QAAQ,KAAK,UAAU,MAAM;CAC7D,MAAM,UAAU,MAAM,WAAW;CACjC,MAAM,aAAc,MAAuD;CAC3E,MAAM,cAAc,UAAkB;EACpC,MAAM,QAAQ,aAAa;EAE3B,IAAI,OAAO,UAAU,YAAY,UAAU,IACzC,OAAO;EAGT,OAAO,MAAM,YAAY,GAAG,MAAM,UAAU,GAAG,QAAQ,MAAM,IAAI,QAAQ;CAC3E;CAEA,IAAI,QACF,OAAO;CAGT,MAAM,YAAY,KAAK,KAAK,KAAK,WAAW;EAC1C,KAAK,OAAO,IAAA,cAAmB,KAAK;EACpC;EACA;EACA;EACA,MAAM;EACN,SAAS,WAAW,KAAK;CAC3B,EAAE;CAEF,OACE,oBAAC,gBAAD;EACE,OAAO,OAAO;EACd,YAAY,MAAM,cAAc,KAAA;EAChC,SAAS,MAAM,WAAW,KAAA;EAC1B,OAAO,MAAM,SAAS;EACtB,MAAM;EACI;YAEV,qBAAC,OAAD;GAAK,WAAU;aAAf,CACG,UACC,oBAAC,WAAD;IACE,MAAM;IACN,SAAS,kBAAkB,QAAQ;IACnC,MAAM;IACN,aAAa,MAAM,eAAe;IAClC,iBAAiB,CAAC;IAClB,YAAY,MAAM;IACT;IACD;IACE;IACG;IACA;IACb,kBAAkB,MAAM,qBAAqB;IAC7C,iBAAiB,MAAM,oBAAoB;GAC5C,CAAA,IAED,KAAK,KAAK,KAAK,UAAU;IACvB,MAAM,MAAM,OAAO,IAAA,cAAmB,KAAK;IAC3C,OACE,oBAAC,OAAD;KAAe,MAAM,OAAO,YAAY,KAAK,EAAE;KAAG,iBAAe;eAC/D,oBAAC,SAAD;MACE,MAAM;MACC;MACF;MACK;MACV,SAAS,WAAW,KAAK;MACzB,aAAa,MAAM,eAAe;MAClC,SAAS,UAAU;MACnB,QAAQ,UAAU,KAAK,SAAS;MAChC,WAAW,CAAC;MACZ,YAAY,MAAM;MACT;MACC;MACF;MACK;KACd,CAAA;IACE,GAjBK,GAiBL;GAET,CAAC,GAGF,CAAC,SACA,qBAAC,UAAD;IACE,MAAK;IACL,aAAW,YAAY,KAAK;IAC5B,WAAU;IACV,eAAe,OAAO,CAAC,CAAC;cAJ1B,CAME,oBAAC,MAAD,EAAM,MAAK,OAAQ,CAAA,GAClB,MAAM,YAAY,KACb;KAEP;;CACS,CAAA;AAEpB"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import { RendererComponent } from '
|
|
2
|
-
declare
|
|
3
|
-
interface ComponentProps {
|
|
4
|
-
"form.rich-editor": {
|
|
5
|
-
conditions?: unknown;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
hidden?: boolean;
|
|
8
|
-
label?: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
readonly?: boolean;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
value?: unknown;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export declare const RichEditorComponent: RendererComponent<"form.rich-editor">;
|
|
1
|
+
import { RendererComponent } from '../../../core/types';
|
|
2
|
+
export declare const RichEditorComponent: RendererComponent<"field.rich-editor">;
|