@ember-joinery/primitives 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +480 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +11 -2
- package/addon-main.cjs +4 -0
- package/declarations/-private/combobox-list.d.ts +59 -0
- package/declarations/-private/combobox-list.d.ts.map +1 -0
- package/declarations/-private/command-score.d.ts +33 -0
- package/declarations/-private/command-score.d.ts.map +1 -0
- package/declarations/-private/delay-group.d.ts +47 -0
- package/declarations/-private/delay-group.d.ts.map +1 -0
- package/declarations/-private/dialog.d.ts +180 -0
- package/declarations/-private/dialog.d.ts.map +1 -0
- package/declarations/-private/form-control.d.ts +70 -0
- package/declarations/-private/form-control.d.ts.map +1 -0
- package/declarations/-private/form-data.d.ts +14 -0
- package/declarations/-private/form-data.d.ts.map +1 -0
- package/declarations/-private/hover-intent.d.ts +48 -0
- package/declarations/-private/hover-intent.d.ts.map +1 -0
- package/declarations/-private/image-loading.d.ts +77 -0
- package/declarations/-private/image-loading.d.ts.map +1 -0
- package/declarations/-private/indicator.d.ts +27 -0
- package/declarations/-private/indicator.d.ts.map +1 -0
- package/declarations/-private/instances.d.ts +11 -0
- package/declarations/-private/instances.d.ts.map +1 -0
- package/declarations/-private/layout-styles.d.ts +34 -0
- package/declarations/-private/layout-styles.d.ts.map +1 -0
- package/declarations/-private/menu.d.ts +616 -0
- package/declarations/-private/menu.d.ts.map +1 -0
- package/declarations/-private/observers.d.ts +35 -0
- package/declarations/-private/observers.d.ts.map +1 -0
- package/declarations/-private/popper.d.ts +149 -0
- package/declarations/-private/popper.d.ts.map +1 -0
- package/declarations/-private/presence-chart.d.ts +39 -0
- package/declarations/-private/presence-chart.d.ts.map +1 -0
- package/declarations/-private/promise-state.d.ts +41 -0
- package/declarations/-private/promise-state.d.ts.map +1 -0
- package/declarations/-private/scroll-end.d.ts +16 -0
- package/declarations/-private/scroll-end.d.ts.map +1 -0
- package/declarations/-private/scroll-visibility.d.ts +68 -0
- package/declarations/-private/scroll-visibility.d.ts.map +1 -0
- package/declarations/-private/toast.d.ts +119 -0
- package/declarations/-private/toast.d.ts.map +1 -0
- package/declarations/-private/typeahead-search.d.ts +29 -0
- package/declarations/-private/typeahead-search.d.ts.map +1 -0
- package/declarations/accordion.d.ts +284 -0
- package/declarations/accordion.d.ts.map +1 -0
- package/declarations/alert-dialog.d.ts +80 -0
- package/declarations/alert-dialog.d.ts.map +1 -0
- package/declarations/anchor/component.d.ts +63 -0
- package/declarations/anchor/component.d.ts.map +1 -0
- package/declarations/anchor/index.d.ts +7 -0
- package/declarations/anchor/index.d.ts.map +1 -0
- package/declarations/anchor/middleware.d.ts +46 -0
- package/declarations/anchor/middleware.d.ts.map +1 -0
- package/declarations/anchor/modifier.d.ts +34 -0
- package/declarations/anchor/modifier.d.ts.map +1 -0
- package/declarations/anchor/options.d.ts +112 -0
- package/declarations/anchor/options.d.ts.map +1 -0
- package/declarations/anchor/position.d.ts +36 -0
- package/declarations/anchor/position.d.ts.map +1 -0
- package/declarations/anchor.d.ts +2 -0
- package/declarations/as.d.ts +33 -0
- package/declarations/as.d.ts.map +1 -0
- package/declarations/aspect-ratio.d.ts +34 -0
- package/declarations/aspect-ratio.d.ts.map +1 -0
- package/declarations/avatar.d.ts +178 -0
- package/declarations/avatar.d.ts.map +1 -0
- package/declarations/body-class.d.ts +30 -0
- package/declarations/body-class.d.ts.map +1 -0
- package/declarations/breadcrumb.d.ts +64 -0
- package/declarations/breadcrumb.d.ts.map +1 -0
- package/declarations/calendar/dates.d.ts +142 -0
- package/declarations/calendar/dates.d.ts.map +1 -0
- package/declarations/calendar/index.d.ts +59 -0
- package/declarations/calendar/index.d.ts.map +1 -0
- package/declarations/calendar/state.d.ts +415 -0
- package/declarations/calendar/state.d.ts.map +1 -0
- package/declarations/calendar.d.ts +3 -0
- package/declarations/checkbox.d.ts +71 -0
- package/declarations/checkbox.d.ts.map +1 -0
- package/declarations/collapsible.d.ts +216 -0
- package/declarations/collapsible.d.ts.map +1 -0
- package/declarations/color-scheme.d.ts +115 -0
- package/declarations/color-scheme.d.ts.map +1 -0
- package/declarations/combobox.d.ts +569 -0
- package/declarations/combobox.d.ts.map +1 -0
- package/declarations/command.d.ts +410 -0
- package/declarations/command.d.ts.map +1 -0
- package/declarations/context-menu.d.ts +155 -0
- package/declarations/context-menu.d.ts.map +1 -0
- package/declarations/controllable-state.d.ts +85 -0
- package/declarations/controllable-state.d.ts.map +1 -0
- package/declarations/dialog.d.ts +80 -0
- package/declarations/dialog.d.ts.map +1 -0
- package/declarations/direction.d.ts +55 -0
- package/declarations/direction.d.ts.map +1 -0
- package/declarations/dismiss.d.ts +111 -0
- package/declarations/dismiss.d.ts.map +1 -0
- package/declarations/dom-context.d.ts +74 -0
- package/declarations/dom-context.d.ts.map +1 -0
- package/declarations/drawer/controller.d.ts +174 -0
- package/declarations/drawer/controller.d.ts.map +1 -0
- package/declarations/drawer/index.d.ts +105 -0
- package/declarations/drawer/index.d.ts.map +1 -0
- package/declarations/drawer/machine.d.ts +139 -0
- package/declarations/drawer/machine.d.ts.map +1 -0
- package/declarations/drawer/parts.d.ts +85 -0
- package/declarations/drawer/parts.d.ts.map +1 -0
- package/declarations/drawer.d.ts +2 -0
- package/declarations/dropdown-menu.d.ts +169 -0
- package/declarations/dropdown-menu.d.ts.map +1 -0
- package/declarations/external-link.d.ts +26 -0
- package/declarations/external-link.d.ts.map +1 -0
- package/declarations/file-drop.d.ts +119 -0
- package/declarations/file-drop.d.ts.map +1 -0
- package/declarations/focus-scope.d.ts +105 -0
- package/declarations/focus-scope.d.ts.map +1 -0
- package/declarations/focus.d.ts +114 -0
- package/declarations/focus.d.ts.map +1 -0
- package/declarations/head.d.ts +20 -0
- package/declarations/head.d.ts.map +1 -0
- package/declarations/heading.d.ts +59 -0
- package/declarations/heading.d.ts.map +1 -0
- package/declarations/hero.d.ts +32 -0
- package/declarations/hero.d.ts.map +1 -0
- package/declarations/hide-others.d.ts +35 -0
- package/declarations/hide-others.d.ts.map +1 -0
- package/declarations/hover-card.d.ts +148 -0
- package/declarations/hover-card.d.ts.map +1 -0
- package/declarations/i18n.d.ts +47 -0
- package/declarations/i18n.d.ts.map +1 -0
- package/declarations/id.d.ts +15 -0
- package/declarations/id.d.ts.map +1 -0
- package/declarations/iframe.d.ts +12 -0
- package/declarations/iframe.d.ts.map +1 -0
- package/declarations/incremental-each.d.ts +81 -0
- package/declarations/incremental-each.d.ts.map +1 -0
- package/declarations/index.d.ts +108 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/input-otp.d.ts +201 -0
- package/declarations/input-otp.d.ts.map +1 -0
- package/declarations/keys.d.ts +50 -0
- package/declarations/keys.d.ts.map +1 -0
- package/declarations/label.d.ts +36 -0
- package/declarations/label.d.ts.map +1 -0
- package/declarations/layer.d.ts +56 -0
- package/declarations/layer.d.ts.map +1 -0
- package/declarations/link-helper.d.ts +73 -0
- package/declarations/link-helper.d.ts.map +1 -0
- package/declarations/link.d.ts +60 -0
- package/declarations/link.d.ts.map +1 -0
- package/declarations/load.d.ts +47 -0
- package/declarations/load.d.ts.map +1 -0
- package/declarations/menubar.d.ts +231 -0
- package/declarations/menubar.d.ts.map +1 -0
- package/declarations/message-scroller/components.d.ts +229 -0
- package/declarations/message-scroller/components.d.ts.map +1 -0
- package/declarations/message-scroller/geometry.d.ts +95 -0
- package/declarations/message-scroller/geometry.d.ts.map +1 -0
- package/declarations/message-scroller/index.d.ts +4 -0
- package/declarations/message-scroller/index.d.ts.map +1 -0
- package/declarations/message-scroller/state.d.ts +124 -0
- package/declarations/message-scroller/state.d.ts.map +1 -0
- package/declarations/message-scroller.d.ts +2 -0
- package/declarations/messages.d.ts +166 -0
- package/declarations/messages.d.ts.map +1 -0
- package/declarations/narrowing.d.ts +24 -0
- package/declarations/narrowing.d.ts.map +1 -0
- package/declarations/native-form.d.ts +56 -0
- package/declarations/native-form.d.ts.map +1 -0
- package/declarations/native-value.d.ts +47 -0
- package/declarations/native-value.d.ts.map +1 -0
- package/declarations/navigation-menu.d.ts +406 -0
- package/declarations/navigation-menu.d.ts.map +1 -0
- package/declarations/on-resize.d.ts +32 -0
- package/declarations/on-resize.d.ts.map +1 -0
- package/declarations/part.d.ts +99 -0
- package/declarations/part.d.ts.map +1 -0
- package/declarations/popover.d.ts +236 -0
- package/declarations/popover.d.ts.map +1 -0
- package/declarations/portal/index.d.ts +3 -0
- package/declarations/portal/index.d.ts.map +1 -0
- package/declarations/portal/portal.d.ts +46 -0
- package/declarations/portal/portal.d.ts.map +1 -0
- package/declarations/portal/targets.d.ts +40 -0
- package/declarations/portal/targets.d.ts.map +1 -0
- package/declarations/portal.d.ts +2 -0
- package/declarations/presence.d.ts +80 -0
- package/declarations/presence.d.ts.map +1 -0
- package/declarations/progress.d.ts +98 -0
- package/declarations/progress.d.ts.map +1 -0
- package/declarations/proper-links.d.ts +69 -0
- package/declarations/proper-links.d.ts.map +1 -0
- package/declarations/qp.d.ts +55 -0
- package/declarations/qp.d.ts.map +1 -0
- package/declarations/questionnaire/components.d.ts +348 -0
- package/declarations/questionnaire/components.d.ts.map +1 -0
- package/declarations/questionnaire/index.d.ts +4 -0
- package/declarations/questionnaire/index.d.ts.map +1 -0
- package/declarations/questionnaire/state.d.ts +400 -0
- package/declarations/questionnaire/state.d.ts.map +1 -0
- package/declarations/questionnaire/utils.d.ts +65 -0
- package/declarations/questionnaire/utils.d.ts.map +1 -0
- package/declarations/questionnaire.d.ts +2 -0
- package/declarations/radio-group.d.ts +115 -0
- package/declarations/radio-group.d.ts.map +1 -0
- package/declarations/rating.d.ts +214 -0
- package/declarations/rating.d.ts.map +1 -0
- package/declarations/resizable/components.d.ts +107 -0
- package/declarations/resizable/components.d.ts.map +1 -0
- package/declarations/resizable/index.d.ts +4 -0
- package/declarations/resizable/index.d.ts.map +1 -0
- package/declarations/resizable/layout.d.ts +93 -0
- package/declarations/resizable/layout.d.ts.map +1 -0
- package/declarations/resizable/state.d.ts +211 -0
- package/declarations/resizable/state.d.ts.map +1 -0
- package/declarations/resizable.d.ts +2 -0
- package/declarations/resize-observer.d.ts +40 -0
- package/declarations/resize-observer.d.ts.map +1 -0
- package/declarations/roving-focus.d.ts +204 -0
- package/declarations/roving-focus.d.ts.map +1 -0
- package/declarations/scroll-area/components.d.ts +125 -0
- package/declarations/scroll-area/components.d.ts.map +1 -0
- package/declarations/scroll-area/index.d.ts +3 -0
- package/declarations/scroll-area/index.d.ts.map +1 -0
- package/declarations/scroll-area/state.d.ts +147 -0
- package/declarations/scroll-area/state.d.ts.map +1 -0
- package/declarations/scroll-area.d.ts +2 -0
- package/declarations/scroll-lock.d.ts +69 -0
- package/declarations/scroll-lock.d.ts.map +1 -0
- package/declarations/scroller.d.ts +71 -0
- package/declarations/scroller.d.ts.map +1 -0
- package/declarations/select.d.ts +459 -0
- package/declarations/select.d.ts.map +1 -0
- package/declarations/separator.d.ts +71 -0
- package/declarations/separator.d.ts.map +1 -0
- package/declarations/service.d.ts +83 -0
- package/declarations/service.d.ts.map +1 -0
- package/declarations/shadowed.d.ts +63 -0
- package/declarations/shadowed.d.ts.map +1 -0
- package/declarations/slider.d.ts +283 -0
- package/declarations/slider.d.ts.map +1 -0
- package/declarations/sticky-footer.d.ts +43 -0
- package/declarations/sticky-footer.d.ts.map +1 -0
- package/declarations/store.d.ts +47 -0
- package/declarations/store.d.ts.map +1 -0
- package/declarations/switch.d.ts +76 -0
- package/declarations/switch.d.ts.map +1 -0
- package/declarations/tabs.d.ts +250 -0
- package/declarations/tabs.d.ts.map +1 -0
- package/declarations/toast/icons.d.ts +29 -0
- package/declarations/toast/icons.d.ts.map +1 -0
- package/declarations/toast/index.d.ts +4 -0
- package/declarations/toast/index.d.ts.map +1 -0
- package/declarations/toast/item.d.ts +162 -0
- package/declarations/toast/item.d.ts.map +1 -0
- package/declarations/toast/state.d.ts +276 -0
- package/declarations/toast/state.d.ts.map +1 -0
- package/declarations/toast/styles.d.ts +20 -0
- package/declarations/toast/styles.d.ts.map +1 -0
- package/declarations/toast/toaster.d.ts +173 -0
- package/declarations/toast/toaster.d.ts.map +1 -0
- package/declarations/toast.d.ts +2 -0
- package/declarations/toggle-group.d.ts +161 -0
- package/declarations/toggle-group.d.ts.map +1 -0
- package/declarations/toggle.d.ts +70 -0
- package/declarations/toggle.d.ts.map +1 -0
- package/declarations/tooltip.d.ts +227 -0
- package/declarations/tooltip.d.ts.map +1 -0
- package/declarations/typeahead.d.ts +97 -0
- package/declarations/typeahead.d.ts.map +1 -0
- package/declarations/viewport.d.ts +109 -0
- package/declarations/viewport.d.ts.map +1 -0
- package/declarations/visually-hidden.d.ts +42 -0
- package/declarations/visually-hidden.d.ts.map +1 -0
- package/declarations/zoetrope.d.ts +120 -0
- package/declarations/zoetrope.d.ts.map +1 -0
- package/dist/accordion.js +367 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert-dialog.js +122 -0
- package/dist/alert-dialog.js.map +1 -0
- package/dist/anchor.js +2 -0
- package/dist/anchor.js.map +1 -0
- package/dist/as.js +60 -0
- package/dist/as.js.map +1 -0
- package/dist/aspect-ratio.js +59 -0
- package/dist/aspect-ratio.js.map +1 -0
- package/dist/avatar.js +464 -0
- package/dist/avatar.js.map +1 -0
- package/dist/body-class.js +57 -0
- package/dist/body-class.js.map +1 -0
- package/dist/breadcrumb.js +59 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/calendar.js +1494 -0
- package/dist/calendar.js.map +1 -0
- package/dist/checkbox.js +81 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/collapsible.js +255 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/color-scheme.js +306 -0
- package/dist/color-scheme.js.map +1 -0
- package/dist/combobox.js +1413 -0
- package/dist/combobox.js.map +1 -0
- package/dist/command.js +1054 -0
- package/dist/command.js.map +1 -0
- package/dist/component-DqLt83fo.js +886 -0
- package/dist/component-DqLt83fo.js.map +1 -0
- package/dist/components-CWfg0cFs.js +1745 -0
- package/dist/components-CWfg0cFs.js.map +1 -0
- package/dist/components-DBWszEI3.js +1285 -0
- package/dist/components-DBWszEI3.js.map +1 -0
- package/dist/components-DI8Azu05.js +1542 -0
- package/dist/components-DI8Azu05.js.map +1 -0
- package/dist/components-F0Ini448.js +875 -0
- package/dist/components-F0Ini448.js.map +1 -0
- package/dist/context-menu.js +207 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/controllable-state.js +134 -0
- package/dist/controllable-state.js.map +1 -0
- package/dist/delay-group-B1K03gBL.js +75 -0
- package/dist/delay-group-B1K03gBL.js.map +1 -0
- package/dist/dialog-3gfz_8NA.js +349 -0
- package/dist/dialog-3gfz_8NA.js.map +1 -0
- package/dist/dialog.js +57 -0
- package/dist/dialog.js.map +1 -0
- package/dist/direction.js +75 -0
- package/dist/direction.js.map +1 -0
- package/dist/dismiss.js +329 -0
- package/dist/dismiss.js.map +1 -0
- package/dist/dom-context.js +104 -0
- package/dist/dom-context.js.map +1 -0
- package/dist/drawer.js +1456 -0
- package/dist/drawer.js.map +1 -0
- package/dist/dropdown-menu.js +201 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/external-link.js +21 -0
- package/dist/external-link.js.map +1 -0
- package/dist/file-drop.js +183 -0
- package/dist/file-drop.js.map +1 -0
- package/dist/focus-scope.js +292 -0
- package/dist/focus-scope.js.map +1 -0
- package/dist/focus.js +311 -0
- package/dist/focus.js.map +1 -0
- package/dist/form-control-Ca_KHSKK.js +177 -0
- package/dist/form-control-Ca_KHSKK.js.map +1 -0
- package/dist/head.js +25 -0
- package/dist/head.js.map +1 -0
- package/dist/heading.js +152 -0
- package/dist/heading.js.map +1 -0
- package/dist/hero.js +36 -0
- package/dist/hero.js.map +1 -0
- package/dist/hide-others.js +108 -0
- package/dist/hide-others.js.map +1 -0
- package/dist/hover-card.js +246 -0
- package/dist/hover-card.js.map +1 -0
- package/dist/hover-intent-Bxb83fgX.js +92 -0
- package/dist/hover-intent-Bxb83fgX.js.map +1 -0
- package/dist/i18n.js +72 -0
- package/dist/i18n.js.map +1 -0
- package/dist/id.js +24 -0
- package/dist/id.js.map +1 -0
- package/dist/iframe.js +19 -0
- package/dist/iframe.js.map +1 -0
- package/dist/incremental-each.js +181 -0
- package/dist/incremental-each.js.map +1 -0
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -0
- package/dist/indicator-sYuRuFJA.js +26 -0
- package/dist/indicator-sYuRuFJA.js.map +1 -0
- package/dist/input-otp.js +611 -0
- package/dist/input-otp.js.map +1 -0
- package/dist/keys.js +65 -0
- package/dist/keys.js.map +1 -0
- package/dist/label.js +41 -0
- package/dist/label.js.map +1 -0
- package/dist/layer.js +157 -0
- package/dist/layer.js.map +1 -0
- package/dist/layout-styles-DY86so8a.js +81 -0
- package/dist/layout-styles-DY86so8a.js.map +1 -0
- package/dist/link-helper.js +122 -0
- package/dist/link-helper.js.map +1 -0
- package/dist/link.js +39 -0
- package/dist/link.js.map +1 -0
- package/dist/load.js +54 -0
- package/dist/load.js.map +1 -0
- package/dist/menu-Da1LFCet.js +1109 -0
- package/dist/menu-Da1LFCet.js.map +1 -0
- package/dist/menubar.js +357 -0
- package/dist/menubar.js.map +1 -0
- package/dist/message-scroller.js +2 -0
- package/dist/message-scroller.js.map +1 -0
- package/dist/messages.js +168 -0
- package/dist/messages.js.map +1 -0
- package/dist/narrowing.js +29 -0
- package/dist/narrowing.js.map +1 -0
- package/dist/native-form.js +134 -0
- package/dist/native-form.js.map +1 -0
- package/dist/native-value.js +125 -0
- package/dist/native-value.js.map +1 -0
- package/dist/navigation-menu.js +872 -0
- package/dist/navigation-menu.js.map +1 -0
- package/dist/observers-aItWe029.js +113 -0
- package/dist/observers-aItWe029.js.map +1 -0
- package/dist/on-resize.js +47 -0
- package/dist/on-resize.js.map +1 -0
- package/dist/part.js +291 -0
- package/dist/part.js.map +1 -0
- package/dist/popover.js +419 -0
- package/dist/popover.js.map +1 -0
- package/dist/popper-BbTzV8dP.js +323 -0
- package/dist/popper-BbTzV8dP.js.map +1 -0
- package/dist/portal-U554WDI9.js +214 -0
- package/dist/portal-U554WDI9.js.map +1 -0
- package/dist/portal.js +2 -0
- package/dist/portal.js.map +1 -0
- package/dist/presence.js +243 -0
- package/dist/presence.js.map +1 -0
- package/dist/progress.js +106 -0
- package/dist/progress.js.map +1 -0
- package/dist/promise-state-BMi2zVoT.js +91 -0
- package/dist/promise-state-BMi2zVoT.js.map +1 -0
- package/dist/proper-links.js +136 -0
- package/dist/proper-links.js.map +1 -0
- package/dist/qp.js +77 -0
- package/dist/qp.js.map +1 -0
- package/dist/questionnaire.js +2 -0
- package/dist/questionnaire.js.map +1 -0
- package/dist/radio-group.js +149 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/rating.js +261 -0
- package/dist/rating.js.map +1 -0
- package/dist/resizable.js +2 -0
- package/dist/resizable.js.map +1 -0
- package/dist/resize-observer.js +85 -0
- package/dist/resize-observer.js.map +1 -0
- package/dist/roving-focus.js +355 -0
- package/dist/roving-focus.js.map +1 -0
- package/dist/scroll-area.js +2 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/scroll-end-Cer8JSIB.js +87 -0
- package/dist/scroll-end-Cer8JSIB.js.map +1 -0
- package/dist/scroll-lock.js +267 -0
- package/dist/scroll-lock.js.map +1 -0
- package/dist/scroller.js +117 -0
- package/dist/scroller.js.map +1 -0
- package/dist/select.js +1223 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.js +80 -0
- package/dist/separator.js.map +1 -0
- package/dist/service.js +160 -0
- package/dist/service.js.map +1 -0
- package/dist/shadowed.js +70 -0
- package/dist/shadowed.js.map +1 -0
- package/dist/slider.js +586 -0
- package/dist/slider.js.map +1 -0
- package/dist/sticky-footer.js +40 -0
- package/dist/sticky-footer.js.map +1 -0
- package/dist/store-BjiAd-KP.js +93 -0
- package/dist/store-BjiAd-KP.js.map +1 -0
- package/dist/store.js +4 -0
- package/dist/store.js.map +1 -0
- package/dist/switch.js +58 -0
- package/dist/switch.js.map +1 -0
- package/dist/tabs.js +458 -0
- package/dist/tabs.js.map +1 -0
- package/dist/toast.js +2 -0
- package/dist/toast.js.map +1 -0
- package/dist/toaster-DwprFZ1J.js +1518 -0
- package/dist/toaster-DwprFZ1J.js.map +1 -0
- package/dist/toggle-group.js +221 -0
- package/dist/toggle-group.js.map +1 -0
- package/dist/toggle.js +78 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tooltip.js +422 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/typeahead.js +233 -0
- package/dist/typeahead.js.map +1 -0
- package/dist/viewport.js +138 -0
- package/dist/viewport.js.map +1 -0
- package/dist/visually-hidden.js +49 -0
- package/dist/visually-hidden.js.map +1 -0
- package/dist/zoetrope.js +336 -0
- package/dist/zoetrope.js.map +1 -0
- package/package.json +101 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indicator-sYuRuFJA.js","sources":["../src/-private/indicator.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only'\nimport { modifier } from 'ember-modifier'\nimport { As, type TagName } from '../as.gts'\nimport { Presence } from '../presence.gts'\n\n/**\n * `pointer-events: none`, as Radix puts on its indicators, so a click on the mark reaches the\n * control. Set through the CSSOM: a strict Content Security Policy blocks a `style` attribute.\n */\nconst passThrough = modifier((element: HTMLElement) => {\n element.style.setProperty('pointer-events', 'none')\n})\n\nexport interface IndicatorSignature {\n Args: {\n /** Keep it rendered while the control is unchecked too, to animate it yourself. */\n forceMount?: boolean\n /** The tag to render. Default `span`. */\n as?: TagName\n /** @internal Bound by the control: whether it shows. */\n present: boolean\n /** @internal Bound by the control: its `data-state`. */\n state: string\n /** @internal Bound by the control. */\n disabled?: boolean\n }\n Blocks: { default: [] }\n Element: HTMLElement\n}\n\n/**\n * The mark inside a checkbox or a radio: Radix's `Checkbox.Indicator` and\n * `RadioGroup.Indicator`. It renders while the control is checked (or indeterminate), and\n * stays through an exit animation keyed on its `data-state`, as Radix's `Presence` does.\n */\nexport const Indicator: TOC<IndicatorSignature> = <template>\n <Presence @present={{@present}} @forceMount={{@forceMount}} as |presence|>\n <As\n @as={{@as}}\n @tag=\"span\"\n data-state={{@state}}\n data-disabled={{if @disabled \"\"}}\n data-test-jn-part=\"indicator\"\n ...attributes\n {{presence.ref}}\n {{passThrough}}\n >{{yield}}</As>\n </Presence>\n</template>\n"],"names":["passThrough","modifier","element","style","setProperty","Indicator","setComponentTemplate","precompileTemplate","strictMode","scope","Presence","As","templateOnly"],"mappings":";;;;;;;AASA,MAAMA,WAAA,GAAcC,QAAA,CAAUC,OAAS,IAAA;EACrCA,OAAA,CAAQC,KAAK,CAACC,WAAW,CAAC,gBAAA,EAAkB,MAAA,CAAA;AAC9C,CAAA,CAAA;AAmBA;;;;AAIC;MACYC,SAAe,GAAAC,oBAAA,CAAsBC,kBAAA,CAAA,kRAAA,EAalD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,QAAA;IAAAC,EAAA;AAAAX,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAY,YAAA,EAAA;;"}
|
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked, cached } from '@glimmer/tracking';
|
|
3
|
+
import { registerDestructor } from '@ember/destroyable';
|
|
4
|
+
import { hash } from '@ember/helper';
|
|
5
|
+
import { on } from '@ember/modifier';
|
|
6
|
+
import { buildWaiter } from '@ember/test-waiters';
|
|
7
|
+
import Modifier from 'ember-modifier';
|
|
8
|
+
import { As } from './as.js';
|
|
9
|
+
import { controllable } from './controllable-state.js';
|
|
10
|
+
import { getDirection } from './direction.js';
|
|
11
|
+
import { format, t } from './i18n.js';
|
|
12
|
+
import { messages } from './messages.js';
|
|
13
|
+
import { isString } from '@sindresorhus/is';
|
|
14
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
15
|
+
import { setComponentTemplate } from '@ember/component';
|
|
16
|
+
import templateOnly from '@ember/component/template-only';
|
|
17
|
+
import { g, i, n } from 'decorator-transforms/runtime';
|
|
18
|
+
|
|
19
|
+
const waiter = buildWaiter('@ember-joinery/primitives:input-otp');
|
|
20
|
+
/** Only digits: `@pattern={{REGEXP_ONLY_DIGITS}}`. */
|
|
21
|
+
const REGEXP_ONLY_DIGITS = '^\\d+$';
|
|
22
|
+
/** Only Latin letters. */
|
|
23
|
+
const REGEXP_ONLY_CHARS = '^[a-zA-Z]+$';
|
|
24
|
+
/** Digits and Latin letters. */
|
|
25
|
+
const REGEXP_ONLY_DIGITS_AND_CHARS = '^[a-zA-Z0-9]+$';
|
|
26
|
+
/** The input's name when nothing else names it, in English (the translator's, when there is one). */
|
|
27
|
+
const INPUT_OTP_LABEL = format(messages.inputOtpLabel);
|
|
28
|
+
/** How far the input reaches past the slots for a password manager's badge, as input-otp's. */
|
|
29
|
+
const PASSWORD_MANAGER_BADGE_SPACE = 40;
|
|
30
|
+
/** What one slot shows: a character of the code, or where the next one goes. */
|
|
31
|
+
|
|
32
|
+
/** The side of the slots the input reaches past for a password manager's badge. */
|
|
33
|
+
const EMPTY_SLOT = {
|
|
34
|
+
index: -1,
|
|
35
|
+
char: null,
|
|
36
|
+
placeholderChar: null,
|
|
37
|
+
isActive: false,
|
|
38
|
+
hasFakeCaret: false
|
|
39
|
+
};
|
|
40
|
+
function slotAt(slots, index) {
|
|
41
|
+
return slots[index] ?? {
|
|
42
|
+
...EMPTY_SLOT,
|
|
43
|
+
index
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** A slot's `data-active`, as React renders upstream's: `true`, `false`, or none past the end. */
|
|
47
|
+
function activeAttribute(slots, index) {
|
|
48
|
+
const slot = slots[index];
|
|
49
|
+
if (!slot) return undefined;
|
|
50
|
+
return slot.isActive ? 'true' : 'false';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* One character's box: a `div` (or `@as`) with `data-active` (`"true"` while the selection is
|
|
54
|
+
* on it), and its character inside, or whatever its block draws from the slot it yields (a
|
|
55
|
+
* caret, say).
|
|
56
|
+
*/
|
|
57
|
+
const InputOTPSlot = setComponentTemplate(precompileTemplate("<As @as={{@as}} data-active={{activeAttribute @slots @index}} data-test-jn-part=\"slot\" data-test-jn-value=\"{{@index}}\" ...attributes>\n {{#if (has-block)}}\n {{yield (slotAt @slots @index)}}\n {{else}}\n {{#let (slotAt @slots @index) as |slot|}}{{slot.char}}{{/let}}\n {{/if}}\n</As>", {
|
|
58
|
+
strictMode: true,
|
|
59
|
+
scope: () => ({
|
|
60
|
+
As,
|
|
61
|
+
activeAttribute,
|
|
62
|
+
slotAt
|
|
63
|
+
})
|
|
64
|
+
}), templateOnly());
|
|
65
|
+
/**
|
|
66
|
+
* A one-time code field, as the `input-otp` library under shadcn's Input OTP has it, which also
|
|
67
|
+
* covers ember-primitives' `OTP`: one native `<input>`, invisible, laid over slots you render
|
|
68
|
+
* from its state, so typing, deleting, paste, the browser's autofill of a code it was sent (the
|
|
69
|
+
* input has `autocomplete="one-time-code"`), and a form all work as on any input. Its selection
|
|
70
|
+
* is kept to one character, the one typing replaces, and the slot under it is active:
|
|
71
|
+
*
|
|
72
|
+
* <InputOTP @maxLength={{6}} @onComplete={{this.verify}} as |otp|>
|
|
73
|
+
* {{#each otp.slots as |slot|}}
|
|
74
|
+
* <otp.Slot @index={{slot.index}} class="my-slot" />
|
|
75
|
+
* {{/each}}
|
|
76
|
+
* </InputOTP>
|
|
77
|
+
*
|
|
78
|
+
* Its code is controlled or not, as in Radix (`@value`, `@defaultValue`, `@onValueChange`);
|
|
79
|
+
* `@pattern` refuses what it doesn't match, and a paste goes through `@pasteTransformer`.
|
|
80
|
+
*/
|
|
81
|
+
class InputOTP extends Component {
|
|
82
|
+
code = controllable(this, 'value', '');
|
|
83
|
+
static {
|
|
84
|
+
g(this.prototype, "isFocused", [tracked], function () {
|
|
85
|
+
return false;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
#isFocused = (i(this, "isFocused"), void 0);
|
|
89
|
+
static {
|
|
90
|
+
g(this.prototype, "isHovering", [tracked], function () {
|
|
91
|
+
return false;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
#isHovering = (i(this, "isHovering"), void 0);
|
|
95
|
+
static {
|
|
96
|
+
g(this.prototype, "selectionStart", [tracked], function () {
|
|
97
|
+
return null;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
#selectionStart = (i(this, "selectionStart"), void 0);
|
|
101
|
+
static {
|
|
102
|
+
g(this.prototype, "selectionEnd", [tracked], function () {
|
|
103
|
+
return null;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
#selectionEnd = (i(this, "selectionEnd"), void 0);
|
|
107
|
+
static {
|
|
108
|
+
g(this.prototype, "badgeSide", [tracked], function () {
|
|
109
|
+
return null;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
#badgeSide = (i(this, "badgeSide"), void 0);
|
|
113
|
+
/** The side the input reaches past the slots for a password manager's badge, if it does. */
|
|
114
|
+
/** The selection last seen, for telling which way it moved. */previousSelection = [null, null, 'none'];
|
|
115
|
+
get value() {
|
|
116
|
+
return this.code.value;
|
|
117
|
+
}
|
|
118
|
+
get maxLength() {
|
|
119
|
+
return this.args.maxLength;
|
|
120
|
+
}
|
|
121
|
+
get isComplete() {
|
|
122
|
+
return this.value.length === this.maxLength;
|
|
123
|
+
}
|
|
124
|
+
/** Where the input reaches past the slots, unless `@pushPasswordManagerStrategy` is `none`. */
|
|
125
|
+
get reach() {
|
|
126
|
+
return this.args.pushPasswordManagerStrategy === 'none' ? null : this.badgeSide;
|
|
127
|
+
}
|
|
128
|
+
get regexp() {
|
|
129
|
+
const {
|
|
130
|
+
pattern
|
|
131
|
+
} = this.args;
|
|
132
|
+
if (!pattern) return null;
|
|
133
|
+
return isString(pattern) ? new RegExp(pattern) : pattern;
|
|
134
|
+
}
|
|
135
|
+
static {
|
|
136
|
+
n(this.prototype, "regexp", [cached]);
|
|
137
|
+
}
|
|
138
|
+
get slots() {
|
|
139
|
+
const {
|
|
140
|
+
value,
|
|
141
|
+
isFocused,
|
|
142
|
+
selectionStart: start,
|
|
143
|
+
selectionEnd: end
|
|
144
|
+
} = this;
|
|
145
|
+
const placeholder = this.args.placeholder;
|
|
146
|
+
return Array.from({
|
|
147
|
+
length: Math.max(0, this.maxLength)
|
|
148
|
+
}, (_, index) => {
|
|
149
|
+
const isActive = isFocused && start !== null && end !== null && (start === end && index === start || index >= start && index < end);
|
|
150
|
+
const char = value[index] ?? null;
|
|
151
|
+
const placeholderChar = value[0] !== undefined ? null : placeholder?.[index] ?? null;
|
|
152
|
+
return {
|
|
153
|
+
index,
|
|
154
|
+
char,
|
|
155
|
+
placeholderChar,
|
|
156
|
+
isActive,
|
|
157
|
+
hasFakeCaret: isActive && char === null
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/** Whether `code` is one the input may hold. */
|
|
162
|
+
static {
|
|
163
|
+
n(this.prototype, "slots", [cached]);
|
|
164
|
+
}
|
|
165
|
+
accepts(code) {
|
|
166
|
+
return code.length === 0 || !this.regexp || this.regexp.test(code);
|
|
167
|
+
}
|
|
168
|
+
/** Puts the code in the input, unless it shows it already (which would move the caret). */
|
|
169
|
+
show(input) {
|
|
170
|
+
if (input.value !== this.value) input.value = this.value;
|
|
171
|
+
}
|
|
172
|
+
/** Sets the slots' selection, touching tracked state only when it changed. */
|
|
173
|
+
mirror(start, end) {
|
|
174
|
+
if (this.selectionStart !== start) this.selectionStart = start;
|
|
175
|
+
if (this.selectionEnd !== end) this.selectionEnd = end;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Keeps the selection on one character, as input-otp does on every `selectionchange`: a caret
|
|
179
|
+
* inside the code selects the character after it (or, moving back, before it), so typing
|
|
180
|
+
* replaces it; a caret after the last character stays there, to add one.
|
|
181
|
+
*/
|
|
182
|
+
syncSelection(input) {
|
|
183
|
+
if (input.ownerDocument.activeElement !== input) {
|
|
184
|
+
this.mirror(null, null);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const selectionStart = input.selectionStart;
|
|
188
|
+
const selectionEnd = input.selectionEnd;
|
|
189
|
+
const max = input.maxLength;
|
|
190
|
+
const value = input.value;
|
|
191
|
+
const previous = this.previousSelection;
|
|
192
|
+
let start = -1;
|
|
193
|
+
let end = -1;
|
|
194
|
+
let direction;
|
|
195
|
+
if (value.length !== 0 && selectionStart !== null && selectionEnd !== null) {
|
|
196
|
+
const isSingleCaret = selectionStart === selectionEnd;
|
|
197
|
+
const isInsertMode = selectionStart === value.length && value.length < max;
|
|
198
|
+
if (isSingleCaret && !isInsertMode) {
|
|
199
|
+
const caret = selectionStart;
|
|
200
|
+
if (caret === 0) {
|
|
201
|
+
start = 0;
|
|
202
|
+
end = 1;
|
|
203
|
+
direction = 'forward';
|
|
204
|
+
} else if (caret === max) {
|
|
205
|
+
start = caret - 1;
|
|
206
|
+
end = caret;
|
|
207
|
+
direction = 'backward';
|
|
208
|
+
} else if (max > 1 && value.length > 1) {
|
|
209
|
+
let offset = 0;
|
|
210
|
+
if (previous[0] !== null && previous[1] !== null) {
|
|
211
|
+
direction = caret < previous[1] ? 'backward' : 'forward';
|
|
212
|
+
const wasInserting = previous[0] === previous[1] && previous[0] < max;
|
|
213
|
+
if (direction === 'backward' && !wasInserting) offset = -1;
|
|
214
|
+
}
|
|
215
|
+
start = offset + caret;
|
|
216
|
+
end = offset + caret + 1;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (start !== -1 && end !== -1 && start !== end) {
|
|
220
|
+
input.setSelectionRange(start, end, direction);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const s = start !== -1 ? start : selectionStart;
|
|
224
|
+
const e = end !== -1 ? end : selectionEnd;
|
|
225
|
+
this.mirror(s, e);
|
|
226
|
+
this.previousSelection = [s, e, direction ?? input.selectionDirection ?? 'none'];
|
|
227
|
+
}
|
|
228
|
+
/** The code before the last change, for telling when it becomes complete. */
|
|
229
|
+
#last;
|
|
230
|
+
/** @internal What the input showed first, so a change from it can complete the code. */
|
|
231
|
+
started(value) {
|
|
232
|
+
this.#last = value;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Notes the code the input holds now. When it has just become complete, calls `@onComplete`
|
|
236
|
+
* and, with `@autoSubmit`, submits the form: at once after someone's change, or after the
|
|
237
|
+
* render when the caller changed `@value` (a render can't run callbacks that change state).
|
|
238
|
+
*/
|
|
239
|
+
settle(input, {
|
|
240
|
+
later = false
|
|
241
|
+
} = {}) {
|
|
242
|
+
const last = this.#last;
|
|
243
|
+
const value = this.value;
|
|
244
|
+
this.#last = value;
|
|
245
|
+
if (last === undefined || last === value) return;
|
|
246
|
+
if (!(last.length < this.maxLength && value.length === this.maxLength)) return;
|
|
247
|
+
const complete = () => {
|
|
248
|
+
this.args.onComplete?.(value);
|
|
249
|
+
if (this.args.autoSubmit) input.form?.requestSubmit();
|
|
250
|
+
};
|
|
251
|
+
if (!later) return complete();
|
|
252
|
+
const token = waiter.beginAsync();
|
|
253
|
+
queueMicrotask(() => {
|
|
254
|
+
try {
|
|
255
|
+
complete();
|
|
256
|
+
} finally {
|
|
257
|
+
waiter.endAsync(token);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Every change, typed, deleted, pasted or autofilled: cut to `@maxLength`, refused when
|
|
263
|
+
* `@pattern` doesn't match it. It listens in the capture phase, so it runs ahead of the
|
|
264
|
+
* caller's own `input` listeners, which never hear a change it refused.
|
|
265
|
+
*/
|
|
266
|
+
handleInput = event => {
|
|
267
|
+
const input = event.currentTarget;
|
|
268
|
+
const next = input.value.slice(0, this.maxLength);
|
|
269
|
+
if (!this.accepts(next)) {
|
|
270
|
+
// Refused: the input goes back to the code it held, and nothing else hears the change.
|
|
271
|
+
event.stopImmediatePropagation();
|
|
272
|
+
this.show(input);
|
|
273
|
+
this.syncSelection(input);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (next.length < this.value.length) {
|
|
277
|
+
// Deleting moves no selection, so nothing else tells the slots.
|
|
278
|
+
input.ownerDocument.dispatchEvent(new Event('selectionchange'));
|
|
279
|
+
}
|
|
280
|
+
this.code.set(next);
|
|
281
|
+
// Controlled, the caller's answer is there now; either way the input shows the code.
|
|
282
|
+
this.show(input);
|
|
283
|
+
this.syncSelection(input);
|
|
284
|
+
this.settle(input);
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Every paste goes into the code here, as input-otp does on iOS (and ember-primitives does
|
|
288
|
+
* everywhere): through `@pasteTransformer`, into the selection, cut to `@maxLength`, and
|
|
289
|
+
* refused whole when the code wouldn't match `@pattern`. An `input` event follows, as a
|
|
290
|
+
* native paste's does.
|
|
291
|
+
*/
|
|
292
|
+
handlePaste = event => {
|
|
293
|
+
const input = event.currentTarget;
|
|
294
|
+
const clipboard = event.clipboardData;
|
|
295
|
+
if (!clipboard) return;
|
|
296
|
+
event.preventDefault();
|
|
297
|
+
const pasted = clipboard.getData('text/plain');
|
|
298
|
+
const content = this.args.pasteTransformer ? this.args.pasteTransformer(pasted) : pasted;
|
|
299
|
+
const value = this.value;
|
|
300
|
+
const start = input.selectionStart ?? value.length;
|
|
301
|
+
const end = input.selectionEnd ?? start;
|
|
302
|
+
const next = (value.slice(0, start) + content + value.slice(end)).slice(0, this.maxLength);
|
|
303
|
+
if (!this.accepts(next)) return;
|
|
304
|
+
input.value = next;
|
|
305
|
+
input.dispatchEvent(new InputEvent('input', {
|
|
306
|
+
bubbles: true,
|
|
307
|
+
inputType: 'insertFromPaste',
|
|
308
|
+
data: content
|
|
309
|
+
}));
|
|
310
|
+
const caret = Math.min(next.length, this.maxLength - 1);
|
|
311
|
+
input.setSelectionRange(caret, next.length);
|
|
312
|
+
this.syncSelection(input);
|
|
313
|
+
};
|
|
314
|
+
handleFocus = event => {
|
|
315
|
+
const input = event.currentTarget;
|
|
316
|
+
const start = Math.min(input.value.length, this.maxLength - 1);
|
|
317
|
+
const end = input.value.length;
|
|
318
|
+
input.setSelectionRange(start, end);
|
|
319
|
+
this.mirror(start, end);
|
|
320
|
+
this.previousSelection = [start, end, input.selectionDirection ?? 'none'];
|
|
321
|
+
this.isFocused = true;
|
|
322
|
+
this.#reachForBadge(input);
|
|
323
|
+
};
|
|
324
|
+
handleBlur = () => {
|
|
325
|
+
this.isFocused = false;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Right to left, the slots run from the right, but a code is a left-to-right run (digits and
|
|
329
|
+
* Latin letters), so the browser's arrows would move the selection the wrong way across them.
|
|
330
|
+
* There, ArrowLeft goes on to the next character and ArrowRight back to the one before, as
|
|
331
|
+
* the browser's ArrowRight and ArrowLeft do left to right. Home and End go to the first and
|
|
332
|
+
* the last either way, as the browser's do.
|
|
333
|
+
*/
|
|
334
|
+
handleKeyDown = event => {
|
|
335
|
+
const {
|
|
336
|
+
key
|
|
337
|
+
} = event;
|
|
338
|
+
if (key !== 'ArrowLeft' && key !== 'ArrowRight') return;
|
|
339
|
+
if (event.defaultPrevented || event.isComposing) return;
|
|
340
|
+
if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
341
|
+
const input = event.currentTarget;
|
|
342
|
+
if (slotDirection(input) !== 'rtl') return;
|
|
343
|
+
event.preventDefault();
|
|
344
|
+
const forward = key === 'ArrowLeft';
|
|
345
|
+
const length = input.value.length;
|
|
346
|
+
const start = input.selectionStart ?? length;
|
|
347
|
+
const end = input.selectionEnd ?? start;
|
|
348
|
+
let caret;
|
|
349
|
+
if (start !== end) caret = forward ? end : start;else caret = forward ? Math.min(length, end + 1) : Math.max(0, start - 1);
|
|
350
|
+
input.setSelectionRange(caret, caret);
|
|
351
|
+
this.syncSelection(input);
|
|
352
|
+
};
|
|
353
|
+
handleMouseOver = event => {
|
|
354
|
+
const hovering = !event.currentTarget.disabled;
|
|
355
|
+
if (this.isHovering !== hovering) this.isHovering = hovering;
|
|
356
|
+
};
|
|
357
|
+
handleMouseLeave = () => {
|
|
358
|
+
if (this.isHovering) this.isHovering = false;
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Each time it takes focus, the input reaches past the slots where the viewport leaves room,
|
|
362
|
+
* so a password manager's badge (drawn at an input's inline end) sits beyond the last slot.
|
|
363
|
+
* It reaches toward the inline end, which is the side its wider box grows to: an absolutely
|
|
364
|
+
* placed box with both insets and a width drops the end one. input-otp reaches only once it
|
|
365
|
+
* finds a badge, but its check (`elementFromPoint` hitting anything but the container, which
|
|
366
|
+
* takes no pointer) finds one wherever the input is, so it reaches on every focus too.
|
|
367
|
+
*/
|
|
368
|
+
#reachForBadge(input) {
|
|
369
|
+
if (this.args.pushPasswordManagerStrategy === 'none') return;
|
|
370
|
+
const container = input.closest('[data-input-otp-container]');
|
|
371
|
+
const view = input.ownerDocument.defaultView;
|
|
372
|
+
if (!container || !view) return;
|
|
373
|
+
const box = container.getBoundingClientRect();
|
|
374
|
+
const side = getDirection(input.parentElement ?? input) === 'rtl' ? 'left' : 'right';
|
|
375
|
+
const room = side === 'left' ? box.left : view.innerWidth - box.right;
|
|
376
|
+
const reach = room >= PASSWORD_MANAGER_BADGE_SPACE ? side : null;
|
|
377
|
+
if (this.badgeSide !== reach) this.badgeSide = reach;
|
|
378
|
+
}
|
|
379
|
+
static {
|
|
380
|
+
setComponentTemplate(precompileTemplate("<div class={{@containerClass}} data-input-otp-container data-test-jn=\"input-otp\" data-test-jn-name={{@name}}>\n {{yield (hash slots=this.slots Slot=(component InputOTPSlot slots=this.slots) value=this.value isComplete=this.isComplete isFocused=this.isFocused isHovering=this.isHovering)}}\n <div>\n <input autocomplete=\"one-time-code\" inputmode=\"numeric\" aria-label={{@label}} data-input-otp data-input-otp-placeholder-shown={{if this.value undefined \"true\"}} data-input-otp-mss={{this.selectionStart}} data-input-otp-mse={{this.selectionEnd}} pattern={{if this.regexp this.regexp.source}} aria-placeholder={{@placeholder}} maxlength={{@maxLength}} data-test-jn-part=\"input\" {{on \"input\" this.handleInput capture=true}} {{on \"paste\" this.handlePaste capture=true}} {{on \"focus\" this.handleFocus}} {{on \"blur\" this.handleBlur}} {{on \"keydown\" this.handleKeyDown}} {{on \"mouseover\" this.handleMouseOver}} {{on \"mouseleave\" this.handleMouseLeave}} ...attributes {{OTPInputModifier otp=this value=this.value textAlign=@textAlign reach=this.reach label=(t messages.inputOtpLabel)}} />\n </div>\n</div>", {
|
|
381
|
+
strictMode: true,
|
|
382
|
+
scope: () => ({
|
|
383
|
+
hash,
|
|
384
|
+
InputOTPSlot,
|
|
385
|
+
on,
|
|
386
|
+
OTPInputModifier,
|
|
387
|
+
t,
|
|
388
|
+
messages
|
|
389
|
+
})
|
|
390
|
+
}), this);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Ties the input to its `InputOTP`: it shows the code (and, when the caller's `@value` makes it
|
|
395
|
+
* complete, calls `@onComplete`), styles the input, and once, listens for `selectionchange`,
|
|
396
|
+
* measures the input for `--root-height`, adopts the shared rules, names the input when
|
|
397
|
+
* nothing else does, and puts the code back after a form reset.
|
|
398
|
+
*/
|
|
399
|
+
class OTPInputModifier extends Modifier {
|
|
400
|
+
#connected = false;
|
|
401
|
+
/** The selection sync a render scheduled, cleared when the modifier goes. */
|
|
402
|
+
#sync;
|
|
403
|
+
/** The `aria-label` this gave the input, so a name of the caller's is left alone. */
|
|
404
|
+
#label;
|
|
405
|
+
modify(input, _, {
|
|
406
|
+
otp,
|
|
407
|
+
textAlign = 'left',
|
|
408
|
+
reach,
|
|
409
|
+
label
|
|
410
|
+
}) {
|
|
411
|
+
const ours = this.#label !== undefined && input.getAttribute('aria-label') === this.#label;
|
|
412
|
+
if (ours || !isNamed(input)) input.setAttribute('aria-label', this.#label = label);
|
|
413
|
+
otp.show(input);
|
|
414
|
+
style(input, textAlign, reach);
|
|
415
|
+
if (!this.#connected) {
|
|
416
|
+
this.#connected = true;
|
|
417
|
+
styleContainer(input);
|
|
418
|
+
registerDestructor(this, connect(input, otp));
|
|
419
|
+
registerDestructor(this, () => this.#cancelSync());
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
otp.settle(input, {
|
|
423
|
+
later: true
|
|
424
|
+
});
|
|
425
|
+
// A render can't change what it has read, so the slots follow the selection after it.
|
|
426
|
+
this.#cancelSync();
|
|
427
|
+
const token = waiter.beginAsync();
|
|
428
|
+
const timer = setTimeout(() => {
|
|
429
|
+
this.#sync = undefined;
|
|
430
|
+
try {
|
|
431
|
+
if (input.isConnected) otp.syncSelection(input);
|
|
432
|
+
} finally {
|
|
433
|
+
waiter.endAsync(token);
|
|
434
|
+
}
|
|
435
|
+
}, 0);
|
|
436
|
+
this.#sync = {
|
|
437
|
+
timer,
|
|
438
|
+
token
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
#cancelSync() {
|
|
442
|
+
if (!this.#sync) return;
|
|
443
|
+
clearTimeout(this.#sync.timer);
|
|
444
|
+
waiter.endAsync(this.#sync.token);
|
|
445
|
+
this.#sync = undefined;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* The styles input-otp gives its container and the box around the input: the container takes
|
|
450
|
+
* no pointer (the input does), and the box covers it. Through the CSSOM, as all of these, so a
|
|
451
|
+
* strict Content Security Policy allows them.
|
|
452
|
+
*/
|
|
453
|
+
function styleContainer(input) {
|
|
454
|
+
const box = input.parentElement;
|
|
455
|
+
const container = box?.parentElement;
|
|
456
|
+
if (!box || !container) return;
|
|
457
|
+
container.style.setProperty('position', 'relative');
|
|
458
|
+
container.style.setProperty('cursor', 'text');
|
|
459
|
+
container.style.setProperty('user-select', 'none');
|
|
460
|
+
container.style.setProperty('-webkit-user-select', 'none');
|
|
461
|
+
container.style.setProperty('pointer-events', 'none');
|
|
462
|
+
box.style.setProperty('position', 'absolute');
|
|
463
|
+
box.style.setProperty('inset', '0');
|
|
464
|
+
box.style.setProperty('pointer-events', 'none');
|
|
465
|
+
}
|
|
466
|
+
/** The direction the slots run in: their container's. */
|
|
467
|
+
function slotDirection(input) {
|
|
468
|
+
return getDirection(input.closest('[data-input-otp-container]') ?? input);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The input's own styles, as input-otp's: it covers the slots, and draws nothing. Reaching for
|
|
472
|
+
* a badge, it is 40px wider, toward `reach`, and clipped there, so it takes the pointer over
|
|
473
|
+
* the slots alone: every slot, the first one right to left included, takes a click.
|
|
474
|
+
*/
|
|
475
|
+
function style(input, textAlign, reach) {
|
|
476
|
+
const style = input.style;
|
|
477
|
+
const badge = `${PASSWORD_MANAGER_BADGE_SPACE}px`;
|
|
478
|
+
style.setProperty('position', 'absolute');
|
|
479
|
+
style.setProperty('inset', '0');
|
|
480
|
+
style.setProperty('width', reach ? `calc(100% + ${badge})` : '100%');
|
|
481
|
+
if (reach === 'right') style.setProperty('clip-path', `inset(0 ${badge} 0 0)`);else if (reach === 'left') style.setProperty('clip-path', `inset(0 0 0 ${badge})`);else style.removeProperty('clip-path');
|
|
482
|
+
style.setProperty('height', '100%');
|
|
483
|
+
style.setProperty('display', 'flex');
|
|
484
|
+
style.setProperty('text-align', textAlign);
|
|
485
|
+
style.setProperty('opacity', '1'); // iOS needs it to paste on a long press
|
|
486
|
+
style.setProperty('color', 'transparent');
|
|
487
|
+
style.setProperty('pointer-events', 'all');
|
|
488
|
+
style.setProperty('background', 'transparent');
|
|
489
|
+
style.setProperty('caret-color', 'transparent');
|
|
490
|
+
style.setProperty('border', '0 solid transparent');
|
|
491
|
+
style.setProperty('outline', '0 solid transparent');
|
|
492
|
+
style.setProperty('box-shadow', 'none');
|
|
493
|
+
style.setProperty('line-height', '1');
|
|
494
|
+
style.setProperty('letter-spacing', '-.5em');
|
|
495
|
+
style.setProperty('font-size', 'var(--root-height)');
|
|
496
|
+
style.setProperty('font-family', 'monospace');
|
|
497
|
+
style.setProperty('font-variant-numeric', 'tabular-nums');
|
|
498
|
+
}
|
|
499
|
+
/** What every input needs whatever its styles: input-otp's injected rules. */
|
|
500
|
+
const SHARED_RULES = `
|
|
501
|
+
[data-input-otp]::selection { background: transparent !important; color: transparent !important; }
|
|
502
|
+
[data-input-otp]:autofill, [data-input-otp]:-webkit-autofill { background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important; }
|
|
503
|
+
@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }
|
|
504
|
+
[data-input-otp] + * { pointer-events: all !important; }
|
|
505
|
+
`;
|
|
506
|
+
const sheets = new WeakMap();
|
|
507
|
+
/**
|
|
508
|
+
* Adopts the shared rules into the input's document (or shadow root), once. A constructed
|
|
509
|
+
* sheet, not a `<style>`, so a strict Content Security Policy allows it.
|
|
510
|
+
*/
|
|
511
|
+
function adoptRules(input) {
|
|
512
|
+
const root = input.getRootNode();
|
|
513
|
+
const document = input.ownerDocument;
|
|
514
|
+
const View = document.defaultView;
|
|
515
|
+
if (!View || !(root instanceof View.Document || root instanceof View.ShadowRoot)) return;
|
|
516
|
+
let sheet = sheets.get(document);
|
|
517
|
+
if (!sheet) {
|
|
518
|
+
sheet = new View.CSSStyleSheet();
|
|
519
|
+
try {
|
|
520
|
+
sheet.replaceSync(SHARED_RULES);
|
|
521
|
+
} catch {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
sheets.set(document, sheet);
|
|
525
|
+
}
|
|
526
|
+
if (!root.adoptedStyleSheets.includes(sheet)) {
|
|
527
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
/** Whether the input has a name of its own: an `aria-label`, `aria-labelledby` or a `<label>`. */
|
|
531
|
+
function isNamed(input) {
|
|
532
|
+
return Boolean(input.getAttribute('aria-label')?.trim()) || input.hasAttribute('aria-labelledby') || Boolean(input.labels?.length);
|
|
533
|
+
}
|
|
534
|
+
/** Starts the input's listeners and observers; returns what stops them. */
|
|
535
|
+
function connect(input, otp) {
|
|
536
|
+
const document = input.ownerDocument;
|
|
537
|
+
const container = input.closest('[data-input-otp-container]');
|
|
538
|
+
otp.started(otp.value);
|
|
539
|
+
adoptRules(input);
|
|
540
|
+
const onSelectionChange = () => otp.syncSelection(input);
|
|
541
|
+
document.addEventListener('selectionchange', onSelectionChange, {
|
|
542
|
+
capture: true
|
|
543
|
+
});
|
|
544
|
+
// Focused already (`autofocus`): the slots hear it after the render, which can't change
|
|
545
|
+
// what it has read.
|
|
546
|
+
let focused;
|
|
547
|
+
if (document.activeElement === input) {
|
|
548
|
+
const token = waiter.beginAsync();
|
|
549
|
+
const timer = setTimeout(() => {
|
|
550
|
+
focused = undefined;
|
|
551
|
+
try {
|
|
552
|
+
if (document.activeElement !== input) return;
|
|
553
|
+
otp.isFocused = true;
|
|
554
|
+
otp.syncSelection(input);
|
|
555
|
+
} finally {
|
|
556
|
+
waiter.endAsync(token);
|
|
557
|
+
}
|
|
558
|
+
}, 0);
|
|
559
|
+
focused = {
|
|
560
|
+
timer,
|
|
561
|
+
token
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
const measure = () => {
|
|
565
|
+
container?.style.setProperty('--root-height', `${input.clientHeight}px`);
|
|
566
|
+
};
|
|
567
|
+
measure();
|
|
568
|
+
const View = document.defaultView;
|
|
569
|
+
const observer = View ? new View.ResizeObserver(measure) : undefined;
|
|
570
|
+
observer?.observe(input);
|
|
571
|
+
// A form reset puts the code back to the one it started with, as Joinery's inputs do.
|
|
572
|
+
const start = otp.value;
|
|
573
|
+
let reset;
|
|
574
|
+
const onReset = event => {
|
|
575
|
+
if (event.target !== input.form || event.defaultPrevented || reset) return;
|
|
576
|
+
const token = waiter.beginAsync();
|
|
577
|
+
const timer = setTimeout(() => {
|
|
578
|
+
reset = undefined;
|
|
579
|
+
try {
|
|
580
|
+
otp.code.set(start);
|
|
581
|
+
otp.show(input);
|
|
582
|
+
otp.settle(input);
|
|
583
|
+
} finally {
|
|
584
|
+
waiter.endAsync(token);
|
|
585
|
+
}
|
|
586
|
+
}, 0);
|
|
587
|
+
reset = {
|
|
588
|
+
timer,
|
|
589
|
+
token
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
document.addEventListener('reset', onReset);
|
|
593
|
+
return () => {
|
|
594
|
+
document.removeEventListener('selectionchange', onSelectionChange, {
|
|
595
|
+
capture: true
|
|
596
|
+
});
|
|
597
|
+
document.removeEventListener('reset', onReset);
|
|
598
|
+
observer?.disconnect();
|
|
599
|
+
if (focused) {
|
|
600
|
+
clearTimeout(focused.timer);
|
|
601
|
+
waiter.endAsync(focused.token);
|
|
602
|
+
}
|
|
603
|
+
if (reset) {
|
|
604
|
+
clearTimeout(reset.timer);
|
|
605
|
+
waiter.endAsync(reset.token);
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export { INPUT_OTP_LABEL, InputOTP, InputOTPSlot, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };
|
|
611
|
+
//# sourceMappingURL=input-otp.js.map
|