@salutejs/plasma-new-hope 0.78.0-canary.1201.8969250152.0 → 0.78.0-canary.1201.8985207823.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/Combobox.css +3 -0
- package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +3 -0
- package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +3 -0
- package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +3 -0
- package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +3 -0
- package/cjs/components/Dropdown/Dropdown.css +3 -0
- package/cjs/components/Dropdown/Dropdown.js +5 -2
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/Dropdown/hooks/useHashMaps.js +2 -2
- package/cjs/components/Dropdown/hooks/useHashMaps.js.map +1 -1
- package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +185 -162
- package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +4 -1
- package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +29 -0
- package/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles.js.map +1 -0
- package/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles_3w3l45.css +2 -0
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.css +7 -0
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +99 -0
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -0
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +115 -0
- package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js.map +1 -0
- package/cjs/components/Dropdown/ui/DropdownOld/utils/index.js +23 -0
- package/cjs/components/Dropdown/ui/DropdownOld/utils/index.js.map +1 -0
- package/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base.js +9 -0
- package/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base.js.map +1 -0
- package/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base_x642ct.css +1 -0
- package/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base.js +9 -0
- package/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base.js.map +1 -0
- package/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base_x642ct.css +1 -0
- package/cjs/components/Pagination/Pagination.css +3 -0
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +3 -0
- package/cjs/components/Select/Select.css +3 -0
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.css +3 -0
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.css +3 -0
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.css +3 -0
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.css +3 -0
- package/cjs/components/Select/ui/SelectItem/SelectItem.css +3 -0
- package/cjs/index.css +3 -0
- package/cjs/index.js +5 -0
- package/cjs/index.js.map +1 -1
- package/es/components/Combobox/Combobox.css +3 -0
- package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +3 -0
- package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +3 -0
- package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +3 -0
- package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +3 -0
- package/es/components/Dropdown/Dropdown.css +3 -0
- package/es/components/Dropdown/Dropdown.js +5 -2
- package/es/components/Dropdown/Dropdown.js.map +1 -1
- package/es/components/Dropdown/hooks/useHashMaps.js +2 -2
- package/es/components/Dropdown/hooks/useHashMaps.js.map +1 -1
- package/es/components/Dropdown/hooks/useKeyboardNavigation.js +185 -162
- package/es/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +4 -1
- package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +24 -0
- package/es/components/Dropdown/ui/DropdownOld/Dropdown.styles.js.map +1 -0
- package/es/components/Dropdown/ui/DropdownOld/Dropdown.styles_3w3l45.css +2 -0
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.css +7 -0
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +94 -0
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -0
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +111 -0
- package/es/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js.map +1 -0
- package/es/components/Dropdown/ui/DropdownOld/utils/index.js +18 -0
- package/es/components/Dropdown/ui/DropdownOld/utils/index.js.map +1 -0
- package/es/components/Dropdown/ui/DropdownOld/variations/_size/base.js +5 -0
- package/es/components/Dropdown/ui/DropdownOld/variations/_size/base.js.map +1 -0
- package/es/components/Dropdown/ui/DropdownOld/variations/_size/base_x642ct.css +1 -0
- package/es/components/Dropdown/ui/DropdownOld/variations/_view/base.js +5 -0
- package/es/components/Dropdown/ui/DropdownOld/variations/_view/base.js.map +1 -0
- package/es/components/Dropdown/ui/DropdownOld/variations/_view/base_x642ct.css +1 -0
- package/es/components/Pagination/Pagination.css +3 -0
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +3 -0
- package/es/components/Select/Select.css +3 -0
- package/es/components/Select/ui/SelectDivider/SelectDivider.css +3 -0
- package/es/components/Select/ui/SelectFooter/SelectFooter.css +3 -0
- package/es/components/Select/ui/SelectGroup/SelectGroup.css +3 -0
- package/es/components/Select/ui/SelectHeader/SelectHeader.css +3 -0
- package/es/components/Select/ui/SelectItem/SelectItem.css +3 -0
- package/es/index.css +3 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Dropdown/Dropdown.js +2 -2
- package/styled-components/cjs/components/Dropdown/hooks/useHashMaps.js +2 -2
- package/styled-components/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +189 -162
- package/styled-components/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +19 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/Dropdown.types.js +5 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +101 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +118 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/utils/index.js +21 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base.js +8 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_size/tokens.json +1 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base.js +8 -0
- package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_view/tokens.json +1 -0
- package/styled-components/cjs/components/Dropdown/ui/index.js +21 -1
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.config.js +25 -0
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.stories.tsx +292 -0
- package/styled-components/es/components/Dropdown/Dropdown.js +2 -2
- package/styled-components/es/components/Dropdown/hooks/useHashMaps.js +2 -2
- package/styled-components/es/components/Dropdown/hooks/useKeyboardNavigation.js +189 -162
- package/styled-components/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +1 -1
- package/styled-components/es/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +13 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/Dropdown.types.js +1 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +92 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +112 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/utils/index.js +15 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_size/base.js +2 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_size/tokens.json +1 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_view/base.js +2 -0
- package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_view/tokens.json +1 -0
- package/styled-components/es/components/Dropdown/ui/index.js +3 -1
- package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.config.js +19 -0
- package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.js +5 -0
- package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.stories.tsx +292 -0
- package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownOld/Dropdown.styles.d.ts +8 -0
- package/types/components/Dropdown/ui/DropdownOld/Dropdown.styles.d.ts.map +1 -0
- package/types/components/Dropdown/ui/DropdownOld/Dropdown.types.d.ts +76 -0
- package/types/components/Dropdown/ui/DropdownOld/Dropdown.types.d.ts.map +1 -0
- package/types/components/Dropdown/ui/DropdownOld/DropdownOld.d.ts +26 -0
- package/types/components/Dropdown/ui/DropdownOld/DropdownOld.d.ts.map +1 -0
- package/types/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.d.ts +113 -0
- package/types/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.d.ts.map +1 -0
- package/types/components/Dropdown/ui/DropdownOld/utils/index.d.ts +4 -0
- package/types/components/Dropdown/ui/DropdownOld/utils/index.d.ts.map +1 -0
- package/types/components/Dropdown/ui/DropdownOld/variations/_size/base.d.ts +2 -0
- package/types/components/Dropdown/ui/DropdownOld/variations/_size/base.d.ts.map +1 -0
- package/types/components/Dropdown/ui/DropdownOld/variations/_view/base.d.ts +2 -0
- package/types/components/Dropdown/ui/DropdownOld/variations/_view/base.d.ts.map +1 -0
- package/types/components/Dropdown/ui/index.d.ts +2 -0
- package/types/components/Dropdown/ui/index.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Dropdown/Dropdown.config.d.ts +18 -0
- package/types/examples/plasma_web/components/Dropdown/Dropdown.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Dropdown/Dropdown.d.ts +13 -0
- package/types/examples/plasma_web/components/Dropdown/Dropdown.d.ts.map +1 -0
@@ -39,180 +39,207 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
39
39
|
var currentLength = pathMap.get(path === null || path === void 0 ? void 0 : path[path.length - 1]) || 0;
|
40
40
|
var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
|
41
41
|
var onKeyDown = function onKeyDown(event) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
if (code === keys.ArrowDown) {
|
63
|
-
if (focusedPath.length) {
|
64
|
-
if (currentIndex + 1 >= currentLength) {
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
dispatchFocusedPath({
|
68
|
-
type: 'change_last_focus',
|
69
|
-
value: currentIndex + 1
|
70
|
-
});
|
71
|
-
} else {
|
72
|
-
dispatchPath({
|
73
|
-
type: 'opened_first_level'
|
74
|
-
});
|
75
|
-
dispatchFocusedPath({
|
76
|
-
type: 'set_initial_focus'
|
77
|
-
});
|
78
|
-
handleGlobalToggle(true, event);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
if (code === keys.ArrowLeft) {
|
82
|
-
if (focusedPath.length) {
|
83
|
-
dispatchPath({
|
84
|
-
type: 'removed_last_level'
|
85
|
-
});
|
86
|
-
dispatchFocusedPath({
|
87
|
-
type: 'return_prev_focus'
|
88
|
-
});
|
89
|
-
}
|
90
|
-
if (focusedPath.length === 1) {
|
91
|
-
handleGlobalToggle(false, event);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
if (code === keys.ArrowRight) {
|
95
|
-
if (focusedPath.length) {
|
96
|
-
var currentItem = getFurtherPath(focusedPath, focusedToValueMap);
|
97
|
-
if (currentItem !== null && currentItem !== void 0 && currentItem.items) {
|
98
|
-
dispatchPath({
|
99
|
-
type: 'added_next_level',
|
100
|
-
value: currentItem.value.toString()
|
101
|
-
});
|
102
|
-
dispatchFocusedPath({
|
103
|
-
type: 'add_focus',
|
104
|
-
value: 0
|
105
|
-
});
|
42
|
+
switch (event.code) {
|
43
|
+
case keys.ArrowUp:
|
44
|
+
{
|
45
|
+
if (focusedPath.length) {
|
46
|
+
if (currentIndex > 0) {
|
47
|
+
dispatchFocusedPath({
|
48
|
+
type: 'change_last_focus',
|
49
|
+
value: currentIndex - 1
|
50
|
+
});
|
51
|
+
}
|
52
|
+
} else {
|
53
|
+
dispatchPath({
|
54
|
+
type: 'opened_first_level'
|
55
|
+
});
|
56
|
+
dispatchFocusedPath({
|
57
|
+
type: 'set_initial_focus'
|
58
|
+
});
|
59
|
+
handleGlobalToggle(true, event);
|
60
|
+
}
|
61
|
+
break;
|
106
62
|
}
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
63
|
+
case keys.ArrowDown:
|
64
|
+
{
|
65
|
+
if (focusedPath.length) {
|
66
|
+
if (currentIndex + 1 < currentLength) {
|
67
|
+
dispatchFocusedPath({
|
68
|
+
type: 'change_last_focus',
|
69
|
+
value: currentIndex + 1
|
70
|
+
});
|
71
|
+
}
|
72
|
+
} else {
|
73
|
+
dispatchPath({
|
74
|
+
type: 'opened_first_level'
|
75
|
+
});
|
76
|
+
dispatchFocusedPath({
|
77
|
+
type: 'set_initial_focus'
|
78
|
+
});
|
79
|
+
handleGlobalToggle(true, event);
|
80
|
+
}
|
81
|
+
break;
|
115
82
|
}
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
if (
|
83
|
+
case keys.ArrowLeft:
|
84
|
+
{
|
85
|
+
if (focusedPath.length) {
|
86
|
+
dispatchPath({
|
87
|
+
type: 'removed_last_level'
|
88
|
+
});
|
89
|
+
dispatchFocusedPath({
|
90
|
+
type: 'return_prev_focus'
|
91
|
+
});
|
92
|
+
}
|
93
|
+
if (focusedPath.length === 1) {
|
127
94
|
handleGlobalToggle(false, event);
|
128
95
|
}
|
129
|
-
|
130
|
-
|
96
|
+
break;
|
97
|
+
}
|
98
|
+
case keys.ArrowRight:
|
99
|
+
{
|
100
|
+
if (focusedPath.length) {
|
101
|
+
var currentItem = getFurtherPath(focusedPath, focusedToValueMap);
|
102
|
+
if (currentItem !== null && currentItem !== void 0 && currentItem.items) {
|
103
|
+
dispatchPath({
|
104
|
+
type: 'added_next_level',
|
105
|
+
value: currentItem.value.toString()
|
106
|
+
});
|
107
|
+
dispatchFocusedPath({
|
108
|
+
type: 'add_focus',
|
109
|
+
value: 0
|
110
|
+
});
|
111
|
+
}
|
131
112
|
}
|
132
|
-
|
133
|
-
|
113
|
+
break;
|
114
|
+
}
|
115
|
+
case keys.Enter:
|
116
|
+
case keys.Space:
|
117
|
+
{
|
118
|
+
event.preventDefault();
|
119
|
+
if (path[0]) {
|
120
|
+
var _currentItem = getFurtherPath(focusedPath, focusedToValueMap);
|
121
|
+
if (_currentItem !== null && _currentItem !== void 0 && _currentItem.disabled || _currentItem !== null && _currentItem !== void 0 && _currentItem.isDisabled) {
|
122
|
+
break;
|
123
|
+
}
|
124
|
+
if (_currentItem !== null && _currentItem !== void 0 && _currentItem.items) {
|
125
|
+
dispatchPath({
|
126
|
+
type: 'added_next_level',
|
127
|
+
value: _currentItem.value.toString()
|
128
|
+
});
|
129
|
+
dispatchFocusedPath({
|
130
|
+
type: 'add_focus',
|
131
|
+
value: 0
|
132
|
+
});
|
133
|
+
} else {
|
134
|
+
if (closeOnSelect) {
|
135
|
+
handleGlobalToggle(false, event);
|
136
|
+
}
|
137
|
+
if (onItemSelect && _currentItem) {
|
138
|
+
onItemSelect(_currentItem, event);
|
139
|
+
}
|
140
|
+
if (onItemClick && _currentItem) {
|
141
|
+
onItemClick(_currentItem, event);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
} else {
|
145
|
+
dispatchPath({
|
146
|
+
type: 'opened_first_level'
|
147
|
+
});
|
148
|
+
dispatchFocusedPath({
|
149
|
+
type: 'set_initial_focus'
|
150
|
+
});
|
134
151
|
}
|
152
|
+
break;
|
135
153
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
});
|
140
|
-
dispatchFocusedPath({
|
141
|
-
type: 'set_initial_focus'
|
142
|
-
});
|
143
|
-
}
|
144
|
-
}
|
145
|
-
if (code === keys.Tab || code === keys.Escape) {
|
146
|
-
dispatchFocusedPath({
|
147
|
-
type: 'reset'
|
148
|
-
});
|
149
|
-
dispatchPath({
|
150
|
-
type: 'reset'
|
151
|
-
});
|
152
|
-
handleGlobalToggle(false, event);
|
153
|
-
}
|
154
|
-
if (code === keys.Home) {
|
155
|
-
if (path[0]) {
|
156
|
-
dispatchFocusedPath({
|
157
|
-
type: 'change_last_focus',
|
158
|
-
value: 0
|
159
|
-
});
|
160
|
-
} else {
|
161
|
-
dispatchPath({
|
162
|
-
type: 'opened_first_level'
|
163
|
-
});
|
164
|
-
dispatchFocusedPath({
|
165
|
-
type: 'set_initial_focus'
|
166
|
-
});
|
167
|
-
handleGlobalToggle(true, event);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
if (code === keys.End) {
|
171
|
-
if (path[0]) {
|
172
|
-
dispatchFocusedPath({
|
173
|
-
type: 'change_last_focus',
|
174
|
-
value: currentLength - 1
|
175
|
-
});
|
176
|
-
} else {
|
177
|
-
dispatchPath({
|
178
|
-
type: 'opened_first_level'
|
179
|
-
});
|
180
|
-
dispatchFocusedPath({
|
181
|
-
type: 'change_last_focus',
|
182
|
-
value: (pathMap.get('root') || 0) - 1
|
183
|
-
});
|
184
|
-
handleGlobalToggle(true, event);
|
185
|
-
}
|
186
|
-
}
|
187
|
-
if (code === keys.PageUp) {
|
188
|
-
if (path[0]) {
|
189
|
-
if (currentIndex <= JUMP_SIZE) {
|
154
|
+
case keys.Tab:
|
155
|
+
case keys.Escape:
|
156
|
+
{
|
190
157
|
dispatchFocusedPath({
|
191
|
-
type: '
|
192
|
-
value: 0
|
158
|
+
type: 'reset'
|
193
159
|
});
|
194
|
-
|
195
|
-
|
196
|
-
type: 'change_last_focus',
|
197
|
-
value: currentIndex - JUMP_SIZE
|
160
|
+
dispatchPath({
|
161
|
+
type: 'reset'
|
198
162
|
});
|
163
|
+
handleGlobalToggle(false, event);
|
164
|
+
break;
|
199
165
|
}
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
166
|
+
case keys.Home:
|
167
|
+
{
|
168
|
+
if (path[0]) {
|
169
|
+
dispatchFocusedPath({
|
170
|
+
type: 'change_last_focus',
|
171
|
+
value: 0
|
172
|
+
});
|
173
|
+
} else {
|
174
|
+
dispatchPath({
|
175
|
+
type: 'opened_first_level'
|
176
|
+
});
|
177
|
+
dispatchFocusedPath({
|
178
|
+
type: 'set_initial_focus'
|
179
|
+
});
|
180
|
+
handleGlobalToggle(true, event);
|
181
|
+
}
|
182
|
+
break;
|
183
|
+
}
|
184
|
+
case keys.End:
|
185
|
+
{
|
186
|
+
if (path[0]) {
|
187
|
+
dispatchFocusedPath({
|
188
|
+
type: 'change_last_focus',
|
189
|
+
value: currentLength - 1
|
190
|
+
});
|
191
|
+
} else {
|
192
|
+
dispatchPath({
|
193
|
+
type: 'opened_first_level'
|
194
|
+
});
|
195
|
+
dispatchFocusedPath({
|
196
|
+
type: 'change_last_focus',
|
197
|
+
value: (pathMap.get('root') || 0) - 1
|
198
|
+
});
|
199
|
+
handleGlobalToggle(true, event);
|
200
|
+
}
|
201
|
+
break;
|
202
|
+
}
|
203
|
+
case keys.PageUp:
|
204
|
+
{
|
205
|
+
if (!path[0]) {
|
206
|
+
break;
|
207
|
+
}
|
208
|
+
if (currentIndex <= JUMP_SIZE) {
|
209
|
+
dispatchFocusedPath({
|
210
|
+
type: 'change_last_focus',
|
211
|
+
value: 0
|
212
|
+
});
|
213
|
+
} else {
|
214
|
+
dispatchFocusedPath({
|
215
|
+
type: 'change_last_focus',
|
216
|
+
value: currentIndex - JUMP_SIZE
|
217
|
+
});
|
218
|
+
}
|
219
|
+
break;
|
220
|
+
}
|
221
|
+
case keys.PageDown:
|
222
|
+
{
|
223
|
+
if (!path[0]) {
|
224
|
+
break;
|
225
|
+
}
|
226
|
+
if (currentLength - currentIndex <= JUMP_SIZE) {
|
227
|
+
dispatchFocusedPath({
|
228
|
+
type: 'change_last_focus',
|
229
|
+
value: currentLength - 1
|
230
|
+
});
|
231
|
+
} else {
|
232
|
+
dispatchFocusedPath({
|
233
|
+
type: 'change_last_focus',
|
234
|
+
value: currentIndex + JUMP_SIZE
|
235
|
+
});
|
236
|
+
}
|
237
|
+
break;
|
238
|
+
}
|
239
|
+
default:
|
240
|
+
{
|
241
|
+
break;
|
214
242
|
}
|
215
|
-
}
|
216
243
|
}
|
217
244
|
};
|
218
245
|
return {
|
@@ -42,7 +42,7 @@ var DropdownInner = exports.DropdownInner = function DropdownInner(_ref) {
|
|
42
42
|
}
|
43
43
|
};
|
44
44
|
var isCurrentListOpen = path[currentLevel + 1] === item.value.toString();
|
45
|
-
var listId = "
|
45
|
+
var listId = "tree_level_".concat(currentLevel + 2);
|
46
46
|
var nextLevel = currentLevel + 1;
|
47
47
|
if (item !== null && item !== void 0 && item.items) {
|
48
48
|
return /*#__PURE__*/_react["default"].createElement(_Dropdown.StyledPopover, {
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.StyledPopover = exports.StyledDropdown = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("styled-components"));
|
8
|
+
var _engines = /*#__PURE__*/require("../../../../engines");
|
9
|
+
var _Popover = /*#__PURE__*/require("../../../Popover");
|
10
|
+
var _DropdownOld = /*#__PURE__*/require("./DropdownOld.tokens");
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12
|
+
// issue #823
|
13
|
+
var Popover = /*#__PURE__*/(0, _engines.component)(_Popover.popoverConfig);
|
14
|
+
var StyledPopover = exports.StyledPopover = /*#__PURE__*/(0, _styledComponents["default"])(Popover).withConfig({
|
15
|
+
componentId: "plasma-new-hope__sc-10adsb5-0"
|
16
|
+
})([".", "{display:block;}"], /*#__PURE__*/String(_Popover.popoverClasses.target));
|
17
|
+
var StyledDropdown = exports.StyledDropdown = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
18
|
+
componentId: "plasma-new-hope__sc-10adsb5-1"
|
19
|
+
})(["box-sizing:border-box;background:var(", ");box-shadow:var(", ");border-radius:var(", ");width:var(", ");height:var(", ");padding:var(", ") var(", ") var(", ") var(", ");"], _DropdownOld.tokens.background, _DropdownOld.tokens.boxShadow, _DropdownOld.tokens.borderRadius, _DropdownOld.tokens.width, _DropdownOld.tokens.height, _DropdownOld.tokens.paddingTop, _DropdownOld.tokens.paddingRight, _DropdownOld.tokens.paddingBottom, _DropdownOld.tokens.paddingLeft);
|
@@ -0,0 +1,101 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.dropdownOldRoot = exports.dropdownOldConfig = void 0;
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
|
+
var _base = /*#__PURE__*/require("./variations/_view/base");
|
11
|
+
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
12
|
+
var _Dropdown = /*#__PURE__*/require("./Dropdown.styles");
|
13
|
+
var _utils = /*#__PURE__*/require("./utils");
|
14
|
+
var _excluded = ["id", "target", "children", "hasArrow", "role", "view", "size", "frame", "onToggle", "isFocusTrapped", "isOpen", "placement", "trigger", "offset", "preventOverflow", "closeOnOverlayClick", "closeOnEsc"];
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
18
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
20
|
+
/**
|
21
|
+
* Выпадающий список без внешнего контроля видимости.
|
22
|
+
*/
|
23
|
+
var dropdownOldRoot = exports.dropdownOldRoot = function dropdownOldRoot(Root) {
|
24
|
+
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, outerRootRef) {
|
25
|
+
var id = _ref.id,
|
26
|
+
target = _ref.target,
|
27
|
+
children = _ref.children,
|
28
|
+
hasArrow = _ref.hasArrow,
|
29
|
+
role = _ref.role,
|
30
|
+
view = _ref.view,
|
31
|
+
size = _ref.size,
|
32
|
+
frame = _ref.frame,
|
33
|
+
_onToggle = _ref.onToggle,
|
34
|
+
_ref$isFocusTrapped = _ref.isFocusTrapped,
|
35
|
+
isFocusTrapped = _ref$isFocusTrapped === void 0 ? true : _ref$isFocusTrapped,
|
36
|
+
_ref$isOpen = _ref.isOpen,
|
37
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
38
|
+
_ref$placement = _ref.placement,
|
39
|
+
placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
|
40
|
+
_ref$trigger = _ref.trigger,
|
41
|
+
trigger = _ref$trigger === void 0 ? 'click' : _ref$trigger,
|
42
|
+
_ref$offset = _ref.offset,
|
43
|
+
offset = _ref$offset === void 0 ? [0, 6] : _ref$offset,
|
44
|
+
_ref$preventOverflow = _ref.preventOverflow,
|
45
|
+
preventOverflow = _ref$preventOverflow === void 0 ? false : _ref$preventOverflow,
|
46
|
+
_ref$closeOnOverlayCl = _ref.closeOnOverlayClick,
|
47
|
+
closeOnOverlayClick = _ref$closeOnOverlayCl === void 0 ? false : _ref$closeOnOverlayCl,
|
48
|
+
_ref$closeOnEsc = _ref.closeOnEsc,
|
49
|
+
closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
|
50
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
51
|
+
var uniqId = (0, _plasmaCore.useUniqId)();
|
52
|
+
var innerId = id || uniqId;
|
53
|
+
var rootRef = (0, _react.useRef)(null);
|
54
|
+
var dropdownRef = (0, _react.useRef)(null);
|
55
|
+
var handleRef = (0, _plasmaCore.useForkRef)(rootRef, outerRootRef);
|
56
|
+
var trapRef = (0, _plasmaCore.useFocusTrap)(isOpen && isFocusTrapped);
|
57
|
+
var dropdownForkRef = (0, _plasmaCore.useForkRef)(dropdownRef, trapRef);
|
58
|
+
return /*#__PURE__*/_react["default"].createElement(_Dropdown.StyledPopover, {
|
59
|
+
role: role,
|
60
|
+
isOpen: isOpen,
|
61
|
+
usePortal: false,
|
62
|
+
onToggle: function onToggle(is, event) {
|
63
|
+
return _onToggle === null || _onToggle === void 0 ? void 0 : _onToggle(is, event);
|
64
|
+
},
|
65
|
+
id: innerId,
|
66
|
+
ref: dropdownForkRef,
|
67
|
+
target: target,
|
68
|
+
offset: offset,
|
69
|
+
preventOverflow: preventOverflow,
|
70
|
+
hasArrow: hasArrow,
|
71
|
+
placement: (0, _utils.getPlacements)(placement),
|
72
|
+
trigger: trigger,
|
73
|
+
closeOnOverlayClick: closeOnOverlayClick,
|
74
|
+
closeOnEsc: closeOnEsc,
|
75
|
+
isFocusTrapped: isFocusTrapped,
|
76
|
+
frame: frame
|
77
|
+
}, /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
78
|
+
ref: handleRef,
|
79
|
+
view: view,
|
80
|
+
size: size
|
81
|
+
}, rest), /*#__PURE__*/_react["default"].createElement(_Dropdown.StyledDropdown, null, children)));
|
82
|
+
});
|
83
|
+
};
|
84
|
+
var dropdownOldConfig = exports.dropdownOldConfig = {
|
85
|
+
name: 'Dropdown',
|
86
|
+
tag: 'div',
|
87
|
+
layout: dropdownOldRoot,
|
88
|
+
base: '',
|
89
|
+
variations: {
|
90
|
+
view: {
|
91
|
+
css: _base.base
|
92
|
+
},
|
93
|
+
size: {
|
94
|
+
css: _base2.base
|
95
|
+
}
|
96
|
+
},
|
97
|
+
defaults: {
|
98
|
+
view: 'default',
|
99
|
+
size: 'm'
|
100
|
+
}
|
101
|
+
};
|
@@ -0,0 +1,118 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.tokens = exports.classes = void 0;
|
7
|
+
var classes = exports.classes = {
|
8
|
+
dropdownItemIsSelected: 'dropdown-item-is-selected',
|
9
|
+
dropdownItemIsDisabled: 'dropdown-item-is-disabled'
|
10
|
+
};
|
11
|
+
var tokens = exports.tokens = {
|
12
|
+
background: '--plasma-dropdown-background',
|
13
|
+
boxShadow: '--plasma-dropdown-box-shadow',
|
14
|
+
width: '--plasma-dropdown-width',
|
15
|
+
height: '--plasma-dropdown-height',
|
16
|
+
borderRadius: '--plasma-dropdown-border-radius',
|
17
|
+
paddingTop: '--plasma-dropdown-padding-top',
|
18
|
+
paddingRight: '--plasma-dropdown-padding-right',
|
19
|
+
paddingBottom: '--plasma-dropdown-padding-bottom',
|
20
|
+
paddingLeft: '--plasma-dropdown-padding-left',
|
21
|
+
itemBackground: '--plasma-dropdown-item-background',
|
22
|
+
itemColor: '--plasma-dropdown-item-color',
|
23
|
+
itemBackgroundHover: '--plasma-dropdown-item-background-hover',
|
24
|
+
itemBackgroundSelected: '--plasma-dropdown-item-background-selected',
|
25
|
+
itemColorSelected: '--plasma-dropdown-item-color-selected',
|
26
|
+
itemBackgroundSelectedHover: '--plasma-dropdown-item-background-selected-hover',
|
27
|
+
itemColorSelectedHover: '--plasma-dropdown-item-color-selected-hover',
|
28
|
+
itemWidth: '--plasma-dropdown-item-width',
|
29
|
+
itemHeight: '--plasma-dropdown-item-height',
|
30
|
+
itemBorderRadius: '--plasma-dropdown-item-border-radius',
|
31
|
+
itemPaddingTop: '--plasma-dropdown-item-padding-top',
|
32
|
+
itemPaddingRight: '--plasma-dropdown-item-padding-right',
|
33
|
+
itemPaddingBottom: '--plasma-dropdown-item-padding-bottom',
|
34
|
+
itemPaddingLeft: '--plasma-dropdown-item-padding-left',
|
35
|
+
itemMarginTop: '--plasma-dropdown-item-margin-top',
|
36
|
+
itemMarginRight: '--plasma-dropdown-item-margin-right',
|
37
|
+
itemMarginBottom: '--plasma-dropdown-item-margin-bottom',
|
38
|
+
itemMarginLeft: '--plasma-dropdown-item-margin-left',
|
39
|
+
itemFontFamily: '--plasma-dropdown-item-font-family',
|
40
|
+
itemFontSize: '--plasma-dropdown-item-font-size',
|
41
|
+
itemFontStyle: '--plasma-dropdown-item-font-style',
|
42
|
+
itemFontWeightBold: '--plasma-dropdown-item-letter-spacing',
|
43
|
+
itemFontLetterSpacing: '--plasma-dropdown-item-line-height',
|
44
|
+
itemFontLineHeight: '--plasma-dropdown-item-font-weight',
|
45
|
+
itemContentLeftColor: '--plasma-dropdown-item-content-left-color',
|
46
|
+
itemContentRightColor: '--plasma-dropdown-item-content-right-color',
|
47
|
+
itemContentLeftWidth: '--plasma-dropdown-item-content-left-width',
|
48
|
+
itemContentRightWidth: '--plasma-dropdown-item-content-right-width',
|
49
|
+
footerBackground: '--plasma-dropdown-footer-background',
|
50
|
+
footerWidth: '--plasma-dropdown-footer-width',
|
51
|
+
footerHeight: '--plasma-dropdown-footer-height',
|
52
|
+
footerPaddingTop: '--plasma-dropdown-footer-padding-top',
|
53
|
+
footerPaddingRight: '--plasma-dropdown-footer-padding-right',
|
54
|
+
footerPaddingBottom: '--plasma-dropdown-footer-padding-bottom',
|
55
|
+
footerPaddingLeft: '--plasma-dropdown-footer-padding-left',
|
56
|
+
footerMarginTop: '--plasma-dropdown-footer-margin-top',
|
57
|
+
footerMarginRight: '--plasma-dropdown-footer-margin-right',
|
58
|
+
footerMarginBottom: '--plasma-dropdown-footer-margin-bottom',
|
59
|
+
footerMarginLeft: '--plasma-dropdown-footer-margin-left',
|
60
|
+
footerFontFamily: '--plasma-dropdown-footer-font-family',
|
61
|
+
footerFontSize: '--plasma-dropdown-footer-font-size',
|
62
|
+
footerFontStyle: '--plasma-dropdown-footer-font-style',
|
63
|
+
footerFontWeightBold: '--plasma-dropdown-footer-letter-spacing',
|
64
|
+
footerFontLetterSpacing: '--plasma-dropdown-footer-line-height',
|
65
|
+
footerFontLineHeight: '--plasma-dropdown-footer-font-weight',
|
66
|
+
headerBackground: '--plasma-dropdown-header-background',
|
67
|
+
headerWidth: '--plasma-dropdown-header-width',
|
68
|
+
headerHeight: '--plasma-dropdown-header-height',
|
69
|
+
headerPaddingTop: '--plasma-dropdown-header-padding-top',
|
70
|
+
headerPaddingRight: '--plasma-dropdown-header-padding-right',
|
71
|
+
headerPaddingBottom: '--plasma-dropdown-header-padding-bottom',
|
72
|
+
headerPaddingLeft: '--plasma-dropdown-header-padding-left',
|
73
|
+
headerMarginTop: '--plasma-dropdown-header-margin-top',
|
74
|
+
headerMarginRight: '--plasma-dropdown-header-margin-right',
|
75
|
+
headerMarginBottom: '--plasma-dropdown-header-margin-bottom',
|
76
|
+
headerMarginLeft: '--plasma-dropdown-header-margin-left',
|
77
|
+
headerFontFamily: '--plasma-dropdown-header-font-family',
|
78
|
+
headerFontSize: '--plasma-dropdown-header-font-size',
|
79
|
+
headerFontStyle: '--plasma-dropdown-header-font-style',
|
80
|
+
headerFontWeightBold: '--plasma-dropdown-header-letter-spacing',
|
81
|
+
headerFontLetterSpacing: '--plasma-dropdown-header-line-height',
|
82
|
+
headerFontLineHeight: '--plasma-dropdown-header-font-weight',
|
83
|
+
dividerColor: '--plasma-dropdown-divider-color',
|
84
|
+
dividerWidth: '--plasma-dropdown-divider-width',
|
85
|
+
dividerHeight: '--plasma-dropdown-divider-height',
|
86
|
+
dividerMarginTop: '--plasma-dropdown-divider-margin-top',
|
87
|
+
dividerMarginRight: '--plasma-dropdown-divider-margin-right',
|
88
|
+
dividerMarginBottom: '--plasma-dropdown-divider-margin-bottom',
|
89
|
+
dividerMarginLeft: '--plasma-dropdown-divider-margin-left',
|
90
|
+
groupBackground: '--plasma-dropdown-group-background',
|
91
|
+
groupWidth: '--plasma-dropdown-group-width',
|
92
|
+
groupHeight: '--plasma-dropdown-group-height',
|
93
|
+
groupPaddingTop: '--plasma-dropdown-group-padding-top',
|
94
|
+
groupPaddingRight: '--plasma-dropdown-group-padding-right',
|
95
|
+
groupPaddingBottom: '--plasma-dropdown-group-padding-bottom',
|
96
|
+
groupPaddingLeft: '--plasma-dropdown-group-padding-left',
|
97
|
+
groupMarginTop: '--plasma-dropdown-group-margin-top',
|
98
|
+
groupMarginRight: '--plasma-dropdown-group-margin-right',
|
99
|
+
groupMarginBottom: '--plasma-dropdown-group-margin-bottom',
|
100
|
+
groupMarginLeft: '--plasma-dropdown-group-margin-left',
|
101
|
+
groupLabelColor: '--plasma-dropdown-group-label-color',
|
102
|
+
groupLabelFontFamily: '--plasma-dropdown-group-label-font-family',
|
103
|
+
groupLabelFontSize: '--plasma-dropdown-group-label-font-size',
|
104
|
+
groupLabelFontStyle: '--plasma-dropdown-group-label-font-style',
|
105
|
+
groupLabelFontWeight: '--plasma-dropdown-group-label-font-weight',
|
106
|
+
groupLabelLetterSpacing: '--plasma-dropdown-group-label-letter-spacing',
|
107
|
+
groupLabelLineHeight: '--plasma-dropdown-group-label-line-height',
|
108
|
+
groupLabelPaddingTop: '--plasma-dropdown-group-label-padding-top',
|
109
|
+
groupLabelPaddingRight: '--plasma-dropdown-group-label-padding-right',
|
110
|
+
groupLabelPaddingBottom: '--plasma-dropdown-group-label-padding-bottom',
|
111
|
+
groupLabelPaddingLeft: '--plasma-dropdown-group-label-padding-left',
|
112
|
+
groupLabelMarginTop: '--plasma-dropdown-group-label-margin-top',
|
113
|
+
groupLabelMarginRight: '--plasma-dropdown-group-label-margin-right',
|
114
|
+
groupLabelMarginBottom: '--plasma-dropdown-group-label-margin-bottom',
|
115
|
+
groupLabelMarginLeft: '--plasma-dropdown-group-label-margin-left',
|
116
|
+
disabledOpacity: '--plasma-dropdown-disabled-opacity',
|
117
|
+
focusColor: '--plasma-dropdown-focus-color'
|
118
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getPlacements = exports.getPlacement = void 0;
|
7
|
+
var getPlacement = exports.getPlacement = function getPlacement(placement) {
|
8
|
+
return "".concat(placement, "-start");
|
9
|
+
};
|
10
|
+
var getPlacements = exports.getPlacements = function getPlacements(placements) {
|
11
|
+
if (!placements) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
var isArray = Array.isArray(placements);
|
15
|
+
if (!isArray) {
|
16
|
+
return getPlacement(placements);
|
17
|
+
}
|
18
|
+
return (placements || []).map(function (placement) {
|
19
|
+
return getPlacement(placement);
|
20
|
+
});
|
21
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
[]
|