@wso2/am-core-ui 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/CatalogKindListing-DvUuZEpc.js +137 -0
  2. package/dist/{CodeBlock-mB_Loq7I.js → CodeBlock-B2Ecl916.js} +1 -1
  3. package/dist/EnvironmentCard-CIXhDhlZ.js +319 -0
  4. package/dist/{EnvironmentSelector-B7Bl93s2.js → EnvironmentSelector-D8S6nO9u.js} +1 -1
  5. package/dist/IsolationTierIndicator-cf90kgjL.js +81 -0
  6. package/dist/LabelChips-7rA7_yre.js +139 -0
  7. package/dist/PolicyListSection-D6aVSKwP.js +1143 -0
  8. package/dist/{ResourceListShell-Cx6mdeqv.js → ResourceListShell-DFisKftq.js} +1 -1
  9. package/dist/{SwaggerSpecViewer-BvkhoKsi.js → SwaggerSpecViewer-DzjR6U6W.js} +1 -1
  10. package/dist/{debounce-BV83M53b.js → debounce-D17ObVdG.js} +1 -1
  11. package/dist/{format-BEZZRyE2.js → format-wlHhWjGo.js} +1 -1
  12. package/dist/{formatDistanceToNow-TErllcH8.js → formatDistanceToNow-DyjnT7l9.js} +11 -11
  13. package/dist/{gatewayScripts-D8O45W8u.js → gatewayScripts-D4ZDEDPS.js} +1 -1
  14. package/dist/{index-sr-mWz4T.js → index-3K-zqdp-.js} +32 -32
  15. package/dist/{index-KRsV2L4V.js → index-6liAPSDn.js} +160 -160
  16. package/dist/{index-B52h3RHg.js → index-B3ASENUJ.js} +109 -109
  17. package/dist/index-B7Pf4oPq.js +3069 -0
  18. package/dist/index-BNO3FhZK.js +2304 -0
  19. package/dist/index-BUZSfCl5.js +335 -0
  20. package/dist/index-BXiG1r_o.js +1409 -0
  21. package/dist/{index-_0Pj_ZtW.js → index-BYy7Iaam.js} +40 -40
  22. package/dist/{index-BfjzUWDa.js → index-BbB_yx4V.js} +103 -103
  23. package/dist/index-BjWJ95lH.js +2728 -0
  24. package/dist/{index-B_Z0MwXk.js → index-ByEInFlf.js} +10916 -9520
  25. package/dist/index-C8WIhzyz.js +123 -0
  26. package/dist/index-CnzvaT6b.js +2368 -0
  27. package/dist/index-CrnCf-hJ.js +763 -0
  28. package/dist/{index-CgCWbWzN.js → index-Cvsho9xg.js} +381 -377
  29. package/dist/{index-UqDmyMSA.js → index-CxnAo1_c.js} +21 -21
  30. package/dist/{index-BnV-PkwM.js → index-Cz7-AZwE.js} +2 -2
  31. package/dist/{index-BP5drcF2.js → index-DBdRFjxm.js} +232 -233
  32. package/dist/{index-BZ4vxviI.js → index-DFsSvmMZ.js} +5 -5
  33. package/dist/index-DslzOSGN.js +2549 -0
  34. package/dist/{index-DD4qF7gq.js → index-DvpYvchM.js} +101 -100
  35. package/dist/index.d.ts +784 -163
  36. package/dist/index.js +532 -454
  37. package/dist/js-yaml-CvhD-clg.js +1335 -0
  38. package/dist/{llmProviderPayload-CzihkdNa.js → llmProviderPayload-BPzWDy7n.js} +2 -2
  39. package/package.json +1 -1
  40. package/dist/CatalogKindListing-DtFI2YMG.js +0 -118
  41. package/dist/EnvironmentCard-09h1XRxx.js +0 -310
  42. package/dist/PolicyListSection-o4k9e8XO.js +0 -2475
  43. package/dist/index-CGDYgUCH.js +0 -711
  44. package/dist/index-COt7nJIf.js +0 -2286
  45. package/dist/index-CWZjOy1h.js +0 -2247
  46. package/dist/index-CezvogTQ.js +0 -116
  47. package/dist/index-CjCkcuuI.js +0 -322
  48. package/dist/index-CjXvuf9m.js +0 -1354
  49. package/dist/index-DeQ-9KTC.js +0 -737
  50. package/dist/index-Df6OBy4E.js +0 -3041
  51. package/dist/index-PUuASE1F.js +0 -2507
@@ -0,0 +1,139 @@
1
+ import { jsx as t, jsxs as Z } from "react/jsx-runtime";
2
+ import { c as te } from "react/compiler-runtime";
3
+ import { useState as D, useRef as N, useLayoutEffect as le } from "react";
4
+ import { Box as u, Chip as G, Typography as k, Button as q, IconButton as ne, Tooltip as ie, Stack as re } from "@wso2/oxygen-ui";
5
+ import { X as Y, Plus as se } from "@wso2/oxygen-ui-icons-react";
6
+ import { n as J } from "./index-ByEInFlf.js";
7
+ const Q = 10, ae = /^[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$/, oe = /^([a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?)?$/, H = 63;
8
+ function ce(o) {
9
+ if (!o) return "Key is required";
10
+ if (o.length > H) return `Key must be at most ${H} characters`;
11
+ if (!ae.test(o)) return "Use letters, digits, '.', '_' or '-', starting and ending with a letter or digit";
12
+ }
13
+ function de(o) {
14
+ if (o.length > H) return `Value must be at most ${H} characters`;
15
+ if (!oe.test(o)) return "Use letters, digits, '.', '_' or '-', starting and ending with a letter or digit";
16
+ }
17
+ const be = (o) => {
18
+ const e = te(45), {
19
+ value: l,
20
+ onChange: d,
21
+ disabled: C,
22
+ hideTitle: $,
23
+ title: T,
24
+ description: I
25
+ } = o, r = C === void 0 ? !1 : C, n = $ === void 0 ? !1 : $, s = T === void 0 ? "Labels (Optional)" : T, f = I === void 0 ? "Attach key/value labels to organize and filter resources." : I, [c, v] = D(!1), [i, h] = D(""), [a, b] = D("");
26
+ let w;
27
+ e[0] !== l ? (w = Object.entries(l), e[0] = l, e[1] = w) : w = e[1];
28
+ const p = w;
29
+ let B;
30
+ e[2] !== i ? (B = i ? ce(i) : void 0, e[2] = i, e[3] = B) : B = e[3];
31
+ const z = B;
32
+ let P;
33
+ e[4] !== a ? (P = de(a), e[4] = a, e[5] = P) : P = e[5];
34
+ const R = P, O = i && Object.prototype.hasOwnProperty.call(l, i) ? "A label with this key already exists" : void 0, S = p.length >= Q, x = !i || !!z || !!R || !!O;
35
+ let V;
36
+ e[6] !== x || e[7] !== i || e[8] !== a || e[9] !== d || e[10] !== l ? (V = () => {
37
+ x || (d({
38
+ ...l,
39
+ [i]: a
40
+ }), h(""), b(""), v(!1));
41
+ }, e[6] = x, e[7] = i, e[8] = a, e[9] = d, e[10] = l, e[11] = V) : V = e[11];
42
+ const M = V;
43
+ let K;
44
+ e[12] !== d || e[13] !== l ? (K = (m) => {
45
+ const g = {
46
+ ...l
47
+ };
48
+ delete g[m], d(g);
49
+ }, e[12] = d, e[13] = l, e[14] = K) : K = e[14];
50
+ const U = K;
51
+ let X;
52
+ e[15] === Symbol.for("react.memo_cache_sentinel") ? (X = () => {
53
+ h(""), b(""), v(!1);
54
+ }, e[15] = X) : X = e[15];
55
+ const ee = X;
56
+ let A;
57
+ e[16] !== n || e[17] !== s ? (A = !n && /* @__PURE__ */ t(k, { variant: "h6", children: s }), e[16] = n, e[17] = s, e[18] = A) : A = e[18];
58
+ let y;
59
+ e[19] !== f ? (y = /* @__PURE__ */ t(k, { variant: "body2", children: f }), e[19] = f, e[20] = y) : y = e[20];
60
+ let E;
61
+ e[21] !== r || e[22] !== p || e[23] !== U ? (E = p.length > 0 && /* @__PURE__ */ t(u, { display: "flex", flexWrap: "wrap", gap: 1, children: p.map((m) => {
62
+ const [g, F] = m;
63
+ return /* @__PURE__ */ t(G, { label: F ? `${g}: ${F}` : g, size: "small", variant: "outlined", onDelete: r ? void 0 : () => U(g), deleteIcon: /* @__PURE__ */ t(Y, { size: 14 }) }, g);
64
+ }) }), e[21] = r, e[22] = p, e[23] = U, e[24] = E) : E = e[24];
65
+ let _;
66
+ e[25] !== r || e[26] !== O || e[27] !== M || e[28] !== x || e[29] !== c || e[30] !== z || e[31] !== i || e[32] !== a || e[33] !== R ? (_ = c && /* @__PURE__ */ Z(u, { display: "flex", gap: 1, alignItems: "flex-start", children: [
67
+ /* @__PURE__ */ t(J, { label: "Key", size: "small", value: i, onChange: (m) => h(m.target.value), placeholder: "e.g. env", error: !!z || !!O, helperText: z ?? O, disabled: r }),
68
+ /* @__PURE__ */ t(J, { label: "Value", size: "small", value: a, onChange: (m) => b(m.target.value), placeholder: "e.g. production", error: !!R, helperText: R, disabled: r }),
69
+ /* @__PURE__ */ Z(u, { display: "flex", gap: 0.5, mt: 2.5, children: [
70
+ /* @__PURE__ */ t(q, { variant: "contained", size: "small", onClick: M, disabled: r || x, children: "Add" }),
71
+ /* @__PURE__ */ t(ne, { size: "small", onClick: ee, title: "Cancel", children: /* @__PURE__ */ t(Y, { size: 18 }) })
72
+ ] })
73
+ ] }), e[25] = r, e[26] = O, e[27] = M, e[28] = x, e[29] = c, e[30] = z, e[31] = i, e[32] = a, e[33] = R, e[34] = _) : _ = e[34];
74
+ let L;
75
+ e[35] !== S || e[36] !== r || e[37] !== c ? (L = !c && !r && /* @__PURE__ */ t(u, { display: "flex", justifyContent: "flex-start", children: /* @__PURE__ */ t(q, { startIcon: /* @__PURE__ */ t(se, { fontSize: "small" }), variant: "outlined", color: "primary", size: "small", onClick: () => v(!0), disabled: S, title: S ? `At most ${Q} labels per resource` : void 0, children: "Add Label" }) }), e[35] = S, e[36] = r, e[37] = c, e[38] = L) : L = e[38];
76
+ let j;
77
+ return e[39] !== A || e[40] !== y || e[41] !== E || e[42] !== _ || e[43] !== L ? (j = /* @__PURE__ */ Z(u, { display: "flex", flexDirection: "column", gap: 1.5, width: "100%", children: [
78
+ A,
79
+ y,
80
+ E,
81
+ _,
82
+ L
83
+ ] }), e[39] = A, e[40] = y, e[41] = E, e[42] = _, e[43] = L, e[44] = j) : j = e[44], j;
84
+ }, W = 4, fe = 46, xe = ({
85
+ labels: o,
86
+ size: e = "small"
87
+ }) => {
88
+ const l = Object.entries(o ?? {}), d = N(null), C = N([]), [$, T] = D(l.length);
89
+ if (le(() => {
90
+ const n = d.current;
91
+ if (!n) return;
92
+ const s = () => {
93
+ const c = n.clientWidth;
94
+ if (c <= 0) return;
95
+ let v = 0, i = 0;
96
+ for (let h = 0; h < l.length; h++) {
97
+ const a = C.current[h]?.getBoundingClientRect().width ?? 0, b = i > 0 ? W : 0, p = l.length - (h + 1) > 0 ? fe + W : 0;
98
+ if (v + b + a + p > c && i > 0) break;
99
+ v += b + a, i += 1;
100
+ }
101
+ T(i || (l.length > 0 ? 1 : 0));
102
+ };
103
+ if (s(), typeof ResizeObserver > "u") return;
104
+ const f = new ResizeObserver(s);
105
+ return f.observe(n), () => f.disconnect();
106
+ }, [o]), l.length === 0) return null;
107
+ const I = l.slice(0, $), r = l.slice($);
108
+ return /* @__PURE__ */ Z(u, { ref: d, sx: {
109
+ display: "flex",
110
+ flexWrap: "nowrap",
111
+ alignItems: "center",
112
+ gap: `${W}px`,
113
+ overflow: "hidden",
114
+ minWidth: 0,
115
+ flex: "1 1 0%"
116
+ }, children: [
117
+ /* @__PURE__ */ t(u, { "aria-hidden": !0, sx: {
118
+ position: "absolute",
119
+ top: -9999,
120
+ left: -9999,
121
+ visibility: "hidden",
122
+ display: "flex",
123
+ gap: `${W}px`,
124
+ pointerEvents: "none"
125
+ }, children: l.map(([n, s], f) => /* @__PURE__ */ t(u, { ref: (c) => {
126
+ C.current[f] = c;
127
+ }, children: /* @__PURE__ */ t(G, { label: s ? `${n}: ${s}` : n, size: e, variant: "outlined" }) }, n)) }),
128
+ I.map(([n, s]) => /* @__PURE__ */ t(G, { label: s ? `${n}: ${s}` : n, size: e, variant: "outlined", sx: {
129
+ flexShrink: 0
130
+ } }, n)),
131
+ r.length > 0 && /* @__PURE__ */ t(ie, { title: /* @__PURE__ */ t(re, { spacing: 0.25, children: r.map(([n, s]) => /* @__PURE__ */ t(k, { variant: "caption", children: s ? `${n}: ${s}` : n }, n)) }), placement: "top", children: /* @__PURE__ */ t(G, { label: `+${r.length}`, size: e, variant: "outlined", sx: {
132
+ flexShrink: 0
133
+ } }) })
134
+ ] });
135
+ };
136
+ export {
137
+ be as L,
138
+ xe as a
139
+ };