@shoper/phoenix_design_system 1.17.6-1 → 1.17.7
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/dropdown/dropdown_toggler.js +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js +54 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +6 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js +0 -10
- package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js +0 -10
- package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js +2 -0
- package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/toggle/toggle_button.js +7 -14
- package/build/cjs/packages/phoenix/src/components/toggle/toggle_button.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +10 -0
- package/build/esm/packages/phoenix/src/components/messages/base_message.js +56 -3
- package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.d.ts +2 -0
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +5 -2
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/hints/hint.d.ts +0 -2
- package/build/esm/packages/phoenix/src/components/messages/hints/hint.js +0 -10
- package/build/esm/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.d.ts +0 -2
- package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js +0 -10
- package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/portal/portal_constants.js +2 -1
- package/build/esm/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/toggle/toggle_button.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/toggle/toggle_button.js +7 -14
- package/build/esm/packages/phoenix/src/components/toggle/toggle_button.js.map +1 -1
- package/package.json +2 -2
|
@@ -15,7 +15,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
|
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
this.name = '';
|
|
18
|
-
this.ariaHasPopup = '
|
|
18
|
+
this.ariaHasPopup = 'menu';
|
|
19
19
|
this.ariaControls = '';
|
|
20
20
|
this.role = 'button';
|
|
21
21
|
this._setupTogglerAria = () => {
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var lit = require('lit');
|
|
6
7
|
var decorators = require('lit/decorators');
|
|
7
8
|
var utilities = require('@dreamcommerce/utilities');
|
|
8
9
|
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
10
|
+
var v4 = require('../../../../../external/uuid/dist/esm-browser/v4.js');
|
|
9
11
|
var portal_constants = require('../portal/portal_constants.js');
|
|
10
12
|
var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
|
|
11
13
|
var relative_position_controller = require('../../controllers/relative_position_controller/relative_position_controller.js');
|
|
12
14
|
var base_message_constants = require('./base_message_constants.js');
|
|
15
|
+
var ref = require('lit/directives/ref');
|
|
13
16
|
|
|
14
17
|
class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
15
18
|
constructor() {
|
|
@@ -20,9 +23,24 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
20
23
|
this.offset = base_message_constants.DEFAULT_MESSAGE_OFFSET;
|
|
21
24
|
this.mouseonly = false;
|
|
22
25
|
this.tabindex = '-1';
|
|
26
|
+
this.useAsLabel = false;
|
|
27
|
+
this._messageId = v4['default']();
|
|
28
|
+
this._tooltipRef = ref.createRef();
|
|
29
|
+
this._handleChildrenAriaAttributes = () => {
|
|
30
|
+
[...this.children].forEach((child) => {
|
|
31
|
+
if (base_message_constants.LIST_OF_MESSAGE_CHILDREN.includes(child.tagName.toLowerCase()) || this._tooltipRef.value === child)
|
|
32
|
+
return;
|
|
33
|
+
const attributeName = this.useAsLabel ? 'aria-labelledby' : 'aria-describedby';
|
|
34
|
+
child.setAttribute(attributeName, `${child.getAttribute(attributeName) || ''} ${this._messageId}`);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
23
37
|
this._setupEventListeners = () => {
|
|
38
|
+
var _a, _b;
|
|
24
39
|
this.addEventListener('mouseenter', this.open);
|
|
25
40
|
this.addEventListener('mouseleave', this.close);
|
|
41
|
+
this.addEventListener('keydown', this._closeFromKeyboard);
|
|
42
|
+
(_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.open);
|
|
43
|
+
(_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.close);
|
|
26
44
|
if (!this.mouseonly) {
|
|
27
45
|
this.addEventListener('focusin', this.open);
|
|
28
46
|
this.addEventListener('focusout', this.close);
|
|
@@ -43,6 +61,13 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
43
61
|
this.opened = true;
|
|
44
62
|
}, base_message_constants.MESSAGE_SHOW_DELAY_IN_MS);
|
|
45
63
|
};
|
|
64
|
+
this._closeFromKeyboard = (ev) => {
|
|
65
|
+
if (ev.key !== 'Escape' || !this.opened)
|
|
66
|
+
return;
|
|
67
|
+
ev.preventDefault();
|
|
68
|
+
ev.stopPropagation();
|
|
69
|
+
this.close();
|
|
70
|
+
};
|
|
46
71
|
this.close = () => {
|
|
47
72
|
this._shouldDelayClosing = Date.now() - this._tooltipOpenTime > base_message_constants.MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
|
|
48
73
|
clearTimeout(this._openTimeout);
|
|
@@ -83,8 +108,14 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
83
108
|
offset: this.offset
|
|
84
109
|
});
|
|
85
110
|
this.setAttribute('tabindex', this.tabindex);
|
|
111
|
+
if (!this._$baseMessageContent)
|
|
112
|
+
this._$baseMessageContent = [...this.children].find((child) => base_message_constants.MESSAGE_CONTENT_ELEMENTS.includes(child.tagName.toLowerCase()));
|
|
86
113
|
this._setupEventListeners();
|
|
87
114
|
}
|
|
115
|
+
firstUpdated(props) {
|
|
116
|
+
super.firstUpdated(props);
|
|
117
|
+
this._handleChildrenAriaAttributes();
|
|
118
|
+
}
|
|
88
119
|
static _appendMessagePortal() {
|
|
89
120
|
const $messagePortalTarget = document.querySelector(`[name="${base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME}"]`);
|
|
90
121
|
if ($messagePortalTarget)
|
|
@@ -93,6 +124,24 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
93
124
|
$portalTarget.setAttribute(portal_constants.PORTAL_TARGET_NAME_PROP, base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME);
|
|
94
125
|
document.body.appendChild($portalTarget);
|
|
95
126
|
}
|
|
127
|
+
disconnectedCallback() {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
super.disconnectedCallback();
|
|
130
|
+
(_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', this.open);
|
|
131
|
+
(_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.close);
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
var _a;
|
|
135
|
+
super.render();
|
|
136
|
+
return lit.html `
|
|
137
|
+
<span ${ref.ref(this._tooltipRef)} id="${this._messageId}" class="${base_message_constants.SCREEN_READER_ONLY_CLASS_NAME}" role="tooltip">
|
|
138
|
+
${utilities.DomUtils.stripHTMLTags(((_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.innerHTML) || '')}
|
|
139
|
+
</span>
|
|
140
|
+
<h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
|
|
141
|
+
${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
|
|
142
|
+
</h-portal>
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
96
145
|
}
|
|
97
146
|
tslib_es6.__decorate([
|
|
98
147
|
decorators.property({ type: Boolean, reflect: true }),
|
|
@@ -117,7 +166,11 @@ tslib_es6.__decorate([
|
|
|
117
166
|
tslib_es6.__decorate([
|
|
118
167
|
decorators.property({ type: String }),
|
|
119
168
|
tslib_es6.__metadata("design:type", String)
|
|
120
|
-
], BaseMessage.prototype, "tabindex", void 0);
|
|
169
|
+
], BaseMessage.prototype, "tabindex", void 0);
|
|
170
|
+
tslib_es6.__decorate([
|
|
171
|
+
decorators.property({ type: Boolean, attribute: 'use-as-label' }),
|
|
172
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
173
|
+
], BaseMessage.prototype, "useAsLabel", void 0);
|
|
121
174
|
|
|
122
175
|
exports.BaseMessage = BaseMessage;
|
|
123
176
|
//# sourceMappingURL=base_message.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var portal_constants = require('../portal/portal_constants.js');
|
|
5
6
|
var hint_constants = require('./hints/hint_constants.js');
|
|
6
7
|
var tooltip_constants = require('./tooltips/tooltip_constants.js');
|
|
7
8
|
|
|
@@ -10,16 +11,20 @@ const MESSAGE_CONTENT_SLOT_NAME = 'message-content';
|
|
|
10
11
|
const MESSAGE_REMOVED_CLASS_NAME = `removed`;
|
|
11
12
|
const DEFAULT_MESSAGE_OFFSET = 10;
|
|
12
13
|
const MESSAGE_CONTENT_ELEMENTS = [tooltip_constants.TOOLTIP_CONTENT_ELEMENT_NAME, hint_constants.HINT_CONTENT_ELEMENT_NAME];
|
|
14
|
+
const LIST_OF_MESSAGE_CHILDREN = [...MESSAGE_CONTENT_ELEMENTS, portal_constants.PORTAL_COMPONENT_NAME];
|
|
13
15
|
const MESSAGE_SHOW_DELAY_IN_MS = 100;
|
|
14
16
|
const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
|
|
15
|
-
const MESSAGE_CLOSE_DELAY_IN_MS = 500;
|
|
17
|
+
const MESSAGE_CLOSE_DELAY_IN_MS = 500;
|
|
18
|
+
const SCREEN_READER_ONLY_CLASS_NAME = 'sr-only';
|
|
16
19
|
|
|
17
20
|
exports.DEFAULT_MESSAGE_OFFSET = DEFAULT_MESSAGE_OFFSET;
|
|
18
21
|
exports.DEFAULT_MESSAGE_PORTAL_NAME = DEFAULT_MESSAGE_PORTAL_NAME;
|
|
22
|
+
exports.LIST_OF_MESSAGE_CHILDREN = LIST_OF_MESSAGE_CHILDREN;
|
|
19
23
|
exports.MESSAGE_CLOSE_DELAY_IN_MS = MESSAGE_CLOSE_DELAY_IN_MS;
|
|
20
24
|
exports.MESSAGE_CONTENT_ELEMENTS = MESSAGE_CONTENT_ELEMENTS;
|
|
21
25
|
exports.MESSAGE_CONTENT_SLOT_NAME = MESSAGE_CONTENT_SLOT_NAME;
|
|
22
26
|
exports.MESSAGE_REMOVED_CLASS_NAME = MESSAGE_REMOVED_CLASS_NAME;
|
|
23
27
|
exports.MESSAGE_SHOW_DELAY_IN_MS = MESSAGE_SHOW_DELAY_IN_MS;
|
|
24
28
|
exports.MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
|
|
29
|
+
exports.SCREEN_READER_ONLY_CLASS_NAME = SCREEN_READER_ONLY_CLASS_NAME;
|
|
25
30
|
//# sourceMappingURL=base_message_constants.js.map
|
|
@@ -1 +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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
6
|
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
7
|
-
var litHtml = require('lit-html');
|
|
8
7
|
var hint_constants = require('./hint_constants.js');
|
|
9
|
-
var base_message_constants = require('../base_message_constants.js');
|
|
10
8
|
var base_message = require('../base_message.js');
|
|
11
9
|
|
|
12
10
|
exports.HHint = class HHint extends base_message.BaseMessage {
|
|
@@ -18,14 +16,6 @@ exports.HHint = class HHint extends base_message.BaseMessage {
|
|
|
18
16
|
super.connectedCallback(hint_constants.HINT_CLASS_NAME);
|
|
19
17
|
this.classList.add(hint_constants.HINT_CLASS_NAME);
|
|
20
18
|
}
|
|
21
|
-
render() {
|
|
22
|
-
super.render();
|
|
23
|
-
return litHtml.html `
|
|
24
|
-
<h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
|
|
25
|
-
${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
|
|
26
|
-
</h-portal>
|
|
27
|
-
`;
|
|
28
|
-
}
|
|
29
19
|
};
|
|
30
20
|
exports.HHint = tslib_es6.__decorate([
|
|
31
21
|
phoenix_custom_element.phoenixCustomElement(hint_constants.HINT_ELEMENT_NAME),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;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,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
6
|
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
7
|
-
var litHtml = require('lit-html');
|
|
8
7
|
var tooltip_constants = require('./tooltip_constants.js');
|
|
9
|
-
var base_message_constants = require('../base_message_constants.js');
|
|
10
8
|
var base_message = require('../base_message.js');
|
|
11
9
|
|
|
12
10
|
exports.HTooltip = class HTooltip extends base_message.BaseMessage {
|
|
@@ -14,14 +12,6 @@ exports.HTooltip = class HTooltip extends base_message.BaseMessage {
|
|
|
14
12
|
super.connectedCallback(tooltip_constants.TOOLTIP_CLASS_NAME);
|
|
15
13
|
this.classList.add(tooltip_constants.TOOLTIP_CLASS_NAME);
|
|
16
14
|
}
|
|
17
|
-
render() {
|
|
18
|
-
super.render();
|
|
19
|
-
return litHtml.html `
|
|
20
|
-
<h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
|
|
21
|
-
${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
|
|
22
|
-
</h-portal>
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
25
15
|
};
|
|
26
16
|
exports.HTooltip = tslib_es6.__decorate([
|
|
27
17
|
phoenix_custom_element.phoenixCustomElement(tooltip_constants.TOOLTIP_ELEMENT_NAME)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;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,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -7,9 +7,11 @@ const PORTAL_EVENTS = {
|
|
|
7
7
|
close: 'close'
|
|
8
8
|
};
|
|
9
9
|
const PORTAL_TARGET_NAME_PROP = 'name';
|
|
10
|
+
const PORTAL_COMPONENT_NAME = 'h-portal';
|
|
10
11
|
const PORTAL_TARGET_COMPONENT_NAME = 'h-portal-target';
|
|
11
12
|
const PORTAL_TARGET_ATTRIBUTE_NAME = 'portal-target';
|
|
12
13
|
|
|
14
|
+
exports.PORTAL_COMPONENT_NAME = PORTAL_COMPONENT_NAME;
|
|
13
15
|
exports.PORTAL_EVENTS = PORTAL_EVENTS;
|
|
14
16
|
exports.PORTAL_TARGET_ATTRIBUTE_NAME = PORTAL_TARGET_ATTRIBUTE_NAME;
|
|
15
17
|
exports.PORTAL_TARGET_COMPONENT_NAME = PORTAL_TARGET_COMPONENT_NAME;
|
|
@@ -1 +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;AACA;AACA;"}
|
|
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;AACA;AACA;AACA;AACA;"}
|
|
@@ -16,22 +16,17 @@ exports.HToggleBtn = class HToggleBtn extends phoenix_light_lit_element.PhoenixL
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
this.action = toggle_constants.TOGGLE_ACTIONS.collapse;
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
$collapseToggleBtn === null || $collapseToggleBtn === void 0 ? void 0 : $collapseToggleBtn.focus();
|
|
19
|
+
this._visibility = {
|
|
20
|
+
collapse: (isOpened) => {
|
|
21
|
+
isOpened ? this._visibilityController.show() : this._visibilityController.hide();
|
|
22
|
+
},
|
|
23
|
+
expand: (isOpened) => {
|
|
24
|
+
isOpened ? this._visibilityController.hide() : this._visibilityController.show();
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
this._dispatchToggleEvent = () => {
|
|
29
28
|
this.emitCustomEvent(toggle_constants.TOGGLE_BUTTON_EVENTS.toggle);
|
|
30
29
|
};
|
|
31
|
-
this._visibility = {
|
|
32
|
-
collapse: this._handleVisibilityChange,
|
|
33
|
-
expand: this._handleVisibilityChange
|
|
34
|
-
};
|
|
35
30
|
this._btnController = new btn_controller.BtnController(this, this._dispatchToggleEvent);
|
|
36
31
|
this._visibilityController = new visibility_controller.VisibilityController(this);
|
|
37
32
|
}
|
|
@@ -43,12 +38,10 @@ exports.HToggleBtn = class HToggleBtn extends phoenix_light_lit_element.PhoenixL
|
|
|
43
38
|
this._visibility[this.action](isOpened);
|
|
44
39
|
});
|
|
45
40
|
this._opened$.subscribe(this._openedObserver);
|
|
46
|
-
this.setAttribute('aria-expanded', this.action === toggle_constants.TOGGLE_ACTIONS.collapse ? 'true' : 'false');
|
|
47
41
|
this.addEventListener('click', this._dispatchToggleEvent);
|
|
48
42
|
}
|
|
49
43
|
disconnectedCallback() {
|
|
50
|
-
|
|
51
|
-
this._openedObserver && this._opened$.unsubscribe(this._openedObserver);
|
|
44
|
+
this._opened$.unsubscribe(this._openedObserver);
|
|
52
45
|
}
|
|
53
46
|
};
|
|
54
47
|
tslib_es6.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -11,7 +11,7 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
13
|
this.name = '';
|
|
14
|
-
this.ariaHasPopup = '
|
|
14
|
+
this.ariaHasPopup = 'menu';
|
|
15
15
|
this.ariaControls = '';
|
|
16
16
|
this.role = 'button';
|
|
17
17
|
this._setupTogglerAria = () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IBaseMessage } from './base_message_types';
|
|
2
2
|
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
3
|
import type { TDirection } from '@dreamcommerce/utilities';
|
|
4
|
+
import { PropertyValues, TemplateResult } from 'lit';
|
|
4
5
|
export declare class BaseMessage extends PhoenixLightLitElement implements IBaseMessage {
|
|
5
6
|
opened: boolean;
|
|
6
7
|
portalTarget: string;
|
|
@@ -8,6 +9,8 @@ export declare class BaseMessage extends PhoenixLightLitElement implements IBase
|
|
|
8
9
|
offset: number;
|
|
9
10
|
mouseonly: boolean;
|
|
10
11
|
tabindex: string;
|
|
12
|
+
useAsLabel: boolean;
|
|
13
|
+
private _messageId;
|
|
11
14
|
private _positionController;
|
|
12
15
|
private _clickOutsideController;
|
|
13
16
|
private _$messageContent;
|
|
@@ -16,11 +19,18 @@ export declare class BaseMessage extends PhoenixLightLitElement implements IBase
|
|
|
16
19
|
private _shouldDelayClosing;
|
|
17
20
|
private _closeTimeout;
|
|
18
21
|
private _messageComponentName;
|
|
22
|
+
private _$baseMessageContent?;
|
|
23
|
+
private _tooltipRef;
|
|
19
24
|
constructor();
|
|
20
25
|
connectedCallback(messageComponentName?: string): void;
|
|
26
|
+
firstUpdated(props: PropertyValues): void;
|
|
27
|
+
private _handleChildrenAriaAttributes;
|
|
21
28
|
private static _appendMessagePortal;
|
|
22
29
|
private _setupEventListeners;
|
|
23
30
|
protected _positionMessage: () => void;
|
|
24
31
|
open: () => void;
|
|
32
|
+
private _closeFromKeyboard;
|
|
25
33
|
close: () => void;
|
|
34
|
+
disconnectedCallback(): void;
|
|
35
|
+
protected render(): TemplateResult;
|
|
26
36
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html } from 'lit';
|
|
2
3
|
import { property } from 'lit/decorators';
|
|
3
|
-
import { DIRECTIONS } from '@dreamcommerce/utilities';
|
|
4
|
+
import { DIRECTIONS, DomUtils } from '@dreamcommerce/utilities';
|
|
4
5
|
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
6
|
+
import v4 from '../../../../../external/uuid/dist/esm-browser/v4.js';
|
|
5
7
|
import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP, PORTAL_TARGET_ATTRIBUTE_NAME } from '../portal/portal_constants.js';
|
|
6
8
|
import { ClickOutsideController } from '../../controllers/click_outside_controller/click_outside_controller.js';
|
|
7
9
|
import { RelativePositionController } from '../../controllers/relative_position_controller/relative_position_controller.js';
|
|
8
|
-
import { DEFAULT_MESSAGE_PORTAL_NAME, DEFAULT_MESSAGE_OFFSET, MESSAGE_SHOW_DELAY_IN_MS, MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS, MESSAGE_REMOVED_CLASS_NAME, MESSAGE_CLOSE_DELAY_IN_MS, MESSAGE_CONTENT_ELEMENTS } from './base_message_constants.js';
|
|
10
|
+
import { DEFAULT_MESSAGE_PORTAL_NAME, DEFAULT_MESSAGE_OFFSET, LIST_OF_MESSAGE_CHILDREN, MESSAGE_SHOW_DELAY_IN_MS, MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS, MESSAGE_REMOVED_CLASS_NAME, MESSAGE_CLOSE_DELAY_IN_MS, MESSAGE_CONTENT_ELEMENTS, SCREEN_READER_ONLY_CLASS_NAME, MESSAGE_CONTENT_SLOT_NAME } from './base_message_constants.js';
|
|
11
|
+
import { createRef, ref } from 'lit/directives/ref';
|
|
9
12
|
|
|
10
13
|
class BaseMessage extends PhoenixLightLitElement {
|
|
11
14
|
constructor() {
|
|
@@ -16,9 +19,24 @@ class BaseMessage extends PhoenixLightLitElement {
|
|
|
16
19
|
this.offset = DEFAULT_MESSAGE_OFFSET;
|
|
17
20
|
this.mouseonly = false;
|
|
18
21
|
this.tabindex = '-1';
|
|
22
|
+
this.useAsLabel = false;
|
|
23
|
+
this._messageId = v4();
|
|
24
|
+
this._tooltipRef = createRef();
|
|
25
|
+
this._handleChildrenAriaAttributes = () => {
|
|
26
|
+
[...this.children].forEach((child) => {
|
|
27
|
+
if (LIST_OF_MESSAGE_CHILDREN.includes(child.tagName.toLowerCase()) || this._tooltipRef.value === child)
|
|
28
|
+
return;
|
|
29
|
+
const attributeName = this.useAsLabel ? 'aria-labelledby' : 'aria-describedby';
|
|
30
|
+
child.setAttribute(attributeName, `${child.getAttribute(attributeName) || ''} ${this._messageId}`);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
19
33
|
this._setupEventListeners = () => {
|
|
34
|
+
var _a, _b;
|
|
20
35
|
this.addEventListener('mouseenter', this.open);
|
|
21
36
|
this.addEventListener('mouseleave', this.close);
|
|
37
|
+
this.addEventListener('keydown', this._closeFromKeyboard);
|
|
38
|
+
(_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.open);
|
|
39
|
+
(_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.close);
|
|
22
40
|
if (!this.mouseonly) {
|
|
23
41
|
this.addEventListener('focusin', this.open);
|
|
24
42
|
this.addEventListener('focusout', this.close);
|
|
@@ -39,6 +57,13 @@ class BaseMessage extends PhoenixLightLitElement {
|
|
|
39
57
|
this.opened = true;
|
|
40
58
|
}, MESSAGE_SHOW_DELAY_IN_MS);
|
|
41
59
|
};
|
|
60
|
+
this._closeFromKeyboard = (ev) => {
|
|
61
|
+
if (ev.key !== 'Escape' || !this.opened)
|
|
62
|
+
return;
|
|
63
|
+
ev.preventDefault();
|
|
64
|
+
ev.stopPropagation();
|
|
65
|
+
this.close();
|
|
66
|
+
};
|
|
42
67
|
this.close = () => {
|
|
43
68
|
this._shouldDelayClosing = Date.now() - this._tooltipOpenTime > MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
|
|
44
69
|
clearTimeout(this._openTimeout);
|
|
@@ -79,8 +104,14 @@ class BaseMessage extends PhoenixLightLitElement {
|
|
|
79
104
|
offset: this.offset
|
|
80
105
|
});
|
|
81
106
|
this.setAttribute('tabindex', this.tabindex);
|
|
107
|
+
if (!this._$baseMessageContent)
|
|
108
|
+
this._$baseMessageContent = [...this.children].find((child) => MESSAGE_CONTENT_ELEMENTS.includes(child.tagName.toLowerCase()));
|
|
82
109
|
this._setupEventListeners();
|
|
83
110
|
}
|
|
111
|
+
firstUpdated(props) {
|
|
112
|
+
super.firstUpdated(props);
|
|
113
|
+
this._handleChildrenAriaAttributes();
|
|
114
|
+
}
|
|
84
115
|
static _appendMessagePortal() {
|
|
85
116
|
const $messagePortalTarget = document.querySelector(`[name="${DEFAULT_MESSAGE_PORTAL_NAME}"]`);
|
|
86
117
|
if ($messagePortalTarget)
|
|
@@ -89,6 +120,24 @@ class BaseMessage extends PhoenixLightLitElement {
|
|
|
89
120
|
$portalTarget.setAttribute(PORTAL_TARGET_NAME_PROP, DEFAULT_MESSAGE_PORTAL_NAME);
|
|
90
121
|
document.body.appendChild($portalTarget);
|
|
91
122
|
}
|
|
123
|
+
disconnectedCallback() {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
super.disconnectedCallback();
|
|
126
|
+
(_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', this.open);
|
|
127
|
+
(_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.close);
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
130
|
+
var _a;
|
|
131
|
+
super.render();
|
|
132
|
+
return html `
|
|
133
|
+
<span ${ref(this._tooltipRef)} id="${this._messageId}" class="${SCREEN_READER_ONLY_CLASS_NAME}" role="tooltip">
|
|
134
|
+
${DomUtils.stripHTMLTags(((_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.innerHTML) || '')}
|
|
135
|
+
</span>
|
|
136
|
+
<h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
|
|
137
|
+
${this.getSlot(MESSAGE_CONTENT_SLOT_NAME)}
|
|
138
|
+
</h-portal>
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
92
141
|
}
|
|
93
142
|
__decorate([
|
|
94
143
|
property({ type: Boolean, reflect: true }),
|
|
@@ -113,7 +162,11 @@ __decorate([
|
|
|
113
162
|
__decorate([
|
|
114
163
|
property({ type: String }),
|
|
115
164
|
__metadata("design:type", String)
|
|
116
|
-
], BaseMessage.prototype, "tabindex", void 0);
|
|
165
|
+
], BaseMessage.prototype, "tabindex", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
property({ type: Boolean, attribute: 'use-as-label' }),
|
|
168
|
+
__metadata("design:type", Boolean)
|
|
169
|
+
], BaseMessage.prototype, "useAsLabel", void 0);
|
|
117
170
|
|
|
118
171
|
export { BaseMessage };
|
|
119
172
|
//# sourceMappingURL=base_message.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,eAAe,qDAAyD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -4,6 +4,8 @@ export declare const MESSAGE_REMOVED_CLASS_NAME = "removed";
|
|
|
4
4
|
export declare const DEFAULT_MESSAGE_OFFSET = 10;
|
|
5
5
|
export declare const MESSAGE_ELEMENTS: string[];
|
|
6
6
|
export declare const MESSAGE_CONTENT_ELEMENTS: string[];
|
|
7
|
+
export declare const LIST_OF_MESSAGE_CHILDREN: string[];
|
|
7
8
|
export declare const MESSAGE_SHOW_DELAY_IN_MS = 100;
|
|
8
9
|
export declare const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
|
|
9
10
|
export declare const MESSAGE_CLOSE_DELAY_IN_MS = 500;
|
|
11
|
+
export declare const SCREEN_READER_ONLY_CLASS_NAME = "sr-only";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PORTAL_COMPONENT_NAME } from '../portal/portal_constants.js';
|
|
1
2
|
import { HINT_CONTENT_ELEMENT_NAME } from './hints/hint_constants.js';
|
|
2
3
|
import { TOOLTIP_CONTENT_ELEMENT_NAME } from './tooltips/tooltip_constants.js';
|
|
3
4
|
|
|
@@ -6,9 +7,11 @@ const MESSAGE_CONTENT_SLOT_NAME = 'message-content';
|
|
|
6
7
|
const MESSAGE_REMOVED_CLASS_NAME = `removed`;
|
|
7
8
|
const DEFAULT_MESSAGE_OFFSET = 10;
|
|
8
9
|
const MESSAGE_CONTENT_ELEMENTS = [TOOLTIP_CONTENT_ELEMENT_NAME, HINT_CONTENT_ELEMENT_NAME];
|
|
10
|
+
const LIST_OF_MESSAGE_CHILDREN = [...MESSAGE_CONTENT_ELEMENTS, PORTAL_COMPONENT_NAME];
|
|
9
11
|
const MESSAGE_SHOW_DELAY_IN_MS = 100;
|
|
10
12
|
const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
|
|
11
|
-
const MESSAGE_CLOSE_DELAY_IN_MS = 500;
|
|
13
|
+
const MESSAGE_CLOSE_DELAY_IN_MS = 500;
|
|
14
|
+
const SCREEN_READER_ONLY_CLASS_NAME = 'sr-only';
|
|
12
15
|
|
|
13
|
-
export { DEFAULT_MESSAGE_OFFSET, DEFAULT_MESSAGE_PORTAL_NAME, MESSAGE_CLOSE_DELAY_IN_MS, MESSAGE_CONTENT_ELEMENTS, MESSAGE_CONTENT_SLOT_NAME, MESSAGE_REMOVED_CLASS_NAME, MESSAGE_SHOW_DELAY_IN_MS, MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS };
|
|
16
|
+
export { DEFAULT_MESSAGE_OFFSET, DEFAULT_MESSAGE_PORTAL_NAME, LIST_OF_MESSAGE_CHILDREN, MESSAGE_CLOSE_DELAY_IN_MS, MESSAGE_CONTENT_ELEMENTS, MESSAGE_CONTENT_SLOT_NAME, MESSAGE_REMOVED_CLASS_NAME, MESSAGE_SHOW_DELAY_IN_MS, MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS, SCREEN_READER_ONLY_CLASS_NAME };
|
|
14
17
|
//# sourceMappingURL=base_message_constants.js.map
|
|
@@ -1 +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;"}
|
|
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;AACA;AACA;"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
3
|
-
import { html } from 'lit-html';
|
|
4
3
|
import { HINT_DEFAULT_OFFSET, HINT_CLASS_NAME, HINT_ELEMENT_NAME } from './hint_constants.js';
|
|
5
|
-
import { MESSAGE_CONTENT_SLOT_NAME } from '../base_message_constants.js';
|
|
6
4
|
import { BaseMessage } from '../base_message.js';
|
|
7
5
|
|
|
8
6
|
let HHint = class HHint extends BaseMessage {
|
|
@@ -14,14 +12,6 @@ let HHint = class HHint extends BaseMessage {
|
|
|
14
12
|
super.connectedCallback(HINT_CLASS_NAME);
|
|
15
13
|
this.classList.add(HINT_CLASS_NAME);
|
|
16
14
|
}
|
|
17
|
-
render() {
|
|
18
|
-
super.render();
|
|
19
|
-
return html `
|
|
20
|
-
<h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
|
|
21
|
-
${this.getSlot(MESSAGE_CONTENT_SLOT_NAME)}
|
|
22
|
-
</h-portal>
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
25
15
|
};
|
|
26
16
|
HHint = __decorate([
|
|
27
17
|
phoenixCustomElement(HINT_ELEMENT_NAME),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;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,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { __decorate } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
3
|
-
import { html } from 'lit-html';
|
|
4
3
|
import { TOOLTIP_CLASS_NAME, TOOLTIP_ELEMENT_NAME } from './tooltip_constants.js';
|
|
5
|
-
import { MESSAGE_CONTENT_SLOT_NAME } from '../base_message_constants.js';
|
|
6
4
|
import { BaseMessage } from '../base_message.js';
|
|
7
5
|
|
|
8
6
|
let HTooltip = class HTooltip extends BaseMessage {
|
|
@@ -10,14 +8,6 @@ let HTooltip = class HTooltip extends BaseMessage {
|
|
|
10
8
|
super.connectedCallback(TOOLTIP_CLASS_NAME);
|
|
11
9
|
this.classList.add(TOOLTIP_CLASS_NAME);
|
|
12
10
|
}
|
|
13
|
-
render() {
|
|
14
|
-
super.render();
|
|
15
|
-
return html `
|
|
16
|
-
<h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
|
|
17
|
-
${this.getSlot(MESSAGE_CONTENT_SLOT_NAME)}
|
|
18
|
-
</h-portal>
|
|
19
|
-
`;
|
|
20
|
-
}
|
|
21
11
|
};
|
|
22
12
|
HTooltip = __decorate([
|
|
23
13
|
phoenixCustomElement(TOOLTIP_ELEMENT_NAME)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,2BAA2B,+CAAmD;AAC9E;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,2BAA2B,+CAAmD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -3,8 +3,9 @@ const PORTAL_EVENTS = {
|
|
|
3
3
|
close: 'close'
|
|
4
4
|
};
|
|
5
5
|
const PORTAL_TARGET_NAME_PROP = 'name';
|
|
6
|
+
const PORTAL_COMPONENT_NAME = 'h-portal';
|
|
6
7
|
const PORTAL_TARGET_COMPONENT_NAME = 'h-portal-target';
|
|
7
8
|
const PORTAL_TARGET_ATTRIBUTE_NAME = 'portal-target';
|
|
8
9
|
|
|
9
|
-
export { PORTAL_EVENTS, PORTAL_TARGET_ATTRIBUTE_NAME, PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP };
|
|
10
|
+
export { PORTAL_COMPONENT_NAME, PORTAL_EVENTS, PORTAL_TARGET_ATTRIBUTE_NAME, PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP };
|
|
10
11
|
//# sourceMappingURL=portal_constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -8,7 +8,6 @@ export declare class HToggleBtn extends PhoenixLightLitElement {
|
|
|
8
8
|
action: "collapse";
|
|
9
9
|
private _visibility;
|
|
10
10
|
constructor();
|
|
11
|
-
private _handleVisibilityChange;
|
|
12
11
|
connectedCallback(): Promise<void>;
|
|
13
12
|
disconnectedCallback(): void;
|
|
14
13
|
private _dispatchToggleEvent;
|
|
@@ -12,22 +12,17 @@ let HToggleBtn = class HToggleBtn extends PhoenixLightLitElement {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
this.action = TOGGLE_ACTIONS.collapse;
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
$collapseToggleBtn === null || $collapseToggleBtn === void 0 ? void 0 : $collapseToggleBtn.focus();
|
|
15
|
+
this._visibility = {
|
|
16
|
+
collapse: (isOpened) => {
|
|
17
|
+
isOpened ? this._visibilityController.show() : this._visibilityController.hide();
|
|
18
|
+
},
|
|
19
|
+
expand: (isOpened) => {
|
|
20
|
+
isOpened ? this._visibilityController.hide() : this._visibilityController.show();
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
23
|
this._dispatchToggleEvent = () => {
|
|
25
24
|
this.emitCustomEvent(TOGGLE_BUTTON_EVENTS.toggle);
|
|
26
25
|
};
|
|
27
|
-
this._visibility = {
|
|
28
|
-
collapse: this._handleVisibilityChange,
|
|
29
|
-
expand: this._handleVisibilityChange
|
|
30
|
-
};
|
|
31
26
|
this._btnController = new BtnController(this, this._dispatchToggleEvent);
|
|
32
27
|
this._visibilityController = new VisibilityController(this);
|
|
33
28
|
}
|
|
@@ -39,12 +34,10 @@ let HToggleBtn = class HToggleBtn extends PhoenixLightLitElement {
|
|
|
39
34
|
this._visibility[this.action](isOpened);
|
|
40
35
|
});
|
|
41
36
|
this._opened$.subscribe(this._openedObserver);
|
|
42
|
-
this.setAttribute('aria-expanded', this.action === TOGGLE_ACTIONS.collapse ? 'true' : 'false');
|
|
43
37
|
this.addEventListener('click', this._dispatchToggleEvent);
|
|
44
38
|
}
|
|
45
39
|
disconnectedCallback() {
|
|
46
|
-
|
|
47
|
-
this._openedObserver && this._opened$.unsubscribe(this._openedObserver);
|
|
40
|
+
this._opened$.unsubscribe(this._openedObserver);
|
|
48
41
|
}
|
|
49
42
|
};
|
|
50
43
|
__decorate([
|
|
@@ -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;
|
|
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;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@shoper/phoenix_design_system",
|
|
3
3
|
"packageManager": "yarn@3.2.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "1.17.
|
|
5
|
+
"version": "1.17.7",
|
|
6
6
|
"description": "phoenix design system",
|
|
7
7
|
"author": "zefirek",
|
|
8
8
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@splidejs/splide-extension-auto-scroll": "^0.5.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@dreamcommerce/utilities": "^1.20.1-
|
|
34
|
+
"@dreamcommerce/utilities": "^1.20.1-6",
|
|
35
35
|
"@shoper/jest_config": "^0.0.0",
|
|
36
36
|
"@shoper/tsconfig": "^0.0.0",
|
|
37
37
|
"@splidejs/splide": "4.0.7",
|