@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,195 @@
|
|
|
1
|
+
import { LitElement, html, svg } from 'lit';
|
|
2
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
+
import { AvailabilityController, OpenAxesController, VisibilityController, hostAria, report } from '../../primitives/index.js';
|
|
4
|
+
import { AXES, styles } from './loading-indicator.styles.js';
|
|
5
|
+
/** The kinds of `comp.loading-indicator.motion.entrance`. The first is the default, and what an unknown name falls back to. */
|
|
6
|
+
const ENTRANCES = ['fade', 'grow'];
|
|
7
|
+
const ENTRANCE_TOKEN = '--tanrei-comp-loading-indicator-motion-entrance';
|
|
8
|
+
/** LDG-14: an attribute that is empty or does not parse as a finite number is not a number (and is reported). */
|
|
9
|
+
const milliseconds = {
|
|
10
|
+
fromAttribute: (value) => (value === null ? null : value.trim() === '' ? Number.NaN : Number(value)),
|
|
11
|
+
};
|
|
12
|
+
const usable = (value) => typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
13
|
+
/**
|
|
14
|
+
* Shows that a short wait of unknown length is under way, inline or over content.
|
|
15
|
+
*
|
|
16
|
+
* Contract: specs/loading-indicator.spec.json. A quarter arc that turns once per cycle, with no track; `contained` draws
|
|
17
|
+
* it on a raised circle of its own, for waits over content. Every visual value is a `--tanrei-comp-loading-indicator-*`
|
|
18
|
+
* token. When the length of the wait can be measured, use `<tanrei-progress-indicator>` instead.
|
|
19
|
+
*
|
|
20
|
+
* Insert it when the wait starts and remove it when the wait ends. From its insertion it waits `showDelay` (null takes
|
|
21
|
+
* `motion.show-delay`) with its box kept, drawing nothing and exposing nothing (`aria-hidden="true"`); then it enters
|
|
22
|
+
* (`entrance`: fade, or grow from its center, over `enterDuration`) and the arc starts turning. Moving it within the
|
|
23
|
+
* document starts a new delay; hiding it (`hidden`, CSS, scrolling) neither restarts nor pauses it. A change of
|
|
24
|
+
* `showDelay`, `entrance` or `enterDuration` applies from the next insertion.
|
|
25
|
+
*
|
|
26
|
+
* Once shown, the host is a progressbar with no value (`role="progressbar"`, `aria-label` from `label`,
|
|
27
|
+
* `aria-busy="true"`). It is never focusable and never announces itself: mark the region being loaded `aria-busy` and
|
|
28
|
+
* announce its arrival in the product. Under `prefers-reduced-motion: reduce` the arc stops turning and the whole circle
|
|
29
|
+
* pulses, and grow enters as a fade; the delay is kept. Off screen, the turning is paused (the entrance is not).
|
|
30
|
+
*
|
|
31
|
+
* @tag tanrei-loading-indicator
|
|
32
|
+
* @csspart container - The raised circle behind the indicator (filled only when contained).
|
|
33
|
+
* @csspart indicator - The turning arc.
|
|
34
|
+
*/
|
|
35
|
+
export class TanreiLoadingIndicator extends LitElement {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
this.availability = new AvailabilityController(this, 'loading-indicator');
|
|
39
|
+
/** The indicator's box (16 / 24 / 40 in the default system): small in a control, medium next to text, large in an empty section. */
|
|
40
|
+
this.size = 'medium';
|
|
41
|
+
/** Draws the indicator on a raised container of its own, for places where it floats over content. */
|
|
42
|
+
this.contained = false;
|
|
43
|
+
/** The accessible name: what is loading ("Loading messages"). Required. */
|
|
44
|
+
this.label = '';
|
|
45
|
+
/**
|
|
46
|
+
* How long, in milliseconds, it waits from its insertion before it is drawn and exposed; 0 shows it as it is inserted.
|
|
47
|
+
* Null takes `motion.show-delay`, as does a negative or non-finite value (reported).
|
|
48
|
+
*/
|
|
49
|
+
this.showDelay = null;
|
|
50
|
+
/** How it enters once shown: fade, or grow from its center. Auto takes `motion.entrance`. */
|
|
51
|
+
this.entrance = 'auto';
|
|
52
|
+
/**
|
|
53
|
+
* How long, in milliseconds, its entrance lasts; 0 shows it whole at once. Null takes `motion.enter-duration`, as does
|
|
54
|
+
* a negative or non-finite value (reported).
|
|
55
|
+
*/
|
|
56
|
+
this.enterDuration = null;
|
|
57
|
+
/** LDG-9: sizes a design system adds, and a size the active system does not have (src/primitives/axes.ts). */
|
|
58
|
+
this.axes = new OpenAxesController(this, { component: 'loading-indicator', behavior: 'LDG-9', axes: AXES });
|
|
59
|
+
/** LDG-7: the arc turns only while it can be seen. */
|
|
60
|
+
this.visibility = new VisibilityController(this);
|
|
61
|
+
/** LDG-11, LDG-12: false during the show delay. */
|
|
62
|
+
this.shown = false;
|
|
63
|
+
this.run = null;
|
|
64
|
+
this.entering = false;
|
|
65
|
+
this.entry = null;
|
|
66
|
+
}
|
|
67
|
+
static { this.styles = styles; }
|
|
68
|
+
static { this.properties = {
|
|
69
|
+
size: { type: String, reflect: true },
|
|
70
|
+
contained: { type: Boolean, reflect: true },
|
|
71
|
+
label: { type: String },
|
|
72
|
+
showDelay: { attribute: 'show-delay', converter: milliseconds },
|
|
73
|
+
entrance: { type: String },
|
|
74
|
+
enterDuration: { attribute: 'enter-duration', converter: milliseconds },
|
|
75
|
+
}; }
|
|
76
|
+
connectedCallback() {
|
|
77
|
+
super.connectedCallback();
|
|
78
|
+
// LDG-16: every insertion waits its whole delay, with the values of that moment.
|
|
79
|
+
clearTimeout(this.timer);
|
|
80
|
+
this.cancelEntrance();
|
|
81
|
+
this.shown = false;
|
|
82
|
+
this.requestUpdate();
|
|
83
|
+
this.run = this.resolve();
|
|
84
|
+
if (this.run.delay === 0)
|
|
85
|
+
this.show();
|
|
86
|
+
else {
|
|
87
|
+
this.expose();
|
|
88
|
+
// LDG-15: a wait, not motion — kept under reduced motion, and counted while the indicator cannot be seen.
|
|
89
|
+
this.timer = setTimeout(() => this.show(), this.run.delay);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
disconnectedCallback() {
|
|
93
|
+
super.disconnectedCallback();
|
|
94
|
+
// LDG-16: removed during the delay, it has shown nothing; removed while shown, it is gone at once.
|
|
95
|
+
clearTimeout(this.timer);
|
|
96
|
+
this.timer = undefined;
|
|
97
|
+
this.cancelEntrance();
|
|
98
|
+
this.shown = false;
|
|
99
|
+
}
|
|
100
|
+
/** LDG-14: the delay, the entrance's duration, curve and kind, from the props or else from the tokens as they resolve now. */
|
|
101
|
+
resolve() {
|
|
102
|
+
// A duration token is an expression: it is computed through real properties, never parsed.
|
|
103
|
+
const probe = document.createElement('span');
|
|
104
|
+
probe.className = 'timing';
|
|
105
|
+
this.renderRoot.appendChild(probe);
|
|
106
|
+
const style = getComputedStyle(probe);
|
|
107
|
+
const ms = (value) => (Number.parseFloat(value) || 0) * 1000;
|
|
108
|
+
const token = { delay: ms(style.transitionDelay), duration: ms(style.transitionDuration), easing: style.transitionTimingFunction };
|
|
109
|
+
probe.remove();
|
|
110
|
+
const named = ENTRANCES.includes(this.entrance) ? this.entrance : null;
|
|
111
|
+
// The system's choice of kind arrives as its name; an unknown name is the first kind.
|
|
112
|
+
const system = getComputedStyle(this).getPropertyValue(ENTRANCE_TOKEN).trim();
|
|
113
|
+
return {
|
|
114
|
+
delay: usable(this.showDelay) ? this.showDelay : token.delay,
|
|
115
|
+
duration: usable(this.enterDuration) ? this.enterDuration : token.duration,
|
|
116
|
+
easing: token.easing,
|
|
117
|
+
entrance: named ?? (ENTRANCES.includes(system) ? system : ENTRANCES[0]),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** LDG-12: shown — exposed, entering, and the cycle starting from its beginning. */
|
|
121
|
+
show() {
|
|
122
|
+
this.timer = undefined;
|
|
123
|
+
this.shown = true;
|
|
124
|
+
this.entering = true;
|
|
125
|
+
this.expose();
|
|
126
|
+
this.requestUpdate();
|
|
127
|
+
}
|
|
128
|
+
/** LDG-5, LDG-11: a busy progressbar with no value once shown; absent from the accessibility tree while it waits. */
|
|
129
|
+
expose() {
|
|
130
|
+
// LDG-6: not focusable, not a live region.
|
|
131
|
+
if (this.shown)
|
|
132
|
+
hostAria(this, { role: 'progressbar', 'aria-label': this.label || null, 'aria-busy': 'true', 'aria-hidden': null });
|
|
133
|
+
else
|
|
134
|
+
hostAria(this, { role: null, 'aria-label': null, 'aria-busy': null, 'aria-hidden': 'true' });
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* LDG-13: fade eases the opacity of the whole component from 0 to 1; grow does so while scaling it from nothing about its
|
|
138
|
+
* center. Drawn only — the box keeps its size — and it runs to its end whether or not the indicator is seen.
|
|
139
|
+
*/
|
|
140
|
+
enter(container) {
|
|
141
|
+
const run = this.run;
|
|
142
|
+
if (!run || run.duration <= 0)
|
|
143
|
+
return;
|
|
144
|
+
// Reduced motion: nothing moves, so grow enters as fade.
|
|
145
|
+
const grow = run.entrance === 'grow' && !matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
146
|
+
const keyframes = grow ? [{ opacity: 0, transform: 'scale(0)' }, { opacity: 1, transform: 'none' }] : [{ opacity: 0 }, { opacity: 1 }];
|
|
147
|
+
this.entry = container.animate(keyframes, { duration: run.duration, easing: run.easing, fill: 'backwards' });
|
|
148
|
+
this.entry.id = grow ? 'enter-grow' : 'enter-fade';
|
|
149
|
+
}
|
|
150
|
+
cancelEntrance() {
|
|
151
|
+
this.entering = false;
|
|
152
|
+
this.entry?.cancel();
|
|
153
|
+
this.entry = null;
|
|
154
|
+
}
|
|
155
|
+
willUpdate(changed) {
|
|
156
|
+
// LDG-10: a moving mark alone is not a name.
|
|
157
|
+
if (changed.has('label') && !this.label)
|
|
158
|
+
report(this, 'LDG-10', 'label is empty, so the loading indicator has no accessible name; give it a label');
|
|
159
|
+
// LDG-14: a value it cannot use takes the token, and is reported.
|
|
160
|
+
for (const [name, attribute, token] of [['showDelay', 'show-delay', 'show-delay'], ['enterDuration', 'enter-duration', 'enter-duration']]) {
|
|
161
|
+
const value = this[name];
|
|
162
|
+
if (!changed.has(name) || value === null || value === undefined || usable(value))
|
|
163
|
+
continue;
|
|
164
|
+
const written = this.getAttribute(attribute);
|
|
165
|
+
const shown = Number.isNaN(value) && written !== null ? `"${written}"` : String(value);
|
|
166
|
+
report(this, 'LDG-14', `${name} ${shown} is not a finite, non-negative number of milliseconds; it takes comp.loading-indicator.motion.${token}`);
|
|
167
|
+
}
|
|
168
|
+
if (changed.has('entrance') && this.entrance !== 'auto' && !ENTRANCES.includes(this.entrance)) {
|
|
169
|
+
report(this, 'LDG-14', `entrance "${this.entrance}" is not auto, fade or grow; it takes comp.loading-indicator.motion.entrance`);
|
|
170
|
+
}
|
|
171
|
+
if (this.isConnected)
|
|
172
|
+
this.expose();
|
|
173
|
+
}
|
|
174
|
+
updated() {
|
|
175
|
+
if (!this.entering)
|
|
176
|
+
return;
|
|
177
|
+
this.entering = false;
|
|
178
|
+
const container = this.renderRoot.querySelector('.container');
|
|
179
|
+
if (container)
|
|
180
|
+
this.enter(container);
|
|
181
|
+
}
|
|
182
|
+
render() {
|
|
183
|
+
// LDG-11: while it waits, its box is kept and nothing is drawn or run.
|
|
184
|
+
return html `
|
|
185
|
+
<div part="container" class=${classMap({ container: true, waiting: !this.shown })} data-tanrei-shape>
|
|
186
|
+
<div part="indicator" class=${classMap({ indicator: true, paused: !this.visibility.visible })}>
|
|
187
|
+
<svg aria-hidden="true" focusable="false">${svg `<circle></circle>`}</svg>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (!customElements.get('tanrei-loading-indicator'))
|
|
194
|
+
customElements.define('tanrei-loading-indicator', TanreiLoadingIndicator);
|
|
195
|
+
//# sourceMappingURL=loading-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading-indicator.js","sourceRoot":"","sources":["../../../src/components/loading-indicator/loading-indicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkD,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AA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AY,CAAC,CAAC;QAC3E,IAAI,SAAS;YAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAEkB,MAAM;QACvB,uEAAuE;QACvE,OAAO,IAAI,CAAA;oCACqB,QAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;sCACjD,QAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;sDAC/C,GAAG,CAAA,mBAAmB;;;KAGvE,CAAC;IACJ,CAAC;CACF;AAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAAE,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type OpenAxis } from '../../primitives/index.js';
|
|
2
|
+
/** The sizes every design system has; a layer may add more. */
|
|
3
|
+
export declare const CORE_SIZES: readonly ['small', 'medium', 'large'];
|
|
4
|
+
/** LDG-9: a size a layer adds gets its block on demand; one the active system lacks draws medium and is reported. */
|
|
5
|
+
export declare const AXES: readonly OpenAxis[];
|
|
6
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { arcStyles } from '../../primitives/index.js';
|
|
3
|
+
import { cornerRadius, shape } from '../../styles/shape.js';
|
|
4
|
+
/** The sizes every design system has; a layer may add more. */
|
|
5
|
+
export const CORE_SIZES = ['small', 'medium', 'large'];
|
|
6
|
+
const DEFAULT_SIZE = 'medium';
|
|
7
|
+
const PREFIX = '--tanrei-comp-loading-indicator';
|
|
8
|
+
/** The members of the size axis (`dev.tanrei.axes.size.members`). */
|
|
9
|
+
const SIZE_MEMBERS = { ring: 'indicator-size', stroke: 'indicator-thickness', container: 'container-size' };
|
|
10
|
+
const ref = (member, size, fallback) => fallback ? `var(${PREFIX}-${member}-${size}, var(${PREFIX}-${member}-${fallback}))` : `var(${PREFIX}-${member}-${size})`;
|
|
11
|
+
const sizeBlock = (size, selector, fallback = null) => `${selector} {\n${Object.entries(SIZE_MEMBERS)
|
|
12
|
+
.map(([key, member]) => ` --_${key}: ${ref(member, size, fallback)};`)
|
|
13
|
+
.join('\n')}\n}`;
|
|
14
|
+
/** LDG-9: a size a layer adds gets its block on demand; one the active system lacks draws medium and is reported. */
|
|
15
|
+
export const AXES = [
|
|
16
|
+
{ name: 'size', core: CORE_SIZES, default: DEFAULT_SIZE, rules: (value, selector) => sizeBlock(value, selector, DEFAULT_SIZE), probe: (value) => `${PREFIX}-indicator-size-${value}` },
|
|
17
|
+
];
|
|
18
|
+
const T = (name) => unsafeCSS(`var(${PREFIX}-${name})`);
|
|
19
|
+
// Every visual value is a token (tokens/comp/loading-indicator.tokens.json): per size the indicator's square, its
|
|
20
|
+
// stroke and the container's square; the indicator color on the surface, and — contained — the container's color,
|
|
21
|
+
// elevation and shape and the indicator color on it; the length of one turn; the show delay and the entrance's duration
|
|
22
|
+
// and curve (its kind is read by the element, loading-indicator.ts).
|
|
23
|
+
export const styles = css `
|
|
24
|
+
:host {
|
|
25
|
+
/* LDG-2: not contained, the component is exactly its indicator's square. */
|
|
26
|
+
display: inline-block;
|
|
27
|
+
position: relative;
|
|
28
|
+
flex: none;
|
|
29
|
+
vertical-align: middle;
|
|
30
|
+
inline-size: var(--_ring);
|
|
31
|
+
block-size: var(--_ring);
|
|
32
|
+
--_color: ${T('indicator-color')};
|
|
33
|
+
}
|
|
34
|
+
:host([hidden]) {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
${unsafeCSS(sizeBlock(DEFAULT_SIZE, ':host'))}
|
|
38
|
+
${unsafeCSS(CORE_SIZES.filter((s) => s !== DEFAULT_SIZE).map((s) => sizeBlock(s, `:host([size='${s}'])`)).join('\n'))}
|
|
39
|
+
|
|
40
|
+
/* LDG-3: contained, a raised, filled container of the size's container square, the indicator centered in it. */
|
|
41
|
+
:host([contained]) {
|
|
42
|
+
inline-size: var(--_container);
|
|
43
|
+
block-size: var(--_container);
|
|
44
|
+
--_color: ${T('contained-indicator-color')};
|
|
45
|
+
}
|
|
46
|
+
.container {
|
|
47
|
+
position: absolute;
|
|
48
|
+
inset: 0;
|
|
49
|
+
display: grid;
|
|
50
|
+
place-items: center;
|
|
51
|
+
}
|
|
52
|
+
:host([contained]) .container {
|
|
53
|
+
background: ${T('contained-container-color')};
|
|
54
|
+
box-shadow: ${T('contained-container-elevation')};
|
|
55
|
+
${unsafeCSS(cornerRadius(`${PREFIX}-container-shape`))}
|
|
56
|
+
}
|
|
57
|
+
${shape}
|
|
58
|
+
|
|
59
|
+
/* LDG-1: a quarter of the circle with round caps, whose outer edge touches the indicator's square, turning clockwise
|
|
60
|
+
once per cycle at constant speed; no track. The dash is shortened by the caps and moved forward by half of them,
|
|
61
|
+
so the arc as drawn — caps included — is a quarter. */
|
|
62
|
+
.indicator {
|
|
63
|
+
position: relative;
|
|
64
|
+
inline-size: var(--_ring);
|
|
65
|
+
block-size: var(--_ring);
|
|
66
|
+
animation: ring-turn ${T('motion-cycle-duration')} var(--tanrei-sys-motion-easing-linear) infinite;
|
|
67
|
+
}
|
|
68
|
+
${arcStyles}
|
|
69
|
+
circle {
|
|
70
|
+
stroke: var(--_color);
|
|
71
|
+
stroke-linecap: round;
|
|
72
|
+
stroke-dasharray: max(0px, calc(var(--_c) / 4 - var(--_stroke))) var(--_c);
|
|
73
|
+
stroke-dashoffset: calc(var(--_stroke) / -2);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* LDG-4: under reduced motion it does not turn — the whole circle, its opacity easing from 1 to 0 and back once per
|
|
77
|
+
cycle with sys.motion.easing.standard; a container stays still and opaque. */
|
|
78
|
+
@media (prefers-reduced-motion: reduce) {
|
|
79
|
+
.indicator {
|
|
80
|
+
animation: pulse ${T('motion-cycle-duration')} var(--tanrei-sys-motion-easing-standard) infinite;
|
|
81
|
+
}
|
|
82
|
+
circle {
|
|
83
|
+
stroke-dasharray: none;
|
|
84
|
+
stroke-dashoffset: 0;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* LDG-7: off screen, nothing runs. */
|
|
89
|
+
:host .paused {
|
|
90
|
+
animation-play-state: paused;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* LDG-11: during the show delay the box is kept (the host's size) and nothing is drawn — no indicator, no container,
|
|
94
|
+
no shadow — and nothing runs; the turn (or the pulse) starts from its beginning when it is shown (LDG-12). */
|
|
95
|
+
.waiting {
|
|
96
|
+
visibility: hidden;
|
|
97
|
+
}
|
|
98
|
+
.waiting .indicator {
|
|
99
|
+
animation: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* LDG-14: the tokens' show delay, enter duration and enter easing, computed through inert properties of a probe the
|
|
103
|
+
element reads as it is inserted. */
|
|
104
|
+
.timing {
|
|
105
|
+
display: none;
|
|
106
|
+
transition-property: none;
|
|
107
|
+
transition-delay: ${T('motion-show-delay')};
|
|
108
|
+
transition-duration: ${T('motion-enter-duration')};
|
|
109
|
+
transition-timing-function: ${T('motion-enter-easing')};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@media (forced-colors: active) {
|
|
113
|
+
circle {
|
|
114
|
+
forced-color-adjust: none;
|
|
115
|
+
stroke: CanvasText;
|
|
116
|
+
}
|
|
117
|
+
:host([contained]) .container {
|
|
118
|
+
forced-color-adjust: none;
|
|
119
|
+
background: Canvas;
|
|
120
|
+
outline: var(--tanrei-sys-border-hairline) solid CanvasText;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
//# sourceMappingURL=loading-indicator.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading-indicator.styles.js","sourceRoot":"","sources":["../../../src/components/loading-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;;;;;CAczD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { LitElement, type PropertyDeclarations, type PropertyValues } from 'lit';
|
|
2
|
+
import type { TanreiMainActionButtonSizeRegistry, TanreiMainActionButtonVariantRegistry } from '../../registry.js';
|
|
3
|
+
/** The core variants (filled, tonal, surface), plus any a design system's generated `.d.ts` registers. */
|
|
4
|
+
export type TanreiMainActionButtonVariant = keyof TanreiMainActionButtonVariantRegistry;
|
|
5
|
+
/** The core sizes (small, medium, large), plus any a design system's generated `.d.ts` registers. */
|
|
6
|
+
export type TanreiMainActionButtonSize = keyof TanreiMainActionButtonSizeRegistry;
|
|
7
|
+
/** The side of the label the icon is on, in the reading direction. */
|
|
8
|
+
export type TanreiMainActionButtonIconPosition = 'leading' | 'trailing';
|
|
9
|
+
/**
|
|
10
|
+
* Performs the single most important action of a screen on a raised container that floats above the content, showing
|
|
11
|
+
* its icon and its written name (extended), or collapsing to its icon alone.
|
|
12
|
+
*
|
|
13
|
+
* Contract: specs/main-action-button.spec.json. Every visual value comes from `--tanrei-comp-main-action-button-*`
|
|
14
|
+
* tokens, one set per variant and state — the container color, the label color (the icon's too) and the elevation: how
|
|
15
|
+
* a state looks is the active design system's decision, not this component's. How a press is answered and how keyboard
|
|
16
|
+
* focus is drawn are the system's choices of kind (`--tanrei-sys-behavior-*`), and how far its corners ease is
|
|
17
|
+
* the system's amount (`--tanrei-sys-shape-corner-smoothing`); all are read from the cascade, so they follow
|
|
18
|
+
* `data-tanrei-system`.
|
|
19
|
+
*
|
|
20
|
+
* `label` is the visible text while extended and the accessible name in either form. The icon is the `icon` slot: a
|
|
21
|
+
* glyph of the system's icon set, given as its ligature text (`<span slot="icon">edit</span>`), drawn in the label color
|
|
22
|
+
* at the size's icon size, on the side `iconPosition` names. `extended = false` (the `collapsed` attribute) collapses the
|
|
23
|
+
* button to a square holding only the icon, over the resize motion. Without an icon it stays extended; without a label
|
|
24
|
+
* it never extends (both reported in debug builds). It is an action, never a toggle: it has no pressed, selected or
|
|
25
|
+
* expanded state, and collapsing changes no role, name or focus.
|
|
26
|
+
*
|
|
27
|
+
* The element does not position itself (MAB-18): it is inline, at its own size, and the page places it; which edge stays
|
|
28
|
+
* put while it collapses is the layout's decision too (an element anchored at the inline end collapses toward it).
|
|
29
|
+
*
|
|
30
|
+
* @tag tanrei-main-action-button
|
|
31
|
+
* @slot icon - The icon: a glyph of the system's icon set (its ligature text), or a `.tanrei-icon`, `<svg>` or `<img>`. Required to collapse. A glyph the icon set flags is mirrored in right-to-left; `data-mirror="auto | always | never"` on the element decides for one use.
|
|
32
|
+
* @csspart container - The native button: the raised shape that carries every state and casts the elevation.
|
|
33
|
+
* @csspart icon - The box the icon is drawn in (hidden from assistive technology).
|
|
34
|
+
* @csspart label - The label text.
|
|
35
|
+
* @fires click - The button was activated by pointer, touch, keyboard or assistive technology.
|
|
36
|
+
*/
|
|
37
|
+
export declare class TanreiMainActionButton extends LitElement {
|
|
38
|
+
private readonly availability;
|
|
39
|
+
static styles: import("lit").CSSResult[];
|
|
40
|
+
static shadowRootOptions: ShadowRootInit;
|
|
41
|
+
static properties: PropertyDeclarations;
|
|
42
|
+
/** Emphasis: filled is the screen's main action at full strength; tonal is quieter; surface keeps the container neutral over colored content (a map, a photo). */
|
|
43
|
+
variant: TanreiMainActionButtonVariant;
|
|
44
|
+
/** Visual height (small 40 / medium 48 / large 64 in the default system), which is also the side of the collapsed form. The hit area always meets the minimum target. */
|
|
45
|
+
size: TanreiMainActionButtonSize;
|
|
46
|
+
/** Shows the label beside the icon. False (the `collapsed` attribute) collapses the button to its icon; the label stays the accessible name. Not a toggle. */
|
|
47
|
+
extended: boolean;
|
|
48
|
+
/** The side of the label the icon is on, in the reading direction (the `icon-position` attribute). Collapsed, the icon is centered either way. */
|
|
49
|
+
iconPosition: TanreiMainActionButtonIconPosition;
|
|
50
|
+
/** Prevents interaction and removes the button from the focus order. Hiding it when its action is unavailable is usually better. */
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
/** The visible text while extended, and the accessible name in either form. Required: an icon alone is not a name. */
|
|
53
|
+
label: string;
|
|
54
|
+
/**
|
|
55
|
+
* The host's `aria-description`, read by assistive technology from the native button (src/primitives/description.ts).
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
forwardedDescription: string | null;
|
|
59
|
+
/** Whether the icon slot has content: the icon selects its side's padding, and is what it collapses to. */
|
|
60
|
+
protected hasIcon: boolean;
|
|
61
|
+
/** MAB-14: the width is changing between the two forms; the label keeps one line until it is done. */
|
|
62
|
+
protected resizing: boolean;
|
|
63
|
+
private resizeTimer;
|
|
64
|
+
/** MAB-7: sizes and variants a design system adds, and a value the active system does not have (src/primitives/axes.ts). */
|
|
65
|
+
private readonly axes;
|
|
66
|
+
/**
|
|
67
|
+
* MAB-22: the glyph in the icon slot is marked when the icon set mirrors its name in right-to-left, or the product's
|
|
68
|
+
* `data-mirror` says so (src/primitives/glyph-mirror.ts); `iconGlyph()` draws the mark.
|
|
69
|
+
*/
|
|
70
|
+
private readonly mirror;
|
|
71
|
+
/** MAB-8 / MAB-9: the pressed state, press-hold and the answer the system chooses (src/primitives/press.ts). */
|
|
72
|
+
private readonly press;
|
|
73
|
+
private get container();
|
|
74
|
+
private get collapsed();
|
|
75
|
+
constructor();
|
|
76
|
+
/** `element.click()` activates the button as a person would — through the native button — and does nothing while disabled. */
|
|
77
|
+
click(): void;
|
|
78
|
+
disconnectedCallback(): void;
|
|
79
|
+
/** MAB-10: where style queries are missing, the focus style is read when focus arrives. */
|
|
80
|
+
private onFocus;
|
|
81
|
+
private onIconSlotChange;
|
|
82
|
+
/**
|
|
83
|
+
* MAB-14: the resize runs over the label box's transition (comp.main-action-button.motion.resize-duration, 0 where
|
|
84
|
+
* motion is reduced); for that long the label keeps one line.
|
|
85
|
+
*/
|
|
86
|
+
private startResize;
|
|
87
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
88
|
+
protected updated(changed: PropertyValues): void;
|
|
89
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
90
|
+
}
|
|
91
|
+
declare global {
|
|
92
|
+
interface HTMLElementTagNameMap {
|
|
93
|
+
'tanrei-main-action-button': TanreiMainActionButton;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
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, FORWARDED_DESCRIPTION, GlyphMirrorController, OpenAxesController, PressController, report, syncFocusStyle } from '../../primitives/index.js';
|
|
5
|
+
import { AXES, styles } from './main-action-button.styles.js';
|
|
6
|
+
import { focusedAtFirst } from '../../primitives/autofocus.js';
|
|
7
|
+
/** MAB-13, MAB-15, MAB-16: the form it draws. No label: collapsed, whatever else; no icon: extended; otherwise as asked. */
|
|
8
|
+
const isCollapsed = (extended, hasIcon, label) => !label || (!extended && hasIcon);
|
|
9
|
+
/**
|
|
10
|
+
* Performs the single most important action of a screen on a raised container that floats above the content, showing
|
|
11
|
+
* its icon and its written name (extended), or collapsing to its icon alone.
|
|
12
|
+
*
|
|
13
|
+
* Contract: specs/main-action-button.spec.json. Every visual value comes from `--tanrei-comp-main-action-button-*`
|
|
14
|
+
* tokens, one set per variant and state — the container color, the label color (the icon's too) and the elevation: how
|
|
15
|
+
* a state looks is the active design system's decision, not this component's. How a press is answered and how keyboard
|
|
16
|
+
* focus is drawn are the system's choices of kind (`--tanrei-sys-behavior-*`), and how far its corners ease is
|
|
17
|
+
* the system's amount (`--tanrei-sys-shape-corner-smoothing`); all are read from the cascade, so they follow
|
|
18
|
+
* `data-tanrei-system`.
|
|
19
|
+
*
|
|
20
|
+
* `label` is the visible text while extended and the accessible name in either form. The icon is the `icon` slot: a
|
|
21
|
+
* glyph of the system's icon set, given as its ligature text (`<span slot="icon">edit</span>`), drawn in the label color
|
|
22
|
+
* at the size's icon size, on the side `iconPosition` names. `extended = false` (the `collapsed` attribute) collapses the
|
|
23
|
+
* button to a square holding only the icon, over the resize motion. Without an icon it stays extended; without a label
|
|
24
|
+
* it never extends (both reported in debug builds). It is an action, never a toggle: it has no pressed, selected or
|
|
25
|
+
* expanded state, and collapsing changes no role, name or focus.
|
|
26
|
+
*
|
|
27
|
+
* The element does not position itself (MAB-18): it is inline, at its own size, and the page places it; which edge stays
|
|
28
|
+
* put while it collapses is the layout's decision too (an element anchored at the inline end collapses toward it).
|
|
29
|
+
*
|
|
30
|
+
* @tag tanrei-main-action-button
|
|
31
|
+
* @slot icon - The icon: a glyph of the system's icon set (its ligature text), or a `.tanrei-icon`, `<svg>` or `<img>`. Required to collapse. A glyph the icon set flags is mirrored in right-to-left; `data-mirror="auto | always | never"` on the element decides for one use.
|
|
32
|
+
* @csspart container - The native button: the raised shape that carries every state and casts the elevation.
|
|
33
|
+
* @csspart icon - The box the icon is drawn in (hidden from assistive technology).
|
|
34
|
+
* @csspart label - The label text.
|
|
35
|
+
* @fires click - The button was activated by pointer, touch, keyboard or assistive technology.
|
|
36
|
+
*/
|
|
37
|
+
export class TanreiMainActionButton extends LitElement {
|
|
38
|
+
static { this.styles = [styles, hiddenHost]; }
|
|
39
|
+
static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true }; }
|
|
40
|
+
static { this.properties = {
|
|
41
|
+
variant: { type: String, reflect: true },
|
|
42
|
+
size: { type: String, reflect: true },
|
|
43
|
+
// An HTML boolean attribute cannot default to true: the attribute is the inverse, `collapsed` (the spec's web notes).
|
|
44
|
+
extended: {
|
|
45
|
+
attribute: 'collapsed',
|
|
46
|
+
reflect: true,
|
|
47
|
+
converter: { fromAttribute: (value) => value === null, toAttribute: (value) => (value ? null : '') },
|
|
48
|
+
},
|
|
49
|
+
iconPosition: { type: String, attribute: 'icon-position', reflect: true },
|
|
50
|
+
disabled: { type: Boolean, reflect: true },
|
|
51
|
+
label: { type: String },
|
|
52
|
+
hasIcon: { state: true },
|
|
53
|
+
resizing: { state: true },
|
|
54
|
+
forwardedDescription: FORWARDED_DESCRIPTION,
|
|
55
|
+
}; }
|
|
56
|
+
get container() {
|
|
57
|
+
return this.renderRoot.querySelector('button');
|
|
58
|
+
}
|
|
59
|
+
get collapsed() {
|
|
60
|
+
return isCollapsed(this.extended, this.hasIcon, this.label);
|
|
61
|
+
}
|
|
62
|
+
constructor() {
|
|
63
|
+
super();
|
|
64
|
+
this.availability = new AvailabilityController(this, 'main-action-button');
|
|
65
|
+
/** Emphasis: filled is the screen's main action at full strength; tonal is quieter; surface keeps the container neutral over colored content (a map, a photo). */
|
|
66
|
+
this.variant = 'filled';
|
|
67
|
+
/** Visual height (small 40 / medium 48 / large 64 in the default system), which is also the side of the collapsed form. The hit area always meets the minimum target. */
|
|
68
|
+
this.size = 'medium';
|
|
69
|
+
/** Shows the label beside the icon. False (the `collapsed` attribute) collapses the button to its icon; the label stays the accessible name. Not a toggle. */
|
|
70
|
+
this.extended = true;
|
|
71
|
+
/** The side of the label the icon is on, in the reading direction (the `icon-position` attribute). Collapsed, the icon is centered either way. */
|
|
72
|
+
this.iconPosition = 'leading';
|
|
73
|
+
/** Prevents interaction and removes the button from the focus order. Hiding it when its action is unavailable is usually better. */
|
|
74
|
+
this.disabled = false;
|
|
75
|
+
/** The visible text while extended, and the accessible name in either form. Required: an icon alone is not a name. */
|
|
76
|
+
this.label = '';
|
|
77
|
+
/**
|
|
78
|
+
* The host's `aria-description`, read by assistive technology from the native button (src/primitives/description.ts).
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
this.forwardedDescription = null;
|
|
82
|
+
/** Whether the icon slot has content: the icon selects its side's padding, and is what it collapses to. */
|
|
83
|
+
this.hasIcon = false;
|
|
84
|
+
/** MAB-14: the width is changing between the two forms; the label keeps one line until it is done. */
|
|
85
|
+
this.resizing = false;
|
|
86
|
+
/** MAB-7: sizes and variants a design system adds, and a value the active system does not have (src/primitives/axes.ts). */
|
|
87
|
+
this.axes = new OpenAxesController(this, { component: 'main-action-button', behavior: 'MAB-7', axes: AXES });
|
|
88
|
+
/**
|
|
89
|
+
* MAB-22: the glyph in the icon slot is marked when the icon set mirrors its name in right-to-left, or the product's
|
|
90
|
+
* `data-mirror` says so (src/primitives/glyph-mirror.ts); `iconGlyph()` draws the mark.
|
|
91
|
+
*/
|
|
92
|
+
this.mirror = new GlyphMirrorController(this, { slots: 'slot[name="icon"]' });
|
|
93
|
+
/** MAB-8 / MAB-9: the pressed state, press-hold and the answer the system chooses (src/primitives/press.ts). */
|
|
94
|
+
this.press = new PressController(this, {
|
|
95
|
+
container: () => this.container,
|
|
96
|
+
holdCarrier: () => this.renderRoot.querySelector('.label'),
|
|
97
|
+
disabled: () => this.disabled,
|
|
98
|
+
});
|
|
99
|
+
// A disabled native button already swallows its own clicks; this also covers clicks that land on the host
|
|
100
|
+
// (a click event dispatched on it), so MAB-2 holds.
|
|
101
|
+
this.addEventListener('click', (event) => {
|
|
102
|
+
if (this.disabled) {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
event.stopImmediatePropagation();
|
|
105
|
+
}
|
|
106
|
+
}, { capture: true });
|
|
107
|
+
}
|
|
108
|
+
/** `element.click()` activates the button as a person would — through the native button — and does nothing while disabled. */
|
|
109
|
+
click() {
|
|
110
|
+
const container = this.container;
|
|
111
|
+
if (container)
|
|
112
|
+
container.click();
|
|
113
|
+
else if (!this.disabled)
|
|
114
|
+
super.click();
|
|
115
|
+
}
|
|
116
|
+
disconnectedCallback() {
|
|
117
|
+
super.disconnectedCallback();
|
|
118
|
+
clearTimeout(this.resizeTimer);
|
|
119
|
+
this.resizing = false;
|
|
120
|
+
}
|
|
121
|
+
/** MAB-10: where style queries are missing, the focus style is read when focus arrives. */
|
|
122
|
+
onFocus() {
|
|
123
|
+
syncFocusStyle(this, this.container);
|
|
124
|
+
}
|
|
125
|
+
onIconSlotChange(event) {
|
|
126
|
+
this.hasIcon = event.target.assignedElements().length > 0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* MAB-14: the resize runs over the label box's transition (comp.main-action-button.motion.resize-duration, 0 where
|
|
130
|
+
* motion is reduced); for that long the label keeps one line.
|
|
131
|
+
*/
|
|
132
|
+
startResize() {
|
|
133
|
+
clearTimeout(this.resizeTimer);
|
|
134
|
+
const box = this.renderRoot.querySelector('.label-box');
|
|
135
|
+
const seconds = box ? Number.parseFloat(getComputedStyle(box).transitionDuration) : 0;
|
|
136
|
+
if (!(seconds > 0)) {
|
|
137
|
+
this.resizing = false;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
this.resizing = true;
|
|
141
|
+
this.resizeTimer = setTimeout(() => (this.resizing = false), seconds * 1000);
|
|
142
|
+
}
|
|
143
|
+
willUpdate(changed) {
|
|
144
|
+
// The first render already draws the right form: the icon's light-DOM element is there before the slot says so
|
|
145
|
+
// (its slotchange comes after the render), so a collapsed element never animates in from extended.
|
|
146
|
+
if (!this.hasUpdated) {
|
|
147
|
+
this.hasIcon = [...this.children].some((child) => child.slot === 'icon');
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// The form changes when `extended`, the icon or the label changes what it can be.
|
|
151
|
+
if (changed.has('extended') || changed.has('hasIcon') || changed.has('label')) {
|
|
152
|
+
const before = (key, now) => (changed.has(key) ? changed.get(key) : now);
|
|
153
|
+
const was = isCollapsed(before('extended', this.extended), before('hasIcon', this.hasIcon), before('label', this.label) ?? '');
|
|
154
|
+
if (was !== this.collapsed)
|
|
155
|
+
this.startResize();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
updated(changed) {
|
|
159
|
+
// MAB-16: the label is the name; without one it never extends. It still renders; a debug build says what is missing.
|
|
160
|
+
if (changed.has('label') && !this.label)
|
|
161
|
+
report(this, 'MAB-16', 'label is empty, so the button has no accessible name and stays collapsed; give it a label');
|
|
162
|
+
// MAB-15: without an icon there is nothing to collapse to — it stays extended, and a debug build says why.
|
|
163
|
+
if ((changed.has('extended') || changed.has('hasIcon') || changed.has('label')) && !this.extended && !this.hasIcon && this.label) {
|
|
164
|
+
report(this, 'MAB-15', 'extended is false but there is no icon, so it cannot collapse; it stays extended — give it an icon');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
render() {
|
|
168
|
+
// The native <button> supplies role, focusability, Enter/Space activation and the disabled state, so assistive
|
|
169
|
+
// technology and test tools see real semantics. The label is its content — its name in either form (MAB-13) — and
|
|
170
|
+
// nothing here changes with the form but what is drawn: no aria-expanded, no aria-pressed, no live region (MAB-20).
|
|
171
|
+
const side = this.iconPosition === 'trailing' ? 'trailing' : 'leading';
|
|
172
|
+
return html `
|
|
173
|
+
<button
|
|
174
|
+
part="container"
|
|
175
|
+
type="button"
|
|
176
|
+
data-tanrei-shape
|
|
177
|
+
class=${classMap({ [side]: this.hasIcon, collapsed: this.collapsed })}
|
|
178
|
+
?data-resizing=${this.resizing}
|
|
179
|
+
aria-description=${this.forwardedDescription ?? nothing}
|
|
180
|
+
?disabled=${this.disabled}
|
|
181
|
+
@pointerdown=${this.press.onPointerDown}
|
|
182
|
+
@pointerup=${this.press.release}
|
|
183
|
+
@pointercancel=${this.press.release}
|
|
184
|
+
@pointerleave=${this.press.release}
|
|
185
|
+
@keydown=${this.press.onKeyDown}
|
|
186
|
+
@keyup=${this.press.onKeyUp}
|
|
187
|
+
@blur=${this.press.onBlur}
|
|
188
|
+
@focus=${this.onFocus}
|
|
189
|
+
>
|
|
190
|
+
<span class="content">
|
|
191
|
+
<span class="icon-box"><span part="icon" class="icon" aria-hidden="true"><slot name="icon" @slotchange=${this.onIconSlotChange}></slot></span></span>
|
|
192
|
+
<span class="label-box"><span class="label-clip"><span part="label" class="label">${this.label}</span></span></span>
|
|
193
|
+
</span>
|
|
194
|
+
</button>
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// `autofocus` on it gives it focus when the page first loads too (src/primitives/autofocus.ts).
|
|
199
|
+
focusedAtFirst(TanreiMainActionButton);
|
|
200
|
+
if (!customElements.get('tanrei-main-action-button'))
|
|
201
|
+
customElements.define('tanrei-main-action-button', TanreiMainActionButton);
|
|
202
|
+
//# sourceMappingURL=main-action-button.js.map
|