@botiverse/raft-ui 0.51.0 → 0.52.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/CHANGELOG.md +20 -0
- package/dist/components/activity-inbox/activity-inbox-shell.d.mts +12 -0
- package/dist/components/activity-inbox/activity-inbox-shell.mjs +39 -0
- package/dist/components/activity-inbox/activity-inbox-shell.recipe.mjs +14 -0
- package/dist/components/activity-inbox/activity-inbox-sidebar.d.mts +6 -0
- package/dist/components/activity-inbox/activity-inbox-sidebar.mjs +22 -0
- package/dist/components/activity-inbox/activity-inbox-sidebar.recipe.mjs +22 -0
- package/dist/components/activity-inbox/activity-inbox-toolbar.d.mts +9 -0
- package/dist/components/activity-inbox/activity-inbox-toolbar.mjs +29 -0
- package/dist/components/activity-inbox/activity-inbox-toolbar.recipe.mjs +14 -0
- package/dist/components/activity-inbox/index.d.mts +4 -0
- package/dist/components/alert-dialog/alert-dialog.d.mts +41 -0
- package/dist/components/alert-dialog/alert-dialog.mjs +163 -0
- package/dist/components/alert-dialog/index.d.mts +2 -0
- package/dist/components/announcement-dialog/announcement-dialog.d.mts +18 -0
- package/dist/components/announcement-dialog/announcement-dialog.mjs +121 -0
- package/dist/components/announcement-dialog/index.d.mts +3 -0
- package/dist/components/app-rail/app-rail.d.mts +31 -0
- package/dist/components/app-rail/app-rail.mjs +126 -0
- package/dist/components/app-rail/app-rail.recipe.mjs +47 -0
- package/dist/components/app-rail/index.d.mts +2 -0
- package/dist/components/app-shell/app-shell.d.mts +27 -0
- package/dist/components/app-shell/app-shell.mjs +217 -0
- package/dist/components/app-shell/index.d.mts +2 -0
- package/dist/components/avatar/avatar.d.mts +169 -0
- package/dist/components/avatar/avatar.mjs +298 -0
- package/dist/components/avatar/index.d.mts +2 -0
- package/dist/components/badge/badge.d.mts +89 -0
- package/dist/components/badge/badge.mjs +203 -0
- package/dist/components/badge/index.d.mts +2 -0
- package/dist/components/banner/banner.d.mts +141 -0
- package/dist/components/banner/banner.mjs +228 -0
- package/dist/components/banner/index.d.mts +2 -0
- package/dist/components/button/button.d.mts +257 -0
- package/dist/components/button/button.mjs +177 -0
- package/dist/components/button/index.d.mts +2 -0
- package/dist/components/card/card.d.mts +21 -0
- package/dist/components/card/card.mjs +114 -0
- package/dist/components/card/card.recipe.d.mts +105 -0
- package/dist/components/card/card.recipe.mjs +67 -0
- package/dist/components/card/index.d.mts +2 -0
- package/dist/components/checkbox/checkbox-indicator.d.mts +92 -0
- package/dist/components/checkbox/checkbox-indicator.mjs +61 -0
- package/dist/components/checkbox/checkbox.d.mts +9 -0
- package/dist/components/checkbox/checkbox.mjs +40 -0
- package/dist/components/checkbox/index.d.mts +3 -0
- package/dist/components/choice-list/choice-list.d.mts +103 -0
- package/dist/components/choice-list/choice-list.mjs +301 -0
- package/dist/components/choice-list/choice-list.recipe.mjs +44 -0
- package/dist/components/choice-list/index.d.mts +2 -0
- package/dist/components/code-block/code-block.d.mts +30 -0
- package/dist/components/code-block/code-block.mjs +151 -0
- package/dist/components/code-block/code-block.recipe.mjs +47 -0
- package/dist/components/code-block/index.d.mts +2 -0
- package/dist/components/combobox/combobox.d.mts +69 -0
- package/dist/components/combobox/combobox.mjs +438 -0
- package/dist/components/combobox/index.d.mts +2 -0
- package/dist/components/combobox-select/combobox-select.d.mts +4 -0
- package/dist/components/combobox-select/combobox-select.list-side.mjs +16 -0
- package/dist/components/combobox-select/combobox-select.mjs +473 -0
- package/dist/components/combobox-select/combobox-select.options.mjs +21 -0
- package/dist/components/combobox-select/combobox-select.types.d.mts +83 -0
- package/dist/components/combobox-select/index.d.mts +3 -0
- package/dist/components/comment/comment-card.d.mts +40 -0
- package/dist/components/comment/comment-card.mjs +83 -0
- package/dist/components/comment/comment-entry.d.mts +24 -0
- package/dist/components/comment/comment-entry.mjs +75 -0
- package/dist/components/comment/comment-highlight.d.mts +18 -0
- package/dist/components/comment/comment-highlight.mjs +33 -0
- package/dist/components/comment/comment-margin-layout.d.mts +32 -0
- package/dist/components/comment/comment-margin-layout.mjs +44 -0
- package/dist/components/comment/comment-margin.d.mts +29 -0
- package/dist/components/comment/comment-margin.mjs +164 -0
- package/dist/components/comment/comment-marker.d.mts +16 -0
- package/dist/components/comment/comment-marker.mjs +24 -0
- package/dist/components/comment/comment.recipe.mjs +58 -0
- package/dist/components/comment/index.d.mts +8 -0
- package/dist/components/comment/use-comment-margin-fits.d.mts +16 -0
- package/dist/components/comment/use-comment-margin-fits.mjs +34 -0
- package/dist/components/composer/composer-attachment.recipe.mjs +85 -0
- package/dist/components/composer/composer-attachments-scroll-area.d.mts +5 -0
- package/dist/components/composer/composer-attachments-scroll-area.mjs +93 -0
- package/dist/components/composer/composer-attachments.d.mts +27 -0
- package/dist/components/composer/composer-attachments.mjs +147 -0
- package/dist/components/composer/composer-drop-overlay.d.mts +9 -0
- package/dist/components/composer/composer-drop-overlay.mjs +60 -0
- package/dist/components/composer/composer-drop-overlay.recipe.mjs +23 -0
- package/dist/components/composer/composer-root.d.mts +5 -0
- package/dist/components/composer/composer-root.mjs +18 -0
- package/dist/components/composer/composer-suggestion-list.d.mts +139 -0
- package/dist/components/composer/composer-suggestion-list.mjs +160 -0
- package/dist/components/composer/composer-toolbar-label.d.mts +5 -0
- package/dist/components/composer/composer-toolbar-label.mjs +24 -0
- package/dist/components/composer/composer.d.mts +20 -0
- package/dist/components/composer/composer.mjs +88 -0
- package/dist/components/composer/composer.recipe.mjs +29 -0
- package/dist/components/composer/index.d.mts +10 -0
- package/dist/components/composer/sortable-composer-attachments.d.mts +37 -0
- package/dist/components/composer/sortable-composer-attachments.mjs +247 -0
- package/dist/components/composer/use-composer-suggestions.d.mts +83 -0
- package/dist/components/composer/use-composer-suggestions.mjs +207 -0
- package/dist/components/context-menu/context-menu.d.mts +53 -0
- package/dist/components/context-menu/context-menu.mjs +275 -0
- package/dist/components/context-menu/index.d.mts +2 -0
- package/dist/components/conversation-panel/conversation-panel-empty-state.d.mts +9 -0
- package/dist/components/conversation-panel/conversation-panel-empty-state.mjs +57 -0
- package/dist/components/conversation-panel/conversation-panel.d.mts +20 -0
- package/dist/components/conversation-panel/conversation-panel.mjs +63 -0
- package/dist/components/conversation-panel/conversation-panel.recipe.mjs +15 -0
- package/dist/components/conversation-panel/index.d.mts +3 -0
- package/dist/components/copyable-code/copyable-code.d.mts +72 -0
- package/dist/components/copyable-code/copyable-code.mjs +153 -0
- package/dist/components/copyable-code/index.d.mts +2 -0
- package/dist/components/description-list/description-list.d.mts +59 -0
- package/dist/components/description-list/description-list.mjs +96 -0
- package/dist/components/description-list/index.d.mts +2 -0
- package/dist/components/dialog/dialog-sheet-context.mjs +58 -0
- package/dist/components/dialog/dialog-sheet.d.mts +31 -0
- package/dist/components/dialog/dialog-sheet.mjs +194 -0
- package/dist/components/dialog/dialog.d.mts +85 -0
- package/dist/components/dialog/dialog.mjs +371 -0
- package/dist/components/dialog/index.d.mts +3 -0
- package/dist/components/drag/drag-announcements.d.mts +72 -0
- package/dist/components/drag/drag-announcements.mjs +115 -0
- package/dist/components/drag/drag-lift.d.mts +100 -0
- package/dist/components/drag/drag-lift.mjs +276 -0
- package/dist/components/drag/drag-lists.d.mts +98 -0
- package/dist/components/drag/drag-lists.mjs +258 -0
- package/dist/components/drag/drag-sensors.d.mts +87 -0
- package/dist/components/drag/drag-sensors.mjs +169 -0
- package/dist/components/drag/drag.recipe.d.mts +7 -0
- package/dist/components/drag/drag.recipe.mjs +30 -0
- package/dist/components/drag/drop-placeholder.d.mts +41 -0
- package/dist/components/drag/drop-placeholder.mjs +161 -0
- package/dist/components/drag/index.d.mts +8 -0
- package/dist/components/drawer/drawer.d.mts +34 -0
- package/dist/components/drawer/drawer.mjs +202 -0
- package/dist/components/drawer/drawer.recipe.mjs +175 -0
- package/dist/components/drawer/index.d.mts +2 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.mts +62 -0
- package/dist/components/dropdown-menu/dropdown-menu.mjs +319 -0
- package/dist/components/dropdown-menu/index.d.mts +2 -0
- package/dist/components/ellipsis/ellipsis.d.mts +55 -0
- package/dist/components/ellipsis/ellipsis.mjs +320 -0
- package/dist/components/ellipsis/index.d.mts +3 -0
- package/dist/components/empty-state/empty-state.d.mts +15 -0
- package/dist/components/empty-state/empty-state.mjs +102 -0
- package/dist/components/empty-state/index.d.mts +2 -0
- package/dist/components/field/field.d.mts +79 -0
- package/dist/components/field/field.mjs +100 -0
- package/dist/components/field/index.d.mts +2 -0
- package/dist/components/file-preview/file-preview.d.mts +17 -0
- package/dist/components/file-preview/file-preview.mjs +210 -0
- package/dist/components/file-preview/file-preview.recipe.d.mts +99 -0
- package/dist/components/file-preview/file-preview.recipe.mjs +39 -0
- package/dist/components/file-preview/index.d.mts +2 -0
- package/dist/components/files/files.d.mts +35 -0
- package/dist/components/files/files.mjs +69 -0
- package/dist/components/files/files.recipe.mjs +40 -0
- package/dist/components/files/index.d.mts +2 -0
- package/dist/components/filter-chip/filter-chip.d.mts +25 -0
- package/dist/components/filter-chip/filter-chip.mjs +59 -0
- package/dist/components/filter-chip/index.d.mts +2 -0
- package/dist/components/float-button/float-button.d.mts +36 -0
- package/dist/components/float-button/float-button.mjs +116 -0
- package/dist/components/float-button/float-button.position.d.mts +6 -0
- package/dist/components/float-button/float-button.position.mjs +41 -0
- package/dist/components/float-button/index.d.mts +3 -0
- package/dist/components/form-section/form-section.d.mts +16 -0
- package/dist/components/form-section/form-section.mjs +53 -0
- package/dist/components/form-section/index.d.mts +2 -0
- package/dist/components/icon-tile/icon-tile.d.mts +97 -0
- package/dist/components/icon-tile/icon-tile.mjs +49 -0
- package/dist/components/icon-tile/index.d.mts +2 -0
- package/dist/components/icons/action-icons.d.mts +34 -0
- package/dist/components/icons/action-icons.mjs +383 -0
- package/dist/components/icons/conversation-icons.d.mts +12 -0
- package/dist/components/icons/conversation-icons.mjs +147 -0
- package/dist/components/icons/index.d.mts +4 -0
- package/dist/components/icons/object-icons.d.mts +6 -0
- package/dist/components/icons/object-icons.mjs +27 -0
- package/dist/components/inbox-item/inbox-item-leading-badge.d.mts +13 -0
- package/dist/components/inbox-item/inbox-item-leading-badge.mjs +27 -0
- package/dist/components/inbox-item/inbox-item-skeleton.d.mts +46 -0
- package/dist/components/inbox-item/inbox-item-skeleton.mjs +89 -0
- package/dist/components/inbox-item/inbox-item-skeleton.recipe.mjs +20 -0
- package/dist/components/inbox-item/inbox-item.d.mts +71 -0
- package/dist/components/inbox-item/inbox-item.mjs +276 -0
- package/dist/components/inbox-item/inbox-item.recipe.mjs +137 -0
- package/dist/components/inbox-item/index.d.mts +2 -0
- package/dist/components/inline-code/index.d.mts +2 -0
- package/dist/components/inline-code/inline-code.d.mts +8 -0
- package/dist/components/inline-code/inline-code.mjs +30 -0
- package/dist/components/input/index.d.mts +2 -0
- package/dist/components/input/input.d.mts +16 -0
- package/dist/components/input/input.mjs +20 -0
- package/dist/components/input/input.recipe.mjs +12 -0
- package/dist/components/input-group/index.d.mts +2 -0
- package/dist/components/input-group/input-group.d.mts +93 -0
- package/dist/components/input-group/input-group.mjs +178 -0
- package/dist/components/kbd/index.d.mts +2 -0
- package/dist/components/kbd/kbd.d.mts +7 -0
- package/dist/components/kbd/kbd.mjs +34 -0
- package/dist/components/label/index.d.mts +2 -0
- package/dist/components/label/label.d.mts +60 -0
- package/dist/components/label/label.mjs +75 -0
- package/dist/components/legacy-task-panel/index.d.mts +2 -0
- package/dist/components/legacy-task-panel/legacy-task-panel.d.mts +57 -0
- package/dist/components/legacy-task-panel/legacy-task-panel.mjs +234 -0
- package/dist/components/legacy-task-panel/legacy-task-panel.recipe.mjs +30 -0
- package/dist/components/lightbox/index.d.mts +2 -0
- package/dist/components/lightbox/lightbox.d.mts +55 -0
- package/dist/components/lightbox/lightbox.mjs +336 -0
- package/dist/components/list-row/index.d.mts +2 -0
- package/dist/components/list-row/list-row-skeleton.d.mts +21 -0
- package/dist/components/list-row/list-row-skeleton.mjs +43 -0
- package/dist/components/list-row/list-row.d.mts +66 -0
- package/dist/components/list-row/list-row.mjs +167 -0
- package/dist/components/list-row/list-row.recipe.d.mts +126 -0
- package/dist/components/list-row/list-row.recipe.mjs +94 -0
- package/dist/components/live-agent-activity-bar/index.d.mts +2 -0
- package/dist/components/live-agent-activity-bar/live-agent-activity-bar.d.mts +25 -0
- package/dist/components/live-agent-activity-bar/live-agent-activity-bar.mjs +107 -0
- package/dist/components/logo/index.d.mts +2 -0
- package/dist/components/logo/raft-logo.d.mts +9 -0
- package/dist/components/logo/raft-logo.mjs +63 -0
- package/dist/components/markdown/index.d.mts +2 -0
- package/dist/components/markdown/markdown-parts.d.mts +54 -0
- package/dist/components/markdown/markdown-parts.mjs +153 -0
- package/dist/components/markdown/markdown.recipe.mjs +77 -0
- package/dist/components/message-action-card/index.d.mts +2 -0
- package/dist/components/message-action-card/message-action-card-content.recipe.mjs +50 -0
- package/dist/components/message-action-card/message-action-card.d.mts +95 -0
- package/dist/components/message-action-card/message-action-card.mjs +298 -0
- package/dist/components/message-action-card/message-action-card.recipe.mjs +47 -0
- package/dist/components/message-attachment/index.d.mts +5 -0
- package/dist/components/message-attachment/message-attachment.d.mts +27 -0
- package/dist/components/message-attachment/message-attachment.mjs +129 -0
- package/dist/components/message-attachment/message-attachment.recipe.mjs +36 -0
- package/dist/components/message-attachment/message-image-gallery-rows.d.mts +47 -0
- package/dist/components/message-attachment/message-image-gallery-rows.mjs +55 -0
- package/dist/components/message-attachment/message-image-gallery.d.mts +32 -0
- package/dist/components/message-attachment/message-image-gallery.mjs +105 -0
- package/dist/components/message-attachment/message-image-gallery.recipe.mjs +61 -0
- package/dist/components/message-attachment/message-video-preview.d.mts +19 -0
- package/dist/components/message-attachment/message-video-preview.mjs +92 -0
- package/dist/components/message-attachment/message-video-preview.recipe.mjs +33 -0
- package/dist/components/message-embed/index.d.mts +2 -0
- package/dist/components/message-embed/message-embed.d.mts +12 -0
- package/dist/components/message-embed/message-embed.mjs +42 -0
- package/dist/components/message-embed/message-embed.recipe.mjs +14 -0
- package/dist/components/message-forwarded-bundle/index.d.mts +2 -0
- package/dist/components/message-forwarded-bundle/message-forwarded-bundle.d.mts +92 -0
- package/dist/components/message-forwarded-bundle/message-forwarded-bundle.mjs +324 -0
- package/dist/components/message-forwarded-bundle/message-forwarded-bundle.recipe.mjs +81 -0
- package/dist/components/message-item/index.d.mts +13 -0
- package/dist/components/message-item/message-footer.d.mts +20 -0
- package/dist/components/message-item/message-footer.mjs +54 -0
- package/dist/components/message-item/message-footer.recipe.mjs +46 -0
- package/dist/components/message-item/message-item-content.d.mts +22 -0
- package/dist/components/message-item/message-item-content.mjs +81 -0
- package/dist/components/message-item/message-item-delegated.d.mts +38 -0
- package/dist/components/message-item/message-item-delegated.mjs +72 -0
- package/dist/components/message-item/message-item-gutter.d.mts +10 -0
- package/dist/components/message-item/message-item-gutter.mjs +41 -0
- package/dist/components/message-item/message-item-header.d.mts +29 -0
- package/dist/components/message-item/message-item-header.mjs +107 -0
- package/dist/components/message-item/message-item-label.mjs +113 -0
- package/dist/components/message-item/message-item-root.d.mts +25 -0
- package/dist/components/message-item/message-item-root.mjs +39 -0
- package/dist/components/message-item/message-item-toolbar.d.mts +9 -0
- package/dist/components/message-item/message-item-toolbar.mjs +131 -0
- package/dist/components/message-item/message-item.recipe.d.mts +101 -0
- package/dist/components/message-item/message-item.recipe.mjs +114 -0
- package/dist/components/message-item/message-multi-select.d.mts +15 -0
- package/dist/components/message-item/message-multi-select.mjs +49 -0
- package/dist/components/message-item/message-multi-select.recipe.mjs +23 -0
- package/dist/components/message-item/message-reaction.d.mts +39 -0
- package/dist/components/message-item/message-reaction.mjs +188 -0
- package/dist/components/message-item/message-reaction.recipe.mjs +76 -0
- package/dist/components/message-item/message-reference.d.mts +50 -0
- package/dist/components/message-item/message-reference.mjs +111 -0
- package/dist/components/message-item/message-reference.recipe.d.mts +6 -0
- package/dist/components/message-item/message-reference.recipe.mjs +63 -0
- package/dist/components/message-item/message-text-selection-toolbar.d.mts +24 -0
- package/dist/components/message-item/message-text-selection-toolbar.mjs +13 -0
- package/dist/components/message-list/index.d.mts +4 -0
- package/dist/components/message-list/message-list-jump.d.mts +21 -0
- package/dist/components/message-list/message-list-jump.mjs +73 -0
- package/dist/components/message-list/message-list-markers.d.mts +13 -0
- package/dist/components/message-list/message-list-markers.mjs +70 -0
- package/dist/components/message-list/message-list.d.mts +7 -0
- package/dist/components/message-list/message-list.mjs +52 -0
- package/dist/components/message-list/message-list.recipe.mjs +54 -0
- package/dist/components/message-quoted-preview/index.d.mts +2 -0
- package/dist/components/message-quoted-preview/message-quoted-preview.d.mts +40 -0
- package/dist/components/message-quoted-preview/message-quoted-preview.mjs +144 -0
- package/dist/components/message-quoted-preview/message-quoted-preview.recipe.mjs +38 -0
- package/dist/components/message-replies/index.d.mts +2 -0
- package/dist/components/message-replies/message-replies.d.mts +17 -0
- package/dist/components/message-replies/message-replies.mjs +79 -0
- package/dist/components/message-replies/message-replies.recipe.mjs +25 -0
- package/dist/components/message-translation/index.d.mts +2 -0
- package/dist/components/message-translation/message-translation.d.mts +20 -0
- package/dist/components/message-translation/message-translation.mjs +64 -0
- package/dist/components/message-translation/message-translation.recipe.mjs +27 -0
- package/dist/components/meter/index.d.mts +2 -0
- package/dist/components/meter/meter.d.mts +107 -0
- package/dist/components/meter/meter.mjs +118 -0
- package/dist/components/mobile-nav/index.d.mts +3 -0
- package/dist/components/mobile-nav/mobile-nav-server.d.mts +71 -0
- package/dist/components/mobile-nav/mobile-nav-server.mjs +287 -0
- package/dist/components/mobile-nav/mobile-nav.d.mts +12 -0
- package/dist/components/mobile-nav/mobile-nav.mjs +73 -0
- package/dist/components/mode-bar/index.d.mts +2 -0
- package/dist/components/mode-bar/mode-bar.d.mts +33 -0
- package/dist/components/mode-bar/mode-bar.mjs +115 -0
- package/dist/components/notification-center/index.d.mts +2 -0
- package/dist/components/notification-center/notification-center.d.mts +225 -0
- package/dist/components/notification-center/notification-center.mjs +340 -0
- package/dist/components/panel/index.d.mts +7 -0
- package/dist/components/panel/panel-action.d.mts +15 -0
- package/dist/components/panel/panel-action.mjs +23 -0
- package/dist/components/panel/panel-action.recipe.mjs +40 -0
- package/dist/components/panel/panel-header.d.mts +34 -0
- package/dist/components/panel/panel-header.mjs +135 -0
- package/dist/components/panel/panel-header.recipe.mjs +78 -0
- package/dist/components/panel/panel-notice.d.mts +16 -0
- package/dist/components/panel/panel-notice.mjs +77 -0
- package/dist/components/panel/panel-split-action.d.mts +34 -0
- package/dist/components/panel/panel-split-action.mjs +69 -0
- package/dist/components/panel/panel-split-action.recipe.mjs +53 -0
- package/dist/components/panel/panel-toggle-action.d.mts +6 -0
- package/dist/components/panel/panel-toggle-action.mjs +15 -0
- package/dist/components/panel/panel.d.mts +25 -0
- package/dist/components/panel/panel.mjs +96 -0
- package/dist/components/panel/panel.recipe.mjs +24 -0
- package/dist/components/picker-trigger-button/index.d.mts +2 -0
- package/dist/components/picker-trigger-button/picker-trigger-button.d.mts +7 -0
- package/dist/components/picker-trigger-button/picker-trigger-button.mjs +36 -0
- package/dist/components/popover/index.d.mts +2 -0
- package/dist/components/popover/popover.d.mts +41 -0
- package/dist/components/popover/popover.mjs +184 -0
- package/dist/components/preview-card/index.d.mts +2 -0
- package/dist/components/preview-card/preview-card.d.mts +43 -0
- package/dist/components/preview-card/preview-card.mjs +197 -0
- package/dist/components/profile-panel/index.d.mts +2 -0
- package/dist/components/profile-panel/profile-panel.d.mts +14 -0
- package/dist/components/profile-panel/profile-panel.mjs +46 -0
- package/dist/components/profile-panel/profile-panel.recipe.mjs +14 -0
- package/dist/components/progress/index.d.mts +2 -0
- package/dist/components/progress/progress.d.mts +119 -0
- package/dist/components/progress/progress.mjs +139 -0
- package/dist/components/pull-to-refresh/index.d.mts +4 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-gesture.d.mts +30 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-gesture.mjs +134 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-indicator.d.mts +21 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-indicator.mjs +153 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-material-progress.mjs +150 -0
- package/dist/components/pull-to-refresh/use-pull-to-refresh.d.mts +55 -0
- package/dist/components/pull-to-refresh/use-pull-to-refresh.mjs +156 -0
- package/dist/components/radio-group/index.d.mts +2 -0
- package/dist/components/radio-group/radio-group.d.mts +14 -0
- package/dist/components/radio-group/radio-group.mjs +59 -0
- package/dist/components/resizable/index.d.mts +2 -0
- package/dist/components/resizable/resizable.d.mts +15 -0
- package/dist/components/resizable/resizable.mjs +39 -0
- package/dist/components/resizable/resizable.recipe.mjs +24 -0
- package/dist/components/scroll-area/index.d.mts +2 -0
- package/dist/components/scroll-area/scroll-area.d.mts +17 -0
- package/dist/components/scroll-area/scroll-area.mjs +55 -0
- package/dist/components/scroll-area/scroll-area.recipe.mjs +23 -0
- package/dist/components/search/index.d.mts +6 -0
- package/dist/components/search/search-entity.d.mts +24 -0
- package/dist/components/search/search-entity.mjs +106 -0
- package/dist/components/search/search-entity.recipe.mjs +41 -0
- package/dist/components/search/search-message.d.mts +25 -0
- package/dist/components/search/search-message.mjs +115 -0
- package/dist/components/search/search-message.recipe.mjs +32 -0
- package/dist/components/search/search-thread.d.mts +17 -0
- package/dist/components/search/search-thread.mjs +79 -0
- package/dist/components/search/search-thread.recipe.mjs +16 -0
- package/dist/components/search/search-trigger.d.mts +15 -0
- package/dist/components/search/search-trigger.mjs +59 -0
- package/dist/components/search/search.d.mts +23 -0
- package/dist/components/search/search.mjs +88 -0
- package/dist/components/search/search.recipe.mjs +22 -0
- package/dist/components/segmented-control/index.d.mts +2 -0
- package/dist/components/segmented-control/segmented-control.d.mts +38 -0
- package/dist/components/segmented-control/segmented-control.mjs +306 -0
- package/dist/components/select/index.d.mts +2 -0
- package/dist/components/select/select.d.mts +95 -0
- package/dist/components/select/select.mjs +483 -0
- package/dist/components/separator/index.d.mts +2 -0
- package/dist/components/separator/separator.d.mts +10 -0
- package/dist/components/separator/separator.mjs +49 -0
- package/dist/components/sidebar/index.d.mts +5 -0
- package/dist/components/sidebar/sidebar-item.d.mts +64 -0
- package/dist/components/sidebar/sidebar-item.mjs +201 -0
- package/dist/components/sidebar/sidebar-item.recipe.mjs +100 -0
- package/dist/components/sidebar/sidebar-menu.d.mts +13 -0
- package/dist/components/sidebar/sidebar-menu.mjs +67 -0
- package/dist/components/sidebar/sidebar-menu.recipe.mjs +22 -0
- package/dist/components/sidebar/sidebar-section.d.mts +41 -0
- package/dist/components/sidebar/sidebar-section.mjs +164 -0
- package/dist/components/sidebar/sidebar-section.recipe.mjs +45 -0
- package/dist/components/sidebar/sidebar.d.mts +17 -0
- package/dist/components/sidebar/sidebar.mjs +149 -0
- package/dist/components/sidebar/sidebar.recipe.mjs +37 -0
- package/dist/components/skeleton/index.d.mts +2 -0
- package/dist/components/skeleton/skeleton.d.mts +50 -0
- package/dist/components/skeleton/skeleton.mjs +29 -0
- package/dist/components/spinner/index.d.mts +2 -0
- package/dist/components/spinner/spinner.d.mts +77 -0
- package/dist/components/spinner/spinner.mjs +118 -0
- package/dist/components/status/index.d.mts +2 -0
- package/dist/components/status/status.d.mts +143 -0
- package/dist/components/status/status.mjs +56 -0
- package/dist/components/steps/index.d.mts +3 -0
- package/dist/components/steps/otter-indicator.d.mts +17 -0
- package/dist/components/steps/otter-indicator.mjs +331 -0
- package/dist/components/steps/steps.d.mts +50 -0
- package/dist/components/steps/steps.mjs +174 -0
- package/dist/components/switch/index.d.mts +2 -0
- package/dist/components/switch/switch.d.mts +9 -0
- package/dist/components/switch/switch.mjs +50 -0
- package/dist/components/system-message/index.d.mts +2 -0
- package/dist/components/system-message/system-message.d.mts +27 -0
- package/dist/components/system-message/system-message.mjs +113 -0
- package/dist/components/system-message/system-message.recipe.mjs +34 -0
- package/dist/components/table/index.d.mts +2 -0
- package/dist/components/table/table.d.mts +35 -0
- package/dist/components/table/table.mjs +102 -0
- package/dist/components/table/table.recipe.mjs +31 -0
- package/dist/components/tabs/index.d.mts +2 -0
- package/dist/components/tabs/tabs.d.mts +185 -0
- package/dist/components/tabs/tabs.mjs +528 -0
- package/dist/components/task-board/index.d.mts +2 -0
- package/dist/components/task-board/task-board-column.recipe.mjs +46 -0
- package/dist/components/task-board/task-board.d.mts +40 -0
- package/dist/components/task-board/task-board.mjs +155 -0
- package/dist/components/task-card/index.d.mts +2 -0
- package/dist/components/task-card/task-card-status.recipe.mjs +17 -0
- package/dist/components/task-card/task-card.d.mts +30 -0
- package/dist/components/task-card/task-card.mjs +141 -0
- package/dist/components/task-card/task-card.recipe.mjs +39 -0
- package/dist/components/task-dnd/index.d.mts +2 -0
- package/dist/components/task-dnd/task-dnd.d.mts +75 -0
- package/dist/components/task-dnd/task-dnd.mjs +341 -0
- package/dist/components/task-dnd/task-dnd.recipe.mjs +20 -0
- package/dist/components/task-list/index.d.mts +2 -0
- package/dist/components/task-list/task-list-section.recipe.mjs +37 -0
- package/dist/components/task-list/task-list.d.mts +34 -0
- package/dist/components/task-list/task-list.mjs +119 -0
- package/dist/components/tasks/index.d.mts +7 -0
- package/dist/components/tasks/task-chip.d.mts +14 -0
- package/dist/components/tasks/task-chip.mjs +81 -0
- package/dist/components/tasks/task-loading.d.mts +7 -0
- package/dist/components/tasks/task-loading.mjs +32 -0
- package/dist/components/tasks/task-loading.recipe.mjs +8 -0
- package/dist/components/tasks/task-status-badge.d.mts +24 -0
- package/dist/components/tasks/task-status-badge.mjs +24 -0
- package/dist/components/tasks/task-status-icon.d.mts +13 -0
- package/dist/components/tasks/task-status-icon.mjs +90 -0
- package/dist/components/tasks/task-status.recipe.d.mts +62 -0
- package/dist/components/tasks/task-status.recipe.mjs +33 -0
- package/dist/components/tasks/tasks-panel.d.mts +22 -0
- package/dist/components/tasks/tasks-panel.mjs +114 -0
- package/dist/components/tasks/tasks-panel.recipe.mjs +36 -0
- package/dist/components/text/index.d.mts +2 -0
- package/dist/components/text/text.d.mts +186 -0
- package/dist/components/text/text.mjs +114 -0
- package/dist/components/text-link/index.d.mts +2 -0
- package/dist/components/text-link/text-link.d.mts +36 -0
- package/dist/components/text-link/text-link.mjs +60 -0
- package/dist/components/text-selection-toolbar/index.d.mts +3 -0
- package/dist/components/text-selection-toolbar/text-selection-anchor.d.mts +22 -0
- package/dist/components/text-selection-toolbar/text-selection-anchor.mjs +106 -0
- package/dist/components/text-selection-toolbar/text-selection-toolbar.d.mts +20 -0
- package/dist/components/text-selection-toolbar/text-selection-toolbar.mjs +41 -0
- package/dist/components/text-selection-toolbar/text-selection-toolbar.recipe.mjs +19 -0
- package/dist/components/textarea/index.d.mts +2 -0
- package/dist/components/textarea/textarea.d.mts +16 -0
- package/dist/components/textarea/textarea.mjs +62 -0
- package/dist/components/thread-panel/index.d.mts +2 -0
- package/dist/components/thread-panel/thread-panel.d.mts +31 -0
- package/dist/components/thread-panel/thread-panel.mjs +162 -0
- package/dist/components/thread-panel/thread-panel.recipe.mjs +36 -0
- package/dist/components/timeline/index.d.mts +2 -0
- package/dist/components/timeline/timeline.d.mts +44 -0
- package/dist/components/timeline/timeline.mjs +81 -0
- package/dist/components/toast/index.d.mts +2 -0
- package/dist/components/toast/toast.d.mts +263 -0
- package/dist/components/toast/toast.mjs +556 -0
- package/dist/components/toggle-group/index.d.mts +2 -0
- package/dist/components/toggle-group/toggle-group.d.mts +15 -0
- package/dist/components/toggle-group/toggle-group.mjs +64 -0
- package/dist/components/tooltip/index.d.mts +2 -0
- package/dist/components/tooltip/tooltip.d.mts +18 -0
- package/dist/components/tooltip/tooltip.mjs +197 -0
- package/dist/components/virtual-list/ItemColumns.mjs +37 -0
- package/dist/components/virtual-list/VirtualList.d.mts +4 -0
- package/dist/components/virtual-list/VirtualList.mjs +1401 -0
- package/dist/components/virtual-list/VirtualListContext.mjs +5 -0
- package/dist/components/virtual-list/hooks/use-event-callback.mjs +10 -0
- package/dist/components/virtual-list/hooks/use-ios-momentum-compensation.mjs +148 -0
- package/dist/components/virtual-list/hooks/use-keyboard-scroll.mjs +42 -0
- package/dist/components/virtual-list/hooks/use-latest-ref.mjs +10 -0
- package/dist/components/virtual-list/hooks/use-layout-effect-with-previous.mjs +16 -0
- package/dist/components/virtual-list/hooks/use-memo-with-previous.mjs +22 -0
- package/dist/components/virtual-list/hooks/use-non-passive-wheel.mjs +23 -0
- package/dist/components/virtual-list/hooks/use-non-virtual-content-resize.mjs +28 -0
- package/dist/components/virtual-list/hooks/use-scroll-anchor.mjs +55 -0
- package/dist/components/virtual-list/index.d.mts +5 -0
- package/dist/components/virtual-list/public-types.d.mts +341 -0
- package/dist/components/virtual-list/resize-observer/ResizeObserverWrapper.d.mts +5 -0
- package/dist/components/virtual-list/resize-observer/ResizeObserverWrapper.mjs +70 -0
- package/dist/components/virtual-list/resize-observer/resize-observer-delegate.d.mts +6 -0
- package/dist/components/virtual-list/resize-observer/resize-observer-delegate.mjs +54 -0
- package/dist/components/virtual-list/utils/align.mjs +19 -0
- package/dist/components/virtual-list/utils/constants.mjs +30 -0
- package/dist/components/virtual-list/utils/fenwick-tree.mjs +66 -0
- package/dist/components/virtual-list/utils/items-anchor.mjs +49 -0
- package/dist/components/virtual-list/utils/measure.mjs +77 -0
- package/dist/components/virtual-list/utils/platform.mjs +39 -0
- package/dist/components/virtual-list/utils/range.mjs +103 -0
- package/dist/components/virtual-list/utils/size-cache.mjs +35 -0
- package/dist/components/workspace-button/index.d.mts +2 -0
- package/dist/components/workspace-button/workspace-button.d.mts +9 -0
- package/dist/components/workspace-button/workspace-button.mjs +28 -0
- package/dist/index.d.mts +239 -4864
- package/dist/index.mjs +142 -17054
- package/dist/lib/chip-remove.mjs +17 -0
- package/dist/lib/data-attributes.d.mts +5 -0
- package/dist/lib/decision-width.mjs +9 -0
- package/dist/lib/default-native-button.mjs +8 -0
- package/dist/lib/desktop-media.mjs +10 -0
- package/dist/lib/drag-escape.mjs +37 -0
- package/dist/lib/frame-insets.mjs +127 -0
- package/dist/lib/head-edges.mjs +44 -0
- package/dist/lib/hud-text-action.mjs +10 -0
- package/dist/lib/inline-chip.mjs +30 -0
- package/dist/lib/input-modality.d.mts +36 -0
- package/dist/lib/input-modality.mjs +186 -0
- package/dist/lib/list-cell.mjs +21 -0
- package/dist/lib/located.d.mts +25 -0
- package/dist/lib/located.mjs +28 -0
- package/dist/lib/overlay-depth.d.mts +42 -0
- package/dist/lib/overlay-depth.mjs +59 -0
- package/dist/lib/phone-media.mjs +24 -0
- package/dist/lib/presence.d.mts +16 -0
- package/dist/lib/presence.mjs +16 -0
- package/dist/lib/row-tone.d.mts +8 -0
- package/dist/lib/search-hit.mjs +18 -0
- package/dist/lib/stacked-actions.mjs +112 -0
- package/dist/lib/styled-props.d.mts +15 -0
- package/dist/lib/tap-activation.mjs +133 -0
- package/dist/lib/theme/theme-context.d.mts +10 -0
- package/dist/lib/theme/theme-context.mjs +9 -0
- package/dist/lib/theme/theme-provider.d.mts +23 -0
- package/dist/lib/theme/theme-provider.mjs +61 -0
- package/dist/lib/theme/theme-scope.mjs +19 -0
- package/dist/lib/theme/use-theme.d.mts +5 -0
- package/dist/lib/theme/use-theme.mjs +9 -0
- package/dist/lib/touch-drag.d.mts +55 -0
- package/dist/lib/touch-drag.mjs +151 -0
- package/dist/lib/truncation.d.mts +26 -0
- package/dist/lib/truncation.mjs +153 -0
- package/dist/lib/tv.d.mts +2 -0
- package/dist/lib/tv.mjs +14 -0
- package/dist/lib/use-copy-to-clipboard.mjs +58 -0
- package/dist/lib/use-merged-ref.mjs +60 -0
- package/dist/lib/use-mobile-viewport.mjs +17 -0
- package/dist/lib/use-overflow-title.mjs +49 -0
- package/dist/lib/use-scrollbar-size.d.mts +16 -0
- package/dist/lib/use-scrollbar-size.mjs +46 -0
- package/dist/lib/use-truncated.d.mts +20 -0
- package/dist/lib/use-truncated.mjs +34 -0
- package/dist/lib/without-children.d.mts +8 -0
- package/dist/wip.d.mts +61 -1190
- package/dist/wip.mjs +43 -2970
- package/package.json +8 -1
- package/dist/index-C3ymUW98.d.mts +0 -1816
- package/dist/mode-bar-tGnYByXp.mjs +0 -7564
- package/dist/style.css +0 -1395
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Announcements, ScreenReaderInstructions, UniqueIdentifier } from "@dnd-kit/core";
|
|
2
|
+
//#region src/components/drag/drag-announcements.d.ts
|
|
3
|
+
/** A place in words: the list or area's name, and the item's position in it when it has one. */
|
|
4
|
+
export type DragPlace = {
|
|
5
|
+
/**
|
|
6
|
+
* The list or area, as people see it: "Pinned", "In Review", "the right
|
|
7
|
+
* column". Empty when it has no name (an unlabelled tab row): then only the
|
|
8
|
+
* position is said.
|
|
9
|
+
*/
|
|
10
|
+
place: string;
|
|
11
|
+
/** 1-based. */
|
|
12
|
+
position?: number;
|
|
13
|
+
count?: number;
|
|
14
|
+
};
|
|
15
|
+
export type DragNamed = {
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* What a screen reader hears during a drag, by name and never by id
|
|
20
|
+
* (design/patterns/drag-and-drop.md#screen-readers). The defaults are English;
|
|
21
|
+
* pass your translations, built from the same details.
|
|
22
|
+
*/
|
|
23
|
+
export type DragMessages = {
|
|
24
|
+
/** Read with every draggable item. */
|
|
25
|
+
instructions: string;
|
|
26
|
+
pickedUp: (details: DragNamed & Partial<DragPlace>) => string;
|
|
27
|
+
over: (details: DragNamed & DragPlace) => string;
|
|
28
|
+
/** The hand is over no place: a drop now puts the item back. */
|
|
29
|
+
notOver: (details: DragNamed) => string;
|
|
30
|
+
refused: (details: DragNamed & {
|
|
31
|
+
place: string;
|
|
32
|
+
reason: string;
|
|
33
|
+
}) => string;
|
|
34
|
+
dropped: (details: DragNamed & DragPlace) => string;
|
|
35
|
+
cancelled: (details: DragNamed & Partial<DragPlace>) => string;
|
|
36
|
+
/** A drop on a refused place: why, then the item back home (`place` is its home). */
|
|
37
|
+
refusedDrop: (details: DragNamed & Partial<DragPlace> & {
|
|
38
|
+
reason: string;
|
|
39
|
+
}) => string;
|
|
40
|
+
};
|
|
41
|
+
export declare const DEFAULT_DRAG_MESSAGES: DragMessages;
|
|
42
|
+
/** Merges your messages over the English defaults. */
|
|
43
|
+
export declare function dragMessages(messages?: Partial<DragMessages>): DragMessages;
|
|
44
|
+
export type DragAnnouncementSource = {
|
|
45
|
+
/**
|
|
46
|
+
* The dragged item's name as people see it: "#launch-week", "Task #25",
|
|
47
|
+
* "Wug". Never an id: return an empty string when there is no name, and
|
|
48
|
+
* the drag is not announced.
|
|
49
|
+
*/
|
|
50
|
+
name: (activeId: UniqueIdentifier) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Where the item would land with the hand over `overId`, or where it is
|
|
53
|
+
* when `overId` is null (on pick-up and after a cancel). Return null for
|
|
54
|
+
* "nowhere". Without it, a move over a place and a drop on one are not
|
|
55
|
+
* announced (pick-up, refusals and cancels still are).
|
|
56
|
+
*/
|
|
57
|
+
place?: (activeId: UniqueIdentifier, overId: UniqueIdentifier | null) => DragPlace | null;
|
|
58
|
+
/** Why `overId` won't take the item, or null when it will. */
|
|
59
|
+
refusal?: (activeId: UniqueIdentifier, overId: UniqueIdentifier) => {
|
|
60
|
+
place: string;
|
|
61
|
+
reason: string;
|
|
62
|
+
} | null;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* dnd-kit `announcements` that speak by name, from your names and places,
|
|
66
|
+
* in your language. Pass them with `dragInstructions` as a `DndContext`'s
|
|
67
|
+
* `accessibility`, or to `TaskDndProvider`'s.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createDragAnnouncements(source: DragAnnouncementSource, messages?: Partial<DragMessages>): Announcements;
|
|
70
|
+
/** dnd-kit `screenReaderInstructions`: Space, not Enter, in your language. */
|
|
71
|
+
export declare function dragInstructions(messages?: Partial<DragMessages>): ScreenReaderInstructions;
|
|
72
|
+
//#endregion
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
//#region src/components/drag/drag-announcements.ts
|
|
2
|
+
function at({ place, position, count }) {
|
|
3
|
+
const where = position == null ? "" : count == null ? `position ${position}` : `position ${position} of ${count}`;
|
|
4
|
+
if (!place) return where;
|
|
5
|
+
return where ? `${place}, ${where}` : place;
|
|
6
|
+
}
|
|
7
|
+
function sentence(text) {
|
|
8
|
+
return /[.!?]$/.test(text) ? text : `${text}.`;
|
|
9
|
+
}
|
|
10
|
+
const DEFAULT_DRAG_MESSAGES = {
|
|
11
|
+
instructions: "To pick up an item, press Space. Use the arrow keys to move it, Space to drop it, Escape to cancel.",
|
|
12
|
+
pickedUp: ({ name, ...place }) => at(place) ? `Picked up ${name}. Over ${at(place)}.` : `Picked up ${name}.`,
|
|
13
|
+
over: ({ name: _name, ...place }) => `Over ${at(place)}.`,
|
|
14
|
+
notOver: () => "Not over a place. Dropping now cancels.",
|
|
15
|
+
refused: ({ name, place, reason }) => `${name} can't go to ${place}. ${reason}`,
|
|
16
|
+
dropped: ({ name, ...place }) => `Dropped ${name} in ${at(place)}.`,
|
|
17
|
+
cancelled: ({ name, ...place }) => at(place) ? `Cancelled. ${name} is back in ${at(place)}.` : `Cancelled. ${name} is back.`,
|
|
18
|
+
refusedDrop: ({ reason, ...rest }) => `${sentence(reason)} ${DEFAULT_DRAG_MESSAGES.cancelled(rest)}`
|
|
19
|
+
};
|
|
20
|
+
/** Merges your messages over the English defaults. */
|
|
21
|
+
function dragMessages(messages) {
|
|
22
|
+
return messages ? {
|
|
23
|
+
...DEFAULT_DRAG_MESSAGES,
|
|
24
|
+
...messages
|
|
25
|
+
} : DEFAULT_DRAG_MESSAGES;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* dnd-kit `announcements` that speak by name, from your names and places,
|
|
29
|
+
* in your language. Pass them with `dragInstructions` as a `DndContext`'s
|
|
30
|
+
* `accessibility`, or to `TaskDndProvider`'s.
|
|
31
|
+
*/
|
|
32
|
+
function createDragAnnouncements(source, messages) {
|
|
33
|
+
const say = dragMessages(messages);
|
|
34
|
+
let lastPlace = null;
|
|
35
|
+
const placeKey = (place) => place ? JSON.stringify(place) : null;
|
|
36
|
+
const describeOver = (name, activeId, overId) => {
|
|
37
|
+
if (overId == null) {
|
|
38
|
+
lastPlace = null;
|
|
39
|
+
return say.notOver({ name });
|
|
40
|
+
}
|
|
41
|
+
const refused = source.refusal?.(activeId, overId);
|
|
42
|
+
if (refused) {
|
|
43
|
+
lastPlace = null;
|
|
44
|
+
return say.refused({
|
|
45
|
+
name,
|
|
46
|
+
...refused
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (!source.place) return void 0;
|
|
50
|
+
const place = source.place(activeId, overId);
|
|
51
|
+
if (!place) {
|
|
52
|
+
lastPlace = null;
|
|
53
|
+
return say.notOver({ name });
|
|
54
|
+
}
|
|
55
|
+
const key = placeKey(place);
|
|
56
|
+
if (key === lastPlace) return void 0;
|
|
57
|
+
lastPlace = key;
|
|
58
|
+
return say.over({
|
|
59
|
+
name,
|
|
60
|
+
...place
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const named = (speak) => (event) => {
|
|
64
|
+
const name = source.name(event.active.id);
|
|
65
|
+
return name ? speak(name, event) : void 0;
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
onDragStart: named((name, { active }) => {
|
|
69
|
+
const home = source.place?.(active.id, null);
|
|
70
|
+
lastPlace = placeKey(home);
|
|
71
|
+
return say.pickedUp({
|
|
72
|
+
name,
|
|
73
|
+
...home
|
|
74
|
+
});
|
|
75
|
+
}),
|
|
76
|
+
onDragOver: named((name, { active, over }) => describeOver(name, active.id, over?.id ?? null)),
|
|
77
|
+
onDragMove: () => void 0,
|
|
78
|
+
onDragEnd: named((name, { active, over }) => {
|
|
79
|
+
const refused = over == null ? null : source.refusal?.(active.id, over.id);
|
|
80
|
+
if (over != null && !refused && !source.place) return void 0;
|
|
81
|
+
const place = over == null || refused ? null : source.place?.(active.id, over.id);
|
|
82
|
+
if (place) return say.dropped({
|
|
83
|
+
name,
|
|
84
|
+
...place
|
|
85
|
+
});
|
|
86
|
+
const home = source.place?.(active.id, null);
|
|
87
|
+
return refused ? say.refusedDrop({
|
|
88
|
+
name,
|
|
89
|
+
reason: refused.reason,
|
|
90
|
+
...home
|
|
91
|
+
}) : say.cancelled({
|
|
92
|
+
name,
|
|
93
|
+
...home
|
|
94
|
+
});
|
|
95
|
+
}),
|
|
96
|
+
onDragCancel: named((name, { active }) => say.cancelled({
|
|
97
|
+
name,
|
|
98
|
+
...source.place?.(active.id, null)
|
|
99
|
+
}))
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Announcements that say nothing, for a surface that announces on its own or has no names. */
|
|
103
|
+
const SILENT_DRAG_ANNOUNCEMENTS = {
|
|
104
|
+
onDragStart: () => void 0,
|
|
105
|
+
onDragMove: () => void 0,
|
|
106
|
+
onDragOver: () => void 0,
|
|
107
|
+
onDragEnd: () => void 0,
|
|
108
|
+
onDragCancel: () => void 0
|
|
109
|
+
};
|
|
110
|
+
/** dnd-kit `screenReaderInstructions`: Space, not Enter, in your language. */
|
|
111
|
+
function dragInstructions(messages) {
|
|
112
|
+
return { draggable: dragMessages(messages).instructions };
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { DEFAULT_DRAG_MESSAGES, SILENT_DRAG_ANNOUNCEMENTS, createDragAnnouncements, dragInstructions, dragMessages };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { LIFT_CLASS } from "./drag.recipe.mjs";
|
|
2
|
+
import { CSSProperties, ReactNode } from "react";
|
|
3
|
+
import { DropAnimation, Modifier } from "@dnd-kit/core";
|
|
4
|
+
//#region src/components/drag/drag-lift.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A drag settling (motion.md, `motion-drag-settle-*`): the lifted copy
|
|
7
|
+
* gliding into its place on a drop or back home on a cancel, siblings sliding
|
|
8
|
+
* apart to open the place, and a layout reflowing on a drop.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DRAG_SETTLE: {
|
|
11
|
+
readonly duration: 160;
|
|
12
|
+
readonly easing: "cubic-bezier(0.25, 1, 0.5, 1)";
|
|
13
|
+
};
|
|
14
|
+
/** For `useSortable({ transition })`: siblings slide with the same token. */
|
|
15
|
+
export declare const DRAG_SIBLING_TRANSITION: {
|
|
16
|
+
readonly duration: 160;
|
|
17
|
+
readonly easing: "cubic-bezier(0.25, 1, 0.5, 1)";
|
|
18
|
+
};
|
|
19
|
+
/** The item a drag came from, while nothing else has taken its place (`data-drag-origin`). */
|
|
20
|
+
export declare const ORIGIN_OPACITY = 0.4;
|
|
21
|
+
/** Auto-scroll starts this close to the edge of anything that scrolls. */
|
|
22
|
+
export declare const DRAG_AUTO_SCROLL_ZONE_PX = 48;
|
|
23
|
+
/** How far a keyboard drag sets the copy off its place, so the place's dashed outline shows. */
|
|
24
|
+
export declare const DRAG_KEYBOARD_OFFSET_PX = 6;
|
|
25
|
+
/**
|
|
26
|
+
* Drop: the copy glides into its place. Cancel: it glides back home. While
|
|
27
|
+
* it glides, the item it will become stays hidden, then appears there.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DROP_GLIDE: DropAnimation;
|
|
30
|
+
/**
|
|
31
|
+
* The sibling transition for `useSortable({ transition })`: the drag-settle
|
|
32
|
+
* slide, or none with `prefers-reduced-motion`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useDragSiblingTransition(): {
|
|
35
|
+
readonly duration: 160;
|
|
36
|
+
readonly easing: "cubic-bezier(0.25, 1, 0.5, 1)";
|
|
37
|
+
} | null;
|
|
38
|
+
/**
|
|
39
|
+
* For a compact proxy (a section's head, at most 240px wide): the grab point
|
|
40
|
+
* is kept, but pulled to within `inset` of the proxy's end, so the hand never
|
|
41
|
+
* holds empty air beside it. A constant shift: the copy still tracks 1:1.
|
|
42
|
+
*/
|
|
43
|
+
export declare function keepGrabInside(proxyWidth: number, inset?: number): Modifier;
|
|
44
|
+
/**
|
|
45
|
+
* Cancels the drag in progress, whichever sensor holds it. Every dnd-kit
|
|
46
|
+
* sensor (and so every sensor of `useDragSensors`) puts the item back when the
|
|
47
|
+
* window is resized, so this sends the window a `resize`: unlike a synthetic
|
|
48
|
+
* Escape, no app's own Escape handler (a dialog, a panel, a popover) hears it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function cancelDrag(win?: Window): void;
|
|
51
|
+
/**
|
|
52
|
+
* Above every raft-ui layer (popovers 50, a stacked dialog 60, toasts and the
|
|
53
|
+
* lightbox 70) and an app's own top layers: the copy in the hand is always on
|
|
54
|
+
* top. dnd-kit's own default.
|
|
55
|
+
*/
|
|
56
|
+
export declare const DRAG_LIFT_Z_INDEX = 999;
|
|
57
|
+
export type DragLiftProps = {
|
|
58
|
+
/** The lifted copy: the dragged item itself, or a compact proxy for a large one. Nothing while nothing is lifted. */
|
|
59
|
+
children?: ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* The copy takes the item's size and the control radius. Pass the item's
|
|
62
|
+
* own radius here, such as `rounded-container` for a card, or a size for a
|
|
63
|
+
* compact proxy (`size-auto max-w-60`).
|
|
64
|
+
*/
|
|
65
|
+
className?: string;
|
|
66
|
+
style?: CSSProperties;
|
|
67
|
+
/** Modifiers for the copy only, such as one that keeps a compact proxy under the hand. */
|
|
68
|
+
modifiers?: Modifier[];
|
|
69
|
+
/**
|
|
70
|
+
* Scroll whatever scrollable area the pointer comes within 48px of the edge
|
|
71
|
+
* of. Turn dnd-kit's own off (`<DndContext autoScroll={false}>`) so the two
|
|
72
|
+
* don't scroll together.
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
autoScroll?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Render the copy in another element, such as `document.body` when an
|
|
78
|
+
* ancestor has a transform (a drawer, a dialog), which would offset a
|
|
79
|
+
* `position: fixed` copy. It keeps the theme scope it was rendered in
|
|
80
|
+
* (`light` / `dark`), as raft-ui's portals do. By default it renders in place.
|
|
81
|
+
*/
|
|
82
|
+
container?: Element | DocumentFragment | null;
|
|
83
|
+
/** @default DRAG_LIFT_Z_INDEX (999) */
|
|
84
|
+
zIndex?: number;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The copy of a dragged item that follows the hand
|
|
88
|
+
* (design/patterns/drag-and-drop.md#what-follows-the-hand): an opaque popover
|
|
89
|
+
* surface with `shadow-float` and a `line-seam` ring, no scale and no tilt,
|
|
90
|
+
* 1:1 with the pointer from the grab point, never clamped to its container and
|
|
91
|
+
* never held to one axis. On a drop it glides into its place, and on a cancel
|
|
92
|
+
* back home (160ms, `motion-drag-settle-*`; none with reduced motion).
|
|
93
|
+
*
|
|
94
|
+
* While something is lifted it also sets the grabbing cursor, cancels the
|
|
95
|
+
* drag when the window loses focus or the tab is hidden, and scrolls an area
|
|
96
|
+
* the pointer is near the edge of. Render it inside the `DndContext`.
|
|
97
|
+
*/
|
|
98
|
+
export declare function DragLift({ children, className, style, modifiers, autoScroll, container, zIndex }: DragLiftProps): import("react").JSX.Element;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { LIFT_CLASS };
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../cn.mjs";
|
|
3
|
+
import { useTheme } from "../../lib/theme/use-theme.mjs";
|
|
4
|
+
import { LIFT_CLASS, drag } from "./drag.recipe.mjs";
|
|
5
|
+
import { useEffect, useMemo, useSyncExternalStore } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
8
|
+
import { DragOverlay, defaultDropAnimationSideEffects, useDndContext } from "@dnd-kit/core";
|
|
9
|
+
//#region src/components/drag/drag-lift.tsx
|
|
10
|
+
/**
|
|
11
|
+
* A drag settling (motion.md, `motion-drag-settle-*`): the lifted copy
|
|
12
|
+
* gliding into its place on a drop or back home on a cancel, siblings sliding
|
|
13
|
+
* apart to open the place, and a layout reflowing on a drop.
|
|
14
|
+
*/
|
|
15
|
+
const DRAG_SETTLE = {
|
|
16
|
+
duration: 160,
|
|
17
|
+
easing: "cubic-bezier(0.25, 1, 0.5, 1)"
|
|
18
|
+
};
|
|
19
|
+
/** For `useSortable({ transition })`: siblings slide with the same token. */
|
|
20
|
+
const DRAG_SIBLING_TRANSITION = {
|
|
21
|
+
duration: DRAG_SETTLE.duration,
|
|
22
|
+
easing: DRAG_SETTLE.easing
|
|
23
|
+
};
|
|
24
|
+
/** The item a drag came from, while nothing else has taken its place (`data-drag-origin`). */
|
|
25
|
+
const ORIGIN_OPACITY = .4;
|
|
26
|
+
/** Auto-scroll starts this close to the edge of anything that scrolls. */
|
|
27
|
+
const DRAG_AUTO_SCROLL_ZONE_PX = 48;
|
|
28
|
+
/** How far a keyboard drag sets the copy off its place, so the place's dashed outline shows. */
|
|
29
|
+
const DRAG_KEYBOARD_OFFSET_PX = 6;
|
|
30
|
+
const hideActiveWhileGliding = defaultDropAnimationSideEffects({ styles: { active: { opacity: "0" } } });
|
|
31
|
+
/**
|
|
32
|
+
* Drop: the copy glides into its place. Cancel: it glides back home. While
|
|
33
|
+
* it glides, the item it will become stays hidden, then appears there.
|
|
34
|
+
*/
|
|
35
|
+
const DROP_GLIDE = {
|
|
36
|
+
duration: DRAG_SETTLE.duration,
|
|
37
|
+
easing: DRAG_SETTLE.easing,
|
|
38
|
+
sideEffects: (parameters) => {
|
|
39
|
+
const restore = hideActiveWhileGliding(parameters);
|
|
40
|
+
const copy = parameters.dragOverlay.node.querySelector("[data-slot=drag-lift]");
|
|
41
|
+
if (copy?.style.translate) {
|
|
42
|
+
copy.style.transition = `translate ${DRAG_SETTLE.duration}ms ${DRAG_SETTLE.easing}`;
|
|
43
|
+
copy.style.translate = "0px 0px";
|
|
44
|
+
}
|
|
45
|
+
return restore;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const OVERLAY_STYLE = { pointerEvents: "none" };
|
|
49
|
+
const REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
|
|
50
|
+
function subscribeReducedMotion(listener) {
|
|
51
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {};
|
|
52
|
+
const query = window.matchMedia(REDUCED_MOTION);
|
|
53
|
+
query.addEventListener("change", listener);
|
|
54
|
+
return () => query.removeEventListener("change", listener);
|
|
55
|
+
}
|
|
56
|
+
function reducedMotion() {
|
|
57
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(REDUCED_MOTION).matches;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The sibling transition for `useSortable({ transition })`: the drag-settle
|
|
61
|
+
* slide, or none with `prefers-reduced-motion`.
|
|
62
|
+
*/
|
|
63
|
+
function useDragSiblingTransition() {
|
|
64
|
+
return useSyncExternalStore(subscribeReducedMotion, reducedMotion, () => false) ? null : DRAG_SIBLING_TRANSITION;
|
|
65
|
+
}
|
|
66
|
+
const KEYBOARD_OFFSET = `6px 6px`;
|
|
67
|
+
function isKeyboardEvent(event) {
|
|
68
|
+
return typeof KeyboardEvent !== "undefined" && event instanceof KeyboardEvent;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* For a compact proxy (a section's head, at most 240px wide): the grab point
|
|
72
|
+
* is kept, but pulled to within `inset` of the proxy's end, so the hand never
|
|
73
|
+
* holds empty air beside it. A constant shift: the copy still tracks 1:1.
|
|
74
|
+
*/
|
|
75
|
+
function keepGrabInside(proxyWidth, inset = 20) {
|
|
76
|
+
return ({ transform, activatorEvent, activeNodeRect }) => {
|
|
77
|
+
if (!activeNodeRect || !activatorEvent) return transform;
|
|
78
|
+
const point = eventPoint(activatorEvent);
|
|
79
|
+
if (!point) return transform;
|
|
80
|
+
const grabX = point.x - activeNodeRect.left;
|
|
81
|
+
const max = proxyWidth - inset;
|
|
82
|
+
return grabX > max ? {
|
|
83
|
+
...transform,
|
|
84
|
+
x: transform.x + (grabX - max)
|
|
85
|
+
} : transform;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function eventPoint(event) {
|
|
89
|
+
if ("clientX" in event && typeof event.clientX === "number") {
|
|
90
|
+
const pointerEvent = event;
|
|
91
|
+
return {
|
|
92
|
+
x: pointerEvent.clientX,
|
|
93
|
+
y: pointerEvent.clientY
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const touch = event.touches?.[0] ?? event.changedTouches?.[0];
|
|
97
|
+
return touch ? {
|
|
98
|
+
x: touch.clientX,
|
|
99
|
+
y: touch.clientY
|
|
100
|
+
} : null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Cancels the drag in progress, whichever sensor holds it. Every dnd-kit
|
|
104
|
+
* sensor (and so every sensor of `useDragSensors`) puts the item back when the
|
|
105
|
+
* window is resized, so this sends the window a `resize`: unlike a synthetic
|
|
106
|
+
* Escape, no app's own Escape handler (a dialog, a panel, a popover) hears it.
|
|
107
|
+
*/
|
|
108
|
+
function cancelDrag(win = window) {
|
|
109
|
+
win.dispatchEvent(new Event("resize"));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Above every raft-ui layer (popovers 50, a stacked dialog 60, toasts and the
|
|
113
|
+
* lightbox 70) and an app's own top layers: the copy in the hand is always on
|
|
114
|
+
* top. dnd-kit's own default.
|
|
115
|
+
*/
|
|
116
|
+
const DRAG_LIFT_Z_INDEX = 999;
|
|
117
|
+
const noSubscribe = () => () => {};
|
|
118
|
+
const clientBody = () => document.body;
|
|
119
|
+
const serverBody = () => null;
|
|
120
|
+
/**
|
|
121
|
+
* For a component whose copy goes to `document.body` unless it is told
|
|
122
|
+
* otherwise: `undefined` is the body (once on the client, so hydration
|
|
123
|
+
* matches), `null` is in place, and an element is that element.
|
|
124
|
+
*/
|
|
125
|
+
function useLiftContainer(container) {
|
|
126
|
+
const body = useSyncExternalStore(noSubscribe, clientBody, serverBody);
|
|
127
|
+
return container === void 0 ? body : container;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The copy of a dragged item that follows the hand
|
|
131
|
+
* (design/patterns/drag-and-drop.md#what-follows-the-hand): an opaque popover
|
|
132
|
+
* surface with `shadow-float` and a `line-seam` ring, no scale and no tilt,
|
|
133
|
+
* 1:1 with the pointer from the grab point, never clamped to its container and
|
|
134
|
+
* never held to one axis. On a drop it glides into its place, and on a cancel
|
|
135
|
+
* back home (160ms, `motion-drag-settle-*`; none with reduced motion).
|
|
136
|
+
*
|
|
137
|
+
* While something is lifted it also sets the grabbing cursor, cancels the
|
|
138
|
+
* drag when the window loses focus or the tab is hidden, and scrolls an area
|
|
139
|
+
* the pointer is near the edge of. Render it inside the `DndContext`.
|
|
140
|
+
*/
|
|
141
|
+
function DragLift({ children, className, style, modifiers, autoScroll = true, container, zIndex = 999 }) {
|
|
142
|
+
const { lift } = drag();
|
|
143
|
+
const { resolvedMode } = useTheme();
|
|
144
|
+
const reduced = useSyncExternalStore(subscribeReducedMotion, reducedMotion, () => false);
|
|
145
|
+
const { activatorEvent } = useDndContext();
|
|
146
|
+
const liftStyle = useMemo(() => isKeyboardEvent(activatorEvent) ? {
|
|
147
|
+
translate: KEYBOARD_OFFSET,
|
|
148
|
+
...style
|
|
149
|
+
} : style, [activatorEvent, style]);
|
|
150
|
+
const overlay = /* @__PURE__ */ jsx(DragOverlay, {
|
|
151
|
+
dropAnimation: reduced ? null : DROP_GLIDE,
|
|
152
|
+
modifiers,
|
|
153
|
+
zIndex,
|
|
154
|
+
style: OVERLAY_STYLE,
|
|
155
|
+
children: children == null || children === false ? null : /* @__PURE__ */ jsx("div", {
|
|
156
|
+
className: "size-full",
|
|
157
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
158
|
+
"data-slot": "drag-lift",
|
|
159
|
+
className: lift({ className }),
|
|
160
|
+
style: liftStyle,
|
|
161
|
+
children
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DragSession, { autoScroll }), container ? createPortal(/* @__PURE__ */ jsx("div", {
|
|
166
|
+
"data-slot": "drag-lift-portal",
|
|
167
|
+
className: cn("contents", resolvedMode),
|
|
168
|
+
children: overlay
|
|
169
|
+
}), container) : overlay] });
|
|
170
|
+
}
|
|
171
|
+
/** Where the pointer is during a drag: auto-scroll and the refusal hint read it. */
|
|
172
|
+
const pointer = {
|
|
173
|
+
x: 0,
|
|
174
|
+
y: 0,
|
|
175
|
+
known: false
|
|
176
|
+
};
|
|
177
|
+
function trackPointer(event) {
|
|
178
|
+
const point = "touches" in event ? event.touches[0] : event;
|
|
179
|
+
if (!point) return;
|
|
180
|
+
pointer.x = point.clientX;
|
|
181
|
+
pointer.y = point.clientY;
|
|
182
|
+
pointer.known = true;
|
|
183
|
+
}
|
|
184
|
+
/** The pointer's last place, for a hint that follows it. */
|
|
185
|
+
function dragPointer() {
|
|
186
|
+
return pointer.known ? {
|
|
187
|
+
x: pointer.x,
|
|
188
|
+
y: pointer.y
|
|
189
|
+
} : null;
|
|
190
|
+
}
|
|
191
|
+
function DragSession({ autoScroll }) {
|
|
192
|
+
const { active, activatorEvent } = useDndContext();
|
|
193
|
+
const dragging = active != null;
|
|
194
|
+
const viaKeyboard = isKeyboardEvent(activatorEvent);
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
if (!dragging) return;
|
|
197
|
+
const root = document.documentElement;
|
|
198
|
+
root.setAttribute("data-dragging", "");
|
|
199
|
+
if (activatorEvent && !viaKeyboard) trackPointer(activatorEvent);
|
|
200
|
+
const onMove = (event) => trackPointer(event);
|
|
201
|
+
const onBlur = () => cancelDrag();
|
|
202
|
+
const onVisibility = () => {
|
|
203
|
+
if (document.visibilityState === "hidden") cancelDrag();
|
|
204
|
+
};
|
|
205
|
+
window.addEventListener("pointermove", onMove, {
|
|
206
|
+
capture: true,
|
|
207
|
+
passive: true
|
|
208
|
+
});
|
|
209
|
+
window.addEventListener("touchmove", onMove, {
|
|
210
|
+
capture: true,
|
|
211
|
+
passive: true
|
|
212
|
+
});
|
|
213
|
+
window.addEventListener("blur", onBlur);
|
|
214
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
215
|
+
let frame = 0;
|
|
216
|
+
const tick = () => {
|
|
217
|
+
if (pointer.known) autoScrollAt(pointer.x, pointer.y);
|
|
218
|
+
frame = requestAnimationFrame(tick);
|
|
219
|
+
};
|
|
220
|
+
if (autoScroll && !viaKeyboard) frame = requestAnimationFrame(tick);
|
|
221
|
+
return () => {
|
|
222
|
+
root.removeAttribute("data-dragging");
|
|
223
|
+
pointer.known = false;
|
|
224
|
+
window.removeEventListener("pointermove", onMove, { capture: true });
|
|
225
|
+
window.removeEventListener("touchmove", onMove, { capture: true });
|
|
226
|
+
window.removeEventListener("blur", onBlur);
|
|
227
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
228
|
+
cancelAnimationFrame(frame);
|
|
229
|
+
};
|
|
230
|
+
}, [
|
|
231
|
+
dragging,
|
|
232
|
+
viaKeyboard,
|
|
233
|
+
autoScroll,
|
|
234
|
+
activatorEvent
|
|
235
|
+
]);
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
function scrollable(element) {
|
|
239
|
+
const style = getComputedStyle(element);
|
|
240
|
+
return {
|
|
241
|
+
x: /(auto|scroll)/.test(style.overflowX) && element.scrollWidth > element.clientWidth,
|
|
242
|
+
y: /(auto|scroll)/.test(style.overflowY) && element.scrollHeight > element.clientHeight
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/** Faster the nearer the edge: up to 16px a frame at the edge itself. */
|
|
246
|
+
function speed(depth) {
|
|
247
|
+
return Math.ceil(16 * Math.min(1, depth / 48) ** 2);
|
|
248
|
+
}
|
|
249
|
+
function scrollDelta(start, end, at, position, max) {
|
|
250
|
+
const zone = 48;
|
|
251
|
+
if (at < start + zone && position > 0) return -speed(start + zone - at);
|
|
252
|
+
if (at > end - zone && position < max) return speed(at - (end - zone));
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
/** Scrolls the nearest area under the point that can still scroll toward the edge it is near. */
|
|
256
|
+
function autoScrollAt(x, y) {
|
|
257
|
+
let element = document.elementFromPoint(x, y);
|
|
258
|
+
while (element && element !== document.documentElement && element !== document.body) {
|
|
259
|
+
const can = scrollable(element);
|
|
260
|
+
if (can.x || can.y) {
|
|
261
|
+
const rect = element.getBoundingClientRect();
|
|
262
|
+
const dy = can.y ? scrollDelta(rect.top, rect.bottom, y, element.scrollTop, element.scrollHeight - element.clientHeight - 1) : 0;
|
|
263
|
+
const dx = can.x ? scrollDelta(rect.left, rect.right, x, element.scrollLeft, element.scrollWidth - element.clientWidth - 1) : 0;
|
|
264
|
+
if (dx || dy) {
|
|
265
|
+
element.scrollBy(dx, dy);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
element = element.parentElement;
|
|
270
|
+
}
|
|
271
|
+
const page = document.scrollingElement ?? document.documentElement;
|
|
272
|
+
const dy = scrollDelta(0, window.innerHeight, y, page.scrollTop, page.scrollHeight - window.innerHeight - 1);
|
|
273
|
+
if (dy) window.scrollBy(0, dy);
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
export { DRAG_AUTO_SCROLL_ZONE_PX, DRAG_KEYBOARD_OFFSET_PX, DRAG_LIFT_Z_INDEX, DRAG_SETTLE, DRAG_SIBLING_TRANSITION, DROP_GLIDE, DragLift, LIFT_CLASS, ORIGIN_OPACITY, autoScrollAt, cancelDrag, dragPointer, keepGrabInside, useDragSiblingTransition, useLiftContainer };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { DragMessages } from "./drag-announcements.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { Announcements, CollisionDetection, DragEndEvent, DragOverEvent, DragStartEvent, KeyboardCoordinateGetter, ScreenReaderInstructions, UniqueIdentifier } from "@dnd-kit/core";
|
|
4
|
+
import { SortingStrategy } from "@dnd-kit/sortable";
|
|
5
|
+
//#region src/components/drag/drag-lists.d.ts
|
|
6
|
+
export type DragListsItems<L extends string> = Record<L, readonly string[]>;
|
|
7
|
+
export type UseDragListsOptions<L extends string> = {
|
|
8
|
+
/** The lists, in the order they are on screen (by keyboard, entering a list from above lands first, from below last). */
|
|
9
|
+
lists: readonly L[];
|
|
10
|
+
/** Each list's items, by id. */
|
|
11
|
+
items: DragListsItems<L>;
|
|
12
|
+
/** Called with the lists as they should now render: while dragging (the item standing at its landing spot), on a drop and on a cancel. */
|
|
13
|
+
onItemsChange: (items: DragListsItems<L>) => void;
|
|
14
|
+
/** A list's name as people see it ("Pinned"). */
|
|
15
|
+
listName: (list: L) => string;
|
|
16
|
+
/** An item's name as people see it ("#launch-week"); never its id. */
|
|
17
|
+
itemName: (id: string) => string;
|
|
18
|
+
/** Why `to` won't take an item from `from`, or null when it will. */
|
|
19
|
+
refuse?: (from: L, to: L, id: string) => string | null;
|
|
20
|
+
/** The surface's collision detection; it is held still for a moment right after the item changes list. */
|
|
21
|
+
collisionDetection: CollisionDetection;
|
|
22
|
+
/** Says each step in a polite live region (`useDragAnnouncer`). */
|
|
23
|
+
announce: (message: string) => void;
|
|
24
|
+
/** Your translations of the announcements. */
|
|
25
|
+
messages?: Partial<DragMessages>;
|
|
26
|
+
};
|
|
27
|
+
/** dnd-kit's vertical strategy, except that nothing moves while the hand is outside the list. */
|
|
28
|
+
export declare const dragListStrategy: SortingStrategy;
|
|
29
|
+
/**
|
|
30
|
+
* Items in one or more lists that can be reordered and moved between lists
|
|
31
|
+
* (a sidebar's sections, a board's columns): the lists half of the drag
|
|
32
|
+
* model (design/patterns/drag-and-drop.md#where-it-will-land). While dragging,
|
|
33
|
+
* the item stands at its landing spot (its own slot is the place; siblings
|
|
34
|
+
* slide apart), a list can refuse it, and every step is announced by name.
|
|
35
|
+
* The keyboard is measured from the item's real place, so the arrows never
|
|
36
|
+
* skip one after a move into another list.
|
|
37
|
+
*
|
|
38
|
+
* Spread `handlers`, `collisionDetection` and `accessibility` on the
|
|
39
|
+
* `DndContext`, pass `coordinateGetter` to `useDragSensors`, and render
|
|
40
|
+
* `DragRemeasure version={items}` inside it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useDragLists<L extends string>({ lists, items, onItemsChange, listName, itemName, refuse, collisionDetection, announce, messages }: UseDragListsOptions<L>): {
|
|
43
|
+
/** The dragged item's id, or null. */
|
|
44
|
+
activeId: string | null;
|
|
45
|
+
/** The list that refuses the item under the hand, and why. */
|
|
46
|
+
refusal: {
|
|
47
|
+
list: L;
|
|
48
|
+
reason: string;
|
|
49
|
+
} | null;
|
|
50
|
+
/** The list the drag started in, while dragging. */
|
|
51
|
+
originList: L | null;
|
|
52
|
+
isHome: (id: string, index: number) => boolean;
|
|
53
|
+
listOf: (state: DragListsItems<L>, id: UniqueIdentifier) => L | null;
|
|
54
|
+
collisionDetection: CollisionDetection;
|
|
55
|
+
coordinateGetter: KeyboardCoordinateGetter;
|
|
56
|
+
accessibility: {
|
|
57
|
+
announcements: Announcements;
|
|
58
|
+
screenReaderInstructions: ScreenReaderInstructions;
|
|
59
|
+
};
|
|
60
|
+
handlers: {
|
|
61
|
+
onDragStart: ({ active, activatorEvent }: DragStartEvent) => void;
|
|
62
|
+
onDragOver: ({ active, over }: DragOverEvent) => void;
|
|
63
|
+
onDragEnd: ({ over }: DragEndEvent) => void;
|
|
64
|
+
onDragCancel: () => void;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type DraggedSlotProps = {
|
|
68
|
+
/**
|
|
69
|
+
* This item is the one being dragged. Render the slot around every item
|
|
70
|
+
* and pass `isDragging`, so the dragged one keeps its node (and focus).
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
dragging?: boolean;
|
|
74
|
+
/** The dragged item still stands at its own place. */
|
|
75
|
+
home: boolean;
|
|
76
|
+
/** The item's radius class, for the place: `rounded-control` by default. */
|
|
77
|
+
radius?: string;
|
|
78
|
+
/** Classes for the place, after `radius`. */
|
|
79
|
+
className?: string;
|
|
80
|
+
children: ReactNode;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Wraps each item's content in a list. The dragged item's own node is at 40%
|
|
84
|
+
* while it is still home, and the dashed place (its size, its radius) once it
|
|
85
|
+
* stands anywhere else. Every other item renders as it is: the wrapper stays
|
|
86
|
+
* the same, so the item keeps focus when its drag starts.
|
|
87
|
+
*/
|
|
88
|
+
export declare function DraggedSlot({ dragging, home, radius, className, children }: DraggedSlotProps): import("react").JSX.Element;
|
|
89
|
+
/** The last announcement, for a polite live region (`DragLiveRegion`). Repeats are dropped. */
|
|
90
|
+
export declare function useDragAnnouncer(): {
|
|
91
|
+
message: string;
|
|
92
|
+
announce: (text: string) => void;
|
|
93
|
+
};
|
|
94
|
+
/** A polite, visually hidden live region for drag announcements. */
|
|
95
|
+
export declare function DragLiveRegion({ message }: {
|
|
96
|
+
message: string;
|
|
97
|
+
}): import("react").JSX.Element;
|
|
98
|
+
//#endregion
|