@slotted/angular 0.0.0-stage → 0.1.0-beta.1
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 +21 -0
- package/README.md +51 -2
- package/docs/AGENTS.snippet.md +10 -0
- package/docs/accordion.json +345 -0
- package/docs/accordion.md +207 -0
- package/docs/action-bar.json +421 -0
- package/docs/action-bar.md +364 -0
- package/docs/action-sheet.json +210 -0
- package/docs/action-sheet.md +19 -0
- package/docs/alert.json +407 -0
- package/docs/alert.md +239 -0
- package/docs/app-shell.examples.md +349 -0
- package/docs/app-shell.json +835 -0
- package/docs/app-shell.md +214 -0
- package/docs/aspect-ratio.json +159 -0
- package/docs/aspect-ratio.md +134 -0
- package/docs/attachment.json +486 -0
- package/docs/attachment.md +253 -0
- package/docs/avatar-group.json +208 -0
- package/docs/avatar-group.md +130 -0
- package/docs/avatar.json +342 -0
- package/docs/avatar.md +142 -0
- package/docs/badge.json +334 -0
- package/docs/badge.md +138 -0
- package/docs/breadcrumb.json +368 -0
- package/docs/breadcrumb.md +237 -0
- package/docs/button-group.json +158 -0
- package/docs/button-group.md +72 -0
- package/docs/button.examples.md +621 -0
- package/docs/button.json +977 -0
- package/docs/button.md +200 -0
- package/docs/calendar.json +592 -0
- package/docs/calendar.md +242 -0
- package/docs/card.json +283 -0
- package/docs/card.md +130 -0
- package/docs/carousel.json +560 -0
- package/docs/carousel.md +357 -0
- package/docs/cascader.json +933 -0
- package/docs/cascader.md +379 -0
- package/docs/chart.examples.md +582 -0
- package/docs/chart.json +1359 -0
- package/docs/chart.md +187 -0
- package/docs/checkbox-group.examples.md +612 -0
- package/docs/checkbox-group.json +395 -0
- package/docs/checkbox-group.md +106 -0
- package/docs/checkbox.examples.md +546 -0
- package/docs/checkbox.json +506 -0
- package/docs/checkbox.md +104 -0
- package/docs/code-block.json +616 -0
- package/docs/code-block.md +303 -0
- package/docs/collapsible.json +456 -0
- package/docs/collapsible.md +261 -0
- package/docs/color-picker.json +523 -0
- package/docs/color-picker.md +201 -0
- package/docs/column-manager.json +486 -0
- package/docs/column-manager.md +277 -0
- package/docs/combobox.examples.md +1732 -0
- package/docs/combobox.json +1250 -0
- package/docs/combobox.md +209 -0
- package/docs/command-palette.json +800 -0
- package/docs/command-palette.md +419 -0
- package/docs/container.json +156 -0
- package/docs/container.md +92 -0
- package/docs/context-menu.json +231 -0
- package/docs/context-menu.md +176 -0
- package/docs/currency-field.examples.md +321 -0
- package/docs/currency-field.json +649 -0
- package/docs/currency-field.md +128 -0
- package/docs/dashboard-grid.json +680 -0
- package/docs/dashboard-grid.md +265 -0
- package/docs/data-grid.examples.md +3064 -0
- package/docs/data-grid.json +1577 -0
- package/docs/data-grid.md +237 -0
- package/docs/data-grid.props.md +81 -0
- package/docs/data-list.json +685 -0
- package/docs/data-list.md +327 -0
- package/docs/date-field.json +490 -0
- package/docs/date-field.md +235 -0
- package/docs/date-picker.examples.md +1226 -0
- package/docs/date-picker.json +696 -0
- package/docs/date-picker.md +121 -0
- package/docs/date-range-picker.examples.md +1300 -0
- package/docs/date-range-picker.json +903 -0
- package/docs/date-range-picker.md +142 -0
- package/docs/datetime-field.json +665 -0
- package/docs/datetime-field.md +337 -0
- package/docs/datetime-picker.examples.md +1269 -0
- package/docs/datetime-picker.json +928 -0
- package/docs/datetime-picker.md +150 -0
- package/docs/datetime-range-picker.examples.md +225 -0
- package/docs/datetime-range-picker.json +1015 -0
- package/docs/datetime-range-picker.md +162 -0
- package/docs/description-list.json +471 -0
- package/docs/description-list.md +268 -0
- package/docs/detail-panel.json +530 -0
- package/docs/detail-panel.md +361 -0
- package/docs/dialog.examples.md +2467 -0
- package/docs/dialog.json +1141 -0
- package/docs/dialog.md +217 -0
- package/docs/dialog.props.md +63 -0
- package/docs/divider.json +148 -0
- package/docs/divider.md +83 -0
- package/docs/drawer.examples.md +1929 -0
- package/docs/drawer.json +753 -0
- package/docs/drawer.md +199 -0
- package/docs/entity-picker.json +946 -0
- package/docs/entity-picker.md +365 -0
- package/docs/event-calendar.examples.md +308 -0
- package/docs/event-calendar.json +1202 -0
- package/docs/event-calendar.md +201 -0
- package/docs/field-group.json +333 -0
- package/docs/field-group.md +181 -0
- package/docs/field.examples.md +676 -0
- package/docs/field.json +528 -0
- package/docs/field.md +127 -0
- package/docs/filter-bar.json +817 -0
- package/docs/filter-bar.md +380 -0
- package/docs/form.json +378 -0
- package/docs/form.md +235 -0
- package/docs/fullscreen.json +395 -0
- package/docs/fullscreen.md +225 -0
- package/docs/grid.json +176 -0
- package/docs/grid.md +74 -0
- package/docs/highlight.json +279 -0
- package/docs/highlight.md +210 -0
- package/docs/hover-card.json +254 -0
- package/docs/hover-card.md +213 -0
- package/docs/icon.json +173 -0
- package/docs/icon.md +101 -0
- package/docs/image.json +476 -0
- package/docs/image.md +254 -0
- package/docs/import-export-center.json +836 -0
- package/docs/import-export-center.md +345 -0
- package/docs/index.md +141 -0
- package/docs/inline-message.json +312 -0
- package/docs/inline-message.md +191 -0
- package/docs/inline.json +149 -0
- package/docs/inline.md +72 -0
- package/docs/kbd.json +350 -0
- package/docs/kbd.md +210 -0
- package/docs/link.json +264 -0
- package/docs/link.md +167 -0
- package/docs/list-item.json +463 -0
- package/docs/list-item.md +236 -0
- package/docs/list.json +321 -0
- package/docs/list.md +185 -0
- package/docs/listbox.json +807 -0
- package/docs/listbox.md +413 -0
- package/docs/loading-overlay.json +440 -0
- package/docs/loading-overlay.md +248 -0
- package/docs/markdown.json +461 -0
- package/docs/markdown.md +266 -0
- package/docs/menu.examples.md +1651 -0
- package/docs/menu.json +922 -0
- package/docs/menu.md +155 -0
- package/docs/menubar.json +292 -0
- package/docs/menubar.md +173 -0
- package/docs/message-scroller.json +401 -0
- package/docs/message-scroller.md +212 -0
- package/docs/message.json +862 -0
- package/docs/message.md +473 -0
- package/docs/multi-select.examples.md +1922 -0
- package/docs/multi-select.json +1314 -0
- package/docs/multi-select.md +213 -0
- package/docs/navigation-menu.json +529 -0
- package/docs/navigation-menu.md +329 -0
- package/docs/notification-center.json +664 -0
- package/docs/notification-center.md +372 -0
- package/docs/number-field.examples.md +1078 -0
- package/docs/number-field.json +668 -0
- package/docs/number-field.md +137 -0
- package/docs/otp-input.json +479 -0
- package/docs/otp-input.md +291 -0
- package/docs/page-header.json +574 -0
- package/docs/page-header.md +338 -0
- package/docs/page.json +332 -0
- package/docs/page.md +184 -0
- package/docs/pagination.json +434 -0
- package/docs/pagination.md +238 -0
- package/docs/popover.examples.md +1235 -0
- package/docs/popover.json +656 -0
- package/docs/popover.md +199 -0
- package/docs/progress-indicator.json +501 -0
- package/docs/progress-indicator.md +329 -0
- package/docs/prompt-composer.json +498 -0
- package/docs/prompt-composer.md +278 -0
- package/docs/prose.json +357 -0
- package/docs/prose.md +226 -0
- package/docs/radio-group.examples.md +626 -0
- package/docs/radio-group.json +541 -0
- package/docs/radio-group.md +112 -0
- package/docs/rating.json +1053 -0
- package/docs/rating.md +435 -0
- package/docs/result-state.json +376 -0
- package/docs/result-state.md +286 -0
- package/docs/saved-views.json +384 -0
- package/docs/saved-views.md +242 -0
- package/docs/scroll-area.json +120 -0
- package/docs/scroll-area.md +8 -0
- package/docs/section.json +344 -0
- package/docs/section.md +208 -0
- package/docs/segmented-control.json +429 -0
- package/docs/segmented-control.md +240 -0
- package/docs/select.examples.md +1214 -0
- package/docs/select.json +1147 -0
- package/docs/select.md +199 -0
- package/docs/side-navigation.json +632 -0
- package/docs/side-navigation.md +430 -0
- package/docs/skeleton.json +358 -0
- package/docs/skeleton.md +223 -0
- package/docs/slider.json +522 -0
- package/docs/slider.md +261 -0
- package/docs/sparkline.json +426 -0
- package/docs/sparkline.md +206 -0
- package/docs/split-button.json +361 -0
- package/docs/split-button.md +275 -0
- package/docs/splitter.json +142 -0
- package/docs/splitter.md +14 -0
- package/docs/stack.json +135 -0
- package/docs/stack.md +74 -0
- package/docs/stat-card.json +529 -0
- package/docs/stat-card.md +270 -0
- package/docs/status-indicator.json +314 -0
- package/docs/status-indicator.md +197 -0
- package/docs/stepper.json +451 -0
- package/docs/stepper.md +250 -0
- package/docs/switch.json +451 -0
- package/docs/switch.md +508 -0
- package/docs/table-of-contents.json +553 -0
- package/docs/table-of-contents.md +289 -0
- package/docs/table.examples.md +1981 -0
- package/docs/table.json +1059 -0
- package/docs/table.md +290 -0
- package/docs/tabs.examples.md +1370 -0
- package/docs/tabs.json +661 -0
- package/docs/tabs.md +211 -0
- package/docs/tag.json +813 -0
- package/docs/tag.md +241 -0
- package/docs/tags-input.json +771 -0
- package/docs/tags-input.md +361 -0
- package/docs/text-field.examples.md +821 -0
- package/docs/text-field.json +604 -0
- package/docs/text-field.md +125 -0
- package/docs/textarea.examples.md +612 -0
- package/docs/textarea.json +440 -0
- package/docs/textarea.md +98 -0
- package/docs/time-field.json +584 -0
- package/docs/time-field.md +291 -0
- package/docs/time-picker.json +679 -0
- package/docs/time-picker.md +315 -0
- package/docs/time-range-picker.examples.md +191 -0
- package/docs/time-range-picker.json +924 -0
- package/docs/time-range-picker.md +152 -0
- package/docs/timeline.json +839 -0
- package/docs/timeline.md +401 -0
- package/docs/toast.json +642 -0
- package/docs/toast.md +311 -0
- package/docs/toggle-group.json +417 -0
- package/docs/toggle-group.md +255 -0
- package/docs/toggle.json +326 -0
- package/docs/toggle.md +222 -0
- package/docs/toolbar.json +380 -0
- package/docs/toolbar.md +240 -0
- package/docs/tooltip.examples.md +664 -0
- package/docs/tooltip.json +604 -0
- package/docs/tooltip.md +146 -0
- package/docs/top-navigation.examples.md +287 -0
- package/docs/top-navigation.json +648 -0
- package/docs/top-navigation.md +138 -0
- package/docs/tour.json +759 -0
- package/docs/tour.md +337 -0
- package/docs/transfer.json +746 -0
- package/docs/transfer.md +273 -0
- package/docs/tree.json +918 -0
- package/docs/tree.md +397 -0
- package/docs/typography.json +317 -0
- package/docs/typography.md +107 -0
- package/docs/upload.examples.md +358 -0
- package/docs/upload.json +1103 -0
- package/docs/upload.md +166 -0
- package/docs/visually-hidden.json +71 -0
- package/docs/visually-hidden.md +42 -0
- package/docs/wizard.json +724 -0
- package/docs/wizard.md +295 -0
- package/fesm2022/slotted-angular-accordion.mjs +247 -0
- package/fesm2022/slotted-angular-accordion.mjs.map +1 -0
- package/fesm2022/slotted-angular-action-bar.mjs +639 -0
- package/fesm2022/slotted-angular-action-bar.mjs.map +1 -0
- package/fesm2022/slotted-angular-action-sheet.mjs +749 -0
- package/fesm2022/slotted-angular-action-sheet.mjs.map +1 -0
- package/fesm2022/slotted-angular-alert.mjs +427 -0
- package/fesm2022/slotted-angular-alert.mjs.map +1 -0
- package/fesm2022/slotted-angular-app-shell.mjs +1334 -0
- package/fesm2022/slotted-angular-app-shell.mjs.map +1 -0
- package/fesm2022/slotted-angular-aspect-ratio.mjs +63 -0
- package/fesm2022/slotted-angular-aspect-ratio.mjs.map +1 -0
- package/fesm2022/slotted-angular-attachment.mjs +595 -0
- package/fesm2022/slotted-angular-attachment.mjs.map +1 -0
- package/fesm2022/slotted-angular-avatar-group.mjs +230 -0
- package/fesm2022/slotted-angular-avatar-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-avatar.mjs +330 -0
- package/fesm2022/slotted-angular-avatar.mjs.map +1 -0
- package/fesm2022/slotted-angular-badge.mjs +255 -0
- package/fesm2022/slotted-angular-badge.mjs.map +1 -0
- package/fesm2022/slotted-angular-breadcrumb.mjs +544 -0
- package/fesm2022/slotted-angular-breadcrumb.mjs.map +1 -0
- package/fesm2022/slotted-angular-button-group.mjs +146 -0
- package/fesm2022/slotted-angular-button-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-button.mjs +692 -0
- package/fesm2022/slotted-angular-button.mjs.map +1 -0
- package/fesm2022/slotted-angular-calendar.mjs +916 -0
- package/fesm2022/slotted-angular-calendar.mjs.map +1 -0
- package/fesm2022/slotted-angular-card.mjs +225 -0
- package/fesm2022/slotted-angular-card.mjs.map +1 -0
- package/fesm2022/slotted-angular-carousel.mjs +840 -0
- package/fesm2022/slotted-angular-carousel.mjs.map +1 -0
- package/fesm2022/slotted-angular-cascader.mjs +1839 -0
- package/fesm2022/slotted-angular-cascader.mjs.map +1 -0
- package/fesm2022/slotted-angular-chart.mjs +974 -0
- package/fesm2022/slotted-angular-chart.mjs.map +1 -0
- package/fesm2022/slotted-angular-checkbox-group.mjs +283 -0
- package/fesm2022/slotted-angular-checkbox-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-checkbox.mjs +468 -0
- package/fesm2022/slotted-angular-checkbox.mjs.map +1 -0
- package/fesm2022/slotted-angular-code-block.mjs +476 -0
- package/fesm2022/slotted-angular-code-block.mjs.map +1 -0
- package/fesm2022/slotted-angular-collapsible.mjs +479 -0
- package/fesm2022/slotted-angular-collapsible.mjs.map +1 -0
- package/fesm2022/slotted-angular-color-picker.mjs +910 -0
- package/fesm2022/slotted-angular-color-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-column-manager.mjs +1037 -0
- package/fesm2022/slotted-angular-column-manager.mjs.map +1 -0
- package/fesm2022/slotted-angular-combobox.mjs +1480 -0
- package/fesm2022/slotted-angular-combobox.mjs.map +1 -0
- package/fesm2022/slotted-angular-command-palette.mjs +1283 -0
- package/fesm2022/slotted-angular-command-palette.mjs.map +1 -0
- package/fesm2022/slotted-angular-container.mjs +105 -0
- package/fesm2022/slotted-angular-container.mjs.map +1 -0
- package/fesm2022/slotted-angular-context-menu.mjs +221 -0
- package/fesm2022/slotted-angular-context-menu.mjs.map +1 -0
- package/fesm2022/slotted-angular-currency-field.mjs +1131 -0
- package/fesm2022/slotted-angular-currency-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-dashboard-grid.mjs +1928 -0
- package/fesm2022/slotted-angular-dashboard-grid.mjs.map +1 -0
- package/fesm2022/slotted-angular-data-grid.mjs +6697 -0
- package/fesm2022/slotted-angular-data-grid.mjs.map +1 -0
- package/fesm2022/slotted-angular-data-list.mjs +1418 -0
- package/fesm2022/slotted-angular-data-list.mjs.map +1 -0
- package/fesm2022/slotted-angular-date-field.mjs +772 -0
- package/fesm2022/slotted-angular-date-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-date-picker.mjs +690 -0
- package/fesm2022/slotted-angular-date-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-date-range-picker.mjs +1150 -0
- package/fesm2022/slotted-angular-date-range-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-datetime-field.mjs +1058 -0
- package/fesm2022/slotted-angular-datetime-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-datetime-picker.mjs +1362 -0
- package/fesm2022/slotted-angular-datetime-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-datetime-range-picker.mjs +1872 -0
- package/fesm2022/slotted-angular-datetime-range-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-description-list.mjs +545 -0
- package/fesm2022/slotted-angular-description-list.mjs.map +1 -0
- package/fesm2022/slotted-angular-detail-panel.mjs +754 -0
- package/fesm2022/slotted-angular-detail-panel.mjs.map +1 -0
- package/fesm2022/slotted-angular-dialog.mjs +980 -0
- package/fesm2022/slotted-angular-dialog.mjs.map +1 -0
- package/fesm2022/slotted-angular-divider.mjs +76 -0
- package/fesm2022/slotted-angular-divider.mjs.map +1 -0
- package/fesm2022/slotted-angular-drawer.mjs +1397 -0
- package/fesm2022/slotted-angular-drawer.mjs.map +1 -0
- package/fesm2022/slotted-angular-entity-picker.mjs +1987 -0
- package/fesm2022/slotted-angular-entity-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-event-calendar.mjs +2934 -0
- package/fesm2022/slotted-angular-event-calendar.mjs.map +1 -0
- package/fesm2022/slotted-angular-field-group.mjs +301 -0
- package/fesm2022/slotted-angular-field-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-field.mjs +928 -0
- package/fesm2022/slotted-angular-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-filter-bar.mjs +3107 -0
- package/fesm2022/slotted-angular-filter-bar.mjs.map +1 -0
- package/fesm2022/slotted-angular-form.mjs +592 -0
- package/fesm2022/slotted-angular-form.mjs.map +1 -0
- package/fesm2022/slotted-angular-fullscreen.mjs +314 -0
- package/fesm2022/slotted-angular-fullscreen.mjs.map +1 -0
- package/fesm2022/slotted-angular-grid.mjs +58 -0
- package/fesm2022/slotted-angular-grid.mjs.map +1 -0
- package/fesm2022/slotted-angular-highlight.mjs +123 -0
- package/fesm2022/slotted-angular-highlight.mjs.map +1 -0
- package/fesm2022/slotted-angular-hover-card.mjs +326 -0
- package/fesm2022/slotted-angular-hover-card.mjs.map +1 -0
- package/fesm2022/slotted-angular-i18n.mjs +75 -0
- package/fesm2022/slotted-angular-i18n.mjs.map +1 -0
- package/fesm2022/slotted-angular-icon.mjs +232 -0
- package/fesm2022/slotted-angular-icon.mjs.map +1 -0
- package/fesm2022/slotted-angular-image.mjs +442 -0
- package/fesm2022/slotted-angular-image.mjs.map +1 -0
- package/fesm2022/slotted-angular-import-export-center.mjs +1792 -0
- package/fesm2022/slotted-angular-import-export-center.mjs.map +1 -0
- package/fesm2022/slotted-angular-inline-message.mjs +280 -0
- package/fesm2022/slotted-angular-inline-message.mjs.map +1 -0
- package/fesm2022/slotted-angular-inline.mjs +52 -0
- package/fesm2022/slotted-angular-inline.mjs.map +1 -0
- package/fesm2022/slotted-angular-kbd.mjs +284 -0
- package/fesm2022/slotted-angular-kbd.mjs.map +1 -0
- package/fesm2022/slotted-angular-link.mjs +182 -0
- package/fesm2022/slotted-angular-link.mjs.map +1 -0
- package/fesm2022/slotted-angular-list-item.mjs +367 -0
- package/fesm2022/slotted-angular-list-item.mjs.map +1 -0
- package/fesm2022/slotted-angular-list.mjs +256 -0
- package/fesm2022/slotted-angular-list.mjs.map +1 -0
- package/fesm2022/slotted-angular-listbox.mjs +1274 -0
- package/fesm2022/slotted-angular-listbox.mjs.map +1 -0
- package/fesm2022/slotted-angular-loading-overlay.mjs +451 -0
- package/fesm2022/slotted-angular-loading-overlay.mjs.map +1 -0
- package/fesm2022/slotted-angular-markdown.mjs +914 -0
- package/fesm2022/slotted-angular-markdown.mjs.map +1 -0
- package/fesm2022/slotted-angular-menu.mjs +1211 -0
- package/fesm2022/slotted-angular-menu.mjs.map +1 -0
- package/fesm2022/slotted-angular-menubar.mjs +230 -0
- package/fesm2022/slotted-angular-menubar.mjs.map +1 -0
- package/fesm2022/slotted-angular-message-scroller.mjs +378 -0
- package/fesm2022/slotted-angular-message-scroller.mjs.map +1 -0
- package/fesm2022/slotted-angular-message.mjs +866 -0
- package/fesm2022/slotted-angular-message.mjs.map +1 -0
- package/fesm2022/slotted-angular-multi-select.mjs +1939 -0
- package/fesm2022/slotted-angular-multi-select.mjs.map +1 -0
- package/fesm2022/slotted-angular-navigation-menu.mjs +770 -0
- package/fesm2022/slotted-angular-navigation-menu.mjs.map +1 -0
- package/fesm2022/slotted-angular-notification-center.mjs +1172 -0
- package/fesm2022/slotted-angular-notification-center.mjs.map +1 -0
- package/fesm2022/slotted-angular-number-field.mjs +966 -0
- package/fesm2022/slotted-angular-number-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-otp-input.mjs +629 -0
- package/fesm2022/slotted-angular-otp-input.mjs.map +1 -0
- package/fesm2022/slotted-angular-page-header.mjs +788 -0
- package/fesm2022/slotted-angular-page-header.mjs.map +1 -0
- package/fesm2022/slotted-angular-page.mjs +255 -0
- package/fesm2022/slotted-angular-page.mjs.map +1 -0
- package/fesm2022/slotted-angular-pagination.mjs +562 -0
- package/fesm2022/slotted-angular-pagination.mjs.map +1 -0
- package/fesm2022/slotted-angular-popover.mjs +799 -0
- package/fesm2022/slotted-angular-popover.mjs.map +1 -0
- package/fesm2022/slotted-angular-progress-indicator.mjs +572 -0
- package/fesm2022/slotted-angular-progress-indicator.mjs.map +1 -0
- package/fesm2022/slotted-angular-prompt-composer.mjs +596 -0
- package/fesm2022/slotted-angular-prompt-composer.mjs.map +1 -0
- package/fesm2022/slotted-angular-prose.mjs +314 -0
- package/fesm2022/slotted-angular-prose.mjs.map +1 -0
- package/fesm2022/slotted-angular-radio-group.mjs +469 -0
- package/fesm2022/slotted-angular-radio-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-rating.mjs +1174 -0
- package/fesm2022/slotted-angular-rating.mjs.map +1 -0
- package/fesm2022/slotted-angular-result-state.mjs +330 -0
- package/fesm2022/slotted-angular-result-state.mjs.map +1 -0
- package/fesm2022/slotted-angular-saved-views.mjs +877 -0
- package/fesm2022/slotted-angular-saved-views.mjs.map +1 -0
- package/fesm2022/slotted-angular-scroll-area.mjs +294 -0
- package/fesm2022/slotted-angular-scroll-area.mjs.map +1 -0
- package/fesm2022/slotted-angular-section.mjs +266 -0
- package/fesm2022/slotted-angular-section.mjs.map +1 -0
- package/fesm2022/slotted-angular-segmented-control.mjs +454 -0
- package/fesm2022/slotted-angular-segmented-control.mjs.map +1 -0
- package/fesm2022/slotted-angular-select.mjs +1899 -0
- package/fesm2022/slotted-angular-select.mjs.map +1 -0
- package/fesm2022/slotted-angular-side-navigation.mjs +1042 -0
- package/fesm2022/slotted-angular-side-navigation.mjs.map +1 -0
- package/fesm2022/slotted-angular-skeleton.mjs +316 -0
- package/fesm2022/slotted-angular-skeleton.mjs.map +1 -0
- package/fesm2022/slotted-angular-slider.mjs +586 -0
- package/fesm2022/slotted-angular-slider.mjs.map +1 -0
- package/fesm2022/slotted-angular-sparkline.mjs +235 -0
- package/fesm2022/slotted-angular-sparkline.mjs.map +1 -0
- package/fesm2022/slotted-angular-split-button.mjs +331 -0
- package/fesm2022/slotted-angular-split-button.mjs.map +1 -0
- package/fesm2022/slotted-angular-splitter.mjs +516 -0
- package/fesm2022/slotted-angular-splitter.mjs.map +1 -0
- package/fesm2022/slotted-angular-stack.mjs +48 -0
- package/fesm2022/slotted-angular-stack.mjs.map +1 -0
- package/fesm2022/slotted-angular-stat-card.mjs +478 -0
- package/fesm2022/slotted-angular-stat-card.mjs.map +1 -0
- package/fesm2022/slotted-angular-status-indicator.mjs +155 -0
- package/fesm2022/slotted-angular-status-indicator.mjs.map +1 -0
- package/fesm2022/slotted-angular-stepper.mjs +536 -0
- package/fesm2022/slotted-angular-stepper.mjs.map +1 -0
- package/fesm2022/slotted-angular-switch.mjs +447 -0
- package/fesm2022/slotted-angular-switch.mjs.map +1 -0
- package/fesm2022/slotted-angular-table-of-contents.mjs +750 -0
- package/fesm2022/slotted-angular-table-of-contents.mjs.map +1 -0
- package/fesm2022/slotted-angular-table.mjs +2518 -0
- package/fesm2022/slotted-angular-table.mjs.map +1 -0
- package/fesm2022/slotted-angular-tabs.mjs +829 -0
- package/fesm2022/slotted-angular-tabs.mjs.map +1 -0
- package/fesm2022/slotted-angular-tag.mjs +595 -0
- package/fesm2022/slotted-angular-tag.mjs.map +1 -0
- package/fesm2022/slotted-angular-tags-input.mjs +1211 -0
- package/fesm2022/slotted-angular-tags-input.mjs.map +1 -0
- package/fesm2022/slotted-angular-text-field.mjs +674 -0
- package/fesm2022/slotted-angular-text-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-textarea.mjs +275 -0
- package/fesm2022/slotted-angular-textarea.mjs.map +1 -0
- package/fesm2022/slotted-angular-theme.mjs +45 -0
- package/fesm2022/slotted-angular-theme.mjs.map +1 -0
- package/fesm2022/slotted-angular-time-field.mjs +895 -0
- package/fesm2022/slotted-angular-time-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-time-picker.mjs +856 -0
- package/fesm2022/slotted-angular-time-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-time-range-picker.mjs +1534 -0
- package/fesm2022/slotted-angular-time-range-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-timeline.mjs +928 -0
- package/fesm2022/slotted-angular-timeline.mjs.map +1 -0
- package/fesm2022/slotted-angular-toast.mjs +917 -0
- package/fesm2022/slotted-angular-toast.mjs.map +1 -0
- package/fesm2022/slotted-angular-toggle-group.mjs +311 -0
- package/fesm2022/slotted-angular-toggle-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-toggle.mjs +162 -0
- package/fesm2022/slotted-angular-toggle.mjs.map +1 -0
- package/fesm2022/slotted-angular-toolbar.mjs +536 -0
- package/fesm2022/slotted-angular-toolbar.mjs.map +1 -0
- package/fesm2022/slotted-angular-tooltip.mjs +798 -0
- package/fesm2022/slotted-angular-tooltip.mjs.map +1 -0
- package/fesm2022/slotted-angular-top-navigation.mjs +1308 -0
- package/fesm2022/slotted-angular-top-navigation.mjs.map +1 -0
- package/fesm2022/slotted-angular-tour.mjs +1330 -0
- package/fesm2022/slotted-angular-tour.mjs.map +1 -0
- package/fesm2022/slotted-angular-transfer.mjs +1406 -0
- package/fesm2022/slotted-angular-transfer.mjs.map +1 -0
- package/fesm2022/slotted-angular-tree.mjs +1448 -0
- package/fesm2022/slotted-angular-tree.mjs.map +1 -0
- package/fesm2022/slotted-angular-typography.mjs +184 -0
- package/fesm2022/slotted-angular-typography.mjs.map +1 -0
- package/fesm2022/slotted-angular-upload.mjs +1523 -0
- package/fesm2022/slotted-angular-upload.mjs.map +1 -0
- package/fesm2022/slotted-angular-visually-hidden.mjs +32 -0
- package/fesm2022/slotted-angular-visually-hidden.mjs.map +1 -0
- package/fesm2022/slotted-angular-wizard.mjs +1715 -0
- package/fesm2022/slotted-angular-wizard.mjs.map +1 -0
- package/fesm2022/slotted-angular.mjs +4 -0
- package/fesm2022/slotted-angular.mjs.map +1 -0
- package/package.json +537 -3
- package/types/slotted-angular-accordion.d.ts +156 -0
- package/types/slotted-angular-accordion.d.ts.map +1 -0
- package/types/slotted-angular-action-bar.d.ts +291 -0
- package/types/slotted-angular-action-bar.d.ts.map +1 -0
- package/types/slotted-angular-action-sheet.d.ts +294 -0
- package/types/slotted-angular-action-sheet.d.ts.map +1 -0
- package/types/slotted-angular-alert.d.ts +214 -0
- package/types/slotted-angular-alert.d.ts.map +1 -0
- package/types/slotted-angular-app-shell.d.ts +549 -0
- package/types/slotted-angular-app-shell.d.ts.map +1 -0
- package/types/slotted-angular-aspect-ratio.d.ts +57 -0
- package/types/slotted-angular-aspect-ratio.d.ts.map +1 -0
- package/types/slotted-angular-attachment.d.ts +294 -0
- package/types/slotted-angular-attachment.d.ts.map +1 -0
- package/types/slotted-angular-avatar-group.d.ts +119 -0
- package/types/slotted-angular-avatar-group.d.ts.map +1 -0
- package/types/slotted-angular-avatar.d.ts +202 -0
- package/types/slotted-angular-avatar.d.ts.map +1 -0
- package/types/slotted-angular-badge.d.ts +166 -0
- package/types/slotted-angular-badge.d.ts.map +1 -0
- package/types/slotted-angular-breadcrumb.d.ts +251 -0
- package/types/slotted-angular-breadcrumb.d.ts.map +1 -0
- package/types/slotted-angular-button-group.d.ts +89 -0
- package/types/slotted-angular-button-group.d.ts.map +1 -0
- package/types/slotted-angular-button.d.ts +390 -0
- package/types/slotted-angular-button.d.ts.map +1 -0
- package/types/slotted-angular-calendar.d.ts +280 -0
- package/types/slotted-angular-calendar.d.ts.map +1 -0
- package/types/slotted-angular-card.d.ts +140 -0
- package/types/slotted-angular-card.d.ts.map +1 -0
- package/types/slotted-angular-carousel.d.ts +288 -0
- package/types/slotted-angular-carousel.d.ts.map +1 -0
- package/types/slotted-angular-cascader.d.ts +351 -0
- package/types/slotted-angular-cascader.d.ts.map +1 -0
- package/types/slotted-angular-chart.d.ts +319 -0
- package/types/slotted-angular-chart.d.ts.map +1 -0
- package/types/slotted-angular-checkbox-group.d.ts +156 -0
- package/types/slotted-angular-checkbox-group.d.ts.map +1 -0
- package/types/slotted-angular-checkbox.d.ts +197 -0
- package/types/slotted-angular-checkbox.d.ts.map +1 -0
- package/types/slotted-angular-code-block.d.ts +158 -0
- package/types/slotted-angular-code-block.d.ts.map +1 -0
- package/types/slotted-angular-collapsible.d.ts +272 -0
- package/types/slotted-angular-collapsible.d.ts.map +1 -0
- package/types/slotted-angular-color-picker.d.ts +181 -0
- package/types/slotted-angular-color-picker.d.ts.map +1 -0
- package/types/slotted-angular-column-manager.d.ts +200 -0
- package/types/slotted-angular-column-manager.d.ts.map +1 -0
- package/types/slotted-angular-combobox.d.ts +449 -0
- package/types/slotted-angular-combobox.d.ts.map +1 -0
- package/types/slotted-angular-command-palette.d.ts +256 -0
- package/types/slotted-angular-command-palette.d.ts.map +1 -0
- package/types/slotted-angular-container.d.ts +84 -0
- package/types/slotted-angular-container.d.ts.map +1 -0
- package/types/slotted-angular-context-menu.d.ts +84 -0
- package/types/slotted-angular-context-menu.d.ts.map +1 -0
- package/types/slotted-angular-currency-field.d.ts +480 -0
- package/types/slotted-angular-currency-field.d.ts.map +1 -0
- package/types/slotted-angular-dashboard-grid.d.ts +341 -0
- package/types/slotted-angular-dashboard-grid.d.ts.map +1 -0
- package/types/slotted-angular-data-grid.d.ts +1077 -0
- package/types/slotted-angular-data-grid.d.ts.map +1 -0
- package/types/slotted-angular-data-list.d.ts +272 -0
- package/types/slotted-angular-data-list.d.ts.map +1 -0
- package/types/slotted-angular-date-field.d.ts +320 -0
- package/types/slotted-angular-date-field.d.ts.map +1 -0
- package/types/slotted-angular-date-picker.d.ts +224 -0
- package/types/slotted-angular-date-picker.d.ts.map +1 -0
- package/types/slotted-angular-date-range-picker.d.ts +310 -0
- package/types/slotted-angular-date-range-picker.d.ts.map +1 -0
- package/types/slotted-angular-datetime-field.d.ts +362 -0
- package/types/slotted-angular-datetime-field.d.ts.map +1 -0
- package/types/slotted-angular-datetime-picker.d.ts +370 -0
- package/types/slotted-angular-datetime-picker.d.ts.map +1 -0
- package/types/slotted-angular-datetime-range-picker.d.ts +459 -0
- package/types/slotted-angular-datetime-range-picker.d.ts.map +1 -0
- package/types/slotted-angular-description-list.d.ts +281 -0
- package/types/slotted-angular-description-list.d.ts.map +1 -0
- package/types/slotted-angular-detail-panel.d.ts +240 -0
- package/types/slotted-angular-detail-panel.d.ts.map +1 -0
- package/types/slotted-angular-dialog.d.ts +497 -0
- package/types/slotted-angular-dialog.d.ts.map +1 -0
- package/types/slotted-angular-divider.d.ts +40 -0
- package/types/slotted-angular-divider.d.ts.map +1 -0
- package/types/slotted-angular-drawer.d.ts +532 -0
- package/types/slotted-angular-drawer.d.ts.map +1 -0
- package/types/slotted-angular-entity-picker.d.ts +338 -0
- package/types/slotted-angular-entity-picker.d.ts.map +1 -0
- package/types/slotted-angular-event-calendar.d.ts +574 -0
- package/types/slotted-angular-event-calendar.d.ts.map +1 -0
- package/types/slotted-angular-field-group.d.ts +152 -0
- package/types/slotted-angular-field-group.d.ts.map +1 -0
- package/types/slotted-angular-field.d.ts +535 -0
- package/types/slotted-angular-field.d.ts.map +1 -0
- package/types/slotted-angular-filter-bar.d.ts +573 -0
- package/types/slotted-angular-filter-bar.d.ts.map +1 -0
- package/types/slotted-angular-form.d.ts +298 -0
- package/types/slotted-angular-form.d.ts.map +1 -0
- package/types/slotted-angular-fullscreen.d.ts +145 -0
- package/types/slotted-angular-fullscreen.d.ts.map +1 -0
- package/types/slotted-angular-grid.d.ts +50 -0
- package/types/slotted-angular-grid.d.ts.map +1 -0
- package/types/slotted-angular-highlight.d.ts +93 -0
- package/types/slotted-angular-highlight.d.ts.map +1 -0
- package/types/slotted-angular-hover-card.d.ts +140 -0
- package/types/slotted-angular-hover-card.d.ts.map +1 -0
- package/types/slotted-angular-i18n.d.ts +46 -0
- package/types/slotted-angular-i18n.d.ts.map +1 -0
- package/types/slotted-angular-icon.d.ts +94 -0
- package/types/slotted-angular-icon.d.ts.map +1 -0
- package/types/slotted-angular-image.d.ts +251 -0
- package/types/slotted-angular-image.d.ts.map +1 -0
- package/types/slotted-angular-import-export-center.d.ts +351 -0
- package/types/slotted-angular-import-export-center.d.ts.map +1 -0
- package/types/slotted-angular-inline-message.d.ts +195 -0
- package/types/slotted-angular-inline-message.d.ts.map +1 -0
- package/types/slotted-angular-inline.d.ts +41 -0
- package/types/slotted-angular-inline.d.ts.map +1 -0
- package/types/slotted-angular-kbd.d.ts +174 -0
- package/types/slotted-angular-kbd.d.ts.map +1 -0
- package/types/slotted-angular-link.d.ts +94 -0
- package/types/slotted-angular-link.d.ts.map +1 -0
- package/types/slotted-angular-list-item.d.ts +210 -0
- package/types/slotted-angular-list-item.d.ts.map +1 -0
- package/types/slotted-angular-list.d.ts +176 -0
- package/types/slotted-angular-list.d.ts.map +1 -0
- package/types/slotted-angular-listbox.d.ts +470 -0
- package/types/slotted-angular-listbox.d.ts.map +1 -0
- package/types/slotted-angular-loading-overlay.d.ts +219 -0
- package/types/slotted-angular-loading-overlay.d.ts.map +1 -0
- package/types/slotted-angular-markdown.d.ts +172 -0
- package/types/slotted-angular-markdown.d.ts.map +1 -0
- package/types/slotted-angular-menu.d.ts +448 -0
- package/types/slotted-angular-menu.d.ts.map +1 -0
- package/types/slotted-angular-menubar.d.ts +90 -0
- package/types/slotted-angular-menubar.d.ts.map +1 -0
- package/types/slotted-angular-message-scroller.d.ts +151 -0
- package/types/slotted-angular-message-scroller.d.ts.map +1 -0
- package/types/slotted-angular-message.d.ts +348 -0
- package/types/slotted-angular-message.d.ts.map +1 -0
- package/types/slotted-angular-multi-select.d.ts +462 -0
- package/types/slotted-angular-multi-select.d.ts.map +1 -0
- package/types/slotted-angular-navigation-menu.d.ts +309 -0
- package/types/slotted-angular-navigation-menu.d.ts.map +1 -0
- package/types/slotted-angular-notification-center.d.ts +318 -0
- package/types/slotted-angular-notification-center.d.ts.map +1 -0
- package/types/slotted-angular-number-field.d.ts +402 -0
- package/types/slotted-angular-number-field.d.ts.map +1 -0
- package/types/slotted-angular-otp-input.d.ts +286 -0
- package/types/slotted-angular-otp-input.d.ts.map +1 -0
- package/types/slotted-angular-page-header.d.ts +334 -0
- package/types/slotted-angular-page-header.d.ts.map +1 -0
- package/types/slotted-angular-page.d.ts +141 -0
- package/types/slotted-angular-page.d.ts.map +1 -0
- package/types/slotted-angular-pagination.d.ts +213 -0
- package/types/slotted-angular-pagination.d.ts.map +1 -0
- package/types/slotted-angular-popover.d.ts +366 -0
- package/types/slotted-angular-popover.d.ts.map +1 -0
- package/types/slotted-angular-progress-indicator.d.ts +312 -0
- package/types/slotted-angular-progress-indicator.d.ts.map +1 -0
- package/types/slotted-angular-prompt-composer.d.ts +242 -0
- package/types/slotted-angular-prompt-composer.d.ts.map +1 -0
- package/types/slotted-angular-prose.d.ts +171 -0
- package/types/slotted-angular-prose.d.ts.map +1 -0
- package/types/slotted-angular-radio-group.d.ts +268 -0
- package/types/slotted-angular-radio-group.d.ts.map +1 -0
- package/types/slotted-angular-rating.d.ts +374 -0
- package/types/slotted-angular-rating.d.ts.map +1 -0
- package/types/slotted-angular-result-state.d.ts +217 -0
- package/types/slotted-angular-result-state.d.ts.map +1 -0
- package/types/slotted-angular-saved-views.d.ts +198 -0
- package/types/slotted-angular-saved-views.d.ts.map +1 -0
- package/types/slotted-angular-scroll-area.d.ts +186 -0
- package/types/slotted-angular-scroll-area.d.ts.map +1 -0
- package/types/slotted-angular-section.d.ts +143 -0
- package/types/slotted-angular-section.d.ts.map +1 -0
- package/types/slotted-angular-segmented-control.d.ts +251 -0
- package/types/slotted-angular-segmented-control.d.ts.map +1 -0
- package/types/slotted-angular-select.d.ts +507 -0
- package/types/slotted-angular-select.d.ts.map +1 -0
- package/types/slotted-angular-side-navigation.d.ts +373 -0
- package/types/slotted-angular-side-navigation.d.ts.map +1 -0
- package/types/slotted-angular-skeleton.d.ts +198 -0
- package/types/slotted-angular-skeleton.d.ts.map +1 -0
- package/types/slotted-angular-slider.d.ts +216 -0
- package/types/slotted-angular-slider.d.ts.map +1 -0
- package/types/slotted-angular-sparkline.d.ts +106 -0
- package/types/slotted-angular-sparkline.d.ts.map +1 -0
- package/types/slotted-angular-split-button.d.ts +180 -0
- package/types/slotted-angular-split-button.d.ts.map +1 -0
- package/types/slotted-angular-splitter.d.ts +206 -0
- package/types/slotted-angular-splitter.d.ts.map +1 -0
- package/types/slotted-angular-stack.d.ts +38 -0
- package/types/slotted-angular-stack.d.ts.map +1 -0
- package/types/slotted-angular-stat-card.d.ts +232 -0
- package/types/slotted-angular-stat-card.d.ts.map +1 -0
- package/types/slotted-angular-status-indicator.d.ts +106 -0
- package/types/slotted-angular-status-indicator.d.ts.map +1 -0
- package/types/slotted-angular-stepper.d.ts +198 -0
- package/types/slotted-angular-stepper.d.ts.map +1 -0
- package/types/slotted-angular-switch.d.ts +243 -0
- package/types/slotted-angular-switch.d.ts.map +1 -0
- package/types/slotted-angular-table-of-contents.d.ts +210 -0
- package/types/slotted-angular-table-of-contents.d.ts.map +1 -0
- package/types/slotted-angular-table.d.ts +888 -0
- package/types/slotted-angular-table.d.ts.map +1 -0
- package/types/slotted-angular-tabs.d.ts +340 -0
- package/types/slotted-angular-tabs.d.ts.map +1 -0
- package/types/slotted-angular-tag.d.ts +279 -0
- package/types/slotted-angular-tag.d.ts.map +1 -0
- package/types/slotted-angular-tags-input.d.ts +302 -0
- package/types/slotted-angular-tags-input.d.ts.map +1 -0
- package/types/slotted-angular-text-field.d.ts +334 -0
- package/types/slotted-angular-text-field.d.ts.map +1 -0
- package/types/slotted-angular-textarea.d.ts +150 -0
- package/types/slotted-angular-textarea.d.ts.map +1 -0
- package/types/slotted-angular-theme.d.ts +26 -0
- package/types/slotted-angular-theme.d.ts.map +1 -0
- package/types/slotted-angular-time-field.d.ts +300 -0
- package/types/slotted-angular-time-field.d.ts.map +1 -0
- package/types/slotted-angular-time-picker.d.ts +260 -0
- package/types/slotted-angular-time-picker.d.ts.map +1 -0
- package/types/slotted-angular-time-range-picker.d.ts +401 -0
- package/types/slotted-angular-time-range-picker.d.ts.map +1 -0
- package/types/slotted-angular-timeline.d.ts +329 -0
- package/types/slotted-angular-timeline.d.ts.map +1 -0
- package/types/slotted-angular-toast.d.ts +340 -0
- package/types/slotted-angular-toast.d.ts.map +1 -0
- package/types/slotted-angular-toggle-group.d.ts +167 -0
- package/types/slotted-angular-toggle-group.d.ts.map +1 -0
- package/types/slotted-angular-toggle.d.ts +106 -0
- package/types/slotted-angular-toggle.d.ts.map +1 -0
- package/types/slotted-angular-toolbar.d.ts +252 -0
- package/types/slotted-angular-toolbar.d.ts.map +1 -0
- package/types/slotted-angular-tooltip.d.ts +388 -0
- package/types/slotted-angular-tooltip.d.ts.map +1 -0
- package/types/slotted-angular-top-navigation.d.ts +442 -0
- package/types/slotted-angular-top-navigation.d.ts.map +1 -0
- package/types/slotted-angular-tour.d.ts +440 -0
- package/types/slotted-angular-tour.d.ts.map +1 -0
- package/types/slotted-angular-transfer.d.ts +296 -0
- package/types/slotted-angular-transfer.d.ts.map +1 -0
- package/types/slotted-angular-tree.d.ts +499 -0
- package/types/slotted-angular-tree.d.ts.map +1 -0
- package/types/slotted-angular-typography.d.ts +89 -0
- package/types/slotted-angular-typography.d.ts.map +1 -0
- package/types/slotted-angular-upload.d.ts +365 -0
- package/types/slotted-angular-upload.d.ts.map +1 -0
- package/types/slotted-angular-visually-hidden.d.ts +19 -0
- package/types/slotted-angular-visually-hidden.d.ts.map +1 -0
- package/types/slotted-angular-wizard.d.ts +441 -0
- package/types/slotted-angular-wizard.d.ts.map +1 -0
- package/types/slotted-angular.d.ts +3 -0
- package/types/slotted-angular.d.ts.map +1 -0
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, booleanAttribute, numberAttribute, contentChild, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, output, ElementRef, DestroyRef, HostAttributeToken, signal, effect, forwardRef, Directive } from '@angular/core';
|
|
3
|
+
import { currentSlots, spreadPlaceholder, sanitize, normalizeSelection } from '@slotted/core/otp';
|
|
4
|
+
import { SlField } from '@slotted/angular/field';
|
|
5
|
+
import { createControllable } from '@slotted/core/state';
|
|
6
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
|
|
8
|
+
const FALLBACK = {
|
|
9
|
+
attached: false,
|
|
10
|
+
length: 6,
|
|
11
|
+
placeholder: '',
|
|
12
|
+
size: 'md',
|
|
13
|
+
type: 'numeric',
|
|
14
|
+
variant: 'outline',
|
|
15
|
+
};
|
|
16
|
+
const OTP_INPUT_DEFAULTS = new InjectionToken('slotted otp input defaults', { providedIn: 'root', factory: () => FALLBACK });
|
|
17
|
+
/**
|
|
18
|
+
* An application decides once what its code fields look like — and how long
|
|
19
|
+
* its codes are — rather than repeating the same inputs on every verification
|
|
20
|
+
* screen. A control that states any of them itself still wins.
|
|
21
|
+
*
|
|
22
|
+
* `size` is the one the field outranks: a control inside a field takes the
|
|
23
|
+
* field's step and this token answers only outside one.
|
|
24
|
+
*/
|
|
25
|
+
function provideOtpInputDefaults(defaults) {
|
|
26
|
+
return {
|
|
27
|
+
provide: OTP_INPUT_DEFAULTS,
|
|
28
|
+
useFactory: () => ({ ...FALLBACK, ...defaults }),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** What a code field renders as here, before it states anything of its own. */
|
|
32
|
+
function injectOtpInputDefaults() {
|
|
33
|
+
return inject(OTP_INPUT_DEFAULTS);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* What the frame needs to know about the control inside it, and what the
|
|
37
|
+
* control needs the frame to call.
|
|
38
|
+
*
|
|
39
|
+
* It is an abstract class rather than an import so the two directives can
|
|
40
|
+
* depend on each other without a cycle — the shape `text-field` already has.
|
|
41
|
+
* The control provides itself as this, and the frame queries for it.
|
|
42
|
+
*/
|
|
43
|
+
class SlOtpInputState {
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The character a masked box shows, which is the one a password field shows. */
|
|
47
|
+
const MASK = '•';
|
|
48
|
+
/**
|
|
49
|
+
* `groups` has to add up to `length`; a partition that does not is one group.
|
|
50
|
+
* A silent fallback rather than a throw, because a code field that renders
|
|
51
|
+
* nothing on a verification screen locks the reader out of the product.
|
|
52
|
+
*/
|
|
53
|
+
function partition(length, groups) {
|
|
54
|
+
if (groups === undefined)
|
|
55
|
+
return [length];
|
|
56
|
+
const sum = groups.reduce((total, size) => total + size, 0);
|
|
57
|
+
return sum === length && groups.every((size) => size > 0) ? [...groups] : [length];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The frame: N painted boxes around one real input.
|
|
61
|
+
*
|
|
62
|
+
* **It is not the control.** The element carrying `data-ui` is the consumer's
|
|
63
|
+
* own box with no role; the `input` inside it holds the value, the identifier
|
|
64
|
+
* and every native attribute, and lies over the boxes, transparent. The boxes
|
|
65
|
+
* are drawn here from what the control reports, and are hidden from assistive
|
|
66
|
+
* technology.
|
|
67
|
+
*
|
|
68
|
+
* **Angular pays one element for that frame, and React pays none.** React can
|
|
69
|
+
* render a wrapper from inside a component; an Angular directive cannot create
|
|
70
|
+
* a box around its own host. `slOtpInputControl` injects this class, so a
|
|
71
|
+
* control written without the frame is a compile-time failure rather than a
|
|
72
|
+
* silent one.
|
|
73
|
+
*/
|
|
74
|
+
class SlOtpInput {
|
|
75
|
+
/** Defaults to the field, then to the token, then to `md`. */
|
|
76
|
+
size = input(undefined, /* @ts-ignore */
|
|
77
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
78
|
+
/** Defaults to the token, then to `outline`. */
|
|
79
|
+
variant = input(undefined, /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
81
|
+
/** Joins the boxes of a group along one seam. Defaults to the token's. */
|
|
82
|
+
attached = input(undefined, { ...(ngDevMode ? { debugName: "attached" } : /* istanbul ignore next */ {}), transform: (value) => (value === undefined ? undefined : booleanAttribute(value)) });
|
|
83
|
+
/** How many characters the code has. Defaults to the token's, then 6. */
|
|
84
|
+
length = input(undefined, { ...(ngDevMode ? { debugName: "length" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : numberAttribute(value) });
|
|
85
|
+
/**
|
|
86
|
+
* How the boxes are partitioned: `[3, 3]` draws two groups of three with a
|
|
87
|
+
* separator between them. The sum has to be `length`; a partition that does
|
|
88
|
+
* not add up draws one group.
|
|
89
|
+
*/
|
|
90
|
+
groupsInput = input(undefined, { ...(ngDevMode ? { debugName: "groupsInput" } : /* istanbul ignore next */ {}), alias: 'groups' });
|
|
91
|
+
/**
|
|
92
|
+
* What an empty box shows: one character repeats over every box, and a
|
|
93
|
+
* string as long as the code distributes. Defaults to the token's.
|
|
94
|
+
*/
|
|
95
|
+
placeholder = input(undefined, /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
97
|
+
/**
|
|
98
|
+
* Hides the characters: the control becomes `type="password"`, so the
|
|
99
|
+
* platform treats the value as a secret, and each filled box shows a bullet.
|
|
100
|
+
*/
|
|
101
|
+
mask = input(false, { ...(ngDevMode ? { debugName: "mask" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
102
|
+
defaults = injectOtpInputDefaults();
|
|
103
|
+
field = inject(SlField, { optional: true });
|
|
104
|
+
/**
|
|
105
|
+
* The control inside. It provides itself as `SlOtpInputState`, so the frame
|
|
106
|
+
* can paint the value and the cursor without either directive importing the
|
|
107
|
+
* other.
|
|
108
|
+
*/
|
|
109
|
+
control = contentChild(SlOtpInputState, { ...(ngDevMode ? { debugName: "control" } : /* istanbul ignore next */ {}), descendants: true });
|
|
110
|
+
resolvedSize = computed(() => this.size() ?? this.field?.resolvedSize() ?? this.defaults.size, /* @ts-ignore */
|
|
111
|
+
...(ngDevMode ? [{ debugName: "resolvedSize" }] : /* istanbul ignore next */ []));
|
|
112
|
+
resolvedVariant = computed(() => this.variant() ?? this.defaults.variant, /* @ts-ignore */
|
|
113
|
+
...(ngDevMode ? [{ debugName: "resolvedVariant" }] : /* istanbul ignore next */ []));
|
|
114
|
+
resolvedAttached = computed(() => this.attached() ?? this.defaults.attached, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "resolvedAttached" }] : /* istanbul ignore next */ []));
|
|
116
|
+
resolvedLength = computed(() => this.length() ?? this.defaults.length, /* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [{ debugName: "resolvedLength" }] : /* istanbul ignore next */ []));
|
|
118
|
+
resolvedPlaceholder = computed(() => this.placeholder() ?? this.defaults.placeholder, /* @ts-ignore */
|
|
119
|
+
...(ngDevMode ? [{ debugName: "resolvedPlaceholder" }] : /* istanbul ignore next */ []));
|
|
120
|
+
complete = computed(() => {
|
|
121
|
+
const control = this.control();
|
|
122
|
+
return control !== undefined && control.code().length === this.resolvedLength();
|
|
123
|
+
}, /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []));
|
|
125
|
+
groups = computed(() => {
|
|
126
|
+
const length = this.resolvedLength();
|
|
127
|
+
const control = this.control();
|
|
128
|
+
const code = control?.code() ?? '';
|
|
129
|
+
const selection = control?.focused() === true ? control.selection() : null;
|
|
130
|
+
const active = new Set(selection === null ? [] : currentSlots({ ...selection, length, valueLength: code.length }));
|
|
131
|
+
const placeholders = spreadPlaceholder(this.resolvedPlaceholder(), length);
|
|
132
|
+
const mask = this.mask();
|
|
133
|
+
let index = 0;
|
|
134
|
+
return partition(length, this.groupsInput()).map((count) => Array.from({ length: count }, () => {
|
|
135
|
+
const character = code[index] ?? '';
|
|
136
|
+
const slot = {
|
|
137
|
+
index,
|
|
138
|
+
shown: character === '' ? '' : mask ? MASK : character,
|
|
139
|
+
placeholder: placeholders[index] ?? '',
|
|
140
|
+
current: active.has(index),
|
|
141
|
+
};
|
|
142
|
+
index += 1;
|
|
143
|
+
return slot;
|
|
144
|
+
}));
|
|
145
|
+
}, /* @ts-ignore */
|
|
146
|
+
...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
147
|
+
/**
|
|
148
|
+
* A press on a box puts the cursor in that box. The input lies over the
|
|
149
|
+
* boxes and would otherwise place its caret by the x of transparent text;
|
|
150
|
+
* the box under the pointer is what the reader meant, so it is found from
|
|
151
|
+
* the point and handed to the control.
|
|
152
|
+
*/
|
|
153
|
+
onPointerDown(event) {
|
|
154
|
+
const control = this.control();
|
|
155
|
+
if (control === undefined || control.resolvedDisabled() === true)
|
|
156
|
+
return;
|
|
157
|
+
if (typeof document.elementsFromPoint !== 'function')
|
|
158
|
+
return;
|
|
159
|
+
const host = event.currentTarget;
|
|
160
|
+
const slot = document
|
|
161
|
+
.elementsFromPoint(event.clientX, event.clientY)
|
|
162
|
+
.find((candidate) => candidate instanceof HTMLElement &&
|
|
163
|
+
candidate.dataset['part'] === 'slot' &&
|
|
164
|
+
candidate.closest("[data-ui='otp-input']") === host);
|
|
165
|
+
if (slot === undefined)
|
|
166
|
+
return;
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
control.pressAt(Number(slot.dataset['index'] ?? 0));
|
|
169
|
+
}
|
|
170
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SlOtpInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
171
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: SlOtpInput, isStandalone: true, selector: "[slOtpInput]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, attached: { classPropertyName: "attached", publicName: "attached", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, groupsInput: { classPropertyName: "groupsInput", publicName: "groups", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-ui": "otp-input", "data-part": "root" }, listeners: { "pointerdown": "onPointerDown($event)" }, properties: { "attr.data-size": "resolvedSize()", "attr.data-variant": "resolvedVariant()", "attr.data-attached": "resolvedAttached() ? '' : null", "attr.data-mask": "mask() ? '' : null", "attr.data-complete": "complete() ? '' : null", "attr.data-disabled": "control()?.resolvedDisabled() === true ? '' : null", "attr.data-invalid": "control()?.resolvedInvalid() === true ? '' : null", "attr.data-readonly": "control()?.resolvedReadOnly() === true ? '' : null" } }, queries: [{ propertyName: "control", first: true, predicate: SlOtpInputState, descendants: true, isSignal: true }], exportAs: ["slOtpInput"], ngImport: i0, template: `<ng-content />
|
|
172
|
+
@for (group of groups(); track $index; let first = $first) {
|
|
173
|
+
@if (!first) {
|
|
174
|
+
<div data-part="separator" aria-hidden="true"></div>
|
|
175
|
+
}
|
|
176
|
+
<div data-part="group" aria-hidden="true">
|
|
177
|
+
@for (slot of group; track slot.index) {
|
|
178
|
+
<div
|
|
179
|
+
data-part="slot"
|
|
180
|
+
[attr.data-index]="slot.index"
|
|
181
|
+
[attr.data-current]="slot.current ? '' : null"
|
|
182
|
+
[attr.data-placeholder]="
|
|
183
|
+
slot.shown === '' && slot.placeholder !== '' ? slot.placeholder : null
|
|
184
|
+
"
|
|
185
|
+
[textContent]="slot.shown"
|
|
186
|
+
></div>
|
|
187
|
+
}
|
|
188
|
+
</div>
|
|
189
|
+
}`, isInline: true, styles: ["@layer slotted.components{[data-ui=otp-input][data-part=root]{--_height: var(--slotted-control-height-md, 34px);--_font-size: var(--slotted-font-size-md, .875rem);--_gap: var(--slotted-control-gap-md, 8px);--_radius: var(--slotted-otp-input-radius, var(--slotted-control-radius, 4px));--_caret-width: var(--slotted-otp-input-caret-width, var(--slotted-border-width-thin, 1px));align-items:center;color:var(--slotted-otp-input-color, var(--slotted-text, CanvasText));direction:ltr;display:inline-flex;font-family:var(--slotted-control-font-family, system-ui, sans-serif);font-size:var(--_font-size);font-weight:var(--slotted-otp-input-font-weight, var(--slotted-font-weight-medium, 500));font-variant-numeric:tabular-nums;gap:var(--slotted-otp-input-group-gap, var(--slotted-space-4, .5rem));inline-size:fit-content;line-height:1;max-inline-size:100%;position:relative}[data-ui=otp-input]>[data-part=input]{appearance:none;background-color:transparent;block-size:100%;border:0;box-shadow:none;caret-color:transparent;color:transparent;font:inherit;inline-size:100%;inset:0;margin:0;outline:none;padding:0;position:absolute;touch-action:manipulation;-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:transparent;z-index:1}[data-ui=otp-input]>[data-part=input]::selection{background-color:transparent!important;color:transparent!important;text-shadow:none!important;-webkit-text-fill-color:transparent!important}[data-ui=otp-input]>[data-part=input]{-webkit-user-drag:none}[data-ui=otp-input]>[data-part=input]:autofill{box-shadow:inset 0 0 0 100px var(--slotted-otp-input-autofill-background, var(--slotted-tone-accent-surface));-webkit-text-fill-color:transparent}[data-ui=otp-input]>[data-part=group]{align-items:center;display:flex;gap:var(--_gap);min-inline-size:0}[data-ui=otp-input]>[data-part=separator]{background-color:var( --slotted-otp-input-separator-color, var(--slotted-control-border-color, ButtonBorder) );block-size:var(--slotted-border-width-thick, 2px);border-radius:var(--slotted-radius-full, 9999px);flex:0 0 auto;inline-size:var(--slotted-otp-input-separator-size, var(--slotted-space-4, .5rem))}[data-ui=otp-input] [data-part=slot]{align-items:center;background-color:var(--slotted-otp-input-background, var(--slotted-control-surface, Field));block-size:var(--_height);border:var(--slotted-control-border-width, 1px) solid var(--slotted-otp-input-border-color, var(--slotted-control-border-color, ButtonBorder));border-radius:var(--_radius);box-shadow:var(--slotted-otp-input-shadow, var(--slotted-control-shadow, none));box-sizing:border-box;display:flex;flex:0 1 auto;inline-size:var(--_height);justify-content:center;min-inline-size:calc(var(--_height) * .6);position:relative;transition:background-color var(--slotted-control-transition-duration) var(--slotted-control-transition-easing),border-color var(--slotted-control-transition-duration) var(--slotted-control-transition-easing),box-shadow var(--slotted-control-transition-duration) var(--slotted-control-transition-easing);white-space:nowrap}[data-ui=otp-input] [data-part=slot]:empty:before{color:var(--slotted-otp-input-placeholder-color, var(--slotted-text-muted));content:attr(data-placeholder)}[data-ui=otp-input][data-mask] [data-part=slot]:not(:empty){font-size:var(--slotted-otp-input-mask-size, var(--slotted-font-size-2xl, 1.25rem))}[data-ui=otp-input][data-attached]>[data-part=group]{gap:0}[data-ui=otp-input][data-attached] [data-part=slot]{border-radius:0}[data-ui=otp-input][data-attached] [data-part=slot]:not(:first-child){margin-inline-start:calc(var(--slotted-control-border-width, 1px) * -1)}[data-ui=otp-input][data-attached] [data-part=slot]:first-child{border-start-start-radius:var(--_radius);border-end-start-radius:var(--_radius)}[data-ui=otp-input][data-attached] [data-part=slot]:last-child{border-start-end-radius:var(--_radius);border-end-end-radius:var(--_radius)}[data-ui=otp-input][data-attached] [data-part=slot][data-current]{z-index:1}[data-ui=otp-input][data-part=root][data-size=sm]{--_height: var(--slotted-control-height-sm, 30px);--_font-size: var(--slotted-font-size-sm, .8125rem);--_gap: var(--slotted-control-gap-sm, 6px)}[data-ui=otp-input][data-part=root][data-size=md]{--_height: var(--slotted-control-height-md, 34px);--_font-size: var(--slotted-font-size-md, .875rem);--_gap: var(--slotted-control-gap-md, 8px)}[data-ui=otp-input][data-part=root][data-size=lg]{--_height: var(--slotted-control-height-lg, 38px);--_font-size: var(--slotted-font-size-lg, 1rem);--_gap: var(--slotted-control-gap-lg, 8px)}[data-ui=otp-input][data-variant=subtle] [data-part=slot]{background-color:var( --slotted-otp-input-subtle-background, var(--slotted-surface-sunken, Canvas) );border-color:var( --slotted-otp-input-subtle-border-color, var(--slotted-border-subtle, ButtonBorder) )}[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus) [data-part=slot][data-current]:empty:after{animation:slotted-otp-input-blink var(--slotted-duration-loop) step-end infinite;background-color:currentcolor;block-size:1em;content:\"\";inline-size:var(--_caret-width);position:absolute}@keyframes slotted-otp-input-blink{0%,50%{opacity:1}50.01%,to{opacity:0}}@media(prefers-reduced-motion:reduce){[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus) [data-part=slot][data-current]:empty:after{animation:none}}[data-ui=otp-input][data-part=root]:hover:not([data-disabled]):not([data-readonly]):not([data-invalid]) [data-part=slot]{border-color:var(--slotted-otp-input-hover-border-color, var(--slotted-tone-accent-border))}[data-ui=otp-input][data-part=root][data-variant=subtle]:hover:not([data-disabled]):not([data-readonly]):not([data-invalid]) [data-part=slot]{background-color:var( --slotted-otp-input-subtle-hover-background, var(--slotted-tone-secondary-subtle-hover) )}[data-ui=otp-input][data-part=root]:not([data-invalid]):has(>[data-part=input]:focus) [data-part=slot][data-current]{border-color:var(--slotted-otp-input-current-border-color, var(--slotted-tone-accent-border))}[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus) [data-part=slot][data-current]:not(:empty){background-color:var( --slotted-otp-input-selection-background, var(--slotted-tone-accent-surface) )}[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus-visible) [data-part=slot][data-current]{box-shadow:var(--slotted-control-shadow-focus-geometry, 0 1px 4px -1px) var(--slotted-focus-ring-color, Highlight);outline:var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);outline-offset:var(--slotted-focus-ring-offset, 2px)}[data-ui=otp-input][data-part=root][data-invalid]{--slotted-focus-ring-color: var( --slotted-otp-input-invalid-focus-ring-color, var(--slotted-focus-ring-color-invalid, Highlight) )}[data-ui=otp-input][data-part=root][data-invalid] [data-part=slot]{--_invalid-edge-width: var( --slotted-otp-input-invalid-edge-width, var(--slotted-control-invalid-edge-width, 1px) );--_invalid-edge-color: var( --slotted-otp-input-invalid-border-color, var(--slotted-tone-danger-border) );--_invalid-edge: inset 0 0 0 var(--_invalid-edge-width) var(--_invalid-edge-color);border-color:var(--slotted-otp-input-invalid-border-color, var(--slotted-tone-danger-border));box-shadow:var(--_invalid-edge)}[data-ui=otp-input][data-part=root][data-invalid]:has(>[data-part=input]:focus-visible) [data-part=slot][data-current]{box-shadow:var(--_invalid-edge),var(--slotted-control-shadow-focus-geometry, 0 1px 4px -1px) var(--slotted-focus-ring-color, Highlight)}@media(forced-colors:active){[data-ui=otp-input][data-part=root][data-invalid] [data-part=slot]{outline:var(--_invalid-edge-width) solid CanvasText;outline-offset:calc(-1 * (var(--slotted-control-border-width, 1px) + var(--_invalid-edge-width)))}[data-ui=otp-input][data-part=root][data-invalid]:has(>[data-part=input]:focus-visible) [data-part=slot][data-current]{outline:calc(var(--slotted-focus-ring-width, 2px) + var(--_invalid-edge-width)) double var(--slotted-focus-ring-color, Highlight);outline-offset:var(--slotted-focus-ring-offset, 2px)}}[data-ui=otp-input][data-part=root][data-readonly] [data-part=slot]{background-color:var( --slotted-otp-input-readonly-background, var(--slotted-tone-secondary-subtle-hover) );cursor:default}[data-ui=otp-input][data-part=root][data-readonly] [data-part=slot]:after{content:none}[data-ui=otp-input][data-part=root][data-disabled],[data-ui=otp-input][data-part=root]:has(>[data-part=input]:disabled){color:var(--slotted-otp-input-disabled-color, var(--slotted-disabled-foreground));cursor:not-allowed}[data-ui=otp-input][data-part=root][data-disabled] [data-part=slot],[data-ui=otp-input][data-part=root]:has(>[data-part=input]:disabled) [data-part=slot]{background-color:var( --slotted-otp-input-disabled-background, var(--slotted-disabled-background) );border-color:var(--slotted-otp-input-disabled-border-color, var(--slotted-disabled-border));box-shadow:none}@media(forced-colors:active){[data-ui=otp-input]>[data-part=input]{forced-color-adjust:none}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
190
|
+
}
|
|
191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SlOtpInput, decorators: [{
|
|
192
|
+
type: Component,
|
|
193
|
+
args: [{ selector: '[slOtpInput]', standalone: true, exportAs: 'slOtpInput', template: `<ng-content />
|
|
194
|
+
@for (group of groups(); track $index; let first = $first) {
|
|
195
|
+
@if (!first) {
|
|
196
|
+
<div data-part="separator" aria-hidden="true"></div>
|
|
197
|
+
}
|
|
198
|
+
<div data-part="group" aria-hidden="true">
|
|
199
|
+
@for (slot of group; track slot.index) {
|
|
200
|
+
<div
|
|
201
|
+
data-part="slot"
|
|
202
|
+
[attr.data-index]="slot.index"
|
|
203
|
+
[attr.data-current]="slot.current ? '' : null"
|
|
204
|
+
[attr.data-placeholder]="
|
|
205
|
+
slot.shown === '' && slot.placeholder !== '' ? slot.placeholder : null
|
|
206
|
+
"
|
|
207
|
+
[textContent]="slot.shown"
|
|
208
|
+
></div>
|
|
209
|
+
}
|
|
210
|
+
</div>
|
|
211
|
+
}`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
212
|
+
'data-ui': 'otp-input',
|
|
213
|
+
'data-part': 'root',
|
|
214
|
+
'[attr.data-size]': 'resolvedSize()',
|
|
215
|
+
'[attr.data-variant]': 'resolvedVariant()',
|
|
216
|
+
'[attr.data-attached]': "resolvedAttached() ? '' : null",
|
|
217
|
+
'[attr.data-mask]': "mask() ? '' : null",
|
|
218
|
+
'[attr.data-complete]': "complete() ? '' : null",
|
|
219
|
+
'[attr.data-disabled]': "control()?.resolvedDisabled() === true ? '' : null",
|
|
220
|
+
'[attr.data-invalid]': "control()?.resolvedInvalid() === true ? '' : null",
|
|
221
|
+
'[attr.data-readonly]': "control()?.resolvedReadOnly() === true ? '' : null",
|
|
222
|
+
'(pointerdown)': 'onPointerDown($event)',
|
|
223
|
+
}, styles: ["@layer slotted.components{[data-ui=otp-input][data-part=root]{--_height: var(--slotted-control-height-md, 34px);--_font-size: var(--slotted-font-size-md, .875rem);--_gap: var(--slotted-control-gap-md, 8px);--_radius: var(--slotted-otp-input-radius, var(--slotted-control-radius, 4px));--_caret-width: var(--slotted-otp-input-caret-width, var(--slotted-border-width-thin, 1px));align-items:center;color:var(--slotted-otp-input-color, var(--slotted-text, CanvasText));direction:ltr;display:inline-flex;font-family:var(--slotted-control-font-family, system-ui, sans-serif);font-size:var(--_font-size);font-weight:var(--slotted-otp-input-font-weight, var(--slotted-font-weight-medium, 500));font-variant-numeric:tabular-nums;gap:var(--slotted-otp-input-group-gap, var(--slotted-space-4, .5rem));inline-size:fit-content;line-height:1;max-inline-size:100%;position:relative}[data-ui=otp-input]>[data-part=input]{appearance:none;background-color:transparent;block-size:100%;border:0;box-shadow:none;caret-color:transparent;color:transparent;font:inherit;inline-size:100%;inset:0;margin:0;outline:none;padding:0;position:absolute;touch-action:manipulation;-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:transparent;z-index:1}[data-ui=otp-input]>[data-part=input]::selection{background-color:transparent!important;color:transparent!important;text-shadow:none!important;-webkit-text-fill-color:transparent!important}[data-ui=otp-input]>[data-part=input]{-webkit-user-drag:none}[data-ui=otp-input]>[data-part=input]:autofill{box-shadow:inset 0 0 0 100px var(--slotted-otp-input-autofill-background, var(--slotted-tone-accent-surface));-webkit-text-fill-color:transparent}[data-ui=otp-input]>[data-part=group]{align-items:center;display:flex;gap:var(--_gap);min-inline-size:0}[data-ui=otp-input]>[data-part=separator]{background-color:var( --slotted-otp-input-separator-color, var(--slotted-control-border-color, ButtonBorder) );block-size:var(--slotted-border-width-thick, 2px);border-radius:var(--slotted-radius-full, 9999px);flex:0 0 auto;inline-size:var(--slotted-otp-input-separator-size, var(--slotted-space-4, .5rem))}[data-ui=otp-input] [data-part=slot]{align-items:center;background-color:var(--slotted-otp-input-background, var(--slotted-control-surface, Field));block-size:var(--_height);border:var(--slotted-control-border-width, 1px) solid var(--slotted-otp-input-border-color, var(--slotted-control-border-color, ButtonBorder));border-radius:var(--_radius);box-shadow:var(--slotted-otp-input-shadow, var(--slotted-control-shadow, none));box-sizing:border-box;display:flex;flex:0 1 auto;inline-size:var(--_height);justify-content:center;min-inline-size:calc(var(--_height) * .6);position:relative;transition:background-color var(--slotted-control-transition-duration) var(--slotted-control-transition-easing),border-color var(--slotted-control-transition-duration) var(--slotted-control-transition-easing),box-shadow var(--slotted-control-transition-duration) var(--slotted-control-transition-easing);white-space:nowrap}[data-ui=otp-input] [data-part=slot]:empty:before{color:var(--slotted-otp-input-placeholder-color, var(--slotted-text-muted));content:attr(data-placeholder)}[data-ui=otp-input][data-mask] [data-part=slot]:not(:empty){font-size:var(--slotted-otp-input-mask-size, var(--slotted-font-size-2xl, 1.25rem))}[data-ui=otp-input][data-attached]>[data-part=group]{gap:0}[data-ui=otp-input][data-attached] [data-part=slot]{border-radius:0}[data-ui=otp-input][data-attached] [data-part=slot]:not(:first-child){margin-inline-start:calc(var(--slotted-control-border-width, 1px) * -1)}[data-ui=otp-input][data-attached] [data-part=slot]:first-child{border-start-start-radius:var(--_radius);border-end-start-radius:var(--_radius)}[data-ui=otp-input][data-attached] [data-part=slot]:last-child{border-start-end-radius:var(--_radius);border-end-end-radius:var(--_radius)}[data-ui=otp-input][data-attached] [data-part=slot][data-current]{z-index:1}[data-ui=otp-input][data-part=root][data-size=sm]{--_height: var(--slotted-control-height-sm, 30px);--_font-size: var(--slotted-font-size-sm, .8125rem);--_gap: var(--slotted-control-gap-sm, 6px)}[data-ui=otp-input][data-part=root][data-size=md]{--_height: var(--slotted-control-height-md, 34px);--_font-size: var(--slotted-font-size-md, .875rem);--_gap: var(--slotted-control-gap-md, 8px)}[data-ui=otp-input][data-part=root][data-size=lg]{--_height: var(--slotted-control-height-lg, 38px);--_font-size: var(--slotted-font-size-lg, 1rem);--_gap: var(--slotted-control-gap-lg, 8px)}[data-ui=otp-input][data-variant=subtle] [data-part=slot]{background-color:var( --slotted-otp-input-subtle-background, var(--slotted-surface-sunken, Canvas) );border-color:var( --slotted-otp-input-subtle-border-color, var(--slotted-border-subtle, ButtonBorder) )}[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus) [data-part=slot][data-current]:empty:after{animation:slotted-otp-input-blink var(--slotted-duration-loop) step-end infinite;background-color:currentcolor;block-size:1em;content:\"\";inline-size:var(--_caret-width);position:absolute}@keyframes slotted-otp-input-blink{0%,50%{opacity:1}50.01%,to{opacity:0}}@media(prefers-reduced-motion:reduce){[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus) [data-part=slot][data-current]:empty:after{animation:none}}[data-ui=otp-input][data-part=root]:hover:not([data-disabled]):not([data-readonly]):not([data-invalid]) [data-part=slot]{border-color:var(--slotted-otp-input-hover-border-color, var(--slotted-tone-accent-border))}[data-ui=otp-input][data-part=root][data-variant=subtle]:hover:not([data-disabled]):not([data-readonly]):not([data-invalid]) [data-part=slot]{background-color:var( --slotted-otp-input-subtle-hover-background, var(--slotted-tone-secondary-subtle-hover) )}[data-ui=otp-input][data-part=root]:not([data-invalid]):has(>[data-part=input]:focus) [data-part=slot][data-current]{border-color:var(--slotted-otp-input-current-border-color, var(--slotted-tone-accent-border))}[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus) [data-part=slot][data-current]:not(:empty){background-color:var( --slotted-otp-input-selection-background, var(--slotted-tone-accent-surface) )}[data-ui=otp-input][data-part=root]:has(>[data-part=input]:focus-visible) [data-part=slot][data-current]{box-shadow:var(--slotted-control-shadow-focus-geometry, 0 1px 4px -1px) var(--slotted-focus-ring-color, Highlight);outline:var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);outline-offset:var(--slotted-focus-ring-offset, 2px)}[data-ui=otp-input][data-part=root][data-invalid]{--slotted-focus-ring-color: var( --slotted-otp-input-invalid-focus-ring-color, var(--slotted-focus-ring-color-invalid, Highlight) )}[data-ui=otp-input][data-part=root][data-invalid] [data-part=slot]{--_invalid-edge-width: var( --slotted-otp-input-invalid-edge-width, var(--slotted-control-invalid-edge-width, 1px) );--_invalid-edge-color: var( --slotted-otp-input-invalid-border-color, var(--slotted-tone-danger-border) );--_invalid-edge: inset 0 0 0 var(--_invalid-edge-width) var(--_invalid-edge-color);border-color:var(--slotted-otp-input-invalid-border-color, var(--slotted-tone-danger-border));box-shadow:var(--_invalid-edge)}[data-ui=otp-input][data-part=root][data-invalid]:has(>[data-part=input]:focus-visible) [data-part=slot][data-current]{box-shadow:var(--_invalid-edge),var(--slotted-control-shadow-focus-geometry, 0 1px 4px -1px) var(--slotted-focus-ring-color, Highlight)}@media(forced-colors:active){[data-ui=otp-input][data-part=root][data-invalid] [data-part=slot]{outline:var(--_invalid-edge-width) solid CanvasText;outline-offset:calc(-1 * (var(--slotted-control-border-width, 1px) + var(--_invalid-edge-width)))}[data-ui=otp-input][data-part=root][data-invalid]:has(>[data-part=input]:focus-visible) [data-part=slot][data-current]{outline:calc(var(--slotted-focus-ring-width, 2px) + var(--_invalid-edge-width)) double var(--slotted-focus-ring-color, Highlight);outline-offset:var(--slotted-focus-ring-offset, 2px)}}[data-ui=otp-input][data-part=root][data-readonly] [data-part=slot]{background-color:var( --slotted-otp-input-readonly-background, var(--slotted-tone-secondary-subtle-hover) );cursor:default}[data-ui=otp-input][data-part=root][data-readonly] [data-part=slot]:after{content:none}[data-ui=otp-input][data-part=root][data-disabled],[data-ui=otp-input][data-part=root]:has(>[data-part=input]:disabled){color:var(--slotted-otp-input-disabled-color, var(--slotted-disabled-foreground));cursor:not-allowed}[data-ui=otp-input][data-part=root][data-disabled] [data-part=slot],[data-ui=otp-input][data-part=root]:has(>[data-part=input]:disabled) [data-part=slot]{background-color:var( --slotted-otp-input-disabled-background, var(--slotted-disabled-background) );border-color:var(--slotted-otp-input-disabled-border-color, var(--slotted-disabled-border));box-shadow:none}@media(forced-colors:active){[data-ui=otp-input]>[data-part=input]{forced-color-adjust:none}}}\n"] }]
|
|
224
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], attached: [{ type: i0.Input, args: [{ isSignal: true, alias: "attached", required: false }] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: false }] }], groupsInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "groups", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], mask: [{ type: i0.Input, args: [{ isSignal: true, alias: "mask", required: false }] }], control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SlOtpInputState), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The control itself: the value, the identifier, and everything the field
|
|
228
|
+
* around it says. `dragstart` is refused: a press on a selected character
|
|
229
|
+
* would otherwise drag that text, with a ghost of the character floating
|
|
230
|
+
* under the pointer, and in a full code a character is selected at every
|
|
231
|
+
* press.
|
|
232
|
+
*
|
|
233
|
+
* **The element owns the characters, and the directive keeps a copy.** The
|
|
234
|
+
* frame paints every character, so unlike `text-field` this mirror is the
|
|
235
|
+
* value and not only its length. `writeValue` from a form and a `[value]`
|
|
236
|
+
* binding both write the element; typing writes it directly, and the copy
|
|
237
|
+
* follows — which is what Angular's own `DefaultValueAccessor` does.
|
|
238
|
+
*
|
|
239
|
+
* **The selection is normalised, not the keys.** Every key is the browser's.
|
|
240
|
+
* After each change the directive makes sure a cursor inside the value has
|
|
241
|
+
* one character selected, so typing replaces it instead of being refused by
|
|
242
|
+
* `maxlength` — the rule `@slotted/core/otp` holds.
|
|
243
|
+
*
|
|
244
|
+
* **Unset means ask the field.** `disabled`, `readOnly` and `invalid` default
|
|
245
|
+
* to `undefined` rather than `false`. A value the consumer wrote as a static
|
|
246
|
+
* attribute is read before the host binding computes, so the binding never
|
|
247
|
+
* writes over it.
|
|
248
|
+
*/
|
|
249
|
+
class SlOtpInputControl {
|
|
250
|
+
/** Present means the consumer owns the value. */
|
|
251
|
+
value = input(undefined, /* @ts-ignore */
|
|
252
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
253
|
+
/** The value the control starts from when nobody else writes one. */
|
|
254
|
+
defaultValue = input(undefined, /* @ts-ignore */
|
|
255
|
+
...(ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []));
|
|
256
|
+
/** Which characters the code takes. Defaults to the token's, then `numeric`. */
|
|
257
|
+
type = input(undefined, /* @ts-ignore */
|
|
258
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
259
|
+
/** Tested against each character; outranks `type` in what is accepted. */
|
|
260
|
+
pattern = input(undefined, /* @ts-ignore */
|
|
261
|
+
...(ngDevMode ? [{ debugName: "pattern" }] : /* istanbul ignore next */ []));
|
|
262
|
+
/**
|
|
263
|
+
* Run over every edit before the filter: strip a `G-` prefix, uppercase a
|
|
264
|
+
* code the reader typed in lowercase.
|
|
265
|
+
*/
|
|
266
|
+
transform = input(undefined, /* @ts-ignore */
|
|
267
|
+
...(ngDevMode ? [{ debugName: "transform" }] : /* istanbul ignore next */ []));
|
|
268
|
+
/** Unstated rather than `false`, so the control defers to the field. */
|
|
269
|
+
disabled = input(undefined, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: (value) => (value === undefined ? undefined : booleanAttribute(value)) });
|
|
270
|
+
/** Unstated rather than `false`. Reaches the element as the native `readonly`. */
|
|
271
|
+
readOnly = input(undefined, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), transform: (value) => (value === undefined ? undefined : booleanAttribute(value)) });
|
|
272
|
+
/** Unstated rather than `false`. Reaches the element as `aria-invalid`. */
|
|
273
|
+
invalid = input(undefined, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: (value) => (value === undefined ? undefined : booleanAttribute(value)) });
|
|
274
|
+
/** Submits the owning form when the code is complete. */
|
|
275
|
+
autoSubmit = input(false, { ...(ngDevMode ? { debugName: "autoSubmit" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
276
|
+
/**
|
|
277
|
+
* Asks the platform for the code the moment an SMS arrives, where the
|
|
278
|
+
* WebOTP API exists. The request is abandoned when the form submits or the
|
|
279
|
+
* control is destroyed.
|
|
280
|
+
*/
|
|
281
|
+
webOtp = input(false, { ...(ngDevMode ? { debugName: "webOtp" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
282
|
+
/**
|
|
283
|
+
* One output for one transition, carrying the value, the value it replaces,
|
|
284
|
+
* the reason, the originating event and `cancel()`. There is no `[(value)]`,
|
|
285
|
+
* because a two-way binding has one slot and can carry none of those; a form
|
|
286
|
+
* gets the same movement through `ControlValueAccessor`.
|
|
287
|
+
*/
|
|
288
|
+
valueChange = output();
|
|
289
|
+
/** The value, the moment it reaches `length` characters. */
|
|
290
|
+
complete = output();
|
|
291
|
+
/** What an edit lost to the filter, before the value moves. */
|
|
292
|
+
rejected = output();
|
|
293
|
+
element = inject(ElementRef).nativeElement;
|
|
294
|
+
destroyRef = inject(DestroyRef);
|
|
295
|
+
/**
|
|
296
|
+
* The frame around the control. Injected without `optional`, so an `input`
|
|
297
|
+
* written without it fails at construction rather than silently losing its
|
|
298
|
+
* boxes. It is public because the host bindings read its length and mask.
|
|
299
|
+
*/
|
|
300
|
+
frame = inject(SlOtpInput);
|
|
301
|
+
field = inject(SlField, { optional: true });
|
|
302
|
+
defaults = injectOtpInputDefaults();
|
|
303
|
+
writtenId = inject(new HostAttributeToken('id'), { optional: true });
|
|
304
|
+
writtenType = inject(new HostAttributeToken('type'), { optional: true });
|
|
305
|
+
writtenAutocomplete = inject(new HostAttributeToken('autocomplete'), {
|
|
306
|
+
optional: true,
|
|
307
|
+
});
|
|
308
|
+
writtenInputMode = inject(new HostAttributeToken('inputmode'), {
|
|
309
|
+
optional: true,
|
|
310
|
+
});
|
|
311
|
+
writtenSpellcheck = inject(new HostAttributeToken('spellcheck'), {
|
|
312
|
+
optional: true,
|
|
313
|
+
});
|
|
314
|
+
writtenDescribedBy = inject(new HostAttributeToken('aria-describedby'), {
|
|
315
|
+
optional: true,
|
|
316
|
+
});
|
|
317
|
+
writtenInvalid = inject(new HostAttributeToken('aria-invalid'), {
|
|
318
|
+
optional: true,
|
|
319
|
+
});
|
|
320
|
+
writtenRequired = inject(new HostAttributeToken('aria-required'), {
|
|
321
|
+
optional: true,
|
|
322
|
+
});
|
|
323
|
+
writtenReadonly = inject(new HostAttributeToken('readonly'), { optional: true });
|
|
324
|
+
/** What the element is showing, cut to the code. */
|
|
325
|
+
mirror = signal('', /* @ts-ignore */
|
|
326
|
+
...(ngDevMode ? [{ debugName: "mirror" }] : /* istanbul ignore next */ []));
|
|
327
|
+
code = this.mirror.asReadonly();
|
|
328
|
+
ownSelection = signal(null, /* @ts-ignore */
|
|
329
|
+
...(ngDevMode ? [{ debugName: "ownSelection" }] : /* istanbul ignore next */ []));
|
|
330
|
+
selection = this.ownSelection.asReadonly();
|
|
331
|
+
ownFocused = signal(false, /* @ts-ignore */
|
|
332
|
+
...(ngDevMode ? [{ debugName: "ownFocused" }] : /* istanbul ignore next */ []));
|
|
333
|
+
focused = this.ownFocused.asReadonly();
|
|
334
|
+
previousSelection = null;
|
|
335
|
+
reported = null;
|
|
336
|
+
formDisabled = signal(undefined, /* @ts-ignore */
|
|
337
|
+
...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
|
|
338
|
+
onChangeFn = () => undefined;
|
|
339
|
+
onTouchedFn = () => undefined;
|
|
340
|
+
resolvedType = computed(() => this.frame.mask() ? 'password' : (this.writtenType ?? 'text'), /* @ts-ignore */
|
|
341
|
+
...(ngDevMode ? [{ debugName: "resolvedType" }] : /* istanbul ignore next */ []));
|
|
342
|
+
/** Which characters the code takes, stated here or by the token. */
|
|
343
|
+
codeType = computed(() => this.type() ?? this.defaults.type, /* @ts-ignore */
|
|
344
|
+
...(ngDevMode ? [{ debugName: "codeType" }] : /* istanbul ignore next */ []));
|
|
345
|
+
resolvedDisabled = computed(() => this.disabled() ?? this.formDisabled() ?? this.field?.resolvedDisabled(), /* @ts-ignore */
|
|
346
|
+
...(ngDevMode ? [{ debugName: "resolvedDisabled" }] : /* istanbul ignore next */ []));
|
|
347
|
+
resolvedReadOnly = computed(() => this.readOnly() ??
|
|
348
|
+
(this.writtenReadonly === null ? undefined : true) ??
|
|
349
|
+
this.field?.resolvedReadOnly(), /* @ts-ignore */
|
|
350
|
+
...(ngDevMode ? [{ debugName: "resolvedReadOnly" }] : /* istanbul ignore next */ []));
|
|
351
|
+
resolvedInvalid = computed(() => this.invalid() ?? this.field?.invalid(), /* @ts-ignore */
|
|
352
|
+
...(ngDevMode ? [{ debugName: "resolvedInvalid" }] : /* istanbul ignore next */ []));
|
|
353
|
+
controlId = computed(() => this.writtenId ?? this.field?.ids().control ?? null, /* @ts-ignore */
|
|
354
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
355
|
+
resolvedAutocomplete = computed(() => this.writtenAutocomplete ?? 'one-time-code', /* @ts-ignore */
|
|
356
|
+
...(ngDevMode ? [{ debugName: "resolvedAutocomplete" }] : /* istanbul ignore next */ []));
|
|
357
|
+
resolvedInputMode = computed(() => this.writtenInputMode ?? (this.codeType() === 'numeric' ? 'numeric' : 'text'), /* @ts-ignore */
|
|
358
|
+
...(ngDevMode ? [{ debugName: "resolvedInputMode" }] : /* istanbul ignore next */ []));
|
|
359
|
+
resolvedSpellcheck = computed(() => this.writtenSpellcheck ?? 'false', /* @ts-ignore */
|
|
360
|
+
...(ngDevMode ? [{ debugName: "resolvedSpellcheck" }] : /* istanbul ignore next */ []));
|
|
361
|
+
/** Merged after the consumer's own, so a tour step is read before the help. */
|
|
362
|
+
describedBy = computed(() => {
|
|
363
|
+
const merged = [this.writtenDescribedBy, this.field?.describedBy()].filter(Boolean);
|
|
364
|
+
return merged.length === 0 ? null : merged.join(' ');
|
|
365
|
+
}, /* @ts-ignore */
|
|
366
|
+
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
367
|
+
ariaInvalid = computed(() => this.writtenInvalid ?? (this.resolvedInvalid() === true ? 'true' : null), /* @ts-ignore */
|
|
368
|
+
...(ngDevMode ? [{ debugName: "ariaInvalid" }] : /* istanbul ignore next */ []));
|
|
369
|
+
ariaRequired = computed(() => this.writtenRequired ?? (this.field?.required() === true ? 'true' : null), /* @ts-ignore */
|
|
370
|
+
...(ngDevMode ? [{ debugName: "ariaRequired" }] : /* istanbul ignore next */ []));
|
|
371
|
+
disabledAttribute = computed(() => this.resolvedDisabled() === true ? '' : null, /* @ts-ignore */
|
|
372
|
+
...(ngDevMode ? [{ debugName: "disabledAttribute" }] : /* istanbul ignore next */ []));
|
|
373
|
+
readonlyAttribute = computed(() => this.resolvedReadOnly() === true ? '' : null, /* @ts-ignore */
|
|
374
|
+
...(ngDevMode ? [{ debugName: "readonlyAttribute" }] : /* istanbul ignore next */ []));
|
|
375
|
+
constructor() {
|
|
376
|
+
/* A consumer's own value writes the element, the way a form's does. */
|
|
377
|
+
effect(() => {
|
|
378
|
+
const next = this.value();
|
|
379
|
+
if (next === undefined)
|
|
380
|
+
return;
|
|
381
|
+
const clean = this.sanitize(next).value;
|
|
382
|
+
if (clean === this.element.value)
|
|
383
|
+
return;
|
|
384
|
+
this.element.value = clean;
|
|
385
|
+
this.mirror.set(clean);
|
|
386
|
+
this.reportCompletion();
|
|
387
|
+
});
|
|
388
|
+
/**
|
|
389
|
+
* The browser fires `selectionchange` on the document, for every control
|
|
390
|
+
* at once; it is read only while this one holds focus. `capture` because
|
|
391
|
+
* the event does not bubble in every engine.
|
|
392
|
+
*/
|
|
393
|
+
const onSelectionChange = () => {
|
|
394
|
+
if (this.ownFocused() && document.activeElement === this.element)
|
|
395
|
+
this.syncSelection();
|
|
396
|
+
};
|
|
397
|
+
document.addEventListener('selectionchange', onSelectionChange, { capture: true });
|
|
398
|
+
this.destroyRef.onDestroy(() => document.removeEventListener('selectionchange', onSelectionChange, { capture: true }));
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Angular creates every directive in a template before it binds any input,
|
|
402
|
+
* so the starting value is read here rather than in the constructor.
|
|
403
|
+
*/
|
|
404
|
+
ngOnInit() {
|
|
405
|
+
const initial = this.sanitize(this.defaultValue() ?? this.element.value).value;
|
|
406
|
+
if (initial !== this.element.value)
|
|
407
|
+
this.element.value = initial;
|
|
408
|
+
this.mirror.set(initial);
|
|
409
|
+
this.reportCompletion();
|
|
410
|
+
/**
|
|
411
|
+
* A native reset restores the element's own value and tells nothing, so
|
|
412
|
+
* the copy would keep painting the last thing typed.
|
|
413
|
+
*/
|
|
414
|
+
const form = this.element.form;
|
|
415
|
+
if (form !== null) {
|
|
416
|
+
const onReset = () => {
|
|
417
|
+
/* The element is restored after the event; the copy follows it. */
|
|
418
|
+
queueMicrotask(() => this.mirror.set(this.sanitize(this.element.value).value));
|
|
419
|
+
};
|
|
420
|
+
form.addEventListener('reset', onReset);
|
|
421
|
+
this.destroyRef.onDestroy(() => form.removeEventListener('reset', onReset));
|
|
422
|
+
}
|
|
423
|
+
if (this.webOtp())
|
|
424
|
+
this.requestWebOtp();
|
|
425
|
+
}
|
|
426
|
+
/** The native element, for `focus()`, `select()` and `setSelectionRange()`. */
|
|
427
|
+
get inputElement() {
|
|
428
|
+
return this.element;
|
|
429
|
+
}
|
|
430
|
+
writeValue(value) {
|
|
431
|
+
const clean = this.sanitize(value ?? '').value;
|
|
432
|
+
this.element.value = clean;
|
|
433
|
+
this.mirror.set(clean);
|
|
434
|
+
this.reportCompletion();
|
|
435
|
+
}
|
|
436
|
+
registerOnChange(fn) {
|
|
437
|
+
this.onChangeFn = fn;
|
|
438
|
+
}
|
|
439
|
+
registerOnTouched(fn) {
|
|
440
|
+
this.onTouchedFn = fn;
|
|
441
|
+
}
|
|
442
|
+
setDisabledState(isDisabled) {
|
|
443
|
+
this.formDisabled.set(isDisabled);
|
|
444
|
+
}
|
|
445
|
+
pressAt(index) {
|
|
446
|
+
const at = Math.min(index, this.element.value.length);
|
|
447
|
+
this.element.focus();
|
|
448
|
+
const end = at < this.element.value.length ? at + 1 : at;
|
|
449
|
+
this.previousSelection = null;
|
|
450
|
+
this.element.setSelectionRange(at, end);
|
|
451
|
+
this.syncSelection();
|
|
452
|
+
}
|
|
453
|
+
onInput(event) {
|
|
454
|
+
const element = this.element;
|
|
455
|
+
const { rejected, value: next } = this.sanitize(element.value);
|
|
456
|
+
if (rejected !== '')
|
|
457
|
+
this.rejected.emit({ text: rejected, source: event });
|
|
458
|
+
if (next !== element.value) {
|
|
459
|
+
/* What the filter dropped is taken out of the element, and the cursor
|
|
460
|
+
goes where the accepted characters end. */
|
|
461
|
+
const caret = Math.min(element.selectionStart ?? next.length, next.length);
|
|
462
|
+
element.value = next;
|
|
463
|
+
element.setSelectionRange(caret, caret);
|
|
464
|
+
}
|
|
465
|
+
/* After an edit the cursor is inserting: the next selection reads as one
|
|
466
|
+
that came from a caret, not from a selected character. */
|
|
467
|
+
const caret = element.selectionStart ?? next.length;
|
|
468
|
+
this.previousSelection = { start: caret, end: caret };
|
|
469
|
+
if (this.request(next, 'keyboard', event)) {
|
|
470
|
+
this.mirror.set(next);
|
|
471
|
+
this.onChangeFn(next);
|
|
472
|
+
this.reportCompletion();
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
/* Refused: the element goes back to what the copy holds. */
|
|
476
|
+
element.value = this.mirror();
|
|
477
|
+
}
|
|
478
|
+
this.syncSelection();
|
|
479
|
+
}
|
|
480
|
+
onFocus() {
|
|
481
|
+
this.ownFocused.set(true);
|
|
482
|
+
/* Focus lands after the last character, or on it when the code is full. */
|
|
483
|
+
const at = this.element.value.length;
|
|
484
|
+
this.element.setSelectionRange(Math.min(at, this.frame.resolvedLength() - 1), at);
|
|
485
|
+
this.previousSelection = null;
|
|
486
|
+
this.syncSelection();
|
|
487
|
+
}
|
|
488
|
+
onBlur() {
|
|
489
|
+
this.ownFocused.set(false);
|
|
490
|
+
this.ownSelection.set(null);
|
|
491
|
+
this.previousSelection = null;
|
|
492
|
+
this.onTouchedFn();
|
|
493
|
+
}
|
|
494
|
+
sanitize(text) {
|
|
495
|
+
return sanitize(text, {
|
|
496
|
+
length: this.frame.resolvedLength(),
|
|
497
|
+
pattern: this.pattern(),
|
|
498
|
+
transform: this.transform(),
|
|
499
|
+
type: this.codeType(),
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
/** Reads the element's selection, corrects it, and paints the current box. */
|
|
503
|
+
syncSelection() {
|
|
504
|
+
const element = this.element;
|
|
505
|
+
const start = element.selectionStart ?? element.value.length;
|
|
506
|
+
const end = element.selectionEnd ?? start;
|
|
507
|
+
const corrected = normalizeSelection({
|
|
508
|
+
start,
|
|
509
|
+
end,
|
|
510
|
+
valueLength: element.value.length,
|
|
511
|
+
length: this.frame.resolvedLength(),
|
|
512
|
+
previous: this.previousSelection ?? undefined,
|
|
513
|
+
});
|
|
514
|
+
if (corrected !== null) {
|
|
515
|
+
element.setSelectionRange(corrected.start, corrected.end, corrected.direction);
|
|
516
|
+
}
|
|
517
|
+
const final = corrected ?? { start, end };
|
|
518
|
+
this.previousSelection = final;
|
|
519
|
+
this.ownSelection.set(final);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Completion is a fact about the value, reported once per value: a full
|
|
523
|
+
* code edited into another full code reports again, and a code emptied and
|
|
524
|
+
* retyped reports again.
|
|
525
|
+
*/
|
|
526
|
+
reportCompletion() {
|
|
527
|
+
const code = this.mirror();
|
|
528
|
+
if (code.length !== this.frame.resolvedLength()) {
|
|
529
|
+
this.reported = null;
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (this.reported === code)
|
|
533
|
+
return;
|
|
534
|
+
this.reported = code;
|
|
535
|
+
this.complete.emit(code);
|
|
536
|
+
if (this.autoSubmit())
|
|
537
|
+
this.element.form?.requestSubmit();
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* The WebOTP API: where it exists, the platform hands over the code the
|
|
541
|
+
* moment the SMS arrives. Abandoned when the form submits on its own or the
|
|
542
|
+
* directive is destroyed, which is the shape MDN's example takes.
|
|
543
|
+
*/
|
|
544
|
+
requestWebOtp() {
|
|
545
|
+
if (typeof window === 'undefined' || !('OTPCredential' in window))
|
|
546
|
+
return;
|
|
547
|
+
const controller = new AbortController();
|
|
548
|
+
const form = this.element.form;
|
|
549
|
+
const abort = () => controller.abort();
|
|
550
|
+
form?.addEventListener('submit', abort);
|
|
551
|
+
this.destroyRef.onDestroy(() => {
|
|
552
|
+
form?.removeEventListener('submit', abort);
|
|
553
|
+
controller.abort();
|
|
554
|
+
});
|
|
555
|
+
navigator.credentials
|
|
556
|
+
.get({ otp: { transport: ['sms'] }, signal: controller.signal })
|
|
557
|
+
.then((credential) => {
|
|
558
|
+
const code = credential?.code;
|
|
559
|
+
if (code === undefined)
|
|
560
|
+
return;
|
|
561
|
+
const next = this.sanitize(code).value;
|
|
562
|
+
if (!this.request(next, 'programmatic', credential))
|
|
563
|
+
return;
|
|
564
|
+
this.element.value = next;
|
|
565
|
+
this.mirror.set(next);
|
|
566
|
+
this.onChangeFn(next);
|
|
567
|
+
this.reportCompletion();
|
|
568
|
+
})
|
|
569
|
+
.catch(() => undefined);
|
|
570
|
+
}
|
|
571
|
+
/** Emits the request and says whether anything may commit. */
|
|
572
|
+
request(next, reason, source) {
|
|
573
|
+
if (next === this.mirror())
|
|
574
|
+
return false;
|
|
575
|
+
let cancelled = false;
|
|
576
|
+
const state = createControllable({
|
|
577
|
+
controlled: undefined,
|
|
578
|
+
initial: this.mirror(),
|
|
579
|
+
onRequest: (request) => {
|
|
580
|
+
this.valueChange.emit(request);
|
|
581
|
+
cancelled = request.cancelled;
|
|
582
|
+
},
|
|
583
|
+
});
|
|
584
|
+
state.request(next, reason, source);
|
|
585
|
+
return !cancelled;
|
|
586
|
+
}
|
|
587
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SlOtpInputControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
588
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.7", type: SlOtpInputControl, isStandalone: true, selector: "input[slOtpInputControl]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, transform: { classPropertyName: "transform", publicName: "transform", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, autoSubmit: { classPropertyName: "autoSubmit", publicName: "autoSubmit", isSignal: true, isRequired: false, transformFunction: null }, webOtp: { classPropertyName: "webOtp", publicName: "webOtp", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", complete: "complete", rejected: "rejected" }, host: { attributes: { "data-part": "input" }, listeners: { "input": "onInput($event)", "dragstart": "$event.preventDefault()", "focus": "onFocus()", "blur": "onBlur()" }, properties: { "attr.id": "controlId()", "attr.type": "resolvedType()", "attr.autocomplete": "resolvedAutocomplete()", "attr.inputmode": "resolvedInputMode()", "attr.maxlength": "frame.resolvedLength()", "attr.spellcheck": "resolvedSpellcheck()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "ariaInvalid()", "attr.aria-required": "ariaRequired()", "attr.disabled": "disabledAttribute()", "attr.readonly": "readonlyAttribute()" } }, providers: [
|
|
589
|
+
{ provide: SlOtpInputState, useExisting: forwardRef(() => SlOtpInputControl) },
|
|
590
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SlOtpInputControl), multi: true },
|
|
591
|
+
], exportAs: ["slOtpInputControl"], ngImport: i0 });
|
|
592
|
+
}
|
|
593
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SlOtpInputControl, decorators: [{
|
|
594
|
+
type: Directive,
|
|
595
|
+
args: [{
|
|
596
|
+
selector: 'input[slOtpInputControl]',
|
|
597
|
+
standalone: true,
|
|
598
|
+
exportAs: 'slOtpInputControl',
|
|
599
|
+
providers: [
|
|
600
|
+
{ provide: SlOtpInputState, useExisting: forwardRef(() => SlOtpInputControl) },
|
|
601
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SlOtpInputControl), multi: true },
|
|
602
|
+
],
|
|
603
|
+
host: {
|
|
604
|
+
'data-part': 'input',
|
|
605
|
+
'[attr.id]': 'controlId()',
|
|
606
|
+
'[attr.type]': 'resolvedType()',
|
|
607
|
+
'[attr.autocomplete]': 'resolvedAutocomplete()',
|
|
608
|
+
'[attr.inputmode]': 'resolvedInputMode()',
|
|
609
|
+
'[attr.maxlength]': 'frame.resolvedLength()',
|
|
610
|
+
'[attr.spellcheck]': 'resolvedSpellcheck()',
|
|
611
|
+
'[attr.aria-describedby]': 'describedBy()',
|
|
612
|
+
'[attr.aria-invalid]': 'ariaInvalid()',
|
|
613
|
+
'[attr.aria-required]': 'ariaRequired()',
|
|
614
|
+
'[attr.disabled]': 'disabledAttribute()',
|
|
615
|
+
'[attr.readonly]': 'readonlyAttribute()',
|
|
616
|
+
'(input)': 'onInput($event)',
|
|
617
|
+
'(dragstart)': '$event.preventDefault()',
|
|
618
|
+
'(focus)': 'onFocus()',
|
|
619
|
+
'(blur)': 'onBlur()',
|
|
620
|
+
},
|
|
621
|
+
}]
|
|
622
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], transform: [{ type: i0.Input, args: [{ isSignal: true, alias: "transform", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], autoSubmit: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoSubmit", required: false }] }], webOtp: [{ type: i0.Input, args: [{ isSignal: true, alias: "webOtp", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], complete: [{ type: i0.Output, args: ["complete"] }], rejected: [{ type: i0.Output, args: ["rejected"] }] } });
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Generated bundle index. Do not edit.
|
|
626
|
+
*/
|
|
627
|
+
|
|
628
|
+
export { OTP_INPUT_DEFAULTS, SlOtpInput, SlOtpInputControl, SlOtpInputState, injectOtpInputDefaults, provideOtpInputDefaults };
|
|
629
|
+
//# sourceMappingURL=slotted-angular-otp-input.mjs.map
|