@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.
Files changed (138) hide show
  1. package/cjs/components/Combobox/Combobox.css +3 -0
  2. package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +3 -0
  3. package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +3 -0
  4. package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +3 -0
  5. package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +3 -0
  6. package/cjs/components/Dropdown/Dropdown.css +3 -0
  7. package/cjs/components/Dropdown/Dropdown.js +5 -2
  8. package/cjs/components/Dropdown/Dropdown.js.map +1 -1
  9. package/cjs/components/Dropdown/hooks/useHashMaps.js +2 -2
  10. package/cjs/components/Dropdown/hooks/useHashMaps.js.map +1 -1
  11. package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +185 -162
  12. package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -1
  13. package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +4 -1
  14. package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -1
  15. package/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +29 -0
  16. package/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles.js.map +1 -0
  17. package/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles_3w3l45.css +2 -0
  18. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.css +7 -0
  19. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +99 -0
  20. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -0
  21. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +115 -0
  22. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js.map +1 -0
  23. package/cjs/components/Dropdown/ui/DropdownOld/utils/index.js +23 -0
  24. package/cjs/components/Dropdown/ui/DropdownOld/utils/index.js.map +1 -0
  25. package/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base.js +9 -0
  26. package/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base.js.map +1 -0
  27. package/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base_x642ct.css +1 -0
  28. package/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base.js +9 -0
  29. package/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base.js.map +1 -0
  30. package/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base_x642ct.css +1 -0
  31. package/cjs/components/Pagination/Pagination.css +3 -0
  32. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +3 -0
  33. package/cjs/components/Select/Select.css +3 -0
  34. package/cjs/components/Select/ui/SelectDivider/SelectDivider.css +3 -0
  35. package/cjs/components/Select/ui/SelectFooter/SelectFooter.css +3 -0
  36. package/cjs/components/Select/ui/SelectGroup/SelectGroup.css +3 -0
  37. package/cjs/components/Select/ui/SelectHeader/SelectHeader.css +3 -0
  38. package/cjs/components/Select/ui/SelectItem/SelectItem.css +3 -0
  39. package/cjs/index.css +3 -0
  40. package/cjs/index.js +5 -0
  41. package/cjs/index.js.map +1 -1
  42. package/es/components/Combobox/Combobox.css +3 -0
  43. package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +3 -0
  44. package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +3 -0
  45. package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +3 -0
  46. package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +3 -0
  47. package/es/components/Dropdown/Dropdown.css +3 -0
  48. package/es/components/Dropdown/Dropdown.js +5 -2
  49. package/es/components/Dropdown/Dropdown.js.map +1 -1
  50. package/es/components/Dropdown/hooks/useHashMaps.js +2 -2
  51. package/es/components/Dropdown/hooks/useHashMaps.js.map +1 -1
  52. package/es/components/Dropdown/hooks/useKeyboardNavigation.js +185 -162
  53. package/es/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -1
  54. package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +4 -1
  55. package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -1
  56. package/es/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +24 -0
  57. package/es/components/Dropdown/ui/DropdownOld/Dropdown.styles.js.map +1 -0
  58. package/es/components/Dropdown/ui/DropdownOld/Dropdown.styles_3w3l45.css +2 -0
  59. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.css +7 -0
  60. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +94 -0
  61. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -0
  62. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +111 -0
  63. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js.map +1 -0
  64. package/es/components/Dropdown/ui/DropdownOld/utils/index.js +18 -0
  65. package/es/components/Dropdown/ui/DropdownOld/utils/index.js.map +1 -0
  66. package/es/components/Dropdown/ui/DropdownOld/variations/_size/base.js +5 -0
  67. package/es/components/Dropdown/ui/DropdownOld/variations/_size/base.js.map +1 -0
  68. package/es/components/Dropdown/ui/DropdownOld/variations/_size/base_x642ct.css +1 -0
  69. package/es/components/Dropdown/ui/DropdownOld/variations/_view/base.js +5 -0
  70. package/es/components/Dropdown/ui/DropdownOld/variations/_view/base.js.map +1 -0
  71. package/es/components/Dropdown/ui/DropdownOld/variations/_view/base_x642ct.css +1 -0
  72. package/es/components/Pagination/Pagination.css +3 -0
  73. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +3 -0
  74. package/es/components/Select/Select.css +3 -0
  75. package/es/components/Select/ui/SelectDivider/SelectDivider.css +3 -0
  76. package/es/components/Select/ui/SelectFooter/SelectFooter.css +3 -0
  77. package/es/components/Select/ui/SelectGroup/SelectGroup.css +3 -0
  78. package/es/components/Select/ui/SelectHeader/SelectHeader.css +3 -0
  79. package/es/components/Select/ui/SelectItem/SelectItem.css +3 -0
  80. package/es/index.css +3 -0
  81. package/es/index.js +2 -0
  82. package/es/index.js.map +1 -1
  83. package/package.json +2 -2
  84. package/styled-components/cjs/components/Dropdown/Dropdown.js +2 -2
  85. package/styled-components/cjs/components/Dropdown/hooks/useHashMaps.js +2 -2
  86. package/styled-components/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +189 -162
  87. package/styled-components/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +1 -1
  88. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +19 -0
  89. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/Dropdown.types.js +5 -0
  90. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +101 -0
  91. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +118 -0
  92. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/utils/index.js +21 -0
  93. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_size/base.js +8 -0
  94. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_size/tokens.json +1 -0
  95. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_view/base.js +8 -0
  96. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/variations/_view/tokens.json +1 -0
  97. package/styled-components/cjs/components/Dropdown/ui/index.js +21 -1
  98. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.config.js +25 -0
  99. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.js +11 -0
  100. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Dropdown.stories.tsx +292 -0
  101. package/styled-components/es/components/Dropdown/Dropdown.js +2 -2
  102. package/styled-components/es/components/Dropdown/hooks/useHashMaps.js +2 -2
  103. package/styled-components/es/components/Dropdown/hooks/useKeyboardNavigation.js +189 -162
  104. package/styled-components/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +1 -1
  105. package/styled-components/es/components/Dropdown/ui/DropdownOld/Dropdown.styles.js +13 -0
  106. package/styled-components/es/components/Dropdown/ui/DropdownOld/Dropdown.types.js +1 -0
  107. package/styled-components/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +92 -0
  108. package/styled-components/es/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.js +112 -0
  109. package/styled-components/es/components/Dropdown/ui/DropdownOld/utils/index.js +15 -0
  110. package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_size/base.js +2 -0
  111. package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_size/tokens.json +1 -0
  112. package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_view/base.js +2 -0
  113. package/styled-components/es/components/Dropdown/ui/DropdownOld/variations/_view/tokens.json +1 -0
  114. package/styled-components/es/components/Dropdown/ui/index.js +3 -1
  115. package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.config.js +19 -0
  116. package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.js +5 -0
  117. package/styled-components/es/examples/plasma_web/components/Dropdown/Dropdown.stories.tsx +292 -0
  118. package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts.map +1 -1
  119. package/types/components/Dropdown/ui/DropdownOld/Dropdown.styles.d.ts +8 -0
  120. package/types/components/Dropdown/ui/DropdownOld/Dropdown.styles.d.ts.map +1 -0
  121. package/types/components/Dropdown/ui/DropdownOld/Dropdown.types.d.ts +76 -0
  122. package/types/components/Dropdown/ui/DropdownOld/Dropdown.types.d.ts.map +1 -0
  123. package/types/components/Dropdown/ui/DropdownOld/DropdownOld.d.ts +26 -0
  124. package/types/components/Dropdown/ui/DropdownOld/DropdownOld.d.ts.map +1 -0
  125. package/types/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.d.ts +113 -0
  126. package/types/components/Dropdown/ui/DropdownOld/DropdownOld.tokens.d.ts.map +1 -0
  127. package/types/components/Dropdown/ui/DropdownOld/utils/index.d.ts +4 -0
  128. package/types/components/Dropdown/ui/DropdownOld/utils/index.d.ts.map +1 -0
  129. package/types/components/Dropdown/ui/DropdownOld/variations/_size/base.d.ts +2 -0
  130. package/types/components/Dropdown/ui/DropdownOld/variations/_size/base.d.ts.map +1 -0
  131. package/types/components/Dropdown/ui/DropdownOld/variations/_view/base.d.ts +2 -0
  132. package/types/components/Dropdown/ui/DropdownOld/variations/_view/base.d.ts.map +1 -0
  133. package/types/components/Dropdown/ui/index.d.ts +2 -0
  134. package/types/components/Dropdown/ui/index.d.ts.map +1 -1
  135. package/types/examples/plasma_web/components/Dropdown/Dropdown.config.d.ts +18 -0
  136. package/types/examples/plasma_web/components/Dropdown/Dropdown.config.d.ts.map +1 -0
  137. package/types/examples/plasma_web/components/Dropdown/Dropdown.d.ts +13 -0
  138. package/types/examples/plasma_web/components/Dropdown/Dropdown.d.ts.map +1 -0
@@ -33,180 +33,203 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
33
33
  var currentLength = pathMap.get(path === null || path === void 0 ? void 0 : path[path.length - 1]) || 0;
34
34
  var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
35
35
  var onKeyDown = function onKeyDown(event) {
36
- var code = event.code;
37
- if (code === keys.ArrowUp) {
38
- if (focusedPath.length) {
39
- if (currentIndex <= 0) {
40
- return;
41
- }
42
- dispatchFocusedPath({
43
- type: 'change_last_focus',
44
- value: currentIndex - 1
45
- });
46
- } else {
47
- dispatchPath({
48
- type: 'opened_first_level'
49
- });
50
- dispatchFocusedPath({
51
- type: 'set_initial_focus'
52
- });
53
- handleGlobalToggle(true, event);
54
- }
55
- }
56
- if (code === keys.ArrowDown) {
57
- if (focusedPath.length) {
58
- if (currentIndex + 1 >= currentLength) {
59
- return;
60
- }
61
- dispatchFocusedPath({
62
- type: 'change_last_focus',
63
- value: currentIndex + 1
64
- });
65
- } else {
66
- dispatchPath({
67
- type: 'opened_first_level'
68
- });
69
- dispatchFocusedPath({
70
- type: 'set_initial_focus'
71
- });
72
- handleGlobalToggle(true, event);
73
- }
74
- }
75
- if (code === keys.ArrowLeft) {
76
- if (focusedPath.length) {
77
- dispatchPath({
78
- type: 'removed_last_level'
79
- });
80
- dispatchFocusedPath({
81
- type: 'return_prev_focus'
82
- });
83
- }
84
- if (focusedPath.length === 1) {
85
- handleGlobalToggle(false, event);
86
- }
87
- }
88
- if (code === keys.ArrowRight) {
89
- if (focusedPath.length) {
90
- var currentItem = getFurtherPath(focusedPath, focusedToValueMap);
91
- if (currentItem !== null && currentItem !== void 0 && currentItem.items) {
92
- dispatchPath({
93
- type: 'added_next_level',
94
- value: currentItem.value.toString()
95
- });
96
- dispatchFocusedPath({
97
- type: 'add_focus',
98
- value: 0
99
- });
36
+ switch (event.code) {
37
+ case keys.ArrowUp:
38
+ {
39
+ if (focusedPath.length) {
40
+ if (currentIndex > 0) {
41
+ dispatchFocusedPath({
42
+ type: 'change_last_focus',
43
+ value: currentIndex - 1
44
+ });
45
+ }
46
+ } else {
47
+ dispatchPath({
48
+ type: 'opened_first_level'
49
+ });
50
+ dispatchFocusedPath({
51
+ type: 'set_initial_focus'
52
+ });
53
+ handleGlobalToggle(true, event);
54
+ }
55
+ break;
100
56
  }
101
- }
102
- }
103
- if (code === keys.Enter || code === keys.Space) {
104
- event.preventDefault();
105
- if (path[0]) {
106
- var _currentItem = getFurtherPath(focusedPath, focusedToValueMap);
107
- if (_currentItem !== null && _currentItem !== void 0 && _currentItem.disabled || _currentItem !== null && _currentItem !== void 0 && _currentItem.isDisabled) {
108
- return;
57
+ case keys.ArrowDown:
58
+ {
59
+ if (focusedPath.length) {
60
+ if (currentIndex + 1 < currentLength) {
61
+ dispatchFocusedPath({
62
+ type: 'change_last_focus',
63
+ value: currentIndex + 1
64
+ });
65
+ }
66
+ } else {
67
+ dispatchPath({
68
+ type: 'opened_first_level'
69
+ });
70
+ dispatchFocusedPath({
71
+ type: 'set_initial_focus'
72
+ });
73
+ handleGlobalToggle(true, event);
74
+ }
75
+ break;
109
76
  }
110
- if (_currentItem !== null && _currentItem !== void 0 && _currentItem.items) {
111
- dispatchPath({
112
- type: 'added_next_level',
113
- value: _currentItem.value.toString()
114
- });
115
- dispatchFocusedPath({
116
- type: 'add_focus',
117
- value: 0
118
- });
119
- } else {
120
- if (closeOnSelect) {
77
+ case keys.ArrowLeft:
78
+ {
79
+ if (focusedPath.length) {
80
+ dispatchPath({
81
+ type: 'removed_last_level'
82
+ });
83
+ dispatchFocusedPath({
84
+ type: 'return_prev_focus'
85
+ });
86
+ }
87
+ if (focusedPath.length === 1) {
121
88
  handleGlobalToggle(false, event);
122
89
  }
123
- if (onItemSelect && _currentItem) {
124
- onItemSelect(_currentItem, event);
90
+ break;
91
+ }
92
+ case keys.ArrowRight:
93
+ {
94
+ if (focusedPath.length) {
95
+ var currentItem = getFurtherPath(focusedPath, focusedToValueMap);
96
+ if (currentItem !== null && currentItem !== void 0 && currentItem.items) {
97
+ dispatchPath({
98
+ type: 'added_next_level',
99
+ value: currentItem.value.toString()
100
+ });
101
+ dispatchFocusedPath({
102
+ type: 'add_focus',
103
+ value: 0
104
+ });
105
+ }
125
106
  }
126
- if (onItemClick && _currentItem) {
127
- onItemClick(_currentItem, event);
107
+ break;
108
+ }
109
+ case keys.Enter:
110
+ case keys.Space:
111
+ {
112
+ event.preventDefault();
113
+ if (path[0]) {
114
+ var _currentItem = getFurtherPath(focusedPath, focusedToValueMap);
115
+ if (_currentItem !== null && _currentItem !== void 0 && _currentItem.disabled || _currentItem !== null && _currentItem !== void 0 && _currentItem.isDisabled) {
116
+ break;
117
+ }
118
+ if (_currentItem !== null && _currentItem !== void 0 && _currentItem.items) {
119
+ dispatchPath({
120
+ type: 'added_next_level',
121
+ value: _currentItem.value.toString()
122
+ });
123
+ dispatchFocusedPath({
124
+ type: 'add_focus',
125
+ value: 0
126
+ });
127
+ } else {
128
+ if (closeOnSelect) {
129
+ handleGlobalToggle(false, event);
130
+ }
131
+ if (onItemSelect && _currentItem) {
132
+ onItemSelect(_currentItem, event);
133
+ }
134
+ if (onItemClick && _currentItem) {
135
+ onItemClick(_currentItem, event);
136
+ }
137
+ }
138
+ } else {
139
+ dispatchPath({
140
+ type: 'opened_first_level'
141
+ });
142
+ dispatchFocusedPath({
143
+ type: 'set_initial_focus'
144
+ });
128
145
  }
146
+ break;
129
147
  }
130
- } else {
131
- dispatchPath({
132
- type: 'opened_first_level'
133
- });
134
- dispatchFocusedPath({
135
- type: 'set_initial_focus'
136
- });
137
- }
138
- }
139
- if (code === keys.Tab || code === keys.Escape) {
140
- dispatchFocusedPath({
141
- type: 'reset'
142
- });
143
- dispatchPath({
144
- type: 'reset'
145
- });
146
- handleGlobalToggle(false, event);
147
- }
148
- if (code === keys.Home) {
149
- if (path[0]) {
150
- dispatchFocusedPath({
151
- type: 'change_last_focus',
152
- value: 0
153
- });
154
- } else {
155
- dispatchPath({
156
- type: 'opened_first_level'
157
- });
158
- dispatchFocusedPath({
159
- type: 'set_initial_focus'
160
- });
161
- handleGlobalToggle(true, event);
162
- }
163
- }
164
- if (code === keys.End) {
165
- if (path[0]) {
166
- dispatchFocusedPath({
167
- type: 'change_last_focus',
168
- value: currentLength - 1
169
- });
170
- } else {
171
- dispatchPath({
172
- type: 'opened_first_level'
173
- });
174
- dispatchFocusedPath({
175
- type: 'change_last_focus',
176
- value: (pathMap.get('root') || 0) - 1
177
- });
178
- handleGlobalToggle(true, event);
179
- }
180
- }
181
- if (code === keys.PageUp) {
182
- if (path[0]) {
183
- if (currentIndex <= JUMP_SIZE) {
148
+ case keys.Tab:
149
+ case keys.Escape:
150
+ {
184
151
  dispatchFocusedPath({
185
- type: 'change_last_focus',
186
- value: 0
152
+ type: 'reset'
187
153
  });
188
- } else {
189
- dispatchFocusedPath({
190
- type: 'change_last_focus',
191
- value: currentIndex - JUMP_SIZE
154
+ dispatchPath({
155
+ type: 'reset'
192
156
  });
157
+ handleGlobalToggle(false, event);
158
+ break;
193
159
  }
194
- }
195
- }
196
- if (code === keys.PageDown) {
197
- if (path[0]) {
198
- if (currentLength - currentIndex <= JUMP_SIZE) {
199
- dispatchFocusedPath({
200
- type: 'change_last_focus',
201
- value: currentLength - 1
202
- });
203
- } else {
204
- dispatchFocusedPath({
205
- type: 'change_last_focus',
206
- value: currentIndex + JUMP_SIZE
207
- });
160
+ case keys.Home:
161
+ {
162
+ if (path[0]) {
163
+ dispatchFocusedPath({
164
+ type: 'change_last_focus',
165
+ value: 0
166
+ });
167
+ } else {
168
+ dispatchPath({
169
+ type: 'opened_first_level'
170
+ });
171
+ dispatchFocusedPath({
172
+ type: 'set_initial_focus'
173
+ });
174
+ handleGlobalToggle(true, event);
175
+ }
176
+ break;
177
+ }
178
+ case keys.End:
179
+ {
180
+ if (path[0]) {
181
+ dispatchFocusedPath({
182
+ type: 'change_last_focus',
183
+ value: currentLength - 1
184
+ });
185
+ } else {
186
+ dispatchPath({
187
+ type: 'opened_first_level'
188
+ });
189
+ dispatchFocusedPath({
190
+ type: 'change_last_focus',
191
+ value: (pathMap.get('root') || 0) - 1
192
+ });
193
+ handleGlobalToggle(true, event);
194
+ }
195
+ break;
196
+ }
197
+ case keys.PageUp:
198
+ {
199
+ if (!path[0]) {
200
+ break;
201
+ }
202
+ if (currentIndex <= JUMP_SIZE) {
203
+ dispatchFocusedPath({
204
+ type: 'change_last_focus',
205
+ value: 0
206
+ });
207
+ } else {
208
+ dispatchFocusedPath({
209
+ type: 'change_last_focus',
210
+ value: currentIndex - JUMP_SIZE
211
+ });
212
+ }
213
+ break;
214
+ }
215
+ case keys.PageDown:
216
+ {
217
+ if (!path[0]) {
218
+ break;
219
+ }
220
+ if (currentLength - currentIndex <= JUMP_SIZE) {
221
+ dispatchFocusedPath({
222
+ type: 'change_last_focus',
223
+ value: currentLength - 1
224
+ });
225
+ } else {
226
+ dispatchFocusedPath({
227
+ type: 'change_last_focus',
228
+ value: currentIndex + JUMP_SIZE
229
+ });
230
+ }
231
+ break;
208
232
  }
209
- }
210
233
  }
211
234
  };
212
235
  return {
@@ -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 currentLength: number = pathMap.get(path?.[path.length - 1]) || 0;\n const currentIndex: number = focusedPath?.[focusedPath.length - 1] || 0;\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n const { code } = event;\n\n if (code === keys.ArrowUp) {\n if (focusedPath.length) {\n if (currentIndex <= 0) {\n return;\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleGlobalToggle(true, event);\n }\n }\n\n if (code === keys.ArrowDown) {\n if (focusedPath.length) {\n if (currentIndex + 1 >= currentLength) {\n return;\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleGlobalToggle(true, event);\n }\n }\n\n if (code === keys.ArrowLeft) {\n if (focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n\n if (focusedPath.length === 1) {\n handleGlobalToggle(false, event);\n }\n }\n\n if (code === keys.ArrowRight) {\n if (focusedPath.length) {\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.items) {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n }\n }\n }\n\n if (code === keys.Enter || code === keys.Space) {\n event.preventDefault();\n\n if (path[0]) {\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.disabled || currentItem?.isDisabled) {\n return;\n }\n\n if (currentItem?.items) {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\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 } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n }\n }\n\n if (code === keys.Tab || code === keys.Escape) {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n\n handleGlobalToggle(false, event);\n }\n\n if (code === keys.Home) {\n if (path[0]) {\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\n if (code === keys.End) {\n if (path[0]) {\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\n if (code === keys.PageUp) {\n if (path[0]) {\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 }\n\n if (code === keys.PageDown) {\n if (path[0]) {\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 }\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","currentLength","length","currentIndex","onKeyDown","event","code","type","value","currentItem","items","toString","preventDefault","disabled","isDisabled"],"mappings":"AASA,IAAMA,SAAS,GAAG,EAAE,CAAA;AAEb,IAAMC,IAAI,GAAG;AAChBC,EAAAA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AAY,IAAIpC,SAAS,EAAE;AAC3C0B,UAAAA,mBAAmB,CAAC;AAAEc,YAAAA,IAAI,EAAE,mBAAmB;YAAEC,KAAK,EAAEP,aAAa,GAAG,CAAA;AAAE,WAAC,CAAC,CAAA;AAChF,SAAC,MAAM;AACHR,UAAAA,mBAAmB,CAAC;AAAEc,YAAAA,IAAI,EAAE,mBAAmB;YAAEC,KAAK,EAAEL,YAAY,GAAGpC,SAAAA;AAAU,WAAC,CAAC,CAAA;AACvF,SAAA;AACJ,OAAA;AACJ,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 currentLength: number = pathMap.get(path?.[path.length - 1]) || 0;\n const currentIndex: number = focusedPath?.[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 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 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 dispatchPath({ type: 'removed_last_level' });\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n\n if (focusedPath.length === 1) {\n handleGlobalToggle(false, event);\n }\n\n break;\n }\n\n case keys.ArrowRight: {\n if (focusedPath.length) {\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.items) {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n }\n }\n\n break;\n }\n\n case keys.Enter:\n case keys.Space: {\n event.preventDefault();\n\n if (path[0]) {\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.disabled || currentItem?.isDisabled) {\n break;\n }\n\n if (currentItem?.items) {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\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 } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\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 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 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 (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 (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","currentLength","length","currentIndex","onKeyDown","event","code","type","value","currentItem","items","toString","preventDefault","disabled","isDisabled"],"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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AY,IAAIpC,SAAS,EAAE;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,EAAEL,YAAY,GAAGpC,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,IAAIO,aAAa,GAAGE,YAAY,IAAIpC,SAAS,EAAE;AAC3C0B,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEP,aAAa,GAAG,CAAA;AAAE,aAAC,CAAC,CAAA;AAChF,WAAC,MAAM;AACHR,YAAAA,mBAAmB,CAAC;AAAEc,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEL,YAAY,GAAGpC,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;;;;"}
@@ -5,6 +5,9 @@ import { DropdownItem } from '../DropdownItem/DropdownItem.js';
5
5
  import { StyledPopover, Ul } from '../../Dropdown.styles.js';
6
6
  import '../../../../utils/react.js';
7
7
  import 'focus-visible';
8
+ import '@linaria/core';
9
+ import 'react-dom';
10
+ import 'react-popper';
8
11
 
9
12
  var DropdownInner = function DropdownInner(_ref) {
10
13
  var item = _ref.item,
@@ -40,7 +43,7 @@ var DropdownInner = function DropdownInner(_ref) {
40
43
  }
41
44
  };
42
45
  var isCurrentListOpen = path[currentLevel + 1] === item.value.toString();
43
- var listId = "listbox".concat(currentLevel + 2);
46
+ var listId = "tree_level_".concat(currentLevel + 2);
44
47
  var nextLevel = currentLevel + 1;
45
48
  if (item !== null && item !== void 0 && item.items) {
46
49
  return /*#__PURE__*/React.createElement(StyledPopover, {
@@ -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';\n\nimport { DropdownItem } from '..';\nimport { Ul, StyledPopover } from '../../Dropdown.styles';\n\nimport { DropdownInnerProps } from './DropdownInner.type';\n\nconst DropdownInner: FC<DropdownInnerProps> = ({\n item,\n currentLevel,\n focusedPath,\n path,\n dispatchPath,\n index,\n trigger,\n itemRole,\n listHeight,\n listOverflow,\n handleGlobalToggle,\n closeOnSelect,\n onHover,\n onItemSelect,\n onItemClick,\n listWidth,\n variant,\n hasArrow,\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 isCurrentListOpen = path[currentLevel + 1] === item.value.toString();\n\n const listId = `listbox${currentLevel + 2}`;\n const nextLevel = currentLevel + 1;\n\n if (item?.items) {\n return (\n <StyledPopover\n isOpen={isCurrentListOpen}\n usePortal={false}\n placement=\"right-start\"\n trigger={trigger}\n target={\n <DropdownItem\n item={item}\n index={index}\n path={path}\n focusedPath={focusedPath}\n currentLevel={currentLevel}\n itemRole={itemRole}\n onHover={onHover}\n onItemSelect={onItemSelect}\n onItemClick={onItemClick}\n variant={variant}\n hasArrow={hasArrow}\n ariaControls={listId}\n ariaExpanded={isCurrentListOpen}\n ariaLevel={nextLevel}\n ariaLabel={item.label}\n />\n }\n onToggle={handleToggle}\n isFocusTrapped={false}\n preventOverflow={false}\n >\n <Ul\n listHeight={listHeight}\n listOverflow={listOverflow}\n role=\"group\"\n id={listId}\n listWidth={listWidth}\n isInnerUl\n >\n {item.items.map((innerItem, innerIndex) => (\n <DropdownInner\n key={`${innerIndex}/${currentLevel}`}\n item={innerItem}\n currentLevel={nextLevel}\n focusedPath={focusedPath}\n path={path}\n dispatchPath={dispatchPath}\n index={innerIndex}\n trigger={trigger}\n itemRole={itemRole}\n listHeight={listHeight}\n listOverflow={listOverflow}\n handleGlobalToggle={handleGlobalToggle}\n closeOnSelect={closeOnSelect}\n onHover={onHover}\n onItemSelect={onItemSelect}\n onItemClick={onItemClick}\n listWidth={listWidth}\n variant={variant}\n hasArrow={hasArrow}\n />\n ))}\n </Ul>\n </StyledPopover>\n );\n }\n\n return (\n <DropdownItem\n item={item}\n index={index}\n focusedPath={focusedPath}\n currentLevel={currentLevel}\n itemRole={itemRole}\n handleGlobalToggle={handleGlobalToggle}\n closeOnSelect={closeOnSelect}\n onHover={onHover}\n onItemSelect={onItemSelect}\n onItemClick={onItemClick}\n variant={variant}\n />\n );\n};\n\nexport { DropdownInner };\n"],"names":["DropdownInner","_ref","item","currentLevel","focusedPath","path","dispatchPath","index","trigger","itemRole","listHeight","listOverflow","handleGlobalToggle","closeOnSelect","onHover","onItemSelect","onItemClick","listWidth","variant","hasArrow","handleToggle","opened","type","value","toString","level","isCurrentListOpen","listId","concat","nextLevel","items","React","createElement","StyledPopover","isOpen","usePortal","placement","target","DropdownItem","ariaControls","ariaExpanded","ariaLevel","ariaLabel","label","onToggle","isFocusTrapped","preventOverflow","Ul","role","id","isInnerUl","map","innerItem","innerIndex","key"],"mappings":";;;;;;;;AAQA,IAAMA,aAAqC,GAAG,SAAxCA,aAAqCA,CAAAC,IAAA,EAmBrC;AAAA,EAAA,IAlBFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IACZC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,IAAI,GAAAJ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nBG,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCC,IAAAA,aAAa,EAAEA,aAAc;AAC7BC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,YAAY,EAAEA,YAAa;AAC3BC,IAAAA,WAAW,EAAEA,WAAY;AACzBE,IAAAA,OAAO,EAAEA,OAAAA;AAAQ,GACpB,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"DropdownInner.js","sources":["../../../../../src/components/Dropdown/ui/DropdownInner/DropdownInner.tsx"],"sourcesContent":["import React from 'react';\nimport type { FC } from 'react';\n\nimport { DropdownItem } from '..';\nimport { Ul, StyledPopover } from '../../Dropdown.styles';\n\nimport { DropdownInnerProps } from './DropdownInner.type';\n\nconst DropdownInner: FC<DropdownInnerProps> = ({\n item,\n currentLevel,\n focusedPath,\n path,\n dispatchPath,\n index,\n trigger,\n itemRole,\n listHeight,\n listOverflow,\n handleGlobalToggle,\n closeOnSelect,\n onHover,\n onItemSelect,\n onItemClick,\n listWidth,\n variant,\n hasArrow,\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 isCurrentListOpen = path[currentLevel + 1] === item.value.toString();\n\n const listId = `tree_level_${currentLevel + 2}`;\n const nextLevel = currentLevel + 1;\n\n if (item?.items) {\n return (\n <StyledPopover\n isOpen={isCurrentListOpen}\n usePortal={false}\n placement=\"right-start\"\n trigger={trigger}\n target={\n <DropdownItem\n item={item}\n index={index}\n path={path}\n focusedPath={focusedPath}\n currentLevel={currentLevel}\n itemRole={itemRole}\n onHover={onHover}\n onItemSelect={onItemSelect}\n onItemClick={onItemClick}\n variant={variant}\n hasArrow={hasArrow}\n ariaControls={listId}\n ariaExpanded={isCurrentListOpen}\n ariaLevel={nextLevel}\n ariaLabel={item.label}\n />\n }\n onToggle={handleToggle}\n isFocusTrapped={false}\n preventOverflow={false}\n >\n <Ul\n listHeight={listHeight}\n listOverflow={listOverflow}\n role=\"group\"\n id={listId}\n listWidth={listWidth}\n isInnerUl\n >\n {item.items.map((innerItem, innerIndex) => (\n <DropdownInner\n key={`${innerIndex}/${currentLevel}`}\n item={innerItem}\n currentLevel={nextLevel}\n focusedPath={focusedPath}\n path={path}\n dispatchPath={dispatchPath}\n index={innerIndex}\n trigger={trigger}\n itemRole={itemRole}\n listHeight={listHeight}\n listOverflow={listOverflow}\n handleGlobalToggle={handleGlobalToggle}\n closeOnSelect={closeOnSelect}\n onHover={onHover}\n onItemSelect={onItemSelect}\n onItemClick={onItemClick}\n listWidth={listWidth}\n variant={variant}\n hasArrow={hasArrow}\n />\n ))}\n </Ul>\n </StyledPopover>\n );\n }\n\n return (\n <DropdownItem\n item={item}\n index={index}\n focusedPath={focusedPath}\n currentLevel={currentLevel}\n itemRole={itemRole}\n handleGlobalToggle={handleGlobalToggle}\n closeOnSelect={closeOnSelect}\n onHover={onHover}\n onItemSelect={onItemSelect}\n onItemClick={onItemClick}\n variant={variant}\n />\n );\n};\n\nexport { DropdownInner };\n"],"names":["DropdownInner","_ref","item","currentLevel","focusedPath","path","dispatchPath","index","trigger","itemRole","listHeight","listOverflow","handleGlobalToggle","closeOnSelect","onHover","onItemSelect","onItemClick","listWidth","variant","hasArrow","handleToggle","opened","type","value","toString","level","isCurrentListOpen","listId","concat","nextLevel","items","React","createElement","StyledPopover","isOpen","usePortal","placement","target","DropdownItem","ariaControls","ariaExpanded","ariaLevel","ariaLabel","label","onToggle","isFocusTrapped","preventOverflow","Ul","role","id","isInnerUl","map","innerItem","innerIndex","key"],"mappings":";;;;;;;;;;;AAQA,IAAMA,aAAqC,GAAG,SAAxCA,aAAqCA,CAAAC,IAAA,EAmBrC;AAAA,EAAA,IAlBFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IACZC,WAAW,GAAAH,IAAA,C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BM,IAAAA,QAAQ,EAAEA,QAAS;AACnBG,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCC,IAAAA,aAAa,EAAEA,aAAc;AAC7BC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,YAAY,EAAEA,YAAa;AAC3BC,IAAAA,WAAW,EAAEA,WAAY;AACzBE,IAAAA,OAAO,EAAEA,OAAAA;AAAQ,GACpB,CAAC,CAAA;AAEV;;;;"}
@@ -0,0 +1,24 @@
1
+ import './Dropdown.styles_3w3l45.css';
2
+ import { styled } from '@linaria/react';
3
+ import '@linaria/core';
4
+ import { component } from '../../../../engines/common.js';
5
+ import { popoverConfig } from '../../../Popover/Popover.js';
6
+
7
+ // issue #823
8
+ var Popover = /*#__PURE__*/component(popoverConfig);
9
+ var _exp = function _exp() {
10
+ return Popover;
11
+ };
12
+ var StyledPopover = /*#__PURE__*/styled(_exp())({
13
+ name: "StyledPopover",
14
+ "class": "s1rwu6ky",
15
+ propsAsIs: true
16
+ });
17
+ var StyledDropdown = /*#__PURE__*/styled('div')({
18
+ name: "StyledDropdown",
19
+ "class": "s10jhp3l",
20
+ propsAsIs: false
21
+ });
22
+
23
+ export { StyledDropdown, StyledPopover };
24
+ //# sourceMappingURL=Dropdown.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.styles.js","sources":["../../../../../src/components/Dropdown/ui/DropdownOld/Dropdown.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { component } from '../../../../engines';\nimport { popoverConfig, popoverClasses } from '../../../Popover';\n\nimport { tokens } from './DropdownOld.tokens';\n\n// issue #823\nconst Popover = component(popoverConfig);\n\nexport const StyledPopover = styled(Popover)`\n .${String(popoverClasses.target)} {\n display: block;\n }\n`;\n\nexport const StyledDropdown = styled.div`\n box-sizing: border-box;\n\n background: var(${tokens.background});\n box-shadow: var(${tokens.boxShadow});\n\n border-radius: var(${tokens.borderRadius});\n width: var(${tokens.width});\n height: var(${tokens.height});\n\n padding: var(${tokens.paddingTop}) var(${tokens.paddingRight}) var(${tokens.paddingBottom})\n var(${tokens.paddingLeft});\n`;\n"],"names":["Popover","component","popoverConfig","_exp","StyledPopover","styled","name","class","propsAsIs","StyledDropdown"],"mappings":";;;;;AAOA;AACA,IAAMA,OAAO,gBAAGC,SAAS,CAACC,aAAa,CAAC,CAAA;AAAC,IAAAC,IAAA,GAPvBA,SAOuBA,IAAAA,GAAA;AAAA,EAAA,OAELH,OAAO,CAAA;AAAA,CAAA,CAAA;AAApC,IAAMI,aAAa,gBAAGC,MAAM,CAAAF,IAAA,EAAA,CAAA,CAAA;AAAAG,EAAAA,IAAA,EAAA,eAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAIlC,EAAA;AAEM,IAAMC,cAAc,gBAAGJ,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,gBAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAYnC;;;;"}
@@ -0,0 +1,2 @@
1
+ .s1rwu6ky .popover-target{display:block;}
2
+ .s10jhp3l{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
@@ -0,0 +1,7 @@
1
+ .Popover_styles_rmr9za_s1g1xbt5__0bafa6fb{display:inline-block;}
2
+ .Popover_styles_rmr9za_s12xwbyh__0bafa6fb{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;box-sizing:border-box;position:relative;}
3
+ .Popover_styles_rmr9za_s1pd4d8a__0bafa6fb{width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);}.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb::before{position:absolute;width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);-webkit-mask-image:var(--plasma-popover-arrow-mask-image);mask-image:var(--plasma-popover-arrow-mask-image);background:var(--plasma-popover-arrow-background);content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}
4
+ .Popover_styles_rmr9za_s16xlixz__0bafa6fb{position:absolute;z-index:var(--s16xlixz-0);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{right:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{left:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:unset !important;bottom:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}
5
+
6
+ .Dropdown_styles_3w3l45_s1rwu6ky__59648b20 .Dropdown_styles_3w3l45_popoverTarget__59648b20{display:block;}
7
+ .Dropdown_styles_3w3l45_s10jhp3l__59648b20{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
@@ -0,0 +1,94 @@
1
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import React, { forwardRef, useRef } from 'react';
3
+ import { useUniqId, useForkRef, useFocusTrap } from '@salutejs/plasma-core';
4
+ import { base } from './variations/_view/base.js';
5
+ import { base as base$1 } from './variations/_size/base.js';
6
+ import { StyledPopover, StyledDropdown } from './Dropdown.styles.js';
7
+ import { getPlacements } from './utils/index.js';
8
+
9
+ var _excluded = ["id", "target", "children", "hasArrow", "role", "view", "size", "frame", "onToggle", "isFocusTrapped", "isOpen", "placement", "trigger", "offset", "preventOverflow", "closeOnOverlayClick", "closeOnEsc"];
10
+ /**
11
+ * Выпадающий список без внешнего контроля видимости.
12
+ */
13
+ var dropdownOldRoot = function dropdownOldRoot(Root) {
14
+ return /*#__PURE__*/forwardRef(function (_ref, outerRootRef) {
15
+ var id = _ref.id,
16
+ target = _ref.target,
17
+ children = _ref.children,
18
+ hasArrow = _ref.hasArrow,
19
+ role = _ref.role,
20
+ view = _ref.view,
21
+ size = _ref.size,
22
+ frame = _ref.frame,
23
+ _onToggle = _ref.onToggle,
24
+ _ref$isFocusTrapped = _ref.isFocusTrapped,
25
+ isFocusTrapped = _ref$isFocusTrapped === void 0 ? true : _ref$isFocusTrapped,
26
+ _ref$isOpen = _ref.isOpen,
27
+ isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
28
+ _ref$placement = _ref.placement,
29
+ placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
30
+ _ref$trigger = _ref.trigger,
31
+ trigger = _ref$trigger === void 0 ? 'click' : _ref$trigger,
32
+ _ref$offset = _ref.offset,
33
+ offset = _ref$offset === void 0 ? [0, 6] : _ref$offset,
34
+ _ref$preventOverflow = _ref.preventOverflow,
35
+ preventOverflow = _ref$preventOverflow === void 0 ? false : _ref$preventOverflow,
36
+ _ref$closeOnOverlayCl = _ref.closeOnOverlayClick,
37
+ closeOnOverlayClick = _ref$closeOnOverlayCl === void 0 ? false : _ref$closeOnOverlayCl,
38
+ _ref$closeOnEsc = _ref.closeOnEsc,
39
+ closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
40
+ rest = _objectWithoutProperties(_ref, _excluded);
41
+ var uniqId = useUniqId();
42
+ var innerId = id || uniqId;
43
+ var rootRef = useRef(null);
44
+ var dropdownRef = useRef(null);
45
+ var handleRef = useForkRef(rootRef, outerRootRef);
46
+ var trapRef = useFocusTrap(isOpen && isFocusTrapped);
47
+ var dropdownForkRef = useForkRef(dropdownRef, trapRef);
48
+ return /*#__PURE__*/React.createElement(StyledPopover, {
49
+ role: role,
50
+ isOpen: isOpen,
51
+ usePortal: false,
52
+ onToggle: function onToggle(is, event) {
53
+ return _onToggle === null || _onToggle === void 0 ? void 0 : _onToggle(is, event);
54
+ },
55
+ id: innerId,
56
+ ref: dropdownForkRef,
57
+ target: target,
58
+ offset: offset,
59
+ preventOverflow: preventOverflow,
60
+ hasArrow: hasArrow,
61
+ placement: getPlacements(placement),
62
+ trigger: trigger,
63
+ closeOnOverlayClick: closeOnOverlayClick,
64
+ closeOnEsc: closeOnEsc,
65
+ isFocusTrapped: isFocusTrapped,
66
+ frame: frame
67
+ }, /*#__PURE__*/React.createElement(Root, _extends({
68
+ ref: handleRef,
69
+ view: view,
70
+ size: size
71
+ }, rest), /*#__PURE__*/React.createElement(StyledDropdown, null, children)));
72
+ });
73
+ };
74
+ var dropdownOldConfig = {
75
+ name: 'Dropdown',
76
+ tag: 'div',
77
+ layout: dropdownOldRoot,
78
+ base: '',
79
+ variations: {
80
+ view: {
81
+ css: base
82
+ },
83
+ size: {
84
+ css: base$1
85
+ }
86
+ },
87
+ defaults: {
88
+ view: 'default',
89
+ size: 'm'
90
+ }
91
+ };
92
+
93
+ export { dropdownOldConfig, dropdownOldRoot };
94
+ //# sourceMappingURL=DropdownOld.js.map