@campminder/components 0.1.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.
Files changed (76) hide show
  1. package/README.md +198 -0
  2. package/dist/index.d.ts +16 -0
  3. package/dist/index.js +11 -0
  4. package/dist/menu-tree.upstream.test.d.ts +1 -0
  5. package/dist/property-B5JHHBCF.js +603 -0
  6. package/dist/side-nav/MegaMenu.d.ts +50 -0
  7. package/dist/side-nav/MegaMenu.styles.d.ts +33 -0
  8. package/dist/side-nav/SideNav.d.ts +89 -0
  9. package/dist/side-nav/SideNav.styles.d.ts +42 -0
  10. package/dist/side-nav/Utils/helpers.d.ts +57 -0
  11. package/dist/side-nav/assets/MegaMenuIcons/AccountsGrayIcon.d.ts +2 -0
  12. package/dist/side-nav/assets/MegaMenuIcons/AdminGrayIcon.d.ts +2 -0
  13. package/dist/side-nav/assets/MegaMenuIcons/AlumniGrayIcon.d.ts +2 -0
  14. package/dist/side-nav/assets/MegaMenuIcons/CampInTouchGrayIcon.d.ts +2 -0
  15. package/dist/side-nav/assets/MegaMenuIcons/CamperGrayIcon.d.ts +2 -0
  16. package/dist/side-nav/assets/MegaMenuIcons/CommunicationGrayIcon.d.ts +2 -0
  17. package/dist/side-nav/assets/MegaMenuIcons/DefaultMMIcon.d.ts +2 -0
  18. package/dist/side-nav/assets/MegaMenuIcons/FinancialGrayIcon.d.ts +2 -0
  19. package/dist/side-nav/assets/MegaMenuIcons/MedicalGrayIcon.d.ts +2 -0
  20. package/dist/side-nav/assets/MegaMenuIcons/OpenInNewIcon.d.ts +2 -0
  21. package/dist/side-nav/assets/MegaMenuIcons/ReportsGrayIcon.d.ts +2 -0
  22. package/dist/side-nav/assets/MegaMenuIcons/SchedulingGrayIcon.d.ts +2 -0
  23. package/dist/side-nav/assets/MegaMenuIcons/StaffGrayIcon.d.ts +2 -0
  24. package/dist/side-nav/assets/MegaMenuIcons/TravelGrayIcon.d.ts +2 -0
  25. package/dist/side-nav/assets/MegaMenuIcons/index.d.ts +16 -0
  26. package/dist/side-nav/assets/SideNavIcons/AccountsIcon.d.ts +2 -0
  27. package/dist/side-nav/assets/SideNavIcons/AdminIcon.d.ts +2 -0
  28. package/dist/side-nav/assets/SideNavIcons/AlumniIcon.d.ts +2 -0
  29. package/dist/side-nav/assets/SideNavIcons/CampInTouch.d.ts +2 -0
  30. package/dist/side-nav/assets/SideNavIcons/CamperIcon.d.ts +2 -0
  31. package/dist/side-nav/assets/SideNavIcons/ChevronRightIcon.d.ts +2 -0
  32. package/dist/side-nav/assets/SideNavIcons/CloseIcon.d.ts +2 -0
  33. package/dist/side-nav/assets/SideNavIcons/CommunicationIcon.d.ts +2 -0
  34. package/dist/side-nav/assets/SideNavIcons/DefaultNavIcon.d.ts +2 -0
  35. package/dist/side-nav/assets/SideNavIcons/FinancialIcon.d.ts +2 -0
  36. package/dist/side-nav/assets/SideNavIcons/HomeIcon.d.ts +2 -0
  37. package/dist/side-nav/assets/SideNavIcons/MedicalIcon.d.ts +2 -0
  38. package/dist/side-nav/assets/SideNavIcons/MenuCollapseIcon.d.ts +2 -0
  39. package/dist/side-nav/assets/SideNavIcons/MenuIcon.d.ts +10 -0
  40. package/dist/side-nav/assets/SideNavIcons/ReportsIcon.d.ts +2 -0
  41. package/dist/side-nav/assets/SideNavIcons/SchedulingIcon.d.ts +2 -0
  42. package/dist/side-nav/assets/SideNavIcons/StaffIcon.d.ts +2 -0
  43. package/dist/side-nav/assets/SideNavIcons/TravelIcon.d.ts +2 -0
  44. package/dist/side-nav/assets/SideNavIcons/index.d.ts +20 -0
  45. package/dist/side-nav/icon-map.d.ts +17 -0
  46. package/dist/side-nav/index.d.ts +5 -0
  47. package/dist/side-nav/mega-menu-icon-map.d.ts +20 -0
  48. package/dist/side-nav/mega-menu-layout.d.ts +9 -0
  49. package/dist/side-nav/mega-menu.test.d.ts +1 -0
  50. package/dist/side-nav/side-nav.test.d.ts +1 -0
  51. package/dist/side-nav.d.ts +1 -0
  52. package/dist/side-nav.js +1198 -0
  53. package/dist/state-Ns9O6R8g.js +12 -0
  54. package/dist/super-user-banner/SuperUserBanner.d.ts +43 -0
  55. package/dist/super-user-banner/SuperUserBanner.styles.d.ts +21 -0
  56. package/dist/super-user-banner/index.d.ts +2 -0
  57. package/dist/super-user-banner/super-user-banner.test.d.ts +1 -0
  58. package/dist/super-user-banner.d.ts +1 -0
  59. package/dist/super-user-banner.js +178 -0
  60. package/dist/top-bar/TopBar.d.ts +39 -0
  61. package/dist/top-bar/TopBar.styles.d.ts +1 -0
  62. package/dist/top-bar/Utils/helpers.d.ts +3 -0
  63. package/dist/top-bar/Utils/safe-url.d.ts +56 -0
  64. package/dist/top-bar/Utils/safe-url.test.d.ts +1 -0
  65. package/dist/top-bar/Utils/types.d.ts +50 -0
  66. package/dist/top-bar/assets/TopBarIcons/CheckIcon.d.ts +2 -0
  67. package/dist/top-bar/assets/TopBarIcons/CrossIcon.d.ts +2 -0
  68. package/dist/top-bar/assets/TopBarIcons/DropDownIcon.d.ts +2 -0
  69. package/dist/top-bar/assets/TopBarIcons/InfoIcon.d.ts +2 -0
  70. package/dist/top-bar/assets/TopBarIcons/OpenInNewIcon.d.ts +2 -0
  71. package/dist/top-bar/assets/TopBarIcons/index.d.ts +7 -0
  72. package/dist/top-bar/index.d.ts +3 -0
  73. package/dist/top-bar/top-bar.test.d.ts +1 -0
  74. package/dist/top-bar.d.ts +1 -0
  75. package/dist/top-bar.js +615 -0
  76. package/package.json +52 -0
@@ -0,0 +1,615 @@
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
4
+ width="20"
5
+ height="20"
6
+ viewBox="0 0 20 20"
7
+ fill="none"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ >
10
+ <path
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
+ fill="#00AA47"
13
+ />
14
+ </svg>`, L = o`<svg
15
+ width="20"
16
+ height="20"
17
+ viewBox="0 0 20 20"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ >
21
+ <path
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
+ fill="#A0A0A0"
24
+ />
25
+ </svg>`, S = o`<svg
26
+ width="24"
27
+ height="24"
28
+ viewBox="0 0 24 24"
29
+ fill="none"
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ >
32
+ <path
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
+ fill="#380F8C"
35
+ />
36
+ </svg>`, k = o`<svg
37
+ width="24"
38
+ height="24"
39
+ viewBox="0 0 24 24"
40
+ fill="none"
41
+ xmlns="http://www.w3.org/2000/svg"
42
+ >
43
+ <path
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
+ fill="#380F8C"
46
+ />
47
+ </svg>`, h = o`<svg
48
+ width="16"
49
+ height="16"
50
+ viewBox="0 0 16 16"
51
+ fill="none"
52
+ xmlns="http://www.w3.org/2000/svg"
53
+ >
54
+ <path
55
+ d="M12.6667 12.6667H3.33333V3.33333H8V2H3.33333C2.59333 2 2 2.6 2 3.33333V12.6667C2 13.4 2.59333 14 3.33333 14H12.6667C13.4 14 14 13.4 14 12.6667V8H12.6667V12.6667ZM9.33333 2V3.33333H11.7267L5.17333 9.88667L6.11333 10.8267L12.6667 4.27333V6.66667H14V2H9.33333Z"
56
+ fill="#282828"
57
+ />
58
+ </svg> `, C = v`
59
+ * {
60
+ padding: 0;
61
+ margin: 0;
62
+ box-sizing: border-box;
63
+ }
64
+
65
+ :host {
66
+ height: 56px;
67
+ }
68
+
69
+ .top-bar {
70
+ height: inherit;
71
+ background-color: #ffffff;
72
+ display: flex;
73
+ padding: 8px 16px;
74
+ border-bottom: 1px solid #a0a0a0;
75
+ transition:
76
+ left 0.3s ease,
77
+ width 0.3s ease;
78
+ }
79
+
80
+ .top-bar-content {
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: space-between;
84
+ width: 100%;
85
+ position: relative;
86
+ min-width: 0;
87
+ max-width: 100%;
88
+ }
89
+
90
+ .page-info {
91
+ display: flex;
92
+ align-items: center;
93
+ flex-shrink: 0;
94
+ }
95
+
96
+ @media screen and (max-width: 530px) {
97
+ .page-info {
98
+ padding-left: 56px;
99
+ }
100
+ }
101
+
102
+ .home-icon {
103
+ display: grid;
104
+ place-content: center;
105
+ width: 136.02px;
106
+ height: 24px;
107
+ cursor: pointer;
108
+ }
109
+
110
+ .home-icon-img {
111
+ height: auto;
112
+ max-height: 100%;
113
+ width: auto;
114
+ max-width: 100%;
115
+ object-fit: contain;
116
+ }
117
+
118
+ .page-title {
119
+ font-family: 'Inter', sans-serif;
120
+ font-size: 16px;
121
+ font-weight: 400;
122
+ line-height: 24px;
123
+ text-align: left;
124
+ text-underline-position: from-font;
125
+ text-decoration-skip-ink: none;
126
+ color: #282828;
127
+ margin-left: 32px;
128
+ text-transform: capitalize;
129
+ white-space: nowrap;
130
+ }
131
+
132
+ .user-navigation {
133
+ position: relative;
134
+ display: flex;
135
+ gap: 1px;
136
+ align-items: center;
137
+ flex: 1;
138
+ justify-content: flex-end;
139
+ min-width: 0;
140
+ max-width: 100%;
141
+ }
142
+
143
+ @media screen and (max-width: 530px) {
144
+ .user-navigation {
145
+ flex: 1;
146
+ min-width: 0;
147
+ max-width: 100%;
148
+ }
149
+ }
150
+
151
+ .user-profile {
152
+ display: flex;
153
+ gap: 0;
154
+ justify-content: space-around;
155
+ align-items: center;
156
+ width: auto;
157
+ height: 40px;
158
+ padding: 4px 4px 4px 8px;
159
+ border-radius: 4px;
160
+ cursor: pointer;
161
+ }
162
+
163
+ .user-profile:hover,
164
+ .user-profile.active,
165
+ .super-user-toggle:hover,
166
+ .super-user-toggle.active {
167
+ background-color: #773dbd3d;
168
+ }
169
+
170
+ .profile-pic {
171
+ height: 24px;
172
+ width: 24px;
173
+ border-radius: 50%;
174
+ }
175
+
176
+ .dropdown {
177
+ position: absolute;
178
+ width: 256px;
179
+ height: 0;
180
+ top: 42px;
181
+ right: 0;
182
+ border-radius: 4px;
183
+ background: #ffffff;
184
+ box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.12);
185
+ z-index: 9999999;
186
+ overflow: hidden;
187
+ transition: height 0.1s ease-in-out;
188
+ }
189
+
190
+ .dropdown.open {
191
+ height: auto;
192
+ }
193
+
194
+ .user-info {
195
+ color: #000000;
196
+ padding: 8px 16px;
197
+ display: flex;
198
+ justify-content: flex-start;
199
+ flex-flow: column;
200
+ gap: 4px;
201
+ }
202
+
203
+ .user-info strong {
204
+ font-family: 'Inter', sans-serif;
205
+ font-size: 16px;
206
+ font-weight: 600;
207
+ line-height: 24px;
208
+ letter-spacing: 0.0025em;
209
+ }
210
+
211
+ .user-info p {
212
+ font-family: 'Inter', sans-serif;
213
+ font-size: 14px;
214
+ font-weight: 400;
215
+ line-height: 20px;
216
+ letter-spacing: -0.001em;
217
+ text-align: left;
218
+ }
219
+
220
+ .navigation-links {
221
+ list-style: none;
222
+ padding: 0 8px 8px 8px;
223
+ max-height: 500px;
224
+ overflow-y: auto;
225
+ overflow-x: hidden;
226
+ }
227
+
228
+ .navigation-links a {
229
+ width: 240px;
230
+ height: 40px;
231
+ display: flex;
232
+ align-items: center;
233
+ border-radius: 4px;
234
+ text-decoration: none;
235
+ font-family: 'Inter', sans-serif;
236
+ font-size: 14px;
237
+ font-weight: 400;
238
+ line-height: 20px;
239
+ letter-spacing: -0.001em;
240
+ color: #282828;
241
+ }
242
+
243
+ .navigation-links a:hover {
244
+ background-color: #773dbd3d;
245
+ }
246
+
247
+ .link-icon {
248
+ display: grid;
249
+ place-content: center;
250
+ margin: 0 8px;
251
+ width: 20px;
252
+ height: 20px;
253
+ }
254
+
255
+ .user-drop-down-icon {
256
+ display: grid;
257
+ place-content: center;
258
+ width: 24px;
259
+ height: 24px;
260
+ }
261
+
262
+ .new-tab-icon {
263
+ margin-left: 4px;
264
+ display: grid;
265
+ place-content: center;
266
+ }
267
+
268
+ .super-user-toggle {
269
+ color: black;
270
+ cursor: pointer;
271
+ width: 40px;
272
+ height: 40px;
273
+ border-radius: 4px;
274
+ padding: 8px;
275
+ }
276
+
277
+ .super-user-dropdown {
278
+ position: absolute;
279
+ width: 305px;
280
+ max-height: calc(100vh - 105px);
281
+ top: 40px;
282
+ right: 61px;
283
+ background: #ffffff;
284
+ color: black;
285
+ box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.12);
286
+ border-radius: 4px;
287
+ display: none;
288
+ font-family: 'Inter', sans-serif;
289
+ overflow-y: auto;
290
+ }
291
+
292
+ .super-user-dropdown.open {
293
+ display: block;
294
+ }
295
+
296
+ .super-user-section,
297
+ .super-user-section-btn {
298
+ padding: 8px 16px;
299
+ border-top: 1px solid #cccccc;
300
+ }
301
+
302
+ .super-user-section-client {
303
+ padding: 8px 16px;
304
+ border: none;
305
+ }
306
+
307
+ .section-title {
308
+ display: block;
309
+ font-size: 14px;
310
+ font-weight: 600;
311
+ line-height: 24px;
312
+ letter-spacing: 0.0025em;
313
+ color: #000000;
314
+ }
315
+
316
+ .client-section-title {
317
+ font-size: 16px;
318
+ }
319
+
320
+ .sub-title {
321
+ font-size: 14px;
322
+ font-weight: 400;
323
+ line-height: 20px;
324
+ letter-spacing: -0.001em;
325
+ margin-bottom: 8px;
326
+ }
327
+
328
+ .feature {
329
+ display: flex;
330
+ justify-content: space-between;
331
+ align-items: center;
332
+ font-size: 14px;
333
+ padding: 8px 0;
334
+ }
335
+
336
+ .feature.block {
337
+ flex-direction: column;
338
+ align-items: flex-start;
339
+ }
340
+
341
+ .feature-name {
342
+ font-size: 14px;
343
+ font-weight: 600;
344
+ line-height: 20px;
345
+ letter-spacing: 0.0025em;
346
+ }
347
+
348
+ .feature-value {
349
+ margin-left: 6px;
350
+ color: #282828;
351
+ font-size: 14px;
352
+ font-weight: 400;
353
+ line-height: 20px;
354
+ letter-spacing: -0.001em;
355
+ }
356
+
357
+ .feature.block .feature-value {
358
+ display: block;
359
+ margin-left: 0;
360
+ font-size: 12px;
361
+ }
362
+
363
+ .reset-pwd-url {
364
+ font-size: 14px;
365
+ font-style: normal;
366
+ font-weight: 600;
367
+ line-height: 20px;
368
+ color: #773dbd;
369
+ text-align: left;
370
+ text-decoration: underline;
371
+ }
372
+
373
+ /*
374
+ * The single breakpoint for the page title, and there used to be two.
375
+ *
376
+ * Upstream hid it twice over: this rule, and a ':host(.is-mobile) .page-title--hidden'
377
+ * rule that fired off the class 'deviceCSS' wrote onto the host at its own 530px
378
+ * breakpoint. The class was applied unconditionally by the template, so the
379
+ * '--hidden' suffix described nothing — and because 815 > 530, this rule had already
380
+ * hidden the title before the other one could. Dropping the class and its rule leaves
381
+ * observable behaviour identical at every width, which is why the port is the moment
382
+ * to do it.
383
+ */
384
+ @media screen and (max-width: 815px) {
385
+ .page-title {
386
+ display: none;
387
+ }
388
+ }
389
+ `, D = (e) => {
390
+ var t, i, n, r;
391
+ try {
392
+ 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) => {
394
+ var p;
395
+ (p = a.features) == null || p.sort(f);
396
+ }), s;
397
+ } catch (s) {
398
+ return console.error("Failed to decode and parse data:", s), null;
399
+ }
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) {
402
+ try {
403
+ return new URL(e, P).protocol;
404
+ } catch {
405
+ return null;
406
+ }
407
+ }
408
+ function w(e) {
409
+ if (!e) return !1;
410
+ const t = x(e);
411
+ return t !== null && E.has(t);
412
+ }
413
+ function u(e) {
414
+ return w(e) ? e : A;
415
+ }
416
+ function d(e) {
417
+ if (!e) return "";
418
+ const t = x(e);
419
+ return t !== null && U.has(t) ? e : "";
420
+ }
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 ?? "");
426
+ });
427
+ return `${t.length > 0 ? t.join(",") : H},${I}`;
428
+ }
429
+ function V(e) {
430
+ return e ? e.split(/<br\b[^>]*>/i) : [];
431
+ }
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;
436
+ };
437
+ let l = class extends b {
438
+ constructor() {
439
+ super(...arguments), this.data = null, this.isDropdownOpen = !1, this.isSuperUserDropdownOpen = !1, this.handleOutsideClick = (e) => {
440
+ var i;
441
+ const t = e.target;
442
+ (i = this.shadowRoot) != null && i.contains(t) || this.closeAllDropdowns();
443
+ }, this.toggleDropdown = (e) => {
444
+ e.stopPropagation(), this.isDropdownOpen = !this.isDropdownOpen, this.isDropdownOpen && (this.isSuperUserDropdownOpen = !1);
445
+ }, this.toggleSuperUserDropdown = (e) => {
446
+ e.stopPropagation(), this.isSuperUserDropdownOpen = !this.isSuperUserDropdownOpen, this.isSuperUserDropdownOpen && (this.isDropdownOpen = !1);
447
+ }, this.renderFeatureValue = (e) => {
448
+ 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`
453
+ <div class="feature ${e.display === "block" ? "block" : ""}">
454
+ ${e.name ? o`<span class="feature-name">${e.name}</span>` : ""}
455
+ ${this.renderFeatureValue(e)}
456
+ </div>
457
+ `, this.renderFeatureSection = (e) => o`
458
+ <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>` : ""}
461
+ ${e.features.map(this.renderFeature)}
462
+ </div>
463
+ `, 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`
466
+ <a
467
+ href="#nowhere"
468
+ target="_top"
469
+ @click="${() => (w(i) && window.open(i, "", z(a)), !1)}"
470
+ >
471
+ <img
472
+ src=${d(r)}
473
+ alt="icon"
474
+ class="link-icon"
475
+ referrerpolicy="no-referrer"
476
+ />
477
+ ${t} ${p ? o`<span class="new-tab-icon">${h}</span>` : null}
478
+ </a>
479
+ ` : o`
480
+ <a
481
+ href=${u(i)}
482
+ target=${n ? "_blank" : "_self"}
483
+ rel=${n ? "noopener noreferrer" : y}
484
+ >
485
+ <img
486
+ src=${d(r)}
487
+ alt="icon"
488
+ class="link-icon"
489
+ referrerpolicy="no-referrer"
490
+ />
491
+ ${t} ${p ? o`<span class="new-tab-icon">${h}</span>` : null}
492
+ </a>
493
+ `;
494
+ };
495
+ }
496
+ connectedCallback() {
497
+ super.connectedCallback(), this.initEventListeners();
498
+ }
499
+ disconnectedCallback() {
500
+ super.disconnectedCallback(), this.removeEventListeners();
501
+ }
502
+ initEventListeners() {
503
+ document.addEventListener("click", this.handleOutsideClick);
504
+ }
505
+ removeEventListeners() {
506
+ document.removeEventListener("click", this.handleOutsideClick);
507
+ }
508
+ closeAllDropdowns() {
509
+ this.isDropdownOpen = !1, this.isSuperUserDropdownOpen = !1;
510
+ }
511
+ renderSearch() {
512
+ return o`<slot name="search"></slot>`;
513
+ }
514
+ renderSuperUserDropdown(e, t, i) {
515
+ var n;
516
+ return o`
517
+ <div
518
+ class=${`super-user-toggle ${this.isSuperUserDropdownOpen ? "active" : ""}`}
519
+ @click=${this.toggleSuperUserDropdown}
520
+ >
521
+ <span class="info-icon">${k}</span>
522
+ </div>
523
+ <div class=${`super-user-dropdown ${this.isSuperUserDropdownOpen ? "open" : ""}`}>
524
+ <div class="super-user-section-client">
525
+ <p class="section-title client-section-title">Client ID: ${t.id}</p>
526
+ <p class="sub-title">Domain: ${t.domain}</p>
527
+ <p class="sub-title">Country: ${t.country}</p>
528
+ </div>
529
+ ${(n = e == null ? void 0 : e.sections) == null ? void 0 : n.map(this.renderFeatureSection)}
530
+ <div class="super-user-section-btn">
531
+ <div class="feature">
532
+ <a href=${u(i)} class="reset-pwd-url">Reset Password</a>
533
+ </div>
534
+ </div>
535
+ </div>
536
+ `;
537
+ }
538
+ renderUserDropdown(e, t, i) {
539
+ return o`
540
+ <div
541
+ class=${`user-profile ${this.isDropdownOpen ? "active" : ""}`}
542
+ @click=${this.toggleDropdown}
543
+ >
544
+ <img
545
+ src=${d(e.profile_url)}
546
+ alt="Profile"
547
+ class="profile-pic"
548
+ referrerpolicy="no-referrer"
549
+ />
550
+ <span class="user-drop-down-icon">${S}</span>
551
+ </div>
552
+ <div class=${`dropdown ${this.isDropdownOpen ? "open" : ""}`}>
553
+ <div class="user-info">
554
+ <strong>${e.name}</strong>
555
+ <p>${t.name}</p>
556
+ </div>
557
+ <div class="navigation-links">${i.map(this.renderNavigationLink)}</div>
558
+ </div>
559
+ `;
560
+ }
561
+ render() {
562
+ if (!this.data)
563
+ return o`<div>Loading...</div>`;
564
+ const {
565
+ logo_url: e,
566
+ page_title: t,
567
+ account_data: i,
568
+ client_data: n,
569
+ super_user_data: r,
570
+ reset_password_url: s
571
+ } = this.data, { person_data: a, links: p } = i;
572
+ return o`
573
+ <section class="top-bar">
574
+ <div class="top-bar-content">
575
+ <div class="page-info">
576
+ <a href="/default.aspx" class="home-icon">
577
+ <img
578
+ src=${d(e)}
579
+ alt="campminder"
580
+ class="home-icon-img"
581
+ referrerpolicy="no-referrer"
582
+ />
583
+ </a>
584
+ <div class="page-title">${t}</div>
585
+ </div>
586
+
587
+ <div class="user-navigation">
588
+ ${this.renderSearch()}
589
+ ${r ? this.renderSuperUserDropdown(r, n, s) : null}
590
+ ${this.renderUserDropdown(a, n, p)}
591
+ </div>
592
+ </div>
593
+ </section>
594
+ `;
595
+ }
596
+ };
597
+ l.styles = C;
598
+ c([
599
+ m({
600
+ type: Object,
601
+ converter: { fromAttribute: D }
602
+ })
603
+ ], l.prototype, "data", 2);
604
+ c([
605
+ g()
606
+ ], l.prototype, "isDropdownOpen", 2);
607
+ c([
608
+ g()
609
+ ], l.prototype, "isSuperUserDropdownOpen", 2);
610
+ l = c([
611
+ $("cm-top-bar")
612
+ ], l);
613
+ export {
614
+ l as TopBar
615
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@campminder/components",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "main": "./dist/index.js",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/index.js",
18
+ "types": "./dist/index.d.ts"
19
+ },
20
+ "./side-nav": {
21
+ "import": "./dist/side-nav.js",
22
+ "types": "./dist/side-nav/index.d.ts"
23
+ },
24
+ "./top-bar": {
25
+ "import": "./dist/top-bar.js",
26
+ "types": "./dist/top-bar/index.d.ts"
27
+ },
28
+ "./super-user-banner": {
29
+ "import": "./dist/super-user-banner.js",
30
+ "types": "./dist/super-user-banner/index.d.ts"
31
+ }
32
+ },
33
+ "dependencies": {
34
+ "@campminder/menu-tree": "^0.1.0",
35
+ "lit": "^3.1.2"
36
+ },
37
+ "devDependencies": {
38
+ "jsdom": "^25.0.0",
39
+ "shx": "^0.3.4",
40
+ "typescript": "^5.2.2",
41
+ "vite": "^5.0.8",
42
+ "vite-plugin-dts": "^3.7.2",
43
+ "vitest": "^3.2.4"
44
+ },
45
+ "scripts": {
46
+ "dev": "vite",
47
+ "build": "tsc && vite build",
48
+ "lint": "tsc --noEmit",
49
+ "test": "vitest run",
50
+ "clean": "shx rm -rf dist .turbo"
51
+ }
52
+ }