@laser-ui/components 1.6.1 → 2.0.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.
Files changed (298) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/accordion/Accordion.d.ts +1 -1
  3. package/accordion/Accordion.js +13 -25
  4. package/accordion/types.d.ts +1 -0
  5. package/affix/Affix.d.ts +2 -2
  6. package/affix/Affix.js +27 -32
  7. package/affix/types.d.ts +7 -2
  8. package/alert/Alert.d.ts +1 -1
  9. package/alert/Alert.js +12 -21
  10. package/anchor/Anchor.d.ts +2 -4
  11. package/anchor/Anchor.js +34 -26
  12. package/anchor/types.d.ts +1 -0
  13. package/avatar/Avatar.d.ts +1 -1
  14. package/avatar/Avatar.js +9 -3
  15. package/badge/Badge.d.ts +1 -1
  16. package/badge/Badge.js +22 -41
  17. package/badge/BadgeText.js +12 -26
  18. package/badge/internal/BadgeNumber.d.ts +2 -2
  19. package/badge/internal/BadgeNumber.js +34 -24
  20. package/base-input/BaseInput.d.ts +1 -2
  21. package/base-input/BaseInput.js +4 -4
  22. package/base-input/types.d.ts +1 -0
  23. package/breadcrumb/Breadcrumb.d.ts +1 -1
  24. package/button/Button.d.ts +1 -2
  25. package/button/Button.js +18 -22
  26. package/button/types.d.ts +1 -0
  27. package/card/Card.d.ts +1 -1
  28. package/card/CardAction.d.ts +1 -1
  29. package/card/CardAction.js +3 -4
  30. package/card/CardActions.d.ts +1 -1
  31. package/card/CardActions.js +7 -3
  32. package/card/CardContent.d.ts +1 -1
  33. package/card/CardHeader.d.ts +1 -1
  34. package/card/types.d.ts +5 -1
  35. package/cascader/Cascader.d.ts +2 -4
  36. package/cascader/Cascader.js +217 -214
  37. package/cascader/internal/CascaderPanel.d.ts +2 -2
  38. package/cascader/internal/CascaderPanel.js +21 -7
  39. package/cascader/internal/CascaderSearchPanel.d.ts +2 -2
  40. package/cascader/internal/CascaderSearchPanel.js +15 -6
  41. package/cascader/types.d.ts +3 -3
  42. package/checkbox/Checkbox.d.ts +1 -1
  43. package/checkbox/Checkbox.js +4 -5
  44. package/checkbox/CheckboxGroup.d.ts +1 -1
  45. package/checkbox/CheckboxGroup.js +8 -7
  46. package/checkbox/types.d.ts +14 -4
  47. package/{internal/circular-progress → circular-progress}/CircularProgress.d.ts +1 -1
  48. package/{internal/circular-progress → circular-progress}/CircularProgress.js +2 -2
  49. package/compose/Compose.d.ts +1 -1
  50. package/compose/ComposeItem.d.ts +1 -1
  51. package/config-provider/ConfigProvider.d.ts +1 -1
  52. package/config-provider/ConfigProvider.js +3 -3
  53. package/date-picker/DatePicker.d.ts +2 -2
  54. package/date-picker/DatePicker.js +116 -98
  55. package/date-picker/internal/DatePickerPanel.d.ts +2 -1
  56. package/date-picker/internal/DatePickerPanel.js +4 -4
  57. package/date-picker/types.d.ts +3 -3
  58. package/dialog-service.d.ts +9 -6
  59. package/dialog-service.js +50 -26
  60. package/drawer/Drawer.d.ts +1 -1
  61. package/drawer/Drawer.js +83 -92
  62. package/drawer/DrawerFooter.d.ts +1 -1
  63. package/drawer/DrawerFooter.js +12 -9
  64. package/drawer/DrawerHeader.d.ts +1 -1
  65. package/drawer/DrawerHeader.js +10 -7
  66. package/drawer/types.d.ts +9 -2
  67. package/drawer/vars.d.ts +5 -1
  68. package/drawer/vars.js +1 -1
  69. package/dropdown/Dropdown.d.ts +2 -4
  70. package/dropdown/Dropdown.js +83 -104
  71. package/dropdown/internal/DropdownGroup.d.ts +1 -1
  72. package/dropdown/internal/DropdownItem.d.ts +1 -1
  73. package/dropdown/internal/DropdownSub.d.ts +2 -1
  74. package/dropdown/internal/DropdownSub.js +26 -49
  75. package/dropdown/types.d.ts +15 -2
  76. package/empty/Empty.d.ts +1 -1
  77. package/fab/Fab.d.ts +1 -1
  78. package/fab/Fab.js +19 -14
  79. package/fab/FabBacktop.d.ts +1 -1
  80. package/fab/FabBacktop.js +24 -31
  81. package/fab/FabButton.d.ts +1 -1
  82. package/fab/FabButton.js +37 -10
  83. package/fab/types.d.ts +6 -2
  84. package/fab/vars.d.ts +14 -0
  85. package/fab/vars.js +4 -0
  86. package/form/Form.d.ts +1 -1
  87. package/form/Form.js +7 -2
  88. package/form/FormItem.d.ts +1 -1
  89. package/form/FormItem.js +35 -24
  90. package/form/internal/FormError.d.ts +3 -2
  91. package/form/internal/FormError.js +10 -19
  92. package/hooks/index.d.ts +0 -2
  93. package/hooks/index.js +0 -2
  94. package/hooks/useComponentProps.js +2 -2
  95. package/hooks/useFocusVisible.d.ts +9 -2
  96. package/hooks/useFocusVisible.js +5 -11
  97. package/hooks/useLayout.d.ts +2 -2
  98. package/hooks/useLayout.js +2 -2
  99. package/hooks/useNamespace.js +2 -2
  100. package/hooks/useNestedPopup.d.ts +1 -1
  101. package/hooks/useScopedProps.js +2 -2
  102. package/hooks/useStyled.js +2 -2
  103. package/hooks/useTranslation.js +2 -2
  104. package/icon/Icon.d.ts +1 -1
  105. package/icon/Icon.js +7 -4
  106. package/image/Image.d.ts +1 -1
  107. package/image/Image.js +6 -2
  108. package/image/ImageAction.d.ts +1 -1
  109. package/image/ImageAction.js +3 -4
  110. package/image/ImageLoader.d.ts +1 -1
  111. package/image/ImagePreview.d.ts +1 -1
  112. package/image/ImagePreview.js +94 -109
  113. package/image/types.d.ts +6 -2
  114. package/input/Input.d.ts +1 -1
  115. package/input/Input.js +12 -8
  116. package/input/InputNumber.js +49 -40
  117. package/input/types.d.ts +3 -5
  118. package/internal/lazy-loading/LazyLoading.d.ts +3 -0
  119. package/internal/lazy-loading/LazyLoading.js +9 -0
  120. package/internal/lazy-loading/index.d.ts +2 -0
  121. package/internal/lazy-loading/index.js +1 -0
  122. package/internal/lazy-loading/types.d.ts +7 -0
  123. package/internal/popup/Popup.d.ts +1 -1
  124. package/internal/popup/Popup.js +40 -68
  125. package/internal/popup/types.d.ts +13 -6
  126. package/internal/portal/Portal.d.ts +1 -1
  127. package/internal/portal/Portal.js +12 -6
  128. package/internal/portal/types.d.ts +3 -2
  129. package/mask/Mask.d.ts +3 -0
  130. package/mask/Mask.js +31 -0
  131. package/menu/Menu.d.ts +2 -4
  132. package/menu/Menu.js +37 -42
  133. package/menu/internal/MenuGroup.d.ts +1 -1
  134. package/menu/internal/MenuItem.d.ts +1 -1
  135. package/menu/internal/MenuItem.js +14 -10
  136. package/menu/internal/MenuSub.d.ts +2 -1
  137. package/menu/internal/MenuSub.js +43 -70
  138. package/menu/types.d.ts +1 -0
  139. package/modal/Modal.d.ts +1 -1
  140. package/modal/Modal.js +77 -80
  141. package/modal/ModalAlert.d.ts +1 -1
  142. package/modal/ModalFooter.d.ts +1 -1
  143. package/modal/ModalFooter.js +12 -9
  144. package/modal/ModalHeader.d.ts +1 -1
  145. package/modal/ModalHeader.js +10 -7
  146. package/modal/types.d.ts +9 -2
  147. package/modal/vars.d.ts +5 -0
  148. package/modal/vars.js +2 -0
  149. package/notification/Notification.d.ts +1 -1
  150. package/notification/Notification.js +44 -71
  151. package/notification/types.d.ts +1 -0
  152. package/package.json +2 -2
  153. package/pagination/Pagination.d.ts +1 -1
  154. package/pagination/Pagination.js +9 -6
  155. package/popover/Popover.d.ts +2 -2
  156. package/popover/Popover.js +82 -118
  157. package/popover/PopoverFooter.d.ts +1 -1
  158. package/popover/PopoverFooter.js +12 -9
  159. package/popover/PopoverHeader.d.ts +1 -1
  160. package/popover/PopoverHeader.js +10 -7
  161. package/popover/types.d.ts +18 -4
  162. package/popover/vars.d.ts +5 -0
  163. package/popover/vars.js +2 -0
  164. package/progress/Progress.d.ts +1 -1
  165. package/radio/Radio.d.ts +1 -1
  166. package/radio/Radio.js +18 -13
  167. package/radio/RadioGroup.d.ts +1 -1
  168. package/radio/RadioGroup.js +12 -7
  169. package/radio/types.d.ts +16 -4
  170. package/radio/vars.d.ts +6 -0
  171. package/radio/vars.js +2 -0
  172. package/rating/Rating.d.ts +1 -1
  173. package/rating/internal/RatingStar.d.ts +1 -1
  174. package/rating/internal/RatingStar.js +23 -21
  175. package/root/Root.d.ts +1 -1
  176. package/root/Root.js +1 -1
  177. package/select/Select.d.ts +2 -4
  178. package/select/Select.js +245 -243
  179. package/select/types.d.ts +3 -3
  180. package/separator/Separator.d.ts +1 -1
  181. package/skeleton/Skeleton.d.ts +1 -1
  182. package/slider/Slider.d.ts +1 -1
  183. package/slider/Slider.js +54 -34
  184. package/slider/types.d.ts +2 -3
  185. package/slides/Slides.d.ts +1 -1
  186. package/slides/Slides.js +8 -3
  187. package/spinner/Spinner.d.ts +1 -1
  188. package/spinner/Spinner.js +27 -29
  189. package/stepper/Stepper.d.ts +1 -1
  190. package/stepper/Stepper.js +9 -16
  191. package/switch/Switch.js +33 -24
  192. package/switch/types.d.ts +2 -3
  193. package/table/Table.d.ts +1 -1
  194. package/table/Table.js +14 -10
  195. package/table/TableEmpty.d.ts +1 -1
  196. package/table/TableEmpty.js +9 -3
  197. package/table/TableExpand.d.ts +1 -1
  198. package/table/TableFilter.d.ts +1 -1
  199. package/table/TableFilter.js +1 -1
  200. package/table/TableTd.d.ts +1 -1
  201. package/table/TableTh.d.ts +1 -1
  202. package/table/TableThAction.d.ts +1 -1
  203. package/table/TableThAction.js +3 -4
  204. package/table/internal/TableCell.d.ts +1 -1
  205. package/table/internal/TableCell.js +13 -5
  206. package/table/types.d.ts +9 -2
  207. package/tabs/Tabs.d.ts +2 -4
  208. package/tabs/Tabs.js +41 -25
  209. package/tabs/types.d.ts +1 -0
  210. package/tag/Tag.d.ts +1 -1
  211. package/textarea/Textarea.d.ts +1 -1
  212. package/textarea/Textarea.js +15 -8
  213. package/textarea/types.d.ts +1 -0
  214. package/time-picker/TimePicker.d.ts +2 -2
  215. package/time-picker/TimePicker.js +89 -75
  216. package/time-picker/internal/TimePickerPanel.d.ts +2 -1
  217. package/time-picker/internal/TimePickerPanel.js +22 -7
  218. package/time-picker/types.d.ts +3 -3
  219. package/timeline/Timeline.d.ts +1 -1
  220. package/toast/Toast.d.ts +1 -1
  221. package/toast/Toast.js +44 -72
  222. package/toast/types.d.ts +1 -0
  223. package/tooltip/Tooltip.d.ts +2 -2
  224. package/tooltip/Tooltip.js +50 -74
  225. package/tooltip/types.d.ts +10 -2
  226. package/transfer/Transfer.d.ts +1 -1
  227. package/transfer/internal/TransferPanel.d.ts +1 -1
  228. package/transfer/internal/TransferPanel.js +7 -2
  229. package/{internal/transition → transition}/CollapseTransition.d.ts +1 -1
  230. package/transition/CollapseTransition.js +65 -0
  231. package/transition/Transition.d.ts +3 -0
  232. package/transition/Transition.js +148 -0
  233. package/transition/types.d.ts +29 -0
  234. package/tree/Tree.d.ts +1 -1
  235. package/tree/Tree.js +19 -7
  236. package/tree/internal/TreePanel.d.ts +2 -2
  237. package/tree/internal/TreePanel.js +32 -26
  238. package/tree-select/TreeSelect.d.ts +2 -4
  239. package/tree-select/TreeSelect.js +216 -213
  240. package/tree-select/internal/TreeSelectSearchPanel.d.ts +2 -2
  241. package/tree-select/internal/TreeSelectSearchPanel.js +15 -6
  242. package/tree-select/types.d.ts +3 -3
  243. package/types.d.ts +1 -1
  244. package/upload/Upload.d.ts +1 -3
  245. package/upload/Upload.js +41 -50
  246. package/upload/UploadAction.d.ts +1 -1
  247. package/upload/UploadAction.js +19 -16
  248. package/upload/UploadButton.d.ts +1 -1
  249. package/upload/UploadButton.js +16 -12
  250. package/upload/UploadList.d.ts +1 -1
  251. package/upload/UploadList.js +52 -47
  252. package/upload/UploadPicture.d.ts +1 -1
  253. package/upload/UploadPicture.js +47 -53
  254. package/upload/UploadPictureList.d.ts +1 -1
  255. package/upload/UploadPictureList.js +52 -47
  256. package/upload/UploadPreviewAction.d.ts +1 -1
  257. package/upload/UploadPreviewAction.js +15 -14
  258. package/upload/hooks.d.ts +2 -0
  259. package/upload/types.d.ts +27 -6
  260. package/upload/vars.d.ts +11 -0
  261. package/upload/vars.js +3 -0
  262. package/virtual-scroll/VirtualScroll.d.ts +2 -4
  263. package/virtual-scroll/VirtualScroll.js +13 -21
  264. package/virtual-scroll/types.d.ts +2 -1
  265. package/wave/Wave.d.ts +3 -0
  266. package/{internal/wave → wave}/Wave.js +6 -6
  267. package/{internal/wave → wave}/types.d.ts +1 -0
  268. package/wave/types.js +1 -0
  269. package/LICENSE +0 -21
  270. package/hooks/useJSS.d.ts +0 -1
  271. package/hooks/useJSS.js +0 -15
  272. package/hooks/useNextTick.d.ts +0 -2
  273. package/internal/mask/Mask.d.ts +0 -3
  274. package/internal/mask/Mask.js +0 -36
  275. package/internal/transition/CollapseTransition.js +0 -101
  276. package/internal/transition/Transition.d.ts +0 -3
  277. package/internal/transition/Transition.js +0 -87
  278. package/internal/transition/types.d.ts +0 -33
  279. package/internal/wave/Wave.d.ts +0 -3
  280. /package/{internal/circular-progress → circular-progress}/index.d.ts +0 -0
  281. /package/{internal/circular-progress → circular-progress}/index.js +0 -0
  282. /package/{internal/circular-progress → circular-progress}/vars.d.ts +0 -0
  283. /package/{internal/circular-progress → circular-progress}/vars.js +0 -0
  284. /package/internal/{mask → lazy-loading}/types.js +0 -0
  285. /package/{internal/mask → mask}/index.d.ts +0 -0
  286. /package/{internal/mask → mask}/index.js +0 -0
  287. /package/{internal/mask → mask}/types.d.ts +0 -0
  288. /package/{internal/transition → mask}/types.js +0 -0
  289. /package/{internal/mask → mask}/vars.d.ts +0 -0
  290. /package/{internal/mask → mask}/vars.js +0 -0
  291. /package/{internal/transition → transition}/index.d.ts +0 -0
  292. /package/{internal/transition → transition}/index.js +0 -0
  293. /package/{internal/wave → transition}/types.js +0 -0
  294. /package/{hooks/useNextTick.js → upload/hooks.js} +0 -0
  295. /package/{internal/wave → wave}/index.d.ts +0 -0
  296. /package/{internal/wave → wave}/index.js +0 -0
  297. /package/{internal/wave → wave}/vars.d.ts +0 -0
  298. /package/{internal/wave → wave}/vars.js +0 -0
package/select/Select.js CHANGED
@@ -1,35 +1,34 @@
1
1
  import { __rest } from "tslib";
2
2
  import { createElement as _createElement } from "react";
3
3
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
- import { useEventCallback, useForkRef, useResize } from '@laser-ui/hooks';
5
- import { findNested, scrollIntoViewIfNeeded } from '@laser-ui/utils';
4
+ import { useEventCallback, useResize } from '@laser-ui/hooks';
5
+ import { findNested, scrollIntoViewIfNeeded, setRef } from '@laser-ui/utils';
6
6
  import CancelFilled from '@material-design-icons/svg/filled/cancel.svg?react';
7
7
  import AddOutlined from '@material-design-icons/svg/outlined/add.svg?react';
8
8
  import CloseOutlined from '@material-design-icons/svg/outlined/close.svg?react';
9
9
  import KeyboardArrowDownOutlined from '@material-design-icons/svg/outlined/keyboard_arrow_down.svg?react';
10
10
  import SearchOutlined from '@material-design-icons/svg/outlined/search.svg?react';
11
11
  import { isNull, isNumber, isUndefined } from 'lodash';
12
- import { createElement, forwardRef, useCallback, useId, useImperativeHandle, useMemo, useRef, useState } from 'react';
12
+ import { useCallback, useId, useImperativeHandle, useMemo, useRef, useState } from 'react';
13
13
  import { CLASSES, IS_CREATED } from './vars';
14
14
  import { BaseInput } from '../base-input';
15
15
  import { Checkbox } from '../checkbox';
16
+ import { CircularProgress } from '../circular-progress';
16
17
  import { Dropdown } from '../dropdown';
17
18
  import { Empty } from '../empty';
18
- import { useComponentProps, useContainerScrolling, useControlled, useDesign, useFocusVisible, useJSS, useLayout, useMaxIndex, useNamespace, useScopedProps, useStyled, useTranslation, } from '../hooks';
19
+ import { useComponentProps, useContainerScrolling, useControlled, useDesign, useFocusVisible, useLayout, useMaxIndex, useNamespace, useScopedProps, useStyled, useTranslation, } from '../hooks';
19
20
  import { Icon } from '../icon';
20
- import { CircularProgress } from '../internal/circular-progress';
21
21
  import { Portal } from '../internal/portal';
22
- import { Transition } from '../internal/transition';
23
22
  import { ROOT_DATA } from '../root/vars';
24
23
  import { Tag } from '../tag';
24
+ import { Transition } from '../transition';
25
25
  import { getVerticalSidePosition, isPrintableCharacter, mergeCS } from '../utils';
26
26
  import { TTANSITION_DURING_POPUP, WINDOW_SPACE } from '../vars';
27
27
  import { VirtualScroll } from '../virtual-scroll';
28
- function SelectFC(props, ref) {
29
- const _a = useComponentProps('Select', props), { styleOverrides, styleProvider, formControl, list: listProp, model, defaultModel, visible: visibleProp, defaultVisible, placeholder, multiple = false, searchable = false, searchValue: searchValueProp, defaultSearchValue, clearable: clearableProp = false, loading = false, size: sizeProp, disabled: disabledProp = false, monospaced = true, virtual = false, escClosable = true, customItem, customSelected, customSearch, createItem, inputRef: inputRefProp, inputRender, popupRender, onModelChange, onVisibleChange, onSearch, onClear, onCreateItem, onScrollBottom, afterVisibleChange } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "formControl", "list", "model", "defaultModel", "visible", "defaultVisible", "placeholder", "multiple", "searchable", "searchValue", "defaultSearchValue", "clearable", "loading", "size", "disabled", "monospaced", "virtual", "escClosable", "customItem", "customSelected", "customSearch", "createItem", "inputRef", "inputRender", "popupRender", "onModelChange", "onVisibleChange", "onSearch", "onClear", "onCreateItem", "onScrollBottom", "afterVisibleChange"]);
28
+ export function Select(props) {
29
+ const _a = useComponentProps('Select', props), { ref, styleOverrides, styleProvider, formControl, list: listProp, model, defaultModel, visible: visibleProp, defaultVisible, placeholder, multiple = false, searchable = false, searchValue: searchValueProp, defaultSearchValue, clearable: clearableProp = false, loading = false, size: sizeProp, disabled: disabledProp = false, monospaced = true, virtual = false, escClosable = true, customItem, customSelected, customSearch, createItem, inputProps, popupRender, onModelChange, onVisibleChange, onSearch, onClear, onCreateItem, onScrollBottom, afterVisibleChange } = _a, restProps = __rest(_a, ["ref", "styleOverrides", "styleProvider", "formControl", "list", "model", "defaultModel", "visible", "defaultVisible", "placeholder", "multiple", "searchable", "searchValue", "defaultSearchValue", "clearable", "loading", "size", "disabled", "monospaced", "virtual", "escClosable", "customItem", "customSelected", "customSearch", "createItem", "inputProps", "popupRender", "onModelChange", "onVisibleChange", "onSearch", "onClear", "onCreateItem", "onScrollBottom", "afterVisibleChange"]);
30
30
  const namespace = useNamespace();
31
31
  const styled = useStyled(CLASSES, { select: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.select, 'select-popup': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['select-popup'] }, styleOverrides);
32
- const sheet = useJSS();
33
32
  const { t } = useTranslation();
34
33
  const uniqueId = useId();
35
34
  const listId = `${namespace}-select-list-${uniqueId}`;
@@ -39,7 +38,6 @@ function SelectFC(props, ref) {
39
38
  const popupRef = useRef(null);
40
39
  const listRef = useRef(null);
41
40
  const inputRef = useRef(null);
42
- const combineInputRef = useForkRef(inputRef, inputRefProp);
43
41
  const vsRef = useRef(null);
44
42
  const itemsMap = useMemo(() => {
45
43
  const items = new Map();
@@ -133,7 +131,7 @@ function SelectFC(props, ref) {
133
131
  return searchList;
134
132
  })();
135
133
  const list = hasSearch ? searchList : listProp;
136
- const [focusVisible, focusVisibleWrapper] = useFocusVisible((code) => code.startsWith('Arrow') || ['Home', 'End', 'Enter', 'Space'].includes(code));
134
+ const [focusVisible, focusVisibleProps] = useFocusVisible((code) => code.startsWith('Arrow') || ['Home', 'End', 'Enter', 'Space'].includes(code));
137
135
  const [_itemFocusedWithoutSearch, setItemFocusedWithoutSearch] = useState();
138
136
  const itemFocusedWithoutSearch = (() => {
139
137
  let itemFocused;
@@ -173,7 +171,6 @@ function SelectFC(props, ref) {
173
171
  };
174
172
  const maxZIndex = useMaxIndex(visible);
175
173
  const zIndex = `calc(var(--${namespace}-zindex-fixed) + ${maxZIndex})`;
176
- const transformOrigin = useRef();
177
174
  const updatePosition = useEventCallback(() => {
178
175
  if (visible && boxRef.current && popupRef.current) {
179
176
  if (monospaced) {
@@ -183,16 +180,12 @@ function SelectFC(props, ref) {
183
180
  placement: 'bottom',
184
181
  inWindow: WINDOW_SPACE,
185
182
  });
186
- transformOrigin.current = position.transformOrigin;
187
- if (sheet.classes.position) {
188
- popupRef.current.classList.toggle(sheet.classes.position, false);
189
- }
190
- sheet.replaceRule('position', {
191
- top: position.top,
192
- left: position.left,
193
- width,
194
- });
195
- popupRef.current.classList.toggle(sheet.classes.position, true);
183
+ popupRef.current.style.setProperty(`--popup-down-transform-origin`, position.transformOrigin);
184
+ popupRef.current.style.top = position.top + 'px';
185
+ popupRef.current.style.left = position.left + 'px';
186
+ popupRef.current.style.width = width + 'px';
187
+ popupRef.current.style.minWidth = '';
188
+ popupRef.current.style.maxWidth = '';
196
189
  }
197
190
  else {
198
191
  const boxWidth = boxRef.current.offsetWidth;
@@ -203,17 +196,12 @@ function SelectFC(props, ref) {
203
196
  placement: 'bottom-left',
204
197
  inWindow: WINDOW_SPACE,
205
198
  });
206
- transformOrigin.current = position.transformOrigin;
207
- if (sheet.classes.position) {
208
- popupRef.current.classList.toggle(sheet.classes.position, false);
209
- }
210
- sheet.replaceRule('position', {
211
- top: position.top,
212
- left: position.left,
213
- minWidth: Math.min(boxWidth, maxWidth),
214
- maxWidth,
215
- });
216
- popupRef.current.classList.toggle(sheet.classes.position, true);
199
+ popupRef.current.style.setProperty(`--popup-down-transform-origin`, position.transformOrigin);
200
+ popupRef.current.style.top = position.top + 'px';
201
+ popupRef.current.style.left = position.left + 'px';
202
+ popupRef.current.style.width = '';
203
+ popupRef.current.style.minWidth = Math.min(boxWidth, maxWidth) + 'px';
204
+ popupRef.current.style.maxWidth = maxWidth + 'px';
217
205
  }
218
206
  }
219
207
  });
@@ -229,140 +217,9 @@ function SelectFC(props, ref) {
229
217
  e.preventDefault();
230
218
  }
231
219
  };
232
- const scrollCallback = useRef();
220
+ const scrollCallback = useRef(() => { });
233
221
  const inputable = searchable && visible;
234
222
  const clearable = clearableProp && hasSelected && !visible && !loading && !disabled;
235
- const inputNode = focusVisibleWrapper(createElement(searchable ? BaseInput : 'div', Object.assign(Object.assign(Object.assign(Object.assign({}, mergeCS(styled('select__search'), {
236
- style: {
237
- opacity: inputable ? undefined : 0,
238
- zIndex: inputable ? undefined : -1,
239
- },
240
- })), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria), { ref: combineInputRef, tabIndex: disabled ? -1 : 0, role: 'combobox', 'aria-haspopup': 'listbox', 'aria-expanded': visible, 'aria-controls': listId, onBlur: () => {
241
- changeVisible(false);
242
- }, onKeyDown: (e) => {
243
- if (e.code === 'Escape') {
244
- if (visible && escClosable) {
245
- e.stopPropagation();
246
- e.preventDefault();
247
- changeVisible(false);
248
- }
249
- }
250
- else {
251
- const focusItem = (code) => {
252
- var _a, _b, _c, _d;
253
- if (listRef.current) {
254
- let item;
255
- switch (code) {
256
- case 'next':
257
- item = (_a = vsRef.current) === null || _a === void 0 ? void 0 : _a.scrollToStep(listRef.current, 1);
258
- break;
259
- case 'prev':
260
- item = (_b = vsRef.current) === null || _b === void 0 ? void 0 : _b.scrollToStep(listRef.current, -1);
261
- break;
262
- case 'first':
263
- item = (_c = vsRef.current) === null || _c === void 0 ? void 0 : _c.scrollToStart(listRef.current);
264
- break;
265
- case 'last':
266
- item = (_d = vsRef.current) === null || _d === void 0 ? void 0 : _d.scrollToEnd(listRef.current);
267
- break;
268
- default:
269
- break;
270
- }
271
- if (item) {
272
- changeItemFocused(item);
273
- if (virtual === false) {
274
- scrollCallback.current = () => {
275
- const el = document.getElementById(getItemId(item.value));
276
- if (el) {
277
- scrollIntoViewIfNeeded(el, listRef.current);
278
- }
279
- };
280
- if (visible) {
281
- scrollCallback.current();
282
- scrollCallback.current = undefined;
283
- }
284
- }
285
- }
286
- }
287
- };
288
- if (visible) {
289
- switch (e.code) {
290
- case 'ArrowUp': {
291
- e.preventDefault();
292
- focusItem('prev');
293
- break;
294
- }
295
- case 'ArrowDown': {
296
- e.preventDefault();
297
- focusItem('next');
298
- break;
299
- }
300
- case 'Home': {
301
- e.preventDefault();
302
- focusItem('first');
303
- break;
304
- }
305
- case 'End': {
306
- e.preventDefault();
307
- focusItem('last');
308
- break;
309
- }
310
- default: {
311
- if (e.code === 'Enter' || (e.code === 'Space' && !searchable)) {
312
- e.preventDefault();
313
- if (itemFocused) {
314
- if (itemFocused[IS_CREATED]) {
315
- handleCreateItem(itemFocused);
316
- }
317
- changeSelectedByClick(itemFocused.value);
318
- }
319
- }
320
- break;
321
- }
322
- }
323
- }
324
- else if (!(searchable && ['Home', 'End', 'Enter', 'Space'].includes(e.code))) {
325
- switch (e.code) {
326
- case 'End':
327
- case 'ArrowUp': {
328
- e.preventDefault();
329
- changeVisible(true);
330
- focusItem('last');
331
- break;
332
- }
333
- case 'Home':
334
- case 'ArrowDown': {
335
- e.preventDefault();
336
- changeVisible(true);
337
- focusItem('first');
338
- break;
339
- }
340
- case 'Enter':
341
- case 'Space': {
342
- e.preventDefault();
343
- changeVisible(true);
344
- break;
345
- }
346
- default: {
347
- if (isPrintableCharacter(e.key)) {
348
- changeVisible(true);
349
- }
350
- break;
351
- }
352
- }
353
- }
354
- }
355
- } }), searchable
356
- ? {
357
- type: 'text',
358
- value: searchValue,
359
- autoComplete: 'off',
360
- disabled,
361
- onValueChange: (val) => {
362
- changeSearchValue(val);
363
- },
364
- }
365
- : {})));
366
223
  const [selectedNode, suffixNode, selectedLabel] = (() => {
367
224
  let selectedNode = null;
368
225
  let suffixNode = null;
@@ -384,7 +241,7 @@ function SelectFC(props, ref) {
384
241
  })), onClick: (id) => {
385
242
  changeSelectedByClick(id);
386
243
  return false;
387
- }, children: _jsx(Tag, { tabIndex: -1, size: size, children: selected.size }) }));
244
+ }, children: (dropdownProps) => (_jsx(Tag, Object.assign({}, dropdownProps, { tabIndex: -1, size: size, children: selected.size }))) }));
388
245
  selectedNode = selectedItems.map(({ value, label, item }) => (_jsxs(Tag, { size: size, children: [label, !((item === null || item === void 0 ? void 0 : item.disabled) || disabled) && (_jsx("div", Object.assign({}, styled('select__close'), { role: "button", "aria-label": t('Close'), onClick: (e) => {
389
246
  e.stopPropagation();
390
247
  changeSelectedByClick(value);
@@ -413,7 +270,12 @@ function SelectFC(props, ref) {
413
270
  }), {
414
271
  className: restProps.className,
415
272
  style: restProps.style,
416
- }), designProps, { ref: boxRef, onMouseDown: (e) => {
273
+ }), designProps, { ref: (instance) => {
274
+ boxRef.current = instance;
275
+ return () => {
276
+ boxRef.current = null;
277
+ };
278
+ }, onMouseDown: (e) => {
417
279
  var _a;
418
280
  (_a = restProps.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
419
281
  preventBlur(e);
@@ -426,7 +288,157 @@ function SelectFC(props, ref) {
426
288
  (_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
427
289
  (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus({ preventScroll: true });
428
290
  changeVisible((draft) => (searchable ? true : !draft));
429
- }, children: [_jsxs("div", Object.assign({}, styled('select__container'), { title: selectedLabel, children: [inputRender ? inputRender(inputNode) : inputNode, !inputable &&
291
+ }, children: [_jsxs("div", Object.assign({}, styled('select__container'), { title: selectedLabel, children: [(() => {
292
+ const nodeProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inputProps), mergeCS(styled('select__search'), {
293
+ style: {
294
+ opacity: inputable ? undefined : 0,
295
+ zIndex: inputable ? undefined : -1,
296
+ },
297
+ })), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria), { ref: (instance) => {
298
+ inputRef.current = instance;
299
+ const ret = setRef(inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, instance);
300
+ return () => {
301
+ inputRef.current = null;
302
+ ret();
303
+ };
304
+ }, tabIndex: disabled ? -1 : 0, role: 'combobox', 'aria-haspopup': 'listbox', 'aria-expanded': visible, 'aria-controls': listId, onFocus: (e) => {
305
+ var _a;
306
+ (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
307
+ focusVisibleProps.onFocus(e);
308
+ }, onBlur: (e) => {
309
+ var _a;
310
+ (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
311
+ focusVisibleProps.onBlur(e);
312
+ changeVisible(false);
313
+ }, onKeyDown: (e) => {
314
+ var _a;
315
+ (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
316
+ focusVisibleProps.onKeyDown(e);
317
+ if (e.code === 'Escape') {
318
+ if (visible && escClosable) {
319
+ e.stopPropagation();
320
+ e.preventDefault();
321
+ changeVisible(false);
322
+ }
323
+ }
324
+ else {
325
+ const focusItem = (code) => {
326
+ var _a, _b, _c, _d;
327
+ if (listRef.current) {
328
+ let item;
329
+ switch (code) {
330
+ case 'next':
331
+ item = (_a = vsRef.current) === null || _a === void 0 ? void 0 : _a.scrollToStep(listRef.current, 1);
332
+ break;
333
+ case 'prev':
334
+ item = (_b = vsRef.current) === null || _b === void 0 ? void 0 : _b.scrollToStep(listRef.current, -1);
335
+ break;
336
+ case 'first':
337
+ item = (_c = vsRef.current) === null || _c === void 0 ? void 0 : _c.scrollToStart(listRef.current);
338
+ break;
339
+ case 'last':
340
+ item = (_d = vsRef.current) === null || _d === void 0 ? void 0 : _d.scrollToEnd(listRef.current);
341
+ break;
342
+ default:
343
+ break;
344
+ }
345
+ if (item) {
346
+ changeItemFocused(item);
347
+ if (virtual === false) {
348
+ scrollCallback.current = () => {
349
+ scrollCallback.current = () => { };
350
+ const el = document.getElementById(getItemId(item.value));
351
+ if (el) {
352
+ scrollIntoViewIfNeeded(el, listRef.current);
353
+ }
354
+ };
355
+ if (visible) {
356
+ scrollCallback.current();
357
+ }
358
+ }
359
+ }
360
+ }
361
+ };
362
+ if (visible) {
363
+ switch (e.code) {
364
+ case 'ArrowUp': {
365
+ e.preventDefault();
366
+ focusItem('prev');
367
+ break;
368
+ }
369
+ case 'ArrowDown': {
370
+ e.preventDefault();
371
+ focusItem('next');
372
+ break;
373
+ }
374
+ case 'Home': {
375
+ e.preventDefault();
376
+ focusItem('first');
377
+ break;
378
+ }
379
+ case 'End': {
380
+ e.preventDefault();
381
+ focusItem('last');
382
+ break;
383
+ }
384
+ default: {
385
+ if (e.code === 'Enter' || (e.code === 'Space' && !searchable)) {
386
+ e.preventDefault();
387
+ if (itemFocused) {
388
+ if (itemFocused[IS_CREATED]) {
389
+ handleCreateItem(itemFocused);
390
+ }
391
+ changeSelectedByClick(itemFocused.value);
392
+ }
393
+ }
394
+ break;
395
+ }
396
+ }
397
+ }
398
+ else if (!(searchable && ['Home', 'End', 'Enter', 'Space'].includes(e.code))) {
399
+ switch (e.code) {
400
+ case 'End':
401
+ case 'ArrowUp': {
402
+ e.preventDefault();
403
+ changeVisible(true);
404
+ focusItem('last');
405
+ break;
406
+ }
407
+ case 'Home':
408
+ case 'ArrowDown': {
409
+ e.preventDefault();
410
+ changeVisible(true);
411
+ focusItem('first');
412
+ break;
413
+ }
414
+ case 'Enter':
415
+ case 'Space': {
416
+ e.preventDefault();
417
+ changeVisible(true);
418
+ break;
419
+ }
420
+ default: {
421
+ if (isPrintableCharacter(e.key)) {
422
+ changeVisible(true);
423
+ }
424
+ break;
425
+ }
426
+ }
427
+ }
428
+ }
429
+ } }), searchable
430
+ ? {
431
+ type: 'text',
432
+ value: searchValue,
433
+ autoComplete: 'off',
434
+ disabled,
435
+ onValueChange: (val) => {
436
+ changeSearchValue(val);
437
+ },
438
+ }
439
+ : {});
440
+ return searchable ? _jsx(BaseInput, Object.assign({}, nodeProps)) : _jsx("div", Object.assign({}, nodeProps));
441
+ })(), !inputable &&
430
442
  (hasSelected ? (_jsx("div", Object.assign({}, styled('select__content'), { children: selectedNode }))) : placeholder ? (_jsx("div", Object.assign({}, styled('select__placeholder-wrapper'), { children: _jsx("div", Object.assign({}, styled('select__placeholder'), { children: placeholder })) }))) : null)] })), multiple && (_jsx("div", Object.assign({}, styled('select__multiple-count'), { onClick: (e) => {
431
443
  e.stopPropagation();
432
444
  }, children: suffixNode }))), clearable && (_jsx("div", Object.assign({}, styled('select__clear'), { role: "button", "aria-label": t('Clear'), onClick: (e) => {
@@ -448,82 +460,72 @@ function SelectFC(props, ref) {
448
460
  document.body.appendChild(el);
449
461
  }
450
462
  return el;
451
- }, children: _jsx(Transition, { enter: visible, during: TTANSITION_DURING_POPUP, afterRender: () => {
452
- var _a;
463
+ }, children: _jsx(Transition, { enter: visible, name: `${namespace}-popup-down`, duration: TTANSITION_DURING_POPUP, onSkipEnter: () => {
453
464
  updatePosition();
454
- (_a = scrollCallback.current) === null || _a === void 0 ? void 0 : _a.call(scrollCallback);
455
- scrollCallback.current = undefined;
456
- }, afterEnter: () => {
465
+ scrollCallback.current();
466
+ }, onBeforeEnter: () => {
467
+ updatePosition();
468
+ scrollCallback.current();
469
+ }, onAfterEnter: () => {
457
470
  afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
458
- }, afterLeave: () => {
471
+ }, onAfterLeave: () => {
459
472
  afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
460
- }, children: (state) => {
461
- let transitionStyle = {};
462
- switch (state) {
463
- case 'enter':
464
- transitionStyle = { transform: 'scaleY(0.7)', opacity: 0 };
465
- break;
466
- case 'entering':
467
- transitionStyle = {
468
- transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_POPUP}ms ease-out`).join(', '),
469
- transformOrigin: transformOrigin.current,
470
- };
471
- break;
472
- case 'leaving':
473
- transitionStyle = {
474
- transform: 'scaleY(0.7)',
475
- opacity: 0,
476
- transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_POPUP}ms ease-in`).join(', '),
477
- transformOrigin: transformOrigin.current,
478
- };
479
- break;
480
- case 'leaved':
481
- transitionStyle = { display: 'none' };
482
- break;
483
- default:
484
- break;
485
- }
486
- return (_jsx("div", Object.assign({}, mergeCS(styled('select-popup'), {
487
- style: Object.assign({ zIndex }, transitionStyle),
488
- }), { ref: popupRef, onMouseDown: (e) => {
489
- preventBlur(e);
490
- }, onMouseUp: (e) => {
491
- preventBlur(e);
492
- }, children: (() => {
493
- const el = (_jsxs("div", Object.assign({}, styled('select-popup__content'), { children: [loading && (_jsx("div", Object.assign({}, styled('select-popup__loading', {
494
- 'select-popup__loading--empty': list.length === 0,
495
- }), { children: _jsx(Icon, { children: _jsx(CircularProgress, {}) }) }))), loading && list.length === 0 ? null : (_jsx(VirtualScroll, Object.assign({}, vsProps, { ref: vsRef, enable: virtual !== false, listSize: 264, listPadding: 4, itemRender: (item, index, props, ancestry, children) => {
496
- const { label: itemLabel, value: itemValue, disabled: itemDisabled } = item;
497
- const node = customItem ? customItem(item) : itemLabel;
498
- if (children) {
499
- return (_createElement("ul", Object.assign({}, styled('select__option-group'), { key: itemValue, role: "group", "aria-labelledby": getItemId(itemValue) }),
500
- _createElement("li", Object.assign({}, styled('select__option-group-label'), { key: itemValue, id: getItemId(itemValue), role: "presentation" }),
501
- _jsx("div", Object.assign({}, styled('select__option-content'), { children: node }))),
502
- children));
503
- }
504
- let isSelected = false;
505
- if (multiple) {
506
- isSelected = selected.has(itemValue);
507
- }
508
- else {
509
- isSelected = selected === itemValue;
510
- }
511
- return (_createElement("li", Object.assign({}, mergeCS(styled('select__option', {
512
- 'select__option.is-selected': !multiple && isSelected,
513
- 'select__option.is-disabled': itemDisabled,
514
- }), { style: { paddingLeft: ancestry.length === 0 ? undefined : 12 + 8 } }), props, { key: itemValue, id: getItemId(itemValue), title: (item[IS_CREATED] ? t('Create') + ' ' : '') + itemLabel, role: "option", "aria-selected": isSelected, "aria-disabled": itemDisabled, onClick: () => {
515
- if (item[IS_CREATED]) {
516
- handleCreateItem(item);
517
- }
518
- changeItemFocused(item);
519
- changeSelectedByClick(itemValue);
520
- } }),
521
- focusVisible && (itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.value) === itemValue && _jsx("div", { className: `${namespace}-focus-outline` }),
522
- item[IS_CREATED] ? (_jsx("div", Object.assign({}, styled('select__option-prefix'), { children: _jsx(Icon, { theme: "primary", children: _jsx(AddOutlined, {}) }) }))) : multiple ? (_jsx("div", Object.assign({}, styled('select__option-prefix'), { children: _jsx(Checkbox, { model: isSelected, disabled: itemDisabled }) }))) : null,
523
- _jsx("div", Object.assign({}, styled('select__option-content'), { children: node }))));
524
- }, itemFocused: itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.value, itemEmptyRender: () => (_jsx("li", Object.assign({}, mergeCS(styled('select__empty'), { style: { paddingLeft: 12 + 8 } }), { children: _jsx("div", Object.assign({}, styled('select__option-content'), { children: t('No data') })) }))), itemInAriaSetsize: (item) => !item.children, placeholder: "li", onScrollEnd: onScrollBottom, children: (vsList, onScroll) => (_jsx("ul", Object.assign({}, styled('select__list'), { ref: listRef, id: listId, tabIndex: -1, role: "listbox", "aria-multiselectable": multiple, "aria-activedescendant": isUndefined(itemFocused) ? undefined : getItemId(itemFocused.value), onScroll: onScroll, children: list.length === 0 ? _jsx(Empty, { style: { padding: '12px 0' }, image: Empty.SIMPLE_IMG }) : vsList }))) })))] })));
525
- return popupRender ? popupRender(el) : el;
526
- })() })));
527
- } }) })] }));
473
+ }, children: (transitionRef, leaved) => (_jsx("div", Object.assign({}, mergeCS(styled('select-popup'), {
474
+ style: Object.assign({ zIndex }, (leaved ? { display: 'none' } : undefined)),
475
+ }), { ref: (instance) => {
476
+ popupRef.current = instance;
477
+ transitionRef(instance);
478
+ return () => {
479
+ popupRef.current = null;
480
+ transitionRef(null);
481
+ };
482
+ }, onMouseDown: (e) => {
483
+ preventBlur(e);
484
+ }, onMouseUp: (e) => {
485
+ preventBlur(e);
486
+ }, children: (() => {
487
+ const el = (_jsxs("div", Object.assign({}, styled('select-popup__content'), { children: [loading && (_jsx("div", Object.assign({}, styled('select-popup__loading', {
488
+ 'select-popup__loading--empty': list.length === 0,
489
+ }), { children: _jsx(Icon, { children: _jsx(CircularProgress, {}) }) }))), loading && list.length === 0 ? null : (_jsx(VirtualScroll, Object.assign({}, vsProps, { ref: (instance) => {
490
+ vsRef.current = instance;
491
+ return () => {
492
+ vsRef.current = null;
493
+ };
494
+ }, enable: virtual !== false, listSize: 264, listPadding: 4, itemRender: (item, index, props, ancestry, children) => {
495
+ const { label: itemLabel, value: itemValue, disabled: itemDisabled } = item;
496
+ const node = customItem ? customItem(item) : itemLabel;
497
+ if (children) {
498
+ return (_createElement("ul", Object.assign({}, styled('select__option-group'), { key: itemValue, role: "group", "aria-labelledby": getItemId(itemValue) }),
499
+ _createElement("li", Object.assign({}, styled('select__option-group-label'), { key: itemValue, id: getItemId(itemValue), role: "presentation" }),
500
+ _jsx("div", Object.assign({}, styled('select__option-content'), { children: node }))),
501
+ children));
502
+ }
503
+ let isSelected = false;
504
+ if (multiple) {
505
+ isSelected = selected.has(itemValue);
506
+ }
507
+ else {
508
+ isSelected = selected === itemValue;
509
+ }
510
+ return (_createElement("li", Object.assign({}, mergeCS(styled('select__option', {
511
+ 'select__option.is-selected': !multiple && isSelected,
512
+ 'select__option.is-disabled': itemDisabled,
513
+ }), { style: { paddingLeft: ancestry.length === 0 ? undefined : 12 + 8 } }), props, { key: itemValue, id: getItemId(itemValue), title: (item[IS_CREATED] ? t('Create') + ' ' : '') + itemLabel, role: "option", "aria-selected": isSelected, "aria-disabled": itemDisabled, onClick: () => {
514
+ if (item[IS_CREATED]) {
515
+ handleCreateItem(item);
516
+ }
517
+ changeItemFocused(item);
518
+ changeSelectedByClick(itemValue);
519
+ } }),
520
+ focusVisible && (itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.value) === itemValue && _jsx("div", { className: `${namespace}-focus-outline` }),
521
+ item[IS_CREATED] ? (_jsx("div", Object.assign({}, styled('select__option-prefix'), { children: _jsx(Icon, { theme: "primary", children: _jsx(AddOutlined, {}) }) }))) : multiple ? (_jsx("div", Object.assign({}, styled('select__option-prefix'), { children: _jsx(Checkbox, { model: isSelected, disabled: itemDisabled }) }))) : null,
522
+ _jsx("div", Object.assign({}, styled('select__option-content'), { children: node }))));
523
+ }, itemFocused: itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.value, itemEmptyRender: () => (_jsx("li", Object.assign({}, mergeCS(styled('select__empty'), { style: { paddingLeft: 12 + 8 } }), { children: _jsx("div", Object.assign({}, styled('select__option-content'), { children: t('No data') })) }))), itemInAriaSetsize: (item) => !item.children, placeholder: "li", onScrollEnd: onScrollBottom, children: (vsList, onScroll) => (_jsx("ul", Object.assign({}, styled('select__list'), { ref: (instance) => {
524
+ listRef.current = instance;
525
+ return () => {
526
+ listRef.current = null;
527
+ };
528
+ }, id: listId, tabIndex: -1, role: "listbox", "aria-multiselectable": multiple, "aria-activedescendant": isUndefined(itemFocused) ? undefined : getItemId(itemFocused.value), onScroll: onScroll, children: list.length === 0 ? _jsx(Empty, { style: { padding: '12px 0' }, image: Empty.SIMPLE_IMG }) : vsList }))) })))] })));
529
+ return popupRender ? popupRender(el) : el;
530
+ })() }))) }) })] }));
528
531
  }
529
- export const Select = forwardRef(SelectFC);
package/select/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { CLASSES } from './vars';
3
3
  import type { FormControlProvider } from '../form/types';
4
- import type { BaseProps, CloneHTMLElement, Size } from '../types';
4
+ import type { BaseProps, Size } from '../types';
5
5
  export {};
6
6
  export interface SelectRef {
7
7
  updatePosition: () => void;
@@ -13,6 +13,7 @@ export interface SelectItem<V extends React.Key> {
13
13
  children?: SelectItem<V>[];
14
14
  }
15
15
  export interface SelectProps<V extends React.Key, T extends SelectItem<V>> extends BaseProps<'select' | 'select-popup', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
16
+ ref?: React.Ref<SelectRef>;
16
17
  formControl?: FormControlProvider;
17
18
  list: T[];
18
19
  model?: V | null | V[];
@@ -38,8 +39,7 @@ export interface SelectProps<V extends React.Key, T extends SelectItem<V>> exten
38
39
  sort?: (a: T, b: T) => number;
39
40
  };
40
41
  createItem?: (value: string) => T | undefined;
41
- inputRef?: React.ForwardedRef<HTMLInputElement>;
42
- inputRender?: CloneHTMLElement;
42
+ inputProps?: React.ComponentPropsWithRef<'input'>;
43
43
  popupRender?: (el: React.ReactElement) => React.ReactNode;
44
44
  onModelChange?: (value: any, origin: any) => void;
45
45
  onVisibleChange?: (visible: boolean) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import type { SeparatorProps } from './types';
3
- export declare function Separator(props: SeparatorProps): JSX.Element | null;
3
+ export declare function Separator(props: SeparatorProps): React.ReactElement | null;