@telia-ace/widget-components-area 1.0.33 → 1.1.1-rc.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.
@@ -0,0 +1,896 @@
1
+ import { jsx as u, jsxs as $e } from "react/jsx-runtime";
2
+ import { c as N, E as Ce, _ as we, a as Ee, b as Se, T as le, P as z, C as de, u as X, d as k, e as L, f as Te, g as Z, h as A, i as me, W as R, j as pe, k as fe, S as Pe, R as Q, n as b, G as q, l as J, m as ne, o as j, p as he, q as ge, r as De, s as Re, t as be, A as G, D as Me, v as Oe, w as Ve, L as Ne, B as je, x as Ae, y as _e } from "./index-aa7b061f.mjs";
3
+ import F, { Children as ze, isValidElement as Y, cloneElement as H, useContext as re, useState as S, useCallback as ye, useEffect as $, forwardRef as oe, useMemo as Fe, Suspense as Le } from "react";
4
+ import "react-dom";
5
+ const Be = (e) => e === "entering" || e === "entered", Ke = (e) => e === "exiting" || e === "exited", O = {
6
+ fade: {
7
+ in: "opacity: 1;",
8
+ out: "opacity: 0;"
9
+ },
10
+ "slide-left": {
11
+ in: "transform: translateX(0);",
12
+ out: "transform: translateX(-100%);"
13
+ },
14
+ "slide-right": {
15
+ in: "transform: translateX(0);",
16
+ out: "transform: translateX(100%);"
17
+ },
18
+ "slide-up": {
19
+ in: "transform: translateY(0);",
20
+ out: "transform: translateY(100%);"
21
+ },
22
+ "slide-down": {
23
+ in: "transform: translateY(0);",
24
+ out: "transform: translateY(-100%);"
25
+ },
26
+ scale: {
27
+ in: "transform: scale(1);",
28
+ out: "transform: scale(0);"
29
+ }
30
+ }, We = ["slide-up", "slide-down", "slide-left", "slide-right", "scale"], I = {
31
+ compose: (e = "exited", t) => {
32
+ const { enter: r, exit: s } = t, n = r.transitionKeys.split(" "), i = We.indexOf(n[0]) > -1 ? "transform" : "opacity";
33
+ if (Be(e))
34
+ return n && n.length > 0 ? N`
35
+ ${n && n.length > 0 && n.map((a) => O[a] ? O[a].in : "")}
36
+ transition: ${i} ${r.duration}ms ${r.easing};
37
+ ` : "";
38
+ const o = n && n.length > 0 && N`
39
+ ${n.map((a) => O[a] ? O[a].out : "")}
40
+ `;
41
+ if (Ke(e)) {
42
+ const a = s.transitionKeys.split(" ");
43
+ return a && a.length > 0 && e === "exiting" ? N`
44
+ ${o};
45
+ ${a.map((c) => O[c] ? O[c].out : "")}
46
+ transition: ${i} ${s.duration}ms ${s.easing};
47
+ ` : o;
48
+ }
49
+ },
50
+ composeViewTransition: (e, t, r) => {
51
+ if (t === "slide")
52
+ return I.compose(e, {
53
+ enter: {
54
+ transitionKeys: r === "forth" ? "slide-right" : "slide-left",
55
+ duration: 500
56
+ },
57
+ exit: {
58
+ transitionKeys: r === "forth" ? "slide-left" : "slide-right",
59
+ duration: 500
60
+ }
61
+ });
62
+ if (t === "fade")
63
+ return I.compose(e, {
64
+ enter: {
65
+ transitionKeys: "fade",
66
+ duration: 500
67
+ },
68
+ exit: {
69
+ transitionKeys: "fade",
70
+ duration: 500
71
+ }
72
+ });
73
+ },
74
+ get: (e) => O[e]
75
+ }, ue = (e = {}) => (Object.keys(e).forEach((t) => {
76
+ (e[t] === null || typeof e[t] > "u") && delete e[t];
77
+ }), e), Ge = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ u(Ce, { ...t }) : null;
78
+ function Xe(e) {
79
+ if (e === void 0)
80
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
81
+ return e;
82
+ }
83
+ function ie(e, t) {
84
+ var r = function(i) {
85
+ return t && Y(i) ? t(i) : i;
86
+ }, s = /* @__PURE__ */ Object.create(null);
87
+ return e && ze.map(e, function(n) {
88
+ return n;
89
+ }).forEach(function(n) {
90
+ s[n.key] = r(n);
91
+ }), s;
92
+ }
93
+ function Ye(e, t) {
94
+ e = e || {}, t = t || {};
95
+ function r(d) {
96
+ return d in t ? t[d] : e[d];
97
+ }
98
+ var s = /* @__PURE__ */ Object.create(null), n = [];
99
+ for (var i in e)
100
+ i in t ? n.length && (s[i] = n, n = []) : n.push(i);
101
+ var o, a = {};
102
+ for (var c in t) {
103
+ if (s[c])
104
+ for (o = 0; o < s[c].length; o++) {
105
+ var l = s[c][o];
106
+ a[s[c][o]] = r(l);
107
+ }
108
+ a[c] = r(c);
109
+ }
110
+ for (o = 0; o < n.length; o++)
111
+ a[n[o]] = r(n[o]);
112
+ return a;
113
+ }
114
+ function V(e, t, r) {
115
+ return r[t] != null ? r[t] : e.props[t];
116
+ }
117
+ function He(e, t) {
118
+ return ie(e.children, function(r) {
119
+ return H(r, {
120
+ onExited: t.bind(null, r),
121
+ in: !0,
122
+ appear: V(r, "appear", e),
123
+ enter: V(r, "enter", e),
124
+ exit: V(r, "exit", e)
125
+ });
126
+ });
127
+ }
128
+ function Ie(e, t, r) {
129
+ var s = ie(e.children), n = Ye(t, s);
130
+ return Object.keys(n).forEach(function(i) {
131
+ var o = n[i];
132
+ if (Y(o)) {
133
+ var a = i in t, c = i in s, l = t[i], d = Y(l) && !l.props.in;
134
+ c && (!a || d) ? n[i] = H(o, {
135
+ onExited: r.bind(null, o),
136
+ in: !0,
137
+ exit: V(o, "exit", e),
138
+ enter: V(o, "enter", e)
139
+ }) : !c && a && !d ? n[i] = H(o, {
140
+ in: !1
141
+ }) : c && a && Y(l) && (n[i] = H(o, {
142
+ onExited: r.bind(null, o),
143
+ in: l.props.in,
144
+ exit: V(o, "exit", e),
145
+ enter: V(o, "enter", e)
146
+ }));
147
+ }
148
+ }), n;
149
+ }
150
+ var Ue = Object.values || function(e) {
151
+ return Object.keys(e).map(function(t) {
152
+ return e[t];
153
+ });
154
+ }, ke = {
155
+ component: "div",
156
+ childFactory: function(t) {
157
+ return t;
158
+ }
159
+ }, se = /* @__PURE__ */ function(e) {
160
+ we(t, e);
161
+ function t(s, n) {
162
+ var i;
163
+ i = e.call(this, s, n) || this;
164
+ var o = i.handleExited.bind(Xe(i));
165
+ return i.state = {
166
+ contextValue: {
167
+ isMounting: !0
168
+ },
169
+ handleExited: o,
170
+ firstRender: !0
171
+ }, i;
172
+ }
173
+ var r = t.prototype;
174
+ return r.componentDidMount = function() {
175
+ this.mounted = !0, this.setState({
176
+ contextValue: {
177
+ isMounting: !1
178
+ }
179
+ });
180
+ }, r.componentWillUnmount = function() {
181
+ this.mounted = !1;
182
+ }, t.getDerivedStateFromProps = function(n, i) {
183
+ var o = i.children, a = i.handleExited, c = i.firstRender;
184
+ return {
185
+ children: c ? He(n, a) : Ie(n, o, a),
186
+ firstRender: !1
187
+ };
188
+ }, r.handleExited = function(n, i) {
189
+ var o = ie(this.props.children);
190
+ n.key in o || (n.props.onExited && n.props.onExited(i), this.mounted && this.setState(function(a) {
191
+ var c = Ee({}, a.children);
192
+ return delete c[n.key], {
193
+ children: c
194
+ };
195
+ }));
196
+ }, r.render = function() {
197
+ var n = this.props, i = n.component, o = n.childFactory, a = Se(n, ["component", "childFactory"]), c = this.state.contextValue, l = Ue(this.state.children).map(o);
198
+ return delete a.appear, delete a.enter, delete a.exit, i === null ? /* @__PURE__ */ F.createElement(le.Provider, {
199
+ value: c
200
+ }, l) : /* @__PURE__ */ F.createElement(le.Provider, {
201
+ value: c
202
+ }, /* @__PURE__ */ F.createElement(i, a, l));
203
+ }, t;
204
+ }(F.Component);
205
+ se.propTypes = process.env.NODE_ENV !== "production" ? {
206
+ /**
207
+ * `<TransitionGroup>` renders a `<div>` by default. You can change this
208
+ * behavior by providing a `component` prop.
209
+ * If you use React v16+ and would like to avoid a wrapping `<div>` element
210
+ * you can pass in `component={null}`. This is useful if the wrapping div
211
+ * borks your css styles.
212
+ */
213
+ component: z.any,
214
+ /**
215
+ * A set of `<Transition>` components, that are toggled `in` and out as they
216
+ * leave. the `<TransitionGroup>` will inject specific transition props, so
217
+ * remember to spread them through if you are wrapping the `<Transition>` as
218
+ * with our `<Fade>` example.
219
+ *
220
+ * While this component is meant for multiple `Transition` or `CSSTransition`
221
+ * children, sometimes you may want to have a single transition child with
222
+ * content that you want to be transitioned out and in when you change it
223
+ * (e.g. routes, images etc.) In that case you can change the `key` prop of
224
+ * the transition child as you change its content, this will cause
225
+ * `TransitionGroup` to transition the child out and back in.
226
+ */
227
+ children: z.node,
228
+ /**
229
+ * A convenience prop that enables or disables appear animations
230
+ * for all children. Note that specifying this will override any defaults set
231
+ * on individual children Transitions.
232
+ */
233
+ appear: z.bool,
234
+ /**
235
+ * A convenience prop that enables or disables enter animations
236
+ * for all children. Note that specifying this will override any defaults set
237
+ * on individual children Transitions.
238
+ */
239
+ enter: z.bool,
240
+ /**
241
+ * A convenience prop that enables or disables exit animations
242
+ * for all children. Note that specifying this will override any defaults set
243
+ * on individual children Transitions.
244
+ */
245
+ exit: z.bool,
246
+ /**
247
+ * You may need to apply reactive updates to a child as it is exiting.
248
+ * This is generally done by using `cloneElement` however in the case of an exiting
249
+ * child the element has already been removed and not accessible to the consumer.
250
+ *
251
+ * If you do need to update a child as it leaves you can provide a `childFactory`
252
+ * to wrap every child, even the ones that are leaving.
253
+ *
254
+ * @type Function(child: ReactElement) -> ReactElement
255
+ */
256
+ childFactory: z.func
257
+ } : {};
258
+ se.defaultProps = ke;
259
+ const qe = se, ae = () => re(de), ee = (e, t) => ({
260
+ id: e.id,
261
+ type: e.type,
262
+ name: e.name,
263
+ branch: t || "default"
264
+ }), Je = () => {
265
+ const e = X(), t = k(), [r, s] = S([]), n = L(), i = ye(
266
+ (o) => {
267
+ if (t && n.current && o) {
268
+ const a = t.getBranch(o), c = o.getChildren(a).map((l) => ee(l));
269
+ s(c);
270
+ }
271
+ },
272
+ [n, t, s, e]
273
+ );
274
+ return $(() => {
275
+ e && i(e);
276
+ }, [e, t]), $(() => {
277
+ if (t) {
278
+ const [o, a] = Te(t.events);
279
+ return o("components:set-layout", (c, l) => {
280
+ (e === l.node.parent || l.node.parent === t.nodes.root) && i(l.node.parent);
281
+ }), o("components:node-appended", (c, l) => {
282
+ (e === l.node.parent || l.node.parent === t.nodes.root) && i(l.node.parent);
283
+ }), o("components:node-removed", (c, { parentNode: l }) => {
284
+ (l === e || l === t.nodes.root) && i(l);
285
+ }), () => {
286
+ a();
287
+ };
288
+ }
289
+ }, [e, t, i]), r;
290
+ }, Qe = () => re(Z), Ze = (e, t) => {
291
+ const r = ae(), s = A(), [n, i] = S(void 0), o = L(), a = e || r.type || "";
292
+ return $(() => {
293
+ if (a) {
294
+ let c;
295
+ return (t || s).getAsync("componentResolver").then((l) => {
296
+ if (o.current) {
297
+ const d = l.getComponent(a);
298
+ i(d);
299
+ }
300
+ c = l.registerResolver(a, (d) => {
301
+ o.current && i(d);
302
+ });
303
+ }), () => {
304
+ c && c();
305
+ };
306
+ }
307
+ }, [o, a, t, s]), n;
308
+ }, et = (e) => {
309
+ const t = X(e), r = k(), [s, n] = S({}), i = L();
310
+ return $(() => {
311
+ t && i.current && n(t.attributes.layout);
312
+ }, [t, i]), $(() => {
313
+ if (r) {
314
+ const o = r.events.subscribe(
315
+ "components:layout-changed",
316
+ (a, c) => {
317
+ t === c.node && i.current && n(c.node.attributes.layout);
318
+ }
319
+ );
320
+ return () => {
321
+ o();
322
+ };
323
+ }
324
+ }, [r, i, t]), s;
325
+ }, ce = () => re(me), tt = (e) => {
326
+ const [t, r] = S(), s = A(), n = L();
327
+ return $(() => {
328
+ let i;
329
+ const o = (e || s).get("$widget");
330
+ if (!o)
331
+ return;
332
+ const { name: a, invoke: c } = o;
333
+ return c("renderState").then((l) => {
334
+ n.current && r(l);
335
+ }), (e || s).getAsync("actionResolver").then((l) => {
336
+ i = l.subscribe(a, (d, m) => {
337
+ switch (m) {
338
+ case "close":
339
+ case "open":
340
+ n.current && r(
341
+ m === "open" ? R.open : R.closed
342
+ );
343
+ break;
344
+ case "hide":
345
+ n.current && r(R.hidden);
346
+ }
347
+ });
348
+ }), () => {
349
+ i && i();
350
+ };
351
+ }, [n]), t;
352
+ }, nt = (e) => {
353
+ const t = A(), r = pe(), [s, n] = S({ name: "", params: {} }), i = L();
354
+ return $(() => {
355
+ const o = (e || t).get("$widget");
356
+ if (!o)
357
+ return;
358
+ const { events: a } = o;
359
+ return a.subscribe("router:change", (l, { next: { routeData: d } }) => {
360
+ if (i.current) {
361
+ const { name: m, params: p } = d;
362
+ ue(p), n({ name: m, params: p });
363
+ }
364
+ });
365
+ }, [i, e, t]), $(() => {
366
+ if (r && r.history && i.current) {
367
+ const o = r.getRouteData(), { name: a, params: c } = o;
368
+ ue(c), n({ name: a, params: c });
369
+ }
370
+ }, [r, i]), s;
371
+ }, rt = (e) => {
372
+ const {
373
+ in: t,
374
+ mountOnEnter: r = !0,
375
+ unmountOnExit: s = !0,
376
+ timeout: n,
377
+ children: i,
378
+ transitions: o
379
+ } = e, c = (() => {
380
+ var l, d;
381
+ if (!(!o || o === "none")) {
382
+ if (typeof o == "string")
383
+ return {
384
+ enter: {
385
+ transitionKeys: o,
386
+ duration: n ? typeof n == "number" ? n : n.enter : 200,
387
+ easing: "ease-in"
388
+ },
389
+ exit: {
390
+ transitionKeys: o,
391
+ duration: n ? typeof n == "number" ? n : n.exit : 200,
392
+ easing: "ease-out"
393
+ }
394
+ };
395
+ if (typeof o == "object") {
396
+ const { enter: m, exit: p } = o;
397
+ return {
398
+ enter: {
399
+ transitionKeys: (l = o.enter) == null ? void 0 : l.type,
400
+ duration: n ? typeof n == "number" ? n : n.enter : 200,
401
+ easing: m.easing ? m.easing : "ease-in"
402
+ },
403
+ exit: {
404
+ transitionKeys: (d = o.enter) == null ? void 0 : d.type,
405
+ duration: n ? typeof n == "number" ? n : n.enter : 200,
406
+ easing: p.easing ? p.easing : "ease-out"
407
+ }
408
+ };
409
+ }
410
+ }
411
+ })();
412
+ return /* @__PURE__ */ u(
413
+ fe,
414
+ {
415
+ timeout: {
416
+ enter: c && c.enter.duration || 0,
417
+ exit: c && c.exit.duration || 0
418
+ },
419
+ in: t,
420
+ appear: !0,
421
+ mountOnEnter: r,
422
+ unmountOnExit: s,
423
+ onEnter: (l) => l.clientHeight,
424
+ children: (l) => i && i(l, c && I.compose(l, c))
425
+ }
426
+ );
427
+ };
428
+ var te = /* @__PURE__ */ ((e) => (e.back = "back", e.forth = "forth", e))(te || {});
429
+ const ot = (e, t, r) => typeof r[e] == "number" && typeof r[t] == "number" && r[e] > r[t] ? "back" : "forth", ve = ({ views: e, location: t, render: r }) => /* @__PURE__ */ u(
430
+ Pe,
431
+ {
432
+ location: t && {
433
+ ...t,
434
+ pathname: t.pathname.split("?")[0]
435
+ },
436
+ children: [
437
+ ...Object.keys(e).filter((s) => !!e[s].path),
438
+ ...Object.keys(e).filter((s) => !e[s].path)
439
+ ].map((s) => {
440
+ const { path: n } = e[s];
441
+ return n ? Array.isArray(n) ? n.map((i) => /* @__PURE__ */ u(Q, { exact: !0, path: i, render: () => r(s) }, s)) : /* @__PURE__ */ u(Q, { exact: !0, path: n, render: () => r(s) }, s) : /* @__PURE__ */ u(Q, { render: () => r(s) }, s);
442
+ })
443
+ }
444
+ ), it = b.div`
445
+ position: relative;
446
+ width: 100%;
447
+ flex: 1;
448
+ `, st = b(q)`
449
+ position: absolute;
450
+ left: 0;
451
+ right: 0;
452
+ ${(e) => !!e.animationCss && e.animationCss}
453
+ ${(e) => !!e.scrollableCss && e.scrollableCss}
454
+ `, at = {
455
+ index: 1,
456
+ search: 2,
457
+ browse: 3,
458
+ guide: 4,
459
+ contact: 5,
460
+ "contact-method": 6,
461
+ conversation: 7
462
+ }, ct = ({ className: e = "", ...t }) => {
463
+ const [r, s] = S("index"), [n, i] = S(
464
+ te.forth
465
+ ), o = nt(), a = pe(), c = ce(), l = J(), d = A(), m = X(), { gap: p = "0" } = l, {
466
+ columns: T = 1,
467
+ animation: C = "none",
468
+ scrollable: g = !1,
469
+ ...M
470
+ } = c, [K, P] = ne(g);
471
+ if (!m || !a)
472
+ return null;
473
+ const { location: _ } = a;
474
+ o.name !== r && o.name !== "" && C && (i(
475
+ ot(r, o.name, at)
476
+ ), s(o.name));
477
+ const { views: y } = d.get("$settings");
478
+ if (!Object.keys(y).length)
479
+ return null;
480
+ const v = (f, w, E) => {
481
+ const h = W(w, E), D = m.getChildren(f)[0];
482
+ return /* @__PURE__ */ u(
483
+ st,
484
+ {
485
+ ...t,
486
+ ...M,
487
+ scrollableCss: K,
488
+ ref: P,
489
+ columns: T,
490
+ gap: p,
491
+ ...h,
492
+ className: j(e, "humany-view"),
493
+ children: /* @__PURE__ */ u(U, { id: D.id, branch: "default" })
494
+ }
495
+ );
496
+ }, W = (f, w) => {
497
+ if (C === "slide" || C === "fade")
498
+ return {
499
+ animationCss: I.composeViewTransition(
500
+ f,
501
+ C,
502
+ w
503
+ ),
504
+ "data-state": f
505
+ };
506
+ };
507
+ return /* @__PURE__ */ u(it, { className: "humany-animated-view", children: /* @__PURE__ */ u(
508
+ qe,
509
+ {
510
+ component: null,
511
+ childFactory: (f) => F.cloneElement(f, { direction: n }),
512
+ children: /* @__PURE__ */ u(
513
+ fe,
514
+ {
515
+ timeout: { enter: 500, exit: 500 },
516
+ onEnter: (f) => f == null ? void 0 : f.clientHeight,
517
+ unmountOnExit: !0,
518
+ direction: te.forth,
519
+ children: (f, { direction: w }) => /* @__PURE__ */ u(
520
+ ve,
521
+ {
522
+ views: y,
523
+ location: _,
524
+ render: (E) => v(E, f, w)
525
+ }
526
+ )
527
+ },
528
+ r
529
+ )
530
+ }
531
+ ) });
532
+ }, lt = b(q)`
533
+ ${(e) => !!e.scrollableCss && e.scrollableCss}
534
+ `, ut = ({ className: e = "", ...t }) => {
535
+ const r = ce(), s = J(), n = A(), i = X(), { views: o } = n.get("$settings"), { gap: a = "0" } = s, { columns: c = 1, animation: l = "none", scrollable: d = !1, ...m } = r, [p, T] = ne(d);
536
+ return i ? /* @__PURE__ */ u(
537
+ lt,
538
+ {
539
+ ...t,
540
+ ...m,
541
+ scrollableCss: p,
542
+ ref: T,
543
+ columns: c,
544
+ gap: a,
545
+ className: j(e, "humany-view"),
546
+ children: /* @__PURE__ */ u(
547
+ ve,
548
+ {
549
+ views: o,
550
+ render: (C) => {
551
+ const g = i.getChildren(C)[0];
552
+ return /* @__PURE__ */ u(U, { id: g.id, node: g, branch: "default" });
553
+ }
554
+ }
555
+ )
556
+ }
557
+ ) : null;
558
+ }, B = (e) => {
559
+ var t, r;
560
+ return N`
561
+ outline: none;
562
+ box-sizing: border-box;
563
+ * {
564
+ box-sizing: border-box;
565
+ outline: none;
566
+ }
567
+
568
+ grid-column: ${e["data-indent"] ? `${e["data-indent"] + 1} / ${e["data-indent"] + (e["data-width"] || 0) + 1}` : `span ${e["data-width"]}`};
569
+
570
+ ${((t = e.theme.fonts) == null ? void 0 : t.type) && `
571
+ font-family: ${e.theme.fonts.type};
572
+
573
+ input, textarea {
574
+ font-family: ${e.theme.fonts.type};
575
+ }
576
+ `}
577
+
578
+ ${((r = e.theme.fonts) == null ? void 0 : r.base) && `
579
+ font-size: ${e.theme.fonts.base};
580
+ `}
581
+
582
+ &:focus-visible {
583
+ ${he(e)};
584
+ }
585
+ `;
586
+ }, dt = b(ut)`
587
+ ${(e) => B(e)}
588
+ `, mt = b(ct)`
589
+ ${(e) => B(e)}
590
+ `, pt = b.div`
591
+ text-align: center;
592
+ ${(e) => {
593
+ var t, r, s;
594
+ return typeof ((t = e.theme.colors) == null ? void 0 : t.warning) < "u" && N`
595
+ color: ${(r = e.theme.colors) == null ? void 0 : r.warning};
596
+ border: 2px dashed ${(s = e.theme.colors) == null ? void 0 : s.warning};
597
+ `;
598
+ }}
599
+ ${(e) => typeof e.theme.borderRadius < "u" && `border-radius: ${e.theme.borderRadius};`}
600
+ ${(e) => B(e)}
601
+ `, ft = oe(
602
+ ({ className: e = "", children: t, ...r }, s) => {
603
+ const n = Ze(), { name: i, type: o, id: a } = ae(), c = Fe(() => n ? b(n)`
604
+ ${B}
605
+ ${ge}
606
+ ` : null, [n]);
607
+ return typeof n > "u" ? null : n === null || c === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ u(
608
+ pt,
609
+ {
610
+ ...r,
611
+ title: `type: ${o}, definition-id: ${i}, instance-id: ${a}`,
612
+ className: j(e, "humany-non-resolved-component"),
613
+ children: /* @__PURE__ */ u(De, { variant: "h5", children: "Non Resolved Component Type" })
614
+ }
615
+ ) : null : /* @__PURE__ */ u(Le, { fallback: null, children: /* @__PURE__ */ u(
616
+ c,
617
+ {
618
+ ref: s,
619
+ ...r,
620
+ className: j(
621
+ e,
622
+ "humany-component",
623
+ `humany-component-${i}`
624
+ ),
625
+ children: t
626
+ }
627
+ ) });
628
+ }
629
+ ), ht = (e) => {
630
+ const t = X(e), r = k(), [s, n] = S({}), i = L();
631
+ return $(() => {
632
+ t && i.current && n(t.attributes.properties);
633
+ }, [t, e, i]), $(() => {
634
+ if (r) {
635
+ const o = r.events.subscribe(
636
+ "components:properties-changed",
637
+ (a, c) => {
638
+ t === c.node && i.current && n(c.node.attributes.properties);
639
+ }
640
+ );
641
+ return () => {
642
+ o();
643
+ };
644
+ }
645
+ }, [r, i, e, t]), s;
646
+ }, gt = (e, t) => t ? !0 : typeof e == "string" ? e === "full" : e > 0, U = oe(
647
+ ({
648
+ className: e = "",
649
+ id: t,
650
+ branch: r,
651
+ node: s,
652
+ ariaLabel: n,
653
+ tabIndex: i,
654
+ context: o,
655
+ ...a
656
+ }, c) => {
657
+ const l = k(), d = A(), [m, p] = S(), T = Qe(), C = J(t), g = ht(t), { size: M = "none", indent: K = 0 } = et(t), P = gt(M, s);
658
+ if ($(() => {
659
+ if (l) {
660
+ if (t && !s) {
661
+ const h = l.nodes.get(t);
662
+ if (h && (p(ee(h, r)), P)) {
663
+ const D = h.mount(d);
664
+ return () => {
665
+ D();
666
+ };
667
+ }
668
+ } else if (s) {
669
+ p(ee(s, r));
670
+ const h = s.mount(d);
671
+ return () => {
672
+ h();
673
+ };
674
+ }
675
+ }
676
+ }, [l, t, s, P]), !m || !P)
677
+ return null;
678
+ const _ = { ...C, ...o || {} }, {
679
+ cardinal: y,
680
+ fonts: v = {},
681
+ accessibility: W = {},
682
+ ...f
683
+ } = _, w = {
684
+ type: v.type,
685
+ base: v.base || "16px",
686
+ small: v.small || "0.8em",
687
+ normal: v.normal || "1em",
688
+ medium: v.medium || "1.2em",
689
+ large: v.large || "1.6em",
690
+ huge: v.huge || "2.5em"
691
+ }, E = {
692
+ ...f,
693
+ fonts: w,
694
+ accessibility: {
695
+ ...W
696
+ }
697
+ };
698
+ return typeof y == "number" && (E.sizes = {
699
+ cardinal: y,
700
+ small: `${y}px`,
701
+ normal: `${y * 3}px`,
702
+ medium: `${y * 5}px`,
703
+ large: `${y * 8}px`
704
+ }), /* @__PURE__ */ u(Re, { theme: E, children: /* @__PURE__ */ u(de.Provider, { value: m, children: /* @__PURE__ */ u(me.Provider, { value: g, children: (() => {
705
+ const h = {
706
+ "data-width": M === "full" ? T : Math.min(M, T),
707
+ "data-indent": K,
708
+ "data-name": m.name,
709
+ "data-node-id": m.id,
710
+ "data-component-type": m.type,
711
+ "aria-label": n,
712
+ tabIndex: i,
713
+ id: m.id,
714
+ role: g && g.role,
715
+ ...a
716
+ };
717
+ switch (m.type) {
718
+ case "view":
719
+ return typeof g.animation == "string" && g.animation !== "none" ? /* @__PURE__ */ u(mt, { ...h, className: e }) : /* @__PURE__ */ u(dt, { ...h, className: e });
720
+ default: {
721
+ const D = be(g);
722
+ return /* @__PURE__ */ u(
723
+ ft,
724
+ {
725
+ ref: c,
726
+ ...h,
727
+ ...D,
728
+ className: e
729
+ }
730
+ );
731
+ }
732
+ }
733
+ })() }) }) });
734
+ }
735
+ );
736
+ F.lazy(() => import("./detached-component-c0baa00b.mjs"));
737
+ const bt = oe(
738
+ ({ children: e, className: t, renderState: r, animation: s, ...n }, i) => r ? /* @__PURE__ */ u(
739
+ rt,
740
+ {
741
+ mountOnEnter: r !== R.hidden,
742
+ timeout: 200,
743
+ in: r === R.open,
744
+ transitions: s,
745
+ unmountOnExit: r === R.closed,
746
+ children: (o, a) => /* @__PURE__ */ u(
747
+ yt,
748
+ {
749
+ ...n,
750
+ animationCss: a,
751
+ "data-state": o,
752
+ ref: i,
753
+ className: j("humany-animated-area", t),
754
+ children: e
755
+ }
756
+ )
757
+ }
758
+ ) : null
759
+ ), yt = b(q)`
760
+ ${B}
761
+ ${(e) => !!e.animationCss && e.animationCss}
762
+ ${(e) => !!e.scrollableCss && e.scrollableCss}
763
+ text-size-adjust: 100%;
764
+ input::-ms-clear {
765
+ display: none;
766
+ }
767
+ ${(e) => e.hidden && e["data-state"] === "exited" && N`
768
+ visibility: collapse;
769
+ pointer-events: none;
770
+ `};
771
+ `, vt = ({ className: e, ...t }) => {
772
+ const { name: r } = ae(), s = tt(), n = J(), i = ce(), o = Je(), a = A(), { gap: c = "0" } = n, {
773
+ columns: l = 1,
774
+ animation: d = "none",
775
+ scrollable: m = !1,
776
+ mode: p = G.Static,
777
+ trigger: T = {},
778
+ fullScreen: C,
779
+ header: g,
780
+ ...M
781
+ } = i, { size: K = 24, symbol: P, label: _, ariaLabel: y, ...v } = T, [W, f] = ne(m), w = ye(
782
+ (x) => {
783
+ const { events: xe } = a.get("$widget");
784
+ return xe.dispatch("widget:area-rendered", {
785
+ name: r,
786
+ properties: i,
787
+ element: x
788
+ }), f.current = x, x;
789
+ },
790
+ // eslint-disable-next-line react-hooks/exhaustive-deps
791
+ [i, s]
792
+ );
793
+ if (!o.length)
794
+ return Ge(a, {
795
+ ...t,
796
+ className: j(e, "humany-area")
797
+ });
798
+ const E = {
799
+ ...t,
800
+ className: j(
801
+ e,
802
+ "humany-area",
803
+ `humany-area-${r}`
804
+ ),
805
+ scrollableCss: W,
806
+ ...M,
807
+ columns: l,
808
+ gap: c,
809
+ renderState: s,
810
+ animation: d,
811
+ hidden: s === R.hidden,
812
+ ref: w
813
+ }, h = (() => d !== "none" ? /* @__PURE__ */ u(Z.Provider, { value: l, children: /* @__PURE__ */ u(bt, { ...E, children: o.map((x) => /* @__PURE__ */ u(U, { id: x.id, branch: "default" }, x.id)) }) }) : s === R.closed ? null : /* @__PURE__ */ u(Z.Provider, { value: l, children: /* @__PURE__ */ u(wt, { ...E, children: o.map((x) => /* @__PURE__ */ u(U, { id: x.id, branch: "default" }, x.id)) }) }))();
814
+ if (p === G.Static)
815
+ return h;
816
+ const D = /* @__PURE__ */ $e(
817
+ xt,
818
+ {
819
+ className: "humany-area-trigger",
820
+ title: y,
821
+ ...be(v),
822
+ children: [
823
+ _ && /* @__PURE__ */ u($t, { children: _ }),
824
+ P && /* @__PURE__ */ u(Ct, { symbol: P, size: K })
825
+ ]
826
+ }
827
+ );
828
+ if (p === G.Dropdown)
829
+ return /* @__PURE__ */ u(Me, { trigger: D, children: h });
830
+ if (p === G.Drawer) {
831
+ const x = Object.values(Oe).includes(d) && {
832
+ type: d
833
+ } || void 0;
834
+ return /* @__PURE__ */ u(
835
+ Ve,
836
+ {
837
+ header: g,
838
+ animation: x,
839
+ fullScreen: C,
840
+ trigger: D,
841
+ children: h
842
+ }
843
+ );
844
+ }
845
+ return p === G.Modal && Ne.warn("modal area not implemented"), null;
846
+ }, xt = b(je)`
847
+ display: flex;
848
+ align-items: inherit;
849
+ align-self: center;
850
+ width: fit-content;
851
+ height: fit-content;
852
+ ${ge}
853
+
854
+ ${(e) => e.theme.fonts && `
855
+ font-family: ${e.theme.fonts.type};
856
+ font-size: ${e.theme.fonts.normal};
857
+ `}
858
+
859
+ &:focus-visible {
860
+ ${he};
861
+ }
862
+ `, $t = b(Ae)`
863
+ margin: 0 ${(e) => {
864
+ var t;
865
+ return (t = e.theme.sizes) == null ? void 0 : t.small;
866
+ }} 0 0;
867
+ color: ${(e) => {
868
+ var t;
869
+ return (t = e.theme.colors) == null ? void 0 : t.text;
870
+ }};
871
+ `, Ct = b(_e)`
872
+ path {
873
+ fill: ${(e) => {
874
+ var t;
875
+ return (t = e.theme.colors) == null ? void 0 : t.text;
876
+ }};
877
+ }
878
+ `, wt = b(q)`
879
+ ${B}
880
+ ${(e) => !!e.scrollableCss && e.scrollableCss}
881
+ text-size-adjust: 100%;
882
+ input::-ms-clear {
883
+ display: none;
884
+ }
885
+ ${(e) => e.hidden && N`
886
+ visibility: collapse;
887
+ pointer-events: none;
888
+ `};
889
+ `, Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
890
+ __proto__: null,
891
+ default: vt
892
+ }, Symbol.toStringTag, { value: "Module" }));
893
+ export {
894
+ U as C,
895
+ Dt as a
896
+ };