@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,748 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
3
|
+
import { AvailabilityController, FieldControlController, GlyphDrawnController, NativeTextController, OpenAxesController, hostAria, report, syncFocusStyle } from '../../primitives/index.js';
|
|
4
|
+
import { FloatingLabelController, floatingAsterisk, floatingLabel, triggerEdges } from '../../primitives/field-trigger.js';
|
|
5
|
+
import '../button/button.js';
|
|
6
|
+
import { formOf, pressDefaultButton } from '../../primitives/default-button.js';
|
|
7
|
+
import { takeFormDisabled } from '../../primitives/form-disabled.js';
|
|
8
|
+
import { FormSays } from '../../primitives/form-says.js';
|
|
9
|
+
import { browserMissingMessage } from '../../primitives/missing-value.js';
|
|
10
|
+
import { AXES, INSET, styles } from './color-input.styles.js';
|
|
11
|
+
import { PICKER_START, given, picked, read } from './color-text.js';
|
|
12
|
+
import { disabledWaitsWhileFocused } from '../../primitives/disabled-while-focused.js';
|
|
13
|
+
import { focusedAtFirst } from '../../primitives/autofocus.js';
|
|
14
|
+
/** The Button sizes every design system has: the picker button takes the input's size name where Button has it (CLI-27). */
|
|
15
|
+
const BUTTON_SIZES = new Set(['small', 'medium', 'large']);
|
|
16
|
+
const platformMessages = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* The browser's own words, in its language, for a constraint a form found unmet: a required control left empty, or a
|
|
19
|
+
* text that is not in the form asked for. They are the platform's words, read from a native input that is never
|
|
20
|
+
* drawn; the color input has none of its own.
|
|
21
|
+
*/
|
|
22
|
+
function platformMessage(kind) {
|
|
23
|
+
if (kind === 'missing')
|
|
24
|
+
return browserMissingMessage('text');
|
|
25
|
+
let message = platformMessages.get(kind);
|
|
26
|
+
if (message === undefined) {
|
|
27
|
+
const probe = document.createElement('input');
|
|
28
|
+
probe.pattern = '#[0-9a-f]{6}';
|
|
29
|
+
probe.value = '-';
|
|
30
|
+
message = probe.validationMessage;
|
|
31
|
+
platformMessages.set(kind, message);
|
|
32
|
+
}
|
|
33
|
+
return message;
|
|
34
|
+
}
|
|
35
|
+
/** Runs `task` once the document has been read: an element upgraded while its children are still being parsed has none yet. */
|
|
36
|
+
function whenParsed(task) {
|
|
37
|
+
if (document.readyState === 'loading')
|
|
38
|
+
document.addEventListener('DOMContentLoaded', task, { once: true });
|
|
39
|
+
else
|
|
40
|
+
task();
|
|
41
|
+
}
|
|
42
|
+
/** The element that has focus, through every shadow root. */
|
|
43
|
+
function deepActiveElement() {
|
|
44
|
+
let active = document.activeElement;
|
|
45
|
+
while (active?.shadowRoot?.activeElement)
|
|
46
|
+
active = active.shadowRoot.activeElement;
|
|
47
|
+
return active;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The box in which people set one color: a text value they can read, type and paste, a sample of it beside the text, a
|
|
51
|
+
* button that asks for a picker and — in the looks that float one — its label inside the box. It looks and measures
|
|
52
|
+
* like a text input. It has no label row, no help and no error text of its own: put it in a `<tanrei-field>`, which
|
|
53
|
+
* names it, describes it and marks it — or use `<tanrei-color-field>`, which is the two together.
|
|
54
|
+
*
|
|
55
|
+
* Contract: specs/color-input.spec.json. Every visual value is a token: the box is drawn from
|
|
56
|
+
* `--tanrei-comp-input-box-*`, the one set every input box is drawn from (CLI-45) — the swatch has the box's icon
|
|
57
|
+
* size — and the swatch's shape and hairline from `--tanrei-comp-color-input-*`; the swatch's fill is the value itself; the picker
|
|
58
|
+
* button is a `<tanrei-button>`, drawn from Button's own tokens.
|
|
59
|
+
*
|
|
60
|
+
* ```html
|
|
61
|
+
* <!-- A row of a list of colors that names each: the box alone, named by its own label. -->
|
|
62
|
+
* <tanrei-color-input label="Primary, tone 40" value="#0f766e" picker picker-label="Choose the color of Primary, tone 40"></tanrei-color-input>
|
|
63
|
+
*
|
|
64
|
+
* <tanrei-field label="Brand color" supporting-text="Six hexadecimal digits, like #0f766e.">
|
|
65
|
+
* <tanrei-color-input name="brand" value="#0f766e" invalid-text="Enter six hexadecimal digits, like #0f766e."></tanrei-color-input>
|
|
66
|
+
* </tanrei-field>
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* `value` is a number sign and six hexadecimal digits in lowercase (`#0f766e`) — an opaque sRGB color — or the empty
|
|
70
|
+
* string for no color, and never anything else. The text is the person's: nothing typed is refused, replaced or
|
|
71
|
+
* reformatted. It is read on every edit — six hexadecimal digits in either case, with or without the number sign, the
|
|
72
|
+
* white space around them left out — and `value` is the color it reads as, or empty. `input` fires when that changes
|
|
73
|
+
* `value`. When focus leaves or Enter is pressed the input commits: a color is rewritten in the value's own form and
|
|
74
|
+
* `change` fires if the value differs from the one last committed; a text that is not a color is kept, marked as an
|
|
75
|
+
* error and reported with `entryerror` — and to the Field that frames it, which shows `invalidText` (FLD-28).
|
|
76
|
+
*
|
|
77
|
+
* With `picker`, a button at the end asks for a picker: it fires a cancelable `pickerrequest` and, unless that was
|
|
78
|
+
* cancelled, presents the browser's own color picker. A pick is an edit by the person. The input draws no picker
|
|
79
|
+
* surface of its own: a product that has one cancels the request, presents it and sets `value`.
|
|
80
|
+
*
|
|
81
|
+
* Inside a `<tanrei-field>` it takes the Field's name, description and states — required, invalid, disabled — through
|
|
82
|
+
* the connection every framed control uses (`src/primitives/field.ts`), and says what only it knows: that it draws the
|
|
83
|
+
* label itself while its look floats one, how far its value's text is inset — past the swatch — and its own refusal
|
|
84
|
+
* of a text that is not a color, with its words (CLI-43). Bare, `label` names it, and a filled or outlined input
|
|
85
|
+
* draws that label floating.
|
|
86
|
+
*
|
|
87
|
+
* It is a block as wide as its place, and exactly as tall as its box (CLI-44). It is a form-associated element: it
|
|
88
|
+
* takes `name`, submits its value, resets to the `value` attribute, is restored on navigation, follows
|
|
89
|
+
* `<fieldset disabled>` and reports `valueMissing` while its Field says it is required and `value` is empty, and
|
|
90
|
+
* `badInput` while an entry error lasts.
|
|
91
|
+
*
|
|
92
|
+
* It has no words of its own: `invalidText`, `pickerLabel` and `label` are the product's, in the product's language.
|
|
93
|
+
*
|
|
94
|
+
* @tag tanrei-color-input
|
|
95
|
+
* @csspart container - The input's box.
|
|
96
|
+
* @csspart outline - A stacked color input's inner line, or an outlined one's border.
|
|
97
|
+
* @csspart active-indicator - The line along the bottom of a filled color input.
|
|
98
|
+
* @csspart label - The label that floats in a filled or an outlined color input.
|
|
99
|
+
* @csspart requirement-label - The required asterisk after a floating label.
|
|
100
|
+
* @csspart swatch - The sample of the value: a square filled with exactly the value's color. Decorative.
|
|
101
|
+
* @csspart input - The native `<input>`: the value as text.
|
|
102
|
+
* @csspart picker-button - The picker button, a `<tanrei-button>`.
|
|
103
|
+
* @attr {string} form - The id of the form the color input belongs to, where it stands outside it: the platform's own attribute, which then wins over a form around it. The `form` property is read-only and returns the form element.
|
|
104
|
+
* @fires input - The person changed the value: an edit of the text made it a color, another color or no color, or a color was picked in the browser's picker. `value` is already the new one. Composed and bubbling. Never fired when the product sets `value`, nor for an edit that leaves `value` as it was.
|
|
105
|
+
* @fires change - The person committed a changed value: focus left the input, Enter was pressed, or the browser's picker closed. `value` is already the new one. Composed and bubbling. Never fired when the product sets `value`.
|
|
106
|
+
* @fires {CustomEvent<TanreiColorInputPickerRequestDetail>} pickerrequest - The person activated the picker button. `detail.value` is the value. Cancelable: `preventDefault()` keeps the input from presenting the browser's picker; the product then presents its own surface and sets `value`. Composed and bubbling.
|
|
107
|
+
* @fires {CustomEvent<TanreiColorInputEntryErrorDetail>} entryerror - The person committed a text that is not empty and is not a color. `detail.text` is the text as typed, `detail.message` is `invalidText` — empty where the product gave none. Composed and bubbling.
|
|
108
|
+
*/
|
|
109
|
+
export class TanreiColorInput extends LitElement {
|
|
110
|
+
static { this.styles = styles; }
|
|
111
|
+
static { this.formAssociated = true; }
|
|
112
|
+
/**
|
|
113
|
+
* Its documented parts, once: what an element composed around it exports (src/primitives/composed.ts). Held equal to
|
|
114
|
+
* the `@csspart` lines above by src/primitives/composed.test.ts.
|
|
115
|
+
*
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
static { this.parts = ['container', 'outline', 'active-indicator', 'label', 'requirement-label', 'swatch', 'input', 'picker-button']; }
|
|
119
|
+
static { this.properties = {
|
|
120
|
+
variant: { type: String, reflect: true },
|
|
121
|
+
size: { type: String, reflect: true },
|
|
122
|
+
value: { type: String },
|
|
123
|
+
name: { type: String, reflect: true },
|
|
124
|
+
label: { type: String },
|
|
125
|
+
labelHidden: { type: Boolean, attribute: 'label-hidden', reflect: true },
|
|
126
|
+
error: { type: Boolean, reflect: true },
|
|
127
|
+
disabled: { type: Boolean, reflect: true },
|
|
128
|
+
invalidText: { type: String, attribute: 'invalid-text' },
|
|
129
|
+
picker: { type: Boolean, reflect: true },
|
|
130
|
+
pickerLabel: { type: String, attribute: 'picker-label' },
|
|
131
|
+
text: { state: true },
|
|
132
|
+
entryError: { state: true },
|
|
133
|
+
focused: { state: true },
|
|
134
|
+
formDisabled: { state: true },
|
|
135
|
+
}; }
|
|
136
|
+
/** The color the input holds: a number sign and six hexadecimal digits in lowercase (`#0f766e`), an opaque sRGB color; or empty for no color. It is never a half-typed text: while the input holds something that is not a color, `value` is empty. A text set in capitals or without its number sign is held in the value's own form; one that is not a color is treated as empty. The `value` attribute is also the value a form reset returns to. */
|
|
137
|
+
// An accessor, not a field: the value is the person's at every moment. The `input` of an edit is
|
|
138
|
+
// the browser's own event of the native text element — or of the browser's color input, for a pick — and is
|
|
139
|
+
// composed: a capturing listener on an ancestor hears it before the element's own listener has run. So what the
|
|
140
|
+
// person has just done to the native element and the element has not taken yet is read from that element, as the
|
|
141
|
+
// element is about to read it (CLI-18, CLI-29). `event.target.value` is then the new value in every listener, and
|
|
142
|
+
// in every listener of an element composed around this one.
|
|
143
|
+
get value() {
|
|
144
|
+
if (this.awaited || this.native.composing)
|
|
145
|
+
return this.held;
|
|
146
|
+
const text = this.nativeInput;
|
|
147
|
+
if (text && text.value !== this.nativeSeen) {
|
|
148
|
+
const reading = read(text.value);
|
|
149
|
+
return reading.kind === 'color' ? reading.value : '';
|
|
150
|
+
}
|
|
151
|
+
const well = this.picking ? this.nativePicker : null;
|
|
152
|
+
if (well && well.value !== this.pickSeen)
|
|
153
|
+
return picked(well.value) ?? this.held;
|
|
154
|
+
return this.held;
|
|
155
|
+
}
|
|
156
|
+
set value(value) {
|
|
157
|
+
this.held = value;
|
|
158
|
+
}
|
|
159
|
+
constructor() {
|
|
160
|
+
super();
|
|
161
|
+
this.availability = new AvailabilityController(this, 'color-input');
|
|
162
|
+
/** The look, as the text inputs beside it: `stacked` is a filled box that draws no label — the label of the Field that frames it stands above it; `filled` and `outlined` float the label inside the box. Use one style per form. A value the color input does not know by name is laid out as stacked. Reflected. */
|
|
163
|
+
this.variant = 'stacked';
|
|
164
|
+
/** The container's minimum height: `medium` or `large` (48 / 56 in the default system), the text input's two sizes. The hit area always meets the minimum target. Reflected. */
|
|
165
|
+
this.size = 'medium';
|
|
166
|
+
/** The value the element holds: what the product set, or the person's last edit or pick as the element took it. */
|
|
167
|
+
this.held = '';
|
|
168
|
+
/** The native text element, once drawn, and what it held when the element last wrote to it or took from it. */
|
|
169
|
+
this.nativeInput = null;
|
|
170
|
+
/** The name the value is submitted under in a form. Reflected. */
|
|
171
|
+
this.name = '';
|
|
172
|
+
/** Names the input for assistive technology where no Field frames it; a filled or outlined input also draws it, as the label that floats in its box. Inside a Field leave it empty: the Field's label names the input, and is what floats. */
|
|
173
|
+
this.label = '';
|
|
174
|
+
/** Does not draw the floating label of a filled or outlined input, which stays the accessible name (`label-hidden`). Inside a Field, hide the label on the Field. A stacked input draws no label, so this changes nothing there. */
|
|
175
|
+
this.labelHidden = false;
|
|
176
|
+
/** Draws the input in its error condition and exposes it as invalid. A Field sets it from its own error; set it here only where no Field frames the input. What a color means is the product's to validate; the input never sets this itself, and enters an error of its own only while the text it was left with is not a color. */
|
|
177
|
+
this.error = false;
|
|
178
|
+
/** Prevents focus, editing, the picker button and form submission. Inside a Field, disable the Field, so that its label follows. */
|
|
179
|
+
this.disabled = false;
|
|
180
|
+
/** The words for an input committed with a text that is not a color (`invalid-text`), in the product's language: given to the Field that frames the input, which shows them as its error text. While it is empty that Field shows its own `errorText`. Where no Field frames the input they are its description while the error lasts. */
|
|
181
|
+
this.invalidText = '';
|
|
182
|
+
/** Shows the picker button. Activated, it fires `pickerrequest` and, unless that was cancelled, presents the browser's own color picker. Reflected. */
|
|
183
|
+
this.picker = false;
|
|
184
|
+
/** The accessible name of the picker button, in the product's language (`picker-label`). Required while `picker` is set. */
|
|
185
|
+
this.pickerLabel = '';
|
|
186
|
+
/** The text in the input: the person's while they edit, the value in its own form otherwise (CLI-17, CLI-19). */
|
|
187
|
+
this.text = '';
|
|
188
|
+
/** CLI-20: the input was committed with a text that is not a color, and holds it still. */
|
|
189
|
+
this.entryError = false;
|
|
190
|
+
/** CLI-22: the input has focus, however it was gained. The picker button's focus is its own. */
|
|
191
|
+
this.focused = false;
|
|
192
|
+
/** Set by the platform (the element's `formDisabledCallback`): an ancestor `<fieldset disabled>`, or its own `disabled` attribute. */
|
|
193
|
+
this.formDisabled = false;
|
|
194
|
+
/** The value the color input made or took from the product last: another `value` is the product's (CLI-21). */
|
|
195
|
+
this.ownValue = '';
|
|
196
|
+
/** CLI-19: the value last committed — when the product set it, or at the last `change`. */
|
|
197
|
+
this.base = '';
|
|
198
|
+
/** CLI-19: the person changed the text since it was last committed or written. */
|
|
199
|
+
this.edited = false;
|
|
200
|
+
/** CLI-21: the product set a value while an input method was composing: its text is written when the composition ends, and is not the person's. */
|
|
201
|
+
this.awaited = false;
|
|
202
|
+
/** CLI-29: the browser's picker was presented and no sign of its closing has been seen yet. */
|
|
203
|
+
this.picking = false;
|
|
204
|
+
/** The Field's answer changed since the last update: the floating label may have other lines (CLI-15). */
|
|
205
|
+
this.frameChanged = false;
|
|
206
|
+
/** CLI-41: sizes and variants a design system adds, and a value the active system does not have (src/primitives/axes.ts). */
|
|
207
|
+
this.axes = new OpenAxesController(this, { component: 'color-input', behavior: 'CLI-41', axes: AXES });
|
|
208
|
+
/**
|
|
209
|
+
* CLI-43: the input's side of the exchange with the Field that frames it (src/primitives/field.ts). It takes the
|
|
210
|
+
* Field's name, description and states, whether the label is hidden and whether an asterisk follows it; and it says
|
|
211
|
+
* what only it knows — that it draws the label, how far its value's text is inset, its own refusal of an entry. It
|
|
212
|
+
* has an error condition of its own (CLI-9). No Field: it is drawn as a bare input.
|
|
213
|
+
*/
|
|
214
|
+
this.frame = new FieldControlController(this, {
|
|
215
|
+
errorCondition: true,
|
|
216
|
+
named: () => !!this.label.trim(),
|
|
217
|
+
says: () => this.saysToField,
|
|
218
|
+
changed: () => (this.frameChanged = true),
|
|
219
|
+
});
|
|
220
|
+
/** CLI-17, CLI-21: the text and the native element kept in step without breaking an input method (src/primitives/native-text.ts). */
|
|
221
|
+
this.native = new NativeTextController({
|
|
222
|
+
input: () => this.input,
|
|
223
|
+
value: () => this.text,
|
|
224
|
+
// What an input method is composing is not read (CLI-17): the text follows the element and nothing is said. A
|
|
225
|
+
// value the product set meanwhile is the text that waits for the composition's end (CLI-21).
|
|
226
|
+
setValue: (text) => {
|
|
227
|
+
if (text === this.text || this.awaited)
|
|
228
|
+
return;
|
|
229
|
+
this.text = text;
|
|
230
|
+
this.edited = true;
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
/** CLI-15: a floating label that does not fit on one line is given the room its lines take. */
|
|
234
|
+
this.floating = new FloatingLabelController(this);
|
|
235
|
+
/** A glyph the color input draws by name is drawn once the icon set can draw it; until then nothing stands in its place. */
|
|
236
|
+
this.glyphs = new GlyphDrawnController(this, () => this.renderRoot.querySelectorAll('.picker-glyph'));
|
|
237
|
+
/**
|
|
238
|
+
* Where a browser gives no sign that its picker closed (nothing was picked, or it tells no one), the next focus of
|
|
239
|
+
* the page counts as one: the window's, when a picker that is a window of its own goes, or any element's.
|
|
240
|
+
*/
|
|
241
|
+
this.onPageFocus = () => this.pickerClosed('page');
|
|
242
|
+
this.internals = this.attachInternals();
|
|
243
|
+
this.says = new FormSays(this, this.internals);
|
|
244
|
+
// A `<label for>` of the page activates the element itself: its input takes focus, and nothing changes.
|
|
245
|
+
this.addEventListener('click', (event) => {
|
|
246
|
+
if (event.composedPath()[0] === this)
|
|
247
|
+
this.focus();
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
get input() {
|
|
251
|
+
return this.renderRoot?.querySelector('.input') ?? null;
|
|
252
|
+
}
|
|
253
|
+
get nativePicker() {
|
|
254
|
+
return this.renderRoot?.querySelector('.native-picker') ?? null;
|
|
255
|
+
}
|
|
256
|
+
get pickerButton() {
|
|
257
|
+
return this.renderRoot?.querySelector('.picker-button') ?? null;
|
|
258
|
+
}
|
|
259
|
+
/** CLI-31: disabled by its own `disabled`, a fieldset's, or the Field's or the field group's around it. */
|
|
260
|
+
get inert_() {
|
|
261
|
+
return this.disabled || this.formDisabled || this.frame.disabled;
|
|
262
|
+
}
|
|
263
|
+
/** How the variant is laid out: filled and outlined by name, every other value as stacked (CLI-41). */
|
|
264
|
+
get layout() {
|
|
265
|
+
return this.variant === 'filled' || this.variant === 'outlined' ? this.variant : 'stacked';
|
|
266
|
+
}
|
|
267
|
+
/** CLI-11: the accessible name — its own label, else the label of the Field that frames it. */
|
|
268
|
+
get name_() {
|
|
269
|
+
return this.frame.name(this.label.trim() ? this.label : '');
|
|
270
|
+
}
|
|
271
|
+
/** CLI-11: its Field says it is required. It has no requirement of its own. */
|
|
272
|
+
get required_() {
|
|
273
|
+
return this.frame.required;
|
|
274
|
+
}
|
|
275
|
+
/** CLI-9: in error — its own `error`, its Field's, or an entry error while it lasts. */
|
|
276
|
+
get inError() {
|
|
277
|
+
return this.error || this.frame.invalid || this.entryError;
|
|
278
|
+
}
|
|
279
|
+
/** CLI-15: the label floats in the box — a filled or an outlined input with a name, unless its own `labelHidden` or its Field's says to draw none. */
|
|
280
|
+
get labelled() {
|
|
281
|
+
return this.layout !== 'stacked' && !!this.name_ && !this.labelHidden && !this.frame.labelHidden;
|
|
282
|
+
}
|
|
283
|
+
/** CLI-20: the words of an entry error while it lasts — `invalidText`; empty where the product gave none. */
|
|
284
|
+
get refusalText() {
|
|
285
|
+
return this.entryError ? this.invalidText : '';
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* CLI-43: what the input says to the Field that frames it. That it draws the label while its look floats one — its
|
|
289
|
+
* name, or nothing while the label is hidden; the Field draws no label row either way. How far the value's text
|
|
290
|
+
* stands from its start edge — past the padding beside the swatch, the swatch and the gap — and the text padding it
|
|
291
|
+
* keeps at its end edge, with or without the picker button, as lengths of the box's tokens (`INSET`, in the styles).
|
|
292
|
+
* And an entry error, with its words. No count: a color has one length.
|
|
293
|
+
*/
|
|
294
|
+
get saysToField() {
|
|
295
|
+
const size = /^[a-z0-9][a-z0-9-]*$/.test(this.size) ? this.size : 'medium';
|
|
296
|
+
return {
|
|
297
|
+
drawsLabel: this.layout !== 'stacked',
|
|
298
|
+
inset: INSET(size),
|
|
299
|
+
refusal: this.entryError ? { text: this.refusalText } : null,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* CLI-11, CLI-20: the input's description — the words of an entry error while no Field frames it (a Field shows
|
|
304
|
+
* them and gives them back as its own description, FLD-28), and then the description its Field gives.
|
|
305
|
+
*/
|
|
306
|
+
get described() {
|
|
307
|
+
return [this.frame.framed ? '' : this.refusalText, this.frame.description()].filter(Boolean).join(' ');
|
|
308
|
+
}
|
|
309
|
+
/** CLI-27: the Button size with the input's size name, or Button's default for a size Button does not have. */
|
|
310
|
+
get pickerSize() {
|
|
311
|
+
if (BUTTON_SIZES.has(this.size))
|
|
312
|
+
return this.size;
|
|
313
|
+
const own = /^[a-z0-9][a-z0-9-]*$/.test(this.size) && getComputedStyle(this).getPropertyValue(`--tanrei-comp-button-container-height-${this.size}`).trim();
|
|
314
|
+
return own ? this.size : 'medium';
|
|
315
|
+
}
|
|
316
|
+
/** The form it belongs to, if any. */
|
|
317
|
+
get form() {
|
|
318
|
+
return this.internals.form;
|
|
319
|
+
}
|
|
320
|
+
/** The native constraint validity: `valueMissing` while its Field says the color input is required and `value` is empty, `badInput` while it holds a committed text that is not a color. */
|
|
321
|
+
get validity() {
|
|
322
|
+
return this.internals.validity;
|
|
323
|
+
}
|
|
324
|
+
get validationMessage() {
|
|
325
|
+
return this.internals.validationMessage;
|
|
326
|
+
}
|
|
327
|
+
get willValidate() {
|
|
328
|
+
return this.internals.willValidate;
|
|
329
|
+
}
|
|
330
|
+
checkValidity() {
|
|
331
|
+
return this.internals.checkValidity();
|
|
332
|
+
}
|
|
333
|
+
reportValidity() {
|
|
334
|
+
return this.internals.reportValidity();
|
|
335
|
+
}
|
|
336
|
+
/** Moves focus to the input — never to the picker button. */
|
|
337
|
+
focus(options) {
|
|
338
|
+
this.input?.focus(options);
|
|
339
|
+
}
|
|
340
|
+
blur() {
|
|
341
|
+
this.input?.blur();
|
|
342
|
+
}
|
|
343
|
+
/** Selects the text in the input. */
|
|
344
|
+
select() {
|
|
345
|
+
this.input?.select();
|
|
346
|
+
}
|
|
347
|
+
formResetCallback() {
|
|
348
|
+
const { value } = given(this.getAttribute('value'));
|
|
349
|
+
this.value = value;
|
|
350
|
+
// The same value as the one held is still a new one: the text and an entry error go.
|
|
351
|
+
this.took(value);
|
|
352
|
+
this.requestUpdate();
|
|
353
|
+
}
|
|
354
|
+
formStateRestoreCallback(state) {
|
|
355
|
+
const value = typeof state === 'string' ? given(state).value : '';
|
|
356
|
+
this.value = value;
|
|
357
|
+
this.took(value);
|
|
358
|
+
this.requestUpdate();
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The platform's word on whether the element is disabled: by a `<fieldset disabled>` around it, and by its own
|
|
362
|
+
* `disabled` attribute too. Lit writes that attribute in the middle of an update, where a change of state would not
|
|
363
|
+
* be drawn: it is taken once that update is over, so an input whose `disabled` was unset is drawn enabled again.
|
|
364
|
+
*/
|
|
365
|
+
formDisabledCallback(disabled) {
|
|
366
|
+
takeFormDisabled(this, disabled, (value) => (this.formDisabled = value));
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* The form's view: the value — a color in its own form, or the empty string — left out while disabled (CLI-31); a
|
|
370
|
+
* missing value while its Field says it is required (CLI-11), and a bad input while an entry error lasts (CLI-20).
|
|
371
|
+
* Said when the color input is drawn, and at once when its value changes: a listener of `input` or `change`, and the
|
|
372
|
+
* form Enter submits, already see the new value. The message of an entry error is `invalidText`, else what its Field
|
|
373
|
+
* shows for it, else the browser's own words; of a missing value, the browser's own words. Said through `FormSays`,
|
|
374
|
+
* so that an element composed around the input repeats it (src/primitives/form-says.ts).
|
|
375
|
+
*/
|
|
376
|
+
syncForm() {
|
|
377
|
+
this.says.value(this.inert_ ? null : this.ownValue, this.ownValue);
|
|
378
|
+
const missing = this.required_ && this.ownValue === '';
|
|
379
|
+
if ((this.entryError || missing) && !this.inert_) {
|
|
380
|
+
const message = (this.entryError ? this.refusalText || this.frame.description() || platformMessage('format') : '') || platformMessage('missing') || this.frame.state?.requiredText || this.name_ || '#rrggbb';
|
|
381
|
+
this.says.validity({ badInput: this.entryError, valueMissing: missing }, message, this.input ?? undefined);
|
|
382
|
+
}
|
|
383
|
+
else
|
|
384
|
+
this.says.validity();
|
|
385
|
+
}
|
|
386
|
+
// ── CLI-16 … CLI-21: the text and the value ───────────────────────────────────────────────────────────────────
|
|
387
|
+
/** CLI-21: the product gave a value: it is shown in the input and the swatch, an entry error ends, and nothing is said. */
|
|
388
|
+
took(value) {
|
|
389
|
+
this.ownValue = value;
|
|
390
|
+
this.base = value;
|
|
391
|
+
this.edited = false;
|
|
392
|
+
this.entryError = false;
|
|
393
|
+
this.text = value;
|
|
394
|
+
this.awaited = this.native.composing;
|
|
395
|
+
}
|
|
396
|
+
/** The color input makes `value` the value itself, and the form sees it at once. */
|
|
397
|
+
keep(value) {
|
|
398
|
+
this.value = value;
|
|
399
|
+
this.ownValue = value;
|
|
400
|
+
this.syncForm();
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* CLI-17, CLI-29: `input`, once, when an edit or a pick changed the value; `value` is already the new one. The event
|
|
404
|
+
* is the browser's own, of the native element the person edited or picked in, where that event leaves the shadow
|
|
405
|
+
* root by itself — it is composed and bubbles, and outside its target is this element. It is then left to pass, and
|
|
406
|
+
* nothing is dispatched in its place: a second event would be heard twice by a capturing listener on an ancestor.
|
|
407
|
+
* Where it would not leave — a pick taken as the picker closes, from its `change` — the element dispatches one.
|
|
408
|
+
*/
|
|
409
|
+
said(native) {
|
|
410
|
+
if (native.type === 'input' && native.bubbles && native.composed)
|
|
411
|
+
return;
|
|
412
|
+
native.stopPropagation();
|
|
413
|
+
this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
|
414
|
+
}
|
|
415
|
+
/** CLI-19, CLI-29: `change`, once, while the value differs from the one last committed. `value` is already the new one. */
|
|
416
|
+
changed() {
|
|
417
|
+
if (this.ownValue === this.base)
|
|
418
|
+
return;
|
|
419
|
+
this.base = this.ownValue;
|
|
420
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* CLI-17, CLI-18, CLI-20: the person changed the text. Nothing is rewritten: the text is theirs. The whole text is
|
|
424
|
+
* read, and `value` becomes the color it reads as, or empty. An entry error ends with the edit. Returns whether the
|
|
425
|
+
* edit changed `value`: `input` is heard for such an edit, and for no other.
|
|
426
|
+
*/
|
|
427
|
+
typed(text) {
|
|
428
|
+
this.nativeSeen = this.nativeInput?.value;
|
|
429
|
+
if (this.awaited) {
|
|
430
|
+
// The composition ended on the product's value: it is shown, and nothing is said.
|
|
431
|
+
this.awaited = false;
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
this.text = text;
|
|
435
|
+
this.edited = true;
|
|
436
|
+
this.entryError = false;
|
|
437
|
+
const reading = read(text);
|
|
438
|
+
const value = reading.kind === 'color' ? reading.value : '';
|
|
439
|
+
if (value === this.ownValue) {
|
|
440
|
+
this.syncForm();
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
this.keep(value);
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
onInput(event) {
|
|
447
|
+
// CLI-17: a composition is left to the native element; the text is read when it ends, and nothing is said meanwhile.
|
|
448
|
+
// An edit that leaves `value` as it was says nothing either: the native element's own `input` stops here, at the
|
|
449
|
+
// shadow root. The `input` of an edit that changed `value` is the color input's (`said()`).
|
|
450
|
+
if (this.native.composingInput(event) || !this.typed(event.target.value))
|
|
451
|
+
event.stopPropagation();
|
|
452
|
+
else
|
|
453
|
+
this.said(event);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* CLI-19, CLI-20: commits the text. A color is rewritten in the value's own form — the number sign added, the digits
|
|
457
|
+
* in lowercase, the white space gone; a text of white space alone is no color and is cleared; a text that is not
|
|
458
|
+
* empty and not a color is kept as typed and enters the entry error (`entryerror`, with `invalidText`). Then
|
|
459
|
+
* `change`, once, while the value differs from the one last committed. A text the person did not change since the
|
|
460
|
+
* last commit commits nothing.
|
|
461
|
+
*/
|
|
462
|
+
commit() {
|
|
463
|
+
if (!this.edited || this.inert_)
|
|
464
|
+
return;
|
|
465
|
+
this.edited = false;
|
|
466
|
+
const reading = read(this.text);
|
|
467
|
+
if (reading.kind === 'invalid') {
|
|
468
|
+
this.entryError = true;
|
|
469
|
+
this.syncForm();
|
|
470
|
+
this.dispatchEvent(new CustomEvent('entryerror', { bubbles: true, composed: true, detail: { text: this.text, message: this.invalidText } }));
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
this.entryError = false;
|
|
474
|
+
this.text = reading.kind === 'color' ? reading.value : '';
|
|
475
|
+
this.syncForm();
|
|
476
|
+
}
|
|
477
|
+
this.changed();
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* CLI-19: the action key commits and, inside a form, then asks for its submission, as a native input does — its own
|
|
481
|
+
* form, or the form of the element composed around it (src/primitives/default-button.ts, `formOf`). While an input
|
|
482
|
+
* method composes, every key is its own (CLI-17).
|
|
483
|
+
*/
|
|
484
|
+
onKeyDown(event) {
|
|
485
|
+
if (event.defaultPrevented || this.inert_)
|
|
486
|
+
return;
|
|
487
|
+
if (event.isComposing || this.native.composing || event.keyCode === 229)
|
|
488
|
+
return;
|
|
489
|
+
if (event.key !== 'Enter')
|
|
490
|
+
return;
|
|
491
|
+
this.commit();
|
|
492
|
+
const form = formOf(this, this.form);
|
|
493
|
+
if (form) {
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
pressDefaultButton(form);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
onFocus() {
|
|
499
|
+
this.focused = true;
|
|
500
|
+
// CLI-23: where style queries are missing, the focus style is read when focus arrives.
|
|
501
|
+
syncFocusStyle(this, this.renderRoot.querySelector('.field'));
|
|
502
|
+
}
|
|
503
|
+
/** CLI-19: the input lost focus: the text is committed. */
|
|
504
|
+
onBlur() {
|
|
505
|
+
this.focused = false;
|
|
506
|
+
this.commit();
|
|
507
|
+
}
|
|
508
|
+
// ── CLI-27 … CLI-29: the picker ───────────────────────────────────────────────────────────────────────────────
|
|
509
|
+
/**
|
|
510
|
+
* CLI-28: the picker button asks for a picker — `pickerrequest`, once, with the value — and then, unless the product
|
|
511
|
+
* cancelled the request, presents the browser's own color picker showing the value, or black while the input holds
|
|
512
|
+
* none, inside the same user activation. Where the browser has none to present, nothing is presented, nothing
|
|
513
|
+
* changes and no focus moves.
|
|
514
|
+
*/
|
|
515
|
+
onPickerClick() {
|
|
516
|
+
if (this.inert_)
|
|
517
|
+
return;
|
|
518
|
+
const request = new CustomEvent('pickerrequest', { bubbles: true, composed: true, cancelable: true, detail: { value: this.ownValue } });
|
|
519
|
+
if (!this.dispatchEvent(request))
|
|
520
|
+
return;
|
|
521
|
+
const native = this.nativePicker;
|
|
522
|
+
if (!native)
|
|
523
|
+
return;
|
|
524
|
+
native.value = this.ownValue || PICKER_START;
|
|
525
|
+
this.pickSeen = native.value;
|
|
526
|
+
try {
|
|
527
|
+
if (typeof native.showPicker === 'function')
|
|
528
|
+
native.showPicker();
|
|
529
|
+
else
|
|
530
|
+
native.click();
|
|
531
|
+
}
|
|
532
|
+
catch {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
this.picking = true;
|
|
536
|
+
window.addEventListener('focus', this.onPageFocus);
|
|
537
|
+
document.addEventListener('focusin', this.onPageFocus, true);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* CLI-29: a pick in the browser's picker is an edit by the person: the color is written into the input in the value's
|
|
541
|
+
* own form, the swatch drawn in it, an entry error ended, and `input` fired when it changed the value — for every
|
|
542
|
+
* pick the browser reports, a drag across the picker included.
|
|
543
|
+
*/
|
|
544
|
+
onPick(event) {
|
|
545
|
+
const well = event.target;
|
|
546
|
+
const value = this.inert_ ? null : picked(well.value);
|
|
547
|
+
this.pickSeen = well.value;
|
|
548
|
+
// A report that is no pick, or a pick of the value it holds already, says nothing: the browser's event stops here.
|
|
549
|
+
if (value === null || value === this.ownValue)
|
|
550
|
+
event.stopPropagation();
|
|
551
|
+
if (value === null)
|
|
552
|
+
return;
|
|
553
|
+
this.text = value;
|
|
554
|
+
this.edited = false;
|
|
555
|
+
this.entryError = false;
|
|
556
|
+
if (value === this.ownValue) {
|
|
557
|
+
this.syncForm();
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
this.keep(value);
|
|
561
|
+
this.said(event);
|
|
562
|
+
}
|
|
563
|
+
/** CLI-29: the browser's picker closed: its `change`, or — where a browser gives none — the page's next focus. */
|
|
564
|
+
onPickerChange(event) {
|
|
565
|
+
// A browser that reports a pick only when its picker closes: the pick is taken first. The browser's own `change`
|
|
566
|
+
// stops here: the color input's is fired by `pickerClosed`, while the value differs from the one last committed.
|
|
567
|
+
this.onPick(event);
|
|
568
|
+
event.stopPropagation();
|
|
569
|
+
this.pickerClosed('picker');
|
|
570
|
+
}
|
|
571
|
+
unwatchPage() {
|
|
572
|
+
window.removeEventListener('focus', this.onPageFocus);
|
|
573
|
+
document.removeEventListener('focusin', this.onPageFocus, true);
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* CLI-29: when the picker closes, `change` once while the value differs from the one last committed, and focus on
|
|
577
|
+
* the picker button, as a popover returns focus to its opener. Focus is never taken from where the person has put it
|
|
578
|
+
* since: the button takes it only while nothing else in the page has it, or what has it is this input's own native
|
|
579
|
+
* picker.
|
|
580
|
+
*/
|
|
581
|
+
pickerClosed(signal) {
|
|
582
|
+
if (signal === 'page' && !this.picking)
|
|
583
|
+
return;
|
|
584
|
+
this.picking = false;
|
|
585
|
+
this.unwatchPage();
|
|
586
|
+
if (!this.isConnected)
|
|
587
|
+
return;
|
|
588
|
+
this.changed();
|
|
589
|
+
const active = deepActiveElement();
|
|
590
|
+
const nowhere = !active || active === document.body || active === document.documentElement;
|
|
591
|
+
const mine = !!active && (active === this.nativePicker || active === this);
|
|
592
|
+
if (nowhere || mine)
|
|
593
|
+
this.pickerButton?.focus();
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* CLI-24: a press on the container's padding, on the swatch or on a floating label moves focus to the input and does
|
|
597
|
+
* nothing else. A press in the input places the caret; the picker button keeps its own press.
|
|
598
|
+
*/
|
|
599
|
+
onContainerPress(event) {
|
|
600
|
+
if (event.button !== 0)
|
|
601
|
+
return;
|
|
602
|
+
const target = event.target;
|
|
603
|
+
if (target.closest('.input, .picker'))
|
|
604
|
+
return;
|
|
605
|
+
event.preventDefault();
|
|
606
|
+
if (!this.inert_)
|
|
607
|
+
this.focus();
|
|
608
|
+
}
|
|
609
|
+
disconnectedCallback() {
|
|
610
|
+
super.disconnectedCallback();
|
|
611
|
+
this.unwatchPage();
|
|
612
|
+
this.picking = false;
|
|
613
|
+
this.focused = false;
|
|
614
|
+
}
|
|
615
|
+
willUpdate(changed) {
|
|
616
|
+
if (this.inert_)
|
|
617
|
+
this.focused = false;
|
|
618
|
+
// CLI-21: a value the product set is held in the value's own form, shown in the input and the swatch, ends an entry
|
|
619
|
+
// error and says nothing. One that is what the value already is leaves the text as the person typed it.
|
|
620
|
+
if (changed.has('value')) {
|
|
621
|
+
const set = this.held;
|
|
622
|
+
const { value, valid } = given(set);
|
|
623
|
+
if (!valid)
|
|
624
|
+
whenParsed(() => report(this, 'CLI-21', `value "${String(set)}" is not a color (a number sign and six hexadecimal digits, like #0f766e); it is treated as empty`, { once: false }));
|
|
625
|
+
if (set !== value)
|
|
626
|
+
this.value = value;
|
|
627
|
+
if (value !== this.ownValue)
|
|
628
|
+
this.took(value);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
updated(changed) {
|
|
632
|
+
// CLI-17, CLI-21: the text is shown in the element — never into a composition.
|
|
633
|
+
this.native.show();
|
|
634
|
+
// What the native element holds now is what the element gave it, or took from it (see `value`).
|
|
635
|
+
this.nativeInput = this.input;
|
|
636
|
+
this.nativeSeen = this.nativeInput?.value;
|
|
637
|
+
// CLI-15: the label's lines follow its text — its own, or the name its Field gives —, the asterisk, the look, the size and the picker button.
|
|
638
|
+
if (this.frameChanged || changed.has('label') || changed.has('labelHidden') || changed.has('variant') || changed.has('size') || changed.has('picker'))
|
|
639
|
+
this.floating.measure();
|
|
640
|
+
this.frameChanged = false;
|
|
641
|
+
// CLI-27: the picker button says it opens a dialog, on the native button that carries its semantics.
|
|
642
|
+
const button = this.pickerButton;
|
|
643
|
+
if (button) {
|
|
644
|
+
void button.updateComplete?.then(() => {
|
|
645
|
+
const native = button.shadowRoot?.querySelector('button');
|
|
646
|
+
if (native)
|
|
647
|
+
hostAria(native, { 'aria-haspopup': 'dialog' });
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
this.syncForm();
|
|
651
|
+
whenParsed(() => this.reports());
|
|
652
|
+
}
|
|
653
|
+
/** What a debug build tells the developer; the color input still renders. */
|
|
654
|
+
reports() {
|
|
655
|
+
if (!this.isConnected)
|
|
656
|
+
return;
|
|
657
|
+
// CLI-11: an input no Field names, with no label of its own, still renders. (A Field with an empty label says so itself: FLD-10.)
|
|
658
|
+
if (!this.label.trim() && !this.frame.state)
|
|
659
|
+
report(this, 'CLI-11', 'label is empty and no field frames it, so the color input has no accessible name; put it in a field with a label, or give it a label');
|
|
660
|
+
if (this.picker && !this.pickerLabel.trim())
|
|
661
|
+
report(this, 'CLI-27', 'pickerLabel is empty, so the picker button has no accessible name; give it one in the product’s language');
|
|
662
|
+
// CLI-20: framed, the Field reports a refusal it has no words for (FLD-28).
|
|
663
|
+
if (this.entryError && !this.invalidText && !this.frame.framed)
|
|
664
|
+
report(this, 'CLI-20', 'the text is not a color and invalidText does not say so; give the color input an invalidText that says the form the value takes');
|
|
665
|
+
}
|
|
666
|
+
render() {
|
|
667
|
+
const layout = this.layout;
|
|
668
|
+
const stacked = layout === 'stacked';
|
|
669
|
+
const inert = this.inert_;
|
|
670
|
+
const name = this.name_;
|
|
671
|
+
const described = this.described;
|
|
672
|
+
const wrong = this.inError;
|
|
673
|
+
const floating = this.labelled;
|
|
674
|
+
// CLI-7: the asterisk follows a floating label while the Field says so (FLD-25); never outside a Field.
|
|
675
|
+
const asterisk = floating && this.frame.requiredMark === 'asterisk' ? floatingAsterisk('asterisk') : nothing;
|
|
676
|
+
// CLI-11, CLI-30: the input is a text box named by its own label or its Field's — drawn or not — whose value is the
|
|
677
|
+
// text it shows, described by what its Field gives. It names itself (`aria-label`): a name taken from a text that
|
|
678
|
+
// is not drawn is no name to a checker. The description is a hidden element of this shadow root: an id cannot
|
|
679
|
+
// cross to the Field's rows. The floating label, the glyph and the swatch are kept from assistive technology: the
|
|
680
|
+
// name and the value's text say them.
|
|
681
|
+
return html `
|
|
682
|
+
<div
|
|
683
|
+
class="field"
|
|
684
|
+
data-layout=${layout}
|
|
685
|
+
?data-error=${wrong}
|
|
686
|
+
?data-disabled=${inert}
|
|
687
|
+
?data-focused=${this.focused && !inert}
|
|
688
|
+
?data-labelled=${floating}
|
|
689
|
+
?data-has-value=${this.text !== ''}
|
|
690
|
+
?data-picker=${this.picker}
|
|
691
|
+
>
|
|
692
|
+
<div part="container" class="container" data-tanrei-shape aria-disabled=${inert ? 'true' : nothing} @mousedown=${this.onContainerPress}>
|
|
693
|
+
<span part="swatch" class="swatch" data-tanrei-shape aria-hidden="true" ?data-filled=${this.ownValue !== ''} style=${styleMap({ '--_value': this.ownValue || null })}></span>
|
|
694
|
+
<div class="body">
|
|
695
|
+
<input
|
|
696
|
+
id="input"
|
|
697
|
+
part="input"
|
|
698
|
+
class="input"
|
|
699
|
+
type="text"
|
|
700
|
+
inputmode="text"
|
|
701
|
+
autocomplete="off"
|
|
702
|
+
autocapitalize="none"
|
|
703
|
+
autocorrect="off"
|
|
704
|
+
spellcheck="false"
|
|
705
|
+
dir="ltr"
|
|
706
|
+
?disabled=${inert}
|
|
707
|
+
aria-label=${name || nothing}
|
|
708
|
+
aria-describedby=${described ? 'description' : nothing}
|
|
709
|
+
aria-invalid=${wrong ? 'true' : nothing}
|
|
710
|
+
aria-required=${this.required_ ? 'true' : nothing}
|
|
711
|
+
@input=${this.onInput}
|
|
712
|
+
@keydown=${this.onKeyDown}
|
|
713
|
+
@focus=${this.onFocus}
|
|
714
|
+
@blur=${this.onBlur}
|
|
715
|
+
@compositionstart=${this.native.onCompositionStart}
|
|
716
|
+
@compositionend=${this.native.onCompositionEnd}
|
|
717
|
+
/>
|
|
718
|
+
</div>
|
|
719
|
+
${this.picker
|
|
720
|
+
? html `<span class="picker"
|
|
721
|
+
><input
|
|
722
|
+
class="native-picker"
|
|
723
|
+
type="color"
|
|
724
|
+
tabindex="-1"
|
|
725
|
+
aria-hidden="true"
|
|
726
|
+
?disabled=${inert}
|
|
727
|
+
@input=${this.onPick}
|
|
728
|
+
@change=${this.onPickerChange}
|
|
729
|
+
@click=${(event) => event.stopPropagation()}
|
|
730
|
+
/><tanrei-button part="picker-button" class="picker-button" variant="text" size=${this.pickerSize} label=${this.pickerLabel} ?disabled=${inert} @click=${this.onPickerClick}
|
|
731
|
+
><span slot="icon" class="picker-glyph"><span class="ink">palette</span></span></tanrei-button
|
|
732
|
+
></span
|
|
733
|
+
>`
|
|
734
|
+
: nothing}
|
|
735
|
+
${floatingLabel({ floating, label: name, asterisk })} ${triggerEdges({ stacked, floating, label: name, asterisk })}
|
|
736
|
+
</div>
|
|
737
|
+
${described ? html `<span id="description" hidden>${described}</span>` : nothing}
|
|
738
|
+
</div>
|
|
739
|
+
`;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
// Its `disabled` attribute, written while it holds focus, waits until focus has left: a frame at most.
|
|
743
|
+
disabledWaitsWhileFocused(TanreiColorInput);
|
|
744
|
+
// `autofocus` on it gives it focus when the page first loads too (src/primitives/autofocus.ts).
|
|
745
|
+
focusedAtFirst(TanreiColorInput);
|
|
746
|
+
if (!customElements.get('tanrei-color-input'))
|
|
747
|
+
customElements.define('tanrei-color-input', TanreiColorInput);
|
|
748
|
+
//# sourceMappingURL=color-input.js.map
|