@devtron-labs/devtron-fe-common-lib 1.8.0 → 1.8.2-beta-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.
Files changed (36) hide show
  1. package/dist/{@code-editor-DGmxV2_q.js → @code-editor-B-1muYkA.js} +4220 -4175
  2. package/dist/@common-rjsf-DJAz4KOK.js +617 -0
  3. package/dist/Common/Constants.d.ts +12 -0
  4. package/dist/Common/RJSF/Form.d.ts +1 -1
  5. package/dist/Common/RJSF/index.d.ts +1 -1
  6. package/dist/Common/RJSF/types.d.ts +17 -3
  7. package/dist/Common/RJSF/utils.d.ts +5 -1
  8. package/dist/Pages/GlobalConfigurations/DeploymentCharts/basicViewSchema.json.d.ts +27 -30
  9. package/dist/Shared/Components/Icon/Icon.d.ts +17 -0
  10. package/dist/Shared/Components/Icon/types.d.ts +1 -1
  11. package/dist/Shared/Components/SSOProviderIcon/SSOProviderIcon.d.ts +2 -0
  12. package/dist/Shared/Components/SSOProviderIcon/index.d.ts +2 -0
  13. package/dist/Shared/Components/SSOProviderIcon/types.d.ts +10 -0
  14. package/dist/Shared/Components/index.d.ts +1 -0
  15. package/dist/assets/@code-editor.css +1 -1
  16. package/dist/assets/ic-app-group.892e71ff.svg +3 -0
  17. package/dist/assets/ic-browser.b8afdf0d.svg +3 -0
  18. package/dist/assets/ic-code.29c36e44.svg +3 -0
  19. package/dist/assets/ic-cube.643b8b57.svg +3 -0
  20. package/dist/assets/ic-gear.51261b97.svg +4 -0
  21. package/dist/assets/ic-google.adce3079.svg +6 -0
  22. package/dist/assets/ic-grid-view.a1ff2479.svg +3 -0
  23. package/dist/assets/ic-helm.49cb43a3.svg +3 -0
  24. package/dist/assets/ic-k8s-job.d3310821.svg +3 -0
  25. package/dist/assets/ic-ldap.1742ec39.svg +3 -0
  26. package/dist/assets/ic-microsoft.4767e309.svg +6 -0
  27. package/dist/assets/ic-monitoring.6e5acb4a.svg +6 -0
  28. package/dist/assets/ic-oidc.27839a0d.svg +4 -0
  29. package/dist/assets/ic-open-box.e672fe67.svg +3 -0
  30. package/dist/assets/ic-openshift.afcfadec.svg +10 -0
  31. package/dist/assets/ic-shield-check.5c033f06.svg +3 -0
  32. package/dist/assets/ic-stack.8b3b1bdd.svg +3 -0
  33. package/dist/index.d.ts +4 -0
  34. package/dist/index.js +436 -432
  35. package/package.json +1 -1
  36. package/dist/@common-rjsf-DcjPfJj5.js +0 -519
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "1.8.0",
3
+ "version": "1.8.2-beta-1",
4
4
  "description": "Supporting common component library",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,519 +0,0 @@
1
- import { j as t, J as P } from "./@vendor-CIA81cZg.js";
2
- import R, { forwardRef as $ } from "react";
3
- import L, { getDefaultRegistry as D } from "@rjsf/core";
4
- import { T as v, c as H, a as U, i as k, b as y, d as S, S as J } from "./@code-editor-DGmxV2_q.js";
5
- import M, { components as A } from "react-select";
6
- import { ReactComponent as V } from "./assets/ic-chevron-down.fc70d7a7.svg";
7
- import { getUiOptions as C, getTemplate as B, getSubmitButtonOptions as W, ADDITIONAL_PROPERTY_FLAG as I, errorId as q, englishStringTranslator as K, TranslatableString as Y, titleId as z, canExpand as G, deepEquals as Q } from "@rjsf/utils";
8
- import { ReactComponent as X } from "./assets/ic-add.cfaa779b.svg";
9
- import { ReactComponent as Z } from "./assets/ic-cross.01e03666.svg";
10
- import { ReactComponent as ee } from "./assets/ic-warning.ecf7ff97.svg";
11
- import './assets/@common-rjsf.css';const N = {
12
- SELECT: "Please select an option",
13
- INPUT: "Please enter an input",
14
- OBJECT_KEY: "Please enter a value for the key"
15
- }, te = "Key not available", Pe = {
16
- "ui:submitButtonOptions": {
17
- norender: !0
18
- }
19
- }, b = ({
20
- showLabel: n,
21
- label: e,
22
- required: s,
23
- children: a,
24
- id: r,
25
- rawDescription: o,
26
- shouldAlignCenter: i = !0
27
- }) => /* @__PURE__ */ t.jsxs(
28
- "div",
29
- {
30
- className: n ? `display-grid dc__gap-12 rjsf-form-template__field ${i ? "flex-align-center" : ""}` : "",
31
- children: [
32
- n && /* @__PURE__ */ t.jsxs("label", { className: "cn-7 fs-13 lh-20 fw-4 flexbox mb-0", htmlFor: r, children: [
33
- /* @__PURE__ */ t.jsx(v, { alwaysShowTippyOnHover: !!o, content: o, children: /* @__PURE__ */ t.jsx("span", { className: `dc__ellipsis-right ${o ? "text-underline-dashed-300" : ""}`, children: e || te }) }),
34
- s && /* @__PURE__ */ t.jsx("span", { className: "cr-5", children: " *" })
35
- ] }),
36
- a
37
- ]
38
- }
39
- ), F = ({ label: n, canAdd: e, onAddClick: s, disabled: a, readonly: r, uiSchema: o, registry: i }) => {
40
- const {
41
- ButtonTemplates: { AddButton: c }
42
- } = i.templates;
43
- return e && /* @__PURE__ */ t.jsx(
44
- c,
45
- {
46
- label: n,
47
- onClick: s,
48
- disabled: a || r,
49
- uiSchema: o,
50
- registry: i
51
- }
52
- );
53
- }, ne = ({
54
- canAdd: n,
55
- className: e,
56
- disabled: s,
57
- idSchema: a,
58
- uiSchema: r,
59
- items: o,
60
- onAddClick: i,
61
- readonly: c,
62
- registry: l,
63
- required: d,
64
- title: x
65
- }) => {
66
- const p = C(r), h = B("ArrayFieldItemTemplate", l, p), u = p.title || x;
67
- return /* @__PURE__ */ t.jsx("fieldset", { className: e, id: a.$id, children: o.length ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
68
- o.map(({ key: j, ..._ }, f) => {
69
- const m = {
70
- ..._.children,
71
- props: {
72
- ..._.children.props
73
- }
74
- };
75
- return /* @__PURE__ */ t.jsx(h, { ..._, children: m }, j);
76
- }),
77
- /* @__PURE__ */ t.jsx(
78
- F,
79
- {
80
- label: u,
81
- canAdd: n,
82
- onAddClick: i,
83
- disabled: s,
84
- readonly: c,
85
- uiSchema: r,
86
- registry: l
87
- }
88
- )
89
- ] }) : /* @__PURE__ */ t.jsx(b, { label: u, required: d, showLabel: !0, id: a.$id, children: /* @__PURE__ */ t.jsx(
90
- F,
91
- {
92
- label: u,
93
- canAdd: n,
94
- onAddClick: i,
95
- disabled: s,
96
- readonly: c,
97
- uiSchema: r,
98
- registry: l
99
- }
100
- ) }) });
101
- }, se = ({
102
- children: n,
103
- disabled: e,
104
- hasToolbar: s,
105
- hasRemove: a,
106
- index: r,
107
- onDropIndexClick: o,
108
- readonly: i,
109
- registry: c,
110
- uiSchema: l
111
- }) => {
112
- const { RemoveButton: d } = c.templates.ButtonTemplates;
113
- return /* @__PURE__ */ t.jsxs("div", { className: "dc__position-rel display-grid rjsf-form-template__array-field-item flex-align-center", children: [
114
- n,
115
- /* @__PURE__ */ t.jsx("div", { className: "dc__position-abs remove-btn__container", style: { right: "-28px", top: "9px" }, children: s && a && /* @__PURE__ */ t.jsx(
116
- d,
117
- {
118
- disabled: e || i,
119
- onClick: o(r),
120
- uiSchema: l,
121
- registry: c
122
- }
123
- ) })
124
- ] });
125
- }, {
126
- templates: { BaseInputTemplate: ae }
127
- } = D(), re = ({ placeholder: n, ...e }) => /* @__PURE__ */ t.jsx(
128
- ae,
129
- {
130
- placeholder: n || N.INPUT,
131
- ...e,
132
- className: "form__input cn-9 fs-13 lh-20 fw-4"
133
- }
134
- ), E = ({
135
- label: n,
136
- icon: e,
137
- iconType: s,
138
- registry: a,
139
- uiSchema: r,
140
- ...o
141
- }) => {
142
- const i = `Add ${n}`;
143
- return /* @__PURE__ */ t.jsx("div", { className: "flexbox flex-justify-start", children: /* @__PURE__ */ t.jsxs(
144
- "button",
145
- {
146
- ...o,
147
- type: "button",
148
- className: "dc__outline-none-imp p-0 dc__transparent flex dc__gap-4 cursor dc__mxw-250",
149
- title: "Add",
150
- children: [
151
- /* @__PURE__ */ t.jsx(X, { className: "icon-dim-16 fcb-5" }),
152
- /* @__PURE__ */ t.jsx(v, { placement: "right", content: i, children: /* @__PURE__ */ t.jsx("span", { className: "cb-5 fs-13 lh-34 dc__truncate", children: i }) })
153
- ]
154
- }
155
- ) });
156
- }, oe = ({ icon: n, iconType: e, registry: s, uiSchema: a, ...r }) => /* @__PURE__ */ t.jsx("button", { ...r, type: "button", className: "dc__outline-none-imp p-0 dc__transparent flex cursor", title: "Remove", children: /* @__PURE__ */ t.jsx(Z, { className: "icon-dim-16 fcn-6" }) }), ie = ({ uiSchema: n }) => {
157
- const { submitText: e, norender: s, props: a = {} } = W(n);
158
- return s ? null : /* @__PURE__ */ t.jsx("div", { className: "flexbox flex-justify-end", children: /* @__PURE__ */ t.jsx("button", { type: "submit", ...a, className: `cta ${a.className || ""}`, children: e }) });
159
- }, w = ({
160
- id: n,
161
- title: e,
162
- required: s,
163
- description: a
164
- }) => /* @__PURE__ */ t.jsxs("legend", { className: "fs-13 fw-6 cn-9 lh-20 dc__no-border pb-9 mb-0", id: n, children: [
165
- /* @__PURE__ */ t.jsx(v, { alwaysShowTippyOnHover: !!a, content: a, children: /* @__PURE__ */ t.jsx("span", { className: `${a ? "text-underline-dashed-300" : ""}`, children: e }) }),
166
- s && /* @__PURE__ */ t.jsx("span", { className: "cr-5", children: " *" })
167
- ] }), le = (n) => {
168
- const {
169
- id: e,
170
- label: s,
171
- children: a,
172
- errors: r,
173
- hidden: o,
174
- required: i,
175
- displayLabel: c,
176
- registry: l,
177
- uiSchema: d,
178
- classNames: x,
179
- schema: p,
180
- rawDescription: h
181
- } = n, u = C(d), j = B(
182
- "WrapIfAdditionalTemplate",
183
- l,
184
- u
185
- ), _ = I in p, f = (c || p.type === "boolean") && !_, m = p.type === "array";
186
- return o ? /* @__PURE__ */ t.jsx("div", { className: "hidden", children: a }) : (
187
- // NOTE: need to override the margins of default rjsf css
188
- /* @__PURE__ */ t.jsxs("div", { className: `${x} mb-0`, children: [
189
- m && /* @__PURE__ */ t.jsx(
190
- w,
191
- {
192
- id: e,
193
- title: s,
194
- required: i,
195
- registry: l,
196
- uiSchema: d,
197
- schema: p,
198
- description: h
199
- }
200
- ),
201
- /* @__PURE__ */ t.jsx(
202
- b,
203
- {
204
- label: s,
205
- showLabel: f,
206
- id: e,
207
- required: i,
208
- rawDescription: h,
209
- children: /* @__PURE__ */ t.jsx(j, { ...n, children: a })
210
- }
211
- ),
212
- r
213
- ] })
214
- );
215
- }, ce = ({ errors: n = [], idSchema: e }) => {
216
- const s = q(e);
217
- return n.length > 0 && /* @__PURE__ */ t.jsx("span", { className: "display-grid rjsf-form-template__field--error dc__gap-12", id: s, children: n.filter((a) => !!a).map((a, r) => /* @__PURE__ */ t.jsxs(R.Fragment, { children: [
218
- /* @__PURE__ */ t.jsx("span", {}),
219
- /* @__PURE__ */ t.jsxs("span", { className: "form__error", children: [
220
- /* @__PURE__ */ t.jsx(ee, { className: "form__icon form__icon--error" }),
221
- a
222
- ] })
223
- ] }, r)) });
224
- }, de = (n, e) => {
225
- switch (n) {
226
- case Y.NewStringDefault:
227
- return "";
228
- default:
229
- return K(n, e);
230
- }
231
- }, Re = (n) => {
232
- try {
233
- const e = new URL(n).origin === window.location.origin;
234
- return {
235
- href: n,
236
- target: e ? "_self" : "_blank",
237
- rel: e ? void 0 : "external noreferrer",
238
- url: n
239
- };
240
- } catch {
241
- return {
242
- href: n,
243
- target: "_blank",
244
- url: `${n} (Invalid URL)`
245
- };
246
- }
247
- }, $e = (n) => {
248
- const e = typeof n;
249
- switch (e) {
250
- case "boolean":
251
- case "string":
252
- case "number":
253
- return e;
254
- case "object":
255
- return Array.isArray(n) ? "array" : n === null ? "null" : e;
256
- default:
257
- return "null";
258
- }
259
- }, T = (n) => {
260
- if (!n)
261
- return "";
262
- const e = n.trim();
263
- return e.match(/^\w+(\/\w+)*$/g) ? `/${e}` : e.match(/^\w+(\.\w+)*$/g) ? `/${e.replaceAll(/\./g, "/")}` : e;
264
- }, O = {
265
- value: !1,
266
- path: ""
267
- }, pe = (n) => {
268
- if (!n)
269
- return null;
270
- const e = structuredClone(n);
271
- return typeof e == "string" ? {
272
- value: !0,
273
- path: T(e)
274
- } : typeof e != "object" ? structuredClone(O) : Object.hasOwn(e, "condition") && "condition" in e && Object.hasOwn(e, "value") && "value" in e ? {
275
- value: e.condition,
276
- path: T(e.value)
277
- } : Object.hasOwn(e, "value") && "value" in e && Object.hasOwn(e, "path") && "path" in e ? {
278
- value: e.value,
279
- path: T(e.path)
280
- } : structuredClone(O);
281
- }, me = ({
282
- disabled: n,
283
- formData: e,
284
- idSchema: s,
285
- onAddClick: a,
286
- properties: r,
287
- readonly: o,
288
- registry: i,
289
- required: c,
290
- schema: l,
291
- title: d,
292
- uiSchema: x,
293
- formContext: p
294
- }) => {
295
- const h = !!l.additionalProperties, u = G(l, x, e) && /* @__PURE__ */ t.jsx(
296
- E,
297
- {
298
- label: d,
299
- className: "object-property-expand",
300
- onClick: a(l),
301
- disabled: n || o,
302
- uiSchema: x,
303
- registry: i
304
- }
305
- ), j = r.filter((_) => {
306
- const f = l.properties?.[_.name]?.hidden;
307
- if (!f)
308
- return !0;
309
- try {
310
- const m = pe(f);
311
- if (!m.path)
312
- throw new Error("Empty path property of hidden descriptor field");
313
- if (!m.path.match(/^\/\w+(\/\w+)*$/g))
314
- throw new Error("Provided path is not a valid JSON pointer");
315
- const g = P({
316
- path: H(m.path),
317
- json: p
318
- })?.[0];
319
- return !(g === void 0 || Q(m.value, g));
320
- } catch {
321
- return !0;
322
- }
323
- }).sort((_) => l.properties?.[_.name]?.type === "boolean" ? -1 : 1).map((_) => _.content);
324
- return h ? r.length ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
325
- /* @__PURE__ */ t.jsx(
326
- b,
327
- {
328
- label: d,
329
- required: c,
330
- showLabel: !0,
331
- id: s.$id,
332
- shouldAlignCenter: !1,
333
- children: /* @__PURE__ */ t.jsx("div", { children: j })
334
- }
335
- ),
336
- u
337
- ] }) : /* @__PURE__ */ t.jsx(b, { label: d, required: c, showLabel: !0, id: s.$id, children: u }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
338
- j,
339
- u
340
- ] });
341
- }, ue = (n) => {
342
- const { idSchema: e, registry: s, required: a, schema: r, title: o, uiSchema: i, description: c } = n, l = !!r.additionalProperties, d = o && !l;
343
- return /* @__PURE__ */ t.jsxs("fieldset", { id: e.$id, children: [
344
- d && /* @__PURE__ */ t.jsx(
345
- w,
346
- {
347
- id: z(e),
348
- title: o,
349
- required: a,
350
- schema: r,
351
- uiSchema: i,
352
- registry: s,
353
- description: c
354
- }
355
- ),
356
- /* @__PURE__ */ t.jsx(
357
- "div",
358
- {
359
- className: `${r.properties && !l && e.$id !== "root" ? "dc__border-left pl-12" : ""} ${e.$id === "root" ? "dc__separated-flexbox dc__separated-flexbox--vertical" : "flexbox-col dc__gap-8"}`,
360
- children: /* @__PURE__ */ t.jsx(me, { ...n })
361
- }
362
- )
363
- ] });
364
- }, he = ({
365
- id: n,
366
- disabled: e,
367
- label: s,
368
- onKeyChange: a,
369
- onDropPropertyClick: r,
370
- readonly: o,
371
- schema: i,
372
- children: c,
373
- uiSchema: l,
374
- registry: d
375
- }) => {
376
- const { templates: x } = d, { RemoveButton: p } = x.ButtonTemplates, h = I in i;
377
- return /* @__PURE__ */ t.jsx(t.Fragment, { children: h ? /* @__PURE__ */ t.jsxs("div", { className: "dc__position-rel rjsf-form-template__additional-fields display-grid dc__gap-8 flex-align-center", children: [
378
- /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
379
- "input",
380
- {
381
- type: "text",
382
- className: "form__input cn-9 fs-13 lh-20 fw-4",
383
- id: `${n}-key`,
384
- onBlur: (u) => a(u.target.value),
385
- placeholder: N.OBJECT_KEY,
386
- defaultValue: s
387
- }
388
- ) }),
389
- /* @__PURE__ */ t.jsx("div", { children: c }),
390
- /* @__PURE__ */ t.jsx("div", { className: "dc__position-abs remove-btn__container", style: { right: "-28px", top: "9px" }, children: /* @__PURE__ */ t.jsx(
391
- p,
392
- {
393
- disabled: e || o,
394
- onClick: r(s),
395
- uiSchema: l,
396
- registry: d
397
- }
398
- ) })
399
- ] }) : c });
400
- }, fe = ({
401
- id: n,
402
- onChange: e,
403
- value: s,
404
- required: a,
405
- disabled: r,
406
- readonly: o,
407
- autofocus: i,
408
- onBlur: c,
409
- onFocus: l
410
- }) => {
411
- const d = (p, h) => {
412
- const { id: u, checked: j } = p.target;
413
- h === "blur" ? c(u, j) : h === "focus" && l(u, j);
414
- }, x = k(s) ? !1 : s;
415
- return /* @__PURE__ */ t.jsxs("div", { children: [
416
- /* @__PURE__ */ t.jsx(
417
- U,
418
- {
419
- selected: x,
420
- onSelect: e,
421
- id: n,
422
- name: n,
423
- required: a,
424
- disabled: r || o,
425
- autoFocus: i,
426
- rootClassName: "w-32 mb-0 dc__height-inherit",
427
- onBlur: (p) => d(p, "blur"),
428
- onFocus: (p) => d(p, "focus")
429
- }
430
- ),
431
- /* @__PURE__ */ t.jsx("span", { className: "dc__capitalize ml-8", children: x.toString() })
432
- ] });
433
- }, xe = ({ children: n, ...e }) => /* @__PURE__ */ t.jsx(A.MenuList, { ...e, children: Array.isArray(n) ? n.slice(0, 20) : n }), _e = (n) => /* @__PURE__ */ t.jsx(A.DropdownIndicator, { ...n, children: /* @__PURE__ */ t.jsx(V, { className: "icon-dim-20 icon-n5", "data-testid": "overview-project-edit-dropdown" }) }), je = (n) => {
434
- const {
435
- id: e,
436
- multiple: s = !1,
437
- options: a,
438
- value: r,
439
- disabled: o,
440
- readonly: i,
441
- autofocus: c = !1,
442
- onChange: l,
443
- onBlur: d,
444
- onFocus: x,
445
- placeholder: p
446
- } = n, { enumOptions: h = [] } = a, u = s ? [] : "", j = (f) => {
447
- l(s ? f.map((m) => m.value) : f.value);
448
- }, _ = (f) => s ? h.filter((m) => f.some((g) => S(g, m.value))) : h.find((m) => S(f, m.value));
449
- return /* @__PURE__ */ t.jsx(
450
- M,
451
- {
452
- id: e,
453
- name: e,
454
- isMulti: s,
455
- value: typeof r > "u" ? u : _(r),
456
- autoFocus: c,
457
- onChange: j,
458
- options: h,
459
- onBlur: () => d(e, r),
460
- onFocus: () => x(e, r),
461
- placeholder: p || N.SELECT,
462
- isDisabled: o || i,
463
- styles: {
464
- ...y,
465
- control: (f, m) => ({
466
- ...y.control(f, m),
467
- minHeight: "36px"
468
- }),
469
- multiValue: (f, m) => ({
470
- ...y.multiValue(f, m),
471
- margin: "2px 8px 2px 2px"
472
- })
473
- },
474
- components: {
475
- IndicatorSeparator: null,
476
- DropdownIndicator: _e,
477
- MenuList: xe
478
- },
479
- menuPlacement: "auto"
480
- }
481
- );
482
- }, ge = {
483
- CheckboxWidget: fe,
484
- SelectWidget: je
485
- }, be = {
486
- ArrayFieldItemTemplate: se,
487
- ArrayFieldTemplate: ne,
488
- BaseInputTemplate: re,
489
- ButtonTemplates: { AddButton: E, RemoveButton: oe, SubmitButton: ie },
490
- FieldTemplate: le,
491
- FieldErrorTemplate: ce,
492
- ObjectFieldTemplate: ue,
493
- TitleFieldTemplate: w,
494
- WrapIfAdditionalTemplate: he
495
- }, ye = L, Te = J, Le = $((n, e) => /* @__PURE__ */ t.jsx(
496
- ye,
497
- {
498
- noHtml5Validate: !0,
499
- showErrorList: !1,
500
- autoComplete: "off",
501
- ...n,
502
- className: `rjsf-form-template__container ${n.className || ""}`,
503
- validator: Te,
504
- templates: {
505
- ...be,
506
- ...n.templates
507
- },
508
- formContext: n.formData,
509
- widgets: { ...ge, ...n.widgets },
510
- translateString: de,
511
- ref: e
512
- }
513
- ));
514
- export {
515
- Pe as H,
516
- Le as R,
517
- Re as a,
518
- $e as g
519
- };