@uoguelph/web-components 2.0.8-rc.0 → 2.0.9-rc.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.
@@ -1,74 +1,75 @@
1
- import { w as z, x as j, y as R, z as U, S as K, l as L, c as M, p as N, a as o, A as E, f as V, B as y, e as k, F as Y, C as G, s as H, t as I, g as w, h as x, i as J, j as P, k as l, r as _, b as Q } from "./index-CEFM1xyC.js";
2
- import { a as W } from "./slot-DaIvQlrl.js";
3
- function B(n, t) {
4
- return n === t || (n == null ? void 0 : n[K]) === t;
1
+ import { w as K, x as L, y as M, z as N, S as V, l as Y, c as G, p as H, a as o, A as _, f as I, B as h, e as x, F as J, C as P, s as Q, t as W, g as k, h as w, i as X, j as Z, k as l, r as E, b as $ } from "./index-BxiW26Pq.js";
2
+ import { a as ee } from "./slot-DAai__2s.js";
3
+ function B(s, t) {
4
+ return s === t || (s == null ? void 0 : s[V]) === t;
5
5
  }
6
- function A(n = {}, t, s, u) {
7
- return z(() => {
8
- var i, a;
9
- return j(() => {
10
- i = a, a = [], R(() => {
11
- n !== s(...a) && (t(n, ...a), i && B(s(...i), n) && t(null, ...i));
6
+ function A(s = {}, t, n, g) {
7
+ return K(() => {
8
+ var u, i;
9
+ return L(() => {
10
+ u = i, i = [], M(() => {
11
+ s !== n(...i) && (t(s, ...i), u && B(n(...u), s) && t(null, ...u));
12
12
  });
13
13
  }), () => {
14
- U(() => {
15
- a && B(s(...a), n) && t(null, ...a);
14
+ N(() => {
15
+ i && B(n(...i), s) && t(null, ...i);
16
16
  });
17
17
  };
18
- }), n;
18
+ }), s;
19
19
  }
20
- const X = (n) => Array.from(n.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], audio[controls], video[controls], details, summary, [tabindex]:not([tabindex="-1"])')), Z = (n, t, s) => {
21
- !t() && n.target === n.currentTarget && s(!1);
22
- }, $ = (n, t) => {
23
- n.key === "Escape" && t(!1);
24
- }, ee = (n, t, s, u, i) => {
25
- var a;
26
- if (t() && !s().contains(n.relatedTarget) && !u().contains(n.relatedTarget))
27
- if (n.preventDefault(), n.target === i()) {
28
- const d = X(u());
29
- (a = d[d.length - 1]) == null || a.focus();
30
- } else
31
- i().focus();
32
- };
33
- var te = (n, t) => t(!1), ne = V('<div><div part="content"><button aria-label="Close modal"><!></button> <!></div></div>');
34
- function se(n, t) {
35
- N(t, !0);
36
- let s = o(t, "isOpen", 15), u = o(t, "centered", 7), i = o(t, "autoOpen", 7), a = o(t, "label", 7), d = o(t, "alertDialog", 7), v = o(t, "staticBackdrop", 7), g = o(t, "dismissButton", 7), f = o(t, "container", 7), b = o(t, "el", 7), h = o(t, "inertElements", 7);
37
- E(() => {
38
- i() && s(!0);
39
- }), E(() => {
40
- if (s()) {
20
+ const te = (s) => Array.from(s.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], audio[controls], video[controls], details, summary, [tabindex]:not([tabindex="-1"])'));
21
+ var se = I('<div><div part="content"><button aria-label="Close modal"><!></button> <!></div></div>');
22
+ function ne(s, t) {
23
+ H(t, !0);
24
+ let n = o(t, "isOpen", 15), g = o(t, "centered", 7), u = o(t, "autoOpen", 7), i = o(t, "label", 7), y = o(t, "alertDialog", 7), v = o(t, "staticBackdrop", 7), f = o(t, "dismissButton", 7), b = o(t, "container", 7), d = o(t, "el", 7), m = o(t, "inertElements", 7);
25
+ const S = (e) => {
26
+ !v() && e.target === e.currentTarget && n(!1);
27
+ }, q = (e) => {
28
+ e.key === "Escape" && n(!1);
29
+ }, F = (e) => {
30
+ var c;
31
+ if (n() && !b().contains(e.relatedTarget) && !d().contains(e.relatedTarget))
32
+ if (e.preventDefault(), e.target === f()) {
33
+ const r = te(d());
34
+ (c = r[r.length - 1]) == null || c.focus();
35
+ } else
36
+ f().focus();
37
+ };
38
+ _(() => {
39
+ u() && n(!0);
40
+ }), _(() => {
41
+ if (n()) {
41
42
  window.requestAnimationFrame(() => {
42
43
  window.requestAnimationFrame(() => {
43
44
  window.requestAnimationFrame(() => {
44
- f().focus();
45
+ b().focus();
45
46
  });
46
47
  });
47
48
  });
48
- let e = b();
49
+ let e = d();
49
50
  for (; e !== null && e !== document.body; ) {
50
- const m = e.parentElement;
51
- if (m === null) {
52
- const c = e.getRootNode();
53
- if (c instanceof ShadowRoot) {
54
- e = c.host;
51
+ const c = e.parentElement;
52
+ if (c === null) {
53
+ const r = e.getRootNode();
54
+ if (r instanceof ShadowRoot) {
55
+ e = r.host;
55
56
  continue;
56
57
  }
57
58
  }
58
- if (m !== null)
59
- for (const c of m.children)
60
- c !== e && !c.inert && (c.inert = !0, h().push(c));
61
- e = m;
59
+ if (c !== null)
60
+ for (const r of c.children)
61
+ r !== e && !r.inert && (r.inert = !0, m().push(r));
62
+ e = c;
62
63
  }
63
- b().dispatchEvent(new CustomEvent("opened", { bubbles: !0, composed: !0 }));
64
+ d().dispatchEvent(new CustomEvent("opened", { bubbles: !0, composed: !0 }));
64
65
  } else {
65
- for (const e of h())
66
+ for (const e of m())
66
67
  e.removeAttribute("inert");
67
- h([]), b().dispatchEvent(new CustomEvent("closed", { bubbles: !0, composed: !0 }));
68
+ m([]), d().dispatchEvent(new CustomEvent("closed", { bubbles: !0, composed: !0 }));
68
69
  }
69
- document.body.style.overflow = s() ? "hidden" : "";
70
+ document.body.style.overflow = n() ? "hidden" : "";
70
71
  });
71
- const S = tv({
72
+ const T = tv({
72
73
  slots: {
73
74
  base: "bg-opacity-50 fixed top-0 left-0 z-[1000] flex h-screen w-screen bg-black transition-[opacity,visibility]",
74
75
  content: "absolute left-1/2 z-1 h-fit max-h-full w-full max-w-full -translate-x-1/2 overflow-auto transition-transform motion-reduce:transition-none sm:w-fit sm:p-8",
@@ -76,14 +77,8 @@ function se(n, t) {
76
77
  },
77
78
  variants: {
78
79
  isOpen: {
79
- true: {
80
- base: "visible opacity-100",
81
- content: "visible opacity-100"
82
- },
83
- false: {
84
- base: "invisible opacity-0",
85
- content: "invisible opacity-0"
86
- }
80
+ true: { base: "visible opacity-100", content: "visible opacity-100" },
81
+ false: { base: "invisible opacity-0", content: "invisible opacity-0" }
87
82
  },
88
83
  centered: { true: "" }
89
84
  },
@@ -101,71 +96,40 @@ function se(n, t) {
101
96
  {
102
97
  isOpen: !1,
103
98
  centered: !0,
104
- class: {
105
- content: "top-1/2 translate-y-[calc(-50%_-_50px)]"
106
- }
99
+ class: { content: "top-1/2 translate-y-[calc(-50%_-_50px)]" }
107
100
  }
108
101
  ]
109
- }), { base: q, content: F, button: T } = S({
110
- isOpen: s(),
111
- centered: u()
112
- });
113
- var r = ne();
114
- y(r, "tabindex", -1), r.__click = [Z, v, s], r.__keyup = [$, s], r.__focusout = [
115
- ee,
116
- s,
117
- f,
118
- b,
119
- g
120
- ];
121
- var O = k(r), p = k(O);
122
- p.__click = [te, s];
123
- var C = k(p);
124
- Y(C, {
125
- get icon() {
126
- return G;
127
- }
128
- }), _(p), A(p, (e) => g(e), () => g());
129
- var D = H(p, 2);
130
- return W(D, t, "default", {}), _(O), _(r), A(r, (e) => f(e), () => f()), I(
131
- (e, m, c) => {
132
- x(r, 1, e), y(r, "role", d() ? "alertdialog" : "dialog"), y(r, "aria-modal", s() ? "true" : ""), y(r, "aria-label", a()), x(O, 1, m), x(p, 1, c);
133
- },
134
- [
135
- () => w(q()),
136
- () => w(F()),
137
- () => w(T())
138
- ]
139
- ), J(n, r), P({
102
+ }), { base: C, content: D, button: z } = T({ isOpen: n(), centered: g() });
103
+ var j = {
140
104
  get isOpen() {
141
- return s();
105
+ return n();
142
106
  },
143
107
  set isOpen(e) {
144
- s(e), l();
108
+ n(e), l();
145
109
  },
146
110
  get centered() {
147
- return u();
111
+ return g();
148
112
  },
149
113
  set centered(e) {
150
- u(e), l();
114
+ g(e), l();
151
115
  },
152
116
  get autoOpen() {
153
- return i();
117
+ return u();
154
118
  },
155
119
  set autoOpen(e) {
156
- i(e), l();
120
+ u(e), l();
157
121
  },
158
122
  get label() {
159
- return a();
123
+ return i();
160
124
  },
161
125
  set label(e) {
162
- a(e), l();
126
+ i(e), l();
163
127
  },
164
128
  get alertDialog() {
165
- return d();
129
+ return y();
166
130
  },
167
131
  set alertDialog(e) {
168
- d(e), l();
132
+ y(e), l();
169
133
  },
170
134
  get staticBackdrop() {
171
135
  return v();
@@ -174,60 +138,60 @@ function se(n, t) {
174
138
  v(e), l();
175
139
  },
176
140
  get dismissButton() {
177
- return g();
141
+ return f();
178
142
  },
179
143
  set dismissButton(e) {
180
- g(e), l();
144
+ f(e), l();
181
145
  },
182
146
  get container() {
183
- return f();
147
+ return b();
184
148
  },
185
149
  set container(e) {
186
- f(e), l();
150
+ b(e), l();
187
151
  },
188
152
  get el() {
189
- return b();
153
+ return d();
190
154
  },
191
155
  set el(e) {
192
- b(e), l();
156
+ d(e), l();
193
157
  },
194
158
  get inertElements() {
195
- return h();
159
+ return m();
196
160
  },
197
161
  set inertElements(e) {
198
- h(e), l();
162
+ m(e), l();
199
163
  }
200
- });
164
+ }, a = se();
165
+ h(a, "tabindex", -1), a.__click = S, a.__keyup = q, a.__focusout = F;
166
+ var O = x(a), p = x(O);
167
+ p.__click = () => n(!1);
168
+ var R = x(p);
169
+ J(R, {
170
+ get icon() {
171
+ return P;
172
+ }
173
+ }), E(p), A(p, (e) => f(e), () => f());
174
+ var U = Q(p, 2);
175
+ return ee(U, t, "default", {}), E(O), E(a), A(a, (e) => b(e), () => b()), W(
176
+ (e, c, r) => {
177
+ w(a, 1, e), h(a, "role", y() ? "alertdialog" : "dialog"), h(a, "aria-modal", n() ? "true" : ""), h(a, "aria-label", i()), w(O, 1, c), w(p, 1, r);
178
+ },
179
+ [
180
+ () => k(C()),
181
+ () => k(D()),
182
+ () => k(z())
183
+ ]
184
+ ), X(s, a), Z(j);
201
185
  }
202
- L(["click", "keyup", "focusout"]);
203
- customElements.define("uofg-modal", M(
204
- se,
186
+ Y(["click", "keyup", "focusout"]);
187
+ customElements.define("uofg-modal", G(
188
+ ne,
205
189
  {
206
- label: {
207
- attribute: "label",
208
- reflect: !0,
209
- type: "String"
210
- },
211
- alertDialog: {
212
- attribute: "alert-dialog",
213
- reflect: !0,
214
- type: "String"
215
- },
216
- centered: {
217
- attribute: "centered",
218
- reflect: !0,
219
- type: "Boolean"
220
- },
221
- autoOpen: {
222
- attribute: "auto-open",
223
- reflect: !0,
224
- type: "Boolean"
225
- },
226
- staticBackdrop: {
227
- attribute: "static-backdrop",
228
- reflect: !0,
229
- type: "Boolean"
230
- },
190
+ label: { attribute: "label", reflect: !0, type: "String" },
191
+ alertDialog: { attribute: "alert-dialog", reflect: !0, type: "String" },
192
+ centered: { attribute: "centered", reflect: !0, type: "Boolean" },
193
+ autoOpen: { attribute: "auto-open", reflect: !0, type: "Boolean" },
194
+ staticBackdrop: { attribute: "static-backdrop", reflect: !0, type: "Boolean" },
231
195
  isOpen: {},
232
196
  dismissButton: {},
233
197
  container: {},
@@ -237,9 +201,9 @@ customElements.define("uofg-modal", M(
237
201
  ["default"],
238
202
  [],
239
203
  !0,
240
- (n) => class extends n {
204
+ (s) => class extends s {
241
205
  constructor() {
242
- super(), Q(this.shadowRoot), this.el = this, this.inertElements = [], this.isOpen = !1;
206
+ super(), $(this.shadowRoot), this.el = this, this.inertElements = [], this.isOpen = !1;
243
207
  }
244
208
  disconnectedCallback() {
245
209
  for (const t of this.inertElements)
@@ -263,5 +227,5 @@ customElements.define("uofg-modal", M(
263
227
  }
264
228
  ));
265
229
  export {
266
- se as default
230
+ ne as default
267
231
  };
@@ -1 +1 @@
1
- :root{font-size:62.5%}body{font-size:1.6rem;margin:0;padding:0}uofg-header{display:block;width:100%}uofg-header *{display:none}uofg-header:defined{height:fit-content!important}uofg-header:not(:defined){height:5rem!important;background-color:#000}@media screen and (min-width: 1024px){uofg-header:not(:defined){height:14rem!important;background:linear-gradient(180deg,#fff,#fff 28%,#000 28%,#000)}}uofg-header:not(:defined):has(*),uofg-header:not(:defined)[page-title]{height:10rem!important;background:linear-gradient(0deg,#ddd,#ddd 50%,#000 50%,#000)}@media screen and (min-width: 1024px){uofg-header:not(:defined):has(*),uofg-header:not(:defined)[page-title]{height:18rem!important;background:linear-gradient(180deg,#fff,#fff 22%,#000 22%,#000 78%,#ddd 78%,#ddd)}}uofg-header:not(:defined):has(*)[variant=dual-brand],uofg-header:not(:defined)[page-title][variant=dual-brand]{height:11.5rem!important}@media screen and (min-width: 1024px){uofg-header:not(:defined):has(*)[variant=dual-brand],uofg-header:not(:defined)[page-title][variant=dual-brand]{height:14rem!important}}uofg-footer{display:block}uofg-modal{display:block;position:fixed;visibility:hidden;z-index:1000}uofg-alert{display:block;max-width:100rem}
1
+ :root{font-size:62.5%}body{font-size:1.6rem;margin:0;padding:0}uofg-header{display:block;width:100%}uofg-header *{display:none}uofg-header:defined{height:fit-content!important}uofg-header:not(:defined){height:5rem!important;background-color:#000}@media screen and (min-width:1024px){uofg-header:not(:defined){height:14rem!important;background:linear-gradient(180deg,#fff,#fff 28%,#000 28%,#000)}}uofg-header:not(:defined):has(*),uofg-header:not(:defined)[page-title]{height:10rem!important;background:linear-gradient(0deg,#ddd,#ddd 50%,#000 50%,#000)}@media screen and (min-width:1024px){uofg-header:not(:defined):has(*),uofg-header:not(:defined)[page-title]{height:18rem!important;background:linear-gradient(180deg,#fff,#fff 22%,#000 22%,#000 78%,#ddd 78%,#ddd)}}uofg-header:not(:defined):has(*)[variant=dual-brand],uofg-header:not(:defined)[page-title][variant=dual-brand]{height:11.5rem!important}@media screen and (min-width:1024px){uofg-header:not(:defined):has(*)[variant=dual-brand],uofg-header:not(:defined)[page-title][variant=dual-brand]{height:14rem!important}}uofg-footer{display:block}uofg-modal{display:block;position:fixed;visibility:hidden;z-index:1000}uofg-alert{display:block;max-width:100rem}
@@ -0,0 +1,25 @@
1
+ import { a4 as n, x as u, w as d, ak as f, al as v } from "./index-BxiW26Pq.js";
2
+ function m(a, e, c = e) {
3
+ var w = a === "x", l = () => n(() => {
4
+ r = !0, clearTimeout(t), t = setTimeout(s, 100), c(window[w ? "scrollX" : "scrollY"]);
5
+ });
6
+ addEventListener("scroll", l, {
7
+ passive: !0
8
+ });
9
+ var r = !1, t, s = () => {
10
+ r = !1;
11
+ }, i = !0;
12
+ u(() => {
13
+ var o = e();
14
+ i ? i = !1 : !r && o != null && (r = !0, clearTimeout(t), scrollTo(window.scrollX, o), t = setTimeout(s, 100));
15
+ }), d(l), f(() => {
16
+ removeEventListener("scroll", l);
17
+ });
18
+ }
19
+ function x(a, e) {
20
+ v(window, ["resize"], () => n(() => e(window[a])));
21
+ }
22
+ export {
23
+ x as a,
24
+ m as b
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uoguelph/web-components",
3
- "version": "2.0.8-rc.0",
3
+ "version": "2.0.9-rc.0",
4
4
  "description": "University of Guelph Web Components Library",
5
5
  "type": "module",
6
6
  "files": [