@megafon/ui-core 5.7.1 → 5.8.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,17 @@
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
+ # [5.8.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.7.1...@megafon/ui-core@5.8.0) (2024-04-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * **search:** add href to search item ([2c00dc8](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/2c00dc858352794b91962af2791c75927fcdf570))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [5.7.1](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.7.0...@megafon/ui-core@5.7.1) (2024-03-26)
7
18
 
8
19
  **Note:** Version bump only for package @megafon/ui-core
@@ -13,6 +13,8 @@ export declare const SearchItemsPaddings: {
13
13
  export declare type SearchItem = {
14
14
  /** Значение value элемента */
15
15
  value: string;
16
+ /** Ссылка элемента */
17
+ href?: string;
16
18
  /** Настраиваемое отображение элементов в выпадающем списке */
17
19
  searchView?: ElementOrString;
18
20
  /** Размер горизонтальных отступов элемента */
@@ -152,8 +152,12 @@ var Search = function Search(_ref) {
152
152
  return;
153
153
  }
154
154
 
155
- var chosenValue = items[index].value;
156
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenValue);
155
+ var chosenItem = items[index];
156
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenItem.value);
157
+
158
+ if (chosenItem.href) {
159
+ window.location.href = chosenItem.href;
160
+ }
157
161
  }, [disabled, items, onSubmit]);
158
162
  var handleSelectSubmit = React.useCallback(function (index) {
159
163
  return function () {
@@ -465,6 +469,7 @@ Search.propTypes = {
465
469
  hideIcon: PropTypes.bool,
466
470
  items: PropTypes.arrayOf(PropTypes.shape({
467
471
  value: PropTypes.string.isRequired,
472
+ href: PropTypes.string,
468
473
  searchView: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.arrayOf(PropTypes.element)]),
469
474
  paddings: PropTypes.oneOf(Object.values(SearchItemsPaddings))
470
475
  }).isRequired),
@@ -13,6 +13,8 @@ export declare const SearchItemsPaddings: {
13
13
  export declare type SearchItem = {
14
14
  /** Значение value элемента */
15
15
  value: string;
16
+ /** Ссылка элемента */
17
+ href?: string;
16
18
  /** Настраиваемое отображение элементов в выпадающем списке */
17
19
  searchView?: ElementOrString;
18
20
  /** Размер горизонтальных отступов элемента */
@@ -193,8 +193,12 @@ var Search = function Search(_ref) {
193
193
  return;
194
194
  }
195
195
 
196
- var chosenValue = items[index].value;
197
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenValue);
196
+ var chosenItem = items[index];
197
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenItem.value);
198
+
199
+ if (chosenItem.href) {
200
+ window.location.href = chosenItem.href;
201
+ }
198
202
  }, [disabled, items, onSubmit]);
199
203
 
200
204
  var handleSelectSubmit = _react["default"].useCallback(function (index) {
@@ -518,6 +522,7 @@ Search.propTypes = {
518
522
  hideIcon: PropTypes.bool,
519
523
  items: PropTypes.arrayOf(PropTypes.shape({
520
524
  value: PropTypes.string.isRequired,
525
+ href: PropTypes.string,
521
526
  searchView: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.arrayOf(PropTypes.element)]),
522
527
  paddings: PropTypes.oneOf(Object.values(SearchItemsPaddings))
523
528
  }).isRequired),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "5.7.1",
3
+ "version": "5.8.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -96,5 +96,5 @@
96
96
  "react-popper": "^2.2.3",
97
97
  "swiper": "^6.5.6"
98
98
  },
99
- "gitHead": "d43977adc9dee8977ae05c334a77c2d928abfd67"
99
+ "gitHead": "2b91154263858cbabab781db58c20d20797ab1b0"
100
100
  }