@shoper/phoenix_design_system 0.2.0 → 0.2.2-1

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.
Files changed (86) hide show
  1. package/build/cjs/external/lit-html/async-directive.js +16 -0
  2. package/build/cjs/external/lit-html/async-directive.js.map +1 -0
  3. package/build/cjs/external/lit-html/directive-helpers.js +14 -0
  4. package/build/cjs/external/lit-html/directive-helpers.js.map +1 -0
  5. package/build/cjs/external/lit-html/directive.js +15 -0
  6. package/build/cjs/external/lit-html/directive.js.map +1 -0
  7. package/build/cjs/external/lit-html/directives/ref.js +17 -0
  8. package/build/cjs/external/lit-html/directives/ref.js.map +1 -0
  9. package/build/cjs/external/lit-html/lit-html.js +14 -0
  10. package/build/cjs/external/lit-html/lit-html.js.map +1 -0
  11. package/build/cjs/packages/phoenix/src/components/modal/modal.js +176 -0
  12. package/build/cjs/packages/phoenix/src/components/modal/modal.js.map +1 -0
  13. package/build/cjs/packages/phoenix/src/components/modal/modal_backdrop.js +65 -0
  14. package/build/cjs/packages/phoenix/src/components/modal/modal_backdrop.js.map +1 -0
  15. package/build/cjs/packages/phoenix/src/components/modal/modal_body.js +19 -0
  16. package/build/cjs/packages/phoenix/src/components/modal/modal_body.js.map +1 -0
  17. package/build/cjs/packages/phoenix/src/components/modal/modal_close.js +41 -0
  18. package/build/cjs/packages/phoenix/src/components/modal/modal_close.js.map +1 -0
  19. package/build/cjs/packages/phoenix/src/components/modal/modal_constants.js +19 -0
  20. package/build/cjs/packages/phoenix/src/components/modal/modal_constants.js.map +1 -0
  21. package/build/cjs/packages/phoenix/src/components/modal/modal_footer.js +19 -0
  22. package/build/cjs/packages/phoenix/src/components/modal/modal_footer.js.map +1 -0
  23. package/build/cjs/packages/phoenix/src/components/modal/modal_header.js +19 -0
  24. package/build/cjs/packages/phoenix/src/components/modal/modal_header.js.map +1 -0
  25. package/build/cjs/packages/phoenix/src/components/portal/portal.js +19 -14
  26. package/build/cjs/packages/phoenix/src/components/portal/portal.js.map +1 -1
  27. package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js +3 -1
  28. package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
  29. package/build/cjs/packages/phoenix/src/components/portal/portal_target.js +9 -10
  30. package/build/cjs/packages/phoenix/src/components/portal/portal_target.js.map +1 -1
  31. package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element.js +35 -1
  32. package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element.js.map +1 -1
  33. package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js +8 -0
  34. package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js.map +1 -0
  35. package/build/cjs/packages/phoenix/src/index.js +45 -3
  36. package/build/cjs/packages/phoenix/src/index.js.map +1 -1
  37. package/build/esm/external/lit-html/async-directive.js +12 -0
  38. package/build/esm/external/lit-html/async-directive.js.map +1 -0
  39. package/build/esm/external/lit-html/directive-helpers.js +10 -0
  40. package/build/esm/external/lit-html/directive-helpers.js.map +1 -0
  41. package/build/esm/external/lit-html/directive.js +9 -0
  42. package/build/esm/external/lit-html/directive.js.map +1 -0
  43. package/build/esm/external/lit-html/directives/ref.js +12 -0
  44. package/build/esm/external/lit-html/directives/ref.js.map +1 -0
  45. package/build/esm/external/lit-html/lit-html.js +9 -0
  46. package/build/esm/external/lit-html/lit-html.js.map +1 -0
  47. package/build/esm/packages/phoenix/src/components/modal/modal.d.ts +30 -0
  48. package/build/esm/packages/phoenix/src/components/modal/modal.js +174 -0
  49. package/build/esm/packages/phoenix/src/components/modal/modal.js.map +1 -0
  50. package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.d.ts +12 -0
  51. package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.js +63 -0
  52. package/build/esm/packages/phoenix/src/components/modal/modal_backdrop.js.map +1 -0
  53. package/build/esm/packages/phoenix/src/components/modal/modal_body.d.ts +4 -0
  54. package/build/esm/packages/phoenix/src/components/modal/modal_body.js +17 -0
  55. package/build/esm/packages/phoenix/src/components/modal/modal_body.js.map +1 -0
  56. package/build/esm/packages/phoenix/src/components/modal/modal_close.d.ts +8 -0
  57. package/build/esm/packages/phoenix/src/components/modal/modal_close.js +39 -0
  58. package/build/esm/packages/phoenix/src/components/modal/modal_close.js.map +1 -0
  59. package/build/esm/packages/phoenix/src/components/modal/modal_constants.d.ts +9 -0
  60. package/build/esm/packages/phoenix/src/components/modal/modal_constants.js +12 -0
  61. package/build/esm/packages/phoenix/src/components/modal/modal_constants.js.map +1 -0
  62. package/build/esm/packages/phoenix/src/components/modal/modal_footer.d.ts +4 -0
  63. package/build/esm/packages/phoenix/src/components/modal/modal_footer.js +17 -0
  64. package/build/esm/packages/phoenix/src/components/modal/modal_footer.js.map +1 -0
  65. package/build/esm/packages/phoenix/src/components/modal/modal_header.d.ts +4 -0
  66. package/build/esm/packages/phoenix/src/components/modal/modal_header.js +17 -0
  67. package/build/esm/packages/phoenix/src/components/modal/modal_header.js.map +1 -0
  68. package/build/esm/packages/phoenix/src/components/portal/portal.d.ts +3 -3
  69. package/build/esm/packages/phoenix/src/components/portal/portal.js +19 -14
  70. package/build/esm/packages/phoenix/src/components/portal/portal.js.map +1 -1
  71. package/build/esm/packages/phoenix/src/components/portal/portal_constants.d.ts +3 -0
  72. package/build/esm/packages/phoenix/src/components/portal/portal_constants.js +3 -2
  73. package/build/esm/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
  74. package/build/esm/packages/phoenix/src/components/portal/portal_target.d.ts +0 -1
  75. package/build/esm/packages/phoenix/src/components/portal/portal_target.js +9 -10
  76. package/build/esm/packages/phoenix/src/components/portal/portal_target.js.map +1 -1
  77. package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element.d.ts +6 -1
  78. package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element.js +36 -2
  79. package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element.js.map +1 -1
  80. package/build/esm/packages/phoenix/src/core/phoenix_light_lit_elements_constants.d.ts +1 -0
  81. package/build/esm/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js +4 -0
  82. package/build/esm/packages/phoenix/src/core/phoenix_light_lit_elements_constants.js.map +1 -0
  83. package/build/esm/packages/phoenix/src/index.d.ts +6 -0
  84. package/build/esm/packages/phoenix/src/index.js +7 -1
  85. package/build/esm/packages/phoenix/src/index.js.map +1 -1
  86. package/package.json +1 -1
@@ -3,15 +3,15 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
- var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element.js');
7
6
  var decorators = require('lit/decorators');
8
- var portal_constants = require('./portal_constants.js');
7
+ var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element.js');
9
8
  var portal_target_error = require('./portal_target_error.js');
9
+ var portal_constants = require('./portal_constants.js');
10
10
 
11
11
  var HPortalTarget_1;
12
12
  exports.HPortalTarget = HPortalTarget_1 = class HPortalTarget extends phoenix_light_lit_element.PhoenixLightLitElement {
13
13
  constructor() {
14
- super();
14
+ super(...arguments);
15
15
  this.name = '';
16
16
  this._portalElementsMap = {};
17
17
  this.portalElements = ({ detail: { portalId, content, to } }) => {
@@ -48,17 +48,17 @@ exports.HPortalTarget = HPortalTarget_1 = class HPortalTarget extends phoenix_li
48
48
  super.disconnectedCallback();
49
49
  document.removeEventListener(portal_constants.PORTAL_EVENTS.open, this.portalElements);
50
50
  document.removeEventListener(portal_constants.PORTAL_EVENTS.close, this.removeTeleportedItems);
51
- HPortalTarget_1.portalTargetsNames.delete(this.name);
51
+ HPortalTarget_1.portalTargetsNames.delete(this[portal_constants.PORTAL_TARGET_NAME_PROP]);
52
52
  }
53
53
  doesDestinationMatch(destination) {
54
- return destination === this.name;
54
+ return destination === this[portal_constants.PORTAL_TARGET_NAME_PROP];
55
55
  }
56
56
  allowOnlyOnePortalTargetWithName() {
57
- if (HPortalTarget_1.portalTargetsNames.has(this.name)) {
57
+ if (HPortalTarget_1.portalTargetsNames.has(this[portal_constants.PORTAL_TARGET_NAME_PROP])) {
58
58
  this.remove();
59
- throw new portal_target_error.PortalTargetError(`Portal target with name "${this.name}" already exists.`);
59
+ throw new portal_target_error.PortalTargetError(`Portal target with name "${this[portal_constants.PORTAL_TARGET_NAME_PROP]}" already exists.`);
60
60
  }
61
- HPortalTarget_1.portalTargetsNames.add(this.name);
61
+ HPortalTarget_1.portalTargetsNames.add(this[portal_constants.PORTAL_TARGET_NAME_PROP]);
62
62
  }
63
63
  };
64
64
  exports.HPortalTarget.portalTargetsNames = new Set();
@@ -71,7 +71,6 @@ tslib_es6.__decorate([
71
71
  tslib_es6.__metadata("design:type", Object)
72
72
  ], exports.HPortalTarget.prototype, "_portalElementsMap", void 0);
73
73
  exports.HPortalTarget = HPortalTarget_1 = tslib_es6.__decorate([
74
- decorators.customElement('h-portal-target'),
75
- tslib_es6.__metadata("design:paramtypes", [])
74
+ decorators.customElement('h-portal-target')
76
75
  ], exports.HPortalTarget);
77
76
  //# sourceMappingURL=portal_target.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;"}
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;"}
@@ -2,13 +2,47 @@
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
+ console.log(this, 2);
21
+ return [...this.querySelectorAll('[slot]')].reduce((acc, $el) => {
22
+ var _a;
23
+ const slotName = $el.slot || phoenix_light_lit_elements_constants.DEFAULT_SLOT_NAME;
24
+ acc[slotName] = acc[slotName] || [];
25
+ acc[slotName].push(lit.html `${$el}`);
26
+ (_a = $el.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild($el);
27
+ $el.removeAttribute('slot');
28
+ return acc;
29
+ }, this._slots);
30
+ }
31
+ getSlot(name) {
32
+ try {
33
+ return this._slots[name];
34
+ }
35
+ catch (_a) { }
36
+ return lit.nothing;
37
+ }
8
38
  createRenderRoot() {
9
39
  return this;
10
40
  }
11
- }
41
+ }
42
+ tslib_es6.__decorate([
43
+ decorators.state(),
44
+ tslib_es6.__metadata("design:type", Object)
45
+ ], PhoenixLightLitElement.prototype, "_slots", void 0);
12
46
 
13
47
  exports.PhoenixLightLitElement = PhoenixLightLitElement;
14
48
  //# 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;AACA;"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const DEFAULT_SLOT_NAME = 'default';
6
+
7
+ exports.DEFAULT_SLOT_NAME = DEFAULT_SLOT_NAME;
8
+ //# sourceMappingURL=phoenix_light_lit_elements_constants.js.map
@@ -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, 'HPortalTarget', {
41
+ Object.defineProperty(exports, 'HModal', {
30
42
  enumerable: true,
31
43
  get: function () {
32
- return portal_target.HPortalTarget;
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,10 @@
1
+ import './lit-html.js';
2
+
3
+ /**
4
+ * @license
5
+ * Copyright 2020 Google LLC
6
+ * SPDX-License-Identifier: BSD-3-Clause
7
+ */const r=o=>void 0===o.strings;
8
+
9
+ export { r as isSingleExpression };
10
+ //# sourceMappingURL=directive-helpers.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;"}
@@ -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,30 @@
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
+ _firstFocusableElement: HTMLElement | undefined;
7
+ _focusableElements: HTMLElement[] | null;
8
+ _lastFocusableElement: HTMLElement | undefined;
9
+ private _contentRef;
10
+ private _focusSentinelStart;
11
+ private _focusSentinelEnd;
12
+ private _propsChangeStrategies;
13
+ private static openModals;
14
+ private static _appendModalsPortal;
15
+ private static _appendModalsBackdrop;
16
+ static isSomeModalOpen(): boolean;
17
+ constructor();
18
+ connectedCallback(): void;
19
+ disconnectedCallback(): void;
20
+ firstUpdated(): void;
21
+ updated(changedProps: Map<string, any>): void;
22
+ private _keepFocusWithinModal;
23
+ private _handleCloseFromCloseComponent;
24
+ private _bindCloseOnEsc;
25
+ open(): void;
26
+ private _dispatchModalOpenedEvent;
27
+ close(): void;
28
+ private _dispatchModalClosedEvent;
29
+ render(): TemplateResult<1>;
30
+ }
@@ -0,0 +1,174 @@
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._firstFocusableElement = undefined;
16
+ this._focusableElements = null;
17
+ this._lastFocusableElement = undefined;
18
+ this._contentRef = e();
19
+ this._focusSentinelStart = e();
20
+ this._focusSentinelEnd = e();
21
+ this._propsChangeStrategies = {
22
+ [MODAL_OPENED_PROP]: {
23
+ true: () => {
24
+ HModal_1.openModals = [...HModal_1.openModals, this];
25
+ document.addEventListener('keydown', this._bindCloseOnEsc);
26
+ setTimeout(() => {
27
+ var _a;
28
+ (_a = this._firstFocusableElement) === null || _a === void 0 ? void 0 : _a.focus();
29
+ }, 0);
30
+ },
31
+ false: () => {
32
+ HModal_1.openModals = HModal_1.openModals.filter((modal) => modal !== this);
33
+ document.removeEventListener('keydown', this._bindCloseOnEsc);
34
+ }
35
+ }
36
+ };
37
+ this._keepFocusWithinModal = (ev) => {
38
+ var _a, _b;
39
+ const isTabPressed = ev.code === 'Tab';
40
+ if (isTabPressed) {
41
+ if (ev.shiftKey) {
42
+ if (document.activeElement === this._firstFocusableElement) {
43
+ (_a = this._lastFocusableElement) === null || _a === void 0 ? void 0 : _a.focus();
44
+ ev.preventDefault();
45
+ }
46
+ }
47
+ else if (document.activeElement === this._lastFocusableElement) {
48
+ (_b = this._firstFocusableElement) === null || _b === void 0 ? void 0 : _b.focus();
49
+ ev.preventDefault();
50
+ }
51
+ }
52
+ };
53
+ this._handleCloseFromCloseComponent = (ev) => {
54
+ var _a;
55
+ ev.stopPropagation();
56
+ if ((_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.contains(ev.target)) {
57
+ this.close();
58
+ }
59
+ };
60
+ this._bindCloseOnEsc = (ev) => {
61
+ ev.stopImmediatePropagation();
62
+ const closeConditions = [ev.key === 'Escape', ev.ctrlKey === false, ev.shiftKey === false, ev.altKey === false];
63
+ const shouldCloseModal = closeConditions.every((condition) => condition);
64
+ if (shouldCloseModal) {
65
+ const [modalToClose] = HModal_1.openModals.slice(-1);
66
+ modalToClose === null || modalToClose === void 0 ? void 0 : modalToClose.close();
67
+ }
68
+ };
69
+ this.hidden = true;
70
+ this._focusableElements = [...this.querySelectorAll(FOCUSABLE_ELEMENTS_WITHIN_MODAL)];
71
+ }
72
+ static _appendModalsPortal() {
73
+ const $modalsPortalTarget = document.querySelector(`h-portal-target[name="${MODALS_PORTAL_NAME}"]`);
74
+ if (!$modalsPortalTarget) {
75
+ const $portalTarget = document.createElement('h-portal-target');
76
+ $portalTarget.setAttribute(PORTAL_TARGET_NAME_PROP, MODALS_PORTAL_NAME);
77
+ document.body.appendChild($portalTarget);
78
+ }
79
+ }
80
+ static _appendModalsBackdrop() {
81
+ const $modalsBackdrop = document.querySelector('h-modal-backdrop');
82
+ if (!$modalsBackdrop) {
83
+ const $backdrop = document.createElement('h-modal-backdrop');
84
+ document.body.appendChild($backdrop);
85
+ }
86
+ }
87
+ static isSomeModalOpen() {
88
+ return HModal_1.openModals.some((modal) => modal.opened);
89
+ }
90
+ connectedCallback() {
91
+ super.connectedCallback();
92
+ HModal_1._appendModalsPortal();
93
+ HModal_1._appendModalsBackdrop();
94
+ document.addEventListener('keydown', this._keepFocusWithinModal);
95
+ document.addEventListener(MODAL_EVENTS.close, this._handleCloseFromCloseComponent);
96
+ }
97
+ disconnectedCallback() {
98
+ super.disconnectedCallback();
99
+ document.removeEventListener(MODAL_EVENTS.close, this._handleCloseFromCloseComponent);
100
+ document.removeEventListener('keydown', this._bindCloseOnEsc);
101
+ }
102
+ firstUpdated() {
103
+ this._firstFocusableElement = this._focusSentinelStart.value;
104
+ this._lastFocusableElement = this._focusSentinelEnd.value;
105
+ }
106
+ updated(changedProps) {
107
+ if (changedProps.has(MODAL_OPENED_PROP)) {
108
+ this._propsChangeStrategies[MODAL_OPENED_PROP][String(this[MODAL_OPENED_PROP])]();
109
+ }
110
+ }
111
+ open() {
112
+ if (!this[MODAL_OPENED_PROP]) {
113
+ this[MODAL_OPENED_PROP] = true;
114
+ this._dispatchModalOpenedEvent();
115
+ }
116
+ }
117
+ _dispatchModalOpenedEvent() {
118
+ const openModalEvent = new CustomEvent(MODAL_EVENTS.opened, {
119
+ bubbles: true
120
+ });
121
+ this.dispatchEvent(openModalEvent);
122
+ }
123
+ close() {
124
+ if (this[MODAL_OPENED_PROP]) {
125
+ this[MODAL_OPENED_PROP] = false;
126
+ this._dispatchModalClosedEvent();
127
+ }
128
+ }
129
+ _dispatchModalClosedEvent() {
130
+ const closeModalEvent = new CustomEvent(MODAL_EVENTS.closed, {
131
+ bubbles: true
132
+ });
133
+ this.dispatchEvent(closeModalEvent);
134
+ }
135
+ render() {
136
+ return html `
137
+ <h-portal ?disabled="${!this.opened}" to="${MODALS_PORTAL_NAME}" hidden>
138
+ <div tabindex="0" ${n(this._focusSentinelStart)}></div>
139
+ <div ${n(this._contentRef)} class="modal ${this.customClass}" role="dialog">
140
+ <div class="modal__container">${this.getSlot('header')} ${this.getSlot('default')} ${this.getSlot('footer')}</div>
141
+ </div>
142
+ <div tabindex="0" ${n(this._focusSentinelEnd)}></div>
143
+ </h-portal>
144
+ `;
145
+ }
146
+ };
147
+ HModal.openModals = [];
148
+ __decorate([
149
+ property({ type: Boolean, reflect: true }),
150
+ __metadata("design:type", Object)
151
+ ], HModal.prototype, "opened", void 0);
152
+ __decorate([
153
+ property({ type: String }),
154
+ __metadata("design:type", Object)
155
+ ], HModal.prototype, "customClass", void 0);
156
+ __decorate([
157
+ state(),
158
+ __metadata("design:type", Object)
159
+ ], HModal.prototype, "_firstFocusableElement", void 0);
160
+ __decorate([
161
+ state(),
162
+ __metadata("design:type", Object)
163
+ ], HModal.prototype, "_focusableElements", void 0);
164
+ __decorate([
165
+ state(),
166
+ __metadata("design:type", Object)
167
+ ], HModal.prototype, "_lastFocusableElement", void 0);
168
+ HModal = HModal_1 = __decorate([
169
+ customElement('h-modal'),
170
+ __metadata("design:paramtypes", [])
171
+ ], HModal);
172
+
173
+ export { HModal };
174
+ //# 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;"}
@@ -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,4 @@
1
+ import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element";
2
+ export declare class HModalBody extends PhoenixLightLitElement {
3
+ constructor();
4
+ }
@@ -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
+ }