@rescui/select 0.13.0 → 0.14.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.
@@ -1,15 +1,15 @@
1
1
  var styles = {
2
- "sizeS": "_sizeS_1bcjdbr_3",
3
- "sizeM": "_sizeM_1bcjdbr_6",
4
- "sizeL": "_sizeL_1bcjdbr_9",
5
- "menu": "_menu_1bcjdbr_13",
6
- "menuSizeS": "_menuSizeS_1bcjdbr_26",
7
- "menuSizeM": "_menuSizeM_1bcjdbr_30",
8
- "menuSizeL": "_menuSizeL_1bcjdbr_34",
9
- "withGroupsLabel": "_withGroupsLabel_1bcjdbr_40",
10
- "lastOption": "_lastOption_1bcjdbr_39",
11
- "divider": "_divider_1bcjdbr_45",
12
- "checkIcon": "_checkIcon_1bcjdbr_51",
13
- "observable": "_observable_1bcjdbr_56"
2
+ "sizeS": "_sizeS_1r2w8hs_3",
3
+ "sizeM": "_sizeM_1r2w8hs_6",
4
+ "sizeL": "_sizeL_1r2w8hs_9",
5
+ "menu": "_menu_1r2w8hs_13",
6
+ "menuSizeS": "_menuSizeS_1r2w8hs_26",
7
+ "menuSizeM": "_menuSizeM_1r2w8hs_30",
8
+ "menuSizeL": "_menuSizeL_1r2w8hs_34",
9
+ "withGroupsLabel": "_withGroupsLabel_1r2w8hs_40",
10
+ "lastOption": "_lastOption_1r2w8hs_39",
11
+ "divider": "_divider_1r2w8hs_45",
12
+ "checkIcon": "_checkIcon_1r2w8hs_51",
13
+ "observable": "_observable_1r2w8hs_56"
14
14
  };
15
15
  export { styles as default };
@@ -1,13 +1,13 @@
1
1
  var styles = {
2
- "themeLight": "_themeLight_1ewks2a_7",
3
- "themeDark": "_themeDark_1ewks2a_10",
4
- "sizeS": "_sizeS_1ewks2a_14",
5
- "sizeM": "_sizeM_1ewks2a_17",
6
- "sizeL": "_sizeL_1ewks2a_20",
7
- "main": "_main_1ewks2a_24",
8
- "label": "_label_1ewks2a_28",
9
- "errorMessage": "_errorMessage_1ewks2a_34",
10
- "errorIcon": "_errorIcon_1ewks2a_45",
11
- "note": "_note_1ewks2a_50"
2
+ "themeLight": "_themeLight_yw1fz9_7",
3
+ "themeDark": "_themeDark_yw1fz9_10",
4
+ "sizeS": "_sizeS_yw1fz9_14",
5
+ "sizeM": "_sizeM_yw1fz9_17",
6
+ "sizeL": "_sizeL_yw1fz9_20",
7
+ "main": "_main_yw1fz9_24",
8
+ "label": "_label_yw1fz9_28",
9
+ "errorMessage": "_errorMessage_yw1fz9_34",
10
+ "errorIcon": "_errorIcon_yw1fz9_45",
11
+ "note": "_note_yw1fz9_50"
12
12
  };
13
13
  export { styles as default };
@@ -7,7 +7,7 @@ import scrollIntoView from 'scroll-into-view-if-needed';
7
7
  import { Dropdown } from '@rescui/dropdown';
8
8
  import { Menu, MenuItem, Divider, GroupHeader } from '@rescui/menu';
9
9
  import { useThemeWithUndefined } from '@rescui/ui-contexts';
10
- import CheckIcon from '../_virtual/check.js';
10
+ import CheckOutlineIcon from '../_virtual/check-outline.js';
11
11
  import { useStrongMemo, getDefaultCursorIndex, isGroupsEmpty, getOptionValue, getMovedCursorIndex, shouldOpenSelect, isIndexMatchCursor, withoutGroupsLabel, getPlainOptionsFromGroups, getEmptyMessage, OptionGroupTypes, convertToOptionGroupsIfNeeded, calculateMaxHeight } from '../utils.js';
12
12
  import { optionType, optionsGroupType, noOptionsMessageType } from '../common-prop-types.js';
13
13
  import { ARROW_DOWN, ARROW_UP, ENTER, SPACE, TAB, ESCAPE, BACKSPACE } from '../key-codes.js';
@@ -36,7 +36,7 @@ const Option = _ref => {
36
36
  const value = getOptionValue(item);
37
37
  const isItemSelected = Boolean(selected && selected.length && selected.some(s => value === getOptionValue(s)));
38
38
  const isHighlighted = isIndexMatchCursor(cursorIndex, index);
39
- const icon = isSingleLine && isItemSelected ? /*#__PURE__*/React.createElement(CheckIcon, {
39
+ const icon = isSingleLine && isItemSelected ? /*#__PURE__*/React.createElement(CheckOutlineIcon, {
40
40
  className: styles.checkIcon,
41
41
  "data-render-all-sizes": true
42
42
  }) : null;
@@ -1,9 +1,9 @@
1
1
  var styles = {
2
- "sizeS": "_sizeS_8r62c0_6",
3
- "sizeM": "_sizeM_8r62c0_9",
4
- "sizeL": "_sizeL_8r62c0_12",
5
- "main": "_main_8r62c0_16",
6
- "wrapper": "_wrapper_8r62c0_20",
7
- "select": "_select_8r62c0_24"
2
+ "sizeS": "_sizeS_1hz5w4n_6",
3
+ "sizeM": "_sizeM_1hz5w4n_9",
4
+ "sizeL": "_sizeL_1hz5w4n_12",
5
+ "main": "_main_1hz5w4n_16",
6
+ "wrapper": "_wrapper_1hz5w4n_20",
7
+ "select": "_select_1hz5w4n_24"
8
8
  };
9
9
  export { styles as default };
@@ -4,10 +4,11 @@ import cn from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import { RemovableTag, Tag } from '@rescui/tag';
6
6
  import { useThemeWithUndefined } from '@rescui/ui-contexts';
7
- import DownIcon from '../_virtual/down.js';
8
- import CloseIcon from '../_virtual/close.js';
9
- import LoadingIcon from '../_virtual/loading.js';
7
+ import DownOutlineIcon from '../_virtual/down-outline.js';
8
+ import CloseOutlineIcon from '../_virtual/close-outline.js';
9
+ import LoadingOutlineIcon from '../_virtual/loading-outline.js';
10
10
  import { optionType } from '../common-prop-types.js';
11
+ import { getOptionValue } from '../utils.js';
11
12
  import Foldable from './foldable.js';
12
13
  import styles from './trigger.p.module.css.js';
13
14
  const THEME_STYLES = {
@@ -32,7 +33,7 @@ const MultiselectOptions = _ref => {
32
33
  onItemClearClick
33
34
  } = _ref;
34
35
  const selectedOptions = selected.map(s => {
35
- const key = s.value ? s.value : s.label;
36
+ const key = getOptionValue(s);
36
37
  return /*#__PURE__*/React.createElement(RemovableTag, {
37
38
  key: key,
38
39
  "data-test": `selected-tag-${key}`,
@@ -112,7 +113,7 @@ const ClearOrLoading = _ref3 => {
112
113
  } = _ref3;
113
114
 
114
115
  if (isLoading) {
115
- return /*#__PURE__*/React.createElement(LoadingIcon, {
116
+ return /*#__PURE__*/React.createElement(LoadingOutlineIcon, {
116
117
  style: {
117
118
  pointerEvents: 'none'
118
119
  },
@@ -129,7 +130,7 @@ const ClearOrLoading = _ref3 => {
129
130
  e.stopPropagation();
130
131
  onClearClick();
131
132
  }
132
- }, /*#__PURE__*/React.createElement(CloseIcon, {
133
+ }, /*#__PURE__*/React.createElement(CloseOutlineIcon, {
133
134
  "data-render-all-sizes": true
134
135
  }));
135
136
  } else {
@@ -222,7 +223,7 @@ const SelectTrigger = /*#__PURE__*/React.memo(props => {
222
223
  isClearable: isClearable,
223
224
  onClearClick: onClearClick,
224
225
  selected: selected
225
- }), /*#__PURE__*/React.createElement(DownIcon, {
226
+ }), /*#__PURE__*/React.createElement(DownOutlineIcon, {
226
227
  className: styles.toggle,
227
228
  "data-test": "down-icon",
228
229
  "data-render-all-sizes": true
@@ -1,31 +1,31 @@
1
1
  var styles = {
2
- "themeLight": "_themeLight_xqlygf_27",
3
- "themeDark": "_themeDark_xqlygf_30",
4
- "sizeS": "_sizeS_xqlygf_34",
5
- "sizeM": "_sizeM_xqlygf_37",
6
- "sizeL": "_sizeL_xqlygf_40",
7
- "classic": "_classic_xqlygf_44",
8
- "rock": "_rock_xqlygf_47",
9
- "main": "_main_xqlygf_51",
10
- "open": "_open_xqlygf_80",
11
- "searchKeyFocused": "_searchKeyFocused_xqlygf_85",
12
- "error": "_error_xqlygf_89",
13
- "disabled": "_disabled_xqlygf_95",
14
- "enabled": "_enabled_xqlygf_103",
15
- "searchFocused": "_searchFocused_xqlygf_104",
16
- "focused": "_focused_xqlygf_105",
17
- "isMulti": "_isMulti_xqlygf_138",
18
- "iconsWrapper": "_iconsWrapper_xqlygf_142",
19
- "labelWrapper": "_labelWrapper_xqlygf_157",
20
- "label": "_label_xqlygf_157",
21
- "labelNotSelected": "_labelNotSelected_xqlygf_197",
22
- "searchInput": "_searchInput_xqlygf_210",
23
- "multi": "_multi_xqlygf_240",
24
- "tagsContainer": "_tagsContainer_xqlygf_256",
25
- "tag": "_tag_xqlygf_256",
26
- "filledTag": "_filledTag_xqlygf_279",
27
- "toggle": "_toggle_xqlygf_286",
28
- "icon": "_icon_xqlygf_142",
29
- "clearIcon": "_clearIcon_xqlygf_353"
2
+ "themeLight": "_themeLight_c93kzc_27",
3
+ "themeDark": "_themeDark_c93kzc_30",
4
+ "sizeS": "_sizeS_c93kzc_34",
5
+ "sizeM": "_sizeM_c93kzc_37",
6
+ "sizeL": "_sizeL_c93kzc_40",
7
+ "classic": "_classic_c93kzc_44",
8
+ "rock": "_rock_c93kzc_47",
9
+ "main": "_main_c93kzc_51",
10
+ "open": "_open_c93kzc_80",
11
+ "searchKeyFocused": "_searchKeyFocused_c93kzc_85",
12
+ "error": "_error_c93kzc_89",
13
+ "disabled": "_disabled_c93kzc_95",
14
+ "enabled": "_enabled_c93kzc_103",
15
+ "searchFocused": "_searchFocused_c93kzc_104",
16
+ "focused": "_focused_c93kzc_105",
17
+ "isMulti": "_isMulti_c93kzc_138",
18
+ "iconsWrapper": "_iconsWrapper_c93kzc_142",
19
+ "labelWrapper": "_labelWrapper_c93kzc_157",
20
+ "label": "_label_c93kzc_157",
21
+ "labelNotSelected": "_labelNotSelected_c93kzc_197",
22
+ "searchInput": "_searchInput_c93kzc_210",
23
+ "multi": "_multi_c93kzc_240",
24
+ "tagsContainer": "_tagsContainer_c93kzc_256",
25
+ "tag": "_tag_c93kzc_256",
26
+ "filledTag": "_filledTag_c93kzc_279",
27
+ "toggle": "_toggle_c93kzc_286",
28
+ "icon": "_icon_c93kzc_142",
29
+ "clearIcon": "_clearIcon_c93kzc_353"
30
30
  };
31
31
  export { styles as default };
package/lib/select.js CHANGED
@@ -11,7 +11,7 @@ import SelectTrigger from './parts/trigger.js';
11
11
  import FormTriggerWrapper from './parts/form-trigger-wrapper.js';
12
12
  import { useObservableForceRerender } from './parts/use-observable-force-rerender.js';
13
13
  import { optionType, optionsGroupType, noOptionsMessageConfigType } from './common-prop-types.js';
14
- import { useStrongMemo, getDefaultCursorIndex, isGroupsEmpty, getMovedCursorIndex, shouldOpenSelect, isIndexMatchCursor, withoutGroupsLabel, getPlainOptionsFromGroups, getEmptyMessage, OptionGroupTypes, getOptionValue, convertToOptionGroupsIfNeeded, escapeRegex, calculateMaxHeight } from './utils.js';
14
+ import { useStrongMemo, getDefaultCursorIndex, isGroupsEmpty, getMovedCursorIndex, shouldOpenSelect, isIndexMatchCursor, withoutGroupsLabel, getPlainOptionsFromGroups, getEmptyMessage, OptionGroupTypes, getOptionValue, convertToOptionGroupsIfNeeded, escapeRegex, getTextFromNodes, calculateMaxHeight } from './utils.js';
15
15
  import { ARROW_DOWN, ARROW_UP, ENTER, SPACE, TAB, ESCAPE, BACKSPACE } from './key-codes.js';
16
16
  import styles from './parts/common-select.p.module.css.js'; // eslint-disable-next-line complexity
17
17
 
@@ -125,7 +125,7 @@ const Select = _ref2 => {
125
125
  let {
126
126
  label
127
127
  } = _ref3;
128
- return filter.test(label);
128
+ return filter.test(getTextFromNodes(label));
129
129
  })
130
130
  }));
131
131
  }, [searchString, groups]);
package/lib/types.d.ts CHANGED
@@ -1,11 +1,12 @@
1
+ import React from 'react';
1
2
  export declare type SelectSize = 'l' | 'm' | 's';
2
3
  export declare type SelectMode = 'classic' | 'rock';
3
4
  export declare type SelectOption = {
4
- label: string;
5
+ label: React.ReactNode;
5
6
  value?: string;
6
7
  };
7
8
  export declare type SelectOptionsGroup = {
8
- label?: string;
9
+ label?: React.ReactNode;
9
10
  options: SelectOption[];
10
11
  };
11
12
  export declare type SelectOptionOrGroup = SelectOption | SelectOptionsGroup;
@@ -18,7 +19,7 @@ export declare type NativeSelectOption = {
18
19
  export declare type NativeSelectOptionsGroup = {
19
20
  label?: string;
20
21
  disabled?: boolean;
21
- options: SelectOption[];
22
+ options: NativeSelectOption[];
22
23
  };
23
24
  export declare type NativeSelectOptionOrGroup = NativeSelectOption | NativeSelectOptionsGroup;
24
25
  export declare type NativeSelectOptions = NativeSelectOptionOrGroup[];
package/lib/utils.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import React from 'react';
1
2
  import type { SelectOptionOrGroup, SelectOptionsGroup, NoOptionsMessage, SelectSize } from './types';
2
3
  import { Groups, Index, SelectOption } from './types';
4
+ export declare const getTextFromNodes: (node: React.ReactNode, depth?: number) => string;
3
5
  export declare function shouldOpenSelect(key: string, isTriggerTarget?: boolean): boolean;
4
6
  export declare function getEmptyMessage(isLoading: boolean, isNothingFound: boolean, noOptionsMessage: NoOptionsMessage): string;
5
7
  export declare function escapeRegex(str: string): string;
package/lib/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useRef } from 'react';
1
+ import React, { useRef } from 'react';
2
2
  import { ARROW_DOWN, ARROW_UP, SPACE, ENTER } from './key-codes.js';
3
3
  const DEFAULT_NO_OPTIONS_MESSAGES = {
4
4
  noOptions: 'No options',
@@ -12,6 +12,31 @@ const ITEM_HEIGHT_BY_SIZE = {
12
12
  l: 52
13
13
  };
14
14
 
15
+ const getTextFromNodes = function (node) {
16
+ var _node$type;
17
+
18
+ let depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
19
+
20
+ if (typeof node === 'string' || typeof node === 'number') {
21
+ return node.toString();
22
+ }
23
+
24
+ if (depth > 15) {
25
+ console.warn('Max depth reached while getting text from nodes');
26
+ return '';
27
+ }
28
+
29
+ if (Array.isArray(node)) {
30
+ return node.map(n => getTextFromNodes(n, depth + 1)).join('');
31
+ }
32
+
33
+ if ( /*#__PURE__*/React.isValidElement(node) && (node === null || node === void 0 || (_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.toString()) === null || _node$type === void 0 ? void 0 : _node$type.toLowerCase()) !== 'svg') {
34
+ return getTextFromNodes(node.props.children, depth + 1);
35
+ }
36
+
37
+ return '';
38
+ };
39
+
15
40
  const isOptionsGroup = optionOrGroup => typeof optionOrGroup.options !== 'undefined';
16
41
 
17
42
  function shouldOpenSelect(key) {
@@ -83,7 +108,7 @@ const calculateMaxHeight = size => {
83
108
  };
84
109
 
85
110
  function getOptionValue(option) {
86
- return typeof option.value === 'string' ? option.value : option.label;
111
+ return typeof option.value === 'string' ? option.value : getTextFromNodes(option.label);
87
112
  }
88
113
 
89
114
  const OptionGroupTypes = {
@@ -173,4 +198,4 @@ const isIndexMatchCursor = (cursorIndex, index) => {
173
198
 
174
199
  const withoutGroupsLabel = groups => groups.every(g => !g.label);
175
200
 
176
- export { OptionGroupTypes, calculateMaxHeight, convertToOptionGroupsIfNeeded, escapeRegex, getDefaultCursorIndex, getEmptyMessage, getMovedCursorIndex, getOptionValue, getPlainOptionsFromGroups, isGroupsEmpty, isIndexMatchCursor, shouldOpenSelect, useStrongMemo, withoutGroupsLabel };
201
+ export { OptionGroupTypes, calculateMaxHeight, convertToOptionGroupsIfNeeded, escapeRegex, getDefaultCursorIndex, getEmptyMessage, getMovedCursorIndex, getOptionValue, getPlainOptionsFromGroups, getTextFromNodes, isGroupsEmpty, isIndexMatchCursor, shouldOpenSelect, useStrongMemo, withoutGroupsLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/select",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -17,8 +17,8 @@
17
17
  "dependencies": {
18
18
  "@babel/runtime-corejs3": "^7.26.0",
19
19
  "@rescui/dropdown": "^0.9.0",
20
- "@rescui/menu": "^0.12.2",
21
- "@rescui/tag": "^0.12.1",
20
+ "@rescui/menu": "^0.13.0",
21
+ "@rescui/tag": "^0.13.0",
22
22
  "@rescui/use-resize-observer": "^0.3.0",
23
23
  "classnames": "^2.2.6",
24
24
  "scroll-into-view-if-needed": "2.2.20"
@@ -40,5 +40,5 @@
40
40
  "build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
41
41
  },
42
42
  "nx": {},
43
- "gitHead": "4c9832a9e5fc1fe7a9a0c863f73f7f14088e3fd5"
43
+ "gitHead": "66c499bb620ffa7b651301dfb24dbb4e5782435d"
44
44
  }
@@ -1,106 +0,0 @@
1
- import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import cn from 'classnames';
5
- import styles from './index.css.js';
6
- const sizeStyles = {
7
- "xs": styles.sizeXS,
8
- "s": styles.sizeS,
9
- "m": styles.sizeM,
10
- "l": styles.sizeL
11
- };
12
- const Size = {
13
- "xs": "xs",
14
- "s": "s",
15
- "m": "m",
16
- "l": "l"
17
- };
18
- const CheckIcon16 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
19
- viewBox: "0 0 16 16"
20
- }, props, {
21
- ref: ref
22
- }), /*#__PURE__*/React.createElement("path", {
23
- d: "M14.03 3.97a.75.75 0 0 1 0 1.06l-7 7a.75.75 0 0 1-1.06 0l-3.5-3.5a.75.75 0 0 1 1.06-1.06l2.97 2.97 6.47-6.47a.75.75 0 0 1 1.06 0"
24
- })));
25
- CheckIcon16.displayName = 'CheckIcon16';
26
- const CheckIcon20 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
27
- viewBox: "0 0 20 20"
28
- }, props, {
29
- ref: ref
30
- }), /*#__PURE__*/React.createElement("path", {
31
- d: "M16.707 5.293a1 1 0 0 1 0 1.414l-8 8a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 1.414-1.414L8 12.586l7.293-7.293a1 1 0 0 1 1.414 0"
32
- })));
33
- CheckIcon20.displayName = 'CheckIcon20';
34
- const CheckIcon24 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
35
- viewBox: "0 0 24 24"
36
- }, props, {
37
- ref: ref
38
- }), /*#__PURE__*/React.createElement("path", {
39
- d: "M20.06 5.94a1.5 1.5 0 0 1 0 2.12l-10 10a1.5 1.5 0 0 1-2.12 0l-5-5a1.5 1.5 0 0 1 2.12-2.12L9 14.878l8.94-8.94a1.5 1.5 0 0 1 2.12 0"
40
- })));
41
- CheckIcon24.displayName = 'CheckIcon24';
42
- const CheckIcon28 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
43
- viewBox: "0 0 28 28"
44
- }, props, {
45
- ref: ref
46
- }), /*#__PURE__*/React.createElement("path", {
47
- d: "M23.014 6.894a1.5 1.5 0 0 0-2.12.092l-9.941 10.846-4.892-4.893a1.5 1.5 0 0 0-2.122 2.122l6 6a1.5 1.5 0 0 0 2.167-.047l11-12a1.5 1.5 0 0 0-.092-2.12"
48
- })));
49
- CheckIcon28.displayName = 'CheckIcon28';
50
- const CheckIcon = /*#__PURE__*/React.forwardRef((_ref, ref) => {
51
- let {
52
- theme,
53
- size: sizeFromProps = "m",
54
- className,
55
- style,
56
- ['data-render-all-sizes']: renderAllSizes = false,
57
- ...props
58
- } = _ref;
59
- const size = sizeFromProps in Size ? sizeFromProps : "m";
60
- const mainProps = { ...props,
61
- className: cn(styles.icon, styles[theme], sizeStyles[size], renderAllSizes && styles.allVariants, className),
62
- style: renderAllSizes ? {
63
- '--rs-icon-ar-width': 28,
64
- '--rs-icon-ar-height': 28,
65
- ...style
66
- } : style,
67
- ref
68
- };
69
-
70
- if (renderAllSizes) {
71
- return /*#__PURE__*/React.createElement("svg", _extends({
72
- viewBox: "0 0 28 28"
73
- }, mainProps), /*#__PURE__*/React.createElement(CheckIcon16, {
74
- className: styles.variant16
75
- }), /*#__PURE__*/React.createElement(CheckIcon20, {
76
- className: styles.variant20
77
- }), /*#__PURE__*/React.createElement(CheckIcon24, {
78
- className: styles.variant24
79
- }), /*#__PURE__*/React.createElement(CheckIcon28, {
80
- className: styles.variant28
81
- }));
82
- }
83
-
84
- if (size === Size['xs']) {
85
- return /*#__PURE__*/React.createElement(CheckIcon16, mainProps);
86
- }
87
-
88
- if (size === Size['s']) {
89
- return /*#__PURE__*/React.createElement(CheckIcon20, mainProps);
90
- }
91
-
92
- if (size === Size['m']) {
93
- return /*#__PURE__*/React.createElement(CheckIcon24, mainProps);
94
- }
95
-
96
- return /*#__PURE__*/React.createElement(CheckIcon28, mainProps);
97
- });
98
- CheckIcon.displayName = 'CheckIcon';
99
- CheckIcon.propTypes = {
100
- className: PropTypes.string,
101
- theme: PropTypes.oneOf(["light", "dark"]),
102
- size: PropTypes.oneOf(["xs", "s", "m", "l"]),
103
- 'data-render-all-sizes': PropTypes.bool,
104
- style: PropTypes.object
105
- };
106
- export { Size, CheckIcon as default };
@@ -1,106 +0,0 @@
1
- import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import cn from 'classnames';
5
- import styles from './index.css.js';
6
- const sizeStyles = {
7
- "xs": styles.sizeXS,
8
- "s": styles.sizeS,
9
- "m": styles.sizeM,
10
- "l": styles.sizeL
11
- };
12
- const Size = {
13
- "xs": "xs",
14
- "s": "s",
15
- "m": "m",
16
- "l": "l"
17
- };
18
- const CloseIcon16 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
19
- viewBox: "0 0 16 16"
20
- }, props, {
21
- ref: ref
22
- }), /*#__PURE__*/React.createElement("path", {
23
- d: "M2.47 2.47a.75.75 0 0 1 1.06 0L8 6.94l4.47-4.47a.75.75 0 1 1 1.06 1.06L9.06 8l4.47 4.47a.75.75 0 1 1-1.06 1.06L8 9.06l-4.47 4.47a.75.75 0 0 1-1.06-1.06L6.94 8 2.47 3.53a.75.75 0 0 1 0-1.06"
24
- })));
25
- CloseIcon16.displayName = 'CloseIcon16';
26
- const CloseIcon20 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
27
- viewBox: "0 0 20 20"
28
- }, props, {
29
- ref: ref
30
- }), /*#__PURE__*/React.createElement("path", {
31
- d: "M3.293 3.293a1 1 0 0 1 1.414 0L10 8.586l5.293-5.293a1 1 0 1 1 1.414 1.414L11.414 10l5.293 5.293a1 1 0 0 1-1.414 1.414L10 11.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L8.586 10 3.293 4.707a1 1 0 0 1 0-1.414"
32
- })));
33
- CloseIcon20.displayName = 'CloseIcon20';
34
- const CloseIcon24 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
35
- viewBox: "0 0 24 24"
36
- }, props, {
37
- ref: ref
38
- }), /*#__PURE__*/React.createElement("path", {
39
- d: "M3.44 3.44a1.5 1.5 0 0 1 2.12 0L12 9.878l6.44-6.44a1.5 1.5 0 0 1 2.12 2.122L14.122 12l6.44 6.44a1.5 1.5 0 0 1-2.122 2.12L12 14.122l-6.44 6.44a1.5 1.5 0 0 1-2.12-2.122L9.878 12l-6.44-6.44a1.5 1.5 0 0 1 0-2.12"
40
- })));
41
- CloseIcon24.displayName = 'CloseIcon24';
42
- const CloseIcon28 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
43
- viewBox: "0 0 28 28"
44
- }, props, {
45
- ref: ref
46
- }), /*#__PURE__*/React.createElement("path", {
47
- d: "M4.44 4.44a1.5 1.5 0 0 1 2.12 0L14 11.878l7.44-7.44a1.5 1.5 0 0 1 2.12 2.122L16.122 14l7.44 7.44a1.5 1.5 0 0 1-2.122 2.12L14 16.122l-7.44 7.44a1.5 1.5 0 0 1-2.12-2.122L11.878 14l-7.44-7.44a1.5 1.5 0 0 1 0-2.12"
48
- })));
49
- CloseIcon28.displayName = 'CloseIcon28';
50
- const CloseIcon = /*#__PURE__*/React.forwardRef((_ref, ref) => {
51
- let {
52
- theme,
53
- size: sizeFromProps = "m",
54
- className,
55
- style,
56
- ['data-render-all-sizes']: renderAllSizes = false,
57
- ...props
58
- } = _ref;
59
- const size = sizeFromProps in Size ? sizeFromProps : "m";
60
- const mainProps = { ...props,
61
- className: cn(styles.icon, styles[theme], sizeStyles[size], renderAllSizes && styles.allVariants, className),
62
- style: renderAllSizes ? {
63
- '--rs-icon-ar-width': 28,
64
- '--rs-icon-ar-height': 28,
65
- ...style
66
- } : style,
67
- ref
68
- };
69
-
70
- if (renderAllSizes) {
71
- return /*#__PURE__*/React.createElement("svg", _extends({
72
- viewBox: "0 0 28 28"
73
- }, mainProps), /*#__PURE__*/React.createElement(CloseIcon16, {
74
- className: styles.variant16
75
- }), /*#__PURE__*/React.createElement(CloseIcon20, {
76
- className: styles.variant20
77
- }), /*#__PURE__*/React.createElement(CloseIcon24, {
78
- className: styles.variant24
79
- }), /*#__PURE__*/React.createElement(CloseIcon28, {
80
- className: styles.variant28
81
- }));
82
- }
83
-
84
- if (size === Size['xs']) {
85
- return /*#__PURE__*/React.createElement(CloseIcon16, mainProps);
86
- }
87
-
88
- if (size === Size['s']) {
89
- return /*#__PURE__*/React.createElement(CloseIcon20, mainProps);
90
- }
91
-
92
- if (size === Size['m']) {
93
- return /*#__PURE__*/React.createElement(CloseIcon24, mainProps);
94
- }
95
-
96
- return /*#__PURE__*/React.createElement(CloseIcon28, mainProps);
97
- });
98
- CloseIcon.displayName = 'CloseIcon';
99
- CloseIcon.propTypes = {
100
- className: PropTypes.string,
101
- theme: PropTypes.oneOf(["light", "dark"]),
102
- size: PropTypes.oneOf(["xs", "s", "m", "l"]),
103
- 'data-render-all-sizes': PropTypes.bool,
104
- style: PropTypes.object
105
- };
106
- export { Size, CloseIcon as default };
@@ -1,106 +0,0 @@
1
- import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import cn from 'classnames';
5
- import styles from './index.css.js';
6
- const sizeStyles = {
7
- "xs": styles.sizeXS,
8
- "s": styles.sizeS,
9
- "m": styles.sizeM,
10
- "l": styles.sizeL
11
- };
12
- const Size = {
13
- "xs": "xs",
14
- "s": "s",
15
- "m": "m",
16
- "l": "l"
17
- };
18
- const DownIcon16 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
19
- viewBox: "0 0 16 16"
20
- }, props, {
21
- ref: ref
22
- }), /*#__PURE__*/React.createElement("path", {
23
- d: "M11.53 5.97a.75.75 0 0 0-1.06 0L8 8.44 5.53 5.97a.75.75 0 0 0-1.06 1.06l3 3a.75.75 0 0 0 1.06 0l3-3a.75.75 0 0 0 0-1.06"
24
- })));
25
- DownIcon16.displayName = 'DownIcon16';
26
- const DownIcon20 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
27
- viewBox: "0 0 20 20"
28
- }, props, {
29
- ref: ref
30
- }), /*#__PURE__*/React.createElement("path", {
31
- d: "M14.707 7.293a1 1 0 0 0-1.414 0L10 10.586 6.707 7.293a1 1 0 0 0-1.414 1.414l4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0 0-1.414"
32
- })));
33
- DownIcon20.displayName = 'DownIcon20';
34
- const DownIcon24 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
35
- viewBox: "0 0 24 24"
36
- }, props, {
37
- ref: ref
38
- }), /*#__PURE__*/React.createElement("path", {
39
- d: "M19.06 7.94a1.5 1.5 0 0 0-2.12 0L12 12.878l-4.94-4.94a1.5 1.5 0 1 0-2.12 2.122l6 6a1.5 1.5 0 0 0 2.12 0l6-6a1.5 1.5 0 0 0 0-2.122"
40
- })));
41
- DownIcon24.displayName = 'DownIcon24';
42
- const DownIcon28 = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
43
- viewBox: "0 0 28 28"
44
- }, props, {
45
- ref: ref
46
- }), /*#__PURE__*/React.createElement("path", {
47
- d: "M22.06 9.44a1.5 1.5 0 0 0-2.12 0L14 15.378l-5.94-5.94a1.5 1.5 0 1 0-2.12 2.122l7 7a1.5 1.5 0 0 0 2.12 0l7-7a1.5 1.5 0 0 0 0-2.122"
48
- })));
49
- DownIcon28.displayName = 'DownIcon28';
50
- const DownIcon = /*#__PURE__*/React.forwardRef((_ref, ref) => {
51
- let {
52
- theme,
53
- size: sizeFromProps = "m",
54
- className,
55
- style,
56
- ['data-render-all-sizes']: renderAllSizes = false,
57
- ...props
58
- } = _ref;
59
- const size = sizeFromProps in Size ? sizeFromProps : "m";
60
- const mainProps = { ...props,
61
- className: cn(styles.icon, styles[theme], sizeStyles[size], renderAllSizes && styles.allVariants, className),
62
- style: renderAllSizes ? {
63
- '--rs-icon-ar-width': 28,
64
- '--rs-icon-ar-height': 28,
65
- ...style
66
- } : style,
67
- ref
68
- };
69
-
70
- if (renderAllSizes) {
71
- return /*#__PURE__*/React.createElement("svg", _extends({
72
- viewBox: "0 0 28 28"
73
- }, mainProps), /*#__PURE__*/React.createElement(DownIcon16, {
74
- className: styles.variant16
75
- }), /*#__PURE__*/React.createElement(DownIcon20, {
76
- className: styles.variant20
77
- }), /*#__PURE__*/React.createElement(DownIcon24, {
78
- className: styles.variant24
79
- }), /*#__PURE__*/React.createElement(DownIcon28, {
80
- className: styles.variant28
81
- }));
82
- }
83
-
84
- if (size === Size['xs']) {
85
- return /*#__PURE__*/React.createElement(DownIcon16, mainProps);
86
- }
87
-
88
- if (size === Size['s']) {
89
- return /*#__PURE__*/React.createElement(DownIcon20, mainProps);
90
- }
91
-
92
- if (size === Size['m']) {
93
- return /*#__PURE__*/React.createElement(DownIcon24, mainProps);
94
- }
95
-
96
- return /*#__PURE__*/React.createElement(DownIcon28, mainProps);
97
- });
98
- DownIcon.displayName = 'DownIcon';
99
- DownIcon.propTypes = {
100
- className: PropTypes.string,
101
- theme: PropTypes.oneOf(["light", "dark"]),
102
- size: PropTypes.oneOf(["xs", "s", "m", "l"]),
103
- 'data-render-all-sizes': PropTypes.bool,
104
- style: PropTypes.object
105
- };
106
- export { Size, DownIcon as default };