@salutejs/plasma-new-hope 0.336.0-canary.2214.17542835950.0 → 0.336.0-canary.2214.17668000726.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/Combobox/ComboboxNew/Combobox.css +6 -6
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +30 -24
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +3 -4
- package/cjs/components/Combobox/ComboboxNew/Combobox.styles.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/{Combobox.styles_isfa46.css → Combobox.styles_261unw.css} +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +3 -7
- package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.css +6 -6
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.js +11 -5
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.js.map +1 -1
- package/cjs/components/Combobox/ComboboxOld/Combobox.css +2 -2
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +2 -2
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +2 -2
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +2 -2
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +2 -2
- package/cjs/components/Drawer/hooks/useDrawer.js +12 -0
- package/cjs/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.css +2 -2
- package/cjs/components/Dropdown/Dropdown.js +6 -10
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.styles.js +2 -9
- package/cjs/components/Dropdown/Dropdown.styles.js.map +1 -1
- package/{es/components/Dropdown/Dropdown.styles_zheit5.css → cjs/components/Dropdown/Dropdown.styles_kkvnr1.css} +1 -1
- package/cjs/components/Dropdown/FloatingPopover.js +22 -40
- package/cjs/components/Dropdown/FloatingPopover.js.map +1 -1
- package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +3 -7
- package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.css +2 -2
- package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +9 -9
- package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- package/cjs/components/Pagination/Pagination.css +2 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
- package/cjs/components/Select/Select.css +2 -2
- package/cjs/components/Select/Select.js +12 -4
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.styles.js +3 -4
- package/cjs/components/Select/Select.styles.js.map +1 -1
- package/cjs/components/Select/{Select.styles_bjoo18.css → Select.styles_dta4dl.css} +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js +3 -7
- package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Select/ui/Inner/Inner.css +2 -2
- package/cjs/components/Select/ui/Inner/Inner.js +11 -5
- package/cjs/components/Select/ui/Inner/Inner.js.map +1 -1
- package/cjs/components/Table/Table.css +2 -2
- package/cjs/components/Table/ui/Cell/Cell.css +2 -2
- package/cjs/components/Table/ui/EditableCell/EditableCell.css +2 -2
- package/cjs/components/Table/ui/HeadCell/HeadCell.css +2 -2
- package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.css +2 -2
- package/cjs/components/Tree/Tree.css +7 -7
- package/cjs/components/Tree/Tree.styles.js +2 -2
- package/cjs/components/Tree/Tree.styles.js.map +1 -1
- package/{es/components/Tree/Tree.styles_104kkxh.css → cjs/components/Tree/Tree.styles_17sq2sw.css} +1 -1
- package/cjs/engines/common.js +11 -1
- package/cjs/engines/common.js.map +1 -1
- package/cjs/index.css +17 -17
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +26 -23
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +16 -16
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +3 -7
- package/emotion/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.js +50 -9
- package/emotion/cjs/components/Drawer/hooks/useDrawer.js +11 -0
- package/emotion/cjs/components/Dropdown/Dropdown.js +6 -10
- package/emotion/cjs/components/Dropdown/Dropdown.styles.js +5 -8
- package/emotion/cjs/components/Dropdown/FloatingPopover.js +23 -47
- package/emotion/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +3 -7
- package/emotion/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +48 -11
- package/emotion/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +1 -1
- package/emotion/cjs/components/Select/Select.js +10 -3
- package/emotion/cjs/components/Select/Select.styles.js +8 -8
- package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +3 -7
- package/emotion/cjs/components/Select/ui/Inner/Inner.js +50 -9
- package/emotion/cjs/components/Tree/Tree.styles.js +15 -15
- package/emotion/cjs/engines/common.js +14 -1
- package/emotion/cjs/examples/components/Combobox/Combobox.js +15 -0
- package/emotion/cjs/examples/components/Tree/Tree.config.js +5 -5
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +26 -23
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.styles.js +16 -16
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.tokens.js +1 -1
- package/emotion/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +3 -7
- package/emotion/es/components/Combobox/ComboboxNew/ui/Inner/Inner.js +11 -6
- package/emotion/es/components/Drawer/hooks/useDrawer.js +11 -0
- package/emotion/es/components/Dropdown/Dropdown.js +6 -10
- package/emotion/es/components/Dropdown/Dropdown.styles.js +5 -8
- package/emotion/es/components/Dropdown/FloatingPopover.js +24 -48
- package/emotion/es/components/Dropdown/hooks/useKeyboardNavigation.js +3 -7
- package/emotion/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +9 -8
- package/emotion/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +1 -1
- package/emotion/es/components/Select/Select.js +10 -3
- package/emotion/es/components/Select/Select.styles.js +8 -8
- package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +3 -7
- package/emotion/es/components/Select/ui/Inner/Inner.js +11 -6
- package/emotion/es/components/Tree/Tree.styles.js +15 -15
- package/emotion/es/engines/common.js +14 -1
- package/emotion/es/examples/components/Combobox/Combobox.js +7 -0
- package/emotion/es/examples/components/Tree/Tree.config.js +5 -5
- package/es/components/Combobox/ComboboxNew/Combobox.css +6 -6
- package/es/components/Combobox/ComboboxNew/Combobox.js +30 -24
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.styles.js +3 -4
- package/es/components/Combobox/ComboboxNew/Combobox.styles.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/{Combobox.styles_isfa46.css → Combobox.styles_261unw.css} +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.tokens.js +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +3 -7
- package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.css +6 -6
- package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.js +12 -6
- package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.js.map +1 -1
- package/es/components/Combobox/ComboboxOld/Combobox.css +2 -2
- package/es/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +2 -2
- package/es/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +2 -2
- package/es/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +2 -2
- package/es/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +2 -2
- package/es/components/Drawer/hooks/useDrawer.js +12 -0
- package/es/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/es/components/Dropdown/Dropdown.css +2 -2
- package/es/components/Dropdown/Dropdown.js +6 -10
- package/es/components/Dropdown/Dropdown.js.map +1 -1
- package/es/components/Dropdown/Dropdown.styles.js +2 -9
- package/es/components/Dropdown/Dropdown.styles.js.map +1 -1
- package/{cjs/components/Dropdown/Dropdown.styles_zheit5.css → es/components/Dropdown/Dropdown.styles_kkvnr1.css} +1 -1
- package/es/components/Dropdown/FloatingPopover.js +24 -42
- package/es/components/Dropdown/FloatingPopover.js.map +1 -1
- package/es/components/Dropdown/hooks/useKeyboardNavigation.js +3 -7
- package/es/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownInner/DropdownInner.css +2 -2
- package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +10 -10
- package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +1 -1
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- package/es/components/Pagination/Pagination.css +2 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
- package/es/components/Select/Select.css +2 -2
- package/es/components/Select/Select.js +12 -4
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/Select.styles.js +3 -4
- package/es/components/Select/Select.styles.js.map +1 -1
- package/es/components/Select/{Select.styles_bjoo18.css → Select.styles_dta4dl.css} +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js +3 -7
- package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Select/ui/Inner/Inner.css +2 -2
- package/es/components/Select/ui/Inner/Inner.js +12 -6
- package/es/components/Select/ui/Inner/Inner.js.map +1 -1
- package/es/components/Table/Table.css +2 -2
- package/es/components/Table/ui/Cell/Cell.css +2 -2
- package/es/components/Table/ui/EditableCell/EditableCell.css +2 -2
- package/es/components/Table/ui/HeadCell/HeadCell.css +2 -2
- package/es/components/Table/ui/HeadCell/ui/Filter/Filter.css +2 -2
- package/es/components/Tree/Tree.css +7 -7
- package/es/components/Tree/Tree.styles.js +2 -2
- package/es/components/Tree/Tree.styles.js.map +1 -1
- package/{cjs/components/Tree/Tree.styles_104kkxh.css → es/components/Tree/Tree.styles_17sq2sw.css} +1 -1
- package/es/engines/common.js +12 -2
- package/es/engines/common.js.map +1 -1
- package/es/index.css +17 -17
- package/package.json +5 -5
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +26 -23
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +9 -9
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +1 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +3 -7
- package/styled-components/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.js +50 -9
- package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +11 -0
- package/styled-components/cjs/components/Dropdown/Dropdown.js +6 -10
- package/styled-components/cjs/components/Dropdown/Dropdown.styles.js +3 -7
- package/styled-components/cjs/components/Dropdown/FloatingPopover.js +23 -47
- package/styled-components/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +3 -7
- package/styled-components/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +48 -11
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +1 -1
- package/styled-components/cjs/components/Select/Select.js +10 -3
- package/styled-components/cjs/components/Select/Select.styles.js +5 -5
- package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +3 -7
- package/styled-components/cjs/components/Select/ui/Inner/Inner.js +50 -9
- package/styled-components/cjs/components/Tree/Tree.styles.js +8 -8
- package/styled-components/cjs/engines/common.js +14 -1
- package/styled-components/cjs/examples/components/Tree/Tree.config.js +3 -1
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +26 -23
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.styles.js +9 -9
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.tokens.js +1 -1
- package/styled-components/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +3 -7
- package/styled-components/es/components/Combobox/ComboboxNew/ui/Inner/Inner.js +11 -6
- package/styled-components/es/components/Drawer/hooks/useDrawer.js +11 -0
- package/styled-components/es/components/Dropdown/Dropdown.js +6 -10
- package/styled-components/es/components/Dropdown/Dropdown.styles.js +3 -7
- package/styled-components/es/components/Dropdown/FloatingPopover.js +24 -48
- package/styled-components/es/components/Dropdown/hooks/useKeyboardNavigation.js +3 -7
- package/styled-components/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +9 -8
- package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +1 -1
- package/styled-components/es/components/Select/Select.js +10 -3
- package/styled-components/es/components/Select/Select.styles.js +5 -5
- package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +3 -7
- package/styled-components/es/components/Select/ui/Inner/Inner.js +11 -6
- package/styled-components/es/components/Tree/Tree.styles.js +8 -8
- package/styled-components/es/engines/common.js +14 -1
- package/styled-components/es/examples/components/Combobox/Combobox.js +7 -0
- package/styled-components/es/examples/components/Tree/Tree.config.js +3 -1
- package/types/components/Autocomplete/Autocomplete.types.d.ts +6 -6
- package/types/components/Autocomplete/Autocomplete.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.styles.d.ts +0 -1
- package/types/components/Combobox/ComboboxNew/Combobox.styles.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.tokens.d.ts +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +13 -6
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Inner/Inner.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Inner/Inner.type.d.ts +2 -1
- package/types/components/Combobox/ComboboxNew/ui/Inner/Inner.type.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.types.d.ts +6 -2
- package/types/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.types.d.ts.map +1 -1
- package/types/components/Drawer/hooks/useDrawer.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.d.ts +6 -6
- package/types/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.styles.d.ts +0 -1
- package/types/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.types.d.ts +9 -9
- package/types/components/Dropdown/Dropdown.types.d.ts.map +1 -1
- package/types/components/Dropdown/FloatingPopover.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownInner/DropdownInner.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownInner/DropdownInner.type.d.ts +2 -3
- package/types/components/Dropdown/ui/DropdownInner/DropdownInner.type.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownItem/DropdownItem.type.d.ts +7 -3
- package/types/components/Dropdown/ui/DropdownItem/DropdownItem.type.d.ts.map +1 -1
- package/types/components/NumberFormat/NumberFormat.d.ts.map +1 -1
- package/types/components/NumberFormat/NumberFormat.types.d.ts +1 -1
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +12 -6
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts.map +1 -1
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.styles.d.ts +0 -1
- package/types/components/Select/Select.styles.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +24 -10
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/Inner.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/Inner.type.d.ts +2 -1
- package/types/components/Select/ui/Inner/Inner.type.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/ui/Item/Item.types.d.ts +11 -3
- package/types/components/Select/ui/Inner/ui/Item/Item.types.d.ts.map +1 -1
- package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts +12 -6
- package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +2 -2
- package/types/engines/common.d.ts.map +1 -1
- package/types/examples/components/Autocomplete/Autocomplete.d.ts +40 -40
- package/types/examples/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/examples/components/Combobox/Combobox.d.ts +48 -24
- package/types/examples/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/components/Dropdown/Dropdown.d.ts +3 -3
- package/types/examples/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/types/examples/components/NumberFormat/NumberFormat.d.ts.map +1 -1
- package/types/examples/components/Select/Select.d.ts +12 -6
- package/types/examples/components/Select/Select.d.ts.map +1 -1
- package/types/examples/components/Tree/Tree.config.d.ts.map +1 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
-
import { useFloating, autoUpdate, autoPlacement, offset, flip, shift, FloatingPortal } from '@floating-ui/react';
|
1
|
+
import { extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import { useFloating, autoUpdate, autoPlacement, offset, flip, shift, useHover, safePolygon, useClick, useInteractions, FloatingPortal } from '@floating-ui/react';
|
3
3
|
import React, { forwardRef } from 'react';
|
4
4
|
import { safeUseId } from '../../utils/react.js';
|
5
5
|
|
@@ -27,6 +27,7 @@ var FloatingPopover = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
27
|
},
|
28
28
|
placement: placement === 'auto' ? undefined : placement,
|
29
29
|
open: opened,
|
30
|
+
onOpenChange: onToggle,
|
30
31
|
middleware: [placement === 'auto' && autoPlacement(), offset({
|
31
32
|
mainAxis: isInner ? LIST_PADDING * 2 : offset$1[1],
|
32
33
|
crossAxis: isInner ? -LIST_PADDING : offset$1[0]
|
@@ -35,40 +36,25 @@ var FloatingPopover = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
35
36
|
}), shift()]
|
36
37
|
}),
|
37
38
|
refs = _useFloating.refs,
|
38
|
-
floatingStyles = _useFloating.floatingStyles
|
39
|
+
floatingStyles = _useFloating.floatingStyles,
|
40
|
+
context = _useFloating.context;
|
39
41
|
var wrappedId = safeUseId();
|
40
|
-
var
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
};
|
54
|
-
var
|
55
|
-
|
56
|
-
var _refs$floating$curren;
|
57
|
-
if (trigger === 'click' || !opened || event.relatedTarget && refs.floating && (_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 && _refs$floating$curren.contains(event.relatedTarget)) {
|
58
|
-
return;
|
59
|
-
}
|
60
|
-
onToggle(false, event);
|
61
|
-
}
|
62
|
-
};
|
63
|
-
var handleFloatingMouseLeave = function handleFloatingMouseLeave(event) {
|
64
|
-
if (event.relatedTarget instanceof HTMLElement && refs.reference.current instanceof HTMLElement) {
|
65
|
-
var _refs$reference$curre;
|
66
|
-
if (trigger === 'click' || !opened || event.relatedTarget && refs.reference && (_refs$reference$curre = refs.reference.current) !== null && _refs$reference$curre !== void 0 && _refs$reference$curre.contains(event.relatedTarget)) {
|
67
|
-
return;
|
68
|
-
}
|
69
|
-
onToggle(false, event);
|
70
|
-
}
|
71
|
-
};
|
42
|
+
var hover = useHover(context, {
|
43
|
+
enabled: trigger === 'hover',
|
44
|
+
delay: {
|
45
|
+
open: 0,
|
46
|
+
close: 50
|
47
|
+
},
|
48
|
+
handleClose: safePolygon({
|
49
|
+
requireIntent: false
|
50
|
+
})
|
51
|
+
});
|
52
|
+
var click = useClick(context, {
|
53
|
+
stickIfOpen: false,
|
54
|
+
ignoreMouse: trigger === 'hover'
|
55
|
+
});
|
56
|
+
var _useInteractions = useInteractions([hover, click]),
|
57
|
+
getReferenceProps = _useInteractions.getReferenceProps;
|
72
58
|
return /*#__PURE__*/React.createElement("div", {
|
73
59
|
ref: ref,
|
74
60
|
id: wrappedId,
|
@@ -76,14 +62,10 @@ var FloatingPopover = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
76
62
|
position: 'relative',
|
77
63
|
display: isInner ? 'block' : 'inline-block'
|
78
64
|
}
|
79
|
-
}, /*#__PURE__*/React.createElement("div", {
|
80
|
-
ref: refs.setReference
|
81
|
-
|
82
|
-
onMouseEnter: handleTargetMouseEnter,
|
83
|
-
onMouseLeave: handleTargetMouseLeave
|
84
|
-
}, target), opened && /*#__PURE__*/React.createElement(FloatingPortal, getFloatingPortalProps(portal, wrappedId), /*#__PURE__*/React.createElement("div", {
|
65
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
66
|
+
ref: refs.setReference
|
67
|
+
}, getReferenceProps()), target), opened && /*#__PURE__*/React.createElement(FloatingPortal, getFloatingPortalProps(portal, wrappedId), /*#__PURE__*/React.createElement("div", {
|
85
68
|
ref: refs.setFloating,
|
86
|
-
onMouseLeave: handleFloatingMouseLeave,
|
87
69
|
style: _objectSpread2(_objectSpread2({}, floatingStyles), {}, {
|
88
70
|
zIndex: zIndex || 1000
|
89
71
|
})
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FloatingPopover.js","sources":["../../../src/components/Dropdown/FloatingPopover.tsx"],"sourcesContent":["import {\n flip,\n shift,\n useFloating,\n FloatingPortal,\n offset as offsetMiddleware,\n autoPlacement,\n autoUpdate,\n} from '@floating-ui/react';\nimport React, { forwardRef
|
1
|
+
{"version":3,"file":"FloatingPopover.js","sources":["../../../src/components/Dropdown/FloatingPopover.tsx"],"sourcesContent":["import {\n flip,\n shift,\n useFloating,\n FloatingPortal,\n offset as offsetMiddleware,\n autoPlacement,\n autoUpdate,\n useHover,\n useInteractions,\n safePolygon,\n useClick,\n} from '@floating-ui/react';\nimport React, { forwardRef } from 'react';\nimport { safeUseId } from 'src/utils';\n\nimport { FloatingPopoverProps } from './Dropdown.types';\n\n// TODO: #2003\nconst LIST_PADDING = 2;\n\nconst FloatingPopover = forwardRef<HTMLDivElement, FloatingPopoverProps>(\n ({ target, children, opened, onToggle, placement, portal, offset = [0, 8], isInner, trigger, zIndex }, ref) => {\n const { refs, floatingStyles, context } = useFloating({\n whileElementsMounted(referenceEl, floatingEl, update) {\n return autoUpdate(referenceEl, floatingEl, update, {\n ancestorScroll: false,\n ancestorResize: false,\n layoutShift: false,\n });\n },\n placement: placement === 'auto' ? undefined : placement,\n open: opened,\n onOpenChange: onToggle,\n middleware: [\n placement === 'auto' && autoPlacement(),\n offsetMiddleware({\n mainAxis: isInner ? LIST_PADDING * 2 : offset[1],\n crossAxis: isInner ? -LIST_PADDING : offset[0],\n }),\n flip({ fallbackAxisSideDirection: 'end' }),\n shift(),\n ],\n });\n const wrappedId = safeUseId();\n\n const hover = useHover(context, {\n enabled: trigger === 'hover',\n delay: {\n open: 0,\n close: 50,\n },\n handleClose: safePolygon({\n requireIntent: false,\n }),\n });\n const click = useClick(context, {\n stickIfOpen: false,\n ignoreMouse: trigger === 'hover',\n });\n\n const { getReferenceProps } = useInteractions([hover, click]);\n\n return (\n <div\n ref={ref}\n id={wrappedId}\n style={{\n position: 'relative',\n display: isInner ? 'block' : 'inline-block',\n }}\n >\n <div ref={refs.setReference} {...getReferenceProps()}>\n {target}\n </div>\n\n {opened && (\n <FloatingPortal {...getFloatingPortalProps(portal, wrappedId)}>\n <div\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n zIndex: zIndex || 1000,\n }}\n >\n {children}\n </div>\n </FloatingPortal>\n )}\n </div>\n );\n },\n);\n\ntype FloatingPortalReturnedProps = {\n root?: React.RefObject<HTMLElement>;\n id?: string;\n};\n\n// root - принимает ref контейнера портала.\n// id - если есть портал - не используется, если портала нет - подставляется 'wrappedId'.\nconst getFloatingPortalProps = (\n portal: FloatingPopoverProps['portal'],\n wrappedId: string,\n): FloatingPortalReturnedProps => {\n if (!portal) {\n return { id: wrappedId };\n }\n\n if (typeof portal === 'string') {\n return { id: portal };\n }\n\n return { root: portal };\n};\n\nexport { FloatingPopover };\n"],"names":["LIST_PADDING","FloatingPopover","forwardRef","_ref","ref","target","children","opened","onToggle","placement","portal","_ref$offset","offset","isInner","trigger","zIndex","_useFloating","useFloating","whileElementsMounted","referenceEl","floatingEl","update","autoUpdate","ancestorScroll","ancestorResize","layoutShift","undefined","open","onOpenChange","middleware","autoPlacement","offsetMiddleware","mainAxis","crossAxis","flip","fallbackAxisSideDirection","shift","refs","floatingStyles","context","wrappedId","safeUseId","hover","useHover","enabled","delay","close","handleClose","safePolygon","requireIntent","click","useClick","stickIfOpen","ignoreMouse","_useInteractions","useInteractions","getReferenceProps","React","createElement","id","style","position","display","_extends","setReference","FloatingPortal","getFloatingPortalProps","setFloating","_objectSpread","root"],"mappings":";;;;;AAkBA;AACA,IAAMA,YAAY,GAAG,CAAC,CAAA;AAEhBC,IAAAA,eAAe,gBAAGC,UAAU,CAC9B,UAAAC,IAAA,EAAuGC,GAAG,EAAK;AAAA,EAAA,IAA5GC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAE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CAC/CnD,EAAAA,MACA,CAAC,EAELE,MAAM,iBACHkD,KAAA,CAAAC,aAAA,CAACO,cAAc,EAAKC,sBAAsB,CAACxD,MAAM,EAAE8B,SAAS,CAAC,eACzDiB,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;IACItD,GAAG,EAAEiC,IAAI,CAAC8B,WAAY;AACtBP,IAAAA,KAAK,EAAAQ,cAAA,CAAAA,cAAA,KACE9B,cAAc,CAAA,EAAA,EAAA,EAAA;MACjBvB,MAAM,EAAEA,MAAM,IAAI,IAAA;AAAI,KAAA,CAAA;GAGzBT,EAAAA,QACA,CACO,CAEnB,CAAC,CAAA;AAEd,CACJ,EAAC;AAOD;AACA;AACA,IAAM4D,sBAAsB,GAAG,SAAzBA,sBAAsBA,CACxBxD,MAAsC,EACtC8B,SAAiB,EACa;EAC9B,IAAI,CAAC9B,MAAM,EAAE;IACT,OAAO;AAAEiD,MAAAA,EAAE,EAAEnB,SAAAA;KAAW,CAAA;AAC5B,GAAA;AAEA,EAAA,IAAI,OAAO9B,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAO;AAAEiD,MAAAA,EAAE,EAAEjD,MAAAA;KAAQ,CAAA;AACzB,GAAA;EAEA,OAAO;AAAE2D,IAAAA,IAAI,EAAE3D,MAAAA;GAAQ,CAAA;AAC3B,CAAC;;;;"}
|
@@ -171,13 +171,9 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
171
171
|
case keys.Tab:
|
172
172
|
case keys.Escape:
|
173
173
|
{
|
174
|
-
|
175
|
-
|
176
|
-
}
|
177
|
-
dispatchPath({
|
178
|
-
type: 'reset'
|
179
|
-
});
|
180
|
-
handleGlobalToggle(false, event);
|
174
|
+
if (path[0]) {
|
175
|
+
handleGlobalToggle(false, event);
|
176
|
+
}
|
181
177
|
break;
|
182
178
|
}
|
183
179
|
case keys.Home:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useKeyboardNavigation.js","sources":["../../../../src/components/Dropdown/hooks/useKeyboardNavigation.ts"],"sourcesContent":["import { KeyboardEvent } from 'react';\nimport type { Dispatch } from 'react';\n\nimport { PathAction, PathState } from '../reducers/pathReducer';\nimport { FocusedPathAction, FocusedPathState } from '../reducers/focusedPathReducer';\nimport { HandleGlobalToggleType, DropdownProps } from '../Dropdown.types';\n\nimport { PathMapType, FocusedToValueMapType } from './useHashMaps';\n\nconst JUMP_SIZE = 10;\n\nexport const keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Home: 'Home',\n End: 'End',\n PageUp: 'PageUp',\n PageDown: 'PageDown',\n};\n\nconst getFurtherPath = (focusedPath: FocusedPathState, focusedToValueMap: FocusedToValueMapType) => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n\n return focusedToValueMap.get(focusedPathAsString);\n};\n\ninterface Props {\n focusedPath: FocusedPathState;\n dispatchFocusedPath: Dispatch<FocusedPathAction>;\n path: PathState;\n dispatchPath: Dispatch<PathAction>;\n pathMap: PathMapType;\n focusedToValueMap: FocusedToValueMapType;\n handleGlobalToggle: HandleGlobalToggleType;\n closeOnSelect: DropdownProps['closeOnSelect'];\n onItemSelect: DropdownProps['onItemSelect'];\n onItemClick: DropdownProps['onItemClick'];\n}\n\ninterface ReturnedProps {\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nexport const useKeyNavigation = ({\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleGlobalToggle,\n closeOnSelect,\n onItemSelect,\n onItemClick,\n}: Props): ReturnedProps => {\n const currentIndex: number = focusedPath?.[focusedPath.length - 1] || 0;\n const currentLength: number = pathMap.get(path?.[focusedPath.length - 1]) || 0;\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n switch (event.code) {\n case keys.ArrowUp: {\n if (focusedPath.length) {\n if (currentIndex > 0) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.ArrowDown: {\n if (focusedPath.length) {\n if (currentIndex + 1 < currentLength) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.ArrowLeft: {\n if (focusedPath.length) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n } else {\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n }\n\n if (path.length === 1) {\n handleGlobalToggle(false, event);\n }\n\n break;\n }\n\n case keys.ArrowRight: {\n if (!focusedPath.length) {\n break;\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.disabled || currentItem?.isDisabled) {\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n }\n\n break;\n }\n\n case keys.Enter:\n case keys.Space: {\n event.preventDefault();\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.disabled || currentItem?.isDisabled) {\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n } else {\n if (closeOnSelect) {\n handleGlobalToggle(false, event);\n }\n\n if (onItemSelect && currentItem) {\n onItemSelect(currentItem, event);\n }\n\n if (onItemClick && currentItem) {\n onItemClick(currentItem, event);\n }\n }\n\n break;\n }\n\n case keys.Tab:\n case keys.Escape: {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n handleGlobalToggle(false, event);\n\n break;\n }\n\n case keys.Home: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.End: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'change_last_focus', value: (pathMap.get('root') || 0) - 1 });\n\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.PageUp: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - JUMP_SIZE });\n }\n\n break;\n }\n\n case keys.PageDown: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentLength - currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + JUMP_SIZE });\n }\n\n break;\n }\n\n default: {\n break;\n }\n }\n };\n\n return { onKeyDown };\n};\n"],"names":["JUMP_SIZE","keys","Enter","Space","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","getFurtherPath","focusedPath","focusedToValueMap","focusedPathAsString","reduce","acc","n","concat","replace","get","useKeyNavigation","_ref","dispatchFocusedPath","path","dispatchPath","pathMap","handleGlobalToggle","closeOnSelect","onItemSelect","onItemClick","currentIndex","length","currentLength","onKeyDown","event","code","type","value","currentItem","disabled","isDisabled","items","toString","preventDefault"],"mappings":"AASA,IAAMA,SAAS,GAAG,EAAE,CAAA;AAEb,IAAMC,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAA;AACd,EAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,WAA6B,EAAEC,iBAAwC,EAAK;EAChG,IAAMC,mBAAmB,GAAGF,WAAW,CAACG,MAAM,CAAC,UAACC,GAAG,EAAEC,CAAC,EAAA;AAAA,IAAA,OAAA,EAAA,CAAAC,MAAA,CAAQF,GAAG,EAAAE,GAAAA,CAAAA,CAAAA,MAAA,CAAID,CAAC,CAAA,CAAA;GAAE,EAAE,EAAE,CAAC,CAACE,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAElG,EAAA,OAAON,iBAAiB,CAACO,GAAG,CAACN,mBAAmB,C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AA;AACxB;;;;"}
|
1
|
+
{"version":3,"file":"useKeyboardNavigation.js","sources":["../../../../src/components/Dropdown/hooks/useKeyboardNavigation.ts"],"sourcesContent":["import { KeyboardEvent } from 'react';\nimport type { Dispatch } from 'react';\n\nimport { PathAction, PathState } from '../reducers/pathReducer';\nimport { FocusedPathAction, FocusedPathState } from '../reducers/focusedPathReducer';\nimport { HandleGlobalToggleType, DropdownProps } from '../Dropdown.types';\n\nimport { PathMapType, FocusedToValueMapType } from './useHashMaps';\n\nconst JUMP_SIZE = 10;\n\nexport const keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Home: 'Home',\n End: 'End',\n PageUp: 'PageUp',\n PageDown: 'PageDown',\n};\n\nconst getFurtherPath = (focusedPath: FocusedPathState, focusedToValueMap: FocusedToValueMapType) => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n\n return focusedToValueMap.get(focusedPathAsString);\n};\n\ninterface Props {\n focusedPath: FocusedPathState;\n dispatchFocusedPath: Dispatch<FocusedPathAction>;\n path: PathState;\n dispatchPath: Dispatch<PathAction>;\n pathMap: PathMapType;\n focusedToValueMap: FocusedToValueMapType;\n handleGlobalToggle: HandleGlobalToggleType;\n closeOnSelect: DropdownProps['closeOnSelect'];\n onItemSelect: DropdownProps['onItemSelect'];\n onItemClick: DropdownProps['onItemClick'];\n}\n\ninterface ReturnedProps {\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nexport const useKeyNavigation = ({\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleGlobalToggle,\n closeOnSelect,\n onItemSelect,\n onItemClick,\n}: Props): ReturnedProps => {\n const currentIndex: number = focusedPath?.[focusedPath.length - 1] || 0;\n const currentLength: number = pathMap.get(path?.[focusedPath.length - 1]) || 0;\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n switch (event.code) {\n case keys.ArrowUp: {\n if (focusedPath.length) {\n if (currentIndex > 0) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.ArrowDown: {\n if (focusedPath.length) {\n if (currentIndex + 1 < currentLength) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.ArrowLeft: {\n if (focusedPath.length) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n } else {\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n }\n\n if (path.length === 1) {\n handleGlobalToggle(false, event);\n }\n\n break;\n }\n\n case keys.ArrowRight: {\n if (!focusedPath.length) {\n break;\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.disabled || currentItem?.isDisabled) {\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n }\n\n break;\n }\n\n case keys.Enter:\n case keys.Space: {\n event.preventDefault();\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.disabled || currentItem?.isDisabled) {\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n } else {\n if (closeOnSelect) {\n handleGlobalToggle(false, event);\n }\n\n if (onItemSelect && currentItem) {\n onItemSelect(currentItem, event);\n }\n\n if (onItemClick && currentItem) {\n onItemClick(currentItem, event);\n }\n }\n\n break;\n }\n\n case keys.Tab:\n case keys.Escape: {\n if (path[0]) {\n handleGlobalToggle(false, event);\n }\n\n break;\n }\n\n case keys.Home: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.End: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'change_last_focus', value: (pathMap.get('root') || 0) - 1 });\n\n handleGlobalToggle(true, event);\n }\n\n break;\n }\n\n case keys.PageUp: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - JUMP_SIZE });\n }\n\n break;\n }\n\n case keys.PageDown: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentLength - currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + JUMP_SIZE });\n }\n\n break;\n }\n\n default: {\n break;\n }\n }\n };\n\n return { onKeyDown };\n};\n"],"names":["JUMP_SIZE","keys","Enter","Space","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","getFurtherPath","focusedPath","focusedToValueMap","focusedPathAsString","reduce","acc","n","concat","replace","get","useKeyNavigation","_ref","dispatchFocusedPath","path","dispatchPath","pathMap","handleGlobalToggle","closeOnSelect","onItemSelect","onItemClick","currentIndex","length","currentLength","onKeyDown","event","code","type","value","currentItem","disabled","isDisabled","items","toString","preventDefault"],"mappings":"AASA,IAAMA,SAAS,GAAG,EAAE,CAAA;AAEb,IAAMC,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAA;AACd,EAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,WAA6B,EAAEC,iBAAwC,EAAK;EAChG,IAAMC,mBAAmB,GAAGF,WAAW,CAACG,MAAM,CAAC,UAACC,GAAG,EAAEC,CAAC,EAAA;AAAA,IAAA,OAAA,EAAA,CAAAC,MAAA,CAAQF,GAAG,EAAAE,GAAAA,CAAAA,CAAAA,MAAA,CAAID,CAAC,CAAA,CAAA;GAAE,EAAE,EAAE,CAAC,CAACE,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAElG,EAAA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1jav4ek__367ba473{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--w1jav4ek-0);min-height:var(--plasma-dropdown-item-height);margin:var(--plasma-dropdown-item-margin,0);box-sizing:content-box;padding:var(--w1jav4ek-1);font-family:var(--plasma-dropdown-item-font-family);font-size:var(--plasma-dropdown-item-font-size);font-style:var(--plasma-dropdown-item-font-style);font-weight:var(--plasma-dropdown-item-letter-spacing);-webkit-letter-spacing:var(--plasma-dropdown-item-line-height);-moz-letter-spacing:var(--plasma-dropdown-item-line-height);-ms-letter-spacing:var(--plasma-dropdown-item-line-height);letter-spacing:var(--plasma-dropdown-item-line-height);line-height:var(--plasma-dropdown-item-font-weight);background-color:var(--surface-clear);border-radius:var( --plasma-dropdown-item-border-radius, calc(var(--plasma-dropdown-border-radius) - 0.125rem - var(--plasma-dropdown-border-width,0rem)) );-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-clip:padding-box;position:relative;}.DropdownItem_styles_1algi32_w1jav4ek__367ba473:hover:not(.DropdownItem_styles_1algi32_dropdownItemIsDisabled__367ba473){cursor:pointer;background-color:var(--plasma-dropdown-item-background-hover);}.DropdownItem_styles_1algi32_w1jav4ek__367ba473.DropdownItem_styles_1algi32_dropdownItemIsActive__367ba473{background-color:var(--plasma-dropdown-item-background-hover);}.DropdownItem_styles_1algi32_w1jav4ek__367ba473.DropdownItem_styles_1algi32_dropdownItemIsDisabled__367ba473{opacity:0.4;cursor:not-allowed;}.DropdownItem_styles_1algi32_w1jav4ek__367ba473:focus{outline:none;}.DropdownItem_styles_1algi32_w1jav4ek__367ba473::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;display:block;box-sizing:content-box;border:0 solid transparent;border-radius:calc(var(--plasma-dropdown-border-radius) - 0.125rem - var(--plasma-dropdown-border-width,0rem));-webkit-transition:none;transition:none;pointer-events:none;}.DropdownItem_styles_1algi32_w1jav4ek__367ba473.DropdownItem_styles_1algi32_dropdownItemIsFocused__367ba473:before{outline:none;box-shadow:inset 0 0 0 0.0625rem var(--surface-accent);}
|
25
25
|
.DropdownItem_styles_1algi32_r1fqtjio__367ba473{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-flex:1;-ms-flex:1;flex:1;}
|
26
26
|
|
27
|
-
.
|
28
|
-
.
|
27
|
+
.Dropdown_styles_kkvnr1_ln7uamp__173ef985{width:var(--ln7uamp-0);padding:calc(var(--plasma-dropdown-padding) + var(--plasma-dropdown-border-width,0rem));border-radius:var(--plasma-dropdown-border-radius);box-sizing:border-box;background:var(--surface-solid-card-brightness);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04), inset 0 0 0 var(--plasma-dropdown-border-width,0) var(--plasma-dropdown-border-color,transparent);}
|
28
|
+
.Dropdown_styles_kkvnr1_ujr7fmv__173ef985{max-height:var(--ujr7fmv-0);overflow-x:hidden;overflow-y:auto;border-radius:calc(var(--plasma-dropdown-border-radius) - 0.125rem - var(--plasma-dropdown-border-width,0rem));margin:0;padding:0;}
|
29
29
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { useRef } from 'react';
|
2
2
|
import { DropdownItem } from '../DropdownItem/DropdownItem.js';
|
3
3
|
import { ListWrapper, Ul } from '../../Dropdown.styles.js';
|
4
4
|
import { FloatingPopover } from '../../FloatingPopover.js';
|
@@ -12,9 +12,8 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
12
12
|
dispatchPath = _ref.dispatchPath,
|
13
13
|
index = _ref.index,
|
14
14
|
trigger = _ref.trigger,
|
15
|
-
|
16
|
-
|
17
|
-
listWidth = _ref.listWidth;
|
15
|
+
listWidth = _ref.listWidth,
|
16
|
+
portal = _ref.portal;
|
18
17
|
var handleToggle = function handleToggle(opened) {
|
19
18
|
if (opened) {
|
20
19
|
dispatchPath({
|
@@ -29,6 +28,7 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
29
28
|
});
|
30
29
|
}
|
31
30
|
};
|
31
|
+
var listWrapperRef = useRef(null);
|
32
32
|
var isCurrentListOpen = path[currentLevel + 1] === item.value.toString();
|
33
33
|
var treeId = safeUseId();
|
34
34
|
var listId = "".concat(treeId, "_tree_level_").concat(currentLevel + 2);
|
@@ -49,14 +49,15 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
49
49
|
ariaLevel: nextLevel,
|
50
50
|
ariaLabel: item.label
|
51
51
|
}),
|
52
|
-
isInner: true
|
52
|
+
isInner: true,
|
53
|
+
portal: portal
|
53
54
|
}, /*#__PURE__*/React.createElement(ListWrapper, {
|
55
|
+
ref: listWrapperRef,
|
54
56
|
listWidth: listWidth
|
55
57
|
}, /*#__PURE__*/React.createElement(Ul, {
|
56
58
|
id: listId,
|
57
59
|
role: "group",
|
58
|
-
listMaxHeight: listMaxHeight
|
59
|
-
listOverflow: listOverflow
|
60
|
+
listMaxHeight: item.listMaxHeight
|
60
61
|
}, item.items.map(function (innerItem, innerIndex) {
|
61
62
|
return /*#__PURE__*/React.createElement(DropdownInner, {
|
62
63
|
key: "".concat(innerIndex, "/").concat(currentLevel),
|
@@ -66,9 +67,8 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
66
67
|
dispatchPath: dispatchPath,
|
67
68
|
index: innerIndex,
|
68
69
|
trigger: trigger,
|
69
|
-
|
70
|
-
|
71
|
-
listWidth: listWidth
|
70
|
+
listWidth: listWidth,
|
71
|
+
portal: listWrapperRef
|
72
72
|
});
|
73
73
|
}))));
|
74
74
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownInner.js","sources":["../../../../../src/components/Dropdown/ui/DropdownInner/DropdownInner.tsx"],"sourcesContent":["import React from 'react';\nimport type { FC } from 'react';\nimport { safeUseId } from 'src/utils';\n\nimport { DropdownItem } from '../DropdownItem/DropdownItem';\nimport { Ul, ListWrapper } from '../../Dropdown.styles';\nimport { FloatingPopover } from '../../FloatingPopover';\nimport { getPlacement } from '../../utils';\n\nimport { DropdownInnerProps } from './DropdownInner.type';\n\nconst DropdownInner: FC<DropdownInnerProps> = ({\n item,\n currentLevel,\n path,\n dispatchPath,\n index,\n trigger,\n
|
1
|
+
{"version":3,"file":"DropdownInner.js","sources":["../../../../../src/components/Dropdown/ui/DropdownInner/DropdownInner.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport type { FC } from 'react';\nimport { safeUseId } from 'src/utils';\n\nimport { DropdownItem } from '../DropdownItem/DropdownItem';\nimport { Ul, ListWrapper } from '../../Dropdown.styles';\nimport { FloatingPopover } from '../../FloatingPopover';\nimport { getPlacement } from '../../utils';\n\nimport { DropdownInnerProps } from './DropdownInner.type';\n\nconst DropdownInner: FC<DropdownInnerProps> = ({\n item,\n currentLevel,\n path,\n dispatchPath,\n index,\n trigger,\n listWidth,\n portal,\n}) => {\n const handleToggle = (opened: boolean): void => {\n if (opened) {\n dispatchPath({ type: 'changed_on_level', value: item.value.toString(), level: currentLevel + 1 });\n } else {\n dispatchPath({ type: 'cut_by_level', level: currentLevel + 1 });\n }\n };\n\n const listWrapperRef = useRef<HTMLDivElement>(null);\n\n const isCurrentListOpen = path[currentLevel + 1] === item.value.toString();\n\n const treeId = safeUseId();\n const listId = `${treeId}_tree_level_${currentLevel + 2}`;\n const nextLevel = currentLevel + 1;\n\n if (item?.items) {\n return (\n <FloatingPopover\n placement={getPlacement(item?.placement || 'right')}\n opened={isCurrentListOpen}\n onToggle={handleToggle}\n trigger={item.trigger || trigger}\n target={\n <DropdownItem\n item={item}\n index={index}\n path={path}\n currentLevel={currentLevel}\n ariaControls={listId}\n ariaExpanded={isCurrentListOpen}\n ariaLevel={nextLevel}\n ariaLabel={item.label}\n />\n }\n isInner\n portal={portal}\n >\n <ListWrapper ref={listWrapperRef} listWidth={listWidth}>\n <Ul id={listId} role=\"group\" listMaxHeight={item.listMaxHeight}>\n {item.items.map((innerItem, innerIndex) => (\n <DropdownInner\n key={`${innerIndex}/${currentLevel}`}\n item={innerItem}\n currentLevel={nextLevel}\n path={path}\n dispatchPath={dispatchPath}\n index={innerIndex}\n trigger={trigger}\n listWidth={listWidth}\n portal={listWrapperRef}\n />\n ))}\n </Ul>\n </ListWrapper>\n </FloatingPopover>\n );\n }\n\n return <DropdownItem item={item} path={path} index={index} currentLevel={currentLevel} ariaLevel={nextLevel} />;\n};\n\nexport { DropdownInner };\n"],"names":["DropdownInner","_ref","item","currentLevel","path","dispatchPath","index","trigger","listWidth","portal","handleToggle","opened","type","value","toString","level","listWrapperRef","useRef","isCurrentListOpen","treeId","safeUseId","listId","concat","nextLevel","items","React","createElement","FloatingPopover","placement","getPlacement","onToggle","target","DropdownItem","ariaControls","ariaExpanded","ariaLevel","ariaLabel","label","isInner","ListWrapper","ref","Ul","id","role","listMaxHeight","map","innerItem","innerIndex","key"],"mappings":";;;;;;;AAWA,IAAMA,aAAqC,GAAG,SAAxCA,aAAqCA,CAAAC,IAAA,EASrC;AAAA,EAAA,IARFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IACZC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,MAAM,GAAAR,IAAA,CAANQ,MAAM,CAAA;AAEN,EAAA,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,MAAe,EAAW;AAC5C,IAAA,IAAIA,MAAM,EAAE;AACRN,MAAAA,YAAY,CAAC;AAAEO,QAAAA,IAAI,EAAE,kBAAkB;AAAEC,QAAAA,KAAK,EAAEX,IAAI,CAACW,KAAK,CAACC,QAAQ,EAAE;QAAEC,KAAK,EAAEZ,YAAY,GAAG,CAAA;AAAE,OAAC,CAAC,CAAA;AACr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K,EAAEA,KAAM;AAACH,IAAAA,YAAY,EAAEA,YAAa;AAACgC,IAAAA,SAAS,EAAEZ,SAAAA;AAAU,GAAE,CAAC,CAAA;AACnH;;;;"}
|
@@ -74,7 +74,7 @@ var DropdownItem = function DropdownItem(_ref) {
|
|
74
74
|
};
|
75
75
|
var handleHover = function handleHover() {
|
76
76
|
if (onHover) {
|
77
|
-
onHover(index);
|
77
|
+
onHover(index, item);
|
78
78
|
}
|
79
79
|
};
|
80
80
|
return /*#__PURE__*/React.createElement(React.Fragment, null, dividerBefore && /*#__PURE__*/React.createElement(Divider, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownItem.js","sources":["../../../../../src/components/Dropdown/ui/DropdownItem/DropdownItem.tsx"],"sourcesContent":["import React, { useEffect, useRef, FC, useContext } from 'react';\n\nimport { classes } from '../../Dropdown.tokens';\nimport { cx } from '../../../../utils';\nimport { Context } from '../../Dropdown.context';\nimport { getItemId } from '../../utils';\n\nimport {\n Wrapper,\n DisclosureIconWrapper,\n Divider,\n CellWrapper,\n StyledCell,\n RenderItemWrapper,\n StyledIconDisclosureRight,\n} from './DropdownItem.styles';\nimport type { DropdownItemProps } from './DropdownItem.type';\n\nexport const DropdownItem: FC<DropdownItemProps> = ({\n item,\n path,\n currentLevel,\n index,\n ariaControls,\n ariaExpanded,\n ariaLevel,\n ariaLabel,\n}) => {\n const {\n value,\n label,\n disabled,\n isDisabled,\n contentLeft,\n contentRight,\n dividerBefore,\n dividerAfter,\n className,\n ...rest\n } = item;\n\n const ref = useRef<HTMLLIElement | null>(null);\n\n const {\n focusedPath,\n size,\n variant,\n itemRole,\n handleGlobalToggle,\n closeOnSelect,\n onHover,\n onItemSelect,\n onItemClick,\n hasArrow,\n treeId,\n renderItem,\n } = useContext(Context);\n\n const hasDescendants = Boolean(item.items);\n const disclosureIconSize = size === 'xs' ? 'xs' : 's';\n const itemDisabled = Boolean(disabled || isDisabled);\n const isDisabledClassName = itemDisabled ? classes.dropdownItemIsDisabled : undefined;\n const focusedClass =\n currentLevel === focusedPath.length - 1 && index === focusedPath?.[currentLevel]\n ? classes.dropdownItemIsFocused\n : undefined;\n const activeClass = value === path?.[currentLevel + 1] ? classes.dropdownItemIsActive : undefined;\n\n useEffect(() => {\n if (focusedClass && ref?.current) {\n ref.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, [focusedClass]);\n\n const handleClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n if (itemDisabled) {\n event.stopPropagation();\n return;\n }\n\n if (onItemSelect) {\n onItemSelect(item, event);\n }\n\n if (onItemClick) {\n onItemClick(item, event);\n }\n\n // Закрываем весь дропдаун целиком при клике на айтем без потомков. Только при closeOnSelect === true.\n if (closeOnSelect && !hasDescendants) {\n handleGlobalToggle(false, event);\n }\n };\n\n const handleHover = () => {\n if (onHover) {\n onHover(index);\n }\n };\n\n return (\n <>\n {dividerBefore && <Divider variant={variant} />}\n\n <Wrapper\n {...rest}\n ref={ref}\n className={cx(isDisabledClassName, focusedClass, activeClass, className)}\n id={getItemId(treeId, value.toString())}\n role={itemRole}\n onClick={handleClick}\n onMouseEnter={handleHover}\n variant={variant}\n aria-disabled={disabled || isDisabled}\n aria-controls={ariaControls}\n aria-expanded={ariaExpanded}\n aria-level={ariaLevel}\n aria-label={ariaLabel}\n >\n {renderItem ? (\n <RenderItemWrapper>{renderItem(item)}</RenderItemWrapper>\n ) : (\n <CellWrapper>\n <StyledCell\n contentLeft={contentLeft}\n contentRight={contentRight}\n alignContentLeft=\"center\"\n alignContentRight=\"center\"\n title={label}\n />\n </CellWrapper>\n )}\n\n {item.items && hasArrow && (\n <DisclosureIconWrapper>\n <StyledIconDisclosureRight size={disclosureIconSize} color=\"inherit\" />\n </DisclosureIconWrapper>\n )}\n </Wrapper>\n\n {dividerAfter && <Divider variant={variant} />}\n </>\n );\n};\n"],"names":["DropdownItem","_ref","item","path","currentLevel","index","ariaControls","ariaExpanded","ariaLevel","ariaLabel","value","label","disabled","isDisabled","contentLeft","contentRight","dividerBefore","dividerAfter","className","rest","_objectWithoutProperties","_excluded","ref","useRef","_useContext","useContext","Context","focusedPath","size","variant","itemRole","handleGlobalToggle","closeOnSelect","onHover","onItemSelect","onItemClick","hasArrow","treeId","renderItem","hasDescendants","Boolean","items","disclosureIconSize","itemDisabled","isDisabledClassName","classes","dropdownItemIsDisabled","undefined","focusedClass","length","dropdownItemIsFocused","activeClass","dropdownItemIsActive","useEffect","current","scrollIntoView","behavior","block","inline","handleClick","event","stopPropagation","handleHover","React","createElement","Fragment","Divider","Wrapper","_extends","cx","id","getItemId","toString","role","onClick","onMouseEnter","RenderItemWrapper","CellWrapper","StyledCell","alignContentLeft","alignContentRight","title","DisclosureIconWrapper","StyledIconDisclosureRight","color"],"mappings":";;;;;;;;;IAkBaA,YAAmC,GAAG,SAAtCA,YAAmCA,CAAAC,IAAA,EAS1C;AAAA,EAAA,IARFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,SAAS,GAAAR,IAAA,CAATQ,SAAS,CAAA;AAET,EAAA,IACIC,KAAK,GAULR,IAAI,CAVJQ,KAAK;IACLC,KAAK,GASLT,IAAI,CATJS,KAAK;IACLC,QAAQ,GAQRV,IAAI,CARJU,QAAQ;IACRC,UAAU,GAOVX,IAAI,CAPJW,UAAU;IACVC,WAAW,GAMXZ,IAAI,CANJY,WAAW;IACXC,YAAY,GAKZb,IAAI,CALJa,YAAY;IACZC,aAAa,GAIbd,IAAI,CAJJc,aAAa;IACbC,YAAY,GAGZf,IAAI,CAHJe,YAAY;IACZC,SAAS,GAEThB,IAAI,C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O,EAAE;
|
1
|
+
{"version":3,"file":"DropdownItem.js","sources":["../../../../../src/components/Dropdown/ui/DropdownItem/DropdownItem.tsx"],"sourcesContent":["import React, { useEffect, useRef, FC, useContext } from 'react';\n\nimport { classes } from '../../Dropdown.tokens';\nimport { cx } from '../../../../utils';\nimport { Context } from '../../Dropdown.context';\nimport { getItemId } from '../../utils';\n\nimport {\n Wrapper,\n DisclosureIconWrapper,\n Divider,\n CellWrapper,\n StyledCell,\n RenderItemWrapper,\n StyledIconDisclosureRight,\n} from './DropdownItem.styles';\nimport type { DropdownItemProps } from './DropdownItem.type';\n\nexport const DropdownItem: FC<DropdownItemProps> = ({\n item,\n path,\n currentLevel,\n index,\n ariaControls,\n ariaExpanded,\n ariaLevel,\n ariaLabel,\n}) => {\n const {\n value,\n label,\n disabled,\n isDisabled,\n contentLeft,\n contentRight,\n dividerBefore,\n dividerAfter,\n className,\n ...rest\n } = item;\n\n const ref = useRef<HTMLLIElement | null>(null);\n\n const {\n focusedPath,\n size,\n variant,\n itemRole,\n handleGlobalToggle,\n closeOnSelect,\n onHover,\n onItemSelect,\n onItemClick,\n hasArrow,\n treeId,\n renderItem,\n } = useContext(Context);\n\n const hasDescendants = Boolean(item.items);\n const disclosureIconSize = size === 'xs' ? 'xs' : 's';\n const itemDisabled = Boolean(disabled || isDisabled);\n const isDisabledClassName = itemDisabled ? classes.dropdownItemIsDisabled : undefined;\n const focusedClass =\n currentLevel === focusedPath.length - 1 && index === focusedPath?.[currentLevel]\n ? classes.dropdownItemIsFocused\n : undefined;\n const activeClass = value === path?.[currentLevel + 1] ? classes.dropdownItemIsActive : undefined;\n\n useEffect(() => {\n if (focusedClass && ref?.current) {\n ref.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, [focusedClass]);\n\n const handleClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n if (itemDisabled) {\n event.stopPropagation();\n return;\n }\n\n if (onItemSelect) {\n onItemSelect(item, event);\n }\n\n if (onItemClick) {\n onItemClick(item, event);\n }\n\n // Закрываем весь дропдаун целиком при клике на айтем без потомков. Только при closeOnSelect === true.\n if (closeOnSelect && !hasDescendants) {\n handleGlobalToggle(false, event);\n }\n };\n\n const handleHover = () => {\n if (onHover) {\n onHover(index, item);\n }\n };\n\n return (\n <>\n {dividerBefore && <Divider variant={variant} />}\n\n <Wrapper\n {...rest}\n ref={ref}\n className={cx(isDisabledClassName, focusedClass, activeClass, className)}\n id={getItemId(treeId, value.toString())}\n role={itemRole}\n onClick={handleClick}\n onMouseEnter={handleHover}\n variant={variant}\n aria-disabled={disabled || isDisabled}\n aria-controls={ariaControls}\n aria-expanded={ariaExpanded}\n aria-level={ariaLevel}\n aria-label={ariaLabel}\n >\n {renderItem ? (\n <RenderItemWrapper>{renderItem(item)}</RenderItemWrapper>\n ) : (\n <CellWrapper>\n <StyledCell\n contentLeft={contentLeft}\n contentRight={contentRight}\n alignContentLeft=\"center\"\n alignContentRight=\"center\"\n title={label}\n />\n </CellWrapper>\n )}\n\n {item.items && hasArrow && (\n <DisclosureIconWrapper>\n <StyledIconDisclosureRight size={disclosureIconSize} color=\"inherit\" />\n </DisclosureIconWrapper>\n )}\n </Wrapper>\n\n {dividerAfter && <Divider variant={variant} />}\n </>\n );\n};\n"],"names":["DropdownItem","_ref","item","path","currentLevel","index","ariaControls","ariaExpanded","ariaLevel","ariaLabel","value","label","disabled","isDisabled","contentLeft","contentRight","dividerBefore","dividerAfter","className","rest","_objectWithoutProperties","_excluded","ref","useRef","_useContext","useContext","Context","focusedPath","size","variant","itemRole","handleGlobalToggle","closeOnSelect","onHover","onItemSelect","onItemClick","hasArrow","treeId","renderItem","hasDescendants","Boolean","items","disclosureIconSize","itemDisabled","isDisabledClassName","classes","dropdownItemIsDisabled","undefined","focusedClass","length","dropdownItemIsFocused","activeClass","dropdownItemIsActive","useEffect","current","scrollIntoView","behavior","block","inline","handleClick","event","stopPropagation","handleHover","React","createElement","Fragment","Divider","Wrapper","_extends","cx","id","getItemId","toString","role","onClick","onMouseEnter","RenderItemWrapper","CellWrapper","StyledCell","alignContentLeft","alignContentRight","title","DisclosureIconWrapper","StyledIconDisclosureRight","color"],"mappings":";;;;;;;;;IAkBaA,YAAmC,GAAG,SAAtCA,YAAmCA,CAAAC,IAAA,EAS1C;AAAA,EAAA,IARFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,SAAS,GAAAR,IAAA,CAATQ,SAAS,CAAA;AAET,EAAA,IACIC,KAAK,GAULR,IAAI,CAVJQ,KAAK;IACLC,KAAK,GASLT,IAAI,CATJS,KAAK;IACLC,QAAQ,GAQRV,IAAI,CARJU,QAAQ;IACRC,UAAU,GAOVX,IAAI,CAPJW,UAAU;IACVC,WAAW,GAMXZ,IAAI,CANJY,WAAW;IACXC,YAAY,GAKZb,IAAI,CALJa,YAAY;IACZC,aAAa,GAIbd,IAAI,CAJJc,aAAa;IACbC,YAAY,GAGZf,IAAI,CAHJe,YAAY;IACZC,SAAS,GAEThB,IAAI,CAFJgB,SAAS;AACNC,IAAAA,IAAI,GAAAC,wBAAA,CACPlB,IAAI,EAAAmB,SAAA,CAAA,CAAA;AAER,EAAA,IAAMC,GAAG,GAAGC,MAAM,CAAuB,IAAI,CAAC,CAAA;AAE9C,EAAA,IAAAC,WAAA,GAaIC,UAAU,CAACC,OAAO,CAAC;IAZnBC,WAAW,GAAAH,WAAA,CAAXG,WAAW;IACXC,IAAI,GAAAJ,WAAA,CAAJI,IAAI;IACJC,OAAO,GAAAL,WAAA,CAAPK,OAAO;IACPC,QAAQ,GAAAN,WAAA,CAARM,QAAQ;IACRC,kBA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O,EAAEA,OAAAA;AAAQ,GAAE,CAC/C,CAAC,CAAA;AAEX;;;;"}
|
@@ -195,8 +195,8 @@
|
|
195
195
|
.SelectAll_styles_ql2mqj_d19w91z6__b71a8639{background:var(--surface-solid-card);}
|
196
196
|
.SelectAll_styles_ql2mqj_d1nbef5q__b71a8639{height:0.0625rem;margin-top:var(--d1nbef5q-0);margin-right:var(--plasma-select-divider-margin-right);margin-left:var(--plasma-select-divider-margin-left);background:var(--plasma-select-divider-color);}
|
197
197
|
|
198
|
-
.
|
199
|
-
.
|
198
|
+
.Select_styles_dta4dl_lpxbau6__559b5dde{width:var(--lpxbau6-0);padding:calc(var(--plasma-select-padding) + var(--plasma-select-dropdown-border-width,0rem));border-radius:var(--plasma-select-border-radius);box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04), inset 0 0 0 var(--plasma-select-dropdown-border-width,0rem) var(--plasma-select-dropdown-border-color,transparent);}
|
199
|
+
.Select_styles_dta4dl_u1yey2x3__559b5dde{max-height:var(--u1yey2x3-0);overflow-x:hidden;overflow-y:var(--u1yey2x3-1);border-radius:calc(var(--plasma-select-border-radius) - 0.125rem - var(--plasma-select-dropdown-border-width,0rem));margin:0;padding:0;}
|
200
200
|
|
201
201
|
|
202
202
|
.SelectNative_styles_1r538h6_satm3n2__407ae55b{visibility:hidden;width:0;height:0;opacity:0;margin:0;padding:0;border:none;}
|
@@ -163,8 +163,8 @@
|
|
163
163
|
.SelectAll_styles_ql2mqj_d19w91z6__b71a8639{background:var(--surface-solid-card);}
|
164
164
|
.SelectAll_styles_ql2mqj_d1nbef5q__b71a8639{height:0.0625rem;margin-top:var(--d1nbef5q-0);margin-right:var(--plasma-select-divider-margin-right);margin-left:var(--plasma-select-divider-margin-left);background:var(--plasma-select-divider-color);}
|
165
165
|
|
166
|
-
.
|
167
|
-
.
|
166
|
+
.Select_styles_dta4dl_lpxbau6__559b5dde{width:var(--lpxbau6-0);padding:calc(var(--plasma-select-padding) + var(--plasma-select-dropdown-border-width,0rem));border-radius:var(--plasma-select-border-radius);box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04), inset 0 0 0 var(--plasma-select-dropdown-border-width,0rem) var(--plasma-select-dropdown-border-color,transparent);}
|
167
|
+
.Select_styles_dta4dl_u1yey2x3__559b5dde{max-height:var(--u1yey2x3-0);overflow-x:hidden;overflow-y:var(--u1yey2x3-1);border-radius:calc(var(--plasma-select-border-radius) - 0.125rem - var(--plasma-select-dropdown-border-width,0rem));margin:0;padding:0;}
|
168
168
|
|
169
169
|
|
170
170
|
.SelectNative_styles_1r538h6_satm3n2__407ae55b{visibility:hidden;width:0;height:0;opacity:0;margin:0;padding:0;border:none;}
|
@@ -163,8 +163,8 @@
|
|
163
163
|
.SelectAll_styles_ql2mqj_d19w91z6__b71a8639{background:var(--surface-solid-card);}
|
164
164
|
.SelectAll_styles_ql2mqj_d1nbef5q__b71a8639{height:0.0625rem;margin-top:var(--d1nbef5q-0);margin-right:var(--plasma-select-divider-margin-right);margin-left:var(--plasma-select-divider-margin-left);background:var(--plasma-select-divider-color);}
|
165
165
|
|
166
|
-
.
|
167
|
-
.
|
166
|
+
.Select_styles_dta4dl_lpxbau6__559b5dde{width:var(--lpxbau6-0);padding:calc(var(--plasma-select-padding) + var(--plasma-select-dropdown-border-width,0rem));border-radius:var(--plasma-select-border-radius);box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04), inset 0 0 0 var(--plasma-select-dropdown-border-width,0rem) var(--plasma-select-dropdown-border-color,transparent);}
|
167
|
+
.Select_styles_dta4dl_u1yey2x3__559b5dde{max-height:var(--u1yey2x3-0);overflow-x:hidden;overflow-y:var(--u1yey2x3-1);border-radius:calc(var(--plasma-select-border-radius) - 0.125rem - var(--plasma-select-dropdown-border-width,0rem));margin:0;padding:0;}
|
168
168
|
|
169
169
|
|
170
170
|
.SelectNative_styles_1r538h6_satm3n2__407ae55b{visibility:hidden;width:0;height:0;opacity:0;margin:0;padding:0;border:none;}
|
@@ -21,7 +21,7 @@ import { VirtualList } from './ui/VirtualList/VirtualList.js';
|
|
21
21
|
import { Inner } from './ui/Inner/Inner.js';
|
22
22
|
import { getView } from './utils/getView.js';
|
23
23
|
|
24
|
-
var _excluded = ["id", "value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "readOnly", "view", "size", "listOverflow", "listHeight", "listMaxHeight", "listWidth", "contentLeft", "onScrollBottom", "onScroll", "chipView", "variant", "portal", "renderValue", "renderItem", "status", "onItemSelect", "separator", "closeAfterSelect", "isTargetAmount", "beforeList", "afterList", "zIndex", "name", "defaultValue", "virtual", "onToggle", "chipType", "multiselect", "_offset", "required", "requiredPlacement", "hasRequiredIndicator", "optional", "hintText", "hintTrigger", "hintView", "hintSize", "hintTargetPlacement", "hintPlacement", "hintWidth", "hintHasArrow", "hasHint"];
|
24
|
+
var _excluded = ["id", "value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "readOnly", "view", "size", "listOverflow", "listHeight", "listMaxHeight", "listWidth", "contentLeft", "onScrollBottom", "onScroll", "chipView", "variant", "portal", "renderValue", "renderItem", "status", "onItemSelect", "separator", "closeAfterSelect", "isTargetAmount", "beforeList", "afterList", "zIndex", "name", "defaultValue", "virtual", "onToggle", "chipType", "multiselect", "mode", "_offset", "required", "requiredPlacement", "hasRequiredIndicator", "optional", "hintText", "hintTrigger", "hintView", "hintSize", "hintTargetPlacement", "hintPlacement", "hintWidth", "hintHasArrow", "hasHint"];
|
25
25
|
|
26
26
|
/**
|
27
27
|
* Выпадающий список. Поддерживает выбор одного или нескольких значений.
|
@@ -46,7 +46,6 @@ var selectRoot = function selectRoot(Root) {
|
|
46
46
|
readOnly = _props$readOnly === void 0 ? false : _props$readOnly,
|
47
47
|
outerView = props.view,
|
48
48
|
size = props.size,
|
49
|
-
listOverflow = props.listOverflow,
|
50
49
|
listHeight = props.listHeight,
|
51
50
|
listMaxHeight = props.listMaxHeight,
|
52
51
|
listWidth = props.listWidth,
|
@@ -72,6 +71,8 @@ var selectRoot = function selectRoot(Root) {
|
|
72
71
|
_props$virtual = props.virtual,
|
73
72
|
virtual = _props$virtual === void 0 ? false : _props$virtual,
|
74
73
|
onToggle = props.onToggle,
|
74
|
+
_props$mode = props.mode,
|
75
|
+
mode = _props$mode === void 0 ? 'default' : _props$mode,
|
75
76
|
_offset = props._offset,
|
76
77
|
required = props.required,
|
77
78
|
requiredPlacement = props.requiredPlacement,
|
@@ -122,6 +123,7 @@ var selectRoot = function selectRoot(Root) {
|
|
122
123
|
var activeDescendantItemValue = ((_getItemByFocused = getItemByFocused(focusedPath, focusedToValueMap)) === null || _getItemByFocused === void 0 ? void 0 : _getItemByFocused.value.toString()) || '';
|
123
124
|
var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
|
124
125
|
var treeId = safeUseId();
|
126
|
+
var listWrapperRef = useRef(null);
|
125
127
|
var view = target === 'textfield-like' && (disabled || readOnly) ? 'default' : getView(status, outerView);
|
126
128
|
|
127
129
|
// Собираем объект с пропсами для required и прокидываем их напрямую в компонент Textfield.
|
@@ -256,6 +258,11 @@ var selectRoot = function selectRoot(Root) {
|
|
256
258
|
type: 'reset'
|
257
259
|
});
|
258
260
|
}
|
261
|
+
|
262
|
+
// Закрываем список, если элемент уже выбран.
|
263
|
+
if (mode === 'radio' && isCurrentChecked) {
|
264
|
+
return;
|
265
|
+
}
|
259
266
|
if (onChange) {
|
260
267
|
onChange(isCurrentChecked ? '' : item.value, item);
|
261
268
|
}
|
@@ -410,12 +417,12 @@ var selectRoot = function selectRoot(Root) {
|
|
410
417
|
disabled: disabled,
|
411
418
|
readOnly: readOnly
|
412
419
|
}, rest), /*#__PURE__*/React.createElement(ListWrapper, {
|
420
|
+
ref: listWrapperRef,
|
413
421
|
listWidth: listWidth
|
414
422
|
}, /*#__PURE__*/React.createElement(Ul, {
|
415
423
|
role: "tree",
|
416
424
|
id: "".concat(treeId, "_tree_level_1"),
|
417
425
|
"aria-multiselectable": Boolean(props.multiselect),
|
418
|
-
listOverflow: listOverflow,
|
419
426
|
listMaxHeight: listMaxHeight || listHeight,
|
420
427
|
onScroll: virtual ? undefined : handleScroll,
|
421
428
|
ref: targetRef,
|
@@ -438,7 +445,8 @@ var selectRoot = function selectRoot(Root) {
|
|
438
445
|
path: path,
|
439
446
|
dispatchPath: dispatchPath,
|
440
447
|
index: index,
|
441
|
-
listWidth: listWidth
|
448
|
+
listWidth: listWidth,
|
449
|
+
portal: listWrapperRef
|
442
450
|
});
|
443
451
|
}), afterList))))));
|
444
452
|
});
|