@frontile/overlays 0.17.0-beta.4 → 0.17.0-beta.6
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/declarations/components/overlay.d.ts +5 -0
- package/declarations/components/overlay.d.ts.map +1 -1
- package/declarations/components/popover.d.ts +12 -3
- package/declarations/components/popover.d.ts.map +1 -1
- package/dist/components/backdrop.js +8 -8
- package/dist/components/backdrop.js.map +1 -1
- package/dist/components/drawer/body.js +10 -9
- package/dist/components/drawer/body.js.map +1 -1
- package/dist/components/drawer/footer.js +10 -9
- package/dist/components/drawer/footer.js.map +1 -1
- package/dist/components/drawer/header.js +10 -9
- package/dist/components/drawer/header.js.map +1 -1
- package/dist/components/drawer.js +15 -19
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/modal/body.js +10 -9
- package/dist/components/modal/body.js.map +1 -1
- package/dist/components/modal/footer.js +10 -9
- package/dist/components/modal/footer.js.map +1 -1
- package/dist/components/modal/header.js +10 -9
- package/dist/components/modal/header.js.map +1 -1
- package/dist/components/modal.js +15 -19
- package/dist/components/modal.js.map +1 -1
- package/dist/components/overlay.js +16 -197
- package/dist/components/overlay.js.map +1 -1
- package/dist/components/popover.js +157 -128
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.js +1 -2
- package/dist/components/portal.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/overlay-DoxxotyF.js +270 -0
- package/dist/overlay-DoxxotyF.js.map +1 -0
- package/dist/{portal-Es7o21X5.js → portal-CGKQ_924.js} +18 -22
- package/dist/{portal-Es7o21X5.js.map → portal-CGKQ_924.js.map} +1 -1
- package/package.json +41 -44
- package/declarations/portal-Es7o21X5.d.ts +0 -5
- package/declarations/portal-Es7o21X5.d.ts.map +0 -1
- package/dist/portal-D1N7TxUb.js +0 -167
- package/dist/portal-D1N7TxUb.js.map +0 -1
|
@@ -1,198 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '@
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
import { macroCondition, isTesting } from '@embroider/macros';
|
|
18
|
-
import { precompileTemplate } from '@ember/template-compilation';
|
|
19
|
-
import { setComponentTemplate } from '@ember/component';
|
|
20
|
-
|
|
21
|
-
var _class, _descriptor, _Overlay;
|
|
22
|
-
function hasNestedPortals(element) {
|
|
23
|
-
const portal = findParentPortal(element);
|
|
24
|
-
if (!portal) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
const childPortal = getElementByAttribute(portal, 'data-portal');
|
|
28
|
-
if (childPortal) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
// finds if the el has a parent with the id `ember-basic-dropdown-wormhole` or a role of `alert`
|
|
34
|
-
function hasWormholeOrAlertParentElement(el) {
|
|
35
|
-
let parent = el.parentElement;
|
|
36
|
-
while (parent) {
|
|
37
|
-
if (parent.id === 'ember-basic-dropdown-wormhole' || parent.role === 'alert') {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
parent = parent.parentElement;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
let Overlay = (_class = (_Overlay = class Overlay extends Component {
|
|
45
|
-
constructor(...args) {
|
|
46
|
-
super(...args);
|
|
47
|
-
_initializerDefineProperty(this, "keepOpen", _descriptor, this);
|
|
48
|
-
_defineProperty(this, "contentElement", void 0);
|
|
49
|
-
_defineProperty(this, "focusedElement", void 0);
|
|
50
|
-
_defineProperty(this, "mouseDownContentElement", null);
|
|
51
|
-
_defineProperty(this, "setupContent", modifier(el => {
|
|
52
|
-
let transitionDuration = this.args.transitionDuration || 200;
|
|
53
|
-
if (!this.isAnimationEnabled) {
|
|
54
|
-
transitionDuration = 0;
|
|
55
|
-
}
|
|
56
|
-
later(() => {
|
|
57
|
-
if (this.isDestroyed) return;
|
|
58
|
-
if (this.args.disableFocusTrap !== true) return;
|
|
59
|
-
el.focus();
|
|
60
|
-
}, transitionDuration);
|
|
61
|
-
this.contentElement = el;
|
|
62
|
-
this.keepOpen = true;
|
|
63
|
-
this.focusedElement = document.activeElement;
|
|
64
|
-
if (this.args.renderInPlace !== true && this.args.blockScroll !== false) {
|
|
65
|
-
document.body.style.overflow = 'hidden';
|
|
66
|
-
}
|
|
67
|
-
if (typeof this.args.onOpen === 'function') {
|
|
68
|
-
this.args.onOpen();
|
|
69
|
-
}
|
|
70
|
-
return () => {
|
|
71
|
-
this.contentElement = undefined;
|
|
72
|
-
if (this.args.renderInPlace !== true && this.args.blockScroll !== false) {
|
|
73
|
-
document.body.style.overflow = '';
|
|
74
|
-
}
|
|
75
|
-
const {
|
|
76
|
-
didClose
|
|
77
|
-
} = this.args;
|
|
78
|
-
later(() => {
|
|
79
|
-
if (!this.isDestroyed) this.keepOpen = false;
|
|
80
|
-
if (typeof didClose === 'function' && !this.isDestroyed) {
|
|
81
|
-
didClose();
|
|
82
|
-
}
|
|
83
|
-
// restore focus
|
|
84
|
-
if (!this.args.preventFocusRestore && this.focusedElement && this.focusedElement.tabIndex > -1 && typeof this.focusedElement.focus !== 'undefined') {
|
|
85
|
-
this.focusedElement.focus();
|
|
86
|
-
}
|
|
87
|
-
}, transitionDuration);
|
|
88
|
-
};
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
handleClose() {
|
|
92
|
-
if (this.args.isOpen && typeof this.args.onClose === 'function') {
|
|
93
|
-
this.args.onClose();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
handleContentClick(event) {
|
|
97
|
-
if (this.args.closeOnOutsideClick !== false && this.args.closeOnOverlayElementClick === true && event.target === this.contentElement && this.mouseDownContentElement == this.contentElement && !hasNestedPortals(this.contentElement) && !hasWormholeOrAlertParentElement(event.target)) {
|
|
98
|
-
this.handleClose();
|
|
99
|
-
}
|
|
100
|
-
this.mouseDownContentElement = null;
|
|
101
|
-
}
|
|
102
|
-
handleOutsideClick(e) {
|
|
103
|
-
if (this.args.closeOnOutsideClick !== false && this.contentElement && !hasNestedPortals(this.contentElement) && !hasWormholeOrAlertParentElement(e.target)) {
|
|
104
|
-
this.handleClose();
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
handleContentMouseDown(event) {
|
|
109
|
-
if (this.args.closeOnOverlayElementClick === true) {
|
|
110
|
-
this.mouseDownContentElement = event.target;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
handleKeyDown(event) {
|
|
114
|
-
if (event.key === 'Escape' && this.args.closeOnEscapeKey !== false) {
|
|
115
|
-
this.handleClose();
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
event.stopImmediatePropagation();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
get isVisible() {
|
|
121
|
-
return this.args.isOpen || this.keepOpen;
|
|
122
|
-
}
|
|
123
|
-
get backdrop() {
|
|
124
|
-
if (!this.args.isOpen) {
|
|
125
|
-
return 'none';
|
|
126
|
-
}
|
|
127
|
-
return this.args.backdrop || 'faded';
|
|
128
|
-
}
|
|
129
|
-
get isAnimationEnabled() {
|
|
130
|
-
if (macroCondition(isTesting())) {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
return !(this.args.disableTransitions === true);
|
|
134
|
-
}
|
|
135
|
-
get focusTrapOptions() {
|
|
136
|
-
return this.args.focusTrapOptions || {
|
|
137
|
-
clickOutsideDeactivates: true,
|
|
138
|
-
allowOutsideClick: true
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
get classes() {
|
|
142
|
-
const {
|
|
143
|
-
overlay
|
|
144
|
-
} = useStyles();
|
|
145
|
-
return overlay({
|
|
146
|
-
class: this.args.class,
|
|
147
|
-
inPlace: this.args.renderInPlace,
|
|
148
|
-
enableFlexContent: !(this.args.disableFlexContent === true)
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
get customContentModifier() {
|
|
152
|
-
if (this.args.customContentModifier) {
|
|
153
|
-
return this.args.customContentModifier;
|
|
154
|
-
}
|
|
155
|
-
return modifier(() => {});
|
|
156
|
-
}
|
|
157
|
-
get backdropTransition() {
|
|
158
|
-
if (this.args.backdropTransition) {
|
|
159
|
-
return this.args.backdropTransition;
|
|
160
|
-
}
|
|
161
|
-
return {
|
|
162
|
-
isEnabled: this.isAnimationEnabled
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
get transition() {
|
|
166
|
-
let options = {
|
|
167
|
-
name: 'overlay-transition--fade',
|
|
168
|
-
isEnabled: this.isAnimationEnabled
|
|
169
|
-
};
|
|
170
|
-
if (typeof this.args.transition === 'object') {
|
|
171
|
-
return {
|
|
172
|
-
...options,
|
|
173
|
-
...this.args.transition
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
return options;
|
|
177
|
-
}
|
|
178
|
-
}, setComponentTemplate(precompileTemplate("\n {{!-- template-lint-disable no-invalid-interactive --}}\n {{!-- template-lint-disable no-pointer-down-event-binding --}}\n\n {{#if this.isVisible}}\n <Portal @renderInPlace={{@renderInPlace}} @target={{@target}}>\n <Backdrop @type={{this.backdrop}} @inPlace={{@renderInPlace}} @transition={{this.backdropTransition}} />\n\n {{#if @isOpen}}\n <div {{this.setupContent}} {{on \"click\" this.handleContentClick}} {{on \"keydown\" this.handleKeyDown}} {{on \"mousedown\" this.handleContentMouseDown}} {{cssTransition didTransitionIn=this.transition.didTransitionIn didTransitionOut=this.transition.didTransitionOut enterClass=this.transition.enterClass enterActiveClass=this.transition.enterActiveClass enterToClass=this.transition.enterToClass isEnabled=this.transition.isEnabled leaveClass=this.transition.leaveClass leaveActiveClass=this.transition.leaveActiveClass leaveToClass=this.transition.leaveToClass name=this.transition.name parentSelector=this.transition.parentSelector}} {{onClickOutside this.handleOutsideClick capture=true}} {{focusTrap isActive=(if @disableFocusTrap false @isOpen) focusTrapOptions=this.focusTrapOptions}} class={{this.classes}} {{!-- Keep this custom modifer by last--}} {{this.customContentModifier}} data-component=\"overlay\" tabindex=\"0\" ...attributes>\n {{yield}}\n </div>\n {{/if}}\n </Portal>\n {{/if}}\n ", {
|
|
179
|
-
strictMode: true,
|
|
180
|
-
scope: () => ({
|
|
181
|
-
Portal,
|
|
182
|
-
Backdrop,
|
|
183
|
-
on,
|
|
184
|
-
cssTransition,
|
|
185
|
-
onClickOutside,
|
|
186
|
-
focusTrap
|
|
187
|
-
})
|
|
188
|
-
}), _Overlay), _Overlay), _descriptor = _applyDecoratedDescriptor(_class.prototype, "keepOpen", [tracked], {
|
|
189
|
-
configurable: true,
|
|
190
|
-
enumerable: true,
|
|
191
|
-
writable: true,
|
|
192
|
-
initializer: function () {
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
}), _applyDecoratedDescriptor(_class.prototype, "handleContentClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleContentClick"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleOutsideClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleOutsideClick"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleContentMouseDown", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleContentMouseDown"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleKeyDown", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleKeyDown"), _class.prototype), _class);
|
|
196
|
-
|
|
197
|
-
export { Overlay, Overlay as default };
|
|
1
|
+
import '@glimmer/component';
|
|
2
|
+
import '@glimmer/tracking';
|
|
3
|
+
import '@ember/object';
|
|
4
|
+
import '@ember/runloop';
|
|
5
|
+
import '@ember/modifier';
|
|
6
|
+
import 'ember-css-transitions';
|
|
7
|
+
import '@frontile/theme';
|
|
8
|
+
import 'ember-modifier';
|
|
9
|
+
import 'ember-focus-trap';
|
|
10
|
+
import 'ember-click-outside/modifiers/on-click-outside';
|
|
11
|
+
import './backdrop.js';
|
|
12
|
+
import '../portal-CGKQ_924.js';
|
|
13
|
+
import '@embroider/macros';
|
|
14
|
+
import '@ember/template-compilation';
|
|
15
|
+
import '@ember/component';
|
|
16
|
+
export { O as Overlay, O as default } from '../overlay-DoxxotyF.js';
|
|
198
17
|
//# sourceMappingURL=overlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.js","sources":["../../src/components/overlay.gts"],"sourcesContent":["/* eslint-disable ember/no-runloop */\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { cssTransition } from 'ember-css-transitions';\nimport { useStyles } from '@frontile/theme';\nimport { modifier } from 'ember-modifier';\n// @ts-ignore\nimport { focusTrap } from 'ember-focus-trap';\nimport onClickOutside from 'ember-click-outside/modifiers/on-click-outside';\nimport { Backdrop, type BackdropSignature } from './backdrop';\nimport { Portal, findParentPortal, type PortalSignature } from './portal';\nimport { getElementByAttribute } from '../-private/dom';\nimport type { ModifierLike } from '@glint/template';\nimport type { CssTransitionSignature } from 'ember-css-transitions/modifiers/css-transition';\nimport { isTesting, macroCondition } from '@embroider/macros';\n\nfunction hasNestedPortals(element: HTMLElement): boolean {\n const portal = findParentPortal(element);\n if (!portal) {\n return false;\n }\n const childPortal = getElementByAttribute(portal, 'data-portal');\n if (childPortal) {\n return true;\n }\n\n return false;\n}\n\n// finds if the el has a parent with the id `ember-basic-dropdown-wormhole` or a role of `alert`\nfunction hasWormholeOrAlertParentElement(el: HTMLElement) {\n let parent = el.parentElement;\n while (parent) {\n if (\n parent.id === 'ember-basic-dropdown-wormhole' ||\n parent.role === 'alert'\n ) {\n return true;\n }\n parent = parent.parentElement;\n }\n return false;\n}\n\ninterface Args\n extends Pick<PortalSignature['Args'], 'renderInPlace' | 'target'> {\n /**\n * Duration of the animation\n *\n * @defaultValue 200\n */\n transitionDuration?: number;\n\n backdrop?: BackdropSignature['Args']['type'];\n\n backdropTransition?: BackdropSignature['Args']['transition'];\n\n /**\n * Disable css transitions\n *\n * @defaultValue false\n */\n disableTransitions?: boolean;\n\n /**\n * Whether the focus trap is disabled or not\n *\n * @defaultValue false\n */\n disableFocusTrap?: boolean;\n\n /**\n * Focus trap options\n *\n * @defaultValue { clickOutsideDeactivates: true, allowOutsideClick: true }\n */\n focusTrapOptions?: unknown;\n\n /**\n * Whether it is open or not\n */\n isOpen: boolean;\n\n /**\n * A function that will be called when closed\n */\n onClose?: () => void;\n\n /**\n * A function that will be called when closing is finished executing, this\n * includes waiting for animations/transitions to finish.\n */\n didClose?: () => void;\n\n /**\n * A function that will be called when opened\n */\n onOpen?: () => void;\n\n /**\n * Whether to close when the area outside (the backdrop) is clicked\n *\n * @defaultValue true\n */\n closeOnOutsideClick?: boolean;\n\n /**\n * Whether to close when the overlay element is clicked, used for modal and drawer components.\n *\n * @defaultValue false\n */\n closeOnOverlayElementClick?: boolean;\n\n /**\n * Whether to close when the escape key is pressed\n *\n * @defaultValue true\n */\n closeOnEscapeKey?: boolean;\n\n /**\n * Transition options\n *\n * @defaultValue {name:'overlay-transition--fade'}\n */\n transition?: CssTransitionSignature['Args']['Named'];\n\n disableFlexContent?: boolean;\n customContentModifier?: ModifierLike<{ Element: HTMLElement }>;\n class?: string;\n /**\n * @defaultValue false\n */\n preventFocusRestore?: boolean;\n\n /**\n * @defaultValue true\n */\n blockScroll?: boolean;\n}\n\ninterface OverlaySignature {\n Args: Args;\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\nclass Overlay extends Component<OverlaySignature> {\n @tracked keepOpen = false;\n\n contentElement: HTMLElement | undefined;\n focusedElement: Element | null | undefined;\n mouseDownContentElement: EventTarget | null = null;\n\n handleClose(): void {\n if (this.args.isOpen && typeof this.args.onClose === 'function') {\n this.args.onClose();\n }\n }\n\n @action handleContentClick(event: MouseEvent): void {\n if (\n this.args.closeOnOutsideClick !== false &&\n this.args.closeOnOverlayElementClick === true &&\n event.target === this.contentElement &&\n this.mouseDownContentElement == this.contentElement &&\n !hasNestedPortals(this.contentElement) &&\n !hasWormholeOrAlertParentElement(event.target as HTMLElement)\n ) {\n this.handleClose();\n }\n this.mouseDownContentElement = null;\n }\n\n @action handleOutsideClick(e: Event): void {\n if (\n this.args.closeOnOutsideClick !== false &&\n this.contentElement &&\n !hasNestedPortals(this.contentElement) &&\n !hasWormholeOrAlertParentElement(e.target as HTMLElement)\n ) {\n this.handleClose();\n e.preventDefault();\n }\n }\n\n @action\n handleContentMouseDown(event: MouseEvent): void {\n if (this.args.closeOnOverlayElementClick === true) {\n this.mouseDownContentElement = event.target;\n }\n }\n\n @action\n handleKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Escape' && this.args.closeOnEscapeKey !== false) {\n this.handleClose();\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n setupContent = modifier((el: HTMLDivElement) => {\n let transitionDuration = this.args.transitionDuration || 200;\n if (!this.isAnimationEnabled) {\n transitionDuration = 0;\n }\n later(() => {\n if (this.isDestroyed) return;\n if (this.args.disableFocusTrap !== true) return;\n el.focus();\n }, transitionDuration);\n\n this.contentElement = el;\n this.keepOpen = true;\n this.focusedElement = document.activeElement;\n\n if (this.args.renderInPlace !== true && this.args.blockScroll !== false) {\n document.body.style.overflow = 'hidden';\n }\n\n if (typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n return () => {\n this.contentElement = undefined;\n\n if (this.args.renderInPlace !== true && this.args.blockScroll !== false) {\n document.body.style.overflow = '';\n }\n\n const { didClose } = this.args;\n later(() => {\n if (!this.isDestroyed) this.keepOpen = false;\n if (typeof didClose === 'function' && !this.isDestroyed) {\n didClose();\n }\n\n // restore focus\n if (\n !this.args.preventFocusRestore &&\n this.focusedElement &&\n (this.focusedElement as HTMLElement).tabIndex > -1 &&\n typeof (this.focusedElement as HTMLElement).focus !== 'undefined'\n ) {\n (this.focusedElement as HTMLElement).focus();\n }\n }, transitionDuration);\n };\n });\n\n get isVisible(): boolean {\n return this.args.isOpen || this.keepOpen;\n }\n\n get backdrop(): BackdropSignature['Args']['type'] {\n if (!this.args.isOpen) {\n return 'none';\n }\n return this.args.backdrop || 'faded';\n }\n\n get isAnimationEnabled(): boolean {\n if (macroCondition(isTesting())) {\n return false;\n }\n return !(this.args.disableTransitions === true);\n }\n\n get focusTrapOptions(): unknown {\n return (\n this.args.focusTrapOptions || {\n clickOutsideDeactivates: true,\n allowOutsideClick: true\n }\n );\n }\n\n get classes() {\n const { overlay } = useStyles();\n\n return overlay({\n class: this.args.class,\n inPlace: this.args.renderInPlace,\n enableFlexContent: !(this.args.disableFlexContent === true)\n });\n }\n\n get customContentModifier() {\n if (this.args.customContentModifier) {\n return this.args.customContentModifier;\n }\n\n return modifier(() => {});\n }\n\n get backdropTransition() {\n if (this.args.backdropTransition) {\n return this.args.backdropTransition;\n }\n\n return { isEnabled: this.isAnimationEnabled };\n }\n\n get transition() {\n let options: BackdropSignature['Args']['transition'] = {\n name: 'overlay-transition--fade',\n isEnabled: this.isAnimationEnabled\n };\n\n if (typeof this.args.transition === 'object') {\n return { ...options, ...this.args.transition };\n }\n\n return options;\n }\n\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-pointer-down-event-binding }}\n\n {{#if this.isVisible}}\n <Portal @renderInPlace={{@renderInPlace}} @target={{@target}}>\n <Backdrop\n @type={{this.backdrop}}\n @inPlace={{@renderInPlace}}\n @transition={{this.backdropTransition}}\n />\n\n {{#if @isOpen}}\n <div\n {{this.setupContent}}\n {{on \"click\" this.handleContentClick}}\n {{on \"keydown\" this.handleKeyDown}}\n {{on \"mousedown\" this.handleContentMouseDown}}\n {{cssTransition\n didTransitionIn=this.transition.didTransitionIn\n didTransitionOut=this.transition.didTransitionOut\n enterClass=this.transition.enterClass\n enterActiveClass=this.transition.enterActiveClass\n enterToClass=this.transition.enterToClass\n isEnabled=this.transition.isEnabled\n leaveClass=this.transition.leaveClass\n leaveActiveClass=this.transition.leaveActiveClass\n leaveToClass=this.transition.leaveToClass\n name=this.transition.name\n parentSelector=this.transition.parentSelector\n }}\n {{onClickOutside this.handleOutsideClick capture=true}}\n {{focusTrap\n isActive=(if @disableFocusTrap false @isOpen)\n focusTrapOptions=this.focusTrapOptions\n }}\n class={{this.classes}}\n {{! Keep this custom modifer by last}}\n {{this.customContentModifier}}\n data-component=\"overlay\"\n tabindex=\"0\"\n ...attributes\n >\n {{yield}}\n </div>\n {{/if}}\n </Portal>\n {{/if}}\n </template>\n}\n\nexport { Overlay, type OverlaySignature };\nexport default Overlay;\n"],"names":["hasNestedPortals","element","portal","findParentPortal","childPortal","getElementByAttribute","hasWormholeOrAlertParentElement","el","parent","parentElement","id","role","Overlay","Component","constructor","args","_initializerDefineProperty","_descriptor","_defineProperty","modifier","transitionDuration","isAnimationEnabled","later","isDestroyed","disableFocusTrap","focus","contentElement","keepOpen","focusedElement","document","activeElement","renderInPlace","blockScroll","body","style","overflow","onOpen","undefined","didClose","preventFocusRestore","tabIndex","handleClose","isOpen","onClose","handleContentClick","event","closeOnOutsideClick","closeOnOverlayElementClick","target","mouseDownContentElement","handleOutsideClick","e","preventDefault","handleContentMouseDown","handleKeyDown","key","closeOnEscapeKey","stopImmediatePropagation","isVisible","backdrop","macroCondition","isTesting","disableTransitions","focusTrapOptions","clickOutsideDeactivates","allowOutsideClick","classes","overlay","useStyles","class","inPlace","enableFlexContent","disableFlexContent","customContentModifier","backdropTransition","isEnabled","transition","options","name","setComponentTemplate","precompileTemplate","strictMode","scope","Portal","Backdrop","on","cssTransition","onClickOutside","focusTrap","_Overlay","_applyDecoratedDescriptor","_class","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,SAASA,gBAAiBA,CAAAC,OAAoB,EAAU;AACtD,EAAA,MAAMC,SAASC,gBAAi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AAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAmB,KAAM;AAAA;AAAA,CAAA,CAAA,EAAAP,yBAAA,CAAAC,MAAA,CAAAC,SAAA,yBAYzBM,MAAA,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAT,MAAA,CAAAC,SAAA,EAAA,oBAAA,CAAA,EAAAD,MAAA,CAAAC,SAAA,CAAAF,EAAAA,yBAAA,CAAAC,MAAA,CAAAC,SAAA,EAAA,oBAAA,EAAA,CAcAM,MAAA,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAT,MAAA,CAAAC,SAAA,EAAAD,oBAAAA,CAAAA,EAAAA,MAAA,CAAAC,SAAA,CAAA,EAAAF,yBAAA,CAAAC,MAAA,CAAAC,SAAA,EAYAM,wBAAAA,EAAAA,CAAAA,MAAA,GAAAC,MAAA,CAAAC,wBAAA,CAAAT,MAAA,CAAAC,SAAA,6BAAAD,MAAA,CAAAC,SAAA,CAAAF,EAAAA,yBAAA,CAAAC,MAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAOAM,MAAA,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAT,MAAA,CAAAC,SAAA,EAAA,eAAA,CAAA,EAAAD,MAAA,CAAAC,SAAA,GAAAD,MAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"overlay.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
|
|
4
|
-
import '@babel/runtime/helpers/esm/initializerWarningHelper';
|
|
5
1
|
import Component from '@glimmer/component';
|
|
6
|
-
import { Overlay } from '
|
|
2
|
+
import { d as decorateFieldV2, i as initializeDeferredDecorator, O as Overlay } from '../overlay-DoxxotyF.js';
|
|
7
3
|
import { tracked } from '@glimmer/tracking';
|
|
8
4
|
import { Velcro } from 'ember-velcro';
|
|
9
5
|
import { assert } from '@ember/debug';
|
|
@@ -15,138 +11,157 @@ import { debounce } from '@ember/runloop';
|
|
|
15
11
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
16
12
|
import { setComponentTemplate } from '@ember/component';
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
class Popover extends Component {
|
|
15
|
+
triggerEl;
|
|
16
|
+
menuId = guidFor(this);
|
|
17
|
+
static {
|
|
18
|
+
decorateFieldV2(this.prototype, "_isOpen", [tracked], function () {
|
|
19
|
+
return false;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
#_isOpen = (initializeDeferredDecorator(this, "_isOpen"), void 0);
|
|
23
|
+
static {
|
|
24
|
+
decorateFieldV2(this.prototype, "isClosing", [tracked], function () {
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
#isClosing = (initializeDeferredDecorator(this, "isClosing"), void 0);
|
|
29
|
+
static {
|
|
30
|
+
decorateFieldV2(this.prototype, "preventFocusRestore", [tracked], function () {
|
|
31
|
+
return false;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
#preventFocusRestore = (initializeDeferredDecorator(this, "preventFocusRestore"), void 0);
|
|
35
|
+
static {
|
|
36
|
+
decorateFieldV2(this.prototype, "triggerWidth", [tracked]);
|
|
37
|
+
}
|
|
38
|
+
#triggerWidth = (initializeDeferredDecorator(this, "triggerWidth"), void 0);
|
|
39
|
+
get isOpen() {
|
|
40
|
+
if (typeof this.args.isOpen !== 'undefined' && typeof this.args.onOpenChange === 'function') {
|
|
41
|
+
return this.args.isOpen;
|
|
42
|
+
}
|
|
43
|
+
return this._isOpen;
|
|
44
|
+
}
|
|
45
|
+
toggle = event => {
|
|
46
|
+
// stops event bubbling to prevent parent click event
|
|
47
|
+
if (typeof event?.stopPropagation === 'function') {
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
}
|
|
50
|
+
if (this.isOpen) {
|
|
51
|
+
this.close();
|
|
52
|
+
} else {
|
|
53
|
+
this.open();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
open = () => {
|
|
57
|
+
if (this.isClosing) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (typeof this.args.onOpenChange === 'function') {
|
|
61
|
+
this.args.onOpenChange(true);
|
|
62
|
+
} else {
|
|
63
|
+
this._isOpen = true;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
close = () => {
|
|
67
|
+
this.isClosing = true;
|
|
68
|
+
if (typeof this.args.onOpenChange === 'function') {
|
|
69
|
+
this.args.onOpenChange(false);
|
|
70
|
+
} else {
|
|
71
|
+
this._isOpen = false;
|
|
72
|
+
}
|
|
73
|
+
if (typeof this.args.didClose === 'function') {
|
|
74
|
+
this.args.didClose();
|
|
75
|
+
}
|
|
76
|
+
debounce(this, this.didClose, 90);
|
|
77
|
+
};
|
|
78
|
+
trigger = modifier((el, [eventType]) => {
|
|
79
|
+
this.triggerEl = el;
|
|
80
|
+
this.triggerWidth = Math.round(el.offsetWidth);
|
|
81
|
+
let observer;
|
|
82
|
+
if (eventType !== 'hover') {
|
|
83
|
+
observer = new ResizeObserver(entries => {
|
|
84
|
+
for (let entry of entries) {
|
|
85
|
+
this.triggerWidth = Math.round(entry.target.offsetWidth);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
observer.observe(el);
|
|
89
|
+
}
|
|
90
|
+
const debounceDuration = 100;
|
|
91
|
+
const open = () => {
|
|
92
|
+
debounce(this, this.open, debounceDuration);
|
|
93
|
+
};
|
|
94
|
+
const close = () => {
|
|
95
|
+
debounce(this, this.close, debounceDuration);
|
|
96
|
+
};
|
|
97
|
+
const onKeydown = event => {
|
|
98
|
+
if (this.isOpen && event.key === 'Escape') {
|
|
99
|
+
this.close();
|
|
30
100
|
event.stopPropagation();
|
|
31
101
|
}
|
|
32
|
-
if (this.isOpen) {
|
|
33
|
-
this.close();
|
|
34
|
-
} else {
|
|
102
|
+
if (!this.isOpen && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
|
|
35
103
|
this.open();
|
|
104
|
+
event.stopPropagation();
|
|
36
105
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (typeof this.args.onOpenChange === 'function') {
|
|
43
|
-
this.args.onOpenChange(true);
|
|
44
|
-
} else {
|
|
45
|
-
this._isOpen = true;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
_defineProperty(this, "close", () => {
|
|
49
|
-
this.isClosing = true;
|
|
50
|
-
if (typeof this.args.onOpenChange === 'function') {
|
|
51
|
-
this.args.onOpenChange(false);
|
|
52
|
-
} else {
|
|
53
|
-
this._isOpen = false;
|
|
106
|
+
if (this.isOpen && event.key === 'Tab') {
|
|
107
|
+
this.preventFocusRestore = true;
|
|
108
|
+
this.close();
|
|
54
109
|
}
|
|
55
|
-
|
|
56
|
-
|
|
110
|
+
// Open when a letter is pressed
|
|
111
|
+
if (!this.isOpen && event.code === `Key${event.key.toUpperCase()}`) {
|
|
112
|
+
this.open();
|
|
57
113
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
114
|
+
};
|
|
115
|
+
if (eventType === 'hover') {
|
|
116
|
+
this.preventFocusRestore = true;
|
|
117
|
+
el.addEventListener('mouseenter', open);
|
|
118
|
+
el.addEventListener('mouseleave', close);
|
|
119
|
+
} else {
|
|
120
|
+
el.addEventListener('keydown', onKeydown);
|
|
121
|
+
el.addEventListener('click', this.toggle);
|
|
122
|
+
}
|
|
123
|
+
el.setAttribute('aria-haspopup', 'true');
|
|
124
|
+
el.setAttribute('aria-controls', this.menuId);
|
|
125
|
+
el.setAttribute('aria-expanded', this.isOpen.toString());
|
|
126
|
+
return () => {
|
|
69
127
|
if (eventType === 'hover') {
|
|
70
|
-
|
|
71
|
-
el.
|
|
72
|
-
el.addEventListener('mouseleave', close);
|
|
128
|
+
el.removeEventListener('mouseenter', open);
|
|
129
|
+
el.removeEventListener('mouseleave', close);
|
|
73
130
|
} else {
|
|
74
|
-
el.
|
|
131
|
+
el.removeEventListener('click', this.toggle);
|
|
132
|
+
el.removeEventListener('keydown', onKeydown);
|
|
75
133
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
el.setAttribute('aria-expanded', this.isOpen.toString());
|
|
79
|
-
return () => {
|
|
80
|
-
if (eventType === 'hover') {
|
|
81
|
-
el.removeEventListener('mouseenter', open);
|
|
82
|
-
el.removeEventListener('mouseleave', close);
|
|
83
|
-
} else {
|
|
84
|
-
el.removeEventListener('click', this.toggle);
|
|
85
|
-
}
|
|
86
|
-
this.triggerEl = undefined;
|
|
87
|
-
};
|
|
88
|
-
}));
|
|
89
|
-
_defineProperty(this, "updateAriaExtanded", modifier(_ => {
|
|
90
|
-
if (this.triggerEl) {
|
|
91
|
-
this.triggerEl.setAttribute('aria-expanded', this.isOpen.toString());
|
|
92
|
-
}
|
|
93
|
-
}));
|
|
94
|
-
_defineProperty(this, "didClose", () => {
|
|
95
|
-
if (!this.isDestroyed || !this.isDestroying) {
|
|
96
|
-
this.isClosing = false;
|
|
134
|
+
if (observer) {
|
|
135
|
+
observer.disconnect();
|
|
97
136
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
137
|
+
this.triggerEl = undefined;
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
updateAriaExtanded = modifier(_ => {
|
|
141
|
+
if (this.triggerEl) {
|
|
142
|
+
this.triggerEl.setAttribute('aria-expanded', this.isOpen.toString());
|
|
103
143
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Content
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "isClosing", [tracked], {
|
|
121
|
-
configurable: true,
|
|
122
|
-
enumerable: true,
|
|
123
|
-
writable: true,
|
|
124
|
-
initializer: function () {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "preventFocusRestore", [tracked], {
|
|
128
|
-
configurable: true,
|
|
129
|
-
enumerable: true,
|
|
130
|
-
writable: true,
|
|
131
|
-
initializer: function () {
|
|
132
|
-
return false;
|
|
144
|
+
});
|
|
145
|
+
didClose = () => {
|
|
146
|
+
if (!this.isDestroyed || !this.isDestroying) {
|
|
147
|
+
this.isClosing = false;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
static {
|
|
151
|
+
setComponentTemplate(precompileTemplate("\n <Velcro @placement={{if @placement @placement \"bottom-start\"}} @strategy={{if @strategy @strategy \"absolute\"}} @offsetOptions={{if @offsetOptions @offsetOptions 5}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} as |velcro|>\n {{yield (hash anchor=velcro.hook isOpen=this.isOpen open=this.open close=this.close toggle=this.toggle trigger=this.trigger Content=(component Content id=this.menuId loop=velcro.loop isOpen=this.isOpen toggle=this.toggle internalDidClose=this.didClose preventFocusRestore=this.preventFocusRestore triggerWidth=this.triggerWidth))}}\n </Velcro>\n ", {
|
|
152
|
+
strictMode: true,
|
|
153
|
+
scope: () => ({
|
|
154
|
+
Velcro,
|
|
155
|
+
hash,
|
|
156
|
+
Content
|
|
157
|
+
})
|
|
158
|
+
}), this);
|
|
133
159
|
}
|
|
134
|
-
}
|
|
160
|
+
}
|
|
135
161
|
/**
|
|
136
162
|
* Component yielded from Popover
|
|
137
163
|
*/
|
|
138
164
|
class Content extends Component {
|
|
139
|
-
constructor(...args) {
|
|
140
|
-
super(...args);
|
|
141
|
-
_defineProperty(this, "didClose", () => {
|
|
142
|
-
if (typeof this.args.internalDidClose === 'function') {
|
|
143
|
-
this.args.internalDidClose();
|
|
144
|
-
}
|
|
145
|
-
if (typeof this.args.didClose === 'function') {
|
|
146
|
-
this.args.didClose();
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
165
|
get loop() {
|
|
151
166
|
assert('The Popover is not properly configured; the @loop is undefined. This issue may arise from failing to set up the anchor.', this.args.loop);
|
|
152
167
|
return this.args.loop;
|
|
@@ -187,14 +202,28 @@ class Content extends Component {
|
|
|
187
202
|
}
|
|
188
203
|
return true;
|
|
189
204
|
}
|
|
205
|
+
didClose = () => {
|
|
206
|
+
if (typeof this.args.internalDidClose === 'function') {
|
|
207
|
+
this.args.internalDidClose();
|
|
208
|
+
}
|
|
209
|
+
if (typeof this.args.didClose === 'function') {
|
|
210
|
+
this.args.didClose();
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
updateTriggerWidth = modifier(el => {
|
|
214
|
+
if (el && this.args.triggerWidth) {
|
|
215
|
+
el.style.setProperty('--trigger-width', `${this.args.triggerWidth}px`);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
static {
|
|
219
|
+
setComponentTemplate(precompileTemplate("\n <Overlay @blockScroll={{this.blockScroll}} @transition={{this.transition}} @backdrop={{this.backdrop}} @customContentModifier={{this.loop}} @disableFlexContent={{true}} @isOpen={{@isOpen}} @onClose={{@toggle}} @onOpen={{@onOpen}} @didClose={{this.didClose}} @renderInPlace={{@renderInPlace}} @target={{@target}} @transitionDuration={{@transitionDuration}} @disableTransitions={{@disableTransitions}} @disableFocusTrap={{this.disableFocusTrap}} @focusTrapOptions={{@focusTrapOptions}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @backdropTransition={{@backdropTransition}} @class={{this.classNames}} @preventFocusRestore={{@preventFocusRestore}} @preventAutoFocus={{@preventAutoFocus}} id={{@id}} ...attributes {{this.updateTriggerWidth @triggerWidth}}>\n {{yield}}\n </Overlay>\n ", {
|
|
220
|
+
strictMode: true,
|
|
221
|
+
scope: () => ({
|
|
222
|
+
Overlay
|
|
223
|
+
})
|
|
224
|
+
}), this);
|
|
225
|
+
}
|
|
190
226
|
}
|
|
191
|
-
_Content = Content;
|
|
192
|
-
setComponentTemplate(precompileTemplate("\n <Overlay @blockScroll={{this.blockScroll}} @transition={{this.transition}} @backdrop={{this.backdrop}} @customContentModifier={{this.loop}} @disableFlexContent={{true}} @isOpen={{@isOpen}} @onClose={{@toggle}} @onOpen={{@onOpen}} @didClose={{this.didClose}} @renderInPlace={{@renderInPlace}} @target={{@target}} @transitionDuration={{@transitionDuration}} @disableTransitions={{@disableTransitions}} @disableFocusTrap={{this.disableFocusTrap}} @focusTrapOptions={{@focusTrapOptions}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @backdropTransition={{@backdropTransition}} @class={{this.classNames}} @preventFocusRestore={{@preventFocusRestore}} id={{@id}} ...attributes>\n {{yield}}\n </Overlay>\n ", {
|
|
193
|
-
strictMode: true,
|
|
194
|
-
scope: () => ({
|
|
195
|
-
Overlay
|
|
196
|
-
})
|
|
197
|
-
}), _Content);
|
|
198
227
|
|
|
199
228
|
export { Popover, Popover as default };
|
|
200
229
|
//# sourceMappingURL=popover.js.map
|