intelicoreact 0.2.89 → 0.2.92

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.
@@ -1434,7 +1434,7 @@ function InputMask() {
1434
1434
  onBlur: onBlur
1435
1435
  }, /*#__PURE__*/_react.default.createElement("div", {
1436
1436
  className: "\n input-mask\n ".concat(isError ? 'input-mask_error' : '', "\n ").concat(isFocused ? 'input-mask_focus' : '', "\n ").concat(blinkError ? 'input-mask_blink-error' : '', "\n "),
1437
- "data-testId": testId,
1437
+ "data-testid": testId,
1438
1438
  onMouseDown: function onMouseDown(e) {
1439
1439
  return cancelDefaultAction(e, function () {
1440
1440
  return setIsMouseDown(true);
@@ -55,7 +55,8 @@ var RangeInputs = function RangeInputs(_ref) {
55
55
  _ref$label = _ref.label,
56
56
  label = _ref$label === void 0 ? '' : _ref$label,
57
57
  _ref$isPrice = _ref.isPrice,
58
- isPrice = _ref$isPrice === void 0 ? false : _ref$isPrice;
58
+ isPrice = _ref$isPrice === void 0 ? false : _ref$isPrice,
59
+ testId = _ref.testId;
59
60
 
60
61
  var _useState = (0, _react.useState)({
61
62
  from: '',
@@ -69,13 +70,15 @@ var RangeInputs = function RangeInputs(_ref) {
69
70
  var inputToRef = (0, _react.useRef)(null);
70
71
 
71
72
  var isValidRange = function isValidRange(from, to) {
72
- var correctFrom = +(from === null || from === void 0 ? void 0 : from.replace(/[^\d]/g, ''));
73
- var correntTo = +(to === null || to === void 0 ? void 0 : to.replace(/[^\d]/g, ''));
73
+ var replaceNotDigitFrom = from === null || from === void 0 ? void 0 : from.toString().replace(/[^\d]/g, ''),
74
+ replaceNotDigitFromTo = to === null || to === void 0 ? void 0 : to.toString().replace(/[^\d]/g, '');
75
+ var correctFrom = parseInt(replaceNotDigitFrom);
76
+ var correntTo = parseInt(replaceNotDigitFromTo);
74
77
  return !!(correctFrom && correntTo && correctFrom <= correntTo);
75
78
  };
76
79
 
77
80
  var valueFormatter = function valueFormatter(value) {
78
- if (type === 'float') return (0, _fieldValueFormatters.filterFloat)(value);else if (isPrice) return (0, _utils.addBitDepthPoints)(value.replace(/[^\d]/g, ''));else return (0, _fieldValueFormatters.formatOnlyNumbers)(value);
81
+ if (type === 'float') return (0, _fieldValueFormatters.filterFloat)(value);else if (isPrice) return (0, _utils.addBitDepthPoints)(value === null || value === void 0 ? void 0 : value.replace(/[^\d]/g, ''));else return (0, _fieldValueFormatters.formatOnlyNumbers)(value);
79
82
  };
80
83
 
81
84
  var handleChange = function handleChange(prop, val) {
@@ -123,6 +126,7 @@ var RangeInputs = function RangeInputs(_ref) {
123
126
  }, /*#__PURE__*/_react.default.createElement("span", {
124
127
  className: "".concat(RC, "__input-label")
125
128
  }, "From"), /*#__PURE__*/_react.default.createElement(_Input.default, {
129
+ testId: "".concat(testId, "--from"),
126
130
  ref: inputFromRef,
127
131
  value: (_valueObj$from = valueObj === null || valueObj === void 0 ? void 0 : valueObj.from) !== null && _valueObj$from !== void 0 ? _valueObj$from : '',
128
132
  onChange: function onChange(val) {
@@ -145,6 +149,7 @@ var RangeInputs = function RangeInputs(_ref) {
145
149
  }, /*#__PURE__*/_react.default.createElement("span", {
146
150
  className: "".concat(RC, "__input-label")
147
151
  }, "to"), /*#__PURE__*/_react.default.createElement(_Input.default, {
152
+ testId: "".concat(testId, "--to"),
148
153
  ref: inputToRef,
149
154
  value: (_valueObj$to = valueObj === null || valueObj === void 0 ? void 0 : valueObj.to) !== null && _valueObj$to !== void 0 ? _valueObj$to : '',
150
155
  onChange: function onChange(val) {
@@ -21,6 +21,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
21
21
 
22
22
  var _reactFeather = require("react-feather");
23
23
 
24
+ var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
25
+
24
26
  var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
25
27
 
26
28
  var _Label = _interopRequireDefault(require("../Label/Label"));
@@ -51,7 +53,9 @@ var TagsDropdown = function TagsDropdown(_ref) {
51
53
  disabled = _ref.disabled,
52
54
  isValuesInTags = _ref.isValuesInTags,
53
55
  _ref$isNotValidateASC = _ref.isNotValidateASCII,
54
- isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC;
56
+ isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC,
57
+ _ref$noTagsWrap = _ref.noTagsWrap,
58
+ noTagsWrap = _ref$noTagsWrap === void 0 ? false : _ref$noTagsWrap;
55
59
 
56
60
  var _useState = (0, _react.useState)(false),
57
61
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -134,10 +138,22 @@ var TagsDropdown = function TagsDropdown(_ref) {
134
138
  }, /*#__PURE__*/_react.default.createElement("div", {
135
139
  className: "".concat(RC, "__trigger"),
136
140
  onClick: function onClick(e) {
137
- if (e.target.className === "".concat(RC, "__trigger") || e.target.className === "tags-dropdown__arrow" || e.target.tagName === 'svg' && e.target.parentNode.className !== 'tag__button') setIsOpen(!isOpen);else if (e.target.tagName === 'INPUT') setIsOpen(true);
141
+ if (e.target.className.indexOf('tag__label') !== -1 || e.target.className.indexOf('tag-list_wrapper') !== -1 || e.target.className === "".concat(RC, "__trigger") || e.target.className === "tags-dropdown__arrow" || e.target.tagName === 'svg' && e.target.parentNode.className !== 'tag__button') setIsOpen(!isOpen);else if (e.target.tagName === 'INPUT') setIsOpen(true);
138
142
  }
139
- }, chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(function (value) {
140
- // el.list?.find?.(e => e.value === value)
143
+ }, noTagsWrap ? /*#__PURE__*/_react.default.createElement(_TagList.default, {
144
+ items: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(function (value, i) {
145
+ var tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(function (el) {
146
+ return el.value === value;
147
+ });
148
+ var label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
149
+ return {
150
+ value: value,
151
+ label: label,
152
+ id: i
153
+ };
154
+ }),
155
+ disableShowMore: true
156
+ }) : chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(function (value) {
141
157
  var tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(function (el) {
142
158
  return el.value === value;
143
159
  });
@@ -150,17 +166,17 @@ var TagsDropdown = function TagsDropdown(_ref) {
150
166
  return deleteChosen(value);
151
167
  }
152
168
  });
153
- }), /*#__PURE__*/_react.default.createElement("input", {
169
+ }), chosenOptions.length === 0 || !noTagsWrap ? /*#__PURE__*/_react.default.createElement("input", {
154
170
  className: "".concat(RC, "__input"),
155
171
  value: searchValue,
156
172
  onChange: function onChange(e) {
157
173
  return onSearchHandler(e.target.value);
158
174
  },
159
- placeholder: placeholder || "Select from list",
175
+ placeholder: placeholder || 'Select from list',
160
176
  onKeyDown: function onKeyDown(e) {
161
177
  return onKeyPress(e, searchValue);
162
178
  }
163
- }), /*#__PURE__*/_react.default.createElement("span", {
179
+ }) : '', /*#__PURE__*/_react.default.createElement("span", {
164
180
  className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen))
165
181
  }, /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, {
166
182
  className: "color--text"
@@ -1,7 +1,7 @@
1
1
  @import "../../../scss/vars";
2
2
 
3
3
  .tags-dropdown {
4
- display: inline-flex;
4
+ display: flex;
5
5
  flex-direction: column;
6
6
  position: relative;
7
7
  width: 100%;
@@ -144,6 +144,13 @@
144
144
  cursor: auto;
145
145
  }
146
146
 
147
+ .tag-list_wrapper {
148
+ box-sizing: border-box;
149
+ background-color: rgba(0,0,0,0);
150
+ padding: 0;
151
+ width: auto;
152
+ }
153
+
147
154
  &_arrow-static {
148
155
  .tags-dropdown__trigger {
149
156
  position: static;
@@ -31,7 +31,9 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
31
31
  onChange = _ref.onChange,
32
32
  isUseParentsClassesAsDataset = _ref.isUseParentsClassesAsDataset,
33
33
  isUseAccordionForGroup = _ref.isUseAccordionForGroup,
34
- accordionIcons = _ref.accordionIcons;
34
+ accordionIcons = _ref.accordionIcons,
35
+ _ref$isOnlyOne = _ref.isOnlyOne,
36
+ isOnlyOne = _ref$isOnlyOne === void 0 ? false : _ref$isOnlyOne;
35
37
  var handle = {
36
38
  changeParent: function changeParent(value, key, prop) {
37
39
  var parent = items.find(function (item) {
@@ -56,15 +58,39 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
56
58
  onChange((0, _toConsumableArray2.default)(items));
57
59
  },
58
60
  changeChild: function changeChild(value, key, parentKey) {
59
- var parent = items.find(function (item) {
60
- return item.key === parentKey;
61
- });
62
- parent.children.find(function (item) {
63
- return item.key === key;
64
- }).value = value;
65
- if (parent.children.every(function (item) {
66
- return item.value;
67
- })) parent.value = true;else parent.value = false;
61
+ if (isOnlyOne) {
62
+ var parent = items.find(function (item) {
63
+ return item.key === parentKey;
64
+ });
65
+ parent.children.find(function (item) {
66
+ return item.key === key;
67
+ }).value = value;
68
+ parent.children.map(function (item) {
69
+ if (item.key !== key && value === true) {
70
+ item.disabled = true;
71
+ parent.disabled = true;
72
+ } else if (item.key !== key && value === false) {
73
+ item.disabled = false;
74
+ parent.disabled = false;
75
+ } else item.disabled = false;
76
+
77
+ return item;
78
+ });
79
+ parent.disabled = true;
80
+ console.log(parent);
81
+ } else {
82
+ var _parent = items.find(function (item) {
83
+ return item.key === parentKey;
84
+ });
85
+
86
+ _parent.children.find(function (item) {
87
+ return item.key === key;
88
+ }).value = value;
89
+ if (_parent.children.every(function (item) {
90
+ return item.value;
91
+ })) _parent.value = true;else _parent.value = false;
92
+ }
93
+
68
94
  onChange((0, _toConsumableArray2.default)(items));
69
95
  },
70
96
  isAllChecked: function isAllChecked(item) {
@@ -131,7 +157,7 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
131
157
  disabled: parent.children.every(function (_ref4) {
132
158
  var disabled = _ref4.disabled;
133
159
  return disabled === true;
134
- })
160
+ }) || parent.disabled
135
161
  }), renderInner(parent));
136
162
  }));
137
163
  };
@@ -53,7 +53,7 @@ var AccordionWithCheckbox = function AccordionWithCheckbox(_ref) {
53
53
  disabled: parent.children.every(function (_ref2) {
54
54
  var disabled = _ref2.disabled;
55
55
  return disabled === true;
56
- })
56
+ }) || parent.disabled
57
57
  }), /*#__PURE__*/_react.default.createElement("span", {
58
58
  className: "".concat(RC, "__description-checked")
59
59
  }, parent !== null && parent !== void 0 && (_parent$children3 = parent.children) !== null && _parent$children3 !== void 0 && _parent$children3.length ? "Selected ".concat(parent.children.filter(function (child) {
@@ -76,7 +76,7 @@ var MonoAccordion = function MonoAccordion(_ref) {
76
76
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, datasetProp, {
77
77
  className: (0, _classnames.default)(RC, className, (_cn = {}, (0, _defineProperty2.default)(_cn, "".concat(RC, "_is-open"), isOpen), (0, _defineProperty2.default)(_cn, "".concat(RC, "_disabled"), disabled), _cn))
78
78
  }), /*#__PURE__*/_react.default.createElement("div", {
79
- "data-testId": "accordionHeader--key-".concat(testId, "--clickable"),
79
+ "data-testid": "accordionHeader--key-".concat(testId, "--clickable"),
80
80
  className: "".concat(RC, "__head"),
81
81
  onClick: handleClick
82
82
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -48,6 +48,8 @@ var TagList = function TagList(_ref) {
48
48
  items = _ref$items === void 0 ? [] : _ref$items,
49
49
  _ref$withToggle = _ref.withToggle,
50
50
  withToggle = _ref$withToggle === void 0 ? true : _ref$withToggle,
51
+ _ref$disableShowMore = _ref.disableShowMore,
52
+ disableShowMore = _ref$disableShowMore === void 0 ? false : _ref$disableShowMore,
51
53
  _ref$shownItemsCount = _ref.shownItemsCount,
52
54
  shownItemsCount = _ref$shownItemsCount === void 0 ? 'auto' : _ref$shownItemsCount,
53
55
  _ref$testId = _ref.testId,
@@ -199,7 +201,7 @@ var TagList = function TagList(_ref) {
199
201
  return /*#__PURE__*/_react.default.createElement(_Tag.default, {
200
202
  label: "+".concat(restItems),
201
203
  className: "tag-list_wrapper_render-more",
202
- onClick: function onClick(e) {
204
+ onClick: disableShowMore ? function () {} : function (e) {
203
205
  return cancelDefault(e, function () {
204
206
  return setRenderAll(true);
205
207
  });
@@ -1,8 +1,6 @@
1
- .tag-list_wrapper{
2
- width: 25%!important;
3
- // min-width: 25%!important;
4
- // max-width: 25%!important;
5
- background-color: #fbf9f9;
6
- padding: 25px;
7
- flex-wrap: wrap;
8
- }
1
+ // .tag-list_wrapper{
2
+ // width: 25%!important;
3
+ // background-color: #fbf9f9;
4
+ // padding: 25px;
5
+ // flex-wrap: wrap;
6
+ // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "0.2.89",
3
+ "version": "0.2.92",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [