@brad-frost-web/eddie-web-components 0.9.0 → 0.10.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.
@@ -0,0 +1,133 @@
1
+ import { EdElement } from '@brad-frost-web/eddie-web-components/components/EdElement';
2
+ interface BlackFridayPromo {
3
+ imgSrc: string;
4
+ imgAlt: string;
5
+ heading: string;
6
+ description: string;
7
+ href?: string;
8
+ buttonText?: string;
9
+ }
10
+ interface BlackFridayCourse {
11
+ imgSrc: string;
12
+ imgAlt: string;
13
+ href: string;
14
+ heading: string;
15
+ }
16
+ /**
17
+ * @slot - The modal content
18
+ * @slot header - The header content
19
+ * @slot footer - The footer ocntent
20
+ */
21
+ export declare class EdBlackFridaymodal extends EdElement {
22
+ static get styles(): import('lit').CSSResult;
23
+ /**
24
+ * Align variants
25
+ * <ed-text-passage size="sm">
26
+ * <ul>
27
+ * <li>**top** - aligns the modal to the top of the viewport</li>
28
+ * <li>**right** - aligns the modal to the right of the viewport</li>
29
+ * <li>**bottom** - aligns the modal to the bottom of the viewport</li>
30
+ * <li>**left** - aligns the modal to the left of the viewport</li>
31
+ * </ul>
32
+ * </ed-text-passage>
33
+ */
34
+ align?: 'top' | 'right' | 'bottom' | 'left';
35
+ /**
36
+ * Close button text
37
+ */
38
+ closeButtonText?: string;
39
+ /**
40
+ * Fade/ghost back the page background content
41
+ */
42
+ hasBackdrop?: boolean;
43
+ /**
44
+ * Active state on the modal
45
+ */
46
+ isActive?: boolean;
47
+ /**
48
+ * Hero image source
49
+ */
50
+ imgSrc?: string;
51
+ /**
52
+ * Hero image alt text
53
+ */
54
+ imgAlt?: string;
55
+ /**
56
+ * Hero heading text
57
+ */
58
+ heading?: string;
59
+ /**
60
+ * Hero description text (supports HTML)
61
+ */
62
+ description?: string;
63
+ /**
64
+ * Courses heading text
65
+ */
66
+ secondaryHeading?: string;
67
+ /**
68
+ * Array of promo items to display in the grid
69
+ */
70
+ promos: BlackFridayPromo[];
71
+ /**
72
+ * Array of course items to display in the grid
73
+ */
74
+ courses: BlackFridayCourse[];
75
+ /**
76
+ * Reference to the close button element
77
+ */
78
+ closeButton?: HTMLButtonElement;
79
+ /**
80
+ * Initialize functions
81
+ */
82
+ constructor();
83
+ /**
84
+ * Connected Callback lifecycle
85
+ */
86
+ connectedCallback(): void;
87
+ /**
88
+ * Disconnected callback lifecycle
89
+ * 1) Remove window resize event listener
90
+ */
91
+ disconnectedCallback(): void;
92
+ /**
93
+ * Updated lifecycle method
94
+ * Focus the close button when the modal becomes active
95
+ */
96
+ updated(changedProperties: Map<string, any>): void;
97
+ /**
98
+ * Handle click outside the component
99
+ * 1) Close the modal on click outside
100
+ * 2) If the nav is already closed then we don't care about outside clicks and we
101
+ * can bail early
102
+ * 3) By the time a user clicks on the page the shadowRoot will almost certainly be
103
+ * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly
104
+ * undefined. To work around that we'll check that we have a shadowRoot (and a
105
+ * rendered .host) element here to appease the TypeScript compiler. This should never
106
+ * actually be shown or run for a human end user.
107
+ * 4) Check to see if we clicked inside the active navigation item
108
+ * 5) If the navigation is active and we've clicked outside of the nav then it should
109
+ * be closed.
110
+ */
111
+ handleOnClickOutside(event: MouseEvent): void;
112
+ handleKeyDown(e: KeyboardEvent): void;
113
+ /**
114
+ * Open modal function
115
+ * Opens the modal and dispatches an event
116
+ */
117
+ openModal(): void;
118
+ /**
119
+ * Close modal function
120
+ * 1) Closes the modal
121
+ * 2) Returns focus to the top of the page when closing
122
+ * 3) Dispatches close event
123
+ */
124
+ closeModal(): void;
125
+ render(): import('lit-html').TemplateResult<1>;
126
+ }
127
+ declare global {
128
+ interface HTMLElementTagNameMap {
129
+ 'ed-black-friday-modal': EdBlackFridaymodal;
130
+ }
131
+ }
132
+ export {};
133
+ //# sourceMappingURL=black-friday-modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"black-friday-modal.d.ts","sourceRoot":"","sources":["../../../../packages/eddie-web-components/components/black-friday-modal/black-friday-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2DAA2D,CAAC;AAGtF,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,wBAAwB,CAAC;AAKhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,MAAM,KAAK,MAAM,4BAEhB;IAED;;;;;;;;;;OAUG;IAEH,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAW;IAEtD;;OAEG;IAEH,eAAe,CAAC,EAAE,MAAM,CAA8B;IAEtD;;OAEG;IAEH,WAAW,CAAC,EAAE,OAAO,CAAS;IAE9B;;OAEG;IAEH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IAEH,MAAM,CAAC,EAAE,MAAM,CAAoC;IAEnD;;OAEG;IAEH,MAAM,CAAC,EAAE,MAAM,CAA8B;IAE7C;;OAEG;IAEH,OAAO,CAAC,EAAE,MAAM,CAA8B;IAE9C;;OAEG;IAEH,WAAW,CAAC,EAAE,MAAM,CAA2D;IAE/E;;OAEG;IAEH,gBAAgB,CAAC,EAAE,MAAM,CAAa;IAEtC;;OAEG;IAEH,MAAM,EAAE,gBAAgB,EAAE,CAkCxB;IAEF;;OAEG;IAEH,OAAO,EAAE,iBAAiB,EAAE,CAmB1B;IAEF;;OAEG;IAEH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC;;OAEG;;IAMH;;OAEG;IACH,iBAAiB;IAMjB;;;OAGG;IACH,oBAAoB;IAKpB;;;OAGG;IACH,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAW3C;;;;;;;;;;;;;OAaG;IACH,oBAAoB,CAAC,KAAK,EAAE,UAAU;IAoBtC,aAAa,CAAC,CAAC,EAAE,aAAa;IAM9B;;;OAGG;IACH,SAAS;IAYT;;;;;OAKG;IACH,UAAU;IAoBV,MAAM;CAqFP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,uBAAuB,EAAE,kBAAkB,CAAC;KAC7C;CACF"}
@@ -0,0 +1,538 @@
1
+ import { E as K } from "../EdElement.js";
2
+ import { unsafeCSS as Z, html as v } from "lit";
3
+ import { property as p, query as J } from "lit/decorators.js";
4
+ import "../button/button.js";
5
+ import "../grid/grid.js";
6
+ import "../grid-item/grid-item.js";
7
+ import { ifDefined as Q } from "lit/directives/if-defined.js";
8
+ const X = ':root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}.ed-c-black-friday-modal{display:block;height:0;width:0;padding:0;overflow:hidden;position:fixed;max-width:none;max-height:none;inset-block-start:unset;inset-block-end:0;inset-inline-end:0;background:var(--ed-theme-color-background-knockout);color:var(--ed-theme-color-content-knockout);border:none;z-index:1000;transition:height var(--ed-theme-animation-fade-quick) var(--ed-theme-animation-ease)}.ed-c-black-friday-modal[open]{visibility:visible;width:100%;height:100vh;box-shadow:0 -5px 10px #0006;overflow:auto}.ed-c-black-friday-modal__header{display:flex;justify-content:space-between;align-items:baseline;gap:1rem;margin-block-end:4rem;box-shadow:0 10px 0 -5px var(--ed-theme-color-background-accent-1),0 20px 0 -10px var(--ed-theme-color-background-accent-2),0 30px 0 -16px var(--ed-theme-color-background-accent-4)}.ed-c-black-friday-modal__header-media{min-height:10rem;max-height:20rem;overflow:hidden}.ed-c-black-friday-modal__header-media:after{content:"";position:absolute;inset:0;background:#0009;z-index:1}.ed-c-black-friday-modal__header-media-image{position:relative;display:block;width:100%}@media all and (min-width:48rem){.ed-c-black-friday-modal__header-media-image{inset-block-end:10rem}}.ed-c-black-friday-modal__header-content{position:relative;width:100%}.ed-c-black-friday-modal__header-content-text{position:absolute;inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%);width:100%;text-align:center;z-index:3}.ed-c-black-friday-modal__header-content-description{font-family:var(--ed-theme-typography-body-lg-font-family);font-weight:var(--ed-theme-typography-body-lg-font-weight);font-size:var(--ed-theme-typography-body-lg-font-size);line-height:var(--ed-theme-typography-body-lg-line-height);letter-spacing:var(--ed-theme-typography-body-lg-letter-spacing);text-transform:var(--ed-theme-typography-body-lg-text-transform)}.ed-c-black-friday-modal__title{margin-block-end:1rem}.ed-c-black-friday-modal__description{max-width:35rem}.ed-c-black-friday-modal__close-button{position:absolute;inset-block-start:.5rem;inset-inline-end:.5rem;appearance:none;background:none;outline:none;border:none;padding:.5rem;z-index:2;cursor:pointer;color:var(--ed-theme-color-content-knockout)}.ed-c-black-friday-modal__close-button:focus-visible{outline:var(--ed-theme-border-width-lg) solid var(--ed-theme-focus-ring-color-border-knockout);outline-offset:var(--ed-theme-offset-focus-ring, .25rem )}@media all and (min-width:60rem){.ed-c-black-friday-modal__close-button{padding:1rem}}.ed-c-black-friday-modal__close-icon{fill:currentColor;height:2rem;width:2rem}.ed-c-black-friday-modal__promos{display:block;margin-block-end:4rem}.ed-c-black-friday-modal__image{display:block;width:100%}.ed-c-black-friday-modal__section-title{display:block;margin-block-end:1rem;text-align:center}.ed-c-black-friday-modal__card{display:flex;flex-direction:column;height:100%}.ed-c-black-friday-modal__card-body{flex:1}.ed-c-black-friday-modal__card-footer{padding:.5rem 1rem 1rem;text-align:center}.ed-c-black-friday-modal__card-media{display:block;overflow:hidden;margin-block-end:1rem;border:1px solid var(--ed-theme-color-border-knockout);border-radius:.5rem}.ed-c-black-friday-modal__card-media:focus-visible{outline:var(--ed-theme-border-width-lg) solid var(--ed-theme-focus-ring-color-border-knockout);outline-offset:var(--ed-theme-offset-focus-ring, .25rem )}.ed-c-black-friday-modal__card-image{display:block;width:100%}.ed-c-black-friday-modal__card-title{display:block;margin-block-end:1rem;text-align:center}.ed-c-black-friday-modal__header-content-title{text-shadow:2px 0 0 var(--ed-theme-color-background-accent-2),4px 0 0 var(--ed-theme-color-background-accent-1);letter-spacing:1.5px}.ed-c-black-friday-modal__card-paragraph{text-align:center}.ed-c-black-friday-modal__card-list-container{display:flex;flex-direction:column;align-items:center}.ed-c-black-friday-modal__card-list{padding:0;margin:0}';
9
+ /**
10
+ * @license
11
+ * Copyright 2017 Google LLC
12
+ * SPDX-License-Identifier: BSD-3-Clause
13
+ */
14
+ const I = globalThis, H = I.trustedTypes, z = H ? H.createPolicy("lit-html", { createHTML: (o) => o }) : void 0, W = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, F = "?" + b, Y = `<${F}>`, A = document, N = () => A.createComment(""), C = (o) => o === null || typeof o != "object" && typeof o != "function", O = Array.isArray, ee = (o) => O(o) || typeof o?.[Symbol.iterator] == "function", D = `[
15
+ \f\r]`, w = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, L = /-->/g, U = />/g, y = RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^
16
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), j = /'/g, R = /"/g, V = /^(?:script|style|textarea|title)$/i, k = Symbol.for("lit-noChange"), l = Symbol.for("lit-nothing"), G = /* @__PURE__ */ new WeakMap(), $ = A.createTreeWalker(A, 129);
17
+ function q(o, e) {
18
+ if (!O(o) || !o.hasOwnProperty("raw")) throw Error("invalid template strings array");
19
+ return z !== void 0 ? z.createHTML(e) : e;
20
+ }
21
+ const te = (o, e) => {
22
+ const t = o.length - 1, i = [];
23
+ let s, a = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", d = w;
24
+ for (let g = 0; g < t; g++) {
25
+ const r = o[g];
26
+ let c, h, n = -1, _ = 0;
27
+ for (; _ < r.length && (d.lastIndex = _, h = d.exec(r), h !== null); ) _ = d.lastIndex, d === w ? h[1] === "!--" ? d = L : h[1] !== void 0 ? d = U : h[2] !== void 0 ? (V.test(h[2]) && (s = RegExp("</" + h[2], "g")), d = y) : h[3] !== void 0 && (d = y) : d === y ? h[0] === ">" ? (d = s ?? w, n = -1) : h[1] === void 0 ? n = -2 : (n = d.lastIndex - h[2].length, c = h[1], d = h[3] === void 0 ? y : h[3] === '"' ? R : j) : d === R || d === j ? d = y : d === L || d === U ? d = w : (d = y, s = void 0);
28
+ const f = d === y && o[g + 1].startsWith("/>") ? " " : "";
29
+ a += d === w ? r + Y : n >= 0 ? (i.push(c), r.slice(0, n) + W + r.slice(n) + b + f) : r + b + (n === -2 ? g : f);
30
+ }
31
+ return [q(o, a + (o[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
32
+ };
33
+ class T {
34
+ constructor({ strings: e, _$litType$: t }, i) {
35
+ let s;
36
+ this.parts = [];
37
+ let a = 0, d = 0;
38
+ const g = e.length - 1, r = this.parts, [c, h] = te(e, t);
39
+ if (this.el = T.createElement(c, i), $.currentNode = this.el.content, t === 2 || t === 3) {
40
+ const n = this.el.content.firstChild;
41
+ n.replaceWith(...n.childNodes);
42
+ }
43
+ for (; (s = $.nextNode()) !== null && r.length < g; ) {
44
+ if (s.nodeType === 1) {
45
+ if (s.hasAttributes()) for (const n of s.getAttributeNames()) if (n.endsWith(W)) {
46
+ const _ = h[d++], f = s.getAttribute(n).split(b), S = /([.?@])?(.*)/.exec(_);
47
+ r.push({ type: 1, index: a, name: S[2], strings: f, ctor: S[1] === "." ? se : S[1] === "?" ? ae : S[1] === "@" ? oe : M }), s.removeAttribute(n);
48
+ } else n.startsWith(b) && (r.push({ type: 6, index: a }), s.removeAttribute(n));
49
+ if (V.test(s.tagName)) {
50
+ const n = s.textContent.split(b), _ = n.length - 1;
51
+ if (_ > 0) {
52
+ s.textContent = H ? H.emptyScript : "";
53
+ for (let f = 0; f < _; f++) s.append(n[f], N()), $.nextNode(), r.push({ type: 2, index: ++a });
54
+ s.append(n[_], N());
55
+ }
56
+ }
57
+ } else if (s.nodeType === 8) if (s.data === F) r.push({ type: 2, index: a });
58
+ else {
59
+ let n = -1;
60
+ for (; (n = s.data.indexOf(b, n + 1)) !== -1; ) r.push({ type: 7, index: a }), n += b.length - 1;
61
+ }
62
+ a++;
63
+ }
64
+ }
65
+ static createElement(e, t) {
66
+ const i = A.createElement("template");
67
+ return i.innerHTML = e, i;
68
+ }
69
+ }
70
+ function x(o, e, t = o, i) {
71
+ if (e === k) return e;
72
+ let s = i !== void 0 ? t._$Co?.[i] : t._$Cl;
73
+ const a = C(e) ? void 0 : e._$litDirective$;
74
+ return s?.constructor !== a && (s?._$AO?.(!1), a === void 0 ? s = void 0 : (s = new a(o), s._$AT(o, t, i)), i !== void 0 ? (t._$Co ??= [])[i] = s : t._$Cl = s), s !== void 0 && (e = x(o, s._$AS(o, e.values), s, i)), e;
75
+ }
76
+ class ie {
77
+ constructor(e, t) {
78
+ this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
79
+ }
80
+ get parentNode() {
81
+ return this._$AM.parentNode;
82
+ }
83
+ get _$AU() {
84
+ return this._$AM._$AU;
85
+ }
86
+ u(e) {
87
+ const { el: { content: t }, parts: i } = this._$AD, s = (e?.creationScope ?? A).importNode(t, !0);
88
+ $.currentNode = s;
89
+ let a = $.nextNode(), d = 0, g = 0, r = i[0];
90
+ for (; r !== void 0; ) {
91
+ if (d === r.index) {
92
+ let c;
93
+ r.type === 2 ? c = new E(a, a.nextSibling, this, e) : r.type === 1 ? c = new r.ctor(a, r.name, r.strings, this, e) : r.type === 6 && (c = new de(a, this, e)), this._$AV.push(c), r = i[++g];
94
+ }
95
+ d !== r?.index && (a = $.nextNode(), d++);
96
+ }
97
+ return $.currentNode = A, s;
98
+ }
99
+ p(e) {
100
+ let t = 0;
101
+ for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, t), t += i.strings.length - 2) : i._$AI(e[t])), t++;
102
+ }
103
+ }
104
+ class E {
105
+ get _$AU() {
106
+ return this._$AM?._$AU ?? this._$Cv;
107
+ }
108
+ constructor(e, t, i, s) {
109
+ this.type = 2, this._$AH = l, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = s, this._$Cv = s?.isConnected ?? !0;
110
+ }
111
+ get parentNode() {
112
+ let e = this._$AA.parentNode;
113
+ const t = this._$AM;
114
+ return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
115
+ }
116
+ get startNode() {
117
+ return this._$AA;
118
+ }
119
+ get endNode() {
120
+ return this._$AB;
121
+ }
122
+ _$AI(e, t = this) {
123
+ e = x(this, e, t), C(e) ? e === l || e == null || e === "" ? (this._$AH !== l && this._$AR(), this._$AH = l) : e !== this._$AH && e !== k && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : ee(e) ? this.k(e) : this._(e);
124
+ }
125
+ O(e) {
126
+ return this._$AA.parentNode.insertBefore(e, this._$AB);
127
+ }
128
+ T(e) {
129
+ this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
130
+ }
131
+ _(e) {
132
+ this._$AH !== l && C(this._$AH) ? this._$AA.nextSibling.data = e : this.T(A.createTextNode(e)), this._$AH = e;
133
+ }
134
+ $(e) {
135
+ const { values: t, _$litType$: i } = e, s = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = T.createElement(q(i.h, i.h[0]), this.options)), i);
136
+ if (this._$AH?._$AD === s) this._$AH.p(t);
137
+ else {
138
+ const a = new ie(s, this), d = a.u(this.options);
139
+ a.p(t), this.T(d), this._$AH = a;
140
+ }
141
+ }
142
+ _$AC(e) {
143
+ let t = G.get(e.strings);
144
+ return t === void 0 && G.set(e.strings, t = new T(e)), t;
145
+ }
146
+ k(e) {
147
+ O(this._$AH) || (this._$AH = [], this._$AR());
148
+ const t = this._$AH;
149
+ let i, s = 0;
150
+ for (const a of e) s === t.length ? t.push(i = new E(this.O(N()), this.O(N()), this, this.options)) : i = t[s], i._$AI(a), s++;
151
+ s < t.length && (this._$AR(i && i._$AB.nextSibling, s), t.length = s);
152
+ }
153
+ _$AR(e = this._$AA.nextSibling, t) {
154
+ for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
155
+ const i = e.nextSibling;
156
+ e.remove(), e = i;
157
+ }
158
+ }
159
+ setConnected(e) {
160
+ this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
161
+ }
162
+ }
163
+ class M {
164
+ get tagName() {
165
+ return this.element.tagName;
166
+ }
167
+ get _$AU() {
168
+ return this._$AM._$AU;
169
+ }
170
+ constructor(e, t, i, s, a) {
171
+ this.type = 1, this._$AH = l, this._$AN = void 0, this.element = e, this.name = t, this._$AM = s, this.options = a, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = l;
172
+ }
173
+ _$AI(e, t = this, i, s) {
174
+ const a = this.strings;
175
+ let d = !1;
176
+ if (a === void 0) e = x(this, e, t, 0), d = !C(e) || e !== this._$AH && e !== k, d && (this._$AH = e);
177
+ else {
178
+ const g = e;
179
+ let r, c;
180
+ for (e = a[0], r = 0; r < a.length - 1; r++) c = x(this, g[i + r], t, r), c === k && (c = this._$AH[r]), d ||= !C(c) || c !== this._$AH[r], c === l ? e = l : e !== l && (e += (c ?? "") + a[r + 1]), this._$AH[r] = c;
181
+ }
182
+ d && !s && this.j(e);
183
+ }
184
+ j(e) {
185
+ e === l ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
186
+ }
187
+ }
188
+ class se extends M {
189
+ constructor() {
190
+ super(...arguments), this.type = 3;
191
+ }
192
+ j(e) {
193
+ this.element[this.name] = e === l ? void 0 : e;
194
+ }
195
+ }
196
+ class ae extends M {
197
+ constructor() {
198
+ super(...arguments), this.type = 4;
199
+ }
200
+ j(e) {
201
+ this.element.toggleAttribute(this.name, !!e && e !== l);
202
+ }
203
+ }
204
+ class oe extends M {
205
+ constructor(e, t, i, s, a) {
206
+ super(e, t, i, s, a), this.type = 5;
207
+ }
208
+ _$AI(e, t = this) {
209
+ if ((e = x(this, e, t, 0) ?? l) === k) return;
210
+ const i = this._$AH, s = e === l && i !== l || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, a = e !== l && (i === l || s);
211
+ s && this.element.removeEventListener(this.name, this, i), a && this.element.addEventListener(this.name, this, e), this._$AH = e;
212
+ }
213
+ handleEvent(e) {
214
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
215
+ }
216
+ }
217
+ class de {
218
+ constructor(e, t, i) {
219
+ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = i;
220
+ }
221
+ get _$AU() {
222
+ return this._$AM._$AU;
223
+ }
224
+ _$AI(e) {
225
+ x(this, e);
226
+ }
227
+ }
228
+ const re = I.litHtmlPolyfillSupport;
229
+ re?.(T, E), (I.litHtmlVersions ??= []).push("3.3.1");
230
+ /**
231
+ * @license
232
+ * Copyright 2017 Google LLC
233
+ * SPDX-License-Identifier: BSD-3-Clause
234
+ */
235
+ const ne = { CHILD: 2 }, le = (o) => (...e) => ({ _$litDirective$: o, values: e });
236
+ class ce {
237
+ constructor(e) {
238
+ }
239
+ get _$AU() {
240
+ return this._$AM._$AU;
241
+ }
242
+ _$AT(e, t, i) {
243
+ this._$Ct = e, this._$AM = t, this._$Ci = i;
244
+ }
245
+ _$AS(e, t) {
246
+ return this.update(e, t);
247
+ }
248
+ update(e, t) {
249
+ return this.render(...t);
250
+ }
251
+ }
252
+ /**
253
+ * @license
254
+ * Copyright 2017 Google LLC
255
+ * SPDX-License-Identifier: BSD-3-Clause
256
+ */
257
+ class B extends ce {
258
+ constructor(e) {
259
+ if (super(e), this.it = l, e.type !== ne.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
260
+ }
261
+ render(e) {
262
+ if (e === l || e == null) return this._t = void 0, this.it = e;
263
+ if (e === k) return e;
264
+ if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
265
+ if (e === this.it) return this._t;
266
+ this.it = e;
267
+ const t = [e];
268
+ return t.raw = t, this._t = { _$litType$: this.constructor.resultType, strings: t, values: [] };
269
+ }
270
+ }
271
+ B.directiveName = "unsafeHTML", B.resultType = 1;
272
+ const P = le(B);
273
+ var he = Object.defineProperty, u = (o, e, t, i) => {
274
+ for (var s = void 0, a = o.length - 1, d; a >= 0; a--)
275
+ (d = o[a]) && (s = d(e, t, s) || s);
276
+ return s && he(e, t, s), s;
277
+ };
278
+ class m extends K {
279
+ /**
280
+ * Initialize functions
281
+ */
282
+ constructor() {
283
+ super(), this.align = "right", this.closeButtonText = "Close Black Friday Deals", this.hasBackdrop = !1, this.imgSrc = "/images/black-friday-crowd.gif", this.imgAlt = "Black Friday crowd swarm", this.heading = "Black Friday Deals!!!!!!", this.description = "<p>Save up to 45% off on our bundles and courses!</p>", this.secondaryHeading = "Courses", this.promos = [
284
+ {
285
+ imgSrc: "/images/mega-bundle.png",
286
+ imgAlt: "Mega bundle image with Subatomic, Atomic Design, and AI & Design Systems courses",
287
+ heading: "MEGA BUNDLE",
288
+ description: `
289
+ <p>
290
+ We admit it: we just like saying the words "MEGA BUNDLE". Get all of our courses (an $1875 value) for one heavily-discounted
291
+ price of $1000. The Mega Bundle includes all of our current and upcoming courses:
292
+ </p>
293
+ <div class="ed-c-black-friday-modal__card-list-container">
294
+ <ul class="ed-c-black-friday-modal__card-list">
295
+ <li>Subatomic: The Complete Guide To Design Tokens</li>
296
+ <li>Atomic Design Certification Course preorder</li>
297
+ <li>AI & Design Systems course preorder</li>
298
+ </ul>
299
+ </div>
300
+ `,
301
+ href: "https://courses.bradfrost.com/enroll/3584706?price_id=4519547",
302
+ buttonText: "buy now"
303
+ },
304
+ {
305
+ imgSrc: "/images/subatomic-atomic-bundle.png",
306
+ imgAlt: "Subatomic The Complete Guide to Design Tokens and Atomic Design Certification Course bundle",
307
+ heading: "SUBATOMIC + ATOMIC DESIGN",
308
+ description: `
309
+ <p>
310
+ Get our Subatomic and Atomic Design Certification Course bundle for just $500! Our Subatomic course will help you master
311
+ design tokens, and our Atomic Design course will help you apply design system best practices at your organization.
312
+ </p>
313
+ `,
314
+ href: "https://courses.bradfrost.com/enroll/3449097?price_id=4366498",
315
+ buttonText: "buy now"
316
+ }
317
+ ], this.courses = [
318
+ {
319
+ imgSrc: "/images/subatomic-social-card.png",
320
+ imgAlt: "Subatomic Course",
321
+ href: "https://designtokenscourse.com/",
322
+ heading: "Subatomic: The Complete Guide to Design Tokens"
323
+ },
324
+ {
325
+ imgSrc: "/images/atomic-design-social-card.png",
326
+ imgAlt: "Atomic Design Certification Course",
327
+ href: "https://atomicdesigncourse.com",
328
+ heading: "Atomic Design Certification Course"
329
+ },
330
+ {
331
+ imgSrc: "/images/ai-design-systems-social-card.png",
332
+ imgAlt: "AI & Design Systems Course",
333
+ href: "https://aianddesign.systems/",
334
+ heading: "AI & Design Systems"
335
+ }
336
+ ], this.handleOnClickOutside = this.handleOnClickOutside.bind(this);
337
+ }
338
+ static get styles() {
339
+ return Z(X);
340
+ }
341
+ /**
342
+ * Connected Callback lifecycle
343
+ */
344
+ connectedCallback() {
345
+ super.connectedCallback(), document.addEventListener("mousedown", this.handleOnClickOutside, !1);
346
+ }
347
+ /**
348
+ * Disconnected callback lifecycle
349
+ * 1) Remove window resize event listener
350
+ */
351
+ disconnectedCallback() {
352
+ document.removeEventListener("mousedown", this.handleOnClickOutside, !1), super.disconnectedCallback();
353
+ }
354
+ /**
355
+ * Updated lifecycle method
356
+ * Focus the close button when the modal becomes active
357
+ */
358
+ updated(e) {
359
+ super.updated(e), e.has("isActive") && this.isActive && setTimeout(() => {
360
+ this.closeButton?.focus();
361
+ }, 0);
362
+ }
363
+ /**
364
+ * Handle click outside the component
365
+ * 1) Close the modal on click outside
366
+ * 2) If the nav is already closed then we don't care about outside clicks and we
367
+ * can bail early
368
+ * 3) By the time a user clicks on the page the shadowRoot will almost certainly be
369
+ * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly
370
+ * undefined. To work around that we'll check that we have a shadowRoot (and a
371
+ * rendered .host) element here to appease the TypeScript compiler. This should never
372
+ * actually be shown or run for a human end user.
373
+ * 4) Check to see if we clicked inside the active navigation item
374
+ * 5) If the navigation is active and we've clicked outside of the nav then it should
375
+ * be closed.
376
+ */
377
+ handleOnClickOutside(e) {
378
+ if (!this.isActive)
379
+ return;
380
+ if (!this.shadowRoot?.host)
381
+ throw Error("Could not determine navigation context during click handler");
382
+ const t = e.composedPath().includes(this.shadowRoot.host);
383
+ this.isActive && !t && this.closeModal();
384
+ }
385
+ handleKeyDown(e) {
386
+ e.code === "Escape" && this.closeModal();
387
+ }
388
+ /**
389
+ * Open modal function
390
+ * Opens the modal and dispatches an event
391
+ */
392
+ openModal() {
393
+ console.log("openModal"), this.isActive = !0;
394
+ const e = {
395
+ detail: { isActive: this.isActive },
396
+ bubbles: !0,
397
+ composed: !0
398
+ };
399
+ this.dispatchEvent(new CustomEvent("ed-black-friday-modal-open", e));
400
+ }
401
+ /**
402
+ * Close modal function
403
+ * 1) Closes the modal
404
+ * 2) Returns focus to the top of the page when closing
405
+ * 3) Dispatches close event
406
+ */
407
+ closeModal() {
408
+ console.log("closeModal"), this.isActive = !1, document.body.setAttribute("tabindex", "-1"), document.body.focus(), setTimeout(() => {
409
+ document.body.removeAttribute("tabindex");
410
+ }, 0);
411
+ const e = {
412
+ detail: { isActive: this.isActive },
413
+ bubbles: !0,
414
+ composed: !0
415
+ };
416
+ this.dispatchEvent(new CustomEvent("ed-black-friday-modal-close", e));
417
+ }
418
+ render() {
419
+ const e = this.componentClassNames("ed-c-black-friday-modal", {
420
+ "ed-c-black-friday-modal--backdrop": this.hasBackdrop,
421
+ "ed-c-black-friday-modal--inactive": !this.isActive
422
+ });
423
+ return v`
424
+ <dialog
425
+ aria-labelledby="black-friday-modal-heading"
426
+ class="${e}"
427
+ open=${Q(this.isActive ? "true" : void 0)}
428
+ @keydown=${this.handleKeyDown}
429
+ >
430
+ <header class="ed-c-black-friday-modal__header">
431
+ <div class="ed-c-black-friday-modal__header-content">
432
+ <div class="ed-c-black-friday-modal__header-media">
433
+ <img class="ed-c-black-friday-modal__header-media-image" src="${this.imgSrc}" alt="${this.imgAlt}" />
434
+ </div>
435
+ <div class="ed-c-black-friday-modal__header-content-text">
436
+ <ed-layout-container>
437
+ <ed-heading id="black-friday-modal-heading" tagName="h2" variant="display-lg" class="ed-u-display-block ed-u-margin-bottom-sm"
438
+ ><span class="ed-c-black-friday-modal__header-content-title">${this.heading}</span></ed-heading
439
+ >
440
+ <div class="ed-c-black-friday-modal__header-content-description">${P(this.description)}</div>
441
+ </ed-layout-container>
442
+ </div>
443
+ </div>
444
+ <button class="ed-c-black-friday-modal__close-button" @click=${this.closeModal}>
445
+ <ed-icon name="close" />
446
+ <span class="is-vishidden">${this.closeButtonText}</span>
447
+ </button>
448
+ </header>
449
+ <div class="ed-c-black-friday-modal__body">
450
+ <ed-layout-container>
451
+ <ed-grid gap="lg" class="ed-c-black-friday-modal__promos">
452
+ ${this.promos.map(
453
+ (t) => v`
454
+ <ed-grid-item>
455
+ <div class="ed-c-black-friday-modal__card">
456
+ <div class="ed-c-black-friday-modal__card-body">
457
+ ${t.href ? v`
458
+ <a class="ed-c-black-friday-modal__card-media" href="${t.href}">
459
+ <img class="ed-c-black-friday-modal__card-image" src="${t.imgSrc}" alt="${t.imgAlt}" />
460
+ </a>
461
+ ` : v` <img class="ed-c-black-friday-modal__card-image" src="${t.imgSrc}" alt="${t.imgAlt}" /> `}
462
+ <ed-heading tagName="h4" variant="title-lg" class="ed-c-black-friday-modal__card-title">${t.heading}</ed-heading>
463
+
464
+ <ed-text-passage class="ed-u-display-block ed-u-margin-bottom-md"> ${P(t.description)} </ed-text-passage>
465
+ </div>
466
+ ${t.href && t.buttonText ? v`
467
+ <footer class="ed-c-black-friday-modal__card-footer">
468
+ <ed-button href="${t.href}" size="lg">${t.buttonText}</ed-button>
469
+ </footer>
470
+ ` : ""}
471
+ </div>
472
+ </ed-grid-item>
473
+ `
474
+ )}
475
+ </ed-grid>
476
+ <ed-heading tagName="h3" variant="headline-default" class="ed-c-black-friday-modal__section-title">${this.secondaryHeading}</ed-heading>
477
+ <ed-grid variant="${this.courses.length >= 3 ? "1-3up" : this.courses.length > 2 ? "2up" : "side-by-side"}">
478
+ ${this.courses.map(
479
+ (t) => v`
480
+ <ed-grid-item>
481
+ <div class="ed-c-black-friday-modal__card">
482
+ <div class="ed-c-black-friday-modal__card-body">
483
+ <a class="ed-c-black-friday-modal__card-media" href="${t.href}">
484
+ <img class="ed-c-black-friday-modal__card-image" src="${t.imgSrc}" alt="${t.imgAlt}" />
485
+ </a>
486
+ <ed-heading tagName="h4" variant="title-default" class="ed-c-black-friday-modal__card-title">${t.heading}</ed-heading>
487
+ </div>
488
+ </div>
489
+ </ed-grid-item>
490
+ `
491
+ )}
492
+ </ed-grid>
493
+ </ed-layout-container>
494
+ </div>
495
+ </dialog>
496
+ `;
497
+ }
498
+ }
499
+ u([
500
+ p()
501
+ ], m.prototype, "align");
502
+ u([
503
+ p()
504
+ ], m.prototype, "closeButtonText");
505
+ u([
506
+ p()
507
+ ], m.prototype, "hasBackdrop");
508
+ u([
509
+ p({ type: Boolean })
510
+ ], m.prototype, "isActive");
511
+ u([
512
+ p()
513
+ ], m.prototype, "imgSrc");
514
+ u([
515
+ p()
516
+ ], m.prototype, "imgAlt");
517
+ u([
518
+ p()
519
+ ], m.prototype, "heading");
520
+ u([
521
+ p()
522
+ ], m.prototype, "description");
523
+ u([
524
+ p()
525
+ ], m.prototype, "secondaryHeading");
526
+ u([
527
+ p({ type: Array })
528
+ ], m.prototype, "promos");
529
+ u([
530
+ p({ type: Array })
531
+ ], m.prototype, "courses");
532
+ u([
533
+ J(".ed-c-black-friday-modal__close-button")
534
+ ], m.prototype, "closeButton");
535
+ customElements.get("ed-black-friday-modal") === void 0 && customElements.define("ed-black-friday-modal", m);
536
+ export {
537
+ m as EdBlackFridaymodal
538
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brad-frost-web/eddie-web-components",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "start": "npm run build:custom-elements.json && npm run storybook",