@cloudscape-design/components 3.0.962 → 3.0.964
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/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +32 -32
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/annotation-context/index.js +2 -2
- package/annotation-context/index.js.map +1 -1
- package/app-layout/classic.d.ts.map +1 -1
- package/app-layout/classic.js +3 -2
- package/app-layout/classic.js.map +1 -1
- package/app-layout/drawer/interfaces.d.ts +1 -0
- package/app-layout/drawer/interfaces.d.ts.map +1 -1
- package/app-layout/drawer/interfaces.js.map +1 -1
- package/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
- package/app-layout/drawer/resizable-drawer.js +6 -6
- package/app-layout/drawer/resizable-drawer.js.map +1 -1
- package/app-layout/interfaces.d.ts +1 -0
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/notifications/styles.css.js +3 -3
- package/app-layout/notifications/styles.scoped.css +7 -7
- package/app-layout/notifications/styles.selectors.js +3 -3
- package/app-layout/runtime-drawer/index.js +1 -1
- package/app-layout/runtime-drawer/index.js.map +1 -1
- package/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts +6 -0
- package/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts.map +1 -0
- package/app-layout/runtime-drawer/use-runtime-drawer-context.js +29 -0
- package/app-layout/runtime-drawer/use-runtime-drawer-context.js.map +1 -0
- package/app-layout/utils/use-keyboard-events.d.ts +5 -1
- package/app-layout/utils/use-keyboard-events.d.ts.map +1 -1
- package/app-layout/utils/use-keyboard-events.js +65 -42
- package/app-layout/utils/use-keyboard-events.js.map +1 -1
- package/app-layout/utils/use-resize.d.ts.map +1 -1
- package/app-layout/utils/use-resize.js +3 -3
- package/app-layout/utils/use-resize.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +86 -86
- package/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +2 -2
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +2 -2
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +10 -10
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +12 -12
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +10 -10
- package/app-layout/visual-refresh-toolbar/drawer/use-resize.d.ts +1 -0
- package/app-layout/visual-refresh-toolbar/drawer/use-resize.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/use-resize.js +2 -2
- package/app-layout/visual-refresh-toolbar/drawer/use-resize.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +19 -19
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +43 -43
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +19 -19
- package/content-layout/styles.css.js +14 -14
- package/content-layout/styles.scoped.css +27 -27
- package/content-layout/styles.selectors.js +14 -14
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/grids/interfaces.d.ts +3 -4
- package/date-range-picker/calendar/grids/interfaces.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/interfaces.js.map +1 -1
- package/date-range-picker/calendar/header/header-button.d.ts +0 -2
- package/date-range-picker/calendar/header/header-button.d.ts.map +1 -1
- package/date-range-picker/calendar/header/header-button.js.map +1 -1
- package/date-range-picker/calendar/header/index.d.ts +2 -3
- package/date-range-picker/calendar/header/index.d.ts.map +1 -1
- package/date-range-picker/calendar/header/index.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts +2 -2
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/calendar/range-inputs.d.ts +3 -3
- package/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
- package/date-range-picker/calendar/range-inputs.js.map +1 -1
- package/date-range-picker/dropdown.d.ts +2 -2
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +2 -7
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/date-range-picker/relative-range/index.d.ts +2 -2
- package/date-range-picker/relative-range/index.d.ts.map +1 -1
- package/date-range-picker/relative-range/index.js.map +1 -1
- package/flashbar/styles.css.js +50 -50
- package/flashbar/styles.scoped.css +166 -166
- package/flashbar/styles.selectors.js +50 -50
- package/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.ar.js +1 -1
- package/i18n/messages/all.ar.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.en.js +1 -1
- package/i18n/messages/all.en.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/i18n/messages-types.d.ts +1 -0
- package/i18n/messages-types.d.ts.map +1 -1
- package/i18n/messages-types.js.map +1 -1
- package/i18n/provider.js +2 -2
- package/i18n/provider.js.map +1 -1
- package/internal/components/drag-handle/button.d.ts +1 -1
- package/internal/components/drag-handle/button.d.ts.map +1 -1
- package/internal/components/drag-handle/button.js +2 -3
- package/internal/components/drag-handle/button.js.map +1 -1
- package/internal/components/drag-handle/index.d.ts +1 -1
- package/internal/components/drag-handle/index.d.ts.map +1 -1
- package/internal/components/drag-handle/index.js.map +1 -1
- package/internal/components/drag-handle/interfaces.d.ts +0 -3
- package/internal/components/drag-handle/interfaces.d.ts.map +1 -1
- package/internal/components/drag-handle/interfaces.js.map +1 -1
- package/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
- package/internal/components/drag-handle-wrapper/index.js +8 -6
- package/internal/components/drag-handle-wrapper/index.js.map +1 -1
- package/internal/components/drag-handle-wrapper/styles.css.js +21 -27
- package/internal/components/drag-handle-wrapper/styles.scoped.css +58 -235
- package/internal/components/drag-handle-wrapper/styles.selectors.js +21 -27
- package/internal/components/dropdown/styles.css.js +20 -20
- package/internal/components/dropdown/styles.scoped.css +38 -38
- package/internal/components/dropdown/styles.selectors.js +20 -20
- package/internal/components/panel-resize-handle/index.d.ts +3 -0
- package/internal/components/panel-resize-handle/index.d.ts.map +1 -1
- package/internal/components/panel-resize-handle/index.js +11 -4
- package/internal/components/panel-resize-handle/index.js.map +1 -1
- package/internal/components/panel-resize-handle/styles.css.js +2 -5
- package/internal/components/panel-resize-handle/styles.scoped.css +9 -26
- package/internal/components/panel-resize-handle/styles.selectors.js +2 -5
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/custom-css-properties/index.d.ts +2 -0
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +59 -57
- package/internal/generated/custom-css-properties/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 +8 -5
- package/internal/hooks/use-base-component/index.js.map +1 -1
- package/internal/plugins/controllers/alert-flash-content.d.ts +2 -0
- package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
- package/internal/plugins/controllers/alert-flash-content.js.map +1 -1
- package/internal/plugins/controllers/drawers.d.ts +7 -0
- package/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/internal/plugins/controllers/drawers.js +17 -1
- package/internal/plugins/controllers/drawers.js.map +1 -1
- package/internal/plugins/helpers/use-discovered-content.d.ts +7 -7
- package/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -1
- package/internal/plugins/helpers/use-discovered-content.js +5 -2
- package/internal/plugins/helpers/use-discovered-content.js.map +1 -1
- package/package.json +2 -3
- package/popover/container.d.ts.map +1 -1
- package/popover/container.js +20 -7
- package/popover/container.js.map +1 -1
- package/slider/styles.css.js +26 -26
- package/slider/styles.scoped.css +86 -86
- package/slider/styles.selectors.js +26 -26
- package/spinner/styles.css.js +13 -13
- package/spinner/styles.scoped.css +39 -39
- package/spinner/styles.selectors.js +13 -13
- package/split-panel/implementation.d.ts.map +1 -1
- package/split-panel/implementation.js +3 -3
- package/split-panel/implementation.js.map +1 -1
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +1 -1
- package/split-panel/index.js.map +1 -1
- package/split-panel/interfaces.d.ts +1 -0
- package/split-panel/interfaces.d.ts.map +1 -1
- package/split-panel/interfaces.js.map +1 -1
- package/table/body-cell/inline-editor.d.ts.map +1 -1
- package/table/body-cell/inline-editor.js +2 -1
- package/table/body-cell/inline-editor.js.map +1 -1
- package/internal/components/panel-resize-handle/icon.d.ts +0 -5
- package/internal/components/panel-resize-handle/icon.d.ts.map +0 -1
- package/internal/components/panel-resize-handle/icon.js +0 -9
- package/internal/components/panel-resize-handle/icon.js.map +0 -1
- package/internal/hooks/use-telemetry/index.d.ts +0 -3
- package/internal/hooks/use-telemetry/index.d.ts.map +0 -1
- package/internal/hooks/use-telemetry/index.js +0 -12
- package/internal/hooks/use-telemetry/index.js.map +0 -1
- package/internal/manifest.json +0 -3
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"arrow": "
|
|
5
|
-
"arrow-outer": "awsui_arrow-
|
|
6
|
-
"arrow-inner": "awsui_arrow-
|
|
7
|
-
"arrow-position-right-top": "awsui_arrow-position-right-
|
|
8
|
-
"arrow-position-right-bottom": "awsui_arrow-position-right-
|
|
9
|
-
"arrow-position-left-top": "awsui_arrow-position-left-
|
|
10
|
-
"arrow-position-left-bottom": "awsui_arrow-position-left-
|
|
11
|
-
"arrow-position-top-center": "awsui_arrow-position-top-
|
|
12
|
-
"arrow-position-top-responsive": "awsui_arrow-position-top-
|
|
13
|
-
"arrow-position-bottom-center": "awsui_arrow-position-bottom-
|
|
14
|
-
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-
|
|
15
|
-
"annotation": "
|
|
16
|
-
"next-button": "awsui_next-
|
|
17
|
-
"previous-button": "awsui_previous-
|
|
18
|
-
"finish-button": "awsui_finish-
|
|
19
|
-
"header": "
|
|
20
|
-
"step-counter-content": "awsui_step-counter-
|
|
21
|
-
"content": "
|
|
22
|
-
"description": "
|
|
23
|
-
"actionBar": "
|
|
24
|
-
"stepCounter": "
|
|
25
|
-
"divider": "
|
|
26
|
-
"hotspot": "
|
|
27
|
-
"icon": "
|
|
4
|
+
"arrow": "awsui_arrow_1hpp3_1rese_193",
|
|
5
|
+
"arrow-outer": "awsui_arrow-outer_1hpp3_1rese_197",
|
|
6
|
+
"arrow-inner": "awsui_arrow-inner_1hpp3_1rese_197",
|
|
7
|
+
"arrow-position-right-top": "awsui_arrow-position-right-top_1hpp3_1rese_239",
|
|
8
|
+
"arrow-position-right-bottom": "awsui_arrow-position-right-bottom_1hpp3_1rese_239",
|
|
9
|
+
"arrow-position-left-top": "awsui_arrow-position-left-top_1hpp3_1rese_242",
|
|
10
|
+
"arrow-position-left-bottom": "awsui_arrow-position-left-bottom_1hpp3_1rese_242",
|
|
11
|
+
"arrow-position-top-center": "awsui_arrow-position-top-center_1hpp3_1rese_245",
|
|
12
|
+
"arrow-position-top-responsive": "awsui_arrow-position-top-responsive_1hpp3_1rese_245",
|
|
13
|
+
"arrow-position-bottom-center": "awsui_arrow-position-bottom-center_1hpp3_1rese_248",
|
|
14
|
+
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_1hpp3_1rese_248",
|
|
15
|
+
"annotation": "awsui_annotation_1hpp3_1rese_252",
|
|
16
|
+
"next-button": "awsui_next-button_1hpp3_1rese_253",
|
|
17
|
+
"previous-button": "awsui_previous-button_1hpp3_1rese_254",
|
|
18
|
+
"finish-button": "awsui_finish-button_1hpp3_1rese_255",
|
|
19
|
+
"header": "awsui_header_1hpp3_1rese_256",
|
|
20
|
+
"step-counter-content": "awsui_step-counter-content_1hpp3_1rese_257",
|
|
21
|
+
"content": "awsui_content_1hpp3_1rese_258",
|
|
22
|
+
"description": "awsui_description_1hpp3_1rese_262",
|
|
23
|
+
"actionBar": "awsui_actionBar_1hpp3_1rese_267",
|
|
24
|
+
"stepCounter": "awsui_stepCounter_1hpp3_1rese_274",
|
|
25
|
+
"divider": "awsui_divider_1hpp3_1rese_278",
|
|
26
|
+
"hotspot": "awsui_hotspot_1hpp3_1rese_282",
|
|
27
|
+
"icon": "awsui_icon_1hpp3_1rese_352"
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -190,11 +190,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
190
190
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
191
191
|
SPDX-License-Identifier: Apache-2.0
|
|
192
192
|
*/
|
|
193
|
-
.
|
|
193
|
+
.awsui_arrow_1hpp3_1rese_193:not(#\9) {
|
|
194
194
|
inline-size: 20px;
|
|
195
195
|
block-size: 10px;
|
|
196
196
|
}
|
|
197
|
-
.awsui_arrow-
|
|
197
|
+
.awsui_arrow-outer_1hpp3_1rese_197:not(#\9), .awsui_arrow-inner_1hpp3_1rese_197:not(#\9) {
|
|
198
198
|
position: absolute;
|
|
199
199
|
overflow: hidden;
|
|
200
200
|
inline-size: 20px;
|
|
@@ -203,7 +203,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
203
203
|
inset-inline-start: 0;
|
|
204
204
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
205
205
|
}
|
|
206
|
-
.awsui_arrow-
|
|
206
|
+
.awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after, .awsui_arrow-inner_1hpp3_1rese_197:not(#\9)::after {
|
|
207
207
|
content: "";
|
|
208
208
|
box-sizing: border-box;
|
|
209
209
|
display: inline-block;
|
|
@@ -219,67 +219,67 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
219
219
|
transform: rotate(45deg);
|
|
220
220
|
transform-origin: 0 100%;
|
|
221
221
|
}
|
|
222
|
-
.awsui_arrow-
|
|
222
|
+
.awsui_arrow-outer_1hpp3_1rese_197:not(#\9):dir(rtl)::after, .awsui_arrow-inner_1hpp3_1rese_197:not(#\9):dir(rtl)::after {
|
|
223
223
|
transform: rotate(-45deg);
|
|
224
224
|
transform-origin: 100% 100%;
|
|
225
225
|
}
|
|
226
|
-
.awsui_arrow-
|
|
226
|
+
.awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after {
|
|
227
227
|
background-color: var(--color-border-status-info-2zt73n, #006ce0);
|
|
228
228
|
}
|
|
229
|
-
.awsui_arrow-
|
|
229
|
+
.awsui_arrow-inner_1hpp3_1rese_197:not(#\9) {
|
|
230
230
|
inset-block-start: 2px;
|
|
231
231
|
}
|
|
232
|
-
.awsui_arrow-
|
|
232
|
+
.awsui_arrow-inner_1hpp3_1rese_197:not(#\9)::after {
|
|
233
233
|
border-start-start-radius: 1px;
|
|
234
234
|
border-start-end-radius: 0;
|
|
235
235
|
border-end-start-radius: 0;
|
|
236
236
|
border-end-end-radius: 0;
|
|
237
237
|
background-color: var(--color-background-status-info-j2xxem, #f0fbff);
|
|
238
238
|
}
|
|
239
|
-
.awsui_arrow-position-right-
|
|
239
|
+
.awsui_arrow-position-right-top_1hpp3_1rese_239 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after, .awsui_arrow-position-right-bottom_1hpp3_1rese_239 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after {
|
|
240
240
|
box-shadow: -0.71px 0.71px 4px -2px var(--color-shadow-default-08gb4j, rgba(15, 20, 26, 0.12));
|
|
241
241
|
}
|
|
242
|
-
.awsui_arrow-position-left-
|
|
242
|
+
.awsui_arrow-position-left-top_1hpp3_1rese_242 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after, .awsui_arrow-position-left-bottom_1hpp3_1rese_242 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after {
|
|
243
243
|
box-shadow: 0.71px -0.71px 4px -2px var(--color-shadow-default-08gb4j, rgba(15, 20, 26, 0.12));
|
|
244
244
|
}
|
|
245
|
-
.awsui_arrow-position-top-
|
|
245
|
+
.awsui_arrow-position-top-center_1hpp3_1rese_245 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after, .awsui_arrow-position-top-responsive_1hpp3_1rese_245 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after {
|
|
246
246
|
box-shadow: -0.71px -0.71px 4px -2px var(--color-shadow-default-08gb4j, rgba(15, 20, 26, 0.12));
|
|
247
247
|
}
|
|
248
|
-
.awsui_arrow-position-bottom-
|
|
248
|
+
.awsui_arrow-position-bottom-center_1hpp3_1rese_248 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after, .awsui_arrow-position-bottom-responsive_1hpp3_1rese_248 > .awsui_arrow-outer_1hpp3_1rese_197:not(#\9)::after {
|
|
249
249
|
box-shadow: 0.71px 0.71px 4px -2px var(--color-shadow-default-08gb4j, rgba(15, 20, 26, 0.12));
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
.
|
|
253
|
-
.awsui_next-
|
|
254
|
-
.awsui_previous-
|
|
255
|
-
.awsui_finish-
|
|
256
|
-
.
|
|
257
|
-
.awsui_step-counter-
|
|
258
|
-
.
|
|
252
|
+
.awsui_annotation_1hpp3_1rese_252:not(#\9),
|
|
253
|
+
.awsui_next-button_1hpp3_1rese_253:not(#\9),
|
|
254
|
+
.awsui_previous-button_1hpp3_1rese_254:not(#\9),
|
|
255
|
+
.awsui_finish-button_1hpp3_1rese_255:not(#\9),
|
|
256
|
+
.awsui_header_1hpp3_1rese_256:not(#\9),
|
|
257
|
+
.awsui_step-counter-content_1hpp3_1rese_257:not(#\9),
|
|
258
|
+
.awsui_content_1hpp3_1rese_258:not(#\9) {
|
|
259
259
|
/* used in test-utils */
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
.
|
|
262
|
+
.awsui_description_1hpp3_1rese_262:not(#\9) {
|
|
263
263
|
overflow: hidden;
|
|
264
264
|
margin-block-start: var(--space-xxs-hwfkai, 4px);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
.
|
|
267
|
+
.awsui_actionBar_1hpp3_1rese_267:not(#\9) {
|
|
268
268
|
display: flex;
|
|
269
269
|
justify-content: space-between;
|
|
270
270
|
align-items: center;
|
|
271
271
|
position: relative;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
.
|
|
274
|
+
.awsui_stepCounter_1hpp3_1rese_274:not(#\9) {
|
|
275
275
|
margin-inline-end: 20px;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
.
|
|
278
|
+
.awsui_divider_1hpp3_1rese_278:not(#\9) {
|
|
279
279
|
border-block-end: var(--border-divider-section-width-uwo8my, 1px) solid var(--color-border-divider-default-jm73jm, #c6c6cd);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
.
|
|
282
|
+
.awsui_hotspot_1hpp3_1rese_282:not(#\9) {
|
|
283
283
|
border-collapse: separate;
|
|
284
284
|
border-spacing: 0;
|
|
285
285
|
box-sizing: border-box;
|
|
@@ -316,27 +316,27 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
316
316
|
padding-block: 0;
|
|
317
317
|
padding-inline: 0;
|
|
318
318
|
cursor: pointer;
|
|
319
|
-
scroll-margin: var(--awsui-content-scroll-margin-
|
|
319
|
+
scroll-margin: var(--awsui-content-scroll-margin-xgujsu, 40px 0 0 0);
|
|
320
320
|
position: relative;
|
|
321
321
|
inline-size: 16px;
|
|
322
322
|
block-size: 16px;
|
|
323
323
|
}
|
|
324
|
-
.
|
|
324
|
+
.awsui_hotspot_1hpp3_1rese_282:not(#\9):before {
|
|
325
325
|
content: "";
|
|
326
326
|
position: absolute;
|
|
327
327
|
inset: calc(-1 * var(--space-xxs-hwfkai, 4px));
|
|
328
328
|
}
|
|
329
|
-
.
|
|
329
|
+
.awsui_hotspot_1hpp3_1rese_282:not(#\9):focus {
|
|
330
330
|
outline: none;
|
|
331
331
|
}
|
|
332
|
-
body[data-awsui-focus-visible=true] .
|
|
332
|
+
body[data-awsui-focus-visible=true] .awsui_hotspot_1hpp3_1rese_282:not(#\9):focus {
|
|
333
333
|
position: relative;
|
|
334
334
|
}
|
|
335
|
-
body[data-awsui-focus-visible=true] .
|
|
335
|
+
body[data-awsui-focus-visible=true] .awsui_hotspot_1hpp3_1rese_282:not(#\9):focus {
|
|
336
336
|
outline: 2px dotted transparent;
|
|
337
337
|
outline-offset: calc(2px - 1px);
|
|
338
338
|
}
|
|
339
|
-
body[data-awsui-focus-visible=true] .
|
|
339
|
+
body[data-awsui-focus-visible=true] .awsui_hotspot_1hpp3_1rese_282:not(#\9):focus::before {
|
|
340
340
|
content: " ";
|
|
341
341
|
display: block;
|
|
342
342
|
position: absolute;
|
|
@@ -350,13 +350,13 @@ body[data-awsui-focus-visible=true] .awsui_hotspot_1hpp3_rgczf_282:not(#\9):focu
|
|
|
350
350
|
border-end-end-radius: var(--border-radius-control-circular-focus-ring-yjhscw, 4px);
|
|
351
351
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-8bi903, #006ce0);
|
|
352
352
|
}
|
|
353
|
-
.
|
|
353
|
+
.awsui_hotspot_1hpp3_1rese_282 > .awsui_icon_1hpp3_1rese_352:not(#\9) {
|
|
354
354
|
position: relative;
|
|
355
355
|
stroke: var(--color-text-link-default-dsa7ac, #006ce0);
|
|
356
356
|
}
|
|
357
|
-
.
|
|
357
|
+
.awsui_hotspot_1hpp3_1rese_282:not(#\9):hover > .awsui_icon_1hpp3_1rese_352 {
|
|
358
358
|
stroke: var(--color-text-link-hover-nut5c6, #002b66);
|
|
359
359
|
}
|
|
360
|
-
.
|
|
360
|
+
.awsui_hotspot_1hpp3_1rese_282:not(#\9):active > .awsui_icon_1hpp3_1rese_352 {
|
|
361
361
|
stroke: var(--color-text-link-default-dsa7ac, #006ce0);
|
|
362
362
|
}
|
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"arrow": "
|
|
6
|
-
"arrow-outer": "awsui_arrow-
|
|
7
|
-
"arrow-inner": "awsui_arrow-
|
|
8
|
-
"arrow-position-right-top": "awsui_arrow-position-right-
|
|
9
|
-
"arrow-position-right-bottom": "awsui_arrow-position-right-
|
|
10
|
-
"arrow-position-left-top": "awsui_arrow-position-left-
|
|
11
|
-
"arrow-position-left-bottom": "awsui_arrow-position-left-
|
|
12
|
-
"arrow-position-top-center": "awsui_arrow-position-top-
|
|
13
|
-
"arrow-position-top-responsive": "awsui_arrow-position-top-
|
|
14
|
-
"arrow-position-bottom-center": "awsui_arrow-position-bottom-
|
|
15
|
-
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-
|
|
16
|
-
"annotation": "
|
|
17
|
-
"next-button": "awsui_next-
|
|
18
|
-
"previous-button": "awsui_previous-
|
|
19
|
-
"finish-button": "awsui_finish-
|
|
20
|
-
"header": "
|
|
21
|
-
"step-counter-content": "awsui_step-counter-
|
|
22
|
-
"content": "
|
|
23
|
-
"description": "
|
|
24
|
-
"actionBar": "
|
|
25
|
-
"stepCounter": "
|
|
26
|
-
"divider": "
|
|
27
|
-
"hotspot": "
|
|
28
|
-
"icon": "
|
|
5
|
+
"arrow": "awsui_arrow_1hpp3_1rese_193",
|
|
6
|
+
"arrow-outer": "awsui_arrow-outer_1hpp3_1rese_197",
|
|
7
|
+
"arrow-inner": "awsui_arrow-inner_1hpp3_1rese_197",
|
|
8
|
+
"arrow-position-right-top": "awsui_arrow-position-right-top_1hpp3_1rese_239",
|
|
9
|
+
"arrow-position-right-bottom": "awsui_arrow-position-right-bottom_1hpp3_1rese_239",
|
|
10
|
+
"arrow-position-left-top": "awsui_arrow-position-left-top_1hpp3_1rese_242",
|
|
11
|
+
"arrow-position-left-bottom": "awsui_arrow-position-left-bottom_1hpp3_1rese_242",
|
|
12
|
+
"arrow-position-top-center": "awsui_arrow-position-top-center_1hpp3_1rese_245",
|
|
13
|
+
"arrow-position-top-responsive": "awsui_arrow-position-top-responsive_1hpp3_1rese_245",
|
|
14
|
+
"arrow-position-bottom-center": "awsui_arrow-position-bottom-center_1hpp3_1rese_248",
|
|
15
|
+
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_1hpp3_1rese_248",
|
|
16
|
+
"annotation": "awsui_annotation_1hpp3_1rese_252",
|
|
17
|
+
"next-button": "awsui_next-button_1hpp3_1rese_253",
|
|
18
|
+
"previous-button": "awsui_previous-button_1hpp3_1rese_254",
|
|
19
|
+
"finish-button": "awsui_finish-button_1hpp3_1rese_255",
|
|
20
|
+
"header": "awsui_header_1hpp3_1rese_256",
|
|
21
|
+
"step-counter-content": "awsui_step-counter-content_1hpp3_1rese_257",
|
|
22
|
+
"content": "awsui_content_1hpp3_1rese_258",
|
|
23
|
+
"description": "awsui_description_1hpp3_1rese_262",
|
|
24
|
+
"actionBar": "awsui_actionBar_1hpp3_1rese_267",
|
|
25
|
+
"stepCounter": "awsui_stepCounter_1hpp3_1rese_274",
|
|
26
|
+
"divider": "awsui_divider_1hpp3_1rese_278",
|
|
27
|
+
"hotspot": "awsui_hotspot_1hpp3_1rese_282",
|
|
28
|
+
"icon": "awsui_icon_1hpp3_1rese_352"
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -3,7 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
6
|
-
import
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
7
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
8
8
|
import { ClosedAnnotation } from './annotation/closed-annotation';
|
|
9
9
|
import { OpenAnnotation } from './annotation/open-annotation';
|
|
@@ -13,7 +13,7 @@ import { getStepInfo } from './utils';
|
|
|
13
13
|
const emptyTasks = [];
|
|
14
14
|
export default function AnnotationContext({ currentTutorial, children, onStepChange, onFinish: onFinishHandler, onStartTutorial, onExitTutorial, i18nStrings, }) {
|
|
15
15
|
var _a, _b, _c, _d;
|
|
16
|
-
|
|
16
|
+
useBaseComponent('AnnotationContext');
|
|
17
17
|
const [open, setOpen] = useState(true);
|
|
18
18
|
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
|
19
19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,CAAC;IAEF,MAAM,iBAAiB,GAAG,WAAW,CAAC,CAAC,EAAU,EAAE,EAAE;QACnD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;YACrC,mCAAmC;YACnC,OAAO;SACR;QAED;;;;UAIE;QACF,oBAAoB,CAAC,OAAO,GAAG,SAAS,CAAC,EAAE,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE3E,oBAAoB,CAAC,iBAAiB,CAAC,EAAE;YACvC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE;gBAC1B,OAAO,iBAAiB,CAAC;aAC1B;YAED,OAAO,SAAS,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAmB;QAC9B,eAAe;QACf,eAAe;QACf,iBAAiB;QACjB,eAAe;QACf,cAAc;QACd,gBAAgB;QAChB,eAAe;KAChB,CAAC;IAEF,OAAO,oBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAA2B,CAAC;AACvF,CAAC;AAED,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAEzD,SAAS,SAAS,CAAoC,GAAY,EAAE,MAAS;IAC3E,6DAA6D;IAC7D,MAAyC,KAAA,MAAM,EAAvC,KAAC,GAAI,EAAE,CAAC,SAAA,EAAK,eAAe,cAA9B,uCAAgC,CAAS,CAAC;IAChD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { HotspotProps } from '../hotspot/interfaces';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useTelemetry } from '../internal/hooks/use-telemetry';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ClosedAnnotation } from './annotation/closed-annotation';\nimport { OpenAnnotation } from './annotation/open-annotation';\nimport { HotspotContext, hotspotContext } from './context';\nimport { AnnotationContextProps } from './interfaces';\nimport { getStepInfo } from './utils';\n\nexport { AnnotationContextProps };\n\n// constant empty array to keep hook dependency stable\nconst emptyTasks: ReadonlyArray<AnnotationContextProps.Task> = [];\n\nexport default function AnnotationContext({\n currentTutorial,\n children,\n onStepChange,\n onFinish: onFinishHandler,\n onStartTutorial,\n onExitTutorial,\n i18nStrings,\n}: AnnotationContextProps): JSX.Element {\n useTelemetry('AnnotationContext');\n\n const [open, setOpen] = useState(true);\n\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n useEffect(() => {\n // When a tutorial is started, we reset the progress to the first step.\n setCurrentStepIndex(0);\n setOpen(true);\n }, [currentTutorial, setOpen]);\n\n const [availableHotspots, setAvailableHotspots] = useState<Record<string, true | undefined>>({});\n // availableHotspots is mirrored in this ref to prevent endless loops\n // in between registerHotspot and unregisterHotspot callbacks.\n const availableHotspotsRef = useRef<Record<string, true | undefined>>(availableHotspots);\n\n const annotations = currentTutorial ? currentTutorial.tasks : emptyTasks;\n const { task, step, localIndex, taskIndex } = getStepInfo(annotations, currentStepIndex);\n const currentId = step?.hotspotId;\n const totalStepCount = annotations.map(a => a.steps.length).reduce((a, b) => a + b, 0);\n\n const id2index = useMemo(() => {\n const mapping: Record<string, number> = {};\n\n let counter = 0;\n for (const annotation of annotations) {\n for (const step of annotation.steps) {\n if (mapping[step.hotspotId] === undefined) {\n mapping[step.hotspotId] = counter;\n }\n counter++;\n }\n }\n\n return mapping;\n }, [annotations]);\n\n const openNextStep = useCallback(() => {\n const newStepIndex = Math.min(currentStepIndex + 1, totalStepCount);\n setCurrentStepIndex(newStepIndex);\n fireNonCancelableEvent(onStepChange, { step: newStepIndex, reason: 'next' });\n }, [currentStepIndex, onStepChange, totalStepCount]);\n\n const openPreviousStep = useCallback(() => {\n const newStepIndex = Math.max(currentStepIndex - 1, 0);\n setCurrentStepIndex(newStepIndex);\n fireNonCancelableEvent(onStepChange, { step: newStepIndex, reason: 'previous' });\n }, [onStepChange, currentStepIndex]);\n\n const onFinish = useCallback(() => fireNonCancelableEvent(onFinishHandler), [onFinishHandler]);\n\n /**\n * If the currently open hotspot disappears from the page (e.g. because of a react-router navigation),\n * this Effect detects the nearest available hotspot and changes to it. This allows us to e.g. automatically\n * advance to the first step on the new page (or the last step on the previous page, in case the user\n * navigates back).\n */\n const isCurrentHotspotAvailable = currentId ? availableHotspots[currentId] : null;\n useEffect(() => {\n if (!currentId || availableHotspotsRef.current[currentId]) {\n return;\n }\n\n const findNearestHotspot = () => {\n let nearestHotspot: string | undefined = undefined;\n let nearestDistance = Infinity;\n for (const hotspotId of Object.keys(availableHotspotsRef.current)) {\n const distanceFromCurrentHotspot = Math.abs(id2index[hotspotId] - currentStepIndex);\n if (distanceFromCurrentHotspot < nearestDistance) {\n nearestDistance = distanceFromCurrentHotspot;\n nearestHotspot = hotspotId;\n }\n }\n return nearestHotspot;\n };\n\n const nearestHotspot = findNearestHotspot();\n if (nearestHotspot) {\n const newStepIndex = id2index[nearestHotspot];\n setCurrentStepIndex(newStepIndex);\n setOpen(true);\n fireNonCancelableEvent(onStepChange, { step: newStepIndex, reason: 'auto-fallback' });\n }\n }, [annotations, isCurrentHotspotAvailable, currentId, currentStepIndex, id2index, onStepChange, availableHotspots]);\n\n const onDismiss = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onOpen = useCallback(\n (stepIndex: number) => {\n setCurrentStepIndex(stepIndex);\n fireNonCancelableEvent(onStepChange, { step: stepIndex, reason: 'open' });\n setOpen(true);\n },\n [onStepChange, setOpen]\n );\n\n const idOfPreviousHotspot = getStepInfo(annotations, currentStepIndex - 1).step?.hotspotId;\n const idOfNextHotspot = getStepInfo(annotations, currentStepIndex + 1).step?.hotspotId;\n const previousHotspotIsAvailable =\n (idOfPreviousHotspot !== undefined && availableHotspots[idOfPreviousHotspot]) ?? false;\n const nextHotspotIsAvailable = (idOfNextHotspot !== undefined && availableHotspots[idOfNextHotspot]) ?? false;\n\n const getContentForId = useCallback(\n (id: string, direction: HotspotProps['direction']) => {\n if (currentTutorial?.completed) {\n return null;\n }\n\n const globalStepIndex = id2index[id];\n if (globalStepIndex === undefined) {\n // This hotspot is not used in the current tutorial.\n return null;\n }\n\n if (!task || !step || !open || id !== currentId) {\n const { task: currentTask, localIndex: currentStepIndex } = getStepInfo(annotations, globalStepIndex);\n return (\n <ClosedAnnotation\n globalStepIndex={globalStepIndex}\n i18nStrings={i18nStrings}\n onOpen={onOpen}\n focusOnRender={id === currentId}\n totalLocalSteps={currentTask ? currentTask.steps.length : 0}\n taskLocalStepIndex={currentStepIndex}\n />\n );\n }\n\n return (\n <OpenAnnotation\n i18nStrings={i18nStrings}\n direction={direction}\n title={i18nStrings.taskTitle(taskIndex, task.title)}\n content={step.content}\n alert={step.warningAlert}\n showPreviousButton={currentStepIndex !== 0}\n showFinishButton={currentStepIndex + 1 === totalStepCount}\n taskLocalStepIndex={localIndex}\n totalLocalSteps={task.steps.length}\n nextButtonEnabled={nextHotspotIsAvailable}\n onNextButtonClick={openNextStep}\n onFinish={onFinish}\n previousButtonEnabled={previousHotspotIsAvailable}\n onPreviousButtonClick={openPreviousStep}\n onDismiss={onDismiss}\n />\n );\n },\n [\n id2index,\n currentTutorial,\n task,\n step,\n open,\n currentId,\n currentStepIndex,\n i18nStrings,\n taskIndex,\n localIndex,\n totalStepCount,\n nextHotspotIsAvailable,\n openNextStep,\n onFinish,\n previousHotspotIsAvailable,\n openPreviousStep,\n onDismiss,\n onOpen,\n annotations,\n ]\n );\n\n const registerHotspot = useCallback(\n (id: string) => {\n if (!id2index || id2index[id] === undefined) {\n // This hotspot is not used in the current tutorial.\n return;\n }\n\n /*\n To ensure that all hotspots are immediately known to all triggered useEffects, we\n need to update the availableHotspotsRef BEFORE the setAvailableHotspots calls, since\n they will be batched and delayed until after the useEffects are run.\n */\n availableHotspotsRef.current = { ...availableHotspotsRef.current, [id]: true } as const;\n\n setAvailableHotspots(availableHotspots => {\n if (availableHotspots[id]) {\n return availableHotspots;\n }\n\n return { ...availableHotspots, [id]: true } as const;\n });\n },\n // We need to react on id2index changes for registering new hotspots when the map changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [id2index]\n );\n\n const unregisterHotspot = useCallback((id: string) => {\n if (!availableHotspotsRef.current[id]) {\n // Prevents unnecessary re-renders.\n return;\n }\n\n /*\n To ensure that all hotspots are immediately known to all triggered useEffects, we\n need to update the availableHotspotsRef BEFORE the setAvailableHotspots calls, since\n they will be batched and delayed until after the useEffects are run.\n */\n availableHotspotsRef.current = removeKey(id, availableHotspotsRef.current);\n\n setAvailableHotspots(availableHotspots => {\n if (!availableHotspots[id]) {\n return availableHotspots;\n }\n\n return removeKey(id, availableHotspots);\n });\n }, []);\n\n const context: HotspotContext = {\n getContentForId,\n registerHotspot,\n unregisterHotspot,\n onStartTutorial,\n onExitTutorial,\n currentStepIndex,\n currentTutorial,\n };\n\n return <hotspotContext.Provider value={context}>{children}</hotspotContext.Provider>;\n}\n\napplyDisplayName(AnnotationContext, 'AnnotationContext');\n\nfunction removeKey<T extends Record<string, unknown>>(key: keyof T, object: T) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _, ...remainingObject } = object;\n return remainingObject;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/annotation-context/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,E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EAAE,iBAAiB,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAmB;QAC9B,eAAe;QACf,eAAe;QACf,iBAAiB;QACjB,eAAe;QACf,cAAc;QACd,gBAAgB;QAChB,eAAe;KAChB,CAAC;IAEF,OAAO,oBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAA2B,CAAC;AACvF,CAAC;AAED,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAEzD,SAAS,SAAS,CAAoC,GAAY,EAAE,MAAS;IAC3E,6DAA6D;IAC7D,MAAyC,KAAA,MAAM,EAAvC,KAAC,GAAI,EAAE,CAAC,SAAA,EAAK,eAAe,cAA9B,uCAAgC,CAAS,CAAC;IAChD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { HotspotProps } from '../hotspot/interfaces';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ClosedAnnotation } from './annotation/closed-annotation';\nimport { OpenAnnotation } from './annotation/open-annotation';\nimport { HotspotContext, hotspotContext } from './context';\nimport { AnnotationContextProps } from './interfaces';\nimport { getStepInfo } from './utils';\n\nexport { AnnotationContextProps };\n\n// constant empty array to keep hook dependency stable\nconst emptyTasks: ReadonlyArray<AnnotationContextProps.Task> = [];\n\nexport default function AnnotationContext({\n currentTutorial,\n children,\n onStepChange,\n onFinish: onFinishHandler,\n onStartTutorial,\n onExitTutorial,\n i18nStrings,\n}: AnnotationContextProps): JSX.Element {\n useBaseComponent('AnnotationContext');\n\n const [open, setOpen] = useState(true);\n\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n useEffect(() => {\n // When a tutorial is started, we reset the progress to the first step.\n setCurrentStepIndex(0);\n setOpen(true);\n }, [currentTutorial, setOpen]);\n\n const [availableHotspots, setAvailableHotspots] = useState<Record<string, true | undefined>>({});\n // availableHotspots is mirrored in this ref to prevent endless loops\n // in between registerHotspot and unregisterHotspot callbacks.\n const availableHotspotsRef = useRef<Record<string, true | undefined>>(availableHotspots);\n\n const annotations = currentTutorial ? currentTutorial.tasks : emptyTasks;\n const { task, step, localIndex, taskIndex } = getStepInfo(annotations, currentStepIndex);\n const currentId = step?.hotspotId;\n const totalStepCount = annotations.map(a => a.steps.length).reduce((a, b) => a + b, 0);\n\n const id2index = useMemo(() => {\n const mapping: Record<string, number> = {};\n\n let counter = 0;\n for (const annotation of annotations) {\n for (const step of annotation.steps) {\n if (mapping[step.hotspotId] === undefined) {\n mapping[step.hotspotId] = counter;\n }\n counter++;\n }\n }\n\n return mapping;\n }, [annotations]);\n\n const openNextStep = useCallback(() => {\n const newStepIndex = Math.min(currentStepIndex + 1, totalStepCount);\n setCurrentStepIndex(newStepIndex);\n fireNonCancelableEvent(onStepChange, { step: newStepIndex, reason: 'next' });\n }, [currentStepIndex, onStepChange, totalStepCount]);\n\n const openPreviousStep = useCallback(() => {\n const newStepIndex = Math.max(currentStepIndex - 1, 0);\n setCurrentStepIndex(newStepIndex);\n fireNonCancelableEvent(onStepChange, { step: newStepIndex, reason: 'previous' });\n }, [onStepChange, currentStepIndex]);\n\n const onFinish = useCallback(() => fireNonCancelableEvent(onFinishHandler), [onFinishHandler]);\n\n /**\n * If the currently open hotspot disappears from the page (e.g. because of a react-router navigation),\n * this Effect detects the nearest available hotspot and changes to it. This allows us to e.g. automatically\n * advance to the first step on the new page (or the last step on the previous page, in case the user\n * navigates back).\n */\n const isCurrentHotspotAvailable = currentId ? availableHotspots[currentId] : null;\n useEffect(() => {\n if (!currentId || availableHotspotsRef.current[currentId]) {\n return;\n }\n\n const findNearestHotspot = () => {\n let nearestHotspot: string | undefined = undefined;\n let nearestDistance = Infinity;\n for (const hotspotId of Object.keys(availableHotspotsRef.current)) {\n const distanceFromCurrentHotspot = Math.abs(id2index[hotspotId] - currentStepIndex);\n if (distanceFromCurrentHotspot < nearestDistance) {\n nearestDistance = distanceFromCurrentHotspot;\n nearestHotspot = hotspotId;\n }\n }\n return nearestHotspot;\n };\n\n const nearestHotspot = findNearestHotspot();\n if (nearestHotspot) {\n const newStepIndex = id2index[nearestHotspot];\n setCurrentStepIndex(newStepIndex);\n setOpen(true);\n fireNonCancelableEvent(onStepChange, { step: newStepIndex, reason: 'auto-fallback' });\n }\n }, [annotations, isCurrentHotspotAvailable, currentId, currentStepIndex, id2index, onStepChange, availableHotspots]);\n\n const onDismiss = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onOpen = useCallback(\n (stepIndex: number) => {\n setCurrentStepIndex(stepIndex);\n fireNonCancelableEvent(onStepChange, { step: stepIndex, reason: 'open' });\n setOpen(true);\n },\n [onStepChange, setOpen]\n );\n\n const idOfPreviousHotspot = getStepInfo(annotations, currentStepIndex - 1).step?.hotspotId;\n const idOfNextHotspot = getStepInfo(annotations, currentStepIndex + 1).step?.hotspotId;\n const previousHotspotIsAvailable =\n (idOfPreviousHotspot !== undefined && availableHotspots[idOfPreviousHotspot]) ?? false;\n const nextHotspotIsAvailable = (idOfNextHotspot !== undefined && availableHotspots[idOfNextHotspot]) ?? false;\n\n const getContentForId = useCallback(\n (id: string, direction: HotspotProps['direction']) => {\n if (currentTutorial?.completed) {\n return null;\n }\n\n const globalStepIndex = id2index[id];\n if (globalStepIndex === undefined) {\n // This hotspot is not used in the current tutorial.\n return null;\n }\n\n if (!task || !step || !open || id !== currentId) {\n const { task: currentTask, localIndex: currentStepIndex } = getStepInfo(annotations, globalStepIndex);\n return (\n <ClosedAnnotation\n globalStepIndex={globalStepIndex}\n i18nStrings={i18nStrings}\n onOpen={onOpen}\n focusOnRender={id === currentId}\n totalLocalSteps={currentTask ? currentTask.steps.length : 0}\n taskLocalStepIndex={currentStepIndex}\n />\n );\n }\n\n return (\n <OpenAnnotation\n i18nStrings={i18nStrings}\n direction={direction}\n title={i18nStrings.taskTitle(taskIndex, task.title)}\n content={step.content}\n alert={step.warningAlert}\n showPreviousButton={currentStepIndex !== 0}\n showFinishButton={currentStepIndex + 1 === totalStepCount}\n taskLocalStepIndex={localIndex}\n totalLocalSteps={task.steps.length}\n nextButtonEnabled={nextHotspotIsAvailable}\n onNextButtonClick={openNextStep}\n onFinish={onFinish}\n previousButtonEnabled={previousHotspotIsAvailable}\n onPreviousButtonClick={openPreviousStep}\n onDismiss={onDismiss}\n />\n );\n },\n [\n id2index,\n currentTutorial,\n task,\n step,\n open,\n currentId,\n currentStepIndex,\n i18nStrings,\n taskIndex,\n localIndex,\n totalStepCount,\n nextHotspotIsAvailable,\n openNextStep,\n onFinish,\n previousHotspotIsAvailable,\n openPreviousStep,\n onDismiss,\n onOpen,\n annotations,\n ]\n );\n\n const registerHotspot = useCallback(\n (id: string) => {\n if (!id2index || id2index[id] === undefined) {\n // This hotspot is not used in the current tutorial.\n return;\n }\n\n /*\n To ensure that all hotspots are immediately known to all triggered useEffects, we\n need to update the availableHotspotsRef BEFORE the setAvailableHotspots calls, since\n they will be batched and delayed until after the useEffects are run.\n */\n availableHotspotsRef.current = { ...availableHotspotsRef.current, [id]: true } as const;\n\n setAvailableHotspots(availableHotspots => {\n if (availableHotspots[id]) {\n return availableHotspots;\n }\n\n return { ...availableHotspots, [id]: true } as const;\n });\n },\n // We need to react on id2index changes for registering new hotspots when the map changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [id2index]\n );\n\n const unregisterHotspot = useCallback((id: string) => {\n if (!availableHotspotsRef.current[id]) {\n // Prevents unnecessary re-renders.\n return;\n }\n\n /*\n To ensure that all hotspots are immediately known to all triggered useEffects, we\n need to update the availableHotspotsRef BEFORE the setAvailableHotspots calls, since\n they will be batched and delayed until after the useEffects are run.\n */\n availableHotspotsRef.current = removeKey(id, availableHotspotsRef.current);\n\n setAvailableHotspots(availableHotspots => {\n if (!availableHotspots[id]) {\n return availableHotspots;\n }\n\n return removeKey(id, availableHotspots);\n });\n }, []);\n\n const context: HotspotContext = {\n getContentForId,\n registerHotspot,\n unregisterHotspot,\n onStartTutorial,\n onExitTutorial,\n currentStepIndex,\n currentTutorial,\n };\n\n return <hotspotContext.Provider value={context}>{children}</hotspotContext.Provider>;\n}\n\napplyDisplayName(AnnotationContext, 'AnnotationContext');\n\nfunction removeKey<T extends Record<string, unknown>>(key: keyof T, object: T) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _, ...remainingObject } = object;\n return remainingObject;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic.d.ts","sourceRoot":"","sources":["../../../src/app-layout/classic.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAoB7F,OAAO,EAAE,cAAc,EAA8B,MAAM,cAAc,CAAC;AAc1E,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"classic.d.ts","sourceRoot":"","sources":["../../../src/app-layout/classic.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAoB7F,OAAO,EAAE,cAAc,EAA8B,MAAM,cAAc,CAAC;AAc1E,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;4CA4jBrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/app-layout/classic.js
CHANGED
|
@@ -25,7 +25,7 @@ import { useSplitPanelFocusControl } from './utils/use-split-panel-focus-control
|
|
|
25
25
|
import styles from './styles.css.js';
|
|
26
26
|
import testutilStyles from './test-classes/styles.css.js';
|
|
27
27
|
const ClassicAppLayout = React.forwardRef((_a, ref) => {
|
|
28
|
-
var _b, _c, _d, _e, _f, _g;
|
|
28
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
29
29
|
var { navigation, navigationWidth, navigationHide, navigationOpen, tools, toolsWidth, toolsHide, toolsOpen: controlledToolsOpen, breadcrumbs, notifications, stickyNotifications, contentHeader, disableContentHeaderOverlap, content, contentType, disableContentPaddings, disableBodyScroll, maxContentWidth, minContentWidth, placement, ariaLabels, splitPanel, splitPanelSize: controlledSplitPanelSize, splitPanelOpen: controlledSplitPanelOpen, splitPanelPreferences: controlledSplitPanelPreferences, onSplitPanelPreferencesChange, onSplitPanelResize, onSplitPanelToggle, onNavigationChange, onToolsChange, drawers: controlledDrawers, onDrawerChange, activeDrawerId: controlledActiveDrawerId } = _a, rest = __rest(_a, ["navigation", "navigationWidth", "navigationHide", "navigationOpen", "tools", "toolsWidth", "toolsHide", "toolsOpen", "breadcrumbs", "notifications", "stickyNotifications", "contentHeader", "disableContentHeaderOverlap", "content", "contentType", "disableContentPaddings", "disableBodyScroll", "maxContentWidth", "minContentWidth", "placement", "ariaLabels", "splitPanel", "splitPanelSize", "splitPanelOpen", "splitPanelPreferences", "onSplitPanelPreferencesChange", "onSplitPanelResize", "onSplitPanelToggle", "onNavigationChange", "onToolsChange", "drawers", "onDrawerChange", "activeDrawerId"]);
|
|
30
30
|
// Private API for embedded view mode
|
|
31
31
|
const __embeddedViewMode = Boolean(rest.__embeddedViewMode);
|
|
@@ -282,13 +282,14 @@ const ClassicAppLayout = React.forwardRef((_a, ref) => {
|
|
|
282
282
|
closeLabel: (_d = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _d === void 0 ? void 0 : _d.closeButton,
|
|
283
283
|
mainLabel: (_e = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _e === void 0 ? void 0 : _e.drawerName,
|
|
284
284
|
resizeHandle: (_f = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _f === void 0 ? void 0 : _f.resizeHandle,
|
|
285
|
+
resizeHandleTooltipText: (_g = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _g === void 0 ? void 0 : _g.resizeHandleTooltipText,
|
|
285
286
|
}, minWidth: minDrawerSize, maxWidth: drawerMaxSize, width: activeDrawerSize, bottomOffset: placement.insetBlockEnd, topOffset: placement.insetBlockStart, isMobile: isMobile, onToggle: isOpen => {
|
|
286
287
|
if (!isOpen) {
|
|
287
288
|
focusToolsButtons();
|
|
288
289
|
focusDrawersButtons();
|
|
289
290
|
onActiveDrawerChange(null, { initiatedByUserAction: true });
|
|
290
291
|
}
|
|
291
|
-
}, isOpen: true, hideOpenButton: true, toggleRefs: drawerRefs, type: "tools", onLoseFocus: loseDrawersFocus, activeDrawer: activeDrawer, onResize: changeDetail => onActiveDrawerResize(changeDetail), refs: drawerRefs, toolsContent: (
|
|
292
|
+
}, isOpen: true, hideOpenButton: true, toggleRefs: drawerRefs, type: "tools", onLoseFocus: loseDrawersFocus, activeDrawer: activeDrawer, onResize: changeDetail => onActiveDrawerResize(changeDetail), refs: drawerRefs, toolsContent: (_h = drawers === null || drawers === void 0 ? void 0 : drawers.find(drawer => drawer.id === TOOLS_DRAWER_ID)) === null || _h === void 0 ? void 0 : _h.content }, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.content)) : (!toolsHide && (React.createElement(Drawer, { contentClassName: testutilStyles.tools, toggleClassName: testutilStyles['tools-toggle'], closeClassName: testutilStyles['tools-close'], ariaLabels: togglesConfig.tools.getLabels(ariaLabels), width: toolsWidth, bottomOffset: placement.insetBlockEnd, topOffset: placement.insetBlockStart, isMobile: isMobile, onToggle: onToolsToggle, isOpen: toolsOpen, toggleRefs: toolsRefs, type: "tools", onLoseFocus: loseToolsFocus }, tools))),
|
|
292
293
|
hasDrawers && drawers.length > 0 && (React.createElement(DrawerTriggersBar, { drawerRefs: drawerRefs, bottomOffset: placement.insetBlockEnd, topOffset: placement.insetBlockStart, isMobile: isMobile, drawers: drawers, activeDrawerId: activeDrawerId, onDrawerChange: newDrawerId => {
|
|
293
294
|
if (activeDrawerId !== newDrawerId) {
|
|
294
295
|
focusToolsButtons();
|