@rescui/select 0.14.4-RUI-286-Fix-tooltip-stacking-f4145b01.1 → 0.15.1-RUI-280-Update-select-component-026338d06.52

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.
Files changed (91) hide show
  1. package/lib/_virtual/index.css.js +12 -12
  2. package/lib/common-prop-types.d.ts +9 -14
  3. package/lib/common-prop-types.js +4 -3
  4. package/lib/constants.d.ts +7 -0
  5. package/lib/constants.js +8 -0
  6. package/lib/hooks/use-css-context-transfer.d.ts +14 -0
  7. package/lib/hooks/use-css-context-transfer.js +40 -0
  8. package/lib/hooks/use-label-focus.d.ts +11 -0
  9. package/lib/hooks/use-label-focus.js +28 -0
  10. package/lib/hooks/use-multi-option-serialization.d.ts +10 -0
  11. package/lib/hooks/use-multi-option-serialization.js +82 -0
  12. package/lib/hooks/use-option-serialization.d.ts +10 -0
  13. package/lib/hooks/use-option-serialization.js +59 -0
  14. package/lib/index.css +1700 -705
  15. package/lib/index.d.ts +4 -6
  16. package/lib/index.js +3 -3
  17. package/lib/multiselect.d.ts +29 -0
  18. package/lib/multiselect.js +239 -0
  19. package/lib/native-select.d.ts +4 -0
  20. package/lib/native-select.js +182 -0
  21. package/lib/parts/foldable.js +5 -7
  22. package/lib/parts/form-trigger-wrapper.d.ts +21 -3
  23. package/lib/parts/form-trigger-wrapper.js +30 -40
  24. package/lib/parts/icons.d.ts +17 -0
  25. package/lib/parts/icons.js +75 -0
  26. package/lib/parts/list-box.d.ts +19 -0
  27. package/lib/parts/list-box.js +146 -0
  28. package/lib/parts/multi-trigger.d.ts +11 -0
  29. package/lib/parts/multi-trigger.js +62 -0
  30. package/lib/parts/native-select-options-with-groups.d.ts +8 -0
  31. package/lib/parts/native-select-options-with-groups.js +76 -0
  32. package/lib/parts/native-select-trigger.d.ts +18 -0
  33. package/lib/parts/native-select-trigger.js +54 -0
  34. package/lib/parts/popover.d.ts +12 -0
  35. package/lib/parts/popover.js +62 -0
  36. package/lib/parts/popup-content.d.ts +19 -0
  37. package/lib/parts/popup-content.js +76 -0
  38. package/lib/public-api.p.css +401 -1022
  39. package/lib/public-api.pcss +401 -1022
  40. package/lib/select-basic.d.ts +3 -0
  41. package/lib/select-basic.js +143 -0
  42. package/lib/select-searchable.d.ts +3 -0
  43. package/lib/select-searchable.js +168 -0
  44. package/lib/select.d.ts +27 -86
  45. package/lib/select.js +58 -352
  46. package/lib/styles/common.p.module.css.js +27 -0
  47. package/lib/styles/form-trigger.p.module.css.js +15 -0
  48. package/lib/styles/list-box.p.module.css.js +16 -0
  49. package/lib/styles/native-select-trigger.p.module.css.js +17 -0
  50. package/lib/styles/native-select.p.module.css.js +9 -0
  51. package/lib/styles/popover.p.module.css.js +10 -0
  52. package/lib/types.d.ts +167 -4
  53. package/lib/utils/calculate-max-height-by-items.d.ts +13 -0
  54. package/lib/utils/calculate-max-height-by-items.js +22 -0
  55. package/lib/utils/convert-options.d.ts +3 -0
  56. package/lib/utils/convert-options.js +52 -0
  57. package/lib/utils/convert-placement.d.ts +3 -0
  58. package/lib/utils/convert-placement.js +22 -0
  59. package/lib/utils/css-vars-utils.d.ts +3 -0
  60. package/lib/utils/css-vars-utils.js +20 -0
  61. package/lib/utils/get-empty-message.d.ts +6 -0
  62. package/lib/utils/get-empty-message.js +32 -0
  63. package/lib/utils/get-option-value.d.ts +2 -0
  64. package/lib/utils/get-option-value.js +11 -0
  65. package/lib/utils/get-real-items-cnt.d.ts +2 -0
  66. package/lib/utils/get-real-items-cnt.js +21 -0
  67. package/lib/utils/get-text-from-nodes.d.ts +2 -0
  68. package/lib/utils/get-text-from-nodes.js +28 -0
  69. package/lib/utils/is-option-a-group.d.ts +2 -0
  70. package/lib/utils/is-option-a-group.js +5 -0
  71. package/lib/utils/throttle.d.ts +1 -0
  72. package/package.json +12 -8
  73. package/lib/_virtual/warning.js +0 -106
  74. package/lib/key-codes.d.ts +0 -7
  75. package/lib/key-codes.js +0 -8
  76. package/lib/parts/common-select.p.module.css.js +0 -15
  77. package/lib/parts/form-trigger.p.module.css.js +0 -13
  78. package/lib/parts/multiselect.d.ts +0 -81
  79. package/lib/parts/multiselect.js +0 -441
  80. package/lib/parts/native-select.d.ts +0 -30
  81. package/lib/parts/native-select.js +0 -244
  82. package/lib/parts/native-select.p.module.css.js +0 -9
  83. package/lib/parts/throttle.d.ts +0 -1
  84. package/lib/parts/trigger.d.ts +0 -37
  85. package/lib/parts/trigger.js +0 -255
  86. package/lib/parts/trigger.p.module.css.js +0 -31
  87. package/lib/utils.d.ts +0 -22
  88. package/lib/utils.js +0 -201
  89. /package/lib/{parts → hooks}/use-observable-force-rerender.d.ts +0 -0
  90. /package/lib/{parts → hooks}/use-observable-force-rerender.js +0 -0
  91. /package/lib/{parts → utils}/throttle.js +0 -0
@@ -1,244 +0,0 @@
1
- "use client";
2
- import React, { useState } from 'react';
3
- import PropTypes from 'prop-types';
4
- import cn from 'classnames';
5
- import { useThemeWithUndefined } from '@rescui/ui-contexts';
6
- import { nativeOptionType, nativeOptionsGroupType, noOptionsMessageType } from '../common-prop-types.js';
7
- import SelectTrigger from './trigger.js';
8
- import FormTriggerWrapper from './form-trigger-wrapper.js';
9
- import styles from './native-select.p.module.css.js';
10
- const DEFAULT_NO_OPTIONS_MESSAGES = {
11
- noOptions: 'No options',
12
- loading: 'Loading...'
13
- };
14
- const PLACEHOLDER_VALUE = '__placeholder__';
15
-
16
- function isString(s) {
17
- return Object.prototype.toString.call(s) === '[object String]';
18
- }
19
-
20
- const isOptionsGroup = optionOrGroup => typeof optionOrGroup.options !== 'undefined';
21
-
22
- const collectOptionGroupValues = options => options.map(_ref => {
23
- let {
24
- value
25
- } = _ref;
26
- return value;
27
- }).join('-');
28
-
29
- const Option = _ref2 => {
30
- let {
31
- value,
32
- label,
33
- disabled = false
34
- } = _ref2;
35
- return /*#__PURE__*/React.createElement("option", {
36
- value: value,
37
- disabled: disabled
38
- }, label);
39
- };
40
-
41
- const OptionGroup = _ref3 => {
42
- let {
43
- options = [],
44
- label = '',
45
- disabled = false
46
- } = _ref3;
47
- return /*#__PURE__*/React.createElement("optgroup", {
48
- label: label,
49
- disabled: disabled
50
- }, options.map(_ref4 => {
51
- let {
52
- value,
53
- label: optionLabel,
54
- disabled: optionDisabled
55
- } = _ref4;
56
- return /*#__PURE__*/React.createElement(Option, {
57
- key: value,
58
- value: value,
59
- label: optionLabel,
60
- disabled: optionDisabled
61
- });
62
- }));
63
- };
64
-
65
- const OptionsWithGroups = _ref5 => {
66
- let {
67
- optionsWithGroups
68
- } = _ref5;
69
- return /*#__PURE__*/React.createElement(React.Fragment, null, optionsWithGroups.map(optionOrGroup => {
70
- if (isOptionsGroup(optionOrGroup)) {
71
- const group = optionOrGroup;
72
- return /*#__PURE__*/React.createElement(OptionGroup, {
73
- key: `group--${group.label}--${collectOptionGroupValues(group.options)}`,
74
- options: group.options,
75
- disabled: group.disabled,
76
- label: group.label
77
- });
78
- }
79
-
80
- const option = optionOrGroup;
81
- return /*#__PURE__*/React.createElement(Option, {
82
- key: option.value,
83
- value: option.value,
84
- label: optionOrGroup.label,
85
- disabled: optionOrGroup.disabled
86
- });
87
- }));
88
- };
89
-
90
- function findSelectedOption(options, selectedValue) {
91
- let result = null;
92
-
93
- const checkOption = option => {
94
- if (result === null || option.value === selectedValue) {
95
- result = option;
96
- }
97
- };
98
-
99
- options.forEach(optionOrGroup => {
100
- if (isOptionsGroup(optionOrGroup)) {
101
- var _group$options;
102
-
103
- const group = optionOrGroup;
104
- (_group$options = group.options) === null || _group$options === void 0 || _group$options.forEach(checkOption);
105
- } else {
106
- checkOption(optionOrGroup);
107
- }
108
- });
109
- return result;
110
- }
111
-
112
- function getNoOptionsMessage(noOptionsMessage, isLoading) {
113
- const {
114
- noOptions,
115
- loading
116
- } = isString(noOptionsMessage) ? { ...DEFAULT_NO_OPTIONS_MESSAGES,
117
- noOptions: noOptionsMessage
118
- } : { ...DEFAULT_NO_OPTIONS_MESSAGES,
119
- ...noOptionsMessage
120
- };
121
-
122
- if (isLoading) {
123
- return loading;
124
- } else {
125
- return noOptions;
126
- }
127
- }
128
-
129
- const SIZE_STYLES = {
130
- s: styles.sizeS,
131
- m: styles.sizeM,
132
- l: styles.sizeL
133
- }; // eslint-disable-next-line complexity
134
-
135
- const NativeSelect = _ref6 => {
136
- let {
137
- options = [],
138
- size = 'm',
139
- theme: themeFromProps,
140
- className = null,
141
- style,
142
- value = undefined,
143
- onChange,
144
- placeholder,
145
- isLoading = false,
146
- isDisabled = false,
147
- trigger,
148
- label,
149
- note,
150
- error,
151
- noOptionsMessage,
152
- name,
153
- boldLabel
154
- } = _ref6;
155
- const theme = useThemeWithUndefined(themeFromProps);
156
- const [hovered, setHovered] = useState(false);
157
-
158
- const handleChange = event => {
159
- const newValue = event.target.value;
160
- const selectedOption = findSelectedOption(options, newValue);
161
-
162
- if (onChange) {
163
- onChange(selectedOption);
164
- }
165
- };
166
-
167
- const optionList = /*#__PURE__*/React.createElement(OptionsWithGroups, {
168
- optionsWithGroups: placeholder !== null ? [{
169
- value: PLACEHOLDER_VALUE,
170
- label: options.length > 0 ? placeholder : getNoOptionsMessage(noOptionsMessage, isLoading),
171
- disabled: true
172
- }, ...options] : options
173
- });
174
-
175
- let _trigger;
176
-
177
- if (trigger) {
178
- _trigger = trigger({
179
- selectedLabel: value === null || value === void 0 ? void 0 : value.label,
180
- selectedValue: value === null || value === void 0 ? void 0 : value.value,
181
- placeholder,
182
- hovered
183
- });
184
- } else {
185
- _trigger = /*#__PURE__*/React.createElement(SelectTrigger, {
186
- theme: theme,
187
- size: size,
188
- isOpen: false,
189
- selected: value,
190
- placeholder: placeholder,
191
- searchInput: "",
192
- isClearable: false,
193
- isLoading: isLoading,
194
- isDisabled: isDisabled,
195
- error: Boolean(error)
196
- });
197
- }
198
-
199
- return /*#__PURE__*/React.createElement(FormTriggerWrapper, {
200
- className: cn(className, styles.main, SIZE_STYLES[size]),
201
- theme: theme,
202
- size: size,
203
- error: error,
204
- label: label,
205
- note: note,
206
- onKeyDown: () => false,
207
- boldLabel: boldLabel
208
- }, /*#__PURE__*/React.createElement("div", {
209
- className: styles.wrapper,
210
- onMouseEnter: () => setHovered(true),
211
- onMouseLeave: () => setHovered(false),
212
- style: style,
213
- "data-test": "native-select"
214
- }, _trigger, /*#__PURE__*/React.createElement("select", {
215
- "data-test": "native-select_select",
216
- "data-rs-internal": 'select-native__select',
217
- className: styles.select,
218
- disabled: isDisabled ? true : undefined,
219
- onChange: handleChange,
220
- name: name,
221
- value: (value === null || value === void 0 ? void 0 : value.label) !== '' ? value === null || value === void 0 ? void 0 : value.value : PLACEHOLDER_VALUE
222
- }, optionList)));
223
- };
224
-
225
- NativeSelect.propTypes = {
226
- className: PropTypes.string,
227
- options: PropTypes.arrayOf(PropTypes.oneOfType([nativeOptionType, nativeOptionsGroupType])),
228
- value: nativeOptionType,
229
- onChange: PropTypes.func,
230
- size: PropTypes.oneOf(['m', 's', 'l']),
231
- theme: PropTypes.oneOf(['light', 'dark']),
232
- placeholder: PropTypes.string,
233
- isDisabled: PropTypes.bool,
234
- isLoading: PropTypes.bool,
235
- trigger: PropTypes.func,
236
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
237
- label: PropTypes.node,
238
- note: PropTypes.node,
239
- noOptionsMessage: noOptionsMessageType,
240
- style: PropTypes.object,
241
- name: PropTypes.string,
242
- boldLabel: PropTypes.bool
243
- };
244
- export { NativeSelect as default };
@@ -1,9 +0,0 @@
1
- var styles = {
2
- "sizeS": "_sizeS_1gl6ux4_6",
3
- "sizeM": "_sizeM_1gl6ux4_9",
4
- "sizeL": "_sizeL_1gl6ux4_12",
5
- "main": "_main_1gl6ux4_16",
6
- "wrapper": "_wrapper_1gl6ux4_20",
7
- "select": "_select_1gl6ux4_24"
8
- };
9
- export { styles as default };
@@ -1 +0,0 @@
1
- export declare function throttle<A extends unknown[], R extends unknown>(func: (...args: A) => R, wait: number): (...args: A) => R;
@@ -1,37 +0,0 @@
1
- import React, { HTMLAttributes } from 'react';
2
- import { Theme } from '@rescui/ui-contexts';
3
- import type { SelectOption, SelectSize, SelectMode } from '../types';
4
- declare type SelectTriggerPropsOwn = {
5
- size: SelectSize;
6
- mode?: SelectMode;
7
- theme?: Theme;
8
- className?: string;
9
- triggerRef?: React.Ref<HTMLDivElement>;
10
- isOpen?: boolean;
11
- selected?: unknown;
12
- placeholder?: string;
13
- isClearable?: boolean;
14
- isLoading?: boolean;
15
- isDisabled?: boolean;
16
- isSingleLine?: boolean;
17
- searchInput?: string;
18
- isSearchable?: boolean;
19
- onClearClick?: () => void;
20
- onItemClearClick?: (s: SelectOption) => void;
21
- onSearchChange?: (newValue: string) => void;
22
- error?: boolean;
23
- };
24
- export declare type SelectTriggerProps = SelectTriggerPropsOwn & Omit<HTMLAttributes<HTMLDivElement>, keyof SelectTriggerPropsOwn>;
25
- export declare type SelectedOptionProps = {
26
- selected: SelectOption;
27
- searchInput?: string;
28
- placeholder?: string;
29
- isSearchable?: boolean;
30
- isDisabled?: boolean;
31
- inputRef: React.Ref<HTMLInputElement>;
32
- handleBlur: React.FocusEventHandler<HTMLInputElement>;
33
- handleFocus: React.FocusEventHandler<HTMLInputElement>;
34
- handleChange: React.ChangeEventHandler<HTMLInputElement>;
35
- };
36
- declare const SelectTrigger: React.FC<SelectTriggerProps>;
37
- export default SelectTrigger;
@@ -1,255 +0,0 @@
1
- "use client";
2
- import React, { useRef, useState } from 'react';
3
- import cn from 'classnames';
4
- import PropTypes from 'prop-types';
5
- import { RemovableTag, Tag } from '@rescui/tag';
6
- import { useThemeWithUndefined } from '@rescui/ui-contexts';
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
- import { optionType } from '../common-prop-types.js';
11
- import { getOptionValue } from '../utils.js';
12
- import Foldable from './foldable.js';
13
- import styles from './trigger.p.module.css.js';
14
- const THEME_STYLES = {
15
- light: styles.themeLight,
16
- dark: styles.themeDark
17
- };
18
- const SIZE_STYLES = {
19
- s: styles.sizeS,
20
- m: styles.sizeM,
21
- l: styles.sizeL
22
- };
23
- const MODE_STYLES = {
24
- classic: styles.classic,
25
- rock: styles.rock
26
- };
27
-
28
- const MultiselectOptions = _ref => {
29
- let {
30
- isSingleLine,
31
- selected,
32
- isDisabled,
33
- onItemClearClick
34
- } = _ref;
35
- const selectedOptions = selected.map(s => {
36
- const key = getOptionValue(s);
37
- return /*#__PURE__*/React.createElement(RemovableTag, {
38
- key: key,
39
- "data-test": `selected-tag-${key}`,
40
- className: styles.tag,
41
- disabled: isDisabled,
42
- onRemoveClick: () => onItemClearClick(s),
43
- "data-rs-internal": 'select-trigger__removable-tag',
44
- wrap: !isSingleLine
45
- }, s.label);
46
- });
47
- return /*#__PURE__*/React.createElement("div", {
48
- className: styles.multi,
49
- "data-test": "multi"
50
- }, isSingleLine ? /*#__PURE__*/React.createElement(Foldable, {
51
- className: styles.tagsContainer,
52
- renderHiddenCounter: (n, ref) => /*#__PURE__*/React.createElement(Tag, {
53
- className: cn(styles.tag, styles.filledTag),
54
- key: "+",
55
- ref: ref,
56
- "data-rs-internal": 'select-trigger__tag'
57
- }, `+${n}`)
58
- }, selectedOptions) : /*#__PURE__*/React.createElement("div", {
59
- className: styles.tagsContainer
60
- }, selectedOptions));
61
- };
62
-
63
- function isSelectedEmpty(selected) {
64
- if (Array.isArray(selected)) {
65
- return selected.length === 0;
66
- } else {
67
- return !selected;
68
- }
69
- } // eslint-disable-next-line complexity
70
-
71
-
72
- const SelectedOption = _ref2 => {
73
- let {
74
- selected,
75
- searchInput = '',
76
- placeholder = '',
77
- isSearchable,
78
- isDisabled,
79
- inputRef,
80
- handleBlur,
81
- handleFocus,
82
- handleChange
83
- } = _ref2;
84
- return /*#__PURE__*/React.createElement("div", {
85
- className: styles.labelWrapper
86
- }, /*#__PURE__*/React.createElement("div", {
87
- className: cn(styles.label, isSelectedEmpty(selected) && styles.labelNotSelected),
88
- "data-test": "select-content"
89
- }, searchInput === '' ? selected && selected.label ? selected.label : placeholder : ''), isSearchable && !isDisabled && /*#__PURE__*/React.createElement("input", {
90
- ref: inputRef,
91
- tabIndex: isSearchable ? 0 : -1,
92
- onBlur: handleBlur,
93
- onFocus: handleFocus,
94
- className: styles.searchInput,
95
- autoCapitalize: "none",
96
- autoComplete: "off",
97
- autoCorrect: "off",
98
- spellCheck: "false",
99
- type: "text",
100
- value: searchInput,
101
- onChange: handleChange,
102
- "data-test": "search-input"
103
- }));
104
- };
105
-
106
- const ClearOrLoading = _ref3 => {
107
- let {
108
- isClearable,
109
- isLoading,
110
- isDisabled,
111
- onClearClick,
112
- selected
113
- } = _ref3;
114
-
115
- if (isLoading) {
116
- return /*#__PURE__*/React.createElement(LoadingOutlineIcon, {
117
- style: {
118
- pointerEvents: 'none'
119
- },
120
- className: styles.icon,
121
- "data-test": "loading-icon",
122
- "data-render-all-sizes": true
123
- });
124
- } else if (isClearable && !isDisabled && !isSelectedEmpty(selected)) {
125
- return /*#__PURE__*/React.createElement("button", {
126
- type: "button",
127
- className: cn(styles.icon, styles.clearIcon),
128
- "data-test": "clear-icon",
129
- onClick: e => {
130
- e.stopPropagation();
131
- onClearClick();
132
- }
133
- }, /*#__PURE__*/React.createElement(CloseOutlineIcon, {
134
- "data-render-all-sizes": true
135
- }));
136
- } else {
137
- return null;
138
- }
139
- }; // eslint-disable-next-line complexity
140
-
141
-
142
- const SelectTrigger = /*#__PURE__*/React.memo(props => {
143
- const {
144
- size,
145
- mode,
146
- theme: themeFromProps,
147
- className,
148
- triggerRef,
149
- isOpen,
150
- selected = null,
151
- placeholder,
152
- isClearable,
153
- isLoading,
154
- isDisabled,
155
- isSingleLine,
156
- searchInput,
157
- isSearchable,
158
- onClearClick,
159
- onItemClearClick,
160
- onSearchChange,
161
- error,
162
- ...restProps
163
- } = props;
164
- const theme = useThemeWithUndefined(themeFromProps);
165
- const inputRef = useRef(null);
166
- const [isSearchFocused, setIsSearchFocused] = useState(false);
167
- const [isFocused, setIsFocused] = useState(false);
168
- const [isSearchKeyFocused, setIsSearchKeyFocused] = useState(false);
169
- const isMulti = selected ? Boolean(selected.length) : false;
170
-
171
- const handleChange = event => {
172
- const newValue = event.target.value;
173
- onSearchChange(newValue);
174
- };
175
-
176
- const handleBlur = () => {
177
- if (isSearchable && inputRef.current) {
178
- setIsSearchFocused(false);
179
- setIsSearchKeyFocused(false);
180
- }
181
- };
182
-
183
- const handleFocus = e => {
184
- if (isSearchable && inputRef.current) {
185
- setIsSearchFocused(true);
186
- const target = e.target;
187
- setIsSearchKeyFocused(target.getAttribute('data-focus-method') === 'key');
188
- }
189
- };
190
-
191
- return /*#__PURE__*/React.createElement("div", {
192
- tabIndex: isSearchable || isDisabled ? -1 : 0,
193
- className: cn(styles.main, SIZE_STYLES[size], MODE_STYLES[mode], THEME_STYLES[theme], isMulti && styles.isMulti, isSearchFocused && styles.searchFocused, isSearchKeyFocused && styles.searchKeyFocused, isOpen && styles.open, isDisabled ? styles.disabled : styles.enabled, Boolean(error) && styles.error, isFocused && styles.focused, className),
194
- onFocus: e => {
195
- const target = e.target;
196
- setIsFocused(target.getAttribute('data-focus-method') === 'key');
197
- },
198
- onBlur: () => setIsFocused(false),
199
- ref: triggerRef,
200
- "data-test": "select",
201
- "data-rs-internal": 'select-trigger',
202
- ...restProps
203
- }, isMulti ? /*#__PURE__*/React.createElement(MultiselectOptions, {
204
- selected: selected,
205
- isDisabled: isDisabled,
206
- isSingleLine: isSingleLine,
207
- onItemClearClick: onItemClearClick
208
- }) : /*#__PURE__*/React.createElement(SelectedOption, {
209
- selected: selected,
210
- placeholder: placeholder,
211
- searchInput: searchInput,
212
- isSearchable: isSearchable,
213
- isDisabled: isDisabled,
214
- inputRef: inputRef,
215
- handleBlur: handleBlur,
216
- handleFocus: handleFocus,
217
- handleChange: handleChange
218
- }), /*#__PURE__*/React.createElement("div", {
219
- className: styles.iconsWrapper
220
- }, /*#__PURE__*/React.createElement(ClearOrLoading, {
221
- isLoading: isLoading,
222
- isDisabled: isDisabled,
223
- isClearable: isClearable,
224
- onClearClick: onClearClick,
225
- selected: selected
226
- }), /*#__PURE__*/React.createElement(DownOutlineIcon, {
227
- className: styles.toggle,
228
- "data-test": "down-icon",
229
- "data-render-all-sizes": true
230
- })));
231
- });
232
- SelectTrigger.displayName = 'SelectTrigger';
233
- SelectTrigger.propTypes = {
234
- size: PropTypes.oneOf(['m', 's', 'l']),
235
- mode: PropTypes.oneOf(['classic', 'rock']),
236
- theme: PropTypes.oneOf(['light', 'dark']),
237
- className: PropTypes.string,
238
- isOpen: PropTypes.bool,
239
- selected: PropTypes.oneOfType([optionType, PropTypes.arrayOf(optionType)]),
240
- placeholder: PropTypes.string,
241
- isClearable: PropTypes.bool,
242
- isLoading: PropTypes.bool,
243
- isDisabled: PropTypes.bool,
244
- isSearchable: PropTypes.bool,
245
- isSingleLine: PropTypes.bool,
246
- onClearClick: PropTypes.func,
247
- onItemClearClick: PropTypes.func,
248
- onSearchChange: PropTypes.func,
249
- error: PropTypes.bool,
250
- triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
251
- current: PropTypes.any
252
- })]),
253
- searchInput: PropTypes.string
254
- };
255
- export { SelectTrigger as default };
@@ -1,31 +0,0 @@
1
- var styles = {
2
- "themeLight": "_themeLight_ufjs6v_27",
3
- "themeDark": "_themeDark_ufjs6v_30",
4
- "sizeS": "_sizeS_ufjs6v_34",
5
- "sizeM": "_sizeM_ufjs6v_37",
6
- "sizeL": "_sizeL_ufjs6v_40",
7
- "classic": "_classic_ufjs6v_44",
8
- "rock": "_rock_ufjs6v_47",
9
- "main": "_main_ufjs6v_51",
10
- "open": "_open_ufjs6v_80",
11
- "searchKeyFocused": "_searchKeyFocused_ufjs6v_85",
12
- "error": "_error_ufjs6v_89",
13
- "disabled": "_disabled_ufjs6v_95",
14
- "enabled": "_enabled_ufjs6v_103",
15
- "searchFocused": "_searchFocused_ufjs6v_104",
16
- "focused": "_focused_ufjs6v_105",
17
- "isMulti": "_isMulti_ufjs6v_138",
18
- "iconsWrapper": "_iconsWrapper_ufjs6v_142",
19
- "labelWrapper": "_labelWrapper_ufjs6v_157",
20
- "label": "_label_ufjs6v_157",
21
- "labelNotSelected": "_labelNotSelected_ufjs6v_197",
22
- "searchInput": "_searchInput_ufjs6v_210",
23
- "multi": "_multi_ufjs6v_240",
24
- "tagsContainer": "_tagsContainer_ufjs6v_256",
25
- "tag": "_tag_ufjs6v_256",
26
- "filledTag": "_filledTag_ufjs6v_279",
27
- "toggle": "_toggle_ufjs6v_286",
28
- "icon": "_icon_ufjs6v_142",
29
- "clearIcon": "_clearIcon_ufjs6v_353"
30
- };
31
- export { styles as default };
package/lib/utils.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import type { SelectOptionOrGroup, SelectOptionsGroup, NoOptionsMessage, SelectSize } from './types';
3
- import { Groups, Index, SelectOption } from './types';
4
- export declare const getTextFromNodes: (node: React.ReactNode, depth?: number) => string;
5
- export declare function shouldOpenSelect(key: string, isTriggerTarget?: boolean): boolean;
6
- export declare function getEmptyMessage(isLoading: boolean, isNothingFound: boolean, noOptionsMessage: NoOptionsMessage): string;
7
- export declare function escapeRegex(str: string): string;
8
- export declare function convertToOptionGroupsIfNeeded(optionsOrGroups?: SelectOptionOrGroup[]): SelectOptionsGroup[];
9
- export declare const calculateMaxHeight: (size: SelectSize) => number;
10
- export declare function getOptionValue(option: SelectOption): string;
11
- export declare const OptionGroupTypes: {
12
- HEADER: string;
13
- OPTION: string;
14
- DIVIDER: string;
15
- };
16
- export declare const getDefaultCursorIndex: (groups: Groups) => Index;
17
- export declare const getPlainOptionsFromGroups: (groups: Groups) => any[];
18
- export declare function isGroupsEmpty(groups: Groups): boolean;
19
- export declare function useStrongMemo<T>(callback: () => T, deps: unknown[]): T;
20
- export declare function getMovedCursorIndex(groups: Groups, currentCursorIndex: Index, isDownDirection: boolean): Index;
21
- export declare const isIndexMatchCursor: (cursorIndex: Index, index: Index) => boolean;
22
- export declare const withoutGroupsLabel: (groups: Groups) => boolean;