@cloudscape-design/components 3.0.244 → 3.0.246
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/annotation-context/annotation/annotation-trigger.d.ts.map +1 -1
- package/annotation-context/annotation/annotation-trigger.js +1 -3
- package/annotation-context/annotation/annotation-trigger.js.map +1 -1
- package/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +29 -29
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/app-layout/visual-refresh/styles.css.js +61 -61
- package/app-layout/visual-refresh/styles.scoped.css +151 -151
- package/app-layout/visual-refresh/styles.selectors.js +61 -61
- package/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
- package/app-layout/visual-refresh/trigger-button.js +2 -4
- package/app-layout/visual-refresh/trigger-button.js.map +1 -1
- package/breadcrumb-group/item/item.d.ts.map +1 -1
- package/breadcrumb-group/item/item.js +2 -5
- package/breadcrumb-group/item/item.js.map +1 -1
- package/breadcrumb-group/item/styles.css.js +9 -9
- package/breadcrumb-group/item/styles.scoped.css +17 -17
- package/breadcrumb-group/item/styles.selectors.js +9 -9
- package/button/internal.d.ts.map +1 -1
- package/button/internal.js +2 -3
- package/button/internal.js.map +1 -1
- package/button/styles.css.js +19 -18
- package/button/styles.scoped.css +136 -136
- package/button/styles.selectors.js +19 -18
- package/calendar/grid/index.d.ts.map +1 -1
- package/calendar/grid/index.js +2 -4
- package/calendar/grid/index.js.map +1 -1
- package/calendar/styles.css.js +18 -18
- package/calendar/styles.scoped.css +38 -38
- package/calendar/styles.selectors.js +18 -18
- package/code-editor/styles.css.js +32 -32
- package/code-editor/styles.scoped.css +109 -109
- package/code-editor/styles.selectors.js +32 -32
- package/code-editor/tab-button.d.ts.map +1 -1
- package/code-editor/tab-button.js +2 -4
- package/code-editor/tab-button.js.map +1 -1
- package/date-picker/index.d.ts.map +1 -1
- package/date-picker/index.js +1 -3
- package/date-picker/index.js.map +1 -1
- package/date-picker/styles.css.js +7 -7
- package/date-picker/styles.scoped.css +9 -9
- package/date-picker/styles.selectors.js +7 -7
- package/date-range-picker/calendar/grids/grid.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/grid.js +1 -3
- package/date-range-picker/calendar/grids/grid.js.map +1 -1
- package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/index.js +1 -3
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/grids/styles.css.js +25 -25
- package/date-range-picker/calendar/grids/styles.scoped.css +42 -42
- package/date-range-picker/calendar/grids/styles.selectors.js +25 -25
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js +1 -3
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/styles.css.js +38 -38
- package/date-range-picker/styles.scoped.css +45 -45
- package/date-range-picker/styles.selectors.js +38 -38
- package/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/expandable-section/expandable-section-header.js +8 -11
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/styles.css.js +23 -23
- package/expandable-section/styles.scoped.css +44 -44
- package/expandable-section/styles.selectors.js +23 -23
- package/flashbar/collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/collapsible-flashbar.js +1 -3
- package/flashbar/collapsible-flashbar.js.map +1 -1
- package/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js +1 -3
- package/flashbar/flash.js.map +1 -1
- package/flashbar/styles.css.js +45 -45
- package/flashbar/styles.scoped.css +144 -144
- package/flashbar/styles.selectors.js +45 -45
- package/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/internal/components/abstract-switch/index.js +8 -4
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/components/abstract-switch/styles.css.js +13 -13
- package/internal/components/abstract-switch/styles.scoped.css +19 -19
- package/internal/components/abstract-switch/styles.selectors.js +13 -13
- package/internal/components/button-trigger/index.d.ts.map +1 -1
- package/internal/components/button-trigger/index.js +1 -3
- package/internal/components/button-trigger/index.js.map +1 -1
- package/internal/components/button-trigger/styles.css.js +9 -9
- package/internal/components/button-trigger/styles.scoped.css +23 -23
- package/internal/components/button-trigger/styles.selectors.js +9 -9
- package/internal/components/chart-legend/index.d.ts.map +1 -1
- package/internal/components/chart-legend/index.js +2 -4
- package/internal/components/chart-legend/index.js.map +1 -1
- package/internal/components/chart-legend/styles.css.js +6 -6
- package/internal/components/chart-legend/styles.scoped.css +15 -15
- package/internal/components/chart-legend/styles.selectors.js +6 -6
- package/internal/components/chart-plot/focus-outline.d.ts.map +1 -1
- package/internal/components/chart-plot/focus-outline.js +25 -3
- package/internal/components/chart-plot/focus-outline.js.map +1 -1
- package/internal/components/filtering-token/index.d.ts +2 -1
- package/internal/components/filtering-token/index.d.ts.map +1 -1
- package/internal/components/filtering-token/index.js +3 -5
- package/internal/components/filtering-token/index.js.map +1 -1
- package/internal/components/filtering-token/styles.css.js +7 -7
- package/internal/components/filtering-token/styles.scoped.css +13 -13
- package/internal/components/filtering-token/styles.selectors.js +7 -7
- package/internal/components/menu-dropdown/index.d.ts.map +1 -1
- package/internal/components/menu-dropdown/index.js +2 -4
- package/internal/components/menu-dropdown/index.js.map +1 -1
- package/internal/components/menu-dropdown/styles.css.js +7 -7
- package/internal/components/menu-dropdown/styles.scoped.css +13 -13
- package/internal/components/menu-dropdown/styles.selectors.js +7 -7
- package/internal/components/options-list/utils/use-keyboard.d.ts +0 -2
- package/internal/components/options-list/utils/use-keyboard.d.ts.map +1 -1
- package/internal/components/options-list/utils/use-keyboard.js +2 -3
- package/internal/components/options-list/utils/use-keyboard.js.map +1 -1
- package/internal/components/token-list/index.d.ts +1 -1
- package/internal/components/token-list/index.d.ts.map +1 -1
- package/internal/components/token-list/index.js +3 -3
- package/internal/components/token-list/index.js.map +1 -1
- package/internal/components/token-list/interfaces.d.ts +0 -1
- package/internal/components/token-list/interfaces.d.ts.map +1 -1
- package/internal/components/token-list/interfaces.js.map +1 -1
- package/internal/components/token-list/styles.css.js +9 -9
- package/internal/components/token-list/styles.scoped.css +20 -20
- package/internal/components/token-list/styles.selectors.js +9 -9
- package/internal/components/token-list/token-focus-controller.js +1 -1
- package/internal/components/token-list/token-focus-controller.js.map +1 -1
- package/internal/components/token-list/token-limit-toggle.d.ts.map +1 -1
- package/internal/components/token-list/token-limit-toggle.js +1 -3
- package/internal/components/token-list/token-limit-toggle.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/hooks/focus-visible/index.d.ts +2 -5
- package/internal/hooks/focus-visible/index.d.ts.map +1 -1
- package/internal/hooks/focus-visible/index.js +42 -22
- package/internal/hooks/focus-visible/index.js.map +1 -1
- package/internal/hooks/use-base-component/index.d.ts.map +1 -1
- package/internal/hooks/use-base-component/index.js +2 -0
- package/internal/hooks/use-base-component/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/link/internal.d.ts.map +1 -1
- package/link/internal.js +1 -3
- package/link/internal.js.map +1 -1
- package/link/styles.css.js +20 -20
- package/link/styles.scoped.css +71 -71
- package/link/styles.selectors.js +20 -20
- package/package.json +1 -1
- package/pagination/internal.d.ts.map +1 -1
- package/pagination/internal.js +1 -3
- package/pagination/internal.js.map +1 -1
- package/pagination/styles.css.js +9 -9
- package/pagination/styles.scoped.css +23 -23
- package/pagination/styles.selectors.js +9 -9
- package/popover/internal.d.ts.map +1 -1
- package/popover/internal.js +1 -3
- package/popover/internal.js.map +1 -1
- package/popover/styles.css.js +50 -50
- package/popover/styles.scoped.css +63 -63
- package/popover/styles.selectors.js +50 -50
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +2 -2
- package/property-filter/index.js.map +1 -1
- package/property-filter/token.d.ts.map +1 -1
- package/property-filter/token.js +1 -1
- package/property-filter/token.js.map +1 -1
- package/segmented-control/segment.d.ts.map +1 -1
- package/segmented-control/segment.js +1 -3
- package/segmented-control/segment.js.map +1 -1
- package/segmented-control/styles.css.js +14 -14
- package/segmented-control/styles.scoped.css +33 -33
- package/segmented-control/styles.selectors.js +14 -14
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +0 -3
- package/select/utils/use-select.js.map +1 -1
- package/side-navigation/internal.d.ts.map +1 -1
- package/side-navigation/internal.js +2 -5
- package/side-navigation/internal.js.map +1 -1
- package/side-navigation/styles.css.js +27 -27
- package/side-navigation/styles.scoped.css +37 -37
- package/side-navigation/styles.selectors.js +27 -27
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +1 -3
- package/split-panel/index.js.map +1 -1
- package/split-panel/styles.css.js +59 -59
- package/split-panel/styles.scoped.css +81 -81
- package/split-panel/styles.selectors.js +59 -59
- package/table/body-cell/index.d.ts.map +1 -1
- package/table/body-cell/index.js +3 -3
- package/table/body-cell/index.js.map +1 -1
- package/table/body-cell/styles.css.js +18 -18
- package/table/body-cell/styles.scoped.css +57 -55
- package/table/body-cell/styles.selectors.js +18 -18
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +11 -9
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/styles.css.js +19 -19
- package/table/header-cell/styles.scoped.css +32 -32
- package/table/header-cell/styles.selectors.js +19 -19
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +1 -3
- package/table/internal.js.map +1 -1
- package/table/resizer/styles.css.js +6 -6
- package/table/resizer/styles.scoped.css +11 -11
- package/table/resizer/styles.selectors.js +6 -6
- package/table/styles.css.js +33 -33
- package/table/styles.scoped.css +41 -41
- package/table/styles.selectors.js +33 -33
- package/tabs/index.d.ts.map +1 -1
- package/tabs/index.js +8 -3
- package/tabs/index.js.map +1 -1
- package/tabs/styles.css.js +21 -21
- package/tabs/styles.scoped.css +38 -38
- package/tabs/styles.selectors.js +21 -21
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +9 -3
- package/tabs/tab-header-bar.js.map +1 -1
- package/tag-editor/internal.d.ts.map +1 -1
- package/tag-editor/internal.js +2 -4
- package/tag-editor/internal.js.map +1 -1
- package/tag-editor/styles.css.js +3 -3
- package/tag-editor/styles.scoped.css +10 -10
- package/tag-editor/styles.selectors.js +3 -3
- package/token-group/dismiss-button.d.ts.map +1 -1
- package/token-group/dismiss-button.js +1 -3
- package/token-group/dismiss-button.js.map +1 -1
- package/token-group/internal.js +2 -2
- package/token-group/internal.js.map +1 -1
- package/token-group/styles.css.js +5 -5
- package/token-group/styles.scoped.css +12 -12
- package/token-group/styles.selectors.js +5 -5
- package/token-group/token.d.ts +3 -5
- package/token-group/token.d.ts.map +1 -1
- package/token-group/token.js +2 -2
- package/token-group/token.js.map +1 -1
- package/top-navigation/1.0-beta/internal.d.ts.map +1 -1
- package/top-navigation/1.0-beta/internal.js +1 -3
- package/top-navigation/1.0-beta/internal.js.map +1 -1
- package/top-navigation/1.0-beta/styles.css.js +25 -25
- package/top-navigation/1.0-beta/styles.scoped.css +42 -42
- package/top-navigation/1.0-beta/styles.selectors.js +25 -25
- package/top-navigation/interfaces.d.ts +4 -0
- package/top-navigation/interfaces.d.ts.map +1 -1
- package/top-navigation/interfaces.js.map +1 -1
- package/top-navigation/internal.d.ts.map +1 -1
- package/top-navigation/internal.js +1 -3
- package/top-navigation/internal.js.map +1 -1
- package/top-navigation/parts/overflow-menu/menu-item.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/menu-item.js +9 -13
- package/top-navigation/parts/overflow-menu/menu-item.js.map +1 -1
- package/top-navigation/parts/utility.d.ts.map +1 -1
- package/top-navigation/parts/utility.js +2 -1
- package/top-navigation/parts/utility.js.map +1 -1
- package/top-navigation/styles.css.js +47 -47
- package/top-navigation/styles.scoped.css +66 -66
- package/top-navigation/styles.selectors.js +47 -47
- package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js +1 -3
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/styles.css.js +18 -18
- package/tutorial-panel/components/tutorial-list/styles.scoped.css +27 -27
- package/tutorial-panel/components/tutorial-list/styles.selectors.js +18 -18
- package/wizard/styles.css.js +32 -32
- package/wizard/styles.scoped.css +63 -63
- package/wizard/styles.selectors.js +32 -32
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +1 -3
- package/wizard/wizard-form.js.map +1 -1
|
@@ -90,7 +90,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
90
90
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
91
|
SPDX-License-Identifier: Apache-2.0
|
|
92
92
|
*/
|
|
93
|
-
.
|
|
93
|
+
.awsui_button_m5h9f_1yya9_93:not(#\9) {
|
|
94
94
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
95
95
|
border-collapse: separate;
|
|
96
96
|
border-spacing: 0;
|
|
@@ -146,38 +146,38 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
146
146
|
background: transparent;
|
|
147
147
|
color: var(--color-text-interactive-default-eg5fsa, #414d5c);
|
|
148
148
|
}
|
|
149
|
-
.
|
|
149
|
+
.awsui_button_m5h9f_1yya9_93:not(#\9):hover {
|
|
150
150
|
color: var(--color-text-interactive-hover-v3lasm, #000716);
|
|
151
151
|
text-decoration: none;
|
|
152
152
|
}
|
|
153
|
-
.
|
|
153
|
+
.awsui_button_m5h9f_1yya9_93:not(#\9):active, .awsui_button_m5h9f_1yya9_93.awsui_expanded_m5h9f_1yya9_127:not(#\9) {
|
|
154
154
|
background: transparent;
|
|
155
155
|
color: var(--color-text-interactive-active-vol84d, #000716);
|
|
156
156
|
}
|
|
157
|
-
.
|
|
157
|
+
.awsui_button_m5h9f_1yya9_93.awsui_expanded_m5h9f_1yya9_127:not(#\9) {
|
|
158
158
|
color: var(--color-text-accent-s1eqko, #0972d3);
|
|
159
159
|
}
|
|
160
|
-
.
|
|
160
|
+
.awsui_button_m5h9f_1yya9_93:not(#\9):focus {
|
|
161
161
|
outline: none;
|
|
162
162
|
text-decoration: none;
|
|
163
163
|
}
|
|
164
|
-
.
|
|
164
|
+
.awsui_button_m5h9f_1yya9_93.awsui_offset-right-none_m5h9f_1yya9_138:not(#\9) {
|
|
165
165
|
margin-right: 0;
|
|
166
166
|
}
|
|
167
|
-
.
|
|
167
|
+
.awsui_button_m5h9f_1yya9_93.awsui_offset-right-l_m5h9f_1yya9_141:not(#\9) {
|
|
168
168
|
margin-right: var(--space-s-hv8c1d, 12px);
|
|
169
169
|
}
|
|
170
|
-
.
|
|
170
|
+
.awsui_button_m5h9f_1yya9_93.awsui_offset-right-xxl_m5h9f_1yya9_144:not(#\9) {
|
|
171
171
|
margin-right: var(--space-xl-a39hup, 24px);
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
body[data-awsui-focus-visible=true] .awsui_button_m5h9f_1yya9_93:not(#\9):focus {
|
|
174
174
|
position: relative;
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
body[data-awsui-focus-visible=true] .awsui_button_m5h9f_1yya9_93:not(#\9):focus {
|
|
177
177
|
outline: 2px dotted transparent;
|
|
178
178
|
outline-offset: calc(-1px - 1px);
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
body[data-awsui-focus-visible=true] .awsui_button_m5h9f_1yya9_93:not(#\9):focus::before {
|
|
181
181
|
content: " ";
|
|
182
182
|
display: block;
|
|
183
183
|
position: absolute;
|
|
@@ -189,10 +189,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
189
189
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
.
|
|
192
|
+
.awsui_text_m5h9f_1yya9_166:not(#\9) {
|
|
193
193
|
margin-right: var(--space-xs-rsr2qu, 8px);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
.
|
|
196
|
+
.awsui_icon_m5h9f_1yya9_170 + .awsui_text_m5h9f_1yya9_166:not(#\9) {
|
|
197
197
|
margin-left: var(--space-xs-rsr2qu, 8px);
|
|
198
198
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"button": "
|
|
6
|
-
"expanded": "
|
|
7
|
-
"offset-right-none": "awsui_offset-right-
|
|
8
|
-
"offset-right-l": "awsui_offset-right-
|
|
9
|
-
"offset-right-xxl": "awsui_offset-right-
|
|
10
|
-
"text": "
|
|
11
|
-
"icon": "
|
|
5
|
+
"button": "awsui_button_m5h9f_1yya9_93",
|
|
6
|
+
"expanded": "awsui_expanded_m5h9f_1yya9_127",
|
|
7
|
+
"offset-right-none": "awsui_offset-right-none_m5h9f_1yya9_138",
|
|
8
|
+
"offset-right-l": "awsui_offset-right-l_m5h9f_1yya9_141",
|
|
9
|
+
"offset-right-xxl": "awsui_offset-right-xxl_m5h9f_1yya9_144",
|
|
10
|
+
"text": "awsui_text_m5h9f_1yya9_166",
|
|
11
|
+
"icon": "awsui_icon_m5h9f_1yya9_170"
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
2
1
|
import { BaseKeyDetail, CancelableEventHandler } from '../../../events';
|
|
3
2
|
interface UseMenuKeyboard {
|
|
4
3
|
(inputProps: {
|
|
@@ -7,7 +6,6 @@ interface UseMenuKeyboard {
|
|
|
7
6
|
goHome: () => void;
|
|
8
7
|
goEnd: () => void;
|
|
9
8
|
closeDropdown: () => void;
|
|
10
|
-
isSelectingUsingSpace: MutableRefObject<boolean>;
|
|
11
9
|
preventNativeSpace?: boolean;
|
|
12
10
|
}): CancelableEventHandler<BaseKeyDetail>;
|
|
13
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-keyboard.d.ts","sourceRoot":"lib/default/","sources":["internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-keyboard.d.ts","sourceRoot":"lib/default/","sources":["internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKxE,UAAU,eAAe;IACvB,CAAC,UAAU,EAAE;QACX,aAAa,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;QAChE,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,aAAa,EAAE,MAAM,IAAI,CAAC;QAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,eAAe,EAAE,eAyC7B,CAAC;AAEF,UAAU,kBAAkB;IAC1B,CAAC,UAAU,EAAE;QAAE,YAAY,EAAE,MAAM,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACvG;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAmBhC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { useCallback } from 'react';
|
|
|
4
4
|
import { KeyCode } from '../../../keycode';
|
|
5
5
|
const HOME = 36;
|
|
6
6
|
const END = 35;
|
|
7
|
-
export const useMenuKeyboard = ({ moveHighlight, selectOption, goHome, goEnd, closeDropdown,
|
|
7
|
+
export const useMenuKeyboard = ({ moveHighlight, selectOption, goHome, goEnd, closeDropdown, preventNativeSpace = false, }) => {
|
|
8
8
|
return useCallback((e) => {
|
|
9
9
|
switch (e.detail.keyCode) {
|
|
10
10
|
case KeyCode.up:
|
|
@@ -32,10 +32,9 @@ export const useMenuKeyboard = ({ moveHighlight, selectOption, goHome, goEnd, cl
|
|
|
32
32
|
if (preventNativeSpace) {
|
|
33
33
|
e.preventDefault();
|
|
34
34
|
selectOption();
|
|
35
|
-
isSelectingUsingSpace.current = true;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
}, [moveHighlight, selectOption, goHome, goEnd, closeDropdown,
|
|
37
|
+
}, [moveHighlight, selectOption, goHome, goEnd, closeDropdown, preventNativeSpace]);
|
|
39
38
|
};
|
|
40
39
|
export const useTriggerKeyboard = ({ openDropdown, goHome }) => {
|
|
41
40
|
return useCallback((e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-keyboard.js","sourceRoot":"lib/default/","sources":["internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"use-keyboard.js","sourceRoot":"lib/default/","sources":["internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,GAAG,GAAG,EAAE,CAAC;AAaf,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,EAC/C,aAAa,EACb,YAAY,EACZ,MAAM,EACN,KAAK,EACL,aAAa,EACb,kBAAkB,GAAG,KAAK,GAC3B,EAAE,EAAE;IACH,OAAO,WAAW,CAChB,CAAC,CAA6B,EAAE,EAAE;QAChC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE;YACxB,KAAK,OAAO,CAAC,EAAE;gBACb,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClB,MAAM;YACR,KAAK,O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, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback } from 'react';\nimport { KeyCode } from '../../../keycode';\nimport { BaseKeyDetail, CancelableEventHandler } from '../../../events';\n\nconst HOME = 36;\nconst END = 35;\n\ninterface UseMenuKeyboard {\n (inputProps: {\n moveHighlight: (direction: -1 | 1, startIndex?: number) => void;\n selectOption: () => void;\n goHome: () => void;\n goEnd: () => void;\n closeDropdown: () => void;\n preventNativeSpace?: boolean;\n }): CancelableEventHandler<BaseKeyDetail>;\n}\n\nexport const useMenuKeyboard: UseMenuKeyboard = ({\n moveHighlight,\n selectOption,\n goHome,\n goEnd,\n closeDropdown,\n preventNativeSpace = false,\n}) => {\n return useCallback(\n (e: CustomEvent<BaseKeyDetail>) => {\n switch (e.detail.keyCode) {\n case KeyCode.up:\n e.preventDefault();\n moveHighlight(-1);\n break;\n case KeyCode.down:\n e.preventDefault();\n moveHighlight(1);\n break;\n case HOME:\n goHome();\n break;\n case END:\n goEnd();\n break;\n case KeyCode.escape:\n closeDropdown();\n break;\n case KeyCode.enter:\n e.preventDefault();\n selectOption();\n break;\n case KeyCode.space:\n if (preventNativeSpace) {\n e.preventDefault();\n selectOption();\n }\n }\n },\n [moveHighlight, selectOption, goHome, goEnd, closeDropdown, preventNativeSpace]\n );\n};\n\ninterface UseTriggerKeyboard {\n (inputProps: { openDropdown: () => void; goHome: () => void }): CancelableEventHandler<BaseKeyDetail>;\n}\n\nexport const useTriggerKeyboard: UseTriggerKeyboard = ({ openDropdown, goHome }) => {\n return useCallback(\n (e: CustomEvent<BaseKeyDetail>) => {\n switch (e.detail.keyCode) {\n case KeyCode.up:\n case KeyCode.down:\n e.preventDefault();\n goHome();\n openDropdown();\n break;\n case KeyCode.space:\n case KeyCode.enter:\n e.preventDefault();\n openDropdown();\n break;\n }\n },\n [openDropdown, goHome]\n );\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TokenListProps } from './interfaces';
|
|
3
|
-
export default function TokenList<Item>({ items, alignment, renderItem,
|
|
3
|
+
export default function TokenList<Item>({ items, alignment, renderItem, limit, after, i18nStrings, removedItemIndex, }: TokenListProps<Item>): JSX.Element;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/token-list/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,EACtC,KAAK,EACL,SAAS,EACT,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/token-list/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,EACtC,KAAK,EACL,SAAS,EACT,UAAU,EACV,KAAK,EACL,KAAK,EACL,WAAW,EACX,gBAAgB,GACjB,EAAE,cAAc,CAAC,IAAI,CAAC,eAmEtB"}
|
|
@@ -6,7 +6,7 @@ import styles from './styles.css.js';
|
|
|
6
6
|
import { useUniqueId } from '../../hooks/use-unique-id';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { useTokenFocusController } from './token-focus-controller';
|
|
9
|
-
export default function TokenList({ items, alignment, renderItem,
|
|
9
|
+
export default function TokenList({ items, alignment, renderItem, limit, after, i18nStrings, removedItemIndex, }) {
|
|
10
10
|
const tokenListRef = useTokenFocusController({ removedItemIndex });
|
|
11
11
|
const controlId = useUniqueId();
|
|
12
12
|
const [expanded, setExpanded] = useState(false);
|
|
@@ -18,13 +18,13 @@ export default function TokenList({ items, alignment, renderItem, itemAttributes
|
|
|
18
18
|
React.createElement(TokenLimitToggle, { controlId: hasVisibleItems ? controlId : undefined, allHidden: limit === 0, expanded: expanded, numberOfHiddenOptions: items.length - visibleItems.length, i18nStrings: i18nStrings, onClick: () => setExpanded(!expanded) }))) : null;
|
|
19
19
|
if (alignment === 'inline') {
|
|
20
20
|
return (React.createElement("div", { ref: tokenListRef, className: clsx(styles.root, styles.horizontal) },
|
|
21
|
-
hasItems && (React.createElement("ul", { id: controlId, className: styles.list }, visibleItems.map((item, itemIndex) => (React.createElement("li",
|
|
21
|
+
hasItems && (React.createElement("ul", { id: controlId, className: styles.list }, visibleItems.map((item, itemIndex) => (React.createElement("li", { key: itemIndex, className: styles['list-item'], "aria-setsize": items.length, "aria-posinset": itemIndex + 1 }, renderItem(item, itemIndex)))))),
|
|
22
22
|
toggle,
|
|
23
23
|
after && React.createElement("div", { className: styles.separator }),
|
|
24
24
|
after));
|
|
25
25
|
}
|
|
26
26
|
return (React.createElement("div", { ref: tokenListRef, className: clsx(styles.root, styles.vertical) },
|
|
27
|
-
hasVisibleItems && (React.createElement("ul", { id: controlId, className: clsx(styles.list, styles[alignment]) }, visibleItems.map((item, itemIndex) => (React.createElement("li",
|
|
27
|
+
hasVisibleItems && (React.createElement("ul", { id: controlId, className: clsx(styles.list, styles[alignment]) }, visibleItems.map((item, itemIndex) => (React.createElement("li", { key: itemIndex, className: styles['list-item'], "aria-setsize": items.length, "aria-posinset": itemIndex + 1 }, renderItem(item, itemIndex)))))),
|
|
28
28
|
toggle,
|
|
29
29
|
after));
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/token-list/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACx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AI,CAClB,4BAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,IAC/D,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CACrC,4BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,kBAChB,KAAK,CAAC,MAAM,mBACX,SAAS,GAAG,CAAC,IAE3B,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CACzB,CACN,CAAC,CACC,CACN;QACA,MAAM;QACN,KAAK,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useState } from 'react';\n\nimport TokenLimitToggle from './token-limit-toggle';\nimport styles from './styles.css.js';\nimport { TokenListProps } from './interfaces';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport clsx from 'clsx';\nimport { useTokenFocusController } from './token-focus-controller';\n\nexport default function TokenList<Item>({\n items,\n alignment,\n renderItem,\n limit,\n after,\n i18nStrings,\n removedItemIndex,\n}: TokenListProps<Item>) {\n const tokenListRef = useTokenFocusController({ removedItemIndex });\n const controlId = useUniqueId();\n\n const [expanded, setExpanded] = useState(false);\n const hasItems = items.length > 0;\n const hasHiddenItems = hasItems && limit !== undefined && items.length > limit;\n const visibleItems = hasHiddenItems && !expanded ? items.slice(0, limit) : items;\n const hasVisibleItems = visibleItems.length > 0;\n\n const toggle = hasHiddenItems ? (\n <div className={styles[`toggle-container-${alignment}`]}>\n <TokenLimitToggle\n controlId={hasVisibleItems ? controlId : undefined}\n allHidden={limit === 0}\n expanded={expanded}\n numberOfHiddenOptions={items.length - visibleItems.length}\n i18nStrings={i18nStrings}\n onClick={() => setExpanded(!expanded)}\n />\n </div>\n ) : null;\n\n if (alignment === 'inline') {\n return (\n <div ref={tokenListRef} className={clsx(styles.root, styles.horizontal)}>\n {hasItems && (\n <ul id={controlId} className={styles.list}>\n {visibleItems.map((item, itemIndex) => (\n <li\n key={itemIndex}\n className={styles['list-item']}\n aria-setsize={items.length}\n aria-posinset={itemIndex + 1}\n >\n {renderItem(item, itemIndex)}\n </li>\n ))}\n </ul>\n )}\n {toggle}\n {after && <div className={styles.separator} />}\n {after}\n </div>\n );\n }\n\n return (\n <div ref={tokenListRef} className={clsx(styles.root, styles.vertical)}>\n {hasVisibleItems && (\n <ul id={controlId} className={clsx(styles.list, styles[alignment])}>\n {visibleItems.map((item, itemIndex) => (\n <li\n key={itemIndex}\n className={styles['list-item']}\n aria-setsize={items.length}\n aria-posinset={itemIndex + 1}\n >\n {renderItem(item, itemIndex)}\n </li>\n ))}\n </ul>\n )}\n {toggle}\n {after}\n </div>\n );\n}\n"]}
|
|
@@ -5,7 +5,6 @@ export interface TokenListProps<Item> {
|
|
|
5
5
|
limit?: number;
|
|
6
6
|
after?: React.ReactNode;
|
|
7
7
|
renderItem: (item: Item, itemIndex: number) => React.ReactNode;
|
|
8
|
-
itemAttributes?: (item: Item, itemIndex: number) => React.HTMLAttributes<HTMLLIElement>;
|
|
9
8
|
i18nStrings?: I18nStrings;
|
|
10
9
|
removedItemIndex?: null | number;
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["internal/components/token-list/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,cAAc,CAAC,IAAI;IAClC,SAAS,EAAE,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC;IAChD,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC/D,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["internal/components/token-list/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,cAAc,CAAC,IAAI;IAClC,SAAS,EAAE,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC;IAChD,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC/D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["internal/components/token-list/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 React from 'react';\n\nexport interface TokenListProps<Item> {\n alignment: 'vertical' | 'horizontal' | 'inline';\n items: readonly Item[];\n limit?: number;\n after?: React.ReactNode;\n renderItem: (item: Item, itemIndex: number) => React.ReactNode;\n
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["internal/components/token-list/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 React from 'react';\n\nexport interface TokenListProps<Item> {\n alignment: 'vertical' | 'horizontal' | 'inline';\n items: readonly Item[];\n limit?: number;\n after?: React.ReactNode;\n renderItem: (item: Item, itemIndex: number) => React.ReactNode;\n i18nStrings?: I18nStrings;\n removedItemIndex?: null | number;\n}\n\nexport interface I18nStrings {\n limitShowFewer?: string;\n limitShowMore?: string;\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"horizontal": "
|
|
6
|
-
"vertical": "
|
|
7
|
-
"list": "
|
|
8
|
-
"list-item": "awsui_list-
|
|
9
|
-
"toggle-container-inline": "awsui_toggle-container-
|
|
10
|
-
"toggle": "
|
|
11
|
-
"description": "
|
|
12
|
-
"separator": "
|
|
4
|
+
"root": "awsui_root_gfwv3_sgio_93",
|
|
5
|
+
"horizontal": "awsui_horizontal_gfwv3_sgio_98",
|
|
6
|
+
"vertical": "awsui_vertical_gfwv3_sgio_102",
|
|
7
|
+
"list": "awsui_list_gfwv3_sgio_106",
|
|
8
|
+
"list-item": "awsui_list-item_gfwv3_sgio_124",
|
|
9
|
+
"toggle-container-inline": "awsui_toggle-container-inline_gfwv3_sgio_128",
|
|
10
|
+
"toggle": "awsui_toggle_gfwv3_sgio_128",
|
|
11
|
+
"description": "awsui_description_gfwv3_sgio_196",
|
|
12
|
+
"separator": "awsui_separator_gfwv3_sgio_200"
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -90,48 +90,48 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
90
90
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
91
|
SPDX-License-Identifier: Apache-2.0
|
|
92
92
|
*/
|
|
93
|
-
.
|
|
93
|
+
.awsui_root_gfwv3_sgio_93:not(#\9) {
|
|
94
94
|
display: flex;
|
|
95
95
|
flex-wrap: wrap;
|
|
96
96
|
gap: var(--space-scaled-xs-6859qs, 8px);
|
|
97
97
|
}
|
|
98
|
-
.
|
|
98
|
+
.awsui_root_gfwv3_sgio_93.awsui_horizontal_gfwv3_sgio_98:not(#\9) {
|
|
99
99
|
gap: var(--space-xs-rsr2qu, 8px);
|
|
100
100
|
flex-direction: row;
|
|
101
101
|
}
|
|
102
|
-
.
|
|
102
|
+
.awsui_root_gfwv3_sgio_93.awsui_vertical_gfwv3_sgio_102:not(#\9) {
|
|
103
103
|
flex-direction: column;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.
|
|
106
|
+
.awsui_list_gfwv3_sgio_106:not(#\9) {
|
|
107
107
|
display: contents;
|
|
108
108
|
list-style: none;
|
|
109
109
|
padding: 0;
|
|
110
110
|
margin: 0;
|
|
111
111
|
}
|
|
112
|
-
.
|
|
112
|
+
.awsui_list_gfwv3_sgio_106.awsui_horizontal_gfwv3_sgio_98:not(#\9), .awsui_list_gfwv3_sgio_106.awsui_vertical_gfwv3_sgio_102:not(#\9) {
|
|
113
113
|
display: flex;
|
|
114
114
|
flex-wrap: wrap;
|
|
115
115
|
gap: var(--space-xs-rsr2qu, 8px);
|
|
116
116
|
}
|
|
117
|
-
.
|
|
117
|
+
.awsui_list_gfwv3_sgio_106.awsui_horizontal_gfwv3_sgio_98:not(#\9) {
|
|
118
118
|
flex-direction: row;
|
|
119
119
|
}
|
|
120
|
-
.
|
|
120
|
+
.awsui_list_gfwv3_sgio_106.awsui_vertical_gfwv3_sgio_102:not(#\9) {
|
|
121
121
|
flex-direction: column;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
.awsui_list-
|
|
124
|
+
.awsui_list-item_gfwv3_sgio_124:not(#\9) {
|
|
125
125
|
/* used in test-utils */
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
.awsui_toggle-container-
|
|
128
|
+
.awsui_toggle-container-inline_gfwv3_sgio_128:not(#\9) {
|
|
129
129
|
padding-left: var(--space-xs-rsr2qu, 8px);
|
|
130
130
|
display: flex;
|
|
131
131
|
align-items: center;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
.
|
|
134
|
+
.awsui_toggle_gfwv3_sgio_128:not(#\9) {
|
|
135
135
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
136
136
|
border-collapse: separate;
|
|
137
137
|
border-spacing: 0;
|
|
@@ -186,46 +186,46 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
186
186
|
margin-left: -1px;
|
|
187
187
|
}
|
|
188
188
|
@media (prefers-reduced-motion: reduce) {
|
|
189
|
-
.
|
|
189
|
+
.awsui_toggle_gfwv3_sgio_128:not(#\9) {
|
|
190
190
|
animation: none;
|
|
191
191
|
transition: none;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
.awsui-motion-disabled .
|
|
194
|
+
.awsui-motion-disabled .awsui_toggle_gfwv3_sgio_128:not(#\9), .awsui-mode-entering .awsui_toggle_gfwv3_sgio_128:not(#\9) {
|
|
195
195
|
animation: none;
|
|
196
196
|
transition: none;
|
|
197
197
|
}
|
|
198
|
-
.
|
|
198
|
+
.awsui_toggle_gfwv3_sgio_128:not(#\9):hover {
|
|
199
199
|
cursor: pointer;
|
|
200
200
|
color: var(--color-text-link-hover-kololx, #033160);
|
|
201
201
|
}
|
|
202
|
-
.
|
|
202
|
+
.awsui_toggle_gfwv3_sgio_128:not(#\9):focus {
|
|
203
203
|
outline: none;
|
|
204
204
|
}
|
|
205
|
-
.
|
|
205
|
+
.awsui_toggle_gfwv3_sgio_128:not(#\9):active {
|
|
206
206
|
color: var(--color-text-link-hover-kololx, #033160);
|
|
207
207
|
}
|
|
208
|
-
.
|
|
208
|
+
.awsui_toggle_gfwv3_sgio_128:not(#\9):active, .awsui_toggle_gfwv3_sgio_128:not(#\9):focus, .awsui_toggle_gfwv3_sgio_128:not(#\9):hover {
|
|
209
209
|
text-decoration: underline;
|
|
210
210
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
211
211
|
text-decoration-color: currentColor;
|
|
212
212
|
}
|
|
213
|
-
.
|
|
213
|
+
.awsui_toggle_gfwv3_sgio_128:not(#\9):active, .awsui_toggle_gfwv3_sgio_128:not(#\9):focus, .awsui_toggle_gfwv3_sgio_128:not(#\9):hover {
|
|
214
214
|
text-decoration: none;
|
|
215
215
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
216
216
|
text-decoration-color: transparent;
|
|
217
217
|
}
|
|
218
|
-
|
|
218
|
+
body[data-awsui-focus-visible=true] .awsui_toggle_gfwv3_sgio_128:not(#\9):focus {
|
|
219
219
|
outline: 2px dotted transparent;
|
|
220
220
|
border: var(--border-field-width-idlekx, 2px) solid var(--color-border-item-focused-ap3b6s, #0972d3);
|
|
221
221
|
border-radius: var(--border-radius-control-default-focus-ring-7661kz, 4px);
|
|
222
222
|
box-shadow: 0 0 0 var(--border-control-focus-ring-shadow-spread-srzyiu, 0px) var(--color-border-item-focused-ap3b6s, #0972d3);
|
|
223
223
|
}
|
|
224
|
-
.
|
|
224
|
+
.awsui_toggle_gfwv3_sgio_128 > .awsui_description_gfwv3_sgio_196:not(#\9) {
|
|
225
225
|
margin-left: var(--space-xxs-ynfts5, 4px);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
.
|
|
228
|
+
.awsui_separator_gfwv3_sgio_200:not(#\9) {
|
|
229
229
|
margin: 0px var(--space-scaled-m-pv0fmt, 16px);
|
|
230
230
|
width: var(--border-divider-section-width-4wm2it, 2px);
|
|
231
231
|
background-color: var(--color-border-divider-default-7s2wjw, #e9ebed);
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"horizontal": "
|
|
7
|
-
"vertical": "
|
|
8
|
-
"list": "
|
|
9
|
-
"list-item": "awsui_list-
|
|
10
|
-
"toggle-container-inline": "awsui_toggle-container-
|
|
11
|
-
"toggle": "
|
|
12
|
-
"description": "
|
|
13
|
-
"separator": "
|
|
5
|
+
"root": "awsui_root_gfwv3_sgio_93",
|
|
6
|
+
"horizontal": "awsui_horizontal_gfwv3_sgio_98",
|
|
7
|
+
"vertical": "awsui_vertical_gfwv3_sgio_102",
|
|
8
|
+
"list": "awsui_list_gfwv3_sgio_106",
|
|
9
|
+
"list-item": "awsui_list-item_gfwv3_sgio_124",
|
|
10
|
+
"toggle-container-inline": "awsui_toggle-container-inline_gfwv3_sgio_128",
|
|
11
|
+
"toggle": "awsui_toggle_gfwv3_sgio_128",
|
|
12
|
+
"description": "awsui_description_gfwv3_sgio_196",
|
|
13
|
+
"separator": "awsui_separator_gfwv3_sgio_200"
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -16,7 +16,7 @@ export function useTokenFocusController({ removedItemIndex }) {
|
|
|
16
16
|
const toggleButton = tokenListRef.current.querySelector(toggleButtonSelector);
|
|
17
17
|
const activeItemIndices = [];
|
|
18
18
|
for (let i = 0; i < tokenElements.length; i++) {
|
|
19
|
-
if (tokenElements[i].
|
|
19
|
+
if (!tokenElements[i].querySelector('[aria-disabled="true"]')) {
|
|
20
20
|
activeItemIndices.push(i);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-focus-controller.js","sourceRoot":"lib/default/","sources":["internal/components/token-list/token-focus-controller.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;AAChD,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;AAEjD,MAAM,UAAU,uBAAuB,CAAC,EAAE,gBAAgB,EAAwC;IAChG,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;;QACb,IAAI,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,KAAK,IAAI,IAAI,YAAY,CAAC,OAAO,KAAK,IAAI,EAAE;YAChG,OAAO;SACR;QAED,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;QAC3E,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;QAE9E,MAAM,iBAAiB,GAAa,EAAE,CAAC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"token-focus-controller.js","sourceRoot":"lib/default/","sources":["internal/components/token-list/token-focus-controller.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;AAChD,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;AAEjD,MAAM,UAAU,uBAAuB,CAAC,EAAE,gBAAgB,EAAwC;IAChG,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;;QACb,IAAI,gBAAgB,KAAK,SAAS,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W,YAAY,WAAW,EAAE;YAC7C,MAAA,iBAAiB,CAAC,WAAW,CAAC,0CAAE,KAAK,EAAE,CAAC;SACzC;aAAM,IAAI,YAAY,YAAY,WAAW,EAAE;YAC9C,YAAY,CAAC,KAAK,EAAE,CAAC;SACtB;IACH,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useRef } from 'react';\nimport { getFirstFocusable } from '../focus-lock/utils.js';\nimport styles from './styles.css.js';\n\nconst tokenSelector = `.${styles['list-item']}`;\nconst toggleButtonSelector = `.${styles.toggle}`;\n\nexport function useTokenFocusController({ removedItemIndex }: { removedItemIndex?: null | number }) {\n const tokenListRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (removedItemIndex === undefined || removedItemIndex === null || tokenListRef.current === null) {\n return;\n }\n\n const tokenElements = tokenListRef.current.querySelectorAll(tokenSelector);\n const toggleButton = tokenListRef.current.querySelector(toggleButtonSelector);\n\n const activeItemIndices: number[] = [];\n for (let i = 0; i < tokenElements.length; i++) {\n if (!tokenElements[i].querySelector('[aria-disabled=\"true\"]')) {\n activeItemIndices.push(i);\n }\n }\n\n let closestPrevIndex = Number.NEGATIVE_INFINITY;\n let closestNextIndex = Number.POSITIVE_INFINITY;\n\n for (const activeIndex of activeItemIndices) {\n if (activeIndex < removedItemIndex) {\n closestPrevIndex =\n removedItemIndex - activeIndex < removedItemIndex - closestPrevIndex ? activeIndex : closestPrevIndex;\n } else {\n closestNextIndex =\n activeIndex - removedItemIndex < closestNextIndex - removedItemIndex ? activeIndex : closestNextIndex;\n }\n }\n\n const nextElement = tokenElements[closestNextIndex];\n const prevElement = tokenElements[closestPrevIndex];\n\n if (nextElement instanceof HTMLElement) {\n getFirstFocusable(nextElement)?.focus();\n } else if (prevElement instanceof HTMLElement) {\n getFirstFocusable(prevElement)?.focus();\n } else if (toggleButton instanceof HTMLElement) {\n toggleButton.focus();\n }\n }, [removedItemIndex]);\n\n return tokenListRef;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-limit-toggle.d.ts","sourceRoot":"lib/default/","sources":["internal/components/token-list/token-limit-toggle.tsx"],"names":[],"mappings":";AAKA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"token-limit-toggle.d.ts","sourceRoot":"lib/default/","sources":["internal/components/token-list/token-limit-toggle.tsx"],"names":[],"mappings":";AAKA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,SAAS,EACT,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,WAAgB,GACjB,EAAE,qBAAqB,eAsBvB"}
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
import React, { useCallback } from 'react';
|
|
4
4
|
import InternalIcon from '../../../icon/internal';
|
|
5
5
|
import { fireNonCancelableEvent } from '../../events';
|
|
6
|
-
import useFocusVisible from '../../hooks/focus-visible';
|
|
7
6
|
import styles from './styles.css.js';
|
|
8
7
|
export default function TokenLimitToggle({ controlId, allHidden, expanded, numberOfHiddenOptions, onClick, i18nStrings = {}, }) {
|
|
9
|
-
const focusVisible = useFocusVisible();
|
|
10
8
|
const numberOfHiddenOptionLabel = allHidden ? numberOfHiddenOptions : `+${numberOfHiddenOptions}`;
|
|
11
9
|
const description = expanded
|
|
12
10
|
? i18nStrings.limitShowFewer
|
|
@@ -14,7 +12,7 @@ export default function TokenLimitToggle({ controlId, allHidden, expanded, numbe
|
|
|
14
12
|
const handleClick = useCallback(() => {
|
|
15
13
|
fireNonCancelableEvent(onClick, null);
|
|
16
14
|
}, [onClick]);
|
|
17
|
-
return (React.createElement("button",
|
|
15
|
+
return (React.createElement("button", { type: "button", className: styles.toggle, onClick: handleClick, "aria-controls": controlId, "aria-expanded": expanded },
|
|
18
16
|
React.createElement(InternalIcon, { name: expanded ? 'treeview-collapse' : 'treeview-expand' }),
|
|
19
17
|
React.createElement("span", { className: styles.description }, description)));
|
|
20
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-limit-toggle.js","sourceRoot":"lib/default/","sources":["internal/components/token-list/token-limit-toggle.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAA6B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"token-limit-toggle.js","sourceRoot":"lib/default/","sources":["internal/components/token-list/token-limit-toggle.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAA6B,MAAM,cAAc,CAAC;AAGjF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,SAAS,EACT,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,WAAW,GAAG,EAAE,GACM;IACtB,MAAM,yBAAyB,GAAG,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,qBAAqB,EAAE,CAAC;IAClG,MAAM,WAAW,GAAG,QAAQ;QAC1B,CAAC,CAAC,WAAW,CAAC,cAAc;QAC5B,CAAC,CAAC,GAAG,WAAW,CAAC,aAAa,IAAI,EAAE,KAAK,yBAAyB,GAAG,CAAC;IAExE,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,OAAO,EAAE,WAAW,mBACL,SAAS,mBACT,QAAQ;QAEvB,oBAAC,YAAY,IAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,GAAI;QAC1E,8BAAM,SAAS,EAAE,MAAM,CAAC,WAAW,IAAG,WAAW,CAAQ,CAClD,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useCallback } from 'react';\nimport InternalIcon from '../../../icon/internal';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../../events';\nimport { I18nStrings } from './interfaces';\n\nimport styles from './styles.css.js';\ninterface TokenLimitToggleProps {\n controlId?: string;\n allHidden: boolean;\n expanded: boolean;\n numberOfHiddenOptions: number;\n onClick?: NonCancelableEventHandler<null>;\n i18nStrings?: I18nStrings;\n}\n\nexport default function TokenLimitToggle({\n controlId,\n allHidden,\n expanded,\n numberOfHiddenOptions,\n onClick,\n i18nStrings = {},\n}: TokenLimitToggleProps) {\n const numberOfHiddenOptionLabel = allHidden ? numberOfHiddenOptions : `+${numberOfHiddenOptions}`;\n const description = expanded\n ? i18nStrings.limitShowFewer\n : `${i18nStrings.limitShowMore || ''} (${numberOfHiddenOptionLabel})`;\n\n const handleClick = useCallback(() => {\n fireNonCancelableEvent(onClick, null);\n }, [onClick]);\n\n return (\n <button\n type=\"button\"\n className={styles.toggle}\n onClick={handleClick}\n aria-controls={controlId}\n aria-expanded={expanded}\n >\n <InternalIcon name={expanded ? 'treeview-collapse' : 'treeview-expand'} />\n <span className={styles.description}>{description}</span>\n </button>\n );\n}\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
} | {
|
|
4
|
-
'data-awsui-focus-visible'?: undefined;
|
|
5
|
-
};
|
|
1
|
+
export declare function isModifierKey(event: KeyboardEvent): boolean;
|
|
2
|
+
export default function useFocusVisible(): void;
|
|
6
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/hooks/focus-visible/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/hooks/focus-visible/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,WAIjD;AAgCD,MAAM,CAAC,OAAO,UAAU,eAAe,SAatC"}
|
|
@@ -1,29 +1,49 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { KeyCode } from '../../keycode';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
export function isModifierKey(event) {
|
|
6
|
+
// we do not want to highlight focused element
|
|
7
|
+
// when special keys are pressed
|
|
8
|
+
return [KeyCode.shift, KeyCode.alt, KeyCode.control, KeyCode.meta].indexOf(event.keyCode) > -1;
|
|
9
|
+
}
|
|
10
|
+
function setIsKeyboard(active) {
|
|
11
|
+
if (active) {
|
|
12
|
+
document.body.setAttribute('data-awsui-focus-visible', 'true');
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
document.body.removeAttribute('data-awsui-focus-visible');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function handleMousedown() {
|
|
19
|
+
return setIsKeyboard(false);
|
|
20
|
+
}
|
|
21
|
+
function handleKeydown(event) {
|
|
22
|
+
if (!isModifierKey(event)) {
|
|
23
|
+
setIsKeyboard(true);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
let componentsCount = 0;
|
|
27
|
+
function addListeners() {
|
|
28
|
+
document.addEventListener('mousedown', handleMousedown);
|
|
29
|
+
document.addEventListener('keydown', handleKeydown);
|
|
30
|
+
}
|
|
31
|
+
function removeListeners() {
|
|
32
|
+
document.removeEventListener('mousedown', handleMousedown);
|
|
33
|
+
document.removeEventListener('keydown', handleKeydown);
|
|
34
|
+
}
|
|
35
|
+
export default function useFocusVisible() {
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (componentsCount === 0) {
|
|
38
|
+
addListeners();
|
|
39
|
+
}
|
|
40
|
+
componentsCount++;
|
|
19
41
|
return () => {
|
|
20
|
-
|
|
21
|
-
|
|
42
|
+
componentsCount--;
|
|
43
|
+
if (componentsCount === 0) {
|
|
44
|
+
removeListeners();
|
|
45
|
+
}
|
|
22
46
|
};
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
export default function useFocusVisible() {
|
|
26
|
-
const visible = useFocusSingleton();
|
|
27
|
-
return visible ? { 'data-awsui-focus-visible': visible } : {};
|
|
47
|
+
}, []);
|
|
28
48
|
}
|
|
29
49
|
//# sourceMappingURL=index.js.map
|