iguazio.dashboard-react-controls 3.2.1 → 3.2.3

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 (62) hide show
  1. package/dist/components/FormChipCell/FormChip/FormChip.d.ts +3 -1
  2. package/dist/components/FormChipCell/FormChip/FormChip.d.ts.map +1 -1
  3. package/dist/components/FormChipCell/FormChip/FormChip.mjs +30 -27
  4. package/dist/components/FormChipCell/FormChip/FormChip.mjs.map +1 -1
  5. package/dist/components/FormChipCell/FormChipCell.d.ts +7 -2
  6. package/dist/components/FormChipCell/FormChipCell.d.ts.map +1 -1
  7. package/dist/components/FormChipCell/FormChipCell.mjs +131 -124
  8. package/dist/components/FormChipCell/FormChipCell.mjs.map +1 -1
  9. package/dist/components/FormChipCell/FormChipCellView.d.ts +8 -1
  10. package/dist/components/FormChipCell/FormChipCellView.d.ts.map +1 -1
  11. package/dist/components/FormChipCell/FormChipCellView.mjs +105 -96
  12. package/dist/components/FormChipCell/FormChipCellView.mjs.map +1 -1
  13. package/dist/components/FormChipCell/NewChipForm/NewChipForm.d.ts +3 -1
  14. package/dist/components/FormChipCell/NewChipForm/NewChipForm.d.ts.map +1 -1
  15. package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs +191 -185
  16. package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs.map +1 -1
  17. package/dist/components/ReadOnlyChips/ReadOnlyChips.d.ts +22 -0
  18. package/dist/components/ReadOnlyChips/ReadOnlyChips.d.ts.map +1 -0
  19. package/dist/components/ReadOnlyChips/ReadOnlyChips.mjs +41 -0
  20. package/dist/components/ReadOnlyChips/ReadOnlyChips.mjs.map +1 -0
  21. package/dist/components/TableCell/TableCell.d.ts.map +1 -1
  22. package/dist/components/TableCell/TableCell.mjs +39 -32
  23. package/dist/components/TableCell/TableCell.mjs.map +1 -1
  24. package/dist/components/index.d.ts +2 -3
  25. package/dist/components/index.d.ts.map +1 -1
  26. package/dist/components/index.mjs +52 -54
  27. package/dist/components/index.mjs.map +1 -1
  28. package/dist/elements/TableLinkCell/TableLinkCell.mjs +1 -1
  29. package/dist/elements/TableLinkCell/TableLinkCell.mjs.map +1 -1
  30. package/dist/hooks/useChipCell.hook.d.ts.map +1 -1
  31. package/dist/hooks/useChipCell.hook.mjs +52 -49
  32. package/dist/hooks/useChipCell.hook.mjs.map +1 -1
  33. package/dist/images/add.svg.mjs +3 -2
  34. package/dist/images/add.svg.mjs.map +1 -1
  35. package/dist/index.css +1 -1
  36. package/dist/types.d.ts +1 -0
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.mjs +53 -49
  39. package/dist/types.mjs.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/components/Chip/Chip.d.ts +0 -3
  42. package/dist/components/Chip/Chip.d.ts.map +0 -1
  43. package/dist/components/Chip/Chip.mjs +0 -153
  44. package/dist/components/Chip/Chip.mjs.map +0 -1
  45. package/dist/components/Chip/Chip.stories.d.ts +0 -26
  46. package/dist/components/Chip/Chip.stories.d.ts.map +0 -1
  47. package/dist/components/ChipCell/ChipCell.d.ts +0 -3
  48. package/dist/components/ChipCell/ChipCell.d.ts.map +0 -1
  49. package/dist/components/ChipCell/ChipCell.mjs +0 -212
  50. package/dist/components/ChipCell/ChipCell.mjs.map +0 -1
  51. package/dist/components/ChipCell/ChipTooltip/ChipTooltip.d.ts +0 -15
  52. package/dist/components/ChipCell/ChipTooltip/ChipTooltip.d.ts.map +0 -1
  53. package/dist/components/ChipCell/ChipTooltip/ChipTooltip.mjs +0 -36
  54. package/dist/components/ChipCell/ChipTooltip/ChipTooltip.mjs.map +0 -1
  55. package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.d.ts +0 -35
  56. package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.d.ts.map +0 -1
  57. package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.mjs +0 -73
  58. package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.mjs.map +0 -1
  59. package/dist/components/ChipForm/ChipForm.mjs +0 -184
  60. package/dist/components/ChipForm/ChipForm.mjs.map +0 -1
  61. package/dist/images/add.svg2.mjs +0 -6
  62. package/dist/images/add.svg2.mjs.map +0 -1
@@ -1,279 +1,285 @@
1
- import { jsx as k, jsxs as ve } from "react/jsx-runtime";
2
- import T, { useState as $, useMemo as H, useCallback as W, useEffect as f, useLayoutEffect as Fe, forwardRef as fe } from "react";
3
- import o from "prop-types";
1
+ import { jsx as W, jsxs as Fe } from "react/jsx-runtime";
2
+ import T, { useState as $, useMemo as H, useCallback as I, useEffect as h, useLayoutEffect as fe, forwardRef as we } from "react";
3
+ import a from "prop-types";
4
4
  import j from "classnames";
5
- import { isEmpty as h, get as D, throttle as we, isNil as G } from "lodash";
6
- import re from "../NewChipInput/NewChipInput.mjs";
7
- import Re from "../../../elements/OptionsMenu/OptionsMenu.mjs";
8
- import be from "../../../elements/ValidationTemplate/ValidationTemplate.mjs";
9
- import { CHIP_OPTIONS as ke } from "../../../types.mjs";
10
- import { CLICK as We, TAB as J, TAB_SHIFT as Ie } from "../../../constants.mjs";
11
- import { getTextWidth as z } from "../formChipCell.util.mjs";
12
- import { getTransitionEndEventName as Ke } from "../../../utils/common.util.mjs";
13
- import Ve from "../../../images/close.svg.mjs";
5
+ import { isEmpty as y, get as z, throttle as Re, isNil as G } from "lodash";
6
+ import se from "../NewChipInput/NewChipInput.mjs";
7
+ import be from "../../../elements/OptionsMenu/OptionsMenu.mjs";
8
+ import ke from "../../../elements/ValidationTemplate/ValidationTemplate.mjs";
9
+ import { CHIP_OPTIONS as We } from "../../../types.mjs";
10
+ import { CLICK as Ie, TAB as J, TAB_SHIFT as Ke } from "../../../constants.mjs";
11
+ import { getTextWidth as D } from "../formChipCell.util.mjs";
12
+ import { getTransitionEndEventName as Ve } from "../../../utils/common.util.mjs";
13
+ import _e from "../../../images/close.svg.mjs";
14
14
  /* empty css */
15
- const _e = {
15
+ const Ne = {
16
16
  rules: {}
17
17
  };
18
- let x = ({
19
- chip: a,
20
- chipIndex: n,
21
- chipOptions: se,
18
+ let P = ({
19
+ chip: d,
20
+ chipIndex: i,
21
+ chipOptions: ne,
22
22
  className: ie = "",
23
- editConfig: t,
24
- handleRemoveChip: ne,
25
- isEditable: d,
26
- keyName: V,
23
+ editConfig: r,
24
+ handleRemoveChip: le,
25
+ isDeletable: Q,
26
+ isEditable: u,
27
+ keyName: N,
27
28
  meta: m,
28
- onChange: _,
29
- setChipSizeIsRecalculated: Q,
30
- setEditConfig: L,
31
- validationRules: le = _e.rules,
32
- valueName: ue
33
- }, P) => {
29
+ onChange: q,
30
+ setChipSizeIsRecalculated: U,
31
+ setEditConfig: O,
32
+ validationRules: ue = Ne.rules,
33
+ valueName: oe
34
+ }, w) => {
34
35
  const [l, A] = $({
35
- isKeyOnly: a.isKeyOnly,
36
- key: a.key,
37
- value: a.value,
36
+ isKeyOnly: d.isKeyOnly,
37
+ key: d.key,
38
+ value: d.value,
38
39
  keyFieldWidth: 0,
39
40
  valueFieldWidth: 0
40
- }), [y, ce] = $("key"), [U, oe] = $(le), [p, B] = $(!1), { background: X, borderColor: Y, borderRadius: Z, density: C, font: g } = se, v = H(() => d ? 25 : 20, [d]), F = H(() => d ? 35 : 20, [d]), M = H(() => Ke(), []), u = T.useRef({}), c = T.useRef({}), S = T.useRef(), E = T.useRef(), ae = j(
41
+ }), [v, ce] = $("key"), [X, ae] = $(ue), [p, B] = $(!1), { background: Y, borderColor: Z, borderRadius: C, density: g, font: ee } = ne, F = H(() => u ? 25 : 20, [u]), f = H(() => u ? 35 : 20, [u]), M = H(() => Ve(), []), o = T.useRef({}), c = T.useRef({}), S = T.useRef(), x = T.useRef(), de = j(
41
42
  ie,
42
- !t.isKeyFocused && "item_edited",
43
- !h(D(m, ["error", n, "key"], [])) && !h(l.key) && !a.disabled && "item_edited_invalid"
44
- ), de = j(
43
+ !r.isKeyFocused && "item_edited",
44
+ !y(z(m, ["error", i, "key"], [])) && !y(l.key) && !d.disabled && u && "item_edited_invalid"
45
+ ), me = j(
45
46
  "edit-chip-container",
46
- X && `edit-chip-container-background_${X}`,
47
- Y && `edit-chip-container-border_${Y}`,
48
- g && `edit-chip-container-font_${g}`,
49
- C && `edit-chip-container-density_${C}`,
47
+ Y && `edit-chip-container-background_${Y}`,
50
48
  Z && `edit-chip-container-border_${Z}`,
51
- (t.isEdit || t.isNewChip) && "edit-chip-container_edited",
52
- a.disabled && "edit-chip-container_disabled edit-chip-container-font_disabled"
53
- ), me = j(
54
- "input-label-value",
55
- !t.isValueFocused && "item_edited",
56
- !h(D(m, ["error", n, "value"], [])) && !h(l.value) && "item_edited_invalid"
49
+ ee && `edit-chip-container-font_${ee}`,
50
+ g && `edit-chip-container-density_${g}`,
51
+ C && `edit-chip-container-border_${C}`,
52
+ (r.isEdit || r.isNewChip) && "edit-chip-container_edited",
53
+ u && d.disabled && "edit-chip-container_disabled edit-chip-container-font_disabled"
57
54
  ), pe = j(
55
+ "input-label-value",
56
+ !r.isValueFocused && "item_edited",
57
+ !y(z(m, ["error", i, "value"], [])) && !y(l.value) && u && "item_edited_invalid"
58
+ ), he = j(
58
59
  "item-icon-close",
59
- !a.disabled && t.chipIndex === n && d && "item-icon-close_invisible",
60
- !d && "item-icon-close_hidden"
61
- ), O = W(() => {
60
+ !d.disabled && (r.chipIndex === i && u || !Q) && "item-icon-close invisible",
61
+ !u && !Q && "item-icon-close hidden"
62
+ ), K = I(() => {
62
63
  var e;
63
- if (u.current) {
64
- const r = z(u.current) + 1, s = z(c.current) + 1, i = ((e = P.current) == null ? void 0 : e.clientWidth) - 50, K = r >= i / 2, q = s >= i / 2;
65
- let w = null, R = null;
66
- if (K && q)
67
- w = R = i / 2;
68
- else if (K) {
69
- R = l.value ? s : F;
70
- const b = i - R;
71
- w = b > r ? r : b;
72
- } else if (q) {
73
- w = l.key ? r : v;
74
- const b = i - w;
75
- R = b > s ? s : b;
64
+ if (o.current) {
65
+ const t = D(o.current) + 1, s = D(c.current) + 1, n = ((e = w.current) == null ? void 0 : e.clientWidth) - 50, _ = t >= n / 2, L = s >= n / 2;
66
+ let R = null, b = null;
67
+ if (_ && L)
68
+ R = b = n / 2;
69
+ else if (_) {
70
+ b = l.value ? s : f;
71
+ const k = n - b;
72
+ R = k > t ? t : k;
73
+ } else if (L) {
74
+ R = l.key ? t : F;
75
+ const k = n - R;
76
+ b = k > s ? s : k;
76
77
  } else
77
- w = !l.key || r <= v ? v : r, R = !l.value || s <= F ? F : s;
78
- u.current.style.width = `${w}px`, h(c.current) || (c.current.style.width = `${R}px`), A((b) => ({
79
- ...b,
80
- keyFieldWidth: w,
81
- valueFieldWidth: R
82
- })), Q(!0);
78
+ R = !l.key || t <= F ? F : t, b = !l.value || s <= f ? f : s;
79
+ o.current.style.width = `${R}px`, y(c.current) || (c.current.style.width = `${b}px`), A((k) => ({
80
+ ...k,
81
+ keyFieldWidth: R,
82
+ valueFieldWidth: b
83
+ })), U(!0);
83
84
  }
84
85
  }, [
85
86
  l.key,
86
87
  l.value,
87
- v,
88
88
  F,
89
- P,
90
- Q
89
+ f,
90
+ w,
91
+ U
91
92
  ]);
92
- f(() => {
93
- const e = we(O, 500);
94
- if (d)
93
+ h(() => {
94
+ if (!w.current) return;
95
+ const e = w.current, t = new ResizeObserver(K);
96
+ return t.observe(e), () => t.unobserve(e);
97
+ }, [w, K]), h(() => {
98
+ const e = Re(K, 500);
99
+ if (u)
95
100
  return window.addEventListener("resize", e), window.addEventListener(M, e), () => {
96
101
  window.removeEventListener("resize", e), window.removeEventListener(M, e);
97
102
  };
98
- }, [d, O, M]), f(() => {
99
- !l.keyFieldWidth && !l.valueFieldWidth && O();
100
- }, [l.keyFieldWidth, l.valueFieldWidth, O]);
101
- const N = W(
102
- (e, r) => {
103
+ }, [u, K, M]), h(() => {
104
+ !l.keyFieldWidth && !l.valueFieldWidth && K();
105
+ }, [l.keyFieldWidth, l.valueFieldWidth, K]);
106
+ const E = I(
107
+ (e, t) => {
103
108
  var s;
104
- t.chipIndex === n && (!(e.path ?? ((s = e.composedPath) == null ? void 0 : s.call(e))).includes(S.current) || r ? (_(e, We, !0), window.getSelection().removeAllRanges(), document.activeElement.blur()) : e.stopPropagation());
109
+ r.chipIndex === i && (!(e.path ?? ((s = e.composedPath) == null ? void 0 : s.call(e))).includes(S.current) || t ? (q(e, Ie, !0), window.getSelection().removeAllRanges(), document.activeElement.blur()) : e.stopPropagation());
105
110
  },
106
- [_, S, n, t.chipIndex]
107
- ), I = W(
111
+ [q, S, i, r.chipIndex]
112
+ ), V = I(
108
113
  (e) => {
109
- E != null && E.current && !E.current.contains(e.target) && (B(!1), N(e, !0));
114
+ x != null && x.current && !x.current.contains(e.target) && (B(!1), E(e, !0));
110
115
  },
111
- [N]
116
+ [E]
112
117
  );
113
- f(() => (p && window.addEventListener("scroll", I, !0), () => {
114
- window.removeEventListener("scroll", I, !0);
115
- }), [I, p]), f(() => {
116
- t.chipIndex === n && (t.isKeyFocused ? u.current.focus() : t.isValueFocused && c.current.focus());
118
+ h(() => (p && window.addEventListener("scroll", V, !0), () => {
119
+ window.removeEventListener("scroll", V, !0);
120
+ }), [V, p]), h(() => {
121
+ r.chipIndex === i && (r.isKeyFocused ? o.current.focus() : r.isValueFocused && c.current.focus());
117
122
  }, [
118
- t.isKeyFocused,
119
- t.isValueFocused,
120
- u,
123
+ r.isKeyFocused,
124
+ r.isValueFocused,
125
+ o,
121
126
  c,
122
- n,
123
- t.chipIndex
124
- ]), f(() => (p && window.addEventListener("scroll", I, !0), () => {
125
- window.removeEventListener("scroll", I, !0);
126
- }), [I, p]), f(() => {
127
- if (t.isEdit)
128
- return document.addEventListener("click", N, !0), () => {
129
- document.removeEventListener("click", N, !0);
127
+ i,
128
+ r.chipIndex
129
+ ]), h(() => (p && window.addEventListener("scroll", V, !0), () => {
130
+ window.removeEventListener("scroll", V, !0);
131
+ }), [V, p]), h(() => {
132
+ if (r.isEdit)
133
+ return document.addEventListener("click", E, !0), () => {
134
+ document.removeEventListener("click", E, !0);
130
135
  };
131
- }, [N, t.isEdit]);
132
- const he = W(
136
+ }, [E, r.isEdit]);
137
+ const ye = I(
133
138
  (e) => {
134
- if (t.chipIndex === n && d) {
135
- if (!e.shiftKey && e.key === J && t.isValueFocused)
136
- return _(e, J);
137
- if (e.shiftKey && e.key === J && t.isKeyFocused)
138
- return _(e, Ie);
139
+ if (r.chipIndex === i && u) {
140
+ if (!e.shiftKey && e.key === J && r.isValueFocused)
141
+ return q(e, J);
142
+ if (e.shiftKey && e.key === J && r.isKeyFocused)
143
+ return q(e, Ke);
139
144
  }
140
145
  e.stopPropagation();
141
146
  },
142
- [t, _, n, d]
143
- ), ee = W(
147
+ [r, q, i, u]
148
+ ), re = I(
144
149
  (e) => {
145
- const r = e.target.name === V;
146
- t.chipIndex === n ? (r ? (u.current.selectionStart = u.current.selectionEnd, L((s) => ({
150
+ const t = e.target.name === N;
151
+ r.chipIndex === i ? (t ? (o.current.selectionStart = o.current.selectionEnd, O((s) => ({
147
152
  ...s,
148
153
  isKeyFocused: !0,
149
154
  isValueFocused: !1
150
- }))) : (c.current.selectionStart = c.current.selectionEnd, L((s) => ({
155
+ }))) : (c.current.selectionStart = c.current.selectionEnd, O((s) => ({
151
156
  ...s,
152
157
  isKeyFocused: !1,
153
158
  isValueFocused: !0
154
- }))), e && e.stopPropagation()) : G(t.chipIndex) && (r ? u.current.selectionStart = u.current.selectionEnd : c.current.selectionStart = c.current.selectionEnd, L({
155
- chipIndex: n,
159
+ }))), e && e.stopPropagation()) : G(r.chipIndex) && (t ? o.current.selectionStart = o.current.selectionEnd : c.current.selectionStart = c.current.selectionEnd, O({
160
+ chipIndex: i,
156
161
  isEdit: !0,
157
- isKeyFocused: r,
158
- isValueFocused: !r
162
+ isKeyFocused: t,
163
+ isValueFocused: !t
159
164
  }));
160
165
  },
161
- [V, u, c, L, t.chipIndex, n]
162
- ), te = W(
166
+ [N, o, c, O, r.chipIndex, i]
167
+ ), te = I(
163
168
  (e) => {
164
169
  var s;
165
- const r = ((s = P.current) == null ? void 0 : s.clientWidth) - 50;
166
- if (e.preventDefault(), e.target.name === V) {
167
- const i = z(u.current);
168
- A((K) => ({
169
- ...K,
170
- key: u.current.value,
171
- keyFieldWidth: u.current.value.length <= 1 ? v : i >= r ? r : i > v ? i + 2 : v
170
+ const t = ((s = w.current) == null ? void 0 : s.clientWidth) - 50;
171
+ if (e.preventDefault(), e.target.name === N) {
172
+ const n = D(o.current);
173
+ A((_) => ({
174
+ ..._,
175
+ key: o.current.value,
176
+ keyFieldWidth: o.current.value.length <= 1 ? F : n >= t ? t : n > F ? n + 2 : F
172
177
  }));
173
178
  } else {
174
- const i = z(c.current);
175
- A((K) => {
176
- var q;
179
+ const n = D(c.current);
180
+ A((_) => {
181
+ var L;
177
182
  return {
178
- ...K,
183
+ ..._,
179
184
  value: c.current.value,
180
- valueFieldWidth: ((q = c.current.value) == null ? void 0 : q.length) <= 1 ? F : i >= r ? r : i > F ? i + 2 : F
185
+ valueFieldWidth: ((L = c.current.value) == null ? void 0 : L.length) <= 1 ? f : n >= t ? t : n > f ? n + 2 : f
181
186
  };
182
187
  });
183
188
  }
184
189
  },
185
- [V, v, P, F]
190
+ [N, F, w, f]
186
191
  );
187
- Fe(() => {
188
- t.chipIndex === n && ce(t.isKeyFocused ? "key" : t.isValueFocused ? "value" : null);
189
- }, [t.isKeyFocused, t.isValueFocused, t.chipIndex, n]), f(() => {
192
+ fe(() => {
193
+ r.chipIndex === i && ce(r.isKeyFocused ? "key" : r.isValueFocused ? "value" : null);
194
+ }, [r.isKeyFocused, r.isValueFocused, r.chipIndex, i]), h(() => {
190
195
  m.valid && p && B(!1);
191
- }, [m.valid, p]), f(() => {
192
- m.error && (oe((e) => {
193
- var r;
196
+ }, [m.valid, p]), h(() => {
197
+ m.error && (ae((e) => {
198
+ var t;
194
199
  return {
195
200
  ...e,
196
- [y]: (r = e[y]) == null ? void 0 : r.map((s) => ({
201
+ [v]: (t = e[v]) == null ? void 0 : t.map((s) => ({
197
202
  ...s,
198
- isValid: h(D(m, ["error", t.chipIndex, y], [])) ? !0 : !m.error[t.chipIndex][y].some(
199
- (i) => i && i.name === s.name
203
+ isValid: y(z(m, ["error", r.chipIndex, v], [])) ? !0 : !m.error[r.chipIndex][v].some(
204
+ (n) => n && n.name === s.name
200
205
  )
201
206
  }))
202
207
  };
203
208
  }), !p && B(!0));
204
- }, [m, p, y, t.chipIndex]);
205
- const ye = W(() => {
209
+ }, [m, p, v, r.chipIndex]);
210
+ const ve = I(() => {
206
211
  var e;
207
- return (e = U[y]) == null ? void 0 : e.map(({ isValid: r = !1, label: s, name: i }) => /* @__PURE__ */ k(be, { valid: r, validationMessage: s }, i));
208
- }, [y, U]);
209
- return /* @__PURE__ */ ve(
212
+ return (e = X[v]) == null ? void 0 : e.map(({ isValid: t = !1, label: s, name: n }) => /* @__PURE__ */ W(ke, { valid: t, validationMessage: s }, n));
213
+ }, [v, X]);
214
+ return /* @__PURE__ */ Fe(
210
215
  "div",
211
216
  {
212
- className: de,
213
- onKeyDown: (e) => !a.disabled && t.isEdit && he(e),
217
+ className: me,
218
+ onKeyDown: (e) => !d.disabled && r.isEdit && ye(e),
214
219
  ref: S,
215
220
  children: [
216
- /* @__PURE__ */ k(
217
- re,
221
+ /* @__PURE__ */ W(
222
+ se,
218
223
  {
219
- className: ae,
220
- disabled: a.disabled || !d || !G(t.chipIndex) && t.chipIndex !== n,
221
- name: V,
224
+ className: de,
225
+ disabled: d.disabled || !u || !G(r.chipIndex) && r.chipIndex !== i,
226
+ name: N,
222
227
  onChange: te,
223
- onFocus: ee,
224
- placeholder: "key",
225
- ref: u,
228
+ onFocus: re,
229
+ placeholder: u ? "key" : "",
230
+ ref: o,
226
231
  style: { width: l.keyFieldWidth }
227
232
  }
228
233
  ),
229
- !l.isKeyOnly && /* @__PURE__ */ k("div", { className: "edit-chip-separator", children: ":" }),
230
- !l.isKeyOnly && /* @__PURE__ */ k(
231
- re,
234
+ !l.isKeyOnly && /* @__PURE__ */ W("div", { className: "edit-chip-separator", children: ":" }),
235
+ !l.isKeyOnly && /* @__PURE__ */ W(
236
+ se,
232
237
  {
233
- className: me,
234
- disabled: a.disabled || !d || !G(t.chipIndex) && t.chipIndex !== n,
235
- name: ue,
238
+ className: pe,
239
+ disabled: d.disabled || !u || !G(r.chipIndex) && r.chipIndex !== i,
240
+ name: oe,
236
241
  onChange: te,
237
- onFocus: ee,
238
- placeholder: "value",
242
+ onFocus: re,
243
+ placeholder: u ? "value" : "",
239
244
  ref: c,
240
245
  style: { width: l.valueFieldWidth }
241
246
  }
242
247
  ),
243
- /* @__PURE__ */ k(
248
+ /* @__PURE__ */ W(
244
249
  "button",
245
250
  {
246
- disabled: a.disabled,
247
- className: pe,
248
- onClick: (e) => !a.disabled && ne(e, n),
249
- children: /* @__PURE__ */ k(Ve, {})
251
+ disabled: d.disabled,
252
+ className: he,
253
+ onClick: (e) => !d.disabled && le(e, i),
254
+ children: /* @__PURE__ */ W(_e, {})
250
255
  }
251
256
  ),
252
- !a.disabled && (t.isKeyFocused ? !h(l.key) : !h(l.value)) && t.chipIndex === n && !h(D(m, ["error", t.chipIndex, y], [])) && /* @__PURE__ */ k(Re, { show: p, ref: { refInputContainer: S, validationRulesRef: E }, children: ye() })
257
+ !d.disabled && (r.isKeyFocused ? !y(l.key) : !y(l.value)) && r.chipIndex === i && !y(z(m, ["error", r.chipIndex, v], [])) && /* @__PURE__ */ W(be, { show: p, ref: { refInputContainer: S, validationRulesRef: x }, children: ve() })
253
258
  ]
254
259
  }
255
260
  );
256
261
  };
257
- x = fe(x);
258
- x.displayName = "NewChipForm";
259
- x.propTypes = {
260
- chip: o.object.isRequired,
261
- chipIndex: o.number.isRequired,
262
- chipOptions: ke.isRequired,
263
- className: o.string,
264
- editConfig: o.object.isRequired,
265
- handleRemoveChip: o.func.isRequired,
266
- isEditable: o.bool.isRequired,
267
- keyName: o.string.isRequired,
268
- meta: o.object.isRequired,
269
- onChange: o.func.isRequired,
270
- setChipSizeIsRecalculated: o.func.isRequired,
271
- setEditConfig: o.func.isRequired,
272
- validationRules: o.object,
273
- valueName: o.string.isRequired
262
+ P = we(P);
263
+ P.displayName = "NewChipForm";
264
+ P.propTypes = {
265
+ chip: a.object.isRequired,
266
+ chipIndex: a.number.isRequired,
267
+ chipOptions: We.isRequired,
268
+ className: a.string,
269
+ editConfig: a.object.isRequired,
270
+ handleRemoveChip: a.func.isRequired,
271
+ isDeletable: a.bool.isRequired,
272
+ isEditable: a.bool.isRequired,
273
+ keyName: a.string.isRequired,
274
+ meta: a.object.isRequired,
275
+ onChange: a.func.isRequired,
276
+ setChipSizeIsRecalculated: a.func.isRequired,
277
+ setEditConfig: a.func.isRequired,
278
+ validationRules: a.object,
279
+ valueName: a.string.isRequired
274
280
  };
275
- const Be = x;
281
+ const Me = P;
276
282
  export {
277
- Be as default
283
+ Me as default
278
284
  };
279
285
  //# sourceMappingURL=NewChipForm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewChipForm.mjs","sources":["../../../../src/lib/components/FormChipCell/NewChipForm/NewChipForm.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, {\n useState,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n forwardRef\n} from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport { isEmpty, get, isNil, throttle } from 'lodash'\n\nimport NewChipInput from '../NewChipInput/NewChipInput'\nimport OptionsMenu from '../../../elements/OptionsMenu/OptionsMenu'\nimport ValidationTemplate from '../../../elements/ValidationTemplate/ValidationTemplate'\n\nimport { CHIP_OPTIONS } from '../../../types'\nimport { CLICK, TAB, TAB_SHIFT } from '../../../constants'\nimport { getTextWidth } from '../formChipCell.util'\nimport { getTransitionEndEventName } from '../../../utils/common.util'\n\nimport Close from '../../../images/close.svg?react'\n\nimport './newChipForm.scss'\n\nconst defaultProps = {\n rules: {}\n}\n\nlet NewChipForm = (\n {\n chip,\n chipIndex,\n chipOptions,\n className = '',\n editConfig,\n handleRemoveChip,\n isEditable,\n keyName,\n meta,\n onChange,\n setChipSizeIsRecalculated,\n setEditConfig,\n validationRules: rules = defaultProps.rules,\n valueName\n },\n ref\n) => {\n const [chipData, setChipData] = useState({\n isKeyOnly: chip.isKeyOnly,\n key: chip.key,\n value: chip.value,\n keyFieldWidth: 0,\n valueFieldWidth: 0\n })\n const [selectedInput, setSelectedInput] = useState('key')\n const [validationRules, setValidationRules] = useState(rules)\n const [showValidationRules, setShowValidationRules] = useState(false)\n\n const { background, borderColor, borderRadius, density, font } = chipOptions\n const minWidthInput = useMemo(() => {\n return isEditable ? 25 : 20\n }, [isEditable])\n const minWidthValueInput = useMemo(() => {\n return isEditable ? 35 : 20\n }, [isEditable])\n const transitionEndEventName = useMemo(() => getTransitionEndEventName(), [])\n\n const refInputKey = React.useRef({})\n const refInputValue = React.useRef({})\n const refInputContainer = React.useRef()\n const validationRulesRef = React.useRef()\n\n const labelKeyClassName = classnames(\n className,\n !editConfig.isKeyFocused && 'item_edited',\n !isEmpty(get(meta, ['error', chipIndex, 'key'], [])) &&\n !isEmpty(chipData.key) &&\n !chip.disabled &&\n 'item_edited_invalid'\n )\n const labelContainerClassName = classnames(\n 'edit-chip-container',\n background && `edit-chip-container-background_${background}`,\n borderColor && `edit-chip-container-border_${borderColor}`,\n font && `edit-chip-container-font_${font}`,\n density && `edit-chip-container-density_${density}`,\n borderRadius && `edit-chip-container-border_${borderRadius}`,\n (editConfig.isEdit || editConfig.isNewChip) && 'edit-chip-container_edited',\n chip.disabled && 'edit-chip-container_disabled edit-chip-container-font_disabled'\n )\n const labelValueClassName = classnames(\n 'input-label-value',\n !editConfig.isValueFocused && 'item_edited',\n !isEmpty(get(meta, ['error', chipIndex, 'value'], [])) &&\n !isEmpty(chipData.value) &&\n 'item_edited_invalid'\n )\n\n const closeButtonClass = classnames(\n 'item-icon-close',\n !chip.disabled &&\n editConfig.chipIndex === chipIndex &&\n isEditable &&\n 'item-icon-close_invisible',\n !isEditable && 'item-icon-close_hidden'\n )\n\n const resizeChip = useCallback(() => {\n if (refInputKey.current) {\n const currentWidthKeyInput = getTextWidth(refInputKey.current) + 1\n const currentWidthValueInput = getTextWidth(refInputValue.current) + 1\n const maxWidthInput = ref.current?.clientWidth - 50\n const keyEllipsis = currentWidthKeyInput >= maxWidthInput / 2\n const valueEllipsis = currentWidthValueInput >= maxWidthInput / 2\n let keyFieldWidth = null\n let valueFieldWidth = null\n\n if (keyEllipsis && valueEllipsis) {\n keyFieldWidth = valueFieldWidth = maxWidthInput / 2\n } else if (keyEllipsis) {\n valueFieldWidth = !chipData.value ? minWidthValueInput : currentWidthValueInput\n\n const remainingPlace = maxWidthInput - valueFieldWidth\n\n keyFieldWidth =\n remainingPlace > currentWidthKeyInput ? currentWidthKeyInput : remainingPlace\n } else if (valueEllipsis) {\n keyFieldWidth = !chipData.key ? minWidthInput : currentWidthKeyInput\n\n const remainingPlace = maxWidthInput - keyFieldWidth\n\n valueFieldWidth =\n remainingPlace > currentWidthValueInput ? currentWidthValueInput : remainingPlace\n } else {\n keyFieldWidth =\n !chipData.key || currentWidthKeyInput <= minWidthInput\n ? minWidthInput\n : currentWidthKeyInput\n valueFieldWidth =\n !chipData.value || currentWidthValueInput <= minWidthValueInput\n ? minWidthValueInput\n : currentWidthValueInput\n }\n\n refInputKey.current.style.width = `${keyFieldWidth}px`\n\n if (!isEmpty(refInputValue.current)) {\n refInputValue.current.style.width = `${valueFieldWidth}px`\n }\n\n setChipData(prevState => ({\n ...prevState,\n keyFieldWidth,\n valueFieldWidth\n }))\n setChipSizeIsRecalculated(true)\n }\n }, [\n chipData.key,\n chipData.value,\n minWidthInput,\n minWidthValueInput,\n ref,\n setChipSizeIsRecalculated\n ])\n\n useEffect(() => {\n const resizeChipDebounced = throttle(resizeChip, 500)\n\n if (isEditable) {\n window.addEventListener('resize', resizeChipDebounced)\n window.addEventListener(transitionEndEventName, resizeChipDebounced)\n\n return () => {\n window.removeEventListener('resize', resizeChipDebounced)\n window.removeEventListener(transitionEndEventName, resizeChipDebounced)\n }\n }\n }, [isEditable, resizeChip, transitionEndEventName])\n\n useEffect(() => {\n if (!chipData.keyFieldWidth && !chipData.valueFieldWidth) {\n resizeChip()\n }\n }, [chipData.keyFieldWidth, chipData.valueFieldWidth, resizeChip])\n\n const outsideClick = useCallback(\n (event, forceOutsideClick) => {\n if (editConfig.chipIndex === chipIndex) {\n const elementPath = event.path ?? event.composedPath?.()\n\n if (!elementPath.includes(refInputContainer.current) || forceOutsideClick) {\n onChange(event, CLICK, true)\n window.getSelection().removeAllRanges()\n document.activeElement.blur()\n } else {\n event.stopPropagation()\n }\n }\n },\n [onChange, refInputContainer, chipIndex, editConfig.chipIndex]\n )\n\n const handleScroll = useCallback(\n event => {\n if (validationRulesRef?.current && !validationRulesRef.current.contains(event.target)) {\n setShowValidationRules(false)\n outsideClick(event, true)\n }\n },\n [outsideClick]\n )\n\n useEffect(() => {\n if (showValidationRules) {\n window.addEventListener('scroll', handleScroll, true)\n }\n return () => {\n window.removeEventListener('scroll', handleScroll, true)\n }\n }, [handleScroll, showValidationRules])\n\n useEffect(() => {\n if (editConfig.chipIndex === chipIndex) {\n if (editConfig.isKeyFocused) {\n refInputKey.current.focus()\n } else if (editConfig.isValueFocused) {\n refInputValue.current.focus()\n }\n }\n }, [\n editConfig.isKeyFocused,\n editConfig.isValueFocused,\n refInputKey,\n refInputValue,\n chipIndex,\n editConfig.chipIndex\n ])\n\n useEffect(() => {\n if (showValidationRules) {\n window.addEventListener('scroll', handleScroll, true)\n }\n return () => {\n window.removeEventListener('scroll', handleScroll, true)\n }\n }, [handleScroll, showValidationRules])\n\n useEffect(() => {\n if (editConfig.isEdit) {\n document.addEventListener('click', outsideClick, true)\n\n return () => {\n document.removeEventListener('click', outsideClick, true)\n }\n }\n }, [outsideClick, editConfig.isEdit])\n\n const focusChip = useCallback(\n event => {\n if (editConfig.chipIndex === chipIndex && isEditable) {\n if (!event.shiftKey && event.key === TAB && editConfig.isValueFocused) {\n return onChange(event, TAB)\n } else if (event.shiftKey && event.key === TAB && editConfig.isKeyFocused) {\n return onChange(event, TAB_SHIFT)\n }\n }\n event.stopPropagation()\n },\n [editConfig, onChange, chipIndex, isEditable]\n )\n\n const handleOnFocus = useCallback(\n event => {\n const isKeyFocused = event.target.name === keyName\n\n if (editConfig.chipIndex === chipIndex) {\n if (isKeyFocused) {\n refInputKey.current.selectionStart = refInputKey.current.selectionEnd\n\n setEditConfig(prevConfig => ({\n ...prevConfig,\n isKeyFocused: true,\n isValueFocused: false\n }))\n } else {\n refInputValue.current.selectionStart = refInputValue.current.selectionEnd\n\n setEditConfig(prevConfig => ({\n ...prevConfig,\n isKeyFocused: false,\n isValueFocused: true\n }))\n }\n\n event && event.stopPropagation()\n } else if (isNil(editConfig.chipIndex)) {\n if (isKeyFocused) {\n refInputKey.current.selectionStart = refInputKey.current.selectionEnd\n } else {\n refInputValue.current.selectionStart = refInputValue.current.selectionEnd\n }\n setEditConfig({\n chipIndex,\n isEdit: true,\n isKeyFocused: isKeyFocused,\n isValueFocused: !isKeyFocused\n })\n }\n },\n [keyName, refInputKey, refInputValue, setEditConfig, editConfig.chipIndex, chipIndex]\n )\n\n const handleOnChange = useCallback(\n event => {\n const maxWidthInput = ref.current?.clientWidth - 50\n\n event.preventDefault()\n\n if (event.target.name === keyName) {\n const currentWidthKeyInput = getTextWidth(refInputKey.current)\n\n setChipData(prevState => ({\n ...prevState,\n key: refInputKey.current.value,\n keyFieldWidth:\n refInputKey.current.value.length <= 1\n ? minWidthInput\n : currentWidthKeyInput >= maxWidthInput\n ? maxWidthInput\n : currentWidthKeyInput > minWidthInput\n ? currentWidthKeyInput + 2\n : minWidthInput\n }))\n } else {\n const currentWidthValueInput = getTextWidth(refInputValue.current)\n\n setChipData(prevState => ({\n ...prevState,\n value: refInputValue.current.value,\n valueFieldWidth:\n refInputValue.current.value?.length <= 1\n ? minWidthValueInput\n : currentWidthValueInput >= maxWidthInput\n ? maxWidthInput\n : currentWidthValueInput > minWidthValueInput\n ? currentWidthValueInput + 2\n : minWidthValueInput\n }))\n }\n },\n [keyName, minWidthInput, ref, minWidthValueInput]\n )\n\n useLayoutEffect(() => {\n if (editConfig.chipIndex === chipIndex) {\n setSelectedInput(editConfig.isKeyFocused ? 'key' : editConfig.isValueFocused ? 'value' : null)\n }\n }, [editConfig.isKeyFocused, editConfig.isValueFocused, editConfig.chipIndex, chipIndex])\n\n useEffect(() => {\n if (meta.valid && showValidationRules) {\n setShowValidationRules(false)\n }\n }, [meta.valid, showValidationRules])\n\n useEffect(() => {\n if (meta.error) {\n setValidationRules(prevState => {\n return {\n ...prevState,\n [selectedInput]: prevState[selectedInput]?.map(rule => {\n return {\n ...rule,\n isValid: isEmpty(get(meta, ['error', editConfig.chipIndex, selectedInput], []))\n ? true\n : !meta.error[editConfig.chipIndex][selectedInput].some(\n err => err && err.name === rule.name\n )\n }\n })\n }\n })\n\n !showValidationRules && setShowValidationRules(true)\n }\n }, [meta, showValidationRules, selectedInput, editConfig.chipIndex])\n\n const getValidationRules = useCallback(() => {\n return validationRules[selectedInput]?.map(({ isValid = false, label, name }) => {\n return <ValidationTemplate valid={isValid} validationMessage={label} key={name} />\n })\n }, [selectedInput, validationRules])\n\n return (\n <div\n className={labelContainerClassName}\n onKeyDown={event => !chip.disabled && editConfig.isEdit && focusChip(event)}\n ref={refInputContainer}\n >\n <NewChipInput\n className={labelKeyClassName}\n disabled={\n chip.disabled ||\n !isEditable ||\n (!isNil(editConfig.chipIndex) && editConfig.chipIndex !== chipIndex)\n }\n name={keyName}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n placeholder=\"key\"\n ref={refInputKey}\n style={{ width: chipData.keyFieldWidth }}\n />\n {!chipData.isKeyOnly && <div className=\"edit-chip-separator\">:</div>}\n {!chipData.isKeyOnly && (\n <NewChipInput\n className={labelValueClassName}\n disabled={\n chip.disabled ||\n !isEditable ||\n (!isNil(editConfig.chipIndex) && editConfig.chipIndex !== chipIndex)\n }\n name={valueName}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n placeholder=\"value\"\n ref={refInputValue}\n style={{ width: chipData.valueFieldWidth }}\n />\n )}\n\n <button\n disabled={chip.disabled}\n className={closeButtonClass}\n onClick={event => !chip.disabled && handleRemoveChip(event, chipIndex)}\n >\n <Close />\n </button>\n\n {!chip.disabled &&\n (editConfig.isKeyFocused ? !isEmpty(chipData.key) : !isEmpty(chipData.value)) &&\n editConfig.chipIndex === chipIndex &&\n !isEmpty(get(meta, ['error', editConfig.chipIndex, selectedInput], [])) && (\n <OptionsMenu show={showValidationRules} ref={{ refInputContainer, validationRulesRef }}>\n {getValidationRules()}\n </OptionsMenu>\n )}\n </div>\n )\n}\n\nNewChipForm = forwardRef(NewChipForm)\n\nNewChipForm.displayName = 'NewChipForm'\n\nNewChipForm.propTypes = {\n chip: PropTypes.object.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS.isRequired,\n className: PropTypes.string,\n editConfig: PropTypes.object.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n isEditable: PropTypes.bool.isRequired,\n keyName: PropTypes.string.isRequired,\n meta: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string.isRequired\n}\n\nexport default NewChipForm\n"],"names":["defaultProps","NewChipForm","chip","chipIndex","chipOptions","className","editConfig","handleRemoveChip","isEditable","keyName","meta","onChange","setChipSizeIsRecalculated","setEditConfig","rules","valueName","ref","chipData","setChipData","useState","selectedInput","setSelectedInput","validationRules","setValidationRules","showValidationRules","setShowValidationRules","background","borderColor","borderRadius","density","font","minWidthInput","useMemo","minWidthValueInput","transitionEndEventName","getTransitionEndEventName","refInputKey","React","refInputValue","refInputContainer","validationRulesRef","labelKeyClassName","classnames","isEmpty","get","labelContainerClassName","labelValueClassName","closeButtonClass","resizeChip","useCallback","currentWidthKeyInput","getTextWidth","currentWidthValueInput","maxWidthInput","_a","keyEllipsis","valueEllipsis","keyFieldWidth","valueFieldWidth","remainingPlace","prevState","useEffect","resizeChipDebounced","throttle","outsideClick","event","forceOutsideClick","CLICK","handleScroll","focusChip","TAB","TAB_SHIFT","handleOnFocus","isKeyFocused","prevConfig","isNil","handleOnChange","useLayoutEffect","rule","err","getValidationRules","isValid","label","name","ValidationTemplate","jsxs","jsx","NewChipInput","Close","OptionsMenu","forwardRef","PropTypes","CHIP_OPTIONS","NewChipForm$1"],"mappings":";;;;;;;;;;;;;;AAyCA,MAAMA,KAAe;AAAA,EACnB,OAAO,CAAA;AACT;AAEA,IAAIC,IAAc,CAChB;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,KAAY;AAAA,EACZ,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAiBC,KAAQd,GAAa;AAAA,EACtC,WAAAe;AACF,GACAC,MACG;AACH,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS;AAAA,IACvC,WAAWjB,EAAK;AAAA,IAChB,KAAKA,EAAK;AAAA,IACV,OAAOA,EAAK;AAAA,IACZ,eAAe;AAAA,IACf,iBAAiB;AAAA,EAA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ACqF,IAAM,CAAA,CAAA;AAAA,UAAA;AAAA,QACT;AAAA,QAEC,CAACtF,EAAK,aACJI,EAAW,eAAe,CAACqC,EAAQ1B,EAAS,GAAG,IAAI,CAAC0B,EAAQ1B,EAAS,KAAK,MAC3EX,EAAW,cAAcH,KACzB,CAACwC,EAAQC,EAAIlC,GAAM,CAAC,SAASJ,EAAW,WAAWc,CAAa,GAAG,CAAE,CAAA,CAAC,uBACnEqE,IAAY,EAAA,MAAMjE,GAAqB,KAAK,EAAE,mBAAAe,GAAmB,oBAAAC,KAC/D,eACH,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN;AAEJ;AAEAvC,IAAcyF,GAAWzF,CAAW;AAEpCA,EAAY,cAAc;AAE1BA,EAAY,YAAY;AAAA,EACtB,MAAM0F,EAAU,OAAO;AAAA,EACvB,WAAWA,EAAU,OAAO;AAAA,EAC5B,aAAaC,GAAa;AAAA,EAC1B,WAAWD,EAAU;AAAA,EACrB,YAAYA,EAAU,OAAO;AAAA,EAC7B,kBAAkBA,EAAU,KAAK;AAAA,EACjC,YAAYA,EAAU,KAAK;AAAA,EAC3B,SAASA,EAAU,OAAO;AAAA,EAC1B,MAAMA,EAAU,OAAO;AAAA,EACvB,UAAUA,EAAU,KAAK;AAAA,EACzB,2BAA2BA,EAAU,KAAK;AAAA,EAC1C,eAAeA,EAAU,KAAK;AAAA,EAC9B,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU,OAAO;AAC9B;AAEA,MAAAE,KAAe5F;"}
1
+ {"version":3,"file":"NewChipForm.mjs","sources":["../../../../src/lib/components/FormChipCell/NewChipForm/NewChipForm.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, {\n useState,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n forwardRef\n} from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport { isEmpty, get, isNil, throttle } from 'lodash'\n\nimport NewChipInput from '../NewChipInput/NewChipInput'\nimport OptionsMenu from '../../../elements/OptionsMenu/OptionsMenu'\nimport ValidationTemplate from '../../../elements/ValidationTemplate/ValidationTemplate'\n\nimport { CHIP_OPTIONS } from '../../../types'\nimport { CLICK, TAB, TAB_SHIFT } from '../../../constants'\nimport { getTextWidth } from '../formChipCell.util'\nimport { getTransitionEndEventName } from '../../../utils/common.util'\n\nimport Close from '../../../images/close.svg?react'\n\nimport './newChipForm.scss'\n\nconst defaultProps = {\n rules: {}\n}\n\nlet NewChipForm = (\n {\n chip,\n chipIndex,\n chipOptions,\n className = '',\n editConfig,\n handleRemoveChip,\n isDeletable,\n isEditable,\n keyName,\n meta,\n onChange,\n setChipSizeIsRecalculated,\n setEditConfig,\n validationRules: rules = defaultProps.rules,\n valueName\n },\n ref\n) => {\n const [chipData, setChipData] = useState({\n isKeyOnly: chip.isKeyOnly,\n key: chip.key,\n value: chip.value,\n keyFieldWidth: 0,\n valueFieldWidth: 0\n })\n const [selectedInput, setSelectedInput] = useState('key')\n const [validationRules, setValidationRules] = useState(rules)\n const [showValidationRules, setShowValidationRules] = useState(false)\n\n const { background, borderColor, borderRadius, density, font } = chipOptions\n const minWidthInput = useMemo(() => {\n return isEditable ? 25 : 20\n }, [isEditable])\n const minWidthValueInput = useMemo(() => {\n return isEditable ? 35 : 20\n }, [isEditable])\n const transitionEndEventName = useMemo(() => getTransitionEndEventName(), [])\n\n const refInputKey = React.useRef({})\n const refInputValue = React.useRef({})\n const refInputContainer = React.useRef()\n const validationRulesRef = React.useRef()\n\n const labelKeyClassName = classnames(\n className,\n !editConfig.isKeyFocused && 'item_edited',\n !isEmpty(get(meta, ['error', chipIndex, 'key'], [])) &&\n !isEmpty(chipData.key) &&\n !chip.disabled &&\n isEditable &&\n 'item_edited_invalid'\n )\n const labelContainerClassName = classnames(\n 'edit-chip-container',\n background && `edit-chip-container-background_${background}`,\n borderColor && `edit-chip-container-border_${borderColor}`,\n font && `edit-chip-container-font_${font}`,\n density && `edit-chip-container-density_${density}`,\n borderRadius && `edit-chip-container-border_${borderRadius}`,\n (editConfig.isEdit || editConfig.isNewChip) && 'edit-chip-container_edited',\n isEditable && chip.disabled && 'edit-chip-container_disabled edit-chip-container-font_disabled'\n )\n const labelValueClassName = classnames(\n 'input-label-value',\n !editConfig.isValueFocused && 'item_edited',\n !isEmpty(get(meta, ['error', chipIndex, 'value'], [])) &&\n !isEmpty(chipData.value) &&\n isEditable &&\n 'item_edited_invalid'\n )\n\n const closeButtonClass = classnames(\n 'item-icon-close',\n !chip.disabled &&\n ((editConfig.chipIndex === chipIndex && isEditable) || !isDeletable) &&\n 'item-icon-close invisible',\n !isEditable && !isDeletable && 'item-icon-close hidden'\n )\n\n const resizeChip = useCallback(() => {\n if (refInputKey.current) {\n const currentWidthKeyInput = getTextWidth(refInputKey.current) + 1\n const currentWidthValueInput = getTextWidth(refInputValue.current) + 1\n const maxWidthInput = ref.current?.clientWidth - 50\n const keyEllipsis = currentWidthKeyInput >= maxWidthInput / 2\n const valueEllipsis = currentWidthValueInput >= maxWidthInput / 2\n let keyFieldWidth = null\n let valueFieldWidth = null\n\n if (keyEllipsis && valueEllipsis) {\n keyFieldWidth = valueFieldWidth = maxWidthInput / 2\n } else if (keyEllipsis) {\n valueFieldWidth = !chipData.value ? minWidthValueInput : currentWidthValueInput\n\n const remainingPlace = maxWidthInput - valueFieldWidth\n\n keyFieldWidth =\n remainingPlace > currentWidthKeyInput ? currentWidthKeyInput : remainingPlace\n } else if (valueEllipsis) {\n keyFieldWidth = !chipData.key ? minWidthInput : currentWidthKeyInput\n\n const remainingPlace = maxWidthInput - keyFieldWidth\n\n valueFieldWidth =\n remainingPlace > currentWidthValueInput ? currentWidthValueInput : remainingPlace\n } else {\n keyFieldWidth =\n !chipData.key || currentWidthKeyInput <= minWidthInput\n ? minWidthInput\n : currentWidthKeyInput\n valueFieldWidth =\n !chipData.value || currentWidthValueInput <= minWidthValueInput\n ? minWidthValueInput\n : currentWidthValueInput\n }\n\n refInputKey.current.style.width = `${keyFieldWidth}px`\n\n if (!isEmpty(refInputValue.current)) {\n refInputValue.current.style.width = `${valueFieldWidth}px`\n }\n\n setChipData(prevState => ({\n ...prevState,\n keyFieldWidth,\n valueFieldWidth\n }))\n setChipSizeIsRecalculated(true)\n }\n }, [\n chipData.key,\n chipData.value,\n minWidthInput,\n minWidthValueInput,\n ref,\n setChipSizeIsRecalculated\n ])\n\n useEffect(() => {\n if (!ref.current) return\n\n const element = ref.current\n const observer = new ResizeObserver(resizeChip)\n\n observer.observe(element)\n\n return () => observer.unobserve(element)\n }, [ref, resizeChip])\n\n useEffect(() => {\n const resizeChipDebounced = throttle(resizeChip, 500)\n\n if (isEditable) {\n window.addEventListener('resize', resizeChipDebounced)\n window.addEventListener(transitionEndEventName, resizeChipDebounced)\n\n return () => {\n window.removeEventListener('resize', resizeChipDebounced)\n window.removeEventListener(transitionEndEventName, resizeChipDebounced)\n }\n }\n }, [isEditable, resizeChip, transitionEndEventName])\n\n useEffect(() => {\n if (!chipData.keyFieldWidth && !chipData.valueFieldWidth) {\n resizeChip()\n }\n }, [chipData.keyFieldWidth, chipData.valueFieldWidth, resizeChip])\n\n const outsideClick = useCallback(\n (event, forceOutsideClick) => {\n if (editConfig.chipIndex === chipIndex) {\n const elementPath = event.path ?? event.composedPath?.()\n\n if (!elementPath.includes(refInputContainer.current) || forceOutsideClick) {\n onChange(event, CLICK, true)\n window.getSelection().removeAllRanges()\n document.activeElement.blur()\n } else {\n event.stopPropagation()\n }\n }\n },\n [onChange, refInputContainer, chipIndex, editConfig.chipIndex]\n )\n\n const handleScroll = useCallback(\n event => {\n if (validationRulesRef?.current && !validationRulesRef.current.contains(event.target)) {\n setShowValidationRules(false)\n outsideClick(event, true)\n }\n },\n [outsideClick]\n )\n\n useEffect(() => {\n if (showValidationRules) {\n window.addEventListener('scroll', handleScroll, true)\n }\n return () => {\n window.removeEventListener('scroll', handleScroll, true)\n }\n }, [handleScroll, showValidationRules])\n\n useEffect(() => {\n if (editConfig.chipIndex === chipIndex) {\n if (editConfig.isKeyFocused) {\n refInputKey.current.focus()\n } else if (editConfig.isValueFocused) {\n refInputValue.current.focus()\n }\n }\n }, [\n editConfig.isKeyFocused,\n editConfig.isValueFocused,\n refInputKey,\n refInputValue,\n chipIndex,\n editConfig.chipIndex\n ])\n\n useEffect(() => {\n if (showValidationRules) {\n window.addEventListener('scroll', handleScroll, true)\n }\n return () => {\n window.removeEventListener('scroll', handleScroll, true)\n }\n }, [handleScroll, showValidationRules])\n\n useEffect(() => {\n if (editConfig.isEdit) {\n document.addEventListener('click', outsideClick, true)\n\n return () => {\n document.removeEventListener('click', outsideClick, true)\n }\n }\n }, [outsideClick, editConfig.isEdit])\n\n const focusChip = useCallback(\n event => {\n if (editConfig.chipIndex === chipIndex && isEditable) {\n if (!event.shiftKey && event.key === TAB && editConfig.isValueFocused) {\n return onChange(event, TAB)\n } else if (event.shiftKey && event.key === TAB && editConfig.isKeyFocused) {\n return onChange(event, TAB_SHIFT)\n }\n }\n event.stopPropagation()\n },\n [editConfig, onChange, chipIndex, isEditable]\n )\n\n const handleOnFocus = useCallback(\n event => {\n const isKeyFocused = event.target.name === keyName\n\n if (editConfig.chipIndex === chipIndex) {\n if (isKeyFocused) {\n refInputKey.current.selectionStart = refInputKey.current.selectionEnd\n\n setEditConfig(prevConfig => ({\n ...prevConfig,\n isKeyFocused: true,\n isValueFocused: false\n }))\n } else {\n refInputValue.current.selectionStart = refInputValue.current.selectionEnd\n\n setEditConfig(prevConfig => ({\n ...prevConfig,\n isKeyFocused: false,\n isValueFocused: true\n }))\n }\n\n event && event.stopPropagation()\n } else if (isNil(editConfig.chipIndex)) {\n if (isKeyFocused) {\n refInputKey.current.selectionStart = refInputKey.current.selectionEnd\n } else {\n refInputValue.current.selectionStart = refInputValue.current.selectionEnd\n }\n setEditConfig({\n chipIndex,\n isEdit: true,\n isKeyFocused: isKeyFocused,\n isValueFocused: !isKeyFocused\n })\n }\n },\n [keyName, refInputKey, refInputValue, setEditConfig, editConfig.chipIndex, chipIndex]\n )\n\n const handleOnChange = useCallback(\n event => {\n const maxWidthInput = ref.current?.clientWidth - 50\n\n event.preventDefault()\n\n if (event.target.name === keyName) {\n const currentWidthKeyInput = getTextWidth(refInputKey.current)\n\n setChipData(prevState => ({\n ...prevState,\n key: refInputKey.current.value,\n keyFieldWidth:\n refInputKey.current.value.length <= 1\n ? minWidthInput\n : currentWidthKeyInput >= maxWidthInput\n ? maxWidthInput\n : currentWidthKeyInput > minWidthInput\n ? currentWidthKeyInput + 2\n : minWidthInput\n }))\n } else {\n const currentWidthValueInput = getTextWidth(refInputValue.current)\n\n setChipData(prevState => ({\n ...prevState,\n value: refInputValue.current.value,\n valueFieldWidth:\n refInputValue.current.value?.length <= 1\n ? minWidthValueInput\n : currentWidthValueInput >= maxWidthInput\n ? maxWidthInput\n : currentWidthValueInput > minWidthValueInput\n ? currentWidthValueInput + 2\n : minWidthValueInput\n }))\n }\n },\n [keyName, minWidthInput, ref, minWidthValueInput]\n )\n\n useLayoutEffect(() => {\n if (editConfig.chipIndex === chipIndex) {\n setSelectedInput(editConfig.isKeyFocused ? 'key' : editConfig.isValueFocused ? 'value' : null)\n }\n }, [editConfig.isKeyFocused, editConfig.isValueFocused, editConfig.chipIndex, chipIndex])\n\n useEffect(() => {\n if (meta.valid && showValidationRules) {\n setShowValidationRules(false)\n }\n }, [meta.valid, showValidationRules])\n\n useEffect(() => {\n if (meta.error) {\n setValidationRules(prevState => {\n return {\n ...prevState,\n [selectedInput]: prevState[selectedInput]?.map(rule => {\n return {\n ...rule,\n isValid: isEmpty(get(meta, ['error', editConfig.chipIndex, selectedInput], []))\n ? true\n : !meta.error[editConfig.chipIndex][selectedInput].some(\n err => err && err.name === rule.name\n )\n }\n })\n }\n })\n\n !showValidationRules && setShowValidationRules(true)\n }\n }, [meta, showValidationRules, selectedInput, editConfig.chipIndex])\n\n const getValidationRules = useCallback(() => {\n return validationRules[selectedInput]?.map(({ isValid = false, label, name }) => {\n return <ValidationTemplate valid={isValid} validationMessage={label} key={name} />\n })\n }, [selectedInput, validationRules])\n\n return (\n <div\n className={labelContainerClassName}\n onKeyDown={event => !chip.disabled && editConfig.isEdit && focusChip(event)}\n ref={refInputContainer}\n >\n <NewChipInput\n className={labelKeyClassName}\n disabled={\n chip.disabled ||\n !isEditable ||\n (!isNil(editConfig.chipIndex) && editConfig.chipIndex !== chipIndex)\n }\n name={keyName}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n placeholder={isEditable ? 'key' : ''}\n ref={refInputKey}\n style={{ width: chipData.keyFieldWidth }}\n />\n {!chipData.isKeyOnly && <div className=\"edit-chip-separator\">:</div>}\n {!chipData.isKeyOnly && (\n <NewChipInput\n className={labelValueClassName}\n disabled={\n chip.disabled ||\n !isEditable ||\n (!isNil(editConfig.chipIndex) && editConfig.chipIndex !== chipIndex)\n }\n name={valueName}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n placeholder={isEditable ? 'value' : ''}\n ref={refInputValue}\n style={{ width: chipData.valueFieldWidth }}\n />\n )}\n\n <button\n disabled={chip.disabled}\n className={closeButtonClass}\n onClick={event => !chip.disabled && handleRemoveChip(event, chipIndex)}\n >\n <Close />\n </button>\n\n {!chip.disabled &&\n (editConfig.isKeyFocused ? !isEmpty(chipData.key) : !isEmpty(chipData.value)) &&\n editConfig.chipIndex === chipIndex &&\n !isEmpty(get(meta, ['error', editConfig.chipIndex, selectedInput], [])) && (\n <OptionsMenu show={showValidationRules} ref={{ refInputContainer, validationRulesRef }}>\n {getValidationRules()}\n </OptionsMenu>\n )}\n </div>\n )\n}\n\nNewChipForm = forwardRef(NewChipForm)\n\nNewChipForm.displayName = 'NewChipForm'\n\nNewChipForm.propTypes = {\n chip: PropTypes.object.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS.isRequired,\n className: PropTypes.string,\n editConfig: PropTypes.object.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n isDeletable: PropTypes.bool.isRequired,\n isEditable: PropTypes.bool.isRequired,\n keyName: PropTypes.string.isRequired,\n meta: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string.isRequired\n}\n\nexport default NewChipForm\n"],"names":["defaultProps","NewChipForm","chip","chipIndex","chipOptions","className","editConfig","handleRemoveChip","isDeletable","isEditable","keyName","meta","onChange","setChipSizeIsRecalculated","setEditConfig","rules","valueName","ref","chipData","setChipData","useState","selectedInput","setSelectedInput","validationRules","setValidationRules","showValidationRules","setShowValidationRules","background","borderColor","borderRadius","density","font","minWidthInput","useMemo","minWidthValueInput","transitionEndEventName","getTransitionEndEventName","refInputKey","React","refInputValue","refInputContainer","validationRulesRef","labelKeyClassName","classnames","isEmpty","get","labelContainerClassName","labelValueClassName","closeButtonClass","resizeChip","useCallback","currentWidthKeyInput","getTextWidth","currentWidthValueInput","maxWidthInput","_a","keyEllipsis","valueEllipsis","keyFieldWidth","valueFieldWidth","remainingPlace","prevState","useEffect","element","observer","resizeChipDebounced","throttle","outsideClick","event","forceOutsideClick","CLICK","handleScroll","focusChip","TAB","TAB_SHIFT","handleOnFocus","isKeyFocused","prevConfig","isNil","handleOnChange","useLayoutEffect","rule","err","getValidationRules","isValid","label","name","ValidationTemplate","jsxs","jsx","NewChipInput","Close","OptionsMenu","forward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AAAe,GAAmB,oBAAAC,KAC/D,eACH,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN;AAEJ;AAEAxC,IAAc4F,GAAW5F,CAAW;AAEpCA,EAAY,cAAc;AAE1BA,EAAY,YAAY;AAAA,EACtB,MAAM6F,EAAU,OAAO;AAAA,EACvB,WAAWA,EAAU,OAAO;AAAA,EAC5B,aAAaC,GAAa;AAAA,EAC1B,WAAWD,EAAU;AAAA,EACrB,YAAYA,EAAU,OAAO;AAAA,EAC7B,kBAAkBA,EAAU,KAAK;AAAA,EACjC,aAAaA,EAAU,KAAK;AAAA,EAC5B,YAAYA,EAAU,KAAK;AAAA,EAC3B,SAASA,EAAU,OAAO;AAAA,EAC1B,MAAMA,EAAU,OAAO;AAAA,EACvB,UAAUA,EAAU,KAAK;AAAA,EACzB,2BAA2BA,EAAU,KAAK;AAAA,EAC1C,eAAeA,EAAU,KAAK;AAAA,EAC9B,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU,OAAO;AAC9B;AAEA,MAAAE,KAAe/F;"}
@@ -0,0 +1,22 @@
1
+ export default ReadOnlyChips;
2
+ declare function ReadOnlyChips({ chipOptions, labels, ...args }: {
3
+ [x: string]: any;
4
+ chipOptions?: {
5
+ type: string;
6
+ boldValue: boolean;
7
+ background: string;
8
+ borderColor: string;
9
+ density: string;
10
+ font: string;
11
+ borderRadius: string;
12
+ };
13
+ labels?: any[];
14
+ }): JSX.Element;
15
+ declare namespace ReadOnlyChips {
16
+ namespace propTypes {
17
+ export { CHIP_OPTIONS as chipOptions };
18
+ export let labels: any;
19
+ }
20
+ }
21
+ import { CHIP_OPTIONS } from '../../types';
22
+ //# sourceMappingURL=ReadOnlyChips.d.ts.map