@cloudscape-design/components-themeable 3.0.269 → 3.0.271
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/test-classes/styles.scss +4 -0
- package/lib/internal/scss/collection-preferences/content-display/sortable-item.scss +80 -0
- package/lib/internal/scss/collection-preferences/content-display/styles.scss +33 -0
- package/lib/internal/scss/collection-preferences/styles.scss +1 -0
- package/lib/internal/scss/collection-preferences/visible-content.scss +1 -0
- package/lib/internal/scss/internal/components/token-list/styles.scss +3 -1
- package/lib/internal/scss/internal/drag-handle/styles.scss +18 -0
- package/lib/internal/scss/internal/handle/styles.scss +31 -0
- package/lib/internal/scss/table/body-cell/styles.scss +4 -159
- package/lib/internal/scss/table/header-cell/styles.scss +160 -0
- package/lib/internal/template/THIRD-PARTY-LICENSES +31 -0
- package/lib/internal/template/app-layout/drawer/index.d.ts +1 -1
- package/lib/internal/template/app-layout/drawer/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/drawer/index.js +3 -3
- package/lib/internal/template/app-layout/drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/drawer/interfaces.d.ts +17 -3
- package/lib/internal/template/app-layout/drawer/interfaces.d.ts.map +1 -1
- package/lib/internal/template/app-layout/drawer/interfaces.js.map +1 -1
- package/lib/internal/template/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/drawer/resizable-drawer.js +6 -4
- package/lib/internal/template/app-layout/drawer/resizable-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/index.js +47 -31
- package/lib/internal/template/app-layout/index.js.map +1 -1
- package/lib/internal/template/app-layout/mobile-toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/mobile-toolbar/index.js +4 -1
- package/lib/internal/template/app-layout/mobile-toolbar/index.js.map +1 -1
- package/lib/internal/template/app-layout/test-classes/styles.css.js +19 -18
- package/lib/internal/template/app-layout/test-classes/styles.scoped.css +22 -18
- package/lib/internal/template/app-layout/test-classes/styles.selectors.js +19 -18
- package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts +1 -0
- package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/drawers.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh/drawers.js.map +1 -1
- package/lib/internal/template/attribute-editor/row.d.ts.map +1 -1
- package/lib/internal/template/attribute-editor/row.js +1 -3
- package/lib/internal/template/attribute-editor/row.js.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/index.d.ts +9 -0
- package/lib/internal/template/collection-preferences/content-display/index.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/index.js +55 -0
- package/lib/internal/template/collection-preferences/content-display/index.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/defaults.d.ts +3 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/defaults.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/defaults.js +9 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/defaults.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/index.d.ts +19 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/index.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/index.js +126 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/index.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/events.d.ts +11 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/events.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/events.js +14 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/events.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/listeners.d.ts +8 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/listeners.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/listeners.js +17 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/listeners.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/scroll.d.ts +30 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/scroll.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/scroll.js +95 -0
- package/lib/internal/template/collection-preferences/content-display/keyboard-sensor/utilities/scroll.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/sortable-item.d.ts +9 -0
- package/lib/internal/template/collection-preferences/content-display/sortable-item.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/sortable-item.js +52 -0
- package/lib/internal/template/collection-preferences/content-display/sortable-item.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/styles.css.js +20 -0
- package/lib/internal/template/collection-preferences/content-display/styles.scoped.css +303 -0
- package/lib/internal/template/collection-preferences/content-display/styles.selectors.js +21 -0
- package/lib/internal/template/collection-preferences/content-display/use-drag-and-drop-reorder.d.ts +14 -0
- package/lib/internal/template/collection-preferences/content-display/use-drag-and-drop-reorder.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/use-drag-and-drop-reorder.js +144 -0
- package/lib/internal/template/collection-preferences/content-display/use-drag-and-drop-reorder.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/use-live-announcements.d.ts +12 -0
- package/lib/internal/template/collection-preferences/content-display/use-live-announcements.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/use-live-announcements.js +40 -0
- package/lib/internal/template/collection-preferences/content-display/use-live-announcements.js.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/utils.d.ts +9 -0
- package/lib/internal/template/collection-preferences/content-display/utils.d.ts.map +1 -0
- package/lib/internal/template/collection-preferences/content-display/utils.js +7 -0
- package/lib/internal/template/collection-preferences/content-display/utils.js.map +1 -0
- package/lib/internal/template/collection-preferences/index.d.ts +1 -1
- package/lib/internal/template/collection-preferences/index.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/index.js +15 -9
- package/lib/internal/template/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.d.ts +47 -1
- package/lib/internal/template/collection-preferences/interfaces.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.js.map +1 -1
- package/lib/internal/template/collection-preferences/styles.css.js +36 -21
- package/lib/internal/template/collection-preferences/styles.scoped.css +326 -22
- package/lib/internal/template/collection-preferences/styles.selectors.js +36 -21
- package/lib/internal/template/collection-preferences/utils.d.ts +1 -1
- package/lib/internal/template/collection-preferences/utils.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/utils.js +20 -9
- package/lib/internal/template/collection-preferences/utils.js.map +1 -1
- package/lib/internal/template/internal/components/token-list/styles.css.js +9 -9
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +22 -21
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +9 -9
- package/lib/internal/template/internal/drag-handle/index.d.ts +9 -0
- package/lib/internal/template/internal/drag-handle/index.d.ts.map +1 -0
- package/lib/internal/template/internal/drag-handle/index.js +13 -0
- package/lib/internal/template/internal/drag-handle/index.js.map +1 -0
- package/lib/internal/template/internal/drag-handle/styles.css.js +6 -0
- package/lib/internal/template/internal/drag-handle/styles.scoped.css +13 -0
- package/lib/internal/template/internal/drag-handle/styles.selectors.js +7 -0
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/handle/index.d.ts +3 -0
- package/lib/internal/template/internal/handle/index.d.ts.map +1 -0
- package/lib/internal/template/internal/handle/index.js +14 -0
- package/lib/internal/template/internal/handle/index.js.map +1 -0
- package/lib/internal/template/internal/handle/styles.css.js +7 -0
- package/lib/internal/template/internal/handle/styles.scoped.css +125 -0
- package/lib/internal/template/internal/handle/styles.selectors.js +8 -0
- package/lib/internal/template/package.json +3 -0
- package/lib/internal/template/table/body-cell/styles.css.js +23 -40
- package/lib/internal/template/table/body-cell/styles.scoped.css +59 -220
- package/lib/internal/template/table/body-cell/styles.selectors.js +23 -40
- package/lib/internal/template/table/header-cell/index.js +1 -1
- package/lib/internal/template/table/header-cell/index.js.map +1 -1
- package/lib/internal/template/table/header-cell/styles.css.js +24 -0
- package/lib/internal/template/table/header-cell/styles.scoped.css +252 -0
- package/lib/internal/template/table/header-cell/styles.selectors.js +25 -0
- package/lib/internal/template/table/interfaces.d.ts +16 -3
- package/lib/internal/template/table/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table/interfaces.js.map +1 -1
- package/lib/internal/template/table/internal.d.ts.map +1 -1
- package/lib/internal/template/table/internal.js +17 -9
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/table/thead.d.ts.map +1 -1
- package/lib/internal/template/table/thead.js +4 -7
- package/lib/internal/template/table/thead.js.map +1 -1
- package/lib/internal/template/table/use-column-widths.js +1 -1
- package/lib/internal/template/table/use-column-widths.js.map +1 -1
- package/lib/internal/template/table/utils.d.ts +5 -0
- package/lib/internal/template/table/utils.d.ts.map +1 -1
- package/lib/internal/template/table/utils.js +23 -0
- package/lib/internal/template/table/utils.js.map +1 -1
- package/lib/internal/template/test-utils/dom/app-layout/index.d.ts +6 -0
- package/lib/internal/template/test-utils/dom/app-layout/index.js +18 -0
- package/lib/internal/template/test-utils/dom/app-layout/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/collection-preferences/content-display-preference.d.ts +37 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/content-display-preference.js +62 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/content-display-preference.js.map +1 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/index.d.ts +2 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/index.js +4 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/table/index.js +10 -9
- package/lib/internal/template/test-utils/dom/table/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/app-layout/index.d.ts +6 -0
- package/lib/internal/template/test-utils/selectors/app-layout/index.js +18 -0
- package/lib/internal/template/test-utils/selectors/app-layout/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/collection-preferences/content-display-preference.d.ts +37 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/content-display-preference.js +62 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/content-display-preference.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.d.ts +2 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.js +4 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/table/index.js +10 -9
- package/lib/internal/template/test-utils/selectors/table/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/lib/internal/template/top-navigation/parts/overflow-menu/menu-item.d.ts.map +1 -1
- package/lib/internal/template/top-navigation/parts/overflow-menu/menu-item.js +5 -4
- package/lib/internal/template/top-navigation/parts/overflow-menu/menu-item.js.map +1 -1
- package/lib/internal/template/top-navigation/parts/utility.js +1 -1
- package/lib/internal/template/top-navigation/parts/utility.js.map +1 -1
- package/package.json +1 -1
- package/lib/internal/template/table/table-wrapper.d.ts +0 -13
- package/lib/internal/template/table/table-wrapper.d.ts.map +0 -1
- package/lib/internal/template/table/table-wrapper.js +0 -15
- package/lib/internal/template/table/table-wrapper.js.map +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@use '../../internal/styles' as styles;
|
|
7
|
+
@use '../../internal/styles/tokens' as awsui;
|
|
8
|
+
|
|
9
|
+
$border-radius: awsui.$border-radius-item;
|
|
10
|
+
|
|
11
|
+
@mixin focus-visible {
|
|
12
|
+
// stylelint-disable-next-line selector-combinator-disallowed-list
|
|
13
|
+
body[data-awsui-focus-visible='true'] & {
|
|
14
|
+
@content;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@mixin animated {
|
|
19
|
+
@include styles.with-motion {
|
|
20
|
+
transition: transform awsui.$motion-duration-transition-quick awsui.$motion-easing-transition-quick;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.sortable-item-toggle {
|
|
25
|
+
/* used in test-utils */
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sortable-item {
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sortable-item-placeholder {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 0;
|
|
35
|
+
bottom: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
background: awsui.$color-drag-placeholder-hover;
|
|
39
|
+
border-radius: $border-radius;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.sortable-item-content {
|
|
43
|
+
border-top: awsui.$border-divider-list-width solid awsui.$color-border-divider-default;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-wrap: nowrap;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
align-items: start;
|
|
48
|
+
padding-top: awsui.$space-xs;
|
|
49
|
+
padding-bottom: awsui.$space-xs;
|
|
50
|
+
padding-right: 0;
|
|
51
|
+
&:not(.draggable) {
|
|
52
|
+
padding-left: awsui.$space-scaled-l;
|
|
53
|
+
}
|
|
54
|
+
&.draggable {
|
|
55
|
+
padding-left: 0;
|
|
56
|
+
padding-right: awsui.$space-scaled-xs;
|
|
57
|
+
background-color: awsui.$color-background-container-content;
|
|
58
|
+
z-index: 1;
|
|
59
|
+
&.active {
|
|
60
|
+
position: relative;
|
|
61
|
+
z-index: 2;
|
|
62
|
+
box-shadow: awsui.$shadow-container-active;
|
|
63
|
+
border-radius: $border-radius;
|
|
64
|
+
}
|
|
65
|
+
&:not(.active).sorting {
|
|
66
|
+
@include animated;
|
|
67
|
+
}
|
|
68
|
+
@include focus-visible {
|
|
69
|
+
&.active {
|
|
70
|
+
@include animated;
|
|
71
|
+
@include styles.focus-highlight(0px);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sortable-item-label {
|
|
78
|
+
padding-right: awsui.$space-l;
|
|
79
|
+
flex-grow: 1;
|
|
80
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@use '../../internal/styles' as styles;
|
|
7
|
+
@use '../../internal/styles/tokens' as awsui;
|
|
8
|
+
|
|
9
|
+
@import 'sortable-item';
|
|
10
|
+
|
|
11
|
+
.content-display,
|
|
12
|
+
.content-display-groups,
|
|
13
|
+
.content-display-group,
|
|
14
|
+
.content-display-option {
|
|
15
|
+
/* used in test-utils */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.content-display-title {
|
|
19
|
+
@include styles.font-label;
|
|
20
|
+
color: awsui.$color-text-form-label;
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.content-display-description {
|
|
25
|
+
@include styles.form-control-description;
|
|
26
|
+
margin-top: awsui.$space-scaled-xxxs;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.content-display-option-list {
|
|
30
|
+
position: relative;
|
|
31
|
+
list-style: none;
|
|
32
|
+
padding: 0;
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.handle {
|
|
7
|
+
cursor: grab;
|
|
8
|
+
// Prevent the browser from scrolling on touch devices when the touch event comes from the drag handle,
|
|
9
|
+
// because this would otherwise interfere with actually dragging the handle.
|
|
10
|
+
// The `touch-action` CSS property is not supported in desktop Safari but it is in mobile Safari
|
|
11
|
+
// (and all our supported mobile browsers, in all the supported versions), which is where it actually matters.
|
|
12
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
13
|
+
touch-action: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.handle:active {
|
|
17
|
+
cursor: grabbing;
|
|
18
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@use '../../internal/styles' as styles;
|
|
7
|
+
@use '../../internal/hooks/focus-visible' as focus-visible;
|
|
8
|
+
@use '../../internal/styles/tokens' as awsui;
|
|
9
|
+
|
|
10
|
+
.handle {
|
|
11
|
+
appearance: none;
|
|
12
|
+
background: transparent;
|
|
13
|
+
border: none;
|
|
14
|
+
padding: 0 awsui.$space-scaled-xxxs;
|
|
15
|
+
margin: 0 awsui.$space-scaled-xxs;
|
|
16
|
+
|
|
17
|
+
color: awsui.$color-text-interactive-default;
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
color: awsui.$color-text-interactive-hover;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@include focus-visible.when-visible {
|
|
24
|
+
&:not(.hide-focus) {
|
|
25
|
+
@include styles.focus-highlight(0px);
|
|
26
|
+
}
|
|
27
|
+
&.hide-focus {
|
|
28
|
+
outline: none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
@use '../../internal/styles' as styles;
|
|
7
7
|
@use '../../internal/styles/tokens' as awsui;
|
|
8
|
-
@use '../../internal/hooks/focus-visible' as focus-visible;
|
|
9
8
|
|
|
10
9
|
$cell-vertical-padding: awsui.$space-scaled-xs;
|
|
11
10
|
// Calculate padding to prevent a shift in content after selection due to the difference
|
|
@@ -257,169 +256,15 @@ $border-placeholder: awsui.$border-item-width solid transparent;
|
|
|
257
256
|
}
|
|
258
257
|
&-editable.is-visual-refresh:not(.body-cell-edit-active):hover {
|
|
259
258
|
&:first-child {
|
|
260
|
-
border-top-left-radius: awsui.$border-radius-
|
|
261
|
-
border-bottom-left-radius: awsui.$border-radius-
|
|
259
|
+
border-top-left-radius: awsui.$border-radius-item;
|
|
260
|
+
border-bottom-left-radius: awsui.$border-radius-item;
|
|
262
261
|
}
|
|
263
262
|
&:last-child {
|
|
264
|
-
border-top-right-radius: awsui.$border-radius-
|
|
265
|
-
border-bottom-right-radius: awsui.$border-radius-
|
|
263
|
+
border-top-right-radius: awsui.$border-radius-item;
|
|
264
|
+
border-bottom-right-radius: awsui.$border-radius-item;
|
|
266
265
|
}
|
|
267
266
|
&.body-cell-first-row > .body-cell-editor {
|
|
268
267
|
padding-top: awsui.$border-divider-list-width;
|
|
269
268
|
}
|
|
270
269
|
}
|
|
271
270
|
}
|
|
272
|
-
|
|
273
|
-
// Header cell styles
|
|
274
|
-
|
|
275
|
-
.header-cell {
|
|
276
|
-
position: relative;
|
|
277
|
-
text-align: left;
|
|
278
|
-
box-sizing: border-box;
|
|
279
|
-
border-bottom: awsui.$border-divider-section-width solid awsui.$color-border-divider-default;
|
|
280
|
-
background: awsui.$color-background-table-header;
|
|
281
|
-
color: awsui.$color-text-column-header;
|
|
282
|
-
font-weight: awsui.$font-heading-s-weight;
|
|
283
|
-
@include styles.font-smoothing;
|
|
284
|
-
padding: awsui.$space-scaled-xxs awsui.$space-scaled-xs;
|
|
285
|
-
&-sticky {
|
|
286
|
-
border-bottom: awsui.$border-table-sticky-width solid awsui.$color-border-divider-default;
|
|
287
|
-
}
|
|
288
|
-
&-stuck:not(.header-cell-variant-full-page) {
|
|
289
|
-
border-bottom-color: transparent;
|
|
290
|
-
}
|
|
291
|
-
&-variant-full-page.header-cell-hidden {
|
|
292
|
-
border-bottom-color: transparent;
|
|
293
|
-
}
|
|
294
|
-
&:last-child,
|
|
295
|
-
&.header-cell-sortable {
|
|
296
|
-
padding-right: awsui.$space-xs;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
&:not(:last-child):before {
|
|
300
|
-
$gap: calc(2 * #{awsui.$space-xs} + #{awsui.$space-xxxs});
|
|
301
|
-
|
|
302
|
-
content: '';
|
|
303
|
-
position: absolute;
|
|
304
|
-
right: 0;
|
|
305
|
-
bottom: 0;
|
|
306
|
-
top: 0;
|
|
307
|
-
min-height: awsui.$font-heading-xs-line-height;
|
|
308
|
-
max-height: calc(100% - #{$gap});
|
|
309
|
-
margin: auto;
|
|
310
|
-
border-left: awsui.$border-divider-section-width solid awsui.$color-border-divider-default;
|
|
311
|
-
box-sizing: border-box;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
&-resizable:not(:last-child):before {
|
|
315
|
-
border-left-color: awsui.$color-border-divider-interactive-default;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.sorting-icon {
|
|
320
|
-
position: absolute;
|
|
321
|
-
top: 50%;
|
|
322
|
-
transform: translateY(-50%);
|
|
323
|
-
right: awsui.$space-xxs;
|
|
324
|
-
color: awsui.$color-text-column-sorting-icon;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.edit-icon {
|
|
328
|
-
margin-left: awsui.$space-xxs;
|
|
329
|
-
margin-top: awsui.$space-scaled-xxs;
|
|
330
|
-
color: inherit;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.header-cell-content {
|
|
334
|
-
position: relative;
|
|
335
|
-
|
|
336
|
-
padding: awsui.$space-scaled-xxs awsui.$space-s;
|
|
337
|
-
.header-cell-sortable > & {
|
|
338
|
-
padding-right: calc(#{awsui.$space-xl} + #{awsui.$space-xxs});
|
|
339
|
-
}
|
|
340
|
-
&:focus {
|
|
341
|
-
outline: none;
|
|
342
|
-
text-decoration: none;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
@include focus-visible.when-visible {
|
|
346
|
-
@include styles.focus-highlight(awsui.$space-table-header-focus-outline-gutter);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// stylelint-disable-next-line selector-combinator-disallowed-list
|
|
350
|
-
body[data-awsui-focus-visible='true'] &.header-cell-fake-focus {
|
|
351
|
-
@include styles.focus-highlight(awsui.$space-table-header-focus-outline-gutter);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
.header-cell-disabled.header-cell-sorted > & {
|
|
355
|
-
& > .sorting-icon {
|
|
356
|
-
color: awsui.$color-text-interactive-disabled;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
.header-cell-sortable:not(.header-cell-disabled) {
|
|
362
|
-
& > .header-cell-content {
|
|
363
|
-
cursor: pointer;
|
|
364
|
-
}
|
|
365
|
-
& > .header-cell-content:hover,
|
|
366
|
-
&.header-cell-sorted > .header-cell-content {
|
|
367
|
-
color: awsui.$color-text-interactive-active;
|
|
368
|
-
& > .sorting-icon {
|
|
369
|
-
color: awsui.$color-text-interactive-active;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
.header-cell-text {
|
|
375
|
-
line-height: awsui.$font-heading-xs-line-height;
|
|
376
|
-
|
|
377
|
-
padding-top: calc(#{awsui.$space-xxxs} / 2);
|
|
378
|
-
padding-bottom: calc(#{awsui.$space-xxxs} / 2);
|
|
379
|
-
|
|
380
|
-
&:not(.header-cell-text-wrap) {
|
|
381
|
-
white-space: nowrap;
|
|
382
|
-
overflow: hidden;
|
|
383
|
-
text-overflow: ellipsis;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
.header-cell-ascending,
|
|
388
|
-
.header-cell-descending {
|
|
389
|
-
/* used in test-utils */
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/*
|
|
393
|
-
In Visual Refresh the first cell in the header should align
|
|
394
|
-
with the left edge of the table as closely as possible. If the
|
|
395
|
-
last header cell is sortable the sort icon should align with the
|
|
396
|
-
settings icon in the pagination slot.
|
|
397
|
-
*/
|
|
398
|
-
.header-cell:not(.is-visual-refresh) {
|
|
399
|
-
&:first-child {
|
|
400
|
-
padding-left: awsui.$space-xs;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.header-cell.is-visual-refresh {
|
|
405
|
-
&:first-child:not(.has-striped-rows) {
|
|
406
|
-
padding-left: awsui.$space-xxxs;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/*
|
|
410
|
-
Striped rows requires additional left padding because the
|
|
411
|
-
shaded background makes the child content appear too close
|
|
412
|
-
to the table edge.
|
|
413
|
-
*/
|
|
414
|
-
&:first-child.has-striped-rows {
|
|
415
|
-
padding-left: awsui.$space-xxs;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
&:first-child > .header-cell-content {
|
|
419
|
-
padding-left: 0;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
&:last-child.header-cell-sortable {
|
|
423
|
-
padding-right: awsui.$space-xxxs;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@use '../../internal/hooks/focus-visible' as focus-visible;
|
|
7
|
+
@use '../../internal/styles/tokens' as awsui;
|
|
8
|
+
@use '../../internal/styles' as styles;
|
|
9
|
+
|
|
10
|
+
.header-cell {
|
|
11
|
+
position: relative;
|
|
12
|
+
text-align: left;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
border-bottom: awsui.$border-divider-section-width solid awsui.$color-border-divider-default;
|
|
15
|
+
background: awsui.$color-background-table-header;
|
|
16
|
+
color: awsui.$color-text-column-header;
|
|
17
|
+
font-weight: awsui.$font-heading-s-weight;
|
|
18
|
+
@include styles.font-smoothing;
|
|
19
|
+
padding: awsui.$space-scaled-xxs awsui.$space-scaled-xs;
|
|
20
|
+
&-sticky {
|
|
21
|
+
border-bottom: awsui.$border-table-sticky-width solid awsui.$color-border-divider-default;
|
|
22
|
+
}
|
|
23
|
+
&-stuck:not(.header-cell-variant-full-page) {
|
|
24
|
+
border-bottom-color: transparent;
|
|
25
|
+
}
|
|
26
|
+
&-variant-full-page.header-cell-hidden {
|
|
27
|
+
border-bottom-color: transparent;
|
|
28
|
+
}
|
|
29
|
+
&:last-child,
|
|
30
|
+
&.header-cell-sortable {
|
|
31
|
+
padding-right: awsui.$space-xs;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:not(:last-child):before {
|
|
35
|
+
$gap: calc(2 * #{awsui.$space-xs} + #{awsui.$space-xxxs});
|
|
36
|
+
|
|
37
|
+
content: '';
|
|
38
|
+
position: absolute;
|
|
39
|
+
right: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
top: 0;
|
|
42
|
+
min-height: awsui.$font-heading-xs-line-height;
|
|
43
|
+
max-height: calc(100% - #{$gap});
|
|
44
|
+
margin: auto;
|
|
45
|
+
border-left: awsui.$border-divider-section-width solid awsui.$color-border-divider-default;
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&-resizable:not(:last-child):before {
|
|
50
|
+
border-left-color: awsui.$color-border-divider-interactive-default;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.sorting-icon {
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 50%;
|
|
57
|
+
transform: translateY(-50%);
|
|
58
|
+
right: awsui.$space-xxs;
|
|
59
|
+
color: awsui.$color-text-column-sorting-icon;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.edit-icon {
|
|
63
|
+
margin-left: awsui.$space-xxs;
|
|
64
|
+
margin-top: awsui.$space-scaled-xxs;
|
|
65
|
+
color: inherit;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.header-cell-content {
|
|
69
|
+
position: relative;
|
|
70
|
+
|
|
71
|
+
padding: awsui.$space-scaled-xxs awsui.$space-s;
|
|
72
|
+
.header-cell-sortable > & {
|
|
73
|
+
padding-right: calc(#{awsui.$space-xl} + #{awsui.$space-xxs});
|
|
74
|
+
}
|
|
75
|
+
&:focus {
|
|
76
|
+
outline: none;
|
|
77
|
+
text-decoration: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@include focus-visible.when-visible {
|
|
81
|
+
@include styles.focus-highlight(awsui.$space-table-header-focus-outline-gutter);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// stylelint-disable-next-line selector-combinator-disallowed-list
|
|
85
|
+
body[data-awsui-focus-visible='true'] &.header-cell-fake-focus {
|
|
86
|
+
@include styles.focus-highlight(awsui.$space-table-header-focus-outline-gutter);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.header-cell-disabled.header-cell-sorted > & {
|
|
90
|
+
& > .sorting-icon {
|
|
91
|
+
color: awsui.$color-text-interactive-disabled;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.header-cell-sortable:not(.header-cell-disabled) {
|
|
97
|
+
& > .header-cell-content {
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
& > .header-cell-content:hover,
|
|
101
|
+
&.header-cell-sorted > .header-cell-content {
|
|
102
|
+
color: awsui.$color-text-interactive-active;
|
|
103
|
+
& > .sorting-icon {
|
|
104
|
+
color: awsui.$color-text-interactive-active;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.header-cell-text {
|
|
110
|
+
line-height: awsui.$font-heading-xs-line-height;
|
|
111
|
+
|
|
112
|
+
padding-top: calc(#{awsui.$space-xxxs} / 2);
|
|
113
|
+
padding-bottom: calc(#{awsui.$space-xxxs} / 2);
|
|
114
|
+
|
|
115
|
+
&:not(.header-cell-text-wrap) {
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.header-cell-ascending,
|
|
123
|
+
.header-cell-descending {
|
|
124
|
+
/* used in test-utils */
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
In Visual Refresh the first cell in the header should align
|
|
129
|
+
with the left edge of the table as closely as possible. If the
|
|
130
|
+
last header cell is sortable the sort icon should align with the
|
|
131
|
+
settings icon in the pagination slot.
|
|
132
|
+
*/
|
|
133
|
+
.header-cell:not(.is-visual-refresh) {
|
|
134
|
+
&:first-child {
|
|
135
|
+
padding-left: awsui.$space-xs;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.header-cell.is-visual-refresh {
|
|
140
|
+
&:first-child:not(.has-striped-rows) {
|
|
141
|
+
padding-left: awsui.$space-xxxs;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/*
|
|
145
|
+
Striped rows requires additional left padding because the
|
|
146
|
+
shaded background makes the child content appear too close
|
|
147
|
+
to the table edge.
|
|
148
|
+
*/
|
|
149
|
+
&:first-child.has-striped-rows {
|
|
150
|
+
padding-left: awsui.$space-xxs;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&:first-child > .header-cell-content {
|
|
154
|
+
padding-left: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&:last-child.header-cell-sortable {
|
|
158
|
+
padding-right: awsui.$space-xxxs;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -246,3 +246,34 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
246
246
|
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
247
247
|
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
248
248
|
THIS SOFTWARE.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
Name: dnd-kit/core
|
|
253
|
+
Version: 6.0.8
|
|
254
|
+
License: MIT
|
|
255
|
+
Private: false
|
|
256
|
+
Description: A lightweight React library for building performant and accessible drag and drop experiences.
|
|
257
|
+
Repository: git+https://github.com/clauderic/dnd-kit.git
|
|
258
|
+
|
|
259
|
+
MIT License
|
|
260
|
+
|
|
261
|
+
Copyright (c) 2021, Claudéric Demers
|
|
262
|
+
|
|
263
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
264
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
265
|
+
in the Software without restriction, including without limitation the rights
|
|
266
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
267
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
268
|
+
furnished to do so, subject to the following conditions:
|
|
269
|
+
|
|
270
|
+
The above copyright notice and this permission notice shall be included in all
|
|
271
|
+
copies or substantial portions of the Software.
|
|
272
|
+
|
|
273
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
274
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
275
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
276
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
277
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
278
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
279
|
+
SOFTWARE.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DesktopDrawerProps, DrawerTriggersBarProps } from './interfaces';
|
|
3
3
|
export declare const Drawer: React.ForwardRefExoticComponent<DesktopDrawerProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
-
export declare function DrawerTriggersBar({ isMobile, topOffset, bottomOffset, drawers, contentClassName, }: DrawerTriggersBarProps): JSX.Element;
|
|
4
|
+
export declare function DrawerTriggersBar({ isMobile, topOffset, bottomOffset, drawers, contentClassName, toggleClassName, }: DrawerTriggersBarProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAoC,MAAM,cAAc,CAAC;AAkB5G,eAAO,MAAM,MAAM,2FAyGlB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAoC,MAAM,cAAc,CAAC;AAkB5G,eAAO,MAAM,MAAM,2FAyGlB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,eAAe,GAChB,EAAE,sBAAsB,eAkCxB"}
|
|
@@ -68,14 +68,14 @@ export const Drawer = React.forwardRef(({ contentClassName, toggleClassName, clo
|
|
|
68
68
|
} }),
|
|
69
69
|
children))));
|
|
70
70
|
});
|
|
71
|
-
export function DrawerTriggersBar({ isMobile, topOffset, bottomOffset, drawers, contentClassName, }) {
|
|
71
|
+
export function DrawerTriggersBar({ isMobile, topOffset, bottomOffset, drawers, contentClassName, toggleClassName, }) {
|
|
72
72
|
var _a;
|
|
73
73
|
return (React.createElement("div", { className: clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {
|
|
74
74
|
[styles['drawer-mobile']]: isMobile,
|
|
75
75
|
}) },
|
|
76
|
-
React.createElement("div", { style: { top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], styles['non-interactive']
|
|
76
|
+
React.createElement("div", { style: { top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], styles['non-interactive']) }, !isMobile && (React.createElement("aside", { "aria-label": drawers === null || drawers === void 0 ? void 0 : drawers.ariaLabel, className: clsx(styles['drawer-triggers'], contentClassName) }, (_a = drawers === null || drawers === void 0 ? void 0 : drawers.items) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
|
|
77
77
|
var _a;
|
|
78
|
-
return (React.createElement(AppLayoutButton, { className: clsx(styles.trigger, styles['trigger-drawer'], drawers.activeDrawerId === item.id && styles.selected), key: `drawer-trigger-${index}`, iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, onClick: () => drawers.onChange({ activeDrawerId: item.id }), ariaExpanded: drawers.activeDrawerId !== undefined }));
|
|
78
|
+
return (React.createElement(AppLayoutButton, { className: clsx(toggleClassName, styles.trigger, styles['trigger-drawer'], drawers.activeDrawerId === item.id && styles.selected), key: `drawer-trigger-${index}`, iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, onClick: () => drawers.onChange({ activeDrawerId: item.id }), ariaExpanded: drawers.activeDrawerId !== undefined }));
|
|
79
79
|
}))))));
|
|
80
80
|
}
|
|
81
81
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,0FAA0F;AAC1F,qFAAqF;AACrF,uFAAuF;AACvF,4EAA4E;AAC5E,wFAAwF;AACxF,0FAA0F;AAC1F,0FAA0F;AAC1F,wBAAwB;AACxB,0FAA0F;AAC1F,4FAA4F;AAC5F,WAAW;AACX,oBAAoB;AACpB,iDAAiD;AACjD,iDAAiD;AACjD,iDAAiD;AACjD,sFAAsF;AACtF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EACE,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,KAAK,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,OAAO,EACP,YAAY,GACO,EACrB,GAA8B,EAC9B,EAAE;IACF,MAAM,oBAAoB,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IAC9D,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAA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E,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAC7B,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EAC5D,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,GAClD,CACH,CAAA;SAAA,CAAC,CACI,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { AppLayoutButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps, DrawerItem, DrawerItemAriaLabels } from './interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n drawersAriaLabels,\n children,\n isOpen,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n drawers,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName, getLabels } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const getDrawersLabels = (labels: DrawerItemAriaLabels = {}) => ({\n drawerMainLabel: labels?.content,\n drawerOpenLabel: labels?.triggerButton,\n drawerCloseLabel: labels?.closeButton,\n });\n const { drawerMainLabel, drawerCloseLabel } = getDrawersLabels(drawersAriaLabels);\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <AppLayoutButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], contentClassName)}\n >\n {!isMobile && regularOpenButton}\n {resizeHandle}\n <TagName aria-label={drawers ? drawerMainLabel : mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={drawers ? drawerCloseLabel : closeLabel}\n onClick={() => {\n onToggle(false);\n drawers?.onChange({ activeDrawerId: undefined });\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\nexport function DrawerTriggersBar({\n isMobile,\n topOffset,\n bottomOffset,\n drawers,\n contentClassName,\n}: DrawerTriggersBarProps) {\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n })}\n >\n <div\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['non-interactive'], contentClassName)}\n >\n {!isMobile && (\n <aside aria-label={drawers?.ariaLabel} className={styles['drawer-triggers']}>\n {drawers?.items?.map((item: DrawerItem, index: number) => (\n <AppLayoutButton\n className={clsx(\n styles.trigger,\n styles['trigger-drawer'],\n drawers.activeDrawerId === item.id && styles.selected\n )}\n key={`drawer-trigger-${index}`}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n onClick={() => drawers.onChange({ activeDrawerId: item.id })}\n ariaExpanded={drawers.activeDrawerId !== undefined}\n />\n ))}\n </aside>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,0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,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,EAC/C,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAEnE,CAAC,QAAQ,IAAI,CACZ,6CAAmB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,IAChG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,GAAG,CAAC,CAAC,IAAgB,EAAE,KAAa,EAAE,EAAE;;YAAC,OAAA,CACxD,oBAAC,eAAe,IACd,SAAS,EAAE,IAAI,CACb,eAAe,EACf,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,gBAAgB,CAAC,EACxB,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,QAAQ,CACtD,EACD,GAAG,EAAE,kBAAkB,KAAK,EAAE,EAC9B,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAC7B,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EAC5D,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,GAClD,CACH,CAAA;SAAA,CAAC,CACI,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { AppLayoutButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps, DrawerItem, DrawerItemAriaLabels } from './interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n drawersAriaLabels,\n children,\n isOpen,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n drawers,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName, getLabels } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const getDrawersLabels = (labels: DrawerItemAriaLabels = {}) => ({\n drawerMainLabel: labels?.content,\n drawerOpenLabel: labels?.triggerButton,\n drawerCloseLabel: labels?.closeButton,\n });\n const { drawerMainLabel, drawerCloseLabel } = getDrawersLabels(drawersAriaLabels);\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <AppLayoutButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], contentClassName)}\n >\n {!isMobile && regularOpenButton}\n {resizeHandle}\n <TagName aria-label={drawers ? drawerMainLabel : mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={drawers ? drawerCloseLabel : closeLabel}\n onClick={() => {\n onToggle(false);\n drawers?.onChange({ activeDrawerId: undefined });\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\nexport function DrawerTriggersBar({\n isMobile,\n topOffset,\n bottomOffset,\n drawers,\n contentClassName,\n toggleClassName,\n}: DrawerTriggersBarProps) {\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n })}\n >\n <div\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['non-interactive'])}\n >\n {!isMobile && (\n <aside aria-label={drawers?.ariaLabel} className={clsx(styles['drawer-triggers'], contentClassName)}>\n {drawers?.items?.map((item: DrawerItem, index: number) => (\n <AppLayoutButton\n className={clsx(\n toggleClassName,\n styles.trigger,\n styles['trigger-drawer'],\n drawers.activeDrawerId === item.id && styles.selected\n )}\n key={`drawer-trigger-${index}`}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n onClick={() => drawers.onChange({ activeDrawerId: item.id })}\n ariaExpanded={drawers.activeDrawerId !== undefined}\n />\n ))}\n </aside>\n )}\n </div>\n </div>\n );\n}\n"]}
|