@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,710 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { AvailabilityController, FieldControlController, report, syncFocusStyle } from '../../primitives/index.js';
|
|
3
|
+
import { formOf, pressDefaultButton } from '../../primitives/default-button.js';
|
|
4
|
+
import { FormSays } from '../../primitives/form-says.js';
|
|
5
|
+
import { takeFormDisabled } from '../../primitives/form-disabled.js';
|
|
6
|
+
import { missingValueMessage } from '../../primitives/missing-value.js';
|
|
7
|
+
import { furthest, readCharacter, readCode, readPermitted, readValue, removeBackward, removeForward, removeRun, replaceAll, settle, typeCharacter, typeText } from './code-text.js';
|
|
8
|
+
import { styles } from './one-time-code-input.styles.js';
|
|
9
|
+
import { disabledWaitsWhileFocused } from '../../primitives/disabled-while-focused.js';
|
|
10
|
+
import { focusedAtFirst } from '../../primitives/autofocus.js';
|
|
11
|
+
const TYPES = ['numeric', 'alphanumeric'];
|
|
12
|
+
const DEFAULT_LENGTH = 6;
|
|
13
|
+
/** OTC-16: the mark a browser's own password field draws for a character. A mark, not a word. */
|
|
14
|
+
const MASK = '•';
|
|
15
|
+
/** The kinds of native input that put text in (the rest remove it, or are an input method's). */
|
|
16
|
+
const INSERTS_WHOLE = new Set(['insertReplacementText', 'insertFromPaste', 'insertFromPasteAsQuotation', 'insertFromDrop', 'insertFromYank']);
|
|
17
|
+
const REMOVES_BACKWARD_RUN = new Set(['deleteWordBackward', 'deleteSoftLineBackward', 'deleteHardLineBackward', 'deleteEntireSoftLine']);
|
|
18
|
+
const REMOVES_FORWARD_RUN = new Set(['deleteWordForward', 'deleteSoftLineForward', 'deleteHardLineForward']);
|
|
19
|
+
/** What an input method does to its own composing text: never stopped, never read as the person's edit (OTC-6). */
|
|
20
|
+
const COMPOSITION = new Set(['insertCompositionText', 'insertFromComposition', 'deleteCompositionText', 'deleteByComposition']);
|
|
21
|
+
/**
|
|
22
|
+
* Takes a short code sent to the person — a sign-in or verification code — as one text value drawn in separate cells,
|
|
23
|
+
* so that its length and what is still missing can be seen, and the browser can fill it in one step.
|
|
24
|
+
*
|
|
25
|
+
* Contract: specs/one-time-code-input.spec.json. Every visual value is a `--tanrei-comp-one-time-code-input-*` token.
|
|
26
|
+
*
|
|
27
|
+
* One field, not one input per character: in the shadow root there is exactly one native `<input>`, laid over the row,
|
|
28
|
+
* whose own text and caret are not drawn; the cells, the caret and the group marks under it are a drawing of its value
|
|
29
|
+
* and are hidden from assistive technology. So it is one Tab stop and one text box whose value is the whole code, and
|
|
30
|
+
* an input method, the browser's autofill (`autocomplete="one-time-code"`), the clipboard and dictation meet one text
|
|
31
|
+
* input. It has no `maxlength` and no `pattern`: a code pasted as "123 456" would be cut before it could be read.
|
|
32
|
+
*
|
|
33
|
+
* It has no label, help or error text of its own: put it in a `<tanrei-field>`, which names it, describes it, marks it
|
|
34
|
+
* required and puts it in its error condition; where the visible label is elsewhere (a dialog's headline), give
|
|
35
|
+
* `label`, which is never drawn. `<tanrei-field label="Verification code"><tanrei-one-time-code-input name="code"
|
|
36
|
+
* group-size="3"></tanrei-one-time-code-input></tanrei-field>`.
|
|
37
|
+
*
|
|
38
|
+
* A permitted character fills the active cell — replacing what it holds — and moves on; other characters are dropped.
|
|
39
|
+
* Text that is pasted, dropped or filled is read whole as one code ("123 456", "123-456", "Your code is 123456.").
|
|
40
|
+
* `input` fires on every change by the person, `complete` once after the `input` that leaves the value `length` long,
|
|
41
|
+
* `change` when a changed value is committed (focus leaves, or Enter), `action` on Enter. Nothing else happens when the
|
|
42
|
+
* code is complete: checking it is the product's.
|
|
43
|
+
*
|
|
44
|
+
* Form-associated: it submits the code under `name`, resets to its `value` attribute, is restored on navigation,
|
|
45
|
+
* follows a disabled `<fieldset>`, and reports a missing value while its Field says it is required and it is empty.
|
|
46
|
+
*
|
|
47
|
+
* @tag tanrei-one-time-code-input
|
|
48
|
+
* @csspart input - The one native text element, laid over the row. Its text is not drawn.
|
|
49
|
+
* @csspart cell - One box per character of the code.
|
|
50
|
+
* @csspart character - The character a filled cell holds, or the mark in its place while `mask` is set.
|
|
51
|
+
* @csspart caret - The caret of an empty active cell.
|
|
52
|
+
* @csspart separator - The mark between two groups of cells.
|
|
53
|
+
* @attr {string} form - The id of the form the one-time-code 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.
|
|
54
|
+
* @fires {CustomEvent<TanreiOneTimeCodeInputDetail>} input - The person changed the value; the element's `value` is already the new one.
|
|
55
|
+
* @fires {CustomEvent<TanreiOneTimeCodeInputDetail>} change - The person committed a changed value: focus left the field, or Enter was pressed.
|
|
56
|
+
* @fires {CustomEvent<TanreiOneTimeCodeInputDetail>} complete - A change by the person left the value `length` characters long. After that change's input, once.
|
|
57
|
+
* @fires {CustomEvent<TanreiOneTimeCodeInputDetail>} action - The person pressed Enter. Cancel it to keep the enclosing form from being submitted.
|
|
58
|
+
*/
|
|
59
|
+
export class TanreiOneTimeCodeInput extends LitElement {
|
|
60
|
+
constructor() {
|
|
61
|
+
super(...arguments);
|
|
62
|
+
this.availability = new AvailabilityController(this, 'one-time-code-input');
|
|
63
|
+
/** The code entered so far: at most `length` characters, digits or — for `alphanumeric` — digits and upper-case letters, with no separator. The `value` attribute is what a form reset returns to. */
|
|
64
|
+
this.value = '';
|
|
65
|
+
/** How many characters the code has, and so how many cells are drawn. A whole number of 1 or more; anything else draws 6. */
|
|
66
|
+
this.length = DEFAULT_LENGTH;
|
|
67
|
+
/** What a cell takes: `numeric` (the default; a numeric keypad) or `alphanumeric` (digits and A to Z, held in upper case; a general keyboard). Anything else behaves as numeric. */
|
|
68
|
+
this.type = 'numeric';
|
|
69
|
+
/** Draws the cells in groups of this many, with a mark between two groups (`group-size`; 3 for a code written "123 456"). 0 draws one group. The value has no separator. */
|
|
70
|
+
this.groupSize = 0;
|
|
71
|
+
/** Draws the browser's password mark in each filled cell in place of its character, and exposes the field as a password field. Paste and autofill still work. */
|
|
72
|
+
this.mask = false;
|
|
73
|
+
/** Names the field for assistive technology where no Field frames it. Never drawn. Inside a Field leave it empty: the Field names it. */
|
|
74
|
+
this.label = '';
|
|
75
|
+
/** Draws every cell in the error condition and exposes the field as invalid. A Field sets this from its own error; set it here only where no Field frames the control. */
|
|
76
|
+
this.error = false;
|
|
77
|
+
/** Prevents entry and takes the field out of the focus order. Inside a Field, disable the Field, so that its label follows. */
|
|
78
|
+
this.disabled = false;
|
|
79
|
+
/** Keeps the field focusable and its value readable, and lets nothing change it (`readonly`): for the moment a complete code is being checked. */
|
|
80
|
+
this.readOnly = false;
|
|
81
|
+
/** Web only: the name the code is submitted under. */
|
|
82
|
+
this.name = '';
|
|
83
|
+
/** OTC-7: the native input has focus, however it was gained. */
|
|
84
|
+
this.focused = false;
|
|
85
|
+
/** OTC-5, OTC-10: the active cell and whether the whole value is selected. Its `value` follows the element's. */
|
|
86
|
+
this.state = { value: '', active: 0, all: false };
|
|
87
|
+
/** OTC-6: the text an input method is composing, as the method gave it; empty while none is. */
|
|
88
|
+
this.composingText = '';
|
|
89
|
+
/** Set by an ancestor `<fieldset disabled>`. */
|
|
90
|
+
this.formDisabled = false;
|
|
91
|
+
this.internals = this.attachInternals();
|
|
92
|
+
/** What it tells its form, said where an element composed around it hears it (src/primitives/form-says.ts). */
|
|
93
|
+
this.says = new FormSays(this, this.internals);
|
|
94
|
+
/**
|
|
95
|
+
* What a Field around it gives it (src/primitives/field.ts): the name while it has no `label` of its own, the
|
|
96
|
+
* description, the invalid, required and disabled states (OTC-17, OTC-20, OTC-22).
|
|
97
|
+
*/
|
|
98
|
+
this.field = new FieldControlController(this, { errorCondition: true, named: () => !!this.label.trim() });
|
|
99
|
+
/** The value the element last held by its own doing: a `value` that differs was set by the product (OTC-18). */
|
|
100
|
+
this.held = '';
|
|
101
|
+
/** OTC-13: the value at the last commit. */
|
|
102
|
+
this.committed = '';
|
|
103
|
+
/** OTC-6: an input method is composing; the native element is its own until it ends. */
|
|
104
|
+
this.composing = false;
|
|
105
|
+
/** A composition has just ended: what the engine still sends for it (an input, the key that committed it) is not the person's edit or the action key. */
|
|
106
|
+
this.settling = false;
|
|
107
|
+
/** OTC-5: focus arrives by a press on a cell, which has chosen the active cell. */
|
|
108
|
+
this.pressing = false;
|
|
109
|
+
/** Focus has arrived and the person has done nothing yet: a selection of the whole text is the browser's own (it selects a text input it tabs into), not the person's select all. */
|
|
110
|
+
this.fresh = false;
|
|
111
|
+
this.rows = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.markRows());
|
|
112
|
+
this.observed = null;
|
|
113
|
+
/**
|
|
114
|
+
* OTC-23: the mark of a group that begins a row is not drawn. The one thing read from the layout: whether a group
|
|
115
|
+
* stands on the row of the group before it. The mark is positioned, so hiding it moves nothing.
|
|
116
|
+
*/
|
|
117
|
+
this.markRows = () => {
|
|
118
|
+
const groups = [...this.renderRoot.querySelectorAll('.group')];
|
|
119
|
+
groups.forEach((group, index) => group.toggleAttribute('data-row-start', index === 0 || group.offsetTop !== groups[index - 1].offsetTop));
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
static { this.styles = styles; }
|
|
123
|
+
static { this.formAssociated = true; }
|
|
124
|
+
/**
|
|
125
|
+
* Its documented parts, once: what an element composed around it exports (src/primitives/composed.ts). Held equal to
|
|
126
|
+
* the `@csspart` lines above by src/primitives/composed.test.ts.
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
static { this.parts = ['input', 'cell', 'character', 'caret', 'separator']; }
|
|
131
|
+
static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true }; }
|
|
132
|
+
static { this.properties = {
|
|
133
|
+
value: { type: String },
|
|
134
|
+
length: { type: Number },
|
|
135
|
+
type: { type: String },
|
|
136
|
+
groupSize: { type: Number, attribute: 'group-size' },
|
|
137
|
+
mask: { type: Boolean, reflect: true },
|
|
138
|
+
label: { type: String },
|
|
139
|
+
error: { type: Boolean, reflect: true },
|
|
140
|
+
disabled: { type: Boolean, reflect: true },
|
|
141
|
+
readOnly: { type: Boolean, attribute: 'readonly', reflect: true },
|
|
142
|
+
name: { type: String, reflect: true },
|
|
143
|
+
focused: { state: true },
|
|
144
|
+
state: { state: true },
|
|
145
|
+
composingText: { state: true },
|
|
146
|
+
formDisabled: { state: true },
|
|
147
|
+
}; }
|
|
148
|
+
get input() {
|
|
149
|
+
return this.renderRoot.querySelector('.input');
|
|
150
|
+
}
|
|
151
|
+
/** The form it belongs to, if any. */
|
|
152
|
+
get form() {
|
|
153
|
+
return this.internals.form;
|
|
154
|
+
}
|
|
155
|
+
/** The element's validity: a missing value while its Field says it is required and it is empty (OTC-29). */
|
|
156
|
+
get validity() {
|
|
157
|
+
return this.internals.validity;
|
|
158
|
+
}
|
|
159
|
+
get validationMessage() {
|
|
160
|
+
return this.internals.validationMessage;
|
|
161
|
+
}
|
|
162
|
+
get willValidate() {
|
|
163
|
+
return this.internals.willValidate;
|
|
164
|
+
}
|
|
165
|
+
checkValidity() {
|
|
166
|
+
return this.internals.checkValidity();
|
|
167
|
+
}
|
|
168
|
+
reportValidity() {
|
|
169
|
+
return this.internals.reportValidity();
|
|
170
|
+
}
|
|
171
|
+
// ─── What the props mean (OTC-19) ─────────────────────────────────────────────────────────────────────────────
|
|
172
|
+
/** OTC-19: the number of cells — `length`, or 6 where it is not a whole number of 1 or more. */
|
|
173
|
+
get cells() {
|
|
174
|
+
const length = Number(this.length);
|
|
175
|
+
return Number.isInteger(length) && length >= 1 ? length : DEFAULT_LENGTH;
|
|
176
|
+
}
|
|
177
|
+
/** OTC-19: `type`, or numeric for a value it does not know. */
|
|
178
|
+
get kind() {
|
|
179
|
+
return TYPES.includes(this.type) ? this.type : 'numeric';
|
|
180
|
+
}
|
|
181
|
+
/** OTC-15, OTC-19: the cells of each group — one group unless `groupSize` is a whole number from 1 to length minus 1. */
|
|
182
|
+
get groups() {
|
|
183
|
+
const cells = this.cells;
|
|
184
|
+
const size = Number(this.groupSize);
|
|
185
|
+
const valid = Number.isInteger(size) && size >= 1 && size <= cells - 1;
|
|
186
|
+
const all = Array.from({ length: cells }, (_, index) => index);
|
|
187
|
+
if (!valid)
|
|
188
|
+
return [all];
|
|
189
|
+
const groups = [];
|
|
190
|
+
for (let at = 0; at < cells; at += size)
|
|
191
|
+
groups.push(all.slice(at, at + size));
|
|
192
|
+
return groups;
|
|
193
|
+
}
|
|
194
|
+
get isDisabled() {
|
|
195
|
+
return this.disabled || this.formDisabled || this.field.disabled;
|
|
196
|
+
}
|
|
197
|
+
/** OTC-20, OTC-21: nothing the person does changes the value. */
|
|
198
|
+
get locked() {
|
|
199
|
+
return this.isDisabled || this.readOnly;
|
|
200
|
+
}
|
|
201
|
+
get isError() {
|
|
202
|
+
return this.error || this.field.invalid;
|
|
203
|
+
}
|
|
204
|
+
// ─── Form (OTC-29) ────────────────────────────────────────────────────────────────────────────────────────────
|
|
205
|
+
formResetCallback() {
|
|
206
|
+
this.value = this.getAttribute('value') ?? '';
|
|
207
|
+
}
|
|
208
|
+
formStateRestoreCallback(state) {
|
|
209
|
+
if (typeof state === 'string')
|
|
210
|
+
this.value = state;
|
|
211
|
+
}
|
|
212
|
+
formDisabledCallback(disabled) {
|
|
213
|
+
takeFormDisabled(this, disabled, (value) => (this.formDisabled = value));
|
|
214
|
+
}
|
|
215
|
+
/** The value a form submits — the code alone, or an empty string — and what its validation is told. */
|
|
216
|
+
syncForm() {
|
|
217
|
+
// OTC-20: a disabled field is left out of the submission (its own attribute, a fieldset's, or its Field's).
|
|
218
|
+
this.says.value(this.isDisabled ? null : this.value, this.value);
|
|
219
|
+
// OTC-29: a missing value while its Field says it is required; nothing for a code shorter than length. A read-only
|
|
220
|
+
// control is not validated, as a native one is not.
|
|
221
|
+
const missing = this.field.required && this.value === '' && !this.locked;
|
|
222
|
+
const input = this.input;
|
|
223
|
+
if (missing && input) {
|
|
224
|
+
const message = missingValueMessage('text', { errorText: '', requiredText: this.field.state?.requiredText ?? '', label: this.field.name(this.label) });
|
|
225
|
+
this.says.validity({ valueMissing: true }, message, input);
|
|
226
|
+
}
|
|
227
|
+
else
|
|
228
|
+
this.says.validity();
|
|
229
|
+
}
|
|
230
|
+
// ─── Lifecycle ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
231
|
+
disconnectedCallback() {
|
|
232
|
+
super.disconnectedCallback();
|
|
233
|
+
this.rows?.disconnect();
|
|
234
|
+
this.observed = null;
|
|
235
|
+
this.composing = false;
|
|
236
|
+
this.settling = false;
|
|
237
|
+
}
|
|
238
|
+
willUpdate(changed) {
|
|
239
|
+
if (changed.has('length') && this.cells !== Number(this.length)) {
|
|
240
|
+
report(this, 'OTC-19', `length ${String(this.length)} is not a whole number of 1 or more; ${DEFAULT_LENGTH} cells are drawn`);
|
|
241
|
+
}
|
|
242
|
+
if (changed.has('type') && !TYPES.includes(this.type))
|
|
243
|
+
report(this, 'OTC-19', `type "${String(this.type)}" is not a value of the one-time-code input; it behaves as "numeric"`);
|
|
244
|
+
if (changed.has('groupSize') || changed.has('length')) {
|
|
245
|
+
const size = Number(this.groupSize);
|
|
246
|
+
if (!(Number.isInteger(size) && size >= 0 && size <= this.cells - 1)) {
|
|
247
|
+
report(this, 'OTC-19', `groupSize ${String(this.groupSize)} is not a whole number from 0 to length minus 1 (${this.cells - 1}); one group is drawn`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (changed.has('value') || changed.has('length') || changed.has('type')) {
|
|
251
|
+
// OTC-18: a value the product set is read by OTC-4 and keeps its first `length` permitted characters; OTC-19: a
|
|
252
|
+
// shorter length keeps the first characters. No event for either.
|
|
253
|
+
const given = String(this.value ?? '');
|
|
254
|
+
const fromProduct = given !== this.held;
|
|
255
|
+
const { value, dropped } = readValue(given, this.cells, this.kind);
|
|
256
|
+
if (fromProduct && dropped)
|
|
257
|
+
report(this, 'OTC-18', `value "${given}" holds characters a ${this.kind} code of ${this.cells} cannot; "${value}" is shown`, { once: false });
|
|
258
|
+
this.value = value;
|
|
259
|
+
this.held = value;
|
|
260
|
+
if (fromProduct) {
|
|
261
|
+
// What the product set is the committed value: leaving the field after it is no change by the person.
|
|
262
|
+
this.committed = value;
|
|
263
|
+
// OTC-18: set while the field has focus, the active cell is the first empty cell, or the last.
|
|
264
|
+
this.state = replaceAll(value, this.cells);
|
|
265
|
+
}
|
|
266
|
+
else
|
|
267
|
+
this.state = settle({ ...this.state, value }, this.cells);
|
|
268
|
+
}
|
|
269
|
+
// OTC-22: a field without a name still renders; a debug build says what is missing.
|
|
270
|
+
if ((changed.has('label') || !this.hasUpdated) && !this.label.trim() && !this.field.label) {
|
|
271
|
+
report(this, 'OTC-22', 'label is empty and no field frames it, so the one-time-code input has no accessible name; put it in a field with a label, or give it a label');
|
|
272
|
+
}
|
|
273
|
+
// OTC-20: a disabled field has no focus and no active cell (a native element that is disabled while it has focus
|
|
274
|
+
// does not always say that it lost it).
|
|
275
|
+
if (this.isDisabled && this.focused) {
|
|
276
|
+
this.focused = false;
|
|
277
|
+
this.state = { ...this.state, all: false };
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
updated(changed) {
|
|
281
|
+
this.syncForm();
|
|
282
|
+
this.show();
|
|
283
|
+
const row = this.renderRoot.querySelector('.row');
|
|
284
|
+
if (row !== this.observed) {
|
|
285
|
+
this.rows?.disconnect();
|
|
286
|
+
if (row)
|
|
287
|
+
this.rows?.observe(row);
|
|
288
|
+
this.observed = row;
|
|
289
|
+
}
|
|
290
|
+
if (changed.has('length') || changed.has('groupSize') || changed.has('type'))
|
|
291
|
+
this.markRows();
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* OTC-2, OTC-5: the native element holds the value and its insertion point stands at the active cell — before its
|
|
295
|
+
* character while it is filled, at the end of the value while it is empty — or the whole value is selected (OTC-10).
|
|
296
|
+
* Never written into a composition: the text is the input method's until it ends.
|
|
297
|
+
*/
|
|
298
|
+
show() {
|
|
299
|
+
const input = this.input;
|
|
300
|
+
if (!input || this.composing)
|
|
301
|
+
return;
|
|
302
|
+
if (input.value !== this.value)
|
|
303
|
+
input.value = this.value;
|
|
304
|
+
if (!this.focused || this.renderRoot.querySelector(':focus') !== input)
|
|
305
|
+
return;
|
|
306
|
+
const [start, end] = this.state.all ? [0, this.value.length] : [this.state.active, this.state.active];
|
|
307
|
+
if (input.selectionStart !== start || input.selectionEnd !== end)
|
|
308
|
+
input.setSelectionRange(start, end);
|
|
309
|
+
}
|
|
310
|
+
// ─── Changes by the person (OTC-6, OTC-9, OTC-10, OTC-11, OTC-13, OTC-14) ───────────────────────────────────
|
|
311
|
+
/**
|
|
312
|
+
* Takes a state an edit produced. When it changes the value the element holds it before anyone hears of it, as a
|
|
313
|
+
* native control does: `input`, then `complete` when the value is `length` long — once for the change.
|
|
314
|
+
*/
|
|
315
|
+
take(next) {
|
|
316
|
+
const cells = this.cells;
|
|
317
|
+
const state = settle(next, cells);
|
|
318
|
+
const changed = state.value !== this.value;
|
|
319
|
+
this.state = state;
|
|
320
|
+
if (!changed) {
|
|
321
|
+
this.show();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
this.held = state.value;
|
|
325
|
+
this.value = state.value;
|
|
326
|
+
this.syncForm();
|
|
327
|
+
this.show();
|
|
328
|
+
const detail = { value: state.value };
|
|
329
|
+
this.dispatchEvent(new CustomEvent('input', { bubbles: true, composed: true, detail }));
|
|
330
|
+
// OTC-14: complete, and nothing else — no submission, no move of focus.
|
|
331
|
+
if (this.value === state.value && state.value.length === cells) {
|
|
332
|
+
this.dispatchEvent(new CustomEvent('complete', { bubbles: true, composed: true, detail: { value: state.value } }));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/** OTC-13: a changed value is committed — `change`, when it differs from the value at the last commit. */
|
|
336
|
+
commit() {
|
|
337
|
+
if (this.locked || this.value === this.committed)
|
|
338
|
+
return;
|
|
339
|
+
this.committed = this.value;
|
|
340
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: { value: this.value } }));
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Text that arrives in the field. One character from the keyboard is typed (OTC-4, OTC-6): a permitted one fills the
|
|
344
|
+
* active cell, any other is dropped. A whole text — pasted, dropped, dictated, filled — is read as one code wherever
|
|
345
|
+
* the active cell is (OTC-11), and changes nothing where it holds none.
|
|
346
|
+
*/
|
|
347
|
+
insert(text, whole) {
|
|
348
|
+
if (this.locked || text === '')
|
|
349
|
+
return;
|
|
350
|
+
const cells = this.cells;
|
|
351
|
+
if (!whole && [...text].length === 1) {
|
|
352
|
+
const char = readCharacter(text, this.kind);
|
|
353
|
+
if (char !== null)
|
|
354
|
+
this.take(typeCharacter(this.state, char, cells));
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const code = readCode(text, cells, this.kind);
|
|
358
|
+
if (code !== null)
|
|
359
|
+
this.take(replaceAll(code, cells));
|
|
360
|
+
}
|
|
361
|
+
onBeforeInput(event) {
|
|
362
|
+
const type = event.inputType;
|
|
363
|
+
// OTC-6: composing text is the input method's, and is read when it is committed.
|
|
364
|
+
if (COMPOSITION.has(type) || event.isComposing || this.composing)
|
|
365
|
+
return;
|
|
366
|
+
const known = type.startsWith('insert') || type.startsWith('delete') || type.startsWith('history') || type.startsWith('format');
|
|
367
|
+
// What is not known is left to the element and read from it afterwards (`onInput`).
|
|
368
|
+
if (!known)
|
|
369
|
+
return;
|
|
370
|
+
// The cells are drawn from the value the element holds, so the native element never edits by itself.
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
if (this.locked)
|
|
373
|
+
return;
|
|
374
|
+
const cells = this.cells;
|
|
375
|
+
if (type === 'insertText')
|
|
376
|
+
this.insert(event.data ?? '', false);
|
|
377
|
+
else if (INSERTS_WHOLE.has(type))
|
|
378
|
+
this.insert(event.data ?? event.dataTransfer?.getData('text/plain') ?? '', true);
|
|
379
|
+
else if (type === 'deleteContentBackward')
|
|
380
|
+
this.take(removeBackward(this.state, cells));
|
|
381
|
+
else if (type === 'deleteContentForward')
|
|
382
|
+
this.take(removeForward(this.state, cells));
|
|
383
|
+
else if (REMOVES_BACKWARD_RUN.has(type))
|
|
384
|
+
this.take(removeRun(this.state, 'backward', cells));
|
|
385
|
+
else if (REMOVES_FORWARD_RUN.has(type))
|
|
386
|
+
this.take(removeRun(this.state, 'forward', cells));
|
|
387
|
+
// The rest — a line break, a cut or a drag (heard as their own events), undo and redo, formatting — changes nothing here.
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The native element's own `input`: it is stopped here (the element's `input` is the composed event `take()` fires).
|
|
391
|
+
* What reaches this without having been read in `beforeinput` — autofill, and input a browser does not announce or
|
|
392
|
+
* does not let be stopped — is read from the element: a removal as the browser made it, one character as typed, and
|
|
393
|
+
* anything else as a whole text (OTC-11).
|
|
394
|
+
*/
|
|
395
|
+
onInput(event) {
|
|
396
|
+
event.stopPropagation();
|
|
397
|
+
const input = this.input;
|
|
398
|
+
if (!input || this.composing || this.settling || event.isComposing)
|
|
399
|
+
return;
|
|
400
|
+
if (input.value === this.value)
|
|
401
|
+
return;
|
|
402
|
+
if (this.locked) {
|
|
403
|
+
this.show();
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const cells = this.cells;
|
|
407
|
+
const { inputType = '', data = null } = event;
|
|
408
|
+
if (inputType.startsWith('delete')) {
|
|
409
|
+
const value = readValue(input.value, cells, this.kind).value;
|
|
410
|
+
this.take({ value, active: input.selectionStart ?? value.length, all: false });
|
|
411
|
+
}
|
|
412
|
+
else if (inputType === 'insertText' && typeof data === 'string' && data !== '')
|
|
413
|
+
this.insert(data, false);
|
|
414
|
+
else
|
|
415
|
+
this.insert(input.value, true);
|
|
416
|
+
// A text that was no code changed nothing: the element shows the value again.
|
|
417
|
+
this.show();
|
|
418
|
+
}
|
|
419
|
+
/** The browser's own `change` is not the field's (OTC-13 decides when a value is committed). */
|
|
420
|
+
onNativeChange(event) {
|
|
421
|
+
event.stopPropagation();
|
|
422
|
+
}
|
|
423
|
+
// ─── An input method (OTC-6, OTC-13) ──────────────────────────────────────────────────────────────────────────
|
|
424
|
+
onCompositionStart() {
|
|
425
|
+
this.composing = true;
|
|
426
|
+
this.composingText = '';
|
|
427
|
+
}
|
|
428
|
+
onCompositionUpdate(event) {
|
|
429
|
+
if (!this.composing)
|
|
430
|
+
return;
|
|
431
|
+
this.composingText = event.data ?? '';
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* The composition ended: what it committed is read character by character, as typed text is; a cancelled one leaves
|
|
435
|
+
* nothing. The engines differ in what follows — an `input` that is no longer composing (Firefox), nothing (Chromium),
|
|
436
|
+
* and the `keydown` of the key that committed it, which no longer says that it composes (WebKit) — so for the rest of
|
|
437
|
+
* this turn nothing the native element sends is read as an edit or as the action key.
|
|
438
|
+
*/
|
|
439
|
+
onCompositionEnd(event) {
|
|
440
|
+
if (!this.composing)
|
|
441
|
+
return;
|
|
442
|
+
this.composing = false;
|
|
443
|
+
this.composingText = '';
|
|
444
|
+
this.settling = true;
|
|
445
|
+
const committed = readPermitted(event.data ?? '', this.kind);
|
|
446
|
+
if (committed && !this.locked)
|
|
447
|
+
this.take(typeText(this.state, committed, this.cells));
|
|
448
|
+
else
|
|
449
|
+
this.show();
|
|
450
|
+
setTimeout(() => {
|
|
451
|
+
this.settling = false;
|
|
452
|
+
this.show();
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
// ─── Keys (OTC-8, OTC-9, OTC-10, OTC-13) ──────────────────────────────────────────────────────────────────────
|
|
456
|
+
onKeyDown(event) {
|
|
457
|
+
this.fresh = false;
|
|
458
|
+
if (this.isDisabled)
|
|
459
|
+
return;
|
|
460
|
+
// OTC-13: a key an input method takes — the one that commits or cancels its text too — is not the field's.
|
|
461
|
+
if (event.isComposing || this.composing || this.settling || event.keyCode === 229)
|
|
462
|
+
return;
|
|
463
|
+
const cells = this.cells;
|
|
464
|
+
const { value, active, all } = this.state;
|
|
465
|
+
const end = furthest(value, cells);
|
|
466
|
+
const jump = event.ctrlKey || event.metaKey || event.altKey;
|
|
467
|
+
switch (event.key) {
|
|
468
|
+
case 'Enter':
|
|
469
|
+
this.act(event);
|
|
470
|
+
return;
|
|
471
|
+
case 'ArrowLeft':
|
|
472
|
+
case 'ArrowRight':
|
|
473
|
+
case 'Home':
|
|
474
|
+
case 'End': {
|
|
475
|
+
// OTC-8, OTC-27: the cell drawn on that side, in every layout direction; the native caret never moves by itself.
|
|
476
|
+
event.preventDefault();
|
|
477
|
+
// OTC-10: Shift with an arrow key selects nothing.
|
|
478
|
+
if (event.shiftKey)
|
|
479
|
+
return;
|
|
480
|
+
const first = event.key === 'Home' || (event.key === 'ArrowLeft' && (jump || all));
|
|
481
|
+
const last = event.key === 'End' || (event.key === 'ArrowRight' && (jump || all));
|
|
482
|
+
const next = first ? 0 : last ? end : event.key === 'ArrowLeft' ? Math.max(0, active - 1) : Math.min(end, active + 1);
|
|
483
|
+
this.state = { value, active: next, all: false };
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
case 'ArrowUp':
|
|
487
|
+
case 'ArrowDown':
|
|
488
|
+
case 'PageUp':
|
|
489
|
+
case 'PageDown':
|
|
490
|
+
// OTC-8: nothing in the field, and left to the page. A browser that moves its caret for them is put right.
|
|
491
|
+
setTimeout(() => this.show());
|
|
492
|
+
return;
|
|
493
|
+
case 'Backspace':
|
|
494
|
+
case 'Delete': {
|
|
495
|
+
// Shift+Delete is a platform's cut: left to the browser, heard as `cut`.
|
|
496
|
+
if (event.key === 'Delete' && event.shiftKey)
|
|
497
|
+
return;
|
|
498
|
+
event.preventDefault();
|
|
499
|
+
if (this.locked)
|
|
500
|
+
return;
|
|
501
|
+
const backward = event.key === 'Backspace';
|
|
502
|
+
if (jump)
|
|
503
|
+
this.take(removeRun(this.state, backward ? 'backward' : 'forward', cells));
|
|
504
|
+
else
|
|
505
|
+
this.take(backward ? removeBackward(this.state, cells) : removeForward(this.state, cells));
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
default:
|
|
509
|
+
// OTC-10: the platform's select all selects the whole value.
|
|
510
|
+
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === 'a') {
|
|
511
|
+
event.preventDefault();
|
|
512
|
+
this.state = { value, active: end, all: value !== '' };
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/** OTC-13: the action key — the commit, then `action`, then the form's submission unless `action` was cancelled. */
|
|
517
|
+
act(event) {
|
|
518
|
+
this.commit();
|
|
519
|
+
const action = new CustomEvent('action', { bubbles: true, composed: true, cancelable: true, detail: { value: this.value } });
|
|
520
|
+
const proceed = this.dispatchEvent(action);
|
|
521
|
+
// Its own form, or the form of the element composed around it (src/primitives/default-button.ts, `formOf`).
|
|
522
|
+
const form = proceed ? formOf(this, this.form) : null;
|
|
523
|
+
if (form) {
|
|
524
|
+
event.preventDefault();
|
|
525
|
+
pressDefaultButton(form);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
// ─── Focus, presses and the selection (OTC-5, OTC-10, OTC-25) ────────────────────────────────────────────────
|
|
529
|
+
onFocus() {
|
|
530
|
+
this.fresh = true;
|
|
531
|
+
// OTC-5: focus that enters by the keyboard, by a Field's label or from the product makes the first empty cell (or
|
|
532
|
+
// the last) active; a press on a cell has chosen already.
|
|
533
|
+
if (!this.pressing)
|
|
534
|
+
this.state = replaceAll(this.value, this.cells);
|
|
535
|
+
this.focused = true;
|
|
536
|
+
// OTC-7: the focus style is read when focus arrives, for a browser without style queries.
|
|
537
|
+
syncFocusStyle(this, this.renderRoot.querySelector('.field'));
|
|
538
|
+
// A browser selects the text of an input it tabs into, after this: the insertion point is put back.
|
|
539
|
+
setTimeout(() => this.show());
|
|
540
|
+
}
|
|
541
|
+
onBlur() {
|
|
542
|
+
this.focused = false;
|
|
543
|
+
this.fresh = false;
|
|
544
|
+
this.state = { ...this.state, all: false };
|
|
545
|
+
// OTC-13: focus left the field.
|
|
546
|
+
this.commit();
|
|
547
|
+
}
|
|
548
|
+
/** The cell at a point of the window, or -1: the native element lies over the cells and takes the press. */
|
|
549
|
+
cellAt(x, y) {
|
|
550
|
+
const cells = [...this.renderRoot.querySelectorAll('.cell')];
|
|
551
|
+
return cells.findIndex((cell) => {
|
|
552
|
+
const box = cell.getBoundingClientRect();
|
|
553
|
+
return x >= box.left && x <= box.right && y >= box.top && y <= box.bottom;
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* OTC-25: a press takes focus and makes the pressed cell active while it is filled, and otherwise the first empty
|
|
558
|
+
* cell. It is not an action and draws no answer. The native element's own answer to a press — its caret where the
|
|
559
|
+
* unseen text is, a selection by dragging or by a second press — is not wanted (OTC-10), so the press is the
|
|
560
|
+
* element's: it focuses the native element itself.
|
|
561
|
+
*/
|
|
562
|
+
onMouseDown(event) {
|
|
563
|
+
this.fresh = false;
|
|
564
|
+
if (this.isDisabled)
|
|
565
|
+
return;
|
|
566
|
+
if (event.button !== 0) {
|
|
567
|
+
// A secondary press (the browser's menu, with its paste) is the browser's; the insertion point is put back.
|
|
568
|
+
setTimeout(() => this.show());
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
event.preventDefault();
|
|
572
|
+
const pressed = this.cellAt(event.clientX, event.clientY);
|
|
573
|
+
const active = pressed >= 0 && pressed < this.value.length ? pressed : furthest(this.value, this.cells);
|
|
574
|
+
this.state = { value: this.value, active, all: false };
|
|
575
|
+
const input = this.input;
|
|
576
|
+
if (input && this.renderRoot.querySelector(':focus') !== input) {
|
|
577
|
+
this.pressing = true;
|
|
578
|
+
input.focus();
|
|
579
|
+
this.pressing = false;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* OTC-10: a selection of the native text. The whole value selected by the person — the browser's menu, a touch
|
|
584
|
+
* keyboard's "select all" — is select all; any other selection (a part of the text, or the one a browser makes when
|
|
585
|
+
* it focuses an input) is undone: the field has no selection of some cells only.
|
|
586
|
+
*/
|
|
587
|
+
onSelect() {
|
|
588
|
+
const input = this.input;
|
|
589
|
+
if (!input || !this.focused || this.composing)
|
|
590
|
+
return;
|
|
591
|
+
const whole = this.value !== '' && input.selectionStart === 0 && input.selectionEnd === input.value.length;
|
|
592
|
+
if (whole && !this.fresh && !this.state.all)
|
|
593
|
+
this.state = { ...this.state, all: true };
|
|
594
|
+
else
|
|
595
|
+
this.show();
|
|
596
|
+
}
|
|
597
|
+
/** OTC-10: copy takes the whole value, without group marks, whichever cell is active; nothing while mask is set. */
|
|
598
|
+
onCopy(event) {
|
|
599
|
+
event.preventDefault();
|
|
600
|
+
if (this.mask || this.isDisabled)
|
|
601
|
+
return;
|
|
602
|
+
event.clipboardData?.setData('text/plain', this.value);
|
|
603
|
+
}
|
|
604
|
+
/** OTC-10: cut takes the whole value and empties the field; while mask is set it gives nothing and changes nothing. */
|
|
605
|
+
onCut(event) {
|
|
606
|
+
event.preventDefault();
|
|
607
|
+
if (this.mask || this.locked || this.value === '')
|
|
608
|
+
return;
|
|
609
|
+
event.clipboardData?.setData('text/plain', this.value);
|
|
610
|
+
this.take({ value: '', active: 0, all: false });
|
|
611
|
+
}
|
|
612
|
+
/** OTC-11: pasted text is read whole as one code. Never blocked, masked or not. */
|
|
613
|
+
onPaste(event) {
|
|
614
|
+
event.preventDefault();
|
|
615
|
+
this.insert(event.clipboardData?.getData('text/plain') ?? '', true);
|
|
616
|
+
}
|
|
617
|
+
/** OTC-11: dropped text is read whole as one code, and the field takes focus as a native input does. */
|
|
618
|
+
onDrop(event) {
|
|
619
|
+
event.preventDefault();
|
|
620
|
+
if (this.locked)
|
|
621
|
+
return;
|
|
622
|
+
this.input?.focus();
|
|
623
|
+
this.insert(event.dataTransfer?.getData('text/plain') ?? '', true);
|
|
624
|
+
}
|
|
625
|
+
// ─── Rendering ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
626
|
+
/**
|
|
627
|
+
* What the cells draw: the value, or — while an input method composes — the value as it would be if the composing
|
|
628
|
+
* text were committed now, with the cells that text fills marked (OTC-6). The value itself does not change.
|
|
629
|
+
*/
|
|
630
|
+
get drawn() {
|
|
631
|
+
const cells = this.cells;
|
|
632
|
+
const state = settle(this.state, cells);
|
|
633
|
+
const text = this.composing ? readPermitted(this.composingText, this.kind) : '';
|
|
634
|
+
if (!text)
|
|
635
|
+
return { state, composing: [0, 0] };
|
|
636
|
+
const from = state.all ? 0 : state.active;
|
|
637
|
+
return { state: typeText(state, text, cells), composing: [from, Math.min(cells, from + [...text].length)] };
|
|
638
|
+
}
|
|
639
|
+
render() {
|
|
640
|
+
const disabled = this.isDisabled;
|
|
641
|
+
const focused = this.focused && !disabled;
|
|
642
|
+
const groups = this.groups;
|
|
643
|
+
const kind = this.kind;
|
|
644
|
+
const { state, composing } = this.drawn;
|
|
645
|
+
const name = this.field.name(this.label);
|
|
646
|
+
const description = this.field.description();
|
|
647
|
+
const cell = (index) => {
|
|
648
|
+
const char = state.value[index];
|
|
649
|
+
const filled = char !== undefined;
|
|
650
|
+
const active = focused && (state.all ? filled : index === state.active);
|
|
651
|
+
// OTC-7: the caret stands in an empty active cell; a read-only field draws none (OTC-21).
|
|
652
|
+
const caret = active && !filled && !this.readOnly;
|
|
653
|
+
const fresh = index >= composing[0] && index < composing[1];
|
|
654
|
+
return html `<span class="cell" part="cell" data-tanrei-shape ?data-active=${active} ?data-filled=${filled}
|
|
655
|
+
>${filled
|
|
656
|
+
? html `<span class="char" part="character" ?data-composing=${fresh}>${this.mask ? MASK : char}</span>`
|
|
657
|
+
: caret
|
|
658
|
+
? html `<span class="caret" part="caret"></span>`
|
|
659
|
+
: nothing}</span
|
|
660
|
+
>`;
|
|
661
|
+
};
|
|
662
|
+
return html `
|
|
663
|
+
<div class="field" data-type=${kind} ?data-error=${this.isError} ?data-disabled=${disabled} ?data-focused=${focused} style="--_cells: ${this.cells}; --_groups: ${groups.length}">
|
|
664
|
+
<input
|
|
665
|
+
class="input"
|
|
666
|
+
part="input"
|
|
667
|
+
type=${this.mask ? 'password' : 'text'}
|
|
668
|
+
autocomplete="one-time-code"
|
|
669
|
+
inputmode=${kind === 'numeric' ? 'numeric' : 'text'}
|
|
670
|
+
autocapitalize=${kind === 'numeric' ? 'off' : 'characters'}
|
|
671
|
+
autocorrect="off"
|
|
672
|
+
spellcheck="false"
|
|
673
|
+
enterkeyhint="done"
|
|
674
|
+
aria-label=${name || nothing}
|
|
675
|
+
aria-description=${description || nothing}
|
|
676
|
+
aria-invalid=${this.isError ? 'true' : nothing}
|
|
677
|
+
aria-required=${this.field.required ? 'true' : nothing}
|
|
678
|
+
aria-readonly=${this.readOnly ? 'true' : nothing}
|
|
679
|
+
?readonly=${this.readOnly}
|
|
680
|
+
?disabled=${disabled}
|
|
681
|
+
@beforeinput=${this.onBeforeInput}
|
|
682
|
+
@input=${this.onInput}
|
|
683
|
+
@change=${this.onNativeChange}
|
|
684
|
+
@compositionstart=${this.onCompositionStart}
|
|
685
|
+
@compositionupdate=${this.onCompositionUpdate}
|
|
686
|
+
@compositionend=${this.onCompositionEnd}
|
|
687
|
+
@keydown=${this.onKeyDown}
|
|
688
|
+
@focus=${this.onFocus}
|
|
689
|
+
@blur=${this.onBlur}
|
|
690
|
+
@mousedown=${this.onMouseDown}
|
|
691
|
+
@select=${this.onSelect}
|
|
692
|
+
@copy=${this.onCopy}
|
|
693
|
+
@cut=${this.onCut}
|
|
694
|
+
@paste=${this.onPaste}
|
|
695
|
+
@drop=${this.onDrop}
|
|
696
|
+
/>
|
|
697
|
+
<div class="row" aria-hidden="true">
|
|
698
|
+
${groups.map((indices, group) => html `<span class="group" style="--_n: ${indices.length}">${group > 0 ? html `<span class="mark" part="separator"></span>` : nothing}${indices.map(cell)}</span>`)}
|
|
699
|
+
</div>
|
|
700
|
+
</div>
|
|
701
|
+
`;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
// Its `disabled` attribute, written while it holds focus, waits until focus has left: a frame at most.
|
|
705
|
+
disabledWaitsWhileFocused(TanreiOneTimeCodeInput);
|
|
706
|
+
// `autofocus` on it gives it focus when the page first loads too (src/primitives/autofocus.ts).
|
|
707
|
+
focusedAtFirst(TanreiOneTimeCodeInput);
|
|
708
|
+
if (!customElements.get('tanrei-one-time-code-input'))
|
|
709
|
+
customElements.define('tanrei-one-time-code-input', TanreiOneTimeCodeInput);
|
|
710
|
+
//# sourceMappingURL=one-time-code-input.js.map
|