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,5 +1,5 @@
1
1
  export default FormChip;
2
- declare function FormChip({ chip, chipIndex, chipSizeIsRecalculated, setChipSizeIsRecalculated, chipOptions, editConfig, handleEditChip, handleRemoveChip, handleToEditMode, isEditable, keyName, meta, setChipsSizes, setEditConfig, validationRules, valueName }: {
2
+ declare function FormChip({ chip, chipIndex, chipSizeIsRecalculated, setChipSizeIsRecalculated, chipOptions, editConfig, handleEditChip, handleRemoveChip, handleToEditMode, isDeletable, isEditable, keyName, meta, setChipsSizes, setEditConfig, validationRules, valueName }: {
3
3
  chip: any;
4
4
  chipIndex: any;
5
5
  chipSizeIsRecalculated: any;
@@ -16,6 +16,7 @@ declare function FormChip({ chip, chipIndex, chipSizeIsRecalculated, setChipSize
16
16
  handleEditChip: any;
17
17
  handleRemoveChip: any;
18
18
  handleToEditMode: any;
19
+ isDeletable?: boolean;
19
20
  isEditable?: boolean;
20
21
  keyName?: string;
21
22
  meta: any;
@@ -36,6 +37,7 @@ declare namespace FormChip {
36
37
  export let handleEditChip: any;
37
38
  export let handleRemoveChip: any;
38
39
  export let handleToEditMode: any;
40
+ export let isDeletable: any;
39
41
  export let isEditable: any;
40
42
  export let keyName: any;
41
43
  export let meta: any;
@@ -1 +1 @@
1
- {"version":3,"file":"FormChip.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.jsx"],"names":[],"mappings":";AAyBA;;;;;;;;;;;;;;;;;;;;;;;;0BA2DC;;;;;;;;;;;;;;;;;;;;;;6BA/D4B,gBAAgB"}
1
+ {"version":3,"file":"FormChip.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.jsx"],"names":[],"mappings":";AAyBA;;;;;;;;;;;;;;;;;;;;;;;;;0BA6DC;;;;;;;;;;;;;;;;;;;;;;;6BAjE4B,gBAAgB"}
@@ -1,13 +1,13 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
- import v, { useLayoutEffect as F, forwardRef as T } from "react";
2
+ import F, { useLayoutEffect as T, forwardRef as k } from "react";
3
3
  import e from "prop-types";
4
- import k from "../NewChipForm/NewChipForm.mjs";
5
- import { CHIP_OPTIONS as w } from "../../../types.mjs";
4
+ import w from "../NewChipForm/NewChipForm.mjs";
5
+ import { CHIP_OPTIONS as O } from "../../../types.mjs";
6
6
  /* empty css */
7
7
  let i = ({
8
8
  chip: f,
9
9
  chipIndex: r,
10
- chipSizeIsRecalculated: n,
10
+ chipSizeIsRecalculated: s,
11
11
  setChipSizeIsRecalculated: c,
12
12
  chipOptions: m = {
13
13
  background: "purple",
@@ -21,25 +21,26 @@ let i = ({
21
21
  handleEditChip: b,
22
22
  handleRemoveChip: h,
23
23
  handleToEditMode: C,
24
- isEditable: q = !1,
25
- keyName: s = "",
26
- meta: g,
24
+ isDeletable: q = !1,
25
+ isEditable: g = !1,
26
+ keyName: a = "",
27
+ meta: y,
27
28
  setChipsSizes: t,
28
- setEditConfig: y,
29
- validationRules: j = {},
30
- valueName: E = ""
31
- }, N) => {
32
- const u = v.useRef();
33
- return F(() => {
34
- u.current && t && n && t((d) => {
35
- var o, a, l;
29
+ setEditConfig: j,
30
+ validationRules: E = {},
31
+ valueName: N = ""
32
+ }, v) => {
33
+ const u = F.useRef();
34
+ return T(() => {
35
+ u.current && t && s && t((d) => {
36
+ var o, n, l;
36
37
  return {
37
38
  ...d,
38
- [r]: ((l = (a = (o = u.current) == null ? void 0 : o.getBoundingClientRect) == null ? void 0 : a.call(o)) == null ? void 0 : l.width) ?? 50
39
+ [r]: ((l = (n = (o = u.current) == null ? void 0 : o.getBoundingClientRect) == null ? void 0 : n.call(o)) == null ? void 0 : l.width) ?? 50
39
40
  };
40
41
  });
41
- }, [r, n, t]), /* @__PURE__ */ p("div", { onClick: (d) => C(d, r, s), ref: u, children: /* @__PURE__ */ p(
42
- k,
42
+ }, [r, s, t]), /* @__PURE__ */ p("div", { onClick: (d) => C(d, r, a), ref: u, children: /* @__PURE__ */ p(
43
+ w,
43
44
  {
44
45
  chip: f,
45
46
  chipIndex: r,
@@ -47,30 +48,32 @@ let i = ({
47
48
  className: "input-label-key",
48
49
  editConfig: R,
49
50
  handleRemoveChip: h,
50
- isEditable: q,
51
- keyName: s,
52
- meta: g,
51
+ isDeletable: q,
52
+ isEditable: g,
53
+ keyName: a,
54
+ meta: y,
53
55
  onChange: b,
54
- ref: N,
56
+ ref: v,
55
57
  setChipSizeIsRecalculated: c,
56
- setEditConfig: y,
57
- validationRules: j,
58
- valueName: E
58
+ setEditConfig: j,
59
+ validationRules: E,
60
+ valueName: N
59
61
  }
60
62
  ) });
61
63
  };
62
- i = T(i);
64
+ i = k(i);
63
65
  i.displayName = "FormChip";
64
66
  i.propTypes = {
65
67
  chip: e.object.isRequired,
66
68
  chipSizeIsRecalculated: e.bool.isRequired,
67
69
  setChipSizeIsRecalculated: e.func.isRequired,
68
70
  chipIndex: e.number.isRequired,
69
- chipOptions: w,
71
+ chipOptions: O,
70
72
  editConfig: e.object.isRequired,
71
73
  handleEditChip: e.func.isRequired,
72
74
  handleRemoveChip: e.func.isRequired,
73
75
  handleToEditMode: e.func.isRequired,
76
+ isDeletable: e.bool,
74
77
  isEditable: e.bool,
75
78
  keyName: e.string,
76
79
  meta: e.object.isRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"FormChip.mjs","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.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, { useLayoutEffect, forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport NewChipForm from '../NewChipForm/NewChipForm'\n\nimport { CHIP_OPTIONS } from '../../../types'\n\nimport './formChip.scss'\n\nlet FormChip = (\n {\n chip,\n chipIndex,\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n editConfig,\n handleEditChip,\n handleRemoveChip,\n handleToEditMode,\n isEditable = false,\n keyName = '',\n meta,\n setChipsSizes,\n setEditConfig,\n validationRules = {},\n valueName = ''\n },\n ref\n) => {\n const chipRef = React.useRef()\n useLayoutEffect(() => {\n if (chipRef.current && setChipsSizes && chipSizeIsRecalculated) {\n setChipsSizes(state => ({\n ...state,\n [chipIndex]: chipRef.current?.getBoundingClientRect?.()?.width ?? 50\n }))\n }\n }, [chipIndex, chipSizeIsRecalculated, setChipsSizes])\n\n return (\n <div onClick={event => handleToEditMode(event, chipIndex, keyName)} ref={chipRef}>\n <NewChipForm\n chip={chip}\n chipIndex={chipIndex}\n chipOptions={chipOptions}\n className=\"input-label-key\"\n editConfig={editConfig}\n handleRemoveChip={handleRemoveChip}\n isEditable={isEditable}\n keyName={keyName}\n meta={meta}\n onChange={handleEditChip}\n ref={ref}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setEditConfig={setEditConfig}\n validationRules={validationRules}\n valueName={valueName}\n />\n </div>\n )\n}\n\nFormChip = forwardRef(FormChip)\n\nFormChip.displayName = 'FormChip'\n\nFormChip.propTypes = {\n chip: PropTypes.object.isRequired,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS,\n editConfig: PropTypes.object.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isEditable: PropTypes.bool,\n keyName: PropTypes.string,\n meta: PropTypes.object.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string\n}\n\nexport default FormChip\n"],"names":["FormChip","chip","chipIndex","chipSizeIsRecalculated","setChipSizeIsRecalculated","chipOptions","editConfig","handleEditChip","handleRemoveChip","handleToEditMode","isEditable","keyName","meta","setChipsSizes","setEditConfig","validationRules","valueName","ref","chipRef","React","useLayoutEffect","state","_c","_b","_a","jsx","event","NewChipForm","forwardRef","PropTypes","CHIP_OPTIONS","FormChip$1"],"mappings":";;;;;;AAyBA,IAAIA,IAAW,CACb;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,SAAAC,IAAU;AAAA,EACV,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAC;AAAA,EACnB,WAAAC,IAAY;AACd,GACAC,MACG;AACG,QAAAC,IAAUC,EAAM,OAAO;AAC7B,SAAAC,EAAgB,MAAM;AAChB,IAAAF,EAAQ,WAAWL,KAAiBV,KACtCU,EAAc,CAAUQ,MAAA;;AAAA;AAAA,QACtB,GAAGA;AAAA,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;AAEA,MAAAE,IAAe/B;"}
1
+ {"version":3,"file":"FormChip.mjs","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.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, { useLayoutEffect, forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport NewChipForm from '../NewChipForm/NewChipForm'\n\nimport { CHIP_OPTIONS } from '../../../types'\n\nimport './formChip.scss'\n\nlet FormChip = (\n {\n chip,\n chipIndex,\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n editConfig,\n handleEditChip,\n handleRemoveChip,\n handleToEditMode,\n isDeletable = false,\n isEditable = false,\n keyName = '',\n meta,\n setChipsSizes,\n setEditConfig,\n validationRules = {},\n valueName = ''\n },\n ref\n) => {\n const chipRef = React.useRef()\n useLayoutEffect(() => {\n if (chipRef.current && setChipsSizes && chipSizeIsRecalculated) {\n setChipsSizes(state => ({\n ...state,\n [chipIndex]: chipRef.current?.getBoundingClientRect?.()?.width ?? 50\n }))\n }\n }, [chipIndex, chipSizeIsRecalculated, setChipsSizes])\n\n return (\n <div onClick={event => handleToEditMode(event, chipIndex, keyName)} ref={chipRef}>\n <NewChipForm\n chip={chip}\n chipIndex={chipIndex}\n chipOptions={chipOptions}\n className=\"input-label-key\"\n editConfig={editConfig}\n handleRemoveChip={handleRemoveChip}\n isDeletable={isDeletable}\n isEditable={isEditable}\n keyName={keyName}\n meta={meta}\n onChange={handleEditChip}\n ref={ref}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setEditConfig={setEditConfig}\n validationRules={validationRules}\n valueName={valueName}\n />\n </div>\n )\n}\n\nFormChip = forwardRef(FormChip)\n\nFormChip.displayName = 'FormChip'\n\nFormChip.propTypes = {\n chip: PropTypes.object.isRequired,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS,\n editConfig: PropTypes.object.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n keyName: PropTypes.string,\n meta: PropTypes.object.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string\n}\n\nexport default FormChip\n"],"names":["FormChip","chip","chipIndex","chipSizeIsRecalculated","setChipSizeIsRecalculated","chipOptions","editConfig","handleEditChip","handleRemoveChip","handleToEditMode","isDeletable","isEditable","keyName","meta","setChipsSizes","setEditConfig","validationRules","valueName","ref","chipRef","React","useLayoutEffect","state","_c","_b","_a","jsx","event","NewChipForm","forwardRef","PropTypes","CHIP_OPTIONS","FormChip$1"],"mappings":";;;;;;AAyBA,IAAIA,IAAW,CACb;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EACA,YA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AAU,KAAK;AAAA,EACvC,2BAA2BA,EAAU,KAAK;AAAA,EAC1C,WAAWA,EAAU,OAAO;AAAA,EAC5B,aAAaC;AAAA,EACb,YAAYD,EAAU,OAAO;AAAA,EAC7B,gBAAgBA,EAAU,KAAK;AAAA,EAC/B,kBAAkBA,EAAU,KAAK;AAAA,EACjC,kBAAkBA,EAAU,KAAK;AAAA,EACjC,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AAAA,EACtB,SAASA,EAAU;AAAA,EACnB,MAAMA,EAAU,OAAO;AAAA,EACvB,eAAeA,EAAU,KAAK;AAAA,EAC9B,eAAeA,EAAU,KAAK;AAAA,EAC9B,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU;AACvB;AAEA,MAAAE,IAAehC;"}
@@ -1,5 +1,5 @@
1
1
  export default FormChipCell;
2
- declare function FormChipCell({ chipOptions, className, delimiter, formState, initialValues, isEditable, label, name, onClick, onExitEditModeCallback, shortChips, validationRules, validator, visibleChipsMaxLength, withInitialParentWidth }: {
2
+ declare function FormChipCell({ chipOptions, className, children, delimiter, formState, initialValues, isDeletable, isEditable, label, name, onClick, onExitEditModeCallback, shortChips, validationRules, validator, visibleChipsMaxLength, withInitialParentWidth }: {
3
3
  chipOptions?: {
4
4
  background: string;
5
5
  boldValue: boolean;
@@ -9,9 +9,11 @@ declare function FormChipCell({ chipOptions, className, delimiter, formState, in
9
9
  font: string;
10
10
  };
11
11
  className?: string;
12
+ children: any;
12
13
  delimiter?: any;
13
14
  formState: any;
14
15
  initialValues: any;
16
+ isDeletable?: boolean;
15
17
  isEditable?: boolean;
16
18
  label?: any;
17
19
  name: any;
@@ -26,10 +28,12 @@ declare function FormChipCell({ chipOptions, className, delimiter, formState, in
26
28
  declare namespace FormChipCell {
27
29
  namespace propTypes {
28
30
  export { CHIP_OPTIONS as chipOptions };
31
+ export let children: any;
29
32
  export let className: any;
30
33
  export let delimiter: any;
31
34
  export let formState: any;
32
35
  export let initialValues: any;
36
+ export let isDeletable: any;
33
37
  export let isEditable: any;
34
38
  export let label: any;
35
39
  export let name: any;
@@ -38,9 +42,10 @@ declare namespace FormChipCell {
38
42
  export let shortChips: any;
39
43
  export let validationRules: any;
40
44
  export let validator: any;
41
- export let visibleChipsMaxLength: any;
45
+ export { VISIBLE_CHIPS_MAX_LENGTH as visibleChipsMaxLength };
42
46
  export let withInitialParentWidth: any;
43
47
  }
44
48
  }
45
49
  import { CHIP_OPTIONS } from '../../types';
50
+ import { VISIBLE_CHIPS_MAX_LENGTH } from '../../types';
46
51
  //# sourceMappingURL=FormChipCell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormChipCell.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FormChipCell/FormChipCell.jsx"],"names":[],"mappings":";AAiCA;;;;;;;;;;;;;;;;;;;;;;;gBAyWC;;;;;;;;;;;;;;;;;;;;6BAnX4B,aAAa"}
1
+ {"version":3,"file":"FormChipCell.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FormChipCell/FormChipCell.jsx"],"names":[],"mappings":";AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;gBA+WC;;;;;;;;;;;;;;;;;;;;;;6BAzXsD,aAAa;yCAAb,aAAa"}
@@ -1,20 +1,20 @@
1
- import { jsxs as pe, jsx as T } from "react/jsx-runtime";
2
- import ce, { useState as k, useMemo as he, useCallback as y } from "react";
3
- import ae, { get as F, set as O, isEmpty as D, isNil as de } from "lodash";
4
- import fe from "classnames";
5
- import r from "prop-types";
6
- import me from "./FormChipCellView.mjs";
7
- import { CHIP_OPTIONS as Ce } from "../../types.mjs";
8
- import { CLICK as Ie, TAB as H, TAB_SHIFT as U } from "../../constants.mjs";
9
- import { areArraysEqual as ge } from "../../utils/common.util.mjs";
10
- import { checkPatternsValidity as ye } from "../../utils/validation.util.mjs";
11
- import { generateChipsList as Fe } from "../../utils/generateChipsList.util.mjs";
12
- import { uniquenessError as b } from "./formChipCell.util.mjs";
1
+ import { jsxs as he, jsx as v } from "react/jsx-runtime";
2
+ import ae, { useState as j, useMemo as de, useCallback as y } from "react";
3
+ import fe, { get as F, set as k, isEmpty as D, isNil as me } from "lodash";
4
+ import Ce from "classnames";
5
+ import u from "prop-types";
6
+ import Ie from "./FormChipCellView.mjs";
7
+ import { VISIBLE_CHIPS_MAX_LENGTH as ge, CHIP_OPTIONS as ye } from "../../types.mjs";
8
+ import { CLICK as Fe, TAB as B, TAB_SHIFT as O } from "../../constants.mjs";
9
+ import { areArraysEqual as Ne } from "../../utils/common.util.mjs";
10
+ import { checkPatternsValidity as Ve } from "../../utils/validation.util.mjs";
11
+ import { generateChipsList as we } from "../../utils/generateChipsList.util.mjs";
12
+ import { uniquenessError as U } from "./formChipCell.util.mjs";
13
13
  import "../../hooks/index.mjs";
14
14
  /* empty css */
15
- import { useChipCell as Ne } from "../../hooks/useChipCell.hook.mjs";
16
- let w = ({
17
- chipOptions: z = {
15
+ import { useChipCell as Re } from "../../hooks/useChipCell.hook.mjs";
16
+ let V = ({
17
+ chipOptions: b = {
18
18
  background: "purple",
19
19
  boldValue: !1,
20
20
  borderRadius: "primary",
@@ -22,63 +22,65 @@ let w = ({
22
22
  density: "dense",
23
23
  font: "purple"
24
24
  },
25
- className: B = "",
26
- delimiter: _ = null,
25
+ className: z = "",
26
+ children: W,
27
+ delimiter: T = null,
27
28
  formState: n,
28
29
  initialValues: q,
30
+ isDeletable: X = !1,
29
31
  isEditable: m = !1,
30
- label: R = null,
31
- name: o,
32
- onClick: V = () => {
32
+ label: w = null,
33
+ name: r,
34
+ onClick: R = () => {
33
35
  },
34
36
  onExitEditModeCallback: d = null,
35
- shortChips: W = !1,
37
+ shortChips: $ = !1,
36
38
  validationRules: P = {},
37
- validator: x = null,
38
- visibleChipsMaxLength: I = null,
39
- withInitialParentWidth: $ = !1
39
+ validator: K = null,
40
+ visibleChipsMaxLength: C = null,
41
+ withInitialParentWidth: A = !1
40
42
  }) => {
41
- const X = fe("chips", B), [Y, A] = k(!1), {
42
- chipsCellRef: G,
43
- chipsWrapperRef: J,
44
- handleShowElements: L,
45
- hiddenChipsCounterRef: Q,
46
- hiddenChipsPopUpRef: Z,
47
- setChipsSizes: S,
48
- setShowHiddenChips: K,
49
- showChips: E,
50
- showHiddenChips: v,
51
- visibleChipsCount: j
52
- } = Ne(m, I, $), [p, C] = k({
43
+ const G = Ce("chips", z), [L, Y] = j(!1), {
44
+ chipsCellRef: J,
45
+ chipsWrapperRef: Q,
46
+ handleShowElements: Z,
47
+ hiddenChipsCounterRef: S,
48
+ hiddenChipsPopUpRef: E,
49
+ setChipsSizes: M,
50
+ setShowHiddenChips: x,
51
+ showChips: ee,
52
+ showHiddenChips: _,
53
+ visibleChipsCount: H
54
+ } = Re(m, C, A), [p, I] = j({
53
55
  chipIndex: null,
54
56
  isEdit: !1,
55
57
  isKeyFocused: !1,
56
58
  isValueFocused: !1,
57
59
  isNewChip: !1
58
60
  });
59
- let M = he(() => m || I === "all" ? {
60
- visibleChips: F(n.values, o),
61
+ let ie = de(() => m || C === "all" ? {
62
+ visibleChips: F(n.values, r),
61
63
  hiddenChips: []
62
- } : Fe(
63
- F(n.values, o),
64
- I || j
65
- ), [I, m, j, n.values, o]);
64
+ } : we(
65
+ F(n.values, r),
66
+ C || H
67
+ ), [C, m, H, n.values, r]);
66
68
  const N = y(
67
69
  (e) => {
68
- ge(F(q, o), e, ["id"]) && O(n.initialValues, o, e), n.form.mutators.setFieldState(o, { modified: !0 }), n.form.mutators.setFieldState(o, { touched: !0 });
70
+ Ne(F(q, r), e, ["id"]) && k(n.initialValues, r, e), n.form.mutators.setFieldState(r, { modified: !0 }), n.form.mutators.setFieldState(r, { touched: !0 });
69
71
  },
70
- [q, o, n]
71
- ), ee = y(
72
+ [q, r, n]
73
+ ), se = y(
72
74
  (e, i) => {
73
75
  var t;
74
- const u = ((t = i.value) == null ? void 0 : t.length) || 0;
75
- !p.isEdit && !p.chipIndex && n.form.mutators.push(o, {
76
- id: u + /* @__PURE__ */ new Date(),
76
+ const o = ((t = i.value) == null ? void 0 : t.length) || 0;
77
+ !p.isEdit && !p.chipIndex && n.form.mutators.push(r, {
78
+ id: o + /* @__PURE__ */ new Date(),
77
79
  key: "",
78
80
  value: "",
79
- delimiter: _
80
- }), v && K(!1), C({
81
- chipIndex: u,
81
+ delimiter: T
82
+ }), _ && x(!1), I({
83
+ chipIndex: o,
82
84
  isEdit: !0,
83
85
  isKeyFocused: !0,
84
86
  isValueFocused: !1,
@@ -88,29 +90,29 @@ let w = ({
88
90
  [
89
91
  p.isEdit,
90
92
  p.chipIndex,
91
- v,
92
- n.form.mutators,
93
- o,
94
93
  _,
95
- K
94
+ n.form.mutators,
95
+ r,
96
+ T,
97
+ x
96
98
  ]
97
99
  ), g = y(
98
- (e, i, u, t = !1) => {
100
+ (e, i, o, t = !1) => {
99
101
  N(
100
- ae.chain(n).get(["values", o]).filter((s, l) => l !== u).value()
101
- ), i.length === 1 ? n.form.change(o, []) : i.remove(u), d && d(), e && !t && e.stopPropagation();
102
+ fe.chain(n).get(["values", r]).filter((s, l) => l !== o).value()
103
+ ), i.length === 1 ? n.form.change(r, []) : i.remove(o), d && d(), e && !t && e.stopPropagation();
102
104
  },
103
- [N, n, o, d]
104
- ), ie = y(
105
- (e, i, u, t) => {
105
+ [N, n, r, d]
106
+ ), le = y(
107
+ (e, i, o, t) => {
106
108
  const { key: s, value: l } = i.value[p.chipIndex], h = !!(s != null && s.trim() && (l != null && l.trim()));
107
- u === Ie ? (h || g(e, i, p.chipIndex, t), C({
109
+ o === Fe ? (h || g(e, i, p.chipIndex, t), I({
108
110
  chipIndex: null,
109
111
  isEdit: !1,
110
112
  isKeyFocused: !1,
111
113
  isValueFocused: !1,
112
114
  isNewChip: !1
113
- }), h && d && d()) : u === H ? (h || g(e, i, p.chipIndex), C((a) => {
115
+ }), h && d && d()) : o === B ? (h || g(e, i, p.chipIndex), I((a) => {
114
116
  const c = a.chipIndex + 1 > i.value.length - 1;
115
117
  return h && c && d && d(), {
116
118
  chipIndex: c ? null : a.chipIndex + 1,
@@ -119,7 +121,7 @@ let w = ({
119
121
  isValueFocused: !1,
120
122
  isNewChip: !1
121
123
  };
122
- })) : u === U && (h || g(e, i, p.chipIndex), C((a) => {
124
+ })) : o === O && (h || g(e, i, p.chipIndex), I((a) => {
123
125
  const c = a.chipIndex === 0;
124
126
  return h && c && d && d(), {
125
127
  chipIndex: c ? null : a.chipIndex - 1,
@@ -128,37 +130,37 @@ let w = ({
128
130
  isValueFocused: !c,
129
131
  isNewChip: !1
130
132
  };
131
- })), N(F(n.values, o)), (p.chipIndex > 0 && p.chipIndex < i.value.length - 1 || i.value.length > 1 && p.chipIndex === 0 && u !== U || i.value.length > 1 && p.chipIndex === i.value.length - 1 && u !== H) && e && e.preventDefault();
133
+ })), N(F(n.values, r)), (p.chipIndex > 0 && p.chipIndex < i.value.length - 1 || i.value.length > 1 && p.chipIndex === 0 && o !== O || i.value.length > 1 && p.chipIndex === i.value.length - 1 && o !== B) && e && e.preventDefault();
132
134
  },
133
135
  [
134
136
  p.chipIndex,
135
137
  N,
136
138
  n.values,
137
- o,
139
+ r,
138
140
  d,
139
141
  g
140
142
  ]
141
- ), se = y(
142
- (e, i, u) => {
143
+ ), te = y(
144
+ (e, i, o) => {
143
145
  if (m) {
144
146
  const { clientX: t, clientY: s } = e;
145
147
  let l = !1;
146
148
  const h = (a, c, f) => {
147
149
  if (f) {
148
150
  const {
149
- top: re,
150
- left: oe,
151
- right: ue,
152
- bottom: ne
151
+ top: ue,
152
+ left: ne,
153
+ right: pe,
154
+ bottom: ce
153
155
  } = f.getBoundingClientRect();
154
- return !(a > ue || a < oe || c > ne || c < re);
156
+ return !(a > pe || a < ne || c > ce || c < ue);
155
157
  }
156
158
  };
157
159
  e.stopPropagation(), e.target.nodeName !== "INPUT" ? e.target.firstElementChild && (l = h(
158
160
  t,
159
161
  s,
160
162
  e.target.firstElementChild
161
- )) : l = e.target.name === u, C((a) => ({
163
+ )) : l = e.target.name === o, I((a) => ({
162
164
  ...a,
163
165
  chipIndex: i,
164
166
  isEdit: !0,
@@ -166,79 +168,84 @@ let w = ({
166
168
  isValueFocused: !l
167
169
  }));
168
170
  }
169
- V && V();
171
+ R && R();
170
172
  },
171
- [m, V]
172
- ), le = (e) => {
173
+ [m, R]
174
+ ), re = (e) => {
173
175
  if (!e) return null;
174
176
  let i = [];
175
- const u = (t, s) => !e.some(({ key: l }, h) => t === l && h !== s);
177
+ const o = (t, s) => !e.some(({ key: l }, h) => t === l && h !== s);
176
178
  return D(P) || (i = e.map((t) => {
177
- const [s, l] = te(t);
179
+ const [s, l] = oe(t);
178
180
  return s && l ? { key: s, value: l } : s ? { key: s } : l ? { value: l } : null;
179
181
  })), e.forEach((t, s) => {
180
- u(t.key, s) || (F(i, [s, "key"], !1) ? i.at(s).key.push(b) : O(i, [s, "key"], [b]));
181
- }), D(i) && x && (i = x(e)), i.every((t) => de(t)) ? null : i;
182
- }, te = ({ key: e, value: i, disabled: u }) => {
182
+ o(t.key, s) || (F(i, [s, "key"], !1) ? i.at(s).key.push(U) : k(i, [s, "key"], [U]));
183
+ }), D(i) && K && (i = K(e)), i.every((t) => me(t)) ? null : i;
184
+ }, oe = ({ key: e, value: i, disabled: o }) => {
183
185
  const t = (s, l) => {
184
- const [h, a] = ye(
186
+ const [h, a] = Ve(
185
187
  P[l].filter((f) => f.pattern),
186
188
  s
187
189
  );
188
190
  return a ? null : h.filter((f) => !f.isValid).map((f) => ({ name: f.name, label: f.label }));
189
191
  };
190
- return u ? [null, null] : [t(e, "key"), t(i, "value")];
192
+ return o ? [null, null] : [t(e, "key"), t(i, "value")];
191
193
  };
192
- return /* @__PURE__ */ pe("div", { className: X, "data-testid": `${o}-chips`, children: [
193
- R && /* @__PURE__ */ T("div", { className: "chips__label", children: R }),
194
- /* @__PURE__ */ T("div", { className: R ? "chips__wrapper" : "", children: /* @__PURE__ */ T(
195
- me,
194
+ return /* @__PURE__ */ he("div", { className: G, "data-testid": `${r}-chips`, children: [
195
+ w && /* @__PURE__ */ v("div", { className: "chips__label", children: w }),
196
+ /* @__PURE__ */ v("div", { className: w ? "chips__wrapper" : "", children: /* @__PURE__ */ v(
197
+ Ie,
196
198
  {
197
- chipOptions: z,
198
- chipSizeIsRecalculated: Y,
199
- chips: M,
199
+ chipOptions: b,
200
+ chipSizeIsRecalculated: L,
201
+ chips: ie,
200
202
  editConfig: p,
201
203
  formState: n,
202
- handleAddNewChip: ee,
203
- handleEditChip: ie,
204
+ handleAddNewChip: se,
205
+ handleEditChip: le,
204
206
  handleRemoveChip: g,
205
- handleShowElements: L,
206
- handleToEditMode: se,
207
+ handleShowElements: Z,
208
+ handleToEditMode: te,
209
+ isDeletable: X,
207
210
  isEditable: m,
208
- name: o,
209
- ref: { chipsCellRef: G, chipsWrapperRef: J, hiddenChipsCounterRef: Q, hiddenChipsPopUpRef: Z },
210
- setChipSizeIsRecalculated: A,
211
- setChipsSizes: S,
212
- setEditConfig: C,
213
- shortChips: W,
214
- showChips: E,
215
- showHiddenChips: v,
216
- validateFields: le,
217
- validationRules: P
211
+ name: r,
212
+ ref: { chipsCellRef: J, chipsWrapperRef: Q, hiddenChipsCounterRef: S, hiddenChipsPopUpRef: E },
213
+ setChipSizeIsRecalculated: Y,
214
+ setChipsSizes: M,
215
+ setEditConfig: I,
216
+ shortChips: $,
217
+ showChips: ee,
218
+ showHiddenChips: _,
219
+ validateFields: re,
220
+ validationRules: P,
221
+ visibleChipsMaxLength: C,
222
+ children: W
218
223
  }
219
224
  ) })
220
225
  ] });
221
226
  };
222
- w.propTypes = {
223
- chipOptions: Ce,
224
- className: r.string,
225
- delimiter: r.oneOfType([r.string, r.element]),
226
- formState: r.object.isRequired,
227
- initialValues: r.object.isRequired,
228
- isEditable: r.bool,
229
- label: r.string,
230
- name: r.string.isRequired,
231
- onClick: r.func,
232
- onExitEditModeCallback: r.func,
233
- shortChips: r.bool,
234
- validationRules: r.object,
235
- validator: r.func,
236
- visibleChipsMaxLength: r.oneOfType([r.string, r.number]),
237
- withInitialParentWidth: r.bool
227
+ V.propTypes = {
228
+ chipOptions: ye,
229
+ children: u.node,
230
+ className: u.string,
231
+ delimiter: u.oneOfType([u.string, u.element]),
232
+ formState: u.object.isRequired,
233
+ initialValues: u.object.isRequired,
234
+ isDeletable: u.bool,
235
+ isEditable: u.bool,
236
+ label: u.string,
237
+ name: u.string.isRequired,
238
+ onClick: u.func,
239
+ onExitEditModeCallback: u.func,
240
+ shortChips: u.bool,
241
+ validationRules: u.object,
242
+ validator: u.func,
243
+ visibleChipsMaxLength: ge,
244
+ withInitialParentWidth: u.bool
238
245
  };
239
- w = ce.memo(w);
240
- const Ue = w;
246
+ V = ae.memo(V);
247
+ const ze = V;
241
248
  export {
242
- Ue as default
249
+ ze as default
243
250
  };
244
251
  //# sourceMappingURL=FormChipCell.mjs.map