@shoper/phoenix_design_system 0.11.3-2 → 0.11.3-3
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/build/cjs/packages/phoenix/src/components/backdrop/backdrop.js +88 -0
- package/build/cjs/packages/phoenix/src/components/{modal/modal_backdrop.js.map → backdrop/backdrop.js.map} +1 -1
- package/build/cjs/packages/phoenix/src/components/backdrop/backdrop_constants.js +17 -0
- package/build/cjs/packages/phoenix/src/components/backdrop/backdrop_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +134 -27
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_constants.js +15 -7
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +7 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -0
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/modal/modal.js +11 -10
- package/build/cjs/packages/phoenix/src/components/modal/modal.js.map +1 -1
- package/build/cjs/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js +4 -2
- package/build/cjs/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js.map +1 -1
- package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator.js +4 -4
- package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.js +29 -9
- package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.js.map +1 -1
- package/build/cjs/packages/phoenix/src/core/context/context_provider_controller.js +1 -1
- package/build/cjs/packages/phoenix/src/global_constants.js +15 -0
- package/build/cjs/packages/phoenix/src/global_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/index.js +10 -10
- package/build/esm/packages/phoenix/src/components/backdrop/backdrop.d.ts +16 -0
- package/build/esm/packages/phoenix/src/components/backdrop/backdrop.js +86 -0
- package/build/esm/packages/phoenix/src/components/{modal/modal_backdrop.js.map → backdrop/backdrop.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/backdrop/backdrop_constants.d.ts +7 -0
- package/build/esm/packages/phoenix/src/components/backdrop/backdrop_constants.js +11 -0
- package/build/esm/packages/phoenix/src/components/backdrop/backdrop_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +11 -3
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +135 -28
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_constants.d.ts +6 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_constants.js +10 -6
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +8 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +2 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/modal/modal.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/modal/modal.js +11 -10
- package/build/esm/packages/phoenix/src/components/modal/modal.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js +4 -2
- package/build/esm/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller_types.d.ts +4 -0
- package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator.js +4 -4
- package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.d.ts +2 -1
- package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.js +30 -10
- package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_types.d.ts +2 -0
- package/build/esm/packages/phoenix/src/core/context/context_provider_controller.js +1 -1
- package/build/esm/packages/phoenix/src/global_constants.d.ts +8 -0
- package/build/esm/packages/phoenix/src/global_constants.js +11 -0
- package/build/esm/packages/phoenix/src/global_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/index.d.ts +1 -1
- package/build/esm/packages/phoenix/src/index.js +2 -2
- package/package.json +1 -1
- package/build/cjs/packages/phoenix/src/components/modal/modal_backdrop.js +0 -66
- package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.d.ts +0 -12
- package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.js +0 -64
|
@@ -8,9 +8,9 @@ var relative_position_controller_constants = require('./relative_position_contro
|
|
|
8
8
|
var relative_position_calculator = require('./relative_position_calculator.js');
|
|
9
9
|
var lodash = require('../../../../../external/lodash/lodash.js');
|
|
10
10
|
|
|
11
|
-
var _RelativePositionController_host, _RelativePositionController_container, _RelativePositionController_nearestNonStaticElementFromElementToPosition, _RelativePositionController_direction, _RelativePositionController_nearestScrollableElement, _RelativePositionController_relativeElement, _RelativePositionController_elementToPosition, _RelativePositionController_throttledReposition, _RelativePositionController_throttledRepositionForScroll;
|
|
11
|
+
var _RelativePositionController_host, _RelativePositionController_container, _RelativePositionController_nearestNonStaticElementFromElementToPosition, _RelativePositionController_direction, _RelativePositionController_nearestScrollableElement, _RelativePositionController_relativeElement, _RelativePositionController_elementToPosition, _RelativePositionController_shouldDisablePositioning, _RelativePositionController_portalElementsNames, _RelativePositionController_throttledReposition, _RelativePositionController_throttledRepositionForScroll;
|
|
12
12
|
class RelativePositionController {
|
|
13
|
-
constructor({ host, container, direction, relativeElement, elementToPosition }) {
|
|
13
|
+
constructor({ host, container, direction, relativeElement, elementToPosition, shouldDisablePositioning, portalElementsNames = [] }) {
|
|
14
14
|
_RelativePositionController_host.set(this, void 0);
|
|
15
15
|
_RelativePositionController_container.set(this, void 0);
|
|
16
16
|
_RelativePositionController_nearestNonStaticElementFromElementToPosition.set(this, void 0);
|
|
@@ -18,30 +18,42 @@ class RelativePositionController {
|
|
|
18
18
|
_RelativePositionController_nearestScrollableElement.set(this, void 0);
|
|
19
19
|
_RelativePositionController_relativeElement.set(this, void 0);
|
|
20
20
|
_RelativePositionController_elementToPosition.set(this, void 0);
|
|
21
|
+
_RelativePositionController_shouldDisablePositioning.set(this, void 0);
|
|
22
|
+
_RelativePositionController_portalElementsNames.set(this, void 0);
|
|
21
23
|
_RelativePositionController_throttledReposition.set(this, lodash['default'].throttle(() => {
|
|
22
|
-
|
|
24
|
+
if (!tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_shouldDisablePositioning, "f")) {
|
|
25
|
+
this.position();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_shouldDisablePositioning, "f").call(this) ? this.disableRelativePositioning() : this.position();
|
|
23
29
|
}, relative_position_controller_constants.DEFAULT_THROTTLE_WAIT_TIME));
|
|
24
30
|
_RelativePositionController_throttledRepositionForScroll.set(this, lodash['default'].throttle(() => {
|
|
25
|
-
|
|
31
|
+
if (!tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_shouldDisablePositioning, "f")) {
|
|
32
|
+
this.position();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_shouldDisablePositioning, "f").call(this) ? this.disableRelativePositioning() : this.position();
|
|
26
36
|
}, relative_position_controller_constants.DEFAULT_SCROLL_THROTTLE_WAIT_TIME));
|
|
27
37
|
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_host, host, "f");
|
|
28
38
|
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_container, container, "f");
|
|
29
39
|
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_direction, direction, "f");
|
|
30
40
|
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_relativeElement, relativeElement, "f");
|
|
31
41
|
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_elementToPosition, elementToPosition, "f");
|
|
42
|
+
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_shouldDisablePositioning, shouldDisablePositioning, "f");
|
|
43
|
+
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_portalElementsNames, portalElementsNames, "f");
|
|
32
44
|
tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_host, "f").addController(this);
|
|
33
45
|
}
|
|
34
46
|
hostConnected() {
|
|
35
|
-
tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_host, "f").addEventListener('resize', tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_throttledReposition, "f"));
|
|
36
47
|
if (!tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_relativeElement, "f"))
|
|
37
48
|
return;
|
|
38
49
|
if (!tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_nearestScrollableElement, "f")) {
|
|
39
50
|
tslib_es6.__classPrivateFieldSet(this, _RelativePositionController_nearestScrollableElement, this._findNearestScrollableElement(tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_relativeElement, "f")), "f");
|
|
40
51
|
}
|
|
52
|
+
window.addEventListener('resize', tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_throttledReposition, "f"));
|
|
41
53
|
tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_nearestScrollableElement, "f").addEventListener('scroll', tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_throttledRepositionForScroll, "f"));
|
|
42
54
|
}
|
|
43
55
|
hostDisconnected() {
|
|
44
|
-
|
|
56
|
+
window.removeEventListener('resize', tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_throttledReposition, "f"));
|
|
45
57
|
if (tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_nearestScrollableElement, "f"))
|
|
46
58
|
tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_nearestScrollableElement, "f").removeEventListener('scroll', tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_throttledRepositionForScroll, "f"));
|
|
47
59
|
}
|
|
@@ -62,7 +74,8 @@ class RelativePositionController {
|
|
|
62
74
|
}
|
|
63
75
|
_findNearestScrollableElement(element) {
|
|
64
76
|
const overflowArray = ['overflow', 'overflowY', 'overflowX'];
|
|
65
|
-
|
|
77
|
+
const scrollableElement = this._findParentBasedOnStyle(element, overflowArray, (overflowArray) => overflowArray.includes(relative_position_controller_constants.OVERFLOW_SCROLL) || overflowArray.includes(relative_position_controller_constants.OVERFLOW_AUTO));
|
|
78
|
+
return scrollableElement !== document.body ? scrollableElement : window;
|
|
66
79
|
}
|
|
67
80
|
_findContainer(element) {
|
|
68
81
|
return this._findParentBasedOnStyle(element, ['position'], ([position]) => relative_position_controller_constants.NON_STATIC_POSITIONS.includes(position));
|
|
@@ -74,7 +87,7 @@ class RelativePositionController {
|
|
|
74
87
|
const parentStyles = styles.reduce((styles, currentStyle) => {
|
|
75
88
|
return [...styles, window.getComputedStyle(parent)[currentStyle]];
|
|
76
89
|
}, []);
|
|
77
|
-
if (callback(parentStyles) || parent === document.body)
|
|
90
|
+
if ((callback(parentStyles) || parent === document.body) && !tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_portalElementsNames, "f").includes(parent.localName))
|
|
78
91
|
return parent;
|
|
79
92
|
return this._findParentBasedOnStyle(parent, styles, callback);
|
|
80
93
|
}
|
|
@@ -90,8 +103,15 @@ class RelativePositionController {
|
|
|
90
103
|
elementStyle.left = '0';
|
|
91
104
|
tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_elementToPosition, "f").style.transform = `translate3d(${position.left}px, ${position.top}px, 0)`;
|
|
92
105
|
}
|
|
106
|
+
disableRelativePositioning() {
|
|
107
|
+
if (!tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_elementToPosition, "f"))
|
|
108
|
+
return;
|
|
109
|
+
const { style: elementStyle } = tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_elementToPosition, "f");
|
|
110
|
+
elementStyle.position = '';
|
|
111
|
+
elementStyle.transform = '';
|
|
112
|
+
}
|
|
93
113
|
}
|
|
94
|
-
_RelativePositionController_host = new WeakMap(), _RelativePositionController_container = new WeakMap(), _RelativePositionController_nearestNonStaticElementFromElementToPosition = new WeakMap(), _RelativePositionController_direction = new WeakMap(), _RelativePositionController_nearestScrollableElement = new WeakMap(), _RelativePositionController_relativeElement = new WeakMap(), _RelativePositionController_elementToPosition = new WeakMap(), _RelativePositionController_throttledReposition = new WeakMap(), _RelativePositionController_throttledRepositionForScroll = new WeakMap();
|
|
114
|
+
_RelativePositionController_host = new WeakMap(), _RelativePositionController_container = new WeakMap(), _RelativePositionController_nearestNonStaticElementFromElementToPosition = new WeakMap(), _RelativePositionController_direction = new WeakMap(), _RelativePositionController_nearestScrollableElement = new WeakMap(), _RelativePositionController_relativeElement = new WeakMap(), _RelativePositionController_elementToPosition = new WeakMap(), _RelativePositionController_shouldDisablePositioning = new WeakMap(), _RelativePositionController_portalElementsNames = new WeakMap(), _RelativePositionController_throttledReposition = new WeakMap(), _RelativePositionController_throttledRepositionForScroll = new WeakMap();
|
|
95
115
|
|
|
96
116
|
exports.RelativePositionController = RelativePositionController;
|
|
97
117
|
//# sourceMappingURL=relative_position_controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA,qBAAqB,0CAA8C;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA,qBAAqB,0CAA8C;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -14,7 +14,7 @@ class ContextProviderController {
|
|
|
14
14
|
_ContextProviderController_handleRequestedValue.set(this, (event) => {
|
|
15
15
|
const customEvent = event;
|
|
16
16
|
const valueKey = customEvent.detail.key;
|
|
17
|
-
if (tslib_es6.__classPrivateFieldGet(this, _ContextProviderController_contextValues, "f")[valueKey]
|
|
17
|
+
if (tslib_es6.__classPrivateFieldGet(this, _ContextProviderController_contextValues, "f")[valueKey] === undefined)
|
|
18
18
|
return;
|
|
19
19
|
customEvent.detail[valueKey] = tslib_es6.__classPrivateFieldGet(this, _ContextProviderController_contextValues, "f")[valueKey];
|
|
20
20
|
event.stopPropagation();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const BREAKPOINTS = {
|
|
6
|
+
xs: 576,
|
|
7
|
+
sm: 768,
|
|
8
|
+
md: 1000,
|
|
9
|
+
lg: 1200,
|
|
10
|
+
xl: 1440,
|
|
11
|
+
xxl: 1920
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.BREAKPOINTS = BREAKPOINTS;
|
|
15
|
+
//# sourceMappingURL=global_constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -9,7 +9,6 @@ var portal_target = require('./components/portal/portal_target.js');
|
|
|
9
9
|
var portal = require('./components/portal/portal.js');
|
|
10
10
|
var modal = require('./components/modal/modal.js');
|
|
11
11
|
var modal_opener = require('./components/modal/modal_opener.js');
|
|
12
|
-
var modal_backdrop = require('./components/modal/modal_backdrop.js');
|
|
13
12
|
var modal_body = require('./components/modal/modal_body.js');
|
|
14
13
|
var modal_footer = require('./components/modal/modal_footer.js');
|
|
15
14
|
var modal_header = require('./components/modal/modal_header.js');
|
|
@@ -50,11 +49,12 @@ var btn_controller = require('./controllers/btn_controller.js');
|
|
|
50
49
|
var accordion_toggler = require('./components/accordion/accordion_toggler.js');
|
|
51
50
|
var accordion = require('./components/accordion/accordion.js');
|
|
52
51
|
var click_outside_controller = require('./controllers/click_outside_controller/click_outside_controller.js');
|
|
52
|
+
var dropdown_content = require('./components/dropdown/dropdown_content.js');
|
|
53
53
|
var relative_position_controller = require('./controllers/relative_position_controller/relative_position_controller.js');
|
|
54
54
|
var dropdown = require('./components/dropdown/dropdown.js');
|
|
55
55
|
var toggle_element_aria_controller = require('./controllers/toggle_element_aria_controller/toggle_element_aria_controller.js');
|
|
56
56
|
var dropdown_toggler = require('./components/dropdown/dropdown_toggler.js');
|
|
57
|
-
var
|
|
57
|
+
var backdrop = require('./components/backdrop/backdrop.js');
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
@@ -85,12 +85,6 @@ Object.defineProperty(exports, 'HModalOpener', {
|
|
|
85
85
|
return modal_opener.HModalOpener;
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
Object.defineProperty(exports, 'HModalBackdrop', {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
get: function () {
|
|
91
|
-
return modal_backdrop.HModalBackdrop;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
88
|
Object.defineProperty(exports, 'HModalBody', {
|
|
95
89
|
enumerable: true,
|
|
96
90
|
get: function () {
|
|
@@ -294,6 +288,12 @@ Object.defineProperty(exports, 'HAccordion', {
|
|
|
294
288
|
}
|
|
295
289
|
});
|
|
296
290
|
exports.ClickOutsideController = click_outside_controller.ClickOutsideController;
|
|
291
|
+
Object.defineProperty(exports, 'HDropdownContent', {
|
|
292
|
+
enumerable: true,
|
|
293
|
+
get: function () {
|
|
294
|
+
return dropdown_content.HDropdownContent;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
297
|
exports.RelativePositionController = relative_position_controller.RelativePositionController;
|
|
298
298
|
Object.defineProperty(exports, 'HDropdown', {
|
|
299
299
|
enumerable: true,
|
|
@@ -308,10 +308,10 @@ Object.defineProperty(exports, 'HDropdownToggler', {
|
|
|
308
308
|
return dropdown_toggler.HDropdownToggler;
|
|
309
309
|
}
|
|
310
310
|
});
|
|
311
|
-
Object.defineProperty(exports, '
|
|
311
|
+
Object.defineProperty(exports, 'HBackdrop', {
|
|
312
312
|
enumerable: true,
|
|
313
313
|
get: function () {
|
|
314
|
-
return
|
|
314
|
+
return backdrop.HBackdrop;
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
317
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element";
|
|
3
|
+
export declare class HBackdrop extends PhoenixLightLitElement {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
private _backdropLayerCounter;
|
|
6
|
+
constructor();
|
|
7
|
+
disconnectedCallback(): void;
|
|
8
|
+
private _appendBackdrop;
|
|
9
|
+
private _show;
|
|
10
|
+
private _hide;
|
|
11
|
+
protected updated(): void;
|
|
12
|
+
private _disableScrolling;
|
|
13
|
+
private _enableScrolling;
|
|
14
|
+
private _dispatchBackdropClickedEvent;
|
|
15
|
+
protected render(): TemplateResult;
|
|
16
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { property, state } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import { BACKDROP_NAME, BACKDROP_EVENTS, BACKDROP_CSS_CLASS } from './backdrop_constants.js';
|
|
7
|
+
|
|
8
|
+
let HBackdrop = class HBackdrop extends PhoenixLightLitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.visible = false;
|
|
12
|
+
this._backdropLayerCounter = 0;
|
|
13
|
+
this._appendBackdrop = () => {
|
|
14
|
+
const $backdrop = document.querySelector(BACKDROP_NAME);
|
|
15
|
+
if (!$backdrop) {
|
|
16
|
+
const $newBackdrop = document.createElement(BACKDROP_NAME);
|
|
17
|
+
document.body.appendChild($newBackdrop);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this._show = () => {
|
|
21
|
+
this._backdropLayerCounter += 1;
|
|
22
|
+
this.visible = true;
|
|
23
|
+
};
|
|
24
|
+
this._hide = () => {
|
|
25
|
+
this._backdropLayerCounter -= 1;
|
|
26
|
+
if (this._backdropLayerCounter > 0)
|
|
27
|
+
return;
|
|
28
|
+
if (this._backdropLayerCounter < 0)
|
|
29
|
+
this._backdropLayerCounter = 0;
|
|
30
|
+
this.visible = false;
|
|
31
|
+
};
|
|
32
|
+
this._dispatchBackdropClickedEvent = () => {
|
|
33
|
+
const backdropClickedEvent = new CustomEvent(BACKDROP_EVENTS.clicked, {
|
|
34
|
+
bubbles: true
|
|
35
|
+
});
|
|
36
|
+
document.dispatchEvent(backdropClickedEvent);
|
|
37
|
+
};
|
|
38
|
+
this._appendBackdrop();
|
|
39
|
+
document.addEventListener(BACKDROP_EVENTS.show, this._show);
|
|
40
|
+
document.addEventListener(BACKDROP_EVENTS.hide, this._hide);
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
super.disconnectedCallback();
|
|
44
|
+
document.removeEventListener(BACKDROP_EVENTS.show, this._show);
|
|
45
|
+
document.removeEventListener(BACKDROP_EVENTS.hide, this._hide);
|
|
46
|
+
}
|
|
47
|
+
updated() {
|
|
48
|
+
if (this.visible) {
|
|
49
|
+
this._disableScrolling();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this._enableScrolling();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
_disableScrolling() {
|
|
56
|
+
document.body.style.overflow = 'hidden';
|
|
57
|
+
document.body.style.paddingRight = '15px';
|
|
58
|
+
}
|
|
59
|
+
_enableScrolling() {
|
|
60
|
+
document.body.style.removeProperty('overflow');
|
|
61
|
+
document.body.style.removeProperty('padding-right');
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
return html ` <div
|
|
65
|
+
aria-hidden="true"
|
|
66
|
+
?hidden="${!this.visible}"
|
|
67
|
+
@click="${this._dispatchBackdropClickedEvent}"
|
|
68
|
+
class="${BACKDROP_CSS_CLASS}"
|
|
69
|
+
></div>`;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
__decorate([
|
|
73
|
+
property({ type: Boolean }),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], HBackdrop.prototype, "visible", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
state(),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], HBackdrop.prototype, "_backdropLayerCounter", void 0);
|
|
80
|
+
HBackdrop = __decorate([
|
|
81
|
+
phoenixCustomElement('h-backdrop'),
|
|
82
|
+
__metadata("design:paramtypes", [])
|
|
83
|
+
], HBackdrop);
|
|
84
|
+
|
|
85
|
+
export { HBackdrop };
|
|
86
|
+
//# sourceMappingURL=backdrop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const BACKDROP_NAME = 'h-backdrop';
|
|
2
|
+
const BACKDROP_CSS_CLASS = 'backdrop';
|
|
3
|
+
const BACKDROP_EVENT_NAME = 'backdrop';
|
|
4
|
+
const BACKDROP_EVENTS = {
|
|
5
|
+
show: `${BACKDROP_EVENT_NAME}.show`,
|
|
6
|
+
hide: `${BACKDROP_EVENT_NAME}.hide`,
|
|
7
|
+
clicked: `${BACKDROP_EVENT_NAME}.clicked`
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { BACKDROP_CSS_CLASS, BACKDROP_EVENTS, BACKDROP_NAME };
|
|
11
|
+
//# sourceMappingURL=backdrop_constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TemplateResult } from 'lit';
|
|
2
|
+
import { HDropdownContent } from './dropdown_content';
|
|
2
3
|
import { IDropdown } from "./dropdown_types";
|
|
3
4
|
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element";
|
|
4
5
|
export declare class HDropdown extends PhoenixLightLitElement implements IDropdown {
|
|
@@ -6,18 +7,25 @@ export declare class HDropdown extends PhoenixLightLitElement implements IDropdo
|
|
|
6
7
|
direction: "bottom-center";
|
|
7
8
|
toggleOnHover: boolean;
|
|
8
9
|
name: string;
|
|
10
|
+
transition: string;
|
|
9
11
|
portalTarget: string;
|
|
10
12
|
$dropdownToggler: HTMLElement | null;
|
|
11
13
|
$dropdownContent: HTMLElement | null;
|
|
14
|
+
$nestedDropdownContentElements?: HDropdownContent[];
|
|
15
|
+
$hoverableDropdownContentElements: HDropdownContent[];
|
|
12
16
|
private _positionController;
|
|
13
17
|
private _clickOutsideController;
|
|
14
18
|
connectedCallback(): void;
|
|
19
|
+
private static _appendDropdownPortal;
|
|
15
20
|
private _setupListeners;
|
|
16
|
-
private _appendDropdownPortal;
|
|
17
21
|
private _handleClickOutside;
|
|
18
22
|
toggle: () => void;
|
|
19
|
-
show: () => void
|
|
20
|
-
|
|
23
|
+
show: () => Promise<void>;
|
|
24
|
+
private _dispatchShowDropdownEvent;
|
|
25
|
+
hide: () => Promise<void>;
|
|
26
|
+
private _dispatchHideDropdownEvent;
|
|
27
|
+
private _hoverToggle;
|
|
28
|
+
private _isHoveredWithinDropdown;
|
|
21
29
|
private _positionDropdownContent;
|
|
22
30
|
disconnectedCallback(): void;
|
|
23
31
|
render(): TemplateResult;
|
|
@@ -4,56 +4,138 @@ import { property } from 'lit/decorators';
|
|
|
4
4
|
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element.js';
|
|
5
5
|
import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
|
|
6
6
|
import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP } from '../portal/portal_constants.js';
|
|
7
|
-
import {
|
|
7
|
+
import { BACKDROP_EVENTS } from '../backdrop/backdrop_constants.js';
|
|
8
|
+
import { DEFAULT_DROPDOWN_PORTAL_NAME, DROPDOWN_CONTENT_VISIBLE_CLASS, DROPDOWN_CONTENT_SHOW, DROPDOWN_EVENTS, DROPDOWN_CONTENT_HIDE, DROPDOWN_CONTAINER_NAME, DROPDOWN_CONTENT_NAME, DROPDOWN_TOGGLER_NAME } from './dropdown_constants.js';
|
|
9
|
+
import { BREAKPOINTS } from '../../global_constants.js';
|
|
8
10
|
import { CLICK_OUTSIDE_CONTROLLER_MESSAGES } from '../../controllers/click_outside_controller/click_outside_controller_messages.js';
|
|
9
11
|
import { ClickOutsideController } from '../../controllers/click_outside_controller/click_outside_controller.js';
|
|
10
12
|
import { DIRECTIONS } from '../../controllers/relative_position_controller/relative_position_controller_constants.js';
|
|
11
13
|
import { RelativePositionController } from '../../controllers/relative_position_controller/relative_position_controller.js';
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
var HDropdown_1;
|
|
16
|
+
let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
14
17
|
constructor() {
|
|
15
18
|
super(...arguments);
|
|
16
19
|
this.opened = false;
|
|
17
20
|
this.direction = DIRECTIONS.bottomCenter;
|
|
18
21
|
this.toggleOnHover = false;
|
|
19
22
|
this.name = '';
|
|
23
|
+
this.transition = 'direction';
|
|
20
24
|
this.portalTarget = DEFAULT_DROPDOWN_PORTAL_NAME;
|
|
21
25
|
this.toggle = () => {
|
|
22
26
|
this.opened ? this.hide() : this.show();
|
|
23
27
|
};
|
|
24
|
-
this.show = () => {
|
|
25
|
-
|
|
28
|
+
this.show = async () => {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'true');
|
|
32
|
+
(_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.classList.add(DROPDOWN_CONTENT_VISIBLE_CLASS, `${DROPDOWN_CONTENT_SHOW}-${this.transition}-start`);
|
|
33
|
+
this.opened = true;
|
|
34
|
+
window.requestAnimationFrame(() => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
var _a;
|
|
37
|
+
(_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.classList.add(`${DROPDOWN_CONTENT_SHOW}-${this.transition}-end`);
|
|
38
|
+
}, 0);
|
|
39
|
+
const transitionDuration = parseFloat(getComputedStyle(this.$dropdownContent || this).transitionDuration) * 1000;
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
var _a;
|
|
42
|
+
this._dispatchShowDropdownEvent();
|
|
43
|
+
(_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.classList.remove(`${DROPDOWN_CONTENT_SHOW}-${this.transition}-start`, `${DROPDOWN_CONTENT_SHOW}-${this.transition}-end`);
|
|
44
|
+
resolve();
|
|
45
|
+
}, transitionDuration);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
this._dispatchShowDropdownEvent = () => {
|
|
26
50
|
const showDropdownEvent = new Event(DROPDOWN_EVENTS.show, {
|
|
27
51
|
bubbles: true
|
|
28
52
|
});
|
|
29
53
|
this.dispatchEvent(showDropdownEvent);
|
|
54
|
+
if (window.innerWidth >= BREAKPOINTS.xs)
|
|
55
|
+
return;
|
|
56
|
+
const showBackdropEvent = new Event(BACKDROP_EVENTS.show, {
|
|
57
|
+
bubbles: true
|
|
58
|
+
});
|
|
59
|
+
document.dispatchEvent(showBackdropEvent);
|
|
30
60
|
};
|
|
31
|
-
this.hide = () => {
|
|
32
|
-
|
|
61
|
+
this.hide = async () => new Promise((resolve) => {
|
|
62
|
+
var _a;
|
|
63
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'false');
|
|
64
|
+
const transitionDuration = parseFloat(getComputedStyle(this.$dropdownContent || this).transitionDuration) * 1000;
|
|
65
|
+
window.requestAnimationFrame(() => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
(_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.classList.remove(`${DROPDOWN_CONTENT_HIDE}-${this.transition}-start`);
|
|
68
|
+
(_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.classList.add(`${DROPDOWN_CONTENT_HIDE}-${this.transition}-end`);
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
var _a;
|
|
71
|
+
(_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.classList.remove(`${DROPDOWN_CONTENT_HIDE}-${this.transition}-start`, `${DROPDOWN_CONTENT_HIDE}-${this.transition}-end`);
|
|
72
|
+
this.opened = false;
|
|
73
|
+
this._dispatchHideDropdownEvent();
|
|
74
|
+
resolve();
|
|
75
|
+
}, transitionDuration);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
this._dispatchHideDropdownEvent = () => {
|
|
33
79
|
const hideDropdownEvent = new Event(DROPDOWN_EVENTS.hide, {
|
|
34
80
|
bubbles: true
|
|
35
81
|
});
|
|
36
82
|
this.dispatchEvent(hideDropdownEvent);
|
|
83
|
+
if (window.innerWidth >= BREAKPOINTS.xs)
|
|
84
|
+
return;
|
|
85
|
+
const hideBackdropEvent = new Event(BACKDROP_EVENTS.hide, {
|
|
86
|
+
bubbles: true
|
|
87
|
+
});
|
|
88
|
+
document.dispatchEvent(hideBackdropEvent);
|
|
89
|
+
};
|
|
90
|
+
this._hoverToggle = async (ev) => {
|
|
91
|
+
if (window.innerWidth < BREAKPOINTS.xs)
|
|
92
|
+
return;
|
|
93
|
+
if (!ev.target) {
|
|
94
|
+
await this.hide();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
|
|
98
|
+
if (isHoveredWithinDropdown && !this.opened) {
|
|
99
|
+
await this.show();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (!isHoveredWithinDropdown && this.opened) {
|
|
103
|
+
if (!this.$hoverableDropdownContentElements) {
|
|
104
|
+
await this.hide();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.$hoverableDropdownContentElements.forEach(async ({ name: dropdownName }) => {
|
|
108
|
+
const dropdown = document.querySelector(`${DROPDOWN_CONTAINER_NAME}[name="${dropdownName}"]`);
|
|
109
|
+
await dropdown.hide();
|
|
110
|
+
});
|
|
111
|
+
}
|
|
37
112
|
};
|
|
38
113
|
this._positionDropdownContent = () => {
|
|
39
114
|
requestAnimationFrame(() => {
|
|
40
|
-
this.opened &&
|
|
115
|
+
this.opened && window.innerWidth < BREAKPOINTS.xs
|
|
116
|
+
? this._positionController.disableRelativePositioning()
|
|
117
|
+
: this._positionController.position();
|
|
41
118
|
});
|
|
42
119
|
};
|
|
43
120
|
}
|
|
44
121
|
connectedCallback() {
|
|
45
122
|
super.connectedCallback();
|
|
46
|
-
|
|
123
|
+
HDropdown_1._appendDropdownPortal();
|
|
47
124
|
if (!this.$dropdownContent)
|
|
48
125
|
this.$dropdownContent = this.querySelector(DROPDOWN_CONTENT_NAME);
|
|
49
126
|
if (!this.$dropdownToggler)
|
|
50
127
|
this.$dropdownToggler = this.querySelector(DROPDOWN_TOGGLER_NAME);
|
|
128
|
+
const $nestedDropdown = this.$dropdownContent.querySelector(DROPDOWN_CONTAINER_NAME);
|
|
129
|
+
if ($nestedDropdown && !this.$nestedDropdownContentElements)
|
|
130
|
+
this.$nestedDropdownContentElements = [...$nestedDropdown.querySelectorAll(DROPDOWN_CONTENT_NAME)];
|
|
51
131
|
if (!this._positionController)
|
|
52
132
|
this._positionController = new RelativePositionController({
|
|
53
133
|
host: this,
|
|
54
134
|
direction: this.direction,
|
|
55
135
|
relativeElement: this.$dropdownToggler,
|
|
56
|
-
elementToPosition: this.$dropdownContent
|
|
136
|
+
elementToPosition: this.$dropdownContent,
|
|
137
|
+
shouldDisablePositioning: () => window.innerWidth < BREAKPOINTS.xs,
|
|
138
|
+
portalElementsNames: [DROPDOWN_CONTENT_NAME]
|
|
57
139
|
});
|
|
58
140
|
if (!this._clickOutsideController)
|
|
59
141
|
this._clickOutsideController = new ClickOutsideController({
|
|
@@ -61,18 +143,12 @@ let HDropdown = class HDropdown extends PhoenixLightLitElement {
|
|
|
61
143
|
container: this,
|
|
62
144
|
name: this.name
|
|
63
145
|
});
|
|
64
|
-
this.
|
|
65
|
-
|
|
66
|
-
_setupListeners() {
|
|
67
|
-
var _a, _b, _c;
|
|
68
|
-
this.addEventListener(CLICK_OUTSIDE_CONTROLLER_MESSAGES.clickedOutside, this._handleClickOutside);
|
|
69
|
-
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.addEventListener('toggle', this.toggle);
|
|
70
|
-
if (this.toggleOnHover) {
|
|
71
|
-
(_b = this.$dropdownToggler) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseenter', this.show);
|
|
72
|
-
(_c = this.$dropdownToggler) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseleave', this.hide);
|
|
146
|
+
if (this.toggleOnHover && !this.$hoverableDropdownContentElements) {
|
|
147
|
+
this.$hoverableDropdownContentElements = [...this.querySelectorAll(DROPDOWN_CONTENT_NAME)];
|
|
73
148
|
}
|
|
149
|
+
this._setupListeners();
|
|
74
150
|
}
|
|
75
|
-
_appendDropdownPortal() {
|
|
151
|
+
static _appendDropdownPortal() {
|
|
76
152
|
const $dropdownPortalTarget = document.querySelector(`[name="${DEFAULT_DROPDOWN_PORTAL_NAME}"]`);
|
|
77
153
|
if (!$dropdownPortalTarget) {
|
|
78
154
|
const $portalTarget = document.createElement(PORTAL_TARGET_COMPONENT_NAME);
|
|
@@ -80,22 +156,49 @@ let HDropdown = class HDropdown extends PhoenixLightLitElement {
|
|
|
80
156
|
document.body.appendChild($portalTarget);
|
|
81
157
|
}
|
|
82
158
|
}
|
|
83
|
-
|
|
159
|
+
_setupListeners() {
|
|
84
160
|
var _a;
|
|
161
|
+
this.addEventListener(CLICK_OUTSIDE_CONTROLLER_MESSAGES.clickedOutside, this._handleClickOutside);
|
|
162
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.addEventListener('toggle', this.toggle);
|
|
163
|
+
if (this.toggleOnHover)
|
|
164
|
+
document.addEventListener('mouseover', this._hoverToggle);
|
|
165
|
+
}
|
|
166
|
+
_handleClickOutside(ev) {
|
|
167
|
+
var _a, _b;
|
|
85
168
|
if (!this.opened)
|
|
86
169
|
return;
|
|
87
|
-
|
|
88
|
-
(_a = this.$
|
|
170
|
+
const target = ev.detail.target;
|
|
171
|
+
const clickedWithinNestedDropdown = (_a = this.$nestedDropdownContentElements) === null || _a === void 0 ? void 0 : _a.find((element) => element.contains(target));
|
|
172
|
+
const shouldHideElements = !((_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.contains(target)) && !this.contains(target) && !clickedWithinNestedDropdown;
|
|
173
|
+
if (shouldHideElements)
|
|
174
|
+
this.hide();
|
|
175
|
+
}
|
|
176
|
+
_isHoveredWithinDropdown(element) {
|
|
177
|
+
if (element === this)
|
|
178
|
+
return true;
|
|
179
|
+
if (element === this.$dropdownContent)
|
|
180
|
+
return true;
|
|
181
|
+
const isDescendantOfDropdown = element.closest(`${DROPDOWN_CONTAINER_NAME}[name="${this.name}"]`) !== null;
|
|
182
|
+
if (isDescendantOfDropdown)
|
|
183
|
+
return true;
|
|
184
|
+
const $closestDropdownContent = element.closest(DROPDOWN_CONTENT_NAME);
|
|
185
|
+
const isDescendantOfContent = this.$dropdownContent &&
|
|
186
|
+
$closestDropdownContent !== null &&
|
|
187
|
+
!!this.$hoverableDropdownContentElements.find((content) => content.name === $closestDropdownContent.name);
|
|
188
|
+
if (isDescendantOfContent)
|
|
189
|
+
return true;
|
|
190
|
+
return false;
|
|
89
191
|
}
|
|
90
192
|
disconnectedCallback() {
|
|
91
|
-
var _a
|
|
193
|
+
var _a;
|
|
92
194
|
super.disconnectedCallback();
|
|
93
195
|
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.removeEventListener('toggle', this.toggle);
|
|
94
|
-
if (this.toggleOnHover)
|
|
95
|
-
|
|
96
|
-
|
|
196
|
+
if (this.toggleOnHover)
|
|
197
|
+
document.removeEventListener('mouseover', this._hoverToggle);
|
|
198
|
+
if (this.opened) {
|
|
199
|
+
this.opened = false;
|
|
200
|
+
this._dispatchHideDropdownEvent();
|
|
97
201
|
}
|
|
98
|
-
this.opened = false;
|
|
99
202
|
}
|
|
100
203
|
render() {
|
|
101
204
|
super.render();
|
|
@@ -123,11 +226,15 @@ __decorate([
|
|
|
123
226
|
property({ type: String }),
|
|
124
227
|
__metadata("design:type", Object)
|
|
125
228
|
], HDropdown.prototype, "name", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property({ type: String }),
|
|
231
|
+
__metadata("design:type", Object)
|
|
232
|
+
], HDropdown.prototype, "transition", void 0);
|
|
126
233
|
__decorate([
|
|
127
234
|
property({ type: String }),
|
|
128
235
|
__metadata("design:type", Object)
|
|
129
236
|
], HDropdown.prototype, "portalTarget", void 0);
|
|
130
|
-
HDropdown = __decorate([
|
|
237
|
+
HDropdown = HDropdown_1 = __decorate([
|
|
131
238
|
phoenixCustomElement('h-dropdown')
|
|
132
239
|
], HDropdown);
|
|
133
240
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -8,5 +8,9 @@ export declare const DROPDOWN_EVENTS: {
|
|
|
8
8
|
readonly hide: "dropdown.hide";
|
|
9
9
|
};
|
|
10
10
|
export declare const DROPDOWN_OPENED_ATTRIBUTE_NAME = "opened";
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
11
|
+
export declare const DROPDOWN_CSS_CLASS = "dropdown";
|
|
12
|
+
export declare const DROPDOWN_CONTENT_CSS_CLASS: string;
|
|
13
|
+
export declare const DROPDOWN_TOGGLER_CSS_CLASS: string;
|
|
14
|
+
export declare const DROPDOWN_CONTENT_VISIBLE_CLASS: string;
|
|
15
|
+
export declare const DROPDOWN_CONTENT_SHOW: string;
|
|
16
|
+
export declare const DROPDOWN_CONTENT_HIDE: string;
|