@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,635 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
+
import { hiddenHost } from '../../primitives/hidden.js';
|
|
4
|
+
import { AvailabilityController, GlyphMirrorController, GroupItemController, OpenAxesController, PressController, SEPARATION_VALUES, SystemWatchController, report, syncFocusStyle, syncSeparation, } from '../../primitives/index.js';
|
|
5
|
+
import { TanreiMenu } from '../menu/menu.js';
|
|
6
|
+
import { AXES, TRAILING_WIDTHS, styles } from './button-with-menu.styles.js';
|
|
7
|
+
import { focusedAtFirst } from '../../primitives/autofocus.js';
|
|
8
|
+
/** The menu's item kinds, as the menu spec defines them: what the menu slot presents. */
|
|
9
|
+
const MENU_CONTENT = 'tanrei-menu-item, tanrei-menu-checkbox-item, tanrei-menu-radio-item, tanrei-submenu';
|
|
10
|
+
/** SPB-22: the pointers that hover — a mouse, a trackpad, a pen. Touch, and what a platform synthesises from it, never do. */
|
|
11
|
+
const hovers = (event) => event.pointerType === 'mouse' || event.pointerType === 'pen';
|
|
12
|
+
/**
|
|
13
|
+
* A half's place is its own — joined to the other half — never a button group's: the connected corners of a group item
|
|
14
|
+
* (src/primitives/group-item.ts), which hold a pill's corners to half the half's measured height and make the fill, the
|
|
15
|
+
* ripple and the ring follow each corner (SPB-13).
|
|
16
|
+
*/
|
|
17
|
+
class JoinedHalf extends GroupItemController {
|
|
18
|
+
constructor(host, container, own) {
|
|
19
|
+
super(host, container);
|
|
20
|
+
this.own = own;
|
|
21
|
+
}
|
|
22
|
+
hostConnected() {
|
|
23
|
+
this.set(this.own);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Performs a main action with one press, and offers related actions in a menu from a second, joined button beside it.
|
|
28
|
+
*
|
|
29
|
+
* Contract: specs/button-with-menu.spec.json. Two native buttons in one row: the leading half (the optional icon and the
|
|
30
|
+
* label) performs the main action and fires `click`; the trailing half (the chevron) asks to open or close the menu and
|
|
31
|
+
* fires `toggle`. The menu is a Tanrei Menu in the shadow root, holding the `menu` slot's items, placed below the whole
|
|
32
|
+
* button with menu with the end edges aligned; focus returns to the trailing half when it closes. It never opens or closes
|
|
33
|
+
* itself: set `open` from `toggle`, and to false from `close`.
|
|
34
|
+
*
|
|
35
|
+
* With `hover-open`, a mouse or a pen resting on the trailing half for `hover-delay` ms (unset: the
|
|
36
|
+
* `comp.button-with-menu.motion.hover-open-delay` token) asks to open it too, through the same `toggle`. A menu open from
|
|
37
|
+
* hover takes no focus, asks to close (`toggle` with false) once the pointer has been off the trailing half and the menu
|
|
38
|
+
* for `motion.hover-close-delay`, and closes on Escape wherever focus is; a press or a key on the trailing half keeps it
|
|
39
|
+
* open and moves focus in, as if that activation had opened it.
|
|
40
|
+
*
|
|
41
|
+
* The halves are joined as `separation` names (SPB-30): under `divider` they touch, with square corners where they meet
|
|
42
|
+
* and a line on the seam, and neither half draws its outline or its elevation's ring along the seam; under `gap` they
|
|
43
|
+
* stand `container.inner-gap` apart with `container.inner-shape` corners. `auto` — the default — takes
|
|
44
|
+
* `comp.button-with-menu.container.separation`, which follows the design system's `sys.behavior.separation`. They are
|
|
45
|
+
* never stacked. `trailing-width="narrow"` draws a slim trailing half: the chevron and a small inset on each side, with
|
|
46
|
+
* no padding added at its round end — as wide as a narrow icon-only Button (SPB-32).
|
|
47
|
+
*
|
|
48
|
+
* Every visual value comes from `--tanrei-comp-button-with-menu-*` tokens, one set per variant shared by both halves, each
|
|
49
|
+
* half drawn in its own state: how a state looks is the active design system's decision, not this component's. How a
|
|
50
|
+
* press is answered and how keyboard focus is drawn are the system's choices of kind (`--tanrei-sys-behavior-*`),
|
|
51
|
+
* and how far its corners ease is the system's amount (`--tanrei-sys-shape-corner-smoothing`); all
|
|
52
|
+
* are read from the cascade, so they follow `data-tanrei-system`.
|
|
53
|
+
*
|
|
54
|
+
* @tag tanrei-button-with-menu
|
|
55
|
+
* @slot icon - The leading half's icon: a glyph of the system's icon set (its ligature text), or a `.tanrei-icon`, `<svg>` or `<img>`. A glyph the icon set flags is mirrored in right-to-left; `data-mirror="auto | always | never"` on the element decides for one use.
|
|
56
|
+
* @slot chevron - The trailing half's glyph in place of `expand_more` (one glyph of the icon set). Alone, it turns half a turn while open; with `chevron-open` it is the closed form only.
|
|
57
|
+
* @slot chevron-open - The trailing half's glyph while open (one glyph of the icon set): the trailing half then cross-fades between the closed glyph and this one instead of turning. A glyph of either chevron slot that the icon set flags is mirrored in right-to-left (`data-mirror` decides for one use); `expand_more` never is.
|
|
58
|
+
* @slot menu - The menu's items: `<tanrei-menu-item>`, `<tanrei-menu-checkbox-item>`, `<tanrei-menu-radio-item>` and `<tanrei-menu-group>` children, each with `slot="menu"`. Their events are theirs, as in any menu.
|
|
59
|
+
* @csspart container - Both halves: each is a native button carrying its own state, shape and elevation.
|
|
60
|
+
* @csspart leading - The leading half.
|
|
61
|
+
* @csspart trailing - The trailing half.
|
|
62
|
+
* @csspart icon - The box the leading icon is drawn in (hidden from assistive technology).
|
|
63
|
+
* @csspart label - The label text.
|
|
64
|
+
* @csspart divider - The line on the seam between the halves under `divider` (decoration: not exposed, takes no press).
|
|
65
|
+
* @csspart chevron - The box each of the trailing half's glyphs is drawn in, closed and open (hidden from assistive technology).
|
|
66
|
+
* @fires click - The leading half was activated by pointer, touch, keyboard or assistive technology. Only the leading half's click reaches listeners on the element.
|
|
67
|
+
* @fires {CustomEvent<TanreiButtonWithMenuToggleDetail>} toggle - The trailing half asks to open or close the menu — by a press, a key or, with `hover-open`, a hover: `detail.open` is the value asked for. Set `open` to it.
|
|
68
|
+
* @fires {CustomEvent<TanreiButtonWithMenuCloseDetail>} close - The menu asks to be closed: `detail.reason` is `escape`, `outside`, `tab`, `focus-out` or `item`. Set `open` to false.
|
|
69
|
+
*/
|
|
70
|
+
export class TanreiButtonWithMenu extends LitElement {
|
|
71
|
+
static { this.styles = [styles, hiddenHost]; }
|
|
72
|
+
// Two tab stops: focus() on the host goes to the leading half. The menu's items are assigned by hand, each to a slot
|
|
73
|
+
// of its own inside the menu, so that the menu draws its dividers between them (MNU-23).
|
|
74
|
+
static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true, slotAssignment: 'manual' }; }
|
|
75
|
+
static { this.properties = {
|
|
76
|
+
variant: { type: String, reflect: true },
|
|
77
|
+
size: { type: String, reflect: true },
|
|
78
|
+
separation: { type: String, reflect: true },
|
|
79
|
+
trailingWidth: { type: String, reflect: true, attribute: 'trailing-width' },
|
|
80
|
+
label: { type: String },
|
|
81
|
+
menuLabel: { type: String, attribute: 'menu-label' },
|
|
82
|
+
open: { type: Boolean, reflect: true },
|
|
83
|
+
disabled: { type: Boolean, reflect: true },
|
|
84
|
+
hoverOpen: { type: Boolean, attribute: 'hover-open', reflect: true },
|
|
85
|
+
hoverDelay: { type: Number, attribute: 'hover-delay' },
|
|
86
|
+
iconChildren: { state: true },
|
|
87
|
+
chevronChildren: { state: true },
|
|
88
|
+
chevronOpenChildren: { state: true },
|
|
89
|
+
menuChildren: { state: true },
|
|
90
|
+
turning: { state: true },
|
|
91
|
+
fromHover: { state: true },
|
|
92
|
+
}; }
|
|
93
|
+
get leading() {
|
|
94
|
+
return this.renderRoot?.querySelector('button.leading') ?? null;
|
|
95
|
+
}
|
|
96
|
+
get trailing() {
|
|
97
|
+
return this.renderRoot?.querySelector('button.trailing') ?? null;
|
|
98
|
+
}
|
|
99
|
+
get labelElement() {
|
|
100
|
+
return this.renderRoot?.querySelector('.label') ?? null;
|
|
101
|
+
}
|
|
102
|
+
get menu() {
|
|
103
|
+
return this.renderRoot?.querySelector('tanrei-menu') ?? null;
|
|
104
|
+
}
|
|
105
|
+
/** SPB-15 / SPB-20: whether the menu slot holds an item (directly or in a group). */
|
|
106
|
+
get hasItems() {
|
|
107
|
+
return this.menuChildren.some((child) => child.matches(MENU_CONTENT) || !!child.querySelector(MENU_CONTENT));
|
|
108
|
+
}
|
|
109
|
+
/** SPB-3 / SPB-7: the open form is drawn while open, except while disabled. */
|
|
110
|
+
get openForm() {
|
|
111
|
+
return this.open && !this.disabled;
|
|
112
|
+
}
|
|
113
|
+
constructor() {
|
|
114
|
+
super();
|
|
115
|
+
this.availability = new AvailabilityController(this, 'button-with-menu');
|
|
116
|
+
/** Emphasis, as Button's variants of the same names. */
|
|
117
|
+
this.variant = 'filled';
|
|
118
|
+
/** Visual height (small 32 / medium 40 / large 56 in the default system), Button's heights. The hit areas always meet the minimum target. */
|
|
119
|
+
this.size = 'medium';
|
|
120
|
+
/**
|
|
121
|
+
* How the two halves are joined. `divider`: they touch, and a line is drawn on the seam. `gap`: they stand a narrow gap
|
|
122
|
+
* apart, with tighter corners where they face each other. `auto` takes `comp.button-with-menu.container.separation`,
|
|
123
|
+
* the design system's answer (divider in the default system). The halves always sit side by side. Anything else is
|
|
124
|
+
* `auto` (reported in debug builds, SPB-8).
|
|
125
|
+
*/
|
|
126
|
+
this.separation = 'auto';
|
|
127
|
+
/**
|
|
128
|
+
* How wide the trailing half is: `default` holds the chevron in a square of the height (32 / 40 / 56) and adds the
|
|
129
|
+
* padding of the rounded outer end (36 / 44 / 60 in the default system); `narrow` is the chevron and
|
|
130
|
+
* `trailing.padding-inline-narrow` on each side of it, with no outer padding (28 / 32 / 32: the width of a narrow
|
|
131
|
+
* icon-only Button, SPB-32). The hit area meets the minimum target at both: a narrow half reaches it past its end
|
|
132
|
+
* edge and is not drawn wider. The `trailing-width` attribute. Anything else is `default` (reported in debug
|
|
133
|
+
* builds, SPB-8).
|
|
134
|
+
*/
|
|
135
|
+
this.trailingWidth = 'default';
|
|
136
|
+
/** The leading half's visible text and accessible name ("Save"). Required. */
|
|
137
|
+
this.label = '';
|
|
138
|
+
/** The trailing half's accessible name ("More save options"): say what the menu offers. Required — the chevron alone is not a name. */
|
|
139
|
+
this.menuLabel = '';
|
|
140
|
+
/** Whether the menu is shown. Set it from `toggle`, and to false from `close`: the button with menu only asks. */
|
|
141
|
+
this.open = false;
|
|
142
|
+
/** Prevents interaction with both halves, removes them from the focus order and presents no menu. */
|
|
143
|
+
this.disabled = false;
|
|
144
|
+
/** Also asks to open the menu when a mouse or a pen rests on the trailing half for `hoverDelay`; never for touch. A press and the keys still open it. */
|
|
145
|
+
this.hoverOpen = false;
|
|
146
|
+
/** How long, in ms, the pointer rests on the trailing half before the menu opens on hover. Unset (null) takes `comp.button-with-menu.motion.hover-open-delay`. */
|
|
147
|
+
this.hoverDelay = null;
|
|
148
|
+
/** The children in the icon slot. */
|
|
149
|
+
this.iconChildren = [];
|
|
150
|
+
/** SPB-21: the children in the chevron slots; each slot draws its first. */
|
|
151
|
+
this.chevronChildren = [];
|
|
152
|
+
this.chevronOpenChildren = [];
|
|
153
|
+
/** The children in the menu slot, each forwarded into the menu through a slot of its own. */
|
|
154
|
+
this.menuChildren = [];
|
|
155
|
+
/** SPB-13, SPB-21: the open form is changing; the trailing half's corners move over the open motion until it is done. */
|
|
156
|
+
this.turning = false;
|
|
157
|
+
/** SPB-22: the menu is open from hover — presented without taking focus, closed when the pointer leaves (SPB-23). */
|
|
158
|
+
this.fromHover = false;
|
|
159
|
+
/** Counts the turns, so that a turn replaced by the next ends nothing. */
|
|
160
|
+
this.turn = 0;
|
|
161
|
+
/** SPB-22: toggle asked for true from hover, and open has not become true since. */
|
|
162
|
+
this.hoverAsked = false;
|
|
163
|
+
/** SPB-23: where a fine pointer is. */
|
|
164
|
+
this.onTrailing = false;
|
|
165
|
+
this.onMenu = false;
|
|
166
|
+
/** SPB-25: the one Escape a menu open from hover takes has been taken. */
|
|
167
|
+
this.escapeTaken = false;
|
|
168
|
+
this.listeningForEscape = false;
|
|
169
|
+
this.menuSettled = false;
|
|
170
|
+
this.menuWasEmpty = null;
|
|
171
|
+
/** SPB-8: sizes and variants a design system adds, and a value the active system does not have (src/primitives/axes.ts). */
|
|
172
|
+
this.axes = new OpenAxesController(this, { component: 'button-with-menu', behavior: 'SPB-8', axes: AXES });
|
|
173
|
+
/**
|
|
174
|
+
* SPB-9 / SPB-10: each half's pressed state, press-hold and the answer the system chooses (src/primitives/press.ts). The
|
|
175
|
+
* leading half's label carries press-hold for both: it is always rendered and has no transition of its own.
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* SPB-28: the glyphs the product gave — the icon's, the chevron's and the open chevron's — are marked when the icon set
|
|
179
|
+
* mirrors their name in right-to-left, or their `data-mirror` says so (src/primitives/glyph-mirror.ts); `iconGlyph()`
|
|
180
|
+
* draws the mark, inside the box that turns (SPB-21). The chevron the button with menu draws itself, expand_more, is the
|
|
181
|
+
* slot's fallback text: no element of the product's, and not a name the icon set mirrors.
|
|
182
|
+
*/
|
|
183
|
+
this.mirror = new GlyphMirrorController(this, { slots: 'slot.icon-slot, slot.chevron-slot, slot.chevron-open-slot' });
|
|
184
|
+
this.leadingPress = new PressController(this, {
|
|
185
|
+
container: () => this.leading,
|
|
186
|
+
holdCarrier: () => this.labelElement,
|
|
187
|
+
disabled: () => this.disabled,
|
|
188
|
+
});
|
|
189
|
+
this.trailingPress = new PressController(this, {
|
|
190
|
+
container: () => this.trailing,
|
|
191
|
+
holdCarrier: () => this.labelElement,
|
|
192
|
+
disabled: () => this.disabled,
|
|
193
|
+
});
|
|
194
|
+
/** SPB-30: where a browser has no style queries, the separation is read when it renders — again when the system is switched. */
|
|
195
|
+
this.system = new SystemWatchController(this);
|
|
196
|
+
/** SPB-13: each half's joined corners, a pill's held to half its height. */
|
|
197
|
+
this.leadingPlace = new JoinedHalf(this, () => this.leading, { variant: 'connected', first: true, last: false });
|
|
198
|
+
this.trailingPlace = new JoinedHalf(this, () => this.trailing, { variant: 'connected', first: false, last: true });
|
|
199
|
+
/** Which children go into which slot: the icon, and each menu child. */
|
|
200
|
+
this.children$ = new MutationObserver((records) => this.readChildren(records));
|
|
201
|
+
/** SPB-5 / SPB-11: where style queries are missing, the focus style is read when focus arrives. */
|
|
202
|
+
this.onFocus = (event) => {
|
|
203
|
+
syncFocusStyle(this, event.currentTarget);
|
|
204
|
+
};
|
|
205
|
+
/** SPB-2: the trailing half asks for the opposite of open; SPB-24: a menu open from hover is kept open instead. */
|
|
206
|
+
this.onTrailingClick = () => {
|
|
207
|
+
if (this.disabled)
|
|
208
|
+
return;
|
|
209
|
+
this.cancelOpenWait();
|
|
210
|
+
if (this.fromHover && this.open) {
|
|
211
|
+
this.adopt();
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
this.hoverAsked = false;
|
|
215
|
+
this.toggle(!this.open);
|
|
216
|
+
};
|
|
217
|
+
/** SPB-2: Down Arrow on the trailing half asks to open a closed menu (SPB-24: adopts one open from hover). The press keys are the PressController's. */
|
|
218
|
+
this.onTrailingKeyDown = (event) => {
|
|
219
|
+
this.trailingPress.onKeyDown(event);
|
|
220
|
+
if (event.key !== 'ArrowDown' || this.disabled)
|
|
221
|
+
return;
|
|
222
|
+
if (this.fromHover && this.open) {
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
this.adopt();
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (this.open)
|
|
228
|
+
return;
|
|
229
|
+
event.preventDefault();
|
|
230
|
+
this.cancelOpenWait();
|
|
231
|
+
this.hoverAsked = false;
|
|
232
|
+
this.toggle(true);
|
|
233
|
+
};
|
|
234
|
+
/** SPB-16: the menu asks to be closed; the button with menu asks the product, with the menu's reason. */
|
|
235
|
+
this.onMenuClose = (event) => {
|
|
236
|
+
if (this.disabled)
|
|
237
|
+
return;
|
|
238
|
+
this.dispatchEvent(new CustomEvent('close', { detail: { reason: event.detail.reason } }));
|
|
239
|
+
};
|
|
240
|
+
/** SPB-22: a mouse or a pen on the trailing half of a closed, enabled button with menu starts the wait. */
|
|
241
|
+
this.onTrailingEnter = (event) => {
|
|
242
|
+
if (!hovers(event))
|
|
243
|
+
return;
|
|
244
|
+
this.onTrailing = true;
|
|
245
|
+
this.cancelCloseGrace();
|
|
246
|
+
if (!this.hoverOpen || this.disabled || this.open)
|
|
247
|
+
return;
|
|
248
|
+
this.cancelOpenWait();
|
|
249
|
+
const wait = this.validHoverDelay ? this.hoverDelay : this.timing().open;
|
|
250
|
+
this.openTimer = setTimeout(() => {
|
|
251
|
+
this.openTimer = undefined;
|
|
252
|
+
if (!this.onTrailing || !this.hoverOpen || this.disabled || this.open)
|
|
253
|
+
return;
|
|
254
|
+
this.hoverAsked = true;
|
|
255
|
+
this.toggle(true);
|
|
256
|
+
}, wait);
|
|
257
|
+
};
|
|
258
|
+
/** SPB-22: leaving before the wait is over cancels it; SPB-23: leaving a menu open from hover starts the grace. */
|
|
259
|
+
this.onTrailingLeave = (event) => {
|
|
260
|
+
this.trailingPress.release();
|
|
261
|
+
if (!hovers(event))
|
|
262
|
+
return;
|
|
263
|
+
this.onTrailing = false;
|
|
264
|
+
this.cancelOpenWait();
|
|
265
|
+
this.startCloseGrace();
|
|
266
|
+
};
|
|
267
|
+
/** SPB-22: a press on either half cancels the wait. */
|
|
268
|
+
this.onHalfPointerDown = (event) => {
|
|
269
|
+
this.cancelOpenWait();
|
|
270
|
+
if (event.currentTarget === this.trailing)
|
|
271
|
+
this.trailingPress.onPointerDown(event);
|
|
272
|
+
else
|
|
273
|
+
this.leadingPress.onPointerDown(event);
|
|
274
|
+
};
|
|
275
|
+
/** SPB-23: the pointer on the menu's surface keeps a menu open from hover open. */
|
|
276
|
+
this.onMenuEnter = (event) => {
|
|
277
|
+
if (!hovers(event))
|
|
278
|
+
return;
|
|
279
|
+
this.onMenu = true;
|
|
280
|
+
this.cancelCloseGrace();
|
|
281
|
+
};
|
|
282
|
+
this.onMenuLeave = (event) => {
|
|
283
|
+
if (!hovers(event))
|
|
284
|
+
return;
|
|
285
|
+
this.onMenu = false;
|
|
286
|
+
this.startCloseGrace();
|
|
287
|
+
};
|
|
288
|
+
/** SPB-25: Escape closes a menu open from hover wherever focus is, once, and reaches nothing else. */
|
|
289
|
+
this.onDocumentKeyDown = (event) => {
|
|
290
|
+
if (event.key !== 'Escape' || event.isComposing || !this.fromHover || !this.open || this.disabled)
|
|
291
|
+
return;
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
event.stopImmediatePropagation();
|
|
294
|
+
this.escapeTaken = true;
|
|
295
|
+
this.listenForEscape(false);
|
|
296
|
+
this.cancelHover();
|
|
297
|
+
this.dispatchEvent(new CustomEvent('close', { detail: { reason: 'escape' } }));
|
|
298
|
+
};
|
|
299
|
+
// SPB-3: a disabled native button already swallows its own clicks; this also covers a click dispatched on the host.
|
|
300
|
+
this.addEventListener('click', (event) => {
|
|
301
|
+
if (this.disabled) {
|
|
302
|
+
event.preventDefault();
|
|
303
|
+
event.stopImmediatePropagation();
|
|
304
|
+
}
|
|
305
|
+
}, { capture: true });
|
|
306
|
+
}
|
|
307
|
+
createRenderRoot() {
|
|
308
|
+
const root = super.createRenderRoot();
|
|
309
|
+
// Only the leading half's click reaches listeners on the element (the spec's web note): the trailing half's (its
|
|
310
|
+
// `toggle`), a menu item's (the item's own, which the menu has answered by now) and a press between the halves stop
|
|
311
|
+
// at the shadow root.
|
|
312
|
+
root.addEventListener('click', (event) => {
|
|
313
|
+
const leading = this.leading;
|
|
314
|
+
if (!leading || !event.composedPath().includes(leading))
|
|
315
|
+
event.stopPropagation();
|
|
316
|
+
});
|
|
317
|
+
return root;
|
|
318
|
+
}
|
|
319
|
+
connectedCallback() {
|
|
320
|
+
super.connectedCallback();
|
|
321
|
+
this.children$.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['slot'] });
|
|
322
|
+
this.readChildren();
|
|
323
|
+
// SPB-20: a parser or a framework may append the children after the element connects; the menu slot is judged
|
|
324
|
+
// once they have settled (the next task), and again whenever it changes.
|
|
325
|
+
clearTimeout(this.settleTimer);
|
|
326
|
+
this.settleTimer = setTimeout(() => {
|
|
327
|
+
this.menuSettled = true;
|
|
328
|
+
this.checkEmptyMenu();
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
disconnectedCallback() {
|
|
332
|
+
super.disconnectedCallback();
|
|
333
|
+
this.children$.disconnect();
|
|
334
|
+
clearTimeout(this.settleTimer);
|
|
335
|
+
this.menuSettled = false;
|
|
336
|
+
this.menuWasEmpty = null;
|
|
337
|
+
this.turn++;
|
|
338
|
+
this.turning = false;
|
|
339
|
+
this.fromHover = false;
|
|
340
|
+
this.cancelHover();
|
|
341
|
+
this.onTrailing = this.onMenu = false;
|
|
342
|
+
this.listenForEscape(false);
|
|
343
|
+
}
|
|
344
|
+
/** `element.click()` activates the leading half as a person would — through the native button — and does nothing while disabled. */
|
|
345
|
+
click() {
|
|
346
|
+
const leading = this.leading;
|
|
347
|
+
if (leading)
|
|
348
|
+
leading.click();
|
|
349
|
+
else if (!this.disabled)
|
|
350
|
+
super.click();
|
|
351
|
+
}
|
|
352
|
+
/** The children by the slot they name. A change inside a menu child (an item added to a group) is the menu's news. */
|
|
353
|
+
readChildren(records = []) {
|
|
354
|
+
const direct = [...this.children];
|
|
355
|
+
const icon = direct.filter((child) => child.slot === 'icon');
|
|
356
|
+
const chevron = direct.filter((child) => child.slot === 'chevron');
|
|
357
|
+
const chevronOpen = direct.filter((child) => child.slot === 'chevron-open');
|
|
358
|
+
const menu = direct.filter((child) => child.slot === 'menu');
|
|
359
|
+
const same = (a, b) => a.length === b.length && a.every((el, i) => el === b[i]);
|
|
360
|
+
if (!same(icon, this.iconChildren))
|
|
361
|
+
this.iconChildren = icon;
|
|
362
|
+
if (!same(chevron, this.chevronChildren))
|
|
363
|
+
this.chevronChildren = chevron;
|
|
364
|
+
if (!same(chevronOpen, this.chevronOpenChildren))
|
|
365
|
+
this.chevronOpenChildren = chevronOpen;
|
|
366
|
+
if (!same(menu, this.menuChildren))
|
|
367
|
+
this.menuChildren = menu;
|
|
368
|
+
else if (records.some((record) => record.target !== this)) {
|
|
369
|
+
// Tell the menu, through its own channel, that what it holds changed.
|
|
370
|
+
this.menu?.dispatchEvent(new Event('tanrei-menu-item-update'));
|
|
371
|
+
this.requestUpdate();
|
|
372
|
+
}
|
|
373
|
+
this.checkEmptyMenu();
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* SPB-20: while the menu slot holds no item the trailing half still toggles and draws its open form, and no menu is
|
|
377
|
+
* presented. A debug build says so once the children have settled, and again each time the slot becomes empty —
|
|
378
|
+
* never on every render.
|
|
379
|
+
*/
|
|
380
|
+
checkEmptyMenu() {
|
|
381
|
+
if (!this.menuSettled)
|
|
382
|
+
return;
|
|
383
|
+
const empty = !this.hasItems;
|
|
384
|
+
if (empty && this.menuWasEmpty !== true) {
|
|
385
|
+
report(this, 'SPB-20', 'the menu slot holds no item, so the trailing half toggles but no menu is presented; give it tanrei-menu-item children with slot="menu"', { once: false });
|
|
386
|
+
}
|
|
387
|
+
this.menuWasEmpty = empty;
|
|
388
|
+
}
|
|
389
|
+
toggle(open) {
|
|
390
|
+
this.dispatchEvent(new CustomEvent('toggle', { detail: { open } }));
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* SPB-24: a press or a key on the trailing half while the menu is open from hover keeps it open and makes it a menu
|
|
394
|
+
* that activation opened: focus moves to its first enabled item (MNU-1), and the pointer leaving no longer closes it.
|
|
395
|
+
*/
|
|
396
|
+
adopt() {
|
|
397
|
+
this.fromHover = false;
|
|
398
|
+
this.cancelHover();
|
|
399
|
+
this.listenForEscape(false);
|
|
400
|
+
const menu = this.menu;
|
|
401
|
+
if (!menu)
|
|
402
|
+
return;
|
|
403
|
+
menu.focusless = false;
|
|
404
|
+
if (this.hasItems)
|
|
405
|
+
menu.focusFirstItem();
|
|
406
|
+
}
|
|
407
|
+
// ── Hover (SPB-22 to SPB-25) ────────────────────────────────────────────────────────────────────────────────────
|
|
408
|
+
/** SPB-22, SPB-23: the token delays, in ms, as they resolve now — read through the inert `.timing` element's real properties. */
|
|
409
|
+
timing() {
|
|
410
|
+
const probe = this.renderRoot?.querySelector('.timing');
|
|
411
|
+
if (!probe)
|
|
412
|
+
return { open: 0, close: 0 };
|
|
413
|
+
const style = getComputedStyle(probe);
|
|
414
|
+
const ms = (value) => (Number.parseFloat(value) || 0) * 1000;
|
|
415
|
+
return { open: ms(style.transitionDelay), close: ms(style.transitionDuration) };
|
|
416
|
+
}
|
|
417
|
+
/** SPB-22: whether hoverDelay is a wait the button with menu can use (a number of ms, 0 or more). */
|
|
418
|
+
get validHoverDelay() {
|
|
419
|
+
return typeof this.hoverDelay === 'number' && Number.isFinite(this.hoverDelay) && this.hoverDelay >= 0;
|
|
420
|
+
}
|
|
421
|
+
cancelOpenWait() {
|
|
422
|
+
clearTimeout(this.openTimer);
|
|
423
|
+
this.openTimer = undefined;
|
|
424
|
+
}
|
|
425
|
+
cancelCloseGrace() {
|
|
426
|
+
clearTimeout(this.closeTimer);
|
|
427
|
+
this.closeTimer = undefined;
|
|
428
|
+
}
|
|
429
|
+
cancelHover() {
|
|
430
|
+
this.cancelOpenWait();
|
|
431
|
+
this.cancelCloseGrace();
|
|
432
|
+
this.hoverAsked = false;
|
|
433
|
+
}
|
|
434
|
+
/** SPB-23: off both the trailing half and the menu for motion.hover-close-delay, a menu open from hover asks to close, once. */
|
|
435
|
+
startCloseGrace() {
|
|
436
|
+
if (!this.fromHover || !this.open || this.onTrailing || this.onMenu || this.closeTimer !== undefined)
|
|
437
|
+
return;
|
|
438
|
+
this.closeTimer = setTimeout(() => {
|
|
439
|
+
this.closeTimer = undefined;
|
|
440
|
+
if (!this.fromHover || !this.open || this.onTrailing || this.onMenu)
|
|
441
|
+
return;
|
|
442
|
+
this.toggle(false);
|
|
443
|
+
}, this.timing().close);
|
|
444
|
+
}
|
|
445
|
+
listenForEscape(on) {
|
|
446
|
+
if (on === this.listeningForEscape)
|
|
447
|
+
return;
|
|
448
|
+
this.listeningForEscape = on;
|
|
449
|
+
if (on)
|
|
450
|
+
document.addEventListener('keydown', this.onDocumentKeyDown, { capture: true });
|
|
451
|
+
else
|
|
452
|
+
document.removeEventListener('keydown', this.onDocumentKeyDown, { capture: true });
|
|
453
|
+
}
|
|
454
|
+
// ── The open form's motion (SPB-13, SPB-21) ─────────────────────────────────────────────────────────────────────
|
|
455
|
+
/**
|
|
456
|
+
* SPB-13, SPB-21: the open form's change — the chevron's turn or cross-fade, over comp.button-with-menu.motion.open-duration
|
|
457
|
+
* (0 where motion is reduced) — and for as long, the trailing half's corners move with it. It ends when the
|
|
458
|
+
* transitions this update started have finished, not on a timer; a turn replaced by the next ends nothing.
|
|
459
|
+
*/
|
|
460
|
+
startTurn() {
|
|
461
|
+
const turn = ++this.turn;
|
|
462
|
+
const moving = [...this.renderRoot.querySelectorAll('.turn, .glyph-open'), this.trailing].filter((el) => !!el);
|
|
463
|
+
// getAnimations() brings style up to date first, so the transitions this update started are among them.
|
|
464
|
+
const running = moving.flatMap((el) => el.getAnimations());
|
|
465
|
+
const end = () => {
|
|
466
|
+
if (turn === this.turn)
|
|
467
|
+
this.turning = false;
|
|
468
|
+
};
|
|
469
|
+
if (running.length === 0)
|
|
470
|
+
end();
|
|
471
|
+
else
|
|
472
|
+
void Promise.allSettled(running.map((animation) => animation.finished)).then(end);
|
|
473
|
+
}
|
|
474
|
+
willUpdate(changed) {
|
|
475
|
+
// SPB-22: a hoverDelay the button with menu cannot use waits for the token; a debug build says so.
|
|
476
|
+
if (changed.has('hoverDelay') && this.hoverDelay !== null && this.hoverDelay !== undefined && !this.validHoverDelay) {
|
|
477
|
+
report(this, 'SPB-22', `hoverDelay ${String(this.hoverDelay)} is not a number of milliseconds of 0 or more; the menu opens on hover after comp.button-with-menu.motion.hover-open-delay`);
|
|
478
|
+
}
|
|
479
|
+
if (changed.has('open')) {
|
|
480
|
+
// SPB-22: open becoming true — from hover or by other means — ends the wait; it is open from hover only when hover asked.
|
|
481
|
+
this.cancelOpenWait();
|
|
482
|
+
if (this.open)
|
|
483
|
+
this.fromHover = this.hoverAsked && !this.disabled;
|
|
484
|
+
else
|
|
485
|
+
this.fromHover = false;
|
|
486
|
+
this.hoverAsked = false;
|
|
487
|
+
this.escapeTaken = false;
|
|
488
|
+
}
|
|
489
|
+
// SPB-3: disabled never opens on hover; a hover wait or grace in progress ends.
|
|
490
|
+
if (this.disabled || !this.hoverOpen) {
|
|
491
|
+
this.cancelOpenWait();
|
|
492
|
+
this.hoverAsked = false;
|
|
493
|
+
}
|
|
494
|
+
if (this.disabled)
|
|
495
|
+
this.fromHover = false;
|
|
496
|
+
if (!this.fromHover)
|
|
497
|
+
this.cancelCloseGrace();
|
|
498
|
+
if (!this.hasUpdated)
|
|
499
|
+
return;
|
|
500
|
+
if (changed.has('open') || changed.has('disabled')) {
|
|
501
|
+
const was = (changed.has('open') ? changed.get('open') : this.open) && !(changed.has('disabled') ? changed.get('disabled') : this.disabled);
|
|
502
|
+
if (was !== this.openForm)
|
|
503
|
+
this.turning = true;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
firstUpdated() {
|
|
507
|
+
// SPB-15: the menu is placed against the whole button with menu; its anchor — focus return, name, ARIA states — is the
|
|
508
|
+
// trailing half.
|
|
509
|
+
const menu = this.menu;
|
|
510
|
+
if (menu)
|
|
511
|
+
menu.positionAnchor = this.renderRoot.querySelector('.row');
|
|
512
|
+
}
|
|
513
|
+
updated(changed) {
|
|
514
|
+
// The slots are assigned by hand: the icon's, each chevron slot's first glyph (SPB-21), and one per menu child.
|
|
515
|
+
const assign = (selector, nodes) => {
|
|
516
|
+
const slot = this.renderRoot.querySelector(selector);
|
|
517
|
+
if (slot && !sameNodes(slot.assignedNodes(), nodes))
|
|
518
|
+
slot.assign(...nodes);
|
|
519
|
+
};
|
|
520
|
+
assign('slot.icon-slot', this.iconChildren);
|
|
521
|
+
assign('slot.chevron-slot', this.chevronChildren.slice(0, 1));
|
|
522
|
+
assign('slot.chevron-open-slot', this.chevronOpenChildren.slice(0, 1));
|
|
523
|
+
this.renderRoot.querySelectorAll('slot.menu-slot').forEach((slot, i) => {
|
|
524
|
+
const child = this.menuChildren[i];
|
|
525
|
+
if (child && !sameNodes(slot.assignedNodes(), [child]))
|
|
526
|
+
slot.assign(child);
|
|
527
|
+
});
|
|
528
|
+
// SPB-21: each chevron slot draws its first glyph; a debug build reports the rest.
|
|
529
|
+
for (const [key, name] of [['chevronChildren', 'chevron'], ['chevronOpenChildren', 'chevron-open']]) {
|
|
530
|
+
if (changed.has(key) && this[key].length > 1)
|
|
531
|
+
report(this, 'SPB-21', `the ${name} slot holds ${this[key].length} glyphs; only the first is drawn`);
|
|
532
|
+
}
|
|
533
|
+
if (this.turning && (changed.has('open') || changed.has('disabled')))
|
|
534
|
+
this.startTurn();
|
|
535
|
+
// SPB-8: a separation or a trailing width it does not define is drawn as the default (no rule matches it) and reported.
|
|
536
|
+
if (changed.has('separation') && !SEPARATION_VALUES.includes(this.separation)) {
|
|
537
|
+
report(this, 'SPB-8', `separation "${this.separation}" is not a value of the button with menu; it is drawn as "auto"`);
|
|
538
|
+
}
|
|
539
|
+
if (changed.has('trailingWidth') && !TRAILING_WIDTHS.includes(this.trailingWidth)) {
|
|
540
|
+
report(this, 'SPB-8', `trailingWidth "${this.trailingWidth}" is not a value of the button with menu; it is drawn as "default"`);
|
|
541
|
+
}
|
|
542
|
+
// SPB-30: without style queries, the name the cascade gives now is written for the styles to match.
|
|
543
|
+
syncSeparation(this, this.renderRoot.querySelector('.row'));
|
|
544
|
+
// SPB-25: while the menu is open from hover, the button with menu listens for its one Escape wherever focus is.
|
|
545
|
+
this.listenForEscape(this.fromHover && this.openForm && !this.escapeTaken);
|
|
546
|
+
// SPB-23: a menu that opened from hover after the pointer had already left starts its grace at once.
|
|
547
|
+
if (changed.has('fromHover'))
|
|
548
|
+
this.startCloseGrace();
|
|
549
|
+
// SPB-20: a half without a name still renders; a debug build says so (the empty menu: checkEmptyMenu()).
|
|
550
|
+
if (changed.has('label') && !this.label.trim())
|
|
551
|
+
report(this, 'SPB-20', 'label is empty, so the leading half has no accessible name; give it a label');
|
|
552
|
+
if (changed.has('menuLabel') && !this.menuLabel.trim()) {
|
|
553
|
+
report(this, 'SPB-20', 'menuLabel is empty, so the trailing half has no accessible name; say what the menu offers ("More save options")');
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
render() {
|
|
557
|
+
const open = this.openForm;
|
|
558
|
+
// SPB-3, SPB-15, SPB-20: the menu is presented while open, enabled and holding an item.
|
|
559
|
+
const presented = open && this.hasItems;
|
|
560
|
+
// SPB-17: two native buttons in reading order, each its own tab stop, and no element of its own around them. The
|
|
561
|
+
// leading half is named by its label; the trailing half by menuLabel, and the menu tells it that it opens a menu,
|
|
562
|
+
// whether it is open and which (aria-haspopup, aria-expanded, aria-controls). The icon and the chevron are hidden.
|
|
563
|
+
// SPB-21: the closed glyph is the chevron slot's, or the icon set's expand_more when it is empty; with a chevron-open
|
|
564
|
+
// glyph the two cross-fade (`swap`), else the closed one turns.
|
|
565
|
+
const swap = this.chevronOpenChildren.length > 0;
|
|
566
|
+
return html `
|
|
567
|
+
<div class="row">
|
|
568
|
+
<button
|
|
569
|
+
part="container leading"
|
|
570
|
+
type="button"
|
|
571
|
+
data-tanrei-shape
|
|
572
|
+
class=${classMap({ leading: true, 'with-icon': this.iconChildren.length > 0, ...this.leadingPlace.classes() })}
|
|
573
|
+
?disabled=${this.disabled}
|
|
574
|
+
@pointerdown=${this.onHalfPointerDown}
|
|
575
|
+
@pointerup=${this.leadingPress.release}
|
|
576
|
+
@pointercancel=${this.leadingPress.release}
|
|
577
|
+
@pointerleave=${this.leadingPress.release}
|
|
578
|
+
@keydown=${this.leadingPress.onKeyDown}
|
|
579
|
+
@keyup=${this.leadingPress.onKeyUp}
|
|
580
|
+
@blur=${this.leadingPress.onBlur}
|
|
581
|
+
@focus=${this.onFocus}
|
|
582
|
+
>
|
|
583
|
+
<span part="icon" class="icon" aria-hidden="true"><slot class="icon-slot" name="icon"></slot></span>
|
|
584
|
+
<span part="label" class="label">${this.label}</span>
|
|
585
|
+
</button>
|
|
586
|
+
<span part="divider" class="divider" aria-hidden="true"></span>
|
|
587
|
+
<button
|
|
588
|
+
part="container trailing"
|
|
589
|
+
type="button"
|
|
590
|
+
id="trailing"
|
|
591
|
+
data-tanrei-shape
|
|
592
|
+
class=${classMap({ trailing: true, open, swap, turning: this.turning, ...this.trailingPlace.classes() })}
|
|
593
|
+
aria-label=${this.menuLabel || nothing}
|
|
594
|
+
?disabled=${this.disabled}
|
|
595
|
+
@click=${this.onTrailingClick}
|
|
596
|
+
@pointerdown=${this.onHalfPointerDown}
|
|
597
|
+
@pointerup=${this.trailingPress.release}
|
|
598
|
+
@pointercancel=${this.trailingPress.release}
|
|
599
|
+
@pointerenter=${this.onTrailingEnter}
|
|
600
|
+
@pointerleave=${this.onTrailingLeave}
|
|
601
|
+
@keydown=${this.onTrailingKeyDown}
|
|
602
|
+
@keyup=${this.trailingPress.onKeyUp}
|
|
603
|
+
@blur=${this.trailingPress.onBlur}
|
|
604
|
+
@focus=${this.onFocus}
|
|
605
|
+
>
|
|
606
|
+
<span class="chevrons" aria-hidden="true">
|
|
607
|
+
<span class="turn"><span part="chevron" class="chevron"><slot class="chevron-slot" name="chevron">expand_more</slot></span></span>
|
|
608
|
+
<span class="glyph-open"><span part="chevron" class="chevron"><slot class="chevron-open-slot" name="chevron-open"></slot></span></span>
|
|
609
|
+
</span>
|
|
610
|
+
</button>
|
|
611
|
+
</div>
|
|
612
|
+
<tanrei-menu
|
|
613
|
+
anchor="trailing"
|
|
614
|
+
placement="bottom-end"
|
|
615
|
+
.focusless=${this.fromHover}
|
|
616
|
+
.open=${presented}
|
|
617
|
+
@close=${this.onMenuClose}
|
|
618
|
+
@pointerenter=${this.onMenuEnter}
|
|
619
|
+
@pointerleave=${this.onMenuLeave}
|
|
620
|
+
>
|
|
621
|
+
${this.menuChildren.map(() => html `<slot class="menu-slot" name="menu"></slot>`)}
|
|
622
|
+
</tanrei-menu>
|
|
623
|
+
<span class="timing"></span>
|
|
624
|
+
`;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
const sameNodes = (a, b) => a.length === b.length && a.every((node, i) => node === b[i]);
|
|
628
|
+
// SPB-15: the menu it presents is the Tanrei Menu, registered with it.
|
|
629
|
+
if (!customElements.get('tanrei-menu'))
|
|
630
|
+
customElements.define('tanrei-menu', TanreiMenu);
|
|
631
|
+
// `autofocus` on it gives it focus when the page first loads too (src/primitives/autofocus.ts).
|
|
632
|
+
focusedAtFirst(TanreiButtonWithMenu);
|
|
633
|
+
if (!customElements.get('tanrei-button-with-menu'))
|
|
634
|
+
customElements.define('tanrei-button-with-menu', TanreiButtonWithMenu);
|
|
635
|
+
//# sourceMappingURL=button-with-menu.js.map
|