@shoper/phoenix_design_system 0.2.1 → 0.2.2-2
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/external/lit-html/async-directive.js +16 -0
- package/build/cjs/external/lit-html/async-directive.js.map +1 -0
- package/build/cjs/external/lit-html/directive-helpers.js +14 -0
- package/build/cjs/external/lit-html/directive-helpers.js.map +1 -0
- package/build/cjs/external/lit-html/directive.js +15 -0
- package/build/cjs/external/lit-html/directive.js.map +1 -0
- package/build/cjs/external/lit-html/directives/ref.js +17 -0
- package/build/cjs/external/lit-html/directives/ref.js.map +1 -0
- package/build/cjs/external/lit-html/lit-html.js +14 -0
- package/build/cjs/external/lit-html/lit-html.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal.js +206 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_backdrop.js +65 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_backdrop.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_body.js +19 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_body.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_close.js +41 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_close.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_constants.js +19 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_footer.js +19 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_footer.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_header.js +19 -0
- package/build/cjs/packages/phoenix/src/components/modal/modal_header.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/portal/portal.js +10 -5
- package/build/cjs/packages/phoenix/src/components/portal/portal.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js +3 -1
- package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/portal/portal_target.js +7 -7
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element.js +34 -1
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element.js.map +1 -1
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js +8 -0
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/index.js +45 -3
- package/build/cjs/packages/phoenix/src/index.js.map +1 -1
- package/build/esm/external/lit-html/async-directive.js +12 -0
- package/build/esm/external/lit-html/async-directive.js.map +1 -0
- package/build/esm/external/lit-html/directive-helpers.js +10 -0
- package/build/esm/external/lit-html/directive-helpers.js.map +1 -0
- package/build/esm/external/lit-html/directive.js +9 -0
- package/build/esm/external/lit-html/directive.js.map +1 -0
- package/build/esm/external/lit-html/directives/ref.js +12 -0
- package/build/esm/external/lit-html/directives/ref.js.map +1 -0
- package/build/esm/external/lit-html/lit-html.js +9 -0
- package/build/esm/external/lit-html/lit-html.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/modal/modal.d.ts +31 -0
- package/build/esm/packages/phoenix/src/components/modal/modal.js +204 -0
- package/build/esm/packages/phoenix/src/components/modal/modal.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.d.ts +12 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.js +63 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_body.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_body.js +17 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_body.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_close.d.ts +8 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_close.js +39 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_close.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_constants.d.ts +9 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_constants.js +12 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_footer.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_footer.js +17 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_footer.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_header.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_header.js +17 -0
- package/build/esm/packages/phoenix/src/components/modal/modal_header.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/portal/portal.d.ts +1 -1
- package/build/esm/packages/phoenix/src/components/portal/portal.js +10 -5
- package/build/esm/packages/phoenix/src/components/portal/portal.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/portal/portal_constants.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/portal/portal_constants.js +3 -2
- package/build/esm/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/portal/portal_target.js +7 -7
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element.d.ts +6 -1
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element.js +35 -2
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element.js.map +1 -1
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_elements_constants.d.ts +1 -0
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js +4 -0
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/index.d.ts +6 -0
- package/build/esm/packages/phoenix/src/index.js +7 -1
- package/build/esm/packages/phoenix/src/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,13 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var tslib_es6 = require('../../../../external/tslib/tslib.es6.js');
|
|
5
6
|
var lit = require('lit');
|
|
7
|
+
var phoenix_light_lit_elements_constants = require('./phoenix_light_lit_elements_constants.js');
|
|
8
|
+
var decorators = require('lit/decorators');
|
|
6
9
|
|
|
7
10
|
class PhoenixLightLitElement extends lit.LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this._slots = {};
|
|
14
|
+
}
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
this._slots = this._assignSlots();
|
|
18
|
+
}
|
|
19
|
+
_assignSlots() {
|
|
20
|
+
return [...this.querySelectorAll('[slot]')].reduce((acc, $el) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const slotName = $el.slot || phoenix_light_lit_elements_constants.DEFAULT_SLOT_NAME;
|
|
23
|
+
acc[slotName] = acc[slotName] || [];
|
|
24
|
+
acc[slotName].push(lit.html `${$el}`);
|
|
25
|
+
(_a = $el.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild($el);
|
|
26
|
+
$el.removeAttribute('slot');
|
|
27
|
+
return acc;
|
|
28
|
+
}, this._slots);
|
|
29
|
+
}
|
|
30
|
+
getSlot(name) {
|
|
31
|
+
try {
|
|
32
|
+
return this._slots[name];
|
|
33
|
+
}
|
|
34
|
+
catch (_a) { }
|
|
35
|
+
return lit.nothing;
|
|
36
|
+
}
|
|
8
37
|
createRenderRoot() {
|
|
9
38
|
return this;
|
|
10
39
|
}
|
|
11
|
-
}
|
|
40
|
+
}
|
|
41
|
+
tslib_es6.__decorate([
|
|
42
|
+
decorators.state(),
|
|
43
|
+
tslib_es6.__metadata("design:type", Object)
|
|
44
|
+
], PhoenixLightLitElement.prototype, "_slots", void 0);
|
|
12
45
|
|
|
13
46
|
exports.PhoenixLightLitElement = PhoenixLightLitElement;
|
|
14
47
|
//# sourceMappingURL=phoenix_light_lit_element.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,wBAAwB,yCAA6C;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -6,8 +6,14 @@ var context_provider_controller = require('./core/context/context_provider_contr
|
|
|
6
6
|
var context_consumer_controller = require('./core/context/context_consumer_controller.js');
|
|
7
7
|
var phoenix_light_lit_element = require('./core/phoenix_light_lit_element.js');
|
|
8
8
|
var hello_button = require('./hello_button.js');
|
|
9
|
-
var portal = require('./components/portal/portal.js');
|
|
10
9
|
var portal_target = require('./components/portal/portal_target.js');
|
|
10
|
+
var portal = require('./components/portal/portal.js');
|
|
11
|
+
var modal = require('./components/modal/modal.js');
|
|
12
|
+
var modal_backdrop = require('./components/modal/modal_backdrop.js');
|
|
13
|
+
var modal_body = require('./components/modal/modal_body.js');
|
|
14
|
+
var modal_footer = require('./components/modal/modal_footer.js');
|
|
15
|
+
var modal_header = require('./components/modal/modal_header.js');
|
|
16
|
+
var modal_close = require('./components/modal/modal_close.js');
|
|
11
17
|
|
|
12
18
|
|
|
13
19
|
|
|
@@ -20,16 +26,52 @@ Object.defineProperty(exports, 'HelloButton', {
|
|
|
20
26
|
return hello_button.HelloButton;
|
|
21
27
|
}
|
|
22
28
|
});
|
|
29
|
+
Object.defineProperty(exports, 'HPortalTarget', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return portal_target.HPortalTarget;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
23
35
|
Object.defineProperty(exports, 'HPortal', {
|
|
24
36
|
enumerable: true,
|
|
25
37
|
get: function () {
|
|
26
38
|
return portal.HPortal;
|
|
27
39
|
}
|
|
28
40
|
});
|
|
29
|
-
Object.defineProperty(exports, '
|
|
41
|
+
Object.defineProperty(exports, 'HModal', {
|
|
30
42
|
enumerable: true,
|
|
31
43
|
get: function () {
|
|
32
|
-
return
|
|
44
|
+
return modal.HModal;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, 'HModalBackdrop', {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return modal_backdrop.HModalBackdrop;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, 'HModalBody', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return modal_body.HModalBody;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, 'HModalFooter', {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () {
|
|
62
|
+
return modal_footer.HModalFooter;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, 'HModalHeader', {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return modal_header.HModalHeader;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, 'HModalClose', {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () {
|
|
74
|
+
return modal_close.HModalClose;
|
|
33
75
|
}
|
|
34
76
|
});
|
|
35
77
|
//# sourceMappingURL=index.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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,12 @@
|
|
|
1
|
+
import { isSingleExpression as r$1 } from './directive-helpers.js';
|
|
2
|
+
import { Directive as i, PartType as t } from './directive.js';
|
|
3
|
+
export { directive } from './directive.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const e=(i,t)=>{var s,o;const n=i._$AN;if(void 0===n)return !1;for(const i of n)null===(o=(s=i)._$AO)||void 0===o||o.call(s,t,!1),e(i,t);return !0},o=i=>{let t,s;do{if(void 0===(t=i._$AM))break;s=t._$AN,s.delete(i),i=t;}while(0===(null==s?void 0:s.size))},n=i=>{for(let t;t=i._$AM;i=t){let s=t._$AN;if(void 0===s)t._$AN=s=new Set;else if(s.has(i))break;s.add(i),l(t);}};function r(i){void 0!==this._$AN?(o(this),this._$AM=i,n(this)):this._$AM=i;}function h(i,t=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(n))for(let i=s;i<n.length;i++)e(n[i],!1),o(n[i]);else null!=n&&(e(n,!1),o(n));else e(this,i);}const l=i=>{var t$1,e,o,n;i.type==t.CHILD&&(null!==(t$1=(o=i)._$AP)&&void 0!==t$1||(o._$AP=h),null!==(e=(n=i)._$AQ)&&void 0!==e||(n._$AQ=r));};class d extends i{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,s){super._$AT(i,t,s),n(this),this.isConnected=i._$AU;}_$AO(i,t=!0){var s,n;i!==this.isConnected&&(this.isConnected=i,i?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),t&&(e(this,i),o(this));}setValue(t){if(r$1(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}}
|
|
10
|
+
|
|
11
|
+
export { d as AsyncDirective };
|
|
12
|
+
//# sourceMappingURL=async-directive.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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
7
|
+
|
|
8
|
+
export { i as Directive, t as PartType, e as directive };
|
|
9
|
+
//# sourceMappingURL=directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { nothing as w } from '../lit-html.js';
|
|
2
|
+
import { directive as e$1 } from '../directive.js';
|
|
3
|
+
import { AsyncDirective as d } from '../async-directive.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2020 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const e=()=>new o;class o{}const h=new WeakMap,n=e$1(class extends d{render(t){return w}update(t,[s]){var e;const o=s!==this.U;return o&&void 0!==this.U&&this.ot(void 0),(o||this.rt!==this.lt)&&(this.U=s,this.ht=null===(e=t.options)||void 0===e?void 0:e.host,this.ot(this.lt=t.element)),w}ot(i){var t;if("function"==typeof this.U){const s=null!==(t=this.ht)&&void 0!==t?t:globalThis;let e=h.get(s);void 0===e&&(e=new WeakMap,h.set(s,e)),void 0!==e.get(this.U)&&this.U.call(this.ht,void 0),e.set(this.U,i),void 0!==i&&this.U.call(this.ht,i);}else this.U.value=i;}get rt(){var i,t,s;return "function"==typeof this.U?null===(t=h.get(null!==(i=this.ht)&&void 0!==i?i:globalThis))||void 0===t?void 0:t.get(this.U):null===(s=this.U)||void 0===s?void 0:s.value}disconnected(){this.rt===this.lt&&this.ot(void 0);}reconnected(){this.ot(this.lt);}});
|
|
10
|
+
|
|
11
|
+
export { e as createRef, n as ref };
|
|
12
|
+
//# sourceMappingURL=ref.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;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
var t;const i=globalThis.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+"").slice(9)}$`,o="?"+e,n=`<${o}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,_=/'/g,m=/"/g,g=/^(?:script|style|textarea|title)$/i,b=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),T=new WeakMap,A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c;for(let i=0;i<o;i++){const s=t[i];let o,u,p=-1,$=0;for(;$<s.length&&(d.lastIndex=$,u=d.exec(s),null!==u);)$=d.lastIndex,d===c?"!--"===u[1]?d=v:void 0!==u[1]?d=a:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f):void 0!==u[3]&&(d=f):d===f?">"===u[0]?(d=null!=h?h:c,p=-1):void 0===u[1]?p=-2:(p=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith("/>")?" ":"";r+=d===c?s+n:p>=0?(l.push(o),s.slice(0,p)+"$lit$"+s.slice(p)+e+y):s+e+(-2===p?(l.push(void 0),i):y);}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return [void 0!==s?s.createHTML(u):u,l]};class E{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=E.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?H:"@"===i[1]?I:S});}else c.push({type:6,index:r});}for(const i of t)l.removeAttribute(i);}if(g.test(l.tagName)){const t=l.textContent.split(e),s=t.length-1;if(s>0){l.textContent=i?i.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h());}}}else if(8===l.nodeType)if(l.data===o)c.push({type:2,index:r});else {let t=-1;for(;-1!==(t=l.data.indexOf(e,t+1));)c.push({type:7,index:r}),t+=e.length-1;}r++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function P(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r(i)?void 0:i._$litDirective$;return (null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=P(t,d._$AS(t,i.values),d,e)),i}class V{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new L(n,this,t)),this.v.push(i),d=e[++r];}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++);}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),r(t)?t===w||null==t||""===t?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):u(t)?this.S(t):this.$(t);}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t));}$(t){this._$AH!==w&&r(this._$AH)?this._$AA.nextSibling.data=t:this.k(l.createTextNode(t)),this._$AH=t;}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=E.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else {const t=new V(o,this),i=t.p(this.options);t.m(s),this.k(i),this._$AH=t;}}_$AC(t){let i=T.get(t.strings);return void 0===i&&T.set(t.strings,i=new E(t)),i}S(t){d(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.M(h()),this.M(h()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=w;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=P(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r(h)||h!==this._$AH[l]),h===w?t=w:t!==w&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.C(t);}C(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class M extends S{constructor(){super(...arguments),this.type=3;}C(t){this.element[this.name]=t===w?void 0:t;}}const k=i?i.emptyScript:"";class H extends S{constructor(){super(...arguments),this.type=4;}C(t){t&&t!==w?this.element.setAttribute(this.name,k):this.element.removeAttribute(this.name);}}class I extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=P(this,t,i,0))&&void 0!==s?s:w)===b)return;const e=this._$AH,o=t===w&&e!==w||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==w&&(e===w||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t);}}const z=window.litHtmlPolyfillSupport;null==z||z(E,N),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.2.5");
|
|
7
|
+
|
|
8
|
+
export { b as noChange, w as nothing };
|
|
9
|
+
//# sourceMappingURL=lit-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element";
|
|
3
|
+
export declare class HModal extends PhoenixLightLitElement {
|
|
4
|
+
opened: boolean;
|
|
5
|
+
customClass: string;
|
|
6
|
+
transition: string;
|
|
7
|
+
_firstFocusableElement: HTMLElement | undefined;
|
|
8
|
+
_focusableElements: HTMLElement[] | null;
|
|
9
|
+
_lastFocusableElement: HTMLElement | undefined;
|
|
10
|
+
private _contentRef;
|
|
11
|
+
private _focusSentinelStart;
|
|
12
|
+
private _focusSentinelEnd;
|
|
13
|
+
private _propsChangeStrategies;
|
|
14
|
+
private static openModals;
|
|
15
|
+
private static _appendModalsPortal;
|
|
16
|
+
private static _appendModalsBackdrop;
|
|
17
|
+
static isSomeModalOpen(): boolean;
|
|
18
|
+
constructor();
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
disconnectedCallback(): void;
|
|
21
|
+
firstUpdated(): void;
|
|
22
|
+
updated(changedProps: Map<string, any>): void;
|
|
23
|
+
private _keepFocusWithinModal;
|
|
24
|
+
private _handleCloseFromCloseComponent;
|
|
25
|
+
private _bindCloseOnEsc;
|
|
26
|
+
open(): void;
|
|
27
|
+
private _dispatchModalOpenedEvent;
|
|
28
|
+
close(): void;
|
|
29
|
+
private _dispatchModalClosedEvent;
|
|
30
|
+
render(): TemplateResult<1>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { property, state, customElement } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element.js';
|
|
5
|
+
import { PORTAL_TARGET_NAME_PROP } from '../portal/portal_constants.js';
|
|
6
|
+
import { MODAL_OPENED_PROP, FOCUSABLE_ELEMENTS_WITHIN_MODAL, MODALS_PORTAL_NAME, MODAL_EVENTS } from './modal_constants.js';
|
|
7
|
+
import { createRef as e, ref as n } from '../../../../../external/lit-html/directives/ref.js';
|
|
8
|
+
|
|
9
|
+
var HModal_1;
|
|
10
|
+
let HModal = HModal_1 = class HModal extends PhoenixLightLitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.opened = false;
|
|
14
|
+
this.customClass = '';
|
|
15
|
+
this.transition = 'slide-in-top';
|
|
16
|
+
this._firstFocusableElement = undefined;
|
|
17
|
+
this._focusableElements = null;
|
|
18
|
+
this._lastFocusableElement = undefined;
|
|
19
|
+
this._contentRef = e();
|
|
20
|
+
this._focusSentinelStart = e();
|
|
21
|
+
this._focusSentinelEnd = e();
|
|
22
|
+
this._propsChangeStrategies = {
|
|
23
|
+
[MODAL_OPENED_PROP]: {
|
|
24
|
+
true: () => {
|
|
25
|
+
const scrollY = window.scrollY;
|
|
26
|
+
HModal_1.openModals = [...HModal_1.openModals, this];
|
|
27
|
+
document.addEventListener('keydown', this._bindCloseOnEsc);
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
(_a = this._firstFocusableElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
31
|
+
window.scrollTo(0, scrollY);
|
|
32
|
+
}, 0);
|
|
33
|
+
},
|
|
34
|
+
false: () => {
|
|
35
|
+
HModal_1.openModals = HModal_1.openModals.filter((modal) => modal !== this);
|
|
36
|
+
document.removeEventListener('keydown', this._bindCloseOnEsc);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this._keepFocusWithinModal = (ev) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const isTabPressed = ev.code === 'Tab';
|
|
43
|
+
if (isTabPressed) {
|
|
44
|
+
if (ev.shiftKey) {
|
|
45
|
+
if (document.activeElement === this._firstFocusableElement) {
|
|
46
|
+
(_a = this._lastFocusableElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
47
|
+
ev.preventDefault();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (document.activeElement === this._lastFocusableElement) {
|
|
51
|
+
(_b = this._firstFocusableElement) === null || _b === void 0 ? void 0 : _b.focus();
|
|
52
|
+
ev.preventDefault();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
this._handleCloseFromCloseComponent = (ev) => {
|
|
57
|
+
var _a;
|
|
58
|
+
ev.stopPropagation();
|
|
59
|
+
if ((_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.contains(ev.target)) {
|
|
60
|
+
this.close();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this._bindCloseOnEsc = (ev) => {
|
|
64
|
+
ev.stopImmediatePropagation();
|
|
65
|
+
const closeConditions = [ev.key === 'Escape', ev.ctrlKey === false, ev.shiftKey === false, ev.altKey === false];
|
|
66
|
+
const shouldCloseModal = closeConditions.every((condition) => condition);
|
|
67
|
+
if (shouldCloseModal) {
|
|
68
|
+
const [modalToClose] = HModal_1.openModals.slice(-1);
|
|
69
|
+
modalToClose === null || modalToClose === void 0 ? void 0 : modalToClose.close();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
this.hidden = true;
|
|
73
|
+
this._focusableElements = [...this.querySelectorAll(FOCUSABLE_ELEMENTS_WITHIN_MODAL)];
|
|
74
|
+
}
|
|
75
|
+
static _appendModalsPortal() {
|
|
76
|
+
const $modalsPortalTarget = document.querySelector(`h-portal-target[name="${MODALS_PORTAL_NAME}"]`);
|
|
77
|
+
if (!$modalsPortalTarget) {
|
|
78
|
+
const $portalTarget = document.createElement('h-portal-target');
|
|
79
|
+
$portalTarget.setAttribute(PORTAL_TARGET_NAME_PROP, MODALS_PORTAL_NAME);
|
|
80
|
+
document.body.appendChild($portalTarget);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
static _appendModalsBackdrop() {
|
|
84
|
+
const $modalsBackdrop = document.querySelector('h-modal-backdrop');
|
|
85
|
+
if (!$modalsBackdrop) {
|
|
86
|
+
const $backdrop = document.createElement('h-modal-backdrop');
|
|
87
|
+
document.body.appendChild($backdrop);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static isSomeModalOpen() {
|
|
91
|
+
return HModal_1.openModals.some((modal) => modal.opened);
|
|
92
|
+
}
|
|
93
|
+
connectedCallback() {
|
|
94
|
+
super.connectedCallback();
|
|
95
|
+
HModal_1._appendModalsPortal();
|
|
96
|
+
HModal_1._appendModalsBackdrop();
|
|
97
|
+
document.addEventListener('keydown', this._keepFocusWithinModal);
|
|
98
|
+
document.addEventListener(MODAL_EVENTS.close, this._handleCloseFromCloseComponent);
|
|
99
|
+
}
|
|
100
|
+
disconnectedCallback() {
|
|
101
|
+
super.disconnectedCallback();
|
|
102
|
+
document.removeEventListener(MODAL_EVENTS.close, this._handleCloseFromCloseComponent);
|
|
103
|
+
document.removeEventListener('keydown', this._bindCloseOnEsc);
|
|
104
|
+
}
|
|
105
|
+
firstUpdated() {
|
|
106
|
+
this._firstFocusableElement = this._focusSentinelStart.value;
|
|
107
|
+
this._lastFocusableElement = this._focusSentinelEnd.value;
|
|
108
|
+
}
|
|
109
|
+
updated(changedProps) {
|
|
110
|
+
if (changedProps.has(MODAL_OPENED_PROP)) {
|
|
111
|
+
this._propsChangeStrategies[MODAL_OPENED_PROP][String(this[MODAL_OPENED_PROP])]();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
open() {
|
|
115
|
+
var _a;
|
|
116
|
+
if (!this[MODAL_OPENED_PROP]) {
|
|
117
|
+
this[MODAL_OPENED_PROP] = true;
|
|
118
|
+
(_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.add(`modal_visible`, `modal_show-${this.transition}-start`);
|
|
119
|
+
window.requestAnimationFrame(() => {
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
var _a;
|
|
122
|
+
(_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.add(`modal_show-${this.transition}-end`);
|
|
123
|
+
}, 0);
|
|
124
|
+
const transitionDuration = parseFloat(getComputedStyle(this._contentRef.value || this).transitionDuration) * 1000;
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
var _a;
|
|
127
|
+
(_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.remove(`modal_show-${this.transition}-start`, `modal_show-${this.transition}-end`);
|
|
128
|
+
this._dispatchModalOpenedEvent();
|
|
129
|
+
}, transitionDuration);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
_dispatchModalOpenedEvent() {
|
|
134
|
+
const openModalEvent = new CustomEvent(MODAL_EVENTS.opened, {
|
|
135
|
+
bubbles: true
|
|
136
|
+
});
|
|
137
|
+
this.dispatchEvent(openModalEvent);
|
|
138
|
+
}
|
|
139
|
+
close() {
|
|
140
|
+
if (this[MODAL_OPENED_PROP]) {
|
|
141
|
+
const transitionDuration = parseFloat(getComputedStyle(this._contentRef.value || this).transitionDuration) * 1000;
|
|
142
|
+
window.requestAnimationFrame(() => {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
(_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.remove(`modal_hide-${this.transition}-start`);
|
|
145
|
+
(_b = this._contentRef.value) === null || _b === void 0 ? void 0 : _b.classList.add(`modal_hide-${this.transition}-end`);
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
var _a;
|
|
148
|
+
(_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.remove(`modal_hide-${this.transition}-start`, `modal_hide-${this.transition}-end`);
|
|
149
|
+
this[MODAL_OPENED_PROP] = false;
|
|
150
|
+
this._dispatchModalClosedEvent();
|
|
151
|
+
}, transitionDuration);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
_dispatchModalClosedEvent() {
|
|
156
|
+
const closeModalEvent = new CustomEvent(MODAL_EVENTS.closed, {
|
|
157
|
+
bubbles: true
|
|
158
|
+
});
|
|
159
|
+
this.dispatchEvent(closeModalEvent);
|
|
160
|
+
}
|
|
161
|
+
render() {
|
|
162
|
+
return html `
|
|
163
|
+
<h-portal ?disabled="${!this.opened}" to="${MODALS_PORTAL_NAME}" hidden>
|
|
164
|
+
<div tabindex="0" ${n(this._focusSentinelStart)}></div>
|
|
165
|
+
<div ${n(this._contentRef)} class="modal ${this.customClass}" role="dialog">
|
|
166
|
+
<div class="modal__container">${this.getSlot('header')} ${this.getSlot('default')} ${this.getSlot('footer')}</div>
|
|
167
|
+
</div>
|
|
168
|
+
<div tabindex="0" ${n(this._focusSentinelEnd)}></div>
|
|
169
|
+
</h-portal>
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
HModal.openModals = [];
|
|
174
|
+
__decorate([
|
|
175
|
+
property({ type: Boolean, reflect: true }),
|
|
176
|
+
__metadata("design:type", Object)
|
|
177
|
+
], HModal.prototype, "opened", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ type: String }),
|
|
180
|
+
__metadata("design:type", Object)
|
|
181
|
+
], HModal.prototype, "customClass", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
property({ type: String }),
|
|
184
|
+
__metadata("design:type", Object)
|
|
185
|
+
], HModal.prototype, "transition", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
state(),
|
|
188
|
+
__metadata("design:type", Object)
|
|
189
|
+
], HModal.prototype, "_firstFocusableElement", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
state(),
|
|
192
|
+
__metadata("design:type", Object)
|
|
193
|
+
], HModal.prototype, "_focusableElements", void 0);
|
|
194
|
+
__decorate([
|
|
195
|
+
state(),
|
|
196
|
+
__metadata("design:type", Object)
|
|
197
|
+
], HModal.prototype, "_lastFocusableElement", void 0);
|
|
198
|
+
HModal = HModal_1 = __decorate([
|
|
199
|
+
customElement('h-modal'),
|
|
200
|
+
__metadata("design:paramtypes", [])
|
|
201
|
+
], HModal);
|
|
202
|
+
|
|
203
|
+
export { HModal };
|
|
204
|
+
//# sourceMappingURL=modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA,yCAAyC,oDAAwD;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,12 @@
|
|
|
1
|
+
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element";
|
|
2
|
+
export declare class HModalBackdrop extends PhoenixLightLitElement {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
private _show;
|
|
7
|
+
private _hide;
|
|
8
|
+
protected updated(): void;
|
|
9
|
+
private _disableScrolling;
|
|
10
|
+
private _enableScrolling;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element.js';
|
|
5
|
+
import { MODAL_EVENTS } from './modal_constants.js';
|
|
6
|
+
import { HModal } from './modal.js';
|
|
7
|
+
|
|
8
|
+
let HModalBackdrop = class HModalBackdrop extends PhoenixLightLitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.visible = false;
|
|
12
|
+
this._show = () => {
|
|
13
|
+
if (!this.visible) {
|
|
14
|
+
this.visible = true;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
this._hide = () => {
|
|
18
|
+
if (!HModal.isSomeModalOpen()) {
|
|
19
|
+
this.visible = false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
super.connectedCallback();
|
|
25
|
+
document.addEventListener(MODAL_EVENTS.opened, this._show);
|
|
26
|
+
document.addEventListener(MODAL_EVENTS.closed, this._hide);
|
|
27
|
+
}
|
|
28
|
+
disconnectedCallback() {
|
|
29
|
+
super.disconnectedCallback();
|
|
30
|
+
document.removeEventListener(MODAL_EVENTS.opened, this._show);
|
|
31
|
+
document.removeEventListener(MODAL_EVENTS.closed, this._hide);
|
|
32
|
+
}
|
|
33
|
+
updated() {
|
|
34
|
+
if (HModal.isSomeModalOpen()) {
|
|
35
|
+
this.visible = true;
|
|
36
|
+
this._disableScrolling();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this._enableScrolling();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_disableScrolling() {
|
|
43
|
+
document.body.style.overflow = 'hidden';
|
|
44
|
+
document.body.style.paddingRight = '15px';
|
|
45
|
+
}
|
|
46
|
+
_enableScrolling() {
|
|
47
|
+
document.body.style.removeProperty('overflow');
|
|
48
|
+
document.body.style.removeProperty('padding-right');
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
return html `<div aria-hidden="true" ?hidden="${!this.visible}" class="modal-backdrop"></div>`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
__decorate([
|
|
55
|
+
property({ type: Boolean }),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], HModalBackdrop.prototype, "visible", void 0);
|
|
58
|
+
HModalBackdrop = __decorate([
|
|
59
|
+
customElement('h-modal-backdrop')
|
|
60
|
+
], HModalBackdrop);
|
|
61
|
+
|
|
62
|
+
export { HModalBackdrop };
|
|
63
|
+
//# sourceMappingURL=modal_backdrop.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { customElement } from 'lit/decorators';
|
|
3
|
+
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element.js';
|
|
4
|
+
|
|
5
|
+
let HModalBody = class HModalBody extends PhoenixLightLitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.slot = this.hasAttribute('slot') ? this.slot : 'default';
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
HModalBody = __decorate([
|
|
12
|
+
customElement('h-modal-body'),
|
|
13
|
+
__metadata("design:paramtypes", [])
|
|
14
|
+
], HModalBody);
|
|
15
|
+
|
|
16
|
+
export { HModalBody };
|
|
17
|
+
//# sourceMappingURL=modal_body.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element";
|
|
2
|
+
export declare class HModalClose extends PhoenixLightLitElement {
|
|
3
|
+
constructor();
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
private _dispatchModalCloseEvent;
|
|
7
|
+
private _dispatchModalCloseOnEnterEvent;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { customElement } from 'lit/decorators';
|
|
3
|
+
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element.js';
|
|
4
|
+
import { MODAL_EVENTS } from './modal_constants.js';
|
|
5
|
+
|
|
6
|
+
let HModalClose = class HModalClose extends PhoenixLightLitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.tabIndex = 0;
|
|
10
|
+
this.setAttribute('role', 'button');
|
|
11
|
+
}
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
super.connectedCallback();
|
|
14
|
+
this.addEventListener('click', this._dispatchModalCloseEvent);
|
|
15
|
+
this.addEventListener('keydown', this._dispatchModalCloseOnEnterEvent);
|
|
16
|
+
}
|
|
17
|
+
disconnectedCallback() {
|
|
18
|
+
this.removeEventListener('click', this._dispatchModalCloseEvent);
|
|
19
|
+
this.removeEventListener('keydown', this._dispatchModalCloseOnEnterEvent);
|
|
20
|
+
}
|
|
21
|
+
_dispatchModalCloseEvent() {
|
|
22
|
+
const closeModalEvent = new CustomEvent(MODAL_EVENTS.close, {
|
|
23
|
+
bubbles: true
|
|
24
|
+
});
|
|
25
|
+
this.dispatchEvent(closeModalEvent);
|
|
26
|
+
}
|
|
27
|
+
_dispatchModalCloseOnEnterEvent(ev) {
|
|
28
|
+
if (ev.code === 'Enter' || ev.code === 'Space') {
|
|
29
|
+
this._dispatchModalCloseEvent();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
HModalClose = __decorate([
|
|
34
|
+
customElement('h-modal-close'),
|
|
35
|
+
__metadata("design:paramtypes", [])
|
|
36
|
+
], HModalClose);
|
|
37
|
+
|
|
38
|
+
export { HModalClose };
|
|
39
|
+
//# sourceMappingURL=modal_close.js.map
|
|
@@ -0,0 +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;"}
|