@tanrei/web 0.0.0-stage → 0.1.0-next.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 +202 -0
- package/NOTICE +58 -0
- package/README.md +9743 -2
- package/custom-elements.json +86072 -0
- package/dist/THIRD_PARTY_LICENSES.md +136 -0
- package/dist/accordion.css +812 -0
- package/dist/app-shell.css +493 -0
- package/dist/avatar.css +80 -0
- package/dist/breadcrumbs.css +511 -0
- package/dist/callout.css +65 -0
- package/dist/code.css +595 -0
- package/dist/components/accordion/accordion.d.ts +197 -0
- package/dist/components/accordion/accordion.js +763 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/app-bar/app-bar.d.ts +107 -0
- package/dist/components/app-bar/app-bar.js +295 -0
- package/dist/components/app-bar/app-bar.js.map +1 -0
- package/dist/components/app-bar/app-bar.styles.d.ts +12 -0
- package/dist/components/app-bar/app-bar.styles.js +223 -0
- package/dist/components/app-bar/app-bar.styles.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +220 -0
- package/dist/components/app-shell/app-shell.js +677 -0
- package/dist/components/app-shell/app-shell.js.map +1 -0
- package/dist/components/avatar/avatar.d.ts +162 -0
- package/dist/components/avatar/avatar.js +390 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/avatar/avatar.styles.d.ts +9 -0
- package/dist/components/avatar/avatar.styles.js +258 -0
- package/dist/components/avatar/avatar.styles.js.map +1 -0
- package/dist/components/badge/badge.d.ts +59 -0
- package/dist/components/badge/badge.js +176 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/badge/badge.styles.d.ts +1 -0
- package/dist/components/badge/badge.styles.js +106 -0
- package/dist/components/badge/badge.styles.js.map +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +207 -0
- package/dist/components/bottom-sheet/bottom-sheet.js +724 -0
- package/dist/components/bottom-sheet/bottom-sheet.js.map +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.styles.d.ts +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.styles.js +393 -0
- package/dist/components/bottom-sheet/bottom-sheet.styles.js.map +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +176 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +638 -0
- package/dist/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.d.ts +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.js +225 -0
- package/dist/components/breadcrumbs/breadcrumbs.styles.js.map +1 -0
- package/dist/components/button/button.d.ts +280 -0
- package/dist/components/button/button.js +530 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/button.styles.d.ts +20 -0
- package/dist/components/button/button.styles.js +328 -0
- package/dist/components/button/button.styles.js.map +1 -0
- package/dist/components/button-group/button-group.d.ts +124 -0
- package/dist/components/button-group/button-group.js +287 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/button-group/button-group.styles.d.ts +1 -0
- package/dist/components/button-group/button-group.styles.js +220 -0
- package/dist/components/button-group/button-group.styles.js.map +1 -0
- package/dist/components/button-with-menu/button-with-menu.d.ts +224 -0
- package/dist/components/button-with-menu/button-with-menu.js +635 -0
- package/dist/components/button-with-menu/button-with-menu.js.map +1 -0
- package/dist/components/button-with-menu/button-with-menu.styles.d.ts +15 -0
- package/dist/components/button-with-menu/button-with-menu.styles.js +418 -0
- package/dist/components/button-with-menu/button-with-menu.styles.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +380 -0
- package/dist/components/calendar/calendar.js +1619 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/calendar.styles.d.ts +11 -0
- package/dist/components/calendar/calendar.styles.js +412 -0
- package/dist/components/calendar/calendar.styles.js.map +1 -0
- package/dist/components/callout/callout.d.ts +157 -0
- package/dist/components/callout/callout.js +436 -0
- package/dist/components/callout/callout.js.map +1 -0
- package/dist/components/callout/callout.styles.d.ts +13 -0
- package/dist/components/callout/callout.styles.js +383 -0
- package/dist/components/callout/callout.styles.js.map +1 -0
- package/dist/components/card/card.d.ts +108 -0
- package/dist/components/card/card.js +235 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/card/card.styles.d.ts +9 -0
- package/dist/components/card/card.styles.js +170 -0
- package/dist/components/card/card.styles.js.map +1 -0
- package/dist/components/carousel/carousel-geometry.d.ts +178 -0
- package/dist/components/carousel/carousel-geometry.js +356 -0
- package/dist/components/carousel/carousel-geometry.js.map +1 -0
- package/dist/components/carousel/carousel.d.ts +401 -0
- package/dist/components/carousel/carousel.js +1352 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/carousel/carousel.styles.d.ts +4 -0
- package/dist/components/carousel/carousel.styles.js +475 -0
- package/dist/components/carousel/carousel.styles.js.map +1 -0
- package/dist/components/chat-composer/chat-composer.d.ts +482 -0
- package/dist/components/chat-composer/chat-composer.js +1374 -0
- package/dist/components/chat-composer/chat-composer.js.map +1 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +9 -0
- package/dist/components/chat-composer/chat-composer.styles.js +308 -0
- package/dist/components/chat-composer/chat-composer.styles.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +135 -0
- package/dist/components/checkbox/checkbox.js +296 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +13 -0
- package/dist/components/checkbox/checkbox.styles.js +226 -0
- package/dist/components/checkbox/checkbox.styles.js.map +1 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +199 -0
- package/dist/components/checkbox-group/checkbox-group.js +500 -0
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
- package/dist/components/chip/chip.d.ts +176 -0
- package/dist/components/chip/chip.js +376 -0
- package/dist/components/chip/chip.js.map +1 -0
- package/dist/components/chip/chip.styles.d.ts +10 -0
- package/dist/components/chip/chip.styles.js +465 -0
- package/dist/components/chip/chip.styles.js.map +1 -0
- package/dist/components/chip-field/chip-field.d.ts +315 -0
- package/dist/components/chip-field/chip-field.js +887 -0
- package/dist/components/chip-field/chip-field.js.map +1 -0
- package/dist/components/code-block/code-block.before.d.ts +2 -0
- package/dist/components/code-block/code-block.before.js +193 -0
- package/dist/components/code-block/code-block.before.js.map +1 -0
- package/dist/components/code-block/code-block.d.ts +268 -0
- package/dist/components/code-block/code-block.js +1009 -0
- package/dist/components/code-block/code-block.js.map +1 -0
- package/dist/components/code-block/code-block.light.d.ts +50 -0
- package/dist/components/code-block/code-block.light.js +287 -0
- package/dist/components/code-block/code-block.light.js.map +1 -0
- package/dist/components/code-block/code-block.lines.d.ts +49 -0
- package/dist/components/code-block/code-block.lines.js +75 -0
- package/dist/components/code-block/code-block.lines.js.map +1 -0
- package/dist/components/code-block/code-block.styles.d.ts +8 -0
- package/dist/components/code-block/code-block.styles.js +212 -0
- package/dist/components/code-block/code-block.styles.js.map +1 -0
- package/dist/components/color-field/color-field.d.ts +120 -0
- package/dist/components/color-field/color-field.js +182 -0
- package/dist/components/color-field/color-field.js.map +1 -0
- package/dist/components/color-input/color-input.d.ts +302 -0
- package/dist/components/color-input/color-input.js +748 -0
- package/dist/components/color-input/color-input.js.map +1 -0
- package/dist/components/color-input/color-input.styles.d.ts +22 -0
- package/dist/components/color-input/color-input.styles.js +373 -0
- package/dist/components/color-input/color-input.styles.js.map +1 -0
- package/dist/components/color-input/color-text.d.ts +48 -0
- package/dist/components/color-input/color-text.js +77 -0
- package/dist/components/color-input/color-text.js.map +1 -0
- package/dist/components/combobox/combobox.d.ts +387 -0
- package/dist/components/combobox/combobox.js +1108 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/combobox/combobox.styles.d.ts +26 -0
- package/dist/components/combobox/combobox.styles.js +497 -0
- package/dist/components/combobox/combobox.styles.js.map +1 -0
- package/dist/components/combobox-field/combobox-field.d.ts +159 -0
- package/dist/components/combobox-field/combobox-field.js +280 -0
- package/dist/components/combobox-field/combobox-field.js.map +1 -0
- package/dist/components/copy-button/copy-button.d.ts +112 -0
- package/dist/components/copy-button/copy-button.js +237 -0
- package/dist/components/copy-button/copy-button.js.map +1 -0
- package/dist/components/copy-button/copy-button.styles.d.ts +1 -0
- package/dist/components/copy-button/copy-button.styles.js +62 -0
- package/dist/components/copy-button/copy-button.styles.js.map +1 -0
- package/dist/components/date-time-picker/date-time-picker.d.ts +603 -0
- package/dist/components/date-time-picker/date-time-picker.js +2537 -0
- package/dist/components/date-time-picker/date-time-picker.js.map +1 -0
- package/dist/components/date-time-picker/date-time-picker.styles.d.ts +1 -0
- package/dist/components/date-time-picker/date-time-picker.styles.js +842 -0
- package/dist/components/date-time-picker/date-time-picker.styles.js.map +1 -0
- package/dist/components/description-list/description-list.d.ts +133 -0
- package/dist/components/description-list/description-list.js +395 -0
- package/dist/components/description-list/description-list.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +140 -0
- package/dist/components/dialog/dialog.js +440 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +306 -0
- package/dist/components/dialog/dialog.styles.js.map +1 -0
- package/dist/components/divider/divider.d.ts +112 -0
- package/dist/components/divider/divider.js +331 -0
- package/dist/components/divider/divider.js.map +1 -0
- package/dist/components/divider/divider.styles.d.ts +6 -0
- package/dist/components/divider/divider.styles.js +183 -0
- package/dist/components/divider/divider.styles.js.map +1 -0
- package/dist/components/embedded-text-input/embedded-text-input.d.ts +246 -0
- package/dist/components/embedded-text-input/embedded-text-input.js +673 -0
- package/dist/components/embedded-text-input/embedded-text-input.js.map +1 -0
- package/dist/components/embedded-text-input/embedded-text-input.styles.d.ts +1 -0
- package/dist/components/embedded-text-input/embedded-text-input.styles.js +204 -0
- package/dist/components/embedded-text-input/embedded-text-input.styles.js.map +1 -0
- package/dist/components/empty-state/empty-state.d.ts +132 -0
- package/dist/components/empty-state/empty-state.js +333 -0
- package/dist/components/empty-state/empty-state.js.map +1 -0
- package/dist/components/empty-state/empty-state.styles.d.ts +11 -0
- package/dist/components/empty-state/empty-state.styles.js +218 -0
- package/dist/components/empty-state/empty-state.styles.js.map +1 -0
- package/dist/components/fab-menu/fab-menu.d.ts +240 -0
- package/dist/components/fab-menu/fab-menu.js +605 -0
- package/dist/components/fab-menu/fab-menu.js.map +1 -0
- package/dist/components/fab-menu/fab-menu.styles.d.ts +21 -0
- package/dist/components/fab-menu/fab-menu.styles.js +427 -0
- package/dist/components/fab-menu/fab-menu.styles.js.map +1 -0
- package/dist/components/field/field.d.ts +165 -0
- package/dist/components/field/field.js +399 -0
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/field/field.styles.d.ts +2 -0
- package/dist/components/field/field.styles.js +177 -0
- package/dist/components/field/field.styles.js.map +1 -0
- package/dist/components/field-group/field-group.d.ts +122 -0
- package/dist/components/field-group/field-group.js +246 -0
- package/dist/components/field-group/field-group.js.map +1 -0
- package/dist/components/field-group/field-group.styles.d.ts +7 -0
- package/dist/components/field-group/field-group.styles.js +28 -0
- package/dist/components/field-group/field-group.styles.js.map +1 -0
- package/dist/components/figure/figure.d.ts +152 -0
- package/dist/components/figure/figure.js +435 -0
- package/dist/components/figure/figure.js.map +1 -0
- package/dist/components/file-item/file-item.d.ts +232 -0
- package/dist/components/file-item/file-item.js +665 -0
- package/dist/components/file-item/file-item.js.map +1 -0
- package/dist/components/file-item/file-item.styles.d.ts +2 -0
- package/dist/components/file-item/file-item.styles.js +582 -0
- package/dist/components/file-item/file-item.styles.js.map +1 -0
- package/dist/components/file-picker/file-picker.d.ts +221 -0
- package/dist/components/file-picker/file-picker.js +588 -0
- package/dist/components/file-picker/file-picker.js.map +1 -0
- package/dist/components/file-picker/file-picker.styles.d.ts +2 -0
- package/dist/components/file-picker/file-picker.styles.js +303 -0
- package/dist/components/file-picker/file-picker.styles.js.map +1 -0
- package/dist/components/file-upload/file-upload.d.ts +353 -0
- package/dist/components/file-upload/file-upload.js +939 -0
- package/dist/components/file-upload/file-upload.js.map +1 -0
- package/dist/components/file-upload/file-upload.styles.d.ts +1 -0
- package/dist/components/file-upload/file-upload.styles.js +91 -0
- package/dist/components/file-upload/file-upload.styles.js.map +1 -0
- package/dist/components/image-preview/image-preview.d.ts +336 -0
- package/dist/components/image-preview/image-preview.js +1510 -0
- package/dist/components/image-preview/image-preview.js.map +1 -0
- package/dist/components/image-preview/image-preview.styles.d.ts +1 -0
- package/dist/components/image-preview/image-preview.styles.js +418 -0
- package/dist/components/image-preview/image-preview.styles.js.map +1 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.d.ts +94 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.js +285 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.d.ts +11 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js +155 -0
- package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js.map +1 -0
- package/dist/components/link-card/link-card.d.ts +156 -0
- package/dist/components/link-card/link-card.js +713 -0
- package/dist/components/link-card/link-card.js.map +1 -0
- package/dist/components/list/list.d.ts +430 -0
- package/dist/components/list/list.js +1230 -0
- package/dist/components/list/list.js.map +1 -0
- package/dist/components/list/list.styles.d.ts +3 -0
- package/dist/components/list/list.styles.js +334 -0
- package/dist/components/list/list.styles.js.map +1 -0
- package/dist/components/loading-indicator/loading-indicator.d.ts +83 -0
- package/dist/components/loading-indicator/loading-indicator.js +195 -0
- package/dist/components/loading-indicator/loading-indicator.js.map +1 -0
- package/dist/components/loading-indicator/loading-indicator.styles.d.ts +6 -0
- package/dist/components/loading-indicator/loading-indicator.styles.js +124 -0
- package/dist/components/loading-indicator/loading-indicator.styles.js.map +1 -0
- package/dist/components/main-action-button/main-action-button.d.ts +95 -0
- package/dist/components/main-action-button/main-action-button.js +202 -0
- package/dist/components/main-action-button/main-action-button.js.map +1 -0
- package/dist/components/main-action-button/main-action-button.styles.d.ts +10 -0
- package/dist/components/main-action-button/main-action-button.styles.js +285 -0
- package/dist/components/main-action-button/main-action-button.styles.js.map +1 -0
- package/dist/components/menu/menu.d.ts +813 -0
- package/dist/components/menu/menu.js +2061 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/menu/menu.styles.d.ts +18 -0
- package/dist/components/menu/menu.styles.js +587 -0
- package/dist/components/menu/menu.styles.js.map +1 -0
- package/dist/components/menubar/menubar.d.ts +477 -0
- package/dist/components/menubar/menubar.js +1677 -0
- package/dist/components/menubar/menubar.js.map +1 -0
- package/dist/components/menubar/menubar.styles.d.ts +43 -0
- package/dist/components/menubar/menubar.styles.js +379 -0
- package/dist/components/menubar/menubar.styles.js.map +1 -0
- package/dist/components/navigation-bar/navigation-bar.d.ts +239 -0
- package/dist/components/navigation-bar/navigation-bar.js +544 -0
- package/dist/components/navigation-bar/navigation-bar.js.map +1 -0
- package/dist/components/navigation-bar/navigation-bar.styles.d.ts +21 -0
- package/dist/components/navigation-bar/navigation-bar.styles.js +320 -0
- package/dist/components/navigation-bar/navigation-bar.styles.js.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts +627 -0
- package/dist/components/navigation-drawer/navigation-drawer.js +1917 -0
- package/dist/components/navigation-drawer/navigation-drawer.js.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.styles.d.ts +40 -0
- package/dist/components/navigation-drawer/navigation-drawer.styles.js +934 -0
- package/dist/components/navigation-drawer/navigation-drawer.styles.js.map +1 -0
- package/dist/components/number-field/number-field.d.ts +147 -0
- package/dist/components/number-field/number-field.js +252 -0
- package/dist/components/number-field/number-field.js.map +1 -0
- package/dist/components/number-input/number-input.d.ts +347 -0
- package/dist/components/number-input/number-input.js +929 -0
- package/dist/components/number-input/number-input.js.map +1 -0
- package/dist/components/number-input/number-input.styles.d.ts +22 -0
- package/dist/components/number-input/number-input.styles.js +395 -0
- package/dist/components/number-input/number-input.styles.js.map +1 -0
- package/dist/components/number-input/number-text.d.ts +74 -0
- package/dist/components/number-input/number-text.js +230 -0
- package/dist/components/number-input/number-text.js.map +1 -0
- package/dist/components/one-time-code-field/one-time-code-field.d.ts +94 -0
- package/dist/components/one-time-code-field/one-time-code-field.js +135 -0
- package/dist/components/one-time-code-field/one-time-code-field.js.map +1 -0
- package/dist/components/one-time-code-input/code-text.d.ts +51 -0
- package/dist/components/one-time-code-input/code-text.js +145 -0
- package/dist/components/one-time-code-input/code-text.js.map +1 -0
- package/dist/components/one-time-code-input/one-time-code-input.d.ts +219 -0
- package/dist/components/one-time-code-input/one-time-code-input.js +710 -0
- package/dist/components/one-time-code-input/one-time-code-input.js.map +1 -0
- package/dist/components/one-time-code-input/one-time-code-input.styles.d.ts +8 -0
- package/dist/components/one-time-code-input/one-time-code-input.styles.js +323 -0
- package/dist/components/one-time-code-input/one-time-code-input.styles.js.map +1 -0
- package/dist/components/option/option.d.ts +51 -0
- package/dist/components/option/option.js +75 -0
- package/dist/components/option/option.js.map +1 -0
- package/dist/components/page-header/page-header.d.ts +97 -0
- package/dist/components/page-header/page-header.js +258 -0
- package/dist/components/page-header/page-header.js.map +1 -0
- package/dist/components/popover/popover.d.ts +217 -0
- package/dist/components/popover/popover.js +616 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/popover/popover.styles.d.ts +8 -0
- package/dist/components/popover/popover.styles.js +299 -0
- package/dist/components/popover/popover.styles.js.map +1 -0
- package/dist/components/progress-indicator/progress-indicator.d.ts +76 -0
- package/dist/components/progress-indicator/progress-indicator.js +165 -0
- package/dist/components/progress-indicator/progress-indicator.js.map +1 -0
- package/dist/components/progress-indicator/progress-indicator.styles.d.ts +7 -0
- package/dist/components/progress-indicator/progress-indicator.styles.js +271 -0
- package/dist/components/progress-indicator/progress-indicator.styles.js.map +1 -0
- package/dist/components/radio-button/radio-button.d.ts +149 -0
- package/dist/components/radio-button/radio-button.js +370 -0
- package/dist/components/radio-button/radio-button.js.map +1 -0
- package/dist/components/radio-button/radio-button.styles.d.ts +8 -0
- package/dist/components/radio-button/radio-button.styles.js +190 -0
- package/dist/components/radio-button/radio-button.styles.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +188 -0
- package/dist/components/radio-group/radio-group.js +380 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/search/search.d.ts +569 -0
- package/dist/components/search/search.js +1801 -0
- package/dist/components/search/search.js.map +1 -0
- package/dist/components/search/search.styles.d.ts +15 -0
- package/dist/components/search/search.styles.js +967 -0
- package/dist/components/search/search.styles.js.map +1 -0
- package/dist/components/segmented-button/segmented-button.d.ts +183 -0
- package/dist/components/segmented-button/segmented-button.js +483 -0
- package/dist/components/segmented-button/segmented-button.js.map +1 -0
- package/dist/components/segmented-button/segmented-button.styles.d.ts +19 -0
- package/dist/components/segmented-button/segmented-button.styles.js +400 -0
- package/dist/components/segmented-button/segmented-button.styles.js.map +1 -0
- package/dist/components/select/select.d.ts +259 -0
- package/dist/components/select/select.js +702 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/select/select.styles.d.ts +27 -0
- package/dist/components/select/select.styles.js +359 -0
- package/dist/components/select/select.styles.js.map +1 -0
- package/dist/components/select-field/select-field.d.ts +141 -0
- package/dist/components/select-field/select-field.js +234 -0
- package/dist/components/select-field/select-field.js.map +1 -0
- package/dist/components/side-sheet/side-sheet.d.ts +190 -0
- package/dist/components/side-sheet/side-sheet.js +592 -0
- package/dist/components/side-sheet/side-sheet.js.map +1 -0
- package/dist/components/side-sheet/side-sheet.styles.d.ts +9 -0
- package/dist/components/side-sheet/side-sheet.styles.js +352 -0
- package/dist/components/side-sheet/side-sheet.styles.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +157 -0
- package/dist/components/skeleton/skeleton.js +550 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/slider/slider.d.ts +235 -0
- package/dist/components/slider/slider.js +792 -0
- package/dist/components/slider/slider.js.map +1 -0
- package/dist/components/slider/slider.styles.d.ts +6 -0
- package/dist/components/slider/slider.styles.js +492 -0
- package/dist/components/slider/slider.styles.js.map +1 -0
- package/dist/components/slider-field/slider-field.d.ts +150 -0
- package/dist/components/slider-field/slider-field.js +269 -0
- package/dist/components/slider-field/slider-field.js.map +1 -0
- package/dist/components/snackbar/snackbar.d.ts +237 -0
- package/dist/components/snackbar/snackbar.js +607 -0
- package/dist/components/snackbar/snackbar.js.map +1 -0
- package/dist/components/snackbar/snackbar.styles.d.ts +10 -0
- package/dist/components/snackbar/snackbar.styles.js +510 -0
- package/dist/components/snackbar/snackbar.styles.js.map +1 -0
- package/dist/components/switch/switch.d.ts +161 -0
- package/dist/components/switch/switch.js +470 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/switch/switch.styles.d.ts +3 -0
- package/dist/components/switch/switch.styles.js +440 -0
- package/dist/components/switch/switch.styles.js.map +1 -0
- package/dist/components/tab-view/tab-view.d.ts +303 -0
- package/dist/components/tab-view/tab-view.js +917 -0
- package/dist/components/tab-view/tab-view.js.map +1 -0
- package/dist/components/tab-view/tab-view.styles.d.ts +19 -0
- package/dist/components/tab-view/tab-view.styles.js +85 -0
- package/dist/components/tab-view/tab-view.styles.js.map +1 -0
- package/dist/components/table/table.d.ts +386 -0
- package/dist/components/table/table.js +1320 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +227 -0
- package/dist/components/table-of-contents/table-of-contents.js +963 -0
- package/dist/components/table-of-contents/table-of-contents.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.styles.d.ts +1 -0
- package/dist/components/table-of-contents/table-of-contents.styles.js +243 -0
- package/dist/components/table-of-contents/table-of-contents.styles.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +800 -0
- package/dist/components/tabs/tabs.js +2183 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/tabs/tabs.styles.d.ts +47 -0
- package/dist/components/tabs/tabs.styles.js +595 -0
- package/dist/components/tabs/tabs.styles.js.map +1 -0
- package/dist/components/tag/tag.d.ts +77 -0
- package/dist/components/tag/tag.js +143 -0
- package/dist/components/tag/tag.js.map +1 -0
- package/dist/components/tag/tag.styles.d.ts +13 -0
- package/dist/components/tag/tag.styles.js +215 -0
- package/dist/components/tag/tag.styles.js.map +1 -0
- package/dist/components/tag-group/tag-group.d.ts +110 -0
- package/dist/components/tag-group/tag-group.js +298 -0
- package/dist/components/tag-group/tag-group.js.map +1 -0
- package/dist/components/tag-group/tag-group.styles.d.ts +8 -0
- package/dist/components/tag-group/tag-group.styles.js +66 -0
- package/dist/components/tag-group/tag-group.styles.js.map +1 -0
- package/dist/components/text-field/text-field.d.ts +159 -0
- package/dist/components/text-field/text-field.js +272 -0
- package/dist/components/text-field/text-field.js.map +1 -0
- package/dist/components/text-input/text-input-segments.d.ts +93 -0
- package/dist/components/text-input/text-input-segments.js +233 -0
- package/dist/components/text-input/text-input-segments.js.map +1 -0
- package/dist/components/text-input/text-input.d.ts +683 -0
- package/dist/components/text-input/text-input.js +2120 -0
- package/dist/components/text-input/text-input.js.map +1 -0
- package/dist/components/text-input/text-input.styles.d.ts +27 -0
- package/dist/components/text-input/text-input.styles.js +1071 -0
- package/dist/components/text-input/text-input.styles.js.map +1 -0
- package/dist/components/toolbar/toolbar.d.ts +123 -0
- package/dist/components/toolbar/toolbar.js +336 -0
- package/dist/components/toolbar/toolbar.js.map +1 -0
- package/dist/components/toolbar/toolbar.styles.d.ts +10 -0
- package/dist/components/toolbar/toolbar.styles.js +156 -0
- package/dist/components/toolbar/toolbar.styles.js.map +1 -0
- package/dist/components/tooltip/tooltip-placement.d.ts +22 -0
- package/dist/components/tooltip/tooltip-placement.js +15 -0
- package/dist/components/tooltip/tooltip-placement.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +267 -0
- package/dist/components/tooltip/tooltip.js +902 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +7 -0
- package/dist/components/tooltip/tooltip.styles.js +240 -0
- package/dist/components/tooltip/tooltip.styles.js.map +1 -0
- package/dist/components/tree-view/tree-view.d.ts +264 -0
- package/dist/components/tree-view/tree-view.js +1228 -0
- package/dist/components/tree-view/tree-view.js.map +1 -0
- package/dist/description-list.css +337 -0
- package/dist/empty-state.css +70 -0
- package/dist/figure.css +381 -0
- package/dist/generated/icon-sets.d.ts +9 -0
- package/dist/generated/icon-sets.js +18 -0
- package/dist/generated/icon-sets.js.map +1 -0
- package/dist/generated/words.d.ts +161 -0
- package/dist/generated/words.js +91 -0
- package/dist/generated/words.js.map +1 -0
- package/dist/highlight/grammars/css.d.ts +3 -0
- package/dist/highlight/grammars/css.js +56 -0
- package/dist/highlight/grammars/css.js.map +1 -0
- package/dist/highlight/grammars/dart.d.ts +3 -0
- package/dist/highlight/grammars/dart.js +53 -0
- package/dist/highlight/grammars/dart.js.map +1 -0
- package/dist/highlight/grammars/javascript.d.ts +4 -0
- package/dist/highlight/grammars/javascript.js +119 -0
- package/dist/highlight/grammars/javascript.js.map +1 -0
- package/dist/highlight/grammars/json.d.ts +3 -0
- package/dist/highlight/grammars/json.js +19 -0
- package/dist/highlight/grammars/json.js.map +1 -0
- package/dist/highlight/grammars/kotlin.d.ts +3 -0
- package/dist/highlight/grammars/kotlin.js +46 -0
- package/dist/highlight/grammars/kotlin.js.map +1 -0
- package/dist/highlight/grammars/markup.d.ts +3 -0
- package/dist/highlight/grammars/markup.js +45 -0
- package/dist/highlight/grammars/markup.js.map +1 -0
- package/dist/highlight/grammars/shared.d.ts +25 -0
- package/dist/highlight/grammars/shared.js +37 -0
- package/dist/highlight/grammars/shared.js.map +1 -0
- package/dist/highlight/grammars/shell.d.ts +3 -0
- package/dist/highlight/grammars/shell.js +48 -0
- package/dist/highlight/grammars/shell.js.map +1 -0
- package/dist/highlight/grammars/swift.d.ts +3 -0
- package/dist/highlight/grammars/swift.js +46 -0
- package/dist/highlight/grammars/swift.js.map +1 -0
- package/dist/highlight/grammars/typescript.d.ts +2 -0
- package/dist/highlight/grammars/typescript.js +5 -0
- package/dist/highlight/grammars/typescript.js.map +1 -0
- package/dist/highlight/index.d.ts +104 -0
- package/dist/highlight/index.js +331 -0
- package/dist/highlight/index.js.map +1 -0
- package/dist/icons.css +107 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +10 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/link-card.css +678 -0
- package/dist/link.css +728 -0
- package/dist/link.d.ts +21 -0
- package/dist/link.js +594 -0
- package/dist/link.js.map +1 -0
- package/dist/links/index.d.ts +136 -0
- package/dist/links/index.js +404 -0
- package/dist/links/index.js.map +1 -0
- package/dist/links/node/address.js +154 -0
- package/dist/links/node/cli.js +102 -0
- package/dist/links/node/fetcher.js +267 -0
- package/dist/links/node/head.js +278 -0
- package/dist/links/node/index.d.ts +164 -0
- package/dist/links/node/index.js +26 -0
- package/dist/links/node/links.js +275 -0
- package/dist/links/node/lock.js +86 -0
- package/dist/links/node/mark.js +71 -0
- package/dist/links/node/options.js +120 -0
- package/dist/links/node/pictures.js +265 -0
- package/dist/links/node/refresh.js +28 -0
- package/dist/menu.css +97 -0
- package/dist/menubar.css +69 -0
- package/dist/page-header.css +324 -0
- package/dist/pagination.css +410 -0
- package/dist/pagination.d.ts +6 -0
- package/dist/pagination.js +256 -0
- package/dist/pagination.js.map +1 -0
- package/dist/primitives/actions.d.ts +75 -0
- package/dist/primitives/actions.js +142 -0
- package/dist/primitives/actions.js.map +1 -0
- package/dist/primitives/after-click.d.ts +8 -0
- package/dist/primitives/after-click.js +21 -0
- package/dist/primitives/after-click.js.map +1 -0
- package/dist/primitives/anchored.d.ts +134 -0
- package/dist/primitives/anchored.js +425 -0
- package/dist/primitives/anchored.js.map +1 -0
- package/dist/primitives/arc.d.ts +13 -0
- package/dist/primitives/arc.js +49 -0
- package/dist/primitives/arc.js.map +1 -0
- package/dist/primitives/arrow.d.ts +47 -0
- package/dist/primitives/arrow.js +159 -0
- package/dist/primitives/arrow.js.map +1 -0
- package/dist/primitives/auto-height.d.ts +56 -0
- package/dist/primitives/auto-height.js +150 -0
- package/dist/primitives/auto-height.js.map +1 -0
- package/dist/primitives/autofocus.d.ts +11 -0
- package/dist/primitives/autofocus.js +26 -0
- package/dist/primitives/autofocus.js.map +1 -0
- package/dist/primitives/availability.d.ts +32 -0
- package/dist/primitives/availability.js +122 -0
- package/dist/primitives/availability.js.map +1 -0
- package/dist/primitives/axes.d.ts +45 -0
- package/dist/primitives/axes.js +72 -0
- package/dist/primitives/axes.js.map +1 -0
- package/dist/primitives/behavior.d.ts +14 -0
- package/dist/primitives/behavior.js +19 -0
- package/dist/primitives/behavior.js.map +1 -0
- package/dist/primitives/calendar-date.d.ts +79 -0
- package/dist/primitives/calendar-date.js +135 -0
- package/dist/primitives/calendar-date.js.map +1 -0
- package/dist/primitives/composed.d.ts +144 -0
- package/dist/primitives/composed.js +303 -0
- package/dist/primitives/composed.js.map +1 -0
- package/dist/primitives/default-button.d.ts +49 -0
- package/dist/primitives/default-button.js +270 -0
- package/dist/primitives/default-button.js.map +1 -0
- package/dist/primitives/description.d.ts +18 -0
- package/dist/primitives/description.js +18 -0
- package/dist/primitives/description.js.map +1 -0
- package/dist/primitives/destination.d.ts +259 -0
- package/dist/primitives/destination.js +651 -0
- package/dist/primitives/destination.js.map +1 -0
- package/dist/primitives/direction.d.ts +23 -0
- package/dist/primitives/direction.js +90 -0
- package/dist/primitives/direction.js.map +1 -0
- package/dist/primitives/disabled-while-focused.d.ts +46 -0
- package/dist/primitives/disabled-while-focused.js +126 -0
- package/dist/primitives/disabled-while-focused.js.map +1 -0
- package/dist/primitives/disclosure.d.ts +9 -0
- package/dist/primitives/disclosure.js +15 -0
- package/dist/primitives/disclosure.js.map +1 -0
- package/dist/primitives/dismiss.d.ts +88 -0
- package/dist/primitives/dismiss.js +232 -0
- package/dist/primitives/dismiss.js.map +1 -0
- package/dist/primitives/field-frame.d.ts +166 -0
- package/dist/primitives/field-frame.js +358 -0
- package/dist/primitives/field-frame.js.map +1 -0
- package/dist/primitives/field-group-frame.d.ts +59 -0
- package/dist/primitives/field-group-frame.js +174 -0
- package/dist/primitives/field-group-frame.js.map +1 -0
- package/dist/primitives/field-trigger.d.ts +117 -0
- package/dist/primitives/field-trigger.js +387 -0
- package/dist/primitives/field-trigger.js.map +1 -0
- package/dist/primitives/field.d.ts +186 -0
- package/dist/primitives/field.js +349 -0
- package/dist/primitives/field.js.map +1 -0
- package/dist/primitives/file-format.d.ts +23 -0
- package/dist/primitives/file-format.js +185 -0
- package/dist/primitives/file-format.js.map +1 -0
- package/dist/primitives/file-item-holder.d.ts +45 -0
- package/dist/primitives/file-item-holder.js +39 -0
- package/dist/primitives/file-item-holder.js.map +1 -0
- package/dist/primitives/focus-order.d.ts +11 -0
- package/dist/primitives/focus-order.js +11 -0
- package/dist/primitives/focus-order.js.map +1 -0
- package/dist/primitives/focus-ring.d.ts +76 -0
- package/dist/primitives/focus-ring.js +230 -0
- package/dist/primitives/focus-ring.js.map +1 -0
- package/dist/primitives/follow.d.ts +65 -0
- package/dist/primitives/follow.js +283 -0
- package/dist/primitives/follow.js.map +1 -0
- package/dist/primitives/form-disabled.d.ts +20 -0
- package/dist/primitives/form-disabled.js +46 -0
- package/dist/primitives/form-disabled.js.map +1 -0
- package/dist/primitives/form-says.d.ts +33 -0
- package/dist/primitives/form-says.js +45 -0
- package/dist/primitives/form-says.js.map +1 -0
- package/dist/primitives/forward.d.ts +13 -0
- package/dist/primitives/forward.js +28 -0
- package/dist/primitives/forward.js.map +1 -0
- package/dist/primitives/glyph-mirror.d.ts +77 -0
- package/dist/primitives/glyph-mirror.js +211 -0
- package/dist/primitives/glyph-mirror.js.map +1 -0
- package/dist/primitives/glyph-pending.d.ts +17 -0
- package/dist/primitives/glyph-pending.js +91 -0
- package/dist/primitives/glyph-pending.js.map +1 -0
- package/dist/primitives/glyph.d.ts +53 -0
- package/dist/primitives/glyph.js +161 -0
- package/dist/primitives/glyph.js.map +1 -0
- package/dist/primitives/group-item.d.ts +128 -0
- package/dist/primitives/group-item.js +334 -0
- package/dist/primitives/group-item.js.map +1 -0
- package/dist/primitives/hidden.d.ts +2 -0
- package/dist/primitives/hidden.js +23 -0
- package/dist/primitives/hidden.js.map +1 -0
- package/dist/primitives/host-aria.d.ts +8 -0
- package/dist/primitives/host-aria.js +18 -0
- package/dist/primitives/host-aria.js.map +1 -0
- package/dist/primitives/index.d.ts +59 -0
- package/dist/primitives/index.js +189 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/indicator-drag.d.ts +90 -0
- package/dist/primitives/indicator-drag.js +207 -0
- package/dist/primitives/indicator-drag.js.map +1 -0
- package/dist/primitives/interactive.d.ts +13 -0
- package/dist/primitives/interactive.js +67 -0
- package/dist/primitives/interactive.js.map +1 -0
- package/dist/primitives/item-row.d.ts +34 -0
- package/dist/primitives/item-row.js +76 -0
- package/dist/primitives/item-row.js.map +1 -0
- package/dist/primitives/item-update.d.ts +2 -0
- package/dist/primitives/item-update.js +12 -0
- package/dist/primitives/item-update.js.map +1 -0
- package/dist/primitives/kept-length.d.ts +34 -0
- package/dist/primitives/kept-length.js +154 -0
- package/dist/primitives/kept-length.js.map +1 -0
- package/dist/primitives/keyboard-convention.d.ts +30 -0
- package/dist/primitives/keyboard-convention.js +88 -0
- package/dist/primitives/keyboard-convention.js.map +1 -0
- package/dist/primitives/label-lines.d.ts +12 -0
- package/dist/primitives/label-lines.js +34 -0
- package/dist/primitives/label-lines.js.map +1 -0
- package/dist/primitives/layout-scale.d.ts +18 -0
- package/dist/primitives/layout-scale.js +35 -0
- package/dist/primitives/layout-scale.js.map +1 -0
- package/dist/primitives/link.d.ts +147 -0
- package/dist/primitives/link.js +204 -0
- package/dist/primitives/link.js.map +1 -0
- package/dist/primitives/locale-date.d.ts +132 -0
- package/dist/primitives/locale-date.js +508 -0
- package/dist/primitives/locale-date.js.map +1 -0
- package/dist/primitives/missing-value.d.ts +16 -0
- package/dist/primitives/missing-value.js +31 -0
- package/dist/primitives/missing-value.js.map +1 -0
- package/dist/primitives/modal.d.ts +38 -0
- package/dist/primitives/modal.js +175 -0
- package/dist/primitives/modal.js.map +1 -0
- package/dist/primitives/native-text.d.ts +51 -0
- package/dist/primitives/native-text.js +77 -0
- package/dist/primitives/native-text.js.map +1 -0
- package/dist/primitives/natural-height.d.ts +21 -0
- package/dist/primitives/natural-height.js +36 -0
- package/dist/primitives/natural-height.js.map +1 -0
- package/dist/primitives/option-list.d.ts +314 -0
- package/dist/primitives/option-list.js +1098 -0
- package/dist/primitives/option-list.js.map +1 -0
- package/dist/primitives/overlay-focus.d.ts +48 -0
- package/dist/primitives/overlay-focus.js +152 -0
- package/dist/primitives/overlay-focus.js.map +1 -0
- package/dist/primitives/placement.d.ts +131 -0
- package/dist/primitives/placement.js +144 -0
- package/dist/primitives/placement.js.map +1 -0
- package/dist/primitives/places.d.ts +44 -0
- package/dist/primitives/places.js +98 -0
- package/dist/primitives/places.js.map +1 -0
- package/dist/primitives/press.d.ts +90 -0
- package/dist/primitives/press.js +153 -0
- package/dist/primitives/press.js.map +1 -0
- package/dist/primitives/report.d.ts +17 -0
- package/dist/primitives/report.js +34 -0
- package/dist/primitives/report.js.map +1 -0
- package/dist/primitives/ripple.d.ts +40 -0
- package/dist/primitives/ripple.js +70 -0
- package/dist/primitives/ripple.js.map +1 -0
- package/dist/primitives/roving.d.ts +41 -0
- package/dist/primitives/roving.js +71 -0
- package/dist/primitives/roving.js.map +1 -0
- package/dist/primitives/selection.d.ts +134 -0
- package/dist/primitives/selection.js +287 -0
- package/dist/primitives/selection.js.map +1 -0
- package/dist/primitives/separation.d.ts +28 -0
- package/dist/primitives/separation.js +96 -0
- package/dist/primitives/separation.js.map +1 -0
- package/dist/primitives/shared-choice.d.ts +33 -0
- package/dist/primitives/shared-choice.js +110 -0
- package/dist/primitives/shared-choice.js.map +1 -0
- package/dist/primitives/sheet.d.ts +63 -0
- package/dist/primitives/sheet.js +139 -0
- package/dist/primitives/sheet.js.map +1 -0
- package/dist/primitives/sheets.d.ts +8 -0
- package/dist/primitives/sheets.js +96 -0
- package/dist/primitives/sheets.js.map +1 -0
- package/dist/primitives/states.d.ts +33 -0
- package/dist/primitives/states.js +30 -0
- package/dist/primitives/states.js.map +1 -0
- package/dist/primitives/system-watch.d.ts +9 -0
- package/dist/primitives/system-watch.js +29 -0
- package/dist/primitives/system-watch.js.map +1 -0
- package/dist/primitives/target.d.ts +21 -0
- package/dist/primitives/target.js +79 -0
- package/dist/primitives/target.js.map +1 -0
- package/dist/primitives/values.d.ts +6 -0
- package/dist/primitives/values.js +22 -0
- package/dist/primitives/values.js.map +1 -0
- package/dist/primitives/visibility.d.ts +12 -0
- package/dist/primitives/visibility.js +50 -0
- package/dist/primitives/visibility.js.map +1 -0
- package/dist/primitives/words.d.ts +81 -0
- package/dist/primitives/words.js +236 -0
- package/dist/primitives/words.js.map +1 -0
- package/dist/prose.css +1917 -0
- package/dist/registry.d.ts +182 -0
- package/dist/registry.js +2 -0
- package/dist/registry.js.map +1 -0
- package/dist/shape.css +21 -0
- package/dist/skeleton.css +428 -0
- package/dist/steps.css +231 -0
- package/dist/steps.d.ts +6 -0
- package/dist/steps.js +156 -0
- package/dist/steps.js.map +1 -0
- package/dist/styles/icons.d.ts +62 -0
- package/dist/styles/icons.js +237 -0
- package/dist/styles/icons.js.map +1 -0
- package/dist/styles/product-text.d.ts +66 -0
- package/dist/styles/product-text.js +114 -0
- package/dist/styles/product-text.js.map +1 -0
- package/dist/styles/registered-properties.d.ts +6 -0
- package/dist/styles/registered-properties.js +68 -0
- package/dist/styles/registered-properties.js.map +1 -0
- package/dist/styles/shape.d.ts +59 -0
- package/dist/styles/shape.js +95 -0
- package/dist/styles/shape.js.map +1 -0
- package/dist/systems/cupertino.css +8793 -0
- package/dist/systems/m3-expressive-like.css +8786 -0
- package/dist/systems/m3-like.css +8748 -0
- package/dist/table-of-contents.css +482 -0
- package/dist/table.css +902 -0
- package/dist/tanrei.bundle.js +26644 -0
- package/dist/tanrei.bundle.js.map +7 -0
- package/dist/text.css +104 -0
- package/dist/timeline.css +410 -0
- package/dist/timeline.d.ts +6 -0
- package/dist/timeline.js +176 -0
- package/dist/timeline.js.map +1 -0
- package/dist/tokens.css +8801 -0
- package/dist/tree-view.css +797 -0
- package/dist/words.d.ts +2 -0
- package/dist/words.js +6 -0
- package/dist/words.js.map +1 -0
- package/package.json +132 -3
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
+
import { AvailabilityController, PressController, SHEET_FLING_VELOCITY, SheetDrag, closeRequestReason, deepActive, focusWithin, holdPageScroll, keyboardCover, modalLayer, modalSheetKeys, onBackdrop, report, returnFocus, syncFocusStyle, watchEscape, WordsController, } from '../../primitives/index.js';
|
|
4
|
+
import { styles } from './bottom-sheet.styles.js';
|
|
5
|
+
const VARIANTS = ['standard', 'modal'];
|
|
6
|
+
const DETENTS = ['partial', 'full'];
|
|
7
|
+
/**
|
|
8
|
+
* BSH-9: where a released drag goes — `close` (below half the lowest height, or a downward fling with no height below
|
|
9
|
+
* it), else the next height in the direction of a fling, else the nearest. `position` is the sheet's visible height at
|
|
10
|
+
* the release, `velocity` its vertical speed in px per ms (positive: down).
|
|
11
|
+
*/
|
|
12
|
+
export function bottomSheetRelease(position, velocity, heights) {
|
|
13
|
+
const stops = heights.two
|
|
14
|
+
? [
|
|
15
|
+
{ detent: 'partial', height: heights.partial },
|
|
16
|
+
{ detent: 'full', height: heights.full },
|
|
17
|
+
]
|
|
18
|
+
: [{ detent: 'partial', height: heights.partial }];
|
|
19
|
+
const lowest = stops[0];
|
|
20
|
+
if (velocity > SHEET_FLING_VELOCITY) {
|
|
21
|
+
const below = stops.filter((stop) => stop.height < position - 0.5);
|
|
22
|
+
return below.length > 0 ? below[below.length - 1].detent : 'close';
|
|
23
|
+
}
|
|
24
|
+
if (position < lowest.height / 2)
|
|
25
|
+
return 'close';
|
|
26
|
+
if (velocity < -SHEET_FLING_VELOCITY)
|
|
27
|
+
return (stops.find((stop) => stop.height > position + 0.5) ?? stops[stops.length - 1]).detent;
|
|
28
|
+
return stops.reduce((best, stop) => (Math.abs(stop.height - position) < Math.abs(best.height - position) ? stop : best)).detent;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Shows supplementary content or a short task in a surface that rises from the bottom edge: `standard`, over the lower
|
|
32
|
+
* part of its parent while the content above stays usable (a layout region), or `modal`, a modal step that dims
|
|
33
|
+
* and blocks everything else until it is dismissed (a modal overlay).
|
|
34
|
+
*
|
|
35
|
+
* Contract: specs/bottom-sheet.spec.json. The content is the default slot. The sheet is as tall as its drag handle's row
|
|
36
|
+
* and its content, up to its `detent`: `partial` takes `container.partial-fraction` of the area, `full` reaches up to
|
|
37
|
+
* `container.margin-block-start` below its top. The person moves it between the two by dragging (the handle's row, the
|
|
38
|
+
* content's padding, or the content where it lets the drag through) or with the drag handle, a button while there are
|
|
39
|
+
* two heights; the element sets `detent` and fires `detentchange`.
|
|
40
|
+
*
|
|
41
|
+
* Controlled: the sheet never closes itself. While `closedby` is not `none` it fires `close` with a reason — a released
|
|
42
|
+
* drag below its lowest height and, for a modal sheet, a press on the scrim, Escape or the platform's back — and you set
|
|
43
|
+
* `open` to false. A product that does not close it sees it settle back.
|
|
44
|
+
*
|
|
45
|
+
* Modal: a native `<dialog>` in the shadow root opened with `showModal()`: in the top layer over `::backdrop` (the scrim),
|
|
46
|
+
* docked to the window's bottom edge, everything else inert, the page held from scrolling and focus kept inside. Focus
|
|
47
|
+
* goes to the slotted element marked `autofocus`, else the sheet (also when it is mounted open), and returns where it was
|
|
48
|
+
* when it closes. Standard: a `<section>` named by `label`, docked to the bottom of its containing block — the host fills
|
|
49
|
+
* the nearest positioned ancestor, so give the parent that holds the sheet and the content `position: relative` — with
|
|
50
|
+
* presses above it reaching the content; opening it moves focus in, closing it gives focus back, and Tab leaves it open.
|
|
51
|
+
*
|
|
52
|
+
* Every visual value comes from `--tanrei-comp-bottom-sheet-*` tokens. The color reaches under
|
|
53
|
+
* `env(safe-area-inset-bottom)`; the sheet sits on the on-screen keyboard (`visualViewport`).
|
|
54
|
+
*
|
|
55
|
+
* @tag tanrei-bottom-sheet
|
|
56
|
+
* @slot - The content: it gets `content.color` as its color, and plain text the body role.
|
|
57
|
+
* @csspart container - The sheet: the `<dialog>` of a modal sheet (its `::backdrop` is the scrim), the `<section>` of a standard one.
|
|
58
|
+
* @csspart handle - The drag handle's box: a `<button>` while the sheet has two heights, drawn at rest otherwise.
|
|
59
|
+
* @csspart grip - The grip drawn in the handle's box (hidden from assistive technology).
|
|
60
|
+
* @csspart content - The box that insets, clips and scrolls the content.
|
|
61
|
+
* @fires {CustomEvent<TanreiBottomSheetCloseDetail>} close - The sheet asks to be closed: `detail.reason` is `drag`, `scrim`, `escape` or `back`. Set `open` to false. Only while `closedby` is not `none`.
|
|
62
|
+
* @fires {CustomEvent<TanreiBottomSheetDetentChangeDetail>} detentchange - The person moved the sheet to its other height, by a drag or with the handle: `detail.detent` (and `detent`) is the new one. Not fired when you set `detent`.
|
|
63
|
+
*/
|
|
64
|
+
export class TanreiBottomSheet extends LitElement {
|
|
65
|
+
constructor() {
|
|
66
|
+
super(...arguments);
|
|
67
|
+
this.availability = new AvailabilityController(this, 'bottom-sheet');
|
|
68
|
+
/** The product's words, read where the instance gives none (src/primitives/words.ts). */
|
|
69
|
+
this.words = new WordsController(this);
|
|
70
|
+
/** `modal` (the default) dims and blocks everything else; `standard` covers the bottom of its parent with no scrim. Any other value is `modal`, reported (BSH-25). Reflected. */
|
|
71
|
+
this.variant = 'modal';
|
|
72
|
+
/** Whether the sheet is shown. Controlled: set it to false in answer to `close` (or from the sheet's own controls). Reflected. */
|
|
73
|
+
this.open = false;
|
|
74
|
+
/**
|
|
75
|
+
* The height it rests at while its content is taller than its partial height: `partial` (the default) or `full`. The
|
|
76
|
+
* element sets it when the person changes the height (and fires `detentchange`); setting it moves the sheet without an
|
|
77
|
+
* event. Any other value is `partial`, reported (BSH-25).
|
|
78
|
+
*/
|
|
79
|
+
this.detent = 'partial';
|
|
80
|
+
/** The spec's `dismissible`, as HTML's own attribute: `none` ignores a drag below the lowest height, Escape, back and the scrim; any other value is `any`. Reflected. */
|
|
81
|
+
this.closedBy = 'any';
|
|
82
|
+
/** Draws the drag handle. False (the `no-handle` attribute) draws none; the sheet can still be dragged by its content. */
|
|
83
|
+
this.handle = true;
|
|
84
|
+
/** The drag handle's accessible name ("Resize sheet"), required while it is a button (BSH-11). */
|
|
85
|
+
this.handleLabel = '';
|
|
86
|
+
/** Insets the content by `container.padding`. False (the `flush` attribute) lets it reach the edges (a list with its own padding). */
|
|
87
|
+
this.inset = true;
|
|
88
|
+
/** Names the modal dialog, or the standard sheet's region ("Share photo"). Required (BSH-22). */
|
|
89
|
+
this.label = '';
|
|
90
|
+
/** BSH-6, BSH-11: whether the content is taller than the partial height (two heights: the handle is a button). */
|
|
91
|
+
this.two = false;
|
|
92
|
+
this.heights = null;
|
|
93
|
+
/** Where focus was when the sheet opened (BSH-3). */
|
|
94
|
+
this.opener = null;
|
|
95
|
+
/** A modal sheet is presented (in the top layer). */
|
|
96
|
+
this.shown = false;
|
|
97
|
+
this.pressedScrim = false;
|
|
98
|
+
this.dragged = false;
|
|
99
|
+
this.drag = null;
|
|
100
|
+
this.dragOnContent = false;
|
|
101
|
+
/** The sheet's visible height while it follows a drag. */
|
|
102
|
+
this.position = 0;
|
|
103
|
+
this.settling = null;
|
|
104
|
+
/** The sheet changed `detent` itself (a drag, the handle): no product move follows. */
|
|
105
|
+
this.choosing = false;
|
|
106
|
+
/** Where a product's change of `detent` starts from (BSH-21). */
|
|
107
|
+
this.movingFrom = null;
|
|
108
|
+
/** Whether focus was inside a standard sheet that is closing (read before the render makes it inert). */
|
|
109
|
+
this.closingWithFocus = false;
|
|
110
|
+
this.resize$ = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.measure());
|
|
111
|
+
/** BSH-13…17: the handle's pressed state, press-hold and the answer the system chooses (src/primitives/press.ts). */
|
|
112
|
+
this.press = new PressController(this, {
|
|
113
|
+
container: () => this.handleButton,
|
|
114
|
+
holdCarrier: () => this.renderRoot?.querySelector('.hold') ?? null,
|
|
115
|
+
disabled: () => !this.interactive,
|
|
116
|
+
});
|
|
117
|
+
/** BSH-5, BSH-2: Escape asks to close (only the topmost overlay answers it); Tab stays inside. */
|
|
118
|
+
this.onKeyDown = (event) => {
|
|
119
|
+
const dialog = this.dialog;
|
|
120
|
+
// BSH-23: an overlay opened from the content above this one answers its own Escape; the browser's own close request
|
|
121
|
+
// never runs (the product closes the sheet).
|
|
122
|
+
if (dialog)
|
|
123
|
+
modalSheetKeys(event, dialog, () => this.requestClose('escape'));
|
|
124
|
+
};
|
|
125
|
+
/** A close request without a key the sheet saw (Android's back) arrives as the native cancel. */
|
|
126
|
+
this.onNativeCancel = (event) => {
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
this.requestClose(closeRequestReason(event));
|
|
129
|
+
};
|
|
130
|
+
/** The browser closed the dialog itself (a close request it would not let the sheet cancel): ask, and stay unless closed. */
|
|
131
|
+
this.onNativeClose = () => {
|
|
132
|
+
const dialog = this.dialog;
|
|
133
|
+
if (!this.shown || !dialog || dialog.open)
|
|
134
|
+
return;
|
|
135
|
+
this.requestClose('back');
|
|
136
|
+
if (this.open && this.modal)
|
|
137
|
+
dialog.showModal();
|
|
138
|
+
};
|
|
139
|
+
this.onClick = (event) => {
|
|
140
|
+
const scrim = this.pressedScrim && onBackdrop(event, this.dialog);
|
|
141
|
+
this.pressedScrim = false;
|
|
142
|
+
if (scrim)
|
|
143
|
+
this.requestClose('scrim');
|
|
144
|
+
};
|
|
145
|
+
// ---- BSH-9, BSH-10, BSH-20: the drag ----
|
|
146
|
+
this.onPointerDown = (event) => {
|
|
147
|
+
this.pressedScrim = this.modal && onBackdrop(event, this.dialog);
|
|
148
|
+
if (this.pressedScrim || !this.open || (this.modal && !this.shown))
|
|
149
|
+
return;
|
|
150
|
+
if (this.drag || (event.pointerType === 'mouse' && event.button !== 0))
|
|
151
|
+
return;
|
|
152
|
+
this.drag = new SheetDrag(event, 'y');
|
|
153
|
+
const content = this.content;
|
|
154
|
+
this.dragOnContent = !!content && event.composedPath().includes(content);
|
|
155
|
+
// The drag is followed through the window, wherever the pointer goes (pointer capture alone can fail to take).
|
|
156
|
+
this.listenToDrag(true);
|
|
157
|
+
};
|
|
158
|
+
this.onPointerMove = (event) => {
|
|
159
|
+
const drag = this.drag;
|
|
160
|
+
if (!drag || event.pointerId !== drag.id)
|
|
161
|
+
return;
|
|
162
|
+
const step = drag.move(event);
|
|
163
|
+
if (step === 'wait')
|
|
164
|
+
return;
|
|
165
|
+
if (step === 'start')
|
|
166
|
+
this.startFollowing(event);
|
|
167
|
+
this.follow(drag.delta(event));
|
|
168
|
+
};
|
|
169
|
+
this.onPointerUp = (event) => {
|
|
170
|
+
const drag = this.drag;
|
|
171
|
+
if (drag && event.pointerId !== drag.id)
|
|
172
|
+
return;
|
|
173
|
+
this.drag = null;
|
|
174
|
+
this.listenToDrag(false);
|
|
175
|
+
const sheet = this.sheet;
|
|
176
|
+
if (!drag || !sheet || !drag.following)
|
|
177
|
+
return;
|
|
178
|
+
sheet.classList.remove('dragging');
|
|
179
|
+
// The click that ends a drag activates nothing.
|
|
180
|
+
this.dragged = true;
|
|
181
|
+
setTimeout(() => (this.dragged = false), 0);
|
|
182
|
+
const heights = this.heights;
|
|
183
|
+
if (!heights)
|
|
184
|
+
return;
|
|
185
|
+
const velocity = event.type === 'pointercancel' ? 0 : drag.velocity(event);
|
|
186
|
+
const decision = bottomSheetRelease(this.position, velocity, heights);
|
|
187
|
+
if (decision !== 'close') {
|
|
188
|
+
this.settleTo(decision);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
// BSH-5: a sheet that cannot be dismissed settles at its lowest height.
|
|
192
|
+
if (!this.dismissible) {
|
|
193
|
+
this.settleTo('partial');
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
// BSH-20: ask, hold where the drag left it for one frame, then slide out (open false) or settle back (declined).
|
|
197
|
+
this.requestClose('drag');
|
|
198
|
+
requestAnimationFrame(() => {
|
|
199
|
+
if (this.open && this.isConnected)
|
|
200
|
+
this.settleTo('partial');
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
/** Swallows the click that ends a drag, before it reaches the handle or the content. */
|
|
204
|
+
this.onClickCapture = {
|
|
205
|
+
capture: true,
|
|
206
|
+
handleEvent: (event) => {
|
|
207
|
+
if (!this.dragged)
|
|
208
|
+
return;
|
|
209
|
+
event.stopPropagation();
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
// ---- BSH-11: the drag handle ----
|
|
214
|
+
this.onHandleClick = () => {
|
|
215
|
+
if (this.dragged || !this.interactive)
|
|
216
|
+
return;
|
|
217
|
+
this.settleTo(this.resting === 'full' ? 'partial' : 'full');
|
|
218
|
+
};
|
|
219
|
+
this.onHandleFocus = () => syncFocusStyle(this, this.handleButton);
|
|
220
|
+
this.onScroll = () => this.syncTouch();
|
|
221
|
+
/** BSH-6, BSH-7: the area ends at the on-screen keyboard, and nothing is under the bottom inset while it is shown. */
|
|
222
|
+
this.onViewport = () => {
|
|
223
|
+
const cover = this.modal ? keyboardCover() : keyboardCover(this.getBoundingClientRect().bottom);
|
|
224
|
+
for (const element of this.renderRoot?.querySelectorAll('.sheet, .area') ?? [])
|
|
225
|
+
element.style.setProperty('--_keyboard', `${cover}px`);
|
|
226
|
+
this.sheet?.classList.toggle('keyboard', cover > 0);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
static { this.styles = styles; }
|
|
230
|
+
static { this.properties = {
|
|
231
|
+
variant: { type: String, reflect: true },
|
|
232
|
+
open: { type: Boolean, reflect: true },
|
|
233
|
+
detent: { type: String },
|
|
234
|
+
closedBy: { type: String, attribute: 'closedby', reflect: true },
|
|
235
|
+
// An HTML boolean attribute cannot default to true: the attributes are the inverses, `no-handle` and `flush`.
|
|
236
|
+
handle: {
|
|
237
|
+
attribute: 'no-handle',
|
|
238
|
+
reflect: true,
|
|
239
|
+
converter: { fromAttribute: (value) => value === null, toAttribute: (value) => (value ? null : '') },
|
|
240
|
+
},
|
|
241
|
+
handleLabel: { type: String, attribute: 'handle-label' },
|
|
242
|
+
inset: {
|
|
243
|
+
attribute: 'flush',
|
|
244
|
+
reflect: true,
|
|
245
|
+
converter: { fromAttribute: (value) => value === null, toAttribute: (value) => (value ? null : '') },
|
|
246
|
+
},
|
|
247
|
+
label: { type: String },
|
|
248
|
+
two: { state: true },
|
|
249
|
+
}; }
|
|
250
|
+
get modal() {
|
|
251
|
+
return this.variant !== 'standard';
|
|
252
|
+
}
|
|
253
|
+
get dismissible() {
|
|
254
|
+
return this.closedBy !== 'none';
|
|
255
|
+
}
|
|
256
|
+
/** The detent drawn: an unknown value is `partial` (BSH-25). */
|
|
257
|
+
get resting() {
|
|
258
|
+
return this.detent === 'full' ? 'full' : 'partial';
|
|
259
|
+
}
|
|
260
|
+
/** BSH-11: the handle is a control only while the sheet has two heights. */
|
|
261
|
+
get interactive() {
|
|
262
|
+
return this.handle && this.two;
|
|
263
|
+
}
|
|
264
|
+
get sheet() {
|
|
265
|
+
return this.renderRoot?.querySelector('.sheet') ?? null;
|
|
266
|
+
}
|
|
267
|
+
get dialog() {
|
|
268
|
+
return this.renderRoot?.querySelector('dialog') ?? null;
|
|
269
|
+
}
|
|
270
|
+
get content() {
|
|
271
|
+
return this.renderRoot?.querySelector('.content') ?? null;
|
|
272
|
+
}
|
|
273
|
+
get handleButton() {
|
|
274
|
+
return this.renderRoot?.querySelector('button.handle') ?? null;
|
|
275
|
+
}
|
|
276
|
+
connectedCallback() {
|
|
277
|
+
super.connectedCallback();
|
|
278
|
+
window.visualViewport?.addEventListener('resize', this.onViewport);
|
|
279
|
+
window.visualViewport?.addEventListener('scroll', this.onViewport);
|
|
280
|
+
// Moved in the document while open: presented again, in place (as mounted).
|
|
281
|
+
if (this.hasUpdated && this.open && this.modal)
|
|
282
|
+
this.present(true);
|
|
283
|
+
}
|
|
284
|
+
disconnectedCallback() {
|
|
285
|
+
super.disconnectedCallback();
|
|
286
|
+
window.visualViewport?.removeEventListener('resize', this.onViewport);
|
|
287
|
+
window.visualViewport?.removeEventListener('scroll', this.onViewport);
|
|
288
|
+
this.resize$?.disconnect();
|
|
289
|
+
this.drag = null;
|
|
290
|
+
this.listenToDrag(false);
|
|
291
|
+
this.cancelSettle();
|
|
292
|
+
if (this.shown)
|
|
293
|
+
this.withdraw(false);
|
|
294
|
+
}
|
|
295
|
+
// ---- BSH-5: asking to close ----
|
|
296
|
+
/** BSH-5: `close` with the reason, once, while dismissible; a standard sheet answers only a drag. */
|
|
297
|
+
requestClose(reason) {
|
|
298
|
+
if (!this.dismissible || !this.open)
|
|
299
|
+
return;
|
|
300
|
+
if (!this.modal && reason !== 'drag')
|
|
301
|
+
return;
|
|
302
|
+
this.dispatchEvent(new CustomEvent('close', { detail: { reason } }));
|
|
303
|
+
}
|
|
304
|
+
listenToDrag(on) {
|
|
305
|
+
const listeners = [
|
|
306
|
+
['pointermove', this.onPointerMove],
|
|
307
|
+
['pointerup', this.onPointerUp],
|
|
308
|
+
['pointercancel', this.onPointerUp],
|
|
309
|
+
];
|
|
310
|
+
for (const [type, listener] of listeners) {
|
|
311
|
+
if (on)
|
|
312
|
+
window.addEventListener(type, listener, true);
|
|
313
|
+
else
|
|
314
|
+
window.removeEventListener(type, listener, true);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/** The drag has passed the slop: the sheet follows it from where it is drawn (mid-motion included). */
|
|
318
|
+
startFollowing(event) {
|
|
319
|
+
const sheet = this.sheet;
|
|
320
|
+
if (!sheet)
|
|
321
|
+
return;
|
|
322
|
+
this.measure();
|
|
323
|
+
const drawn = this.drawn();
|
|
324
|
+
this.cancelSettle();
|
|
325
|
+
this.position = drawn.height - drawn.offset;
|
|
326
|
+
sheet.classList.add('dragging');
|
|
327
|
+
try {
|
|
328
|
+
sheet.setPointerCapture?.(event.pointerId);
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
// A pointer the browser no longer counts as active cannot be captured; the window still follows it.
|
|
332
|
+
}
|
|
333
|
+
// BSH-13: a drag that starts on the handle does not leave it pressed. The controller's disconnect is its cancel: it
|
|
334
|
+
// clears the pressed state and the ripple at once, where a release would hold them for press-hold.
|
|
335
|
+
if (this.handleButton?.dataset.pressed !== undefined)
|
|
336
|
+
this.press.hostDisconnected();
|
|
337
|
+
this.place(this.position);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* BSH-9, BSH-10: follows a move of `dy` (positive: down), never above the highest height. On the content, a move up
|
|
341
|
+
* first raises the sheet to its full height and then scrolls the content; a move down first scrolls the content to its
|
|
342
|
+
* top and then lowers the sheet.
|
|
343
|
+
*/
|
|
344
|
+
follow(dy) {
|
|
345
|
+
const heights = this.heights;
|
|
346
|
+
const content = this.content;
|
|
347
|
+
if (!heights || !content)
|
|
348
|
+
return;
|
|
349
|
+
const highest = heights.two ? heights.full : heights.partial;
|
|
350
|
+
if (dy < 0) {
|
|
351
|
+
const raised = Math.min(Math.max(0, highest - this.position), -dy);
|
|
352
|
+
this.position += raised;
|
|
353
|
+
const rest = -dy - raised;
|
|
354
|
+
if (rest > 0 && this.dragOnContent)
|
|
355
|
+
content.scrollTop += rest;
|
|
356
|
+
}
|
|
357
|
+
else if (dy > 0) {
|
|
358
|
+
let rest = dy;
|
|
359
|
+
if (this.dragOnContent && content.scrollTop > 0) {
|
|
360
|
+
const scrolled = Math.min(content.scrollTop, rest);
|
|
361
|
+
content.scrollTop -= scrolled;
|
|
362
|
+
rest -= scrolled;
|
|
363
|
+
}
|
|
364
|
+
this.position = Math.max(0, this.position - rest);
|
|
365
|
+
}
|
|
366
|
+
this.place(this.position);
|
|
367
|
+
}
|
|
368
|
+
/** Draws the sheet `position` high: above its lowest height by its own height, below it by an offset down. */
|
|
369
|
+
place(position) {
|
|
370
|
+
const sheet = this.sheet;
|
|
371
|
+
const heights = this.heights;
|
|
372
|
+
if (!sheet || !heights)
|
|
373
|
+
return;
|
|
374
|
+
const lowest = heights.partial;
|
|
375
|
+
sheet.style.maxBlockSize = 'none';
|
|
376
|
+
sheet.style.blockSize = `${Math.max(position, lowest)}px`;
|
|
377
|
+
sheet.style.setProperty('--_drag', `${Math.max(0, lowest - position)}px`);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* The sheet as drawn: its height, and how far below the area's bottom edge (where it rests) its bottom edge is —
|
|
381
|
+
* whatever is moving it (a drag, a settle, the enter or exit motion).
|
|
382
|
+
*/
|
|
383
|
+
drawn() {
|
|
384
|
+
const sheet = this.sheet;
|
|
385
|
+
const area = this.renderRoot?.querySelector('.area');
|
|
386
|
+
if (!sheet || !area)
|
|
387
|
+
return { height: 0, offset: 0 };
|
|
388
|
+
const box = sheet.getBoundingClientRect();
|
|
389
|
+
return { height: box.height, offset: Math.max(0, box.bottom - area.getBoundingClientRect().bottom) };
|
|
390
|
+
}
|
|
391
|
+
/** Back to the resting layout: no drawn height or offset of the sheet's own. */
|
|
392
|
+
clearPlacement() {
|
|
393
|
+
const sheet = this.sheet;
|
|
394
|
+
if (!sheet)
|
|
395
|
+
return;
|
|
396
|
+
sheet.style.removeProperty('max-block-size');
|
|
397
|
+
sheet.style.removeProperty('block-size');
|
|
398
|
+
sheet.style.removeProperty('--_drag');
|
|
399
|
+
}
|
|
400
|
+
cancelSettle() {
|
|
401
|
+
const running = this.settling;
|
|
402
|
+
this.settling = null;
|
|
403
|
+
running?.cancel();
|
|
404
|
+
this.sheet?.classList.remove('settling');
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* BSH-9, BSH-11: settles at `detent` — and, where the sheet has two heights and it is not the one it rests at, the
|
|
408
|
+
* sheet sets `detent` to it and fires `detentchange` once.
|
|
409
|
+
*/
|
|
410
|
+
settleTo(detent) {
|
|
411
|
+
const heights = this.heights;
|
|
412
|
+
if (!heights)
|
|
413
|
+
return;
|
|
414
|
+
const from = this.drawn();
|
|
415
|
+
const target = heights.two && detent === 'full' ? heights.full : heights.partial;
|
|
416
|
+
if (heights.two && detent !== this.resting)
|
|
417
|
+
this.choose(detent);
|
|
418
|
+
this.settle(from, target);
|
|
419
|
+
}
|
|
420
|
+
/** The person chose a height: the sheet keeps it (BSH-21) and says so once. */
|
|
421
|
+
choose(detent) {
|
|
422
|
+
this.choosing = true;
|
|
423
|
+
this.detent = detent;
|
|
424
|
+
this.dispatchEvent(new CustomEvent('detentchange', { detail: { detent } }));
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Moves the sheet from where it is drawn to its resting height `target` over the enter motion (BSH-9, BSH-11, BSH-21),
|
|
428
|
+
* at once where motion is reduced. The resting layout is set first; the motion is an animation over it.
|
|
429
|
+
*/
|
|
430
|
+
settle(from, target) {
|
|
431
|
+
const sheet = this.sheet;
|
|
432
|
+
if (!sheet)
|
|
433
|
+
return;
|
|
434
|
+
// Read before anything changes: reading a computed style applies every change made so far.
|
|
435
|
+
const timing = this.renderRoot.querySelector('.timing');
|
|
436
|
+
const style = timing ? getComputedStyle(timing) : null;
|
|
437
|
+
const duration = style ? Number.parseFloat(style.transitionDuration) * 1000 : 0;
|
|
438
|
+
const easing = style?.transitionTimingFunction || 'ease';
|
|
439
|
+
const moves = Math.abs(from.height - target) >= 0.5 || from.offset >= 0.5;
|
|
440
|
+
const animate = moves && duration > 0 && typeof sheet.animate === 'function' && !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
441
|
+
this.cancelSettle();
|
|
442
|
+
// No transition of the sheet's own may start from the resting layout: the motion is the animation below.
|
|
443
|
+
sheet.classList.add('settling');
|
|
444
|
+
this.clearPlacement();
|
|
445
|
+
if (!animate) {
|
|
446
|
+
getComputedStyle(sheet).translate;
|
|
447
|
+
sheet.classList.remove('settling');
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const animation = sheet.animate([
|
|
451
|
+
{ blockSize: `${from.height}px`, maxBlockSize: 'none', translate: `0 ${from.offset}px` },
|
|
452
|
+
{ blockSize: `${target}px`, maxBlockSize: 'none', translate: '0 0px' },
|
|
453
|
+
], { duration, easing });
|
|
454
|
+
this.settling = animation;
|
|
455
|
+
animation.finished.then(() => {
|
|
456
|
+
if (this.settling !== animation)
|
|
457
|
+
return;
|
|
458
|
+
this.settling = null;
|
|
459
|
+
sheet.classList.remove('settling');
|
|
460
|
+
}, () => undefined);
|
|
461
|
+
}
|
|
462
|
+
// ---- BSH-6, BSH-7, BSH-10: the area, the heights and the keyboard ----
|
|
463
|
+
/** BSH-6: the heights, from the area's caps and the content's own height; BSH-10: whether the content scrolls. */
|
|
464
|
+
measure() {
|
|
465
|
+
const sheet = this.sheet;
|
|
466
|
+
const content = this.content;
|
|
467
|
+
const partialCap = this.renderRoot?.querySelector('.cap.partial');
|
|
468
|
+
const fullCap = this.renderRoot?.querySelector('.cap.full');
|
|
469
|
+
if (!sheet || !content || !partialCap || !fullCap)
|
|
470
|
+
return;
|
|
471
|
+
if (sheet.getClientRects().length === 0)
|
|
472
|
+
return;
|
|
473
|
+
const row = this.renderRoot.querySelector('.row')?.getBoundingClientRect().height ?? 0;
|
|
474
|
+
const end = Number.parseFloat(getComputedStyle(sheet).paddingBlockEnd) || 0;
|
|
475
|
+
const natural = row + content.scrollHeight + end;
|
|
476
|
+
const partial = Math.min(natural, partialCap.getBoundingClientRect().height);
|
|
477
|
+
const full = Math.min(natural, fullCap.getBoundingClientRect().height);
|
|
478
|
+
this.heights = { partial, full, two: full - partial > 0.5 };
|
|
479
|
+
if (this.two !== this.heights.two)
|
|
480
|
+
this.two = this.heights.two;
|
|
481
|
+
// BSH-10: a content that scrolls is a Tab stop, so the keyboard can scroll it.
|
|
482
|
+
if (content.scrollHeight > content.clientHeight + 0.5)
|
|
483
|
+
content.setAttribute('tabindex', '0');
|
|
484
|
+
else
|
|
485
|
+
content.removeAttribute('tabindex');
|
|
486
|
+
this.syncTouch();
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* BSH-10 on touch, where the browser decides who takes a drag when it begins: below its highest height the sheet takes
|
|
490
|
+
* every vertical drag on the content; at it, a drag up scrolls the content, and a drag down lowers the sheet once the
|
|
491
|
+
* content is at its top.
|
|
492
|
+
*/
|
|
493
|
+
syncTouch() {
|
|
494
|
+
const content = this.content;
|
|
495
|
+
if (!content)
|
|
496
|
+
return;
|
|
497
|
+
const highest = !this.heights?.two || this.resting === 'full';
|
|
498
|
+
content.dataset.touch = !highest ? 'sheet' : content.scrollTop <= 0 ? 'pan-down' : 'scroll';
|
|
499
|
+
}
|
|
500
|
+
// ---- BSH-2, BSH-3: presenting and focus ----
|
|
501
|
+
/** BSH-3: focus to the slotted element marked `autofocus`, else the sheet itself, so its label is read first. */
|
|
502
|
+
focusInside() {
|
|
503
|
+
const marked = this.querySelector('[autofocus]');
|
|
504
|
+
if (marked && !marked.closest('[inert]'))
|
|
505
|
+
marked.focus();
|
|
506
|
+
else
|
|
507
|
+
this.sheet?.focus();
|
|
508
|
+
}
|
|
509
|
+
/** BSH-3: focus back where it was when the sheet opened — or dropped, where that element is gone. */
|
|
510
|
+
restoreFocus() {
|
|
511
|
+
const opener = this.opener;
|
|
512
|
+
this.opener = null;
|
|
513
|
+
returnFocus(opener, this);
|
|
514
|
+
}
|
|
515
|
+
/** Whether focus is inside the sheet (its content or its shadow root). */
|
|
516
|
+
hasFocus() {
|
|
517
|
+
return focusWithin(this);
|
|
518
|
+
}
|
|
519
|
+
/** BSH-1, BSH-2, BSH-3: in the top layer, the page held, focus in. Mounted open, it appears in place without motion. */
|
|
520
|
+
present(mounted) {
|
|
521
|
+
const dialog = this.dialog;
|
|
522
|
+
if (!dialog || this.shown || !this.isConnected)
|
|
523
|
+
return;
|
|
524
|
+
watchEscape();
|
|
525
|
+
this.cancelSettle();
|
|
526
|
+
this.clearPlacement();
|
|
527
|
+
this.opener = deepActive();
|
|
528
|
+
if (mounted) {
|
|
529
|
+
dialog.classList.add('instant');
|
|
530
|
+
requestAnimationFrame(() => requestAnimationFrame(() => dialog.classList.remove('instant')));
|
|
531
|
+
}
|
|
532
|
+
if (!dialog.open)
|
|
533
|
+
dialog.showModal();
|
|
534
|
+
this.shown = true;
|
|
535
|
+
modalLayer.add(this);
|
|
536
|
+
holdPageScroll(this, true);
|
|
537
|
+
this.onViewport();
|
|
538
|
+
this.measure();
|
|
539
|
+
this.focusInside();
|
|
540
|
+
}
|
|
541
|
+
/** BSH-1, BSH-3: out of the top layer (sliding from where it is drawn), the page given back, focus back where it was. */
|
|
542
|
+
withdraw(restore) {
|
|
543
|
+
if (!this.shown)
|
|
544
|
+
return;
|
|
545
|
+
this.shown = false;
|
|
546
|
+
// A settle in progress stops where it is drawn, and the exit starts from there.
|
|
547
|
+
if (this.settling) {
|
|
548
|
+
const drawn = this.drawn();
|
|
549
|
+
this.cancelSettle();
|
|
550
|
+
this.placeDrawn(drawn);
|
|
551
|
+
}
|
|
552
|
+
modalLayer.delete(this);
|
|
553
|
+
holdPageScroll(this, false);
|
|
554
|
+
const hadFocus = this.hasFocus();
|
|
555
|
+
const dialog = this.dialog;
|
|
556
|
+
if (dialog?.open)
|
|
557
|
+
dialog.close();
|
|
558
|
+
if (restore && hadFocus)
|
|
559
|
+
this.restoreFocus();
|
|
560
|
+
else
|
|
561
|
+
this.opener = null;
|
|
562
|
+
}
|
|
563
|
+
placeDrawn(drawn) {
|
|
564
|
+
const sheet = this.sheet;
|
|
565
|
+
if (!sheet)
|
|
566
|
+
return;
|
|
567
|
+
sheet.style.maxBlockSize = 'none';
|
|
568
|
+
sheet.style.blockSize = `${drawn.height}px`;
|
|
569
|
+
sheet.style.setProperty('--_drag', `${drawn.offset}px`);
|
|
570
|
+
}
|
|
571
|
+
willUpdate(changed) {
|
|
572
|
+
if (changed.has('open') && changed.get('open') === true && !this.open && !this.modal)
|
|
573
|
+
this.closingWithFocus = this.hasFocus();
|
|
574
|
+
// BSH-21: a product's change of detent moves the sheet from where it is drawn.
|
|
575
|
+
if (changed.has('detent') && changed.get('detent') !== undefined && !this.choosing && this.open && this.hasUpdated)
|
|
576
|
+
this.movingFrom = this.drawn();
|
|
577
|
+
}
|
|
578
|
+
firstUpdated() {
|
|
579
|
+
const area = this.renderRoot.querySelector('.area');
|
|
580
|
+
if (area)
|
|
581
|
+
this.resize$?.observe(area);
|
|
582
|
+
}
|
|
583
|
+
updated(changed) {
|
|
584
|
+
this.observe();
|
|
585
|
+
// BSH-22, BSH-11, BSH-25: what a debug build reports.
|
|
586
|
+
if ((changed.has('label') || changed.has('variant')) && !this.label.trim())
|
|
587
|
+
report(this, 'BSH-22', `label is empty, so the ${this.modal ? 'modal dialog' : 'region'} has no accessible name; give it a label`);
|
|
588
|
+
if ((changed.has('handleLabel') || changed.has('two') || changed.has('handle')) && this.interactive && this.words.lacks('handleLabel', this.handleLabel)) {
|
|
589
|
+
report(this, 'BSH-11', 'handle-label is empty, so the drag handle has no accessible name; give it a handle-label');
|
|
590
|
+
}
|
|
591
|
+
if (changed.has('variant') && !VARIANTS.includes(this.variant))
|
|
592
|
+
report(this, 'BSH-25', `variant "${this.variant}" is not defined; the sheet is drawn as modal`);
|
|
593
|
+
if (changed.has('detent') && !DETENTS.includes(this.detent))
|
|
594
|
+
report(this, 'BSH-25', `detent "${this.detent}" is not defined; the sheet rests at partial`);
|
|
595
|
+
const variantChanged = changed.has('variant') && changed.get('variant') !== undefined;
|
|
596
|
+
if (variantChanged && this.shown && !this.modal)
|
|
597
|
+
this.withdraw(false);
|
|
598
|
+
if (changed.has('open') || variantChanged) {
|
|
599
|
+
const mounted = changed.has('open') && changed.get('open') === undefined;
|
|
600
|
+
const was = changed.has('open') ? changed.get('open') === true : this.open;
|
|
601
|
+
if (this.modal) {
|
|
602
|
+
if (this.open)
|
|
603
|
+
this.present(mounted || variantChanged);
|
|
604
|
+
else if (this.shown)
|
|
605
|
+
this.withdraw(true);
|
|
606
|
+
}
|
|
607
|
+
else if (changed.has('open') && !mounted) {
|
|
608
|
+
// BSH-3: a standard sheet opened moves focus in; closed with focus inside, it gives it back. Mounted open, it
|
|
609
|
+
// leaves focus where it is (it makes nothing unfocusable).
|
|
610
|
+
if (this.open && !was) {
|
|
611
|
+
this.cancelSettle();
|
|
612
|
+
this.clearPlacement();
|
|
613
|
+
this.opener = deepActive();
|
|
614
|
+
this.focusInside();
|
|
615
|
+
}
|
|
616
|
+
else if (!this.open && was && this.closingWithFocus) {
|
|
617
|
+
this.closingWithFocus = false;
|
|
618
|
+
this.restoreFocus();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (this.open)
|
|
622
|
+
this.onViewport();
|
|
623
|
+
}
|
|
624
|
+
if (changed.has('handle') || changed.has('inset'))
|
|
625
|
+
this.measure();
|
|
626
|
+
if (this.choosing)
|
|
627
|
+
this.choosing = false;
|
|
628
|
+
else if (changed.has('detent')) {
|
|
629
|
+
const from = this.movingFrom;
|
|
630
|
+
this.movingFrom = null;
|
|
631
|
+
this.measure();
|
|
632
|
+
if (from && this.heights)
|
|
633
|
+
this.settle(from, this.heights.two && this.resting === 'full' ? this.heights.full : this.heights.partial);
|
|
634
|
+
}
|
|
635
|
+
this.syncTouch();
|
|
636
|
+
}
|
|
637
|
+
/** What changes the heights: the area, the content box and the content itself. */
|
|
638
|
+
observe() {
|
|
639
|
+
const resize = this.resize$;
|
|
640
|
+
if (!resize)
|
|
641
|
+
return;
|
|
642
|
+
for (const selector of ['.area', '.content', '.inner', '.row']) {
|
|
643
|
+
const element = this.renderRoot.querySelector(selector);
|
|
644
|
+
if (element)
|
|
645
|
+
resize.observe(element);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
handleTemplate() {
|
|
649
|
+
if (!this.interactive) {
|
|
650
|
+
// BSH-11: at one height the handle is drawn at rest and is nothing to assistive technology or focus.
|
|
651
|
+
return html `<div part="handle" class="handle" data-tanrei-shape aria-hidden="true"><span part="grip" class="grip" data-tanrei-shape aria-hidden="true"></span></div>`;
|
|
652
|
+
}
|
|
653
|
+
return html `<button
|
|
654
|
+
part="handle"
|
|
655
|
+
class="handle"
|
|
656
|
+
type="button"
|
|
657
|
+
data-tanrei-shape
|
|
658
|
+
aria-label=${this.words.get('handleLabel', this.handleLabel) || nothing}
|
|
659
|
+
aria-expanded=${this.resting === 'full' ? 'true' : 'false'}
|
|
660
|
+
@click=${this.onHandleClick}
|
|
661
|
+
@pointerdown=${this.press.onPointerDown}
|
|
662
|
+
@pointerup=${this.press.release}
|
|
663
|
+
@pointercancel=${this.press.release}
|
|
664
|
+
@pointerleave=${this.press.release}
|
|
665
|
+
@keydown=${this.press.onKeyDown}
|
|
666
|
+
@keyup=${this.press.onKeyUp}
|
|
667
|
+
@blur=${this.press.onBlur}
|
|
668
|
+
@focus=${this.onHandleFocus}
|
|
669
|
+
>
|
|
670
|
+
<span part="grip" class="grip" data-tanrei-shape aria-hidden="true"></span><span class="hold"></span>
|
|
671
|
+
</button>`;
|
|
672
|
+
}
|
|
673
|
+
body() {
|
|
674
|
+
return html `
|
|
675
|
+
${this.handle ? html `<div class="row" @click=${this.onClickCapture}>${this.handleTemplate()}</div>` : nothing}
|
|
676
|
+
<div class="middle">
|
|
677
|
+
<div part="content" class=${classMap({ content: true, inset: this.inset })} data-tanrei-shape @scroll=${this.onScroll} @click=${this.onClickCapture}>
|
|
678
|
+
<div class="inner"><slot @slotchange=${() => this.measure()}></slot></div>
|
|
679
|
+
</div>
|
|
680
|
+
<span class="focus" data-tanrei-shape></span>
|
|
681
|
+
</div>
|
|
682
|
+
`;
|
|
683
|
+
}
|
|
684
|
+
render() {
|
|
685
|
+
const label = this.label || nothing;
|
|
686
|
+
const classes = classMap({ sheet: true, standard: !this.modal, 'has-handle': this.handle });
|
|
687
|
+
const area = html `<div class="area" aria-hidden="true"><div class="cap partial"></div><div class="cap full"></div></div>
|
|
688
|
+
<div class="timing" aria-hidden="true"></div>`;
|
|
689
|
+
if (this.modal) {
|
|
690
|
+
// BSH-22: a modal dialog named by the label.
|
|
691
|
+
return html `${area}<dialog
|
|
692
|
+
part="container"
|
|
693
|
+
class=${classes}
|
|
694
|
+
data-detent=${this.resting}
|
|
695
|
+
aria-label=${label}
|
|
696
|
+
tabindex="-1"
|
|
697
|
+
data-tanrei-shape
|
|
698
|
+
@keydown=${this.onKeyDown}
|
|
699
|
+
@cancel=${this.onNativeCancel}
|
|
700
|
+
@close=${this.onNativeClose}
|
|
701
|
+
@pointerdown=${this.onPointerDown}
|
|
702
|
+
@click=${this.onClick}
|
|
703
|
+
>
|
|
704
|
+
${this.body()}
|
|
705
|
+
</dialog>`;
|
|
706
|
+
}
|
|
707
|
+
// BSH-4, BSH-22: a region named by the label; closed, out of the focus order and the accessibility tree (inert).
|
|
708
|
+
return html `${area}<section
|
|
709
|
+
part="container"
|
|
710
|
+
class=${classes}
|
|
711
|
+
data-detent=${this.resting}
|
|
712
|
+
aria-label=${label}
|
|
713
|
+
tabindex="-1"
|
|
714
|
+
?inert=${!this.open}
|
|
715
|
+
data-tanrei-shape
|
|
716
|
+
@pointerdown=${this.onPointerDown}
|
|
717
|
+
>
|
|
718
|
+
${this.body()}
|
|
719
|
+
</section>`;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
if (!customElements.get('tanrei-bottom-sheet'))
|
|
723
|
+
customElements.define('tanrei-bottom-sheet', TanreiBottomSheet);
|
|
724
|
+
//# sourceMappingURL=bottom-sheet.js.map
|