@salutejs/plasma-new-hope 0.336.0-canary.2216.17549652479.0 → 0.336.0-canary.2218.17560383957.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 +22 -23
- 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/DatePicker/RangeDate/RangeDate.js +10 -0
- package/cjs/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- 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 +20 -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/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 +4 -3
- 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/index.css +10 -10
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +20 -22
- 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/DatePicker/RangeDate/RangeDate.js +10 -0
- 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 +21 -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/Select/Select.js +4 -2
- 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/es/components/Combobox/ComboboxNew/Combobox.js +20 -22
- 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/DatePicker/RangeDate/RangeDate.js +10 -0
- 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 +22 -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/Select/Select.js +4 -2
- 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/es/components/Combobox/ComboboxNew/Combobox.css +6 -6
- package/es/components/Combobox/ComboboxNew/Combobox.js +22 -23
- 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/DatePicker/RangeDate/RangeDate.js +10 -0
- package/es/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- 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 +22 -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/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 +4 -3
- 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/index.css +10 -10
- package/package.json +5 -5
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +20 -22
- 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/DatePicker/RangeDate/RangeDate.js +10 -0
- 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 +21 -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/Select/Select.js +4 -2
- 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/es/components/Combobox/ComboboxNew/Combobox.js +20 -22
- 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/DatePicker/RangeDate/RangeDate.js +10 -0
- 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 +22 -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/Select/Select.js +4 -2
- 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/examples/components/Combobox/Combobox.js +0 -7
- 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 +6 -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/DatePicker/RangeDate/RangeDate.d.ts.map +1 -1
- package/types/components/Drawer/hooks/useDrawer.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.d.ts +4 -4
- 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 +8 -8
- 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/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +6 -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 +10 -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 +6 -6
- package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.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 +24 -24
- package/types/examples/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/components/Dropdown/Dropdown.d.ts +2 -2
- package/types/examples/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/types/examples/components/Select/Select.d.ts +6 -6
- package/types/examples/components/Select/Select.d.ts.map +1 -1
@@ -35,6 +35,7 @@ var FloatingPopover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
35
35
|
},
|
36
36
|
placement: placement === 'auto' ? undefined : placement,
|
37
37
|
open: opened,
|
38
|
+
onOpenChange: onToggle,
|
38
39
|
middleware: [placement === 'auto' && react.autoPlacement(), react.offset({
|
39
40
|
mainAxis: isInner ? LIST_PADDING * 2 : offset[1],
|
40
41
|
crossAxis: isInner ? -LIST_PADDING : offset[0]
|
@@ -43,40 +44,23 @@ var FloatingPopover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
43
44
|
}), react.shift()]
|
44
45
|
}),
|
45
46
|
refs = _useFloating.refs,
|
46
|
-
floatingStyles = _useFloating.floatingStyles
|
47
|
+
floatingStyles = _useFloating.floatingStyles,
|
48
|
+
context = _useFloating.context;
|
47
49
|
var wrappedId = react$1.safeUseId();
|
48
|
-
var
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
};
|
56
|
-
var
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
var handleTargetMouseLeave = function handleTargetMouseLeave(event) {
|
63
|
-
if (event.relatedTarget instanceof HTMLElement && refs.floating.current instanceof HTMLElement) {
|
64
|
-
var _refs$floating$curren;
|
65
|
-
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)) {
|
66
|
-
return;
|
67
|
-
}
|
68
|
-
onToggle(false, event);
|
69
|
-
}
|
70
|
-
};
|
71
|
-
var handleFloatingMouseLeave = function handleFloatingMouseLeave(event) {
|
72
|
-
if (event.relatedTarget instanceof HTMLElement && refs.reference.current instanceof HTMLElement) {
|
73
|
-
var _refs$reference$curre;
|
74
|
-
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)) {
|
75
|
-
return;
|
76
|
-
}
|
77
|
-
onToggle(false, event);
|
78
|
-
}
|
79
|
-
};
|
50
|
+
var hover = react.useHover(context, {
|
51
|
+
enabled: trigger === 'hover',
|
52
|
+
delay: {
|
53
|
+
open: 0,
|
54
|
+
close: 50
|
55
|
+
},
|
56
|
+
handleClose: react.safePolygon()
|
57
|
+
});
|
58
|
+
var click = react.useClick(context, {
|
59
|
+
stickIfOpen: false,
|
60
|
+
ignoreMouse: trigger === 'hover'
|
61
|
+
});
|
62
|
+
var _useInteractions = react.useInteractions([hover, click]),
|
63
|
+
getReferenceProps = _useInteractions.getReferenceProps;
|
80
64
|
return /*#__PURE__*/React__default.default.createElement("div", {
|
81
65
|
ref: ref,
|
82
66
|
id: wrappedId,
|
@@ -84,14 +68,10 @@ var FloatingPopover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
84
68
|
position: 'relative',
|
85
69
|
display: isInner ? 'block' : 'inline-block'
|
86
70
|
}
|
87
|
-
}, /*#__PURE__*/React__default.default.createElement("div", {
|
88
|
-
ref: refs.setReference
|
89
|
-
|
90
|
-
onMouseEnter: handleTargetMouseEnter,
|
91
|
-
onMouseLeave: handleTargetMouseLeave
|
92
|
-
}, target), opened && /*#__PURE__*/React__default.default.createElement(react.FloatingPortal, getFloatingPortalProps(portal, wrappedId), /*#__PURE__*/React__default.default.createElement("div", {
|
71
|
+
}, /*#__PURE__*/React__default.default.createElement("div", _rollupPluginBabelHelpers.extends({
|
72
|
+
ref: refs.setReference
|
73
|
+
}, getReferenceProps()), target), opened && /*#__PURE__*/React__default.default.createElement(react.FloatingPortal, getFloatingPortalProps(portal, wrappedId), /*#__PURE__*/React__default.default.createElement("div", {
|
93
74
|
ref: refs.setFloating,
|
94
|
-
onMouseLeave: handleFloatingMouseLeave,
|
95
75
|
style: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, floatingStyles), {}, {
|
96
76
|
zIndex: zIndex || 1000
|
97
77
|
})
|
@@ -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 });\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","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,gBAAU,CAC9B,UAAAC,IAAA,EAAuGC,GAAG,EAAK;AAAA,EAAA,IAA5GC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAEC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,SAAS,GAAAN,IAAA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A;IACIrD,GAAG,EAAEiC,IAAI,CAAC6B,WAAY;AACtBP,IAAAA,KAAK,EAAAQ,uCAAA,CAAAA,uCAAA,KACE7B,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,IAAM2D,sBAAsB,GAAG,SAAzBA,sBAAsBA,CACxBvD,MAAsC,EACtC8B,SAAiB,EACa;EAC9B,IAAI,CAAC9B,MAAM,EAAE;IACT,OAAO;AAAEgD,MAAAA,EAAE,EAAElB,SAAAA;KAAW,CAAA;AAC5B,GAAA;AAEA,EAAA,IAAI,OAAO9B,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAO;AAAEgD,MAAAA,EAAE,EAAEhD,MAAAA;KAAQ,CAAA;AACzB,GAAA;EAEA,OAAO;AAAE0D,IAAAA,IAAI,EAAE1D,MAAAA;GAAQ,CAAA;AAC3B,CAAC;;;;"}
|
@@ -175,13 +175,9 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
175
175
|
case keys.Tab:
|
176
176
|
case keys.Escape:
|
177
177
|
{
|
178
|
-
|
179
|
-
|
180
|
-
}
|
181
|
-
dispatchPath({
|
182
|
-
type: 'reset'
|
183
|
-
});
|
184
|
-
handleGlobalToggle(false, event);
|
178
|
+
if (path[0]) {
|
179
|
+
handleGlobalToggle(false, event);
|
180
|
+
}
|
185
181
|
break;
|
186
182
|
}
|
187
183
|
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,CAAC,CAAA;AACrD,CAAC,CAAA;IAmBYO,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAWD;AAAA,EAAA,IAVxBV,WAAW,GAAAU,IAAA,CAAXV,WAAW;IACXW,mBAAmB,GAAAD,IA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;AAC3B0B,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;AAAEC,cAAAA,KAAK,EAAE,CAAA;AAAE,aAAC,CAAC,CAAA;AAChE,WAAC,MAAM;AACHf,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEP,YAAY,GAAGlC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;MAEA,KAAKC,IAAI,CAACY,QAAQ;AAAE,QAAA;AAChB,UAAA,IAAI,CAACc,IAAI,CAAC,CAAC,CAAC,EAAE;AACV,YAAA,MAAA;AACJ,WAAA;AAEA,UAAA,IAAIA,IAAI,CAACQ,MAAM,GAAGpB,WAAW,CAACoB,MAAM,EAAE;AAClCP,YAAAA,YAAY,CAAC;AAAEY,cAAAA,IAAI,EAAE,oBAAA;AAAqB,aAAC,CAAC,CAAA;AAChD,WAAA;AAEA,UAAA,IAAIJ,aAAa,GAAGF,YAAY,IAAIlC,SAAS,EAAE;AAC3C0B,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEL,aAAa,GAAG,CAAA;AAAE,aAAC,CAAC,CAAA;AAChF,WAAC,MAAM;AACHV,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEP,YAAY,GAAGlC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;AAKJ,KAAA;GACH,CAAA;EAED,OAAO;AAAEqC,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;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,OAAON,iBAAiB,CAACO,GAAG,CAACN,mBAAmB,CAAC,CAAA;AACrD,CAAC,CAAA;IAmBYO,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAWD;AAAA,EAAA,IAVxBV,WAAW,GA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;AAAEC,cAAAA,KAAK,EAAE,CAAA;AAAE,aAAC,CAAC,CAAA;AAChE,WAAC,MAAM;AACHf,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEP,YAAY,GAAGlC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;MAEA,KAAKC,IAAI,CAACY,QAAQ;AAAE,QAAA;AAChB,UAAA,IAAI,CAACc,IAAI,CAAC,CAAC,CAAC,EAAE;AACV,YAAA,MAAA;AACJ,WAAA;AAEA,UAAA,IAAIA,IAAI,CAACQ,MAAM,GAAGpB,WAAW,CAACoB,MAAM,EAAE;AAClCP,YAAAA,YAAY,CAAC;AAAEY,cAAAA,IAAI,EAAE,oBAAA;AAAqB,aAAC,CAAC,CAAA;AAChD,WAAA;AAEA,UAAA,IAAIJ,aAAa,GAAGF,YAAY,IAAIlC,SAAS,EAAE;AAC3C0B,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEL,aAAa,GAAG,CAAA;AAAE,aAAC,CAAC,CAAA;AAChF,WAAC,MAAM;AACHV,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEP,YAAY,GAAGlC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;AAKJ,KAAA;GACH,CAAA;EAED,OAAO;AAAEqC,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACxB;;;;;"}
|
@@ -24,6 +24,6 @@
|
|
24
24
|
.DropdownItem_styles_1algi32_w1jav4ek__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
|
|
@@ -20,9 +20,8 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
20
20
|
dispatchPath = _ref.dispatchPath,
|
21
21
|
index = _ref.index,
|
22
22
|
trigger = _ref.trigger,
|
23
|
-
|
24
|
-
|
25
|
-
listWidth = _ref.listWidth;
|
23
|
+
listWidth = _ref.listWidth,
|
24
|
+
portal = _ref.portal;
|
26
25
|
var handleToggle = function handleToggle(opened) {
|
27
26
|
if (opened) {
|
28
27
|
dispatchPath({
|
@@ -37,6 +36,7 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
37
36
|
});
|
38
37
|
}
|
39
38
|
};
|
39
|
+
var listWrapperRef = React.useRef(null);
|
40
40
|
var isCurrentListOpen = path[currentLevel + 1] === item.value.toString();
|
41
41
|
var treeId = react.safeUseId();
|
42
42
|
var listId = "".concat(treeId, "_tree_level_").concat(currentLevel + 2);
|
@@ -57,14 +57,15 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
57
57
|
ariaLevel: nextLevel,
|
58
58
|
ariaLabel: item.label
|
59
59
|
}),
|
60
|
-
isInner: true
|
60
|
+
isInner: true,
|
61
|
+
portal: portal
|
61
62
|
}, /*#__PURE__*/React__default.default.createElement(Dropdown_styles.ListWrapper, {
|
63
|
+
ref: listWrapperRef,
|
62
64
|
listWidth: listWidth
|
63
65
|
}, /*#__PURE__*/React__default.default.createElement(Dropdown_styles.Ul, {
|
64
66
|
id: listId,
|
65
67
|
role: "group",
|
66
|
-
listMaxHeight: listMaxHeight
|
67
|
-
listOverflow: listOverflow
|
68
|
+
listMaxHeight: item.listMaxHeight
|
68
69
|
}, item.items.map(function (innerItem, innerIndex) {
|
69
70
|
return /*#__PURE__*/React__default.default.createElement(DropdownInner, {
|
70
71
|
key: "".concat(innerIndex, "/").concat(currentLevel),
|
@@ -74,9 +75,8 @@ var DropdownInner = function DropdownInner(_ref) {
|
|
74
75
|
dispatchPath: dispatchPath,
|
75
76
|
index: innerIndex,
|
76
77
|
trigger: trigger,
|
77
|
-
|
78
|
-
|
79
|
-
listWidth: listWidth
|
78
|
+
listWidth: listWidth,
|
79
|
+
portal: listWrapperRef
|
80
80
|
});
|
81
81
|
}))));
|
82
82
|
}
|
@@ -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;AACrG,KAAC,MAAM;AACHE,MAAAA,YAAY,CAAC;AAAEO,QAAAA,IAAI,EAAE,cAAc;QAAEG,KAAK,EAAEZ,YAAY,GAAG,CAAA;AAAE,OAAC,CAAC,CAAA;AACnE,KAAA;GACH,CAAA;AAED,EAAA,IAAMa,cAAc,GAAGC,YAAM,CAAiB,IAAI,CAAC,CAAA;AAEnD,EAAA,IAAMC,iBAAiB,GAAGd,IAAI,CAACD,YAAY,GAAG,CAAC,CAAC,KAAKD,IAAI,C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,cAAe;AAACR,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KAAA,eACnDiB,sBAAA,CAAAC,aAAA,CAACe,kBAAE,EAAA;AAACC,MAAAA,EAAE,EAAErB,MAAO;AAACsB,MAAAA,IAAI,EAAC,OAAO;MAACC,aAAa,EAAE1C,IAAI,CAAC0C,aAAAA;KAC5C1C,EAAAA,IAAI,CAACsB,KAAK,CAACqB,GAAG,CAAC,UAACC,SAAS,EAAEC,UAAU,EAAA;AAAA,MAAA,oBAClCtB,sBAAA,CAAAC,aAAA,CAAC1B,aAAa,EAAA;QACVgD,GAAG,EAAA,EAAA,CAAA1B,MAAA,CAAKyB,UAAU,OAAAzB,MAAA,CAAInB,YAAY,CAAG;AACrCD,QAAAA,IAAI,EAAE4C,SAAU;AAChB3C,QAAAA,YAAY,EAAEoB,SAAU;AACxBnB,QAAAA,IAAI,EAAEA,IAAK;AACXC,QAAAA,YAAY,EAAEA,YAAa;AAC3BC,QAAAA,KAAK,EAAEyC,UAAW;AAClBxC,QAAAA,OAAO,EAAEA,OAAQ;AACjBC,QAAAA,SAAS,EAAEA,SAAU;AACrBC,QAAAA,MAAM,EAAEO,cAAAA;AAAe,OAC1B,CAAC,CAAA;KACL,CACD,CACK,CACA,CAAC,CAAA;AAE1B,GAAA;AAEA,EAAA,oBAAOS,sBAAA,CAAAC,aAAA,CAACM,yBAAY,EAAA;AAAC9B,IAAAA,IAAI,EAAEA,IAAK;AAACE,IAAAA,IAAI,EAAEA,IAAK;AAACE,IAAAA,KAAK,EAAEA,KAAM;AAACH,IAAAA,YAAY,EAAEA,YAAa;AAACgC,IAAAA,SAAS,EAAEZ,SAAAA;AAAU,GAAE,CAAC,CAAA;AACnH;;;;"}
|
@@ -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;}
|
@@ -54,7 +54,6 @@ var selectRoot = function selectRoot(Root) {
|
|
54
54
|
readOnly = _props$readOnly === void 0 ? false : _props$readOnly,
|
55
55
|
outerView = props.view,
|
56
56
|
size = props.size,
|
57
|
-
listOverflow = props.listOverflow,
|
58
57
|
listHeight = props.listHeight,
|
59
58
|
listMaxHeight = props.listMaxHeight,
|
60
59
|
listWidth = props.listWidth,
|
@@ -130,6 +129,7 @@ var selectRoot = function selectRoot(Root) {
|
|
130
129
|
var activeDescendantItemValue = ((_getItemByFocused = useKeyboardNavigation.getItemByFocused(focusedPath, focusedToValueMap)) === null || _getItemByFocused === void 0 ? void 0 : _getItemByFocused.value.toString()) || '';
|
131
130
|
var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
|
132
131
|
var treeId = react.safeUseId();
|
132
|
+
var listWrapperRef = React.useRef(null);
|
133
133
|
var view = target === 'textfield-like' && (disabled || readOnly) ? 'default' : getView.getView(status, outerView);
|
134
134
|
|
135
135
|
// Собираем объект с пропсами для required и прокидываем их напрямую в компонент Textfield.
|
@@ -418,12 +418,12 @@ var selectRoot = function selectRoot(Root) {
|
|
418
418
|
disabled: disabled,
|
419
419
|
readOnly: readOnly
|
420
420
|
}, rest), /*#__PURE__*/React__default.default.createElement(Select_styles.ListWrapper, {
|
421
|
+
ref: listWrapperRef,
|
421
422
|
listWidth: listWidth
|
422
423
|
}, /*#__PURE__*/React__default.default.createElement(Select_styles.Ul, {
|
423
424
|
role: "tree",
|
424
425
|
id: "".concat(treeId, "_tree_level_1"),
|
425
426
|
"aria-multiselectable": Boolean(props.multiselect),
|
426
|
-
listOverflow: listOverflow,
|
427
427
|
listMaxHeight: listMaxHeight || listHeight,
|
428
428
|
onScroll: virtual ? undefined : handleScroll,
|
429
429
|
ref: targetRef,
|
@@ -446,7 +446,8 @@ var selectRoot = function selectRoot(Root) {
|
|
446
446
|
path: path,
|
447
447
|
dispatchPath: dispatchPath,
|
448
448
|
index: index,
|
449
|
-
listWidth: listWidth
|
449
|
+
listWidth: listWidth,
|
450
|
+
portal: listWrapperRef
|
450
451
|
});
|
451
452
|
}), afterList))))));
|
452
453
|
});
|