@campminder/components 0.2.0 → 0.3.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.
@@ -1,4 +1,4 @@
1
- import { n as r } from "./property-B5JHHBCF.js";
1
+ import { n as r } from "./shell-tokens-BjECzZvL.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC
@@ -1,4 +1,4 @@
1
- import { i as p, n as h, a as g, b as d, t as c } from "./property-B5JHHBCF.js";
1
+ import { S as d, i as p, n as h, a as g, b as c, t as m } from "./shell-tokens-BjECzZvL.js";
2
2
  const b = p`
3
3
  * {
4
4
  padding: 0;
@@ -11,6 +11,12 @@ const b = p`
11
11
  height: 32px;
12
12
  min-height: 32px;
13
13
  max-height: 32px;
14
+
15
+ /* Declared per shadow root. This component is slotted into
16
+ * '<campminder-app-shell>' as a light-DOM sibling of the side nav, not a
17
+ * descendant of it, so it inherits nothing from the side nav's ':host' and
18
+ * must read the shared token itself. Rationale: '../shell-tokens.ts'. */
19
+ --font-family: ${d};
14
20
  }
15
21
 
16
22
  .banner {
@@ -45,7 +51,7 @@ const b = p`
45
51
  }
46
52
 
47
53
  .banner-text {
48
- font-family: 'Inter', sans-serif;
54
+ font-family: var(--font-family);
49
55
  font-size: 14px;
50
56
  font-weight: 400;
51
57
  line-height: 20px;
@@ -114,12 +120,12 @@ const b = p`
114
120
  }
115
121
  }
116
122
  `;
117
- var m = Object.defineProperty, u = Object.getOwnPropertyDescriptor, i = (n, a, r, s) => {
118
- for (var e = s > 1 ? void 0 : s ? u(a, r) : a, o = n.length - 1, l; o >= 0; o--)
119
- (l = n[o]) && (e = (s ? l(a, r, e) : l(e)) || e);
120
- return s && e && m(a, r, e), e;
123
+ var u = Object.defineProperty, f = Object.getOwnPropertyDescriptor, i = (n, a, o, s) => {
124
+ for (var e = s > 1 ? void 0 : s ? f(a, o) : a, r = n.length - 1, l; r >= 0; r--)
125
+ (l = n[r]) && (e = (s ? l(a, o, e) : l(e)) || e);
126
+ return s && e && u(a, o, e), e;
121
127
  };
122
- const x = /^(local|localhost|dev|develop(ment)?|qa\d*|test\d*|demo|sandbox|uat)$/;
128
+ const v = /^(local|localhost|dev|develop(ment)?|qa\d*|test\d*|demo|sandbox|uat)$/;
123
129
  let t = class extends g {
124
130
  constructor() {
125
131
  super(...arguments), this.client = "", this.superUser = "", this.activeEnvironment = "";
@@ -142,10 +148,10 @@ let t = class extends g {
142
148
  */
143
149
  get environmentBadgeClass() {
144
150
  const n = this.activeEnvironment.trim().toLowerCase();
145
- return n === "staging" ? "staging" : x.test(n) ? "local" : "alert";
151
+ return n === "staging" ? "staging" : v.test(n) ? "local" : "alert";
146
152
  }
147
153
  render() {
148
- return d`
154
+ return c`
149
155
  <section class="banner banner-text">
150
156
  <div class="content">
151
157
  <span class="text-bold name"
@@ -171,7 +177,7 @@ i([
171
177
  h({ type: String, attribute: "active-environment" })
172
178
  ], t.prototype, "activeEnvironment", 2);
173
179
  t = i([
174
- c("cm-super-user-banner")
180
+ m("cm-super-user-banner")
175
181
  ], t);
176
182
  export {
177
183
  t as SuperUserBanner
package/dist/top-bar.js CHANGED
@@ -1,6 +1,6 @@
1
- import { b as o, i as v, n as m, a as b, A as y, t as $ } from "./property-B5JHHBCF.js";
2
- import { r as g } from "./state-Ns9O6R8g.js";
3
- const _ = o`<svg
1
+ import { b as r, S as m, i as v, n as b, a as y, A as $, t as _ } from "./shell-tokens-BjECzZvL.js";
2
+ import { r as g } from "./state-BvQoY71J.js";
3
+ const L = r`<svg
4
4
  width="20"
5
5
  height="20"
6
6
  viewBox="0 0 20 20"
@@ -11,7 +11,7 @@ const _ = o`<svg
11
11
  d="M10 1.66675C5.40002 1.66675 1.66669 5.40008 1.66669 10.0001C1.66669 14.6001 5.40002 18.3334 10 18.3334C14.6 18.3334 18.3334 14.6001 18.3334 10.0001C18.3334 5.40008 14.6 1.66675 10 1.66675ZM8.33335 14.1667L4.16669 10.0001L5.34169 8.82508L8.33335 11.8084L14.6584 5.48341L15.8334 6.66675L8.33335 14.1667Z"
12
12
  fill="#00AA47"
13
13
  />
14
- </svg>`, L = o`<svg
14
+ </svg>`, S = r`<svg
15
15
  width="20"
16
16
  height="20"
17
17
  viewBox="0 0 20 20"
@@ -22,7 +22,7 @@ const _ = o`<svg
22
22
  d="M10 1.66675C5.39169 1.66675 1.66669 5.39175 1.66669 10.0001C1.66669 14.6084 5.39169 18.3334 10 18.3334C14.6084 18.3334 18.3334 14.6084 18.3334 10.0001C18.3334 5.39175 14.6084 1.66675 10 1.66675ZM14.1667 12.9917L12.9917 14.1667L10 11.1751L7.00835 14.1667L5.83335 12.9917L8.82502 10.0001L5.83335 7.00841L7.00835 5.83341L10 8.82508L12.9917 5.83341L14.1667 7.00841L11.175 10.0001L14.1667 12.9917Z"
23
23
  fill="#A0A0A0"
24
24
  />
25
- </svg>`, S = o`<svg
25
+ </svg>`, k = r`<svg
26
26
  width="24"
27
27
  height="24"
28
28
  viewBox="0 0 24 24"
@@ -33,7 +33,7 @@ const _ = o`<svg
33
33
  d="M8.70621 11.4139L11.2962 14.0039C11.6862 14.3939 12.3162 14.3939 12.7062 14.0039L15.2962 11.4139C15.9262 10.7839 15.4762 9.70386 14.5862 9.70386H9.40621C8.51621 9.70386 8.07621 10.7839 8.70621 11.4139Z"
34
34
  fill="#380F8C"
35
35
  />
36
- </svg>`, k = o`<svg
36
+ </svg>`, D = r`<svg
37
37
  width="24"
38
38
  height="24"
39
39
  viewBox="0 0 24 24"
@@ -44,7 +44,7 @@ const _ = o`<svg
44
44
  d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 17H11V11H13V17ZM13 9H11V7H13V9Z"
45
45
  fill="#380F8C"
46
46
  />
47
- </svg>`, h = o`<svg
47
+ </svg>`, h = r`<svg
48
48
  width="16"
49
49
  height="16"
50
50
  viewBox="0 0 16 16"
@@ -64,6 +64,12 @@ const _ = o`<svg
64
64
 
65
65
  :host {
66
66
  height: 56px;
67
+
68
+ /* Declared per shadow root. This component is slotted into
69
+ * '<campminder-app-shell>' as a light-DOM sibling of the side nav, not a
70
+ * descendant of it, so it inherits nothing from the side nav's ':host' and
71
+ * must read the shared token itself. Rationale: '../shell-tokens.ts'. */
72
+ --font-family: ${m};
67
73
  }
68
74
 
69
75
  .top-bar {
@@ -116,7 +122,7 @@ const _ = o`<svg
116
122
  }
117
123
 
118
124
  .page-title {
119
- font-family: 'Inter', sans-serif;
125
+ font-family: var(--font-family);
120
126
  font-size: 16px;
121
127
  font-weight: 400;
122
128
  line-height: 24px;
@@ -201,7 +207,7 @@ const _ = o`<svg
201
207
  }
202
208
 
203
209
  .user-info strong {
204
- font-family: 'Inter', sans-serif;
210
+ font-family: var(--font-family);
205
211
  font-size: 16px;
206
212
  font-weight: 600;
207
213
  line-height: 24px;
@@ -209,7 +215,7 @@ const _ = o`<svg
209
215
  }
210
216
 
211
217
  .user-info p {
212
- font-family: 'Inter', sans-serif;
218
+ font-family: var(--font-family);
213
219
  font-size: 14px;
214
220
  font-weight: 400;
215
221
  line-height: 20px;
@@ -232,7 +238,7 @@ const _ = o`<svg
232
238
  align-items: center;
233
239
  border-radius: 4px;
234
240
  text-decoration: none;
235
- font-family: 'Inter', sans-serif;
241
+ font-family: var(--font-family);
236
242
  font-size: 14px;
237
243
  font-weight: 400;
238
244
  line-height: 20px;
@@ -285,7 +291,7 @@ const _ = o`<svg
285
291
  box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.12);
286
292
  border-radius: 4px;
287
293
  display: none;
288
- font-family: 'Inter', sans-serif;
294
+ font-family: var(--font-family);
289
295
  overflow-y: auto;
290
296
  }
291
297
 
@@ -386,109 +392,109 @@ const _ = o`<svg
386
392
  display: none;
387
393
  }
388
394
  }
389
- `, D = (e) => {
390
- var t, i, n, r;
395
+ `, O = (e) => {
396
+ var t, n, i, o;
391
397
  try {
392
398
  const s = JSON.parse(decodeURIComponent(atob(e)));
393
- return s.account_data.links.sort(O), (i = (t = s.super_user_data) == null ? void 0 : t.sections) == null || i.sort(f), (r = (n = s.super_user_data) == null ? void 0 : n.sections) == null || r.forEach((a) => {
399
+ return s.account_data.links.sort(E), (n = (t = s.super_user_data) == null ? void 0 : t.sections) == null || n.sort(f), (o = (i = s.super_user_data) == null ? void 0 : i.sections) == null || o.forEach((a) => {
394
400
  var p;
395
401
  (p = a.features) == null || p.sort(f);
396
402
  }), s;
397
403
  } catch (s) {
398
404
  return console.error("Failed to decode and parse data:", s), null;
399
405
  }
400
- }, O = (e, t) => e.sort_order === void 0 && t.sort_order === void 0 ? e.name.localeCompare(t.name) : (e.sort_order ?? 0) - (t.sort_order ?? 0) || e.name.localeCompare(t.name), f = (e, t) => (e.sort_order ?? 0) - (t.sort_order ?? 0), E = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]), U = /* @__PURE__ */ new Set(["http:", "https:", "data:"]), A = "#", P = "https://portal.invalid";
401
- function x(e) {
406
+ }, E = (e, t) => e.sort_order === void 0 && t.sort_order === void 0 ? e.name.localeCompare(t.name) : (e.sort_order ?? 0) - (t.sort_order ?? 0) || e.name.localeCompare(t.name), f = (e, t) => (e.sort_order ?? 0) - (t.sort_order ?? 0), U = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]), A = /* @__PURE__ */ new Set(["http:", "https:", "data:"]), P = "#", F = "https://portal.invalid";
407
+ function w(e) {
402
408
  try {
403
- return new URL(e, P).protocol;
409
+ return new URL(e, F).protocol;
404
410
  } catch {
405
411
  return null;
406
412
  }
407
413
  }
408
- function w(e) {
414
+ function x(e) {
409
415
  if (!e) return !1;
410
- const t = x(e);
411
- return t !== null && E.has(t);
416
+ const t = w(e);
417
+ return t !== null && U.has(t);
412
418
  }
413
419
  function u(e) {
414
- return w(e) ? e : A;
420
+ return x(e) ? e : P;
415
421
  }
416
422
  function d(e) {
417
423
  if (!e) return "";
418
- const t = x(e);
419
- return t !== null && U.has(t) ? e : "";
424
+ const t = w(e);
425
+ return t !== null && A.has(t) ? e : "";
420
426
  }
421
- const F = /* @__PURE__ */ new Set(["height", "width", "top", "left"]), H = "height=720,width=1024", I = "noopener,noreferrer";
422
- function z(e) {
423
- const t = (e ?? "").split(",").map((n) => n.trim()).filter((n) => {
424
- const [r, s] = n.split("=");
425
- return F.has((r == null ? void 0 : r.toLowerCase()) ?? "") && /^\d+$/.test(s ?? "");
427
+ const H = /* @__PURE__ */ new Set(["height", "width", "top", "left"]), z = "height=720,width=1024", M = "noopener,noreferrer";
428
+ function V(e) {
429
+ const t = (e ?? "").split(",").map((i) => i.trim()).filter((i) => {
430
+ const [o, s] = i.split("=");
431
+ return H.has((o == null ? void 0 : o.toLowerCase()) ?? "") && /^\d+$/.test(s ?? "");
426
432
  });
427
- return `${t.length > 0 ? t.join(",") : H},${I}`;
433
+ return `${t.length > 0 ? t.join(",") : z},${M}`;
428
434
  }
429
- function V(e) {
435
+ function I(e) {
430
436
  return e ? e.split(/<br\b[^>]*>/i) : [];
431
437
  }
432
- var M = Object.defineProperty, B = Object.getOwnPropertyDescriptor, c = (e, t, i, n) => {
433
- for (var r = n > 1 ? void 0 : n ? B(t, i) : t, s = e.length - 1, a; s >= 0; s--)
434
- (a = e[s]) && (r = (n ? a(t, i, r) : a(r)) || r);
435
- return n && r && M(t, i, r), r;
438
+ var R = Object.defineProperty, B = Object.getOwnPropertyDescriptor, c = (e, t, n, i) => {
439
+ for (var o = i > 1 ? void 0 : i ? B(t, n) : t, s = e.length - 1, a; s >= 0; s--)
440
+ (a = e[s]) && (o = (i ? a(t, n, o) : a(o)) || o);
441
+ return i && o && R(t, n, o), o;
436
442
  };
437
- let l = class extends b {
443
+ let l = class extends y {
438
444
  constructor() {
439
445
  super(...arguments), this.data = null, this.isDropdownOpen = !1, this.isSuperUserDropdownOpen = !1, this.handleOutsideClick = (e) => {
440
- var i;
446
+ var n;
441
447
  const t = e.target;
442
- (i = this.shadowRoot) != null && i.contains(t) || this.closeAllDropdowns();
448
+ (n = this.shadowRoot) != null && n.contains(t) || this.closeAllDropdowns();
443
449
  }, this.toggleDropdown = (e) => {
444
450
  e.stopPropagation(), this.isDropdownOpen = !this.isDropdownOpen, this.isDropdownOpen && (this.isSuperUserDropdownOpen = !1);
445
451
  }, this.toggleSuperUserDropdown = (e) => {
446
452
  e.stopPropagation(), this.isSuperUserDropdownOpen = !this.isSuperUserDropdownOpen, this.isSuperUserDropdownOpen && (this.isDropdownOpen = !1);
447
453
  }, this.renderFeatureValue = (e) => {
448
454
  if (e.enabled !== void 0)
449
- return o`<span class="feature-value icon">${e.enabled ? _ : L}</span>`;
450
- const i = V(e.value).map((n, r) => r === 0 ? n : o`<br />${n}`);
451
- return o`<span class="feature-value">${i}</span>`;
452
- }, this.renderFeature = (e) => o`
455
+ return r`<span class="feature-value icon">${e.enabled ? L : S}</span>`;
456
+ const n = I(e.value).map((i, o) => o === 0 ? i : r`<br />${i}`);
457
+ return r`<span class="feature-value">${n}</span>`;
458
+ }, this.renderFeature = (e) => r`
453
459
  <div class="feature ${e.display === "block" ? "block" : ""}">
454
- ${e.name ? o`<span class="feature-name">${e.name}</span>` : ""}
460
+ ${e.name ? r`<span class="feature-name">${e.name}</span>` : ""}
455
461
  ${this.renderFeatureValue(e)}
456
462
  </div>
457
- `, this.renderFeatureSection = (e) => o`
463
+ `, this.renderFeatureSection = (e) => r`
458
464
  <div class="super-user-section">
459
- ${e.title ? o`<p class="section-title">${e.title}</p>` : ""}
460
- ${e.sub_title ? o`<p class="sub-title">${e.sub_title}</p>` : ""}
465
+ ${e.title ? r`<p class="section-title">${e.title}</p>` : ""}
466
+ ${e.sub_title ? r`<p class="sub-title">${e.sub_title}</p>` : ""}
461
467
  ${e.features.map(this.renderFeature)}
462
468
  </div>
463
469
  `, this.renderNavigationLink = (e) => {
464
- const { name: t, url: i, new_tab: n, icon_url: r, popup: s, popup_properties: a } = e, p = n || s;
465
- return s ? o`
470
+ const { name: t, url: n, new_tab: i, icon_url: o, popup: s, popup_properties: a } = e, p = i || s;
471
+ return s ? r`
466
472
  <a
467
473
  href="#nowhere"
468
474
  target="_top"
469
- @click="${() => (w(i) && window.open(i, "", z(a)), !1)}"
475
+ @click="${() => (x(n) && window.open(n, "", V(a)), !1)}"
470
476
  >
471
477
  <img
472
- src=${d(r)}
478
+ src=${d(o)}
473
479
  alt="icon"
474
480
  class="link-icon"
475
481
  referrerpolicy="no-referrer"
476
482
  />
477
- ${t} ${p ? o`<span class="new-tab-icon">${h}</span>` : null}
483
+ ${t} ${p ? r`<span class="new-tab-icon">${h}</span>` : null}
478
484
  </a>
479
- ` : o`
485
+ ` : r`
480
486
  <a
481
- href=${u(i)}
482
- target=${n ? "_blank" : "_self"}
483
- rel=${n ? "noopener noreferrer" : y}
487
+ href=${u(n)}
488
+ target=${i ? "_blank" : "_self"}
489
+ rel=${i ? "noopener noreferrer" : $}
484
490
  >
485
491
  <img
486
- src=${d(r)}
492
+ src=${d(o)}
487
493
  alt="icon"
488
494
  class="link-icon"
489
495
  referrerpolicy="no-referrer"
490
496
  />
491
- ${t} ${p ? o`<span class="new-tab-icon">${h}</span>` : null}
497
+ ${t} ${p ? r`<span class="new-tab-icon">${h}</span>` : null}
492
498
  </a>
493
499
  `;
494
500
  };
@@ -509,16 +515,16 @@ let l = class extends b {
509
515
  this.isDropdownOpen = !1, this.isSuperUserDropdownOpen = !1;
510
516
  }
511
517
  renderSearch() {
512
- return o`<slot name="search"></slot>`;
518
+ return r`<slot name="search"></slot>`;
513
519
  }
514
- renderSuperUserDropdown(e, t, i) {
515
- var n;
516
- return o`
520
+ renderSuperUserDropdown(e, t, n) {
521
+ var i;
522
+ return r`
517
523
  <div
518
524
  class=${`super-user-toggle ${this.isSuperUserDropdownOpen ? "active" : ""}`}
519
525
  @click=${this.toggleSuperUserDropdown}
520
526
  >
521
- <span class="info-icon">${k}</span>
527
+ <span class="info-icon">${D}</span>
522
528
  </div>
523
529
  <div class=${`super-user-dropdown ${this.isSuperUserDropdownOpen ? "open" : ""}`}>
524
530
  <div class="super-user-section-client">
@@ -526,17 +532,17 @@ let l = class extends b {
526
532
  <p class="sub-title">Domain: ${t.domain}</p>
527
533
  <p class="sub-title">Country: ${t.country}</p>
528
534
  </div>
529
- ${(n = e == null ? void 0 : e.sections) == null ? void 0 : n.map(this.renderFeatureSection)}
535
+ ${(i = e == null ? void 0 : e.sections) == null ? void 0 : i.map(this.renderFeatureSection)}
530
536
  <div class="super-user-section-btn">
531
537
  <div class="feature">
532
- <a href=${u(i)} class="reset-pwd-url">Reset Password</a>
538
+ <a href=${u(n)} class="reset-pwd-url">Reset Password</a>
533
539
  </div>
534
540
  </div>
535
541
  </div>
536
542
  `;
537
543
  }
538
- renderUserDropdown(e, t, i) {
539
- return o`
544
+ renderUserDropdown(e, t, n) {
545
+ return r`
540
546
  <div
541
547
  class=${`user-profile ${this.isDropdownOpen ? "active" : ""}`}
542
548
  @click=${this.toggleDropdown}
@@ -547,29 +553,29 @@ let l = class extends b {
547
553
  class="profile-pic"
548
554
  referrerpolicy="no-referrer"
549
555
  />
550
- <span class="user-drop-down-icon">${S}</span>
556
+ <span class="user-drop-down-icon">${k}</span>
551
557
  </div>
552
558
  <div class=${`dropdown ${this.isDropdownOpen ? "open" : ""}`}>
553
559
  <div class="user-info">
554
560
  <strong>${e.name}</strong>
555
561
  <p>${t.name}</p>
556
562
  </div>
557
- <div class="navigation-links">${i.map(this.renderNavigationLink)}</div>
563
+ <div class="navigation-links">${n.map(this.renderNavigationLink)}</div>
558
564
  </div>
559
565
  `;
560
566
  }
561
567
  render() {
562
568
  if (!this.data)
563
- return o`<div>Loading...</div>`;
569
+ return r`<div>Loading...</div>`;
564
570
  const {
565
571
  logo_url: e,
566
572
  page_title: t,
567
- account_data: i,
568
- client_data: n,
569
- super_user_data: r,
573
+ account_data: n,
574
+ client_data: i,
575
+ super_user_data: o,
570
576
  reset_password_url: s
571
- } = this.data, { person_data: a, links: p } = i;
572
- return o`
577
+ } = this.data, { person_data: a, links: p } = n;
578
+ return r`
573
579
  <section class="top-bar">
574
580
  <div class="top-bar-content">
575
581
  <div class="page-info">
@@ -586,8 +592,8 @@ let l = class extends b {
586
592
 
587
593
  <div class="user-navigation">
588
594
  ${this.renderSearch()}
589
- ${r ? this.renderSuperUserDropdown(r, n, s) : null}
590
- ${this.renderUserDropdown(a, n, p)}
595
+ ${o ? this.renderSuperUserDropdown(o, i, s) : null}
596
+ ${this.renderUserDropdown(a, i, p)}
591
597
  </div>
592
598
  </div>
593
599
  </section>
@@ -596,9 +602,9 @@ let l = class extends b {
596
602
  };
597
603
  l.styles = C;
598
604
  c([
599
- m({
605
+ b({
600
606
  type: Object,
601
- converter: { fromAttribute: D }
607
+ converter: { fromAttribute: O }
602
608
  })
603
609
  ], l.prototype, "data", 2);
604
610
  c([
@@ -608,7 +614,7 @@ c([
608
614
  g()
609
615
  ], l.prototype, "isSuperUserDropdownOpen", 2);
610
616
  l = c([
611
- $("cm-top-bar")
617
+ _("cm-top-bar")
612
618
  ], l);
613
619
  export {
614
620
  l as TopBar
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campminder/components",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"