iguazio.dashboard-react-controls 3.0.2 → 3.0.4

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.
@@ -1,99 +1,107 @@
1
- import { jsx as R, jsxs as ye } from "react/jsx-runtime";
2
- import T, { useState as $, useMemo as H, useCallback as W, useEffect as f, useLayoutEffect as ve, forwardRef as Fe } from "react";
3
- import d from "prop-types";
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";
4
4
  import j from "classnames";
5
- import { isEmpty as h, get as D, throttle as fe, isNil as G } from "lodash";
6
- import te from "../NewChipInput/NewChipInput.mjs";
7
- import we from "../../../elements/OptionsMenu/OptionsMenu.mjs";
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
8
  import be from "../../../elements/ValidationTemplate/ValidationTemplate.mjs";
9
9
  import { CHIP_OPTIONS as ke } from "../../../types.mjs";
10
- import { CLICK as Re, TAB as J, TAB_SHIFT as We } from "../../../constants.mjs";
10
+ import { CLICK as We, TAB as J, TAB_SHIFT as Ie } from "../../../constants.mjs";
11
11
  import { getTextWidth as z } from "../formChipCell.util.mjs";
12
- import { getTransitionEndEventName as Ie } from "../../../utils/common.util.mjs";
13
- import Ke from "../../../images/close.svg.mjs";
12
+ import { getTransitionEndEventName as Ke } from "../../../utils/common.util.mjs";
13
+ import Ve from "../../../images/close.svg.mjs";
14
14
  /* empty css */
15
- const Ve = {
15
+ const _e = {
16
16
  rules: {}
17
17
  };
18
- let L = ({
19
- chip: o,
18
+ let x = ({
19
+ chip: a,
20
20
  chipIndex: n,
21
- chipOptions: re,
22
- className: se = "",
21
+ chipOptions: se,
22
+ className: ie = "",
23
23
  editConfig: t,
24
- handleRemoveChip: ie,
25
- isEditable: a,
24
+ handleRemoveChip: ne,
25
+ isEditable: d,
26
26
  keyName: V,
27
27
  meta: m,
28
28
  onChange: _,
29
- setEditConfig: P,
30
- validationRules: ne = Ve.rules,
31
- valueName: le
32
- }, q) => {
29
+ setChipSizeIsRecalculated: Q,
30
+ setEditConfig: L,
31
+ validationRules: le = _e.rules,
32
+ valueName: ue
33
+ }, P) => {
33
34
  const [l, A] = $({
34
- isKeyOnly: o.isKeyOnly,
35
- key: o.key,
36
- value: o.value,
35
+ isKeyOnly: a.isKeyOnly,
36
+ key: a.key,
37
+ value: a.value,
37
38
  keyFieldWidth: 0,
38
39
  valueFieldWidth: 0
39
- }), [y, ue] = $("key"), [Q, ce] = $(ne), [p, B] = $(!1), { background: U, borderColor: X, borderRadius: Y, density: Z, font: C } = re, v = H(() => a ? 25 : 20, [a]), F = H(() => a ? 35 : 20, [a]), M = H(() => Ie(), []), u = T.useRef({}), c = T.useRef({}), S = T.useRef(), E = T.useRef(), oe = j(
40
- se,
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
+ ie,
41
42
  !t.isKeyFocused && "item_edited",
42
- !h(D(m, ["error", n, "key"], [])) && !h(l.key) && !o.disabled && "item_edited_invalid"
43
- ), ae = j(
43
+ !h(D(m, ["error", n, "key"], [])) && !h(l.key) && !a.disabled && "item_edited_invalid"
44
+ ), de = j(
44
45
  "edit-chip-container",
45
- U && `edit-chip-container-background_${U}`,
46
- X && `edit-chip-container-border_${X}`,
47
- C && `edit-chip-container-font_${C}`,
48
- Z && `edit-chip-container-density_${Z}`,
46
+ X && `edit-chip-container-background_${X}`,
49
47
  Y && `edit-chip-container-border_${Y}`,
48
+ g && `edit-chip-container-font_${g}`,
49
+ C && `edit-chip-container-density_${C}`,
50
+ Z && `edit-chip-container-border_${Z}`,
50
51
  (t.isEdit || t.isNewChip) && "edit-chip-container_edited",
51
- o.disabled && "edit-chip-container_disabled edit-chip-container-font_disabled"
52
- ), de = j(
52
+ a.disabled && "edit-chip-container_disabled edit-chip-container-font_disabled"
53
+ ), me = j(
53
54
  "input-label-value",
54
55
  !t.isValueFocused && "item_edited",
55
56
  !h(D(m, ["error", n, "value"], [])) && !h(l.value) && "item_edited_invalid"
56
- ), me = j(
57
+ ), pe = j(
57
58
  "item-icon-close",
58
- !o.disabled && t.chipIndex === n && a && "item-icon-close_invisible",
59
- !a && "item-icon-close_hidden"
59
+ !a.disabled && t.chipIndex === n && d && "item-icon-close_invisible",
60
+ !d && "item-icon-close_hidden"
60
61
  ), O = W(() => {
61
62
  var e;
62
63
  if (u.current) {
63
- const r = z(u.current) + 1, s = z(c.current) + 1, i = ((e = q.current) == null ? void 0 : e.clientWidth) - 50, K = r >= i / 2, x = s >= i / 2;
64
- let w = null, b = null;
65
- if (K && x)
66
- w = b = i / 2;
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;
67
68
  else if (K) {
68
- b = l.value ? s : F;
69
- const k = i - b;
70
- w = k > r ? r : k;
71
- } else if (x) {
69
+ R = l.value ? s : F;
70
+ const b = i - R;
71
+ w = b > r ? r : b;
72
+ } else if (q) {
72
73
  w = l.key ? r : v;
73
- const k = i - w;
74
- b = k > s ? s : k;
74
+ const b = i - w;
75
+ R = b > s ? s : b;
75
76
  } else
76
- w = !l.key || r <= v ? v : r, b = !l.value || s <= F ? F : s;
77
- u.current.style.width = `${w}px`, h(c.current) || (c.current.style.width = `${b}px`), A((k) => ({
78
- ...k,
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,
79
80
  keyFieldWidth: w,
80
- valueFieldWidth: b
81
- }));
81
+ valueFieldWidth: R
82
+ })), Q(!0);
82
83
  }
83
- }, [l.key, l.value, v, F, q]);
84
+ }, [
85
+ l.key,
86
+ l.value,
87
+ v,
88
+ F,
89
+ P,
90
+ Q
91
+ ]);
84
92
  f(() => {
85
- const e = fe(O, 500);
86
- if (a)
93
+ const e = we(O, 500);
94
+ if (d)
87
95
  return window.addEventListener("resize", e), window.addEventListener(M, e), () => {
88
96
  window.removeEventListener("resize", e), window.removeEventListener(M, e);
89
97
  };
90
- }, [a, O, M]), f(() => {
98
+ }, [d, O, M]), f(() => {
91
99
  !l.keyFieldWidth && !l.valueFieldWidth && O();
92
100
  }, [l.keyFieldWidth, l.valueFieldWidth, O]);
93
101
  const N = W(
94
102
  (e, r) => {
95
103
  var s;
96
- t.chipIndex === n && (!(e.path ?? ((s = e.composedPath) == null ? void 0 : s.call(e))).includes(S.current) || r ? (_(e, Re, !0), window.getSelection().removeAllRanges(), document.activeElement.blur()) : e.stopPropagation());
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());
97
105
  },
98
106
  [_, S, n, t.chipIndex]
99
107
  ), I = W(
@@ -104,7 +112,7 @@ let L = ({
104
112
  );
105
113
  f(() => (p && window.addEventListener("scroll", I, !0), () => {
106
114
  window.removeEventListener("scroll", I, !0);
107
- }), [p, I]), f(() => {
115
+ }), [I, p]), f(() => {
108
116
  t.chipIndex === n && (t.isKeyFocused ? u.current.focus() : t.isValueFocused && c.current.focus());
109
117
  }, [
110
118
  t.isKeyFocused,
@@ -121,40 +129,40 @@ let L = ({
121
129
  document.removeEventListener("click", N, !0);
122
130
  };
123
131
  }, [N, t.isEdit]);
124
- const pe = W(
132
+ const he = W(
125
133
  (e) => {
126
- if (t.chipIndex === n && a) {
134
+ if (t.chipIndex === n && d) {
127
135
  if (!e.shiftKey && e.key === J && t.isValueFocused)
128
136
  return _(e, J);
129
137
  if (e.shiftKey && e.key === J && t.isKeyFocused)
130
- return _(e, We);
138
+ return _(e, Ie);
131
139
  }
132
140
  e.stopPropagation();
133
141
  },
134
- [t, _, n, a]
135
- ), g = W(
142
+ [t, _, n, d]
143
+ ), ee = W(
136
144
  (e) => {
137
145
  const r = e.target.name === V;
138
- t.chipIndex === n ? (r ? (u.current.selectionStart = u.current.selectionEnd, P((s) => ({
146
+ t.chipIndex === n ? (r ? (u.current.selectionStart = u.current.selectionEnd, L((s) => ({
139
147
  ...s,
140
148
  isKeyFocused: !0,
141
149
  isValueFocused: !1
142
- }))) : (c.current.selectionStart = c.current.selectionEnd, P((s) => ({
150
+ }))) : (c.current.selectionStart = c.current.selectionEnd, L((s) => ({
143
151
  ...s,
144
152
  isKeyFocused: !1,
145
153
  isValueFocused: !0
146
- }))), e && e.stopPropagation()) : G(t.chipIndex) && (r ? u.current.selectionStart = u.current.selectionEnd : c.current.selectionStart = c.current.selectionEnd, P({
154
+ }))), e && e.stopPropagation()) : G(t.chipIndex) && (r ? u.current.selectionStart = u.current.selectionEnd : c.current.selectionStart = c.current.selectionEnd, L({
147
155
  chipIndex: n,
148
156
  isEdit: !0,
149
157
  isKeyFocused: r,
150
158
  isValueFocused: !r
151
159
  }));
152
160
  },
153
- [V, u, c, P, t.chipIndex, n]
154
- ), ee = W(
161
+ [V, u, c, L, t.chipIndex, n]
162
+ ), te = W(
155
163
  (e) => {
156
164
  var s;
157
- const r = ((s = q.current) == null ? void 0 : s.clientWidth) - 50;
165
+ const r = ((s = P.current) == null ? void 0 : s.clientWidth) - 50;
158
166
  if (e.preventDefault(), e.target.name === V) {
159
167
  const i = z(u.current);
160
168
  A((K) => ({
@@ -165,23 +173,23 @@ let L = ({
165
173
  } else {
166
174
  const i = z(c.current);
167
175
  A((K) => {
168
- var x;
176
+ var q;
169
177
  return {
170
178
  ...K,
171
179
  value: c.current.value,
172
- valueFieldWidth: ((x = c.current.value) == null ? void 0 : x.length) <= 1 ? F : i >= r ? r : i > F ? i + 2 : F
180
+ valueFieldWidth: ((q = c.current.value) == null ? void 0 : q.length) <= 1 ? F : i >= r ? r : i > F ? i + 2 : F
173
181
  };
174
182
  });
175
183
  }
176
184
  },
177
- [V, v, q, F]
185
+ [V, v, P, F]
178
186
  );
179
- ve(() => {
180
- t.chipIndex === n && ue(t.isKeyFocused ? "key" : t.isValueFocused ? "value" : null);
187
+ Fe(() => {
188
+ t.chipIndex === n && ce(t.isKeyFocused ? "key" : t.isValueFocused ? "value" : null);
181
189
  }, [t.isKeyFocused, t.isValueFocused, t.chipIndex, n]), f(() => {
182
190
  m.valid && p && B(!1);
183
191
  }, [m.valid, p]), f(() => {
184
- m.error && (ce((e) => {
192
+ m.error && (oe((e) => {
185
193
  var r;
186
194
  return {
187
195
  ...e,
@@ -194,77 +202,78 @@ let L = ({
194
202
  };
195
203
  }), !p && B(!0));
196
204
  }, [m, p, y, t.chipIndex]);
197
- const he = W(() => {
205
+ const ye = W(() => {
198
206
  var e;
199
- return (e = Q[y]) == null ? void 0 : e.map(({ isValid: r = !1, label: s, name: i }) => /* @__PURE__ */ R(be, { valid: r, validationMessage: s }, i));
200
- }, [y, Q]);
201
- return /* @__PURE__ */ ye(
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(
202
210
  "div",
203
211
  {
204
- className: ae,
205
- onKeyDown: (e) => !o.disabled && t.isEdit && pe(e),
212
+ className: de,
213
+ onKeyDown: (e) => !a.disabled && t.isEdit && he(e),
206
214
  ref: S,
207
215
  children: [
208
- /* @__PURE__ */ R(
209
- te,
216
+ /* @__PURE__ */ k(
217
+ re,
210
218
  {
211
- className: oe,
212
- disabled: o.disabled || !a || !G(t.chipIndex) && t.chipIndex !== n,
219
+ className: ae,
220
+ disabled: a.disabled || !d || !G(t.chipIndex) && t.chipIndex !== n,
213
221
  name: V,
214
- onChange: ee,
215
- onFocus: g,
222
+ onChange: te,
223
+ onFocus: ee,
216
224
  placeholder: "key",
217
225
  ref: u,
218
226
  style: { width: l.keyFieldWidth }
219
227
  }
220
228
  ),
221
- !l.isKeyOnly && /* @__PURE__ */ R("div", { className: "edit-chip-separator", children: ":" }),
222
- !l.isKeyOnly && /* @__PURE__ */ R(
223
- te,
229
+ !l.isKeyOnly && /* @__PURE__ */ k("div", { className: "edit-chip-separator", children: ":" }),
230
+ !l.isKeyOnly && /* @__PURE__ */ k(
231
+ re,
224
232
  {
225
- className: de,
226
- disabled: o.disabled || !a || !G(t.chipIndex) && t.chipIndex !== n,
227
- name: le,
228
- onChange: ee,
229
- onFocus: g,
233
+ className: me,
234
+ disabled: a.disabled || !d || !G(t.chipIndex) && t.chipIndex !== n,
235
+ name: ue,
236
+ onChange: te,
237
+ onFocus: ee,
230
238
  placeholder: "value",
231
239
  ref: c,
232
240
  style: { width: l.valueFieldWidth }
233
241
  }
234
242
  ),
235
- /* @__PURE__ */ R(
243
+ /* @__PURE__ */ k(
236
244
  "button",
237
245
  {
238
- disabled: o.disabled,
239
- className: me,
240
- onClick: (e) => !o.disabled && ie(e, n),
241
- children: /* @__PURE__ */ R(Ke, {})
246
+ disabled: a.disabled,
247
+ className: pe,
248
+ onClick: (e) => !a.disabled && ne(e, n),
249
+ children: /* @__PURE__ */ k(Ve, {})
242
250
  }
243
251
  ),
244
- !o.disabled && (t.isKeyFocused ? !h(l.key) : !h(l.value)) && t.chipIndex === n && !h(D(m, ["error", t.chipIndex, y], [])) && /* @__PURE__ */ R(we, { show: p, ref: { refInputContainer: S, validationRulesRef: E }, children: he() })
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() })
245
253
  ]
246
254
  }
247
255
  );
248
256
  };
249
- L = Fe(L);
250
- L.displayName = "NewChipForm";
251
- L.propTypes = {
252
- chip: d.object.isRequired,
253
- chipIndex: d.number.isRequired,
257
+ x = fe(x);
258
+ x.displayName = "NewChipForm";
259
+ x.propTypes = {
260
+ chip: o.object.isRequired,
261
+ chipIndex: o.number.isRequired,
254
262
  chipOptions: ke.isRequired,
255
- className: d.string,
256
- editConfig: d.object.isRequired,
257
- handleRemoveChip: d.func.isRequired,
258
- isEditable: d.bool.isRequired,
259
- keyName: d.string.isRequired,
260
- meta: d.object.isRequired,
261
- onChange: d.func.isRequired,
262
- setEditConfig: d.func.isRequired,
263
- validationRules: d.object,
264
- valueName: d.string.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
265
274
  };
266
- const Ae = L;
275
+ const Be = x;
267
276
  export {
268
- Ae as default
277
+ Be as default
269
278
  };
270
279
  //# 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 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 }\n }, [chipData.key, chipData.value, minWidthInput, minWidthValueInput, ref])\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 }, [showValidationRules, handleScroll])\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 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","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,eAAAC;AAAA,EACA,iBAAiBC,KAAQb,GAAa;AAAA,EACtC,WAAAc;AACF,GACAC,MACG;AACH,QAAM,CAACC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AAAA,YACX,SAAS,CAASkB,MAAA,CAAC9D,EAAK,YAAYK,GAAiByD,GAAO7D,CAAS;AAAA,YAErE,4BAACoF,IAAM,CAAA,CAAA;AAAA,UAAA;AAAA,QACT;AAAA,QAEC,CAACrF,EAAK,aACJI,EAAW,eAAe,CAACoC,EAAQ1B,EAAS,GAAG,IAAI,CAAC0B,EAAQ1B,EAAS,KAAK,MAC3EV,EAAW,cAAcH,KACzB,CAACuC,EAAQC,EAAIjC,GAAM,CAAC,SAASJ,EAAW,WAAWa,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;AAEAtC,IAAcwF,GAAWxF,CAAW;AAEpCA,EAAY,cAAc;AAE1BA,EAAY,YAAY;AAAA,EACtB,MAAMyF,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,eAAeA,EAAU,KAAK;AAAA,EAC9B,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU,OAAO;AAC9B;AAEA,MAAAE,KAAe3F;"}
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;AAA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KAAK;AAAA,EAC1C,eAAeA,EAAU,KAAK;AAAA,EAC9B,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU,OAAO;AAC9B;AAEA,MAAAE,KAAe5F;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormCombobox.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FormCombobox/FormCombobox.jsx"],"names":[],"mappings":";AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;gBAgbC;;;;;;;;;;;;;;;;;;;;;;;;;;wBAzb0E,aAAa;yCAAb,aAAa"}
1
+ {"version":3,"file":"FormCombobox.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FormCombobox/FormCombobox.jsx"],"names":[],"mappings":";AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;gBAobC;;;;;;;;;;;;;;;;;;;;;;;;;;wBA7b0E,aAAa;yCAAb,aAAa"}