@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,865 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
ArrowClockwise,
|
|
6
|
+
ArrowCounterClockwise,
|
|
7
|
+
ArrowsHorizontal,
|
|
8
|
+
CaretLeft,
|
|
9
|
+
CaretRight,
|
|
10
|
+
CornersIn,
|
|
11
|
+
CornersOut,
|
|
12
|
+
DownloadSimple,
|
|
13
|
+
FrameCorners,
|
|
14
|
+
Minus,
|
|
15
|
+
Plus,
|
|
16
|
+
Printer,
|
|
17
|
+
Sidebar,
|
|
18
|
+
X
|
|
19
|
+
} from "atoms-icons";
|
|
20
|
+
import { Button } from "../button/index.mjs";
|
|
21
|
+
import { Dialog, DialogContent, DialogTitle } from "../dialog/index.mjs";
|
|
22
|
+
import {
|
|
23
|
+
DropdownMenu,
|
|
24
|
+
DropdownMenuContent,
|
|
25
|
+
DropdownMenuItem,
|
|
26
|
+
DropdownMenuSeparator,
|
|
27
|
+
DropdownMenuTrigger
|
|
28
|
+
} from "../dropdown-menu/index.mjs";
|
|
29
|
+
import { FileIcon } from "../file-card/index.mjs";
|
|
30
|
+
import { fileTypeFromName, fileTypes } from "../file-card/file-types.mjs";
|
|
31
|
+
import {
|
|
32
|
+
Toolbar,
|
|
33
|
+
ToolbarButton,
|
|
34
|
+
ToolbarGroup,
|
|
35
|
+
ToolbarSeparator,
|
|
36
|
+
ToolbarToggleGroup,
|
|
37
|
+
ToolbarToggleItem
|
|
38
|
+
} from "../toolbar/index.mjs";
|
|
39
|
+
import { formatBytes } from "../file-upload/validate.mjs";
|
|
40
|
+
import { tv } from "../../../lib/tv.mjs";
|
|
41
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
42
|
+
import {
|
|
43
|
+
FilePreviewContext,
|
|
44
|
+
FilePreviewDialogContext,
|
|
45
|
+
ZOOM_PRESETS,
|
|
46
|
+
detectKind,
|
|
47
|
+
extensionOf,
|
|
48
|
+
formatDuration,
|
|
49
|
+
useFilePreview
|
|
50
|
+
} from "./context.mjs";
|
|
51
|
+
import { PdfRenderer, PdfThumbnail } from "./pdf.mjs";
|
|
52
|
+
import { AudioRenderer, ImageRenderer, TextRenderer, UnsupportedRenderer, VideoRenderer } from "./renderers.mjs";
|
|
53
|
+
const filePreviewVariants = tv({
|
|
54
|
+
slots: {
|
|
55
|
+
root: [
|
|
56
|
+
"group/file-preview relative isolate grid min-h-0 grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)] overflow-hidden text-foreground outline-none",
|
|
57
|
+
"[&:fullscreen]:rounded-none [&:fullscreen]:bg-background [&:fullscreen]:shadow-none [&:fullscreen]:ring-0"
|
|
58
|
+
],
|
|
59
|
+
header: "col-span-full row-start-1 flex min-w-0 items-center gap-3 border-b border-border px-4 py-3",
|
|
60
|
+
info: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
61
|
+
title: "truncate text-sm font-medium text-foreground",
|
|
62
|
+
meta: "truncate text-xs tabular-nums text-muted-foreground",
|
|
63
|
+
actions: "ml-auto flex shrink-0 items-center gap-1",
|
|
64
|
+
thumbnails: [
|
|
65
|
+
"col-start-1 row-start-2 flex w-40 min-h-0 flex-col gap-4 overflow-y-auto overscroll-contain border-r border-border p-4 [scrollbar-width:thin]",
|
|
66
|
+
"max-md:hidden data-[state=closed]:hidden"
|
|
67
|
+
],
|
|
68
|
+
viewport: [
|
|
69
|
+
"relative col-start-2 row-start-2 min-h-0 min-w-0 overflow-hidden bg-muted [--surface:var(--muted)]",
|
|
70
|
+
"has-[>[data-slot=file-preview-toolbar]]:[--file-preview-toolbar-space:4rem]",
|
|
71
|
+
"[&>[data-slot=file-preview-toolbar]]:pointer-events-none [&>[data-slot=file-preview-toolbar]]:absolute [&>[data-slot=file-preview-toolbar]]:inset-x-4",
|
|
72
|
+
"[&>[data-slot=file-preview-toolbar]]:bottom-[max(1rem,env(safe-area-inset-bottom))] [&>[data-slot=file-preview-toolbar]]:z-10",
|
|
73
|
+
"[&>[data-slot=file-preview-toolbar]]:justify-center [&>[data-slot=file-preview-toolbar]>*]:pointer-events-auto"
|
|
74
|
+
],
|
|
75
|
+
content: [
|
|
76
|
+
"absolute inset-0 overflow-auto overscroll-contain outline-none [container-type:size]",
|
|
77
|
+
"px-4 pt-4 pb-[calc(1rem+var(--file-preview-toolbar-space,0px))] sm:px-6 sm:pt-6 sm:pb-[calc(1.5rem+var(--file-preview-toolbar-space,0px))]",
|
|
78
|
+
"[scrollbar-gutter:stable] [scrollbar-width:thin] touch-pan-x touch-pan-y",
|
|
79
|
+
"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus",
|
|
80
|
+
"data-[pannable]:cursor-grab data-[panning]:cursor-grabbing data-[panning]:select-none"
|
|
81
|
+
],
|
|
82
|
+
stage: "flex min-h-full w-max min-w-full flex-col items-center justify-center-safe gap-4",
|
|
83
|
+
toolbar: [
|
|
84
|
+
"flex min-w-0 [&>[data-slot=toolbar]]:min-w-0 [&>[data-slot=toolbar]]:max-w-full",
|
|
85
|
+
// A control that renders nothing leaves its separator behind; fold the strays away.
|
|
86
|
+
"[&_[data-slot=toolbar-separator]:first-child]:hidden [&_[data-slot=toolbar-separator]:last-child]:hidden",
|
|
87
|
+
"[&_[data-slot=toolbar-separator]+[data-slot=toolbar-separator]]:hidden"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
variants: {
|
|
91
|
+
variant: {
|
|
92
|
+
default: { root: "rounded-xl shadow-xs ring-1 ring-edge" },
|
|
93
|
+
outline: { root: "rounded-xl ring-1 ring-border" },
|
|
94
|
+
plain: {}
|
|
95
|
+
},
|
|
96
|
+
fill: {
|
|
97
|
+
true: { root: "h-full min-h-0 flex-1" },
|
|
98
|
+
false: { root: "h-[36rem]" }
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
defaultVariants: { variant: "default", fill: false }
|
|
102
|
+
});
|
|
103
|
+
const noSubscription = () => () => {
|
|
104
|
+
};
|
|
105
|
+
const fullscreenEnabled = () => Boolean(document.fullscreenEnabled);
|
|
106
|
+
const serverFalse = () => false;
|
|
107
|
+
function useResolvedSource(file, src) {
|
|
108
|
+
const url = React.useMemo(() => file ? URL.createObjectURL(file) : null, [file]);
|
|
109
|
+
React.useEffect(() => () => {
|
|
110
|
+
if (url) URL.revokeObjectURL(url);
|
|
111
|
+
}, [url]);
|
|
112
|
+
return url ?? src ?? null;
|
|
113
|
+
}
|
|
114
|
+
function FilePreview({
|
|
115
|
+
className,
|
|
116
|
+
file,
|
|
117
|
+
src: srcProp,
|
|
118
|
+
name: nameProp,
|
|
119
|
+
type: typeProp,
|
|
120
|
+
size: sizeProp,
|
|
121
|
+
kind: kindProp,
|
|
122
|
+
zoom: zoomProp,
|
|
123
|
+
defaultZoom = "fit",
|
|
124
|
+
onZoomChange,
|
|
125
|
+
rotation: rotationProp,
|
|
126
|
+
defaultRotation = 0,
|
|
127
|
+
onRotationChange,
|
|
128
|
+
defaultPage = 1,
|
|
129
|
+
onPageChange,
|
|
130
|
+
minZoom = 0.1,
|
|
131
|
+
maxZoom = 5,
|
|
132
|
+
defaultThumbnailsOpen = true,
|
|
133
|
+
textLayer = true,
|
|
134
|
+
pdfOptions,
|
|
135
|
+
onDownload,
|
|
136
|
+
variant = "default",
|
|
137
|
+
fill = false,
|
|
138
|
+
children,
|
|
139
|
+
onKeyDown,
|
|
140
|
+
...props
|
|
141
|
+
}) {
|
|
142
|
+
const src = useResolvedSource(file, srcProp);
|
|
143
|
+
const fileName = file && "name" in file ? file.name : void 0;
|
|
144
|
+
const name = nameProp ?? fileName ?? (srcProp ? decodeURIComponent(srcProp.split(/[?#]/)[0].split("/").pop() ?? "") : "file");
|
|
145
|
+
const type = typeProp ?? file?.type ?? "";
|
|
146
|
+
const size = sizeProp ?? file?.size;
|
|
147
|
+
const kind = kindProp ?? detectKind(type, name);
|
|
148
|
+
const ext = extensionOf(name);
|
|
149
|
+
const rootRef = React.useRef(null);
|
|
150
|
+
const [rootEl, setRootEl] = React.useState(null);
|
|
151
|
+
const setRoot = React.useCallback((node) => {
|
|
152
|
+
rootRef.current = node;
|
|
153
|
+
setRootEl(node);
|
|
154
|
+
}, []);
|
|
155
|
+
const contentRef = React.useRef(null);
|
|
156
|
+
const anchorRef = React.useRef(null);
|
|
157
|
+
const [status, setStatus] = React.useState("loading");
|
|
158
|
+
const [info, setInfoState] = React.useState({});
|
|
159
|
+
const [natural, setNatural] = React.useState(null);
|
|
160
|
+
const [box, setBox] = React.useState({ w: 0, h: 0 });
|
|
161
|
+
const [pdf, setPdf] = React.useState(null);
|
|
162
|
+
const [thumbnailsOpen, setThumbnailsOpen] = React.useState(defaultThumbnailsOpen);
|
|
163
|
+
const [fullscreen, setFullscreen] = React.useState(false);
|
|
164
|
+
const [page, setPage] = React.useState(defaultPage);
|
|
165
|
+
const [innerZoom, setInnerZoom] = React.useState(defaultZoom);
|
|
166
|
+
const [innerRotation, setInnerRotation] = React.useState(defaultRotation);
|
|
167
|
+
const zoom = zoomProp ?? innerZoom;
|
|
168
|
+
const rotation = rotationProp ?? innerRotation;
|
|
169
|
+
const close = React.useContext(FilePreviewDialogContext) ?? void 0;
|
|
170
|
+
const setInfo = React.useCallback((next) => setInfoState((current) => ({ ...current, ...next })), []);
|
|
171
|
+
const [lastSrc, setLastSrc] = React.useState(src);
|
|
172
|
+
if (lastSrc !== src) {
|
|
173
|
+
setLastSrc(src);
|
|
174
|
+
setInfoState({});
|
|
175
|
+
setNatural(null);
|
|
176
|
+
setStatus("loading");
|
|
177
|
+
setPage(defaultPage);
|
|
178
|
+
}
|
|
179
|
+
const scale = React.useMemo(() => {
|
|
180
|
+
if (typeof zoom === "number") return zoom;
|
|
181
|
+
if (!natural || box.w <= 0 || box.h <= 0) return 1;
|
|
182
|
+
const turned = rotation % 180 !== 0;
|
|
183
|
+
const w = turned ? natural.h : natural.w;
|
|
184
|
+
const h = turned ? natural.w : natural.h;
|
|
185
|
+
const width = box.w / w;
|
|
186
|
+
if (zoom === "width") return width;
|
|
187
|
+
if (kind === "text") return Math.min(1, width);
|
|
188
|
+
const fit = Math.min(width, box.h / h);
|
|
189
|
+
return kind === "image" ? Math.min(1, fit) : fit;
|
|
190
|
+
}, [zoom, natural, box, rotation, kind]);
|
|
191
|
+
const callbacks = React.useRef({ onZoomChange, onRotationChange, onPageChange });
|
|
192
|
+
React.useEffect(() => {
|
|
193
|
+
callbacks.current = { onZoomChange, onRotationChange, onPageChange };
|
|
194
|
+
});
|
|
195
|
+
const setZoom = React.useCallback(
|
|
196
|
+
(next, anchor) => {
|
|
197
|
+
const clamped = typeof next === "number" ? Math.min(maxZoom, Math.max(minZoom, next)) : next;
|
|
198
|
+
anchorRef.current = anchor ?? null;
|
|
199
|
+
if (zoomProp === void 0) setInnerZoom(clamped);
|
|
200
|
+
callbacks.current.onZoomChange?.(clamped);
|
|
201
|
+
},
|
|
202
|
+
[zoomProp, minZoom, maxZoom]
|
|
203
|
+
);
|
|
204
|
+
const zoomStep = React.useCallback(
|
|
205
|
+
(direction) => {
|
|
206
|
+
const presets = ZOOM_PRESETS.filter((p) => p >= minZoom && p <= maxZoom);
|
|
207
|
+
const next = direction > 0 ? presets.find((p) => p > scale + 1e-3) ?? maxZoom : [...presets].reverse().find((p) => p < scale - 1e-3) ?? minZoom;
|
|
208
|
+
setZoom(next);
|
|
209
|
+
},
|
|
210
|
+
[scale, minZoom, maxZoom, setZoom]
|
|
211
|
+
);
|
|
212
|
+
const rotate = React.useCallback(
|
|
213
|
+
(direction) => {
|
|
214
|
+
const next = ((rotation + (direction === "clockwise" ? 90 : -90)) % 360 + 360) % 360;
|
|
215
|
+
if (rotationProp === void 0) setInnerRotation(next);
|
|
216
|
+
callbacks.current.onRotationChange?.(next);
|
|
217
|
+
},
|
|
218
|
+
[rotation, rotationProp]
|
|
219
|
+
);
|
|
220
|
+
const reportPage = React.useCallback((next) => {
|
|
221
|
+
setPage((current) => {
|
|
222
|
+
if (current !== next) callbacks.current.onPageChange?.(next);
|
|
223
|
+
return next;
|
|
224
|
+
});
|
|
225
|
+
}, []);
|
|
226
|
+
const goToPage = React.useCallback(
|
|
227
|
+
(next) => {
|
|
228
|
+
const scroller = contentRef.current;
|
|
229
|
+
const target = scroller?.querySelector(`[data-slot=file-preview-page][data-page-number="${next}"]`);
|
|
230
|
+
if (!scroller || !target) return;
|
|
231
|
+
const inset = parseFloat(getComputedStyle(scroller).paddingTop) || 0;
|
|
232
|
+
const top = target.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop - inset;
|
|
233
|
+
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
234
|
+
scroller.scrollTo({ top, behavior: reduced ? "auto" : "smooth" });
|
|
235
|
+
reportPage(next);
|
|
236
|
+
},
|
|
237
|
+
[reportPage]
|
|
238
|
+
);
|
|
239
|
+
const opened = React.useRef(null);
|
|
240
|
+
React.useEffect(() => {
|
|
241
|
+
if (!pdf || opened.current === src) return;
|
|
242
|
+
opened.current = src;
|
|
243
|
+
if (defaultPage > 1) requestAnimationFrame(() => goToPage(defaultPage));
|
|
244
|
+
}, [pdf, src, defaultPage, goToPage]);
|
|
245
|
+
const canFullscreen = React.useSyncExternalStore(noSubscription, fullscreenEnabled, serverFalse);
|
|
246
|
+
React.useEffect(() => {
|
|
247
|
+
const sync = () => setFullscreen(document.fullscreenElement === rootRef.current);
|
|
248
|
+
document.addEventListener("fullscreenchange", sync);
|
|
249
|
+
return () => document.removeEventListener("fullscreenchange", sync);
|
|
250
|
+
}, []);
|
|
251
|
+
const toggleFullscreen = React.useCallback(() => {
|
|
252
|
+
if (document.fullscreenElement) void document.exitFullscreen();
|
|
253
|
+
else void rootRef.current?.requestFullscreen?.();
|
|
254
|
+
}, []);
|
|
255
|
+
const download = React.useCallback(async () => {
|
|
256
|
+
if (onDownload) return onDownload();
|
|
257
|
+
if (!src) return;
|
|
258
|
+
let href = src;
|
|
259
|
+
let made = null;
|
|
260
|
+
if (!src.startsWith("blob:") && !src.startsWith("data:") && new URL(src, location.href).origin !== location.origin) {
|
|
261
|
+
try {
|
|
262
|
+
made = URL.createObjectURL(await (await fetch(src)).blob());
|
|
263
|
+
href = made;
|
|
264
|
+
} catch {
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const a = document.createElement("a");
|
|
268
|
+
a.href = href;
|
|
269
|
+
a.download = name;
|
|
270
|
+
document.body.append(a);
|
|
271
|
+
a.click();
|
|
272
|
+
a.remove();
|
|
273
|
+
if (made) setTimeout(() => URL.revokeObjectURL(made), 1e3);
|
|
274
|
+
}, [onDownload, src, name]);
|
|
275
|
+
const print = React.useCallback(() => {
|
|
276
|
+
if (!src) return;
|
|
277
|
+
const sameOrigin = src.startsWith("blob:") || new URL(src, location.href).origin === location.origin;
|
|
278
|
+
if (!sameOrigin) {
|
|
279
|
+
window.open(src, "_blank", "noopener");
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const frame = document.createElement("iframe");
|
|
283
|
+
frame.style.cssText = "position:fixed;width:0;height:0;border:0;opacity:0";
|
|
284
|
+
frame.src = src;
|
|
285
|
+
frame.onload = () => {
|
|
286
|
+
frame.contentWindow?.focus();
|
|
287
|
+
frame.contentWindow?.print();
|
|
288
|
+
setTimeout(() => frame.remove(), 6e4);
|
|
289
|
+
};
|
|
290
|
+
document.body.append(frame);
|
|
291
|
+
}, [src]);
|
|
292
|
+
const value = {
|
|
293
|
+
src,
|
|
294
|
+
name,
|
|
295
|
+
type,
|
|
296
|
+
size,
|
|
297
|
+
kind,
|
|
298
|
+
ext,
|
|
299
|
+
status,
|
|
300
|
+
setStatus,
|
|
301
|
+
info,
|
|
302
|
+
setInfo,
|
|
303
|
+
natural,
|
|
304
|
+
setNatural,
|
|
305
|
+
box,
|
|
306
|
+
setBox,
|
|
307
|
+
zoom,
|
|
308
|
+
scale,
|
|
309
|
+
setZoom,
|
|
310
|
+
zoomStep,
|
|
311
|
+
minZoom,
|
|
312
|
+
maxZoom,
|
|
313
|
+
anchorRef,
|
|
314
|
+
rotation,
|
|
315
|
+
rotate,
|
|
316
|
+
page,
|
|
317
|
+
numPages: pdf?.sizes.length ?? 0,
|
|
318
|
+
goToPage,
|
|
319
|
+
reportPage,
|
|
320
|
+
thumbnailsOpen,
|
|
321
|
+
setThumbnailsOpen,
|
|
322
|
+
fullscreen,
|
|
323
|
+
toggleFullscreen,
|
|
324
|
+
canFullscreen,
|
|
325
|
+
rootRef,
|
|
326
|
+
rootEl,
|
|
327
|
+
contentRef,
|
|
328
|
+
pdf,
|
|
329
|
+
setPdf,
|
|
330
|
+
textLayer,
|
|
331
|
+
pdfOptions,
|
|
332
|
+
download,
|
|
333
|
+
print,
|
|
334
|
+
close
|
|
335
|
+
};
|
|
336
|
+
const slots = filePreviewVariants({ variant, fill });
|
|
337
|
+
return /* @__PURE__ */ jsx(FilePreviewContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
ref: setRoot,
|
|
341
|
+
"data-slot": "file-preview",
|
|
342
|
+
"data-kind": kind,
|
|
343
|
+
"data-status": status,
|
|
344
|
+
"data-fullscreen": fullscreen ? "" : void 0,
|
|
345
|
+
className: slots.root({ className }),
|
|
346
|
+
onKeyDown: (event) => {
|
|
347
|
+
onKeyDown?.(event);
|
|
348
|
+
if (event.defaultPrevented) return;
|
|
349
|
+
const target = event.target;
|
|
350
|
+
if (target.closest("input, textarea, select, [contenteditable=true], [data-slot=file-preview-audio], video")) return;
|
|
351
|
+
const zoomable = kind === "pdf" || kind === "image" || kind === "text";
|
|
352
|
+
const key = event.key;
|
|
353
|
+
if (zoomable && (key === "+" || key === "=")) {
|
|
354
|
+
event.preventDefault();
|
|
355
|
+
zoomStep(1);
|
|
356
|
+
} else if (zoomable && (key === "-" || key === "_")) {
|
|
357
|
+
event.preventDefault();
|
|
358
|
+
zoomStep(-1);
|
|
359
|
+
} else if (zoomable && key === "0" && !event.metaKey && !event.ctrlKey) {
|
|
360
|
+
event.preventDefault();
|
|
361
|
+
setZoom("fit");
|
|
362
|
+
} else if ((kind === "pdf" || kind === "image") && key.toLowerCase() === "r" && !event.metaKey && !event.ctrlKey) {
|
|
363
|
+
event.preventDefault();
|
|
364
|
+
rotate(event.shiftKey ? "counterclockwise" : "clockwise");
|
|
365
|
+
} else if (key.toLowerCase() === "f" && !event.metaKey && !event.ctrlKey && canFullscreen) {
|
|
366
|
+
event.preventDefault();
|
|
367
|
+
toggleFullscreen();
|
|
368
|
+
} else if (kind === "pdf" && (key === "ArrowLeft" || key === "ArrowRight")) {
|
|
369
|
+
const scroller = contentRef.current;
|
|
370
|
+
if (scroller && scroller.scrollWidth > scroller.clientWidth + 1) return;
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
goToPage(Math.min(value.numPages, Math.max(1, page + (key === "ArrowRight" ? 1 : -1))));
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
...props,
|
|
376
|
+
children
|
|
377
|
+
}
|
|
378
|
+
) });
|
|
379
|
+
}
|
|
380
|
+
function FilePreviewHeader({ className, ...props }) {
|
|
381
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "file-preview-header", className: filePreviewVariants().header({ className }), ...props });
|
|
382
|
+
}
|
|
383
|
+
const ICON_SIZES = { sm: "h-8", md: "h-10", lg: "h-12", xl: "h-16" };
|
|
384
|
+
function FilePreviewIcon({ className, size = "sm", variant, label, ...props }) {
|
|
385
|
+
const { name, ext } = useFilePreview("FilePreviewIcon");
|
|
386
|
+
const type = fileTypeFromName(name);
|
|
387
|
+
return /* @__PURE__ */ jsx(
|
|
388
|
+
FileIcon,
|
|
389
|
+
{
|
|
390
|
+
"data-slot": "file-preview-icon",
|
|
391
|
+
label: label ?? (ext ? ext.toUpperCase().slice(0, 4) : fileTypes[type].label),
|
|
392
|
+
variant,
|
|
393
|
+
className: cn(ICON_SIZES[size], fileTypes[type].tone, "shrink-0", className),
|
|
394
|
+
...props
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
function FilePreviewInfo({ className, ...props }) {
|
|
399
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "file-preview-info", className: filePreviewVariants().info({ className }), ...props });
|
|
400
|
+
}
|
|
401
|
+
function FilePreviewTitle({ className, children, ...props }) {
|
|
402
|
+
const { name } = useFilePreview("FilePreviewTitle");
|
|
403
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "file-preview-title", title: name, className: filePreviewVariants().title({ className }), ...props, children: children ?? name });
|
|
404
|
+
}
|
|
405
|
+
function FilePreviewMeta({ className, children, ...props }) {
|
|
406
|
+
const { ext, size, info, kind } = useFilePreview("FilePreviewMeta");
|
|
407
|
+
const parts = [ext ? ext.toUpperCase() : null, size !== void 0 ? formatBytes(size) : null];
|
|
408
|
+
if (kind === "pdf" && info.pages) parts.push(`${info.pages} ${info.pages === 1 ? "page" : "pages"}`);
|
|
409
|
+
if ((kind === "image" || kind === "video") && info.width && info.height) parts.push(`${info.width} \xD7 ${info.height}`);
|
|
410
|
+
if (kind === "text" && info.lines) parts.push(`${info.lines} ${info.lines === 1 ? "line" : "lines"}`);
|
|
411
|
+
if ((kind === "audio" || kind === "video") && info.duration) parts.push(formatDuration(info.duration));
|
|
412
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "file-preview-meta", className: filePreviewVariants().meta({ className }), ...props, children: children ?? parts.filter(Boolean).join(" \xB7 ") });
|
|
413
|
+
}
|
|
414
|
+
function FilePreviewActions({ className, ...props }) {
|
|
415
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "file-preview-actions", className: filePreviewVariants().actions({ className }), ...props });
|
|
416
|
+
}
|
|
417
|
+
function FilePreviewDownload({ variant = "ghost", size = "sm", children, onClick, ...props }) {
|
|
418
|
+
const { download } = useFilePreview("FilePreviewDownload");
|
|
419
|
+
return /* @__PURE__ */ jsxs(
|
|
420
|
+
Button,
|
|
421
|
+
{
|
|
422
|
+
"data-slot": "file-preview-download",
|
|
423
|
+
variant,
|
|
424
|
+
size,
|
|
425
|
+
iconOnly: !children,
|
|
426
|
+
"aria-label": children ? void 0 : "Download",
|
|
427
|
+
onClick: (event) => {
|
|
428
|
+
onClick?.(event);
|
|
429
|
+
if (!event.defaultPrevented) void download();
|
|
430
|
+
},
|
|
431
|
+
...props,
|
|
432
|
+
children: [
|
|
433
|
+
/* @__PURE__ */ jsx(DownloadSimple, {}),
|
|
434
|
+
children
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
function FilePreviewPrint({ variant = "ghost", size = "sm", children, onClick, ...props }) {
|
|
440
|
+
const { print } = useFilePreview("FilePreviewPrint");
|
|
441
|
+
return /* @__PURE__ */ jsxs(
|
|
442
|
+
Button,
|
|
443
|
+
{
|
|
444
|
+
"data-slot": "file-preview-print",
|
|
445
|
+
variant,
|
|
446
|
+
size,
|
|
447
|
+
iconOnly: !children,
|
|
448
|
+
"aria-label": children ? void 0 : "Print",
|
|
449
|
+
onClick: (event) => {
|
|
450
|
+
onClick?.(event);
|
|
451
|
+
if (!event.defaultPrevented) print();
|
|
452
|
+
},
|
|
453
|
+
...props,
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ jsx(Printer, {}),
|
|
456
|
+
children
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
function FilePreviewClose({ variant = "ghost", size = "sm", onClick, ...props }) {
|
|
462
|
+
const { close } = useFilePreview("FilePreviewClose");
|
|
463
|
+
return /* @__PURE__ */ jsx(
|
|
464
|
+
Button,
|
|
465
|
+
{
|
|
466
|
+
"data-slot": "file-preview-close",
|
|
467
|
+
variant,
|
|
468
|
+
size,
|
|
469
|
+
iconOnly: true,
|
|
470
|
+
"aria-label": "Close",
|
|
471
|
+
onClick: (event) => {
|
|
472
|
+
onClick?.(event);
|
|
473
|
+
if (!event.defaultPrevented) close?.();
|
|
474
|
+
},
|
|
475
|
+
...props,
|
|
476
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
function FilePreviewThumbnails({ className, ...props }) {
|
|
481
|
+
const { kind, pdf, thumbnailsOpen } = useFilePreview("FilePreviewThumbnails");
|
|
482
|
+
if (kind !== "pdf" || !pdf || pdf.sizes.length < 2) return null;
|
|
483
|
+
return /* @__PURE__ */ jsx(
|
|
484
|
+
"nav",
|
|
485
|
+
{
|
|
486
|
+
"data-slot": "file-preview-thumbnails",
|
|
487
|
+
"data-state": thumbnailsOpen ? "open" : "closed",
|
|
488
|
+
"aria-label": "Pages",
|
|
489
|
+
className: filePreviewVariants().thumbnails({ className }),
|
|
490
|
+
...props,
|
|
491
|
+
children: pdf.sizes.map((_, i) => /* @__PURE__ */ jsx(PdfThumbnail, { pageNumber: i + 1 }, i + 1))
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
function Renderer() {
|
|
496
|
+
const { kind, status, src } = useFilePreview("FilePreviewViewport");
|
|
497
|
+
if (!src) return null;
|
|
498
|
+
if (status === "error") return /* @__PURE__ */ jsx(UnsupportedRenderer, { failed: true });
|
|
499
|
+
if (kind === "pdf") return /* @__PURE__ */ jsx(PdfRenderer, {});
|
|
500
|
+
if (kind === "image") return /* @__PURE__ */ jsx(ImageRenderer, {});
|
|
501
|
+
if (kind === "text") return /* @__PURE__ */ jsx(TextRenderer, {});
|
|
502
|
+
if (kind === "audio") return /* @__PURE__ */ jsx(AudioRenderer, {});
|
|
503
|
+
if (kind === "video") return /* @__PURE__ */ jsx(VideoRenderer, {});
|
|
504
|
+
return /* @__PURE__ */ jsx(UnsupportedRenderer, {});
|
|
505
|
+
}
|
|
506
|
+
function FilePreviewViewport({ className, contentProps, children, ...props }) {
|
|
507
|
+
const preview = useFilePreview("FilePreviewViewport");
|
|
508
|
+
const { contentRef, setBox, scale, anchorRef, kind, name, setZoom, natural, rotation } = preview;
|
|
509
|
+
const slots = filePreviewVariants();
|
|
510
|
+
const [pannable, setPannable] = React.useState(false);
|
|
511
|
+
const [panning, setPanning] = React.useState(false);
|
|
512
|
+
const lastScale = React.useRef(scale);
|
|
513
|
+
const latest = React.useRef({ scale, setZoom });
|
|
514
|
+
React.useEffect(() => {
|
|
515
|
+
latest.current = { scale, setZoom };
|
|
516
|
+
});
|
|
517
|
+
React.useEffect(() => {
|
|
518
|
+
const el = contentRef.current;
|
|
519
|
+
if (!el) return;
|
|
520
|
+
const measure = () => {
|
|
521
|
+
const style = getComputedStyle(el);
|
|
522
|
+
const w = el.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);
|
|
523
|
+
const h = el.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);
|
|
524
|
+
setBox({ w: Math.max(0, w), h: Math.max(0, h) });
|
|
525
|
+
};
|
|
526
|
+
measure();
|
|
527
|
+
const observer = new ResizeObserver(measure);
|
|
528
|
+
observer.observe(el);
|
|
529
|
+
return () => observer.disconnect();
|
|
530
|
+
}, [contentRef, setBox]);
|
|
531
|
+
React.useLayoutEffect(() => {
|
|
532
|
+
const el = contentRef.current;
|
|
533
|
+
const previous = lastScale.current;
|
|
534
|
+
lastScale.current = scale;
|
|
535
|
+
if (!el || previous === scale) return;
|
|
536
|
+
const anchor = anchorRef.current ?? { x: el.clientWidth / 2, y: el.clientHeight / 2 };
|
|
537
|
+
anchorRef.current = null;
|
|
538
|
+
const k = scale / previous;
|
|
539
|
+
el.scrollLeft = (el.scrollLeft + anchor.x) * k - anchor.x;
|
|
540
|
+
el.scrollTop = (el.scrollTop + anchor.y) * k - anchor.y;
|
|
541
|
+
}, [scale, contentRef, anchorRef]);
|
|
542
|
+
React.useEffect(() => {
|
|
543
|
+
const el = contentRef.current;
|
|
544
|
+
if (!el) return;
|
|
545
|
+
const check = () => setPannable(kind === "image" && (el.scrollWidth > el.clientWidth + 1 || el.scrollHeight > el.clientHeight + 1));
|
|
546
|
+
check();
|
|
547
|
+
const observer = new ResizeObserver(check);
|
|
548
|
+
observer.observe(el);
|
|
549
|
+
if (el.firstElementChild) observer.observe(el.firstElementChild);
|
|
550
|
+
return () => observer.disconnect();
|
|
551
|
+
}, [contentRef, kind, scale, natural, rotation]);
|
|
552
|
+
React.useEffect(() => {
|
|
553
|
+
const el = contentRef.current;
|
|
554
|
+
if (!el || kind !== "pdf" && kind !== "image" && kind !== "text") return;
|
|
555
|
+
const onWheel = (event) => {
|
|
556
|
+
if (!event.ctrlKey && !event.metaKey) return;
|
|
557
|
+
event.preventDefault();
|
|
558
|
+
const r = el.getBoundingClientRect();
|
|
559
|
+
const { scale: current, setZoom: set } = latest.current;
|
|
560
|
+
set(current * Math.exp(-event.deltaY * 25e-4), { x: event.clientX - r.left, y: event.clientY - r.top });
|
|
561
|
+
};
|
|
562
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
563
|
+
return () => el.removeEventListener("wheel", onWheel);
|
|
564
|
+
}, [contentRef, kind]);
|
|
565
|
+
const pointers = React.useRef(/* @__PURE__ */ new Map());
|
|
566
|
+
const pinch = React.useRef(null);
|
|
567
|
+
const pan = React.useRef(null);
|
|
568
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "file-preview-viewport", className: slots.viewport({ className }), ...props, children: [
|
|
569
|
+
/* @__PURE__ */ jsx(
|
|
570
|
+
"div",
|
|
571
|
+
{
|
|
572
|
+
ref: contentRef,
|
|
573
|
+
role: "group",
|
|
574
|
+
"aria-label": name,
|
|
575
|
+
tabIndex: 0,
|
|
576
|
+
"data-slot": "file-preview-content",
|
|
577
|
+
"data-pannable": pannable ? "" : void 0,
|
|
578
|
+
"data-panning": panning ? "" : void 0,
|
|
579
|
+
...contentProps,
|
|
580
|
+
className: slots.content({ className: contentProps?.className }),
|
|
581
|
+
onPointerDown: (event) => {
|
|
582
|
+
contentProps?.onPointerDown?.(event);
|
|
583
|
+
pointers.current.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
|
584
|
+
if (pointers.current.size === 2) {
|
|
585
|
+
const [a, b] = [...pointers.current.values()];
|
|
586
|
+
pinch.current = { distance: Math.hypot(a.x - b.x, a.y - b.y), scale };
|
|
587
|
+
pan.current = null;
|
|
588
|
+
} else if (pannable && event.pointerType === "mouse" && event.button === 0) {
|
|
589
|
+
const el = event.currentTarget;
|
|
590
|
+
pan.current = { x: event.clientX, y: event.clientY, left: el.scrollLeft, top: el.scrollTop };
|
|
591
|
+
setPanning(true);
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
onPointerMove: (event) => {
|
|
595
|
+
if (pointers.current.has(event.pointerId)) pointers.current.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
|
596
|
+
const el = event.currentTarget;
|
|
597
|
+
if (pinch.current && pointers.current.size === 2) {
|
|
598
|
+
const [a, b] = [...pointers.current.values()];
|
|
599
|
+
const r = el.getBoundingClientRect();
|
|
600
|
+
const distance = Math.hypot(a.x - b.x, a.y - b.y);
|
|
601
|
+
setZoom(pinch.current.scale * (distance / pinch.current.distance), {
|
|
602
|
+
x: (a.x + b.x) / 2 - r.left,
|
|
603
|
+
y: (a.y + b.y) / 2 - r.top
|
|
604
|
+
});
|
|
605
|
+
} else if (pan.current) {
|
|
606
|
+
el.scrollLeft = pan.current.left - (event.clientX - pan.current.x);
|
|
607
|
+
el.scrollTop = pan.current.top - (event.clientY - pan.current.y);
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
onPointerUp: (event) => {
|
|
611
|
+
pointers.current.delete(event.pointerId);
|
|
612
|
+
if (pointers.current.size < 2) pinch.current = null;
|
|
613
|
+
pan.current = null;
|
|
614
|
+
setPanning(false);
|
|
615
|
+
},
|
|
616
|
+
onPointerCancel: (event) => {
|
|
617
|
+
pointers.current.delete(event.pointerId);
|
|
618
|
+
pinch.current = null;
|
|
619
|
+
pan.current = null;
|
|
620
|
+
setPanning(false);
|
|
621
|
+
},
|
|
622
|
+
onDoubleClick: (event) => {
|
|
623
|
+
if (kind !== "image") return;
|
|
624
|
+
const r = event.currentTarget.getBoundingClientRect();
|
|
625
|
+
setZoom(Math.abs(scale - 1) < 0.01 ? "fit" : 1, { x: event.clientX - r.left, y: event.clientY - r.top });
|
|
626
|
+
},
|
|
627
|
+
children: /* @__PURE__ */ jsx("div", { "data-slot": "file-preview-stage", className: slots.stage(), children: /* @__PURE__ */ jsx(Renderer, {}) })
|
|
628
|
+
}
|
|
629
|
+
),
|
|
630
|
+
children
|
|
631
|
+
] });
|
|
632
|
+
}
|
|
633
|
+
const CONTROLLABLE = ["pdf", "image", "text"];
|
|
634
|
+
function FilePreviewToolbar({ className, variant = "floating", "aria-label": label = "Preview controls", ...props }) {
|
|
635
|
+
const { kind, status } = useFilePreview("FilePreviewToolbar");
|
|
636
|
+
if (!CONTROLLABLE.includes(kind) || status === "error") return null;
|
|
637
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "file-preview-toolbar", className: filePreviewVariants().toolbar(), children: /* @__PURE__ */ jsx(Toolbar, { variant, "aria-label": label, className, ...props }) });
|
|
638
|
+
}
|
|
639
|
+
function FilePreviewThumbnailsToggle({ className, ...props }) {
|
|
640
|
+
const { kind, numPages, thumbnailsOpen, setThumbnailsOpen } = useFilePreview("FilePreviewThumbnailsToggle");
|
|
641
|
+
if (kind !== "pdf" || numPages < 2) return null;
|
|
642
|
+
return /* @__PURE__ */ jsx(
|
|
643
|
+
ToolbarButton,
|
|
644
|
+
{
|
|
645
|
+
tooltip: thumbnailsOpen ? "Hide pages" : "Show pages",
|
|
646
|
+
pressed: thumbnailsOpen,
|
|
647
|
+
className: cn("max-md:hidden", className),
|
|
648
|
+
onClick: () => setThumbnailsOpen(!thumbnailsOpen),
|
|
649
|
+
...props,
|
|
650
|
+
children: /* @__PURE__ */ jsx(Sidebar, {})
|
|
651
|
+
}
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
function FilePreviewPageNav({ className }) {
|
|
655
|
+
const { kind, page, numPages, goToPage } = useFilePreview("FilePreviewPageNav");
|
|
656
|
+
const [draft, setDraft] = React.useState(null);
|
|
657
|
+
const countId = React.useId();
|
|
658
|
+
if (kind !== "pdf" || numPages < 1) return null;
|
|
659
|
+
const shown = draft ?? String(page);
|
|
660
|
+
return /* @__PURE__ */ jsxs(ToolbarGroup, { "aria-label": "Pages", className, children: [
|
|
661
|
+
/* @__PURE__ */ jsx(ToolbarButton, { tooltip: "Previous page", disabled: page <= 1, onClick: () => goToPage(page - 1), children: /* @__PURE__ */ jsx(CaretLeft, {}) }),
|
|
662
|
+
/* @__PURE__ */ jsx("label", { className: "flex h-7 items-center", children: /* @__PURE__ */ jsx(
|
|
663
|
+
"input",
|
|
664
|
+
{
|
|
665
|
+
type: "text",
|
|
666
|
+
inputMode: "numeric",
|
|
667
|
+
"aria-label": "Page",
|
|
668
|
+
"aria-describedby": countId,
|
|
669
|
+
value: shown,
|
|
670
|
+
onChange: (event) => setDraft(event.target.value.replace(/[^\d]/g, "")),
|
|
671
|
+
onBlur: () => setDraft(null),
|
|
672
|
+
onKeyDown: (event) => {
|
|
673
|
+
if (event.key === "Enter") {
|
|
674
|
+
const n = Number(shown);
|
|
675
|
+
if (n >= 1 && n <= numPages) goToPage(n);
|
|
676
|
+
setDraft(null);
|
|
677
|
+
} else if (event.key === "Escape") {
|
|
678
|
+
event.stopPropagation();
|
|
679
|
+
setDraft(null);
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
style: { "--digits": String(numPages).length },
|
|
683
|
+
className: "h-6 w-[calc(var(--digits)*1ch+1rem)] rounded-sm bg-foreground/6 text-center text-sm tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-focus"
|
|
684
|
+
}
|
|
685
|
+
) }),
|
|
686
|
+
/* @__PURE__ */ jsxs("span", { id: countId, className: "shrink-0 select-none pr-1.5 pl-0.5 text-sm tabular-nums text-muted-foreground", children: [
|
|
687
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "/ " }),
|
|
688
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "of " }),
|
|
689
|
+
numPages
|
|
690
|
+
] }),
|
|
691
|
+
/* @__PURE__ */ jsx(ToolbarButton, { tooltip: "Next page", disabled: page >= numPages, onClick: () => goToPage(page + 1), children: /* @__PURE__ */ jsx(CaretRight, {}) })
|
|
692
|
+
] });
|
|
693
|
+
}
|
|
694
|
+
function FilePreviewZoomOut(props) {
|
|
695
|
+
const { scale, minZoom, zoomStep, kind } = useFilePreview("FilePreviewZoomOut");
|
|
696
|
+
if (!CONTROLLABLE.includes(kind)) return null;
|
|
697
|
+
return /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "Zoom out", shortcut: "\u2212", disabled: scale <= minZoom + 1e-3, onClick: () => zoomStep(-1), ...props, children: /* @__PURE__ */ jsx(Minus, {}) });
|
|
698
|
+
}
|
|
699
|
+
function FilePreviewZoomIn(props) {
|
|
700
|
+
const { scale, maxZoom, zoomStep, kind } = useFilePreview("FilePreviewZoomIn");
|
|
701
|
+
if (!CONTROLLABLE.includes(kind)) return null;
|
|
702
|
+
return /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "Zoom in", shortcut: "+", disabled: scale >= maxZoom - 1e-3, onClick: () => zoomStep(1), ...props, children: /* @__PURE__ */ jsx(Plus, {}) });
|
|
703
|
+
}
|
|
704
|
+
function FilePreviewZoomMenu({ presets = ZOOM_PRESETS, className, ...props }) {
|
|
705
|
+
const { scale, setZoom, minZoom, maxZoom, kind, rootEl, fullscreen } = useFilePreview("FilePreviewZoomMenu");
|
|
706
|
+
if (!CONTROLLABLE.includes(kind)) return null;
|
|
707
|
+
const percent = `${Math.round(scale * 100)}%`;
|
|
708
|
+
const container = fullscreen ? rootEl : void 0;
|
|
709
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { modal: false, children: [
|
|
710
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { "aria-label": `Zoom ${percent}`, className: cn("w-auto px-2 text-sm tabular-nums", className), ...props, children: percent }) }),
|
|
711
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { side: "top", align: "center", container, className: "w-44", children: [
|
|
712
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, { onSelect: () => setZoom("fit"), children: "Fit to page" }),
|
|
713
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, { onSelect: () => setZoom("width"), children: "Fit to width" }),
|
|
714
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
715
|
+
presets.filter((p) => p >= minZoom && p <= maxZoom).map((p) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: () => setZoom(p), className: "tabular-nums", children: [
|
|
716
|
+
Math.round(p * 100),
|
|
717
|
+
"%"
|
|
718
|
+
] }, p))
|
|
719
|
+
] })
|
|
720
|
+
] });
|
|
721
|
+
}
|
|
722
|
+
function FilePreviewFit({ disabled = false }) {
|
|
723
|
+
const { zoom, setZoom, kind } = useFilePreview("FilePreviewFit");
|
|
724
|
+
if (!CONTROLLABLE.includes(kind)) return null;
|
|
725
|
+
const value = zoom === "fit" || zoom === "width" ? zoom : "";
|
|
726
|
+
return /* @__PURE__ */ jsxs(
|
|
727
|
+
ToolbarToggleGroup,
|
|
728
|
+
{
|
|
729
|
+
type: "single",
|
|
730
|
+
"aria-label": "Fit",
|
|
731
|
+
value,
|
|
732
|
+
disabled,
|
|
733
|
+
onValueChange: (next) => next && setZoom(next),
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsx(ToolbarToggleItem, { value: "fit", tooltip: "Fit to page", shortcut: "0", children: /* @__PURE__ */ jsx(FrameCorners, {}) }),
|
|
736
|
+
/* @__PURE__ */ jsx(ToolbarToggleItem, { value: "width", tooltip: "Fit to width", children: /* @__PURE__ */ jsx(ArrowsHorizontal, {}) })
|
|
737
|
+
]
|
|
738
|
+
}
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
function FilePreviewRotate({ direction = "clockwise", ...props }) {
|
|
742
|
+
const { rotate, kind } = useFilePreview("FilePreviewRotate");
|
|
743
|
+
if (kind !== "pdf" && kind !== "image") return null;
|
|
744
|
+
const clockwise = direction === "clockwise";
|
|
745
|
+
return /* @__PURE__ */ jsx(
|
|
746
|
+
ToolbarButton,
|
|
747
|
+
{
|
|
748
|
+
tooltip: clockwise ? "Rotate right" : "Rotate left",
|
|
749
|
+
shortcut: clockwise ? "R" : "\u21E7R",
|
|
750
|
+
onClick: () => rotate(direction),
|
|
751
|
+
...props,
|
|
752
|
+
children: clockwise ? /* @__PURE__ */ jsx(ArrowClockwise, {}) : /* @__PURE__ */ jsx(ArrowCounterClockwise, {})
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
function FilePreviewFullscreen(props) {
|
|
757
|
+
const { fullscreen, toggleFullscreen, canFullscreen } = useFilePreview("FilePreviewFullscreen");
|
|
758
|
+
if (!canFullscreen) return null;
|
|
759
|
+
return /* @__PURE__ */ jsx(ToolbarButton, { tooltip: fullscreen ? "Exit full screen" : "Full screen", shortcut: "F", onClick: toggleFullscreen, ...props, children: fullscreen ? /* @__PURE__ */ jsx(CornersIn, {}) : /* @__PURE__ */ jsx(CornersOut, {}) });
|
|
760
|
+
}
|
|
761
|
+
function FilePreviewControls() {
|
|
762
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
763
|
+
/* @__PURE__ */ jsx(FilePreviewThumbnailsToggle, {}),
|
|
764
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
765
|
+
/* @__PURE__ */ jsx(FilePreviewPageNav, {}),
|
|
766
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
767
|
+
/* @__PURE__ */ jsx(FilePreviewZoomOut, {}),
|
|
768
|
+
/* @__PURE__ */ jsx(FilePreviewZoomMenu, {}),
|
|
769
|
+
/* @__PURE__ */ jsx(FilePreviewZoomIn, {}),
|
|
770
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
771
|
+
/* @__PURE__ */ jsx(FilePreviewFit, {}),
|
|
772
|
+
/* @__PURE__ */ jsx(FilePreviewRotate, {}),
|
|
773
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
774
|
+
/* @__PURE__ */ jsx(FilePreviewFullscreen, {})
|
|
775
|
+
] });
|
|
776
|
+
}
|
|
777
|
+
function FilePreviewDialog({
|
|
778
|
+
open: openProp,
|
|
779
|
+
defaultOpen = false,
|
|
780
|
+
onOpenChange,
|
|
781
|
+
title,
|
|
782
|
+
className,
|
|
783
|
+
previewClassName,
|
|
784
|
+
file,
|
|
785
|
+
src,
|
|
786
|
+
name,
|
|
787
|
+
variant = "plain",
|
|
788
|
+
children,
|
|
789
|
+
...props
|
|
790
|
+
}) {
|
|
791
|
+
const [innerOpen, setInnerOpen] = React.useState(defaultOpen);
|
|
792
|
+
const open = openProp ?? innerOpen;
|
|
793
|
+
const setOpen = React.useCallback(
|
|
794
|
+
(next) => {
|
|
795
|
+
if (openProp === void 0) setInnerOpen(next);
|
|
796
|
+
onOpenChange?.(next);
|
|
797
|
+
},
|
|
798
|
+
[openProp, onOpenChange]
|
|
799
|
+
);
|
|
800
|
+
const [kept, setKept] = React.useState({ file, src, name });
|
|
801
|
+
if ((file || src) && (kept.file !== file || kept.src !== src || kept.name !== name)) setKept({ file, src, name });
|
|
802
|
+
const shown = file || src ? { file, src, name } : kept;
|
|
803
|
+
const label = title ?? shown.name ?? (shown.file && "name" in shown.file ? shown.file.name : "File preview");
|
|
804
|
+
const close = React.useCallback(() => setOpen(false), [setOpen]);
|
|
805
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(
|
|
806
|
+
DialogContent,
|
|
807
|
+
{
|
|
808
|
+
size: "xl",
|
|
809
|
+
showClose: false,
|
|
810
|
+
className: cn(
|
|
811
|
+
"h-[min(48rem,calc(100dvh-2rem))] max-w-5xl gap-0 overflow-hidden p-0 [--surface:var(--popover)]",
|
|
812
|
+
"max-sm:inset-0 max-sm:m-0 max-sm:h-dvh max-sm:max-h-none max-sm:w-full max-sm:max-w-none max-sm:rounded-none",
|
|
813
|
+
className
|
|
814
|
+
),
|
|
815
|
+
onOpenAutoFocus: (event) => {
|
|
816
|
+
event.preventDefault();
|
|
817
|
+
const content = event.currentTarget.querySelector("[data-slot=file-preview-content]");
|
|
818
|
+
content?.focus();
|
|
819
|
+
},
|
|
820
|
+
children: [
|
|
821
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: label }),
|
|
822
|
+
/* @__PURE__ */ jsx(FilePreviewDialogContext.Provider, { value: close, children: /* @__PURE__ */ jsx(
|
|
823
|
+
FilePreview,
|
|
824
|
+
{
|
|
825
|
+
file: shown.file,
|
|
826
|
+
src: shown.src,
|
|
827
|
+
name: shown.name,
|
|
828
|
+
variant,
|
|
829
|
+
fill: true,
|
|
830
|
+
className: previewClassName,
|
|
831
|
+
...props,
|
|
832
|
+
children
|
|
833
|
+
}
|
|
834
|
+
) })
|
|
835
|
+
]
|
|
836
|
+
}
|
|
837
|
+
) });
|
|
838
|
+
}
|
|
839
|
+
export {
|
|
840
|
+
FilePreview,
|
|
841
|
+
FilePreviewActions,
|
|
842
|
+
FilePreviewClose,
|
|
843
|
+
FilePreviewControls,
|
|
844
|
+
FilePreviewDialog,
|
|
845
|
+
FilePreviewDownload,
|
|
846
|
+
FilePreviewFit,
|
|
847
|
+
FilePreviewFullscreen,
|
|
848
|
+
FilePreviewHeader,
|
|
849
|
+
FilePreviewIcon,
|
|
850
|
+
FilePreviewInfo,
|
|
851
|
+
FilePreviewMeta,
|
|
852
|
+
FilePreviewPageNav,
|
|
853
|
+
FilePreviewPrint,
|
|
854
|
+
FilePreviewRotate,
|
|
855
|
+
FilePreviewThumbnails,
|
|
856
|
+
FilePreviewThumbnailsToggle,
|
|
857
|
+
FilePreviewTitle,
|
|
858
|
+
FilePreviewToolbar,
|
|
859
|
+
FilePreviewViewport,
|
|
860
|
+
FilePreviewZoomIn,
|
|
861
|
+
FilePreviewZoomMenu,
|
|
862
|
+
FilePreviewZoomOut,
|
|
863
|
+
filePreviewVariants
|
|
864
|
+
};
|
|
865
|
+
//# sourceMappingURL=file-preview.mjs.map
|