@justeattakeaway/pie-modal 0.4.0 → 0.6.0
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/.turbo/turbo-build.log +13 -8
- package/CHANGELOG.md +14 -0
- package/dist/index.js +97 -81
- package/dist/react.js +209 -223
- package/dist/types/packages/components/pie-modal/src/defs.d.ts +23 -8
- package/dist/types/packages/components/pie-modal/src/defs.d.ts.map +1 -1
- package/dist/types/packages/components/pie-modal/src/index.d.ts +15 -5
- package/dist/types/packages/components/pie-modal/src/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/defs.ts +25 -8
- package/src/index.ts +40 -13
- package/src/modal.scss +60 -49
- package/test/component/pie-modal.spec.ts +31 -5
- package/test/visual/pie-modal.spec.ts +2 -1
- package/vite.config.js +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
[
|
|
1
|
+
[3:10:46 PM] @custom-elements-manifest/analyzer: Created new manifest.
|
|
2
2
|
react wrapper has been added!
|
|
3
|
-
|
|
3
|
+
[36mvite v4.3.9 [32mbuilding for production...[36m[39m
|
|
4
4
|
transforming...
|
|
5
|
-
|
|
5
|
+
[32m✓[39m 28 modules transformed.
|
|
6
6
|
rendering chunks...
|
|
7
7
|
computing gzip size...
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m 7.43 kB[22m[1m[22m[2m │ gzip: 2.38 kB[22m
|
|
9
|
+
[2mdist/[22m[36mreact.js [39m[1m[2m59.04 kB[22m[1m[22m[2m │ gzip: 15.92 kB[22m
|
|
10
|
+
[32m
|
|
11
|
+
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
12
|
+
[96msrc/index.ts[0m:[93m27[0m:[93m9[0m - [91merror[0m[90m TS2564: [0mProperty '_dialog' has no initializer and is not definitely assigned in the constructor.
|
|
10
13
|
|
|
11
|
-
[
|
|
12
|
-
|
|
13
|
-
[vite:dts] Declaration files built in 5339ms.
|
|
14
|
+
[7m27[0m _dialog: HTMLDialogElement;
|
|
15
|
+
[7m [0m [91m ~~~~~~~[0m
|
|
14
16
|
|
|
17
|
+
[32m✓ built in 28.25s[39m
|
|
18
|
+
[32m[36m[vite:dts][32m Declaration files built in 26028ms.
|
|
19
|
+
[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @justeattakeaway/pie-modal
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [Changed] - Updated styles to use custom props ([#551](https://github.com/justeattakeaway/pie/pull/551)) by [@ashleynolan](https://github.com/ashleynolan)
|
|
8
|
+
|
|
9
|
+
- [Added] - close button to modal ([#549](https://github.com/justeattakeaway/pie/pull/549)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
|
|
10
|
+
|
|
11
|
+
## 0.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [Updated] - enum types to string union types to string union types ([#508](https://github.com/justeattakeaway/pie/pull/508)) by [@FayeCarter](https://github.com/FayeCarter)
|
|
16
|
+
|
|
3
17
|
## 0.4.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { unsafeStatic as
|
|
3
|
-
import { property as
|
|
4
|
-
import { property as
|
|
5
|
-
var
|
|
6
|
-
for (var e =
|
|
7
|
-
(i =
|
|
8
|
-
return
|
|
1
|
+
import { unsafeCSS as g, LitElement as v, html as m } from "lit";
|
|
2
|
+
import { unsafeStatic as u, html as b } from "lit/static-html.js";
|
|
3
|
+
import { property as s, query as _ } from "lit/decorators.js";
|
|
4
|
+
import { property as w } from "lit/decorators/property.js";
|
|
5
|
+
var y = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, P = (r, t, n, o) => {
|
|
6
|
+
for (var e = o > 1 ? void 0 : o ? $(t, n) : t, a = r.length - 1, i; a >= 0; a--)
|
|
7
|
+
(i = r[a]) && (e = (o ? i(t, n, e) : i(e)) || e);
|
|
8
|
+
return o && e && y(t, n, e), e;
|
|
9
9
|
};
|
|
10
|
-
const
|
|
11
|
-
class
|
|
10
|
+
const O = (r) => {
|
|
11
|
+
class t extends r {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments), this.dir = "";
|
|
14
14
|
}
|
|
@@ -22,47 +22,47 @@ const _ = (n) => {
|
|
|
22
22
|
* will not be reactive and is only computed once
|
|
23
23
|
*/
|
|
24
24
|
get isRTL() {
|
|
25
|
-
var
|
|
26
|
-
return this.dir === "ltr" ? !1 : this.dir === "rtl" || ((
|
|
25
|
+
var o;
|
|
26
|
+
return this.dir === "ltr" ? !1 : this.dir === "rtl" || ((o = window == null ? void 0 : window.getComputedStyle(this)) == null ? void 0 : o.direction) === "rtl";
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
const
|
|
34
|
-
Object.defineProperty(
|
|
29
|
+
return P([
|
|
30
|
+
w({ type: String })
|
|
31
|
+
], t.prototype, "dir", 2), t;
|
|
32
|
+
}, C = (r, t, n) => function(o, e) {
|
|
33
|
+
const a = `#${e}`;
|
|
34
|
+
Object.defineProperty(o, e, {
|
|
35
35
|
get() {
|
|
36
|
-
return this[
|
|
36
|
+
return this[a];
|
|
37
37
|
},
|
|
38
38
|
set(i) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
`<${
|
|
42
|
-
`Must be one of: ${
|
|
43
|
-
`Falling back to default value: "${
|
|
44
|
-
), this[
|
|
39
|
+
const f = this[a];
|
|
40
|
+
t.includes(i) ? this[a] = i : (console.error(
|
|
41
|
+
`<${r}> Invalid value "${i}" provided for property "${e}".`,
|
|
42
|
+
`Must be one of: ${t.join(" | ")}.`,
|
|
43
|
+
`Falling back to default value: "${n}"`
|
|
44
|
+
), this[a] = n), this.requestUpdate(e, f);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
},
|
|
48
|
-
const
|
|
49
|
-
Object.defineProperty(
|
|
47
|
+
}, x = (r) => function(t, n) {
|
|
48
|
+
const o = `#${n}`;
|
|
49
|
+
Object.defineProperty(t, n, {
|
|
50
50
|
get() {
|
|
51
|
-
return this[
|
|
51
|
+
return this[o];
|
|
52
52
|
},
|
|
53
53
|
set(e) {
|
|
54
|
-
const
|
|
55
|
-
(e == null || e === "") && console.error(`<${
|
|
54
|
+
const a = this[o];
|
|
55
|
+
(e == null || e === "") && console.error(`<${r}> Missing required attribute "${n}"`), this[o] = e, this.requestUpdate(n, a);
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
},
|
|
58
|
+
}, z = `.c-webComponentTestWrapper{padding-block:var(--dt-spacing-c);padding-inline:var(--dt-spacing-e);font-family:var(--dt-font-interactive-m-family);font-size:calc(var(--dt-font-size-20) * 1px);border:1px solid var(--dt-color-background-dark);display:grid;grid-template-columns:1fr 1fr}.c-webComponentTestWrapper-label{margin-block:var(--dt-spacing-c)}.c-webComponentTestWrapper-slot{padding:var(--dt-spacing-c);border:1px dashed var(--dt-color-background-dark);grid-column:1/3;margin-block-start:var(--dt-spacing-c)}
|
|
59
59
|
`;
|
|
60
|
-
var
|
|
61
|
-
for (var e =
|
|
62
|
-
(i =
|
|
63
|
-
return
|
|
60
|
+
var D = Object.defineProperty, T = Object.getOwnPropertyDescriptor, E = (r, t, n, o) => {
|
|
61
|
+
for (var e = o > 1 ? void 0 : o ? T(t, n) : t, a = r.length - 1, i; a >= 0; a--)
|
|
62
|
+
(i = r[a]) && (e = (o ? i(t, n, e) : i(e)) || e);
|
|
63
|
+
return o && e && D(t, n, e), e;
|
|
64
64
|
};
|
|
65
|
-
class
|
|
65
|
+
class c extends v {
|
|
66
66
|
constructor() {
|
|
67
67
|
super(...arguments), this.propKeyValues = "";
|
|
68
68
|
}
|
|
@@ -71,14 +71,14 @@ class l extends u {
|
|
|
71
71
|
// <p class="c-webComponentTestWrapper-label"><b>size</b>: <code>small</code></p>
|
|
72
72
|
// <p class="c-webComponentTestWrapper-label"><b>isFullWidth</b>: <code>true</code></p>
|
|
73
73
|
_renderPropKeyValues() {
|
|
74
|
-
return this.propKeyValues.split(",").map((
|
|
75
|
-
const [
|
|
76
|
-
return
|
|
74
|
+
return this.propKeyValues.split(",").map((t) => {
|
|
75
|
+
const [n, o] = t.split(":");
|
|
76
|
+
return m`<p class="c-webComponentTestWrapper-label"><b>${n}</b>: <code>${o}</code></p>`;
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
// eslint-disable-next-line class-methods-use-this
|
|
80
80
|
render() {
|
|
81
|
-
return
|
|
81
|
+
return m`
|
|
82
82
|
<div class="c-webComponentTestWrapper">
|
|
83
83
|
${this._renderPropKeyValues()}
|
|
84
84
|
<div class="c-webComponentTestWrapper-slot">
|
|
@@ -87,54 +87,70 @@ class l extends u {
|
|
|
87
87
|
</div>`;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
],
|
|
94
|
-
const
|
|
95
|
-
customElements.get(
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
var
|
|
99
|
-
for (var e =
|
|
100
|
-
(i =
|
|
101
|
-
return
|
|
90
|
+
c.styles = g(z);
|
|
91
|
+
E([
|
|
92
|
+
s({ type: String })
|
|
93
|
+
], c.prototype, "propKeyValues", 2);
|
|
94
|
+
const h = "web-component-test-wrapper";
|
|
95
|
+
customElements.get(h) || customElements.define(h, c);
|
|
96
|
+
const S = `.c-modal{--modal-size-s: 450px;--modal-size-m: 600px;--modal-size-l: 1080px;--modal-border-radius: var(--dt-radius-rounded-d);--modal-font: var(--dt-font-interactive-m-family);--modal-bg-color: var(--dt-color-container-default);--modal-elevation: var(--dt-elevation-04);border-radius:var(--modal-border-radius);border:none;font-family:var(--modal-font);background-color:var(--modal-bg-color);padding:0;inline-size:var(--modal-size-m);box-shadow:var(--modal-elevation)}.c-modal .c-modal-heading{--modal-header-font-size: calc(var(--dt-font-heading-m-size--wide) * 1px);--modal-header-font-line-height: calc(var(--dt-font-heading-m-line-height--wide) * 1px);--modal-header-font-weight: var(--dt-font-heading-m-weight);--modal-header-padding: var(--dt-spacing-e);--modal-header-padding-block-end: var(--dt-spacing-d);font-size:var(--modal-header-font-size);line-height:var(--modal-header-font-line-height);font-weight:var(--modal-header-font-weight);margin:0;padding-block:var(--modal-header-padding) var(--modal-header-padding-block-end);padding-inline:var(--modal-header-padding)}.c-modal .c-modal-content{--modal-content-font-size: calc(var(--dt-font-size-16) * 1px);--modal-content-font-weight: var(--dt-font-weight-regular);--modal-content-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--modal-content-padding: var(--dt-spacing-e);--modal-content-padding-block-start: var(--dt-spacing-a);font-size:var(--modal-content-font-size);line-height:var(--modal-content-line-height);font-weight:var(--modal-content-font-weight);padding-block:var(--modal-content-padding-block-start) var(--modal-content-padding);padding-inline:var(--modal-content-padding)}.c-modal .c-modal-closeBtn{position:absolute;right:var(--dt-spacing-d);top:var(--dt-spacing-d)}
|
|
97
|
+
`, j = ["h1", "h2", "h3", "h4", "h5", "h6"], L = "pie-modal-close";
|
|
98
|
+
var W = Object.defineProperty, V = Object.getOwnPropertyDescriptor, l = (r, t, n, o) => {
|
|
99
|
+
for (var e = o > 1 ? void 0 : o ? V(t, n) : t, a = r.length - 1, i; a >= 0; a--)
|
|
100
|
+
(i = r[a]) && (e = (o ? i(t, n, e) : i(e)) || e);
|
|
101
|
+
return o && e && W(t, n, e), e;
|
|
102
102
|
};
|
|
103
|
-
const
|
|
104
|
-
class
|
|
103
|
+
const p = "pie-modal";
|
|
104
|
+
class d extends O(v) {
|
|
105
105
|
constructor() {
|
|
106
|
-
super(...arguments), this.isOpen = !1, this.headingLevel =
|
|
106
|
+
super(...arguments), this.isOpen = !1, this.headingLevel = "h2", this._handleCloseDialog = () => {
|
|
107
|
+
this._dialog.close(), this._onDialogClose();
|
|
108
|
+
}, this._onDialogClose = () => {
|
|
109
|
+
const t = new CustomEvent(L);
|
|
110
|
+
this.dispatchEvent(t);
|
|
111
|
+
};
|
|
107
112
|
}
|
|
108
113
|
render() {
|
|
109
114
|
const {
|
|
110
|
-
isOpen:
|
|
111
|
-
heading:
|
|
112
|
-
headingLevel:
|
|
113
|
-
} = this, e =
|
|
114
|
-
return
|
|
115
|
-
<dialog class="c-modal" ?open="${
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
115
|
+
isOpen: t,
|
|
116
|
+
heading: n,
|
|
117
|
+
headingLevel: o = "h2"
|
|
118
|
+
} = this, e = u(o);
|
|
119
|
+
return b`
|
|
120
|
+
<dialog id="dialog" class="c-modal" ?open="${t}">
|
|
121
|
+
<header>
|
|
122
|
+
<${e} class="c-modal-heading">${n}</${e}>
|
|
123
|
+
<pie-icon-button
|
|
124
|
+
@click="${this._handleCloseDialog}"
|
|
125
|
+
variant="ghost-tertiary"
|
|
126
|
+
class="c-modal-closeBtn"></pie-icon-button>
|
|
127
|
+
</header>
|
|
128
|
+
<article>
|
|
129
|
+
<div class="c-modal-content">
|
|
130
|
+
<slot></slot>
|
|
131
|
+
</div>
|
|
132
|
+
</article>
|
|
120
133
|
</dialog>
|
|
121
134
|
`;
|
|
122
135
|
}
|
|
123
136
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
],
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
],
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
],
|
|
136
|
-
|
|
137
|
+
d.styles = g(S);
|
|
138
|
+
l([
|
|
139
|
+
s({ type: Boolean })
|
|
140
|
+
], d.prototype, "isOpen", 2);
|
|
141
|
+
l([
|
|
142
|
+
s({ type: String }),
|
|
143
|
+
x(p)
|
|
144
|
+
], d.prototype, "heading", 2);
|
|
145
|
+
l([
|
|
146
|
+
s(),
|
|
147
|
+
C(p, j, "h2")
|
|
148
|
+
], d.prototype, "headingLevel", 2);
|
|
149
|
+
l([
|
|
150
|
+
_("dialog")
|
|
151
|
+
], d.prototype, "_dialog", 2);
|
|
152
|
+
customElements.define(p, d);
|
|
137
153
|
export {
|
|
138
|
-
|
|
139
|
-
|
|
154
|
+
d as PieModal,
|
|
155
|
+
j as headingLevels
|
|
140
156
|
};
|