@eunomia/elements 1.0.0-beta.9 → 1.0.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/README.md +28 -6
- package/dist/angular/forms.d.ts +80 -0
- package/dist/angular/forms.js +267 -0
- package/dist/cdn/components/chunks/chunk-2XPIGFBD.js +1 -0
- package/dist/cdn/components/chunks/chunk-5IUNSTM3.js +1 -0
- package/dist/cdn/components/chunks/chunk-7HXPLZ7C.js +1 -0
- package/dist/cdn/components/chunks/{chunk-J3SZBXM6.js → chunk-A2NO4RSF.js} +7 -7
- package/dist/cdn/components/chunks/{chunk-Q34EQ5HZ.js → chunk-A623JJXJ.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-Y3HOIL64.js → chunk-AW7PU43S.js} +2 -2
- package/dist/cdn/components/chunks/{chunk-FF3I7C3C.js → chunk-DWTNRFWW.js} +1 -3
- package/dist/cdn/components/chunks/chunk-FPNWPMHA.js +1 -0
- package/dist/cdn/components/chunks/chunk-GMWUHGNI.js +319 -0
- package/dist/cdn/components/chunks/{chunk-FQUWHNQT.js → chunk-GXOEPXDW.js} +1 -1
- package/dist/cdn/components/chunks/chunk-HXESKTK2.js +1 -0
- package/dist/cdn/components/chunks/chunk-JDUWKPHW.js +46 -0
- package/dist/cdn/components/chunks/{chunk-D3JJBHXN.js → chunk-JLKCBPD2.js} +2 -2
- package/dist/cdn/components/chunks/chunk-M6ZJHL4Q.js +1 -0
- package/dist/cdn/components/chunks/{chunk-TN3HGHQO.js → chunk-MDSUMP3O.js} +4 -4
- package/dist/cdn/components/chunks/chunk-MSQWOKBB.js +1 -0
- package/dist/cdn/components/chunks/{chunk-3UUZM7X2.js → chunk-NPXRQHUN.js} +3 -3
- package/dist/cdn/components/chunks/chunk-OB7DEGNX.js +1 -0
- package/dist/cdn/components/chunks/{chunk-JANNHW4Q.js → chunk-PADHCLBG.js} +4 -4
- package/dist/cdn/components/chunks/chunk-QMXE3KLT.js +1 -0
- package/dist/cdn/components/chunks/chunk-QNWKRPOW.js +1 -0
- package/dist/cdn/components/chunks/{chunk-KQUUMZ7U.js → chunk-RZF7QQDX.js} +7 -7
- package/dist/cdn/components/chunks/chunk-SCAP7J35.js +1 -0
- package/dist/cdn/components/chunks/chunk-TISMX7UL.js +1 -0
- package/dist/cdn/components/chunks/chunk-TWLI2ZOT.js +1 -0
- package/dist/cdn/components/chunks/chunk-W4VCWRY7.js +210 -0
- package/dist/cdn/components/chunks/{chunk-SZZRMJ65.js → chunk-WEG3KO6T.js} +3 -3
- package/dist/cdn/components/chunks/chunk-WP6ZYBAC.js +1 -0
- package/dist/cdn/components/chunks/{chunk-HGX6GPHM.js → chunk-XCBQ4CKH.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-3UW2LJ7T.js → chunk-XZ3LFOQP.js} +2 -2
- package/dist/cdn/components/eun-alert.js +1 -1
- package/dist/cdn/components/eun-animate.js +92 -180
- package/dist/cdn/components/eun-breadcrumb.js +4 -4
- package/dist/cdn/components/eun-button.js +1 -1
- package/dist/cdn/components/eun-calendar.js +188 -115
- package/dist/cdn/components/eun-card.js +1 -1
- package/dist/cdn/components/eun-carousel.js +36 -28
- package/dist/cdn/components/eun-check-card.js +3 -3
- package/dist/cdn/components/eun-checkbox-list.js +2 -2
- package/dist/cdn/components/eun-checkbox.js +1 -1
- package/dist/cdn/components/eun-chip.js +11 -15
- package/dist/cdn/components/eun-collapse.js +21 -10
- package/dist/cdn/components/eun-color-picker.js +32 -32
- package/dist/cdn/components/eun-counter.js +8 -8
- package/dist/cdn/components/eun-date-picker.js +83 -79
- package/dist/cdn/components/eun-description-list.js +1 -1
- package/dist/cdn/components/eun-divider.js +9 -8
- package/dist/cdn/components/eun-drawer.js +8 -6
- package/dist/cdn/components/eun-dropdown-button.js +1 -1
- package/dist/cdn/components/eun-dropdown-item.js +4 -4
- package/dist/cdn/components/eun-fab.js +1 -1
- package/dist/cdn/components/eun-image-card.js +2 -2
- package/dist/cdn/components/eun-image-carousel.js +55 -29
- package/dist/cdn/components/eun-infinite-list.js +2 -2
- package/dist/cdn/components/eun-input-file.js +3 -3
- package/dist/cdn/components/eun-input-phone.js +6 -6
- package/dist/cdn/components/eun-input.js +1 -1
- package/dist/cdn/components/eun-label.js +1 -1
- package/dist/cdn/components/eun-link.js +18 -329
- package/dist/cdn/components/eun-loader.js +1 -1
- package/dist/cdn/components/eun-modal.js +9 -7
- package/dist/cdn/components/eun-nav-menu.js +363 -0
- package/dist/cdn/components/eun-pagination.js +4 -4
- package/dist/cdn/components/eun-password-strength.js +2 -2
- package/dist/cdn/components/eun-progress-bar.js +1 -1
- package/dist/cdn/components/eun-radio-card.js +4 -4
- package/dist/cdn/components/eun-radio-list.js +1 -1
- package/dist/cdn/components/eun-radio.js +1 -1
- package/dist/cdn/components/eun-rating.js +9 -9
- package/dist/cdn/components/eun-scheduler-event-editor.js +113 -77
- package/dist/cdn/components/eun-scheduler-event.js +1 -1
- package/dist/cdn/components/eun-scheduler.js +137 -79
- package/dist/cdn/components/eun-search.js +6 -6
- package/dist/cdn/components/eun-select.js +1 -1
- package/dist/cdn/components/eun-sidebar.js +23 -14
- package/dist/cdn/components/eun-slider.js +2 -2
- package/dist/cdn/components/eun-sliding-card.js +1 -1
- package/dist/cdn/components/eun-step.js +2 -2
- package/dist/cdn/components/eun-stepper.js +11 -12
- package/dist/cdn/components/eun-switch.js +2 -2
- package/dist/cdn/components/eun-tab-group.js +1 -1
- package/dist/cdn/components/eun-tab-panel.js +1 -1
- package/dist/cdn/components/eun-table-action-bar.js +1 -1
- package/dist/cdn/components/eun-table.js +13 -10
- package/dist/cdn/components/eun-tag.js +1 -1
- package/dist/cdn/components/eun-textarea.js +4 -4
- package/dist/cdn/components/eun-time-picker.js +28 -25
- package/dist/cdn/components/eun-toast.js +8 -8
- package/dist/cdn/components/eun-toggle-group.js +8 -2
- package/dist/cdn/components/eun-toggle-item.js +8 -2
- package/dist/cdn/components/eun-toggle.js +4 -1
- package/dist/cdn/components/eun-toolbar.js +114 -36
- package/dist/cdn/components/eun-tooltip.js +1 -1
- package/dist/cdn/styles/eunomia-themes.css +1 -1
- package/dist/cdn/styles/themes/eunomia-theme.css +1 -1
- package/dist/cdn/styles/themes/mixins/eunomia-neutrals.mixin.scss +2 -2
- package/dist/cdn/styles/themes/prebuilt-themes/eunomia/eunomia.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/fire/eunomia-fire.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/forest/eunomia-forest.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/gold/eunomia-gold.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/ocean/eunomia-ocean.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/salmon/eunomia-salmon.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/violet/eunomia-violet.theme.css +1 -1
- package/dist/cdn/styles/tools/mixins/layout/eunomia-grid.mixin.scss +116 -8
- package/dist/components/action/button/button.styles.js +2 -2
- package/dist/components/action/dropdown-button/dropdown-button.d.ts +4 -0
- package/dist/components/action/dropdown-button/dropdown-button.js +1 -0
- package/dist/components/action/dropdown-button/dropdown-button.styles.js +5 -4
- package/dist/components/action/dropdown-button/dropdown-item.d.ts +1 -0
- package/dist/components/action/dropdown-button/dropdown-item.js +1 -0
- package/dist/components/action/dropdown-button/dropdown-item.styles.js +4 -4
- package/dist/components/action/link/link.d.ts +2 -1
- package/dist/components/action/link/link.js +2 -1
- package/dist/components/action/link/link.styles.d.ts +40 -1
- package/dist/components/action/link/link.styles.js +83 -60
- package/dist/components/action/shared-styles/button-palette.styles.js +1 -1
- package/dist/components/action/toggle/toggle-group.d.ts +1 -0
- package/dist/components/action/toggle/toggle-group.js +1 -0
- package/dist/components/action/toggle/toggle-group.styles.d.ts +1 -0
- package/dist/components/action/toggle/toggle-group.styles.js +9 -2
- package/dist/components/action/toggle/toggle-item.styles.js +8 -2
- package/dist/components/action/toggle/toggle.d.ts +1 -0
- package/dist/components/action/toggle/toggle.js +1 -0
- package/dist/components/action/toggle/toggle.styles.d.ts +1 -0
- package/dist/components/action/toggle/toggle.styles.js +5 -1
- package/dist/components/alert/drawer/drawer.d.ts +14 -13
- package/dist/components/alert/drawer/drawer.js +20 -28
- package/dist/components/alert/modal/modal.d.ts +14 -13
- package/dist/components/alert/modal/modal.js +20 -28
- package/dist/components/alert/modal/modal.styles.js +1 -1
- package/dist/components/alert/toast/toast.d.ts +5 -5
- package/dist/components/alert/toast/toast.js +9 -10
- package/dist/components/alert/toast/toast.styles.js +3 -3
- package/dist/components/content/card/image-card.styles.js +1 -1
- package/dist/components/content/chip/chip.d.ts +7 -9
- package/dist/components/content/chip/chip.js +11 -14
- package/dist/components/content/chip/chip.styles.js +1 -5
- package/dist/components/content/collapse/collapse.d.ts +5 -0
- package/dist/components/content/collapse/collapse.js +7 -0
- package/dist/components/content/collapse/collapse.styles.d.ts +3 -0
- package/dist/components/content/collapse/collapse.styles.js +13 -1
- package/dist/components/content/description-list/description-list.styles.js +1 -1
- package/dist/components/content/image-carousel/image-carousel.d.ts +60 -13
- package/dist/components/content/image-carousel/image-carousel.js +100 -22
- package/dist/components/content/image-carousel/image-carousel.styles.js +32 -6
- package/dist/components/content/password-strength/password-strength.styles.js +1 -1
- package/dist/components/content/progress-bar/progress-bar.styles.js +1 -1
- package/dist/components/content/shared-styles/card-link.styles.js +1 -1
- package/dist/components/content/shared-styles/tone-surface.styles.js +1 -3
- package/dist/components/form/checkbox/check-card.styles.js +2 -2
- package/dist/components/form/checkbox/checkbox-list.d.ts +3 -1
- package/dist/components/form/checkbox/checkbox-list.js +3 -1
- package/dist/components/form/checkbox/checkbox.styles.js +1 -1
- package/dist/components/form/color-picker/color-picker.d.ts +28 -3
- package/dist/components/form/color-picker/color-picker.js +53 -7
- package/dist/components/form/counter/counter.js +1 -1
- package/dist/components/form/counter/counter.styles.js +2 -2
- package/dist/components/form/date-picker/date-picker-day-grid.styles.js +1 -1
- package/dist/components/form/date-picker/date-picker-month-grid.js +1 -1
- package/dist/components/form/date-picker/date-picker.d.ts +50 -13
- package/dist/components/form/date-picker/date-picker.js +178 -43
- package/dist/components/form/input/input.js +1 -4
- package/dist/components/form/input-file/input-file.styles.js +2 -2
- package/dist/components/form/input-phone/input-phone.js +4 -3
- package/dist/components/form/label/label.styles.js +1 -1
- package/dist/components/form/radio/radio-card.styles.js +2 -2
- package/dist/components/form/radio/radio.styles.js +1 -1
- package/dist/components/form/rating/rating.js +3 -5
- package/dist/components/form/rating/rating.styles.js +2 -2
- package/dist/components/form/search/search.d.ts +1 -7
- package/dist/components/form/search/search.js +2 -12
- package/dist/components/form/shared-styles/field.styles.js +2 -2
- package/dist/components/form/slider/slider.styles.js +1 -1
- package/dist/components/form/switch/switch.styles.js +1 -1
- package/dist/components/form/textarea/textarea.js +1 -5
- package/dist/components/form/textarea/textarea.styles.js +2 -2
- package/dist/components/form/time-picker/time-picker-columns.d.ts +4 -1
- package/dist/components/form/time-picker/time-picker-columns.js +64 -15
- package/dist/components/form/time-picker/time-picker-columns.styles.js +5 -1
- package/dist/components/form/time-picker/time-picker-list.d.ts +4 -1
- package/dist/components/form/time-picker/time-picker-list.js +15 -8
- package/dist/components/form/time-picker/time-picker.d.ts +11 -2
- package/dist/components/form/time-picker/time-picker.js +22 -8
- package/dist/components/layout/animate/animate.d.ts +35 -17
- package/dist/components/layout/animate/animate.js +27 -14
- package/dist/components/layout/animate/animate.styles.d.ts +2 -1
- package/dist/components/layout/animate/animate.styles.js +107 -179
- package/dist/components/layout/divider/divider.d.ts +1 -0
- package/dist/components/layout/divider/divider.js +2 -1
- package/dist/components/layout/divider/divider.styles.js +7 -6
- package/dist/components/layout/infinite-list/infinite-list.styles.js +1 -1
- package/dist/components/navigation/breadcrumb/breadcrumb.styles.js +3 -3
- package/dist/components/navigation/carousel/carousel.d.ts +23 -14
- package/dist/components/navigation/carousel/carousel.js +39 -27
- package/dist/components/navigation/carousel/carousel.styles.js +16 -8
- package/dist/components/navigation/nav-menu/nav-menu.d.ts +201 -0
- package/dist/components/navigation/nav-menu/nav-menu.js +673 -0
- package/dist/components/navigation/nav-menu/nav-menu.styles.d.ts +1 -0
- package/dist/components/navigation/nav-menu/nav-menu.styles.js +352 -0
- package/dist/components/navigation/pagination/pagination.d.ts +3 -0
- package/dist/components/navigation/pagination/pagination.styles.js +2 -2
- package/dist/components/navigation/sidebar/sidebar.d.ts +8 -10
- package/dist/components/navigation/sidebar/sidebar.js +12 -15
- package/dist/components/navigation/sidebar/sidebar.styles.js +13 -4
- package/dist/components/navigation/stepper/step.styles.js +2 -2
- package/dist/components/navigation/stepper/stepper.d.ts +24 -13
- package/dist/components/navigation/stepper/stepper.js +36 -23
- package/dist/components/navigation/stepper/stepper.styles.js +2 -2
- package/dist/components/navigation/tabs/tab-group/tab-group.js +1 -1
- package/dist/components/navigation/tabs/tab-panel/tab-panel.styles.js +1 -1
- package/dist/components/navigation/toolbar/toolbar.d.ts +121 -20
- package/dist/components/navigation/toolbar/toolbar.js +176 -45
- package/dist/components/navigation/toolbar/toolbar.styles.js +113 -28
- package/dist/events/editor-state-change.event.d.ts +28 -0
- package/dist/events/editor-state-change.event.js +22 -0
- package/dist/events/event-cancel.event.d.ts +20 -0
- package/dist/events/event-cancel.event.js +17 -0
- package/dist/events/period-change.event.d.ts +14 -6
- package/dist/events/period-change.event.js +9 -6
- package/dist/features/scheduler/calendar/calendar.d.ts +52 -20
- package/dist/features/scheduler/calendar/calendar.js +84 -36
- package/dist/features/scheduler/calendar/calendar.styles.js +5 -2
- package/dist/features/scheduler/scheduler/scheduler.d.ts +69 -4
- package/dist/features/scheduler/scheduler/scheduler.js +172 -47
- package/dist/features/scheduler/scheduler/scheduler.styles.js +6 -0
- package/dist/features/scheduler/scheduler-event/scheduler-event.d.ts +18 -20
- package/dist/features/scheduler/scheduler-event/scheduler-event.js +29 -38
- package/dist/features/scheduler/scheduler-event/scheduler-event.styles.js +2 -2
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.d.ts +102 -18
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.js +249 -112
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.styles.js +11 -1
- package/dist/features/scheduler/shared/scheduler-event-popover.d.ts +9 -1
- package/dist/features/scheduler/shared/scheduler-event-popover.js +77 -42
- package/dist/features/scheduler/shared/scheduler-event-popover.styles.js +14 -3
- package/dist/features/scheduler/shared/scheduler-hour-grid.d.ts +3 -2
- package/dist/features/scheduler/shared/scheduler-hour-grid.js +53 -46
- package/dist/features/scheduler/shared/scheduler-hour-grid.styles.js +13 -7
- package/dist/features/scheduler/shared/scheduler-month-view.js +1 -1
- package/dist/features/scheduler/shared/scheduler-month-view.styles.js +13 -7
- package/dist/features/scheduler/shared/scheduler-year-view.d.ts +6 -5
- package/dist/features/scheduler/shared/scheduler-year-view.js +11 -7
- package/dist/features/scheduler/shared/scheduler-year-view.styles.js +57 -3
- package/dist/features/scheduler/shared/scheduler.types.d.ts +5 -9
- package/dist/features/scheduler/shared/scheduler.utils.d.ts +61 -0
- package/dist/features/scheduler/shared/scheduler.utils.js +78 -4
- package/dist/features/table/table/table-native.styles.js +8 -4
- package/dist/features/table/table/table.d.ts +2 -1
- package/dist/features/table/table/table.js +2 -1
- package/dist/features/table/table/table.styles.js +6 -4
- package/dist/i18n/en.d.ts +17 -0
- package/dist/i18n/en.js +17 -0
- package/dist/i18n/fr.js +17 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/jsx.d.ts +48 -6
- package/dist/mixins/anchor-position.mixin.d.ts +17 -0
- package/dist/mixins/anchor-position.mixin.js +45 -7
- package/dist/mixins/button.mixin.js +2 -1
- package/dist/mixins/check.mixin.js +14 -5
- package/dist/mixins/dialog-surface.mixin.d.ts +1 -1
- package/dist/mixins/dialog-surface.mixin.js +5 -5
- package/dist/mixins/form.mixin.js +33 -13
- package/dist/mixins/localizable.mixin.d.ts +1 -0
- package/dist/mixins/localizable.mixin.js +9 -2
- package/dist/mixins/radio.mixin.js +14 -5
- package/dist/mixins/validators.mixin.js +4 -3
- package/dist/react.d.ts +59 -0
- package/dist/react.js +42 -0
- package/dist/ssr/animate-ssr.css +35 -0
- package/dist/ssr/breadcrumb-ssr.css +3 -3
- package/dist/ssr/button-ssr.css +8 -2
- package/dist/ssr/card-ssr.css +1 -1
- package/dist/ssr/carousel-ssr.css +15 -4
- package/dist/ssr/chip-ssr.css +3 -3
- package/dist/ssr/collapse-ssr.css +2 -2
- package/dist/ssr/description-list-ssr.css +1 -1
- package/dist/ssr/divider-ssr.css +23 -0
- package/dist/ssr/field-ssr.css +245 -42
- package/dist/ssr/image-carousel-ssr.css +2 -4
- package/dist/ssr/links-ssr.css +17 -3
- package/dist/ssr/nav-menu-ssr.css +82 -0
- package/dist/ssr/overlay-ssr.css +4 -0
- package/dist/ssr/scheduler-ssr.css +182 -0
- package/dist/ssr/stepper-ssr.css +136 -0
- package/dist/ssr/table-ssr.css +7 -4
- package/dist/ssr/tag-ssr.css +1 -1
- package/dist/ssr/toolbar-ssr.css +7 -5
- package/dist/utils/css-length.utils.d.ts +14 -0
- package/dist/utils/css-length.utils.js +32 -0
- package/dist/utils/form-validation.utils.d.ts +36 -0
- package/dist/utils/form-validation.utils.js +113 -0
- package/dist/utils/implicit-submission.utils.js +2 -14
- package/dist/utils/interactive-content.utils.d.ts +10 -0
- package/dist/utils/interactive-content.utils.js +43 -0
- package/dist/utils/popover.utils.js +3 -2
- package/dist/utils/scroll-lock.utils.d.ts +9 -1
- package/dist/utils/scroll-lock.utils.js +21 -2
- package/dist/utils/theme-generator.utils.d.ts +1 -0
- package/dist/utils/theme-generator.utils.js +23 -10
- package/dist/utils/validity.utils.d.ts +18 -4
- package/dist/utils/validity.utils.js +74 -4
- package/package.json +34 -3
- package/styles/themes/mixins/eunomia-neutrals.mixin.scss +2 -2
- package/styles/tools/mixins/layout/eunomia-grid.mixin.scss +116 -8
- package/dist/cdn/components/chunks/chunk-4DRU3IYJ.js +0 -1
- package/dist/cdn/components/chunks/chunk-647ISUF4.js +0 -1
- package/dist/cdn/components/chunks/chunk-6TIEBY34.js +0 -1
- package/dist/cdn/components/chunks/chunk-E6UOI36Q.js +0 -1
- package/dist/cdn/components/chunks/chunk-GNAUNTS5.js +0 -1
- package/dist/cdn/components/chunks/chunk-IJJ67C66.js +0 -1
- package/dist/cdn/components/chunks/chunk-J7ETIRSK.js +0 -1
- package/dist/cdn/components/chunks/chunk-JGV7LHEI.js +0 -1
- package/dist/cdn/components/chunks/chunk-L74LXUGL.js +0 -1
- package/dist/cdn/components/chunks/chunk-MY6ORZJR.js +0 -46
- package/dist/cdn/components/chunks/chunk-QWTFP56P.js +0 -1
- package/dist/cdn/components/chunks/chunk-SFX2LQ4K.js +0 -205
- package/dist/cdn/components/chunks/chunk-WW4BTWMH.js +0 -1
- package/dist/utils/boolean.utils.d.ts +0 -14
- package/dist/utils/boolean.utils.js +0 -20
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _EunomiaNavMenu_instances, _EunomiaNavMenu_locked, _EunomiaNavMenu_showTimer, _EunomiaNavMenu_hideTimer, _EunomiaNavMenu_childObserver, _EunomiaNavMenu_syncChildren, _EunomiaNavMenu_assignSlots, _EunomiaNavMenu_applyOpen, _EunomiaNavMenu_setOpen, _EunomiaNavMenu_clearTimers, _EunomiaNavMenu_toggleOpenListeners, _EunomiaNavMenu_anchorPanel, _EunomiaNavMenu_focusTarget, _EunomiaNavMenu_focusLinkAt, _EunomiaNavMenu_openAndFocus, _EunomiaNavMenu_handleTriggerClick, _EunomiaNavMenu_handlePointerEnter, _EunomiaNavMenu_handlePointerLeave, _EunomiaNavMenu_focusTargets, _EunomiaNavMenu_handleKeydown, _EunomiaNavMenu_handleTriggerKey, _EunomiaNavMenu_handleLinkKey, _EunomiaNavMenu_closeFromEscape, _EunomiaNavMenu_handleFocusOut, _EunomiaNavMenu_handleDocumentKeydown, _EunomiaNavMenu_handleOutsidePointerDown, _EunomiaNavMenu_handleLinkClick, _EunomiaNavMenu_renderChevron, _EunomiaNavMenu_renderTriggerContent;
|
|
19
|
+
import { customElement, property, query, state } from "lit/decorators.js";
|
|
20
|
+
import { html, LitElement, nothing } from "lit";
|
|
21
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
22
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
23
|
+
import { ChangeEvent } from "../../../events/change.event.js";
|
|
24
|
+
import { AnchorPositionMixin, } from "../../../mixins/anchor-position.mixin.js";
|
|
25
|
+
import { navMenuStyles } from "./nav-menu.styles.js";
|
|
26
|
+
/**
|
|
27
|
+
* Tag name of the nav-menu component.
|
|
28
|
+
*/
|
|
29
|
+
export const EunomiaNavMenuTagName = "eun-nav-menu";
|
|
30
|
+
/**
|
|
31
|
+
* The slots named by the host's children, every other child being a link.
|
|
32
|
+
*/
|
|
33
|
+
const NAMED_SLOTS = ["label", "icon", "chevron"];
|
|
34
|
+
/**
|
|
35
|
+
* A site navigation entry that reveals a group of links, such as the pages
|
|
36
|
+
* of a section, in a panel under its trigger. It follows the disclosure
|
|
37
|
+
* navigation pattern : the trigger is a button that shows and hides the
|
|
38
|
+
* panel, and every entry of the panel is a real link, so crawlers follow
|
|
39
|
+
* it, a middle click opens it in a new tab, and a framework's own link
|
|
40
|
+
* component keeps its client-side navigation.
|
|
41
|
+
*
|
|
42
|
+
* Each direct child is one link, wrapped by the menu in its own list item
|
|
43
|
+
* without any attribute being written on it : an eun-link, a native anchor,
|
|
44
|
+
* or a framework's own link component. The trigger shows the current state
|
|
45
|
+
* on its own as soon as one of the links is the current page, and
|
|
46
|
+
* announces it to assistive technology.
|
|
47
|
+
*
|
|
48
|
+
* @slot [default] - The links, one per direct child : an eun-link, which fills its row on its own, a native anchor, or a framework's own link component
|
|
49
|
+
* @slot [label] - The trigger's label as light DOM content, so it's part of the server-rendered HTML. Falls back to label when empty
|
|
50
|
+
* @slot [icon] - Replaces the trigger's leading icon entirely with any content, not just an icon element. Falls back to icon when empty
|
|
51
|
+
* @slot [chevron] - Replaces the trigger's trailing chevron entirely with any content, not just an icon element. Falls back to chevronIcon when empty. Whatever ends up there still rotates while open, unless that rotation is set to zero
|
|
52
|
+
* @prop {string} label - The trigger's text. Ignored once something is slotted into label
|
|
53
|
+
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} [icon] - An optional decorative icon shown before the label. Ignored once the icon slot has content
|
|
54
|
+
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} [chevronIcon='keyboard_arrow_down'] - The trailing chevron icon. Ignored once the chevron slot has content
|
|
55
|
+
* @prop {boolean} [hideChevron=false] - Hides the trailing chevron, leaving the label alone in the trigger
|
|
56
|
+
* @prop {'hover' | 'click'} [trigger='hover'] - What opens the panel. With hover, it opens when the pointer rests on the trigger and a click keeps it open. With click, only a click opens and closes it. Touch screens and the keyboard always use the click behavior
|
|
57
|
+
* @prop {'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end'} [placement='bottom-start'] - Where the panel opens relative to the trigger. It flips to the other side on its own when there isn't enough room
|
|
58
|
+
* @prop {boolean} [open=false] - Whether the panel is currently open
|
|
59
|
+
* @prop {boolean} [current=false] - Shows the trigger as the current section. Already set on its own when one of the links is the current page, so only needed when the current page isn't one of them
|
|
60
|
+
* @prop {'light' | 'dark'} [theme='light'] - The color theme of the trigger and the panel. Use dark on a dark background, such as a dark toolbar
|
|
61
|
+
* @prop {number} [showDelay=100] - Milliseconds the pointer rests on the trigger before the panel opens, with trigger set to hover
|
|
62
|
+
* @attr {number} [show-delay=100] - Milliseconds the pointer rests on the trigger before the panel opens
|
|
63
|
+
* @prop {number} [hideDelay=200] - Milliseconds before the panel closes once the pointer leaves it, long enough to move from the trigger into the panel, with trigger set to hover
|
|
64
|
+
* @attr {number} [hide-delay=200] - Milliseconds before the panel closes once the pointer leaves it
|
|
65
|
+
* @attr {string} aria-label - The accessible label of the trigger, required when it has no visible label, such as an icon only trigger
|
|
66
|
+
* @fires {ChangeEvent} eunchange - Fired whenever the panel opens or closes from an interaction. Read the new state from open
|
|
67
|
+
* @csspart trigger - The trigger button, for effects its custom properties don't cover, such as an active indicator
|
|
68
|
+
* @csspart panel - The floating panel holding the links
|
|
69
|
+
* @cssprop [--nav-menu-trigger-color] - Sets the text and icon color of the trigger
|
|
70
|
+
* @cssprop [--nav-menu-trigger-color-hover] - Sets the text and icon color of the trigger on hover, on keyboard focus and while open
|
|
71
|
+
* @cssprop [--nav-menu-trigger-color-current] - Sets the text and icon color of the trigger when it's the current section
|
|
72
|
+
* @cssprop [--nav-menu-trigger-background] - Sets the background of the trigger, transparent by default
|
|
73
|
+
* @cssprop [--nav-menu-trigger-background-hover] - Sets the background of the trigger on hover, on keyboard focus and while open
|
|
74
|
+
* @cssprop [--nav-menu-trigger-shadow] - Sets the box shadow of the trigger, none by default
|
|
75
|
+
* @cssprop [--nav-menu-trigger-shadow-hover] - Sets the box shadow of the trigger on hover, on keyboard focus and while open, falling back to --nav-menu-trigger-shadow
|
|
76
|
+
* @cssprop [--nav-menu-trigger-font-size] - Sets the font size of the trigger, inherited from the surrounding text by default
|
|
77
|
+
* @cssprop [--nav-menu-trigger-font-weight] - Sets the font weight of the trigger
|
|
78
|
+
* @cssprop [--nav-menu-trigger-padding] - Sets the padding of the trigger
|
|
79
|
+
* @cssprop [--nav-menu-trigger-padding-block] - Sets the vertical padding of the trigger, as one length applied to both sides. Ignored when --nav-menu-trigger-padding is set
|
|
80
|
+
* @cssprop [--nav-menu-trigger-padding-inline] - Sets the horizontal padding of the trigger, as one length applied to both sides. Ignored when --nav-menu-trigger-padding is set
|
|
81
|
+
* @cssprop [--nav-menu-trigger-gap] - Sets the gap between the trigger's icon, label and chevron
|
|
82
|
+
* @cssprop [--nav-menu-trigger-border-radius] - Sets the corner radius of the trigger and its focus ring
|
|
83
|
+
* @cssprop [--nav-menu-focus-outline-color] - Sets the color of the trigger's focus ring, and of plain anchors in the panel
|
|
84
|
+
* @cssprop [--nav-menu-icon-size] - Sets the size of the leading icon and the chevron, 1.25em by default so they follow the font size
|
|
85
|
+
* @cssprop [--nav-menu-chevron-rotation] - Sets the rotation applied to the chevron while open, 180deg by default. Zero disables it
|
|
86
|
+
* @cssprop [--nav-menu-panel-background] - Sets the background of the panel
|
|
87
|
+
* @cssprop [--nav-menu-panel-border-color] - Sets the border color of the panel
|
|
88
|
+
* @cssprop [--nav-menu-panel-border-radius] - Sets the corner radius of the panel
|
|
89
|
+
* @cssprop [--nav-menu-panel-shadow] - Sets the box shadow of the panel
|
|
90
|
+
* @cssprop [--nav-menu-panel-padding] - Sets the padding of the panel
|
|
91
|
+
* @cssprop [--nav-menu-panel-gap] - Sets the gap between the links of the panel
|
|
92
|
+
* @cssprop [--nav-menu-panel-min-width] - Sets the minimum width of the panel, which is never narrower than the trigger
|
|
93
|
+
* @cssprop [--nav-menu-panel-max-height] - Sets the maximum height of the panel, beyond which it scrolls
|
|
94
|
+
* @cssprop [--nav-menu-offset] - Sets the distance between the trigger and the panel
|
|
95
|
+
* @cssprop [--nav-menu-link-color] - Sets the color of the links in the panel
|
|
96
|
+
* @cssprop [--nav-menu-link-color-hover] - Sets the color of the links in the panel on hover and focus
|
|
97
|
+
* @cssprop [--nav-menu-link-color-current] - Sets the color of the current page's link in the panel
|
|
98
|
+
* @cssprop [--nav-menu-link-background-hover] - Sets the background of the links in the panel on hover and focus
|
|
99
|
+
* @cssprop [--nav-menu-link-padding] - Sets the padding of the links in the panel
|
|
100
|
+
* @cssprop [--nav-menu-link-border-radius] - Sets the corner radius of the links in the panel
|
|
101
|
+
* @cssprop [--nav-menu-transition-duration] - Sets the duration of the panel's open and close animation, the chevron's rotation and the color transitions
|
|
102
|
+
* @element eun-nav-menu
|
|
103
|
+
*/
|
|
104
|
+
let EunomiaNavMenu = class EunomiaNavMenu extends AnchorPositionMixin(LitElement) {
|
|
105
|
+
constructor() {
|
|
106
|
+
super(...arguments);
|
|
107
|
+
_EunomiaNavMenu_instances.add(this);
|
|
108
|
+
/**
|
|
109
|
+
* The trailing chevron icon ; ignored once the `chevron` slot has
|
|
110
|
+
* content.
|
|
111
|
+
* @default keyboard_arrow_down
|
|
112
|
+
*/
|
|
113
|
+
this.chevronIcon = "keyboard_arrow_down";
|
|
114
|
+
/**
|
|
115
|
+
* Hides the trailing chevron.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
this.hideChevron = false;
|
|
119
|
+
/**
|
|
120
|
+
* What opens the panel. Touch screens and the keyboard always use the
|
|
121
|
+
* click behavior, since they have no hover.
|
|
122
|
+
* @default hover
|
|
123
|
+
*/
|
|
124
|
+
this.trigger = "hover";
|
|
125
|
+
/**
|
|
126
|
+
* Where the panel opens relative to the trigger.
|
|
127
|
+
* @default bottom-start
|
|
128
|
+
*/
|
|
129
|
+
this.placement = "bottom-start";
|
|
130
|
+
/**
|
|
131
|
+
* Indicates whether the panel is currently open.
|
|
132
|
+
* @default false
|
|
133
|
+
*/
|
|
134
|
+
this.open = false;
|
|
135
|
+
/**
|
|
136
|
+
* Shows the trigger as the current section, on top of the state the
|
|
137
|
+
* menu derives from its own links.
|
|
138
|
+
* @default false
|
|
139
|
+
*/
|
|
140
|
+
this.current = false;
|
|
141
|
+
/**
|
|
142
|
+
* The color theme of the trigger and the panel.
|
|
143
|
+
* @default light
|
|
144
|
+
*/
|
|
145
|
+
this.theme = "light";
|
|
146
|
+
/**
|
|
147
|
+
* Milliseconds the pointer rests on the trigger before the panel opens.
|
|
148
|
+
* @default 100
|
|
149
|
+
*/
|
|
150
|
+
this.showDelay = 100;
|
|
151
|
+
/**
|
|
152
|
+
* Milliseconds before the panel closes once the pointer leaves it.
|
|
153
|
+
* @default 200
|
|
154
|
+
*/
|
|
155
|
+
this.hideDelay = 200;
|
|
156
|
+
/**
|
|
157
|
+
* The links, the host's element children without a `slot` attribute.
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
160
|
+
this.links = [];
|
|
161
|
+
/**
|
|
162
|
+
* Whether one of the links is the current page.
|
|
163
|
+
* @internal
|
|
164
|
+
*/
|
|
165
|
+
this.hasCurrentLink = false;
|
|
166
|
+
/**
|
|
167
|
+
* The children assigned to each named slot.
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
this.named = {
|
|
171
|
+
label: [],
|
|
172
|
+
icon: [],
|
|
173
|
+
chevron: [],
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Whether a click or the keyboard opened the panel, so the pointer
|
|
177
|
+
* leaving it doesn't close it.
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
_EunomiaNavMenu_locked.set(this, false);
|
|
181
|
+
/**
|
|
182
|
+
* Pending hover timers.
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
185
|
+
_EunomiaNavMenu_showTimer.set(this, void 0);
|
|
186
|
+
_EunomiaNavMenu_hideTimer.set(this, void 0);
|
|
187
|
+
/**
|
|
188
|
+
* Keeps {@link links}, {@link named} and {@link hasCurrentLink} in sync
|
|
189
|
+
* with the host's children. Created on connection rather than as a
|
|
190
|
+
* field, so the class stays constructible where `MutationObserver`
|
|
191
|
+
* doesn't exist, such as during SSR.
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
_EunomiaNavMenu_childObserver.set(this, void 0);
|
|
195
|
+
/**
|
|
196
|
+
* Handles a click on the trigger. With trigger set to hover, a pointer
|
|
197
|
+
* click on a panel the hover already opened keeps it open rather than
|
|
198
|
+
* closing it under the pointer ; a second click closes it. A keyboard
|
|
199
|
+
* activation always toggles.
|
|
200
|
+
* @param event the trigger's click event.
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
_EunomiaNavMenu_handleTriggerClick.set(this, (event) => {
|
|
204
|
+
const fromPointer = event.detail > 0;
|
|
205
|
+
if (this.trigger === "hover" && fromPointer && this.open && !__classPrivateFieldGet(this, _EunomiaNavMenu_locked, "f")) {
|
|
206
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_clearTimers).call(this);
|
|
207
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_locked, true, "f");
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_locked, !this.open, "f");
|
|
211
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, !this.open);
|
|
212
|
+
});
|
|
213
|
+
/**
|
|
214
|
+
* Opens the panel after {@link showDelay} when a mouse or a pen rests on
|
|
215
|
+
* the trigger, and cancels a pending close when it comes back over the
|
|
216
|
+
* trigger or the panel.
|
|
217
|
+
* @param event the host's pointerenter event.
|
|
218
|
+
* @private
|
|
219
|
+
*/
|
|
220
|
+
_EunomiaNavMenu_handlePointerEnter.set(this, (event) => {
|
|
221
|
+
if (this.trigger !== "hover" || event.pointerType === "touch") {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
clearTimeout(__classPrivateFieldGet(this, _EunomiaNavMenu_hideTimer, "f"));
|
|
225
|
+
if (this.open) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_showTimer, setTimeout(() => {
|
|
229
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_locked, false, "f");
|
|
230
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, true);
|
|
231
|
+
}, this.showDelay), "f");
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* Closes the panel after {@link hideDelay} once the pointer leaves both
|
|
235
|
+
* the trigger and the panel, unless a click or the keyboard opened it.
|
|
236
|
+
* @param event the host's pointerleave event.
|
|
237
|
+
* @private
|
|
238
|
+
*/
|
|
239
|
+
_EunomiaNavMenu_handlePointerLeave.set(this, (event) => {
|
|
240
|
+
if (this.trigger !== "hover" || event.pointerType === "touch") {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
clearTimeout(__classPrivateFieldGet(this, _EunomiaNavMenu_showTimer, "f"));
|
|
244
|
+
if (!this.open || __classPrivateFieldGet(this, _EunomiaNavMenu_locked, "f")) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_hideTimer, setTimeout(() => __classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, false), this.hideDelay), "f");
|
|
248
|
+
});
|
|
249
|
+
/**
|
|
250
|
+
* Keyboard support of the disclosure navigation pattern : `Escape`
|
|
251
|
+
* closes the panel and returns focus to the trigger, `ArrowDown` and
|
|
252
|
+
* `ArrowUp` open it from the trigger and move between its links, `Home`
|
|
253
|
+
* and `End` jump to the first and last link. `Tab` keeps its native
|
|
254
|
+
* order, through the links and out of the menu.
|
|
255
|
+
* @param event the host's keydown event.
|
|
256
|
+
* @private
|
|
257
|
+
*/
|
|
258
|
+
_EunomiaNavMenu_handleKeydown.set(this, (event) => {
|
|
259
|
+
const path = event.composedPath();
|
|
260
|
+
if (this.triggerEl && path.includes(this.triggerEl)) {
|
|
261
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_handleTriggerKey).call(this, event);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const index = __classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_focusTargets).call(this).findIndex((target) => path.includes(target));
|
|
265
|
+
if (index !== -1) {
|
|
266
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_handleLinkKey).call(this, event, index);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
/**
|
|
270
|
+
* Closes the panel once focus moves to an element outside the menu, such
|
|
271
|
+
* as tabbing past its last link. A focus lost to nothing, such as a
|
|
272
|
+
* click on the page, is left to {@link handleOutsidePointerDown}.
|
|
273
|
+
* @param event the host's focusout event.
|
|
274
|
+
* @private
|
|
275
|
+
*/
|
|
276
|
+
_EunomiaNavMenu_handleFocusOut.set(this, (event) => {
|
|
277
|
+
if (this.open &&
|
|
278
|
+
event.relatedTarget instanceof Node &&
|
|
279
|
+
!this.contains(event.relatedTarget)) {
|
|
280
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, false);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
/**
|
|
284
|
+
* Closes the panel on `Escape` while focus is outside the menu, such as a
|
|
285
|
+
* panel opened by hover, so it can be dismissed without moving the
|
|
286
|
+
* pointer. A key pressed inside the menu is handled by
|
|
287
|
+
* {@link handleKeydown}, which stops it before it gets here.
|
|
288
|
+
* @param event the document's keydown event.
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
291
|
+
_EunomiaNavMenu_handleDocumentKeydown.set(this, (event) => {
|
|
292
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
293
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, false);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
/**
|
|
297
|
+
* Closes the panel on a press anywhere outside the menu.
|
|
298
|
+
* @param event the document's pointerdown event.
|
|
299
|
+
* @private
|
|
300
|
+
*/
|
|
301
|
+
_EunomiaNavMenu_handleOutsidePointerDown.set(this, (event) => {
|
|
302
|
+
if (!event.composedPath().includes(this)) {
|
|
303
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, false);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
/**
|
|
307
|
+
* Closes the panel once one of its links is followed in the same tab, so
|
|
308
|
+
* it doesn't stay open over the next page of a single-page app.
|
|
309
|
+
* @param event the host's click event.
|
|
310
|
+
* @private
|
|
311
|
+
*/
|
|
312
|
+
_EunomiaNavMenu_handleLinkClick.set(this, (event) => {
|
|
313
|
+
if (!this.open ||
|
|
314
|
+
event.button !== 0 ||
|
|
315
|
+
event.metaKey ||
|
|
316
|
+
event.ctrlKey ||
|
|
317
|
+
event.shiftKey ||
|
|
318
|
+
event.altKey) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const path = event.composedPath();
|
|
322
|
+
if (this.links.some((link) => path.includes(link))) {
|
|
323
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, false);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
connectedCallback() {
|
|
328
|
+
super.connectedCallback();
|
|
329
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_syncChildren).call(this);
|
|
330
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_childObserver, __classPrivateFieldGet(this, _EunomiaNavMenu_childObserver, "f") ?? new MutationObserver(() => __classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_syncChildren).call(this)), "f");
|
|
331
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_childObserver, "f").observe(this, {
|
|
332
|
+
childList: true,
|
|
333
|
+
subtree: true,
|
|
334
|
+
attributes: true,
|
|
335
|
+
attributeFilter: ["slot", "current", "aria-current"],
|
|
336
|
+
});
|
|
337
|
+
this.addEventListener("pointerenter", __classPrivateFieldGet(this, _EunomiaNavMenu_handlePointerEnter, "f"));
|
|
338
|
+
this.addEventListener("pointerleave", __classPrivateFieldGet(this, _EunomiaNavMenu_handlePointerLeave, "f"));
|
|
339
|
+
this.addEventListener("keydown", __classPrivateFieldGet(this, _EunomiaNavMenu_handleKeydown, "f"));
|
|
340
|
+
this.addEventListener("focusout", __classPrivateFieldGet(this, _EunomiaNavMenu_handleFocusOut, "f"));
|
|
341
|
+
this.addEventListener("click", __classPrivateFieldGet(this, _EunomiaNavMenu_handleLinkClick, "f"));
|
|
342
|
+
}
|
|
343
|
+
disconnectedCallback() {
|
|
344
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_childObserver, "f")?.disconnect();
|
|
345
|
+
this.removeEventListener("pointerenter", __classPrivateFieldGet(this, _EunomiaNavMenu_handlePointerEnter, "f"));
|
|
346
|
+
this.removeEventListener("pointerleave", __classPrivateFieldGet(this, _EunomiaNavMenu_handlePointerLeave, "f"));
|
|
347
|
+
this.removeEventListener("keydown", __classPrivateFieldGet(this, _EunomiaNavMenu_handleKeydown, "f"));
|
|
348
|
+
this.removeEventListener("focusout", __classPrivateFieldGet(this, _EunomiaNavMenu_handleFocusOut, "f"));
|
|
349
|
+
this.removeEventListener("click", __classPrivateFieldGet(this, _EunomiaNavMenu_handleLinkClick, "f"));
|
|
350
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_clearTimers).call(this);
|
|
351
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_toggleOpenListeners).call(this, false);
|
|
352
|
+
super.disconnectedCallback();
|
|
353
|
+
}
|
|
354
|
+
updated(changed) {
|
|
355
|
+
super.updated(changed);
|
|
356
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_assignSlots).call(this);
|
|
357
|
+
if (changed.has("open")) {
|
|
358
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_applyOpen).call(this, changed.get("open") === true);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
render() {
|
|
362
|
+
const current = this.current || this.hasCurrentLink;
|
|
363
|
+
/* eslint-disable lit-a11y/no-redundant-role */
|
|
364
|
+
return html `
|
|
365
|
+
<button
|
|
366
|
+
type="button"
|
|
367
|
+
id="trigger"
|
|
368
|
+
part="trigger"
|
|
369
|
+
class=${classMap({ current })}
|
|
370
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
371
|
+
aria-controls="panel"
|
|
372
|
+
aria-current=${ifDefined(current ? "true" : undefined)}
|
|
373
|
+
aria-label=${ifDefined(this.ariaLabel ?? undefined)}
|
|
374
|
+
@click=${__classPrivateFieldGet(this, _EunomiaNavMenu_handleTriggerClick, "f")}
|
|
375
|
+
>
|
|
376
|
+
${__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_renderTriggerContent).call(this)}
|
|
377
|
+
</button>
|
|
378
|
+
<ul
|
|
379
|
+
id="panel"
|
|
380
|
+
part="panel"
|
|
381
|
+
role="list"
|
|
382
|
+
popover="manual"
|
|
383
|
+
data-light-dismiss
|
|
384
|
+
aria-labelledby="trigger"
|
|
385
|
+
>
|
|
386
|
+
${this.links.map(() => html `<li><slot></slot></li>`)}
|
|
387
|
+
</ul>
|
|
388
|
+
`;
|
|
389
|
+
/* eslint-enable lit-a11y/no-redundant-role */
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
_EunomiaNavMenu_locked = new WeakMap();
|
|
393
|
+
_EunomiaNavMenu_showTimer = new WeakMap();
|
|
394
|
+
_EunomiaNavMenu_hideTimer = new WeakMap();
|
|
395
|
+
_EunomiaNavMenu_childObserver = new WeakMap();
|
|
396
|
+
_EunomiaNavMenu_handleTriggerClick = new WeakMap();
|
|
397
|
+
_EunomiaNavMenu_handlePointerEnter = new WeakMap();
|
|
398
|
+
_EunomiaNavMenu_handlePointerLeave = new WeakMap();
|
|
399
|
+
_EunomiaNavMenu_handleKeydown = new WeakMap();
|
|
400
|
+
_EunomiaNavMenu_handleFocusOut = new WeakMap();
|
|
401
|
+
_EunomiaNavMenu_handleDocumentKeydown = new WeakMap();
|
|
402
|
+
_EunomiaNavMenu_handleOutsidePointerDown = new WeakMap();
|
|
403
|
+
_EunomiaNavMenu_handleLinkClick = new WeakMap();
|
|
404
|
+
_EunomiaNavMenu_instances = new WeakSet();
|
|
405
|
+
_EunomiaNavMenu_syncChildren = function _EunomiaNavMenu_syncChildren() {
|
|
406
|
+
const children = Array.from(this.children);
|
|
407
|
+
const named = { label: [], icon: [], chevron: [] };
|
|
408
|
+
const links = [];
|
|
409
|
+
for (const child of children) {
|
|
410
|
+
const slot = child.getAttribute("slot");
|
|
411
|
+
if (slot === null) {
|
|
412
|
+
links.push(child);
|
|
413
|
+
}
|
|
414
|
+
else if (NAMED_SLOTS.includes(slot)) {
|
|
415
|
+
named[slot].push(child);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (links.length !== this.links.length ||
|
|
419
|
+
links.some((link, index) => link !== this.links[index])) {
|
|
420
|
+
this.links = links;
|
|
421
|
+
}
|
|
422
|
+
if (NAMED_SLOTS.some((name) => named[name].length !== this.named[name].length ||
|
|
423
|
+
named[name].some((el, index) => el !== this.named[name][index]))) {
|
|
424
|
+
this.named = named;
|
|
425
|
+
}
|
|
426
|
+
this.hasCurrentLink = links.some((link) => link.matches('[current], [aria-current="page"]') ||
|
|
427
|
+
link.querySelector('[aria-current="page"]') !== null);
|
|
428
|
+
};
|
|
429
|
+
_EunomiaNavMenu_assignSlots = function _EunomiaNavMenu_assignSlots() {
|
|
430
|
+
const root = this.renderRoot;
|
|
431
|
+
root
|
|
432
|
+
.querySelectorAll("#panel > li > slot")
|
|
433
|
+
.forEach((slot, index) => {
|
|
434
|
+
const link = this.links[index];
|
|
435
|
+
if (link && slot.assignedElements()[0] !== link) {
|
|
436
|
+
slot.assign(link);
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
for (const name of NAMED_SLOTS) {
|
|
440
|
+
const slot = root.querySelector(`slot[name="${name}"]`);
|
|
441
|
+
const elements = this.named[name];
|
|
442
|
+
if (slot &&
|
|
443
|
+
(slot.assignedElements().length !== elements.length ||
|
|
444
|
+
elements.some((el, index) => slot.assignedElements()[index] !== el))) {
|
|
445
|
+
slot.assign(...elements);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
_EunomiaNavMenu_applyOpen = function _EunomiaNavMenu_applyOpen(wasOpen) {
|
|
450
|
+
const panel = this.panelEl;
|
|
451
|
+
if (!panel) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (this.open) {
|
|
455
|
+
if (!panel.matches(":popover-open")) {
|
|
456
|
+
panel.showPopover();
|
|
457
|
+
}
|
|
458
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_anchorPanel).call(this);
|
|
459
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_toggleOpenListeners).call(this, true);
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_locked, false, "f");
|
|
463
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_toggleOpenListeners).call(this, false);
|
|
464
|
+
this.unanchorFloatingElement();
|
|
465
|
+
const focusInside = this.links.some((link) => link.contains(document.activeElement));
|
|
466
|
+
if (panel.matches(":popover-open")) {
|
|
467
|
+
panel.hidePopover();
|
|
468
|
+
}
|
|
469
|
+
if (wasOpen && focusInside) {
|
|
470
|
+
this.triggerEl?.focus();
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
_EunomiaNavMenu_setOpen = function _EunomiaNavMenu_setOpen(open) {
|
|
474
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_clearTimers).call(this);
|
|
475
|
+
if (this.open === open) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
this.open = open;
|
|
479
|
+
this.dispatchEvent(new ChangeEvent());
|
|
480
|
+
};
|
|
481
|
+
_EunomiaNavMenu_clearTimers = function _EunomiaNavMenu_clearTimers() {
|
|
482
|
+
clearTimeout(__classPrivateFieldGet(this, _EunomiaNavMenu_showTimer, "f"));
|
|
483
|
+
clearTimeout(__classPrivateFieldGet(this, _EunomiaNavMenu_hideTimer, "f"));
|
|
484
|
+
};
|
|
485
|
+
_EunomiaNavMenu_toggleOpenListeners = function _EunomiaNavMenu_toggleOpenListeners(on) {
|
|
486
|
+
if (on) {
|
|
487
|
+
document.addEventListener("pointerdown", __classPrivateFieldGet(this, _EunomiaNavMenu_handleOutsidePointerDown, "f"), true);
|
|
488
|
+
document.addEventListener("keydown", __classPrivateFieldGet(this, _EunomiaNavMenu_handleDocumentKeydown, "f"));
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
document.removeEventListener("pointerdown", __classPrivateFieldGet(this, _EunomiaNavMenu_handleOutsidePointerDown, "f"), true);
|
|
492
|
+
document.removeEventListener("keydown", __classPrivateFieldGet(this, _EunomiaNavMenu_handleDocumentKeydown, "f"));
|
|
493
|
+
};
|
|
494
|
+
_EunomiaNavMenu_anchorPanel = function _EunomiaNavMenu_anchorPanel() {
|
|
495
|
+
const trigger = this.triggerEl;
|
|
496
|
+
const panel = this.panelEl;
|
|
497
|
+
if (!trigger || !panel) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
const [side, align = "center"] = this.placement.split("-");
|
|
501
|
+
const gap = Number.parseFloat(getComputedStyle(panel).scrollMarginTop) || 0;
|
|
502
|
+
const options = { gap, side, align };
|
|
503
|
+
this.anchorFloatingElement(trigger, panel, options);
|
|
504
|
+
const native = panel.style.getPropertyValue("position-anchor") !== "";
|
|
505
|
+
panel.toggleAttribute("data-native-anchor", native);
|
|
506
|
+
if (native) {
|
|
507
|
+
this.anchorFloatingElement(trigger, panel, options);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
_EunomiaNavMenu_focusTarget = function _EunomiaNavMenu_focusTarget(link) {
|
|
511
|
+
if (link.matches("a[href]")) {
|
|
512
|
+
return link;
|
|
513
|
+
}
|
|
514
|
+
return (link.querySelector("a[href]") ??
|
|
515
|
+
link.shadowRoot?.querySelector("a[href]") ??
|
|
516
|
+
null);
|
|
517
|
+
};
|
|
518
|
+
_EunomiaNavMenu_focusLinkAt = function _EunomiaNavMenu_focusLinkAt(index) {
|
|
519
|
+
const targets = __classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_focusTargets).call(this);
|
|
520
|
+
if (!targets.length) {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
targets[(index + targets.length) % targets.length].focus();
|
|
524
|
+
};
|
|
525
|
+
_EunomiaNavMenu_openAndFocus =
|
|
526
|
+
/**
|
|
527
|
+
* Opens the panel for the keyboard, then focuses one of its links.
|
|
528
|
+
* @param index the link to focus.
|
|
529
|
+
* @private
|
|
530
|
+
*/
|
|
531
|
+
async function _EunomiaNavMenu_openAndFocus(index) {
|
|
532
|
+
__classPrivateFieldSet(this, _EunomiaNavMenu_locked, true, "f");
|
|
533
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, true);
|
|
534
|
+
await this.updateComplete;
|
|
535
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_focusLinkAt).call(this, index);
|
|
536
|
+
};
|
|
537
|
+
_EunomiaNavMenu_focusTargets = function _EunomiaNavMenu_focusTargets() {
|
|
538
|
+
return this.links
|
|
539
|
+
.map((link) => __classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_focusTarget).call(this, link))
|
|
540
|
+
.filter((target) => target !== null);
|
|
541
|
+
};
|
|
542
|
+
_EunomiaNavMenu_handleTriggerKey = function _EunomiaNavMenu_handleTriggerKey(event) {
|
|
543
|
+
switch (event.key) {
|
|
544
|
+
case "Escape":
|
|
545
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_closeFromEscape).call(this, event);
|
|
546
|
+
return;
|
|
547
|
+
case "ArrowDown":
|
|
548
|
+
case "ArrowUp":
|
|
549
|
+
event.preventDefault();
|
|
550
|
+
void __classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_openAndFocus).call(this, event.key === "ArrowDown" ? 0 : -1);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
_EunomiaNavMenu_handleLinkKey = function _EunomiaNavMenu_handleLinkKey(event, index) {
|
|
555
|
+
const moves = {
|
|
556
|
+
ArrowDown: index + 1,
|
|
557
|
+
ArrowUp: index - 1,
|
|
558
|
+
Home: 0,
|
|
559
|
+
End: -1,
|
|
560
|
+
};
|
|
561
|
+
if (event.key === "Escape") {
|
|
562
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_closeFromEscape).call(this, event);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (event.key in moves) {
|
|
566
|
+
event.preventDefault();
|
|
567
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_focusLinkAt).call(this, moves[event.key]);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
_EunomiaNavMenu_closeFromEscape = function _EunomiaNavMenu_closeFromEscape(event) {
|
|
571
|
+
if (!this.open) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
event.preventDefault();
|
|
575
|
+
event.stopPropagation();
|
|
576
|
+
__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_setOpen).call(this, false);
|
|
577
|
+
this.triggerEl?.focus();
|
|
578
|
+
};
|
|
579
|
+
_EunomiaNavMenu_renderChevron = function _EunomiaNavMenu_renderChevron() {
|
|
580
|
+
if (this.hideChevron) {
|
|
581
|
+
return nothing;
|
|
582
|
+
}
|
|
583
|
+
const fallback = this.named.chevron.length
|
|
584
|
+
? nothing
|
|
585
|
+
: html `<eun-icon class="icon" name=${this.chevronIcon}></eun-icon>`;
|
|
586
|
+
return html `<span id="chevron" aria-hidden="true">
|
|
587
|
+
<slot name="chevron">${fallback}</slot>
|
|
588
|
+
</span>`;
|
|
589
|
+
};
|
|
590
|
+
_EunomiaNavMenu_renderTriggerContent = function _EunomiaNavMenu_renderTriggerContent() {
|
|
591
|
+
const hasIcon = this.named.icon.length > 0 || Boolean(this.icon);
|
|
592
|
+
return html `
|
|
593
|
+
<slot name="icon" class=${classMap({ hidden: !hasIcon })}>
|
|
594
|
+
${this.icon
|
|
595
|
+
? html `<eun-icon class="icon" name=${this.icon}></eun-icon>`
|
|
596
|
+
: nothing}
|
|
597
|
+
</slot>
|
|
598
|
+
<span id="label"><slot name="label">${this.label}</slot></span>
|
|
599
|
+
${__classPrivateFieldGet(this, _EunomiaNavMenu_instances, "m", _EunomiaNavMenu_renderChevron).call(this)}
|
|
600
|
+
`;
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Styles to import to the component.
|
|
604
|
+
*
|
|
605
|
+
* @static
|
|
606
|
+
* @internal
|
|
607
|
+
* @readonly
|
|
608
|
+
*/
|
|
609
|
+
EunomiaNavMenu.styles = [navMenuStyles];
|
|
610
|
+
/**
|
|
611
|
+
* Manual slot assignment : each link is assigned to the slot of its own
|
|
612
|
+
* list item without the menu writing a `slot` attribute on the
|
|
613
|
+
* consumer's elements, which a framework would then reset or report as
|
|
614
|
+
* a hydration mismatch. The named slots are assigned by hand too, from
|
|
615
|
+
* the `slot` attribute the consumer wrote.
|
|
616
|
+
* @internal
|
|
617
|
+
*/
|
|
618
|
+
EunomiaNavMenu.shadowRootOptions = {
|
|
619
|
+
...LitElement.shadowRootOptions,
|
|
620
|
+
slotAssignment: "manual",
|
|
621
|
+
};
|
|
622
|
+
__decorate([
|
|
623
|
+
property()
|
|
624
|
+
], EunomiaNavMenu.prototype, "label", void 0);
|
|
625
|
+
__decorate([
|
|
626
|
+
property()
|
|
627
|
+
], EunomiaNavMenu.prototype, "icon", void 0);
|
|
628
|
+
__decorate([
|
|
629
|
+
property({ attribute: "chevron-icon" })
|
|
630
|
+
], EunomiaNavMenu.prototype, "chevronIcon", void 0);
|
|
631
|
+
__decorate([
|
|
632
|
+
property({ type: Boolean, reflect: true, attribute: "hide-chevron" })
|
|
633
|
+
], EunomiaNavMenu.prototype, "hideChevron", void 0);
|
|
634
|
+
__decorate([
|
|
635
|
+
property({ reflect: true })
|
|
636
|
+
], EunomiaNavMenu.prototype, "trigger", void 0);
|
|
637
|
+
__decorate([
|
|
638
|
+
property({ reflect: true })
|
|
639
|
+
], EunomiaNavMenu.prototype, "placement", void 0);
|
|
640
|
+
__decorate([
|
|
641
|
+
property({ type: Boolean, reflect: true })
|
|
642
|
+
], EunomiaNavMenu.prototype, "open", void 0);
|
|
643
|
+
__decorate([
|
|
644
|
+
property({ type: Boolean, reflect: true })
|
|
645
|
+
], EunomiaNavMenu.prototype, "current", void 0);
|
|
646
|
+
__decorate([
|
|
647
|
+
property({ reflect: true })
|
|
648
|
+
], EunomiaNavMenu.prototype, "theme", void 0);
|
|
649
|
+
__decorate([
|
|
650
|
+
property({ type: Number, attribute: "show-delay" })
|
|
651
|
+
], EunomiaNavMenu.prototype, "showDelay", void 0);
|
|
652
|
+
__decorate([
|
|
653
|
+
property({ type: Number, attribute: "hide-delay" })
|
|
654
|
+
], EunomiaNavMenu.prototype, "hideDelay", void 0);
|
|
655
|
+
__decorate([
|
|
656
|
+
state()
|
|
657
|
+
], EunomiaNavMenu.prototype, "links", void 0);
|
|
658
|
+
__decorate([
|
|
659
|
+
state()
|
|
660
|
+
], EunomiaNavMenu.prototype, "hasCurrentLink", void 0);
|
|
661
|
+
__decorate([
|
|
662
|
+
state()
|
|
663
|
+
], EunomiaNavMenu.prototype, "named", void 0);
|
|
664
|
+
__decorate([
|
|
665
|
+
query("#trigger")
|
|
666
|
+
], EunomiaNavMenu.prototype, "triggerEl", void 0);
|
|
667
|
+
__decorate([
|
|
668
|
+
query("#panel")
|
|
669
|
+
], EunomiaNavMenu.prototype, "panelEl", void 0);
|
|
670
|
+
EunomiaNavMenu = __decorate([
|
|
671
|
+
customElement(EunomiaNavMenuTagName)
|
|
672
|
+
], EunomiaNavMenu);
|
|
673
|
+
export { EunomiaNavMenu };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const navMenuStyles: import("lit").CSSResult;
|