@megafon/ui-core 4.3.0 → 4.4.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.4.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.3.0...@megafon/ui-core@4.4.0) (2022-10-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **textfield:** fix input height in Safari ([b60e1ac](https://github.com/MegafonWebLab/megafon-ui/commit/b60e1acd76dc80b4609b55dc8256eb94e8e8ec0c))
12
+ * **tooltip:** fix touch device controlled trigger ([e983ca8](https://github.com/MegafonWebLab/megafon-ui/commit/e983ca88636990e467b43483b0cf0df06dff8553))
13
+
14
+
15
+ ### Features
16
+
17
+ * **select:** add new props useShortListItems ([31d1172](https://github.com/MegafonWebLab/megafon-ui/commit/31d1172484ca4c07060ff64eb7f3be692f5dbdec))
18
+
19
+
20
+
21
+
22
+
6
23
  # [4.3.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.2.0...@megafon/ui-core@4.3.0) (2022-10-05)
7
24
 
8
25
 
@@ -178,6 +178,9 @@
178
178
  padding: 16px;
179
179
  overflow-y: auto;
180
180
  }
181
+ .mfui-select__list-inner_short {
182
+ max-height: 235px;
183
+ }
181
184
  .mfui-select__list-inner::-webkit-scrollbar {
182
185
  width: 16px;
183
186
  }
@@ -56,6 +56,8 @@ export interface ISelectProps<T extends SelectItemValueType> {
56
56
  notFoundText?: string;
57
57
  /** Массив элементов селекта */
58
58
  items: Array<ISelectItem<T>>;
59
+ /** Отображать короткий выпадающий список */
60
+ shortList?: boolean;
59
61
  /** Дополнительный класс корневого элемента */
60
62
  className?: string;
61
63
  /** Дополнительные классы для внутренних элементов */
@@ -88,7 +90,7 @@ export interface ISelectProps<T extends SelectItemValueType> {
88
90
  onClosed?: () => void;
89
91
  }
90
92
  declare const Select: {
91
- <T extends string | number | undefined>({ type, disabled, verification, noticeText, label, labelId, required, className, classes, dataAttrs, notFoundText, items, placeholder, currentValue, onClosed, onOpened, onSelect, }: ISelectProps<T>): JSX.Element;
93
+ <T extends string | number | undefined>({ type, disabled, verification, noticeText, label, labelId, required, className, classes, dataAttrs, notFoundText, items, placeholder, currentValue, shortList, onClosed, onOpened, onSelect, }: ISelectProps<T>): JSX.Element;
92
94
  propTypes: {
93
95
  type: PropTypes.Requireable<"classic" | "combobox">;
94
96
  label: PropTypes.Requireable<string>;
@@ -144,6 +146,7 @@ declare const Select: {
144
146
  value: PropTypes.Validator<string | number>;
145
147
  paddings: PropTypes.Requireable<"small" | "large">;
146
148
  }>> | null | undefined)[]>;
149
+ shortList: PropTypes.Requireable<boolean>;
147
150
  onSelect: PropTypes.Requireable<(...args: any[]) => any>;
148
151
  onOpened: PropTypes.Requireable<(...args: any[]) => any>;
149
152
  onClosed: PropTypes.Requireable<(...args: any[]) => any>;
@@ -73,6 +73,8 @@ var Select = function Select(_ref) {
73
73
  items = _ref.items,
74
74
  placeholder = _ref.placeholder,
75
75
  currentValue = _ref.currentValue,
76
+ _ref$shortList = _ref.shortList,
77
+ shortList = _ref$shortList === void 0 ? false : _ref$shortList,
76
78
  onClosed = _ref.onClosed,
77
79
  onOpened = _ref.onOpened,
78
80
  onSelect = _ref.onSelect;
@@ -380,7 +382,9 @@ var Select = function Select(_ref) {
380
382
  return /*#__PURE__*/React.createElement("div", {
381
383
  className: cn('list', [classes.list])
382
384
  }, /*#__PURE__*/React.createElement("div", {
383
- className: cn('list-inner', [classes.listInner]),
385
+ className: cn('list-inner', {
386
+ "short": shortList
387
+ }, [classes.listInner]),
384
388
  ref: itemWrapperNode
385
389
  }, currentItems.map(function (_ref3, i) {
386
390
  var title = _ref3.title,
@@ -471,6 +475,7 @@ Select.propTypes = {
471
475
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
472
476
  paddings: PropTypes.oneOf(Object.values(SelectItemsPaddings))
473
477
  })).isRequired,
478
+ shortList: PropTypes.bool,
474
479
  onSelect: PropTypes.func,
475
480
  onOpened: PropTypes.func,
476
481
  onClosed: PropTypes.func
@@ -12,6 +12,7 @@
12
12
  .mfui-text-field__field {
13
13
  display: block;
14
14
  width: 100%;
15
+ margin: 0;
15
16
  padding: 25px 56px 9px 16px;
16
17
  border: 1px solid var(--spbSky2);
17
18
  border-radius: 12px;
@@ -132,7 +132,11 @@ var Tooltip = function Tooltip(_ref) {
132
132
  return isTouchDevice ? TOUCH_KEY : MOUSE_KEY;
133
133
  }, [isTouchDevice]);
134
134
  var triggerEventName = useMemo(function () {
135
- return isTouchDevice ? 'click' : triggerEvent;
135
+ if (triggerEvent === TriggerEvent.CONTROLLED || !isTouchDevice) {
136
+ return triggerEvent;
137
+ }
138
+
139
+ return TriggerEvent.CLICK;
136
140
  }, [isTouchDevice, triggerEvent]);
137
141
  var handleMouseEnter = useCallback(function (e) {
138
142
  if (!isOpen) {
@@ -178,6 +178,9 @@
178
178
  padding: 16px;
179
179
  overflow-y: auto;
180
180
  }
181
+ .mfui-select__list-inner_short {
182
+ max-height: 235px;
183
+ }
181
184
  .mfui-select__list-inner::-webkit-scrollbar {
182
185
  width: 16px;
183
186
  }
@@ -56,6 +56,8 @@ export interface ISelectProps<T extends SelectItemValueType> {
56
56
  notFoundText?: string;
57
57
  /** Массив элементов селекта */
58
58
  items: Array<ISelectItem<T>>;
59
+ /** Отображать короткий выпадающий список */
60
+ shortList?: boolean;
59
61
  /** Дополнительный класс корневого элемента */
60
62
  className?: string;
61
63
  /** Дополнительные классы для внутренних элементов */
@@ -88,7 +90,7 @@ export interface ISelectProps<T extends SelectItemValueType> {
88
90
  onClosed?: () => void;
89
91
  }
90
92
  declare const Select: {
91
- <T extends string | number | undefined>({ type, disabled, verification, noticeText, label, labelId, required, className, classes, dataAttrs, notFoundText, items, placeholder, currentValue, onClosed, onOpened, onSelect, }: ISelectProps<T>): JSX.Element;
93
+ <T extends string | number | undefined>({ type, disabled, verification, noticeText, label, labelId, required, className, classes, dataAttrs, notFoundText, items, placeholder, currentValue, shortList, onClosed, onOpened, onSelect, }: ISelectProps<T>): JSX.Element;
92
94
  propTypes: {
93
95
  type: PropTypes.Requireable<"classic" | "combobox">;
94
96
  label: PropTypes.Requireable<string>;
@@ -144,6 +146,7 @@ declare const Select: {
144
146
  value: PropTypes.Validator<string | number>;
145
147
  paddings: PropTypes.Requireable<"small" | "large">;
146
148
  }>> | null | undefined)[]>;
149
+ shortList: PropTypes.Requireable<boolean>;
147
150
  onSelect: PropTypes.Requireable<(...args: any[]) => any>;
148
151
  onOpened: PropTypes.Requireable<(...args: any[]) => any>;
149
152
  onClosed: PropTypes.Requireable<(...args: any[]) => any>;
@@ -108,6 +108,8 @@ var Select = function Select(_ref) {
108
108
  items = _ref.items,
109
109
  placeholder = _ref.placeholder,
110
110
  currentValue = _ref.currentValue,
111
+ _ref$shortList = _ref.shortList,
112
+ shortList = _ref$shortList === void 0 ? false : _ref$shortList,
111
113
  onClosed = _ref.onClosed,
112
114
  onOpened = _ref.onOpened,
113
115
  onSelect = _ref.onSelect;
@@ -415,7 +417,9 @@ var Select = function Select(_ref) {
415
417
  return /*#__PURE__*/React.createElement("div", {
416
418
  className: cn('list', [classes.list])
417
419
  }, /*#__PURE__*/React.createElement("div", {
418
- className: cn('list-inner', [classes.listInner]),
420
+ className: cn('list-inner', {
421
+ "short": shortList
422
+ }, [classes.listInner]),
419
423
  ref: itemWrapperNode
420
424
  }, currentItems.map(function (_ref3, i) {
421
425
  var title = _ref3.title,
@@ -506,6 +510,7 @@ Select.propTypes = {
506
510
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
507
511
  paddings: PropTypes.oneOf(Object.values(SelectItemsPaddings))
508
512
  })).isRequired,
513
+ shortList: PropTypes.bool,
509
514
  onSelect: PropTypes.func,
510
515
  onOpened: PropTypes.func,
511
516
  onClosed: PropTypes.func
@@ -12,6 +12,7 @@
12
12
  .mfui-text-field__field {
13
13
  display: block;
14
14
  width: 100%;
15
+ margin: 0;
15
16
  padding: 25px 56px 9px 16px;
16
17
  border: 1px solid var(--spbSky2);
17
18
  border-radius: 12px;
@@ -161,7 +161,11 @@ var Tooltip = function Tooltip(_ref) {
161
161
  return isTouchDevice ? TOUCH_KEY : MOUSE_KEY;
162
162
  }, [isTouchDevice]);
163
163
  var triggerEventName = (0, _react.useMemo)(function () {
164
- return isTouchDevice ? 'click' : triggerEvent;
164
+ if (triggerEvent === TriggerEvent.CONTROLLED || !isTouchDevice) {
165
+ return triggerEvent;
166
+ }
167
+
168
+ return TriggerEvent.CLICK;
165
169
  }, [isTouchDevice, triggerEvent]);
166
170
  var handleMouseEnter = (0, _react.useCallback)(function (e) {
167
171
  if (!isOpen) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -97,5 +97,5 @@
97
97
  "react-popper": "^2.2.3",
98
98
  "swiper": "^6.5.6"
99
99
  },
100
- "gitHead": "d46a63dbfc20ee931c4e12a82287b7385596bbcf"
100
+ "gitHead": "ab68c8392f13f494977b7a6e44104f9ae1b1f64b"
101
101
  }