@ember-joinery/primitives 0.0.0-stage → 1.0.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/CHANGELOG.md +472 -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 +307 -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,872 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { hash } from '@ember/helper';
|
|
4
|
+
import { registerDestructor } from '@ember/destroyable';
|
|
5
|
+
import { modifier } from 'ember-modifier';
|
|
6
|
+
import { As } from './as.js';
|
|
7
|
+
import { controllable } from './controllable-state.js';
|
|
8
|
+
import { getDirection } from './direction.js';
|
|
9
|
+
import { dismissable } from './dismiss.js';
|
|
10
|
+
import { idFor } from './id.js';
|
|
11
|
+
import { part } from './part.js';
|
|
12
|
+
import { Presence } from './presence.js';
|
|
13
|
+
import { ignoreROError } from './resize-observer.js';
|
|
14
|
+
import { visuallyHidden } from './visually-hidden.js';
|
|
15
|
+
import { E as ElementRef, b as buttonType } from './popper-BbTzV8dP.js';
|
|
16
|
+
import { d as delayGroup } from './delay-group-B1K03gBL.js';
|
|
17
|
+
import { h as hoverIntent } from './hover-intent-Bxb83fgX.js';
|
|
18
|
+
import { t } from './i18n.js';
|
|
19
|
+
import { messages } from './messages.js';
|
|
20
|
+
import { isUndefined } from '@sindresorhus/is';
|
|
21
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
22
|
+
import { setComponentTemplate } from '@ember/component';
|
|
23
|
+
import templateOnly from '@ember/component/template-only';
|
|
24
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
25
|
+
|
|
26
|
+
/** The spec with a look's classes and attributes added (the spec's own attributes win). */function withLook(spec, look) {
|
|
27
|
+
if (!look) return spec;
|
|
28
|
+
const extra = look();
|
|
29
|
+
return {
|
|
30
|
+
...spec,
|
|
31
|
+
class: extra.class,
|
|
32
|
+
attributes: {
|
|
33
|
+
...extra.attributes,
|
|
34
|
+
...spec.attributes
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Which way the list runs: its triggers and links side by side, or one above another. */
|
|
39
|
+
/** What a `<NavigationMenu>` takes. */
|
|
40
|
+
|
|
41
|
+
/** Sent up from a link that is selected, or a content that is dismissed: the content closes. */const ROOT_CONTENT_DISMISS = 'navigationMenu.rootContentDismiss';
|
|
42
|
+
/** Sent to a link when it is selected; cancel it (`@onSelect`) to keep the content open. */
|
|
43
|
+
const LINK_SELECT = 'navigationMenu.linkSelect';
|
|
44
|
+
const ARROW_KEYS = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'];
|
|
45
|
+
function isMouse(event) {
|
|
46
|
+
return event.pointerType === 'mouse';
|
|
47
|
+
}
|
|
48
|
+
/** The elements a Tab can land on inside `container`, in order, as Radix's navigation menu finds them. */
|
|
49
|
+
function tabbableCandidates(container) {
|
|
50
|
+
const nodes = [];
|
|
51
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
52
|
+
acceptNode: node => {
|
|
53
|
+
const element = node;
|
|
54
|
+
const isHiddenInput = element.tagName === 'INPUT' && element.type === 'hidden';
|
|
55
|
+
if (element.disabled || element.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
56
|
+
return element.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
60
|
+
return nodes;
|
|
61
|
+
}
|
|
62
|
+
/** Radix's `focusFirst` here: true when focus moved, or was already on a candidate. */
|
|
63
|
+
function focusFirst(candidates) {
|
|
64
|
+
const previous = document.activeElement;
|
|
65
|
+
return candidates.some(candidate => {
|
|
66
|
+
if (!candidate) return false;
|
|
67
|
+
if (candidate === previous) return true;
|
|
68
|
+
candidate.focus();
|
|
69
|
+
return document.activeElement !== previous;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Takes elements out of the tab order; returns what puts them back. */
|
|
73
|
+
function removeFromTabOrder(candidates) {
|
|
74
|
+
const previous = candidates.map(candidate => candidate.getAttribute('tabindex'));
|
|
75
|
+
for (const candidate of candidates) candidate.setAttribute('tabindex', '-1');
|
|
76
|
+
return () => {
|
|
77
|
+
candidates.forEach((candidate, index) => {
|
|
78
|
+
const tabindex = previous[index];
|
|
79
|
+
if (tabindex === null || tabindex === undefined) candidate.removeAttribute('tabindex');else candidate.setAttribute('tabindex', tabindex);
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** Sorts elements' owners into document order. */
|
|
84
|
+
function inDocumentOrder(entries, element) {
|
|
85
|
+
return entries.sort((a, b) => element(a).compareDocumentPosition(element(b)) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A value that lasts from one read to the next, as a React ref does across renders: Radix's
|
|
89
|
+
* `usePrevious`, and the motion and trigger its navigation menu keeps while nothing replaces
|
|
90
|
+
* them. Reading it changes nothing a template tracks.
|
|
91
|
+
*/
|
|
92
|
+
class Remembered {
|
|
93
|
+
#value;
|
|
94
|
+
#previous;
|
|
95
|
+
constructor(value) {
|
|
96
|
+
this.#value = value;
|
|
97
|
+
this.#previous = value;
|
|
98
|
+
}
|
|
99
|
+
/** The value before `value`, the last time it changed. */
|
|
100
|
+
previousOf(value) {
|
|
101
|
+
if (value !== this.#value) {
|
|
102
|
+
this.#previous = this.#value;
|
|
103
|
+
this.#value = value;
|
|
104
|
+
}
|
|
105
|
+
return this.#previous;
|
|
106
|
+
}
|
|
107
|
+
/** `value`, kept, unless it is `undefined`: then the last one kept. */
|
|
108
|
+
keep(value) {
|
|
109
|
+
if (value !== undefined) this.#value = value;
|
|
110
|
+
return this.#value;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// ----- Focus groups ---------------------------------------------------------------------------
|
|
114
|
+
/**
|
|
115
|
+
* The list and each content are a focus group, as Radix's navigation menu's: the arrow keys,
|
|
116
|
+
* Home and End move between the triggers and links in it (not round, and in both directions
|
|
117
|
+
* whatever the orientation). The group of an item is the nearest group element above it.
|
|
118
|
+
*/
|
|
119
|
+
const focusGroups = new WeakSet();
|
|
120
|
+
const focusGroupItems = new WeakSet();
|
|
121
|
+
function groupOf(element) {
|
|
122
|
+
for (let parent = element.parentElement; parent; parent = parent.parentElement) {
|
|
123
|
+
if (focusGroups.has(parent)) return parent;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
function groupItems(group) {
|
|
128
|
+
return [...group.querySelectorAll('*')].filter(element => focusGroupItems.has(element) && groupOf(element) === group);
|
|
129
|
+
}
|
|
130
|
+
/** A key on a trigger or a link: move focus between its group's items. */
|
|
131
|
+
function onFocusGroupKeyDown(event, dir) {
|
|
132
|
+
if (event.defaultPrevented) return;
|
|
133
|
+
if (!['Home', 'End', ...ARROW_KEYS].includes(event.key)) return;
|
|
134
|
+
const item = event.currentTarget;
|
|
135
|
+
const group = groupOf(item);
|
|
136
|
+
if (!group) return;
|
|
137
|
+
let candidates = groupItems(group);
|
|
138
|
+
const prevItemKey = dir === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
139
|
+
if ([prevItemKey, 'ArrowUp', 'End'].includes(event.key)) candidates.reverse();
|
|
140
|
+
if (ARROW_KEYS.includes(event.key)) candidates = candidates.slice(candidates.indexOf(item) + 1);
|
|
141
|
+
focusFirst(candidates);
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
}
|
|
144
|
+
/** Makes an element a focus group. */
|
|
145
|
+
const focusGroup = modifier(element => {
|
|
146
|
+
focusGroups.add(element);
|
|
147
|
+
return () => focusGroups.delete(element);
|
|
148
|
+
});
|
|
149
|
+
// ----- The root ---------------------------------------------------------------------------------
|
|
150
|
+
/**
|
|
151
|
+
* A site's navigation, as Radix's `NavigationMenu` (which shadcn's is built on): a `<nav>` with
|
|
152
|
+
* a list of links, some of them triggers that open a panel of more links. It yields its parts:
|
|
153
|
+
*
|
|
154
|
+
* <NavigationMenu as |n|>
|
|
155
|
+
* <n.List>
|
|
156
|
+
* <n.Item as |item|>
|
|
157
|
+
* <item.Trigger>Getting started</item.Trigger>
|
|
158
|
+
* <item.Content>
|
|
159
|
+
* <n.Link href="/docs">Introduction</n.Link>
|
|
160
|
+
* </item.Content>
|
|
161
|
+
* </n.Item>
|
|
162
|
+
* <n.Item><n.Link href="/docs">Docs</n.Link></n.Item>
|
|
163
|
+
* </n.List>
|
|
164
|
+
* <n.Viewport />
|
|
165
|
+
* </NavigationMenu>
|
|
166
|
+
*
|
|
167
|
+
* A trigger opens its content on a click, or when the pointer rests on it (after
|
|
168
|
+
* `@delayDuration`, and at once when another has just been open), and the content closes when
|
|
169
|
+
* the pointer has left both for a moment. With a `Viewport`, every content shows in it, sized
|
|
170
|
+
* to the one that is open and sliding in from the side of the trigger it replaces
|
|
171
|
+
* (`data-motion`). Tab goes from a trigger into its open content and out again to the next
|
|
172
|
+
* trigger; the arrow keys, Home and End move between the triggers and links; Escape closes it.
|
|
173
|
+
* Which content is open is `@value` (its item's `@value`, or `''` for none), its own or yours
|
|
174
|
+
* with `@onValueChange`.
|
|
175
|
+
*/
|
|
176
|
+
class NavigationMenu extends Component {
|
|
177
|
+
valueState = controllable(this, 'value', '');
|
|
178
|
+
rootRef = new ElementRef();
|
|
179
|
+
viewportRef = new ElementRef();
|
|
180
|
+
trackRef = new ElementRef();
|
|
181
|
+
items = new Set();
|
|
182
|
+
/** Whether a Viewport is part of the menu, so its contents show there. */
|
|
183
|
+
static {
|
|
184
|
+
g(this.prototype, "hasViewport", [tracked], function () {
|
|
185
|
+
return false;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
#hasViewport = (i(this, "hasViewport"), void 0);
|
|
189
|
+
#delay = delayGroup(this, this);
|
|
190
|
+
/** The value a delayed open opens. */
|
|
191
|
+
#pending = '';
|
|
192
|
+
// Two timers, as Radix's: a close can come due while a delayed open still waits.
|
|
193
|
+
/** `enter()` opens `#pending` after `@delayDuration`. */
|
|
194
|
+
#openTimer;
|
|
195
|
+
/** `leave()` closes it after 150ms. */
|
|
196
|
+
#closeTimer;
|
|
197
|
+
#previous = new Remembered('');
|
|
198
|
+
#sizedContent;
|
|
199
|
+
#sizeObserver;
|
|
200
|
+
constructor(owner, args) {
|
|
201
|
+
super(owner, args);
|
|
202
|
+
const delay = () => this.args.delayDuration ?? 200;
|
|
203
|
+
this.#openTimer = hoverIntent(this, {
|
|
204
|
+
get openDelay() {
|
|
205
|
+
return delay();
|
|
206
|
+
},
|
|
207
|
+
closeDelay: 0,
|
|
208
|
+
setOpen: () => {
|
|
209
|
+
this.#closeTimer.cancel();
|
|
210
|
+
this.setValue(this.#pending);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
this.#closeTimer = hoverIntent(this, {
|
|
214
|
+
openDelay: 0,
|
|
215
|
+
closeDelay: 150,
|
|
216
|
+
setOpen: () => this.setValue('')
|
|
217
|
+
});
|
|
218
|
+
registerDestructor(this, () => this.#sizeObserver?.disconnect());
|
|
219
|
+
}
|
|
220
|
+
get skipDelayDuration() {
|
|
221
|
+
return this.args.skipDelayDuration ?? 300;
|
|
222
|
+
}
|
|
223
|
+
get id() {
|
|
224
|
+
return idFor(this);
|
|
225
|
+
}
|
|
226
|
+
/** The open item's value, or `''`. */
|
|
227
|
+
get value() {
|
|
228
|
+
return this.valueState.value;
|
|
229
|
+
}
|
|
230
|
+
/** The value before the last change, as Radix's `usePrevious`. */
|
|
231
|
+
get previousValue() {
|
|
232
|
+
return this.#previous.previousOf(this.value);
|
|
233
|
+
}
|
|
234
|
+
get isOpen() {
|
|
235
|
+
return this.value !== '';
|
|
236
|
+
}
|
|
237
|
+
get orientation() {
|
|
238
|
+
return this.args.orientation ?? 'horizontal';
|
|
239
|
+
}
|
|
240
|
+
get dir() {
|
|
241
|
+
return getDirection(this.rootRef.current, this.args.dir);
|
|
242
|
+
}
|
|
243
|
+
/** The direction to render (`dir`): `@dir`, or nothing, so the document's applies. */
|
|
244
|
+
get explicitDir() {
|
|
245
|
+
return this.args.dir;
|
|
246
|
+
}
|
|
247
|
+
/** Its items that have a trigger, in the triggers' order. */
|
|
248
|
+
triggerItems() {
|
|
249
|
+
const items = [...this.items].filter(item => item.triggerRef.current);
|
|
250
|
+
return inDocumentOrder(items, item => item.triggerRef.current);
|
|
251
|
+
}
|
|
252
|
+
/** Every trigger: a press there doesn't dismiss a content (the trigger itself toggles it). */
|
|
253
|
+
isTrigger(target) {
|
|
254
|
+
return this.triggerItems().some(item => item.triggerRef.current.contains(target));
|
|
255
|
+
}
|
|
256
|
+
/** Asks for `value`; when it changed (a controlled `@value` may refuse), the skip delay follows. */
|
|
257
|
+
setValue = value => {
|
|
258
|
+
const was = this.value;
|
|
259
|
+
this.valueState.set(value);
|
|
260
|
+
if (this.value === was) return;
|
|
261
|
+
if (this.value === '') this.#delay.closed();else if (this.skipDelayDuration > 0) this.#delay.opened();
|
|
262
|
+
};
|
|
263
|
+
#startCloseTimer() {
|
|
264
|
+
this.#closeTimer.leave();
|
|
265
|
+
}
|
|
266
|
+
#open(value) {
|
|
267
|
+
this.#closeTimer.cancel();
|
|
268
|
+
this.setValue(value);
|
|
269
|
+
}
|
|
270
|
+
#delayedOpen(value) {
|
|
271
|
+
if (this.value === value) return void this.#closeTimer.cancel();
|
|
272
|
+
this.#pending = value;
|
|
273
|
+
this.#openTimer.enter();
|
|
274
|
+
}
|
|
275
|
+
onTriggerEnter(value) {
|
|
276
|
+
this.#openTimer.cancel();
|
|
277
|
+
if (this.#delay.isOpenDelayed) this.#delayedOpen(value);else this.#open(value);
|
|
278
|
+
}
|
|
279
|
+
onTriggerLeave() {
|
|
280
|
+
this.#openTimer.cancel();
|
|
281
|
+
this.#startCloseTimer();
|
|
282
|
+
}
|
|
283
|
+
onContentEnter = () => this.#closeTimer.cancel();
|
|
284
|
+
onContentLeave = event => {
|
|
285
|
+
if (isMouse(event)) this.#startCloseTimer();
|
|
286
|
+
};
|
|
287
|
+
/** A click on a trigger: opens its content, or closes it when it is open. */
|
|
288
|
+
onItemSelect(value) {
|
|
289
|
+
this.setValue(this.value === value ? '' : value);
|
|
290
|
+
}
|
|
291
|
+
onItemDismiss() {
|
|
292
|
+
this.setValue('');
|
|
293
|
+
}
|
|
294
|
+
/** Sizes the viewport to the content that is open, now and as it changes size. */
|
|
295
|
+
sizeViewportTo(content) {
|
|
296
|
+
const resize = () => {
|
|
297
|
+
const viewport = this.viewportRef.current;
|
|
298
|
+
if (!viewport || !content.isConnected) return;
|
|
299
|
+
viewport.style.setProperty('--radix-navigation-menu-viewport-width', `${content.offsetWidth}px`);
|
|
300
|
+
viewport.style.setProperty('--radix-navigation-menu-viewport-height', `${content.offsetHeight}px`);
|
|
301
|
+
};
|
|
302
|
+
resize();
|
|
303
|
+
if (this.#sizedContent === content) return;
|
|
304
|
+
this.#sizedContent = content;
|
|
305
|
+
this.#sizeObserver?.disconnect();
|
|
306
|
+
if (isUndefined(globalThis.ResizeObserver)) return;
|
|
307
|
+
ignoreROError();
|
|
308
|
+
this.#sizeObserver = new ResizeObserver(resize);
|
|
309
|
+
this.#sizeObserver.observe(content);
|
|
310
|
+
}
|
|
311
|
+
/** The Viewport has rendered (or gone): its contents show there from now on. */
|
|
312
|
+
registerViewport = () => {
|
|
313
|
+
queueMicrotask(() => this.hasViewport = true);
|
|
314
|
+
return () => queueMicrotask(() => this.hasViewport = false);
|
|
315
|
+
};
|
|
316
|
+
/** The link modifier, for the yielded Link and your own elements. */
|
|
317
|
+
link = navigationMenuLinkPart(this, () => this.args.linkLook);
|
|
318
|
+
root = part(() => ({
|
|
319
|
+
attributes: {
|
|
320
|
+
'data-orientation': this.orientation,
|
|
321
|
+
dir: this.explicitDir
|
|
322
|
+
},
|
|
323
|
+
element: element => {
|
|
324
|
+
this.rootRef.set(element);
|
|
325
|
+
return () => this.rootRef.release(element);
|
|
326
|
+
}
|
|
327
|
+
}));
|
|
328
|
+
static {
|
|
329
|
+
setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"nav\" id={{this.id}} aria-label={{t messages.navigationMenuLabel}} data-test-jn=\"navigation-menu\" data-test-jn-name={{@name}} ...attributes {{this.root}}>{{yield (hash List=(component NavigationMenuList root=this) Item=(component NavigationMenuItem root=this) Link=(component NavigationMenuLink link=this.link) Indicator=(component NavigationMenuIndicator root=this) Viewport=(component NavigationMenuViewport root=this) link=this.link navigationMenu=this value=this.value isOpen=this.isOpen setValue=this.setValue)}}</As>", {
|
|
330
|
+
strictMode: true,
|
|
331
|
+
scope: () => ({
|
|
332
|
+
As,
|
|
333
|
+
t,
|
|
334
|
+
messages,
|
|
335
|
+
hash,
|
|
336
|
+
NavigationMenuList,
|
|
337
|
+
NavigationMenuItem,
|
|
338
|
+
NavigationMenuLink,
|
|
339
|
+
NavigationMenuIndicator,
|
|
340
|
+
NavigationMenuViewport
|
|
341
|
+
})
|
|
342
|
+
}), this);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// ----- The list ---------------------------------------------------------------------------------
|
|
346
|
+
|
|
347
|
+
const positionRelative = modifier(element => {
|
|
348
|
+
element.style.setProperty('position', 'relative');
|
|
349
|
+
});
|
|
350
|
+
/**
|
|
351
|
+
* The list of items: a `<ul>`, a focus group, in a `<div>` the Indicator is placed in (Radix's
|
|
352
|
+
* indicator track).
|
|
353
|
+
*/
|
|
354
|
+
class NavigationMenuList extends Component {
|
|
355
|
+
track = part(() => ({
|
|
356
|
+
attributes: {
|
|
357
|
+
'data-test-jn-part': 'indicator-track'
|
|
358
|
+
},
|
|
359
|
+
element: element => {
|
|
360
|
+
this.args.root.trackRef.set(element);
|
|
361
|
+
return () => this.args.root.trackRef.release(element);
|
|
362
|
+
}
|
|
363
|
+
}));
|
|
364
|
+
static {
|
|
365
|
+
setComponentTemplate(precompileTemplate("<div {{positionRelative}} {{this.track}}>\n <ul data-orientation={{@root.orientation}} dir={{@root.explicitDir}} data-test-jn-part=\"list\" ...attributes {{focusGroup}}>{{yield}}</ul>\n</div>", {
|
|
366
|
+
strictMode: true,
|
|
367
|
+
scope: () => ({
|
|
368
|
+
positionRelative,
|
|
369
|
+
focusGroup
|
|
370
|
+
})
|
|
371
|
+
}), this);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// ----- An item -----------------------------------------------------------------------------------
|
|
375
|
+
/** What a trigger and its modifier take. */
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Triggers whose Trigger component renders their focus proxy, right after them. An item renders
|
|
379
|
+
* one at its end for any other: a trigger of the caller's own (`{{item.trigger}}`).
|
|
380
|
+
*/
|
|
381
|
+
const proxiedTriggers = new WeakSet();
|
|
382
|
+
const rendersOwnProxy = modifier(element => {
|
|
383
|
+
proxiedTriggers.add(element);
|
|
384
|
+
return () => proxiedTriggers.delete(element);
|
|
385
|
+
});
|
|
386
|
+
/**
|
|
387
|
+
* What follows an open trigger: the focus proxy, which sends Tab into the content (and Shift+Tab
|
|
388
|
+
* from what comes after into its end), and with a Viewport an `aria-owns`, which puts the
|
|
389
|
+
* content after the trigger for assistive technology.
|
|
390
|
+
*/
|
|
391
|
+
const FocusProxy = setComponentTemplate(precompileTemplate("<span tabindex=\"0\" data-test-jn-part=\"focus-proxy\" {{visuallyHidden}} {{@item.focusProxy}} />\n{{#if @item.root.hasViewport}}\n <span aria-owns={{@item.contentId}} />\n{{/if}}", {
|
|
392
|
+
strictMode: true,
|
|
393
|
+
scope: () => ({
|
|
394
|
+
visuallyHidden
|
|
395
|
+
})
|
|
396
|
+
}), templateOnly());
|
|
397
|
+
/**
|
|
398
|
+
* A `<button>` that opens its item's content. While it is open, a focus proxy after it sends
|
|
399
|
+
* Tab into the content, and (with a Viewport) an `aria-owns` puts the content after it for
|
|
400
|
+
* assistive technology, wherever it is rendered.
|
|
401
|
+
*/
|
|
402
|
+
const NavigationMenuTrigger = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"button\" disabled={{@disabled}} ...attributes {{@item.trigger disabled=@disabled}} {{rendersOwnProxy}}>{{yield}}</As>\n{{#if @item.isOpen}}\n <FocusProxy @item={{@item}} />\n{{/if}}", {
|
|
403
|
+
strictMode: true,
|
|
404
|
+
scope: () => ({
|
|
405
|
+
As,
|
|
406
|
+
rendersOwnProxy,
|
|
407
|
+
FocusProxy
|
|
408
|
+
})
|
|
409
|
+
}), templateOnly());
|
|
410
|
+
/** What a content takes. */
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* An item's content: in the Viewport when the menu has one (sliding in from the side of the
|
|
414
|
+
* trigger it replaces, `data-motion`), and otherwise below its trigger, in its item.
|
|
415
|
+
*/
|
|
416
|
+
class NavigationMenuContent extends Component {
|
|
417
|
+
#motion = new Remembered(null);
|
|
418
|
+
get item() {
|
|
419
|
+
return this.args.item;
|
|
420
|
+
}
|
|
421
|
+
get root() {
|
|
422
|
+
return this.args.item.root;
|
|
423
|
+
}
|
|
424
|
+
get viewport() {
|
|
425
|
+
return this.root.viewportRef.value;
|
|
426
|
+
}
|
|
427
|
+
/** In the Viewport, the content shown is the open one, or the one closing with the menu. */
|
|
428
|
+
get isActive() {
|
|
429
|
+
const {
|
|
430
|
+
root
|
|
431
|
+
} = this;
|
|
432
|
+
const active = root.isOpen ? root.value : root.previousValue;
|
|
433
|
+
return active === this.item.value;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Which way it moves, as Radix's: `from-start` or `from-end` as it replaces the content of a
|
|
437
|
+
* trigger before or after its own, and `to-start` or `to-end` as it gives way to one.
|
|
438
|
+
*/
|
|
439
|
+
get motion() {
|
|
440
|
+
const {
|
|
441
|
+
root
|
|
442
|
+
} = this;
|
|
443
|
+
const values = root.triggerItems().map(item => item.value);
|
|
444
|
+
if (root.dir === 'rtl') values.reverse();
|
|
445
|
+
const value = root.value;
|
|
446
|
+
const previousValue = root.previousValue;
|
|
447
|
+
const index = values.indexOf(value);
|
|
448
|
+
const prevIndex = values.indexOf(previousValue);
|
|
449
|
+
const isSelected = this.item.value === value;
|
|
450
|
+
const wasSelected = prevIndex === values.indexOf(this.item.value);
|
|
451
|
+
if (!isSelected && !wasSelected) return this.#motion.keep(undefined);
|
|
452
|
+
let attribute = null;
|
|
453
|
+
if (index !== prevIndex) {
|
|
454
|
+
if (isSelected && prevIndex !== -1) attribute = index > prevIndex ? 'from-end' : 'from-start';else if (wasSelected && index !== -1) attribute = index > prevIndex ? 'to-start' : 'to-end';
|
|
455
|
+
}
|
|
456
|
+
return this.#motion.keep(attribute);
|
|
457
|
+
}
|
|
458
|
+
get isInViewport() {
|
|
459
|
+
return this.root.hasViewport;
|
|
460
|
+
}
|
|
461
|
+
content = part(({
|
|
462
|
+
inViewport
|
|
463
|
+
}) => {
|
|
464
|
+
const {
|
|
465
|
+
item,
|
|
466
|
+
root
|
|
467
|
+
} = this;
|
|
468
|
+
const open = item.isOpen;
|
|
469
|
+
const spec = {
|
|
470
|
+
attributes: {
|
|
471
|
+
id: item.contentId,
|
|
472
|
+
'aria-labelledby': item.triggerId,
|
|
473
|
+
'data-motion': this.motion,
|
|
474
|
+
'data-orientation': root.orientation,
|
|
475
|
+
'data-state': inViewport ? undefined : open ? 'open' : 'closed',
|
|
476
|
+
dir: root.explicitDir,
|
|
477
|
+
'data-test-jn-part': 'content',
|
|
478
|
+
'data-test-jn-value': item.value
|
|
479
|
+
},
|
|
480
|
+
on: {
|
|
481
|
+
keydown: event => this.#onKeyDown(event),
|
|
482
|
+
...(inViewport ? {} : {
|
|
483
|
+
pointerenter: () => root.onContentEnter(),
|
|
484
|
+
pointerleave: event => root.onContentLeave(event)
|
|
485
|
+
})
|
|
486
|
+
},
|
|
487
|
+
element: element => {
|
|
488
|
+
focusGroups.add(element);
|
|
489
|
+
item.contentRef.set(element);
|
|
490
|
+
const onRootDismiss = () => {
|
|
491
|
+
root.onItemDismiss();
|
|
492
|
+
item.onRootContentClose();
|
|
493
|
+
if (element.contains(document.activeElement)) item.triggerRef.current?.focus();
|
|
494
|
+
};
|
|
495
|
+
element.addEventListener(ROOT_CONTENT_DISMISS, onRootDismiss);
|
|
496
|
+
return () => {
|
|
497
|
+
element.removeEventListener(ROOT_CONTENT_DISMISS, onRootDismiss);
|
|
498
|
+
focusGroups.delete(element);
|
|
499
|
+
item.contentRef.release(element);
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
return spec;
|
|
504
|
+
});
|
|
505
|
+
/** While it is closing in place, it takes no pointer: Radix's "prevent interaction when animating out". */
|
|
506
|
+
pointerEvents = modifier((element, [open]) => {
|
|
507
|
+
if (open) element.style.removeProperty('pointer-events');else element.style.setProperty('pointer-events', 'none');
|
|
508
|
+
});
|
|
509
|
+
/** The Viewport sizes itself to the content that is shown in it. */
|
|
510
|
+
sizeViewport = modifier((element, [active]) => {
|
|
511
|
+
if (active) this.root.sizeViewportTo(element);
|
|
512
|
+
});
|
|
513
|
+
/** Tab moves through its links, and from the last (or first) out through the focus proxy. */
|
|
514
|
+
#onKeyDown(event) {
|
|
515
|
+
const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
|
|
516
|
+
if (event.key !== 'Tab' || isMetaKey) return;
|
|
517
|
+
const candidates = tabbableCandidates(event.currentTarget);
|
|
518
|
+
const index = candidates.findIndex(candidate => candidate === document.activeElement);
|
|
519
|
+
const next = event.shiftKey ? candidates.slice(0, index).reverse() : candidates.slice(index + 1, candidates.length);
|
|
520
|
+
if (focusFirst(next)) event.preventDefault();else this.item.focusProxyRef.current?.focus();
|
|
521
|
+
}
|
|
522
|
+
onDismiss = () => {
|
|
523
|
+
this.item.contentRef.current?.dispatchEvent(new Event(ROOT_CONTENT_DISMISS, {
|
|
524
|
+
bubbles: true,
|
|
525
|
+
cancelable: true
|
|
526
|
+
}));
|
|
527
|
+
};
|
|
528
|
+
onEscapeKeyDown = event => {
|
|
529
|
+
this.args.onEscapeKeyDown?.(event);
|
|
530
|
+
if (!event.defaultPrevented) this.item.wasEscapeClose = true;
|
|
531
|
+
};
|
|
532
|
+
onFocusOutside = event => {
|
|
533
|
+
this.args.onFocusOutside?.(event);
|
|
534
|
+
if (event.defaultPrevented) return;
|
|
535
|
+
this.item.onContentFocusOutside();
|
|
536
|
+
const target = event.target;
|
|
537
|
+
const nav = this.root.rootRef.current;
|
|
538
|
+
if (target && nav?.contains(target)) event.preventDefault();
|
|
539
|
+
};
|
|
540
|
+
onPointerDownOutside = event => {
|
|
541
|
+
this.args.onPointerDownOutside?.(event);
|
|
542
|
+
if (event.defaultPrevented) return;
|
|
543
|
+
const target = event.target;
|
|
544
|
+
if (!target) return;
|
|
545
|
+
const isTrigger = this.root.isTrigger(target);
|
|
546
|
+
const isRootViewport = this.viewport?.contains(target) ?? false;
|
|
547
|
+
if (isTrigger || isRootViewport) event.preventDefault();
|
|
548
|
+
};
|
|
549
|
+
static {
|
|
550
|
+
setComponentTemplate(precompileTemplate("{{#if this.isInViewport}}\n {{#if this.viewport}}\n {{#in-element this.viewport insertBefore=null}}\n <Presence @present={{this.isActive}} @forceMount={{@forceMount}} as |presence|>\n <As @as={{@as}} @tag=\"div\" ...attributes {{presence.ref}} {{this.content inViewport=true}} {{this.sizeViewport this.isActive}} {{dismissable enabled=this.item.isOpen onDismiss=this.onDismiss onEscapeKeyDown=this.onEscapeKeyDown onPointerDownOutside=this.onPointerDownOutside onFocusOutside=this.onFocusOutside onInteractOutside=@onInteractOutside}}>{{yield}}</As>\n </Presence>\n {{/in-element}}\n {{/if}}\n{{else}}\n <Presence @present={{this.item.isOpen}} @forceMount={{@forceMount}} as |presence|>\n <As @as={{@as}} @tag=\"div\" ...attributes {{presence.ref}} {{this.content inViewport=false}} {{this.pointerEvents this.item.isOpen}} {{dismissable enabled=this.item.isOpen onDismiss=this.onDismiss onEscapeKeyDown=this.onEscapeKeyDown onPointerDownOutside=this.onPointerDownOutside onFocusOutside=this.onFocusOutside onInteractOutside=@onInteractOutside}}>{{yield}}</As>\n </Presence>\n{{/if}}", {
|
|
551
|
+
strictMode: true,
|
|
552
|
+
scope: () => ({
|
|
553
|
+
Presence,
|
|
554
|
+
As,
|
|
555
|
+
dismissable
|
|
556
|
+
})
|
|
557
|
+
}), this);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
/** What an item yields: its trigger and content, the trigger's modifier, and its state. */
|
|
561
|
+
|
|
562
|
+
/** An item of the list: an `<li>` holding a link, or a trigger and its content. */class NavigationMenuItem extends Component {
|
|
563
|
+
triggerRef = new ElementRef();
|
|
564
|
+
contentRef = new ElementRef();
|
|
565
|
+
focusProxyRef = new ElementRef();
|
|
566
|
+
/** Escape closed it: the pointer resting on its trigger doesn't open it again until it leaves. */
|
|
567
|
+
wasEscapeClose = false;
|
|
568
|
+
#wasClickClose = false;
|
|
569
|
+
#hasPointerMoveOpened = false;
|
|
570
|
+
#restoreContentTabOrder = () => {};
|
|
571
|
+
constructor(owner, args) {
|
|
572
|
+
super(owner, args);
|
|
573
|
+
this.root.items.add(this);
|
|
574
|
+
}
|
|
575
|
+
willDestroy() {
|
|
576
|
+
super.willDestroy();
|
|
577
|
+
this.root.items.delete(this);
|
|
578
|
+
}
|
|
579
|
+
get root() {
|
|
580
|
+
return this.args.root;
|
|
581
|
+
}
|
|
582
|
+
get value() {
|
|
583
|
+
return this.args.value || idFor(this, 'item');
|
|
584
|
+
}
|
|
585
|
+
get isOpen() {
|
|
586
|
+
return this.root.value === this.value;
|
|
587
|
+
}
|
|
588
|
+
get triggerId() {
|
|
589
|
+
return `${this.root.id}-trigger-${this.value}`;
|
|
590
|
+
}
|
|
591
|
+
get contentId() {
|
|
592
|
+
return `${this.root.id}-content-${this.value}`;
|
|
593
|
+
}
|
|
594
|
+
/** Focus into the content: its first link (`start`) or its last (`end`). */
|
|
595
|
+
onContentEntry = (side = 'start') => {
|
|
596
|
+
const content = this.contentRef.current;
|
|
597
|
+
if (!content) return;
|
|
598
|
+
this.#restoreContentTabOrder();
|
|
599
|
+
const candidates = tabbableCandidates(content);
|
|
600
|
+
if (candidates.length) focusFirst(side === 'start' ? candidates : candidates.reverse());
|
|
601
|
+
};
|
|
602
|
+
/** Focus left the content, or it closed: its links leave the tab order until focus comes back. */
|
|
603
|
+
#onContentExit() {
|
|
604
|
+
const content = this.contentRef.current;
|
|
605
|
+
if (!content) return;
|
|
606
|
+
const candidates = tabbableCandidates(content);
|
|
607
|
+
if (candidates.length) this.#restoreContentTabOrder = removeFromTabOrder(candidates);
|
|
608
|
+
}
|
|
609
|
+
onRootContentClose() {
|
|
610
|
+
this.#onContentExit();
|
|
611
|
+
}
|
|
612
|
+
onContentFocusOutside() {
|
|
613
|
+
this.#onContentExit();
|
|
614
|
+
}
|
|
615
|
+
trigger = part(options => {
|
|
616
|
+
const disabled = options.disabled ?? false;
|
|
617
|
+
const {
|
|
618
|
+
root
|
|
619
|
+
} = this;
|
|
620
|
+
const open = this.isOpen;
|
|
621
|
+
const spec = {
|
|
622
|
+
attributes: {
|
|
623
|
+
id: this.triggerId,
|
|
624
|
+
'data-disabled': disabled ? '' : undefined,
|
|
625
|
+
'data-state': open ? 'open' : 'closed',
|
|
626
|
+
'aria-expanded': String(open),
|
|
627
|
+
'aria-controls': this.contentId,
|
|
628
|
+
'data-test-jn-part': 'trigger',
|
|
629
|
+
'data-test-jn-value': this.value
|
|
630
|
+
},
|
|
631
|
+
on: {
|
|
632
|
+
pointerenter: () => {
|
|
633
|
+
this.#wasClickClose = false;
|
|
634
|
+
this.wasEscapeClose = false;
|
|
635
|
+
},
|
|
636
|
+
pointermove: event => {
|
|
637
|
+
if (!isMouse(event)) return;
|
|
638
|
+
if (disabled || this.#wasClickClose || this.wasEscapeClose) return;
|
|
639
|
+
if (this.#hasPointerMoveOpened) return;
|
|
640
|
+
root.onTriggerEnter(this.value);
|
|
641
|
+
this.#hasPointerMoveOpened = true;
|
|
642
|
+
},
|
|
643
|
+
pointerleave: event => {
|
|
644
|
+
if (!isMouse(event) || disabled) return;
|
|
645
|
+
root.onTriggerLeave();
|
|
646
|
+
this.#hasPointerMoveOpened = false;
|
|
647
|
+
},
|
|
648
|
+
click: () => {
|
|
649
|
+
const wasOpen = this.isOpen;
|
|
650
|
+
root.onItemSelect(this.value);
|
|
651
|
+
this.#wasClickClose = wasOpen;
|
|
652
|
+
},
|
|
653
|
+
keydown: event => {
|
|
654
|
+
const verticalEntryKey = root.dir === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
655
|
+
const entryKey = root.orientation === 'horizontal' ? 'ArrowDown' : verticalEntryKey;
|
|
656
|
+
if (this.isOpen && event.key === entryKey) {
|
|
657
|
+
this.onContentEntry();
|
|
658
|
+
event.preventDefault();
|
|
659
|
+
}
|
|
660
|
+
onFocusGroupKeyDown(event, root.dir);
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
element: element => {
|
|
664
|
+
this.triggerRef.set(element);
|
|
665
|
+
focusGroupItems.add(element);
|
|
666
|
+
const restoreType = buttonType(element);
|
|
667
|
+
return () => {
|
|
668
|
+
restoreType();
|
|
669
|
+
focusGroupItems.delete(element);
|
|
670
|
+
this.triggerRef.release(element);
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
return withLook(spec, this.args.triggerLook);
|
|
675
|
+
});
|
|
676
|
+
/**
|
|
677
|
+
* Whether the item renders its trigger's focus proxy (and `aria-owns`) itself, at its end:
|
|
678
|
+
* while it is open, for a trigger of the caller's own (`<a {{item.trigger}}>`). The Trigger
|
|
679
|
+
* component renders its own, right after it. At the item's end, after a trigger that is its
|
|
680
|
+
* only content, it does the same: in the viewport's case the item holds nothing else, and
|
|
681
|
+
* without one, the content between them is taken out of the tab order as focus leaves it.
|
|
682
|
+
*/
|
|
683
|
+
get rendersFocusProxy() {
|
|
684
|
+
const trigger = this.triggerRef.value;
|
|
685
|
+
return this.isOpen && trigger !== null && !proxiedTriggers.has(trigger);
|
|
686
|
+
}
|
|
687
|
+
/** The focus proxy after an open trigger: Tab onto it goes into the content. */
|
|
688
|
+
focusProxy = part(() => ({
|
|
689
|
+
attributes: {},
|
|
690
|
+
on: {
|
|
691
|
+
focus: event => {
|
|
692
|
+
const content = this.contentRef.current;
|
|
693
|
+
const previous = event.relatedTarget;
|
|
694
|
+
const wasTriggerFocused = previous === this.triggerRef.current;
|
|
695
|
+
const wasFocusFromContent = previous ? content?.contains(previous) ?? false : false;
|
|
696
|
+
if (wasTriggerFocused || !wasFocusFromContent) {
|
|
697
|
+
this.onContentEntry(wasTriggerFocused ? 'start' : 'end');
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
element: element => {
|
|
702
|
+
this.focusProxyRef.set(element);
|
|
703
|
+
return () => this.focusProxyRef.release(element);
|
|
704
|
+
}
|
|
705
|
+
}));
|
|
706
|
+
static {
|
|
707
|
+
setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"li\" data-test-jn-part=\"item\" data-test-jn-value={{this.value}} ...attributes>\n {{yield (hash Trigger=(component NavigationMenuTrigger item=this) Content=(component NavigationMenuContent item=this) trigger=this.trigger value=this.value isOpen=this.isOpen)}}\n {{#if this.rendersFocusProxy}}\n <FocusProxy @item={{this}} />\n {{/if}}\n</As>", {
|
|
708
|
+
strictMode: true,
|
|
709
|
+
scope: () => ({
|
|
710
|
+
As,
|
|
711
|
+
hash,
|
|
712
|
+
NavigationMenuTrigger,
|
|
713
|
+
NavigationMenuContent,
|
|
714
|
+
FocusProxy
|
|
715
|
+
})
|
|
716
|
+
}), this);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
// ----- A link ------------------------------------------------------------------------------------
|
|
720
|
+
/** What a link and its modifier take. */
|
|
721
|
+
|
|
722
|
+
/** A link's modifier: Radix's NavigationMenuLink on your own element (`<LinkTo {{n.link}}>`). */function navigationMenuLinkPart(root, look = () => undefined) {
|
|
723
|
+
return part(options => {
|
|
724
|
+
const spec = {
|
|
725
|
+
attributes: {
|
|
726
|
+
'data-active': options.active ? '' : undefined,
|
|
727
|
+
'aria-current': options.active ? 'page' : undefined,
|
|
728
|
+
'data-test-jn-part': 'link'
|
|
729
|
+
},
|
|
730
|
+
on: {
|
|
731
|
+
keydown: event => onFocusGroupKeyDown(event, root.dir),
|
|
732
|
+
click: event => {
|
|
733
|
+
const target = event.target;
|
|
734
|
+
const select = new CustomEvent(LINK_SELECT, {
|
|
735
|
+
bubbles: true,
|
|
736
|
+
cancelable: true
|
|
737
|
+
});
|
|
738
|
+
target.addEventListener(LINK_SELECT, selected => options.onSelect?.(selected), {
|
|
739
|
+
once: true
|
|
740
|
+
});
|
|
741
|
+
target.dispatchEvent(select);
|
|
742
|
+
if (!select.defaultPrevented && !event.metaKey) {
|
|
743
|
+
target.dispatchEvent(new CustomEvent(ROOT_CONTENT_DISMISS, {
|
|
744
|
+
bubbles: true,
|
|
745
|
+
cancelable: true
|
|
746
|
+
}));
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
element: element => {
|
|
751
|
+
focusGroupItems.add(element);
|
|
752
|
+
return () => focusGroupItems.delete(element);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
return withLook(spec, look());
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* A link: an `<a>` (give it `href`), in the list or in a content. Selecting it closes the
|
|
760
|
+
* content it is in, unless its `@onSelect` prevents that.
|
|
761
|
+
*/
|
|
762
|
+
const NavigationMenuLink = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"a\" ...attributes {{@link active=@active onSelect=@onSelect}}>{{yield}}</As>", {
|
|
763
|
+
strictMode: true,
|
|
764
|
+
scope: () => ({
|
|
765
|
+
As
|
|
766
|
+
})
|
|
767
|
+
}), templateOnly());
|
|
768
|
+
// ----- The indicator ------------------------------------------------------------------------------
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* A mark under the open trigger, as Radix's `Indicator`: rendered in the list's track, as wide
|
|
772
|
+
* as the trigger and moved along to it, `data-state="visible"` while a content is open.
|
|
773
|
+
*/
|
|
774
|
+
class NavigationMenuIndicator extends Component {
|
|
775
|
+
#trigger = new Remembered(null);
|
|
776
|
+
get root() {
|
|
777
|
+
return this.args.root;
|
|
778
|
+
}
|
|
779
|
+
get isVisible() {
|
|
780
|
+
return this.root.isOpen;
|
|
781
|
+
}
|
|
782
|
+
/** The trigger whose content is open, or the last one that was. */
|
|
783
|
+
get activeTrigger() {
|
|
784
|
+
const value = this.root.value;
|
|
785
|
+
const item = this.root.triggerItems().find(each => each.value === value);
|
|
786
|
+
return this.#trigger.keep(item?.triggerRef.current ?? undefined);
|
|
787
|
+
}
|
|
788
|
+
place = modifier((element, [trigger, track, orientation]) => {
|
|
789
|
+
const horizontal = orientation === 'horizontal';
|
|
790
|
+
const position = () => {
|
|
791
|
+
if (!trigger) return;
|
|
792
|
+
const size = horizontal ? trigger.offsetWidth : trigger.offsetHeight;
|
|
793
|
+
const offset = horizontal ? trigger.offsetLeft : trigger.offsetTop;
|
|
794
|
+
const style = element.style;
|
|
795
|
+
style.setProperty('position', 'absolute');
|
|
796
|
+
if (horizontal) {
|
|
797
|
+
style.setProperty('left', '0px');
|
|
798
|
+
style.setProperty('width', `${size}px`);
|
|
799
|
+
style.setProperty('transform', `translateX(${offset}px)`);
|
|
800
|
+
} else {
|
|
801
|
+
style.setProperty('top', '0px');
|
|
802
|
+
style.setProperty('height', `${size}px`);
|
|
803
|
+
style.setProperty('transform', `translateY(${offset}px)`);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
position();
|
|
807
|
+
if (isUndefined(globalThis.ResizeObserver)) return;
|
|
808
|
+
ignoreROError();
|
|
809
|
+
const observer = new ResizeObserver(position);
|
|
810
|
+
if (trigger) observer.observe(trigger);
|
|
811
|
+
if (track) observer.observe(track);
|
|
812
|
+
return () => observer.disconnect();
|
|
813
|
+
});
|
|
814
|
+
static {
|
|
815
|
+
setComponentTemplate(precompileTemplate("{{#if this.root.trackRef.value}}\n {{#in-element this.root.trackRef.value insertBefore=null}}\n <Presence @present={{this.isVisible}} @forceMount={{@forceMount}} as |presence|>\n <div aria-hidden=\"true\" data-state={{if this.isVisible \"visible\" \"hidden\"}} data-orientation={{this.root.orientation}} data-test-jn-part=\"indicator\" ...attributes {{presence.ref}} {{this.place this.activeTrigger this.root.trackRef.value this.root.orientation}}>{{yield}}</div>\n </Presence>\n {{/in-element}}\n{{/if}}", {
|
|
816
|
+
strictMode: true,
|
|
817
|
+
scope: () => ({
|
|
818
|
+
Presence
|
|
819
|
+
})
|
|
820
|
+
}), this);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
// ----- The viewport ---------------------------------------------------------------------------------
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Where every content shows, as Radix's `Viewport`: one panel, rendered while a content is open,
|
|
827
|
+
* sized to it (`--radix-navigation-menu-viewport-width` and `-height`), so it can animate its
|
|
828
|
+
* size as one content gives way to another.
|
|
829
|
+
*/
|
|
830
|
+
class NavigationMenuViewport extends Component {
|
|
831
|
+
constructor(owner, args) {
|
|
832
|
+
super(owner, args);
|
|
833
|
+
registerDestructor(this, args.root.registerViewport());
|
|
834
|
+
}
|
|
835
|
+
get root() {
|
|
836
|
+
return this.args.root;
|
|
837
|
+
}
|
|
838
|
+
viewport = part(() => {
|
|
839
|
+
const {
|
|
840
|
+
root
|
|
841
|
+
} = this;
|
|
842
|
+
return {
|
|
843
|
+
attributes: {
|
|
844
|
+
'data-state': root.isOpen ? 'open' : 'closed',
|
|
845
|
+
'data-orientation': root.orientation,
|
|
846
|
+
'data-test-jn-part': 'viewport'
|
|
847
|
+
},
|
|
848
|
+
on: {
|
|
849
|
+
pointerenter: () => root.onContentEnter(),
|
|
850
|
+
pointerleave: event => root.onContentLeave(event)
|
|
851
|
+
},
|
|
852
|
+
element: element => {
|
|
853
|
+
root.viewportRef.set(element);
|
|
854
|
+
return () => root.viewportRef.release(element);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
});
|
|
858
|
+
pointerEvents = modifier((element, [open]) => {
|
|
859
|
+
if (open) element.style.removeProperty('pointer-events');else element.style.setProperty('pointer-events', 'none');
|
|
860
|
+
});
|
|
861
|
+
static {
|
|
862
|
+
setComponentTemplate(precompileTemplate("<Presence @present={{this.root.isOpen}} @forceMount={{@forceMount}} as |presence|>\n <div ...attributes {{presence.ref}} {{this.viewport}} {{this.pointerEvents this.root.isOpen}}></div>\n</Presence>", {
|
|
863
|
+
strictMode: true,
|
|
864
|
+
scope: () => ({
|
|
865
|
+
Presence
|
|
866
|
+
})
|
|
867
|
+
}), this);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
export { NavigationMenu, NavigationMenuItem, NavigationMenu as default, navigationMenuLinkPart };
|
|
872
|
+
//# sourceMappingURL=navigation-menu.js.map
|