@thalavaisankar/atoms 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +196 -2
- package/THIRD_PARTY_NOTICES.md +275 -0
- package/dist/blocks/index.d.mts +2 -0
- package/dist/blocks/index.mjs +1 -0
- package/dist/blocks/index.mjs.map +1 -0
- package/dist/components/ui/accordion/accordion.mjs +194 -0
- package/dist/components/ui/accordion/accordion.mjs.map +1 -0
- package/dist/components/ui/accordion/index.mjs +15 -0
- package/dist/components/ui/accordion/index.mjs.map +1 -0
- package/dist/components/ui/activity-feed/activity-feed.mjs +287 -0
- package/dist/components/ui/activity-feed/activity-feed.mjs.map +1 -0
- package/dist/components/ui/activity-feed/index.mjs +39 -0
- package/dist/components/ui/activity-feed/index.mjs.map +1 -0
- package/dist/components/ui/alert/alert.mjs +128 -0
- package/dist/components/ui/alert/alert.mjs.map +1 -0
- package/dist/components/ui/alert/index.mjs +17 -0
- package/dist/components/ui/alert/index.mjs.map +1 -0
- package/dist/components/ui/animated-label/animated-label.mjs +89 -0
- package/dist/components/ui/animated-label/animated-label.mjs.map +1 -0
- package/dist/components/ui/animated-label/index.mjs +9 -0
- package/dist/components/ui/animated-label/index.mjs.map +1 -0
- package/dist/components/ui/animated-number/animated-number.mjs +101 -0
- package/dist/components/ui/animated-number/animated-number.mjs.map +1 -0
- package/dist/components/ui/animated-number/index.mjs +5 -0
- package/dist/components/ui/animated-number/index.mjs.map +1 -0
- package/dist/components/ui/avatar/avatar.mjs +130 -0
- package/dist/components/ui/avatar/avatar.mjs.map +1 -0
- package/dist/components/ui/avatar/index.mjs +17 -0
- package/dist/components/ui/avatar/index.mjs.map +1 -0
- package/dist/components/ui/avatar-group/avatar-group.mjs +49 -0
- package/dist/components/ui/avatar-group/avatar-group.mjs.map +1 -0
- package/dist/components/ui/avatar-group/index.mjs +5 -0
- package/dist/components/ui/avatar-group/index.mjs.map +1 -0
- package/dist/components/ui/badge/badge-motion.mjs +108 -0
- package/dist/components/ui/badge/badge-motion.mjs.map +1 -0
- package/dist/components/ui/badge/badge.mjs +314 -0
- package/dist/components/ui/badge/badge.mjs.map +1 -0
- package/dist/components/ui/badge/index.mjs +27 -0
- package/dist/components/ui/badge/index.mjs.map +1 -0
- package/dist/components/ui/badge/readable-ink.mjs +36 -0
- package/dist/components/ui/badge/readable-ink.mjs.map +1 -0
- package/dist/components/ui/badge-group/badge-group.mjs +132 -0
- package/dist/components/ui/badge-group/badge-group.mjs.map +1 -0
- package/dist/components/ui/badge-group/index.mjs +5 -0
- package/dist/components/ui/badge-group/index.mjs.map +1 -0
- package/dist/components/ui/breadcrumb/breadcrumb.mjs +108 -0
- package/dist/components/ui/breadcrumb/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/breadcrumb/index.mjs +19 -0
- package/dist/components/ui/breadcrumb/index.mjs.map +1 -0
- package/dist/components/ui/button/button-variants.mjs +80 -0
- package/dist/components/ui/button/button-variants.mjs.map +1 -0
- package/dist/components/ui/button/button.mjs +74 -0
- package/dist/components/ui/button/button.mjs.map +1 -0
- package/dist/components/ui/button/index.mjs +17 -0
- package/dist/components/ui/button/index.mjs.map +1 -0
- package/dist/components/ui/button/social-button.mjs +45 -0
- package/dist/components/ui/button/social-button.mjs.map +1 -0
- package/dist/components/ui/button/social-logos.mjs +179 -0
- package/dist/components/ui/button/social-logos.mjs.map +1 -0
- package/dist/components/ui/button/split-button.mjs +72 -0
- package/dist/components/ui/button/split-button.mjs.map +1 -0
- package/dist/components/ui/button-group/button-group.mjs +58 -0
- package/dist/components/ui/button-group/button-group.mjs.map +1 -0
- package/dist/components/ui/button-group/index.mjs +11 -0
- package/dist/components/ui/button-group/index.mjs.map +1 -0
- package/dist/components/ui/card/card.mjs +131 -0
- package/dist/components/ui/card/card.mjs.map +1 -0
- package/dist/components/ui/card/index.mjs +23 -0
- package/dist/components/ui/card/index.mjs.map +1 -0
- package/dist/components/ui/chart/bar-list.mjs +87 -0
- package/dist/components/ui/chart/bar-list.mjs.map +1 -0
- package/dist/components/ui/chart/chart-colors.mjs +68 -0
- package/dist/components/ui/chart/chart-colors.mjs.map +1 -0
- package/dist/components/ui/chart/chart-geometry.mjs +152 -0
- package/dist/components/ui/chart/chart-geometry.mjs.map +1 -0
- package/dist/components/ui/chart/chart-specialized.mjs +194 -0
- package/dist/components/ui/chart/chart-specialized.mjs.map +1 -0
- package/dist/components/ui/chart/chart.mjs +648 -0
- package/dist/components/ui/chart/chart.mjs.map +1 -0
- package/dist/components/ui/chart/index.mjs +88 -0
- package/dist/components/ui/chart/index.mjs.map +1 -0
- package/dist/components/ui/chart/radial-meter.mjs +142 -0
- package/dist/components/ui/chart/radial-meter.mjs.map +1 -0
- package/dist/components/ui/chart/types.mjs +1 -0
- package/dist/components/ui/chart/types.mjs.map +1 -0
- package/dist/components/ui/checkbox/checkbox.mjs +183 -0
- package/dist/components/ui/checkbox/checkbox.mjs.map +1 -0
- package/dist/components/ui/checkbox/index.mjs +11 -0
- package/dist/components/ui/checkbox/index.mjs.map +1 -0
- package/dist/components/ui/checklist/checklist.mjs +353 -0
- package/dist/components/ui/checklist/checklist.mjs.map +1 -0
- package/dist/components/ui/checklist/index.mjs +33 -0
- package/dist/components/ui/checklist/index.mjs.map +1 -0
- package/dist/components/ui/chip/chip.mjs +202 -0
- package/dist/components/ui/chip/chip.mjs.map +1 -0
- package/dist/components/ui/chip/index.mjs +13 -0
- package/dist/components/ui/chip/index.mjs.map +1 -0
- package/dist/components/ui/chip-group/chip-group.mjs +204 -0
- package/dist/components/ui/chip-group/chip-group.mjs.map +1 -0
- package/dist/components/ui/chip-group/index.mjs +11 -0
- package/dist/components/ui/chip-group/index.mjs.map +1 -0
- package/dist/components/ui/code-snippet/code-highlighter.mjs +16 -0
- package/dist/components/ui/code-snippet/code-highlighter.mjs.map +1 -0
- package/dist/components/ui/code-snippet/code-snippet.mjs +437 -0
- package/dist/components/ui/code-snippet/code-snippet.mjs.map +1 -0
- package/dist/components/ui/code-snippet/index.mjs +17 -0
- package/dist/components/ui/code-snippet/index.mjs.map +1 -0
- package/dist/components/ui/code-snippet/labels.mjs +16 -0
- package/dist/components/ui/code-snippet/labels.mjs.map +1 -0
- package/dist/components/ui/code-snippet/tokenize.mjs +715 -0
- package/dist/components/ui/code-snippet/tokenize.mjs.map +1 -0
- package/dist/components/ui/code-snippet/types.mjs +1 -0
- package/dist/components/ui/code-snippet/types.mjs.map +1 -0
- package/dist/components/ui/collapsible/collapsible.mjs +85 -0
- package/dist/components/ui/collapsible/collapsible.mjs.map +1 -0
- package/dist/components/ui/collapsible/index.mjs +15 -0
- package/dist/components/ui/collapsible/index.mjs.map +1 -0
- package/dist/components/ui/color-picker/color-picker.mjs +852 -0
- package/dist/components/ui/color-picker/color-picker.mjs.map +1 -0
- package/dist/components/ui/color-picker/index.mjs +47 -0
- package/dist/components/ui/color-picker/index.mjs.map +1 -0
- package/dist/components/ui/combobox/combobox.mjs +745 -0
- package/dist/components/ui/combobox/combobox.mjs.map +1 -0
- package/dist/components/ui/combobox/index.mjs +27 -0
- package/dist/components/ui/combobox/index.mjs.map +1 -0
- package/dist/components/ui/command/command.mjs +439 -0
- package/dist/components/ui/command/command.mjs.map +1 -0
- package/dist/components/ui/command/index.mjs +31 -0
- package/dist/components/ui/command/index.mjs.map +1 -0
- package/dist/components/ui/compare-slider/compare-slider.mjs +335 -0
- package/dist/components/ui/compare-slider/compare-slider.mjs.map +1 -0
- package/dist/components/ui/compare-slider/index.mjs +17 -0
- package/dist/components/ui/compare-slider/index.mjs.map +1 -0
- package/dist/components/ui/context-menu/context-menu.mjs +184 -0
- package/dist/components/ui/context-menu/context-menu.mjs.map +1 -0
- package/dist/components/ui/context-menu/index.mjs +37 -0
- package/dist/components/ui/context-menu/index.mjs.map +1 -0
- package/dist/components/ui/data-table/active-filters.mjs +69 -0
- package/dist/components/ui/data-table/active-filters.mjs.map +1 -0
- package/dist/components/ui/data-table/body-row.mjs +118 -0
- package/dist/components/ui/data-table/body-row.mjs.map +1 -0
- package/dist/components/ui/data-table/cards.mjs +76 -0
- package/dist/components/ui/data-table/cards.mjs.map +1 -0
- package/dist/components/ui/data-table/data-table.mjs +680 -0
- package/dist/components/ui/data-table/data-table.mjs.map +1 -0
- package/dist/components/ui/data-table/empty.mjs +26 -0
- package/dist/components/ui/data-table/empty.mjs.map +1 -0
- package/dist/components/ui/data-table/expand.mjs +70 -0
- package/dist/components/ui/data-table/expand.mjs.map +1 -0
- package/dist/components/ui/data-table/faceted-filter.mjs +112 -0
- package/dist/components/ui/data-table/faceted-filter.mjs.map +1 -0
- package/dist/components/ui/data-table/features.mjs +96 -0
- package/dist/components/ui/data-table/features.mjs.map +1 -0
- package/dist/components/ui/data-table/grip.mjs +37 -0
- package/dist/components/ui/data-table/grip.mjs.map +1 -0
- package/dist/components/ui/data-table/header-cell.mjs +85 -0
- package/dist/components/ui/data-table/header-cell.mjs.map +1 -0
- package/dist/components/ui/data-table/index.mjs +55 -0
- package/dist/components/ui/data-table/index.mjs.map +1 -0
- package/dist/components/ui/data-table/labels.mjs +55 -0
- package/dist/components/ui/data-table/labels.mjs.map +1 -0
- package/dist/components/ui/data-table/load-more.mjs +56 -0
- package/dist/components/ui/data-table/load-more.mjs.map +1 -0
- package/dist/components/ui/data-table/move-item.mjs +11 -0
- package/dist/components/ui/data-table/move-item.mjs.map +1 -0
- package/dist/components/ui/data-table/persist.mjs +65 -0
- package/dist/components/ui/data-table/persist.mjs.map +1 -0
- package/dist/components/ui/data-table/selection-bar.mjs +51 -0
- package/dist/components/ui/data-table/selection-bar.mjs.map +1 -0
- package/dist/components/ui/data-table/tabs.mjs +48 -0
- package/dist/components/ui/data-table/tabs.mjs.map +1 -0
- package/dist/components/ui/data-table/toolbar.mjs +92 -0
- package/dist/components/ui/data-table/toolbar.mjs.map +1 -0
- package/dist/components/ui/data-table/use-reorder.mjs +239 -0
- package/dist/components/ui/data-table/use-reorder.mjs.map +1 -0
- package/dist/components/ui/data-table/use-reveal.mjs +24 -0
- package/dist/components/ui/data-table/use-reveal.mjs.map +1 -0
- package/dist/components/ui/data-table/use-table-state.mjs +38 -0
- package/dist/components/ui/data-table/use-table-state.mjs.map +1 -0
- package/dist/components/ui/data-table/view-options.mjs +66 -0
- package/dist/components/ui/data-table/view-options.mjs.map +1 -0
- package/dist/components/ui/date-picker/calendar.mjs +466 -0
- package/dist/components/ui/date-picker/calendar.mjs.map +1 -0
- package/dist/components/ui/date-picker/date-picker.mjs +366 -0
- package/dist/components/ui/date-picker/date-picker.mjs.map +1 -0
- package/dist/components/ui/date-picker/index.mjs +17 -0
- package/dist/components/ui/date-picker/index.mjs.map +1 -0
- package/dist/components/ui/date-picker/presets.mjs +49 -0
- package/dist/components/ui/date-picker/presets.mjs.map +1 -0
- package/dist/components/ui/description-list/description-list.mjs +40 -0
- package/dist/components/ui/description-list/description-list.mjs.map +1 -0
- package/dist/components/ui/description-list/index.mjs +15 -0
- package/dist/components/ui/description-list/index.mjs.map +1 -0
- package/dist/components/ui/dialog/dialog-stepper.mjs +23 -0
- package/dist/components/ui/dialog/dialog-stepper.mjs.map +1 -0
- package/dist/components/ui/dialog/dialog.mjs +343 -0
- package/dist/components/ui/dialog/dialog.mjs.map +1 -0
- package/dist/components/ui/dialog/focus-return.mjs +21 -0
- package/dist/components/ui/dialog/focus-return.mjs.map +1 -0
- package/dist/components/ui/dialog/index.mjs +33 -0
- package/dist/components/ui/dialog/index.mjs.map +1 -0
- package/dist/components/ui/divider/divider.mjs +130 -0
- package/dist/components/ui/divider/divider.mjs.map +1 -0
- package/dist/components/ui/divider/index.mjs +6 -0
- package/dist/components/ui/divider/index.mjs.map +1 -0
- package/dist/components/ui/dock/dock.mjs +444 -0
- package/dist/components/ui/dock/dock.mjs.map +1 -0
- package/dist/components/ui/dock/index.mjs +19 -0
- package/dist/components/ui/dock/index.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-actions.mjs +118 -0
- package/dist/components/ui/document-editor/block-actions.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-commands.mjs +182 -0
- package/dist/components/ui/document-editor/block-commands.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-handle.mjs +387 -0
- package/dist/components/ui/document-editor/block-handle.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-morph.mjs +95 -0
- package/dist/components/ui/document-editor/block-morph.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-selection.mjs +81 -0
- package/dist/components/ui/document-editor/block-selection.mjs.map +1 -0
- package/dist/components/ui/document-editor/blocks.mjs +30 -0
- package/dist/components/ui/document-editor/blocks.mjs.map +1 -0
- package/dist/components/ui/document-editor/bubble-menu.mjs +120 -0
- package/dist/components/ui/document-editor/bubble-menu.mjs.map +1 -0
- package/dist/components/ui/document-editor/code-block.mjs +89 -0
- package/dist/components/ui/document-editor/code-block.mjs.map +1 -0
- package/dist/components/ui/document-editor/collaboration-types.mjs +9 -0
- package/dist/components/ui/document-editor/collaboration-types.mjs.map +1 -0
- package/dist/components/ui/document-editor/collaboration.mjs +198 -0
- package/dist/components/ui/document-editor/collaboration.mjs.map +1 -0
- package/dist/components/ui/document-editor/columns.mjs +52 -0
- package/dist/components/ui/document-editor/columns.mjs.map +1 -0
- package/dist/components/ui/document-editor/contents.mjs +60 -0
- package/dist/components/ui/document-editor/contents.mjs.map +1 -0
- package/dist/components/ui/document-editor/date-chip.mjs +115 -0
- package/dist/components/ui/document-editor/date-chip.mjs.map +1 -0
- package/dist/components/ui/document-editor/date-words.mjs +101 -0
- package/dist/components/ui/document-editor/date-words.mjs.map +1 -0
- package/dist/components/ui/document-editor/doc-labels.mjs +19 -0
- package/dist/components/ui/document-editor/doc-labels.mjs.map +1 -0
- package/dist/components/ui/document-editor/document-editor.mjs +496 -0
- package/dist/components/ui/document-editor/document-editor.mjs.map +1 -0
- package/dist/components/ui/document-editor/emoji-suggest.mjs +81 -0
- package/dist/components/ui/document-editor/emoji-suggest.mjs.map +1 -0
- package/dist/components/ui/document-editor/focus-mode.mjs +32 -0
- package/dist/components/ui/document-editor/focus-mode.mjs.map +1 -0
- package/dist/components/ui/document-editor/geometry.mjs +35 -0
- package/dist/components/ui/document-editor/geometry.mjs.map +1 -0
- package/dist/components/ui/document-editor/ghost-text.mjs +154 -0
- package/dist/components/ui/document-editor/ghost-text.mjs.map +1 -0
- package/dist/components/ui/document-editor/gliding-caret.mjs +118 -0
- package/dist/components/ui/document-editor/gliding-caret.mjs.map +1 -0
- package/dist/components/ui/document-editor/headings.mjs +64 -0
- package/dist/components/ui/document-editor/headings.mjs.map +1 -0
- package/dist/components/ui/document-editor/image.mjs +318 -0
- package/dist/components/ui/document-editor/image.mjs.map +1 -0
- package/dist/components/ui/document-editor/index.mjs +131 -0
- package/dist/components/ui/document-editor/index.mjs.map +1 -0
- package/dist/components/ui/document-editor/labels.mjs +96 -0
- package/dist/components/ui/document-editor/labels.mjs.map +1 -0
- package/dist/components/ui/document-editor/link-card.mjs +138 -0
- package/dist/components/ui/document-editor/link-card.mjs.map +1 -0
- package/dist/components/ui/document-editor/mentions.mjs +105 -0
- package/dist/components/ui/document-editor/mentions.mjs.map +1 -0
- package/dist/components/ui/document-editor/outline.mjs +138 -0
- package/dist/components/ui/document-editor/outline.mjs.map +1 -0
- package/dist/components/ui/document-editor/section-fold.mjs +124 -0
- package/dist/components/ui/document-editor/section-fold.mjs.map +1 -0
- package/dist/components/ui/document-editor/slash-command.mjs +210 -0
- package/dist/components/ui/document-editor/slash-command.mjs.map +1 -0
- package/dist/components/ui/document-editor/suggest-list.mjs +187 -0
- package/dist/components/ui/document-editor/suggest-list.mjs.map +1 -0
- package/dist/components/ui/document-editor/table.mjs +242 -0
- package/dist/components/ui/document-editor/table.mjs.map +1 -0
- package/dist/components/ui/document-editor/templates.mjs +66 -0
- package/dist/components/ui/document-editor/templates.mjs.map +1 -0
- package/dist/components/ui/document-editor/toggle.mjs +176 -0
- package/dist/components/ui/document-editor/toggle.mjs.map +1 -0
- package/dist/components/ui/document-editor/typography-rules.mjs +8 -0
- package/dist/components/ui/document-editor/typography-rules.mjs.map +1 -0
- package/dist/components/ui/document-editor/use-editor-value.mjs +34 -0
- package/dist/components/ui/document-editor/use-editor-value.mjs.map +1 -0
- package/dist/components/ui/drawer/drawer-nav.mjs +153 -0
- package/dist/components/ui/drawer/drawer-nav.mjs.map +1 -0
- package/dist/components/ui/drawer/drawer.mjs +334 -0
- package/dist/components/ui/drawer/drawer.mjs.map +1 -0
- package/dist/components/ui/drawer/index.mjs +37 -0
- package/dist/components/ui/drawer/index.mjs.map +1 -0
- package/dist/components/ui/drawer/use-swipe-to-close.mjs +77 -0
- package/dist/components/ui/drawer/use-swipe-to-close.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.mjs +567 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu/index.mjs +43 -0
- package/dist/components/ui/dropdown-menu/index.mjs.map +1 -0
- package/dist/components/ui/editable-text/editable-text.mjs +148 -0
- package/dist/components/ui/editable-text/editable-text.mjs.map +1 -0
- package/dist/components/ui/editable-text/index.mjs +6 -0
- package/dist/components/ui/editable-text/index.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/emoji-data.mjs +469 -0
- package/dist/components/ui/emoji-picker/emoji-data.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/emoji-picker.mjs +464 -0
- package/dist/components/ui/emoji-picker/emoji-picker.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/index.mjs +19 -0
- package/dist/components/ui/emoji-picker/index.mjs.map +1 -0
- package/dist/components/ui/empty-state/empty-state.mjs +110 -0
- package/dist/components/ui/empty-state/empty-state.mjs.map +1 -0
- package/dist/components/ui/empty-state/index.mjs +17 -0
- package/dist/components/ui/empty-state/index.mjs.map +1 -0
- package/dist/components/ui/event-calendar/calendar-math.mjs +256 -0
- package/dist/components/ui/event-calendar/calendar-math.mjs.map +1 -0
- package/dist/components/ui/event-calendar/context.mjs +51 -0
- package/dist/components/ui/event-calendar/context.mjs.map +1 -0
- package/dist/components/ui/event-calendar/editor.mjs +292 -0
- package/dist/components/ui/event-calendar/editor.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-block.mjs +55 -0
- package/dist/components/ui/event-calendar/event-block.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-calendar.mjs +438 -0
- package/dist/components/ui/event-calendar/event-calendar.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-keys.mjs +41 -0
- package/dist/components/ui/event-calendar/event-keys.mjs.map +1 -0
- package/dist/components/ui/event-calendar/index.mjs +37 -0
- package/dist/components/ui/event-calendar/index.mjs.map +1 -0
- package/dist/components/ui/event-calendar/month-grid.mjs +207 -0
- package/dist/components/ui/event-calendar/month-grid.mjs.map +1 -0
- package/dist/components/ui/event-calendar/narrow.mjs +193 -0
- package/dist/components/ui/event-calendar/narrow.mjs.map +1 -0
- package/dist/components/ui/event-calendar/time-grid.mjs +534 -0
- package/dist/components/ui/event-calendar/time-grid.mjs.map +1 -0
- package/dist/components/ui/expandable-search/expandable-search.mjs +174 -0
- package/dist/components/ui/expandable-search/expandable-search.mjs.map +1 -0
- package/dist/components/ui/expandable-search/index.mjs +6 -0
- package/dist/components/ui/expandable-search/index.mjs.map +1 -0
- package/dist/components/ui/field/field.mjs +444 -0
- package/dist/components/ui/field/field.mjs.map +1 -0
- package/dist/components/ui/field/index.mjs +21 -0
- package/dist/components/ui/field/index.mjs.map +1 -0
- package/dist/components/ui/file-card/file-card.mjs +198 -0
- package/dist/components/ui/file-card/file-card.mjs.map +1 -0
- package/dist/components/ui/file-card/file-icon.mjs +66 -0
- package/dist/components/ui/file-card/file-icon.mjs.map +1 -0
- package/dist/components/ui/file-card/file-types.mjs +70 -0
- package/dist/components/ui/file-card/file-types.mjs.map +1 -0
- package/dist/components/ui/file-card/index.mjs +32 -0
- package/dist/components/ui/file-card/index.mjs.map +1 -0
- package/dist/components/ui/file-preview/context.mjs +77 -0
- package/dist/components/ui/file-preview/context.mjs.map +1 -0
- package/dist/components/ui/file-preview/file-preview.mjs +865 -0
- package/dist/components/ui/file-preview/file-preview.mjs.map +1 -0
- package/dist/components/ui/file-preview/index.mjs +56 -0
- package/dist/components/ui/file-preview/index.mjs.map +1 -0
- package/dist/components/ui/file-preview/pdf.mjs +250 -0
- package/dist/components/ui/file-preview/pdf.mjs.map +1 -0
- package/dist/components/ui/file-preview/renderers.mjs +257 -0
- package/dist/components/ui/file-preview/renderers.mjs.map +1 -0
- package/dist/components/ui/file-upload/file-upload.mjs +633 -0
- package/dist/components/ui/file-upload/file-upload.mjs.map +1 -0
- package/dist/components/ui/file-upload/index.mjs +42 -0
- package/dist/components/ui/file-upload/index.mjs.map +1 -0
- package/dist/components/ui/file-upload/validate.mjs +111 -0
- package/dist/components/ui/file-upload/validate.mjs.map +1 -0
- package/dist/components/ui/flag/flag.mjs +39 -0
- package/dist/components/ui/flag/flag.mjs.map +1 -0
- package/dist/components/ui/flag/index.mjs +7 -0
- package/dist/components/ui/flag/index.mjs.map +1 -0
- package/dist/components/ui/floating-window/floating-window.mjs +255 -0
- package/dist/components/ui/floating-window/floating-window.mjs.map +1 -0
- package/dist/components/ui/floating-window/index.mjs +11 -0
- package/dist/components/ui/floating-window/index.mjs.map +1 -0
- package/dist/components/ui/form/form-section.mjs +87 -0
- package/dist/components/ui/form/form-section.mjs.map +1 -0
- package/dist/components/ui/form/form.mjs +205 -0
- package/dist/components/ui/form/form.mjs.map +1 -0
- package/dist/components/ui/form/index.mjs +29 -0
- package/dist/components/ui/form/index.mjs.map +1 -0
- package/dist/components/ui/globe/globe-data.mjs +9 -0
- package/dist/components/ui/globe/globe-data.mjs.map +1 -0
- package/dist/components/ui/globe/globe-math.mjs +269 -0
- package/dist/components/ui/globe/globe-math.mjs.map +1 -0
- package/dist/components/ui/globe/globe.mjs +719 -0
- package/dist/components/ui/globe/globe.mjs.map +1 -0
- package/dist/components/ui/globe/index.mjs +13 -0
- package/dist/components/ui/globe/index.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-children.mjs +13 -0
- package/dist/components/ui/highlight-match/highlight-children.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-match-variants.mjs +17 -0
- package/dist/components/ui/highlight-match/highlight-match-variants.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-match.mjs +37 -0
- package/dist/components/ui/highlight-match/highlight-match.mjs.map +1 -0
- package/dist/components/ui/highlight-match/index.mjs +15 -0
- package/dist/components/ui/highlight-match/index.mjs.map +1 -0
- package/dist/components/ui/highlight-match/match-ranges.mjs +50 -0
- package/dist/components/ui/highlight-match/match-ranges.mjs.map +1 -0
- package/dist/components/ui/histogram-slider/histogram-slider.mjs +83 -0
- package/dist/components/ui/histogram-slider/histogram-slider.mjs.map +1 -0
- package/dist/components/ui/histogram-slider/index.mjs +6 -0
- package/dist/components/ui/histogram-slider/index.mjs.map +1 -0
- package/dist/components/ui/hold-button/hold-button.mjs +258 -0
- package/dist/components/ui/hold-button/hold-button.mjs.map +1 -0
- package/dist/components/ui/hold-button/index.mjs +6 -0
- package/dist/components/ui/hold-button/index.mjs.map +1 -0
- package/dist/components/ui/hover-card/hover-card.mjs +111 -0
- package/dist/components/ui/hover-card/hover-card.mjs.map +1 -0
- package/dist/components/ui/hover-card/index.mjs +21 -0
- package/dist/components/ui/hover-card/index.mjs.map +1 -0
- package/dist/components/ui/ink-tray/index.mjs +29 -0
- package/dist/components/ui/ink-tray/index.mjs.map +1 -0
- package/dist/components/ui/ink-tray/ink-tray-art.mjs +68 -0
- package/dist/components/ui/ink-tray/ink-tray-art.mjs.map +1 -0
- package/dist/components/ui/ink-tray/ink-tray.mjs +350 -0
- package/dist/components/ui/ink-tray/ink-tray.mjs.map +1 -0
- package/dist/components/ui/input/index.mjs +41 -0
- package/dist/components/ui/input/index.mjs.map +1 -0
- package/dist/components/ui/input/input.mjs +268 -0
- package/dist/components/ui/input/input.mjs.map +1 -0
- package/dist/components/ui/input/number-input.mjs +272 -0
- package/dist/components/ui/input/number-input.mjs.map +1 -0
- package/dist/components/ui/input/password-input.mjs +49 -0
- package/dist/components/ui/input/password-input.mjs.map +1 -0
- package/dist/components/ui/input/phone-input-countries.mjs +216 -0
- package/dist/components/ui/input/phone-input-countries.mjs.map +1 -0
- package/dist/components/ui/input/phone-input.mjs +326 -0
- package/dist/components/ui/input/phone-input.mjs.map +1 -0
- package/dist/components/ui/input/use-controllable-state.mjs +24 -0
- package/dist/components/ui/input/use-controllable-state.mjs.map +1 -0
- package/dist/components/ui/input/use-hold-repeat.mjs +35 -0
- package/dist/components/ui/input/use-hold-repeat.mjs.map +1 -0
- package/dist/components/ui/input-group/index.mjs +11 -0
- package/dist/components/ui/input-group/index.mjs.map +1 -0
- package/dist/components/ui/input-group/input-group.mjs +78 -0
- package/dist/components/ui/input-group/input-group.mjs.map +1 -0
- package/dist/components/ui/island/index.mjs +23 -0
- package/dist/components/ui/island/index.mjs.map +1 -0
- package/dist/components/ui/island/island.mjs +328 -0
- package/dist/components/ui/island/island.mjs.map +1 -0
- package/dist/components/ui/kbd/index.mjs +6 -0
- package/dist/components/ui/kbd/index.mjs.map +1 -0
- package/dist/components/ui/kbd/kbd.mjs +73 -0
- package/dist/components/ui/kbd/kbd.mjs.map +1 -0
- package/dist/components/ui/keypad/index.mjs +23 -0
- package/dist/components/ui/keypad/index.mjs.map +1 -0
- package/dist/components/ui/keypad/keypad.mjs +345 -0
- package/dist/components/ui/keypad/keypad.mjs.map +1 -0
- package/dist/components/ui/label/index.mjs +7 -0
- package/dist/components/ui/label/index.mjs.map +1 -0
- package/dist/components/ui/label/label.mjs +117 -0
- package/dist/components/ui/label/label.mjs.map +1 -0
- package/dist/components/ui/lightbox/index.mjs +47 -0
- package/dist/components/ui/lightbox/index.mjs.map +1 -0
- package/dist/components/ui/lightbox/labels.mjs +23 -0
- package/dist/components/ui/lightbox/labels.mjs.map +1 -0
- package/dist/components/ui/lightbox/lightbox.mjs +1359 -0
- package/dist/components/ui/lightbox/lightbox.mjs.map +1 -0
- package/dist/components/ui/link/index.mjs +6 -0
- package/dist/components/ui/link/index.mjs.map +1 -0
- package/dist/components/ui/link/link.mjs +64 -0
- package/dist/components/ui/link/link.mjs.map +1 -0
- package/dist/components/ui/list/index.mjs +35 -0
- package/dist/components/ui/list/index.mjs.map +1 -0
- package/dist/components/ui/list/list.mjs +505 -0
- package/dist/components/ui/list/list.mjs.map +1 -0
- package/dist/components/ui/load-more/index.mjs +23 -0
- package/dist/components/ui/load-more/index.mjs.map +1 -0
- package/dist/components/ui/load-more/load-more.mjs +409 -0
- package/dist/components/ui/load-more/load-more.mjs.map +1 -0
- package/dist/components/ui/map/index.mjs +27 -0
- package/dist/components/ui/map/index.mjs.map +1 -0
- package/dist/components/ui/map/map-style.mjs +169 -0
- package/dist/components/ui/map/map-style.mjs.map +1 -0
- package/dist/components/ui/map/map.mjs +624 -0
- package/dist/components/ui/map/map.mjs.map +1 -0
- package/dist/components/ui/map-pin/index.mjs +6 -0
- package/dist/components/ui/map-pin/index.mjs.map +1 -0
- package/dist/components/ui/map-pin/map-pin.mjs +55 -0
- package/dist/components/ui/map-pin/map-pin.mjs.map +1 -0
- package/dist/components/ui/mention/index.mjs +29 -0
- package/dist/components/ui/mention/index.mjs.map +1 -0
- package/dist/components/ui/mention/mention.mjs +262 -0
- package/dist/components/ui/mention/mention.mjs.map +1 -0
- package/dist/components/ui/mention/split-mentions.mjs +24 -0
- package/dist/components/ui/mention/split-mentions.mjs.map +1 -0
- package/dist/components/ui/menubar/index.mjs +39 -0
- package/dist/components/ui/menubar/index.mjs.map +1 -0
- package/dist/components/ui/menubar/menubar.mjs +222 -0
- package/dist/components/ui/menubar/menubar.mjs.map +1 -0
- package/dist/components/ui/meter/index.mjs +21 -0
- package/dist/components/ui/meter/index.mjs.map +1 -0
- package/dist/components/ui/meter/meter.mjs +167 -0
- package/dist/components/ui/meter/meter.mjs.map +1 -0
- package/dist/components/ui/multi-select/index.mjs +25 -0
- package/dist/components/ui/multi-select/index.mjs.map +1 -0
- package/dist/components/ui/multi-select/multi-select.mjs +285 -0
- package/dist/components/ui/multi-select/multi-select.mjs.map +1 -0
- package/dist/components/ui/navigation-menu/index.mjs +41 -0
- package/dist/components/ui/navigation-menu/index.mjs.map +1 -0
- package/dist/components/ui/navigation-menu/navigation-menu.mjs +396 -0
- package/dist/components/ui/navigation-menu/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/notebook-page/index.mjs +15 -0
- package/dist/components/ui/notebook-page/index.mjs.map +1 -0
- package/dist/components/ui/notebook-page/notebook-page.mjs +162 -0
- package/dist/components/ui/notebook-page/notebook-page.mjs.map +1 -0
- package/dist/components/ui/notification-inbox/index.mjs +47 -0
- package/dist/components/ui/notification-inbox/index.mjs.map +1 -0
- package/dist/components/ui/notification-inbox/notification-inbox.mjs +422 -0
- package/dist/components/ui/notification-inbox/notification-inbox.mjs.map +1 -0
- package/dist/components/ui/number-field/index.mjs +24 -0
- package/dist/components/ui/number-field/index.mjs.map +1 -0
- package/dist/components/ui/number-field/number-field.mjs +460 -0
- package/dist/components/ui/number-field/number-field.mjs.map +1 -0
- package/dist/components/ui/number-field/number-format.mjs +48 -0
- package/dist/components/ui/number-field/number-format.mjs.map +1 -0
- package/dist/components/ui/otp-input/index.mjs +9 -0
- package/dist/components/ui/otp-input/index.mjs.map +1 -0
- package/dist/components/ui/otp-input/otp-input.mjs +285 -0
- package/dist/components/ui/otp-input/otp-input.mjs.map +1 -0
- package/dist/components/ui/pager/index.mjs +7 -0
- package/dist/components/ui/pager/index.mjs.map +1 -0
- package/dist/components/ui/pager/pager.mjs +86 -0
- package/dist/components/ui/pager/pager.mjs.map +1 -0
- package/dist/components/ui/pagination/index.mjs +23 -0
- package/dist/components/ui/pagination/index.mjs.map +1 -0
- package/dist/components/ui/pagination/pagination.mjs +210 -0
- package/dist/components/ui/pagination/pagination.mjs.map +1 -0
- package/dist/components/ui/password-strength/index.mjs +21 -0
- package/dist/components/ui/password-strength/index.mjs.map +1 -0
- package/dist/components/ui/password-strength/password-rules.mjs +25 -0
- package/dist/components/ui/password-strength/password-rules.mjs.map +1 -0
- package/dist/components/ui/password-strength/password-strength.mjs +125 -0
- package/dist/components/ui/password-strength/password-strength.mjs.map +1 -0
- package/dist/components/ui/popover/index.mjs +31 -0
- package/dist/components/ui/popover/index.mjs.map +1 -0
- package/dist/components/ui/popover/popover.mjs +574 -0
- package/dist/components/ui/popover/popover.mjs.map +1 -0
- package/dist/components/ui/progress/index.mjs +15 -0
- package/dist/components/ui/progress/index.mjs.map +1 -0
- package/dist/components/ui/progress/progress.mjs +224 -0
- package/dist/components/ui/progress/progress.mjs.map +1 -0
- package/dist/components/ui/prose/index.mjs +6 -0
- package/dist/components/ui/prose/index.mjs.map +1 -0
- package/dist/components/ui/prose/prose.mjs +89 -0
- package/dist/components/ui/prose/prose.mjs.map +1 -0
- package/dist/components/ui/radio-group/index.mjs +15 -0
- package/dist/components/ui/radio-group/index.mjs.map +1 -0
- package/dist/components/ui/radio-group/radio-group.mjs +88 -0
- package/dist/components/ui/radio-group/radio-group.mjs.map +1 -0
- package/dist/components/ui/rating/index.mjs +6 -0
- package/dist/components/ui/rating/index.mjs.map +1 -0
- package/dist/components/ui/rating/rating.mjs +119 -0
- package/dist/components/ui/rating/rating.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/bubble-menu.mjs +120 -0
- package/dist/components/ui/rich-text-editor/bubble-menu.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/image-links.mjs +63 -0
- package/dist/components/ui/rich-text-editor/image-links.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/index.mjs +37 -0
- package/dist/components/ui/rich-text-editor/index.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/labels.mjs +27 -0
- package/dist/components/ui/rich-text-editor/labels.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/rich-text-editor.mjs +149 -0
- package/dist/components/ui/rich-text-editor/rich-text-editor.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/toolbar.mjs +325 -0
- package/dist/components/ui/rich-text-editor/toolbar.mjs.map +1 -0
- package/dist/components/ui/save-bar/index.mjs +13 -0
- package/dist/components/ui/save-bar/index.mjs.map +1 -0
- package/dist/components/ui/save-bar/save-bar.mjs +59 -0
- package/dist/components/ui/save-bar/save-bar.mjs.map +1 -0
- package/dist/components/ui/scroll-area/index.mjs +6 -0
- package/dist/components/ui/scroll-area/index.mjs.map +1 -0
- package/dist/components/ui/scroll-area/scroll-area.mjs +148 -0
- package/dist/components/ui/scroll-area/scroll-area.mjs.map +1 -0
- package/dist/components/ui/scroll-area/use-drag-scroll.mjs +134 -0
- package/dist/components/ui/scroll-area/use-drag-scroll.mjs.map +1 -0
- package/dist/components/ui/select/index.mjs +23 -0
- package/dist/components/ui/select/index.mjs.map +1 -0
- package/dist/components/ui/select/select.mjs +216 -0
- package/dist/components/ui/select/select.mjs.map +1 -0
- package/dist/components/ui/sheet/index.mjs +23 -0
- package/dist/components/ui/sheet/index.mjs.map +1 -0
- package/dist/components/ui/sheet/sheet.mjs +292 -0
- package/dist/components/ui/sheet/sheet.mjs.map +1 -0
- package/dist/components/ui/sidebar/index.mjs +122 -0
- package/dist/components/ui/sidebar/index.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-group.mjs +75 -0
- package/dist/components/ui/sidebar/sidebar-group.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-item.mjs +199 -0
- package/dist/components/ui/sidebar/sidebar-item.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-panels.mjs +182 -0
- package/dist/components/ui/sidebar/sidebar-panels.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-peek.mjs +324 -0
- package/dist/components/ui/sidebar/sidebar-peek.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-rich.mjs +65 -0
- package/dist/components/ui/sidebar/sidebar-rich.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-tree.mjs +224 -0
- package/dist/components/ui/sidebar/sidebar-tree.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar.mjs +205 -0
- package/dist/components/ui/sidebar/sidebar.mjs.map +1 -0
- package/dist/components/ui/sidebar/variants.mjs +396 -0
- package/dist/components/ui/sidebar/variants.mjs.map +1 -0
- package/dist/components/ui/signature/index.mjs +6 -0
- package/dist/components/ui/signature/index.mjs.map +1 -0
- package/dist/components/ui/signature/signature.mjs +145 -0
- package/dist/components/ui/signature/signature.mjs.map +1 -0
- package/dist/components/ui/signature-pad/index.mjs +19 -0
- package/dist/components/ui/signature-pad/index.mjs.map +1 -0
- package/dist/components/ui/signature-pad/signature-pad.mjs +210 -0
- package/dist/components/ui/signature-pad/signature-pad.mjs.map +1 -0
- package/dist/components/ui/signature-pad/strokes.mjs +68 -0
- package/dist/components/ui/signature-pad/strokes.mjs.map +1 -0
- package/dist/components/ui/skeleton/index.mjs +9 -0
- package/dist/components/ui/skeleton/index.mjs.map +1 -0
- package/dist/components/ui/skeleton/skeleton.mjs +58 -0
- package/dist/components/ui/skeleton/skeleton.mjs.map +1 -0
- package/dist/components/ui/slide/index.mjs +25 -0
- package/dist/components/ui/slide/index.mjs.map +1 -0
- package/dist/components/ui/slide/slide.mjs +159 -0
- package/dist/components/ui/slide/slide.mjs.map +1 -0
- package/dist/components/ui/slider/index.mjs +21 -0
- package/dist/components/ui/slider/index.mjs.map +1 -0
- package/dist/components/ui/slider/slider-input.mjs +449 -0
- package/dist/components/ui/slider/slider-input.mjs.map +1 -0
- package/dist/components/ui/slider/slider.mjs +235 -0
- package/dist/components/ui/slider/slider.mjs.map +1 -0
- package/dist/components/ui/slides/index.mjs +31 -0
- package/dist/components/ui/slides/index.mjs.map +1 -0
- package/dist/components/ui/slides/slides.mjs +890 -0
- package/dist/components/ui/slides/slides.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/index.mjs +17 -0
- package/dist/components/ui/smooth-anchors/index.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/smooth-anchors.mjs +75 -0
- package/dist/components/ui/smooth-anchors/smooth-anchors.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/smooth-scroll.mjs +87 -0
- package/dist/components/ui/smooth-anchors/smooth-scroll.mjs.map +1 -0
- package/dist/components/ui/spinner/index.mjs +6 -0
- package/dist/components/ui/spinner/index.mjs.map +1 -0
- package/dist/components/ui/spinner/spinner.mjs +49 -0
- package/dist/components/ui/spinner/spinner.mjs.map +1 -0
- package/dist/components/ui/stat/index.mjs +29 -0
- package/dist/components/ui/stat/index.mjs.map +1 -0
- package/dist/components/ui/stat/stat.mjs +226 -0
- package/dist/components/ui/stat/stat.mjs.map +1 -0
- package/dist/components/ui/status-bar/index.mjs +17 -0
- package/dist/components/ui/status-bar/index.mjs.map +1 -0
- package/dist/components/ui/status-bar/status-bar.mjs +96 -0
- package/dist/components/ui/status-bar/status-bar.mjs.map +1 -0
- package/dist/components/ui/stepper/index.mjs +25 -0
- package/dist/components/ui/stepper/index.mjs.map +1 -0
- package/dist/components/ui/stepper/stepper.mjs +235 -0
- package/dist/components/ui/stepper/stepper.mjs.map +1 -0
- package/dist/components/ui/steps/index.mjs +9 -0
- package/dist/components/ui/steps/index.mjs.map +1 -0
- package/dist/components/ui/steps/steps.mjs +70 -0
- package/dist/components/ui/steps/steps.mjs.map +1 -0
- package/dist/components/ui/swatch-grid/index.mjs +7 -0
- package/dist/components/ui/swatch-grid/index.mjs.map +1 -0
- package/dist/components/ui/swatch-grid/swatch-grid.mjs +110 -0
- package/dist/components/ui/swatch-grid/swatch-grid.mjs.map +1 -0
- package/dist/components/ui/switch/index.mjs +7 -0
- package/dist/components/ui/switch/index.mjs.map +1 -0
- package/dist/components/ui/switch/switch.mjs +79 -0
- package/dist/components/ui/switch/switch.mjs.map +1 -0
- package/dist/components/ui/tab-strip/index.mjs +13 -0
- package/dist/components/ui/tab-strip/index.mjs.map +1 -0
- package/dist/components/ui/tab-strip/tab-strip.mjs +244 -0
- package/dist/components/ui/tab-strip/tab-strip.mjs.map +1 -0
- package/dist/components/ui/table/index.mjs +27 -0
- package/dist/components/ui/table/index.mjs.map +1 -0
- package/dist/components/ui/table/table.mjs +290 -0
- package/dist/components/ui/table/table.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/index.mjs +20 -0
- package/dist/components/ui/table-of-contents/index.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/scroll-spy.mjs +60 -0
- package/dist/components/ui/table-of-contents/scroll-spy.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/table-of-contents.mjs +371 -0
- package/dist/components/ui/table-of-contents/table-of-contents.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/use-headings.mjs +40 -0
- package/dist/components/ui/table-of-contents/use-headings.mjs.map +1 -0
- package/dist/components/ui/tablet-frame/index.mjs +7 -0
- package/dist/components/ui/tablet-frame/index.mjs.map +1 -0
- package/dist/components/ui/tablet-frame/tablet-frame.mjs +48 -0
- package/dist/components/ui/tablet-frame/tablet-frame.mjs.map +1 -0
- package/dist/components/ui/tabs/index.mjs +25 -0
- package/dist/components/ui/tabs/index.mjs.map +1 -0
- package/dist/components/ui/tabs/tabs.mjs +382 -0
- package/dist/components/ui/tabs/tabs.mjs.map +1 -0
- package/dist/components/ui/tabs/use-tabs-indicator.mjs +90 -0
- package/dist/components/ui/tabs/use-tabs-indicator.mjs.map +1 -0
- package/dist/components/ui/tags-input/index.mjs +9 -0
- package/dist/components/ui/tags-input/index.mjs.map +1 -0
- package/dist/components/ui/tags-input/split.mjs +38 -0
- package/dist/components/ui/tags-input/split.mjs.map +1 -0
- package/dist/components/ui/tags-input/tags-input.mjs +328 -0
- package/dist/components/ui/tags-input/tags-input.mjs.map +1 -0
- package/dist/components/ui/terminal/index.mjs +41 -0
- package/dist/components/ui/terminal/index.mjs.map +1 -0
- package/dist/components/ui/terminal/terminal.mjs +287 -0
- package/dist/components/ui/terminal/terminal.mjs.map +1 -0
- package/dist/components/ui/textarea/index.mjs +21 -0
- package/dist/components/ui/textarea/index.mjs.map +1 -0
- package/dist/components/ui/textarea/textarea.mjs +244 -0
- package/dist/components/ui/textarea/textarea.mjs.map +1 -0
- package/dist/components/ui/theme-provider/index.mjs +6 -0
- package/dist/components/ui/theme-provider/index.mjs.map +1 -0
- package/dist/components/ui/theme-provider/theme-provider.mjs +70 -0
- package/dist/components/ui/theme-provider/theme-provider.mjs.map +1 -0
- package/dist/components/ui/toast/index.mjs +19 -0
- package/dist/components/ui/toast/index.mjs.map +1 -0
- package/dist/components/ui/toast/store.mjs +96 -0
- package/dist/components/ui/toast/store.mjs.map +1 -0
- package/dist/components/ui/toast/toast.mjs +395 -0
- package/dist/components/ui/toast/toast.mjs.map +1 -0
- package/dist/components/ui/toggle/index.mjs +13 -0
- package/dist/components/ui/toggle/index.mjs.map +1 -0
- package/dist/components/ui/toggle/toggle.mjs +123 -0
- package/dist/components/ui/toggle/toggle.mjs.map +1 -0
- package/dist/components/ui/toggle-group/index.mjs +11 -0
- package/dist/components/ui/toggle-group/index.mjs.map +1 -0
- package/dist/components/ui/toggle-group/toggle-group.mjs +243 -0
- package/dist/components/ui/toggle-group/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggletip/index.mjs +6 -0
- package/dist/components/ui/toggletip/index.mjs.map +1 -0
- package/dist/components/ui/toggletip/toggletip.mjs +95 -0
- package/dist/components/ui/toggletip/toggletip.mjs.map +1 -0
- package/dist/components/ui/toolbar/index.mjs +21 -0
- package/dist/components/ui/toolbar/index.mjs.map +1 -0
- package/dist/components/ui/toolbar/toolbar.mjs +130 -0
- package/dist/components/ui/toolbar/toolbar.mjs.map +1 -0
- package/dist/components/ui/tooltip/index.mjs +29 -0
- package/dist/components/ui/tooltip/index.mjs.map +1 -0
- package/dist/components/ui/tooltip/tooltip.mjs +640 -0
- package/dist/components/ui/tooltip/tooltip.mjs.map +1 -0
- package/dist/components/ui/tree/index.mjs +11 -0
- package/dist/components/ui/tree/index.mjs.map +1 -0
- package/dist/components/ui/tree/tree.mjs +450 -0
- package/dist/components/ui/tree/tree.mjs.map +1 -0
- package/dist/index.d.mts +19397 -0
- package/dist/index.mjs +157 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/color.mjs +78 -0
- package/dist/lib/color.mjs.map +1 -0
- package/dist/lib/create-context.mjs +31 -0
- package/dist/lib/create-context.mjs.map +1 -0
- package/dist/lib/date.mjs +116 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/density.mjs +79 -0
- package/dist/lib/density.mjs.map +1 -0
- package/dist/lib/field-context.mjs +13 -0
- package/dist/lib/field-context.mjs.map +1 -0
- package/dist/lib/filter.mjs +28 -0
- package/dist/lib/filter.mjs.map +1 -0
- package/dist/lib/gesture.mjs +38 -0
- package/dist/lib/gesture.mjs.map +1 -0
- package/dist/lib/hit-area.mjs +14 -0
- package/dist/lib/hit-area.mjs.map +1 -0
- package/dist/lib/labels.mjs +27 -0
- package/dist/lib/labels.mjs.map +1 -0
- package/dist/lib/morph-box.mjs +56 -0
- package/dist/lib/morph-box.mjs.map +1 -0
- package/dist/lib/motion.mjs +70 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/lib/pulse.mjs +69 -0
- package/dist/lib/pulse.mjs.map +1 -0
- package/dist/lib/roving-focus.mjs +74 -0
- package/dist/lib/roving-focus.mjs.map +1 -0
- package/dist/lib/theme.mjs +67 -0
- package/dist/lib/theme.mjs.map +1 -0
- package/dist/lib/tv.mjs +11 -0
- package/dist/lib/tv.mjs.map +1 -0
- package/dist/lib/utils.mjs +82 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +133 -4
|
@@ -0,0 +1,1359 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { CaretLeft, CaretRight, CornersOut, MagnifyingGlassPlus, Minus, Plus, X } from "atoms-icons";
|
|
5
|
+
import { Dialog as DialogPrimitive, Slot } from "radix-ui";
|
|
6
|
+
import { Button } from "../button/button.mjs";
|
|
7
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
8
|
+
import { defaultLightboxLabels } from "./labels.mjs";
|
|
9
|
+
const FIT = { scale: 1, x: 0, y: 0 };
|
|
10
|
+
const EASE = "cubic-bezier(0.23, 1, 0.32, 1)";
|
|
11
|
+
const FLIGHT_MS = 380;
|
|
12
|
+
const SETTLE = `transform 320ms ${EASE}, opacity 320ms ${EASE}`;
|
|
13
|
+
const reducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
14
|
+
function capture(event) {
|
|
15
|
+
try {
|
|
16
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function subscribeResize(callback) {
|
|
21
|
+
window.addEventListener("resize", callback);
|
|
22
|
+
return () => window.removeEventListener("resize", callback);
|
|
23
|
+
}
|
|
24
|
+
const readSize = () => `${window.innerWidth}x${window.innerHeight}`;
|
|
25
|
+
function useViewportSize() {
|
|
26
|
+
const value = React.useSyncExternalStore(subscribeResize, readSize, () => "1280x800");
|
|
27
|
+
const [w, h] = value.split("x").map(Number);
|
|
28
|
+
return { w, h };
|
|
29
|
+
}
|
|
30
|
+
const LightboxContext = React.createContext(null);
|
|
31
|
+
function useLightbox(part) {
|
|
32
|
+
const ctx = React.useContext(LightboxContext);
|
|
33
|
+
if (!ctx) throw new Error(`${part} must be used inside <Lightbox>`);
|
|
34
|
+
return ctx;
|
|
35
|
+
}
|
|
36
|
+
function byDocumentOrder(a, b) {
|
|
37
|
+
if (!a.el || !b.el) return 0;
|
|
38
|
+
return a.el.compareDocumentPosition(b.el) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
39
|
+
}
|
|
40
|
+
function Lightbox({
|
|
41
|
+
layout = "stage",
|
|
42
|
+
slides: slidesProp,
|
|
43
|
+
images,
|
|
44
|
+
open: openProp,
|
|
45
|
+
defaultOpen = false,
|
|
46
|
+
onOpenChange,
|
|
47
|
+
index: indexProp,
|
|
48
|
+
defaultIndex = 0,
|
|
49
|
+
onIndexChange,
|
|
50
|
+
loop: loopProp,
|
|
51
|
+
labels: labelsProp,
|
|
52
|
+
thumbnails: thumbnailsProp,
|
|
53
|
+
zoomable = true,
|
|
54
|
+
maxZoom = 3,
|
|
55
|
+
zoomStep = 0.1,
|
|
56
|
+
flight: flightProp,
|
|
57
|
+
zoom: zoomAlias,
|
|
58
|
+
children
|
|
59
|
+
}) {
|
|
60
|
+
const [entries, setEntries] = React.useState([]);
|
|
61
|
+
const indexTriggers = React.useRef(/* @__PURE__ */ new Map());
|
|
62
|
+
const contentRef = React.useRef(null);
|
|
63
|
+
const overlayRef = React.useRef(null);
|
|
64
|
+
const [openState, setOpenState] = React.useState(defaultOpen);
|
|
65
|
+
const open = openProp ?? openState;
|
|
66
|
+
const [indexState, setIndexState] = React.useState(defaultIndex);
|
|
67
|
+
const index = indexProp ?? indexState;
|
|
68
|
+
const [zoom, setZoom] = React.useState(FIT);
|
|
69
|
+
const [chrome, setChrome] = React.useState("rest");
|
|
70
|
+
const [sizes, setSizes] = React.useState({});
|
|
71
|
+
const idle = React.useRef(void 0);
|
|
72
|
+
const [contents, setContents] = React.useState(0);
|
|
73
|
+
const registerContent = React.useCallback(() => {
|
|
74
|
+
setContents((n) => n + 1);
|
|
75
|
+
return () => setContents((n) => n - 1);
|
|
76
|
+
}, []);
|
|
77
|
+
const slides = slidesProp ?? images ?? entries.map((entry) => entry.slide);
|
|
78
|
+
const count = slides.length;
|
|
79
|
+
const loop = loopProp ?? layout !== "carousel";
|
|
80
|
+
const labels = React.useMemo(() => ({ ...defaultLightboxLabels, ...labelsProp }), [labelsProp]);
|
|
81
|
+
const thumbnails = thumbnailsProp ?? (layout === "filmstrip" || layout === "inspector" || layout === "carousel");
|
|
82
|
+
const flight = flightProp ?? zoomAlias ?? true;
|
|
83
|
+
const setOpen = React.useCallback(
|
|
84
|
+
(next) => {
|
|
85
|
+
if (openProp === void 0) setOpenState(next);
|
|
86
|
+
onOpenChange?.(next);
|
|
87
|
+
},
|
|
88
|
+
[openProp, onOpenChange]
|
|
89
|
+
);
|
|
90
|
+
const go = React.useCallback(
|
|
91
|
+
(to) => {
|
|
92
|
+
if (count === 0) return;
|
|
93
|
+
const next = loop ? (to % count + count) % count : Math.max(0, Math.min(count - 1, to));
|
|
94
|
+
setZoom(FIT);
|
|
95
|
+
if (indexProp === void 0) setIndexState(next);
|
|
96
|
+
onIndexChange?.(next);
|
|
97
|
+
},
|
|
98
|
+
[count, loop, indexProp, onIndexChange]
|
|
99
|
+
);
|
|
100
|
+
const triggerFor = React.useCallback(
|
|
101
|
+
(i) => indexTriggers.current.get(i) ?? (slidesProp || images ? null : entries[i]?.el ?? null),
|
|
102
|
+
[entries, slidesProp, images]
|
|
103
|
+
);
|
|
104
|
+
const openAt = React.useCallback(
|
|
105
|
+
(i) => {
|
|
106
|
+
setZoom(FIT);
|
|
107
|
+
setChrome("rest");
|
|
108
|
+
if (indexProp === void 0) setIndexState(i);
|
|
109
|
+
onIndexChange?.(i);
|
|
110
|
+
setOpen(true);
|
|
111
|
+
},
|
|
112
|
+
[indexProp, onIndexChange, setOpen]
|
|
113
|
+
);
|
|
114
|
+
const closing = React.useRef(false);
|
|
115
|
+
const close = React.useCallback(() => {
|
|
116
|
+
if (closing.current) return;
|
|
117
|
+
const content = contentRef.current;
|
|
118
|
+
const overlay = overlayRef.current;
|
|
119
|
+
const finish = () => {
|
|
120
|
+
closing.current = false;
|
|
121
|
+
setZoom(FIT);
|
|
122
|
+
setOpen(false);
|
|
123
|
+
};
|
|
124
|
+
if (!content || reducedMotion()) return finish();
|
|
125
|
+
closing.current = true;
|
|
126
|
+
const frame = content.querySelector(`[data-lightbox-index="${index}"] [data-lightbox-frame]`);
|
|
127
|
+
const tile = triggerFor(index);
|
|
128
|
+
const animations = flyBack({ frame, tile, content, overlay, enabled: flight });
|
|
129
|
+
const timer = window.setTimeout(finish, FLIGHT_MS + 120);
|
|
130
|
+
Promise.all(animations.map((animation) => animation.finished.catch(() => void 0))).then(() => {
|
|
131
|
+
window.clearTimeout(timer);
|
|
132
|
+
finish();
|
|
133
|
+
});
|
|
134
|
+
}, [flight, index, setOpen, triggerFor]);
|
|
135
|
+
const wakeChrome = React.useCallback(() => {
|
|
136
|
+
setChrome("active");
|
|
137
|
+
window.clearTimeout(idle.current);
|
|
138
|
+
idle.current = window.setTimeout(() => setChrome("hidden"), 2e3);
|
|
139
|
+
}, []);
|
|
140
|
+
const toggleChrome = React.useCallback(() => {
|
|
141
|
+
window.clearTimeout(idle.current);
|
|
142
|
+
setChrome((current) => current === "hidden" ? "active" : "hidden");
|
|
143
|
+
}, []);
|
|
144
|
+
const register = React.useCallback((entry) => {
|
|
145
|
+
setEntries((list) => [...list.filter((item) => item.id !== entry.id), entry].sort(byDocumentOrder));
|
|
146
|
+
return () => setEntries((list) => list.filter((item) => item.id !== entry.id));
|
|
147
|
+
}, []);
|
|
148
|
+
const registerIndexTrigger = React.useCallback((i, el) => {
|
|
149
|
+
if (el) indexTriggers.current.set(i, el);
|
|
150
|
+
return () => {
|
|
151
|
+
if (indexTriggers.current.get(i) === el) indexTriggers.current.delete(i);
|
|
152
|
+
};
|
|
153
|
+
}, []);
|
|
154
|
+
const setSize = React.useCallback((i, w, h) => {
|
|
155
|
+
setSizes((current) => current[i]?.w === w && current[i]?.h === h ? current : { ...current, [i]: { w, h } });
|
|
156
|
+
}, []);
|
|
157
|
+
const value = {
|
|
158
|
+
layout,
|
|
159
|
+
slides,
|
|
160
|
+
count,
|
|
161
|
+
index: Math.min(index, Math.max(0, count - 1)),
|
|
162
|
+
open,
|
|
163
|
+
loop,
|
|
164
|
+
labels,
|
|
165
|
+
thumbnails,
|
|
166
|
+
zoomable,
|
|
167
|
+
maxZoom,
|
|
168
|
+
zoomStep,
|
|
169
|
+
flight,
|
|
170
|
+
zoom,
|
|
171
|
+
chrome,
|
|
172
|
+
sizes,
|
|
173
|
+
go,
|
|
174
|
+
step: (by) => go(index + by),
|
|
175
|
+
openAt,
|
|
176
|
+
close,
|
|
177
|
+
setZoom,
|
|
178
|
+
wakeChrome,
|
|
179
|
+
toggleChrome,
|
|
180
|
+
setSize,
|
|
181
|
+
register,
|
|
182
|
+
registerIndexTrigger,
|
|
183
|
+
triggerFor,
|
|
184
|
+
contentRef,
|
|
185
|
+
overlayRef,
|
|
186
|
+
registerContent
|
|
187
|
+
};
|
|
188
|
+
return /* @__PURE__ */ jsxs(LightboxContext.Provider, { value, children: [
|
|
189
|
+
children,
|
|
190
|
+
contents === 0 ? /* @__PURE__ */ jsx(ContentImpl, {}) : null
|
|
191
|
+
] });
|
|
192
|
+
}
|
|
193
|
+
function onScreen(el) {
|
|
194
|
+
if (!el) return false;
|
|
195
|
+
const r = el.getBoundingClientRect();
|
|
196
|
+
return r.width > 0 && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth;
|
|
197
|
+
}
|
|
198
|
+
function tileFrame(frame, tile) {
|
|
199
|
+
const f = frame.getBoundingClientRect();
|
|
200
|
+
const t = tile.getBoundingClientRect();
|
|
201
|
+
const scale = Math.max(t.width / f.width, t.height / f.height);
|
|
202
|
+
const dx = t.left + t.width / 2 - (f.left + f.width / 2);
|
|
203
|
+
const dy = t.top + t.height / 2 - (f.top + f.height / 2);
|
|
204
|
+
const insetX = (f.width - t.width / scale) / 2;
|
|
205
|
+
const insetY = (f.height - t.height / scale) / 2;
|
|
206
|
+
const radius = parseFloat(getComputedStyle(tile).borderTopLeftRadius) || 0;
|
|
207
|
+
return {
|
|
208
|
+
transform: `translate(${dx}px, ${dy}px) scale(${scale})`,
|
|
209
|
+
clipPath: `inset(${insetY}px ${insetX}px round ${radius / scale}px)`
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function flyIn({ frame, tile, content, overlay, enabled }) {
|
|
213
|
+
const animations = [];
|
|
214
|
+
const fade = [{ opacity: 0 }, { opacity: 1 }];
|
|
215
|
+
if (enabled && frame && tile && onScreen(tile)) {
|
|
216
|
+
animations.push(
|
|
217
|
+
frame.animate([tileFrame(frame, tile), { transform: "none", clipPath: "inset(0px 0px round 0px)" }], {
|
|
218
|
+
duration: FLIGHT_MS,
|
|
219
|
+
easing: EASE
|
|
220
|
+
})
|
|
221
|
+
);
|
|
222
|
+
content.querySelectorAll("[data-lightbox-chrome], [data-lightbox-index]:not(:has([data-lightbox-frame] *))").forEach(
|
|
223
|
+
(el) => animations.push(el.animate(fade, { duration: FLIGHT_MS, easing: EASE }))
|
|
224
|
+
);
|
|
225
|
+
} else {
|
|
226
|
+
animations.push(content.animate(fade, { duration: 200, easing: EASE }));
|
|
227
|
+
}
|
|
228
|
+
if (overlay) animations.push(overlay.animate(fade, { duration: FLIGHT_MS, easing: EASE }));
|
|
229
|
+
return animations;
|
|
230
|
+
}
|
|
231
|
+
function flyBack({ frame, tile, content, overlay, enabled }) {
|
|
232
|
+
const animations = [];
|
|
233
|
+
const out = [{ opacity: 1 }, { opacity: 0 }];
|
|
234
|
+
const options = { duration: FLIGHT_MS, easing: EASE, fill: "forwards" };
|
|
235
|
+
if (enabled && frame && tile && onScreen(tile)) {
|
|
236
|
+
animations.push(frame.animate([{ transform: "none", clipPath: "inset(0px 0px round 0px)" }, tileFrame(frame, tile)], options));
|
|
237
|
+
content.querySelectorAll("[data-lightbox-chrome]").forEach((el) => animations.push(el.animate(out, options)));
|
|
238
|
+
} else {
|
|
239
|
+
animations.push(content.animate(out, { ...options, duration: 200 }));
|
|
240
|
+
}
|
|
241
|
+
if (overlay) animations.push(overlay.animate(out, options));
|
|
242
|
+
return animations;
|
|
243
|
+
}
|
|
244
|
+
function LightboxTrigger({
|
|
245
|
+
src,
|
|
246
|
+
fullSrc,
|
|
247
|
+
alt,
|
|
248
|
+
caption,
|
|
249
|
+
width,
|
|
250
|
+
height,
|
|
251
|
+
index: indexProp,
|
|
252
|
+
label,
|
|
253
|
+
asChild = false,
|
|
254
|
+
className,
|
|
255
|
+
onClick,
|
|
256
|
+
children,
|
|
257
|
+
ref,
|
|
258
|
+
...props
|
|
259
|
+
}) {
|
|
260
|
+
const ctx = useLightbox("LightboxTrigger");
|
|
261
|
+
const id = React.useId();
|
|
262
|
+
const [el, setEl] = React.useState(null);
|
|
263
|
+
const { register, registerIndexTrigger } = ctx;
|
|
264
|
+
const dataMode = indexProp !== void 0;
|
|
265
|
+
React.useLayoutEffect(() => {
|
|
266
|
+
if (dataMode || !src) return;
|
|
267
|
+
return register({ id, el, slide: { src, thumb: src, fullSrc, alt, caption, width, height } });
|
|
268
|
+
}, [dataMode, register, id, el, src, fullSrc, alt, caption, width, height]);
|
|
269
|
+
React.useLayoutEffect(() => {
|
|
270
|
+
if (!dataMode) return;
|
|
271
|
+
return registerIndexTrigger(indexProp, el);
|
|
272
|
+
}, [dataMode, indexProp, el, registerIndexTrigger]);
|
|
273
|
+
const position = dataMode ? indexProp : ctx.slides.findIndex((slide) => slide.src === src && slide.alt === alt);
|
|
274
|
+
const pill = label === void 0 ? ctx.labels.trigger : label;
|
|
275
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
276
|
+
return /* @__PURE__ */ jsx(
|
|
277
|
+
Comp,
|
|
278
|
+
{
|
|
279
|
+
ref: (node) => {
|
|
280
|
+
setEl(node);
|
|
281
|
+
if (typeof ref === "function") ref(node);
|
|
282
|
+
else if (ref) ref.current = node;
|
|
283
|
+
},
|
|
284
|
+
type: asChild ? void 0 : "button",
|
|
285
|
+
"data-slot": "lightbox-trigger",
|
|
286
|
+
"aria-label": asChild || children ? void 0 : alt,
|
|
287
|
+
className: cn(
|
|
288
|
+
!asChild && "group relative block cursor-pointer overflow-hidden outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background aspect-[3/2] rounded-xl bg-muted",
|
|
289
|
+
className
|
|
290
|
+
),
|
|
291
|
+
onClick: (event) => {
|
|
292
|
+
onClick?.(event);
|
|
293
|
+
if (event.defaultPrevented || position < 0) return;
|
|
294
|
+
ctx.openAt(position);
|
|
295
|
+
},
|
|
296
|
+
...props,
|
|
297
|
+
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
298
|
+
children ?? // eslint-disable-next-line @next/next/no-img-element
|
|
299
|
+
(src ? /* @__PURE__ */ jsx("img", { src, alt: "", draggable: false, loading: "lazy", className: "size-full select-none object-cover" }) : null),
|
|
300
|
+
/* @__PURE__ */ jsx(
|
|
301
|
+
"span",
|
|
302
|
+
{
|
|
303
|
+
"aria-hidden": true,
|
|
304
|
+
className: "pointer-events-none absolute inset-0 bg-black/0 transition-colors duration-base ease-out group-hover:bg-black/30 group-focus-visible:bg-black/30"
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
pill !== null ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 grid place-items-center", children: /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white shadow-md scale-90 opacity-0 transition-[opacity,transform] duration-base ease-spring group-hover:scale-100 group-hover:opacity-100 group-focus-visible:scale-100 group-focus-visible:opacity-100 [&_svg]:size-3.5 [&_svg]:shrink-0", children: pill }) }) : null
|
|
308
|
+
] })
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
function fit(sw, sh, bw, bh) {
|
|
313
|
+
const scale = Math.min(bw / sw, bh / sh);
|
|
314
|
+
return { w: Math.round(sw * scale), h: Math.round(sh * scale) };
|
|
315
|
+
}
|
|
316
|
+
function useGeometry() {
|
|
317
|
+
const ctx = useLightbox("Lightbox");
|
|
318
|
+
const { w: vw, h: vh } = useViewportSize();
|
|
319
|
+
const slide = ctx.slides[ctx.index];
|
|
320
|
+
const natural = ctx.sizes[ctx.index] ?? { w: slide?.width ?? 3, h: slide?.height ?? 2 };
|
|
321
|
+
const wide = vw >= 640;
|
|
322
|
+
const md = vw >= 768;
|
|
323
|
+
switch (ctx.layout) {
|
|
324
|
+
case "carousel": {
|
|
325
|
+
const top = 64;
|
|
326
|
+
const bottom = ctx.thumbnails ? 136 : 64;
|
|
327
|
+
const box = fit(natural.w, natural.h, vw * (wide ? 0.66 : 0.82), vh - top - bottom);
|
|
328
|
+
return { ...box, cy: top + (vh - top - bottom) / 2, spacing: box.w * 0.78 + (wide ? 48 : 16), below: top + (vh - top - bottom) / 2 + box.h / 2 + 16, bandW: vw, bandH: vh - top - bottom };
|
|
329
|
+
}
|
|
330
|
+
case "filmstrip": {
|
|
331
|
+
const top = 64;
|
|
332
|
+
const bottom = 132;
|
|
333
|
+
const box = fit(natural.w, natural.h, vw - (wide ? 160 : 32), vh - top - bottom);
|
|
334
|
+
return { ...box, cy: top + (vh - top - bottom) / 2, spacing: box.w + (wide ? 24 : 12), below: vh - bottom, bandW: vw, bandH: vh - top - bottom };
|
|
335
|
+
}
|
|
336
|
+
case "inspector": {
|
|
337
|
+
const stageW = md ? vw - 352 - 12 : vw - 16;
|
|
338
|
+
const stageH = md ? vh - 24 : vh - 56 - 8 - vh * 0.28;
|
|
339
|
+
const box = fit(natural.w, natural.h, stageW - 48, stageH - 48);
|
|
340
|
+
return { ...box, cy: stageH / 2, spacing: box.w + 48, below: stageH, bandW: stageW, bandH: stageH };
|
|
341
|
+
}
|
|
342
|
+
case "feed": {
|
|
343
|
+
const gutter = wide ? 144 : 80;
|
|
344
|
+
const cw = Math.min(vw - gutter * 2 + (wide ? 0 : 112), 880);
|
|
345
|
+
return { w: cw, h: cw * natural.h / natural.w, cy: vh / 2, spacing: 0, below: 0, bandW: vw, bandH: vh };
|
|
346
|
+
}
|
|
347
|
+
default: {
|
|
348
|
+
const top = 72;
|
|
349
|
+
const bottom = ctx.thumbnails ? 152 : 72;
|
|
350
|
+
const box = fit(natural.w, natural.h, vw - (wide ? 160 : 24), vh - top - bottom);
|
|
351
|
+
const cy = top + (vh - top - bottom) / 2;
|
|
352
|
+
return { ...box, cy, spacing: box.w + (wide ? 192 : 48), below: cy + box.h / 2 + 14, bandW: vw, bandH: vh - top - bottom };
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
function maxScale(ctx, geo) {
|
|
357
|
+
const natural = ctx.sizes[ctx.index];
|
|
358
|
+
return Math.max(ctx.maxZoom, natural ? natural.w / geo.w : 1);
|
|
359
|
+
}
|
|
360
|
+
function clampPan(zoom, geo) {
|
|
361
|
+
const limitX = Math.max(0, (geo.w * zoom.scale - geo.bandW) / 2);
|
|
362
|
+
const limitY = Math.max(0, (geo.h * zoom.scale - geo.bandH) / 2);
|
|
363
|
+
return { scale: zoom.scale, x: Math.max(-limitX, Math.min(limitX, zoom.x)), y: Math.max(-limitY, Math.min(limitY, zoom.y)) };
|
|
364
|
+
}
|
|
365
|
+
function zoomAt(zoom, scale, px, py, geo) {
|
|
366
|
+
if (scale <= 1) return FIT;
|
|
367
|
+
const ratio2 = scale / zoom.scale;
|
|
368
|
+
return clampPan({ scale, x: px - (px - zoom.x) * ratio2, y: py - (py - zoom.y) * ratio2 }, geo);
|
|
369
|
+
}
|
|
370
|
+
const contentClass = {
|
|
371
|
+
stage: "group/lightbox fixed inset-0 z-50 select-none outline-none overflow-hidden touch-none cursor-zoom-out data-[zoomed=true]:cursor-grab data-[chrome=hidden]:cursor-none",
|
|
372
|
+
carousel: "group/lightbox fixed inset-0 z-50 select-none outline-none overflow-hidden touch-none",
|
|
373
|
+
filmstrip: "group/lightbox fixed inset-0 z-50 select-none outline-none flex flex-col",
|
|
374
|
+
inspector: "group/lightbox fixed inset-0 z-50 select-none outline-none grid grid-cols-1 grid-rows-[3.5rem_minmax(0,1fr)] [grid-template-areas:'bar'_'stage'] md:grid-cols-[minmax(0,1fr)_22rem] md:[grid-template-areas:'stage_bar'_'stage_panel'] text-foreground",
|
|
375
|
+
feed: "group/lightbox fixed inset-0 z-50 select-none outline-none overflow-hidden"
|
|
376
|
+
};
|
|
377
|
+
function DefaultParts({ layout, thumbnails }) {
|
|
378
|
+
switch (layout) {
|
|
379
|
+
case "filmstrip":
|
|
380
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
381
|
+
/* @__PURE__ */ jsx(LightboxHeader, { children: /* @__PURE__ */ jsxs(LightboxActions, { children: [
|
|
382
|
+
/* @__PURE__ */ jsx(LightboxZoom, {}),
|
|
383
|
+
/* @__PURE__ */ jsx(LightboxClose, {})
|
|
384
|
+
] }) }),
|
|
385
|
+
/* @__PURE__ */ jsxs(LightboxViewport, { children: [
|
|
386
|
+
/* @__PURE__ */ jsx(LightboxPrev, {}),
|
|
387
|
+
/* @__PURE__ */ jsx(LightboxNext, {})
|
|
388
|
+
] }),
|
|
389
|
+
/* @__PURE__ */ jsxs(LightboxFooter, { children: [
|
|
390
|
+
thumbnails ? /* @__PURE__ */ jsx(LightboxThumbnails, {}) : null,
|
|
391
|
+
/* @__PURE__ */ jsx(LightboxCaption, {}),
|
|
392
|
+
/* @__PURE__ */ jsx(LightboxCounter, {})
|
|
393
|
+
] })
|
|
394
|
+
] });
|
|
395
|
+
case "inspector":
|
|
396
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
397
|
+
/* @__PURE__ */ jsxs(LightboxHeader, { children: [
|
|
398
|
+
/* @__PURE__ */ jsx(LightboxCounter, {}),
|
|
399
|
+
/* @__PURE__ */ jsx(LightboxActions, { children: /* @__PURE__ */ jsx(LightboxClose, {}) })
|
|
400
|
+
] }),
|
|
401
|
+
/* @__PURE__ */ jsx(LightboxViewport, {}),
|
|
402
|
+
/* @__PURE__ */ jsxs(LightboxPanel, { children: [
|
|
403
|
+
/* @__PURE__ */ jsx(LightboxCaption, {}),
|
|
404
|
+
/* @__PURE__ */ jsx(LightboxMeta, {}),
|
|
405
|
+
/* @__PURE__ */ jsxs("div", { role: "group", "data-slot": "button-group", className: "inline-flex gap-1 has-[>[data-variant=ghost]]:gap-0.5 max-md:order-4", children: [
|
|
406
|
+
/* @__PURE__ */ jsx(LightboxPrev, {}),
|
|
407
|
+
/* @__PURE__ */ jsx(LightboxNext, {})
|
|
408
|
+
] }),
|
|
409
|
+
thumbnails ? /* @__PURE__ */ jsx(LightboxThumbnails, {}) : null,
|
|
410
|
+
/* @__PURE__ */ jsx(LightboxZoom, {})
|
|
411
|
+
] })
|
|
412
|
+
] });
|
|
413
|
+
case "feed":
|
|
414
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
415
|
+
/* @__PURE__ */ jsx(LightboxViewport, {}),
|
|
416
|
+
/* @__PURE__ */ jsxs(LightboxHeader, { children: [
|
|
417
|
+
/* @__PURE__ */ jsx(LightboxCounter, {}),
|
|
418
|
+
/* @__PURE__ */ jsxs(LightboxActions, { children: [
|
|
419
|
+
/* @__PURE__ */ jsx(LightboxZoom, {}),
|
|
420
|
+
/* @__PURE__ */ jsx(LightboxClose, {})
|
|
421
|
+
] })
|
|
422
|
+
] }),
|
|
423
|
+
/* @__PURE__ */ jsx(LightboxRail, {})
|
|
424
|
+
] });
|
|
425
|
+
default:
|
|
426
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
427
|
+
/* @__PURE__ */ jsxs(LightboxViewport, { children: [
|
|
428
|
+
/* @__PURE__ */ jsx(LightboxPrev, {}),
|
|
429
|
+
/* @__PURE__ */ jsx(LightboxNext, {})
|
|
430
|
+
] }),
|
|
431
|
+
/* @__PURE__ */ jsx(LightboxCaption, {}),
|
|
432
|
+
/* @__PURE__ */ jsxs(LightboxHeader, { children: [
|
|
433
|
+
/* @__PURE__ */ jsx(LightboxCounter, {}),
|
|
434
|
+
/* @__PURE__ */ jsxs(LightboxActions, { children: [
|
|
435
|
+
/* @__PURE__ */ jsx(LightboxZoomOut, {}),
|
|
436
|
+
/* @__PURE__ */ jsx(LightboxZoomLevel, {}),
|
|
437
|
+
/* @__PURE__ */ jsx(LightboxZoomIn, {}),
|
|
438
|
+
/* @__PURE__ */ jsx(LightboxClose, {})
|
|
439
|
+
] })
|
|
440
|
+
] }),
|
|
441
|
+
thumbnails ? /* @__PURE__ */ jsx(LightboxFooter, { className: "absolute inset-x-0 bottom-0 grid-cols-1", children: /* @__PURE__ */ jsx(LightboxThumbnails, {}) }) : null
|
|
442
|
+
] });
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function LightboxContent(props) {
|
|
446
|
+
const { registerContent } = useLightbox("LightboxContent");
|
|
447
|
+
React.useLayoutEffect(() => registerContent(), [registerContent]);
|
|
448
|
+
return /* @__PURE__ */ jsx(ContentImpl, { ...props });
|
|
449
|
+
}
|
|
450
|
+
function ContentImpl({ className, children, style, ...props }) {
|
|
451
|
+
const ctx = useLightbox("LightboxContent");
|
|
452
|
+
const geo = useGeometry();
|
|
453
|
+
const slide = ctx.slides[ctx.index];
|
|
454
|
+
const { contentRef, overlayRef, open, index, flight, triggerFor, layout } = ctx;
|
|
455
|
+
const flown = React.useRef(false);
|
|
456
|
+
React.useLayoutEffect(() => {
|
|
457
|
+
if (!open) {
|
|
458
|
+
flown.current = false;
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (flown.current) return;
|
|
462
|
+
const content = contentRef.current;
|
|
463
|
+
if (!content) return;
|
|
464
|
+
flown.current = true;
|
|
465
|
+
if (reducedMotion()) return;
|
|
466
|
+
const frame = content.querySelector(`[data-lightbox-index="${index}"] [data-lightbox-frame]`);
|
|
467
|
+
flyIn({ frame, tile: triggerFor(index), content, overlay: overlayRef.current, enabled: flight && layout !== "feed" });
|
|
468
|
+
}, [open, index, flight, triggerFor, contentRef, overlayRef, layout]);
|
|
469
|
+
const onKeyDown = (event) => {
|
|
470
|
+
const vertical = ctx.layout === "feed";
|
|
471
|
+
const keys = {
|
|
472
|
+
[vertical ? "ArrowDown" : "ArrowRight"]: () => ctx.step(1),
|
|
473
|
+
[vertical ? "ArrowUp" : "ArrowLeft"]: () => ctx.step(-1),
|
|
474
|
+
Home: () => ctx.go(0),
|
|
475
|
+
End: () => ctx.go(ctx.count - 1)
|
|
476
|
+
};
|
|
477
|
+
if (ctx.zoomable) {
|
|
478
|
+
const top = maxScale(ctx, geo);
|
|
479
|
+
keys["+"] = keys["="] = () => ctx.setZoom((z) => clampPan({ ...z, scale: Math.min(top, z.scale + ctx.zoomStep) }, geo));
|
|
480
|
+
keys["-"] = () => ctx.setZoom((z) => z.scale - ctx.zoomStep <= 1 ? FIT : clampPan({ ...z, scale: z.scale - ctx.zoomStep }, geo));
|
|
481
|
+
keys["0"] = () => ctx.setZoom(FIT);
|
|
482
|
+
}
|
|
483
|
+
const run = keys[event.key];
|
|
484
|
+
if (!run) return;
|
|
485
|
+
event.preventDefault();
|
|
486
|
+
run();
|
|
487
|
+
};
|
|
488
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open, onOpenChange: (next) => next ? void 0 : ctx.close(), children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
|
|
489
|
+
/* @__PURE__ */ jsx(
|
|
490
|
+
DialogPrimitive.Overlay,
|
|
491
|
+
{
|
|
492
|
+
ref: overlayRef,
|
|
493
|
+
"data-slot": "lightbox-overlay",
|
|
494
|
+
className: cn("fixed inset-0 z-50", layout === "inspector" ? "bg-background" : "bg-black")
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
/* @__PURE__ */ jsxs(
|
|
498
|
+
DialogPrimitive.Content,
|
|
499
|
+
{
|
|
500
|
+
ref: contentRef,
|
|
501
|
+
"data-slot": "lightbox-content",
|
|
502
|
+
"data-layout": layout,
|
|
503
|
+
"data-chrome": ctx.chrome,
|
|
504
|
+
"data-zoomed": ctx.zoom.scale > 1,
|
|
505
|
+
"aria-label": ctx.labels.viewer,
|
|
506
|
+
className: cn(contentClass[layout], className),
|
|
507
|
+
style: { "--slide-w": `${Math.round(geo.w)}px`, ...style },
|
|
508
|
+
onPointerMove: ctx.wakeChrome,
|
|
509
|
+
onKeyDown,
|
|
510
|
+
onEscapeKeyDown: (event) => {
|
|
511
|
+
event.preventDefault();
|
|
512
|
+
if (ctx.zoom.scale > 1) ctx.setZoom(FIT);
|
|
513
|
+
else ctx.close();
|
|
514
|
+
},
|
|
515
|
+
onCloseAutoFocus: (event) => {
|
|
516
|
+
const tile = triggerFor(index);
|
|
517
|
+
if (!tile) return;
|
|
518
|
+
event.preventDefault();
|
|
519
|
+
tile.focus({ preventScroll: true });
|
|
520
|
+
},
|
|
521
|
+
...props,
|
|
522
|
+
children: [
|
|
523
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "sr-only", children: ctx.labels.viewer }),
|
|
524
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Description, { className: "sr-only", children: slide?.alt ?? "" }),
|
|
525
|
+
/* @__PURE__ */ jsxs("div", { "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: [
|
|
526
|
+
slide?.alt ? `${slide.alt}, ` : "",
|
|
527
|
+
ctx.labels.imageOf(ctx.index, ctx.count)
|
|
528
|
+
] }),
|
|
529
|
+
children ?? /* @__PURE__ */ jsx(DefaultParts, { layout, thumbnails: ctx.thumbnails })
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
)
|
|
533
|
+
] }) });
|
|
534
|
+
}
|
|
535
|
+
const viewportClass = {
|
|
536
|
+
stage: "absolute inset-0 touch-none overflow-hidden",
|
|
537
|
+
carousel: "absolute inset-0 touch-none overflow-hidden",
|
|
538
|
+
filmstrip: "relative min-h-0 flex-1 touch-none overflow-hidden",
|
|
539
|
+
inspector: "relative min-h-0 px-2 pb-2 [grid-area:stage] md:p-3 md:pr-0",
|
|
540
|
+
feed: "absolute inset-0 overflow-y-auto overflow-x-hidden overscroll-contain snap-y snap-mandatory touch-pan-y outline-none [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [--feed-gutter:5rem] sm:[--feed-gutter:9rem]"
|
|
541
|
+
};
|
|
542
|
+
function LightboxViewport({ className, children, ...props }) {
|
|
543
|
+
const ctx = useLightbox("LightboxViewport");
|
|
544
|
+
if (ctx.layout === "feed") return /* @__PURE__ */ jsx(FeedViewport, { className, ...props });
|
|
545
|
+
const track = /* @__PURE__ */ jsx(Track, {});
|
|
546
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "lightbox-viewport", className: cn(viewportClass[ctx.layout], className), ...props, children: [
|
|
547
|
+
ctx.layout === "inspector" ? /* @__PURE__ */ jsxs("div", { className: "relative size-full touch-none select-none overflow-hidden rounded-3xl cursor-grab group-data-[zoomed=true]/lightbox:cursor-move", children: [
|
|
548
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": true, "data-lightbox-chrome": "", className: "pointer-events-none absolute inset-0 bg-muted dark:bg-black/35" }),
|
|
549
|
+
track
|
|
550
|
+
] }) : track,
|
|
551
|
+
children
|
|
552
|
+
] });
|
|
553
|
+
}
|
|
554
|
+
function slideImage(slide) {
|
|
555
|
+
return slide.fullSrc ?? slide.src;
|
|
556
|
+
}
|
|
557
|
+
function Track() {
|
|
558
|
+
const ctx = useLightbox("Lightbox");
|
|
559
|
+
const geo = useGeometry();
|
|
560
|
+
const { h: vh } = useViewportSize();
|
|
561
|
+
const [drag, setDrag] = React.useState({ x: 0, y: 0, active: false });
|
|
562
|
+
const [panning, setPanning] = React.useState(false);
|
|
563
|
+
const gesture = React.useRef(null);
|
|
564
|
+
const clickTimer = React.useRef(void 0);
|
|
565
|
+
const n = ctx.count;
|
|
566
|
+
const half = Math.min(2, Math.floor((n - 1) / 2));
|
|
567
|
+
const offsets = [];
|
|
568
|
+
for (let off = -half; off <= Math.min(2, n - 1 - half); off++) offsets.push(off);
|
|
569
|
+
const zoomed = ctx.zoom.scale > 1;
|
|
570
|
+
const carousel = ctx.layout === "carousel";
|
|
571
|
+
const inspector = ctx.layout === "inspector";
|
|
572
|
+
const containerH = inspector ? geo.bandH : ctx.layout === "filmstrip" ? geo.bandH + 64 : vh;
|
|
573
|
+
const atStart = !ctx.loop && ctx.index === 0;
|
|
574
|
+
const atEnd = !ctx.loop && ctx.index === n - 1;
|
|
575
|
+
const onPointerDown = (event) => {
|
|
576
|
+
if (event.button !== 0) return;
|
|
577
|
+
capture(event);
|
|
578
|
+
gesture.current = { id: event.pointerId, x: event.clientX, y: event.clientY, t: performance.now(), axis: null, pan: zoomed ? ctx.zoom : null, moved: false };
|
|
579
|
+
if (zoomed) setPanning(true);
|
|
580
|
+
};
|
|
581
|
+
const onPointerMove = (event) => {
|
|
582
|
+
const g = gesture.current;
|
|
583
|
+
if (!g || g.id !== event.pointerId) return;
|
|
584
|
+
const dx = event.clientX - g.x;
|
|
585
|
+
const dy = event.clientY - g.y;
|
|
586
|
+
if (Math.abs(dx) + Math.abs(dy) > 6) g.moved = true;
|
|
587
|
+
if (g.pan) {
|
|
588
|
+
ctx.setZoom(clampPan({ scale: g.pan.scale, x: g.pan.x + dx, y: g.pan.y + dy }, geo));
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (!g.axis && g.moved) g.axis = Math.abs(dx) >= Math.abs(dy) ? "x" : "y";
|
|
592
|
+
if (!g.axis) return;
|
|
593
|
+
const resist = atStart && dx > 0 || atEnd && dx < 0 ? 0.3 : 1;
|
|
594
|
+
setDrag(g.axis === "x" ? { x: dx * resist, y: 0, active: true } : { x: 0, y: Math.max(0, dy), active: true });
|
|
595
|
+
};
|
|
596
|
+
const onPointerUp = (event) => {
|
|
597
|
+
const g = gesture.current;
|
|
598
|
+
gesture.current = null;
|
|
599
|
+
if (!g || g.id !== event.pointerId) return;
|
|
600
|
+
const dx = event.clientX - g.x;
|
|
601
|
+
const dy = event.clientY - g.y;
|
|
602
|
+
const speed = Math.abs(g.axis === "y" ? dy : dx) / Math.max(1, performance.now() - g.t);
|
|
603
|
+
setDrag({ x: 0, y: 0, active: false });
|
|
604
|
+
setPanning(false);
|
|
605
|
+
if (g.pan || !g.moved) return;
|
|
606
|
+
if (g.axis === "x" && (Math.abs(dx) > geo.spacing * 0.2 || speed > 0.5)) {
|
|
607
|
+
if (dx < 0 && !atEnd) ctx.step(1);
|
|
608
|
+
else if (dx > 0 && !atStart) ctx.step(-1);
|
|
609
|
+
} else if (g.axis === "y" && (dy > 120 || speed > 0.6)) {
|
|
610
|
+
ctx.close();
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
const onFrameClick = (event) => {
|
|
614
|
+
event.stopPropagation();
|
|
615
|
+
if (gesture.current?.moved) return;
|
|
616
|
+
if (!ctx.zoomable) {
|
|
617
|
+
if (event.nativeEvent.pointerType === "touch") ctx.toggleChrome();
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
window.clearTimeout(clickTimer.current);
|
|
621
|
+
if (event.detail === 1) {
|
|
622
|
+
const touch = event.nativeEvent.pointerType === "touch";
|
|
623
|
+
clickTimer.current = window.setTimeout(() => {
|
|
624
|
+
if (touch) ctx.toggleChrome();
|
|
625
|
+
}, 260);
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
const onFrameDoubleClick = (event) => {
|
|
629
|
+
if (!ctx.zoomable) return;
|
|
630
|
+
window.clearTimeout(clickTimer.current);
|
|
631
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
632
|
+
const px = event.clientX - (rect.left + rect.width / 2);
|
|
633
|
+
const py = event.clientY - (rect.top + rect.height / 2);
|
|
634
|
+
ctx.setZoom((z) => z.scale > 1 ? FIT : zoomAt(z, 2, px * (1 / z.scale), py * (1 / z.scale), geo));
|
|
635
|
+
};
|
|
636
|
+
const onWheel = (event) => {
|
|
637
|
+
if (ctx.zoomable && (event.ctrlKey || event.metaKey)) {
|
|
638
|
+
const top = maxScale(ctx, geo);
|
|
639
|
+
ctx.setZoom((z) => zoomAt(z, Math.min(top, Math.max(1, z.scale * Math.exp(-event.deltaY * 0.01))), 0, 0, geo));
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
if (!zoomed && Math.abs(event.deltaX) > Math.abs(event.deltaY) && Math.abs(event.deltaX) > 30) {
|
|
643
|
+
if (event.deltaX > 0 && !atEnd) ctx.step(1);
|
|
644
|
+
else if (event.deltaX < 0 && !atStart) ctx.step(-1);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
const closeProgress = Math.min(1, drag.y / 300);
|
|
648
|
+
return /* @__PURE__ */ jsx(
|
|
649
|
+
"div",
|
|
650
|
+
{
|
|
651
|
+
"data-lightbox-track": "",
|
|
652
|
+
className: "absolute inset-0",
|
|
653
|
+
style: { opacity: 1 - closeProgress * 0.4 },
|
|
654
|
+
onPointerDown,
|
|
655
|
+
onPointerMove,
|
|
656
|
+
onPointerUp,
|
|
657
|
+
onPointerCancel: onPointerUp,
|
|
658
|
+
onWheel,
|
|
659
|
+
onClick: () => {
|
|
660
|
+
if (ctx.layout === "stage" && !zoomed) ctx.close();
|
|
661
|
+
},
|
|
662
|
+
children: offsets.map((off) => {
|
|
663
|
+
const raw = ctx.index + off;
|
|
664
|
+
if (!ctx.loop && (raw < 0 || raw >= n)) return null;
|
|
665
|
+
const i = (raw % n + n) % n;
|
|
666
|
+
const slide = ctx.slides[i];
|
|
667
|
+
if (!slide) return null;
|
|
668
|
+
const progress = off + drag.x / Math.max(1, geo.spacing);
|
|
669
|
+
const distance = Math.min(1, Math.abs(progress));
|
|
670
|
+
const scale = carousel ? 1 - distance * 0.18 : 1;
|
|
671
|
+
const opacity = carousel ? 1 - distance * 0.55 : 1;
|
|
672
|
+
const current = off === 0;
|
|
673
|
+
return /* @__PURE__ */ jsx(
|
|
674
|
+
"div",
|
|
675
|
+
{
|
|
676
|
+
"data-lightbox-index": i,
|
|
677
|
+
"aria-hidden": current ? void 0 : true,
|
|
678
|
+
className: "absolute left-1/2 top-1/2 will-change-transform",
|
|
679
|
+
style: {
|
|
680
|
+
width: geo.w,
|
|
681
|
+
height: geo.h,
|
|
682
|
+
marginLeft: -geo.w / 2,
|
|
683
|
+
marginTop: -geo.h / 2 + (geo.cy - containerH / 2),
|
|
684
|
+
transform: `translate3d(${off * geo.spacing + drag.x}px, ${current ? drag.y : 0}px, 0) scale(${scale * (current ? 1 - closeProgress * 0.15 : 1)})`,
|
|
685
|
+
opacity,
|
|
686
|
+
transition: drag.active ? "none" : SETTLE
|
|
687
|
+
},
|
|
688
|
+
onClick: carousel && !current ? (event) => (event.stopPropagation(), ctx.go(i)) : void 0,
|
|
689
|
+
children: /* @__PURE__ */ jsx(
|
|
690
|
+
"div",
|
|
691
|
+
{
|
|
692
|
+
"data-lightbox-frame": "",
|
|
693
|
+
className: cn("relative size-full", inspector ? "" : "bg-white/5", carousel && !current && "cursor-pointer"),
|
|
694
|
+
onClick: current ? onFrameClick : void 0,
|
|
695
|
+
onDoubleClick: current ? onFrameDoubleClick : void 0,
|
|
696
|
+
children: /* @__PURE__ */ jsxs(
|
|
697
|
+
"div",
|
|
698
|
+
{
|
|
699
|
+
className: cn("relative size-full origin-center will-change-transform", inspector && "overflow-hidden rounded-xl shadow-sm"),
|
|
700
|
+
style: current ? {
|
|
701
|
+
transform: `translate(${ctx.zoom.x}px, ${ctx.zoom.y}px) scale(${ctx.zoom.scale})`,
|
|
702
|
+
transition: panning ? "none" : `transform 260ms ${EASE}`
|
|
703
|
+
} : void 0,
|
|
704
|
+
children: [
|
|
705
|
+
/* @__PURE__ */ jsx("img", { src: slide.thumb ?? slide.src, alt: "", "aria-hidden": true, draggable: false, className: "absolute inset-0 size-full object-cover" }),
|
|
706
|
+
Math.abs(off) <= 1 ? /* @__PURE__ */ jsx(FullImage, { slide, index: i, current }) : null
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
)
|
|
712
|
+
},
|
|
713
|
+
i
|
|
714
|
+
);
|
|
715
|
+
})
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
function FullImage({ slide, index, current }) {
|
|
720
|
+
const ctx = useLightbox("Lightbox");
|
|
721
|
+
const [loaded, setLoaded] = React.useState(false);
|
|
722
|
+
const { setSize } = ctx;
|
|
723
|
+
return (
|
|
724
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
725
|
+
/* @__PURE__ */ jsx(
|
|
726
|
+
"img",
|
|
727
|
+
{
|
|
728
|
+
src: slideImage(slide),
|
|
729
|
+
alt: current ? slide.alt ?? "" : "",
|
|
730
|
+
draggable: false,
|
|
731
|
+
decoding: "async",
|
|
732
|
+
fetchPriority: current ? "high" : "low",
|
|
733
|
+
"data-loaded": loaded,
|
|
734
|
+
className: "absolute inset-0 size-full object-cover opacity-0 transition-opacity duration-base ease-out data-[loaded=true]:opacity-100",
|
|
735
|
+
ref: (node) => {
|
|
736
|
+
if (node?.complete && node.naturalWidth > 0 && !loaded) {
|
|
737
|
+
setLoaded(true);
|
|
738
|
+
setSize(index, node.naturalWidth, node.naturalHeight);
|
|
739
|
+
}
|
|
740
|
+
},
|
|
741
|
+
onLoad: (event) => {
|
|
742
|
+
setLoaded(true);
|
|
743
|
+
setSize(index, event.currentTarget.naturalWidth, event.currentTarget.naturalHeight);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
function FeedViewport({ className, ...props }) {
|
|
750
|
+
const ctx = useLightbox("LightboxViewport");
|
|
751
|
+
const ref = React.useRef(null);
|
|
752
|
+
const { index, go, slides } = ctx;
|
|
753
|
+
const programmatic = React.useRef(false);
|
|
754
|
+
const pull = React.useRef(null);
|
|
755
|
+
React.useLayoutEffect(() => {
|
|
756
|
+
const el = ref.current?.querySelector(`[data-lightbox-index="${index}"]`);
|
|
757
|
+
if (!el) return;
|
|
758
|
+
programmatic.current = true;
|
|
759
|
+
el.scrollIntoView({ block: "center", behavior: "instant" });
|
|
760
|
+
const release = window.setTimeout(() => programmatic.current = false, 120);
|
|
761
|
+
return () => window.clearTimeout(release);
|
|
762
|
+
}, [index]);
|
|
763
|
+
return /* @__PURE__ */ jsxs(
|
|
764
|
+
"div",
|
|
765
|
+
{
|
|
766
|
+
ref,
|
|
767
|
+
"data-slot": "lightbox-viewport",
|
|
768
|
+
tabIndex: -1,
|
|
769
|
+
className: cn(viewportClass.feed, className),
|
|
770
|
+
onScroll: (event) => {
|
|
771
|
+
if (programmatic.current) return;
|
|
772
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
773
|
+
const middle = box.top + box.height / 2;
|
|
774
|
+
let nearest = index;
|
|
775
|
+
let best = Infinity;
|
|
776
|
+
event.currentTarget.querySelectorAll("[data-lightbox-index]").forEach((item) => {
|
|
777
|
+
const r = item.getBoundingClientRect();
|
|
778
|
+
const d = Math.abs(r.top + r.height / 2 - middle);
|
|
779
|
+
if (d < best) {
|
|
780
|
+
best = d;
|
|
781
|
+
nearest = Number(item.dataset.lightboxIndex);
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
if (nearest !== index) {
|
|
785
|
+
programmatic.current = true;
|
|
786
|
+
go(nearest);
|
|
787
|
+
window.setTimeout(() => programmatic.current = false, 60);
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
onPointerDown: (event) => {
|
|
791
|
+
if (event.currentTarget.scrollTop <= 0) pull.current = { y: event.clientY };
|
|
792
|
+
},
|
|
793
|
+
onPointerUp: (event) => {
|
|
794
|
+
if (pull.current && event.clientY - pull.current.y > 120) ctx.close();
|
|
795
|
+
pull.current = null;
|
|
796
|
+
},
|
|
797
|
+
...props,
|
|
798
|
+
children: [
|
|
799
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto flex w-[min(55rem,calc(100%-var(--feed-gutter)*2))] flex-col gap-10 py-[20vh]", children: slides.map((slide, i) => /* @__PURE__ */ jsxs("figure", { "data-lightbox-index": i, className: "flex snap-center flex-col gap-3", children: [
|
|
800
|
+
/* @__PURE__ */ jsx("div", { "data-lightbox-frame": "", className: "relative overflow-hidden rounded-lg bg-white/5", style: { aspectRatio: `${slide.width ?? 3} / ${slide.height ?? 2}` }, children: /* @__PURE__ */ jsx("img", { src: slideImage(slide), alt: slide.alt ?? "", draggable: false, loading: Math.abs(i - index) <= 1 ? "eager" : "lazy", className: "absolute inset-0 size-full object-cover" }) }),
|
|
801
|
+
slide.caption ? /* @__PURE__ */ jsx("figcaption", { "data-lightbox-chrome": "", className: "text-sm text-pretty text-white/70", children: slide.caption }) : null
|
|
802
|
+
] }, i)) }),
|
|
803
|
+
ctx.zoom.scale > 1 ? /* @__PURE__ */ jsx(FeedZoomLayer, {}) : null
|
|
804
|
+
]
|
|
805
|
+
}
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
function FeedZoomLayer() {
|
|
809
|
+
const ctx = useLightbox("Lightbox");
|
|
810
|
+
const slide = ctx.slides[ctx.index];
|
|
811
|
+
const start = React.useRef(null);
|
|
812
|
+
if (!slide) return null;
|
|
813
|
+
return /* @__PURE__ */ jsx(
|
|
814
|
+
"div",
|
|
815
|
+
{
|
|
816
|
+
className: "fixed inset-0 z-20 cursor-move touch-none overflow-hidden bg-black",
|
|
817
|
+
onPointerDown: (event) => {
|
|
818
|
+
capture(event);
|
|
819
|
+
start.current = { x: event.clientX, y: event.clientY, zx: ctx.zoom.x, zy: ctx.zoom.y };
|
|
820
|
+
},
|
|
821
|
+
onPointerMove: (event) => {
|
|
822
|
+
const s = start.current;
|
|
823
|
+
if (!s) return;
|
|
824
|
+
ctx.setZoom({ scale: ctx.zoom.scale, x: s.zx + event.clientX - s.x, y: s.zy + event.clientY - s.y });
|
|
825
|
+
},
|
|
826
|
+
onPointerUp: () => start.current = null,
|
|
827
|
+
onDoubleClick: () => ctx.setZoom(FIT),
|
|
828
|
+
children: /* @__PURE__ */ jsx(
|
|
829
|
+
"img",
|
|
830
|
+
{
|
|
831
|
+
src: slideImage(slide),
|
|
832
|
+
alt: slide.alt ?? "",
|
|
833
|
+
draggable: false,
|
|
834
|
+
className: "absolute left-1/2 top-1/2 max-w-none",
|
|
835
|
+
style: {
|
|
836
|
+
width: `${100 * ctx.zoom.scale}vw`,
|
|
837
|
+
transform: `translate(calc(-50% + ${ctx.zoom.x}px), calc(-50% + ${ctx.zoom.y}px))`
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
)
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
const fadeWithChrome = "transition-opacity duration-base ease-out group-data-[chrome=hidden]/lightbox:pointer-events-none group-data-[chrome=hidden]/lightbox:opacity-0";
|
|
845
|
+
const zoomedPill = "transition-[background-color,box-shadow] duration-fast ease-out group-data-[zoomed=true]/lightbox:bg-black/70 group-data-[zoomed=true]/lightbox:shadow-[inset_0_0_0_1px_rgb(255_255_255/0.1)]";
|
|
846
|
+
function LightboxHeader({ className, ...props }) {
|
|
847
|
+
const { layout } = useLightbox("LightboxHeader");
|
|
848
|
+
const place = {
|
|
849
|
+
stage: "absolute top-0 z-20 px-3 pt-3",
|
|
850
|
+
carousel: "absolute top-0 z-20 px-3 pt-3",
|
|
851
|
+
filmstrip: "absolute top-0 z-20 px-4 pt-4",
|
|
852
|
+
inspector: "relative top-auto z-20 h-14 px-0 pt-0 pl-4 pr-2 [grid-area:bar] md:pl-6 md:pr-4",
|
|
853
|
+
feed: "absolute top-0 z-30 px-4 pt-4 sm:px-6 sm:pt-5"
|
|
854
|
+
}[layout];
|
|
855
|
+
return /* @__PURE__ */ jsx(
|
|
856
|
+
"div",
|
|
857
|
+
{
|
|
858
|
+
"data-slot": "lightbox-header",
|
|
859
|
+
"data-lightbox-chrome": "",
|
|
860
|
+
className: cn("pointer-events-none inset-x-0 flex items-center gap-2 [&>*]:pointer-events-auto", fadeWithChrome, place, className),
|
|
861
|
+
...props
|
|
862
|
+
}
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
function LightboxActions({ className, ...props }) {
|
|
866
|
+
const { layout } = useLightbox("LightboxActions");
|
|
867
|
+
return /* @__PURE__ */ jsx(
|
|
868
|
+
"div",
|
|
869
|
+
{
|
|
870
|
+
role: "group",
|
|
871
|
+
"data-slot": "lightbox-actions",
|
|
872
|
+
className: cn(
|
|
873
|
+
"gap-1 has-[>[data-variant=ghost]]:gap-0.5 ml-auto flex items-center transition-[background-color,box-shadow] duration-fast ease-out",
|
|
874
|
+
layout !== "inspector" && "rounded-full [--button-radius:9999px] group-data-[zoomed=true]/lightbox:bg-black/70 group-data-[zoomed=true]/lightbox:shadow-[inset_0_0_0_1px_rgb(255_255_255/0.1)]",
|
|
875
|
+
className
|
|
876
|
+
),
|
|
877
|
+
...props
|
|
878
|
+
}
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
function LightboxCounter({ className, ...props }) {
|
|
882
|
+
const ctx = useLightbox("LightboxCounter");
|
|
883
|
+
if (ctx.count < 2) return null;
|
|
884
|
+
const look = {
|
|
885
|
+
stage: cn("-ml-2 flex h-10 items-center rounded-full px-3", zoomedPill, "text-white"),
|
|
886
|
+
carousel: cn("-ml-2 flex h-10 items-center rounded-full px-3", zoomedPill, "text-white"),
|
|
887
|
+
filmstrip: "col-start-2 justify-self-end text-white/70",
|
|
888
|
+
inspector: "text-muted-foreground",
|
|
889
|
+
feed: "flex h-10 items-center rounded-full bg-black/45 px-3.5 text-white ring-1 ring-inset ring-white/15"
|
|
890
|
+
}[ctx.layout];
|
|
891
|
+
return /* @__PURE__ */ jsx(
|
|
892
|
+
"span",
|
|
893
|
+
{
|
|
894
|
+
"aria-hidden": true,
|
|
895
|
+
"data-slot": "lightbox-counter",
|
|
896
|
+
"data-lightbox-chrome": "",
|
|
897
|
+
className: cn("pointer-events-none shrink-0 text-sm font-medium tabular-nums", look, className),
|
|
898
|
+
...props,
|
|
899
|
+
children: ctx.labels.counter(ctx.index, ctx.count)
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
function ViewerButton({
|
|
904
|
+
slot,
|
|
905
|
+
className,
|
|
906
|
+
...props
|
|
907
|
+
}) {
|
|
908
|
+
const { layout } = useLightbox("Lightbox");
|
|
909
|
+
const onTheme = layout === "inspector";
|
|
910
|
+
return /* @__PURE__ */ jsx(
|
|
911
|
+
Button,
|
|
912
|
+
{
|
|
913
|
+
variant: "ghost",
|
|
914
|
+
size: "lg",
|
|
915
|
+
iconOnly: true,
|
|
916
|
+
tone: onTheme ? void 0 : "onMedia",
|
|
917
|
+
"data-slot": slot,
|
|
918
|
+
className: cn(
|
|
919
|
+
!onTheme && layout !== "stage" && layout !== "carousel" && "group-data-[zoomed=true]/lightbox:bg-black/50 group-data-[zoomed=true]/lightbox:hover:bg-black/70",
|
|
920
|
+
className
|
|
921
|
+
),
|
|
922
|
+
...props
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
function LightboxClose(props) {
|
|
927
|
+
const ctx = useLightbox("LightboxClose");
|
|
928
|
+
return /* @__PURE__ */ jsx(ViewerButton, { slot: "lightbox-close", "aria-label": ctx.labels.close, onClick: () => ctx.close(), ...props, children: /* @__PURE__ */ jsx(X, {}) });
|
|
929
|
+
}
|
|
930
|
+
function useZoomControls() {
|
|
931
|
+
const ctx = useLightbox("Lightbox");
|
|
932
|
+
const geo = useGeometry();
|
|
933
|
+
const top = maxScale(ctx, geo);
|
|
934
|
+
return {
|
|
935
|
+
ctx,
|
|
936
|
+
level: Math.round(ctx.zoom.scale * 100),
|
|
937
|
+
canIn: ctx.zoom.scale < top - 1e-3,
|
|
938
|
+
canOut: ctx.zoom.scale > 1.001,
|
|
939
|
+
zoomIn: () => ctx.setZoom((z) => clampPan({ ...z, scale: Math.min(top, z.scale + ctx.zoomStep) }, geo)),
|
|
940
|
+
zoomOut: () => ctx.setZoom((z) => z.scale - ctx.zoomStep <= 1.001 ? FIT : clampPan({ ...z, scale: z.scale - ctx.zoomStep }, geo)),
|
|
941
|
+
toggle: () => ctx.setZoom((z) => z.scale > 1 ? FIT : { scale: 2, x: 0, y: 0 }),
|
|
942
|
+
fit: () => ctx.setZoom(FIT)
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
function LightboxZoomIn(props) {
|
|
946
|
+
const { ctx, canIn, zoomIn } = useZoomControls();
|
|
947
|
+
if (!ctx.zoomable) return null;
|
|
948
|
+
return /* @__PURE__ */ jsx(ViewerButton, { slot: "lightbox-zoom-in", "aria-label": ctx.labels.zoomIn, disabled: !canIn, onClick: zoomIn, ...props, children: /* @__PURE__ */ jsx(Plus, {}) });
|
|
949
|
+
}
|
|
950
|
+
function LightboxZoomOut(props) {
|
|
951
|
+
const { ctx, canOut, zoomOut } = useZoomControls();
|
|
952
|
+
if (!ctx.zoomable) return null;
|
|
953
|
+
return /* @__PURE__ */ jsx(ViewerButton, { slot: "lightbox-zoom-out", "aria-label": ctx.labels.zoomOut, disabled: !canOut, onClick: zoomOut, ...props, children: /* @__PURE__ */ jsx(Minus, {}) });
|
|
954
|
+
}
|
|
955
|
+
function LightboxZoomLevel({ className, ...props }) {
|
|
956
|
+
const { ctx, level } = useZoomControls();
|
|
957
|
+
if (!ctx.zoomable || ctx.layout === "feed") return null;
|
|
958
|
+
return /* @__PURE__ */ jsxs(
|
|
959
|
+
"output",
|
|
960
|
+
{
|
|
961
|
+
"aria-label": ctx.labels.zoomLevel,
|
|
962
|
+
"data-slot": "lightbox-zoom-level",
|
|
963
|
+
className: cn(
|
|
964
|
+
"pointer-events-none min-w-12 self-center px-1 text-center text-sm font-medium tabular-nums",
|
|
965
|
+
ctx.layout === "inspector" ? "text-muted-foreground" : "text-white/70",
|
|
966
|
+
className
|
|
967
|
+
),
|
|
968
|
+
...props,
|
|
969
|
+
children: [
|
|
970
|
+
level,
|
|
971
|
+
"%"
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
function LightboxZoom({ className }) {
|
|
977
|
+
const { ctx, toggle, fit: fit2, zoomIn, zoomOut, canIn, canOut } = useZoomControls();
|
|
978
|
+
if (!ctx.zoomable) return null;
|
|
979
|
+
if (ctx.layout === "inspector") {
|
|
980
|
+
return /* @__PURE__ */ jsxs(
|
|
981
|
+
"div",
|
|
982
|
+
{
|
|
983
|
+
"data-slot": "lightbox-zoom",
|
|
984
|
+
className: cn("flex items-center gap-1 border-t border-border pt-4 max-md:order-5 md:sticky md:bottom-0 md:mt-auto md:bg-background md:pb-4", className),
|
|
985
|
+
children: [
|
|
986
|
+
/* @__PURE__ */ jsx(ViewerButton, { slot: "lightbox-zoom-out", "aria-label": ctx.labels.zoomOut, disabled: !canOut, onClick: zoomOut, children: /* @__PURE__ */ jsx(Minus, {}) }),
|
|
987
|
+
/* @__PURE__ */ jsx(LightboxZoomLevel, {}),
|
|
988
|
+
/* @__PURE__ */ jsx(ViewerButton, { slot: "lightbox-zoom-in", "aria-label": ctx.labels.zoomIn, disabled: !canIn, onClick: zoomIn, children: /* @__PURE__ */ jsx(Plus, {}) }),
|
|
989
|
+
/* @__PURE__ */ jsx(ViewerButton, { slot: "lightbox-fit", "aria-label": ctx.labels.fit, disabled: !canOut, onClick: fit2, className: "ml-auto", children: /* @__PURE__ */ jsx(CornersOut, {}) })
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
return /* @__PURE__ */ jsx(ViewerButton, { slot: "lightbox-zoom", "aria-label": ctx.labels.zoom, "aria-pressed": ctx.zoom.scale > 1, onClick: toggle, className, children: /* @__PURE__ */ jsx(MagnifyingGlassPlus, {}) });
|
|
995
|
+
}
|
|
996
|
+
function usePager(direction) {
|
|
997
|
+
const ctx = useLightbox("Lightbox");
|
|
998
|
+
const atEdge = !ctx.loop && (direction < 0 ? ctx.index === 0 : ctx.index === ctx.count - 1);
|
|
999
|
+
return { ctx, hidden: atEdge || ctx.count < 2, page: () => ctx.step(direction) };
|
|
1000
|
+
}
|
|
1001
|
+
function PagerControl({ direction, className, ...props }) {
|
|
1002
|
+
const { ctx, hidden, page } = usePager(direction);
|
|
1003
|
+
const geo = useGeometry();
|
|
1004
|
+
const prev = direction < 0;
|
|
1005
|
+
const slot = prev ? "lightbox-prev" : "lightbox-next";
|
|
1006
|
+
const label = prev ? ctx.labels.previous : ctx.labels.next;
|
|
1007
|
+
const icon = prev ? /* @__PURE__ */ jsx(CaretLeft, {}) : /* @__PURE__ */ jsx(CaretRight, {});
|
|
1008
|
+
if (hidden || ctx.layout === "feed") return null;
|
|
1009
|
+
if (ctx.layout === "stage") {
|
|
1010
|
+
return /* @__PURE__ */ jsx(
|
|
1011
|
+
"div",
|
|
1012
|
+
{
|
|
1013
|
+
"data-lightbox-zone": prev ? "prev" : "next",
|
|
1014
|
+
className: cn(
|
|
1015
|
+
"group/zone absolute inset-y-0 w-1/2 group-data-[zoomed=true]/lightbox:cursor-grab group-data-[chrome=hidden]/lightbox:cursor-none",
|
|
1016
|
+
prev ? "left-0 cursor-w-resize" : "right-0 cursor-e-resize"
|
|
1017
|
+
),
|
|
1018
|
+
style: { top: geo.cy - geo.h / 2, height: geo.h, bottom: "auto" },
|
|
1019
|
+
onClick: (event) => {
|
|
1020
|
+
event.stopPropagation();
|
|
1021
|
+
if (ctx.zoom.scale <= 1) page();
|
|
1022
|
+
},
|
|
1023
|
+
children: /* @__PURE__ */ jsx(
|
|
1024
|
+
ViewerButton,
|
|
1025
|
+
{
|
|
1026
|
+
slot,
|
|
1027
|
+
"aria-label": label,
|
|
1028
|
+
onClick: (event) => {
|
|
1029
|
+
event.stopPropagation();
|
|
1030
|
+
page();
|
|
1031
|
+
},
|
|
1032
|
+
className: cn(
|
|
1033
|
+
"absolute top-1/2 -translate-y-1/2 [&_svg]:size-6 pointer-events-none opacity-0 transition-[opacity,background-color] duration-base ease-out",
|
|
1034
|
+
"group-data-[chrome=active]/lightbox:pointer-events-auto group-data-[chrome=active]/lightbox:opacity-40 group-data-[chrome=active]/lightbox:group-hover/zone:opacity-100 group-data-[chrome=active]/lightbox:hover:opacity-100",
|
|
1035
|
+
"focus-visible:pointer-events-auto focus-visible:opacity-100 group-data-[zoomed=true]/lightbox:pointer-events-none group-data-[zoomed=true]/lightbox:opacity-0",
|
|
1036
|
+
prev ? "left-2 sm:left-5" : "right-2 sm:right-5",
|
|
1037
|
+
className
|
|
1038
|
+
),
|
|
1039
|
+
...props,
|
|
1040
|
+
children: icon
|
|
1041
|
+
}
|
|
1042
|
+
)
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
if (ctx.layout === "inspector") {
|
|
1047
|
+
return /* @__PURE__ */ jsx(ViewerButton, { slot, "aria-label": label, onClick: page, className, ...props, children: icon });
|
|
1048
|
+
}
|
|
1049
|
+
return /* @__PURE__ */ jsx(
|
|
1050
|
+
ViewerButton,
|
|
1051
|
+
{
|
|
1052
|
+
slot,
|
|
1053
|
+
"aria-label": label,
|
|
1054
|
+
onClick: page,
|
|
1055
|
+
"data-lightbox-chrome": "",
|
|
1056
|
+
className: cn(
|
|
1057
|
+
"absolute z-20 -translate-y-1/2",
|
|
1058
|
+
ctx.layout === "filmstrip" && "top-1/2",
|
|
1059
|
+
"group-data-[zoomed=true]/lightbox:bg-black/50 group-data-[zoomed=true]/lightbox:hover:bg-black/70",
|
|
1060
|
+
fadeWithChrome,
|
|
1061
|
+
prev ? "left-2 sm:left-5" : "right-2 sm:right-5",
|
|
1062
|
+
className
|
|
1063
|
+
),
|
|
1064
|
+
style: ctx.layout === "carousel" ? { top: geo.cy } : void 0,
|
|
1065
|
+
...props,
|
|
1066
|
+
children: icon
|
|
1067
|
+
}
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1070
|
+
function LightboxPrev(props) {
|
|
1071
|
+
return /* @__PURE__ */ jsx(PagerControl, { direction: -1, ...props });
|
|
1072
|
+
}
|
|
1073
|
+
function LightboxNext(props) {
|
|
1074
|
+
return /* @__PURE__ */ jsx(PagerControl, { direction: 1, ...props });
|
|
1075
|
+
}
|
|
1076
|
+
function LightboxCaption({ className, ...props }) {
|
|
1077
|
+
const ctx = useLightbox("LightboxCaption");
|
|
1078
|
+
const geo = useGeometry();
|
|
1079
|
+
const slide = ctx.slides[ctx.index];
|
|
1080
|
+
if (!slide || ctx.layout === "feed") return null;
|
|
1081
|
+
if (ctx.layout === "inspector") {
|
|
1082
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "lightbox-caption", "data-lightbox-peek": "", className: cn("flex flex-col gap-1.5 max-md:order-1", className), children: [
|
|
1083
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-medium text-balance text-foreground", children: slide.caption ?? slide.alt }),
|
|
1084
|
+
slide.alt && slide.caption ? /* @__PURE__ */ jsx("p", { className: "text-sm text-pretty text-body", children: slide.alt }) : null
|
|
1085
|
+
] });
|
|
1086
|
+
}
|
|
1087
|
+
if (!slide.caption) return null;
|
|
1088
|
+
const text = /* @__PURE__ */ jsx("span", { className: "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-fast", children: slide.caption }, ctx.index);
|
|
1089
|
+
if (ctx.layout === "filmstrip") {
|
|
1090
|
+
return /* @__PURE__ */ jsx("p", { "data-slot": "lightbox-caption", "data-lightbox-chrome": "", className: cn("col-start-1 min-w-0 truncate text-sm text-white/70", className), ...props, children: text });
|
|
1091
|
+
}
|
|
1092
|
+
return /* @__PURE__ */ jsx(
|
|
1093
|
+
"p",
|
|
1094
|
+
{
|
|
1095
|
+
"data-slot": "lightbox-caption",
|
|
1096
|
+
"data-lightbox-chrome": "",
|
|
1097
|
+
className: cn(
|
|
1098
|
+
"pointer-events-none absolute inset-x-0 z-10 truncate px-6 text-center text-sm text-white/70 group-data-[zoomed=true]/lightbox:opacity-0",
|
|
1099
|
+
fadeWithChrome,
|
|
1100
|
+
className
|
|
1101
|
+
),
|
|
1102
|
+
style: { top: geo.below },
|
|
1103
|
+
...props,
|
|
1104
|
+
children: text
|
|
1105
|
+
}
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
function LightboxFooter({ className, ...props }) {
|
|
1109
|
+
return /* @__PURE__ */ jsx(
|
|
1110
|
+
"div",
|
|
1111
|
+
{
|
|
1112
|
+
"data-slot": "lightbox-footer",
|
|
1113
|
+
"data-lightbox-chrome": "",
|
|
1114
|
+
className: cn(
|
|
1115
|
+
"relative z-10 mx-auto grid w-full max-w-[calc(var(--slide-w,100%)+2rem)] shrink-0 grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-4 gap-y-3 px-4 pb-5 pt-3 sm:pb-6",
|
|
1116
|
+
"group-data-[zoomed=true]/lightbox:pointer-events-none group-data-[zoomed=true]/lightbox:opacity-0",
|
|
1117
|
+
fadeWithChrome,
|
|
1118
|
+
className
|
|
1119
|
+
),
|
|
1120
|
+
...props
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
function LightboxThumbnails({ className }) {
|
|
1125
|
+
const ctx = useLightbox("LightboxThumbnails");
|
|
1126
|
+
const { w: vw } = useViewportSize();
|
|
1127
|
+
const scrub = React.useRef(null);
|
|
1128
|
+
if (ctx.layout === "feed") return null;
|
|
1129
|
+
if (ctx.layout === "inspector") {
|
|
1130
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "lightbox-thumbnails", "data-lightbox-peek": "", className: cn("flex min-w-0 flex-col max-md:order-2", className), children: [
|
|
1131
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 text-xs font-medium text-muted-foreground max-md:hidden", children: ctx.labels.thumbnails }),
|
|
1132
|
+
/* @__PURE__ */ jsx(
|
|
1133
|
+
"div",
|
|
1134
|
+
{
|
|
1135
|
+
role: "group",
|
|
1136
|
+
"aria-label": ctx.labels.thumbnails,
|
|
1137
|
+
className: "flex gap-1 p-1 md:-m-1 md:flex-col max-md:-mx-4 max-md:overflow-x-auto max-md:px-4 max-md:[scrollbar-width:none] max-md:scroll-px-10 max-md:scroll-fade-x",
|
|
1138
|
+
children: ctx.slides.map((slide, i) => /* @__PURE__ */ jsxs(
|
|
1139
|
+
"button",
|
|
1140
|
+
{
|
|
1141
|
+
type: "button",
|
|
1142
|
+
"data-active": i === ctx.index,
|
|
1143
|
+
"aria-current": i === ctx.index ? true : void 0,
|
|
1144
|
+
"aria-label": ctx.labels.goToImage(i, ctx.count),
|
|
1145
|
+
onClick: () => ctx.go(i),
|
|
1146
|
+
className: "group/thumb flex shrink-0 cursor-pointer items-center gap-3 rounded-xl p-1.5 text-left transition-colors duration-fast ease-out hover:bg-foreground/5 outline-none focus-visible:ring-2 focus-visible:ring-focus data-[active=true]:bg-foreground/[0.07]",
|
|
1147
|
+
children: [
|
|
1148
|
+
/* @__PURE__ */ jsx(
|
|
1149
|
+
"img",
|
|
1150
|
+
{
|
|
1151
|
+
src: slide.thumb ?? slide.src,
|
|
1152
|
+
alt: "",
|
|
1153
|
+
draggable: false,
|
|
1154
|
+
loading: "lazy",
|
|
1155
|
+
className: "h-11 w-16 shrink-0 rounded-md object-cover opacity-60 transition-opacity duration-fast ease-out group-hover/thumb:opacity-100 group-data-[active=true]/thumb:opacity-100"
|
|
1156
|
+
}
|
|
1157
|
+
),
|
|
1158
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-sm text-muted-foreground transition-colors duration-fast ease-out max-md:hidden group-hover/thumb:text-foreground group-data-[active=true]/thumb:font-medium group-data-[active=true]/thumb:text-foreground", children: slide.caption ?? slide.alt }),
|
|
1159
|
+
/* @__PURE__ */ jsx("span", { className: "pr-1.5 text-xs text-muted-foreground tabular-nums max-md:hidden", children: i + 1 })
|
|
1160
|
+
]
|
|
1161
|
+
},
|
|
1162
|
+
i
|
|
1163
|
+
))
|
|
1164
|
+
}
|
|
1165
|
+
)
|
|
1166
|
+
] });
|
|
1167
|
+
}
|
|
1168
|
+
const wide = vw >= 640;
|
|
1169
|
+
const thumb = wide ? 72 : 48;
|
|
1170
|
+
const gap = wide ? 8 : 6;
|
|
1171
|
+
const pad = 6;
|
|
1172
|
+
const stripW = ctx.count * thumb + (ctx.count - 1) * gap + pad * 2;
|
|
1173
|
+
const overflow = stripW > vw;
|
|
1174
|
+
const shift = vw / 2 - (pad + ctx.index * (thumb + gap) + thumb / 2) - (vw - Math.min(vw, stripW)) / 2;
|
|
1175
|
+
return /* @__PURE__ */ jsx(
|
|
1176
|
+
"div",
|
|
1177
|
+
{
|
|
1178
|
+
"data-slot": "lightbox-thumbnails",
|
|
1179
|
+
"data-lightbox-chrome": "",
|
|
1180
|
+
"data-overflow": overflow || void 0,
|
|
1181
|
+
className: cn(
|
|
1182
|
+
"group/strip relative col-span-2 w-screen max-w-[100vw] cursor-grab touch-none justify-self-center overflow-hidden active:cursor-grabbing data-[overflow=true]:fade-x data-[overflow=true]:[--fade-size:2.5rem]",
|
|
1183
|
+
className
|
|
1184
|
+
),
|
|
1185
|
+
onPointerDown: (event) => {
|
|
1186
|
+
capture(event);
|
|
1187
|
+
scrub.current = { x: event.clientX, index: ctx.index };
|
|
1188
|
+
},
|
|
1189
|
+
onPointerMove: (event) => {
|
|
1190
|
+
const s = scrub.current;
|
|
1191
|
+
if (!s) return;
|
|
1192
|
+
const next = s.index - Math.round((event.clientX - s.x) / (thumb + gap));
|
|
1193
|
+
if (next !== ctx.index) ctx.go(Math.max(0, Math.min(ctx.count - 1, next)));
|
|
1194
|
+
},
|
|
1195
|
+
onPointerUp: () => scrub.current = null,
|
|
1196
|
+
children: /* @__PURE__ */ jsxs(
|
|
1197
|
+
"div",
|
|
1198
|
+
{
|
|
1199
|
+
className: "relative mx-auto flex w-max gap-1.5 p-1.5 sm:gap-2 group-data-[overflow=true]/strip:px-10",
|
|
1200
|
+
style: { transform: overflow ? `translate3d(${shift}px, 0, 0)` : void 0, transition: `transform 320ms ${EASE}` },
|
|
1201
|
+
children: [
|
|
1202
|
+
/* @__PURE__ */ jsx(
|
|
1203
|
+
"span",
|
|
1204
|
+
{
|
|
1205
|
+
"aria-hidden": true,
|
|
1206
|
+
className: "pointer-events-none absolute left-0 top-1.5 z-10 h-10 w-12 rounded-md ring-2 ring-white sm:h-12 sm:w-18",
|
|
1207
|
+
style: { transform: `translate3d(${pad + ctx.index * (thumb + gap) + (overflow ? 34 : 0)}px, 0, 0)`, transition: `transform 320ms ${EASE}` }
|
|
1208
|
+
}
|
|
1209
|
+
),
|
|
1210
|
+
ctx.slides.map((slide, i) => /* @__PURE__ */ jsx(
|
|
1211
|
+
"button",
|
|
1212
|
+
{
|
|
1213
|
+
type: "button",
|
|
1214
|
+
"data-lightbox-thumb": "",
|
|
1215
|
+
"aria-label": ctx.labels.goToImage(i, ctx.count),
|
|
1216
|
+
"aria-current": i === ctx.index ? true : void 0,
|
|
1217
|
+
onClick: () => ctx.go(i),
|
|
1218
|
+
className: "relative h-10 w-12 shrink-0 cursor-pointer overflow-hidden rounded-md sm:h-12 sm:w-18 outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-black",
|
|
1219
|
+
style: { opacity: i === ctx.index ? 1 : 0.55 },
|
|
1220
|
+
children: /* @__PURE__ */ jsx("img", { src: slide.thumb ?? slide.src, alt: "", draggable: false, loading: "lazy", className: "pointer-events-none size-full object-cover" })
|
|
1221
|
+
},
|
|
1222
|
+
i
|
|
1223
|
+
))
|
|
1224
|
+
]
|
|
1225
|
+
}
|
|
1226
|
+
)
|
|
1227
|
+
}
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1230
|
+
function LightboxPanel({ className, children, ...props }) {
|
|
1231
|
+
const [sheet, setSheet] = React.useState("peek");
|
|
1232
|
+
const offset = { peek: "max-md:translate-y-[calc(100%-9rem)]", full: "max-md:translate-y-0", hidden: "max-md:translate-y-[calc(100%-1.5rem)]" }[sheet];
|
|
1233
|
+
return /* @__PURE__ */ jsxs(
|
|
1234
|
+
"div",
|
|
1235
|
+
{
|
|
1236
|
+
"data-slot": "lightbox-panel",
|
|
1237
|
+
"data-lightbox-chrome": "",
|
|
1238
|
+
"data-sheet": sheet,
|
|
1239
|
+
className: cn(
|
|
1240
|
+
"z-10 flex min-h-0 flex-col max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:max-h-[72%] max-md:rounded-t-3xl max-md:bg-card max-md:shadow-lg max-md:[--surface:var(--card)] max-md:px-4 max-md:pb-[max(1rem,env(safe-area-inset-bottom))] max-md:will-change-transform md:overflow-y-auto md:px-6 md:[grid-area:panel] md:not-has-[[data-slot=lightbox-zoom]]:pb-4",
|
|
1241
|
+
"max-md:transition-transform max-md:duration-base max-md:ease-out",
|
|
1242
|
+
offset,
|
|
1243
|
+
className
|
|
1244
|
+
),
|
|
1245
|
+
...props,
|
|
1246
|
+
children: [
|
|
1247
|
+
/* @__PURE__ */ jsx(
|
|
1248
|
+
"div",
|
|
1249
|
+
{
|
|
1250
|
+
"aria-hidden": true,
|
|
1251
|
+
className: "flex h-6 w-full shrink-0 cursor-grab touch-none items-center justify-center md:hidden after:h-1 after:w-9 after:rounded-full after:bg-foreground/15",
|
|
1252
|
+
onClick: () => setSheet((s) => s === "peek" ? "full" : s === "full" ? "hidden" : "peek")
|
|
1253
|
+
}
|
|
1254
|
+
),
|
|
1255
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-col gap-6 max-md:gap-4 max-md:overflow-y-auto md:pt-2", children })
|
|
1256
|
+
]
|
|
1257
|
+
}
|
|
1258
|
+
);
|
|
1259
|
+
}
|
|
1260
|
+
function ratio(w, h) {
|
|
1261
|
+
const gcd = (a, b) => b === 0 ? a : gcd(b, a % b);
|
|
1262
|
+
const d = gcd(w, h);
|
|
1263
|
+
return `${w / d}:${h / d}`;
|
|
1264
|
+
}
|
|
1265
|
+
function LightboxMeta({ className, ...props }) {
|
|
1266
|
+
const ctx = useLightbox("LightboxMeta");
|
|
1267
|
+
const slide = ctx.slides[ctx.index];
|
|
1268
|
+
const size = ctx.sizes[ctx.index] ?? (slide?.width && slide?.height ? { w: slide.width, h: slide.height } : null);
|
|
1269
|
+
if (!size) return null;
|
|
1270
|
+
return /* @__PURE__ */ jsxs("dl", { "data-slot": "lightbox-meta", className: cn("grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-sm max-md:order-3", className), ...props, children: [
|
|
1271
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: ctx.labels.dimensions }),
|
|
1272
|
+
/* @__PURE__ */ jsxs("dd", { className: "text-right font-medium text-foreground tabular-nums", children: [
|
|
1273
|
+
size.w,
|
|
1274
|
+
" \xD7 ",
|
|
1275
|
+
size.h
|
|
1276
|
+
] }),
|
|
1277
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: ctx.labels.aspect }),
|
|
1278
|
+
/* @__PURE__ */ jsx("dd", { className: "text-right font-medium text-foreground tabular-nums", children: ratio(size.w, size.h) })
|
|
1279
|
+
] });
|
|
1280
|
+
}
|
|
1281
|
+
function LightboxRail({ className, ...props }) {
|
|
1282
|
+
const ctx = useLightbox("LightboxRail");
|
|
1283
|
+
const ref = React.useRef(null);
|
|
1284
|
+
const pick = (clientY) => {
|
|
1285
|
+
const box = ref.current?.getBoundingClientRect();
|
|
1286
|
+
if (!box) return;
|
|
1287
|
+
const t = Math.max(0, Math.min(1, (clientY - box.top) / box.height));
|
|
1288
|
+
ctx.go(Math.round(t * (ctx.count - 1)));
|
|
1289
|
+
};
|
|
1290
|
+
if (ctx.layout !== "feed" || ctx.count < 2) return null;
|
|
1291
|
+
return /* @__PURE__ */ jsx(
|
|
1292
|
+
"div",
|
|
1293
|
+
{
|
|
1294
|
+
ref,
|
|
1295
|
+
role: "slider",
|
|
1296
|
+
tabIndex: 0,
|
|
1297
|
+
"aria-label": ctx.labels.position,
|
|
1298
|
+
"aria-valuemin": 1,
|
|
1299
|
+
"aria-valuemax": ctx.count,
|
|
1300
|
+
"aria-valuenow": ctx.index + 1,
|
|
1301
|
+
"aria-valuetext": ctx.labels.imageOf(ctx.index, ctx.count),
|
|
1302
|
+
"data-slot": "lightbox-rail",
|
|
1303
|
+
"data-lightbox-chrome": "",
|
|
1304
|
+
className: cn(
|
|
1305
|
+
"absolute right-0 top-1/2 z-30 flex w-10 -translate-y-1/2 cursor-ns-resize touch-none flex-col items-end gap-3 py-4 pr-3 rounded-l-lg outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-white",
|
|
1306
|
+
fadeWithChrome,
|
|
1307
|
+
"data-[hidden=true]:pointer-events-none data-[hidden=true]:opacity-0",
|
|
1308
|
+
className
|
|
1309
|
+
),
|
|
1310
|
+
onPointerDown: (event) => {
|
|
1311
|
+
capture(event);
|
|
1312
|
+
pick(event.clientY);
|
|
1313
|
+
},
|
|
1314
|
+
onPointerMove: (event) => {
|
|
1315
|
+
if (event.buttons) pick(event.clientY);
|
|
1316
|
+
},
|
|
1317
|
+
onKeyDown: (event) => {
|
|
1318
|
+
if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
|
|
1319
|
+
event.preventDefault();
|
|
1320
|
+
ctx.step(event.key === "ArrowDown" ? 1 : -1);
|
|
1321
|
+
},
|
|
1322
|
+
...props,
|
|
1323
|
+
children: ctx.slides.map((_, i) => /* @__PURE__ */ jsx(
|
|
1324
|
+
"span",
|
|
1325
|
+
{
|
|
1326
|
+
"aria-hidden": true,
|
|
1327
|
+
className: cn(
|
|
1328
|
+
"h-0.5 rounded-full transition-[width,background-color] duration-fast ease-out",
|
|
1329
|
+
i === ctx.index ? "w-5 bg-white" : "w-3 bg-white/35"
|
|
1330
|
+
)
|
|
1331
|
+
},
|
|
1332
|
+
i
|
|
1333
|
+
))
|
|
1334
|
+
}
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
export {
|
|
1338
|
+
Lightbox,
|
|
1339
|
+
LightboxActions,
|
|
1340
|
+
LightboxCaption,
|
|
1341
|
+
LightboxClose,
|
|
1342
|
+
LightboxContent,
|
|
1343
|
+
LightboxCounter,
|
|
1344
|
+
LightboxFooter,
|
|
1345
|
+
LightboxHeader,
|
|
1346
|
+
LightboxMeta,
|
|
1347
|
+
LightboxNext,
|
|
1348
|
+
LightboxPanel,
|
|
1349
|
+
LightboxPrev,
|
|
1350
|
+
LightboxRail,
|
|
1351
|
+
LightboxThumbnails,
|
|
1352
|
+
LightboxTrigger,
|
|
1353
|
+
LightboxViewport,
|
|
1354
|
+
LightboxZoom,
|
|
1355
|
+
LightboxZoomIn,
|
|
1356
|
+
LightboxZoomLevel,
|
|
1357
|
+
LightboxZoomOut
|
|
1358
|
+
};
|
|
1359
|
+
//# sourceMappingURL=lightbox.mjs.map
|