@emporix/cockpit-component-library 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.
@@ -0,0 +1,938 @@
1
+ import q, { useState as ae, useRef as ee, useMemo as Ie, useEffect as se, useId as Te } from "react";
2
+ var _e = { exports: {} }, le = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.js
6
+ *
7
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var je;
13
+ function De() {
14
+ if (je) return le;
15
+ je = 1;
16
+ var t = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
17
+ function n(a, l, i) {
18
+ var u = null;
19
+ if (i !== void 0 && (u = "" + i), l.key !== void 0 && (u = "" + l.key), "key" in l) {
20
+ i = {};
21
+ for (var b in l)
22
+ b !== "key" && (i[b] = l[b]);
23
+ } else i = l;
24
+ return l = i.ref, {
25
+ $$typeof: t,
26
+ type: a,
27
+ key: u,
28
+ ref: l !== void 0 ? l : null,
29
+ props: i
30
+ };
31
+ }
32
+ return le.Fragment = r, le.jsx = n, le.jsxs = n, le;
33
+ }
34
+ var ie = {};
35
+ /**
36
+ * @license React
37
+ * react-jsx-runtime.development.js
38
+ *
39
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
40
+ *
41
+ * This source code is licensed under the MIT license found in the
42
+ * LICENSE file in the root directory of this source tree.
43
+ */
44
+ var ke;
45
+ function $e() {
46
+ return ke || (ke = 1, process.env.NODE_ENV !== "production" && (function() {
47
+ function t(e) {
48
+ if (e == null) return null;
49
+ if (typeof e == "function")
50
+ return e.$$typeof === Z ? null : e.displayName || e.name || null;
51
+ if (typeof e == "string") return e;
52
+ switch (e) {
53
+ case y:
54
+ return "Fragment";
55
+ case j:
56
+ return "Profiler";
57
+ case E:
58
+ return "StrictMode";
59
+ case L:
60
+ return "Suspense";
61
+ case P:
62
+ return "SuspenseList";
63
+ case ue:
64
+ return "Activity";
65
+ }
66
+ if (typeof e == "object")
67
+ switch (typeof e.tag == "number" && console.error(
68
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
+ ), e.$$typeof) {
70
+ case g:
71
+ return "Portal";
72
+ case R:
73
+ return e.displayName || "Context";
74
+ case C:
75
+ return (e._context.displayName || "Context") + ".Consumer";
76
+ case _:
77
+ var s = e.render;
78
+ return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
+ case ce:
80
+ return s = e.displayName || null, s !== null ? s : t(e.type) || "Memo";
81
+ case V:
82
+ s = e._payload, e = e._init;
83
+ try {
84
+ return t(e(s));
85
+ } catch {
86
+ }
87
+ }
88
+ return null;
89
+ }
90
+ function r(e) {
91
+ return "" + e;
92
+ }
93
+ function n(e) {
94
+ try {
95
+ r(e);
96
+ var s = !1;
97
+ } catch {
98
+ s = !0;
99
+ }
100
+ if (s) {
101
+ s = console;
102
+ var m = s.error, x = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
+ return m.call(
104
+ s,
105
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
+ x
107
+ ), r(e);
108
+ }
109
+ }
110
+ function a(e) {
111
+ if (e === y) return "<>";
112
+ if (typeof e == "object" && e !== null && e.$$typeof === V)
113
+ return "<...>";
114
+ try {
115
+ var s = t(e);
116
+ return s ? "<" + s + ">" : "<...>";
117
+ } catch {
118
+ return "<...>";
119
+ }
120
+ }
121
+ function l() {
122
+ var e = B.A;
123
+ return e === null ? null : e.getOwner();
124
+ }
125
+ function i() {
126
+ return Error("react-stack-top-frame");
127
+ }
128
+ function u(e) {
129
+ if (M.call(e, "key")) {
130
+ var s = Object.getOwnPropertyDescriptor(e, "key").get;
131
+ if (s && s.isReactWarning) return !1;
132
+ }
133
+ return e.key !== void 0;
134
+ }
135
+ function b(e, s) {
136
+ function m() {
137
+ fe || (fe = !0, console.error(
138
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
+ s
140
+ ));
141
+ }
142
+ m.isReactWarning = !0, Object.defineProperty(e, "key", {
143
+ get: m,
144
+ configurable: !0
145
+ });
146
+ }
147
+ function f() {
148
+ var e = t(this.type);
149
+ return re[e] || (re[e] = !0, console.error(
150
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
+ )), e = this.props.ref, e !== void 0 ? e : null;
152
+ }
153
+ function p(e, s, m, x, F, X) {
154
+ var k = m.ref;
155
+ return e = {
156
+ $$typeof: $,
157
+ type: e,
158
+ key: s,
159
+ props: m,
160
+ _owner: x
161
+ }, (k !== void 0 ? k : null) !== null ? Object.defineProperty(e, "ref", {
162
+ enumerable: !1,
163
+ get: f
164
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
165
+ configurable: !1,
166
+ enumerable: !1,
167
+ writable: !0,
168
+ value: 0
169
+ }), Object.defineProperty(e, "_debugInfo", {
170
+ configurable: !1,
171
+ enumerable: !1,
172
+ writable: !0,
173
+ value: null
174
+ }), Object.defineProperty(e, "_debugStack", {
175
+ configurable: !1,
176
+ enumerable: !1,
177
+ writable: !0,
178
+ value: F
179
+ }), Object.defineProperty(e, "_debugTask", {
180
+ configurable: !1,
181
+ enumerable: !1,
182
+ writable: !0,
183
+ value: X
184
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
+ }
186
+ function O(e, s, m, x, F, X) {
187
+ var k = s.children;
188
+ if (k !== void 0)
189
+ if (x)
190
+ if (I(k)) {
191
+ for (x = 0; x < k.length; x++)
192
+ N(k[x]);
193
+ Object.freeze && Object.freeze(k);
194
+ } else
195
+ console.error(
196
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
+ );
198
+ else N(k);
199
+ if (M.call(s, "key")) {
200
+ k = t(e);
201
+ var W = Object.keys(s).filter(function(ye) {
202
+ return ye !== "key";
203
+ });
204
+ x = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", K[k + x] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
205
+ `A props object containing a "key" prop is being spread into JSX:
206
+ let props = %s;
207
+ <%s {...props} />
208
+ React keys must be passed directly to JSX without using spread:
209
+ let props = %s;
210
+ <%s key={someKey} {...props} />`,
211
+ x,
212
+ k,
213
+ W,
214
+ k
215
+ ), K[k + x] = !0);
216
+ }
217
+ if (k = null, m !== void 0 && (n(m), k = "" + m), u(s) && (n(s.key), k = "" + s.key), "key" in s) {
218
+ m = {};
219
+ for (var oe in s)
220
+ oe !== "key" && (m[oe] = s[oe]);
221
+ } else m = s;
222
+ return k && b(
223
+ m,
224
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
+ ), p(
226
+ e,
227
+ k,
228
+ m,
229
+ l(),
230
+ F,
231
+ X
232
+ );
233
+ }
234
+ function N(e) {
235
+ S(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === V && (e._payload.status === "fulfilled" ? S(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
236
+ }
237
+ function S(e) {
238
+ return typeof e == "object" && e !== null && e.$$typeof === $;
239
+ }
240
+ var T = q, $ = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), C = Symbol.for("react.consumer"), R = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), L = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), ce = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), ue = Symbol.for("react.activity"), Z = Symbol.for("react.client.reference"), B = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, I = Array.isArray, H = console.createTask ? console.createTask : function() {
241
+ return null;
242
+ };
243
+ T = {
244
+ react_stack_bottom_frame: function(e) {
245
+ return e();
246
+ }
247
+ };
248
+ var fe, re = {}, de = T.react_stack_bottom_frame.bind(
249
+ T,
250
+ i
251
+ )(), ne = H(a(i)), K = {};
252
+ ie.Fragment = y, ie.jsx = function(e, s, m) {
253
+ var x = 1e4 > B.recentlyCreatedOwnerStacks++;
254
+ return O(
255
+ e,
256
+ s,
257
+ m,
258
+ !1,
259
+ x ? Error("react-stack-top-frame") : de,
260
+ x ? H(a(e)) : ne
261
+ );
262
+ }, ie.jsxs = function(e, s, m) {
263
+ var x = 1e4 > B.recentlyCreatedOwnerStacks++;
264
+ return O(
265
+ e,
266
+ s,
267
+ m,
268
+ !0,
269
+ x ? Error("react-stack-top-frame") : de,
270
+ x ? H(a(e)) : ne
271
+ );
272
+ };
273
+ })()), ie;
274
+ }
275
+ var we;
276
+ function Le() {
277
+ return we || (we = 1, process.env.NODE_ENV === "production" ? _e.exports = De() : _e.exports = $e()), _e.exports;
278
+ }
279
+ var c = Le();
280
+ const Fe = "_primaryButton_uyzzr_1", We = "_primaryButtonDisabled_uyzzr_34", ze = "_spinner_uyzzr_42", xe = {
281
+ primaryButton: Fe,
282
+ primaryButtonDisabled: We,
283
+ spinner: ze
284
+ };
285
+ var Pe = {
286
+ color: void 0,
287
+ size: void 0,
288
+ className: void 0,
289
+ style: void 0,
290
+ attr: void 0
291
+ }, Oe = q.createContext && /* @__PURE__ */ q.createContext(Pe), Ye = ["attr", "size", "title"];
292
+ function qe(t, r) {
293
+ if (t == null) return {};
294
+ var n, a, l = Ve(t, r);
295
+ if (Object.getOwnPropertySymbols) {
296
+ var i = Object.getOwnPropertySymbols(t);
297
+ for (a = 0; a < i.length; a++) n = i[a], r.indexOf(n) === -1 && {}.propertyIsEnumerable.call(t, n) && (l[n] = t[n]);
298
+ }
299
+ return l;
300
+ }
301
+ function Ve(t, r) {
302
+ if (t == null) return {};
303
+ var n = {};
304
+ for (var a in t) if ({}.hasOwnProperty.call(t, a)) {
305
+ if (r.indexOf(a) !== -1) continue;
306
+ n[a] = t[a];
307
+ }
308
+ return n;
309
+ }
310
+ function me() {
311
+ return me = Object.assign ? Object.assign.bind() : function(t) {
312
+ for (var r = 1; r < arguments.length; r++) {
313
+ var n = arguments[r];
314
+ for (var a in n) ({}).hasOwnProperty.call(n, a) && (t[a] = n[a]);
315
+ }
316
+ return t;
317
+ }, me.apply(null, arguments);
318
+ }
319
+ function Ee(t, r) {
320
+ var n = Object.keys(t);
321
+ if (Object.getOwnPropertySymbols) {
322
+ var a = Object.getOwnPropertySymbols(t);
323
+ r && (a = a.filter(function(l) {
324
+ return Object.getOwnPropertyDescriptor(t, l).enumerable;
325
+ })), n.push.apply(n, a);
326
+ }
327
+ return n;
328
+ }
329
+ function ve(t) {
330
+ for (var r = 1; r < arguments.length; r++) {
331
+ var n = arguments[r] != null ? arguments[r] : {};
332
+ r % 2 ? Ee(Object(n), !0).forEach(function(a) {
333
+ Me(t, a, n[a]);
334
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Ee(Object(n)).forEach(function(a) {
335
+ Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(n, a));
336
+ });
337
+ }
338
+ return t;
339
+ }
340
+ function Me(t, r, n) {
341
+ return (r = He(r)) in t ? Object.defineProperty(t, r, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[r] = n, t;
342
+ }
343
+ function He(t) {
344
+ var r = Ue(t, "string");
345
+ return typeof r == "symbol" ? r : r + "";
346
+ }
347
+ function Ue(t, r) {
348
+ if (typeof t != "object" || !t) return t;
349
+ var n = t[Symbol.toPrimitive];
350
+ if (n !== void 0) {
351
+ var a = n.call(t, r);
352
+ if (typeof a != "object") return a;
353
+ throw new TypeError("@@toPrimitive must return a primitive value.");
354
+ }
355
+ return (r === "string" ? String : Number)(t);
356
+ }
357
+ function Se(t) {
358
+ return t && t.map((r, n) => /* @__PURE__ */ q.createElement(r.tag, ve({
359
+ key: n
360
+ }, r.attr), Se(r.child)));
361
+ }
362
+ function be(t) {
363
+ return (r) => /* @__PURE__ */ q.createElement(Je, me({
364
+ attr: ve({}, t.attr)
365
+ }, r), Se(t.child));
366
+ }
367
+ function Je(t) {
368
+ var r = (n) => {
369
+ var {
370
+ attr: a,
371
+ size: l,
372
+ title: i
373
+ } = t, u = qe(t, Ye), b = l || n.size || "1em", f;
374
+ return n.className && (f = n.className), t.className && (f = (f ? f + " " : "") + t.className), /* @__PURE__ */ q.createElement("svg", me({
375
+ stroke: "currentColor",
376
+ fill: "currentColor",
377
+ strokeWidth: "0"
378
+ }, n.attr, a, u, {
379
+ className: f,
380
+ style: ve(ve({
381
+ color: t.color || n.color
382
+ }, n.style), t.style),
383
+ height: b,
384
+ width: b,
385
+ xmlns: "http://www.w3.org/2000/svg"
386
+ }), i && /* @__PURE__ */ q.createElement("title", null, i), t.children);
387
+ };
388
+ return Oe !== void 0 ? /* @__PURE__ */ q.createElement(Oe.Consumer, null, (n) => r(n)) : r(Pe);
389
+ }
390
+ function Ge(t) {
391
+ return be({ attr: { viewBox: "0 0 24 24", fill: "none" }, child: [{ tag: "path", attr: { opacity: "0.2", fillRule: "evenodd", clipRule: "evenodd", d: "M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z", fill: "currentColor" }, child: [] }, { tag: "path", attr: { d: "M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z", fill: "currentColor" }, child: [] }] })(t);
392
+ }
393
+ const Ut = ({
394
+ children: t,
395
+ disabled: r = !1,
396
+ loading: n = !1,
397
+ onClick: a,
398
+ className: l = "",
399
+ "data-testid": i,
400
+ ...u
401
+ }) => {
402
+ const b = [
403
+ xe.primaryButton,
404
+ r ? xe.primaryButtonDisabled : "",
405
+ l
406
+ ].filter(Boolean).join(" ");
407
+ return /* @__PURE__ */ c.jsxs(
408
+ "button",
409
+ {
410
+ type: "button",
411
+ className: b,
412
+ disabled: r || n,
413
+ onClick: a,
414
+ "data-testid": i,
415
+ ...u,
416
+ children: [
417
+ n && /* @__PURE__ */ c.jsx(Ge, { className: xe.spinner, size: 12 }),
418
+ t
419
+ ]
420
+ }
421
+ );
422
+ }, Ze = "_secondaryButton_1s7ft_1", Ke = "_secondaryButtonDisabled_1s7ft_33", Re = {
423
+ secondaryButton: Ze,
424
+ secondaryButtonDisabled: Ke
425
+ }, Jt = ({
426
+ children: t,
427
+ disabled: r = !1,
428
+ onClick: n,
429
+ className: a = "",
430
+ "data-testid": l,
431
+ ...i
432
+ }) => {
433
+ const u = [
434
+ Re.secondaryButton,
435
+ r ? Re.secondaryButtonDisabled : "",
436
+ a
437
+ ].filter(Boolean).join(" ");
438
+ return /* @__PURE__ */ c.jsx(
439
+ "button",
440
+ {
441
+ type: "button",
442
+ className: u,
443
+ disabled: r,
444
+ onClick: n,
445
+ "data-testid": l,
446
+ ...i,
447
+ children: t
448
+ }
449
+ );
450
+ }, Xe = "_tabsContainer_m3c4e_1", Qe = "_tabsHeader_m3c4e_7", et = "_tabItem_m3c4e_13", tt = "_tabContent_m3c4e_29", rt = "_tabLabel_m3c4e_51", nt = "_tabLine_m3c4e_61", ot = "_active_m3c4e_68", at = "_inactive_m3c4e_76", st = "_tabPanels_m3c4e_84", D = {
451
+ tabsContainer: Xe,
452
+ tabsHeader: Qe,
453
+ tabItem: et,
454
+ tabContent: tt,
455
+ tabLabel: rt,
456
+ tabLine: nt,
457
+ active: ot,
458
+ inactive: at,
459
+ tabPanels: st
460
+ }, Gt = ({
461
+ tabs: t,
462
+ activeTabId: r,
463
+ onTabChange: n,
464
+ className: a = "",
465
+ "data-testid": l,
466
+ ...i
467
+ }) => {
468
+ var b;
469
+ const u = [D.tabsContainer, a].filter(Boolean).join(" ");
470
+ return /* @__PURE__ */ c.jsxs("div", { className: u, "data-testid": l, ...i, children: [
471
+ /* @__PURE__ */ c.jsx("div", { className: D.tabsHeader, children: t.map((f) => {
472
+ const p = f.id === r, O = [
473
+ D.tabItem,
474
+ p ? D.active : D.inactive
475
+ ].filter(Boolean).join(" ");
476
+ return /* @__PURE__ */ c.jsxs(
477
+ "button",
478
+ {
479
+ type: "button",
480
+ className: O,
481
+ onClick: () => n(f.id),
482
+ "data-testid": `${l}-tab-${f.id}`,
483
+ children: [
484
+ /* @__PURE__ */ c.jsx("div", { className: D.tabContent, children: /* @__PURE__ */ c.jsx("span", { className: D.tabLabel, children: f.label }) }),
485
+ /* @__PURE__ */ c.jsx("div", { className: D.tabLine })
486
+ ]
487
+ },
488
+ f.id
489
+ );
490
+ }) }),
491
+ /* @__PURE__ */ c.jsx("div", { className: D.tabPanels, children: (b = t.find((f) => f.id === r)) == null ? void 0 : b.content })
492
+ ] });
493
+ };
494
+ function lt(t) {
495
+ return be({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "circle", attr: { cx: "11", cy: "11", r: "8" }, child: [] }, { tag: "line", attr: { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }, child: [] }] })(t);
496
+ }
497
+ function it(t) {
498
+ return be({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "circle", attr: { cx: "12", cy: "12", r: "10" }, child: [] }, { tag: "line", attr: { x1: "12", y1: "16", x2: "12", y2: "12" }, child: [] }, { tag: "line", attr: { x1: "12", y1: "8", x2: "12.01", y2: "8" }, child: [] }] })(t);
499
+ }
500
+ function ct(t) {
501
+ return be({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "polyline", attr: { points: "6 9 12 15 18 9" }, child: [] }] })(t);
502
+ }
503
+ const ut = "_dropdown_1xupi_1", ft = "_label_1xupi_9", dt = "_required_1xupi_18", pt = "_trigger_1xupi_23", _t = "_triggerDisabled_1xupi_47", mt = "_triggerInput_1xupi_56", vt = "_value_1xupi_74", bt = "_placeholder_1xupi_82", yt = "_chevron_1xupi_86", gt = "_open_1xupi_93", xt = "_panel_1xupi_117", ht = "_panelClosing_1xupi_134", jt = "_filterWrapper_1xupi_138", kt = "_filterInput_1xupi_145", wt = "_filterIcon_1xupi_164", Ot = "_list_1xupi_175", Et = "_option_1xupi_184", Rt = "_optionSelected_1xupi_196", Ct = "_optionHighlighted_1xupi_200", Nt = "_optionDisabled_1xupi_204", Tt = "_empty_1xupi_213", Pt = "_disabled_1xupi_220", h = {
504
+ dropdown: ut,
505
+ label: ft,
506
+ required: dt,
507
+ trigger: pt,
508
+ triggerDisabled: _t,
509
+ triggerInput: mt,
510
+ value: vt,
511
+ placeholder: bt,
512
+ chevron: yt,
513
+ open: gt,
514
+ panel: xt,
515
+ panelClosing: ht,
516
+ filterWrapper: jt,
517
+ filterInput: kt,
518
+ filterIcon: wt,
519
+ list: Ot,
520
+ option: Et,
521
+ optionSelected: Rt,
522
+ optionHighlighted: Ct,
523
+ optionDisabled: Nt,
524
+ empty: Tt,
525
+ disabled: Pt
526
+ }, U = (t, r) => {
527
+ const a = t[r];
528
+ return a != null ? String(a) : "";
529
+ }, te = (t, r) => t[r], A = (t, r) => r == null ? !1 : !!t[r], Zt = ({
530
+ value: t,
531
+ onChange: r,
532
+ onEditEnd: n,
533
+ options: a,
534
+ optionLabel: l = "label",
535
+ optionValue: i = "value",
536
+ optionDisabled: u,
537
+ placeholder: b = "Select",
538
+ filter: f = !1,
539
+ editable: p = !1,
540
+ disabled: O = !1,
541
+ required: N = !1,
542
+ label: S,
543
+ inputId: T,
544
+ className: $ = "",
545
+ panelClassName: g = "",
546
+ valueTemplate: y,
547
+ itemTemplate: E,
548
+ "data-testid": j
549
+ }) => {
550
+ const C = a.find(
551
+ (o) => te(o, i) === t
552
+ ), R = C ? U(C, l) : "", [_, L] = ae(!1), [P, ce] = ae(!1), [V, ue] = ae(""), [Z, B] = ae(R), [M, I] = ae(0), H = ee(null), fe = ee(null), re = ee(null), de = ee(null), ne = ee(null), K = ee(!1), e = Ie(
553
+ () => f && !p ? a.filter(
554
+ (o) => U(o, l).toLowerCase().includes(V.toLowerCase())
555
+ ) : a,
556
+ [f, p, a, l, V]
557
+ );
558
+ se(() => {
559
+ p && B(R);
560
+ }, [p, t, R]), se(() => {
561
+ _ && f && !p && (ue(""), I(0), setTimeout(() => {
562
+ var o;
563
+ return (o = re.current) == null ? void 0 : o.focus();
564
+ }, 0));
565
+ }, [_, f, p]), se(() => {
566
+ if (!_) return;
567
+ const o = e.findIndex(
568
+ (w) => te(w, i) === t
569
+ ), d = e.findIndex(
570
+ (w) => !A(w, u)
571
+ ), v = o >= 0 && !A(e[o], u);
572
+ I(v ? o : d >= 0 ? d : 0);
573
+ }, [_, t, e, i, u]), se(() => {
574
+ const o = ne.current;
575
+ o != null && o.scrollIntoView && typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest" });
576
+ }, [M]);
577
+ const s = () => {
578
+ K.current = !0, ce(!0);
579
+ }, m = (o) => {
580
+ var d;
581
+ (K.current || (d = o.animationName) != null && d.includes("menuOut")) && (K.current = !1, L(!1), ce(!1), p && B(R));
582
+ };
583
+ se(() => {
584
+ if (!_ && !P) return;
585
+ const o = (d) => {
586
+ H.current && !H.current.contains(d.target) && (p && B(R), s());
587
+ };
588
+ return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
589
+ }, [_, P, p, R]);
590
+ const x = () => {
591
+ O || L((o) => !o);
592
+ }, F = (o, d) => {
593
+ if (A(o, u)) return;
594
+ const v = te(o, i);
595
+ p && B(U(o, l)), r == null || r({
596
+ value: v ?? null,
597
+ originalEvent: d
598
+ }), s();
599
+ }, X = (o) => {
600
+ if (!_) {
601
+ if (o.key === "Enter" && p && Z.trim()) {
602
+ o.preventDefault();
603
+ const d = Z.trim(), v = d.toLowerCase(), w = a.find((Q) => {
604
+ const Y = U(Q, l).toLowerCase();
605
+ return Y === v || Y.startsWith(v);
606
+ }), z = w && !A(w, u) ? te(w, i) : null;
607
+ w && !A(w, u) && (B(U(w, l)), r == null || r({
608
+ value: z,
609
+ originalEvent: o
610
+ })), n == null || n({
611
+ value: d,
612
+ selectedValue: z,
613
+ originalEvent: o
614
+ });
615
+ return;
616
+ }
617
+ (o.key === "Enter" || o.key === " " || o.key === "ArrowDown") && (o.preventDefault(), L(!0));
618
+ return;
619
+ }
620
+ if (o.key === "Escape") {
621
+ o.preventDefault(), s();
622
+ return;
623
+ }
624
+ if (o.key === "ArrowDown") {
625
+ o.preventDefault(), I((d) => {
626
+ for (let v = d + 1; v < e.length; v++)
627
+ if (!A(e[v], u))
628
+ return v;
629
+ return d;
630
+ });
631
+ return;
632
+ }
633
+ if (o.key === "ArrowUp") {
634
+ o.preventDefault(), I((d) => {
635
+ for (let v = d - 1; v >= 0; v--)
636
+ if (!A(e[v], u))
637
+ return v;
638
+ return d;
639
+ });
640
+ return;
641
+ }
642
+ if (o.key === "Enter") {
643
+ if (o.preventDefault(), p) {
644
+ const d = Z.trim();
645
+ if (d) {
646
+ const v = d.toLowerCase(), w = a.find((Q) => {
647
+ const Y = U(Q, l).toLowerCase();
648
+ return Y === v || Y.startsWith(v);
649
+ }), z = w && !A(w, u) ? te(w, i) : null;
650
+ w && !A(w, u) && F(w, o), n == null || n({
651
+ value: d,
652
+ selectedValue: z,
653
+ originalEvent: o
654
+ });
655
+ } else
656
+ n == null || n({ value: "", selectedValue: null, originalEvent: o });
657
+ } else if (e[M]) {
658
+ const d = e[M];
659
+ A(d, u) || F(d, o);
660
+ }
661
+ }
662
+ }, k = [
663
+ h.dropdown,
664
+ O ? h.disabled : "",
665
+ _ ? h.open : "",
666
+ $
667
+ ].filter(Boolean).join(" "), W = [
668
+ h.trigger,
669
+ O ? h.triggerDisabled : ""
670
+ ].filter(Boolean).join(" "), oe = [
671
+ h.panel,
672
+ P ? h.panelClosing : "",
673
+ g
674
+ ].filter(Boolean).join(" "), ye = Te(), pe = T ?? `dropdown-${ye.replace(/[^a-zA-Z0-9_-]/g, "")}`, ge = `${pe}-panel`;
675
+ return /* @__PURE__ */ c.jsxs("div", { className: k, ref: H, "data-testid": j, children: [
676
+ S != null && /* @__PURE__ */ c.jsxs("label", { htmlFor: pe, className: h.label, children: [
677
+ S,
678
+ N && /* @__PURE__ */ c.jsx("span", { className: h.required, children: "*" })
679
+ ] }),
680
+ /* @__PURE__ */ c.jsxs(
681
+ "div",
682
+ {
683
+ id: p ? void 0 : pe,
684
+ role: "combobox",
685
+ "aria-expanded": _ || P,
686
+ "aria-haspopup": "listbox",
687
+ "aria-controls": _ || P ? ge : void 0,
688
+ "aria-disabled": O,
689
+ "aria-label": typeof S == "string" ? S : void 0,
690
+ tabIndex: p || O ? -1 : 0,
691
+ className: W,
692
+ onClick: p ? void 0 : x,
693
+ onKeyDown: p ? void 0 : X,
694
+ "data-testid": j && !p ? `${j}-trigger` : void 0,
695
+ children: [
696
+ p ? /* @__PURE__ */ c.jsx(
697
+ "input",
698
+ {
699
+ ref: de,
700
+ id: pe,
701
+ type: "text",
702
+ className: h.triggerInput,
703
+ value: Z,
704
+ onChange: (o) => {
705
+ B(o.target.value), !_ && !P && L(!0), I(0);
706
+ },
707
+ onFocus: () => {
708
+ !O && !_ && !P && L(!0);
709
+ },
710
+ onKeyDown: X,
711
+ placeholder: b,
712
+ disabled: O,
713
+ "aria-autocomplete": "list",
714
+ "aria-controls": _ || P ? ge : void 0,
715
+ "aria-expanded": _ || P,
716
+ "data-testid": j ? `${j}-trigger` : void 0
717
+ }
718
+ ) : /* @__PURE__ */ c.jsx("span", { className: h.value, children: y ? y(C ?? null) : R || /* @__PURE__ */ c.jsx("span", { className: h.placeholder, children: b }) }),
719
+ /* @__PURE__ */ c.jsx(
720
+ ct,
721
+ {
722
+ className: h.chevron,
723
+ "aria-hidden": !0,
724
+ onClick: p ? x : void 0
725
+ }
726
+ )
727
+ ]
728
+ }
729
+ ),
730
+ (_ || P) && /* @__PURE__ */ c.jsxs(
731
+ "div",
732
+ {
733
+ ref: fe,
734
+ id: ge,
735
+ className: oe,
736
+ role: "presentation",
737
+ onAnimationEnd: m,
738
+ "data-testid": j ? `${j}-panel` : void 0,
739
+ children: [
740
+ f && !p && /* @__PURE__ */ c.jsxs("div", { className: h.filterWrapper, children: [
741
+ /* @__PURE__ */ c.jsx(
742
+ "input",
743
+ {
744
+ ref: re,
745
+ type: "text",
746
+ className: h.filterInput,
747
+ value: V,
748
+ onChange: (o) => {
749
+ ue(o.target.value), I(0);
750
+ },
751
+ onKeyDown: (o) => {
752
+ o.key === "Escape" && L(!1), o.stopPropagation();
753
+ },
754
+ placeholder: "Search...",
755
+ "aria-label": "Filter options",
756
+ title: "Filter options",
757
+ "data-testid": j ? `${j}-filter` : void 0
758
+ }
759
+ ),
760
+ /* @__PURE__ */ c.jsx(lt, { className: h.filterIcon, "aria-hidden": !0 })
761
+ ] }),
762
+ /* @__PURE__ */ c.jsx("ul", { className: h.list, role: "listbox", "aria-label": "Options", children: e.length === 0 ? /* @__PURE__ */ c.jsx("li", { className: h.empty, children: "No results" }) : e.map((o, d) => {
763
+ const v = te(o, i), w = U(o, l), z = A(o, u), Q = t === v, Y = d === M, Ae = v != null ? String(v) : `option-${d}`;
764
+ return /* @__PURE__ */ c.jsx(
765
+ "li",
766
+ {
767
+ ref: Y ? ne : void 0,
768
+ role: "option",
769
+ "aria-selected": Q,
770
+ "aria-disabled": z,
771
+ className: [
772
+ h.option,
773
+ Q ? h.optionSelected : "",
774
+ Y ? h.optionHighlighted : "",
775
+ z ? h.optionDisabled : ""
776
+ ].filter(Boolean).join(" "),
777
+ onMouseEnter: () => !z && I(d),
778
+ onClick: (Be) => F(o, Be),
779
+ "data-testid": j ? `${j}-option-${d}` : void 0,
780
+ children: E ? E(o) : w
781
+ },
782
+ Ae
783
+ );
784
+ }) })
785
+ ]
786
+ }
787
+ )
788
+ ] });
789
+ }, St = "_inputText_1crp5_1", At = "_label_1crp5_9", Bt = "_required_1crp5_20", It = "_tooltipIcon_1crp5_25", Dt = "_input_1crp5_1", $t = "_inputTextarea_1crp5_72", Lt = "_inputTextDisabled_1crp5_79", J = {
790
+ inputText: St,
791
+ label: At,
792
+ required: Bt,
793
+ tooltipIcon: It,
794
+ input: Dt,
795
+ inputTextarea: $t,
796
+ inputTextDisabled: Lt
797
+ }, Kt = ({
798
+ label: t,
799
+ tooltip: r,
800
+ required: n = !1,
801
+ inputId: a,
802
+ textarea: l = !1,
803
+ rows: i,
804
+ className: u = "",
805
+ "data-testid": b,
806
+ disabled: f = !1,
807
+ ...p
808
+ }) => {
809
+ const { type: O = "text", ...N } = p, S = Te(), T = a || `input-text-${S.replace(/[^a-zA-Z0-9_-]/g, "")}`, $ = [
810
+ J.inputText,
811
+ f ? J.inputTextDisabled : "",
812
+ u
813
+ ].filter(Boolean).join(" "), g = N["aria-invalid"];
814
+ let y;
815
+ g === void 0 ? y = void 0 : g === !0 ? y = "true" : g === !1 ? y = "false" : y = g;
816
+ const E = n ? { "aria-required": "true" } : { "aria-required": "false" }, j = y === void 0 ? {} : { "aria-invalid": y }, C = [J.input, l ? J.inputTextarea : ""].filter(Boolean).join(" "), R = {
817
+ id: T,
818
+ className: C,
819
+ disabled: f,
820
+ ...E,
821
+ ...j,
822
+ "data-testid": b ? `${b}-input` : void 0
823
+ };
824
+ return /* @__PURE__ */ c.jsxs("div", { className: $, "data-testid": b, children: [
825
+ t != null && /* @__PURE__ */ c.jsxs("label", { htmlFor: T, className: J.label, children: [
826
+ t,
827
+ n && /* @__PURE__ */ c.jsx("span", { className: J.required, children: "*" }),
828
+ r != null && /* @__PURE__ */ c.jsx(
829
+ "span",
830
+ {
831
+ className: J.tooltipIcon,
832
+ title: r,
833
+ "aria-label": r,
834
+ children: /* @__PURE__ */ c.jsx(it, { "aria-hidden": !0 })
835
+ }
836
+ )
837
+ ] }),
838
+ l ? /* @__PURE__ */ c.jsx(
839
+ "textarea",
840
+ {
841
+ ...N,
842
+ ...R,
843
+ rows: i ?? 3
844
+ }
845
+ ) : /* @__PURE__ */ c.jsx("input", { ...N, ...R, type: O })
846
+ ] });
847
+ }, Ft = "_selectButton_1u3fo_1", Wt = "_selectButtonDisabled_1u3fo_9", zt = "_selectButtonInvalid_1u3fo_14", Yt = "_button_1u3fo_14", qt = "_buttonFirst_1u3fo_47", Vt = "_buttonLast_1u3fo_51", Mt = "_buttonSelected_1u3fo_59", G = {
848
+ selectButton: Ft,
849
+ selectButtonDisabled: Wt,
850
+ selectButtonInvalid: zt,
851
+ button: Yt,
852
+ buttonFirst: qt,
853
+ buttonLast: Vt,
854
+ buttonSelected: Mt
855
+ }, Ce = (t, r) => {
856
+ const a = t[r];
857
+ return a != null ? String(a) : "";
858
+ }, he = (t, r) => t[r], Ne = (t, r) => r == null ? !1 : !!t[r], Xt = ({
859
+ value: t,
860
+ onChange: r,
861
+ options: n,
862
+ optionLabel: a = "label",
863
+ optionValue: l = "value",
864
+ optionDisabled: i,
865
+ multiple: u = !1,
866
+ itemTemplate: b,
867
+ disabled: f = !1,
868
+ invalid: p = !1,
869
+ className: O = "",
870
+ "data-testid": N
871
+ }) => {
872
+ const S = (g) => {
873
+ const y = he(g, l);
874
+ return u && Array.isArray(t) ? t.includes(y) : t === y;
875
+ }, T = (g, y) => {
876
+ if (f || Ne(g, i)) return;
877
+ const E = he(g, l);
878
+ if (E === void 0) return;
879
+ let j;
880
+ if (u) {
881
+ const C = Array.isArray(t) ? t : [];
882
+ j = C.includes(E) ? C.filter((_) => _ !== E) : [...C, E];
883
+ } else
884
+ j = t === E ? null : E;
885
+ r == null || r({
886
+ value: j,
887
+ originalEvent: y
888
+ });
889
+ }, $ = [
890
+ G.selectButton,
891
+ f ? G.selectButtonDisabled : "",
892
+ p ? G.selectButtonInvalid : "",
893
+ O
894
+ ].filter(Boolean).join(" ");
895
+ return /* @__PURE__ */ c.jsx(
896
+ "div",
897
+ {
898
+ className: $,
899
+ role: "group",
900
+ "aria-disabled": f,
901
+ "data-testid": N,
902
+ children: n.map((g, y) => {
903
+ const E = he(g, l), j = E != null ? String(E) : `option-${y}`, C = Ne(g, i), R = S(g);
904
+ return /* @__PURE__ */ c.jsx(
905
+ "button",
906
+ {
907
+ type: "button",
908
+ "aria-pressed": R,
909
+ "aria-disabled": C || f,
910
+ "aria-label": Ce(g, a),
911
+ disabled: f || C,
912
+ className: [
913
+ G.button,
914
+ R ? G.buttonSelected : "",
915
+ y === 0 ? G.buttonFirst : "",
916
+ y === n.length - 1 ? G.buttonLast : ""
917
+ ].filter(Boolean).join(" "),
918
+ onClick: (_) => T(g, _),
919
+ onKeyDown: (_) => {
920
+ (_.key === " " || _.key === "Enter") && (_.preventDefault(), T(g, _));
921
+ },
922
+ "data-testid": N ? `${N}-option-${y}` : void 0,
923
+ children: b ? b(g) : Ce(g, a)
924
+ },
925
+ j
926
+ );
927
+ })
928
+ }
929
+ );
930
+ };
931
+ export {
932
+ Zt as Dropdown,
933
+ Kt as InputText,
934
+ Ut as PrimaryButton,
935
+ Jt as SecondaryButton,
936
+ Xt as SelectButton,
937
+ Gt as Tabs
938
+ };