intelicoreact 1.4.28 → 1.4.30

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.
@@ -63,9 +63,13 @@ const Dropdown = _ref => {
63
63
  attributesOfNativeInput = {},
64
64
  isDoNotPullOutListOfMainContainer,
65
65
  withMobileLogic,
66
+ withActions,
66
67
  minItemsForShowMobileSearch = MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH,
67
68
  customTrigger,
68
- tabIndex
69
+ tabIndex,
70
+ onActionConfirmClick,
71
+ onActionCancelClick,
72
+ isDefaultOpened
69
73
  } = _ref;
70
74
  const {
71
75
  isMobile: isMobileProp
@@ -497,6 +501,7 @@ const Dropdown = _ref => {
497
501
  (0, _react.useEffect)(() => {
498
502
  if (!isDoNotPullOutListOfMainContainer || dropdownRef.current) {
499
503
  initListContainer();
504
+ if (isDefaultOpened) setIsOpen(true);
500
505
  }
501
506
  }, [isDoNotPullOutListOfMainContainer, dropdownRef.current]);
502
507
  (0, _react.useLayoutEffect)(() => {
@@ -565,8 +570,9 @@ const Dropdown = _ref => {
565
570
 
566
571
  (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 ? void 0 : _getListContainer5.classList.add("dropdown__container--opened");
567
572
  } else {
568
- var _getListContainer6;
573
+ var _searchInputRef$curre2, _getListContainer6;
569
574
 
575
+ searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre2 = searchInputRef.current) === null || _searchInputRef$curre2 === void 0 ? void 0 : _searchInputRef$curre2.blur();
570
576
  (_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.classList.remove("dropdown__container--opened");
571
577
  }
572
578
 
@@ -626,7 +632,11 @@ const Dropdown = _ref => {
626
632
  onKeyUp: onKeyUp
627
633
  }, /*#__PURE__*/_react.default.createElement("button", {
628
634
  "data-testid": "dropdown--".concat(testId || "", "--container"),
629
- className: "".concat(RC, "__trigger input__wrap ").concat(isOpen ? "input__wrap--focus" : "", " ").concat(!value ? "placeholder" : "", " ").concat(error ? "error" : ""),
635
+ className: (0, _classnames.default)("".concat(RC, "__trigger"), "input__wrap", {
636
+ ["".concat(RC, "__trigger--with-actions")]: withActions,
637
+ placeholder: !value,
638
+ error: error
639
+ }),
630
640
  onClick: () => setIsOpen(true),
631
641
  onKeyDown: onKeyDown,
632
642
  onKeyUp: onKeyUp,
@@ -657,7 +667,15 @@ const Dropdown = _ref => {
657
667
  onClick: toggleList
658
668
  }, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, {
659
669
  className: "mobile-icon"
660
- }) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null)))), isOpen && renderListContainer());
670
+ }) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null)))), withActions && /*#__PURE__*/_react.default.createElement("div", {
671
+ className: (0, _classnames.default)("".concat(RC, "__actions"))
672
+ }, /*#__PURE__*/_react.default.createElement("div", {
673
+ className: (0, _classnames.default)("".concat(RC, "__actions-item")),
674
+ onClick: onActionConfirmClick
675
+ }, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null)), /*#__PURE__*/_react.default.createElement("div", {
676
+ className: (0, _classnames.default)("".concat(RC, "__actions-item")),
677
+ onClick: onActionCancelClick
678
+ }, /*#__PURE__*/_react.default.createElement(_reactFeather.X, null))), isOpen && renderListContainer());
661
679
  };
662
680
 
663
681
  var _default = Dropdown;
@@ -3,12 +3,57 @@
3
3
  .dropdown {
4
4
  position: relative;
5
5
 
6
- display: inline-flex;
7
- flex-direction: column;
8
-
9
6
  width: 100%;
10
7
 
11
- border-radius: $radii-s;
8
+ border-radius: $radii-s;
9
+
10
+ display: flex;
11
+ flex-wrap: nowrap;
12
+ justify-content: flex-start;
13
+ align-items: center;
14
+
15
+ border: 1px solid $color--gray--light;
16
+ border-radius: $radii-xs;
17
+ background: $color--light;
18
+ overflow: hidden;
19
+
20
+ &--with-actions {
21
+ border-top-right-radius: 0;
22
+ border-bottom-right-radius: 0;
23
+ }
24
+
25
+ &__actions {
26
+ display: flex;
27
+ align-self: stretch;
28
+ align-items: center;
29
+ justify-content: center;
30
+ border-radius: 0px 2px 2px 0px;
31
+ overflow: hidden;
32
+ box-sizing: border-box;
33
+ min-width: 56px;
34
+
35
+ &-item {
36
+ height: 100%;
37
+ display: flex;
38
+ padding: 4px;
39
+ min-width: 28px;
40
+ justify-content: center;
41
+ align-items: center;
42
+ gap: 4px;
43
+ align-self: stretch;
44
+ background: var(--Background-Light-action, #F4F6FF);
45
+ box-sizing: border-box;
46
+ cursor: pointer;
47
+ border-left: 1px solid var(--Border-Input, #E2E5EC);
48
+ box-sizing: border-box;
49
+ }
50
+
51
+ svg {
52
+ width: 16px;
53
+ height: 16px;
54
+ color: #1E1E2D;
55
+ }
56
+ }
12
57
 
13
58
  &__container {
14
59
  position: fixed;
@@ -32,10 +77,8 @@
32
77
  font-weight: 400;
33
78
  cursor: pointer;
34
79
  text-align: left;
35
-
36
- border: 1px solid $color--gray--light;
37
- border-radius: $radii-xs;
38
- background: $color--light;
80
+ border: none;
81
+ filter: none;
39
82
 
40
83
  .text {
41
84
  overflow: hidden;
@@ -54,9 +97,13 @@
54
97
  &.placeholder .text {
55
98
  opacity: 0.7;
56
99
  }
100
+
101
+ input {
102
+ box-sizing: border-box;
103
+ }
57
104
  }
58
105
 
59
- &--focused &__trigger {
106
+ &--focused {
60
107
  border-color: #6b81dd;
61
108
  filter: drop-shadow(0 0 4px rgb(93 120 255 / 50%));
62
109
  }
@@ -90,7 +90,9 @@ const TagListToDropdown = _ref => {
90
90
  setNewValue(data);
91
91
  setIsValueChanged(true);
92
92
  }
93
- }, props));
93
+ }, props, {
94
+ isDefaultOpened: isEditMode
95
+ }));
94
96
  };
95
97
 
96
98
  const renderTagsList = props => {
@@ -81,6 +81,7 @@ const TagsDropdown = _ref => {
81
81
  doRequest: doLiveSearchRequest,
82
82
  attributesOfNativeInput = {},
83
83
  isUseLocalOptionsStore = true,
84
+ isDefaultOpened = false,
84
85
  withMobileLogic,
85
86
  withCreateLogic,
86
87
  withActions,
@@ -128,6 +129,7 @@ const TagsDropdown = _ref => {
128
129
  searchValueRef.current = value;
129
130
  };
130
131
 
132
+ const editingOptionInputRef = (0, _react.useRef)(null);
131
133
  const [options, setOptions] = (0, _react.useState)([]);
132
134
  const [editingOption, setEditingOptionState] = (0, _react.useState)(null);
133
135
 
@@ -411,7 +413,8 @@ const TagsDropdown = _ref => {
411
413
  onKeyDown: keyCode => {
412
414
  if (keyCode === 13) saveEditingOption();
413
415
  },
414
- symbolsLimit: "50"
416
+ symbolsLimit: "50",
417
+ ref: editingOptionInputRef
415
418
  }), /*#__PURE__*/_react.default.createElement(_Button.default, {
416
419
  variant: "link",
417
420
  icon: /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, null),
@@ -892,6 +895,7 @@ const TagsDropdown = _ref => {
892
895
 
893
896
  (0, _react.useLayoutEffect)(() => {
894
897
  initListContainer();
898
+ if (isDefaultOpened) setIsOpen(true);
895
899
  return () => {
896
900
  var _getListContainer2, _getListContainerWrap;
897
901
 
@@ -1022,13 +1026,19 @@ const TagsDropdown = _ref => {
1022
1026
  })));
1023
1027
  }, [optionsProp]);
1024
1028
  (0, _react.useEffect)(() => {
1025
- if (editingOption) setEditOptionModalStyles();
1029
+ if (editingOption) {
1030
+ var _editingOptionInputRe, _editingOptionInputRe2;
1031
+
1032
+ setEditOptionModalStyles();
1033
+ editingOptionInputRef === null || editingOptionInputRef === void 0 ? void 0 : (_editingOptionInputRe = editingOptionInputRef.current) === null || _editingOptionInputRe === void 0 ? void 0 : (_editingOptionInputRe2 = _editingOptionInputRe.focus) === null || _editingOptionInputRe2 === void 0 ? void 0 : _editingOptionInputRe2.call(_editingOptionInputRe);
1034
+ }
1026
1035
  }, [editingOption === null || editingOption === void 0 ? void 0 : editingOption.value]);
1027
1036
  return /*#__PURE__*/_react.default.createElement("div", {
1028
1037
  className: (0, _classnames.default)(RC, className, {
1029
1038
  ["".concat(RC, "_disabled")]: disabled,
1030
1039
  ["".concat(RC, "-mobile")]: isMobile,
1031
- ["".concat(RC, "--focused")]: isOpen
1040
+ ["".concat(RC, "--focused")]: isOpen && !(customTriggerRef !== null && customTriggerRef !== void 0 && customTriggerRef.current),
1041
+ ["".concat(RC, "--custom-trigger")]: Boolean(customTriggerRef === null || customTriggerRef === void 0 ? void 0 : customTriggerRef.current)
1032
1042
  }),
1033
1043
  ref: dropdownRef
1034
1044
  }, renderDropdownTrigger(), withActions && /*#__PURE__*/_react.default.createElement("div", {
@@ -9,6 +9,14 @@
9
9
 
10
10
  width: 100%;
11
11
 
12
+ border: 1px solid #e2e5ec;
13
+ border-radius: 3px;
14
+ overflow: hidden;
15
+
16
+ &--custom-trigger {
17
+ border: none;
18
+ }
19
+
12
20
  &__container {
13
21
  position: fixed;
14
22
  z-index: 99999;
@@ -39,8 +47,6 @@
39
47
  width: 100%;
40
48
 
41
49
  cursor: pointer;
42
-
43
- border: 1px solid #e2e5ec;
44
50
  border-radius: 3px;
45
51
  background: #fff;
46
52
 
@@ -60,9 +66,42 @@
60
66
  }
61
67
  }
62
68
 
63
- &--focused &__trigger {
69
+ &__actions {
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ border-radius: 0px 2px 2px 0px;
74
+ overflow: hidden;
75
+ box-sizing: border-box;
76
+ min-width: 56px;
77
+
78
+ &-item {
79
+ height: 100%;
80
+ display: flex;
81
+ padding: 4px;
82
+ min-width: 28px;
83
+ justify-content: center;
84
+ align-items: center;
85
+ gap: 4px;
86
+ align-self: stretch;
87
+ background: var(--Background-Light-action, #F4F6FF);
88
+ box-sizing: border-box;
89
+ cursor: pointer;
90
+ border-left: 1px solid var(--Border-Input, #E2E5EC);
91
+ box-sizing: border-box;
92
+ }
93
+
94
+ svg {
95
+ width: 16px;
96
+ height: 16px;
97
+ color: #1E1E2D;
98
+ }
99
+ }
100
+
101
+
102
+ &--focused {
64
103
 
65
- border-color: #6b81dd;
104
+ border: 1px solid #6b81dd;
66
105
  filter: drop-shadow(0 0 4px rgb(93 120 255 / 50%));
67
106
  }
68
107
 
@@ -316,42 +355,6 @@
316
355
  height: 100%;
317
356
  }
318
357
  }
319
-
320
- &__actions {
321
- display: flex;
322
- align-items: center;
323
- justify-content: center;
324
- border: 1px solid var(--Border-Input, #E2E5EC);
325
- border-left: none;
326
- border-radius: 0px 2px 2px 0px;
327
- overflow: hidden;
328
-
329
- &-item {
330
- height: 100%;
331
- display: flex;
332
- padding: 4px;
333
- min-width: 24px;
334
- justify-content: center;
335
- align-items: center;
336
- gap: 4px;
337
- align-self: stretch;
338
- background: var(--Background-Light-action, #F4F6FF);
339
- box-sizing: border-box;
340
- cursor: pointer;
341
- border-right: 1px solid var(--Border-Input, #E2E5EC);
342
-
343
- &:last-child {
344
- border: none;
345
- }
346
- }
347
-
348
- svg {
349
- width: 16px;
350
- height: 16px;
351
- color: #1E1E2D;
352
- }
353
- }
354
-
355
358
  &__edit-option-modal {
356
359
  position: absolute;
357
360
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.4.28",
3
+ "version": "1.4.30",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [