@telia-ace/knowledge-widget-ui 0.0.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.
package/index.mjs ADDED
@@ -0,0 +1,1364 @@
1
+ import { jsx as a, jsxs as p, Fragment as te } from "react/jsx-runtime";
2
+ import { useRouteData as ne, Link as He, Icon as I, List as E, list as ie, invertedHoverButton as ae, ItemList as C, itemList as D, Drawer as je, Dropdown as oe, headingElement as Y, Text as se, Button as _, paddedBorderTabStyle as V, Confirm as Re, SymbolBadge as z, StyledText as j, convertToStringAttributes as re, useKeyPress as T, useContainer as le, useEventListener as q, Timestamp as ce, DateFormats as de, TextLink as R, useIsTabbing as We, getHumanyIsTabbing as Ee, setHumanyIsTabbing as Ye, borderTabStyle as W, Paragraph as _e, genericHtml as Oe, AnchorLink as Ge, WidgetLink as Ke } from "@telia-ace/widget-ui";
3
+ export * from "@telia-ace/widget-ui";
4
+ import { createParams as F, formatUrl as J, appendClassNames as k } from "@telia-ace/widget-utilities";
5
+ import c from "@emotion/styled";
6
+ import { forwardRef as A, useCallback as w, useState as N, useEffect as M, useMemo as Ue, useRef as me, useImperativeHandle as Ve } from "react";
7
+ import { css as y, keyframes as he } from "@emotion/react";
8
+ const fe = ({
9
+ title: t = "",
10
+ className: e,
11
+ id: n,
12
+ parent: i,
13
+ connection: o,
14
+ type: s,
15
+ target: r,
16
+ href: m,
17
+ children: l,
18
+ connectionKey: d
19
+ }) => {
20
+ const u = {}, { name: h, params: f } = ne();
21
+ switch (s) {
22
+ case "default":
23
+ case "guide":
24
+ const { id: v, title: $ } = i;
25
+ let x = d || o;
26
+ v !== n && !d && (x = void 0), u.routeName = h, u.params = F({
27
+ ...f,
28
+ guide: n,
29
+ connection: x,
30
+ uriName: n === v ? J($) : J(t)
31
+ });
32
+ break;
33
+ case "link":
34
+ u.href = m, u.target = r;
35
+ break;
36
+ }
37
+ return /* @__PURE__ */ a(
38
+ He,
39
+ {
40
+ className: k(e, "humany-dialog-link"),
41
+ ...u,
42
+ children: l || /* @__PURE__ */ p(te, { children: [
43
+ s === "link" && /* @__PURE__ */ a(I, { faIcon: "link" }),
44
+ /* @__PURE__ */ a("span", { children: t })
45
+ ] })
46
+ }
47
+ );
48
+ }, Mt = A(
49
+ ({ className: t, dialog: e, ...n }, i) => e.length ? /* @__PURE__ */ a(
50
+ qe,
51
+ {
52
+ className: k(t, "humany-dialog"),
53
+ items: e,
54
+ renderItem: (o) => /* @__PURE__ */ a("li", { "data-dialog": o.connection, children: /* @__PURE__ */ a(fe, { ...o }) }, o.connection),
55
+ ...n,
56
+ ref: i
57
+ }
58
+ ) : null
59
+ ), qe = c(E)`
60
+ ${ie}
61
+ a {
62
+ min-width: 150px;
63
+ max-width: 400px;
64
+ display: block;
65
+ white-space: normal;
66
+ ${(t) => {
67
+ var e, n;
68
+ return ((e = t.theme.colors) == null ? void 0 : e.primary) && ae({
69
+ primaryColor: (n = t.theme.colors) == null ? void 0 : n.primary,
70
+ secondaryColor: "#FFFFFF",
71
+ theme: t.theme
72
+ });
73
+ }}
74
+ }
75
+
76
+ i {
77
+ margin: 0 ${(t) => {
78
+ var e;
79
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
80
+ }} 0 0;
81
+ }
82
+ `, Pt = ({
83
+ trigger: t,
84
+ header: e,
85
+ className: n,
86
+ animation: i,
87
+ fullScreen: o,
88
+ onToggle: s,
89
+ children: r,
90
+ ref: m,
91
+ closeButtonAriaLabel: l,
92
+ ...d
93
+ }) => /* @__PURE__ */ a(
94
+ je,
95
+ {
96
+ className: k(n, "humany-drawer-list"),
97
+ trigger: t,
98
+ header: e,
99
+ animation: i,
100
+ fullScreen: o,
101
+ onToggle: s,
102
+ closeButtonAriaLabel: l,
103
+ children: /* @__PURE__ */ a(Je, { ...d, children: r })
104
+ }
105
+ ), Je = c(C)`
106
+ ${D}
107
+ font-family: ${(t) => {
108
+ var e;
109
+ return (e = t.theme.fonts) == null ? void 0 : e.type;
110
+ }};
111
+ padding: ${(t) => {
112
+ var e;
113
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
114
+ }};
115
+ > ul > li {
116
+ overflow: visible;
117
+ font-weight: 300;
118
+ font-size: ${(t) => {
119
+ var e;
120
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
121
+ }};
122
+ }
123
+ `, Bt = ({
124
+ items: t,
125
+ renderItem: e,
126
+ trigger: n,
127
+ header: i,
128
+ children: o
129
+ }) => /* @__PURE__ */ a(oe, { className: "humany-dropdown-actions", trigger: n, children: /* @__PURE__ */ p(Qe, { children: [
130
+ !!i && /* @__PURE__ */ a(Xe, { children: i }),
131
+ t && e && /* @__PURE__ */ a(Ze, { items: t, renderItem: e }),
132
+ o
133
+ ] }) }), Qe = c.div`
134
+ background: #fff;
135
+ border: #ccc 1px solid;
136
+ box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
137
+ font-family: ${(t) => {
138
+ var e;
139
+ return (e = t.theme.fonts) == null ? void 0 : e.type;
140
+ }};
141
+ font-size: ${(t) => {
142
+ var e;
143
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
144
+ }};
145
+ `, Xe = c.div`
146
+ padding: ${(t) => {
147
+ var e;
148
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
149
+ }};
150
+ padding-bottom: 0;
151
+ font-size: ${(t) => {
152
+ var e;
153
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
154
+ }};
155
+ font-weight: normal;
156
+ white-space: nowrap;
157
+ display: flex;
158
+ align-items: center;
159
+
160
+ h1,
161
+ h2,
162
+ h3,
163
+ h4,
164
+ h5,
165
+ h6 {
166
+ margin: 0;
167
+ font-weight: normal;
168
+ padding-bottom: 0;
169
+ }
170
+
171
+ svg,
172
+ i {
173
+ margin-right: ${(t) => {
174
+ var e;
175
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
176
+ }};
177
+ }
178
+ `, Ze = c(E)`
179
+ list-style: none;
180
+ padding: 0;
181
+ margin: 0;
182
+ padding: ${(t) => {
183
+ var e;
184
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
185
+ }} 0;
186
+
187
+ li {
188
+ background: #fff;
189
+
190
+ a {
191
+ display: block;
192
+ font-size: ${(t) => {
193
+ var e;
194
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
195
+ }};
196
+ padding: ${(t) => {
197
+ var e, n;
198
+ return `${(e = t.theme.sizes) == null ? void 0 : e.small} ${(n = t.theme.sizes) == null ? void 0 : n.normal}`;
199
+ }};
200
+ cursor: pointer;
201
+ color: #555;
202
+ text-decoration: none;
203
+
204
+ &:hover {
205
+ background: #f9f9f9;
206
+ color: ${(t) => {
207
+ var e;
208
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
209
+ }};
210
+ }
211
+ }
212
+ }
213
+ `, Ht = ({
214
+ trigger: t,
215
+ className: e,
216
+ children: n,
217
+ closeButtonAriaLabel: i,
218
+ ...o
219
+ }) => /* @__PURE__ */ a(
220
+ oe,
221
+ {
222
+ className: k(e, "humany-dropdown-list"),
223
+ closeButtonAriaLabel: i,
224
+ trigger: t,
225
+ children: /* @__PURE__ */ a(et, { ...o, children: n })
226
+ }
227
+ ), et = c(C)`
228
+ ${D}
229
+ font-family: ${(t) => {
230
+ var e;
231
+ return (e = t.theme.fonts) == null ? void 0 : e.type;
232
+ }};
233
+ > div {
234
+ ${(t) => {
235
+ var e;
236
+ return Y(t)(
237
+ "> h1",
238
+ y`
239
+ font-size: ${(e = t.theme.fonts) == null ? void 0 : e.normal};
240
+ line-height: 1.2em;
241
+ `
242
+ );
243
+ }}
244
+ }
245
+ > ul > li {
246
+ overflow: visible;
247
+ font-weight: 300;
248
+ font-size: ${(t) => {
249
+ var e;
250
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
251
+ }};
252
+
253
+ a {
254
+ display: inline-block;
255
+
256
+ @media (hover: hover) {
257
+ &:hover {
258
+ text-decoration: underline;
259
+ }
260
+ }
261
+ }
262
+ }
263
+ `, tt = (t) => y`
264
+ ${t["data-loading"] && "position: relative;"};
265
+ ${t["data-loading"] && "min-height: 150px;"}
266
+ > * {
267
+ transition: 200ms ease-out opacity;
268
+ opacity: ${t["data-loading"] ? "0.5" : "1"};
269
+ }
270
+ .humany-loader {
271
+ opacity: ${t["data-loading"] ? "1" : "0"};
272
+ }
273
+ `, jt = c(I)`
274
+ && {
275
+ font-size: ${(t) => {
276
+ var e;
277
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
278
+ }};
279
+ }
280
+ width: 1.2em;
281
+ `, Rt = c(se)`
282
+ font-size: ${(t) => {
283
+ var e;
284
+ return (e = t.theme.fonts) == null ? void 0 : e.medium;
285
+ }};
286
+ font-weight: normal;
287
+ line-height: 1.2em;
288
+ color: ${(t) => {
289
+ var e;
290
+ return (e = t.theme.colors) == null ? void 0 : e.text;
291
+ }};
292
+ `, nt = c(_)`
293
+ display: flex;
294
+ align-items: center;
295
+
296
+ ${(t) => {
297
+ var e;
298
+ return t["data-has-label"] === "true" && t["data-has-symbol"] === "true" && `
299
+ svg, i {
300
+ margin: 0 ${(e = t.theme.sizes) == null ? void 0 : e.small} 0 0;
301
+ }
302
+ `;
303
+ }}
304
+
305
+ &:focus-visible {
306
+ ${(t) => t["data-has-label"] === "true" && V}
307
+
308
+ svg, i {
309
+ ${(t) => t["data-has-label"] === "false" && t["data-has-symbol"] === "true" && y`
310
+ ${V(t)}
311
+ box-sizing: content-box;
312
+ `}
313
+ }
314
+ }
315
+
316
+ span {
317
+ flex: 1;
318
+ font-weight: 300;
319
+ }
320
+ `, it = ({
321
+ addFavoriteTooltip: t,
322
+ removeFavoriteCancelLabel: e,
323
+ removeFavoriteConfirmLabel: n,
324
+ removeFavoriteHeader: i,
325
+ removeFavoriteLabel: o,
326
+ removeFavoriteTooltip: s,
327
+ id: r,
328
+ isFavorite: m,
329
+ guideTitle: l,
330
+ buttonLabel: d = "",
331
+ actions: { addFavorite: u, removeFavorite: h }
332
+ }) => {
333
+ const f = w(() => {
334
+ h(r);
335
+ }, [r, h]), v = w(() => {
336
+ u(r);
337
+ }, [r, u]), $ = `${m ? s : t}${l ? `: "${l}"` : ""}`;
338
+ return m ? /* @__PURE__ */ a(
339
+ Re,
340
+ {
341
+ trigger: /* @__PURE__ */ p(
342
+ Q,
343
+ {
344
+ className: "humany-favorite-button",
345
+ title: $,
346
+ "aria-label": $,
347
+ "data-favorite": "true",
348
+ "data-has-label": d ? "true" : "false",
349
+ "data-has-symbol": "true",
350
+ children: [
351
+ /* @__PURE__ */ a(
352
+ z,
353
+ {
354
+ size: 16,
355
+ symbol: { type: "Svg", content: "star-empty" }
356
+ }
357
+ ),
358
+ d && /* @__PURE__ */ a(j, { children: d })
359
+ ]
360
+ }
361
+ ),
362
+ onConfirm: f,
363
+ cancelLabel: e,
364
+ confirmLabel: n,
365
+ header: i,
366
+ text: o
367
+ }
368
+ ) : /* @__PURE__ */ p(
369
+ Q,
370
+ {
371
+ className: "humany-favorite-button",
372
+ title: $,
373
+ "aria-label": $,
374
+ onClick: v,
375
+ "data-favorite": "false",
376
+ "data-has-label": d ? "true" : "false",
377
+ "data-has-symbol": "true",
378
+ children: [
379
+ /* @__PURE__ */ a(z, { size: 16, symbol: { type: "Svg", content: "star-empty" } }),
380
+ d && /* @__PURE__ */ a(j, { children: d })
381
+ ]
382
+ }
383
+ );
384
+ }, Q = c(nt)`
385
+ grid-area: favorite;
386
+
387
+ &:focus-visible {
388
+ svg {
389
+ ${(t) => {
390
+ var e, n;
391
+ return t["data-favorite"] === "true" ? `
392
+ fill: transparent;
393
+
394
+ path {
395
+ fill: transparent;
396
+ }
397
+ ` : `
398
+ fill: ${(e = t.theme.colors) == null ? void 0 : e.text};
399
+
400
+ path {
401
+ fill: ${(n = t.theme.colors) == null ? void 0 : n.text};
402
+ }
403
+ `;
404
+ }}
405
+ }
406
+ }
407
+
408
+ ${(t) => {
409
+ var e, n, i, o, s, r, m;
410
+ return ((e = t.theme.colors) == null ? void 0 : e.text) && y`
411
+ svg {
412
+ stroke: ${(n = t.theme.colors) == null ? void 0 : n.text};
413
+
414
+ path {
415
+ stroke: ${(i = t.theme.colors) == null ? void 0 : i.text};
416
+ }
417
+
418
+ ${t["data-favorite"] === "true" && `
419
+ fill: ${(o = t.theme.colors) == null ? void 0 : o.text};
420
+
421
+ path {
422
+ fill: ${(s = t.theme.colors) == null ? void 0 : s.text};
423
+ }
424
+ `};
425
+ }
426
+
427
+ &:hover {
428
+ svg {
429
+ ${t["data-favorite"] === "true" ? `
430
+ fill: transparent;
431
+
432
+ path {
433
+ fill: transparent;
434
+ }
435
+ ` : `
436
+ fill: ${(r = t.theme.colors) == null ? void 0 : r.text};
437
+
438
+ path {
439
+ fill: ${(m = t.theme.colors) == null ? void 0 : m.text};
440
+ }
441
+ `};
442
+ }
443
+ }
444
+ `;
445
+ }}
446
+ `, Wt = A(
447
+ ({
448
+ onFeedback: t = () => {
449
+ },
450
+ direction: e = "horizontal",
451
+ className: n,
452
+ header: i,
453
+ positive: o,
454
+ negative: s,
455
+ selected: r,
456
+ ...m
457
+ }, l) => /* @__PURE__ */ p(
458
+ ot,
459
+ {
460
+ className: k(n, "humany-feedback"),
461
+ "data-direction": e,
462
+ ...re(m),
463
+ ref: l,
464
+ children: [
465
+ !!i && /* @__PURE__ */ a(at, { children: i }),
466
+ /* @__PURE__ */ p(
467
+ X,
468
+ {
469
+ className: "humany-feedback-button",
470
+ disabled: !!r,
471
+ "data-selected": r === "positive",
472
+ "data-direction": e,
473
+ onClick: () => t("positive"),
474
+ children: [
475
+ /* @__PURE__ */ a(I, { faIcon: "smile-o" }),
476
+ /* @__PURE__ */ a("span", { children: o })
477
+ ]
478
+ }
479
+ ),
480
+ /* @__PURE__ */ p(
481
+ X,
482
+ {
483
+ className: "humany-feedback-button",
484
+ disabled: !!r,
485
+ "data-selected": r === "negative",
486
+ "data-direction": e,
487
+ onClick: () => t("negative"),
488
+ children: [
489
+ /* @__PURE__ */ a(I, { faIcon: "frown-o" }),
490
+ /* @__PURE__ */ a("span", { children: s })
491
+ ]
492
+ }
493
+ )
494
+ ]
495
+ }
496
+ )
497
+ ), at = c(j)`
498
+ font-weight: normal;
499
+ margin: 0 0 ${(t) => {
500
+ var e;
501
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
502
+ }};
503
+ font-size: ${(t) => {
504
+ var e;
505
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
506
+ }};
507
+ display: block;
508
+ `, X = c(_)`
509
+ display: inline-block;
510
+ font-size: ${(t) => {
511
+ var e;
512
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
513
+ }};
514
+ font-weight: 300;
515
+ && {
516
+ margin-right: ${(t) => {
517
+ var e;
518
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
519
+ }};
520
+ }
521
+
522
+ ${(t) => {
523
+ var e, n;
524
+ return t["data-direction"] === "horizontal" && y`
525
+ width: 225px;
526
+ max-width: calc(50% - ${(e = t.theme.sizes) == null ? void 0 : e.large} - ${(n = t.theme.sizes) == null ? void 0 : n.small});
527
+ `;
528
+ }}
529
+
530
+ ${(t) => t["data-direction"] === "vertical" && y`
531
+ min-width: 190px;
532
+ `}
533
+
534
+ ${(t) => {
535
+ var e, n;
536
+ return ((e = t.theme.colors) == null ? void 0 : e.primary) && ae({
537
+ active: t["data-selected"],
538
+ primaryColor: (n = t.theme.colors) == null ? void 0 : n.primary,
539
+ secondaryColor: "#FFFFFF",
540
+ theme: t.theme
541
+ });
542
+ }}
543
+
544
+ i {
545
+ margin: 0 ${(t) => {
546
+ var e;
547
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
548
+ }} 0 0;
549
+ }
550
+ `, ot = c.div`
551
+ ${(t) => {
552
+ var e;
553
+ return t["data-direction"] === "vertical" && y`
554
+ > button {
555
+ width: 100%;
556
+ &:not(:last-child) {
557
+ margin-bottom: ${(e = t.theme.sizes) == null ? void 0 : e.normal};
558
+ }
559
+ }
560
+ `;
561
+ }}
562
+ `, Et = () => {
563
+ const [t, e] = N(null), n = T("ArrowLeft"), i = T("ArrowRight"), o = T("ArrowUp"), s = T("ArrowDown");
564
+ return M(() => {
565
+ e(n ? "left" : i ? "right" : o ? "up" : s ? "down" : null);
566
+ }, [n, i, o, s]), t;
567
+ }, Yt = (t, e) => {
568
+ const [n, i] = N(t), o = w(() => setTimeout(() => {
569
+ i(t);
570
+ }, e), [e, i, t]);
571
+ return M(
572
+ () => {
573
+ const s = o();
574
+ return () => {
575
+ clearTimeout(s);
576
+ };
577
+ },
578
+ [o]
579
+ // Only re-call effect if value or delay changes
580
+ ), n;
581
+ }, st = () => {
582
+ const t = le(), [e, n] = N([]), i = t.get("favorites");
583
+ M(() => {
584
+ if (i) {
585
+ n(i.get());
586
+ const { events: l } = t.get("$widget");
587
+ return l.subscribe(
588
+ "widget:favorites-updated",
589
+ (u, { updated: h }) => {
590
+ n([...h]);
591
+ }
592
+ );
593
+ }
594
+ }, []);
595
+ const o = (l) => i ? i.add(l) : Promise.resolve([]), s = (l) => i ? i.remove(l) : Promise.resolve([]), r = () => i ? i.clear() : Promise.resolve([]), m = w(
596
+ (l) => e.indexOf(l) > -1 ? s(l) : o(l),
597
+ // eslint-disable-next-line react-hooks/exhaustive-deps
598
+ [e]
599
+ );
600
+ return [
601
+ e,
602
+ Ue(
603
+ () => ({
604
+ addFavorite: o,
605
+ removeFavorite: s,
606
+ clearFavorites: r,
607
+ toggleFavorite: m
608
+ }),
609
+ // eslint-disable-next-line react-hooks/exhaustive-deps
610
+ [e]
611
+ )
612
+ ];
613
+ }, _t = () => {
614
+ const [t, e] = N(!1), n = me(), i = w(() => e(!0), [e]), o = w(() => e(!1), [e]);
615
+ return q("mouseenter", i, n.current), q("mouseleave", o, n.current), [t, n];
616
+ }, rt = ({
617
+ format: t = de.YYYY_MM_DD_HH_MM,
618
+ className: e = "",
619
+ byLabel: n = "",
620
+ modifiedLabel: i = "",
621
+ publishedLabel: o = "",
622
+ modifiedBy: s = "",
623
+ publishedBy: r = "",
624
+ showModified: m = !1,
625
+ showPublished: l = !1,
626
+ modified: d,
627
+ published: u
628
+ }) => {
629
+ const h = l && u ? /* @__PURE__ */ a(Z, { format: t, timestamp: u }) : null, f = m && d ? /* @__PURE__ */ a(Z, { format: t, timestamp: d }) : null;
630
+ return !h && !f ? null : /* @__PURE__ */ p(H, { className: k(e, "humany-metadata"), children: [
631
+ h && /* @__PURE__ */ p(H, { className: "humany-published", children: [
632
+ o,
633
+ h,
634
+ n && r && ` ${n.replace("{{editor}}", r)}`
635
+ ] }),
636
+ f && /* @__PURE__ */ p(H, { className: "humany-modified", children: [
637
+ h && ", ",
638
+ i,
639
+ f,
640
+ n && s && ` ${n.replace("{{editor}}", s)}`
641
+ ] })
642
+ ] });
643
+ }, Z = c(ce)`
644
+ &:not(:first-child) {
645
+ margin-left: 4px;
646
+ }
647
+ &:not(:last-child) {
648
+ margin-right: 4px;
649
+ }
650
+ `, H = c(se)`
651
+ font-style: italic;
652
+ `, lt = ({ tags: t }) => t.filter((e) => e.symbol).length ? /* @__PURE__ */ a(
653
+ mt,
654
+ {
655
+ className: "humany-guide-list-tags",
656
+ items: t,
657
+ renderItem: ({ id: e, symbol: n, title: i }) => n && /* @__PURE__ */ a("li", { "data-tag": e, children: /* @__PURE__ */ a(ht, { size: 18, symbol: n, title: i }) }, e)
658
+ }
659
+ ) : null, Ot = A(({ title: t, id: e, route: n, symbolSize: i, collapseUri: o, children: s }, r) => {
660
+ const { params: m } = ne();
661
+ return /* @__PURE__ */ p(ct, { ref: r, "data-guide": e, children: [
662
+ /* @__PURE__ */ a(
663
+ R,
664
+ {
665
+ "aria-expanded": !0,
666
+ title: t,
667
+ "aria-label": t,
668
+ routeName: n,
669
+ params: F({
670
+ ...m,
671
+ uriName: o || void 0,
672
+ id: void 0,
673
+ guide: void 0,
674
+ accordion: void 0
675
+ }),
676
+ text: t,
677
+ children: /* @__PURE__ */ a(
678
+ z,
679
+ {
680
+ size: i,
681
+ symbol: { type: "Svg", content: "caret-up" }
682
+ }
683
+ )
684
+ }
685
+ ),
686
+ s
687
+ ] });
688
+ }), ct = c.li`
689
+ > a {
690
+ grid-column: 1/-1;
691
+ font-weight: bold;
692
+ margin: 0 0 ${(t) => {
693
+ var e;
694
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
695
+ }} 0;
696
+ }
697
+
698
+ > div {
699
+ grid-column: 1/-1;
700
+ }
701
+ `, Gt = A(
702
+ ({
703
+ expandable: t = !1,
704
+ routing: e = {},
705
+ paramMappers: n = {},
706
+ symbolSize: i = 11,
707
+ pageRole: o = "link",
708
+ pageCaret: s = "down",
709
+ showTags: r = !1,
710
+ showFavoriteToggle: m = !1,
711
+ localPaging: l = !1,
712
+ onItemClick: d = () => {
713
+ },
714
+ dispatch: u = () => {
715
+ },
716
+ metadata: h = {},
717
+ pageLabel: f,
718
+ className: v,
719
+ children: $,
720
+ items: x,
721
+ renderItem: S,
722
+ addFavoriteTooltip: ue,
723
+ removeFavoriteCancelLabel: ge,
724
+ removeFavoriteConfirmLabel: pe,
725
+ removeFavoriteHeader: ye,
726
+ removeFavoriteLabel: $e,
727
+ removeFavoriteTooltip: ve,
728
+ searchResultsEmptyLabel: xe,
729
+ ...O
730
+ }, be) => {
731
+ const we = We(), P = me(), { guide: ke = "guide", page: ze = "index" } = e, {
732
+ guide: Se = ({ id: g }) => F({ guide: g }),
733
+ page: G = () => F()
734
+ } = n, [Ne, Le] = st(), Te = le(), { events: Ie } = Te.get("$widget");
735
+ Ve(be, () => P.current);
736
+ const B = (g) => {
737
+ const { id: b, title: L, tags: Ae, published: K, modified: U, publishedBy: Me, modifiedBy: Pe } = g;
738
+ return /* @__PURE__ */ p(
739
+ "li",
740
+ {
741
+ "data-guide": b,
742
+ "has-metadata": (!!(h != null && h.showPublished) && !!K || !!(h != null && h.showModified) && !!U).toString(),
743
+ children: [
744
+ /* @__PURE__ */ a(
745
+ R,
746
+ {
747
+ className: "humany-guide-link",
748
+ routeName: ke,
749
+ onClick: (Be) => {
750
+ d(Be, g), Ie.dispatch("tracking:guide-list-item-clicked", {
751
+ guide: g
752
+ });
753
+ },
754
+ params: Se(g),
755
+ text: L,
756
+ children: /* @__PURE__ */ a(
757
+ z,
758
+ {
759
+ size: i,
760
+ symbol: {
761
+ type: "Svg",
762
+ content: t ? "caret-down" : "caret-right"
763
+ }
764
+ }
765
+ )
766
+ }
767
+ ),
768
+ m && /* @__PURE__ */ a(
769
+ it,
770
+ {
771
+ guideTitle: L,
772
+ addFavoriteTooltip: ue,
773
+ removeFavoriteCancelLabel: ge,
774
+ removeFavoriteConfirmLabel: pe,
775
+ removeFavoriteHeader: ye,
776
+ removeFavoriteLabel: $e,
777
+ removeFavoriteTooltip: ve,
778
+ isFavorite: Ne.indexOf(b) > -1,
779
+ actions: Le,
780
+ id: b
781
+ }
782
+ ),
783
+ r && /* @__PURE__ */ a(lt, { tags: Ae }),
784
+ /* @__PURE__ */ a(
785
+ ft,
786
+ {
787
+ ...h,
788
+ indent: t ? void 0 : i,
789
+ modified: U,
790
+ published: K,
791
+ publishedBy: Me,
792
+ modifiedBy: Pe
793
+ }
794
+ )
795
+ ]
796
+ },
797
+ b
798
+ );
799
+ }, Fe = w(
800
+ (g, b, L) => S ? S(g, b, L, B) : B(g),
801
+ [S, B]
802
+ ), Ce = w(
803
+ (g) => {
804
+ l && (g.preventDefault(), u("page", G()));
805
+ },
806
+ [u, l]
807
+ );
808
+ M(() => {
809
+ var b;
810
+ const g = (b = P.current) == null ? void 0 : b.querySelector(
811
+ ".humany-guide-list > ul > li .humany-guide-link"
812
+ );
813
+ g && Ee() && (g.focus(), Ye(!1));
814
+ }, [x]);
815
+ const De = !!Object.keys(h).filter(
816
+ (g) => typeof h[g] < "u"
817
+ ).length;
818
+ return /* @__PURE__ */ p(
819
+ dt,
820
+ {
821
+ className: k(v, "humany-guide-list"),
822
+ "data-item-count": x.length,
823
+ items: x,
824
+ renderItem: Fe,
825
+ isTabbing: we,
826
+ expandable: t ? "true" : "false",
827
+ "grid-items": r || m || De ? "true" : "false",
828
+ ...re(O),
829
+ ref: P,
830
+ children: [
831
+ f ? /* @__PURE__ */ a(
832
+ R,
833
+ {
834
+ text: f,
835
+ title: f,
836
+ "aria-label": f,
837
+ routeName: ze,
838
+ role: o,
839
+ params: G(),
840
+ onClick: Ce,
841
+ children: /* @__PURE__ */ a(
842
+ z,
843
+ {
844
+ size: i,
845
+ symbol: { type: "Svg", content: `caret-${s}` }
846
+ }
847
+ )
848
+ }
849
+ ) : null,
850
+ $,
851
+ !O["data-loading"] && x.length === 0 && /* @__PURE__ */ a("p", { children: xe })
852
+ ]
853
+ }
854
+ );
855
+ }
856
+ ), dt = c(C)`
857
+ ${D}
858
+ padding: ${(t) => {
859
+ var e;
860
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
861
+ }};
862
+ overflow: auto;
863
+ justify-content: flex-start;
864
+ white-space: nowrap;
865
+ font-weight: 300;
866
+ text-decoration: none;
867
+
868
+ > div {
869
+ ${(t) => Y(t)(
870
+ "> h1",
871
+ y`
872
+ white-space: pre-wrap;
873
+ `
874
+ )}
875
+ }
876
+
877
+ > ul > li {
878
+ ${(t) => {
879
+ var e, n;
880
+ return t["grid-items"] === "true" && y`
881
+ display: grid;
882
+ grid-template-columns: auto 1fr 1fr;
883
+ gap: 0px 0px;
884
+ grid-template-areas: '. favorite tags';
885
+ align-items: center;
886
+
887
+ > button {
888
+ margin: 0 0 0 ${(e = t.theme.sizes) == null ? void 0 : e.small};
889
+
890
+ &[data-favorite='false'] {
891
+ ${t.isTabbing ? "opacity: 0;" : "display: none;"};
892
+ &:focus {
893
+ opacity: 1;
894
+ }
895
+ }
896
+ }
897
+
898
+ > span {
899
+ font-size: ${(n = t.theme.fonts) == null ? void 0 : n.small};
900
+ }
901
+
902
+ &:hover {
903
+ button[data-favorite='false'] {
904
+ display: flex;
905
+ justify-self: flex-start;
906
+ }
907
+ }
908
+
909
+ &[has-metadata='true'] {
910
+ grid-template-rows: 1fr 1fr;
911
+ grid-template-areas:
912
+ '. favorite tags'
913
+ 'metadata metadata metadata';
914
+ }
915
+ `;
916
+ }}
917
+ > a {
918
+ color: ${(t) => {
919
+ var e;
920
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
921
+ }};
922
+ overflow: hidden;
923
+ text-overflow: ellipsis;
924
+ max-width: 100%;
925
+ display: inline-block;
926
+
927
+ svg {
928
+ margin: 0 calc(${(t) => {
929
+ var e;
930
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
931
+ }}*2) 0 0;
932
+ line {
933
+ stroke: ${(t) => {
934
+ var e;
935
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
936
+ }};
937
+ }
938
+ }
939
+
940
+ ${(t) => {
941
+ var e;
942
+ return t.expandable === "true" && y`
943
+ display: flex;
944
+ flex-direction: row-reverse;
945
+ justify-content: flex-end;
946
+ align-items: center;
947
+
948
+ span {
949
+ overflow: hidden;
950
+ text-overflow: ellipsis;
951
+ }
952
+
953
+ svg {
954
+ margin: 0 0 0 ${(e = t.theme.sizes) == null ? void 0 : e.small};
955
+ }
956
+ `;
957
+ }}
958
+
959
+ &:focus-visible {
960
+ ${W}
961
+ text-decoration: underline;
962
+ }
963
+
964
+ @media (hover: hover) {
965
+ &:hover {
966
+ text-decoration: underline;
967
+ }
968
+ }
969
+ }
970
+ }
971
+
972
+ > a {
973
+ color: ${(t) => {
974
+ var e;
975
+ return (e = t.theme.colors) == null ? void 0 : e.text;
976
+ }};
977
+ margin: ${(t) => {
978
+ var e;
979
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
980
+ }} 0 0;
981
+ align-self: flex-start;
982
+ align-items: center;
983
+ display: flex;
984
+
985
+ span {
986
+ text-decoration: underline;
987
+ }
988
+
989
+ svg {
990
+ margin: 0 calc(${(t) => {
991
+ var e;
992
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
993
+ }}*2) 0 0;
994
+ line {
995
+ stroke: ${(t) => {
996
+ var e;
997
+ return (e = t.theme.colors) == null ? void 0 : e.text;
998
+ }};
999
+ }
1000
+ }
1001
+
1002
+ &:focus-visible {
1003
+ ${W}
1004
+ text-decoration: underline;
1005
+ }
1006
+ }
1007
+ `, mt = c(E)`
1008
+ ${ie}
1009
+ display: flex;
1010
+ margin: 0 0 0 auto;
1011
+ grid-area: tags;
1012
+
1013
+ li,
1014
+ li:last-child {
1015
+ margin: 0 0 0 ${(t) => {
1016
+ var e;
1017
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1018
+ }};
1019
+ display: flex;
1020
+ align-items: center;
1021
+ justify-content: space-between;
1022
+ }
1023
+ `, ht = c(z)`
1024
+ display: block;
1025
+ color: ${(t) => {
1026
+ var e;
1027
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1028
+ }};
1029
+ ${(t) => {
1030
+ if (t.symbol.type === "Uri")
1031
+ return `
1032
+ width: ${t.size}px;
1033
+ height: ${t.size}px;
1034
+ `;
1035
+ if (t.symbol.type === "FontAwesome")
1036
+ return `
1037
+ font-size: ${t.size}px;
1038
+ `;
1039
+ }}
1040
+ `, ft = c(rt)`
1041
+ grid-area: metadata;
1042
+ text-overflow: ellipsis;
1043
+ overflow: hidden;
1044
+ font-size: ${(t) => {
1045
+ var e;
1046
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
1047
+ }};
1048
+ ${(t) => {
1049
+ var e;
1050
+ return typeof t.indent == "number" && `text-indent: calc(${(e = t.theme.sizes) == null ? void 0 : e.small} * 2 + ${t.indent}px);`;
1051
+ }}
1052
+ `, ut = he`
1053
+ 100% {
1054
+ transform: rotate(360deg);
1055
+ }
1056
+ `, gt = he`
1057
+ 0% {
1058
+ stroke-dasharray: 1, 200;
1059
+ stroke-dashoffset: 0;
1060
+ }
1061
+ 50% {
1062
+ stroke-dasharray: 89, 200;
1063
+ stroke-dashoffset: -35px;
1064
+ }
1065
+ 100% {
1066
+ stroke-dasharray: 89, 200;
1067
+ stroke-dashoffset: -124px;
1068
+ }
1069
+ `, pt = c.svg`
1070
+ animation: ${ut} 2s linear infinite;
1071
+ height: 100%;
1072
+ transform-origin: center center;
1073
+ width: 100%;
1074
+ position: absolute;
1075
+ top: 0;
1076
+ bottom: 0;
1077
+ left: 0;
1078
+ right: 0;
1079
+ margin: auto;
1080
+ transition: 200ms ease-out opacity;
1081
+ `, yt = c.div`
1082
+ position: absolute;
1083
+ top: 0;
1084
+ bottom: 0;
1085
+ left: 0;
1086
+ right: 0;
1087
+ height: 100%;
1088
+ width: 100%;
1089
+ pointer-events: ${(t) => t["data-loading"] ? "all" : "none"};
1090
+ display: flex;
1091
+ flex-direction: column;
1092
+ justify-content: center;
1093
+ transition: 200ms ease-out opacity;
1094
+ box-sizing: border-box;
1095
+ overflow: hidden;
1096
+
1097
+ .humany-spinner-svg {
1098
+ opacity: ${(t) => t["data-loading"] ? "1" : "0"};
1099
+ }
1100
+ `, $t = c.div`
1101
+ position: relative;
1102
+ margin: 0 auto;
1103
+ width: 100px;
1104
+ &:before {
1105
+ content: '';
1106
+ display: block;
1107
+ padding-top: 100%;
1108
+ }
1109
+ `, vt = c.circle`
1110
+ stroke-dasharray: 1, 200;
1111
+ stroke-dashoffset: 0;
1112
+ animation: ${gt} 1.5s ease-in-out infinite;
1113
+ stroke-linecap: round;
1114
+ stroke: ${(t) => {
1115
+ var e;
1116
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1117
+ }};
1118
+ stroke-width: 2px;
1119
+ `, xt = ({ loading: t = !1 }) => /* @__PURE__ */ a(yt, { className: "humany-loader", "data-loading": t, children: /* @__PURE__ */ a($t, { className: "humany-spinner", children: /* @__PURE__ */ a(pt, { className: "humany-spinner-svg", viewBox: "25 25 50 50", children: /* @__PURE__ */ a(
1120
+ vt,
1121
+ {
1122
+ cx: "50",
1123
+ cy: "50",
1124
+ r: "20",
1125
+ fill: "none",
1126
+ "stroke-width": "2",
1127
+ "stroke-miterlimit": "10"
1128
+ }
1129
+ ) }) }) }), Kt = ({
1130
+ className: t,
1131
+ showHeader: e,
1132
+ notificationList: n,
1133
+ loading: i,
1134
+ ...o
1135
+ }) => {
1136
+ const [s, r] = N(null), {
1137
+ id: m,
1138
+ title: l,
1139
+ symbol: d,
1140
+ notifications: u = [],
1141
+ defaultHeaderOptions: h = { visible: !0 }
1142
+ } = n || {};
1143
+ return !u.length && !i ? null : /* @__PURE__ */ a(
1144
+ wt,
1145
+ {
1146
+ ...o,
1147
+ "data-loading": i,
1148
+ "data-show-header": typeof e == "boolean" ? e : h.visible,
1149
+ className: k(t, "humany-notification-list"),
1150
+ "data-notification-category": m,
1151
+ header: l,
1152
+ symbol: d,
1153
+ items: u,
1154
+ renderItem: ({ id: f, title: v, body: $, modified: x, expandable: S }) => /* @__PURE__ */ a(
1155
+ kt,
1156
+ {
1157
+ "data-notification": f,
1158
+ "data-expanded": S ? s === f : !0,
1159
+ children: S ? /* @__PURE__ */ p(te, { children: [
1160
+ /* @__PURE__ */ p(
1161
+ bt,
1162
+ {
1163
+ title: v,
1164
+ "aria-label": v,
1165
+ "aria-expanded": s === f,
1166
+ onClick: () => r(s === f ? null : f),
1167
+ children: [
1168
+ /* @__PURE__ */ a("span", { children: v }),
1169
+ /* @__PURE__ */ a(
1170
+ zt,
1171
+ {
1172
+ size: 11,
1173
+ symbol: {
1174
+ type: "Svg",
1175
+ content: `caret-${s === f ? "up" : "down"}`
1176
+ }
1177
+ }
1178
+ )
1179
+ ]
1180
+ }
1181
+ ),
1182
+ /* @__PURE__ */ a(ee, { html: $ }),
1183
+ x && /* @__PURE__ */ a(
1184
+ St,
1185
+ {
1186
+ format: de.YYYY_MM_DD,
1187
+ timestamp: x
1188
+ }
1189
+ )
1190
+ ] }) : /* @__PURE__ */ a(ee, { html: $ })
1191
+ },
1192
+ f
1193
+ ),
1194
+ children: /* @__PURE__ */ a(xt, { loading: i })
1195
+ }
1196
+ );
1197
+ }, bt = c(_)`
1198
+ display: flex;
1199
+ justify-content: space-between;
1200
+ align-items: center;
1201
+ width: 100%;
1202
+ text-align: left;
1203
+ svg,
1204
+ i {
1205
+ color: ${(t) => {
1206
+ var e;
1207
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1208
+ }};
1209
+ }
1210
+ span {
1211
+ color: ${(t) => {
1212
+ var e;
1213
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1214
+ }};
1215
+ font-size: ${(t) => {
1216
+ var e;
1217
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
1218
+ }};
1219
+ overflow: hidden;
1220
+ text-overflow: ellipsis;
1221
+ flex: 1;
1222
+ white-space: nowrap;
1223
+ }
1224
+ &:focus-visible {
1225
+ ${W}
1226
+ span {
1227
+ color: ${(t) => {
1228
+ var e;
1229
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1230
+ }};
1231
+ text-decoration: underline;
1232
+ }
1233
+ }
1234
+ `, wt = c(C)`
1235
+ ${tt}
1236
+ ${D}
1237
+ overflow: hidden;
1238
+ justify-content: flex-start;
1239
+ padding: ${(t) => {
1240
+ var e;
1241
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1242
+ }};
1243
+ ${(t) => !t["data-show-header"] && y`
1244
+ > div {
1245
+ ${Y(t)(
1246
+ "h1",
1247
+ y`
1248
+ display: none;
1249
+ `
1250
+ )}
1251
+ }
1252
+ `}
1253
+
1254
+ @media (hover: hover) {
1255
+ button:hover {
1256
+ text-decoration: underline;
1257
+ }
1258
+ }
1259
+ `, ee = c(_e)`
1260
+ ${Oe}
1261
+ font-weight: 300;
1262
+
1263
+ p {
1264
+ white-space: normal;
1265
+ }
1266
+ `, kt = c.li`
1267
+ .humany-paragraph {
1268
+ display: none;
1269
+ &:not(:only-child) {
1270
+ ${(t) => {
1271
+ var e, n, i;
1272
+ return ((e = t.theme.sizes) == null ? void 0 : e.cardinal) && ((n = t.theme.sizes) == null ? void 0 : n.normal) && y`
1273
+ margin: ${(i = t.theme.sizes) == null ? void 0 : i.normal} 0;
1274
+ `;
1275
+ }}
1276
+ }
1277
+ }
1278
+
1279
+ ${(t) => t["data-expanded"] && y`
1280
+ .humany-paragraph {
1281
+ display: block;
1282
+ }
1283
+ `}
1284
+
1285
+ > span {
1286
+ display: block;
1287
+ font-weight: 300;
1288
+ color: ${(t) => {
1289
+ var e;
1290
+ return (e = t.theme.colors) == null ? void 0 : e.accent;
1291
+ }};
1292
+ }
1293
+ `, zt = c(z)`
1294
+ margin: 0 0 0 ${(t) => {
1295
+ var e;
1296
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1297
+ }};
1298
+ line {
1299
+ stroke: ${(t) => {
1300
+ var e;
1301
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1302
+ }};
1303
+ }
1304
+ `, St = c(ce)`
1305
+ font-size: ${(t) => {
1306
+ var e;
1307
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
1308
+ }};
1309
+ font-weight: 300;
1310
+ `, Nt = (t) => new RegExp("^#", "i").test(t), Lt = (t) => ({ children: e, ...n }) => {
1311
+ const {
1312
+ implementation: i,
1313
+ name: o
1314
+ } = t.get("$widget"), { href: s = "" } = n;
1315
+ if (Nt(s))
1316
+ return /* @__PURE__ */ a(Ge, { smooth: !0, to: s, children: e });
1317
+ const r = i.bindings.map((d) => d.replace(/\./g, "\\.")).join("|"), l = new RegExp(
1318
+ `^((http[s]?:)?//)?(${r})/([^\\s]+)`
1319
+ ).exec(s);
1320
+ if (l && l.length >= 4) {
1321
+ const d = l[4];
1322
+ if (i.widgets.get(d) && !d.startsWith("blob?") && !d.startsWith(o))
1323
+ return /* @__PURE__ */ a(Ke, { widgetName: d, children: e });
1324
+ }
1325
+ return /* @__PURE__ */ a("a", { ...n, children: e });
1326
+ }, Ut = (t, e = []) => ({
1327
+ transform: {
1328
+ a: (n) => {
1329
+ const { children: i, ...o } = n, s = o["data-target"];
1330
+ if (s && e.length) {
1331
+ const m = e.find(
1332
+ ({ connection: l }) => l === s
1333
+ );
1334
+ if (m)
1335
+ return /* @__PURE__ */ a(fe, { ...m, children: i });
1336
+ }
1337
+ return Lt(t)(n);
1338
+ }
1339
+ }
1340
+ });
1341
+ export {
1342
+ Ot as AccordionListItem,
1343
+ fe as DialogLink,
1344
+ Mt as DialogList,
1345
+ Pt as DrawerList,
1346
+ Bt as DropdownActions,
1347
+ Ht as DropdownList,
1348
+ it as FavoriteButton,
1349
+ Wt as Feedback,
1350
+ Gt as GuideList,
1351
+ xt as Loader,
1352
+ yt as LoaderWrapper,
1353
+ rt as Metadata,
1354
+ Kt as NotificationList,
1355
+ jt as SmallCaret,
1356
+ Rt as StyledHeaderText,
1357
+ nt as StyledListButton,
1358
+ Ut as guideRenderInstructions,
1359
+ tt as loadingOpacity,
1360
+ Et as useArrowKeys,
1361
+ Yt as useDebounce,
1362
+ st as useFavorites,
1363
+ _t as useHover
1364
+ };