@cloudscape-design/components 3.0.1083 → 3.0.1085
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/autosuggest/plain-list.js +1 -1
- package/autosuggest/plain-list.js.map +1 -1
- package/autosuggest/virtual-list.js +1 -1
- package/autosuggest/virtual-list.js.map +1 -1
- package/button-dropdown/internal.d.ts.map +1 -1
- package/button-dropdown/internal.js +1 -1
- package/button-dropdown/internal.js.map +1 -1
- package/button-group/internal.d.ts.map +1 -1
- package/button-group/internal.js +5 -87
- package/button-group/internal.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/option/index.d.ts +0 -1
- package/internal/components/option/index.d.ts.map +1 -1
- package/internal/components/option/index.js +2 -11
- package/internal/components/option/index.js.map +1 -1
- package/internal/components/option/interfaces.d.ts +0 -1
- package/internal/components/option/interfaces.d.ts.map +1 -1
- package/internal/components/option/interfaces.js.map +1 -1
- package/internal/components/option/option-parts.d.ts.map +1 -1
- package/internal/components/option/option-parts.js +1 -1
- package/internal/components/option/option-parts.js.map +1 -1
- package/internal/components/option/utils/unflatten-options.d.ts +15 -0
- package/internal/components/option/utils/unflatten-options.d.ts.map +1 -0
- package/internal/components/option/utils/unflatten-options.js +23 -0
- package/internal/components/option/utils/unflatten-options.js.map +1 -0
- package/internal/components/options-list/index.d.ts +2 -1
- package/internal/components/options-list/index.d.ts.map +1 -1
- package/internal/components/options-list/index.js +2 -2
- package/internal/components/options-list/index.js.map +1 -1
- package/internal/components/selectable-item/index.d.ts.map +1 -1
- package/internal/components/selectable-item/index.js +23 -20
- package/internal/components/selectable-item/index.js.map +1 -1
- package/internal/components/selectable-item/interfaces.d.ts +1 -0
- package/internal/components/selectable-item/interfaces.d.ts.map +1 -1
- package/internal/components/selectable-item/interfaces.js.map +1 -1
- package/internal/components/selectable-item/styles.css.js +22 -21
- package/internal/components/selectable-item/styles.scoped.css +42 -42
- package/internal/components/selectable-item/styles.selectors.js +22 -21
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/manifest.json +1 -1
- package/multiselect/use-multiselect.d.ts +2 -1
- package/multiselect/use-multiselect.d.ts.map +1 -1
- package/navigable-group/index.d.ts +8 -0
- package/navigable-group/index.d.ts.map +1 -0
- package/navigable-group/index.js +23 -0
- package/navigable-group/index.js.map +1 -0
- package/navigable-group/interfaces.d.ts +37 -0
- package/navigable-group/interfaces.d.ts.map +1 -0
- package/navigable-group/interfaces.js +4 -0
- package/navigable-group/interfaces.js.map +1 -0
- package/navigable-group/internal.d.ts +4 -0
- package/navigable-group/internal.d.ts.map +1 -0
- package/navigable-group/internal.js +125 -0
- package/navigable-group/internal.js.map +1 -0
- package/navigable-group/styles.css.js +6 -0
- package/navigable-group/styles.scoped.css +7 -0
- package/navigable-group/styles.selectors.js +7 -0
- package/navigable-group/test-classes/styles.css.js +6 -0
- package/navigable-group/test-classes/styles.scoped.css +7 -0
- package/navigable-group/test-classes/styles.selectors.js +7 -0
- package/package.json +2 -1
- package/select/internal.js +1 -1
- package/select/internal.js.map +1 -1
- package/select/parts/item.d.ts +1 -0
- package/select/parts/item.d.ts.map +1 -1
- package/select/parts/item.js +2 -2
- package/select/parts/item.js.map +1 -1
- package/select/parts/multiselect-item.d.ts.map +1 -1
- package/select/parts/multiselect-item.js +2 -2
- package/select/parts/multiselect-item.js.map +1 -1
- package/select/parts/option-group.d.ts +14 -0
- package/select/parts/option-group.d.ts.map +1 -0
- package/select/parts/option-group.js +9 -0
- package/select/parts/option-group.js.map +1 -0
- package/select/parts/plain-list.d.ts.map +1 -1
- package/select/parts/plain-list.js +4 -2
- package/select/parts/plain-list.js.map +1 -1
- package/select/parts/styles.css.js +22 -21
- package/select/parts/styles.scoped.css +26 -22
- package/select/parts/styles.selectors.js +22 -21
- package/select/parts/virtual-list.d.ts.map +1 -1
- package/select/parts/virtual-list.js +5 -3
- package/select/parts/virtual-list.js.map +1 -1
- package/select/utils/render-options.d.ts +2 -0
- package/select/utils/render-options.d.ts.map +1 -1
- package/select/utils/render-options.js +23 -3
- package/select/utils/render-options.js.map +1 -1
- package/select/utils/use-select.d.ts +1 -1
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +6 -1
- package/select/utils/use-select.js.map +1 -1
- package/test-utils/dom/index.d.ts +20 -0
- package/test-utils/dom/index.js +12 -1
- package/test-utils/dom/index.js.map +1 -1
- package/test-utils/dom/navigable-group/index.d.ts +5 -0
- package/test-utils/dom/navigable-group/index.js +14 -0
- package/test-utils/dom/navigable-group/index.js.map +1 -0
- package/test-utils/selectors/index.d.ts +18 -0
- package/test-utils/selectors/index.js +12 -1
- package/test-utils/selectors/index.js.map +1 -1
- package/test-utils/selectors/navigable-group/index.d.ts +5 -0
- package/test-utils/selectors/navigable-group/index.js +14 -0
- package/test-utils/selectors/navigable-group/index.js.map +1 -0
- package/token-group/internal.js +1 -1
- package/token-group/internal.js.map +1 -1
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
*/
|
|
143
143
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
144
144
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
145
|
-
.awsui_selectable-
|
|
145
|
+
.awsui_selectable-item_15o6u_d2ghy_145:not(#\9) {
|
|
146
146
|
font-size: var(--font-size-body-m-a7nh2n, 14px);
|
|
147
147
|
line-height: var(--line-height-body-m-2mh3ke, 20px);
|
|
148
148
|
color: var(--color-text-body-default-vvtq8u, #0f141a);
|
|
@@ -164,17 +164,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
164
164
|
padding-block: calc(var(--space-xxs-hwfkai, 4px) + var(--border-item-width-miijiw, 2px) - var(--border-divider-list-width-tdfx1x, 1px));
|
|
165
165
|
padding-inline: calc(var(--space-field-horizontal-0aq2ch, 12px) + var(--border-item-width-miijiw, 2px));
|
|
166
166
|
}
|
|
167
|
-
.awsui_selectable-
|
|
167
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_pad-bottom_15o6u_d2ghy_167:not(#\9) {
|
|
168
168
|
padding-block-end: calc(calc(var(--space-xxs-hwfkai, 4px) + var(--border-item-width-miijiw, 2px) - var(--border-divider-list-width-tdfx1x, 1px)) + var(--space-xxxs-pajhad, 2px));
|
|
169
169
|
border-block-end-color: transparent;
|
|
170
170
|
}
|
|
171
|
-
.awsui_selectable-
|
|
171
|
+
.awsui_selectable-item_15o6u_d2ghy_145:not(#\9):not(:first-child), .awsui_selectable-item_15o6u_d2ghy_145.awsui_virtual_15o6u_d2ghy_171:not(#\9) {
|
|
172
172
|
margin-block-start: calc(-1 * var(--border-item-width-miijiw, 2px));
|
|
173
173
|
}
|
|
174
|
-
.awsui_selectable-
|
|
174
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_has-background_15o6u_d2ghy_174:not(#\9) {
|
|
175
175
|
background-color: var(--color-background-dropdown-item-hover-yunepc, #f3f3f7);
|
|
176
176
|
}
|
|
177
|
-
.awsui_selectable-
|
|
177
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_highlighted_15o6u_d2ghy_177:not(#\9), .awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177:not(#\9) {
|
|
178
178
|
color: var(--color-text-dropdown-item-highlighted-yr1px8, #0f141a);
|
|
179
179
|
border-width: var(--border-item-width-miijiw, 2px);
|
|
180
180
|
border-start-start-radius: var(--border-radius-item-iwaia5, 8px);
|
|
@@ -184,135 +184,135 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
184
184
|
padding-block: var(--space-xxs-hwfkai, 4px);
|
|
185
185
|
padding-inline: var(--space-field-horizontal-0aq2ch, 12px);
|
|
186
186
|
}
|
|
187
|
-
.awsui_selectable-
|
|
187
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_highlighted_15o6u_d2ghy_177.awsui_pad-bottom_15o6u_d2ghy_167:not(#\9), .awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177.awsui_pad-bottom_15o6u_d2ghy_167:not(#\9) {
|
|
188
188
|
padding-block-end: calc(var(--space-xxs-hwfkai, 4px) + var(--space-xxxs-pajhad, 2px));
|
|
189
189
|
}
|
|
190
|
-
.awsui_selectable-
|
|
190
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_highlighted_15o6u_d2ghy_177:not(#\9) {
|
|
191
191
|
z-index: 3;
|
|
192
192
|
background-color: var(--color-background-dropdown-item-hover-yunepc, #f3f3f7);
|
|
193
193
|
border-color: var(--color-border-dropdown-item-hover-aqfuxq, #8c8c94);
|
|
194
194
|
}
|
|
195
|
-
.awsui_selectable-
|
|
195
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_highlighted_15o6u_d2ghy_177.awsui_disabled_15o6u_d2ghy_195:not(#\9) {
|
|
196
196
|
color: var(--color-text-dropdown-item-dimmed-tq8vh3, #b4b4bb);
|
|
197
197
|
border-color: var(--color-border-dropdown-item-dimmed-hover-ga9sch, #8c8c94);
|
|
198
198
|
background-color: var(--color-background-dropdown-item-dimmed-dhho03, transparent);
|
|
199
199
|
}
|
|
200
|
-
.awsui_selectable-
|
|
200
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_highlighted_15o6u_d2ghy_177.awsui_is-keyboard_15o6u_d2ghy_200:not(#\9) {
|
|
201
201
|
border-color: var(--color-border-dropdown-item-focused-zacqlp, #424650);
|
|
202
202
|
}
|
|
203
|
-
.awsui_selectable-
|
|
203
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_highlighted_15o6u_d2ghy_177.awsui_is-keyboard_15o6u_d2ghy_200:not(#\9):not(.awsui_visual-refresh_15o6u_d2ghy_203) {
|
|
204
204
|
box-shadow: inset 0 0 0 var(--border-control-focus-ring-shadow-spread-9mjajk, 1px) var(--color-border-item-focused-uk47pl, #006ce0);
|
|
205
205
|
}
|
|
206
|
-
.awsui_selectable-
|
|
206
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177:not(#\9) {
|
|
207
207
|
z-index: 2;
|
|
208
208
|
background-color: var(--color-background-dropdown-item-selected-f3v6te, #f0fbff);
|
|
209
209
|
border-color: var(--color-border-dropdown-item-selected-dl2ezh, #006ce0);
|
|
210
210
|
}
|
|
211
|
-
.awsui_selectable-
|
|
211
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177.awsui_next-item-selected_15o6u_d2ghy_211:not(#\9) {
|
|
212
212
|
border-end-start-radius: 0;
|
|
213
213
|
border-end-end-radius: 0;
|
|
214
214
|
}
|
|
215
|
-
.awsui_selectable-
|
|
215
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177.awsui_highlighted_15o6u_d2ghy_177:not(#\9) {
|
|
216
216
|
border-color: var(--color-border-dropdown-item-selected-dl2ezh, #006ce0);
|
|
217
217
|
z-index: 3;
|
|
218
218
|
outline: var(--border-item-width-miijiw, 2px) solid var(--color-border-dropdown-item-hover-aqfuxq, #8c8c94);
|
|
219
219
|
outline-offset: calc(-2 * var(--border-item-width-miijiw, 2px));
|
|
220
220
|
}
|
|
221
|
-
.awsui_selectable-
|
|
221
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177.awsui_highlighted_15o6u_d2ghy_177.awsui_is-keyboard_15o6u_d2ghy_200:not(#\9) {
|
|
222
222
|
border-color: var(--color-border-dropdown-item-selected-dl2ezh, #006ce0);
|
|
223
223
|
outline-color: var(--color-border-dropdown-item-focused-zacqlp, #424650);
|
|
224
224
|
}
|
|
225
|
-
.awsui_selectable-
|
|
225
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177.awsui_highlighted_15o6u_d2ghy_177:not(#\9):not(.awsui_visual-refresh_15o6u_d2ghy_203) {
|
|
226
226
|
border-color: var(--color-border-dropdown-item-hover-aqfuxq, #8c8c94);
|
|
227
227
|
outline: none;
|
|
228
228
|
}
|
|
229
|
-
.awsui_selectable-
|
|
229
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177.awsui_highlighted_15o6u_d2ghy_177:not(#\9):not(.awsui_visual-refresh_15o6u_d2ghy_203).awsui_is-keyboard_15o6u_d2ghy_200 {
|
|
230
230
|
border-color: var(--color-border-dropdown-item-focused-zacqlp, #424650);
|
|
231
231
|
}
|
|
232
|
-
.awsui_selectable-
|
|
232
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177 + .awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177:not(#\9), .awsui_selectable-item_15o6u_d2ghy_145.awsui_selected_15o6u_d2ghy_177.awsui_previous-item-selected_15o6u_d2ghy_232:not(#\9) {
|
|
233
233
|
border-start-start-radius: 0;
|
|
234
234
|
border-start-end-radius: 0;
|
|
235
235
|
}
|
|
236
|
-
.awsui_selectable-
|
|
236
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_parent_15o6u_d2ghy_236:not(#\9) {
|
|
237
237
|
font-weight: bold;
|
|
238
238
|
color: var(--color-text-dropdown-group-label-2tmyik, #424650);
|
|
239
239
|
}
|
|
240
|
-
.awsui_selectable-
|
|
240
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_parent_15o6u_d2ghy_236:not(#\9):not(.awsui_interactiveGroups_15o6u_d2ghy_240) {
|
|
241
241
|
border-block-start-color: var(--color-border-dropdown-group-ylcnh8, #c6c6cd);
|
|
242
242
|
padding-block: var(--space-xs-ymlm0b, 8px);
|
|
243
243
|
padding-inline: var(--space-xs-ymlm0b, 8px);
|
|
244
244
|
}
|
|
245
|
-
.awsui_selectable-
|
|
245
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_parent_15o6u_d2ghy_236.awsui_interactiveGroups_15o6u_d2ghy_240:not(#\9) {
|
|
246
246
|
padding-block: calc(var(--space-xs-ymlm0b, 8px) + var(--border-item-width-miijiw, 2px) - var(--border-divider-list-width-tdfx1x, 1px));
|
|
247
247
|
padding-inline: calc(var(--space-field-horizontal-0aq2ch, 12px) + var(--border-item-width-miijiw, 2px));
|
|
248
248
|
}
|
|
249
|
-
.awsui_selectable-
|
|
249
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_parent_15o6u_d2ghy_236.awsui_interactiveGroups_15o6u_d2ghy_240.awsui_highlighted_15o6u_d2ghy_177:not(#\9) {
|
|
250
250
|
color: var(--color-text-dropdown-item-highlighted-yr1px8, #0f141a);
|
|
251
251
|
}
|
|
252
|
-
.awsui_selectable-
|
|
252
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_parent_15o6u_d2ghy_236.awsui_interactiveGroups_15o6u_d2ghy_240.awsui_highlighted_15o6u_d2ghy_177:not(#\9), .awsui_selectable-item_15o6u_d2ghy_145.awsui_parent_15o6u_d2ghy_236.awsui_interactiveGroups_15o6u_d2ghy_240.awsui_selected_15o6u_d2ghy_177:not(#\9) {
|
|
253
253
|
padding-block: var(--space-xs-ymlm0b, 8px);
|
|
254
254
|
padding-inline: var(--space-field-horizontal-0aq2ch, 12px);
|
|
255
255
|
}
|
|
256
|
-
.awsui_selectable-
|
|
256
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_child_15o6u_d2ghy_256:not(#\9) {
|
|
257
257
|
padding-inline-start: calc(var(--space-xxl-32srm4, 32px) + var(--border-item-width-miijiw, 2px));
|
|
258
258
|
}
|
|
259
|
-
.awsui_selectable-
|
|
259
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_child_15o6u_d2ghy_256.awsui_highlighted_15o6u_d2ghy_177:not(#\9), .awsui_selectable-item_15o6u_d2ghy_145.awsui_child_15o6u_d2ghy_256.awsui_selected_15o6u_d2ghy_177:not(#\9) {
|
|
260
260
|
padding-inline-start: var(--space-xxl-32srm4, 32px);
|
|
261
261
|
}
|
|
262
|
-
.awsui_selectable-
|
|
262
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(#\9) {
|
|
263
263
|
position: sticky;
|
|
264
264
|
inset-block-start: 0;
|
|
265
265
|
margin-block-end: calc(var(--border-item-width-miijiw, 2px) - var(--border-divider-list-width-tdfx1x, 1px));
|
|
266
266
|
z-index: 4;
|
|
267
267
|
}
|
|
268
|
-
.awsui_selectable-
|
|
268
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(#\9):not(.awsui_highlighted_15o6u_d2ghy_177):not(.awsui_selected_15o6u_d2ghy_177) {
|
|
269
269
|
border-inline-start-width: var(--border-item-width-miijiw, 2px);
|
|
270
270
|
border-inline-start-color: var(--color-border-dropdown-container-cmthq7, #b4b4bb);
|
|
271
271
|
border-inline-end-color: var(--color-border-dropdown-container-cmthq7, #b4b4bb);
|
|
272
272
|
padding-inline: var(--space-field-horizontal-0aq2ch, 12px);
|
|
273
273
|
}
|
|
274
|
-
.awsui_selectable-
|
|
274
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(#\9):not(.awsui_highlighted_15o6u_d2ghy_177):not(.awsui_selected_15o6u_d2ghy_177):not(.awsui_with-scrollbar_15o6u_d2ghy_274) {
|
|
275
275
|
border-inline-end-width: var(--border-item-width-miijiw, 2px);
|
|
276
276
|
}
|
|
277
|
-
.awsui_selectable-
|
|
277
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(#\9):not(.awsui_highlighted_15o6u_d2ghy_177):not(.awsui_selected_15o6u_d2ghy_177).awsui_with-scrollbar_15o6u_d2ghy_274 {
|
|
278
278
|
border-inline-end-width: 0;
|
|
279
279
|
}
|
|
280
|
-
.awsui_selectable-
|
|
280
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(#\9):not(.awsui_highlighted_15o6u_d2ghy_177):not(.awsui_selected_15o6u_d2ghy_177):not(.awsui_after-header_15o6u_d2ghy_280) {
|
|
281
281
|
border-start-start-radius: var(--border-radius-item-iwaia5, 8px);
|
|
282
282
|
}
|
|
283
|
-
.awsui_selectable-
|
|
283
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(#\9):not(.awsui_highlighted_15o6u_d2ghy_177):not(.awsui_selected_15o6u_d2ghy_177):not(.awsui_after-header_15o6u_d2ghy_280):not(.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(.awsui_highlighted_15o6u_d2ghy_177):not(.awsui_selected_15o6u_d2ghy_177):not(.awsui_after-header_15o6u_d2ghy_280).awsui_with-scrollbar_15o6u_d2ghy_274) {
|
|
284
284
|
border-start-end-radius: var(--border-radius-item-iwaia5, 8px);
|
|
285
285
|
}
|
|
286
|
-
.awsui_selectable-
|
|
286
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262:not(#\9):not(.awsui_highlighted_15o6u_d2ghy_177):not(.awsui_selected_15o6u_d2ghy_177).awsui_after-header_15o6u_d2ghy_280 {
|
|
287
287
|
border-block-start-color: var(--color-background-dropdown-item-default-qmc033, #ffffff);
|
|
288
288
|
}
|
|
289
|
-
.awsui_selectable-
|
|
289
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262.awsui_disabled_15o6u_d2ghy_195.awsui_highlighted_15o6u_d2ghy_177:not(#\9), .awsui_selectable-item_15o6u_d2ghy_145.awsui_sticky_15o6u_d2ghy_262.awsui_disabled_15o6u_d2ghy_195.awsui_selected_15o6u_d2ghy_177:not(#\9) {
|
|
290
290
|
border-block-end-color: transparent;
|
|
291
291
|
border-block-start-color: transparent;
|
|
292
292
|
border-inline-start-color: transparent;
|
|
293
293
|
border-inline-end-color: transparent;
|
|
294
294
|
}
|
|
295
|
-
.awsui_selectable-
|
|
295
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_disabled_15o6u_d2ghy_195:not(#\9) {
|
|
296
296
|
color: var(--color-text-dropdown-item-disabled-8m65hf, #b4b4bb);
|
|
297
297
|
}
|
|
298
|
-
.awsui_selectable-
|
|
298
|
+
.awsui_selectable-item_15o6u_d2ghy_145:not(#\9):not(.awsui_disabled_15o6u_d2ghy_195):not(.awsui_parent_15o6u_d2ghy_236) {
|
|
299
299
|
cursor: pointer;
|
|
300
300
|
}
|
|
301
|
-
.awsui_selectable-
|
|
301
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_interactiveGroups_15o6u_d2ghy_240:not(#\9):not(.awsui_disabled_15o6u_d2ghy_195) {
|
|
302
302
|
cursor: pointer;
|
|
303
303
|
}
|
|
304
|
-
.awsui_selectable-
|
|
304
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_virtual_15o6u_d2ghy_171:not(#\9) {
|
|
305
305
|
position: absolute;
|
|
306
306
|
inset-block-start: var(--border-dropdown-virtual-offset-width-3wp954, 2px);
|
|
307
307
|
inset-inline-start: 0;
|
|
308
308
|
inline-size: 100%;
|
|
309
309
|
box-sizing: border-box;
|
|
310
310
|
}
|
|
311
|
-
.awsui_selectable-
|
|
311
|
+
.awsui_selectable-item_15o6u_d2ghy_145.awsui_virtual_15o6u_d2ghy_171:not(#\9):first-of-type:not(.awsui_selected_15o6u_d2ghy_177, .awsui_highlighted_15o6u_d2ghy_177) {
|
|
312
312
|
border-block-start-color: var(--color-border-dropdown-item-top-gp2d1p, transparent);
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
.awsui_measure-
|
|
315
|
+
.awsui_measure-strut_15o6u_d2ghy_315:not(#\9) {
|
|
316
316
|
position: absolute;
|
|
317
317
|
pointer-events: none;
|
|
318
318
|
block-size: 100%;
|
|
@@ -321,20 +321,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
321
321
|
inset-inline-start: 0;
|
|
322
322
|
padding-block-start: var(--border-divider-list-width-tdfx1x, 1px);
|
|
323
323
|
}
|
|
324
|
-
.awsui_measure-strut-
|
|
324
|
+
.awsui_measure-strut-first_15o6u_d2ghy_324:not(#\9) {
|
|
325
325
|
padding-block-end: var(--border-divider-list-width-tdfx1x, 1px);
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
.awsui_screenreader-
|
|
328
|
+
.awsui_screenreader-content_15o6u_d2ghy_328:not(#\9) {
|
|
329
329
|
position: absolute !important;
|
|
330
330
|
inset-block-start: -9999px !important;
|
|
331
331
|
inset-inline-start: -9999px !important;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
.awsui_option-
|
|
334
|
+
.awsui_option-content_15o6u_d2ghy_334:not(#\9) {
|
|
335
335
|
/* used in test-utils */
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
.awsui_select-
|
|
338
|
+
.awsui_select-all_15o6u_d2ghy_338:not(#\9) {
|
|
339
339
|
/* used in test-utils */
|
|
340
340
|
}
|
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"selectable-item": "awsui_selectable-
|
|
6
|
-
"pad-bottom": "awsui_pad-
|
|
7
|
-
"virtual": "
|
|
8
|
-
"has-background": "awsui_has-
|
|
9
|
-
"highlighted": "
|
|
10
|
-
"selected": "
|
|
11
|
-
"disabled": "
|
|
12
|
-
"is-keyboard": "awsui_is-
|
|
13
|
-
"visual-refresh": "awsui_visual-
|
|
14
|
-
"next-item-selected": "awsui_next-item-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"measure-strut
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
5
|
+
"selectable-item": "awsui_selectable-item_15o6u_d2ghy_145",
|
|
6
|
+
"pad-bottom": "awsui_pad-bottom_15o6u_d2ghy_167",
|
|
7
|
+
"virtual": "awsui_virtual_15o6u_d2ghy_171",
|
|
8
|
+
"has-background": "awsui_has-background_15o6u_d2ghy_174",
|
|
9
|
+
"highlighted": "awsui_highlighted_15o6u_d2ghy_177",
|
|
10
|
+
"selected": "awsui_selected_15o6u_d2ghy_177",
|
|
11
|
+
"disabled": "awsui_disabled_15o6u_d2ghy_195",
|
|
12
|
+
"is-keyboard": "awsui_is-keyboard_15o6u_d2ghy_200",
|
|
13
|
+
"visual-refresh": "awsui_visual-refresh_15o6u_d2ghy_203",
|
|
14
|
+
"next-item-selected": "awsui_next-item-selected_15o6u_d2ghy_211",
|
|
15
|
+
"previous-item-selected": "awsui_previous-item-selected_15o6u_d2ghy_232",
|
|
16
|
+
"parent": "awsui_parent_15o6u_d2ghy_236",
|
|
17
|
+
"interactiveGroups": "awsui_interactiveGroups_15o6u_d2ghy_240",
|
|
18
|
+
"child": "awsui_child_15o6u_d2ghy_256",
|
|
19
|
+
"sticky": "awsui_sticky_15o6u_d2ghy_262",
|
|
20
|
+
"with-scrollbar": "awsui_with-scrollbar_15o6u_d2ghy_274",
|
|
21
|
+
"after-header": "awsui_after-header_15o6u_d2ghy_280",
|
|
22
|
+
"measure-strut": "awsui_measure-strut_15o6u_d2ghy_315",
|
|
23
|
+
"measure-strut-first": "awsui_measure-strut-first_15o6u_d2ghy_324",
|
|
24
|
+
"screenreader-content": "awsui_screenreader-content_15o6u_d2ghy_328",
|
|
25
|
+
"option-content": "awsui_option-content_15o6u_d2ghy_334",
|
|
26
|
+
"select-all": "awsui_select-all_15o6u_d2ghy_338"
|
|
26
27
|
};
|
|
27
28
|
|
package/internal/environment.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (746aab5c)";
|
|
3
|
+
export var GIT_SHA = "746aab5c";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "console";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
package/internal/manifest.json
CHANGED
|
@@ -74,10 +74,11 @@ export declare function useMultiselect({
|
|
|
74
74
|
onMouseUp?: ((itemIndex: number) => void) | undefined;
|
|
75
75
|
nativeAttributes?: Record<string, any> | undefined;
|
|
76
76
|
ariaLabel?: string | undefined;
|
|
77
|
+
tagOverride?: "div" | "ul" | undefined;
|
|
77
78
|
statusType: DropdownStatusProps.StatusType;
|
|
78
79
|
decreaseBlockMargin?: boolean | undefined;
|
|
79
80
|
stickyItemBlockSize?: number | null | undefined;
|
|
80
|
-
ref: React.RefObject<
|
|
81
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
81
82
|
};
|
|
82
83
|
getOptionProps: (option: DropdownOption, index: number) => any;
|
|
83
84
|
getTokenProps: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-multiselect.d.ts","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,cAAc,EAAiC,MAAM,0CAA0C,CAAC;AAIzG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAO7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,qBAAqB,GAAG,YAAY,CACvC,IAAI,CACF,gBAAgB,EACd,SAAS,GACT,iBAAiB,GACjB,eAAe,GACf,sBAAsB,GACtB,UAAU,GACV,SAAS,GACT,2BAA2B,GAC3B,mBAAmB,GACnB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,aAAa,CAChB,GACC,mBAAmB,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;CAC9C,EACH,SAAS,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,UAAU,CAC5E,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3B,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,eAAe,EACf,WAAW,EACX,GAAG,SAAS,EACb,EAAE,qBAAqB
|
|
1
|
+
{"version":3,"file":"use-multiselect.d.ts","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,cAAc,EAAiC,MAAM,0CAA0C,CAAC;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AW,EACX,GAAG,SAAS,EACb,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAuLc,gBAAgB;;;;;;;;;;EA0CrD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavigableGroupProps } from './interfaces';
|
|
3
|
+
export { NavigableGroupProps };
|
|
4
|
+
/**
|
|
5
|
+
* @awsuiSystem core
|
|
6
|
+
*/
|
|
7
|
+
declare const NavigableGroup: React.ForwardRefExoticComponent<NavigableGroupProps & React.RefAttributes<NavigableGroupProps.Ref>>;
|
|
8
|
+
export default NavigableGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B;;GAEG;AACH,QAAA,MAAM,cAAc,qGAMlB,CAAC;AAGH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
4
|
+
import { __rest } from "tslib";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
8
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
9
|
+
import { getExternalProps } from '../internal/utils/external-props';
|
|
10
|
+
import InternalNavigableGroup from './internal';
|
|
11
|
+
/**
|
|
12
|
+
* @awsuiSystem core
|
|
13
|
+
*/
|
|
14
|
+
const NavigableGroup = React.forwardRef((_a, ref) => {
|
|
15
|
+
var rest = __rest(_a, []);
|
|
16
|
+
const baseProps = getBaseProps(rest);
|
|
17
|
+
const baseComponentProps = useBaseComponent('NavigableGroup');
|
|
18
|
+
const externalProps = getExternalProps(rest);
|
|
19
|
+
return React.createElement(InternalNavigableGroup, Object.assign({}, baseProps, baseComponentProps, externalProps, { ref: ref }));
|
|
20
|
+
});
|
|
21
|
+
applyDisplayName(NavigableGroup, 'NavigableGroup');
|
|
22
|
+
export default NavigableGroup;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/navigable-group/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,sBAAsB,MAAM,YAAY,CAAC;AAIhD;;GAEG;AACH,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAgC,EAAE,GAAuC,EAAE,EAAE;QAAxE,IAAI,cAAT,EAAW,CAAF;IAChD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC9D,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAE7C,OAAO,oBAAC,sBAAsB,oBAAK,SAAS,EAAM,kBAAkB,EAAM,aAAa,IAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACxG,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { NavigableGroupProps } from './interfaces';\nimport InternalNavigableGroup from './internal';\n\nexport { NavigableGroupProps };\n\n/**\n * @awsuiSystem core\n */\nconst NavigableGroup = React.forwardRef(({ ...rest }: NavigableGroupProps, ref: React.Ref<NavigableGroupProps.Ref>) => {\n const baseProps = getBaseProps(rest);\n const baseComponentProps = useBaseComponent('NavigableGroup');\n const externalProps = getExternalProps(rest);\n\n return <InternalNavigableGroup {...baseProps} {...baseComponentProps} {...externalProps} ref={ref} />;\n});\n\napplyDisplayName(NavigableGroup, 'NavigableGroup');\nexport default NavigableGroup;\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseComponentProps } from '../internal/base-component';
|
|
3
|
+
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
4
|
+
export interface NavigableGroupProps extends BaseComponentProps {
|
|
5
|
+
/**
|
|
6
|
+
* The children that will be rendered inside the navigation group.
|
|
7
|
+
*
|
|
8
|
+
* The following Cloudscape components are supported, but do not
|
|
9
|
+
* need to be direct children of the group:
|
|
10
|
+
* - Button
|
|
11
|
+
* - Button dropdown
|
|
12
|
+
* - Toggle button
|
|
13
|
+
* - Link
|
|
14
|
+
*/
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* A method that should return a unique identifier for a given element.
|
|
18
|
+
* The element passed will be the first focusable descendent of a child component.
|
|
19
|
+
*/
|
|
20
|
+
getItemKey: (element: HTMLElement) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Determines which arrow keys move focus sequentially within the group:
|
|
23
|
+
* - `horizontal` - left and right arrow keys
|
|
24
|
+
* - `vertical` - up and down arrow keys
|
|
25
|
+
* - `both` - all arrow keys
|
|
26
|
+
*/
|
|
27
|
+
navigationDirection?: 'horizontal' | 'vertical' | 'both';
|
|
28
|
+
}
|
|
29
|
+
export interface InternalNavigableGroupProps extends NavigableGroupProps, InternalBaseComponentProps {}
|
|
30
|
+
export declare namespace NavigableGroupProps {
|
|
31
|
+
interface Ref {
|
|
32
|
+
/**
|
|
33
|
+
* Focuses the first focusable element (or previously focused element) in the navigation group.
|
|
34
|
+
*/
|
|
35
|
+
focus(): void;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D;;;;;;;;;OASG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,CAAC;IAC7C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;CAC1D;AAED,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB,EAAE,0BAA0B;CAAG;AAEvG,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/navigable-group/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface NavigableGroupProps extends BaseComponentProps {\n /**\n * The children that will be rendered inside the navigation group.\n *\n * The following Cloudscape components are supported, but do not\n * need to be direct children of the group:\n * - Button\n * - Button dropdown\n * - Toggle button\n * - Link\n */\n children: React.ReactNode;\n /**\n * A method that should return a unique identifier for a given element.\n * The element passed will be the first focusable descendent of a child component.\n */\n getItemKey: (element: HTMLElement) => string;\n /**\n * Determines which arrow keys move focus sequentially within the group:\n * - `horizontal` - left and right arrow keys\n * - `vertical` - up and down arrow keys\n * - `both` - all arrow keys\n */\n navigationDirection?: 'horizontal' | 'vertical' | 'both';\n}\n\nexport interface InternalNavigableGroupProps extends NavigableGroupProps, InternalBaseComponentProps {}\n\nexport namespace NavigableGroupProps {\n export interface Ref {\n /**\n * Focuses the first focusable element (or previously focused element) in the navigation group.\n */\n focus(): void;\n }\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InternalNavigableGroupProps, NavigableGroupProps } from './interfaces';
|
|
3
|
+
declare const InternalNavigableGroup: React.ForwardRefExoticComponent<InternalNavigableGroupProps & React.RefAttributes<NavigableGroupProps.Ref>>;
|
|
4
|
+
export default InternalNavigableGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAelF,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKhF,QAAA,MAAM,sBAAsB,6GA+I3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';
|
|
7
|
+
import { SingleTabStopNavigationProvider, } from '@cloudscape-design/component-toolkit/internal';
|
|
8
|
+
import { getBaseProps } from '../internal/base-component';
|
|
9
|
+
import { getAllFocusables } from '../internal/components/focus-lock/utils';
|
|
10
|
+
import { hasModifierKeys } from '../internal/events';
|
|
11
|
+
import { KeyCode } from '../internal/keycode';
|
|
12
|
+
import { circleIndex } from '../internal/utils/circle-index';
|
|
13
|
+
import handleKey from '../internal/utils/handle-key';
|
|
14
|
+
import styles from './styles.css.js';
|
|
15
|
+
import testUtilStyles from './test-classes/styles.css.js';
|
|
16
|
+
const InternalNavigableGroup = forwardRef((_a, ref) => {
|
|
17
|
+
var { children, getItemKey, navigationDirection = 'horizontal', __internalRootRef } = _a, props = __rest(_a, ["children", "getItemKey", "navigationDirection", "__internalRootRef"]);
|
|
18
|
+
const baseProps = getBaseProps(props);
|
|
19
|
+
const navigationAPI = useRef(null);
|
|
20
|
+
const containerObjectRef = useRef(null);
|
|
21
|
+
const containerRef = useMergeRefs(containerObjectRef, __internalRootRef);
|
|
22
|
+
const focusedIdRef = useRef();
|
|
23
|
+
useImperativeHandle(ref, () => ({
|
|
24
|
+
focus: () => {
|
|
25
|
+
const target = getNextFocusTarget();
|
|
26
|
+
if (target) {
|
|
27
|
+
target.focus();
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
function getNextFocusTarget() {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
if (containerObjectRef.current) {
|
|
34
|
+
const focusables = getFocusablesFrom(containerObjectRef.current);
|
|
35
|
+
return (_b = (_a = focusables.find(el => getItemKey(el) === focusedIdRef.current)) !== null && _a !== void 0 ? _a : focusables[0]) !== null && _b !== void 0 ? _b : null;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function onUnregisterActive(focusableElement) {
|
|
40
|
+
var _a;
|
|
41
|
+
// Only refocus when the node is actually removed (no such element anymore).
|
|
42
|
+
const target = (_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.getFocusTarget();
|
|
43
|
+
if (target && getItemKey(target) !== getItemKey(focusableElement)) {
|
|
44
|
+
target.focus();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
var _a;
|
|
49
|
+
(_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.updateFocusTarget();
|
|
50
|
+
});
|
|
51
|
+
function onFocus(event) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
if (event.target instanceof HTMLElement && ((_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.isRegistered(event.target))) {
|
|
54
|
+
focusedIdRef.current = getItemKey(event.target);
|
|
55
|
+
}
|
|
56
|
+
(_b = navigationAPI.current) === null || _b === void 0 ? void 0 : _b.updateFocusTarget();
|
|
57
|
+
}
|
|
58
|
+
function onBlur() {
|
|
59
|
+
var _a;
|
|
60
|
+
(_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.updateFocusTarget();
|
|
61
|
+
}
|
|
62
|
+
function onKeyDown(event) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
const focusTarget = (_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.getFocusTarget();
|
|
65
|
+
let specialKeys = [];
|
|
66
|
+
switch (navigationDirection) {
|
|
67
|
+
case 'horizontal':
|
|
68
|
+
specialKeys = [KeyCode.right, KeyCode.left];
|
|
69
|
+
break;
|
|
70
|
+
case 'vertical':
|
|
71
|
+
specialKeys = [KeyCode.down, KeyCode.up];
|
|
72
|
+
break;
|
|
73
|
+
case 'both':
|
|
74
|
+
specialKeys = [KeyCode.right, KeyCode.left, KeyCode.down, KeyCode.up];
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
specialKeys.push(KeyCode.end, KeyCode.home, KeyCode.pageUp, KeyCode.pageDown);
|
|
78
|
+
if (hasModifierKeys(event) || specialKeys.indexOf(event.keyCode) === -1) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (!containerObjectRef.current || !focusTarget) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// Ignore navigation when the focused element is not a registered focusable.
|
|
85
|
+
if (document.activeElement && !((_b = navigationAPI.current) === null || _b === void 0 ? void 0 : _b.isRegistered(document.activeElement))) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
const focusables = getFocusablesFrom(containerObjectRef.current);
|
|
90
|
+
const activeIndex = focusables.indexOf(focusTarget);
|
|
91
|
+
const getNextIndex = (delta) => {
|
|
92
|
+
const newIndex = activeIndex + delta;
|
|
93
|
+
return circleIndex(newIndex, [0, focusables.length - 1]);
|
|
94
|
+
};
|
|
95
|
+
handleKey(event, {
|
|
96
|
+
onHome: () => focusElement(focusables[0]),
|
|
97
|
+
onEnd: () => focusElement(focusables[focusables.length - 1]),
|
|
98
|
+
onInlineStart: () => focusElement(focusables[getNextIndex(-1)]),
|
|
99
|
+
onBlockStart: () => focusElement(focusables[getNextIndex(-1)]),
|
|
100
|
+
onInlineEnd: () => focusElement(focusables[getNextIndex(1)]),
|
|
101
|
+
onBlockEnd: () => focusElement(focusables[getNextIndex(1)]),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function focusElement(element) {
|
|
105
|
+
element.focus();
|
|
106
|
+
}
|
|
107
|
+
// List all non-disabled and registered focusables: those are eligible for keyboard navigation.
|
|
108
|
+
function getFocusablesFrom(target) {
|
|
109
|
+
function isElementRegistered(element) {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
return (_b = (_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.isRegistered(element)) !== null && _b !== void 0 ? _b : false;
|
|
112
|
+
}
|
|
113
|
+
function isElementDisabled(element) {
|
|
114
|
+
if ('disabled' in element) {
|
|
115
|
+
return element.disabled;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
return getAllFocusables(target).filter(el => isElementRegistered(el) && !isElementDisabled(el));
|
|
120
|
+
}
|
|
121
|
+
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles.root, testUtilStyles.root, baseProps.className), ref: containerRef, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown }),
|
|
122
|
+
React.createElement(SingleTabStopNavigationProvider, { ref: navigationAPI, navigationActive: true, getNextFocusTarget: getNextFocusTarget, onUnregisterActive: onUnregisterActive }, children)));
|
|
123
|
+
});
|
|
124
|
+
export default InternalNavigableGroup;
|
|
125
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/navigable-group/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAEL,+BAA+B,GAChC,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAGrD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OA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CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport {\n SingleTabStopNavigationAPI,\n SingleTabStopNavigationProvider,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { getAllFocusables } from '../internal/components/focus-lock/utils';\nimport { hasModifierKeys } from '../internal/events';\nimport { KeyCode } from '../internal/keycode';\nimport { circleIndex } from '../internal/utils/circle-index';\nimport handleKey from '../internal/utils/handle-key';\nimport { InternalNavigableGroupProps, NavigableGroupProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nconst InternalNavigableGroup = forwardRef(\n (\n {\n children,\n getItemKey,\n navigationDirection = 'horizontal',\n __internalRootRef,\n ...props\n }: InternalNavigableGroupProps,\n ref: React.Ref<NavigableGroupProps.Ref>\n ) => {\n const baseProps = getBaseProps(props);\n const navigationAPI = useRef<SingleTabStopNavigationAPI>(null);\n const containerObjectRef = useRef<HTMLDivElement>(null);\n const containerRef = useMergeRefs(containerObjectRef, __internalRootRef);\n const focusedIdRef = useRef<string>();\n\n useImperativeHandle(ref, () => ({\n focus: () => {\n const target = getNextFocusTarget();\n if (target) {\n target.focus();\n }\n },\n }));\n\n function getNextFocusTarget(): null | HTMLElement {\n if (containerObjectRef.current) {\n const focusables = getFocusablesFrom(containerObjectRef.current);\n return focusables.find(el => getItemKey(el) === focusedIdRef.current) ?? focusables[0] ?? null;\n }\n return null;\n }\n\n function onUnregisterActive(focusableElement: HTMLElement) {\n // Only refocus when the node is actually removed (no such element anymore).\n const target = navigationAPI.current?.getFocusTarget();\n\n if (target && getItemKey(target) !== getItemKey(focusableElement)) {\n target.focus();\n }\n }\n\n useEffect(() => {\n navigationAPI.current?.updateFocusTarget();\n });\n\n function onFocus(event: React.FocusEvent) {\n if (event.target instanceof HTMLElement && navigationAPI.current?.isRegistered(event.target)) {\n focusedIdRef.current = getItemKey(event.target);\n }\n navigationAPI.current?.updateFocusTarget();\n }\n\n function onBlur() {\n navigationAPI.current?.updateFocusTarget();\n }\n\n function onKeyDown(event: React.KeyboardEvent) {\n const focusTarget = navigationAPI.current?.getFocusTarget();\n let specialKeys = [];\n switch (navigationDirection) {\n case 'horizontal':\n specialKeys = [KeyCode.right, KeyCode.left];\n break;\n case 'vertical':\n specialKeys = [KeyCode.down, KeyCode.up];\n break;\n case 'both':\n specialKeys = [KeyCode.right, KeyCode.left, KeyCode.down, KeyCode.up];\n break;\n }\n specialKeys.push(KeyCode.end, KeyCode.home, KeyCode.pageUp, KeyCode.pageDown);\n if (hasModifierKeys(event) || specialKeys.indexOf(event.keyCode) === -1) {\n return;\n }\n if (!containerObjectRef.current || !focusTarget) {\n return;\n }\n // Ignore navigation when the focused element is not a registered focusable.\n if (document.activeElement && !navigationAPI.current?.isRegistered(document.activeElement)) {\n return;\n }\n event.preventDefault();\n\n const focusables = getFocusablesFrom(containerObjectRef.current);\n const activeIndex = focusables.indexOf(focusTarget);\n const getNextIndex = (delta: number) => {\n const newIndex = activeIndex + delta;\n return circleIndex(newIndex, [0, focusables.length - 1]);\n };\n\n handleKey(event as any, {\n onHome: () => focusElement(focusables[0]),\n onEnd: () => focusElement(focusables[focusables.length - 1]),\n onInlineStart: () => focusElement(focusables[getNextIndex(-1)]),\n onBlockStart: () => focusElement(focusables[getNextIndex(-1)]),\n onInlineEnd: () => focusElement(focusables[getNextIndex(1)]),\n onBlockEnd: () => focusElement(focusables[getNextIndex(1)]),\n });\n }\n\n function focusElement(element: HTMLElement) {\n element.focus();\n }\n\n // List all non-disabled and registered focusables: those are eligible for keyboard navigation.\n function getFocusablesFrom(target: HTMLElement) {\n function isElementRegistered(element: HTMLElement) {\n return navigationAPI.current?.isRegistered(element) ?? false;\n }\n\n function isElementDisabled(element: HTMLElement) {\n if ('disabled' in element) {\n return element.disabled;\n }\n\n return false;\n }\n\n return getAllFocusables(target).filter(el => isElementRegistered(el) && !isElementDisabled(el));\n }\n\n return (\n <div\n {...baseProps}\n className={clsx(styles.root, testUtilStyles.root, baseProps.className)}\n ref={containerRef}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n >\n <SingleTabStopNavigationProvider\n ref={navigationAPI}\n navigationActive={true}\n getNextFocusTarget={getNextFocusTarget}\n onUnregisterActive={onUnregisterActive}\n >\n {children}\n </SingleTabStopNavigationProvider>\n </div>\n );\n }\n);\n\nexport default InternalNavigableGroup;\n"]}
|