intelicoreact 1.0.76 → 1.0.78

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.
@@ -364,9 +364,11 @@ var Dropdown = function Dropdown(_ref) {
364
364
  (0, _react.useLayoutEffect)(function () {
365
365
  window.addEventListener('resize', setListContainerStyles);
366
366
  window.addEventListener('mousewheel', closeList);
367
+ window.addEventListener('touchmove', closeList);
367
368
  return function () {
368
369
  window.removeEventListener('resize', setListContainerStyles);
369
370
  window.removeEventListener('mousewheel', closeList);
371
+ window.removeEventListener('touchmove', closeList);
370
372
  };
371
373
  }, [getListContainer]);
372
374
  (0, _react.useEffect)(function () {
@@ -401,6 +403,9 @@ var Dropdown = function Dropdown(_ref) {
401
403
  setIsOpen(true);
402
404
  };
403
405
 
406
+ (0, _react.useEffect)(function () {
407
+ if (isOpen && isSearching) setSearchValue(selectedLabel);
408
+ }, [isSearching]);
404
409
  var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
405
410
  return option.value === value;
406
411
  })) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
@@ -429,12 +434,15 @@ var Dropdown = function Dropdown(_ref) {
429
434
  className: "".concat(RC, "__input"),
430
435
  value: isSearching ? searchValue !== null && searchValue !== void 0 ? searchValue : '' : selectedLabel || '',
431
436
  onChange: function onChange(e) {
437
+ console.log({
438
+ searchValue: searchValue,
439
+ selectedLabel: selectedLabel
440
+ });
441
+ setIsSearching(true);
432
442
  onSearchHandler(e.target.value);
433
443
  },
434
444
  placeholder: placeholder,
435
445
  onFocus: function onFocus(e) {
436
- setSearchValue(selectedLabel);
437
- setIsSearching(true);
438
446
  e.target.select();
439
447
  },
440
448
  onBlur: function onBlur() {
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _reactFeather = require("react-feather");
15
+
16
+ require("./FileLoaderLocal.scss");
17
+
18
+ var FileLoaderLocal = function FileLoaderLocal(_ref) {
19
+ var id = _ref.id,
20
+ label = _ref.label,
21
+ error = _ref.error,
22
+ isRequired = _ref.isRequired,
23
+ accept = _ref.accept,
24
+ onChange = _ref.onChange,
25
+ className = _ref.className,
26
+ value = _ref.value,
27
+ isNoTrashIcon = _ref.isNoTrashIcon;
28
+
29
+ var getFileName = function getFileName(value) {
30
+ var result = value.match(/[^\\]+$/);
31
+ return onChange({
32
+ value: result[0],
33
+ id: id
34
+ });
35
+ };
36
+
37
+ var renderRequiredLabel = function renderRequiredLabel() {
38
+ if (!value) {
39
+ if (isRequired) return /*#__PURE__*/_react.default.createElement("div", {
40
+ className: "file-loader-local--required"
41
+ }, "Required");else return /*#__PURE__*/_react.default.createElement("div", {
42
+ className: "file-loader-local--optional"
43
+ }, "Optional");
44
+ }
45
+ };
46
+
47
+ return /*#__PURE__*/_react.default.createElement("div", {
48
+ className: (0, _classnames.default)('file-loader-local', className)
49
+ }, /*#__PURE__*/_react.default.createElement("input", {
50
+ onChange: function onChange(e) {
51
+ return getFileName(e.target.value);
52
+ },
53
+ className: "file-loader-local__file-input",
54
+ id: "file-input-".concat(id),
55
+ type: "file",
56
+ name: "file",
57
+ required: isRequired,
58
+ accept: accept
59
+ }), /*#__PURE__*/_react.default.createElement("label", {
60
+ className: "file-loader-local__label-box",
61
+ htmlFor: "file-input-".concat(id)
62
+ }, /*#__PURE__*/_react.default.createElement("div", {
63
+ className: "j4"
64
+ }, !value && /*#__PURE__*/_react.default.createElement(_reactFeather.Download, {
65
+ className: "file-loader-local__upload-icon"
66
+ }), value && /*#__PURE__*/_react.default.createElement(_reactFeather.Paperclip, {
67
+ className: "file-loader-local__upload-icon"
68
+ }), /*#__PURE__*/_react.default.createElement("div", {
69
+ className: (0, _classnames.default)('file-loader-local__label', {
70
+ 'file-loader-local__label-filled': value
71
+ })
72
+ }, /*#__PURE__*/_react.default.createElement("span", {
73
+ className: "file-loader-local__label-text"
74
+ }, value || label), error && /*#__PURE__*/_react.default.createElement("span", {
75
+ className: "file-loader-local__error"
76
+ }, error))), value && !isNoTrashIcon && /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, {
77
+ className: "file-loader-local__trash-icon",
78
+ onClick: function onClick() {
79
+ return onChange({
80
+ id: id
81
+ });
82
+ }
83
+ }), renderRequiredLabel()));
84
+ };
85
+
86
+ var _default = FileLoaderLocal;
87
+ exports.default = _default;
@@ -0,0 +1,84 @@
1
+ .file-loader-local {
2
+ display: flex;
3
+ align-items: center;
4
+ background-color: #FFFFFF;
5
+ position: relative;
6
+ box-sizing: border-box;
7
+ min-height: 50px;
8
+ border-radius: 8px;
9
+ box-shadow: 0px 2px 8px rgb(39 73 113 / 15%);
10
+
11
+ &__file-input {
12
+ width: 0.1px;
13
+ height: 0.1px;
14
+ opacity: 0;
15
+ position: absolute;
16
+ z-index: -10;
17
+ }
18
+
19
+ &__label-box {
20
+ cursor: pointer;
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: space-between;
24
+ flex-wrap: nowrap;
25
+ font-family: Sarabun;
26
+ font-size: 14px;
27
+ font-weight: 400;
28
+ line-height: 20px;
29
+ color: #1F7499;
30
+ padding: 15px 18px 15px 16px;
31
+ width: 100%;
32
+ max-height: 50px;
33
+ box-sizing: border-box;
34
+ }
35
+
36
+ &__upload-icon {
37
+ transform: rotate(180deg);
38
+ min-height: 16px;
39
+ max-height: 16px;
40
+ min-width: 16px;
41
+ max-width: 16px;
42
+ stroke-width: 1.5px;
43
+ margin-right: 8px;
44
+ color: #A0A4B0;
45
+ }
46
+
47
+ &__trash-icon {
48
+ min-height: 16px;
49
+ max-height: 16px;
50
+ min-width: 16px;
51
+ max-width: 16px;
52
+ color: #F06D8D;
53
+ }
54
+
55
+ &__label {
56
+ display: flex;
57
+ flex-direction: column;
58
+ }
59
+
60
+ &__label-text {
61
+ white-space: nowrap;
62
+ word-break: break-word;
63
+ overflow: hidden;
64
+ text-overflow: ellipsis;
65
+ width: 200px;
66
+ }
67
+
68
+ &__label-filled {
69
+ color: #171D33;
70
+ }
71
+
72
+ &__error {
73
+ color: #F06D8D;
74
+ font-size: 12px;
75
+ }
76
+
77
+ &--required {
78
+ color: #F06D8D;
79
+ }
80
+
81
+ &--optional {
82
+ color: #757F8C;
83
+ }
84
+ }
@@ -87,7 +87,8 @@ var InputDateRange = function InputDateRange(props) {
87
87
  isCompare = _useState4[0],
88
88
  setIsCompare = _useState4[1];
89
89
 
90
- var ref = !isUseAbs ? (0, _dependencies.useClickOutside)(toggleOff) : (0, _react.useRef)(null);
90
+ var dropdownContainers = document.getElementsByClassName('dropdown__container');
91
+ var ref = !isUseAbs ? (0, _dependencies.useClickOutside)(toggleOff, dropdownContainers) : (0, _react.useRef)(null);
91
92
  var internalContainerRef = (0, _react.useRef)(null);
92
93
 
93
94
  var handleChange = function handleChange(input) {
@@ -31,9 +31,23 @@ var useClickOutside = function useClickOutside(hideComponent, additionalComponen
31
31
  var ref = (0, _react.useRef)(null);
32
32
 
33
33
  var checkCondition = function checkCondition(target) {
34
- var _ref$current, _ref$current2;
34
+ if (additionalComponent) {
35
+ if (additionalComponent !== null && additionalComponent !== void 0 && additionalComponent.length) {
36
+ var _ref$current, _Array$from;
35
37
 
36
- return additionalComponent ? !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target)) && !(additionalComponent !== null && additionalComponent !== void 0 && additionalComponent.contains(target)) : !((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.contains(target));
38
+ return !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target)) && !((_Array$from = Array.from(additionalComponent)) !== null && _Array$from !== void 0 && _Array$from.some(function (item) {
39
+ return item === null || item === void 0 ? void 0 : item.contains(target);
40
+ }));
41
+ } else {
42
+ var _ref$current2;
43
+
44
+ return !((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.contains(target)) && !(additionalComponent !== null && additionalComponent !== void 0 && additionalComponent.contains(target));
45
+ }
46
+ } else {
47
+ var _ref$current3;
48
+
49
+ return !((_ref$current3 = ref.current) !== null && _ref$current3 !== void 0 && _ref$current3.contains(target));
50
+ }
37
51
  };
38
52
 
39
53
  var handleClickOutside = (0, _react.useCallback)(function (_ref) {
@@ -55,6 +55,8 @@ var RangeList = function RangeList(props) {
55
55
  error = props.error,
56
56
  defaultErrorText = props.defaultErrorText,
57
57
  nullValueText = props.nullValueText,
58
+ _props$isOnlyOneRow = props.isOnlyOneRow,
59
+ isOnlyOneRow = _props$isOnlyOneRow === void 0 ? false : _props$isOnlyOneRow,
58
60
  testId = props.testId;
59
61
  var NULL_VALUE_TEXT = nullValueText !== null && nullValueText !== void 0 ? nullValueText : 'No data';
60
62
 
@@ -76,6 +78,7 @@ var RangeList = function RangeList(props) {
76
78
  var inputFromRef = (0, _react.useRef)(null);
77
79
  var inputToRef = (0, _react.useRef)(null);
78
80
  var isValidRange = !!(state !== null && state !== void 0 && state.from && state !== null && state !== void 0 && state.to && +(state === null || state === void 0 ? void 0 : state.from) <= +(state === null || state === void 0 ? void 0 : state.to));
81
+ var isShowRow = isOnlyOneRow && (value === null || value === void 0 ? void 0 : value.length) === 0 || !isOnlyOneRow;
79
82
  var handle = {
80
83
  inputsChange: function inputsChange(val, prop) {
81
84
  return setState(_objectSpread(_objectSpread({}, state), {}, (0, _defineProperty2.default)({}, prop, val)));
@@ -126,6 +129,60 @@ var RangeList = function RangeList(props) {
126
129
  if (code === 13) inputToRef.current.blur();
127
130
  }
128
131
  };
132
+
133
+ var renderInputsAndAddButtonRow = function renderInputsAndAddButtonRow() {
134
+ return /*#__PURE__*/_react.default.createElement("div", {
135
+ className: (0, _classnames.default)("".concat(RC, "__row"), "".concat(RC, "__inputs"))
136
+ }, /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
137
+ className: "".concat(RC, "__cell-input")
138
+ }, /*#__PURE__*/_react.default.createElement(_Input.default, {
139
+ testId: "range-list".concat(testId && "--".concat(testId), "-from"),
140
+ ref: inputFromRef,
141
+ onlyNumbers: isFloatValues ? {
142
+ type: 'float',
143
+ decimalPlaces: decimalPlaces || 0
144
+ } : {
145
+ type: 'int'
146
+ },
147
+ value: state.from,
148
+ onBlur: function onBlur(e) {
149
+ return handle.rangeValidation(e, 'from');
150
+ },
151
+ onChange: function onChange(val) {
152
+ return handle.inputsChange(val, 'from');
153
+ },
154
+ onKeyUp: function onKeyUp(code) {
155
+ return handle.onKeyUpFromInput(code);
156
+ }
157
+ })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
158
+ className: "".concat(RC, "__cell-input")
159
+ }, /*#__PURE__*/_react.default.createElement(_Input.default, {
160
+ testId: "range-list".concat(testId && "--".concat(testId), "-to"),
161
+ ref: inputToRef,
162
+ onlyNumbers: isFloatValues ? {
163
+ type: 'float',
164
+ decimalPlaces: decimalPlaces || 0
165
+ } : {
166
+ type: 'int'
167
+ },
168
+ value: state.to,
169
+ onBlur: function onBlur(e) {
170
+ return handle.rangeValidation(e, 'to');
171
+ },
172
+ onChange: function onChange(val) {
173
+ return handle.inputsChange(val, 'to');
174
+ },
175
+ onKeyUp: function onKeyUp(code) {
176
+ return handle.onKeyUpToInput(code);
177
+ }
178
+ })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
179
+ className: "".concat(RC, "__cell-button")
180
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
181
+ testId: "range-list".concat(testId && "--".concat(testId), "-button"),
182
+ onClick: handle.addRange
183
+ }, "Add")));
184
+ };
185
+
129
186
  return /*#__PURE__*/_react.default.createElement("div", {
130
187
  className: (0, _classnames.default)(RC, className, (0, _defineProperty2.default)({}, "".concat(RC, "_disabled"), disabled))
131
188
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -134,56 +191,7 @@ var RangeList = function RangeList(props) {
134
191
  className: "".concat(RC, "__cell-label")
135
192
  }, "From"), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
136
193
  className: "".concat(RC, "__cell-label")
137
- }, "To")), /*#__PURE__*/_react.default.createElement("div", {
138
- className: (0, _classnames.default)("".concat(RC, "__row"), "".concat(RC, "__inputs"))
139
- }, /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
140
- className: "".concat(RC, "__cell-input")
141
- }, /*#__PURE__*/_react.default.createElement(_Input.default, {
142
- testId: "range-list".concat(testId && "--".concat(testId), "-from"),
143
- ref: inputFromRef,
144
- onlyNumbers: isFloatValues ? {
145
- type: 'float',
146
- decimalPlaces: decimalPlaces || 0
147
- } : {
148
- type: 'int'
149
- },
150
- value: state.from,
151
- onBlur: function onBlur(e) {
152
- return handle.rangeValidation(e, 'from');
153
- },
154
- onChange: function onChange(val) {
155
- return handle.inputsChange(val, 'from');
156
- },
157
- onKeyUp: function onKeyUp(code) {
158
- return handle.onKeyUpFromInput(code);
159
- }
160
- })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
161
- className: "".concat(RC, "__cell-input")
162
- }, /*#__PURE__*/_react.default.createElement(_Input.default, {
163
- testId: "range-list".concat(testId && "--".concat(testId), "-to"),
164
- ref: inputToRef,
165
- onlyNumbers: isFloatValues ? {
166
- type: 'float',
167
- decimalPlaces: decimalPlaces || 0
168
- } : {
169
- type: 'int'
170
- },
171
- value: state.to,
172
- onBlur: function onBlur(e) {
173
- return handle.rangeValidation(e, 'to');
174
- },
175
- onChange: function onChange(val) {
176
- return handle.inputsChange(val, 'to');
177
- },
178
- onKeyUp: function onKeyUp(code) {
179
- return handle.onKeyUpToInput(code);
180
- }
181
- })), /*#__PURE__*/_react.default.createElement(_RangeListRow.RangeListCell, {
182
- className: "".concat(RC, "__cell-button")
183
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
184
- testId: "range-list".concat(testId && "--".concat(testId), "-button"),
185
- onClick: handle.addRange
186
- }, "Add"))), (innerError || outerError || error) && /*#__PURE__*/_react.default.createElement("span", {
194
+ }, "To")), isShowRow && renderInputsAndAddButtonRow(), (innerError || outerError || error) && /*#__PURE__*/_react.default.createElement("span", {
187
195
  className: "".concat(RC, "__error")
188
196
  }, innerError || error || outerError), !(value !== null && value !== void 0 && value.length) && /*#__PURE__*/_react.default.createElement("div", {
189
197
  className: (0, _classnames.default)("".concat(RC, "__row"), "".concat(RC, "__values"), "".concat(RC, "__null-value"))
@@ -196,7 +196,9 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
196
196
  var disabled = _ref4.disabled;
197
197
  return disabled === true;
198
198
  }) || parent.disabled
199
- }), renderInner(parent));
199
+ }), /*#__PURE__*/_react.default.createElement("div", {
200
+ className: (0, _classnames.default)("".concat(RC, "__parent__children"))
201
+ }, renderInner(parent)));
200
202
  }));
201
203
  };
202
204
 
@@ -1,6 +1,10 @@
1
1
  .tiered-checkboxes {
2
2
  &__parents {
3
3
  margin-bottom: 25px;
4
+
5
+ & > label {
6
+ display: inline-flex;
7
+ }
4
8
  }
5
9
 
6
10
  &__children {
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ require("./Box.scss");
15
+
16
+ // global
17
+ // styles
18
+ var directionVariants = {
19
+ column: 'column',
20
+ row: 'row'
21
+ };
22
+ var sizes = {
23
+ none: 'none',
24
+ xs: 'xs',
25
+ s: 's',
26
+ m: 'm',
27
+ l: 'l',
28
+ xl: 'xl'
29
+ };
30
+
31
+ var Box = function Box(_ref) {
32
+ var children = _ref.children,
33
+ _ref$paddingVariant = _ref.paddingVariant,
34
+ paddingVariant = _ref$paddingVariant === void 0 ? sizes.m : _ref$paddingVariant,
35
+ _ref$radiiVariant = _ref.radiiVariant,
36
+ radiiVariant = _ref$radiiVariant === void 0 ? sizes.s : _ref$radiiVariant,
37
+ _ref$direction = _ref.direction,
38
+ direction = _ref$direction === void 0 ? directionVariants.column : _ref$direction,
39
+ className = _ref.className;
40
+ var styles = {
41
+ flexDirection: direction
42
+ };
43
+ return /*#__PURE__*/_react.default.createElement("div", {
44
+ style: styles,
45
+ className: (0, _classnames.default)('box', "box--padding-".concat(paddingVariant), "box--radii-".concat(radiiVariant), className, {
46
+ df: direction === directionVariants.row,
47
+ 'dfc-jc': direction === directionVariants.column
48
+ })
49
+ }, children);
50
+ };
51
+
52
+ var _default = Box;
53
+ exports.default = _default;
@@ -0,0 +1,58 @@
1
+ @import '../../../scss/_vars';
2
+
3
+ .box {
4
+ box-sizing: border-box;
5
+ height: fit-content;
6
+
7
+ border: 1px solid #E1E8F1;
8
+
9
+ &--radii-none {
10
+ border-radius: 0;
11
+ }
12
+
13
+
14
+ &--radii-xs {
15
+ border-radius: $radii-xs;
16
+ }
17
+
18
+ &--radii-s {
19
+ border-radius: $radii-s;
20
+ }
21
+
22
+ &--radii-m {
23
+ border-radius: $radii-m;
24
+ }
25
+
26
+ &--radii-l {
27
+ border-radius: $radii-l;
28
+ }
29
+
30
+ &--radii-xl {
31
+ border-radius: $radii-xl;
32
+ }
33
+
34
+ &--padding-none {
35
+ padding: 0;
36
+ }
37
+
38
+
39
+ &--padding-xs {
40
+ padding: $spacing-xs;
41
+ }
42
+
43
+ &--padding-s {
44
+ padding: $spacing-s;
45
+ }
46
+
47
+ &--padding-m {
48
+ padding: $spacing-m;
49
+ }
50
+
51
+ &--padding-l {
52
+ padding: $spacing-l;
53
+ }
54
+
55
+ &--padding-xl {
56
+ padding: $spacing-xl;
57
+ }
58
+ }
@@ -2,6 +2,19 @@
2
2
  //@import "anme/scss/anme-vars";
3
3
  @import "~anme/scss/anme-vars";
4
4
 
5
+ $radii-xs: 4px;
6
+ $radii-s: 8px;
7
+ $radii-m: 16px;
8
+ $radii-l: 24px;
9
+ $radii-xl: 32px;
10
+
11
+
12
+ $spacing-xs: 4px;
13
+ $spacing-s: 8px;
14
+ $spacing-m: 16px;
15
+ $spacing-l: 24px;
16
+ $spacing-xl: 32px;
17
+
5
18
  /* THEME COLORS */
6
19
 
7
20
  $color--secondary: #F06D8D;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [