@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,235 @@
|
|
|
1
|
+
import { LitElement, nothing } from 'lit';
|
|
2
|
+
import { html, literal } from 'lit/static-html.js';
|
|
3
|
+
import { hiddenHost } from '../../primitives/hidden.js';
|
|
4
|
+
import { AvailabilityController, LinkController, OpenAxesController, PressController, linkAttributes, report, slottedInteractive, syncFocusStyle } from '../../primitives/index.js';
|
|
5
|
+
import { AXES, styles } from './card.styles.js';
|
|
6
|
+
import { focusedAtFirst } from '../../primitives/autofocus.js';
|
|
7
|
+
/**
|
|
8
|
+
* Sets a group of related content apart from its background, and can be one action that opens what it shows.
|
|
9
|
+
*
|
|
10
|
+
* Contract: specs/card.spec.json. Every visual value comes from `--tanrei-comp-card-*` tokens, one set per variant and
|
|
11
|
+
* state: how a state looks is the active design system's decision, not this component's. How a press is answered and
|
|
12
|
+
* how keyboard focus is drawn are the system's choices of kind (`--tanrei-sys-behavior-*`), and how far its
|
|
13
|
+
* corners ease is the system's amount (`--tanrei-sys-shape-corner-smoothing`), read from the cascade.
|
|
14
|
+
*
|
|
15
|
+
* The content is the default slot: any layout. The card insets it by `comp.card.container.padding` (not with `flush`),
|
|
16
|
+
* clips it to its corners and hands it the variant's content color as the inherited `color`. With `interactive` the
|
|
17
|
+
* whole card is one action with the button role — its content must then hold nothing interactive (reported in debug
|
|
18
|
+
* builds) — and it can be `disabled`, which dims it as a whole. Without `interactive` it has no role (a named group
|
|
19
|
+
* with `label`) and leaves its content's semantics alone.
|
|
20
|
+
*
|
|
21
|
+
* With `href` the whole card is one link — a link card (CRD-19), whether `interactive` is set or not: the
|
|
22
|
+
* shadow root holds an `<a href>` around the slot in place of the element with the button role, drawn as an interactive
|
|
23
|
+
* card is. Enter activates it and Space does not; `click` fires first and cancelling it cancels the navigation.
|
|
24
|
+
* `target="new"` opens a new tab, safely (`noopener`), and reads `target-label` as the link's description; the card
|
|
25
|
+
* draws no mark, because its content is yours — put the icon set's `open_in_new` in it. Its content must hold nothing
|
|
26
|
+
* interactive, as an interactive card's.
|
|
27
|
+
*
|
|
28
|
+
* @tag tanrei-card
|
|
29
|
+
* @slot - The content: any layout of media, text and — only when the card is neither interactive nor a link — actions.
|
|
30
|
+
* @csspart container - The card's shape: its color, elevation, corners and, when interactive or a link, every state and the button or link semantics.
|
|
31
|
+
* @csspart content - The box that insets the content and clips it to the corners.
|
|
32
|
+
* @csspart outline - The outlined variant's edge, drawn above the content.
|
|
33
|
+
* @fires click - An interactive card or a link card was activated by pointer, touch, keyboard or assistive technology. A link card fires it before the browser follows the address; `preventDefault()` cancels the navigation.
|
|
34
|
+
*/
|
|
35
|
+
export class TanreiCard extends LitElement {
|
|
36
|
+
static { this.styles = [styles, hiddenHost]; }
|
|
37
|
+
// `element.focus()` focuses an interactive card; a card that is not an action has nothing to focus (CRD-11). Only the
|
|
38
|
+
// shadow tree is searched for a delegate, never the slotted content, so a click on a plain card never focuses its content.
|
|
39
|
+
static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true }; }
|
|
40
|
+
static { this.properties = {
|
|
41
|
+
variant: { type: String, reflect: true },
|
|
42
|
+
interactive: { type: Boolean, reflect: true },
|
|
43
|
+
disabled: { type: Boolean, reflect: true },
|
|
44
|
+
// An HTML boolean attribute cannot default to true: the attribute is the inverse, `flush` (the spec's web notes).
|
|
45
|
+
inset: {
|
|
46
|
+
attribute: 'flush',
|
|
47
|
+
reflect: true,
|
|
48
|
+
converter: { fromAttribute: (value) => value === null, toAttribute: (value) => (value ? null : '') },
|
|
49
|
+
},
|
|
50
|
+
label: { type: String },
|
|
51
|
+
href: { type: String },
|
|
52
|
+
target: { type: String },
|
|
53
|
+
targetLabel: { type: String, attribute: 'target-label' },
|
|
54
|
+
rel: { type: String },
|
|
55
|
+
download: { type: String },
|
|
56
|
+
}; }
|
|
57
|
+
get container() {
|
|
58
|
+
return this.renderRoot.querySelector('.container');
|
|
59
|
+
}
|
|
60
|
+
/** Whether the card is one pressable thing: an action (`interactive`) or a link (CRD-19). */
|
|
61
|
+
get pressable() {
|
|
62
|
+
return this.interactive || !!this.link.form;
|
|
63
|
+
}
|
|
64
|
+
/** Whether the card is an action or a link that can be taken now. */
|
|
65
|
+
get active() {
|
|
66
|
+
return this.pressable && !this.disabled;
|
|
67
|
+
}
|
|
68
|
+
constructor() {
|
|
69
|
+
super();
|
|
70
|
+
this.availability = new AvailabilityController(this, 'card');
|
|
71
|
+
/** How the card separates from its background: by depth (elevated), by tone (filled) or by an edge (outlined). Pick by the background. */
|
|
72
|
+
this.variant = 'outlined';
|
|
73
|
+
/** Makes the whole card one pressable action with the button role (it emits click). Its content must then hold nothing interactive. */
|
|
74
|
+
this.interactive = false;
|
|
75
|
+
/** Prevents interaction and removes an interactive card or a link card from the focus order. Ignored for a card that is neither. */
|
|
76
|
+
this.disabled = false;
|
|
77
|
+
/**
|
|
78
|
+
* Insets the content by the card's padding. False (the `flush` attribute) lets content reach the card's edges — a
|
|
79
|
+
* photo on top — and that content pads its own text (`--tanrei-comp-card-container-padding`).
|
|
80
|
+
*/
|
|
81
|
+
this.inset = true;
|
|
82
|
+
/** The accessible name: of the action or the link when interactive or a link card (normally its heading's text), of a named group otherwise. */
|
|
83
|
+
this.label = '';
|
|
84
|
+
/**
|
|
85
|
+
* The destination: a URL, a path or a fragment. Not empty, the whole card is one link (CRD-19) whether `interactive`
|
|
86
|
+
* is set or not: the link role, one tab stop, an `<a href>` around the content, activated by Enter and not by Space.
|
|
87
|
+
* White space is no destination, and a `javascript:` address or one that cannot be read is refused and reported in
|
|
88
|
+
* debug builds (CRD-23).
|
|
89
|
+
*/
|
|
90
|
+
this.href = '';
|
|
91
|
+
/**
|
|
92
|
+
* Where the destination opens: `same` (here) or `new` (a new tab or window, with `noopener`), which the card says
|
|
93
|
+
* through `targetLabel`; it draws no mark (CRD-21). HTML's `_self` and `_blank` are read as those two; anything else is
|
|
94
|
+
* `same` and reported. Ignored without `href`.
|
|
95
|
+
*/
|
|
96
|
+
this.target = 'same';
|
|
97
|
+
/** What assistive technology reads after the link's name while `target` is `new` ("opens in a new tab"): your words, in your language. Required then; ignored otherwise. */
|
|
98
|
+
this.targetLabel = '';
|
|
99
|
+
/** Web only: forwarded to the anchor's `rel`; `target="new"` adds `noopener` to it. Ignored without `href`. */
|
|
100
|
+
this.rel = null;
|
|
101
|
+
/** Web only: forwarded to the anchor's `download` (the file name; empty for the address's own). Ignored without `href`. */
|
|
102
|
+
this.download = null;
|
|
103
|
+
/** CRD-7: variants a design system adds, and a value the active system does not have (src/primitives/axes.ts). */
|
|
104
|
+
this.axes = new OpenAxesController(this, { component: 'card', behavior: 'CRD-7', axes: AXES });
|
|
105
|
+
/**
|
|
106
|
+
* CRD-19 … CRD-23: the link the card is while it has a destination, what its anchor carries, and what a debug build
|
|
107
|
+
* is told (src/primitives/link.ts).
|
|
108
|
+
*/
|
|
109
|
+
this.link = new LinkController(this, { ids: { refused: 'CRD-23', newContext: 'CRD-21' }, disabled: () => this.disabled });
|
|
110
|
+
/**
|
|
111
|
+
* CRD-8 / CRD-9: the pressed state, press-hold and the answer the system chooses (src/primitives/press.ts). CRD-20: a
|
|
112
|
+
* link card is pressed by Enter alone; Space is the browser's.
|
|
113
|
+
*/
|
|
114
|
+
this.press = new PressController(this, {
|
|
115
|
+
container: () => this.container,
|
|
116
|
+
holdCarrier: () => this.renderRoot.querySelector('.clip'),
|
|
117
|
+
disabled: () => !this.active,
|
|
118
|
+
keys: () => this.link.pressKeys,
|
|
119
|
+
});
|
|
120
|
+
/** Space activates on key-up, as a native button does, and only when the key went down on the card. */
|
|
121
|
+
this.spaceDown = false;
|
|
122
|
+
// CRD-2, CRD-22: a disabled interactive card or link card swallows every click that reaches it, from its content or
|
|
123
|
+
// dispatched on it.
|
|
124
|
+
this.addEventListener('click', (event) => {
|
|
125
|
+
if (this.pressable && this.disabled) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
event.stopImmediatePropagation();
|
|
128
|
+
}
|
|
129
|
+
}, { capture: true });
|
|
130
|
+
}
|
|
131
|
+
/** `element.click()` activates an interactive card as a person would, and follows a link card; otherwise it does nothing (CRD-2, CRD-11). */
|
|
132
|
+
click() {
|
|
133
|
+
if (this.active)
|
|
134
|
+
this.container?.click();
|
|
135
|
+
}
|
|
136
|
+
/** CRD-10: where style queries are missing, the focus style is read when focus arrives. */
|
|
137
|
+
onFocus() {
|
|
138
|
+
syncFocusStyle(this, this.container);
|
|
139
|
+
}
|
|
140
|
+
/** CRD-1: Enter activates on key-down and Space on key-up, as a native button does. */
|
|
141
|
+
onKeyDown(event) {
|
|
142
|
+
if (!this.active || event.target !== this.container)
|
|
143
|
+
return;
|
|
144
|
+
this.press.onKeyDown(event);
|
|
145
|
+
// CRD-20: a link card's keys are the anchor's own — Enter fires its click and follows it, Space scrolls the page.
|
|
146
|
+
if (this.link.form)
|
|
147
|
+
return;
|
|
148
|
+
if (event.key === 'Enter') {
|
|
149
|
+
if (!event.repeat)
|
|
150
|
+
this.container?.click();
|
|
151
|
+
}
|
|
152
|
+
else if (event.key === ' ') {
|
|
153
|
+
// Space would scroll the page.
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
this.spaceDown = true;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
onKeyUp(event) {
|
|
159
|
+
this.press.onKeyUp(event);
|
|
160
|
+
if (event.key !== ' ' || !this.spaceDown)
|
|
161
|
+
return;
|
|
162
|
+
this.spaceDown = false;
|
|
163
|
+
if (this.active)
|
|
164
|
+
this.container?.click();
|
|
165
|
+
}
|
|
166
|
+
onBlur() {
|
|
167
|
+
// A Space whose key-up arrives somewhere else does not activate, as on a native button.
|
|
168
|
+
this.spaceDown = false;
|
|
169
|
+
this.press.onBlur();
|
|
170
|
+
}
|
|
171
|
+
/** CRD-15: an interactive card's or a link card's content holds nothing interactive; a debug build names what it found, on every slot change. */
|
|
172
|
+
async inspectContent() {
|
|
173
|
+
if (!this.pressable)
|
|
174
|
+
return;
|
|
175
|
+
const found = await slottedInteractive(this.renderRoot.querySelector('slot'));
|
|
176
|
+
if (!found)
|
|
177
|
+
return;
|
|
178
|
+
if (this.link.form) {
|
|
179
|
+
report(this, 'CRD-15', `a link card holds an interactive element (<${found.localName}>), which assistive technology cannot reach and whose press would also follow the card's link; give the card no href and let that element be its link`);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
report(this, 'CRD-15', `an interactive card holds an interactive element (<${found.localName}>), which assistive technology cannot reach and whose press would also activate the card; make the card non-interactive and let that element be its action`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
updated(changed) {
|
|
186
|
+
// CRD-14: an interactive card or a link card without a label is named by its whole content; a debug build says so.
|
|
187
|
+
if ((changed.has('label') || changed.has('interactive') || changed.has('href')) && this.pressable && !this.label) {
|
|
188
|
+
report(this, 'CRD-14', `${this.link.form ? 'a link' : 'an interactive'} card has no label, so its whole content is its accessible name; give it a label (normally its heading’s text)`);
|
|
189
|
+
}
|
|
190
|
+
if ((changed.has('interactive') || changed.has('href')) && this.hasUpdated)
|
|
191
|
+
void this.inspectContent();
|
|
192
|
+
if (changed.has('disabled') && this.disabled)
|
|
193
|
+
this.spaceDown = false;
|
|
194
|
+
}
|
|
195
|
+
render() {
|
|
196
|
+
// An interactive card is a shadow element with the button role (not a <button>, whose content model forbids block
|
|
197
|
+
// content): Enter, Space and the click come from this element. A card that is not interactive has no role of its
|
|
198
|
+
// own — or is a named group — and no press or focus handling at all (CRD-11, CRD-14).
|
|
199
|
+
// CRD-19: a link card is an anchor around the slot instead — HTML allows one around block content that holds nothing
|
|
200
|
+
// interactive — with the same class, parts and listeners; its role, its focusability and its address are the
|
|
201
|
+
// anchor's own, written by the link primitive (a disabled one is the anchor without `href`, CRD-22).
|
|
202
|
+
const link = this.link.form;
|
|
203
|
+
const tag = link ? literal `a` : literal `div`;
|
|
204
|
+
const role = link ? nothing : this.interactive ? 'button' : this.label ? 'group' : nothing;
|
|
205
|
+
return html `
|
|
206
|
+
<${tag}
|
|
207
|
+
part="container"
|
|
208
|
+
class="container"
|
|
209
|
+
data-tanrei-shape
|
|
210
|
+
role=${role}
|
|
211
|
+
${linkAttributes(link)}
|
|
212
|
+
tabindex=${!link && this.active ? '0' : nothing}
|
|
213
|
+
aria-label=${this.label || nothing}
|
|
214
|
+
aria-description=${this.link.describe() ?? nothing}
|
|
215
|
+
aria-disabled=${!link && this.interactive && this.disabled ? 'true' : nothing}
|
|
216
|
+
@pointerdown=${this.press.onPointerDown}
|
|
217
|
+
@pointerup=${this.press.release}
|
|
218
|
+
@pointercancel=${this.press.release}
|
|
219
|
+
@pointerleave=${this.press.release}
|
|
220
|
+
@keydown=${this.onKeyDown}
|
|
221
|
+
@keyup=${this.onKeyUp}
|
|
222
|
+
@blur=${this.onBlur}
|
|
223
|
+
@focus=${this.onFocus}
|
|
224
|
+
>
|
|
225
|
+
<div part="content" class="clip"><slot @slotchange=${this.inspectContent}></slot></div>
|
|
226
|
+
<span part="outline" class="outline" aria-hidden="true"></span>
|
|
227
|
+
</${tag}>
|
|
228
|
+
`;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// `autofocus` on it gives it focus when the page first loads too (src/primitives/autofocus.ts).
|
|
232
|
+
focusedAtFirst(TanreiCard);
|
|
233
|
+
if (!customElements.get('tanrei-card'))
|
|
234
|
+
customElements.define('tanrei-card', TanreiCard);
|
|
235
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UA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
|
+
import { type OpenAxis } from '../../primitives/index.js';
|
|
2
|
+
/** The values every design system has. A layer may add more; those get their styles on demand. */
|
|
3
|
+
export declare const CORE_VARIANTS: readonly ['elevated', 'filled', 'outlined'];
|
|
4
|
+
/**
|
|
5
|
+
* The open axis (CRD-7): a variant a layer added gets its block on demand, built by the same function as the
|
|
6
|
+
* core blocks and falling back to the default's tokens; a value the active system lacks is reported in debug builds.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AXES: readonly OpenAxis[];
|
|
9
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { focusRing, minimumTarget, pressHold, rippleStyles, stateRules } from '../../primitives/index.js';
|
|
3
|
+
import { cornerRadius, shape } from '../../styles/shape.js';
|
|
4
|
+
// Every visual value is a token (tokens/comp/card.tokens.json). For each state an interactive card reads that state's
|
|
5
|
+
// tokens — it never computes how a state looks: hover, focus and press mix the variant's container with its
|
|
6
|
+
// `state-layer.color` in the default system, draw nothing in cupertino, and a disabled card dims as a whole, by value.
|
|
7
|
+
/** The values every design system has. A layer may add more; those get their styles on demand. */
|
|
8
|
+
export const CORE_VARIANTS = ['elevated', 'filled', 'outlined'];
|
|
9
|
+
const DEFAULT_VARIANT = 'outlined';
|
|
10
|
+
const STATES = { '': '', hovered: '-h', focused: '-f', pressed: '-p', disabled: '-d' };
|
|
11
|
+
const PARTS = { c: 'container-color', l: 'content-color', o: 'outline-color', e: 'container-elevation' };
|
|
12
|
+
const PREFIX = '--tanrei-comp-card';
|
|
13
|
+
// A value the core does not have may be missing from the active design system: fall back to the default's token.
|
|
14
|
+
const ref = (name, key, fallback) => (fallback ? `var(${name(key)}, var(${name(fallback)}))` : `var(${name(key)})`);
|
|
15
|
+
// Private custom properties (`--_c-h` = container, hovered) select the variant's tokens once per host.
|
|
16
|
+
const variantBlock = (variant, selector, fallback = null) => `${selector} {\n${Object.entries(STATES)
|
|
17
|
+
.flatMap(([state, suffix]) => Object.entries(PARTS).map(([key, part]) => ` --_${key}${suffix}: ${ref((v) => `${PREFIX}-${v}-${state ? `${state}-` : ''}${part}`, variant, fallback)};`))
|
|
18
|
+
.join('\n')}\n}`;
|
|
19
|
+
/**
|
|
20
|
+
* The open axis (CRD-7): a variant a layer added gets its block on demand, built by the same function as the
|
|
21
|
+
* core blocks and falling back to the default's tokens; a value the active system lacks is reported in debug builds.
|
|
22
|
+
*/
|
|
23
|
+
export const AXES = [
|
|
24
|
+
{ name: 'variant', core: CORE_VARIANTS, default: DEFAULT_VARIANT, rules: (value, selector) => variantBlock(value, selector, DEFAULT_VARIANT), probe: (value) => `${PREFIX}-${value}-container-color` },
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Everything a state paints except its container color: the content color (inherited by the slotted content, CRD-13),
|
|
28
|
+
* the elevation, and the outline — which the `.outline` layer above the content draws from `--_outline` (CRD-12).
|
|
29
|
+
*/
|
|
30
|
+
const paintContent = (suffix) => `
|
|
31
|
+
color: var(--_l${suffix});
|
|
32
|
+
box-shadow: var(--_e${suffix});
|
|
33
|
+
--_outline: var(--_o${suffix});`;
|
|
34
|
+
const paint = (suffix) => `
|
|
35
|
+
background: var(--_c${suffix});${paintContent(suffix)}`;
|
|
36
|
+
// The pieces every control shares (src/primitives): the state rules and their precedence, the ripple, the focus
|
|
37
|
+
// indicator (ring or glow), the minimum target and the carrier of press-hold, plus the one corner rule
|
|
38
|
+
// (styles/shape.ts). A card answers states only while it is an action (role="button", CRD-11); it is not a
|
|
39
|
+
// native button, so its disabled condition is `aria-disabled` (CRD-2).
|
|
40
|
+
// CRD-19: a link card's container is an anchor, and answers every state as the element with the button role does, from
|
|
41
|
+
// the same tokens; ACTION names either, and weighs what `[role='button']` weighed.
|
|
42
|
+
const ACTION = ".container:is([role='button'], a)";
|
|
43
|
+
const on = (state) => `${ACTION}${state === ':disabled' ? "[aria-disabled='true']" : state}`;
|
|
44
|
+
export const styles = css `
|
|
45
|
+
:host {
|
|
46
|
+
display: block;
|
|
47
|
+
}
|
|
48
|
+
${unsafeCSS(variantBlock(DEFAULT_VARIANT, ':host'))}
|
|
49
|
+
${unsafeCSS(CORE_VARIANTS.filter((v) => v !== DEFAULT_VARIANT).map((v) => variantBlock(v, `:host([variant='${v}'])`)).join('\n'))}
|
|
50
|
+
|
|
51
|
+
.container {
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
position: relative;
|
|
54
|
+
/* Its own stacking context, so the ripple can sit above the container color and below the content. */
|
|
55
|
+
isolation: isolate;
|
|
56
|
+
display: block;
|
|
57
|
+
/* CRD-12: no height of its own — it grows with its content. */
|
|
58
|
+
${unsafeCSS(cornerRadius('--tanrei-comp-card-container-shape'))}
|
|
59
|
+
${unsafeCSS(paint(''))}
|
|
60
|
+
-webkit-tap-highlight-color: transparent;
|
|
61
|
+
/* CRD-16: a state change of the colors, the elevation and the opacity is animated. */
|
|
62
|
+
transition-property: background-color, color, box-shadow, opacity;
|
|
63
|
+
transition-duration: var(--tanrei-comp-card-motion-state-duration);
|
|
64
|
+
transition-timing-function: var(--tanrei-comp-card-motion-state-easing);
|
|
65
|
+
}
|
|
66
|
+
${unsafeCSS(ACTION)} {
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
outline: none;
|
|
69
|
+
}
|
|
70
|
+
/* CRD-19: the anchor of a link card is the card's shape and nothing of a text link — no underline, and the content
|
|
71
|
+
color of its variant and state (above), never the browser's link or visited color. */
|
|
72
|
+
a.container {
|
|
73
|
+
text-decoration: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* CRD-12: the content is clipped to the container's shape (a box of its own, so the focus ring and the target outside
|
|
77
|
+
the container are not clipped with it) and inset by the padding on every side — logical, so RTL mirrors (CRD-17). */
|
|
78
|
+
.clip {
|
|
79
|
+
display: block;
|
|
80
|
+
/* A stacking context of its own: content that stacks itself (z-index) stays under the outline, and the content is
|
|
81
|
+
hit above the container's target (::before). */
|
|
82
|
+
isolation: isolate;
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
border-radius: calc(var(--tanrei-corner-radius) * var(--_corner-scale));
|
|
85
|
+
corner-shape: inherit;
|
|
86
|
+
padding: var(--tanrei-comp-card-container-padding);
|
|
87
|
+
}
|
|
88
|
+
:host([flush]) .clip {
|
|
89
|
+
padding: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* CRD-12: the outlined variant's edge, above the content (media that reaches the edges does not cover it), inside the
|
|
93
|
+
container, comp.card.outline.width wide. The other variants' outline color is transparent. */
|
|
94
|
+
.outline {
|
|
95
|
+
position: absolute;
|
|
96
|
+
inset: 0;
|
|
97
|
+
border-radius: calc(var(--tanrei-corner-radius) * var(--_corner-scale));
|
|
98
|
+
corner-shape: inherit;
|
|
99
|
+
box-shadow: inset 0 0 0 var(--tanrei-comp-card-outline-width) var(--_outline);
|
|
100
|
+
pointer-events: none;
|
|
101
|
+
transition: box-shadow var(--tanrei-comp-card-motion-state-duration) var(--tanrei-comp-card-motion-state-easing);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* CRD-5: the hit area meets the minimum target without changing the visual size. */
|
|
105
|
+
${minimumTarget(ACTION)}
|
|
106
|
+
|
|
107
|
+
/* CRD-3, CRD-6, CRD-8, CRD-9: each state paints from that state's tokens; pressed > focused > hovered, disabled over
|
|
108
|
+
all. Pressed is data-pressed="<feedback>" (PressController): overlay paints the pressed tokens on the whole container;
|
|
109
|
+
ripple and dim paint everything else from them while the container color stays with the state under the press
|
|
110
|
+
(ripple adds the pressed color as a layer, dim adds none); none paints nothing. */
|
|
111
|
+
${stateRules(on, {
|
|
112
|
+
hovered: `${paint('-h')}
|
|
113
|
+
opacity: var(--tanrei-comp-card-hovered-opacity);`,
|
|
114
|
+
focused: `${paint('-f')}
|
|
115
|
+
opacity: var(--tanrei-comp-card-focused-opacity);`,
|
|
116
|
+
pressed: `${paint('-p')}
|
|
117
|
+
opacity: var(--tanrei-comp-card-pressed-opacity);`,
|
|
118
|
+
pressedContent: `${paintContent('-p')}
|
|
119
|
+
opacity: var(--tanrei-comp-card-pressed-opacity);`,
|
|
120
|
+
disabled: `
|
|
121
|
+
cursor: default;${paint('-d')}
|
|
122
|
+
opacity: var(--tanrei-comp-card-disabled-opacity);`,
|
|
123
|
+
})}
|
|
124
|
+
|
|
125
|
+
/* CRD-8: the outline takes the pressed state without a transition in, as the container does. */
|
|
126
|
+
.container[data-pressed]:not([data-pressed='none']) .outline {
|
|
127
|
+
transition-duration: 0s;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* CRD-9 ripple: grows over comp.card.motion.feedback-duration and fades over motion.state-duration, both with
|
|
131
|
+
motion.state-easing, under the content and the outline. */
|
|
132
|
+
${rippleStyles({
|
|
133
|
+
color: '--_c-p',
|
|
134
|
+
grow: '--tanrei-comp-card-motion-feedback-duration',
|
|
135
|
+
fade: '--tanrei-comp-card-motion-state-duration',
|
|
136
|
+
easing: '--tanrei-comp-card-motion-state-easing',
|
|
137
|
+
})}
|
|
138
|
+
|
|
139
|
+
/* CRD-4 and CRD-10 focus-style: the ring (or the glow), never animated. */
|
|
140
|
+
${focusRing(on)}
|
|
141
|
+
|
|
142
|
+
/* CRD-10, corner smoothing: the shared rule, on the container (data-tanrei-shape); the clip, the outline, the ripple
|
|
143
|
+
and the ring are concentric with it and inherit its curve. */
|
|
144
|
+
${shape}
|
|
145
|
+
|
|
146
|
+
/* CRD-8: the clip carries press-hold for PressController. */
|
|
147
|
+
${pressHold('.clip')}
|
|
148
|
+
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
.container,
|
|
151
|
+
.outline {
|
|
152
|
+
transition: none;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
@media (forced-colors: active) {
|
|
156
|
+
.outline {
|
|
157
|
+
border: var(--tanrei-comp-card-outline-width) solid CanvasText;
|
|
158
|
+
}
|
|
159
|
+
${unsafeCSS(ACTION)} .outline {
|
|
160
|
+
border-color: ButtonText;
|
|
161
|
+
}
|
|
162
|
+
.container[aria-disabled='true'] {
|
|
163
|
+
color: GrayText;
|
|
164
|
+
}
|
|
165
|
+
.container[aria-disabled='true'] .outline {
|
|
166
|
+
border-color: GrayText;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
//# sourceMappingURL=card.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.styles.js","sourceRoot":"","sources":["../../../src/components/card/card.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAiB,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACzH,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE5D,sHAAsH;AACtH,4GAA4G;AAC5G,uHAAuH;AACvH,kGAAkG;AAClG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AACzE,MAAM,eAAe,GAAG,UAAU,CAAC;AACnC,MAAM,MAAM,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAW,CAAC;AAChG,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,qBAAqB,EAAW,CAAC;AAElH,MAAM,MAAM,GAAG,oBAAoB,CAAC;AACpC,iHAAiH;AACjH,MAAM,GAAG,GAAG,CAAC,IAA6B,EAAE,GAAW,EAAE,QAAuB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,I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,CAAC;;;;;;;;;IASA,YAAY,CAAC;IACb,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,6CAA6C;IACnD,IAAI,EAAE,0CAA0C;IAChD,MAAM,EAAE,wCAAwC;CACjD,CAAC;;;IAGA,SAAS,CAAC,EAAE,CAAC;;;;IAIb,KAAK;;;IAGL,SAAS,CAAC,OAAO,CAAC;;;;;;;;;;;;MAYhB,SAAS,CAAC,MAAM,CAAC;;;;;;;;;;CAUtB,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the items of a carousel are for a width and a scroll offset (CRL-8 – CRL-13, CRL-26, CRL-27), and where the
|
|
3
|
+
* row rests (its resting positions, CRL-12, CRL-13): the spec's geometry, with no DOM. Every length is in CSS px, in the
|
|
4
|
+
* row's inner coordinates — 0 is the inner start edge, after `comp.carousel.layout.padding-inline` — and along the
|
|
5
|
+
* reading direction (a right-to-left row mirrors them). Nothing here is rounded (CRL-10: "Widths SHALL NOT be rounded
|
|
6
|
+
* before the items are placed"): the element rounds what it draws to device pixels, starts first (CRL-40).
|
|
7
|
+
*
|
|
8
|
+
* The one rule the slots keep (CRL-40): every slot starts `gap` beyond the drawn end of the one before it — the edge
|
|
9
|
+
* slots of no width a fluid row ends with (CRL-12) and the smaller slots of a scaled row of fixed widths (CRL-26)
|
|
10
|
+
* included. An item's start and width are interpolated between the two slots around its slot position, so the end of
|
|
11
|
+
* one item and the start of the next are interpolated between points that are `gap` apart at both ends: two neighbours
|
|
12
|
+
* are `gap` apart at every scroll position.
|
|
13
|
+
*/
|
|
14
|
+
/** Where the item in focus sits (CRL-11). */
|
|
15
|
+
export type TanreiCarouselHeroAlignment = 'start' | 'center';
|
|
16
|
+
/** What the geometry is computed from: the carousel's width, its tokens and its axes. */
|
|
17
|
+
export interface CarouselMetrics {
|
|
18
|
+
/** The carousel's width (its inner width W is this less the padding twice). */
|
|
19
|
+
width: number;
|
|
20
|
+
/** comp.carousel.layout.padding-inline. */
|
|
21
|
+
padding: number;
|
|
22
|
+
/** comp.carousel.layout.gap (g). */
|
|
23
|
+
gap: number;
|
|
24
|
+
/** L: `itemWidth`, or comp.carousel.container.large-width while it is null (CRL-9). */
|
|
25
|
+
largeWidth: number;
|
|
26
|
+
/** comp.carousel.container.small-min-width. */
|
|
27
|
+
smallMin: number;
|
|
28
|
+
/** comp.carousel.container.small-max-width. */
|
|
29
|
+
smallMax: number;
|
|
30
|
+
heroAlignment: TanreiCarouselHeroAlignment;
|
|
31
|
+
/** `fluidWidth` (CRL-9, CRL-10). */
|
|
32
|
+
fluid: boolean;
|
|
33
|
+
/** `scaleOthers` (CRL-26): with fixed widths the slots other than the hero's are narrower and close up. */
|
|
34
|
+
scaleOthers?: boolean;
|
|
35
|
+
/** comp.carousel.container.min-scale (CRL-26); 1 while it is left out. */
|
|
36
|
+
minScale?: number;
|
|
37
|
+
/** `snap` (CRL-14, CRL-17, CRL-18). */
|
|
38
|
+
snap: boolean;
|
|
39
|
+
/** `loop` as set; it is in effect only with two or more items (CRL-27). */
|
|
40
|
+
loop: boolean;
|
|
41
|
+
/** N, the number of items. */
|
|
42
|
+
count: number;
|
|
43
|
+
}
|
|
44
|
+
/** One slot or item as drawn: its start (inner coordinates) and its width. */
|
|
45
|
+
export interface ItemBox {
|
|
46
|
+
start: number;
|
|
47
|
+
width: number;
|
|
48
|
+
}
|
|
49
|
+
/** An item as placed: its box and its slot position s (CRL-12, CRL-15, CRL-26). */
|
|
50
|
+
export interface PlacedItem extends ItemBox {
|
|
51
|
+
s: number;
|
|
52
|
+
/** CRL-12: false at or beyond an edge slot of a fluid row — the item is not drawn (its box has no width). */
|
|
53
|
+
drawn: boolean;
|
|
54
|
+
/** CRL-4: on its way between the last slot and an edge slot, where it is narrower than any slot. */
|
|
55
|
+
transit: boolean;
|
|
56
|
+
/** CRL-26: the scale it is drawn at — 1 unless `scaleOthers`, then down to min-scale by its distance from the hero slot. */
|
|
57
|
+
scale: number;
|
|
58
|
+
}
|
|
59
|
+
export declare class CarouselGeometry {
|
|
60
|
+
/** W, the inner width. */
|
|
61
|
+
readonly inner: number;
|
|
62
|
+
readonly padding: number;
|
|
63
|
+
readonly gap: number;
|
|
64
|
+
readonly count: number;
|
|
65
|
+
readonly center: boolean;
|
|
66
|
+
/** Whether the row is laid out with fluid widths: `fluidWidth`, unless the row is too narrow for side slots (CRL-9). */
|
|
67
|
+
readonly fluid: boolean;
|
|
68
|
+
/** `fluidWidth` as set (CRL-17, CRL-18 read the prop, not the fallback). */
|
|
69
|
+
readonly fluidSet: boolean;
|
|
70
|
+
readonly snap: boolean;
|
|
71
|
+
/** CRL-26: whether the others are scaled, and the least scale. */
|
|
72
|
+
readonly scaled: boolean;
|
|
73
|
+
readonly minScale: number;
|
|
74
|
+
/** Whether loop is in effect: set, and two or more items (CRL-27). */
|
|
75
|
+
readonly loop: boolean;
|
|
76
|
+
/** H, the hero slot's width, and the width every item's content is laid out at (CRL-9, CRL-15). */
|
|
77
|
+
readonly hero: number;
|
|
78
|
+
/** h, where the hero slot starts (CRL-11). */
|
|
79
|
+
readonly heroStart: number;
|
|
80
|
+
/** CRL-9: fluid widths whose cap is less than the greatest small width — laid out as fixed widths, H being W. */
|
|
81
|
+
readonly oneSlot: boolean;
|
|
82
|
+
/** CRL-10: the widths of the slots on a side where items follow the hero, going outward (empty for fixed widths). */
|
|
83
|
+
readonly side: readonly number[];
|
|
84
|
+
/** The slots after the hero, slot 0 first and the edge slot (no width, CRL-12) last (fluid widths). */
|
|
85
|
+
private readonly after;
|
|
86
|
+
/** The slots before the hero, slot 0 first and the edge slot (no width) last (fluid widths). */
|
|
87
|
+
private readonly before;
|
|
88
|
+
/** With fixed widths, the width of every slot but the hero's: H, or H × min-scale while the others are scaled (CRL-13, CRL-26). */
|
|
89
|
+
private readonly other;
|
|
90
|
+
/** The resting positions in order, while loop is not in effect (CRL-12, CRL-13). */
|
|
91
|
+
private readonly resting;
|
|
92
|
+
/** While loop is in effect: how many turns the track is long, and the first position of the middle one. */
|
|
93
|
+
readonly turns: number;
|
|
94
|
+
readonly middle: number;
|
|
95
|
+
constructor({ width, padding, gap: g, largeWidth: l, smallMin, smallMax, heroAlignment, fluid, scaleOthers, minScale, snap, loop, count }: CarouselMetrics);
|
|
96
|
+
/** How far the row scrolls for one position: the hero slot plus the gap (CRL-12). */
|
|
97
|
+
get step(): number;
|
|
98
|
+
/** The greatest p: the end of the range, or the end of a looping track. */
|
|
99
|
+
get maxPosition(): number;
|
|
100
|
+
/** The scroll range in px: the track is the carousel's width plus this. */
|
|
101
|
+
get range(): number;
|
|
102
|
+
/** D, the number of resting positions (CRL-12): N while loop is in effect. */
|
|
103
|
+
get restingCount(): number;
|
|
104
|
+
/**
|
|
105
|
+
* CRL-17, CRL-18: whether the resting item is the item at slot 0 and focus brings an item there — fluid widths, a
|
|
106
|
+
* centred hero or a row that snaps; otherwise (fixed widths at the start, free scroll) the first item wholly in view.
|
|
107
|
+
*/
|
|
108
|
+
get toSlot(): boolean;
|
|
109
|
+
/** The scroll position p for a scroll offset: within the range, and whole when it is within a hair of it. */
|
|
110
|
+
position(offset: number): number;
|
|
111
|
+
/** The scroll offset of a position. */
|
|
112
|
+
offset(position: number): number;
|
|
113
|
+
/** p as the ring sees it while loop is in effect (0 up to N), else p itself. */
|
|
114
|
+
logical(position: number): number;
|
|
115
|
+
/**
|
|
116
|
+
* CRL-12, CRL-27: item `index`'s slot position s at `position`: i − p, or, while loop is in effect, the one value that
|
|
117
|
+
* differs from it by a whole number of turns and lies above −N / 2 and at most N / 2 (centred) or above −1 and at
|
|
118
|
+
* most N − 1 (at the start).
|
|
119
|
+
*/
|
|
120
|
+
slotPosition(index: number, position: number): number;
|
|
121
|
+
/** Slot `k`'s box in a fluid row, k from the edge slot before the hero to the edge slot after it. */
|
|
122
|
+
private slot;
|
|
123
|
+
/**
|
|
124
|
+
* Slot `k`'s box in a row of fixed widths (CRL-13, CRL-26): the hero slot H wide at h, every other slot `other` wide —
|
|
125
|
+
* H, or H × min-scale while the others are scaled — each g beyond the drawn edge of the one before it going outward,
|
|
126
|
+
* without end.
|
|
127
|
+
*/
|
|
128
|
+
private fixedSlot;
|
|
129
|
+
/** CRL-26: the scale of an item at slot position `s`: 1 at the hero slot, min-scale a whole slot away and beyond. */
|
|
130
|
+
scale(s: number): number;
|
|
131
|
+
/**
|
|
132
|
+
* Item `index` at `position` (CRL-12, CRL-13, CRL-26): its start and width are the linear interpolation between those
|
|
133
|
+
* of the two slots around its slot position. With fluid widths an item at or beyond an edge slot is not drawn: its box
|
|
134
|
+
* is the edge slot's, of no width. With fixed widths the slots go on beyond the carousel's edges, where the items are
|
|
135
|
+
* clipped.
|
|
136
|
+
*/
|
|
137
|
+
item(index: number, position: number): PlacedItem;
|
|
138
|
+
/** CRL-17: the resting item — the item at slot 0, or the first item wholly in view (fixed widths at the start, free). */
|
|
139
|
+
restingIndex(position: number): number;
|
|
140
|
+
/**
|
|
141
|
+
* CRL-18: the position that brings item `index` into place — slot 0, or where the range ends first the resting
|
|
142
|
+
* position nearest it, the shorter way round while loop is in effect; or, for fixed widths at the start with free
|
|
143
|
+
* scroll, wholly between the inner edges with the least scroll.
|
|
144
|
+
*/
|
|
145
|
+
revealPosition(index: number, position: number): number;
|
|
146
|
+
/** The shortest signed distance around the ring equal to `delta` modulo N. */
|
|
147
|
+
private shorter;
|
|
148
|
+
/**
|
|
149
|
+
* CRL-14: where a row that snaps comes to rest from `position`: the next resting position in the direction of a fling
|
|
150
|
+
* (`direction` 1 toward the end, −1 toward the start), or else the nearest one.
|
|
151
|
+
*/
|
|
152
|
+
settlePosition(position: number, direction: -1 | 0 | 1): number;
|
|
153
|
+
/**
|
|
154
|
+
* CRL-29: the indicator's position q for `position` — between resting positions j and j + 1 it runs linearly from j
|
|
155
|
+
* to j + 1; while loop is in effect it is p less a whole number of turns, from 0 up to N.
|
|
156
|
+
*/
|
|
157
|
+
indicatorPosition(position: number): number;
|
|
158
|
+
/** CRL-29: how far q is from dot j, around the ring while loop is in effect. */
|
|
159
|
+
dotDistance(q: number, j: number): number;
|
|
160
|
+
/** CRL-31: the index of the resting position nearest `position` (a dot's index), 0 up to D − 1. */
|
|
161
|
+
nearestResting(position: number): number;
|
|
162
|
+
/**
|
|
163
|
+
* The position of resting position `j` (a dot): the resting position itself, or, while loop is in effect, the whole
|
|
164
|
+
* position of that ring value nearest `from` (the shorter way round).
|
|
165
|
+
*/
|
|
166
|
+
restingPosition(j: number, from?: number): number;
|
|
167
|
+
/**
|
|
168
|
+
* CRL-30, CRL-32: the resting position one step from `position`'s nearest (`direction` 1 or −1): beyond the ends it
|
|
169
|
+
* wraps while `wrap` is true — forward round the ring while loop is in effect, else to the other end — and otherwise
|
|
170
|
+
* stays at the end.
|
|
171
|
+
*/
|
|
172
|
+
stepResting(position: number, direction: 1 | -1, wrap: boolean): number;
|
|
173
|
+
/**
|
|
174
|
+
* CRL-27: while loop is in effect, the same place on the ring in the middle turn of the track, when `position` has
|
|
175
|
+
* come within a turn of either end; otherwise `position` itself. Moving by whole turns draws nothing new.
|
|
176
|
+
*/
|
|
177
|
+
recentre(position: number): number;
|
|
178
|
+
}
|