@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,230 @@
|
|
|
1
|
+
// A number as a number input holds it, reads it and writes it (NMI-17, NMI-18, NMI-20, NMI-22). Nothing here touches
|
|
2
|
+
// the page: it is arithmetic and text, so that every rule can be tested by itself.
|
|
3
|
+
//
|
|
4
|
+
// the arithmetic a decimal held exactly — a whole number of units of 10^-scale — so that 0.1 stepped by 0.2 is 0.3
|
|
5
|
+
// and a half is rounded away from zero as the digits a person typed say, never as the nearest
|
|
6
|
+
// binary fraction does.
|
|
7
|
+
// the form a locale's digits, its decimal separator, its grouping separator and its minus sign, asked of
|
|
8
|
+
// `Intl.NumberFormat` once per locale.
|
|
9
|
+
// writing the number in that form: no grouping, no exponent, a fixed range of digits after the separator.
|
|
10
|
+
// reading a text as a number, leniently, by that form — and never by a guess between two locales' forms.
|
|
11
|
+
const pow10 = (exponent) => 10n ** BigInt(exponent);
|
|
12
|
+
function normalise(int, scale) {
|
|
13
|
+
while (scale > 0 && int % 10n === 0n) {
|
|
14
|
+
int /= 10n;
|
|
15
|
+
scale--;
|
|
16
|
+
}
|
|
17
|
+
return { int, scale };
|
|
18
|
+
}
|
|
19
|
+
export const ZERO = { int: 0n, scale: 0 };
|
|
20
|
+
/**
|
|
21
|
+
* A plain decimal string — ASCII digits, a period, an optional sign and exponent ("12.5", "-0.25", "1e-7") — as a
|
|
22
|
+
* decimal; null for anything else. The form of the `value` attribute, of a form's value, and of a number as JavaScript
|
|
23
|
+
* writes it.
|
|
24
|
+
*/
|
|
25
|
+
export function decimalFromString(text) {
|
|
26
|
+
const match = /^([+-]?)(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/i.exec(text.trim());
|
|
27
|
+
if (!match || (!match[2] && !match[3]))
|
|
28
|
+
return null;
|
|
29
|
+
const fraction = match[3] ?? '';
|
|
30
|
+
let int = BigInt(`${match[2]}${fraction}` || '0');
|
|
31
|
+
let scale = fraction.length - Number(match[4] ?? 0);
|
|
32
|
+
// A scale no number a person means has: not worth the digits.
|
|
33
|
+
if (Math.abs(scale) > 400)
|
|
34
|
+
return null;
|
|
35
|
+
if (scale < 0) {
|
|
36
|
+
int *= pow10(-scale);
|
|
37
|
+
scale = 0;
|
|
38
|
+
}
|
|
39
|
+
return normalise(match[1] === '-' ? -int : int, scale);
|
|
40
|
+
}
|
|
41
|
+
/** A number as the decimal its shortest text names (0.1 is one tenth, not the binary fraction nearest to it); null for what is not a finite number. */
|
|
42
|
+
export const decimalOf = (value) => (Number.isFinite(value) ? decimalFromString(String(value)) : null);
|
|
43
|
+
/** The digits of a decimal's magnitude: before the separator, and after it. */
|
|
44
|
+
function digitsOf({ int, scale }) {
|
|
45
|
+
const negative = int < 0n;
|
|
46
|
+
const digits = (negative ? -int : int).toString().padStart(scale + 1, '0');
|
|
47
|
+
return { negative, whole: digits.slice(0, digits.length - scale), fraction: scale ? digits.slice(digits.length - scale) : '' };
|
|
48
|
+
}
|
|
49
|
+
/** The plain decimal string of a decimal: ASCII digits and a period, never an exponent, never the locale's form ("12.5"). */
|
|
50
|
+
export function canonical(decimal) {
|
|
51
|
+
const { negative, whole, fraction } = digitsOf(decimal);
|
|
52
|
+
return `${negative ? '-' : ''}${whole}${fraction ? `.${fraction}` : ''}`;
|
|
53
|
+
}
|
|
54
|
+
/** The number a decimal is (the nearest one a JavaScript number can hold). */
|
|
55
|
+
export const numberOf = (decimal) => Number(canonical(decimal));
|
|
56
|
+
/** Two decimals as whole numbers of one unit. */
|
|
57
|
+
function aligned(a, b) {
|
|
58
|
+
const scale = Math.max(a.scale, b.scale);
|
|
59
|
+
return [a.int * pow10(scale - a.scale), b.int * pow10(scale - b.scale), scale];
|
|
60
|
+
}
|
|
61
|
+
export function compare(a, b) {
|
|
62
|
+
const [x, y] = aligned(a, b);
|
|
63
|
+
return x < y ? -1 : x > y ? 1 : 0;
|
|
64
|
+
}
|
|
65
|
+
export const times = (decimal, factor) => normalise(decimal.int * BigInt(factor), decimal.scale);
|
|
66
|
+
/** NMI-20: held within the limits — raised to `min`, lowered to `max` — where each is given. */
|
|
67
|
+
export function clamp(decimal, min, max) {
|
|
68
|
+
if (min && compare(decimal, min) < 0)
|
|
69
|
+
return min;
|
|
70
|
+
if (max && compare(decimal, max) > 0)
|
|
71
|
+
return max;
|
|
72
|
+
return decimal;
|
|
73
|
+
}
|
|
74
|
+
/** NMI-20: rounded to `digits` digits after the separator, a half away from zero. */
|
|
75
|
+
export function round(decimal, digits) {
|
|
76
|
+
if (decimal.scale <= digits)
|
|
77
|
+
return decimal;
|
|
78
|
+
const unit = pow10(decimal.scale - digits);
|
|
79
|
+
const negative = decimal.int < 0n;
|
|
80
|
+
const magnitude = negative ? -decimal.int : decimal.int;
|
|
81
|
+
const rounded = (magnitude + unit / 2n) / unit;
|
|
82
|
+
return normalise(negative ? -rounded : rounded, digits);
|
|
83
|
+
}
|
|
84
|
+
const floorDivide = (a, b) => (a >= 0n ? a / b : -((-a + b - 1n) / b));
|
|
85
|
+
const ceilDivide = (a, b) => -floorDivide(-a, b);
|
|
86
|
+
/**
|
|
87
|
+
* NMI-22: the next number from `from`, in `direction`, that is `base` plus a whole multiple of `amount` (which is above
|
|
88
|
+
* zero) — so a number between two such numbers goes to the nearer one in that direction, and not past it.
|
|
89
|
+
*/
|
|
90
|
+
export function stepped(from, base, amount, direction) {
|
|
91
|
+
const scale = Math.max(from.scale, base.scale, amount.scale);
|
|
92
|
+
const unit = (decimal) => decimal.int * pow10(scale - decimal.scale);
|
|
93
|
+
const offset = unit(from) - unit(base);
|
|
94
|
+
const size = unit(amount);
|
|
95
|
+
const multiple = direction > 0 ? floorDivide(offset, size) + 1n : ceilDivide(offset, size) - 1n;
|
|
96
|
+
return normalise(unit(base) + multiple * size, scale);
|
|
97
|
+
}
|
|
98
|
+
/** Characters that carry a direction and nothing else: they are no part of a number. */
|
|
99
|
+
const DIRECTION_MARKS = /[--]/gu;
|
|
100
|
+
const forms = new Map();
|
|
101
|
+
/** The form of a locale `Intl` knows (a tag `supportedLocale()` of src/primitives/locale-date.ts returned). */
|
|
102
|
+
export function numberForm(locale) {
|
|
103
|
+
let form = forms.get(locale);
|
|
104
|
+
if (!form) {
|
|
105
|
+
const plain = new Intl.NumberFormat(locale, { useGrouping: false, maximumFractionDigits: 0 });
|
|
106
|
+
const parts = new Intl.NumberFormat(locale, { useGrouping: true, minimumFractionDigits: 1 }).formatToParts(-1234567.5);
|
|
107
|
+
const part = (type) => parts.find((p) => p.type === type)?.value ?? '';
|
|
108
|
+
form = {
|
|
109
|
+
digits: Array.from({ length: 10 }, (_, digit) => plain.format(digit)),
|
|
110
|
+
decimal: part('decimal') || '.',
|
|
111
|
+
group: part('group'),
|
|
112
|
+
minus: part('minusSign').replace(DIRECTION_MARKS, '') || '-',
|
|
113
|
+
};
|
|
114
|
+
forms.set(locale, form);
|
|
115
|
+
}
|
|
116
|
+
return form;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* NMI-17: the number in the locale's form — its digits and its decimal separator, its minus sign before a negative
|
|
120
|
+
* number, at least `minDigits` and at most `maxDigits` digits after the separator with no other trailing zeros, no
|
|
121
|
+
* exponent and no grouping separators: what is shown can be typed back.
|
|
122
|
+
*/
|
|
123
|
+
export function format(decimal, form, minDigits, maxDigits) {
|
|
124
|
+
const { negative, whole, fraction } = digitsOf(round(decimal, maxDigits));
|
|
125
|
+
const local = (digits) => Array.from(digits, (digit) => form.digits[Number(digit)]).join('');
|
|
126
|
+
const shown = fraction.padEnd(minDigits, '0');
|
|
127
|
+
// A number that rounds to zero is written without a sign.
|
|
128
|
+
const signed = negative && /[1-9]/.test(whole + shown);
|
|
129
|
+
return `${signed ? form.minus : ''}${local(whole)}${shown ? `${form.decimal}${local(shown)}` : ''}`;
|
|
130
|
+
}
|
|
131
|
+
const EMPTY = { kind: 'empty' };
|
|
132
|
+
const INVALID = { kind: 'invalid' };
|
|
133
|
+
/** A hyphen-minus, a minus sign, and their full-width and small forms; a plus sign and its full-width form. */
|
|
134
|
+
const MINUS = new Set(['-', '−', '-', '﹣']);
|
|
135
|
+
const PLUS = new Set(['+', '+']);
|
|
136
|
+
/**
|
|
137
|
+
* The zeros of the scripts whose ten digits stand in a row: ASCII, full-width, and the decimal digits a person's
|
|
138
|
+
* keyboard may give whatever the product's locale is (Arabic-Indic and its eastern form, Devanagari, Bengali, Gurmukhi,
|
|
139
|
+
* Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, Tibetan, Myanmar, Khmer, Mongolian). A digit is a
|
|
140
|
+
* digit in every locale: reading one is no guess.
|
|
141
|
+
*/
|
|
142
|
+
const ZEROS = [0x30, 0xff10, 0x660, 0x6f0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xbe6, 0xc66, 0xce6, 0xd66, 0xe50, 0xed0, 0xf20, 0x1040, 0x17e0, 0x1810];
|
|
143
|
+
function digitOf(character, form) {
|
|
144
|
+
const own = form.digits.indexOf(character);
|
|
145
|
+
if (own >= 0)
|
|
146
|
+
return own;
|
|
147
|
+
const code = character.codePointAt(0);
|
|
148
|
+
for (const zero of ZEROS)
|
|
149
|
+
if (code >= zero && code <= zero + 9)
|
|
150
|
+
return code - zero;
|
|
151
|
+
return -1;
|
|
152
|
+
}
|
|
153
|
+
/** A character and its full-width form are one character to a reader of numbers. */
|
|
154
|
+
const narrow = (character) => character.normalize('NFKC');
|
|
155
|
+
/** Without the marks of direction and without spaces — around the number or inside it. */
|
|
156
|
+
const squeeze = (text) => text.replace(DIRECTION_MARKS, '').replace(/\s+/gu, '');
|
|
157
|
+
/** Whether `text` begins (or, `end`, ends) with `affix`, compared as written and then without regard to case. */
|
|
158
|
+
function hasAffix(text, affix, end) {
|
|
159
|
+
if (!affix || affix.length > text.length)
|
|
160
|
+
return false;
|
|
161
|
+
const piece = end ? text.slice(text.length - affix.length) : text.slice(0, affix.length);
|
|
162
|
+
return piece === affix || piece.toLowerCase() === affix.toLowerCase();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* NMI-18: reads a text as a number, leniently, by the locale's form.
|
|
166
|
+
*
|
|
167
|
+
* - Spaces, around the number and inside it, and marks of direction are ignored.
|
|
168
|
+
* - A hyphen-minus or a minus sign before the digits, or a plus sign, is its sign — before or after a prefix.
|
|
169
|
+
* - `prefix` before the number and `suffix` after it are ignored where they were typed or pasted with it.
|
|
170
|
+
* - ASCII digits, the locale's own, full-width digits and the decimal digits of other scripts are digits.
|
|
171
|
+
* - The locale's decimal separator, once, is the separator. So is a period, the separator of a plain decimal number,
|
|
172
|
+
* wherever the locale does not group with it: a period in a locale that groups with periods is a grouping separator
|
|
173
|
+
* ("1.500" is 1500 in German), and never a guess.
|
|
174
|
+
* - The locale's grouping separator is ignored wherever it stands between two digits before the separator.
|
|
175
|
+
* - An empty text, or one of spaces only, is no value. Anything else is not a number.
|
|
176
|
+
*/
|
|
177
|
+
export function read(text, form, affixes = {}) {
|
|
178
|
+
let rest = squeeze(text);
|
|
179
|
+
if (!rest)
|
|
180
|
+
return EMPTY;
|
|
181
|
+
let negative = false;
|
|
182
|
+
let signed = false;
|
|
183
|
+
const sign = () => {
|
|
184
|
+
const first = rest[0];
|
|
185
|
+
if (signed || !(MINUS.has(first) || PLUS.has(first)))
|
|
186
|
+
return;
|
|
187
|
+
signed = true;
|
|
188
|
+
negative = MINUS.has(first);
|
|
189
|
+
rest = rest.slice(1);
|
|
190
|
+
};
|
|
191
|
+
sign();
|
|
192
|
+
const prefix = squeeze(affixes.prefix ?? '');
|
|
193
|
+
const suffix = squeeze(affixes.suffix ?? '');
|
|
194
|
+
if (hasAffix(rest, prefix, false))
|
|
195
|
+
rest = rest.slice(prefix.length);
|
|
196
|
+
sign();
|
|
197
|
+
if (hasAffix(rest, suffix, true))
|
|
198
|
+
rest = rest.slice(0, rest.length - suffix.length);
|
|
199
|
+
const group = narrow(form.group);
|
|
200
|
+
const decimal = narrow(form.decimal);
|
|
201
|
+
const isDecimal = (character) => character === form.decimal || narrow(character) === decimal || (narrow(character) === '.' && group !== '.');
|
|
202
|
+
const isGroup = (character) => !!group && (character === form.group || narrow(character) === group || (form.group === '’' && character === "'"));
|
|
203
|
+
const characters = Array.from(rest);
|
|
204
|
+
let whole = '';
|
|
205
|
+
let fraction = '';
|
|
206
|
+
let separated = false;
|
|
207
|
+
for (let index = 0; index < characters.length; index++) {
|
|
208
|
+
const character = characters[index];
|
|
209
|
+
const digit = digitOf(character, form);
|
|
210
|
+
if (digit >= 0) {
|
|
211
|
+
if (separated)
|
|
212
|
+
fraction += digit;
|
|
213
|
+
else
|
|
214
|
+
whole += digit;
|
|
215
|
+
}
|
|
216
|
+
else if (!separated && isGroup(character) && index > 0 && digitOf(characters[index - 1], form) >= 0 && index + 1 < characters.length && digitOf(characters[index + 1], form) >= 0) {
|
|
217
|
+
// A grouping separator between two digits says nothing.
|
|
218
|
+
}
|
|
219
|
+
else if (!separated && isDecimal(character))
|
|
220
|
+
separated = true;
|
|
221
|
+
else
|
|
222
|
+
return INVALID;
|
|
223
|
+
}
|
|
224
|
+
if (!whole && !fraction)
|
|
225
|
+
return INVALID;
|
|
226
|
+
const magnitude = BigInt(whole + fraction);
|
|
227
|
+
const value = normalise(negative ? -magnitude : magnitude, fraction.length);
|
|
228
|
+
return Number.isFinite(numberOf(value)) ? { kind: 'number', value } : INVALID;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=number-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-text.js","sourceRoot":"","sources":["../../../src/components/number-input/number-text.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,mFAAmF;AACnF,EAAE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;QAAE,OAAO,OAAO,CAAC;IACxC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type PropertyDeclarations } from 'lit';
|
|
2
|
+
import { ComposedControl, type ValueMember } from '../../primitives/composed.js';
|
|
3
|
+
import { type TanreiFieldRequiredMark, type TanreiFieldRequirement } from '../field/field.js';
|
|
4
|
+
import { type TanreiOneTimeCodeInputDetail, type TanreiOneTimeCodeInputType } from '../one-time-code-input/one-time-code-input.js';
|
|
5
|
+
export type { TanreiFieldRequiredMark, TanreiFieldRequirement, TanreiOneTimeCodeInputDetail, TanreiOneTimeCodeInputType };
|
|
6
|
+
/**
|
|
7
|
+
* Asks for a short code sent to the person as one complete field. Built from a Field (`<tanrei-field>`) and the
|
|
8
|
+
* One-time-code input (`<tanrei-one-time-code-input>`) it frames: the input under the Field's label, with the Field's
|
|
9
|
+
* help and its error, tied together for assistive technology and taking part in a form as one control.
|
|
10
|
+
*
|
|
11
|
+
* Contract: specs/one-time-code-field.spec.json. `<tanrei-one-time-code-field name="code" label="Verification code"
|
|
12
|
+
* supporting-text="Enter the 6-digit code we sent to your phone." group-size="3"></tanrei-one-time-code-field>`.
|
|
13
|
+
*
|
|
14
|
+
* Composed (`src/primitives/composed.ts`): its shadow root holds the two members' own elements and nothing
|
|
15
|
+
* else, so it draws nothing of its own and has no token — every `--tanrei-comp-field-*` and
|
|
16
|
+
* `--tanrei-comp-one-time-code-input-*` value reaches the members by inheritance, and one instance is set apart by
|
|
17
|
+
* setting such a property on this element. Each property is its member's, set on that member unchanged. One level
|
|
18
|
+
* down, the same by hand: `<tanrei-field label="Verification code"><tanrei-one-time-code-input name="code"
|
|
19
|
+
* group-size="3"></tanrei-one-time-code-input></tanrei-field>` — for something of the product's own inside the frame.
|
|
20
|
+
*
|
|
21
|
+
* `value` is at every moment the One-time-code input's, and the four events are that input's own, with this element
|
|
22
|
+
* as their target: `event.target.value` is the code in every listener. It dispatches none itself.
|
|
23
|
+
*
|
|
24
|
+
* Form-associated: it submits the code under `name` — nothing while disabled —, resets to its `value` attribute, is
|
|
25
|
+
* restored on navigation, follows a disabled `<fieldset>`, and reports a missing value while `requirement` is
|
|
26
|
+
* `required` and it is empty. Enter in the cells presses the default button of this element's form.
|
|
27
|
+
*
|
|
28
|
+
* The element is not focusable itself and has no role: `focus()` goes to the cells, and its name is `label` (with
|
|
29
|
+
* `label-hidden` where it is not drawn), never `aria-label`.
|
|
30
|
+
*
|
|
31
|
+
* @tag tanrei-one-time-code-field
|
|
32
|
+
* @slot label-icon - => tanrei-field
|
|
33
|
+
* @csspart field - The frame: the `<tanrei-field>` it is built from.
|
|
34
|
+
* @csspart one-time-code-input - The control: the `<tanrei-one-time-code-input>` it is built from.
|
|
35
|
+
* @exportparts tanrei-field -counter, -value-text
|
|
36
|
+
* @exportparts tanrei-one-time-code-input
|
|
37
|
+
* @attr {string} form - The id of the form the one-time-code field 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.
|
|
38
|
+
* @fires input - => tanrei-one-time-code-input
|
|
39
|
+
* @fires change - => tanrei-one-time-code-input
|
|
40
|
+
* @fires complete - => tanrei-one-time-code-input
|
|
41
|
+
* @fires action - => tanrei-one-time-code-input
|
|
42
|
+
*/
|
|
43
|
+
export declare class TanreiOneTimeCodeField extends ComposedControl<string> {
|
|
44
|
+
/** OTF-4: the one control the form meets. Its members stand in its shadow root, outside every form. */
|
|
45
|
+
static formAssociated: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Its parts, once: the two members and what each exports.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
static readonly parts: readonly string[];
|
|
52
|
+
static properties: PropertyDeclarations;
|
|
53
|
+
/** @from tanrei-field.label */
|
|
54
|
+
label: string;
|
|
55
|
+
/** @from tanrei-field.labelHidden */
|
|
56
|
+
labelHidden: boolean;
|
|
57
|
+
/** @from tanrei-field.supportingText */
|
|
58
|
+
supportingText: string;
|
|
59
|
+
/** @from tanrei-field.errorText */
|
|
60
|
+
errorText: string;
|
|
61
|
+
/** @from tanrei-field.error */
|
|
62
|
+
error: boolean;
|
|
63
|
+
/** @from tanrei-field.disabled */
|
|
64
|
+
disabled: boolean;
|
|
65
|
+
/** @from tanrei-field.requirement */
|
|
66
|
+
requirement: TanreiFieldRequirement;
|
|
67
|
+
/** @from tanrei-field.requiredMark */
|
|
68
|
+
requiredMark: TanreiFieldRequiredMark;
|
|
69
|
+
/** @from tanrei-field.requiredText */
|
|
70
|
+
requiredText: string;
|
|
71
|
+
/** @from tanrei-field.optionalText */
|
|
72
|
+
optionalText: string;
|
|
73
|
+
/** @from tanrei-one-time-code-input.value */
|
|
74
|
+
get value(): string;
|
|
75
|
+
set value(value: string);
|
|
76
|
+
/** @from tanrei-one-time-code-input.length */
|
|
77
|
+
length: number;
|
|
78
|
+
/** @from tanrei-one-time-code-input.type */
|
|
79
|
+
type: TanreiOneTimeCodeInputType;
|
|
80
|
+
/** @from tanrei-one-time-code-input.groupSize */
|
|
81
|
+
groupSize: number;
|
|
82
|
+
/** @from tanrei-one-time-code-input.mask */
|
|
83
|
+
mask: boolean;
|
|
84
|
+
/** @from tanrei-one-time-code-input.readOnly */
|
|
85
|
+
readOnly: boolean;
|
|
86
|
+
protected readonly hostNameSentence = "OTF-1";
|
|
87
|
+
protected get valueMember(): ValueMember<string> | null;
|
|
88
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
89
|
+
}
|
|
90
|
+
declare global {
|
|
91
|
+
interface HTMLElementTagNameMap {
|
|
92
|
+
'tanrei-one-time-code-field': TanreiOneTimeCodeField;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { ComposedControl, exported, forward } from '../../primitives/composed.js';
|
|
3
|
+
import { TanreiField } from '../field/field.js';
|
|
4
|
+
import { TanreiOneTimeCodeInput } from '../one-time-code-input/one-time-code-input.js';
|
|
5
|
+
/** OTF-2: the props that are the Field's, given to it unchanged. `disabled` is the Field's too, joined with a disabled fieldset's (W6). */
|
|
6
|
+
const FIELD = ['label', 'labelHidden', 'supportingText', 'errorText', 'error', 'requirement', 'requiredMark', 'requiredText', 'optionalText'];
|
|
7
|
+
/** OTF-2: the props that are the One-time-code input's. Its own `label`, `error` and `disabled` are never set. */
|
|
8
|
+
const INPUT = ['value', 'length', 'type', 'groupSize', 'mask', 'readOnly'];
|
|
9
|
+
/**
|
|
10
|
+
* W4: each member's documented parts, from the member's own list. No name is shared by the two. The Field's `counter`
|
|
11
|
+
* and `value-text` are left out: a one-time-code field gives its Field no count and no value text, so neither part is
|
|
12
|
+
* ever drawn in it.
|
|
13
|
+
*/
|
|
14
|
+
const FIELD_PARTS = exported(TanreiField, {}, ['counter', 'value-text']);
|
|
15
|
+
const INPUT_PARTS = exported(TanreiOneTimeCodeInput);
|
|
16
|
+
/**
|
|
17
|
+
* Asks for a short code sent to the person as one complete field. Built from a Field (`<tanrei-field>`) and the
|
|
18
|
+
* One-time-code input (`<tanrei-one-time-code-input>`) it frames: the input under the Field's label, with the Field's
|
|
19
|
+
* help and its error, tied together for assistive technology and taking part in a form as one control.
|
|
20
|
+
*
|
|
21
|
+
* Contract: specs/one-time-code-field.spec.json. `<tanrei-one-time-code-field name="code" label="Verification code"
|
|
22
|
+
* supporting-text="Enter the 6-digit code we sent to your phone." group-size="3"></tanrei-one-time-code-field>`.
|
|
23
|
+
*
|
|
24
|
+
* Composed (`src/primitives/composed.ts`): its shadow root holds the two members' own elements and nothing
|
|
25
|
+
* else, so it draws nothing of its own and has no token — every `--tanrei-comp-field-*` and
|
|
26
|
+
* `--tanrei-comp-one-time-code-input-*` value reaches the members by inheritance, and one instance is set apart by
|
|
27
|
+
* setting such a property on this element. Each property is its member's, set on that member unchanged. One level
|
|
28
|
+
* down, the same by hand: `<tanrei-field label="Verification code"><tanrei-one-time-code-input name="code"
|
|
29
|
+
* group-size="3"></tanrei-one-time-code-input></tanrei-field>` — for something of the product's own inside the frame.
|
|
30
|
+
*
|
|
31
|
+
* `value` is at every moment the One-time-code input's, and the four events are that input's own, with this element
|
|
32
|
+
* as their target: `event.target.value` is the code in every listener. It dispatches none itself.
|
|
33
|
+
*
|
|
34
|
+
* Form-associated: it submits the code under `name` — nothing while disabled —, resets to its `value` attribute, is
|
|
35
|
+
* restored on navigation, follows a disabled `<fieldset>`, and reports a missing value while `requirement` is
|
|
36
|
+
* `required` and it is empty. Enter in the cells presses the default button of this element's form.
|
|
37
|
+
*
|
|
38
|
+
* The element is not focusable itself and has no role: `focus()` goes to the cells, and its name is `label` (with
|
|
39
|
+
* `label-hidden` where it is not drawn), never `aria-label`.
|
|
40
|
+
*
|
|
41
|
+
* @tag tanrei-one-time-code-field
|
|
42
|
+
* @slot label-icon - => tanrei-field
|
|
43
|
+
* @csspart field - The frame: the `<tanrei-field>` it is built from.
|
|
44
|
+
* @csspart one-time-code-input - The control: the `<tanrei-one-time-code-input>` it is built from.
|
|
45
|
+
* @exportparts tanrei-field -counter, -value-text
|
|
46
|
+
* @exportparts tanrei-one-time-code-input
|
|
47
|
+
* @attr {string} form - The id of the form the one-time-code field 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.
|
|
48
|
+
* @fires input - => tanrei-one-time-code-input
|
|
49
|
+
* @fires change - => tanrei-one-time-code-input
|
|
50
|
+
* @fires complete - => tanrei-one-time-code-input
|
|
51
|
+
* @fires action - => tanrei-one-time-code-input
|
|
52
|
+
*/
|
|
53
|
+
export class TanreiOneTimeCodeField extends ComposedControl {
|
|
54
|
+
constructor() {
|
|
55
|
+
super(...arguments);
|
|
56
|
+
/** @from tanrei-field.label */
|
|
57
|
+
this.label = '';
|
|
58
|
+
/** @from tanrei-field.labelHidden */
|
|
59
|
+
this.labelHidden = false;
|
|
60
|
+
/** @from tanrei-field.supportingText */
|
|
61
|
+
this.supportingText = '';
|
|
62
|
+
/** @from tanrei-field.errorText */
|
|
63
|
+
this.errorText = '';
|
|
64
|
+
/** @from tanrei-field.error */
|
|
65
|
+
this.error = false;
|
|
66
|
+
/** @from tanrei-field.disabled */
|
|
67
|
+
this.disabled = false;
|
|
68
|
+
/** @from tanrei-field.requirement */
|
|
69
|
+
this.requirement = 'none';
|
|
70
|
+
/** @from tanrei-field.requiredMark */
|
|
71
|
+
this.requiredMark = 'auto';
|
|
72
|
+
/** @from tanrei-field.requiredText */
|
|
73
|
+
this.requiredText = '';
|
|
74
|
+
/** @from tanrei-field.optionalText */
|
|
75
|
+
this.optionalText = '';
|
|
76
|
+
/** @from tanrei-one-time-code-input.length */
|
|
77
|
+
this.length = 6;
|
|
78
|
+
/** @from tanrei-one-time-code-input.type */
|
|
79
|
+
this.type = 'numeric';
|
|
80
|
+
/** @from tanrei-one-time-code-input.groupSize */
|
|
81
|
+
this.groupSize = 0;
|
|
82
|
+
/** @from tanrei-one-time-code-input.mask */
|
|
83
|
+
this.mask = false;
|
|
84
|
+
/** @from tanrei-one-time-code-input.readOnly */
|
|
85
|
+
this.readOnly = false;
|
|
86
|
+
this.hostNameSentence = 'OTF-1';
|
|
87
|
+
}
|
|
88
|
+
/** OTF-4: the one control the form meets. Its members stand in its shadow root, outside every form. */
|
|
89
|
+
static { this.formAssociated = true; }
|
|
90
|
+
/**
|
|
91
|
+
* Its parts, once: the two members and what each exports.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
static { this.parts = ['field', 'one-time-code-input', ...FIELD_PARTS.names, ...INPUT_PARTS.names]; }
|
|
96
|
+
static { this.properties = {
|
|
97
|
+
label: { type: String },
|
|
98
|
+
labelHidden: { type: Boolean, attribute: 'label-hidden', reflect: true },
|
|
99
|
+
supportingText: { type: String, attribute: 'supporting-text' },
|
|
100
|
+
errorText: { type: String, attribute: 'error-text' },
|
|
101
|
+
error: { type: Boolean, reflect: true },
|
|
102
|
+
disabled: { type: Boolean, reflect: true },
|
|
103
|
+
requirement: { type: String, reflect: true },
|
|
104
|
+
requiredMark: { type: String, attribute: 'required-mark', reflect: true },
|
|
105
|
+
requiredText: { type: String, attribute: 'required-text' },
|
|
106
|
+
optionalText: { type: String, attribute: 'optional-text' },
|
|
107
|
+
value: { type: String },
|
|
108
|
+
length: { type: Number },
|
|
109
|
+
type: { type: String },
|
|
110
|
+
groupSize: { type: Number, attribute: 'group-size' },
|
|
111
|
+
mask: { type: Boolean, reflect: true },
|
|
112
|
+
readOnly: { type: Boolean, attribute: 'readonly', reflect: true },
|
|
113
|
+
}; }
|
|
114
|
+
/** @from tanrei-one-time-code-input.value */
|
|
115
|
+
get value() {
|
|
116
|
+
return this.memberValue('');
|
|
117
|
+
}
|
|
118
|
+
set value(value) {
|
|
119
|
+
this.giveValue(value);
|
|
120
|
+
}
|
|
121
|
+
get valueMember() {
|
|
122
|
+
return this.renderRoot?.querySelector('tanrei-one-time-code-input') ?? null;
|
|
123
|
+
}
|
|
124
|
+
// OTF-1: a Field whose one control is a One-time-code input, exactly as a product writes the two — and nothing else
|
|
125
|
+
// but the passage of the Field's label glyph (OTF-6). No text stands between the tags: the Field's control is its
|
|
126
|
+
// one child.
|
|
127
|
+
render() {
|
|
128
|
+
return html `<tanrei-field part="field" exportparts=${FIELD_PARTS.attribute} ${forward(this, FIELD)} .disabled=${this.disabled || this.formDisabled}
|
|
129
|
+
>${this.pass('label-icon')}<tanrei-one-time-code-input part="one-time-code-input" exportparts=${INPUT_PARTS.attribute} ${forward(this, INPUT)}></tanrei-one-time-code-input
|
|
130
|
+
></tanrei-field>`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (!customElements.get('tanrei-one-time-code-field'))
|
|
134
|
+
customElements.define('tanrei-one-time-code-field', TanreiOneTimeCodeField);
|
|
135
|
+
//# sourceMappingURL=one-time-code-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-time-code-field.js","sourceRoot":"","sources":["../../../src/components/one-time-code-field/one-time-code-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,IAAI,EAAE,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,eAAe,EAAoB,QAAQ,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,EAAE,WAAW,EAA6D,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAsE,MAAM,+CAA+C,CAAC;AAK3J,2IAA2I;AAC3I,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAU,CAAC;AACvJ,kHAAkH;AAClH,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAEpF;;;;GAIG;AACH,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AACzE,MAAM,WAAW,GAAG,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAuB;IAAnE;;QA8BE,+BAA+B;QAC/B,UAAK,GAAG,EAAE,CAAC;QAEX,qCAAqC;QACr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I,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,cAAc,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,YAAY;SAC7I,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,sEAAsE,WAAW,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;qBAC9H,CAAC;IACpB,CAAC;CACF;AAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,4BAA4B,CAAC;IAAE,cAAc,CAAC,MAAM,CAAC,4BAA4B,EAAE,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** What a cell takes (OTC-4): the digits 0 to 9, or those and the letters A to Z. */
|
|
2
|
+
export type CodeType = 'numeric' | 'alphanumeric';
|
|
3
|
+
/** The value, the active cell, and whether the whole value is selected (OTC-5, OTC-10). */
|
|
4
|
+
export interface CodeState {
|
|
5
|
+
value: string;
|
|
6
|
+
/** The cell the next character goes to: 0 … the first empty cell, or the last cell while all are filled. */
|
|
7
|
+
active: number;
|
|
8
|
+
/** The platform's select all was used: every filled cell is drawn active, and the next edit acts on the whole value. */
|
|
9
|
+
all: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* OTC-4: one character as the field reads it — a decimal digit of any script and a full-width digit or letter as its
|
|
13
|
+
* ASCII form, a lower-case letter as its upper-case form — or `null` where the type does not permit it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function readCharacter(char: string, type: CodeType): string | null;
|
|
16
|
+
/** The permitted characters of `text`, each read by OTC-4, in order; what is not permitted is dropped. */
|
|
17
|
+
export declare function readPermitted(text: string, type: CodeType): string;
|
|
18
|
+
/** OTC-18, OTC-19: a value the product set as the field holds it, and whether anything of it was dropped. */
|
|
19
|
+
export declare function readValue(text: string, length: number, type: CodeType): {
|
|
20
|
+
value: string;
|
|
21
|
+
dropped: boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* OTC-11: a whole text — pasted, dropped, dictated or given by autofill — read as one code, or `null` where it holds
|
|
25
|
+
* none. White space, hyphens and dashes go; if every remaining character is permitted (and there is one) the code is
|
|
26
|
+
* the first `length` of them. Otherwise, for digits only, the text is searched: exactly one run of exactly `length`
|
|
27
|
+
* digits that no other digit adjoins is the code ("Your code is 123456."). Anything else is no code.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readCode(text: string, length: number, type: CodeType): string | null;
|
|
30
|
+
/** OTC-5: the furthest cell that can be active — the first empty cell, or the last cell while all are filled. */
|
|
31
|
+
export declare const furthest: (value: string, length: number) => number;
|
|
32
|
+
/** The state with its active cell brought inside what the value allows. */
|
|
33
|
+
export declare const settle: (state: CodeState, length: number) => CodeState;
|
|
34
|
+
/**
|
|
35
|
+
* OTC-6, OTC-10: one permitted character typed — it stands in the active cell, in place of what the cell holds, and the
|
|
36
|
+
* active cell moves on (it stays on the last); typed over a selected value it replaces the whole value.
|
|
37
|
+
*/
|
|
38
|
+
export declare function typeCharacter(state: CodeState, char: string, length: number): CodeState;
|
|
39
|
+
/** Characters typed one after another (OTC-6: text an input method commits is read character by character). */
|
|
40
|
+
export declare function typeText(state: CodeState, text: string, length: number): CodeState;
|
|
41
|
+
/**
|
|
42
|
+
* OTC-9, OTC-10: Backspace — a filled active cell loses its character and stays active; an empty one loses the
|
|
43
|
+
* character before it and the active cell moves there; a selected value is emptied. The rest closes the gap.
|
|
44
|
+
*/
|
|
45
|
+
export declare function removeBackward(state: CodeState, length: number): CodeState;
|
|
46
|
+
/** OTC-9, OTC-10: Delete — the active cell loses its character; a selected value is emptied. */
|
|
47
|
+
export declare function removeForward(state: CodeState, length: number): CodeState;
|
|
48
|
+
/** The platform's removal of a word or a line: everything before the active cell, or everything from it on. */
|
|
49
|
+
export declare function removeRun(state: CodeState, direction: 'backward' | 'forward', length: number): CodeState;
|
|
50
|
+
/** OTC-11, OTC-18: a whole value taken at once; the active cell is the first empty cell, or the last. */
|
|
51
|
+
export declare const replaceAll: (value: string, length: number) => CodeState;
|