@lattice-php/lattice 0.30.0 → 0.31.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/dist/action/components/action-form.js +26 -25
- package/dist/action/components/action-form.js.map +1 -1
- package/dist/action/components/action-group.js.map +1 -1
- package/dist/action/components/action-trigger-provider.js.map +1 -1
- package/dist/action/components/action.js.map +1 -1
- package/dist/action/lib/run-action.js +2 -1
- package/dist/action/lib/run-action.js.map +1 -1
- package/dist/appearance/index.js.map +1 -1
- package/dist/chat/components/chat-box.js +4 -2
- package/dist/chat/components/chat-box.js.map +1 -1
- package/dist/chat/components/message-list.js.map +1 -1
- package/dist/chat/components/message.js.map +1 -1
- package/dist/chat/components/prompt-input.js.map +1 -1
- package/dist/chat/hooks/use-chat.js +2 -1
- package/dist/chat/hooks/use-chat.js.map +1 -1
- package/dist/chat/lib/transport.js.map +1 -1
- package/dist/chat/parts/text.js.map +1 -1
- package/dist/chat/parts/tool-call.js.map +1 -1
- package/dist/core/api.js.map +1 -1
- package/dist/core/event-names.d.ts +1 -0
- package/dist/core/event-names.js +1 -0
- package/dist/core/event-names.js.map +1 -1
- package/dist/core/hooks/column-sizing.js.map +1 -1
- package/dist/core/hooks/use-column-resizing.js.map +1 -1
- package/dist/core/materialize.js.map +1 -1
- package/dist/core/registry-context.js.map +1 -1
- package/dist/core/renderer.js +2 -1
- package/dist/core/renderer.js.map +1 -1
- package/dist/core/test-id.js.map +1 -1
- package/dist/core/upload.js.map +1 -1
- package/dist/create-app.js +1 -1
- package/dist/create-app.js.map +1 -1
- package/dist/effects/registry.js +2 -1
- package/dist/effects/registry.js.map +1 -1
- package/dist/form/components/base/field.js.map +1 -1
- package/dist/form/components/base/submit-button.js.map +1 -1
- package/dist/form/components/fields/add-row-menu.js.map +1 -1
- package/dist/form/components/fields/builder.js +2 -1
- package/dist/form/components/fields/builder.js.map +1 -1
- package/dist/form/components/fields/checkbox.js.map +1 -1
- package/dist/form/components/fields/choice.js.map +1 -1
- package/dist/form/components/fields/color-picker-field.js.map +1 -1
- package/dist/form/components/fields/date-input.js.map +1 -1
- package/dist/form/components/fields/date-picker-field.js.map +1 -1
- package/dist/form/components/fields/date-picker-value.js.map +1 -1
- package/dist/form/components/fields/date-picker.js.map +1 -1
- package/dist/form/components/fields/date-time-input.js.map +1 -1
- package/dist/form/components/fields/file-upload.js +3 -2
- package/dist/form/components/fields/file-upload.js.map +1 -1
- package/dist/form/components/fields/number-input.js.map +1 -1
- package/dist/form/components/fields/otp-input.js.map +1 -1
- package/dist/form/components/fields/password-input.js.map +1 -1
- package/dist/form/components/fields/repeater.js +2 -1
- package/dist/form/components/fields/repeater.js.map +1 -1
- package/dist/form/components/fields/rich-editor-field.js +6 -5
- package/dist/form/components/fields/rich-editor-field.js.map +1 -1
- package/dist/form/components/fields/rich-editor.js.map +1 -1
- package/dist/form/components/fields/row-action-menu.js.map +1 -1
- package/dist/form/components/fields/row-actions.js.map +1 -1
- package/dist/form/components/fields/row-item.js.map +1 -1
- package/dist/form/components/fields/row-templates.js.map +1 -1
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/simple-field.js.map +1 -1
- package/dist/form/components/fields/table-rows.js.map +1 -1
- package/dist/form/components/fields/text-input.js.map +1 -1
- package/dist/form/components/fields/textarea.js.map +1 -1
- package/dist/form/components/fields/time-input.js.map +1 -1
- package/dist/form/components/fields/time-picker-columns.js.map +1 -1
- package/dist/form/components/fields/time-picker.js +0 -1
- package/dist/form/components/fields/time-picker.js.map +1 -1
- package/dist/form/components/fields/toggle.js.map +1 -1
- package/dist/form/components/fields/use-flip-reorder.js.map +1 -1
- package/dist/form/components/form.js +7 -5
- package/dist/form/components/form.js.map +1 -1
- package/dist/form/components/wizard.js +1 -1
- package/dist/form/components/wizard.js.map +1 -1
- package/dist/form/hooks/resolved-nodes.js.map +1 -1
- package/dist/form/hooks/use-dependent-field.js +2 -1
- package/dist/form/hooks/use-dependent-field.js.map +1 -1
- package/dist/form/hooks/use-form-resolver.js +2 -1
- package/dist/form/hooks/use-form-resolver.js.map +1 -1
- package/dist/form/hooks/values.js +2 -1
- package/dist/form/hooks/values.js.map +1 -1
- package/dist/form/lib/conditions.js +1 -1
- package/dist/form/lib/conditions.js.map +1 -1
- package/dist/form/lib/field-dom-name.js.map +1 -1
- package/dist/form/lib/field-props.js +1 -1
- package/dist/form/lib/field-props.js.map +1 -1
- package/dist/form/lib/form-path.js.map +1 -1
- package/dist/form/lib/form-transport.js.map +1 -1
- package/dist/form/lib/prefill-targets.js.map +1 -1
- package/dist/form/lib/wizard-steps.js.map +1 -1
- package/dist/form/rich-editor/builtins.js.map +1 -1
- package/dist/format/date-time.d.ts +1 -0
- package/dist/format/date-time.js +5 -1
- package/dist/format/date-time.js.map +1 -1
- package/dist/format/number.js.map +1 -1
- package/dist/i18n/config.js.map +1 -1
- package/dist/i18n/date-time-formatter.d.ts +13 -0
- package/dist/i18n/date-time-formatter.js +28 -0
- package/dist/i18n/date-time-formatter.js.map +1 -0
- package/dist/i18n/date-time.js +1 -1
- package/dist/i18n/date-time.js.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/instance.js +2 -0
- package/dist/i18n/instance.js.map +1 -1
- package/dist/i18n/locale.js +1 -1
- package/dist/i18n/locale.js.map +1 -1
- package/dist/i18n/timezone.js.map +1 -1
- package/dist/i18n/translatable.js.map +1 -1
- package/dist/icons/icon-renderer.js.map +1 -1
- package/dist/icons/sprite.js.map +1 -1
- package/dist/layout/components/breadcrumbs.js.map +1 -1
- package/dist/layout/components/callouts.d.ts +2 -1
- package/dist/layout/components/callouts.js +6 -2
- package/dist/layout/components/callouts.js.map +1 -1
- package/dist/layout/components/dropdown.js.map +1 -1
- package/dist/layout/components/menu-item.js.map +1 -1
- package/dist/layout/components/menu.js.map +1 -1
- package/dist/layout/components/popover.js.map +1 -1
- package/dist/layout/components/schema-layout.js.map +1 -1
- package/dist/layout/components/sidebar.js.map +1 -1
- package/dist/lib/color.js +1 -1
- package/dist/lib/color.js.map +1 -1
- package/dist/lib/use-media-query.js.map +1 -1
- package/dist/notifications/components/empty-state.js.map +1 -1
- package/dist/notifications/components/notification-item.js.map +1 -1
- package/dist/notifications/components/notification-list.js.map +1 -1
- package/dist/notifications/components/notifications.js.map +1 -1
- package/dist/notifications/store.js.map +1 -1
- package/dist/page.js.map +1 -1
- package/dist/provider-base.js.map +1 -1
- package/dist/realtime/listeners.js.map +1 -1
- package/dist/remote/components/data-list.js.map +1 -1
- package/dist/table/components/bulk-bar.js.map +1 -1
- package/dist/table/components/cells/badge-cell.js.map +1 -1
- package/dist/table/components/cells/boolean-cell.js.map +1 -1
- package/dist/table/components/cells/icon-cell.js.map +1 -1
- package/dist/table/components/cells/numeric-cell.js.map +1 -1
- package/dist/table/components/cells/stack-cell.js.map +1 -1
- package/dist/table/components/cells/text-cell.js.map +1 -1
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/column-header.js.map +1 -1
- package/dist/table/components/column-visibility-menu.js +2 -1
- package/dist/table/components/column-visibility-menu.js.map +1 -1
- package/dist/table/components/filter-bar.js +2 -1
- package/dist/table/components/filter-bar.js.map +1 -1
- package/dist/table/components/filter-controls.js +6 -5
- package/dist/table/components/filter-controls.js.map +1 -1
- package/dist/table/components/filter-value-input.js.map +1 -1
- package/dist/table/components/pagination.d.ts +5 -1
- package/dist/table/components/pagination.js +25 -6
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/components/sort-bar.js.map +1 -1
- package/dist/table/components/table-cell.js +2 -1
- package/dist/table/components/table-cell.js.map +1 -1
- package/dist/table/components/table-search.js.map +1 -1
- package/dist/table/components/table.js +6 -2
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/hooks/use-column-visibility.js.map +1 -1
- package/dist/table/hooks/use-table-selection.js +2 -1
- package/dist/table/hooks/use-table-selection.js.map +1 -1
- package/dist/table/hooks/use-table.d.ts +2 -0
- package/dist/table/hooks/use-table.js +12 -0
- package/dist/table/hooks/use-table.js.map +1 -1
- package/dist/table/lib/bulk.js.map +1 -1
- package/dist/table/lib/filter-values.js.map +1 -1
- package/dist/table/lib/format.js.map +1 -1
- package/dist/table/lib/payload.d.ts +2 -0
- package/dist/table/lib/payload.js +18 -3
- package/dist/table/lib/payload.js.map +1 -1
- package/dist/table/lib/query.js +2 -1
- package/dist/table/lib/query.js.map +1 -1
- package/dist/toast/callout.d.ts +1 -0
- package/dist/toast/callout.js +9 -1
- package/dist/toast/callout.js.map +1 -1
- package/dist/toast/index.d.ts +1 -1
- package/dist/toast/index.js +2 -2
- package/dist/toast/toaster.js.map +1 -1
- package/dist/types/generated.d.ts +9 -1
- package/dist/ui/affix-group.js.map +1 -1
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/chart-view.js.map +1 -1
- package/dist/ui/chart.js.map +1 -1
- package/dist/ui/checkbox.js.map +1 -1
- package/dist/ui/collapsible.js.map +1 -1
- package/dist/ui/color-picker.js.map +1 -1
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/confirm-dialog.js.map +1 -1
- package/dist/ui/copyable-text.js.map +1 -1
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/fragment.js +2 -1
- package/dist/ui/fragment.js.map +1 -1
- package/dist/ui/heading.js.map +1 -1
- package/dist/ui/icon-button.js.map +1 -1
- package/dist/ui/icon.js.map +1 -1
- package/dist/ui/image-preview.js.map +1 -1
- package/dist/ui/info-tooltip.js.map +1 -1
- package/dist/ui/input-error.js.map +1 -1
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/link.js.map +1 -1
- package/dist/ui/modal.js.map +1 -1
- package/dist/ui/password-input.js.map +1 -1
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/section.js +4 -2
- package/dist/ui/section.js.map +1 -1
- package/dist/ui/segmented-control.js.map +1 -1
- package/dist/ui/segmented-pills.js.map +1 -1
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/text.js.map +1 -1
- package/dist/ui/tooltip.js.map +1 -1
- package/dist/vite-typescript-refresh.js.map +1 -1
- package/dist/vite.js.map +1 -1
- package/dist-standalone/chunks/chart-view-ZCTbih8A.js +59 -0
- package/dist-standalone/chunks/date-picker-field-CCnkf4SC.js +1 -0
- package/dist-standalone/chunks/dist-CK9gk4iB.js +1 -0
- package/dist-standalone/chunks/dist-DqlcM-vw.js +2 -0
- package/dist-standalone/chunks/icon-button-DcP25cn4.js +41 -0
- package/dist-standalone/chunks/instance-t58Awajh.js +1 -0
- package/dist-standalone/chunks/jsx-runtime-CN5ucv1d.js +1 -0
- package/dist-standalone/chunks/locale-CgtcxthU.js +1 -0
- package/dist-standalone/chunks/materialize-CWqnSEHR.js +1 -0
- package/dist-standalone/chunks/{notifications-echo-DsfNc4Ge.js → notifications-echo-uU87iJAV.js} +1 -1
- package/dist-standalone/chunks/number-BvVKQqOG.js +1 -0
- package/dist-standalone/chunks/page-props-B4GewgLI.js +1 -0
- package/dist-standalone/chunks/react-SIfiwpqq.js +1 -0
- package/dist-standalone/chunks/rich-editor-field-BtbU5XFS.js +158 -0
- package/dist-standalone/chunks/shared-props-B_wT1GcG.js +1 -0
- package/dist-standalone/chunks/subscriptions-BdHDnVA3.js +1 -0
- package/dist-standalone/chunks/time-picker-DSs9fDWe.js +1 -0
- package/dist-standalone/chunks/timezone-BukvzD0d.js +1 -0
- package/dist-standalone/chunks/translatable-DLw4h3x8.js +1 -0
- package/dist-standalone/chunks/use-effect-dispatcher-CiWYRvsF.js +97 -0
- package/dist-standalone/chunks/{with-selector-BwDoCrJJ.js → with-selector-zFUY-tQj.js} +1 -1
- package/dist-standalone/lattice.css +2 -2
- package/dist-standalone/lattice.js +4 -48
- package/dist-standalone/manifest.json +24 -15
- package/dist-standalone/sprite.svg +1 -1
- package/package.json +6 -6
- package/resources/icons/align-center.svg +1 -1
- package/resources/icons/align-justify.svg +1 -1
- package/resources/icons/align-left.svg +1 -1
- package/resources/icons/align-right.svg +1 -1
- package/resources/icons/arrow-down.svg +1 -1
- package/resources/icons/arrow-up.svg +1 -1
- package/resources/icons/bell.svg +1 -1
- package/resources/icons/bold.svg +1 -1
- package/resources/icons/calendar.svg +5 -5
- package/resources/icons/check.svg +1 -1
- package/resources/icons/chevron-down.svg +1 -1
- package/resources/icons/chevron-left.svg +1 -1
- package/resources/icons/chevron-right.svg +1 -1
- package/resources/icons/chevrons-up-down.svg +1 -1
- package/resources/icons/circle-alert.svg +1 -1
- package/resources/icons/circle-check.svg +1 -1
- package/resources/icons/circle-help.svg +1 -1
- package/resources/icons/circle-x.svg +1 -1
- package/resources/icons/clock.svg +1 -1
- package/resources/icons/code-xml.svg +1 -1
- package/resources/icons/code.svg +1 -1
- package/resources/icons/columns-3.svg +1 -1
- package/resources/icons/copy.svg +1 -1
- package/resources/icons/external-link.svg +1 -1
- package/resources/icons/eye-off.svg +1 -1
- package/resources/icons/eye.svg +1 -1
- package/resources/icons/filter.svg +1 -1
- package/resources/icons/heading-1.svg +1 -1
- package/resources/icons/heading-2.svg +1 -1
- package/resources/icons/heading-3.svg +1 -1
- package/resources/icons/heading.svg +1 -1
- package/resources/icons/highlighter.svg +1 -1
- package/resources/icons/info.svg +1 -1
- package/resources/icons/italic.svg +1 -1
- package/resources/icons/layout-dashboard.svg +1 -1
- package/resources/icons/link.svg +1 -1
- package/resources/icons/list-ordered.svg +1 -1
- package/resources/icons/list.svg +1 -1
- package/resources/icons/loader-2.svg +1 -1
- package/resources/icons/minus.svg +1 -1
- package/resources/icons/more-horizontal.svg +1 -1
- package/resources/icons/panel-left.svg +1 -1
- package/resources/icons/pencil-line.svg +1 -1
- package/resources/icons/pencil.svg +1 -1
- package/resources/icons/plus.svg +1 -1
- package/resources/icons/quote.svg +1 -1
- package/resources/icons/rotate-ccw.svg +1 -1
- package/resources/icons/rows-3.svg +1 -1
- package/resources/icons/search.svg +1 -1
- package/resources/icons/send.svg +1 -1
- package/resources/icons/settings.svg +1 -1
- package/resources/icons/smile.svg +1 -1
- package/resources/icons/strikethrough.svg +1 -1
- package/resources/icons/table.svg +1 -1
- package/resources/icons/trash-2.svg +1 -1
- package/resources/icons/underline.svg +1 -1
- package/resources/icons/x.svg +1 -1
- package/dist-standalone/chunks/chart-view-CpYsLvzR.js +0 -36
- package/dist-standalone/chunks/date-picker-field-lX8N40Ii.js +0 -1
- package/dist-standalone/chunks/dist-PaT1gYi_.js +0 -2
- package/dist-standalone/chunks/jsx-runtime-Drll_-DD.js +0 -1
- package/dist-standalone/chunks/locale-CXqr7LPR.js +0 -1
- package/dist-standalone/chunks/page-props-ClpVjpOc.js +0 -1
- package/dist-standalone/chunks/react-B8IZ02wI.js +0 -1
- package/dist-standalone/chunks/rich-editor-field-C71csVJv.js +0 -154
- package/dist-standalone/chunks/subscriptions-B1STcwPE.js +0 -1
- package/dist-standalone/chunks/use-effect-dispatcher-I8So0l_I.js +0 -97
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.js","names":[],"sources":["../../resources/js/ui/icon-button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Icon } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\n/**\n * A compact, resizable icon button — the shared affordance behind toolbar\n * triggers, popover triggers, and inline clear/remove buttons. `ghost` matches\n * `Button emphasis=\"ghost\"` (accent hover) and reacts to `aria-pressed` (toggle)\n * and `data-[state=open]` (a popover trigger). `segmented` joins onto the right\n * of an adjacent input. Size defaults to `sm`; pass `size` to resize.\n */\nconst iconButtonVariants = cva(\n cn(\n \"relative inline-flex shrink-0 items-center justify-center rounded-lt-sm transition-colors\",\n \"outline-none focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50\",\n \"disabled:pointer-events-none disabled:bg-lt-disabled disabled:text-lt-disabled-fg\",\n ),\n {\n variants: {\n emphasis: {\n ghost: cn(\n \"text-lt-muted-fg hover:bg-lt-accent hover:text-lt-accent-fg\",\n \"data-[state=open]:bg-lt-accent data-[state=open]:text-lt-accent-fg\",\n \"aria-pressed:bg-lt-accent aria-pressed:text-lt-accent-fg\",\n ),\n segmented: cn(\n \"-ml-px rounded-l-none border border-lt-input text-lt-muted-fg hover:bg-lt-accent hover:text-lt-accent-fg\",\n \"data-[state=open]:z-10 data-[state=open]:border-lt-primary data-[state=open]:text-lt-fg\",\n ),\n },\n size: {\n xs: \"size-5 [&_svg]:size-lt-icon-sm\",\n sm: \"size-7 [&_svg]:size-lt-icon-md\",\n md: \"size-lt-control-md [&_svg]:size-lt-icon-md\",\n },\n },\n defaultVariants: { emphasis: \"ghost\", size: \"sm\" },\n },\n);\n\nexport function IconButton({\n icon,\n label,\n active,\n size,\n emphasis,\n className,\n children,\n ref,\n ...props\n}: Omit<React.ComponentProps<\"button\">, \"aria-pressed\"> &\n VariantProps<typeof iconButtonVariants> & {\n /** Icon glyph name; omit and pass `children` for custom content. */\n icon?: string;\n /** Accessible name (also used when the button shows only an icon). */\n label: string;\n /** Toggle state — sets `aria-pressed` and the pressed styling. */\n active?: boolean;\n }) {\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n aria-pressed={active}\n className={cn(iconButtonVariants({ emphasis, size }), className)}\n {...props}\n >\n {icon ? <Icon name={icon} aria-hidden=\"true\" /> : null}\n {children}\n </button>\n );\n}\n\nexport { iconButtonVariants };\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAM,qBAAqB,IACzB,GACE,6FACA,+FACA,mFACF,GACA;CACE,UAAU;EACR,UAAU;GACR,OAAO,GACL,+DACA,sEACA,0DACF;GACA,WAAW,GACT,4GACA,yFACF;EACF;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CACA,iBAAiB;EAAE,UAAU;EAAS,MAAM;CAAK;AACnD,CACF;AAEA,SAAgB,WAAW,EACzB,MACA,OACA,QACA,MACA,UACA,WACA,UACA,KACA,GAAG,SASA;CACH,OACE,qBAAC,UAAD;EACO;EACL,MAAK;EACL,cAAY;EACZ,gBAAc;EACd,WAAW,GAAG,mBAAmB;GAAE;GAAU;EAAK,CAAC,GAAG,SAAS;EAC/D,GAAI;
|
|
1
|
+
{"version":3,"file":"icon-button.js","names":[],"sources":["../../resources/js/ui/icon-button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Icon } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\n/**\n * A compact, resizable icon button — the shared affordance behind toolbar\n * triggers, popover triggers, and inline clear/remove buttons. `ghost` matches\n * `Button emphasis=\"ghost\"` (accent hover) and reacts to `aria-pressed` (toggle)\n * and `data-[state=open]` (a popover trigger). `segmented` joins onto the right\n * of an adjacent input. Size defaults to `sm`; pass `size` to resize.\n */\nconst iconButtonVariants = cva(\n cn(\n \"relative inline-flex shrink-0 items-center justify-center rounded-lt-sm transition-colors\",\n \"outline-none focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50\",\n \"disabled:pointer-events-none disabled:bg-lt-disabled disabled:text-lt-disabled-fg\",\n ),\n {\n variants: {\n emphasis: {\n ghost: cn(\n \"text-lt-muted-fg hover:bg-lt-accent hover:text-lt-accent-fg\",\n \"data-[state=open]:bg-lt-accent data-[state=open]:text-lt-accent-fg\",\n \"aria-pressed:bg-lt-accent aria-pressed:text-lt-accent-fg\",\n ),\n segmented: cn(\n \"-ml-px rounded-l-none border border-lt-input text-lt-muted-fg hover:bg-lt-accent hover:text-lt-accent-fg\",\n \"data-[state=open]:z-10 data-[state=open]:border-lt-primary data-[state=open]:text-lt-fg\",\n ),\n },\n size: {\n xs: \"size-5 [&_svg]:size-lt-icon-sm\",\n sm: \"size-7 [&_svg]:size-lt-icon-md\",\n md: \"size-lt-control-md [&_svg]:size-lt-icon-md\",\n },\n },\n defaultVariants: { emphasis: \"ghost\", size: \"sm\" },\n },\n);\n\nexport function IconButton({\n icon,\n label,\n active,\n size,\n emphasis,\n className,\n children,\n ref,\n ...props\n}: Omit<React.ComponentProps<\"button\">, \"aria-pressed\"> &\n VariantProps<typeof iconButtonVariants> & {\n /** Icon glyph name; omit and pass `children` for custom content. */\n icon?: string;\n /** Accessible name (also used when the button shows only an icon). */\n label: string;\n /** Toggle state — sets `aria-pressed` and the pressed styling. */\n active?: boolean;\n }) {\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n aria-pressed={active}\n className={cn(iconButtonVariants({ emphasis, size }), className)}\n {...props}\n >\n {icon ? <Icon name={icon} aria-hidden=\"true\" /> : null}\n {children}\n </button>\n );\n}\n\nexport { iconButtonVariants };\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAM,qBAAqB,IACzB,GACE,6FACA,+FACA,mFACF,GACA;CACE,UAAU;EACR,UAAU;GACR,OAAO,GACL,+DACA,sEACA,0DACF;GACA,WAAW,GACT,4GACA,yFACF;EACF;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CACA,iBAAiB;EAAE,UAAU;EAAS,MAAM;CAAK;AACnD,CACF;AAEA,SAAgB,WAAW,EACzB,MACA,OACA,QACA,MACA,UACA,WACA,UACA,KACA,GAAG,SASA;CACH,OACE,qBAAC,UAAD;EACO;EACL,MAAK;EACL,cAAY;EACZ,gBAAc;EACd,WAAW,GAAG,mBAAmB;GAAE;GAAU;EAAK,CAAC,GAAG,SAAS;EAC/D,GAAI;EANN,UAAA,CAQG,OAAO,oBAAC,MAAD;GAAM,MAAM;GAAM,eAAY;EAAQ,CAAA,IAAI,MACjD,QACK;;AAEZ"}
|
package/dist/ui/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","names":[],"sources":["../../resources/js/ui/icon.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { coerceColor, colorValue } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\n\nconst sizeClass: Record<Size, string> = {\n xs: \"size-lt-icon-xs\",\n sm: \"size-lt-icon-sm\",\n md: \"size-lt-icon-md\",\n lg: \"size-lt-icon-lg\",\n xl: \"size-lt-icon-xl\",\n \"2xl\": \"size-lt-icon-2xl\",\n \"3xl\": \"size-lt-icon-3xl\",\n \"4xl\": \"size-lt-icon-4xl\",\n};\n\nconst IconComponent: RendererComponent<\"icon\"> = ({ node }) => {\n const { name, size, color, class: className } = node.props;\n const icon = <IconRenderer icon={name} className={cn(sizeClass[size], className)} />;\n const coerced = coerceColor(color);\n\n if (!coerced) {\n return icon;\n }\n\n return (\n <span className=\"contents\" style={{ color: colorValue(coerced) }}>\n {icon}\n </span>\n );\n};\n\nexport default IconComponent;\n"],"mappings":";;;;;AAMA,IAAM,YAAkC;CACtC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAC7D,MAAM,EAAE,MAAM,MAAM,OAAO,OAAO,cAAc,KAAK;CACrD,MAAM,OAAO,oBAAC,cAAD;EAAc,MAAM;EAAM,WAAW,GAAG,UAAU,OAAO,SAAS;CAAI,CAAA;CACnF,MAAM,UAAU,YAAY,KAAK;CAEjC,IAAI,CAAC,SACH,OAAO;CAGT,OACE,oBAAC,QAAD;EAAM,WAAU;EAAW,OAAO,EAAE,OAAO,WAAW,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"icon.js","names":[],"sources":["../../resources/js/ui/icon.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { coerceColor, colorValue } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\n\nconst sizeClass: Record<Size, string> = {\n xs: \"size-lt-icon-xs\",\n sm: \"size-lt-icon-sm\",\n md: \"size-lt-icon-md\",\n lg: \"size-lt-icon-lg\",\n xl: \"size-lt-icon-xl\",\n \"2xl\": \"size-lt-icon-2xl\",\n \"3xl\": \"size-lt-icon-3xl\",\n \"4xl\": \"size-lt-icon-4xl\",\n};\n\nconst IconComponent: RendererComponent<\"icon\"> = ({ node }) => {\n const { name, size, color, class: className } = node.props;\n const icon = <IconRenderer icon={name} className={cn(sizeClass[size], className)} />;\n const coerced = coerceColor(color);\n\n if (!coerced) {\n return icon;\n }\n\n return (\n <span className=\"contents\" style={{ color: colorValue(coerced) }}>\n {icon}\n </span>\n );\n};\n\nexport default IconComponent;\n"],"mappings":";;;;;AAMA,IAAM,YAAkC;CACtC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAC7D,MAAM,EAAE,MAAM,MAAM,OAAO,OAAO,cAAc,KAAK;CACrD,MAAM,OAAO,oBAAC,cAAD;EAAc,MAAM;EAAM,WAAW,GAAG,UAAU,OAAO,SAAS;CAAI,CAAA;CACnF,MAAM,UAAU,YAAY,KAAK;CAEjC,IAAI,CAAC,SACH,OAAO;CAGT,OACE,oBAAC,QAAD;EAAM,WAAU;EAAW,OAAO,EAAE,OAAO,WAAW,OAAO,EAAE;EAC5D,UAAA;CACG,CAAA;AAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-preview.js","names":[],"sources":["../../resources/js/ui/image-preview.tsx"],"sourcesContent":["import { useT } from \"@lattice-php/lattice/i18n\";\nimport { type ReactNode, useState } from \"react\";\nimport { Button } from \"@lattice-php/lattice/ui/button\";\nimport { Dialog, DialogClose, DialogContent, DialogTitle } from \"./dialog\";\n\ninterface PreviewableImageProps {\n src: string;\n alt: string;\n previewable: boolean;\n width?: number;\n height?: number;\n className?: string;\n testId?: string;\n}\n\nexport function PreviewableImage({\n src,\n alt,\n previewable,\n width,\n height,\n className,\n testId,\n}: PreviewableImageProps): ReactNode {\n const { t } = useT(\"lattice\");\n const [open, setOpen] = useState(false);\n\n const image = (\n <img\n alt={alt}\n src={src}\n width={width}\n height={height}\n className={className}\n style={width ? { width, height } : undefined}\n />\n );\n\n if (!previewable) {\n return image;\n }\n\n const openLabel = t(\"common.image.open-preview\", \"View image\");\n\n return (\n <>\n <button\n type=\"button\"\n data-test={testId}\n className=\"cursor-zoom-in\"\n aria-label={openLabel}\n onClick={() => setOpen(true)}\n >\n {image}\n </button>\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent\n aria-describedby={undefined}\n className=\"max-h-[90vh] w-auto max-w-[90vw] border-none bg-transparent p-0 shadow-none\"\n >\n <DialogTitle className=\"sr-only\">{alt || openLabel}</DialogTitle>\n <img\n alt={alt}\n src={src}\n data-slot=\"image-lightbox\"\n className=\"max-h-[90vh] max-w-[90vw] rounded-lt object-contain\"\n />\n <DialogClose asChild>\n <Button\n icon=\"x\"\n aria-label={t(\"common.close\", \"Close\")}\n data-test=\"lightbox-close\"\n size=\"icon\"\n emphasis=\"ghost\"\n className=\"absolute top-2 right-2 bg-lt-bg/80 hover:bg-lt-bg\"\n />\n </DialogClose>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;AAeA,SAAgB,iBAAiB,EAC/B,KACA,KACA,aACA,OACA,QACA,WACA,UACmC;CACnC,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CAEtC,MAAM,QACJ,oBAAC,OAAD;EACO;EACA;EACE;EACC;EACG;EACX,OAAO,QAAQ;GAAE;GAAO;EAAO,IAAI,KAAA;CACpC,CAAA;CAGH,IAAI,CAAC,aACH,OAAO;CAGT,MAAM,YAAY,EAAE,6BAA6B,YAAY;CAE7D,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EACE,MAAK;EACL,aAAW;EACX,WAAU;EACV,cAAY;EACZ,eAAe,QAAQ,IAAI;
|
|
1
|
+
{"version":3,"file":"image-preview.js","names":[],"sources":["../../resources/js/ui/image-preview.tsx"],"sourcesContent":["import { useT } from \"@lattice-php/lattice/i18n\";\nimport { type ReactNode, useState } from \"react\";\nimport { Button } from \"@lattice-php/lattice/ui/button\";\nimport { Dialog, DialogClose, DialogContent, DialogTitle } from \"./dialog\";\n\ninterface PreviewableImageProps {\n src: string;\n alt: string;\n previewable: boolean;\n width?: number;\n height?: number;\n className?: string;\n testId?: string;\n}\n\nexport function PreviewableImage({\n src,\n alt,\n previewable,\n width,\n height,\n className,\n testId,\n}: PreviewableImageProps): ReactNode {\n const { t } = useT(\"lattice\");\n const [open, setOpen] = useState(false);\n\n const image = (\n <img\n alt={alt}\n src={src}\n width={width}\n height={height}\n className={className}\n style={width ? { width, height } : undefined}\n />\n );\n\n if (!previewable) {\n return image;\n }\n\n const openLabel = t(\"common.image.open-preview\", \"View image\");\n\n return (\n <>\n <button\n type=\"button\"\n data-test={testId}\n className=\"cursor-zoom-in\"\n aria-label={openLabel}\n onClick={() => setOpen(true)}\n >\n {image}\n </button>\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent\n aria-describedby={undefined}\n className=\"max-h-[90vh] w-auto max-w-[90vw] border-none bg-transparent p-0 shadow-none\"\n >\n <DialogTitle className=\"sr-only\">{alt || openLabel}</DialogTitle>\n <img\n alt={alt}\n src={src}\n data-slot=\"image-lightbox\"\n className=\"max-h-[90vh] max-w-[90vw] rounded-lt object-contain\"\n />\n <DialogClose asChild>\n <Button\n icon=\"x\"\n aria-label={t(\"common.close\", \"Close\")}\n data-test=\"lightbox-close\"\n size=\"icon\"\n emphasis=\"ghost\"\n className=\"absolute top-2 right-2 bg-lt-bg/80 hover:bg-lt-bg\"\n />\n </DialogClose>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;AAeA,SAAgB,iBAAiB,EAC/B,KACA,KACA,aACA,OACA,QACA,WACA,UACmC;CACnC,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CAEtC,MAAM,QACJ,oBAAC,OAAD;EACO;EACA;EACE;EACC;EACG;EACX,OAAO,QAAQ;GAAE;GAAO;EAAO,IAAI,KAAA;CACpC,CAAA;CAGH,IAAI,CAAC,aACH,OAAO;CAGT,MAAM,YAAY,EAAE,6BAA6B,YAAY;CAE7D,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EACE,MAAK;EACL,aAAW;EACX,WAAU;EACV,cAAY;EACZ,eAAe,QAAQ,IAAI;EAE1B,UAAA;CACK,CAAA,GACR,oBAAC,QAAD;EAAc;EAAM,cAAc;EAChC,UAAA,qBAAC,eAAD;GACE,oBAAkB,KAAA;GAClB,WAAU;GAFZ,UAAA;IAIE,oBAAC,aAAD;KAAa,WAAU;KAAW,UAAA,OAAO;IAAuB,CAAA;IAChE,oBAAC,OAAD;KACO;KACA;KACL,aAAU;KACV,WAAU;IACX,CAAA;IACD,oBAAC,aAAD;KAAa,SAAA;KACX,UAAA,oBAAC,QAAD;MACE,MAAK;MACL,cAAY,EAAE,gBAAgB,OAAO;MACrC,aAAU;MACV,MAAK;MACL,UAAS;MACT,WAAU;KACX,CAAA;IACU,CAAA;GACA;;CACT,CAAA,CACR,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-tooltip.js","names":[],"sources":["../../resources/js/ui/info-tooltip.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\nexport function InfoTooltip({ content }: { content?: string | null }) {\n const { t } = useT(\"lattice\");\n\n if (!content) {\n return null;\n }\n\n return (\n <Popover>\n <PopoverTrigger\n type=\"button\"\n aria-label={t(\"common.more-info\", \"More information\")}\n className=\"ml-1 inline-flex rounded-lt-sm text-lt-muted-fg outline-none hover:text-lt-fg focus-visible:text-lt-fg focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)]\"\n >\n <Icon name=\"info\" className=\"size-lt-icon-sm\" />\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"max-w-xs p-3 text-sm [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: content }}\n />\n </Popover>\n );\n}\n"],"mappings":";;;;;AAIA,SAAgB,YAAY,EAAE,WAAwC;CACpE,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,IAAI,CAAC,SACH,OAAO;CAGT,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,MAAK;EACL,cAAY,EAAE,oBAAoB,kBAAkB;EACpD,WAAU;
|
|
1
|
+
{"version":3,"file":"info-tooltip.js","names":[],"sources":["../../resources/js/ui/info-tooltip.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\nexport function InfoTooltip({ content }: { content?: string | null }) {\n const { t } = useT(\"lattice\");\n\n if (!content) {\n return null;\n }\n\n return (\n <Popover>\n <PopoverTrigger\n type=\"button\"\n aria-label={t(\"common.more-info\", \"More information\")}\n className=\"ml-1 inline-flex rounded-lt-sm text-lt-muted-fg outline-none hover:text-lt-fg focus-visible:text-lt-fg focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)]\"\n >\n <Icon name=\"info\" className=\"size-lt-icon-sm\" />\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"max-w-xs p-3 text-sm [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: content }}\n />\n </Popover>\n );\n}\n"],"mappings":";;;;;AAIA,SAAgB,YAAY,EAAE,WAAwC;CACpE,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,IAAI,CAAC,SACH,OAAO;CAGT,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,MAAK;EACL,cAAY,EAAE,oBAAoB,kBAAkB;EACpD,WAAU;EAEV,UAAA,oBAAC,MAAD;GAAM,MAAK;GAAO,WAAU;EAAmB,CAAA;CACjC,CAAA,GAChB,oBAAC,gBAAD;EACE,OAAM;EACN,WAAU;EACV,yBAAyB,EAAE,QAAQ,QAAQ;CAC5C,CAAA,CACM,EAAA,CAAA;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-error.js","names":[],"sources":["../../resources/js/ui/input-error.tsx"],"sourcesContent":["import type { HTMLAttributes } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nexport default function InputError({\n message,\n className = \"\",\n ...props\n}: HTMLAttributes<HTMLParagraphElement> & { message?: string }) {\n return message ? (\n <p {...props} className={cn(\"text-sm text-lt-danger\", className)}>\n {message}\n </p>\n ) : null;\n}\n"],"mappings":";;;AAGA,SAAwB,WAAW,EACjC,SACA,YAAY,IACZ,GAAG,SAC2D;CAC9D,OAAO,UACL,oBAAC,KAAD;EAAG,GAAI;EAAO,WAAW,GAAG,0BAA0B,SAAS;
|
|
1
|
+
{"version":3,"file":"input-error.js","names":[],"sources":["../../resources/js/ui/input-error.tsx"],"sourcesContent":["import type { HTMLAttributes } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nexport default function InputError({\n message,\n className = \"\",\n ...props\n}: HTMLAttributes<HTMLParagraphElement> & { message?: string }) {\n return message ? (\n <p {...props} className={cn(\"text-sm text-lt-danger\", className)}>\n {message}\n </p>\n ) : null;\n}\n"],"mappings":";;;AAGA,SAAwB,WAAW,EACjC,SACA,YAAY,IACZ,GAAG,SAC2D;CAC9D,OAAO,UACL,oBAAC,KAAD;EAAG,GAAI;EAAO,WAAW,GAAG,0BAA0B,SAAS;EAC5D,UAAA;CACA,CAAA,IACD;AACN"}
|
package/dist/ui/input-otp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp.js","names":[],"sources":["../../resources/js/ui/input-otp.tsx"],"sourcesContent":["import { OTPInput, REGEXP_ONLY_DIGITS, type SlotProps } from \"input-otp\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction Slot({ char, hasFakeCaret, isActive }: SlotProps) {\n return (\n <div\n className={cn(\n \"relative flex h-lt-control-md w-10 items-center justify-center border-y border-r border-lt-input text-base shadow-lt-xs transition-all first:rounded-l-lt-sm first:border-l last:rounded-r-lt-sm\",\n isActive && \"z-10 border-lt-ring ring-lt-ring/50 ring-[length:var(--lt-ring-width)]\",\n )}\n >\n {char}\n {hasFakeCaret ? (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"bg-lt-fg h-5 w-px animate-pulse\" />\n </div>\n ) : null}\n </div>\n );\n}\n\ntype InputOTPProps = Omit<ComponentProps<typeof OTPInput>, \"children\" | \"maxLength\" | \"render\"> & {\n length: number;\n};\n\nexport function InputOTP({\n length,\n containerClassName,\n pattern = REGEXP_ONLY_DIGITS,\n ...props\n}: InputOTPProps) {\n return (\n <OTPInput\n maxLength={length}\n pattern={pattern}\n containerClassName={cn(\n \"flex items-center gap-2 has-[:disabled]:opacity-50\",\n containerClassName,\n )}\n render={({ slots }) => (\n <div className=\"flex items-center\">\n {slots.map((slot, index) => (\n <Slot key={index} {...slot} />\n ))}\n </div>\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;AAIA,SAAS,KAAK,EAAE,MAAM,cAAc,YAAuB;CACzD,OACE,qBAAC,OAAD;EACE,WAAW,GACT,oMACA,YAAY,wEACd;
|
|
1
|
+
{"version":3,"file":"input-otp.js","names":[],"sources":["../../resources/js/ui/input-otp.tsx"],"sourcesContent":["import { OTPInput, REGEXP_ONLY_DIGITS, type SlotProps } from \"input-otp\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction Slot({ char, hasFakeCaret, isActive }: SlotProps) {\n return (\n <div\n className={cn(\n \"relative flex h-lt-control-md w-10 items-center justify-center border-y border-r border-lt-input text-base shadow-lt-xs transition-all first:rounded-l-lt-sm first:border-l last:rounded-r-lt-sm\",\n isActive && \"z-10 border-lt-ring ring-lt-ring/50 ring-[length:var(--lt-ring-width)]\",\n )}\n >\n {char}\n {hasFakeCaret ? (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"bg-lt-fg h-5 w-px animate-pulse\" />\n </div>\n ) : null}\n </div>\n );\n}\n\ntype InputOTPProps = Omit<ComponentProps<typeof OTPInput>, \"children\" | \"maxLength\" | \"render\"> & {\n length: number;\n};\n\nexport function InputOTP({\n length,\n containerClassName,\n pattern = REGEXP_ONLY_DIGITS,\n ...props\n}: InputOTPProps) {\n return (\n <OTPInput\n maxLength={length}\n pattern={pattern}\n containerClassName={cn(\n \"flex items-center gap-2 has-[:disabled]:opacity-50\",\n containerClassName,\n )}\n render={({ slots }) => (\n <div className=\"flex items-center\">\n {slots.map((slot, index) => (\n <Slot key={index} {...slot} />\n ))}\n </div>\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;AAIA,SAAS,KAAK,EAAE,MAAM,cAAc,YAAuB;CACzD,OACE,qBAAC,OAAD;EACE,WAAW,GACT,oMACA,YAAY,wEACd;EAJF,UAAA,CAMG,MACA,eACC,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,OAAD,EAAK,WAAU,kCAAmC,CAAA;EAC/C,CAAA,IACH,IACD;;AAET;AAMA,SAAgB,SAAS,EACvB,QACA,oBACA,UAAU,oBACV,GAAG,SACa;CAChB,OACE,oBAAC,UAAD;EACE,WAAW;EACF;EACT,oBAAoB,GAClB,sDACA,kBACF;EACA,SAAS,EAAE,YACT,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,MAAM,KAAK,MAAM,UAChB,oBAAC,MAAD,EAAkB,GAAI,KAAO,GAAlB,KAAkB,CAC9B;EACE,CAAA;EAEP,GAAI;CACL,CAAA;AAEL"}
|
package/dist/ui/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","names":[],"sources":["../../resources/js/ui/link.tsx"],"sourcesContent":["import { Link } from \"@inertiajs/react\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport type { Affix } from \"@lattice-php/lattice/types/generated\";\nimport { actionMenuItemClassName, useActionMenu } from \"./action-menu-context\";\nimport { ActionTrigger, type TriggerState, useClickBehavior } from \"./click-behavior\";\n\nconst textLinkClassName =\n \"text-lt-fg underline decoration-lt-border underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-lt-border\";\n\nfunction TextLink({ className = \"\", children, ...props }: ComponentProps<typeof Link>) {\n return (\n <Link className={cn(textLinkClassName, className)} {...props}>\n {children}\n </Link>\n );\n}\n\nfunction LinkAffix({ affix, className }: { affix: Affix; className?: string }) {\n if (affix.icon) {\n return <IconRenderer className={cn(\"size-lt-icon-md shrink-0\", className)} icon={affix.icon} />;\n }\n\n return <span className={cn(\"shrink-0 text-sm text-lt-muted-fg\", className)}>{affix.text}</span>;\n}\n\nfunction LinkContent({\n icon,\n isMenuItem,\n label,\n prefix,\n suffix,\n}: {\n icon?: string | null;\n isMenuItem: boolean;\n label: string;\n prefix?: Affix | null;\n suffix?: Affix | null;\n}) {\n if (icon) {\n return <IconRenderer className=\"size-lt-icon-md shrink-0\" icon={icon} />;\n }\n\n if (isMenuItem) {\n return (\n <>\n {prefix ? <LinkAffix affix={prefix} /> : null}\n <span>{label}</span>\n {suffix ? <LinkAffix affix={suffix} className=\"ml-auto\" /> : null}\n </>\n );\n }\n\n if (prefix || suffix) {\n return (\n <span className=\"inline-flex items-center gap-1.5 align-baseline\">\n {prefix ? <LinkAffix affix={prefix} /> : null}\n <span>{label}</span>\n {suffix ? <LinkAffix affix={suffix} /> : null}\n </span>\n );\n }\n\n return label;\n}\n\nfunction labelWithTextAffixes(label: string, prefix?: Affix | null, suffix?: Affix | null) {\n if (!prefix?.text && !suffix?.text) {\n return undefined;\n }\n\n return [prefix?.text, label, suffix?.text]\n .filter((part): part is string => Boolean(part))\n .join(\" \");\n}\n\nconst LinkComponent: RendererComponent<\"link\"> = ({ node }) => {\n const isMenuItem = useActionMenu();\n const { icon, label: rawLabel, prefix, suffix } = node.props;\n const label = rawLabel ?? \"\";\n const behavior = useClickBehavior(node.props);\n const className = isMenuItem ? actionMenuItemClassName : undefined;\n const testId = nodeIdentity(node);\n const content = (\n <LinkContent\n icon={icon}\n isMenuItem={isMenuItem}\n label={label}\n prefix={prefix}\n suffix={suffix}\n />\n );\n const ariaLabel = icon ? label : labelWithTextAffixes(label, prefix, suffix);\n\n const triggerButton = ({ onClick, processing }: TriggerState) => (\n <button\n aria-label={ariaLabel}\n className={cn(textLinkClassName, className)}\n data-test={testId}\n disabled={processing}\n onClick={onClick}\n type=\"button\"\n >\n {content}\n </button>\n );\n\n if (behavior.kind === \"action\") {\n return <ActionTrigger action={behavior.action}>{triggerButton}</ActionTrigger>;\n }\n\n if (behavior.kind === \"effects\") {\n return triggerButton({ onClick: behavior.onClick, processing: false });\n }\n\n return (\n <TextLink\n aria-label={ariaLabel}\n className={className}\n data-test={testId}\n href={behavior.kind === \"navigate\" ? behavior.href : \"#\"}\n method={behavior.kind === \"navigate\" ? behavior.method : \"get\"}\n tabIndex={node.props.tabIndex ?? undefined}\n >\n {content}\n </TextLink>\n );\n};\n\nexport default LinkComponent;\nexport { TextLink };\n"],"mappings":";;;;;;;;AAUA,IAAM,oBACJ;AAEF,SAAS,SAAS,EAAE,YAAY,IAAI,UAAU,GAAG,SAAsC;CACrF,OACE,oBAAC,MAAD;EAAM,WAAW,GAAG,mBAAmB,SAAS;EAAG,GAAI;EACpD;CACG,CAAA;AAEV;AAEA,SAAS,UAAU,EAAE,OAAO,aAAmD;CAC7E,IAAI,MAAM,MACR,OAAO,oBAAC,cAAD;EAAc,WAAW,GAAG,4BAA4B,SAAS;EAAG,MAAM,MAAM;CAAO,CAAA;CAGhG,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,qCAAqC,SAAS;
|
|
1
|
+
{"version":3,"file":"link.js","names":[],"sources":["../../resources/js/ui/link.tsx"],"sourcesContent":["import { Link } from \"@inertiajs/react\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport type { Affix } from \"@lattice-php/lattice/types/generated\";\nimport { actionMenuItemClassName, useActionMenu } from \"./action-menu-context\";\nimport { ActionTrigger, type TriggerState, useClickBehavior } from \"./click-behavior\";\n\nconst textLinkClassName =\n \"text-lt-fg underline decoration-lt-border underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-lt-border\";\n\nfunction TextLink({ className = \"\", children, ...props }: ComponentProps<typeof Link>) {\n return (\n <Link className={cn(textLinkClassName, className)} {...props}>\n {children}\n </Link>\n );\n}\n\nfunction LinkAffix({ affix, className }: { affix: Affix; className?: string }) {\n if (affix.icon) {\n return <IconRenderer className={cn(\"size-lt-icon-md shrink-0\", className)} icon={affix.icon} />;\n }\n\n return <span className={cn(\"shrink-0 text-sm text-lt-muted-fg\", className)}>{affix.text}</span>;\n}\n\nfunction LinkContent({\n icon,\n isMenuItem,\n label,\n prefix,\n suffix,\n}: {\n icon?: string | null;\n isMenuItem: boolean;\n label: string;\n prefix?: Affix | null;\n suffix?: Affix | null;\n}) {\n if (icon) {\n return <IconRenderer className=\"size-lt-icon-md shrink-0\" icon={icon} />;\n }\n\n if (isMenuItem) {\n return (\n <>\n {prefix ? <LinkAffix affix={prefix} /> : null}\n <span>{label}</span>\n {suffix ? <LinkAffix affix={suffix} className=\"ml-auto\" /> : null}\n </>\n );\n }\n\n if (prefix || suffix) {\n return (\n <span className=\"inline-flex items-center gap-1.5 align-baseline\">\n {prefix ? <LinkAffix affix={prefix} /> : null}\n <span>{label}</span>\n {suffix ? <LinkAffix affix={suffix} /> : null}\n </span>\n );\n }\n\n return label;\n}\n\nfunction labelWithTextAffixes(label: string, prefix?: Affix | null, suffix?: Affix | null) {\n if (!prefix?.text && !suffix?.text) {\n return undefined;\n }\n\n return [prefix?.text, label, suffix?.text]\n .filter((part): part is string => Boolean(part))\n .join(\" \");\n}\n\nconst LinkComponent: RendererComponent<\"link\"> = ({ node }) => {\n const isMenuItem = useActionMenu();\n const { icon, label: rawLabel, prefix, suffix } = node.props;\n const label = rawLabel ?? \"\";\n const behavior = useClickBehavior(node.props);\n const className = isMenuItem ? actionMenuItemClassName : undefined;\n const testId = nodeIdentity(node);\n const content = (\n <LinkContent\n icon={icon}\n isMenuItem={isMenuItem}\n label={label}\n prefix={prefix}\n suffix={suffix}\n />\n );\n const ariaLabel = icon ? label : labelWithTextAffixes(label, prefix, suffix);\n\n const triggerButton = ({ onClick, processing }: TriggerState) => (\n <button\n aria-label={ariaLabel}\n className={cn(textLinkClassName, className)}\n data-test={testId}\n disabled={processing}\n onClick={onClick}\n type=\"button\"\n >\n {content}\n </button>\n );\n\n if (behavior.kind === \"action\") {\n return <ActionTrigger action={behavior.action}>{triggerButton}</ActionTrigger>;\n }\n\n if (behavior.kind === \"effects\") {\n return triggerButton({ onClick: behavior.onClick, processing: false });\n }\n\n return (\n <TextLink\n aria-label={ariaLabel}\n className={className}\n data-test={testId}\n href={behavior.kind === \"navigate\" ? behavior.href : \"#\"}\n method={behavior.kind === \"navigate\" ? behavior.method : \"get\"}\n tabIndex={node.props.tabIndex ?? undefined}\n >\n {content}\n </TextLink>\n );\n};\n\nexport default LinkComponent;\nexport { TextLink };\n"],"mappings":";;;;;;;;AAUA,IAAM,oBACJ;AAEF,SAAS,SAAS,EAAE,YAAY,IAAI,UAAU,GAAG,SAAsC;CACrF,OACE,oBAAC,MAAD;EAAM,WAAW,GAAG,mBAAmB,SAAS;EAAG,GAAI;EACpD;CACG,CAAA;AAEV;AAEA,SAAS,UAAU,EAAE,OAAO,aAAmD;CAC7E,IAAI,MAAM,MACR,OAAO,oBAAC,cAAD;EAAc,WAAW,GAAG,4BAA4B,SAAS;EAAG,MAAM,MAAM;CAAO,CAAA;CAGhG,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,qCAAqC,SAAS;EAAI,UAAA,MAAM;CAAW,CAAA;AAChG;AAEA,SAAS,YAAY,EACnB,MACA,YACA,OACA,QACA,UAOC;CACD,IAAI,MACF,OAAO,oBAAC,cAAD;EAAc,WAAU;EAAiC;CAAO,CAAA;CAGzE,IAAI,YACF,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,SAAS,oBAAC,WAAD,EAAW,OAAO,OAAS,CAAA,IAAI;EACzC,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;EAClB,SAAS,oBAAC,WAAD;GAAW,OAAO;GAAQ,WAAU;EAAW,CAAA,IAAI;CAC7D,EAAA,CAAA;CAIN,IAAI,UAAU,QACZ,OACE,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA;GACG,SAAS,oBAAC,WAAD,EAAW,OAAO,OAAS,CAAA,IAAI;GACzC,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;GAClB,SAAS,oBAAC,WAAD,EAAW,OAAO,OAAS,CAAA,IAAI;EACrC;;CAIV,OAAO;AACT;AAEA,SAAS,qBAAqB,OAAe,QAAuB,QAAuB;CACzF,IAAI,CAAC,QAAQ,QAAQ,CAAC,QAAQ,MAC5B;CAGF,OAAO;EAAC,QAAQ;EAAM;EAAO,QAAQ;CAAI,CAAC,CACvC,QAAQ,SAAyB,QAAQ,IAAI,CAAC,CAAC,CAC/C,KAAK,GAAG;AACb;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAC7D,MAAM,aAAa,cAAc;CACjC,MAAM,EAAE,MAAM,OAAO,UAAU,QAAQ,WAAW,KAAK;CACvD,MAAM,QAAQ,YAAY;CAC1B,MAAM,WAAW,iBAAiB,KAAK,KAAK;CAC5C,MAAM,YAAY,aAAa,0BAA0B,KAAA;CACzD,MAAM,SAAS,aAAa,IAAI;CAChC,MAAM,UACJ,oBAAC,aAAD;EACQ;EACM;EACL;EACC;EACA;CACT,CAAA;CAEH,MAAM,YAAY,OAAO,QAAQ,qBAAqB,OAAO,QAAQ,MAAM;CAE3E,MAAM,iBAAiB,EAAE,SAAS,iBAChC,oBAAC,UAAD;EACE,cAAY;EACZ,WAAW,GAAG,mBAAmB,SAAS;EAC1C,aAAW;EACX,UAAU;EACD;EACT,MAAK;EAEJ,UAAA;CACK,CAAA;CAGV,IAAI,SAAS,SAAS,UACpB,OAAO,oBAAC,eAAD;EAAe,QAAQ,SAAS;EAAS,UAAA;CAA6B,CAAA;CAG/E,IAAI,SAAS,SAAS,WACpB,OAAO,cAAc;EAAE,SAAS,SAAS;EAAS,YAAY;CAAM,CAAC;CAGvE,OACE,oBAAC,UAAD;EACE,cAAY;EACD;EACX,aAAW;EACX,MAAM,SAAS,SAAS,aAAa,SAAS,OAAO;EACrD,QAAQ,SAAS,SAAS,aAAa,SAAS,SAAS;EACzD,UAAU,KAAK,MAAM,YAAY,KAAA;EAEhC,UAAA;CACO,CAAA;AAEd"}
|
package/dist/ui/modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","names":[],"sources":["../../resources/js/ui/modal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { Dialog, DialogContent, DialogHeader } from \"@lattice-php/lattice/ui/dialog\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/core/event-names\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\ntype ModalEvent = CustomEvent<{\n modal: string | null;\n}>;\n\nfunction matchesModal(event: Event, modal: string): boolean {\n const target = (event as ModalEvent).detail?.modal;\n\n return target == null || target === modal;\n}\n\nconst ModalComponent: RendererComponent<\"modal\"> = ({ children, node }) => {\n const { t } = useT(\"lattice\");\n const title = node.props.title ?? t(\"common.dialog\", \"Dialog\");\n const description = node.props.description;\n const closeLabel = node.props.closeLabel;\n const [isOpen, setIsOpen] = useState(node.props.open === true);\n const openerRef = useRef<HTMLElement | null>(null);\n const wasOpenRef = useRef(isOpen);\n\n // Honour server-driven open changes across re-renders, not just on mount. One\n // way on purpose: closing stays user/closeModal-driven so it never fights a\n // manual close, and the dep keeps it from re-firing while open stays true.\n useEffect(() => {\n if (node.props.open === true) {\n setIsOpen(true);\n }\n }, [node.props.open]);\n\n useEffect(() => {\n function open(event: Event): void {\n if (node.id && matchesModal(event, node.id)) {\n openerRef.current =\n document.activeElement instanceof HTMLElement ? document.activeElement : null;\n setIsOpen(true);\n }\n }\n\n function close(event: Event): void {\n if (!node.id || matchesModal(event, node.id)) {\n setIsOpen(false);\n }\n }\n\n window.addEventListener(LATTICE_EVENT.openModal, open);\n window.addEventListener(LATTICE_EVENT.closeModal, close);\n\n return () => {\n window.removeEventListener(LATTICE_EVENT.openModal, open);\n window.removeEventListener(LATTICE_EVENT.closeModal, close);\n };\n }, [node.id]);\n\n // Radix only restores focus to a `DialogTrigger`-registered element, and this\n // modal is opened imperatively rather than through one. Own the restore\n // ourselves instead: whatever had focus when the modal opened gets it back\n // once the closing dialog has finished unmounting.\n useEffect(() => {\n if (wasOpenRef.current && !isOpen) {\n const opener = openerRef.current;\n\n if (opener) {\n requestAnimationFrame(() => opener.focus());\n }\n }\n\n wasOpenRef.current = isOpen;\n }, [isOpen]);\n\n return (\n <Dialog open={isOpen} onOpenChange={setIsOpen}>\n <DialogContent\n {...(description ? {} : { \"aria-describedby\": undefined })}\n placement={node.props.side ?? \"center\"}\n width={node.props.width}\n >\n <DialogHeader closeLabel={closeLabel} description={description} title={title} />\n <div className=\"mt-6 space-y-6\">{children}</div>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default ModalComponent;\n"],"mappings":";;;;;;AAUA,SAAS,aAAa,OAAc,OAAwB;CAC1D,MAAM,SAAU,MAAqB,QAAQ;CAE7C,OAAO,UAAU,QAAQ,WAAW;AACtC;AAEA,IAAM,kBAA8C,EAAE,UAAU,WAAW;CACzE,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,QAAQ,KAAK,MAAM,SAAS,EAAE,iBAAiB,QAAQ;CAC7D,MAAM,cAAc,KAAK,MAAM;CAC/B,MAAM,aAAa,KAAK,MAAM;CAC9B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK,MAAM,SAAS,IAAI;CAC7D,MAAM,YAAY,OAA2B,IAAI;CACjD,MAAM,aAAa,OAAO,MAAM;CAKhC,gBAAgB;EACd,IAAI,KAAK,MAAM,SAAS,MACtB,UAAU,IAAI;CAElB,GAAG,CAAC,KAAK,MAAM,IAAI,CAAC;CAEpB,gBAAgB;EACd,SAAS,KAAK,OAAoB;GAChC,IAAI,KAAK,MAAM,aAAa,OAAO,KAAK,EAAE,GAAG;IAC3C,UAAU,UACR,SAAS,yBAAyB,cAAc,SAAS,gBAAgB;IAC3E,UAAU,IAAI;GAChB;EACF;EAEA,SAAS,MAAM,OAAoB;GACjC,IAAI,CAAC,KAAK,MAAM,aAAa,OAAO,KAAK,EAAE,GACzC,UAAU,KAAK;EAEnB;EAEA,OAAO,iBAAiB,cAAc,WAAW,IAAI;EACrD,OAAO,iBAAiB,cAAc,YAAY,KAAK;EAEvD,aAAa;GACX,OAAO,oBAAoB,cAAc,WAAW,IAAI;GACxD,OAAO,oBAAoB,cAAc,YAAY,KAAK;EAC5D;CACF,GAAG,CAAC,KAAK,EAAE,CAAC;CAMZ,gBAAgB;EACd,IAAI,WAAW,WAAW,CAAC,QAAQ;GACjC,MAAM,SAAS,UAAU;GAEzB,IAAI,QACF,4BAA4B,OAAO,MAAM,CAAC;EAE9C;EAEA,WAAW,UAAU;CACvB,GAAG,CAAC,MAAM,CAAC;CAEX,OACE,oBAAC,QAAD;EAAQ,MAAM;EAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"modal.js","names":[],"sources":["../../resources/js/ui/modal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { Dialog, DialogContent, DialogHeader } from \"@lattice-php/lattice/ui/dialog\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/core/event-names\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\ntype ModalEvent = CustomEvent<{\n modal: string | null;\n}>;\n\nfunction matchesModal(event: Event, modal: string): boolean {\n const target = (event as ModalEvent).detail?.modal;\n\n return target == null || target === modal;\n}\n\nconst ModalComponent: RendererComponent<\"modal\"> = ({ children, node }) => {\n const { t } = useT(\"lattice\");\n const title = node.props.title ?? t(\"common.dialog\", \"Dialog\");\n const description = node.props.description;\n const closeLabel = node.props.closeLabel;\n const [isOpen, setIsOpen] = useState(node.props.open === true);\n const openerRef = useRef<HTMLElement | null>(null);\n const wasOpenRef = useRef(isOpen);\n\n // Honour server-driven open changes across re-renders, not just on mount. One\n // way on purpose: closing stays user/closeModal-driven so it never fights a\n // manual close, and the dep keeps it from re-firing while open stays true.\n useEffect(() => {\n if (node.props.open === true) {\n setIsOpen(true);\n }\n }, [node.props.open]);\n\n useEffect(() => {\n function open(event: Event): void {\n if (node.id && matchesModal(event, node.id)) {\n openerRef.current =\n document.activeElement instanceof HTMLElement ? document.activeElement : null;\n setIsOpen(true);\n }\n }\n\n function close(event: Event): void {\n if (!node.id || matchesModal(event, node.id)) {\n setIsOpen(false);\n }\n }\n\n window.addEventListener(LATTICE_EVENT.openModal, open);\n window.addEventListener(LATTICE_EVENT.closeModal, close);\n\n return () => {\n window.removeEventListener(LATTICE_EVENT.openModal, open);\n window.removeEventListener(LATTICE_EVENT.closeModal, close);\n };\n }, [node.id]);\n\n // Radix only restores focus to a `DialogTrigger`-registered element, and this\n // modal is opened imperatively rather than through one. Own the restore\n // ourselves instead: whatever had focus when the modal opened gets it back\n // once the closing dialog has finished unmounting.\n useEffect(() => {\n if (wasOpenRef.current && !isOpen) {\n const opener = openerRef.current;\n\n if (opener) {\n requestAnimationFrame(() => opener.focus());\n }\n }\n\n wasOpenRef.current = isOpen;\n }, [isOpen]);\n\n return (\n <Dialog open={isOpen} onOpenChange={setIsOpen}>\n <DialogContent\n {...(description ? {} : { \"aria-describedby\": undefined })}\n placement={node.props.side ?? \"center\"}\n width={node.props.width}\n >\n <DialogHeader closeLabel={closeLabel} description={description} title={title} />\n <div className=\"mt-6 space-y-6\">{children}</div>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default ModalComponent;\n"],"mappings":";;;;;;AAUA,SAAS,aAAa,OAAc,OAAwB;CAC1D,MAAM,SAAU,MAAqB,QAAQ;CAE7C,OAAO,UAAU,QAAQ,WAAW;AACtC;AAEA,IAAM,kBAA8C,EAAE,UAAU,WAAW;CACzE,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,QAAQ,KAAK,MAAM,SAAS,EAAE,iBAAiB,QAAQ;CAC7D,MAAM,cAAc,KAAK,MAAM;CAC/B,MAAM,aAAa,KAAK,MAAM;CAC9B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK,MAAM,SAAS,IAAI;CAC7D,MAAM,YAAY,OAA2B,IAAI;CACjD,MAAM,aAAa,OAAO,MAAM;CAKhC,gBAAgB;EACd,IAAI,KAAK,MAAM,SAAS,MACtB,UAAU,IAAI;CAElB,GAAG,CAAC,KAAK,MAAM,IAAI,CAAC;CAEpB,gBAAgB;EACd,SAAS,KAAK,OAAoB;GAChC,IAAI,KAAK,MAAM,aAAa,OAAO,KAAK,EAAE,GAAG;IAC3C,UAAU,UACR,SAAS,yBAAyB,cAAc,SAAS,gBAAgB;IAC3E,UAAU,IAAI;GAChB;EACF;EAEA,SAAS,MAAM,OAAoB;GACjC,IAAI,CAAC,KAAK,MAAM,aAAa,OAAO,KAAK,EAAE,GACzC,UAAU,KAAK;EAEnB;EAEA,OAAO,iBAAiB,cAAc,WAAW,IAAI;EACrD,OAAO,iBAAiB,cAAc,YAAY,KAAK;EAEvD,aAAa;GACX,OAAO,oBAAoB,cAAc,WAAW,IAAI;GACxD,OAAO,oBAAoB,cAAc,YAAY,KAAK;EAC5D;CACF,GAAG,CAAC,KAAK,EAAE,CAAC;CAMZ,gBAAgB;EACd,IAAI,WAAW,WAAW,CAAC,QAAQ;GACjC,MAAM,SAAS,UAAU;GAEzB,IAAI,QACF,4BAA4B,OAAO,MAAM,CAAC;EAE9C;EAEA,WAAW,UAAU;CACvB,GAAG,CAAC,MAAM,CAAC;CAEX,OACE,oBAAC,QAAD;EAAQ,MAAM;EAAQ,cAAc;EAClC,UAAA,qBAAC,eAAD;GACE,GAAK,cAAc,CAAC,IAAI,EAAE,oBAAoB,KAAA,EAAU;GACxD,WAAW,KAAK,MAAM,QAAQ;GAC9B,OAAO,KAAK,MAAM;GAHpB,UAAA,CAKE,oBAAC,cAAD;IAA0B;IAAyB;IAAoB;GAAQ,CAAA,GAC/E,oBAAC,OAAD;IAAK,WAAU;IAAkB;GAAc,CAAA,CAClC;;CACT,CAAA;AAEZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-input.js","names":[],"sources":["../../resources/js/ui/password-input.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport type { ComponentProps, Ref } from \"react\";\nimport { useState } from \"react\";\nimport { Input } from \"@lattice-php/lattice/ui/input\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\ntype PasswordInputProps = Omit<ComponentProps<\"input\">, \"type\"> & {\n passwordrules?: string;\n ref?: Ref<HTMLInputElement>;\n};\n\nexport default function PasswordInput({ className, ref, ...props }: PasswordInputProps) {\n const [showPassword, setShowPassword] = useState(false);\n\n return (\n <div className=\"relative\">\n <Input\n type={showPassword ? \"text\" : \"password\"}\n className={cn(\"pr-10\", className)}\n ref={ref}\n {...props}\n />\n <button\n type=\"button\"\n data-test={\n typeof props.name === \"string\" ? `${props.name}-visibility` : \"password-visibility\"\n }\n onClick={() => setShowPassword((prev) => !prev)}\n className=\"absolute inset-y-0 right-0 flex items-center rounded-r-lt-sm px-3 text-lt-muted-fg hover:text-lt-fg focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50 focus-visible:outline-none\"\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n tabIndex={-1}\n >\n {showPassword ? (\n <Icon name=\"eye-off\" className=\"size-lt-icon-md\" />\n ) : (\n <Icon name=\"eye\" className=\"size-lt-icon-md\" />\n )}\n </button>\n </div>\n );\n}\n"],"mappings":";;;;;;AAWA,SAAwB,cAAc,EAAE,WAAW,KAAK,GAAG,SAA6B;CACtF,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAEtD,OACE,qBAAC,OAAD;EAAK,WAAU;
|
|
1
|
+
{"version":3,"file":"password-input.js","names":[],"sources":["../../resources/js/ui/password-input.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport type { ComponentProps, Ref } from \"react\";\nimport { useState } from \"react\";\nimport { Input } from \"@lattice-php/lattice/ui/input\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\ntype PasswordInputProps = Omit<ComponentProps<\"input\">, \"type\"> & {\n passwordrules?: string;\n ref?: Ref<HTMLInputElement>;\n};\n\nexport default function PasswordInput({ className, ref, ...props }: PasswordInputProps) {\n const [showPassword, setShowPassword] = useState(false);\n\n return (\n <div className=\"relative\">\n <Input\n type={showPassword ? \"text\" : \"password\"}\n className={cn(\"pr-10\", className)}\n ref={ref}\n {...props}\n />\n <button\n type=\"button\"\n data-test={\n typeof props.name === \"string\" ? `${props.name}-visibility` : \"password-visibility\"\n }\n onClick={() => setShowPassword((prev) => !prev)}\n className=\"absolute inset-y-0 right-0 flex items-center rounded-r-lt-sm px-3 text-lt-muted-fg hover:text-lt-fg focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50 focus-visible:outline-none\"\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n tabIndex={-1}\n >\n {showPassword ? (\n <Icon name=\"eye-off\" className=\"size-lt-icon-md\" />\n ) : (\n <Icon name=\"eye\" className=\"size-lt-icon-md\" />\n )}\n </button>\n </div>\n );\n}\n"],"mappings":";;;;;;AAWA,SAAwB,cAAc,EAAE,WAAW,KAAK,GAAG,SAA6B;CACtF,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAEtD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,OAAD;GACE,MAAM,eAAe,SAAS;GAC9B,WAAW,GAAG,SAAS,SAAS;GAC3B;GACL,GAAI;EACL,CAAA,GACD,oBAAC,UAAD;GACE,MAAK;GACL,aACE,OAAO,MAAM,SAAS,WAAW,GAAG,MAAM,KAAK,eAAe;GAEhE,eAAe,iBAAiB,SAAS,CAAC,IAAI;GAC9C,WAAU;GACV,cAAY,eAAe,kBAAkB;GAC7C,UAAU;GAET,UAAA,eACC,oBAAC,MAAD;IAAM,MAAK;IAAU,WAAU;GAAmB,CAAA,IAElD,oBAAC,MAAD;IAAM,MAAK;IAAM,WAAU;GAAmB,CAAA;EAE1C,CAAA,CACL;;AAET"}
|
package/dist/ui/progress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","names":[],"sources":["../../resources/js/ui/progress.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useLocale } from \"@lattice-php/lattice/i18n\";\nimport { coerceColor, colorValue, namedColor } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\n\nconst barHeights: Record<Size, string> = {\n xs: \"h-1\",\n sm: \"h-1.5\",\n md: \"h-2.5\",\n lg: \"h-3\",\n xl: \"h-4\",\n \"2xl\": \"h-5\",\n \"3xl\": \"h-6\",\n \"4xl\": \"h-8\",\n};\n\nconst circleDiameters: Record<Size, number> = {\n xs: 24,\n sm: 32,\n md: 40,\n lg: 48,\n xl: 64,\n \"2xl\": 80,\n \"3xl\": 96,\n \"4xl\": 128,\n};\n\nconst circleReadouts: Record<Size, string> = {\n xs: \"text-[0.5rem]\",\n sm: \"text-[0.625rem]\",\n md: \"text-xs\",\n lg: \"text-sm\",\n xl: \"text-base\",\n \"2xl\": \"text-lg\",\n \"3xl\": \"text-xl\",\n \"4xl\": \"text-2xl\",\n};\n\nconst ProgressComponent: RendererComponent<\"progress\"> = ({ node }) => {\n const { value, max, shape, showValue, color, size } = node.props;\n const { locale } = useLocale();\n const paint = colorValue(coerceColor(color) ?? namedColor(\"primary\"));\n\n const clamped = max > 0 ? Math.min(Math.max(value, 0), max) : 0;\n const ratio = max > 0 ? clamped / max : 0;\n const percent = new Intl.NumberFormat(locale, {\n maximumFractionDigits: 0,\n style: \"percent\",\n }).format(ratio);\n\n const aria = {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": clamped,\n \"aria-valuetext\": percent,\n role: \"progressbar\",\n } as const;\n\n if (shape === \"circle\") {\n const diameter = circleDiameters[size];\n const strokeWidth = Math.max(3, diameter / 10);\n const radius = (diameter - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n\n return (\n <div {...aria} className=\"relative inline-flex\" data-lattice-progress=\"circle\">\n <svg className=\"-rotate-90\" height={diameter} width={diameter}>\n <circle\n className=\"text-lt-muted\"\n cx={diameter / 2}\n cy={diameter / 2}\n fill=\"none\"\n r={radius}\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n />\n <circle\n cx={diameter / 2}\n cy={diameter / 2}\n fill=\"none\"\n r={radius}\n stroke=\"currentColor\"\n strokeDasharray={circumference}\n strokeDashoffset={circumference * (1 - ratio)}\n strokeLinecap=\"round\"\n strokeWidth={strokeWidth}\n style={{ color: paint }}\n />\n </svg>\n {showValue && (\n <span\n className={cn(\n \"absolute inset-0 flex items-center justify-center font-medium text-lt-fg tabular-nums\",\n circleReadouts[size],\n )}\n >\n {percent}\n </span>\n )}\n </div>\n );\n }\n\n return (\n <div className=\"flex w-full items-center gap-2\" data-lattice-progress=\"bar\">\n <div\n {...aria}\n className={cn(\"w-full overflow-hidden rounded-full bg-lt-muted\", barHeights[size])}\n >\n <div\n className=\"h-full rounded-full\"\n style={{ background: paint, width: `${ratio * 100}%` }}\n />\n </div>\n {showValue && (\n <span className=\"shrink-0 text-lt-muted-fg text-sm tabular-nums\">{percent}</span>\n )}\n </div>\n );\n};\n\nexport default ProgressComponent;\n"],"mappings":";;;;;AAMA,IAAM,aAAmC;CACvC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,kBAAwC;CAC5C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,iBAAuC;CAC3C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,qBAAoD,EAAE,WAAW;CACrE,MAAM,EAAE,OAAO,KAAK,OAAO,WAAW,OAAO,SAAS,KAAK;CAC3D,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAK,WAAW,SAAS,CAAC;CAEpE,MAAM,UAAU,MAAM,IAAI,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,GAAG,IAAI;CAC9D,MAAM,QAAQ,MAAM,IAAI,UAAU,MAAM;CACxC,MAAM,UAAU,IAAI,KAAK,aAAa,QAAQ;EAC5C,uBAAuB;EACvB,OAAO;CACT,CAAC,
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../../resources/js/ui/progress.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useLocale } from \"@lattice-php/lattice/i18n\";\nimport { coerceColor, colorValue, namedColor } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\n\nconst barHeights: Record<Size, string> = {\n xs: \"h-1\",\n sm: \"h-1.5\",\n md: \"h-2.5\",\n lg: \"h-3\",\n xl: \"h-4\",\n \"2xl\": \"h-5\",\n \"3xl\": \"h-6\",\n \"4xl\": \"h-8\",\n};\n\nconst circleDiameters: Record<Size, number> = {\n xs: 24,\n sm: 32,\n md: 40,\n lg: 48,\n xl: 64,\n \"2xl\": 80,\n \"3xl\": 96,\n \"4xl\": 128,\n};\n\nconst circleReadouts: Record<Size, string> = {\n xs: \"text-[0.5rem]\",\n sm: \"text-[0.625rem]\",\n md: \"text-xs\",\n lg: \"text-sm\",\n xl: \"text-base\",\n \"2xl\": \"text-lg\",\n \"3xl\": \"text-xl\",\n \"4xl\": \"text-2xl\",\n};\n\nconst ProgressComponent: RendererComponent<\"progress\"> = ({ node }) => {\n const { value, max, shape, showValue, color, size } = node.props;\n const { locale } = useLocale();\n const paint = colorValue(coerceColor(color) ?? namedColor(\"primary\"));\n\n const clamped = max > 0 ? Math.min(Math.max(value, 0), max) : 0;\n const ratio = max > 0 ? clamped / max : 0;\n const percent = new Intl.NumberFormat(locale, {\n maximumFractionDigits: 0,\n style: \"percent\",\n }).format(ratio);\n\n const aria = {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": clamped,\n \"aria-valuetext\": percent,\n role: \"progressbar\",\n } as const;\n\n if (shape === \"circle\") {\n const diameter = circleDiameters[size];\n const strokeWidth = Math.max(3, diameter / 10);\n const radius = (diameter - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n\n return (\n <div {...aria} className=\"relative inline-flex\" data-lattice-progress=\"circle\">\n <svg className=\"-rotate-90\" height={diameter} width={diameter}>\n <circle\n className=\"text-lt-muted\"\n cx={diameter / 2}\n cy={diameter / 2}\n fill=\"none\"\n r={radius}\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n />\n <circle\n cx={diameter / 2}\n cy={diameter / 2}\n fill=\"none\"\n r={radius}\n stroke=\"currentColor\"\n strokeDasharray={circumference}\n strokeDashoffset={circumference * (1 - ratio)}\n strokeLinecap=\"round\"\n strokeWidth={strokeWidth}\n style={{ color: paint }}\n />\n </svg>\n {showValue && (\n <span\n className={cn(\n \"absolute inset-0 flex items-center justify-center font-medium text-lt-fg tabular-nums\",\n circleReadouts[size],\n )}\n >\n {percent}\n </span>\n )}\n </div>\n );\n }\n\n return (\n <div className=\"flex w-full items-center gap-2\" data-lattice-progress=\"bar\">\n <div\n {...aria}\n className={cn(\"w-full overflow-hidden rounded-full bg-lt-muted\", barHeights[size])}\n >\n <div\n className=\"h-full rounded-full\"\n style={{ background: paint, width: `${ratio * 100}%` }}\n />\n </div>\n {showValue && (\n <span className=\"shrink-0 text-lt-muted-fg text-sm tabular-nums\">{percent}</span>\n )}\n </div>\n );\n};\n\nexport default ProgressComponent;\n"],"mappings":";;;;;AAMA,IAAM,aAAmC;CACvC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,kBAAwC;CAC5C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,O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AO,MAAM;IACvB,CAAA,CACE;GACJ,CAAA,GAAA,aACC,oBAAC,QAAD;IACE,WAAW,GACT,yFACA,eAAe,KACjB;IAEC,UAAA;GACG,CAAA,CAEL;;CAET;CAEA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAiC,yBAAsB;EAAtE,UAAA,CACE,oBAAC,OAAD;GACE,GAAI;GACJ,WAAW,GAAG,mDAAmD,WAAW,KAAK;GAEjF,UAAA,oBAAC,OAAD;IACE,WAAU;IACV,OAAO;KAAE,YAAY;KAAO,OAAO,GAAG,QAAQ,IAAI;IAAG;GACtD,CAAA;EACE,CAAA,GACJ,aACC,oBAAC,QAAD;GAAM,WAAU;GAAkD,UAAA;EAAc,CAAA,CAE/E;;AAET"}
|
package/dist/ui/section.js
CHANGED
|
@@ -13,13 +13,15 @@ var SectionComponent = ({ children, node }) => {
|
|
|
13
13
|
const rememberState = node.props.rememberState !== false;
|
|
14
14
|
const headerActions = toNodes(node.props.headerActions);
|
|
15
15
|
const identity = nodeIdentity(node);
|
|
16
|
-
const
|
|
16
|
+
const storageKey = `lattice:section:${identity ?? "default"}`;
|
|
17
|
+
const [collapsed, toggle] = useCollapsibleState(storageKey, node.props.collapsed === true, collapsible && rememberState);
|
|
17
18
|
const isCollapsed = collapsible && collapsed;
|
|
19
|
+
const hasHeader = Boolean(title || description || headerActions.length > 0 || collapsible);
|
|
18
20
|
return /* @__PURE__ */ jsxs("section", {
|
|
19
21
|
"data-slot": "section",
|
|
20
22
|
className: "flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm",
|
|
21
23
|
"data-lattice-component": identity,
|
|
22
|
-
children: [
|
|
24
|
+
children: [hasHeader && /* @__PURE__ */ jsxs("div", {
|
|
23
25
|
className: "flex items-start justify-between gap-4 px-lt-gutter",
|
|
24
26
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
25
27
|
className: "flex min-w-0 items-start gap-2",
|
package/dist/ui/section.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.js","names":[],"sources":["../../resources/js/ui/section.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { nodeIdentity, prefixedTestId } from \"@lattice-php/lattice/core/test-id\";\nimport { toNodes } from \"@lattice-php/lattice/core/nodes\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { InfoTooltip } from \"./info-tooltip\";\nimport { useCollapsibleState } from \"./use-collapsible-state\";\n\nconst SectionComponent: RendererComponent<\"section\"> = ({ children, node }) => {\n const { title, description, tooltip } = node.props;\n const collapsible = node.props.collapsible === true;\n const rememberState = node.props.rememberState !== false;\n const headerActions = toNodes(node.props.headerActions);\n const identity = nodeIdentity(node);\n const storageKey = `lattice:section:${identity ?? \"default\"}`;\n\n const [collapsed, toggle] = useCollapsibleState(\n storageKey,\n node.props.collapsed === true,\n collapsible && rememberState,\n );\n\n const isCollapsed = collapsible && collapsed;\n const hasHeader = Boolean(title || description || headerActions.length > 0 || collapsible);\n\n return (\n <section\n data-slot=\"section\"\n className=\"flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={identity}\n >\n {hasHeader && (\n <div className=\"flex items-start justify-between gap-4 px-lt-gutter\">\n <div className=\"flex min-w-0 items-start gap-2\">\n {collapsible && (\n <button\n aria-expanded={!isCollapsed}\n aria-label={isCollapsed ? \"Expand section\" : \"Collapse section\"}\n data-test={prefixedTestId(\"section-toggle\", identity) ?? \"section-toggle-default\"}\n className=\"mt-0.5 inline-flex shrink-0 items-center rounded-lt-sm p-0.5 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg\"\n onClick={toggle}\n type=\"button\"\n >\n <Icon\n name=\"chevron-down\"\n className={cn(\n \"size-lt-icon-md transition-transform\",\n isCollapsed && \"-rotate-90\",\n )}\n />\n </button>\n )}\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title && (\n <div className=\"flex items-center\">\n <div className=\"font-semibold leading-none\">{title}</div>\n <InfoTooltip content={tooltip} />\n </div>\n )}\n {description && (\n <div className=\"flex items-center\">\n <div className=\"text-sm text-lt-muted-fg\">{description}</div>\n {!title && <InfoTooltip content={tooltip} />}\n </div>\n )}\n </div>\n </div>\n\n {headerActions.length > 0 && (\n <div className=\"flex shrink-0 items-center gap-2\">\n <Renderer nodes={headerActions} />\n </div>\n )}\n </div>\n )}\n\n {!isCollapsed && children && (\n <div className=\"flex flex-col gap-6 px-lt-gutter\">{children}</div>\n )}\n </section>\n );\n};\n\nexport default SectionComponent;\n"],"mappings":";;;;;;;;;AASA,IAAM,oBAAkD,EAAE,UAAU,WAAW;CAC7E,MAAM,EAAE,OAAO,aAAa,YAAY,KAAK;CAC7C,MAAM,cAAc,KAAK,MAAM,gBAAgB;CAC/C,MAAM,gBAAgB,KAAK,MAAM,kBAAkB;CACnD,MAAM,gBAAgB,QAAQ,KAAK,MAAM,aAAa;CACtD,MAAM,WAAW,aAAa,IAAI;
|
|
1
|
+
{"version":3,"file":"section.js","names":[],"sources":["../../resources/js/ui/section.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { nodeIdentity, prefixedTestId } from \"@lattice-php/lattice/core/test-id\";\nimport { toNodes } from \"@lattice-php/lattice/core/nodes\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { InfoTooltip } from \"./info-tooltip\";\nimport { useCollapsibleState } from \"./use-collapsible-state\";\n\nconst SectionComponent: RendererComponent<\"section\"> = ({ children, node }) => {\n const { title, description, tooltip } = node.props;\n const collapsible = node.props.collapsible === true;\n const rememberState = node.props.rememberState !== false;\n const headerActions = toNodes(node.props.headerActions);\n const identity = nodeIdentity(node);\n const storageKey = `lattice:section:${identity ?? \"default\"}`;\n\n const [collapsed, toggle] = useCollapsibleState(\n storageKey,\n node.props.collapsed === true,\n collapsible && rememberState,\n );\n\n const isCollapsed = collapsible && collapsed;\n const hasHeader = Boolean(title || description || headerActions.length > 0 || collapsible);\n\n return (\n <section\n data-slot=\"section\"\n className=\"flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={identity}\n >\n {hasHeader && (\n <div className=\"flex items-start justify-between gap-4 px-lt-gutter\">\n <div className=\"flex min-w-0 items-start gap-2\">\n {collapsible && (\n <button\n aria-expanded={!isCollapsed}\n aria-label={isCollapsed ? \"Expand section\" : \"Collapse section\"}\n data-test={prefixedTestId(\"section-toggle\", identity) ?? \"section-toggle-default\"}\n className=\"mt-0.5 inline-flex shrink-0 items-center rounded-lt-sm p-0.5 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg\"\n onClick={toggle}\n type=\"button\"\n >\n <Icon\n name=\"chevron-down\"\n className={cn(\n \"size-lt-icon-md transition-transform\",\n isCollapsed && \"-rotate-90\",\n )}\n />\n </button>\n )}\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title && (\n <div className=\"flex items-center\">\n <div className=\"font-semibold leading-none\">{title}</div>\n <InfoTooltip content={tooltip} />\n </div>\n )}\n {description && (\n <div className=\"flex items-center\">\n <div className=\"text-sm text-lt-muted-fg\">{description}</div>\n {!title && <InfoTooltip content={tooltip} />}\n </div>\n )}\n </div>\n </div>\n\n {headerActions.length > 0 && (\n <div className=\"flex shrink-0 items-center gap-2\">\n <Renderer nodes={headerActions} />\n </div>\n )}\n </div>\n )}\n\n {!isCollapsed && children && (\n <div className=\"flex flex-col gap-6 px-lt-gutter\">{children}</div>\n )}\n </section>\n );\n};\n\nexport default SectionComponent;\n"],"mappings":";;;;;;;;;AASA,IAAM,oBAAkD,EAAE,UAAU,WAAW;CAC7E,MA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B,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,oBAAC,UAAD,EAAU,OAAO,cAAgB,CAAA;GAC9B,CAAA,CAEJ;EAGN,CAAA,GAAA,CAAC,eAAe,YACf,oBAAC,OAAD;GAAK,WAAU;GAAoC;EAAc,CAAA,CAE5D;;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-control.js","names":[],"sources":["../../resources/js/ui/segmented-control.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { SegmentedPills } from \"./segmented-pills\";\n\nconst SegmentedControlComponent: RendererComponent<\"segmented-control\"> = ({ node }) => {\n const { options, name, emits } = node.props;\n const [value, setValue] = useState(node.props.value || options[0]?.value || \"\");\n\n if (options.length === 0) {\n return null;\n }\n\n function select(next: string): void {\n setValue(next);\n\n if (emits) {\n window.dispatchEvent(new CustomEvent(emits, { detail: { name, value: next } }));\n }\n }\n\n return (\n <SegmentedPills\n ariaLabel={node.props.label ?? undefined}\n name={name}\n onSelect={select}\n options={options}\n value={value}\n />\n );\n};\n\nexport default SegmentedControlComponent;\n"],"mappings":";;;;AAIA,IAAM,6BAAqE,EAAE,WAAW;CACtF,MAAM,EAAE,SAAS,MAAM,UAAU,KAAK;CACtC,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK,MAAM,SAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"segmented-control.js","names":[],"sources":["../../resources/js/ui/segmented-control.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { SegmentedPills } from \"./segmented-pills\";\n\nconst SegmentedControlComponent: RendererComponent<\"segmented-control\"> = ({ node }) => {\n const { options, name, emits } = node.props;\n const [value, setValue] = useState(node.props.value || options[0]?.value || \"\");\n\n if (options.length === 0) {\n return null;\n }\n\n function select(next: string): void {\n setValue(next);\n\n if (emits) {\n window.dispatchEvent(new CustomEvent(emits, { detail: { name, value: next } }));\n }\n }\n\n return (\n <SegmentedPills\n ariaLabel={node.props.label ?? undefined}\n name={name}\n onSelect={select}\n options={options}\n value={value}\n />\n );\n};\n\nexport default SegmentedControlComponent;\n"],"mappings":";;;;AAIA,IAAM,6BAAqE,EAAE,WAAW;CACtF,MAAM,EAAE,SAAS,MAAM,UAAU,KAAK;CACtC,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK,MAAM,SAAS,QAAQ,EAAE,EAAE,SAAS,EAAE;CAE9E,IAAI,QAAQ,WAAW,GACrB,OAAO;CAGT,SAAS,OAAO,MAAoB;EAClC,SAAS,IAAI;EAEb,IAAI,OACF,OAAO,cAAc,IAAI,YAAY,OAAO,EAAE,QAAQ;GAAE;GAAM,OAAO;EAAK,EAAE,CAAC,CAAC;CAElF;CAEA,OACE,oBAAC,gBAAD;EACE,WAAW,KAAK,MAAM,SAAS,KAAA;EACzB;EACN,UAAU;EACD;EACF;CACR,CAAA;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-pills.js","names":[],"sources":["../../resources/js/ui/segmented-pills.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport type { Option } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { pillClassName } from \"./pill\";\n\n/**\n * Presentational segmented pill group. Used by the form choice field (bound to a\n * form value) and the core segmented control (standalone, emits an event).\n */\nexport function SegmentedPills({\n ariaLabel,\n autoFocus = false,\n disabled = false,\n name,\n onSelect,\n options,\n tabIndex,\n value,\n}: {\n ariaLabel?: string;\n autoFocus?: boolean;\n disabled?: boolean;\n name?: string;\n onSelect: (value: string) => void;\n options: Option[];\n tabIndex?: number;\n value: string;\n}) {\n const groupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!autoFocus) {\n return;\n }\n\n const group = groupRef.current;\n const target =\n group?.querySelector<HTMLButtonElement>('button[aria-checked=\"true\"]') ??\n group?.querySelector<HTMLButtonElement>(\"button\");\n\n target?.focus();\n }, [autoFocus]);\n\n return (\n <div\n aria-label={ariaLabel}\n className=\"inline-flex w-fit max-w-full gap-1 overflow-x-auto rounded-lt bg-lt-muted p-1\"\n ref={groupRef}\n role=\"radiogroup\"\n >\n {options.map((option) => {\n const isSelected = value === option.value;\n\n return (\n <button\n aria-checked={isSelected}\n data-test={`${name ?? \"segment\"}-${option.value}`}\n className={cn(pillClassName(isSelected), disabled && \"cursor-not-allowed opacity-60\")}\n disabled={disabled}\n key={option.value}\n onClick={() => onSelect(option.value)}\n role=\"radio\"\n tabIndex={tabIndex}\n type=\"button\"\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,eAAe,EAC7B,WACA,YAAY,OACZ,WAAW,OACX,MACA,UACA,SACA,UACA,SAUC;CACD,MAAM,WAAW,OAAuB,IAAI;CAE5C,gBAAgB;EACd,IAAI,CAAC,WACH;EAGF,MAAM,QAAQ,SAAS;EAKvB,CAHE,OAAO,cAAiC,+BAA6B,KACrE,OAAO,cAAiC,QAAQ,
|
|
1
|
+
{"version":3,"file":"segmented-pills.js","names":[],"sources":["../../resources/js/ui/segmented-pills.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport type { Option } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { pillClassName } from \"./pill\";\n\n/**\n * Presentational segmented pill group. Used by the form choice field (bound to a\n * form value) and the core segmented control (standalone, emits an event).\n */\nexport function SegmentedPills({\n ariaLabel,\n autoFocus = false,\n disabled = false,\n name,\n onSelect,\n options,\n tabIndex,\n value,\n}: {\n ariaLabel?: string;\n autoFocus?: boolean;\n disabled?: boolean;\n name?: string;\n onSelect: (value: string) => void;\n options: Option[];\n tabIndex?: number;\n value: string;\n}) {\n const groupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!autoFocus) {\n return;\n }\n\n const group = groupRef.current;\n const target =\n group?.querySelector<HTMLButtonElement>('button[aria-checked=\"true\"]') ??\n group?.querySelector<HTMLButtonElement>(\"button\");\n\n target?.focus();\n }, [autoFocus]);\n\n return (\n <div\n aria-label={ariaLabel}\n className=\"inline-flex w-fit max-w-full gap-1 overflow-x-auto rounded-lt bg-lt-muted p-1\"\n ref={groupRef}\n role=\"radiogroup\"\n >\n {options.map((option) => {\n const isSelected = value === option.value;\n\n return (\n <button\n aria-checked={isSelected}\n data-test={`${name ?? \"segment\"}-${option.value}`}\n className={cn(pillClassName(isSelected), disabled && \"cursor-not-allowed opacity-60\")}\n disabled={disabled}\n key={option.value}\n onClick={() => onSelect(option.value)}\n role=\"radio\"\n tabIndex={tabIndex}\n type=\"button\"\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,eAAe,EAC7B,WACA,YAAY,OACZ,WAAW,OACX,MACA,UACA,SACA,UACA,SAUC;CACD,MAAM,WAAW,OAAuB,IAAI;CAE5C,gBAAgB;EACd,IAAI,CAAC,WACH;EAGF,MAAM,QAAQ,SAAS;EAKvB,CAHE,OAAO,cAAiC,+BAA6B,KACrE,OAAO,cAAiC,QAAQ,EAAA,EAE1C,MAAM;CAChB,GAAG,CAAC,SAAS,CAAC;CAEd,OACE,oBAAC,OAAD;EACE,cAAY;EACZ,WAAU;EACV,KAAK;EACL,MAAK;EAEJ,UAAA,QAAQ,KAAK,WAAW;GACvB,MAAM,aAAa,UAAU,OAAO;GAEpC,OACE,oBAAC,UAAD;IACE,gBAAc;IACd,aAAW,GAAG,QAAQ,UAAU,GAAG,OAAO;IAC1C,WAAW,GAAG,cAAc,UAAU,GAAG,YAAY,+BAA+B;IAC1E;IAEV,eAAe,SAAS,OAAO,KAAK;IACpC,MAAK;IACK;IACV,MAAK;IAEJ,UAAA,OAAO;GACF,GAPD,OAAO,KAON;EAEZ,CAAC;CACE,CAAA;AAET"}
|
package/dist/ui/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":[],"sources":["../../resources/js/ui/tabs.tsx"],"sourcesContent":["import { router } from \"@inertiajs/react\";\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport type { Node, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport type { Tab } from \"@lattice-php/lattice/types/generated\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { pillClassName } from \"./pill\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\ntype TabsContextValue = {\n activeValue: string;\n setActiveValue: (value: string) => void;\n};\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(): TabsContextValue {\n const context = useContext(TabsContext);\n\n if (!context) {\n return {\n activeValue: \"\",\n setActiveValue: () => {},\n };\n }\n\n return context;\n}\n\ntype TabItem = {\n confirm?: {\n required?: boolean;\n };\n label: string;\n value: string;\n};\n\nfunction getTabs(node: Node): TabItem[] {\n return (node.schema ?? [])\n .filter((child) => child.type === \"tab\")\n .map((child) => {\n const props = child.props as unknown as Tab;\n\n return {\n confirm: props.confirm ? { required: props.confirm.required } : undefined,\n label: props.label,\n value: props.value,\n };\n })\n .filter((tab) => tab.value !== \"\");\n}\n\nfunction queryValue(queryKey: string, tabs: Array<{ value: string }>): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n const value = new URLSearchParams(window.location.search).get(queryKey);\n\n if (!value || !tabs.some((tab) => tab.value === value)) {\n return null;\n }\n\n return value;\n}\n\nfunction replaceQueryValue(queryKey: string, value: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n window.history.replaceState(window.history.state, \"\", `${url.pathname}${url.search}${url.hash}`);\n}\n\nfunction queryUrl(queryKey: string, value: string): string {\n if (typeof window === \"undefined\") {\n return \"\";\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n\n return `${url.pathname}${url.search}${url.hash}`;\n}\n\nexport const TabsComponent: RendererComponent<\"tabs\"> = ({ children, node }) => {\n const { t } = useT(\"lattice\");\n const tabs = useMemo(() => getTabs(node), [node]);\n const firstValue = tabs[0]?.value ?? \"\";\n const queryKey = node.props.queryKey;\n const orientation = node.props.orientation;\n const isVertical = orientation === \"vertical\";\n const alignment = node.props.alignment;\n const isStretched = !isVertical && alignment === \"stretch\";\n const serverActiveValue = node.props.activeValue;\n const defaultValue = node.props.defaultValue ?? firstValue;\n const tablistRef = useRef<HTMLDivElement>(null);\n const [activeValue, setActiveTabValue] = useState(\n () => serverActiveValue || (queryValue(queryKey, tabs) ?? defaultValue) || firstValue,\n );\n\n const selectTab = useCallback(\n (tab: TabItem): void => {\n if (tab.confirm?.required) {\n router.visit(queryUrl(queryKey, tab.value), {\n preserveScroll: true,\n });\n\n return;\n }\n\n setActiveTabValue(tab.value);\n replaceQueryValue(queryKey, tab.value);\n },\n [queryKey],\n );\n\n const selectTabValue = useCallback(\n (value: string): void => {\n const tab = tabs.find((item) => item.value === value);\n\n if (tab) {\n selectTab(tab);\n }\n },\n [selectTab, tabs],\n );\n\n const contextValue = useMemo(\n () => ({ activeValue, setActiveValue: selectTabValue }),\n [activeValue, selectTabValue],\n );\n\n function onTablistKeyDown(event: KeyboardEvent<HTMLButtonElement>): void {\n const nextKey = isVertical ? \"ArrowDown\" : \"ArrowRight\";\n const prevKey = isVertical ? \"ArrowUp\" : \"ArrowLeft\";\n\n if (\n event.key !== nextKey &&\n event.key !== prevKey &&\n event.key !== \"Home\" &&\n event.key !== \"End\"\n ) {\n return;\n }\n\n const buttons = Array.from(\n tablistRef.current?.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]') ?? [],\n );\n\n if (buttons.length === 0) {\n return;\n }\n\n event.preventDefault();\n const current = buttons.indexOf(document.activeElement as HTMLButtonElement);\n\n let index: number;\n if (event.key === \"Home\") {\n index = 0;\n } else if (event.key === \"End\") {\n index = buttons.length - 1;\n } else {\n const delta = event.key === nextKey ? 1 : -1;\n const base = current < 0 ? 0 : current;\n index = (base + delta + buttons.length) % buttons.length;\n }\n\n buttons[index]?.focus();\n }\n\n return (\n <TabsContext.Provider value={contextValue}>\n <div\n className={cn(\n \"gap-6\",\n isVertical ? cn(\"flex\", alignment === \"end\" && \"flex-row-reverse\") : \"grid\",\n )}\n data-lattice-tabs={node.key ?? node.id}\n >\n <div\n aria-label={t(\"common.tabs\", \"Tabs\")}\n aria-orientation={orientation}\n className={cn(\n \"gap-1 rounded-lt bg-lt-muted p-1\",\n isVertical && \"flex flex-col\",\n isStretched && \"flex w-full\",\n !isVertical &&\n !isStretched &&\n cn(\"inline-flex w-fit max-w-full overflow-x-auto\", {\n \"justify-self-center\": alignment === \"center\",\n \"justify-self-end\": alignment === \"end\",\n }),\n )}\n ref={tablistRef}\n role=\"tablist\"\n >\n {tabs.map((tab) => {\n const isActive = activeValue === tab.value;\n\n return (\n <button\n aria-controls={`${tab.value}-panel`}\n aria-selected={isActive}\n data-test={`tab-${tab.value}`}\n className={cn(\n pillClassName(isActive),\n isVertical && \"text-left\",\n isStretched && \"flex-1\",\n )}\n id={`${tab.value}-tab`}\n key={tab.value}\n onClick={() => selectTab(tab)}\n onKeyDown={onTablistKeyDown}\n role=\"tab\"\n tabIndex={isActive ? 0 : -1}\n type=\"button\"\n >\n {tab.label}\n </button>\n );\n })}\n </div>\n\n <div className={cn(\"min-w-0\", isVertical && \"flex-1\")}>{children}</div>\n </div>\n </TabsContext.Provider>\n );\n};\n\nconst TabComponent: RendererComponent<\"tab\"> = ({ children, node }) => {\n const { activeValue } = useTabsContext();\n const value = node.props.value;\n const isActive = activeValue === value;\n const [hasOpened, setHasOpened] = useState(isActive);\n\n useEffect(() => {\n if (isActive) {\n setHasOpened(true);\n }\n }, [isActive]);\n\n return (\n <section\n aria-labelledby={`${value}-tab`}\n className={cn(\"space-y-8\", !isActive && \"hidden\")}\n hidden={!isActive}\n id={`${value}-panel`}\n role=\"tabpanel\"\n tabIndex={0}\n >\n {hasOpened ? (children as ReactNode) : null}\n </section>\n );\n};\n\nexport default TabComponent;\n"],"mappings":";;;;;;;AAsBA,IAAM,cAAc,cAAuC,IAAI;AAE/D,SAAS,iBAAmC;CAC1C,MAAM,UAAU,WAAW,WAAW;CAEtC,IAAI,CAAC,SACH,OAAO;EACL,aAAa;EACb,sBAAsB,CAAC;CACzB;CAGF,OAAO;AACT;AAUA,SAAS,QAAQ,MAAuB;CACtC,QAAQ,KAAK,UAAU,CAAC,GACrB,QAAQ,UAAU,MAAM,SAAS,KAAK,EACtC,KAAK,UAAU;EACd,MAAM,QAAQ,MAAM;EAEpB,OAAO;GACL,SAAS,MAAM,UAAU,EAAE,UAAU,MAAM,QAAQ,SAAS,IAAI,KAAA;GAChE,OAAO,MAAM;GACb,OAAO,MAAM;EACf;CACF,CAAC,EACA,QAAQ,QAAQ,IAAI,UAAU,EAAE;AACrC;AAEA,SAAS,WAAW,UAAkB,MAA+C;CACnF,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,MAAM,QAAQ,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAAE,IAAI,QAAQ;CAEtE,IAAI,CAAC,SAAS,CAAC,KAAK,MAAM,QAAQ,IAAI,UAAU,KAAK,GACnD,OAAO;CAGT,OAAO;AACT;AAEA,SAAS,kBAAkB,UAAkB,OAAqB;CAChE,IAAI,OAAO,WAAW,aACpB;CAGF,MAAM,MAAM,IAAI,IAAI,OAAO,SAAS,IAAI;CACxC,IAAI,aAAa,IAAI,UAAU,KAAK;CACpC,OAAO,QAAQ,aAAa,OAAO,QAAQ,OAAO,IAAI,GAAG,IAAI,WAAW,IAAI,SAAS,IAAI,MAAM;AACjG;AAEA,SAAS,SAAS,UAAkB,OAAuB;CACzD,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,MAAM,MAAM,IAAI,IAAI,OAAO,SAAS,IAAI;CACxC,IAAI,aAAa,IAAI,UAAU,K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AAG,WAAW,cAAc,QAAQ;IAAI;GAAc,CAAA,CACnE;;CACe,CAAA;AAE1B;AAEA,IAAM,gBAA0C,EAAE,UAAU,WAAW;CACrE,MAAM,EAAE,gBAAgB,eAAe;CACvC,MAAM,QAAQ,KAAK,MAAM;CACzB,MAAM,WAAW,gBAAgB;CACjC,MAAM,CAAC,WAAW,gBAAgB,SAAS,QAAQ;CAEnD,gBAAgB;EACd,IAAI,UACF,aAAa,IAAI;CAErB,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,oBAAC,WAAD;EACE,mBAAiB,GAAG,MAAM;EAC1B,WAAW,GAAG,aAAa,CAAC,YAAY,QAAQ;EAChD,QAAQ,CAAC;EACT,IAAI,GAAG,MAAM;EACb,MAAK;EACL,UAAU;YAET,YAAa,WAAyB;CAChC,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"tabs.js","names":[],"sources":["../../resources/js/ui/tabs.tsx"],"sourcesContent":["import { router } from \"@inertiajs/react\";\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport type { Node, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport type { Tab } from \"@lattice-php/lattice/types/generated\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { pillClassName } from \"./pill\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\ntype TabsContextValue = {\n activeValue: string;\n setActiveValue: (value: string) => void;\n};\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(): TabsContextValue {\n const context = useContext(TabsContext);\n\n if (!context) {\n return {\n activeValue: \"\",\n setActiveValue: () => {},\n };\n }\n\n return context;\n}\n\ntype TabItem = {\n confirm?: {\n required?: boolean;\n };\n label: string;\n value: string;\n};\n\nfunction getTabs(node: Node): TabItem[] {\n return (node.schema ?? [])\n .filter((child) => child.type === \"tab\")\n .map((child) => {\n const props = child.props as unknown as Tab;\n\n return {\n confirm: props.confirm ? { required: props.confirm.required } : undefined,\n label: props.label,\n value: props.value,\n };\n })\n .filter((tab) => tab.value !== \"\");\n}\n\nfunction queryValue(queryKey: string, tabs: Array<{ value: string }>): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n const value = new URLSearchParams(window.location.search).get(queryKey);\n\n if (!value || !tabs.some((tab) => tab.value === value)) {\n return null;\n }\n\n return value;\n}\n\nfunction replaceQueryValue(queryKey: string, value: string): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n window.history.replaceState(window.history.state, \"\", `${url.pathname}${url.search}${url.hash}`);\n}\n\nfunction queryUrl(queryKey: string, value: string): string {\n if (typeof window === \"undefined\") {\n return \"\";\n }\n\n const url = new URL(window.location.href);\n url.searchParams.set(queryKey, value);\n\n return `${url.pathname}${url.search}${url.hash}`;\n}\n\nexport const TabsComponent: RendererComponent<\"tabs\"> = ({ children, node }) => {\n const { t } = useT(\"lattice\");\n const tabs = useMemo(() => getTabs(node), [node]);\n const firstValue = tabs[0]?.value ?? \"\";\n const queryKey = node.props.queryKey;\n const orientation = node.props.orientation;\n const isVertical = orientation === \"vertical\";\n const alignment = node.props.alignment;\n const isStretched = !isVertical && alignment === \"stretch\";\n const serverActiveValue = node.props.activeValue;\n const defaultValue = node.props.defaultValue ?? firstValue;\n const tablistRef = useRef<HTMLDivElement>(null);\n const [activeValue, setActiveTabValue] = useState(\n () => serverActiveValue || (queryValue(queryKey, tabs) ?? defaultValue) || firstValue,\n );\n\n const selectTab = useCallback(\n (tab: TabItem): void => {\n if (tab.confirm?.required) {\n router.visit(queryUrl(queryKey, tab.value), {\n preserveScroll: true,\n });\n\n return;\n }\n\n setActiveTabValue(tab.value);\n replaceQueryValue(queryKey, tab.value);\n },\n [queryKey],\n );\n\n const selectTabValue = useCallback(\n (value: string): void => {\n const tab = tabs.find((item) => item.value === value);\n\n if (tab) {\n selectTab(tab);\n }\n },\n [selectTab, tabs],\n );\n\n const contextValue = useMemo(\n () => ({ activeValue, setActiveValue: selectTabValue }),\n [activeValue, selectTabValue],\n );\n\n function onTablistKeyDown(event: KeyboardEvent<HTMLButtonElement>): void {\n const nextKey = isVertical ? \"ArrowDown\" : \"ArrowRight\";\n const prevKey = isVertical ? \"ArrowUp\" : \"ArrowLeft\";\n\n if (\n event.key !== nextKey &&\n event.key !== prevKey &&\n event.key !== \"Home\" &&\n event.key !== \"End\"\n ) {\n return;\n }\n\n const buttons = Array.from(\n tablistRef.current?.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]') ?? [],\n );\n\n if (buttons.length === 0) {\n return;\n }\n\n event.preventDefault();\n const current = buttons.indexOf(document.activeElement as HTMLButtonElement);\n\n let index: number;\n if (event.key === \"Home\") {\n index = 0;\n } else if (event.key === \"End\") {\n index = buttons.length - 1;\n } else {\n const delta = event.key === nextKey ? 1 : -1;\n const base = current < 0 ? 0 : current;\n index = (base + delta + buttons.length) % buttons.length;\n }\n\n buttons[index]?.focus();\n }\n\n return (\n <TabsContext.Provider value={contextValue}>\n <div\n className={cn(\n \"gap-6\",\n isVertical ? cn(\"flex\", alignment === \"end\" && \"flex-row-reverse\") : \"grid\",\n )}\n data-lattice-tabs={node.key ?? node.id}\n >\n <div\n aria-label={t(\"common.tabs\", \"Tabs\")}\n aria-orientation={orientation}\n className={cn(\n \"gap-1 rounded-lt bg-lt-muted p-1\",\n isVertical && \"flex flex-col\",\n isStretched && \"flex w-full\",\n !isVertical &&\n !isStretched &&\n cn(\"inline-flex w-fit max-w-full overflow-x-auto\", {\n \"justify-self-center\": alignment === \"center\",\n \"justify-self-end\": alignment === \"end\",\n }),\n )}\n ref={tablistRef}\n role=\"tablist\"\n >\n {tabs.map((tab) => {\n const isActive = activeValue === tab.value;\n\n return (\n <button\n aria-controls={`${tab.value}-panel`}\n aria-selected={isActive}\n data-test={`tab-${tab.value}`}\n className={cn(\n pillClassName(isActive),\n isVertical && \"text-left\",\n isStretched && \"flex-1\",\n )}\n id={`${tab.value}-tab`}\n key={tab.value}\n onClick={() => selectTab(tab)}\n onKeyDown={onTablistKeyDown}\n role=\"tab\"\n tabIndex={isActive ? 0 : -1}\n type=\"button\"\n >\n {tab.label}\n </button>\n );\n })}\n </div>\n\n <div className={cn(\"min-w-0\", isVertical && \"flex-1\")}>{children}</div>\n </div>\n </TabsContext.Provider>\n );\n};\n\nconst TabComponent: RendererComponent<\"tab\"> = ({ children, node }) => {\n const { activeValue } = useTabsContext();\n const value = node.props.value;\n const isActive = activeValue === value;\n const [hasOpened, setHasOpened] = useState(isActive);\n\n useEffect(() => {\n if (isActive) {\n setHasOpened(true);\n }\n }, [isActive]);\n\n return (\n <section\n aria-labelledby={`${value}-tab`}\n className={cn(\"space-y-8\", !isActive && \"hidden\")}\n hidden={!isActive}\n id={`${value}-panel`}\n role=\"tabpanel\"\n tabIndex={0}\n >\n {hasOpened ? (children as ReactNode) : null}\n </section>\n );\n};\n\nexport default TabComponent;\n"],"mappings":";;;;;;;AAsBA,IAAM,cAAc,cAAuC,IAAI;AAE/D,SAAS,iBAAmC;CAC1C,MAAM,UAAU,WAAW,WAAW;CAEtC,IAAI,CAAC,SACH,OAAO;EACL,aAAa;EACb,sBAAsB,CAAC;CACzB;CAGF,OAAO;AACT;AAUA,SAAS,QAAQ,MAAuB;CACtC,QAAQ,KAAK,UAAU,CAAC,EAAA,CACrB,QAAQ,UAAU,MAAM,SAAS,KAAK,CAAC,CACvC,KAAK,UAAU;EACd,MAAM,QAAQ,MAAM;EAEpB,OAAO;GACL,SAAS,MAAM,UAAU,EAAE,UAAU,MAAM,QAAQ,SAAS,IAAI,KAAA;GAChE,OAAO,MAAM;GACb,OAAO,MAAM;EACf;CACF,CAAC,CAAC,CACD,QAAQ,QAAQ,IAAI,UAAU,EAAE;AACrC;AAEA,SAAS,WAAW,UAAkB,MAA+C;CACnF,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,MAAM,QAAQ,IAAI,gBAAgB,OA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ACA,cAAc,iBACd,eAAe,eACf,CAAC,cACC,CAAC,eACD,GAAG,gDAAgD;KACjD,uBAAuB,cAAc;KACrC,oBAAoB,cAAc;IACpC,CAAC,CACL;IACA,KAAK;IACL,MAAK;IAEJ,UAAA,KAAK,KAAK,QAAQ;KACjB,MAAM,WAAW,gBAAgB,IAAI;KAErC,OACE,oBAAC,UAAD;MACE,iBAAe,GAAG,IAAI,MAAM;MAC5B,iBAAe;MACf,aAAW,OAAO,IAAI;MACtB,WAAW,GACT,cAAc,QAAQ,GACtB,cAAc,aACd,eAAe,QACjB;MACA,IAAI,GAAG,IAAI,MAAM;MAEjB,eAAe,UAAU,GAAG;MAC5B,WAAW;MACX,MAAK;MACL,UAAU,WAAW,IAAI;MACzB,MAAK;MAEJ,UAAA,IAAI;KACC,GARD,IAAI,KAQH;IAEZ,CAAC;GACE,CAAA,GAEL,oBAAC,OAAD;IAAK,WAAW,GAAG,WAAW,cAAc,QAAQ;IAAI;GAAc,CAAA,CACnE;;CACe,CAAA;AAE1B;AAEA,IAAM,gBAA0C,EAAE,UAAU,WAAW;CACrE,MAAM,EAAE,gBAAgB,eAAe;CACvC,MAAM,QAAQ,KAAK,MAAM;CACzB,MAAM,WAAW,gBAAgB;CACjC,MAAM,CAAC,WAAW,gBAAgB,SAAS,QAAQ;CAEnD,gBAAgB;EACd,IAAI,UACF,aAAa,IAAI;CAErB,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,oBAAC,WAAD;EACE,mBAAiB,GAAG,MAAM;EAC1B,WAAW,GAAG,aAAa,CAAC,YAAY,QAAQ;EAChD,QAAQ,CAAC;EACT,IAAI,GAAG,MAAM;EACb,MAAK;EACL,UAAU;EAET,UAAA,YAAa,WAAyB;CAChC,CAAA;AAEb"}
|
package/dist/ui/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../resources/js/ui/text.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { coerceColor, colorValue, namedColor } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\nimport { CopyableText } from \"./copyable-text\";\n\nconst textAlignments: Record<string, string> = {\n center: \"text-center\",\n left: \"text-left\",\n};\n\nconst textSizes: Record<Size, string> = {\n xs: \"text-xs leading-5\",\n sm: \"text-sm leading-6\",\n md: \"text-base leading-7\",\n lg: \"text-lg leading-8\",\n xl: \"text-xl leading-8\",\n \"2xl\": \"text-2xl leading-9\",\n \"3xl\": \"text-3xl leading-10\",\n \"4xl\": \"text-4xl leading-none\",\n};\n\nconst TextComponent: RendererComponent<\"text\"> = ({ node }) => {\n const align = node.props.align ?? \"left\";\n const color = colorValue(coerceColor(node.props.color) ?? namedColor(\"muted\"));\n\n const text = (\n <p\n className={cn(\n \"m-0\",\n \"max-w-2xl\",\n textAlignments[align] ?? textAlignments.left,\n textSizes[node.props.size],\n )}\n style={{ color }}\n >\n {node.props.text}\n </p>\n );\n\n if (!node.props.copyable) {\n return text;\n }\n\n return (\n <CopyableText value={node.props.text} label={node.props.text}>\n {text}\n </CopyableText>\n );\n};\n\nexport default TextComponent;\n"],"mappings":";;;;;AAMA,IAAM,iBAAyC;CAC7C,QAAQ;CACR,MAAM;AACR;AAEA,IAAM,YAAkC;CACtC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAC7D,MAAM,QAAQ,KAAK,MAAM,SAAS;CAClC,MAAM,QAAQ,WAAW,YAAY,KAAK,MAAM,KAAK,KAAK,WAAW,OAAO,CAAC;CAE7E,MAAM,OACJ,oBAAC,KAAD;EACE,WAAW,GACT,OACA,aACA,eAAe,UAAU,eAAe,MACxC,UAAU,KAAK,MAAM,KACvB;EACA,OAAO,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../resources/js/ui/text.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { coerceColor, colorValue, namedColor } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\nimport { CopyableText } from \"./copyable-text\";\n\nconst textAlignments: Record<string, string> = {\n center: \"text-center\",\n left: \"text-left\",\n};\n\nconst textSizes: Record<Size, string> = {\n xs: \"text-xs leading-5\",\n sm: \"text-sm leading-6\",\n md: \"text-base leading-7\",\n lg: \"text-lg leading-8\",\n xl: \"text-xl leading-8\",\n \"2xl\": \"text-2xl leading-9\",\n \"3xl\": \"text-3xl leading-10\",\n \"4xl\": \"text-4xl leading-none\",\n};\n\nconst TextComponent: RendererComponent<\"text\"> = ({ node }) => {\n const align = node.props.align ?? \"left\";\n const color = colorValue(coerceColor(node.props.color) ?? namedColor(\"muted\"));\n\n const text = (\n <p\n className={cn(\n \"m-0\",\n \"max-w-2xl\",\n textAlignments[align] ?? textAlignments.left,\n textSizes[node.props.size],\n )}\n style={{ color }}\n >\n {node.props.text}\n </p>\n );\n\n if (!node.props.copyable) {\n return text;\n }\n\n return (\n <CopyableText value={node.props.text} label={node.props.text}>\n {text}\n </CopyableText>\n );\n};\n\nexport default TextComponent;\n"],"mappings":";;;;;AAMA,IAAM,iBAAyC;CAC7C,QAAQ;CACR,MAAM;AACR;AAEA,IAAM,YAAkC;CACtC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAC7D,MAAM,QAAQ,KAAK,MAAM,SAAS;CAClC,MAAM,QAAQ,WAAW,YAAY,KAAK,MAAM,KAAK,KAAK,WAAW,OAAO,CAAC;CAE7E,MAAM,OACJ,oBAAC,KAAD;EACE,WAAW,GACT,OACA,aACA,eAAe,UAAU,eAAe,MACxC,UAAU,KAAK,MAAM,KACvB;EACA,OAAO,EAAE,MAAM;EAEd,UAAA,KAAK,MAAM;CACX,CAAA;CAGL,IAAI,CAAC,KAAK,MAAM,UACd,OAAO;CAGT,OACE,oBAAC,cAAD;EAAc,OAAO,KAAK,MAAM;EAAM,OAAO,KAAK,MAAM;EACrD,UAAA;CACW,CAAA;AAElB"}
|
package/dist/ui/tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":[],"sources":["../../resources/js/ui/tooltip.tsx"],"sourcesContent":["import { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { toNodes } from \"@lattice-php/lattice/core/nodes\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { InfoTooltip } from \"./info-tooltip\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\nconst TooltipComponent: RendererComponent<\"tooltip\"> = ({ node }) => {\n const content = node.props.content;\n const trigger = toNodes(node.props.trigger);\n\n if (!content) {\n return null;\n }\n\n if (trigger.length === 0) {\n return <InfoTooltip content={content} />;\n }\n\n return (\n <Popover>\n <PopoverTrigger\n type=\"button\"\n className=\"inline-flex items-center rounded-lt-sm outline-none focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)]\"\n >\n <Renderer nodes={trigger} />\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"max-w-xs p-3 text-sm [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: content }}\n />\n </Popover>\n );\n};\n\nexport default TooltipComponent;\n"],"mappings":";;;;;;AAMA,IAAM,oBAAkD,EAAE,WAAW;CACnE,MAAM,UAAU,KAAK,MAAM;CAC3B,MAAM,UAAU,QAAQ,KAAK,MAAM,OAAO;CAE1C,IAAI,CAAC,SACH,OAAO;CAGT,IAAI,QAAQ,WAAW,GACrB,OAAO,oBAAC,aAAD,EAAsB,QAAU,CAAA;CAGzC,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,MAAK;EACL,WAAU;
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":[],"sources":["../../resources/js/ui/tooltip.tsx"],"sourcesContent":["import { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { toNodes } from \"@lattice-php/lattice/core/nodes\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { InfoTooltip } from \"./info-tooltip\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\nconst TooltipComponent: RendererComponent<\"tooltip\"> = ({ node }) => {\n const content = node.props.content;\n const trigger = toNodes(node.props.trigger);\n\n if (!content) {\n return null;\n }\n\n if (trigger.length === 0) {\n return <InfoTooltip content={content} />;\n }\n\n return (\n <Popover>\n <PopoverTrigger\n type=\"button\"\n className=\"inline-flex items-center rounded-lt-sm outline-none focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)]\"\n >\n <Renderer nodes={trigger} />\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"max-w-xs p-3 text-sm [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: content }}\n />\n </Popover>\n );\n};\n\nexport default TooltipComponent;\n"],"mappings":";;;;;;AAMA,IAAM,oBAAkD,EAAE,WAAW;CACnE,MAAM,UAAU,KAAK,MAAM;CAC3B,MAAM,UAAU,QAAQ,KAAK,MAAM,OAAO;CAE1C,IAAI,CAAC,SACH,OAAO;CAGT,IAAI,QAAQ,WAAW,GACrB,OAAO,oBAAC,aAAD,EAAsB,QAAU,CAAA;CAGzC,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,MAAK;EACL,WAAU;EAEV,UAAA,oBAAC,UAAD,EAAU,OAAO,QAAU,CAAA;CACb,CAAA,GAChB,oBAAC,gBAAD;EACE,OAAM;EACN,WAAU;EACV,yBAAyB,EAAE,QAAQ,QAAQ;CAC5C,CAAA,CACM,EAAA,CAAA;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-typescript-refresh.js","names":[],"sources":["../resources/js/vite-typescript-refresh.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { Logger } from \"vite\";\n\nconst MAX_STDERR_CHARS = 500;\n\n/**\n * Deliberately absent from `package.json#exports`: unreachable from outside\n * the package even though it compiles into `dist/`. `spawnProcess`/`fileExists`\n * are test seams — the only real caller uses the defaults.\n */\nexport function refreshTypeScriptTypes(\n appRoot: string,\n logger: Pick<Logger, \"info\" | \"warn\">,\n spawnProcess: typeof spawn = spawn,\n fileExists: typeof existsSync = existsSync,\n): void {\n if (!fileExists(path.join(appRoot, \"artisan\"))) {\n return;\n }\n\n const child = spawnProcess(\"php\", [\"artisan\", \"lattice:typescript\"], {\n cwd: appRoot,\n stdio: [\"ignore\", \"ignore\", \"pipe\"],\n });\n\n let stderr = \"\";\n let warned = false;\n\n const warnOnce = (message: string): void => {\n if (warned) {\n return;\n }\n\n warned = true;\n logger.warn(message);\n };\n\n child.stderr?.on(\"data\", (chunk: Buffer) => {\n if (stderr.length < MAX_STDERR_CHARS) {\n stderr += chunk.toString();\n }\n });\n\n // An unhandled \"error\" on the piped stream (e.g. EPIPE) would crash the dev server.\n child.stderr?.on(\"error\", () => {});\n\n child.on(\"error\", (error) => {\n warnOnce(`[lattice] could not refresh TypeScript types: ${error.message}`);\n });\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n logger.info(\"[lattice] refreshed TypeScript types\");\n }\n });\n\n // \"exit\" can fire before stderr has flushed; \"close\" only fires once all stdio has drained.\n child.on(\"close\", (code) => {\n if (code === 0) {\n return;\n }\n\n const detail = stderr.trim().slice(0, MAX_STDERR_CHARS);\n\n warnOnce(\n `[lattice] php artisan lattice:typescript exited with code ${code}${detail ? `: ${detail}` : \"\"}`,\n );\n });\n}\n"],"mappings":";;;;AAKA,IAAM,mBAAmB;;;;;;AAOzB,SAAgB,uBACd,SACA,QACA,eAA6B,OAC7B,aAAgC,YAC1B;CACN,IAAI,CAAC,WAAW,KAAK,KAAK,SAAS,SAAS,CAAC,GAC3C;CAGF,MAAM,QAAQ,aAAa,OAAO,CAAC,WAAW,oBAAoB,GAAG;EACnE,KAAK;EACL,OAAO;GAAC;GAAU;GAAU;EAAM;CACpC,CAAC;CAED,IAAI,SAAS;CACb,IAAI,SAAS;CAEb,MAAM,YAAY,YAA0B;EAC1C,IAAI,QACF;EAGF,SAAS;EACT,OAAO,KAAK,OAAO;CACrB;CAEA,MAAM,QAAQ,GAAG,SAAS,UAAkB;EAC1C,IAAI,OAAO,SAAS,kBAClB,UAAU,MAAM,SAAS;CAE7B,CAAC;CAGD,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC;CAElC,MAAM,GAAG,UAAU,UAAU;EAC3B,SAAS,iDAAiD,MAAM,SAAS;CAC3E,CAAC;CAED,MAAM,GAAG,SAAS,SAAS;EACzB,IAAI,SAAS,GACX,OAAO,KAAK,sCAAsC;CAEtD,CAAC;CAGD,MAAM,GAAG,UAAU,SAAS;EAC1B,IAAI,SAAS,GACX;EAGF,MAAM,SAAS,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"vite-typescript-refresh.js","names":[],"sources":["../resources/js/vite-typescript-refresh.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { Logger } from \"vite\";\n\nconst MAX_STDERR_CHARS = 500;\n\n/**\n * Deliberately absent from `package.json#exports`: unreachable from outside\n * the package even though it compiles into `dist/`. `spawnProcess`/`fileExists`\n * are test seams — the only real caller uses the defaults.\n */\nexport function refreshTypeScriptTypes(\n appRoot: string,\n logger: Pick<Logger, \"info\" | \"warn\">,\n spawnProcess: typeof spawn = spawn,\n fileExists: typeof existsSync = existsSync,\n): void {\n if (!fileExists(path.join(appRoot, \"artisan\"))) {\n return;\n }\n\n const child = spawnProcess(\"php\", [\"artisan\", \"lattice:typescript\"], {\n cwd: appRoot,\n stdio: [\"ignore\", \"ignore\", \"pipe\"],\n });\n\n let stderr = \"\";\n let warned = false;\n\n const warnOnce = (message: string): void => {\n if (warned) {\n return;\n }\n\n warned = true;\n logger.warn(message);\n };\n\n child.stderr?.on(\"data\", (chunk: Buffer) => {\n if (stderr.length < MAX_STDERR_CHARS) {\n stderr += chunk.toString();\n }\n });\n\n // An unhandled \"error\" on the piped stream (e.g. EPIPE) would crash the dev server.\n child.stderr?.on(\"error\", () => {});\n\n child.on(\"error\", (error) => {\n warnOnce(`[lattice] could not refresh TypeScript types: ${error.message}`);\n });\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n logger.info(\"[lattice] refreshed TypeScript types\");\n }\n });\n\n // \"exit\" can fire before stderr has flushed; \"close\" only fires once all stdio has drained.\n child.on(\"close\", (code) => {\n if (code === 0) {\n return;\n }\n\n const detail = stderr.trim().slice(0, MAX_STDERR_CHARS);\n\n warnOnce(\n `[lattice] php artisan lattice:typescript exited with code ${code}${detail ? `: ${detail}` : \"\"}`,\n );\n });\n}\n"],"mappings":";;;;AAKA,IAAM,mBAAmB;;;;;;AAOzB,SAAgB,uBACd,SACA,QACA,eAA6B,OAC7B,aAAgC,YAC1B;CACN,IAAI,CAAC,WAAW,KAAK,KAAK,SAAS,SAAS,CAAC,GAC3C;CAGF,MAAM,QAAQ,aAAa,OAAO,CAAC,WAAW,oBAAoB,GAAG;EACnE,KAAK;EACL,OAAO;GAAC;GAAU;GAAU;EAAM;CACpC,CAAC;CAED,IAAI,SAAS;CACb,IAAI,SAAS;CAEb,MAAM,YAAY,YAA0B;EAC1C,IAAI,QACF;EAGF,SAAS;EACT,OAAO,KAAK,OAAO;CACrB;CAEA,MAAM,QAAQ,GAAG,SAAS,UAAkB;EAC1C,IAAI,OAAO,SAAS,kBAClB,UAAU,MAAM,SAAS;CAE7B,CAAC;CAGD,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC;CAElC,MAAM,GAAG,UAAU,UAAU;EAC3B,SAAS,iDAAiD,MAAM,SAAS;CAC3E,CAAC;CAED,MAAM,GAAG,SAAS,SAAS;EACzB,IAAI,SAAS,GACX,OAAO,KAAK,sCAAsC;CAEtD,CAAC;CAGD,MAAM,GAAG,UAAU,SAAS;EAC1B,IAAI,SAAS,GACX;EAGF,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,gBAAgB;EAEtD,SACE,6DAA6D,OAAO,SAAS,KAAK,WAAW,IAC/F;CACF,CAAC;AACH"}
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":[],"sources":["../resources/js/vite.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { IconTypesOptions, SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\nimport { refreshTypeScriptTypes } from \"./vite-typescript-refresh\";\n\ntype InlineDependency = string | RegExp;\n\ntype ConfigWithTest = UserConfig & {\n test?: {\n server?: {\n deps?: {\n inline?: InlineDependency[];\n };\n };\n };\n};\n\nexport type LatticeViteIconsOptions = Omit<SvgSpriteOptions, \"dts\" | \"iconDirs\"> & {\n dirs?: string[];\n dts?: Partial<IconTypesOptions> | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n /** Refresh generated TypeScript types via the dev server. Defaults to `true`. */\n typescript?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const { appRoot } = resolveRoots(options);\n const plugins: PluginOption[] = [\n corePlugin(options),\n optionalPeersPlugin(),\n componentPackagesPlugin(discoverComponentPackages(appRoot)),\n typescriptPlugin(options),\n ];\n const iconOptions = resolveIconOptions(options);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\n/** A Composer package that contributes a Lattice component plugin. */\nexport type LatticeComponentPackage = {\n name: string;\n /** Absolute path to the package's installed directory. */\n dir: string;\n /** Absolute path to the package's JS plugin entry (its `createPlugin(...)`). */\n plugin: string;\n};\n\ntype InstalledPackage = {\n name: string;\n \"install-path\"?: string;\n extra?: { lattice?: { plugin?: string } };\n};\n\ntype RootPackageJson = {\n name?: string;\n extra?: { lattice?: { plugin?: string } };\n};\n\n/**\n * Resolve every Composer package that declares `extra.lattice.plugin` into an\n * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the\n * dir `installed.json` records its `install-path`s against).\n */\nexport function collectComponentPackages(\n installed: { packages?: InstalledPackage[] } | InstalledPackage[],\n installPathsRelativeTo: string,\n): LatticeComponentPackage[] {\n const packages = Array.isArray(installed) ? installed : (installed.packages ?? []);\n\n return packages.flatMap((pkg) => {\n const entry = pkg.extra?.lattice?.plugin;\n\n if (typeof entry !== \"string\") {\n return [];\n }\n\n const dir = path.resolve(installPathsRelativeTo, pkg[\"install-path\"] ?? `../${pkg.name}`);\n\n return [{ name: pkg.name, dir, plugin: path.resolve(dir, entry) }];\n });\n}\n\n/**\n * Resolve the composer ROOT project's own `extra.lattice.plugin` — Composer\n * never lists the root package in `installed.json`, so a component package\n * declaring the plugin entry in its own composer.json would otherwise be\n * invisible to its own dev server (e.g. inside a testbench workbench, where\n * the package itself is the app root).\n */\nexport function collectRootComponentPackage(\n composerJson: RootPackageJson,\n appRoot: string,\n): LatticeComponentPackage[] {\n const entry = composerJson.extra?.lattice?.plugin;\n\n if (typeof entry !== \"string\" || typeof composerJson.name !== \"string\") {\n return [];\n }\n\n return [{ name: composerJson.name, dir: appRoot, plugin: path.resolve(appRoot, entry) }];\n}\n\n/**\n * Read `<appRoot>/vendor/composer/installed.json` and `<appRoot>/composer.json`\n * and collect every component package they contribute.\n */\nexport function discoverComponentPackages(appRoot: string): LatticeComponentPackage[] {\n const composerDir = path.resolve(appRoot, \"vendor/composer\");\n\n let installed: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(composerDir, \"installed.json\"), \"utf8\");\n installed = collectComponentPackages(JSON.parse(raw), composerDir);\n } catch {\n installed = [];\n }\n\n let root: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(appRoot, \"composer.json\"), \"utf8\");\n root = collectRootComponentPackage(JSON.parse(raw), appRoot);\n } catch {\n root = [];\n }\n\n return [...installed, ...root];\n}\n\nconst VIRTUAL_PLUGINS_ID = \"virtual:lattice/plugins\";\nconst RESOLVED_VIRTUAL_PLUGINS_ID = `\\0${VIRTUAL_PLUGINS_ID}`;\n\n/**\n * Exposes the discovered component packages as `virtual:lattice/plugins` — a\n * module whose default export is the array of their `createPlugin(...)` results,\n * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem\n * access to each package dir so its source compiles from `vendor/` (or a symlink).\n */\nexport function componentPackagesPlugin(packages: LatticeComponentPackage[]): Plugin {\n return {\n name: \"lattice:component-packages\",\n config(config) {\n if (packages.length === 0) {\n return {};\n }\n\n const workspaceRoot = searchForWorkspaceRoot(config.root ?? process.cwd());\n\n return { server: { fs: { allow: [workspaceRoot, ...packages.map((pkg) => pkg.dir)] } } };\n },\n resolveId(id) {\n return id === VIRTUAL_PLUGINS_ID ? RESOLVED_VIRTUAL_PLUGINS_ID : null;\n },\n load(id) {\n if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) {\n return null;\n }\n\n const imports = packages\n .map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`)\n .join(\"\\n\");\n const list = packages.map((_, index) => `p${index}`).join(\", \");\n\n return `${imports}\\nexport default [${list}];\\n`;\n },\n };\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n alias: options.source\n ? {\n \"@lattice-php/lattice/css\": path.resolve(root, \"resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n }\n : {\n react: path.resolve(appRoot, \"node_modules/react\"),\n \"react-dom\": path.resolve(appRoot, \"node_modules/react-dom\"),\n },\n dedupe: [\"@inertiajs/react\", \"react\", \"react-dom\"],\n },\n server: options.source\n ? {\n fs: {\n allow: [searchForWorkspaceRoot(appRoot), root],\n },\n }\n : undefined,\n test: {\n server: {\n deps: {\n inline: [\n \"@lattice-php/lattice\",\n /[/\\\\]lattice[/\\\\]dist[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@radix-ui[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@tiptap[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]react-i18next[/\\\\]/,\n ],\n },\n },\n },\n };\n}\n\nfunction corePlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice\",\n config() {\n return latticeConfig(options);\n },\n };\n}\n\nconst OPTIONAL_PEER_STUB_PREFIX = \"\\0lattice-optional-peer/\";\n\n/**\n * Real-time listeners statically import their optional Echo peers. A consumer\n * that never uses real-time should still build, so stub a missing peer with\n * hooks that throw — the `RealtimeListeners` error boundary then degrades\n * gracefully and warns to install the peer, exactly as when it is absent.\n */\nconst OPTIONAL_PEER_STUBS: Record<string, string> = {\n \"@laravel/echo-react\": [\n \"const missing = () => {\",\n \" throw new Error(\",\n ' \"[lattice] Real-time listeners require @laravel/echo-react. Install it and call configureEcho().\",',\n \" );\",\n \"};\",\n \"export const useEcho = missing;\",\n \"export const useEchoPublic = missing;\",\n \"export const useEchoPresence = missing;\",\n \"export const useEchoNotification = missing;\",\n ].join(\"\\n\"),\n};\n\nfunction optionalPeersPlugin(): Plugin {\n return {\n name: \"lattice:optional-peers\",\n enforce: \"pre\",\n async resolveId(id) {\n if (!Object.prototype.hasOwnProperty.call(OPTIONAL_PEER_STUBS, id)) {\n return null;\n }\n\n const installed = await this.resolve(id, undefined, { skipSelf: true });\n\n return installed ? null : `${OPTIONAL_PEER_STUB_PREFIX}${id}`;\n },\n load(id) {\n if (!id.startsWith(OPTIONAL_PEER_STUB_PREFIX)) {\n return null;\n }\n\n return OPTIONAL_PEER_STUBS[id.slice(OPTIONAL_PEER_STUB_PREFIX.length)] ?? null;\n },\n };\n}\n\n/**\n * Refreshes `node.props` typings from the app's own `php artisan\n * lattice:typescript` whenever the dev server starts — installing or updating\n * a component package would otherwise leave its generated types stale until\n * someone remembers to run the command by hand. Dev-server only: a production\n * build machine may not have PHP installed, and the generated file is a dev\n * ergonomics artifact, not a build input.\n *\n * Module-private like its siblings `optionalPeersPlugin`/`corePlugin` — the\n * `refreshTypeScriptTypes` DI seam it defers to lives in\n * `./vite-typescript-refresh`, which isn't part of the published `vite`\n * subpath either (see that module for why).\n */\nfunction typescriptPlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice:typescript\",\n apply: \"serve\",\n configureServer(server) {\n const typescript = options.typescript ?? true;\n\n if (typescript === false) {\n return;\n }\n\n const { appRoot } = resolveRoots(options);\n\n refreshTypeScriptTypes(appRoot, server.config.logger);\n },\n };\n}\n\nexport function resolveIconOptions(options: LatticeViteOptions): SvgSpriteOptions | null {\n const icons = options.icons ?? true;\n\n if (icons === false) {\n return null;\n }\n\n const { root } = resolveRoots(options);\n const iconOptions = icons === true ? {} : icons;\n const { dirs = [], dts, ...spriteOptions } = iconOptions;\n const defaultTypes = {\n file: \"resources/js/types/sprite-icons.ts\",\n augmentModule: \"@lattice-php/lattice\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [path.resolve(root, \"resources/icons\"), ...dirs],\n ...(dts === false ? {} : { dts: { ...defaultTypes, ...dts } }),\n };\n}\n\nfunction resolveRoots(options: LatticeViteOptions): Roots {\n const appRoot = options.appRoot ?? process.cwd();\n const root = options.root ?? path.resolve(appRoot, \"vendor/lattice-php/lattice\");\n\n return { appRoot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AAU,OAAO,CAAC,IAAI;CAE1C,MAAM,eAAe;EACnB,MAAM;EACN,eAAe;EACf,kBAAkB;CACpB;CAEA,OAAO;EACL,GAAG;EACH,UAAU,CAAC,KAAK,QAAQ,MAAM,iBAAiB,GAAG,GAAG,IAAI;EACzD,GAAI,QAAQ,QAAQ,CAAC,IAAI,EAAE,KAAK;GAAE,GAAG;GAAc,GAAG;EAAI,EAAE;CAC9D;AACF;AAEA,SAAS,aAAa,SAAoC;CACxD,MAAM,UAAU,QAAQ,WAAW,QAAQ,IAAI;CAG/C,OAAO;EAAE;EAAS,MAFL,QAAQ,QAAQ,KAAK,QAAQ,SAAS,4BAA4B;CAExD;AACzB"}
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../resources/js/vite.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { IconTypesOptions, SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\nimport { refreshTypeScriptTypes } from \"./vite-typescript-refresh\";\n\ntype InlineDependency = string | RegExp;\n\ntype ConfigWithTest = UserConfig & {\n test?: {\n server?: {\n deps?: {\n inline?: InlineDependency[];\n };\n };\n };\n};\n\nexport type LatticeViteIconsOptions = Omit<SvgSpriteOptions, \"dts\" | \"iconDirs\"> & {\n dirs?: string[];\n dts?: Partial<IconTypesOptions> | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n /** Refresh generated TypeScript types via the dev server. Defaults to `true`. */\n typescript?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const { appRoot } = resolveRoots(options);\n const plugins: PluginOption[] = [\n corePlugin(options),\n optionalPeersPlugin(),\n componentPackagesPlugin(discoverComponentPackages(appRoot)),\n typescriptPlugin(options),\n ];\n const iconOptions = resolveIconOptions(options);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\n/** A Composer package that contributes a Lattice component plugin. */\nexport type LatticeComponentPackage = {\n name: string;\n /** Absolute path to the package's installed directory. */\n dir: string;\n /** Absolute path to the package's JS plugin entry (its `createPlugin(...)`). */\n plugin: string;\n};\n\ntype InstalledPackage = {\n name: string;\n \"install-path\"?: string;\n extra?: { lattice?: { plugin?: string } };\n};\n\ntype RootPackageJson = {\n name?: string;\n extra?: { lattice?: { plugin?: string } };\n};\n\n/**\n * Resolve every Composer package that declares `extra.lattice.plugin` into an\n * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the\n * dir `installed.json` records its `install-path`s against).\n */\nexport function collectComponentPackages(\n installed: { packages?: InstalledPackage[] } | InstalledPackage[],\n installPathsRelativeTo: string,\n): LatticeComponentPackage[] {\n const packages = Array.isArray(installed) ? installed : (installed.packages ?? []);\n\n return packages.flatMap((pkg) => {\n const entry = pkg.extra?.lattice?.plugin;\n\n if (typeof entry !== \"string\") {\n return [];\n }\n\n const dir = path.resolve(installPathsRelativeTo, pkg[\"install-path\"] ?? `../${pkg.name}`);\n\n return [{ name: pkg.name, dir, plugin: path.resolve(dir, entry) }];\n });\n}\n\n/**\n * Resolve the composer ROOT project's own `extra.lattice.plugin` — Composer\n * never lists the root package in `installed.json`, so a component package\n * declaring the plugin entry in its own composer.json would otherwise be\n * invisible to its own dev server (e.g. inside a testbench workbench, where\n * the package itself is the app root).\n */\nexport function collectRootComponentPackage(\n composerJson: RootPackageJson,\n appRoot: string,\n): LatticeComponentPackage[] {\n const entry = composerJson.extra?.lattice?.plugin;\n\n if (typeof entry !== \"string\" || typeof composerJson.name !== \"string\") {\n return [];\n }\n\n return [{ name: composerJson.name, dir: appRoot, plugin: path.resolve(appRoot, entry) }];\n}\n\n/**\n * Read `<appRoot>/vendor/composer/installed.json` and `<appRoot>/composer.json`\n * and collect every component package they contribute.\n */\nexport function discoverComponentPackages(appRoot: string): LatticeComponentPackage[] {\n const composerDir = path.resolve(appRoot, \"vendor/composer\");\n\n let installed: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(composerDir, \"installed.json\"), \"utf8\");\n installed = collectComponentPackages(JSON.parse(raw), composerDir);\n } catch {\n installed = [];\n }\n\n let root: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(appRoot, \"composer.json\"), \"utf8\");\n root = collectRootComponentPackage(JSON.parse(raw), appRoot);\n } catch {\n root = [];\n }\n\n return [...installed, ...root];\n}\n\nconst VIRTUAL_PLUGINS_ID = \"virtual:lattice/plugins\";\nconst RESOLVED_VIRTUAL_PLUGINS_ID = `\\0${VIRTUAL_PLUGINS_ID}`;\n\n/**\n * Exposes the discovered component packages as `virtual:lattice/plugins` — a\n * module whose default export is the array of their `createPlugin(...)` results,\n * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem\n * access to each package dir so its source compiles from `vendor/` (or a symlink).\n */\nexport function componentPackagesPlugin(packages: LatticeComponentPackage[]): Plugin {\n return {\n name: \"lattice:component-packages\",\n config(config) {\n if (packages.length === 0) {\n return {};\n }\n\n const workspaceRoot = searchForWorkspaceRoot(config.root ?? process.cwd());\n\n return { server: { fs: { allow: [workspaceRoot, ...packages.map((pkg) => pkg.dir)] } } };\n },\n resolveId(id) {\n return id === VIRTUAL_PLUGINS_ID ? RESOLVED_VIRTUAL_PLUGINS_ID : null;\n },\n load(id) {\n if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) {\n return null;\n }\n\n const imports = packages\n .map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`)\n .join(\"\\n\");\n const list = packages.map((_, index) => `p${index}`).join(\", \");\n\n return `${imports}\\nexport default [${list}];\\n`;\n },\n };\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n alias: options.source\n ? {\n \"@lattice-php/lattice/css\": path.resolve(root, \"resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n }\n : {\n react: path.resolve(appRoot, \"node_modules/react\"),\n \"react-dom\": path.resolve(appRoot, \"node_modules/react-dom\"),\n },\n dedupe: [\"@inertiajs/react\", \"react\", \"react-dom\"],\n },\n server: options.source\n ? {\n fs: {\n allow: [searchForWorkspaceRoot(appRoot), root],\n },\n }\n : undefined,\n test: {\n server: {\n deps: {\n inline: [\n \"@lattice-php/lattice\",\n /[/\\\\]lattice[/\\\\]dist[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@radix-ui[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@tiptap[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]react-i18next[/\\\\]/,\n ],\n },\n },\n },\n };\n}\n\nfunction corePlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice\",\n config() {\n return latticeConfig(options);\n },\n };\n}\n\nconst OPTIONAL_PEER_STUB_PREFIX = \"\\0lattice-optional-peer/\";\n\n/**\n * Real-time listeners statically import their optional Echo peers. A consumer\n * that never uses real-time should still build, so stub a missing peer with\n * hooks that throw — the `RealtimeListeners` error boundary then degrades\n * gracefully and warns to install the peer, exactly as when it is absent.\n */\nconst OPTIONAL_PEER_STUBS: Record<string, string> = {\n \"@laravel/echo-react\": [\n \"const missing = () => {\",\n \" throw new Error(\",\n ' \"[lattice] Real-time listeners require @laravel/echo-react. Install it and call configureEcho().\",',\n \" );\",\n \"};\",\n \"export const useEcho = missing;\",\n \"export const useEchoPublic = missing;\",\n \"export const useEchoPresence = missing;\",\n \"export const useEchoNotification = missing;\",\n ].join(\"\\n\"),\n};\n\nfunction optionalPeersPlugin(): Plugin {\n return {\n name: \"lattice:optional-peers\",\n enforce: \"pre\",\n async resolveId(id) {\n if (!Object.prototype.hasOwnProperty.call(OPTIONAL_PEER_STUBS, id)) {\n return null;\n }\n\n const installed = await this.resolve(id, undefined, { skipSelf: true });\n\n return installed ? null : `${OPTIONAL_PEER_STUB_PREFIX}${id}`;\n },\n load(id) {\n if (!id.startsWith(OPTIONAL_PEER_STUB_PREFIX)) {\n return null;\n }\n\n return OPTIONAL_PEER_STUBS[id.slice(OPTIONAL_PEER_STUB_PREFIX.length)] ?? null;\n },\n };\n}\n\n/**\n * Refreshes `node.props` typings from the app's own `php artisan\n * lattice:typescript` whenever the dev server starts — installing or updating\n * a component package would otherwise leave its generated types stale until\n * someone remembers to run the command by hand. Dev-server only: a production\n * build machine may not have PHP installed, and the generated file is a dev\n * ergonomics artifact, not a build input.\n *\n * Module-private like its siblings `optionalPeersPlugin`/`corePlugin` — the\n * `refreshTypeScriptTypes` DI seam it defers to lives in\n * `./vite-typescript-refresh`, which isn't part of the published `vite`\n * subpath either (see that module for why).\n */\nfunction typescriptPlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice:typescript\",\n apply: \"serve\",\n configureServer(server) {\n const typescript = options.typescript ?? true;\n\n if (typescript === false) {\n return;\n }\n\n const { appRoot } = resolveRoots(options);\n\n refreshTypeScriptTypes(appRoot, server.config.logger);\n },\n };\n}\n\nexport function resolveIconOptions(options: LatticeViteOptions): SvgSpriteOptions | null {\n const icons = options.icons ?? true;\n\n if (icons === false) {\n return null;\n }\n\n const { root } = resolveRoots(options);\n const iconOptions = icons === true ? {} : icons;\n const { dirs = [], dts, ...spriteOptions } = iconOptions;\n const defaultTypes = {\n file: \"resources/js/types/sprite-icons.ts\",\n augmentModule: \"@lattice-php/lattice\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [path.resolve(root, \"resources/icons\"), ...dirs],\n ...(dts === false ? {} : { dts: { ...defaultTypes, ...dts } }),\n };\n}\n\nfunction resolveRoots(options: LatticeViteOptions): Roots {\n const appRoot = options.appRoot ?? process.cwd();\n const root = options.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