@cloudscape-design/components-themeable 3.0.270 → 3.0.272
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/button/styles.scss +2 -8
- 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/expandable-section/styles.scss +16 -2
- package/lib/internal/scss/file-upload/file-input/styles.scss +8 -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 -4
- package/lib/internal/template/THIRD-PARTY-LICENSES +31 -0
- package/lib/internal/template/autosuggest/options-controller.d.ts +1 -1
- package/lib/internal/template/autosuggest/options-controller.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/options-controller.js +22 -23
- package/lib/internal/template/autosuggest/options-controller.js.map +1 -1
- package/lib/internal/template/autosuggest/options-list.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/options-list.js +1 -2
- package/lib/internal/template/autosuggest/options-list.js.map +1 -1
- package/lib/internal/template/button/internal.d.ts +0 -1
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +1 -3
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/button/styles.css.js +18 -20
- package/lib/internal/template/button/styles.scoped.css +136 -298
- package/lib/internal/template/button/styles.selectors.js +18 -20
- 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/expandable-section/expandable-section-header.js +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.js.map +1 -1
- package/lib/internal/template/expandable-section/styles.css.js +24 -23
- package/lib/internal/template/expandable-section/styles.scoped.css +66 -44
- package/lib/internal/template/expandable-section/styles.selectors.js +24 -23
- package/lib/internal/template/file-upload/file-input/index.d.ts.map +1 -1
- package/lib/internal/template/file-upload/file-input/index.js +2 -1
- package/lib/internal/template/file-upload/file-input/index.js.map +1 -1
- package/lib/internal/template/file-upload/file-input/styles.css.js +4 -3
- package/lib/internal/template/file-upload/file-input/styles.scoped.css +107 -4
- package/lib/internal/template/file-upload/file-input/styles.selectors.js +4 -3
- package/lib/internal/template/internal/components/autosuggest-input/index.js +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
- package/lib/internal/template/internal/components/options-list/utils/test-indexes.d.ts +1 -1
- package/lib/internal/template/internal/components/options-list/utils/test-indexes.d.ts.map +1 -1
- package/lib/internal/template/internal/components/options-list/utils/test-indexes.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 -23
- package/lib/internal/template/table/body-cell/styles.scoped.css +59 -59
- package/lib/internal/template/table/body-cell/styles.selectors.js +23 -23
- 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 +7 -5
- 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 +3 -6
- package/lib/internal/template/table/thead.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/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/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/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/package.json +1 -1
|
@@ -38,13 +38,7 @@
|
|
|
38
38
|
text-decoration: none;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
@include focus-visible.when-visible {
|
|
43
|
-
@include styles.focus-highlight(awsui.$space-button-focus-outline-gutter);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// stylelint-disable-next-line selector-combinator-disallowed-list
|
|
47
|
-
body[data-awsui-focus-visible='true'] &.force-focus-outline {
|
|
41
|
+
@include focus-visible.when-visible {
|
|
48
42
|
@include styles.focus-highlight(awsui.$space-button-focus-outline-gutter);
|
|
49
43
|
}
|
|
50
44
|
&.variant-icon,
|
|
@@ -59,7 +53,7 @@
|
|
|
59
53
|
);
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
|
-
&.variant-inline-icon
|
|
56
|
+
&.variant-inline-icon {
|
|
63
57
|
@include focus-visible.when-visible {
|
|
64
58
|
@include styles.focus-highlight(awsui.$space-button-inline-icon-focus-outline-gutter);
|
|
65
59
|
}
|
|
@@ -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: flex-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
|
+
}
|
|
@@ -99,6 +99,16 @@
|
|
|
99
99
|
padding: 0;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
&-button {
|
|
103
|
+
box-sizing: border-box;
|
|
104
|
+
display: flex;
|
|
105
|
+
|
|
106
|
+
// Header buttons for non-container variants show the focus ring directly
|
|
107
|
+
@include focus-visible.when-visible {
|
|
108
|
+
@include styles.focus-highlight(0px);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
102
112
|
&-container {
|
|
103
113
|
width: 100%;
|
|
104
114
|
// The icon-container style is kept for variant='container' and header
|
|
@@ -106,17 +116,21 @@
|
|
|
106
116
|
margin-top: awsui.$space-expandable-section-icon-offset-top;
|
|
107
117
|
}
|
|
108
118
|
|
|
109
|
-
|
|
119
|
+
// stylelint-disable-next-line selector-combinator-disallowed-list
|
|
120
|
+
body[data-awsui-focus-visible='true'] &:focus-within {
|
|
110
121
|
outline: none;
|
|
111
122
|
text-decoration: none;
|
|
112
123
|
padding: container.$header-focus-visible-padding;
|
|
113
124
|
|
|
114
125
|
@include styles.form-focus-element(awsui.$border-radius-control-default-focus-ring);
|
|
115
126
|
}
|
|
127
|
+
|
|
128
|
+
// Header buttons that sit in a container should not show focus because the parent container has a focus ring already
|
|
116
129
|
&-button {
|
|
117
130
|
box-sizing: border-box;
|
|
118
131
|
display: flex;
|
|
119
|
-
|
|
132
|
+
|
|
133
|
+
@include focus-visible.when-visible {
|
|
120
134
|
outline: none;
|
|
121
135
|
text-decoration: none;
|
|
122
136
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
@use '../../internal/styles/tokens' as awsui;
|
|
7
|
+
@use '../../internal/styles' as styles;
|
|
7
8
|
|
|
8
9
|
.upload-button,
|
|
9
10
|
.upload-input {
|
|
@@ -18,3 +19,10 @@
|
|
|
18
19
|
position: absolute;
|
|
19
20
|
clip: rect(0, 0, 0, 0);
|
|
20
21
|
}
|
|
22
|
+
|
|
23
|
+
.upload-button {
|
|
24
|
+
// stylelint-disable-next-line selector-combinator-disallowed-list
|
|
25
|
+
body[data-awsui-focus-visible='true'] &.force-focus-outline {
|
|
26
|
+
@include styles.focus-highlight(awsui.$space-button-focus-outline-gutter);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -256,12 +256,12 @@ $border-placeholder: awsui.$border-item-width solid transparent;
|
|
|
256
256
|
}
|
|
257
257
|
&-editable.is-visual-refresh:not(.body-cell-edit-active):hover {
|
|
258
258
|
&:first-child {
|
|
259
|
-
border-top-left-radius: awsui.$border-radius-
|
|
260
|
-
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;
|
|
261
261
|
}
|
|
262
262
|
&:last-child {
|
|
263
|
-
border-top-right-radius: awsui.$border-radius-
|
|
264
|
-
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;
|
|
265
265
|
}
|
|
266
266
|
&.body-cell-first-row > .body-cell-editor {
|
|
267
267
|
padding-top: awsui.$border-divider-list-width;
|
|
@@ -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.
|
|
@@ -12,6 +12,7 @@ export interface UseAutosuggestItemsProps {
|
|
|
12
12
|
export interface AutosuggestItemsState extends HighlightedOptionState<AutosuggestItem> {
|
|
13
13
|
items: readonly AutosuggestItem[];
|
|
14
14
|
showAll: boolean;
|
|
15
|
+
getItemGroup: (item: AutosuggestItem) => undefined | AutosuggestProps.OptionGroup;
|
|
15
16
|
}
|
|
16
17
|
export interface AutosuggestItemsHandlers extends HighlightedOptionHandlers<AutosuggestItem> {
|
|
17
18
|
setShowAll(value: boolean): void;
|
|
@@ -19,7 +20,6 @@ export interface AutosuggestItemsHandlers extends HighlightedOptionHandlers<Auto
|
|
|
19
20
|
highlightVisibleOptionWithMouse(index: number): void;
|
|
20
21
|
selectVisibleOptionWithMouse(index: number): void;
|
|
21
22
|
}
|
|
22
|
-
export declare const getParentGroup: (item: AutosuggestItem) => AutosuggestItem | undefined;
|
|
23
23
|
export declare const useAutosuggestItems: ({ options, filterValue, filterText, filteringType, hideEnteredTextLabel, onSelectItem, }: UseAutosuggestItemsProps) => [AutosuggestItemsState, AutosuggestItemsHandlers];
|
|
24
24
|
export {};
|
|
25
25
|
//# sourceMappingURL=options-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-controller.d.ts","sourceRoot":"lib/default/","sources":["autosuggest/options-controller.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EAEvB,MAAM,gEAAgE,CAAC;AAExE,KAAK,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAExC,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAC9C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB,CAAC,eAAe,CAAC;IACpF,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"options-controller.d.ts","sourceRoot":"lib/default/","sources":["autosuggest/options-controller.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EAEvB,MAAM,gEAAgE,CAAC;AAExE,KAAK,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAExC,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAC9C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB,CAAC,eAAe,CAAC;IACpF,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,SAAS,GAAG,gBAAgB,CAAC,WAAW,CAAC;CACnF;AAED,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB,CAAC,eAAe,CAAC;IAC1F,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,mCAAmC,IAAI,OAAO,CAAC;IAC/C,+BAA+B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACnD;AAQD,eAAO,MAAM,mBAAmB,6FAO7B,wBAAwB,KAAG,CAAC,qBAAqB,EAAE,wBAAwB,CAiD7E,CAAC"}
|
|
@@ -8,20 +8,18 @@ import { useHighlightedOption, } from '../internal/components/options-list/utils
|
|
|
8
8
|
const isHighlightable = (option) => {
|
|
9
9
|
return !!option && option.type !== 'parent';
|
|
10
10
|
};
|
|
11
|
-
const parentMap = new WeakMap();
|
|
12
|
-
export const getParentGroup = (item) => parentMap.get(item);
|
|
13
11
|
const isInteractive = (option) => !!option && !option.disabled && option.type !== 'parent';
|
|
14
12
|
export const useAutosuggestItems = ({ options, filterValue, filterText, filteringType, hideEnteredTextLabel, onSelectItem, }) => {
|
|
15
13
|
const [showAll, setShowAll] = useState(false);
|
|
16
|
-
const items = useMemo(() => createItems(options), [options]);
|
|
14
|
+
const { items, getItemGroup } = useMemo(() => createItems(options), [options]);
|
|
17
15
|
const filteredItems = useMemo(() => {
|
|
18
16
|
const filteredItems = filteringType === 'auto' && !showAll ? filterOptions(items, filterText) : [...items];
|
|
19
17
|
if (filterValue && !hideEnteredTextLabel) {
|
|
20
18
|
filteredItems.unshift({ value: filterValue, type: 'use-entered', option: { value: filterValue } });
|
|
21
19
|
}
|
|
22
|
-
generateTestIndexes(filteredItems,
|
|
20
|
+
generateTestIndexes(filteredItems, getItemGroup);
|
|
23
21
|
return filteredItems;
|
|
24
|
-
}, [items, filterValue, filterText, filteringType, showAll, hideEnteredTextLabel]);
|
|
22
|
+
}, [items, getItemGroup, filterValue, filterText, filteringType, showAll, hideEnteredTextLabel]);
|
|
25
23
|
const [highlightedOptionState, highlightedOptionHandlers] = useHighlightedOption({
|
|
26
24
|
options: filteredItems,
|
|
27
25
|
isHighlightable,
|
|
@@ -44,7 +42,7 @@ export const useAutosuggestItems = ({ options, filterValue, filterText, filterin
|
|
|
44
42
|
}
|
|
45
43
|
};
|
|
46
44
|
return [
|
|
47
|
-
Object.assign(Object.assign({}, highlightedOptionState), { items: filteredItems, showAll }),
|
|
45
|
+
Object.assign(Object.assign({}, highlightedOptionState), { items: filteredItems, showAll, getItemGroup }),
|
|
48
46
|
Object.assign(Object.assign({}, highlightedOptionHandlers), { setShowAll,
|
|
49
47
|
selectHighlightedOptionWithKeyboard,
|
|
50
48
|
highlightVisibleOptionWithMouse,
|
|
@@ -53,6 +51,8 @@ export const useAutosuggestItems = ({ options, filterValue, filterText, filterin
|
|
|
53
51
|
};
|
|
54
52
|
function createItems(options) {
|
|
55
53
|
const items = [];
|
|
54
|
+
const itemToGroup = new WeakMap();
|
|
55
|
+
const getItemGroup = (item) => itemToGroup.get(item);
|
|
56
56
|
for (const option of options) {
|
|
57
57
|
if (isGroup(option)) {
|
|
58
58
|
for (const item of flattenGroup(option)) {
|
|
@@ -63,25 +63,24 @@ function createItems(options) {
|
|
|
63
63
|
items.push(Object.assign(Object.assign({}, option), { option }));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
function flattenGroup(group) {
|
|
67
|
+
const { options } = group, rest = __rest(group, ["options"]);
|
|
68
|
+
let hasOnlyDisabledChildren = true;
|
|
69
|
+
const items = [Object.assign(Object.assign({}, rest), { type: 'parent', option: group })];
|
|
70
|
+
for (const option of options) {
|
|
71
|
+
if (!option.disabled) {
|
|
72
|
+
hasOnlyDisabledChildren = false;
|
|
73
|
+
}
|
|
74
|
+
const childOption = Object.assign(Object.assign({}, option), { type: 'child', disabled: option.disabled || rest.disabled, option });
|
|
75
|
+
items.push(childOption);
|
|
76
|
+
itemToGroup.set(childOption, group);
|
|
77
|
+
}
|
|
78
|
+
items[0].disabled = items[0].disabled || hasOnlyDisabledChildren;
|
|
79
|
+
return items;
|
|
80
|
+
}
|
|
81
|
+
return { items, getItemGroup };
|
|
67
82
|
}
|
|
68
83
|
function isGroup(optionOrGroup) {
|
|
69
84
|
return 'options' in optionOrGroup;
|
|
70
85
|
}
|
|
71
|
-
function flattenGroup(group) {
|
|
72
|
-
const { options } = group, rest = __rest(group, ["options"]);
|
|
73
|
-
let hasOnlyDisabledChildren = true;
|
|
74
|
-
const items = [Object.assign(Object.assign({}, rest), { type: 'parent', option: group })];
|
|
75
|
-
for (const option of options) {
|
|
76
|
-
if (!option.disabled) {
|
|
77
|
-
hasOnlyDisabledChildren = false;
|
|
78
|
-
}
|
|
79
|
-
const childOption = Object.assign(Object.assign({}, option), { type: 'child', disabled: option.disabled || rest.disabled, option });
|
|
80
|
-
items.push(childOption);
|
|
81
|
-
// TODO: Refactor parentMap and remove this side effect
|
|
82
|
-
parentMap.set(childOption, Object.assign(Object.assign({}, group), { option: group }));
|
|
83
|
-
}
|
|
84
|
-
items[0].disabled = items[0].disabled || hasOnlyDisabledChildren;
|
|
85
|
-
return items;
|
|
86
|
-
}
|
|
87
86
|
//# sourceMappingURL=options-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-controller.js","sourceRoot":"lib/default/","sources":["autosuggest/options-controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,OAAO,EAGL,oBAAoB,GACrB,MAAM,gEAAgE,CAAC;
|
|
1
|
+
{"version":3,"file":"options-controller.js","sourceRoot":"lib/default/","sources":["autosuggest/options-controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,OAAO,EAGL,oBAAoB,GACrB,MAAM,gEAAgE,CAAC;AA0BxE,MAAM,eAAe,GAAG,CAAC,MAAwB,EAAE,EAAE;IACnD,OAAO,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,MAAwB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAE7G,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,OAAO,EACP,WAAW,EACX,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,YAAY,GACa,EAAqD,EAAE;IAChF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO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AI,OAAO,EAAE;YAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACpB,uBAAuB,GAAG,KAAK,CAAC;aACjC;YAED,MAAM,WAAW,mCACZ,MAAM,KACT,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAC1C,MAAM,GACP,CAAC;YAEF,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAExB,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;SACrC;QAED,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,uBAAuB,CAAC;QAEjE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,OAAO,CAAC,aAAsC;IACrD,OAAO,SAAS,IAAI,aAAa,CAAC;AACpC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useMemo, useState } from 'react';\nimport { filterOptions } from './utils/utils';\nimport { generateTestIndexes } from '../internal/components/options-list/utils/test-indexes';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\nimport {\n HighlightedOptionHandlers,\n HighlightedOptionState,\n useHighlightedOption,\n} from '../internal/components/options-list/utils/use-highlight-option';\n\ntype Options = AutosuggestProps.Options;\n\nexport interface UseAutosuggestItemsProps {\n options: Options;\n filterValue: string;\n filterText: string;\n filteringType: AutosuggestProps.FilteringType;\n hideEnteredTextLabel?: boolean;\n onSelectItem: (option: AutosuggestItem) => void;\n}\n\nexport interface AutosuggestItemsState extends HighlightedOptionState<AutosuggestItem> {\n items: readonly AutosuggestItem[];\n showAll: boolean;\n getItemGroup: (item: AutosuggestItem) => undefined | AutosuggestProps.OptionGroup;\n}\n\nexport interface AutosuggestItemsHandlers extends HighlightedOptionHandlers<AutosuggestItem> {\n setShowAll(value: boolean): void;\n selectHighlightedOptionWithKeyboard(): boolean;\n highlightVisibleOptionWithMouse(index: number): void;\n selectVisibleOptionWithMouse(index: number): void;\n}\n\nconst isHighlightable = (option?: AutosuggestItem) => {\n return !!option && option.type !== 'parent';\n};\n\nconst isInteractive = (option?: AutosuggestItem) => !!option && !option.disabled && option.type !== 'parent';\n\nexport const useAutosuggestItems = ({\n options,\n filterValue,\n filterText,\n filteringType,\n hideEnteredTextLabel,\n onSelectItem,\n}: UseAutosuggestItemsProps): [AutosuggestItemsState, AutosuggestItemsHandlers] => {\n const [showAll, setShowAll] = useState(false);\n\n const { items, getItemGroup } = useMemo(() => createItems(options), [options]);\n\n const filteredItems = useMemo(() => {\n const filteredItems = filteringType === 'auto' && !showAll ? filterOptions(items, filterText) : [...items];\n if (filterValue && !hideEnteredTextLabel) {\n filteredItems.unshift({ value: filterValue, type: 'use-entered', option: { value: filterValue } });\n }\n generateTestIndexes(filteredItems, getItemGroup);\n return filteredItems;\n }, [items, getItemGroup, filterValue, filterText, filteringType, showAll, hideEnteredTextLabel]);\n\n const [highlightedOptionState, highlightedOptionHandlers] = useHighlightedOption({\n options: filteredItems,\n isHighlightable,\n });\n\n const selectHighlightedOptionWithKeyboard = () => {\n if (highlightedOptionState.highlightedOption && isInteractive(highlightedOptionState.highlightedOption)) {\n onSelectItem(highlightedOptionState.highlightedOption);\n return true;\n }\n return false;\n };\n\n const highlightVisibleOptionWithMouse = (index: number) => {\n if (filteredItems[index] && isHighlightable(filteredItems[index])) {\n highlightedOptionHandlers.setHighlightedIndexWithMouse(index);\n }\n };\n\n const selectVisibleOptionWithMouse = (index: number) => {\n if (filteredItems[index] && isInteractive(filteredItems[index])) {\n onSelectItem(filteredItems[index]);\n }\n };\n\n return [\n { ...highlightedOptionState, items: filteredItems, showAll, getItemGroup },\n {\n ...highlightedOptionHandlers,\n setShowAll,\n selectHighlightedOptionWithKeyboard,\n highlightVisibleOptionWithMouse,\n selectVisibleOptionWithMouse,\n },\n ];\n};\n\nfunction createItems(options: Options) {\n const items: AutosuggestItem[] = [];\n const itemToGroup = new WeakMap<AutosuggestItem, AutosuggestProps.OptionGroup>();\n const getItemGroup = (item: AutosuggestItem) => itemToGroup.get(item);\n\n for (const option of options) {\n if (isGroup(option)) {\n for (const item of flattenGroup(option)) {\n items.push(item);\n }\n } else {\n items.push({ ...option, option });\n }\n }\n\n function flattenGroup(group: AutosuggestProps.OptionGroup) {\n const { options, ...rest } = group;\n\n let hasOnlyDisabledChildren = true;\n\n const items: AutosuggestItem[] = [{ ...rest, type: 'parent', option: group }];\n\n for (const option of options) {\n if (!option.disabled) {\n hasOnlyDisabledChildren = false;\n }\n\n const childOption: AutosuggestItem = {\n ...option,\n type: 'child',\n disabled: option.disabled || rest.disabled,\n option,\n };\n\n items.push(childOption);\n\n itemToGroup.set(childOption, group);\n }\n\n items[0].disabled = items[0].disabled || hasOnlyDisabledChildren;\n\n return items;\n }\n\n return { items, getItemGroup };\n}\n\nfunction isGroup(optionOrGroup: AutosuggestProps.Option): optionOrGroup is AutosuggestProps.OptionGroup {\n return 'options' in optionOrGroup;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-list.d.ts","sourceRoot":"lib/default/","sources":["autosuggest/options-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"options-list.d.ts","sourceRoot":"lib/default/","sources":["autosuggest/options-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhD,MAAM,WAAW,2BACf,SAAQ,IAAI,CACV,gBAAgB,EAChB,kBAAkB,GAAG,eAAe,GAAG,mBAAmB,GAAG,2BAA2B,CACzF;IACD,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AASD,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,EACb,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,EACV,eAAe,GAChB,EAAE,2BAA2B,eAiC7B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { getParentGroup } from './options-controller';
|
|
5
4
|
import VirtualList from './virtual-list';
|
|
6
5
|
import PlainList from './plain-list';
|
|
7
6
|
import { useAnnouncement } from '../select/utils/use-announcement';
|
|
@@ -19,7 +18,7 @@ export default function AutosuggestOptionsList({ autosuggestItemsState, autosugg
|
|
|
19
18
|
const announcement = useAnnouncement({
|
|
20
19
|
announceSelected: ((_a = autosuggestItemsState.highlightedOption) === null || _a === void 0 ? void 0 : _a.value) === highlightText,
|
|
21
20
|
highlightedOption: autosuggestItemsState.highlightedOption,
|
|
22
|
-
getParent: option =>
|
|
21
|
+
getParent: option => autosuggestItemsState.getItemGroup(option),
|
|
23
22
|
selectedAriaLabel,
|
|
24
23
|
renderHighlightedAriaLive,
|
|
25
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-list.js","sourceRoot":"lib/default/","sources":["autosuggest/options-list.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"options-list.js","sourceRoot":"lib/default/","sources":["autosuggest/options-list.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAmBnE,MAAM,uBAAuB,GAAG,CAAC,OAAgC,EAAE,EAAE,CAAC,CAAC,SAAiB,EAAE,EAAE;IAC1F,4DAA4D;IAC5D,IAAI,SAAS,GAAG,CAAC,CAAC,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,CAAC;KACpB;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,EACb,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,EACV,eAAe,GACa;;IAC5B,MAAM,aAAa,GAAG,uBAAuB,CAAC,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;IACrG,MAAM,eAAe,GAAG,uBAAuB,CAAC,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;IAE1G,MAAM,aAAa,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IAE9D,MAAM,YAAY,GAAG,eAAe,CAAC;QACnC,gBAAgB,EAAE,CAAA,MAAA,qBAAqB,CAAC,iBAAiB,0CAAE,KAAK,MAAK,aAAa;QAClF,iBAAiB,EAAE,qBAAqB,CAAC,iBAAiB;QAC1D,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,qBAAqB,CAAC,YAAY,CAAC,MAAM,CAAC;QAC/D,iBAAiB;QACjB,yBAAyB;KAC1B,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,aAAa,IACZ,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,qBAAqB,EAAE,qBAAqB,EAC5C,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,EAC5E,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE;YACT,EAAE,EAAE,MAAM;YACV,cAAc,EAAE,SAAS;YACzB,SAAS,EAAE,aAAa;YACxB,WAAW,EAAE,eAAe;YAC5B,eAAe;SAChB,EACD,mBAAmB,EAAE,YAAY,GACjC,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { AutosuggestItemsHandlers, AutosuggestItemsState } from './options-controller';\nimport { AutosuggestProps } from './interfaces';\nimport VirtualList from './virtual-list';\nimport PlainList from './plain-list';\n\nimport { useAnnouncement } from '../select/utils/use-announcement';\n\nexport interface AutosuggestOptionsListProps\n extends Pick<\n AutosuggestProps,\n 'enteredTextLabel' | 'virtualScroll' | 'selectedAriaLabel' | 'renderHighlightedAriaLive'\n > {\n autosuggestItemsState: AutosuggestItemsState;\n autosuggestItemsHandlers: AutosuggestItemsHandlers;\n highlightedOptionId?: string;\n highlightText: string;\n listId: string;\n controlId: string;\n handleLoadMore: () => void;\n hasDropdownStatus?: boolean;\n listBottom?: React.ReactNode;\n ariaDescribedby?: string;\n}\n\nconst createMouseEventHandler = (handler: (index: number) => void) => (itemIndex: number) => {\n // prevent mouse events to avoid losing focus from the input\n if (itemIndex > -1) {\n handler(itemIndex);\n }\n};\n\nexport default function AutosuggestOptionsList({\n autosuggestItemsState,\n autosuggestItemsHandlers,\n highlightedOptionId,\n highlightText,\n listId,\n controlId,\n enteredTextLabel,\n handleLoadMore,\n hasDropdownStatus,\n virtualScroll,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n listBottom,\n ariaDescribedby,\n}: AutosuggestOptionsListProps) {\n const handleMouseUp = createMouseEventHandler(autosuggestItemsHandlers.selectVisibleOptionWithMouse);\n const handleMouseMove = createMouseEventHandler(autosuggestItemsHandlers.highlightVisibleOptionWithMouse);\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const announcement = useAnnouncement({\n announceSelected: autosuggestItemsState.highlightedOption?.value === highlightText,\n highlightedOption: autosuggestItemsState.highlightedOption,\n getParent: option => autosuggestItemsState.getItemGroup(option),\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n return (\n <ListComponent\n listBottom={listBottom}\n handleLoadMore={handleLoadMore}\n autosuggestItemsState={autosuggestItemsState}\n highlightText={highlightText}\n enteredTextLabel={enteredTextLabel}\n highlightedA11yProps={highlightedOptionId ? { id: highlightedOptionId } : {}}\n hasDropdownStatus={hasDropdownStatus}\n menuProps={{\n id: listId,\n ariaLabelledby: controlId,\n onMouseUp: handleMouseUp,\n onMouseMove: handleMouseMove,\n ariaDescribedby,\n }}\n screenReaderContent={announcement}\n />\n );\n}\n"]}
|
|
@@ -6,7 +6,6 @@ export declare const InternalButton: React.ForwardRefExoticComponent<Omit<Button
|
|
|
6
6
|
__nativeAttributes?: Record<string, any> | undefined;
|
|
7
7
|
__iconClass?: string | undefined;
|
|
8
8
|
__activated?: boolean | undefined;
|
|
9
|
-
__forcedFocusState?: "none" | "focused" | undefined;
|
|
10
9
|
} & InternalBaseComponentProps & React.RefAttributes<ButtonProps.Ref>>;
|
|
11
10
|
export default InternalButton;
|
|
12
11
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["button/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["button/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAYlF,eAAO,MAAM,cAAc;cANf,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe;;;;sEAqI3G,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { checkSafeUrl } from '../internal/utils/check-safe-url';
|
|
|
11
11
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
12
12
|
import LiveRegion from '../internal/components/live-region';
|
|
13
13
|
export const InternalButton = React.forwardRef((_a, ref) => {
|
|
14
|
-
var { children, iconName, __iconClass, onClick, onFollow, iconAlign = 'left', iconUrl, iconSvg, iconAlt, variant = 'normal', loading = false, loadingText, disabled = false, wrapText = true, href, target, rel, download, formAction = 'submit', ariaLabel, ariaExpanded,
|
|
14
|
+
var { children, iconName, __iconClass, onClick, onFollow, iconAlign = 'left', iconUrl, iconSvg, iconAlt, variant = 'normal', loading = false, loadingText, disabled = false, wrapText = true, href, target, rel, download, formAction = 'submit', ariaLabel, ariaExpanded, __nativeAttributes, __internalRootRef = null, __activated = false } = _a, props = __rest(_a, ["children", "iconName", "__iconClass", "onClick", "onFollow", "iconAlign", "iconUrl", "iconSvg", "iconAlt", "variant", "loading", "loadingText", "disabled", "wrapText", "href", "target", "rel", "download", "formAction", "ariaLabel", "ariaExpanded", "__nativeAttributes", "__internalRootRef", "__activated"]);
|
|
15
15
|
checkSafeUrl('Button', href);
|
|
16
16
|
const isAnchor = Boolean(href);
|
|
17
17
|
const isNotInteractive = loading || disabled;
|
|
@@ -33,8 +33,6 @@ export const InternalButton = React.forwardRef((_a, ref) => {
|
|
|
33
33
|
[styles['button-no-wrap']]: !wrapText,
|
|
34
34
|
[styles['button-no-text']]: !shouldHaveContent,
|
|
35
35
|
[styles['is-activated']]: __activated,
|
|
36
|
-
[styles['hide-focus-outline']]: __forcedFocusState === 'none',
|
|
37
|
-
[styles['force-focus-outline']]: __forcedFocusState === 'focused',
|
|
38
36
|
});
|
|
39
37
|
const buttonProps = Object.assign(Object.assign(Object.assign({}, props), __nativeAttributes), {
|
|
40
38
|
// https://github.com/microsoft/TypeScript/issues/36659
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAmB,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,UAAU,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,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AAW,IACf,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EACjD,QAAQ,EAAE,QAAQ,mBACH,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,KAErD,aAAa,CACP;QACR,OAAO,IAAI,WAAW,IAAI,oBAAC,UAAU,QAAE,WAAW,CAAc,CAChE,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,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, { useCallback, useRef } from 'react';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport styles from './styles.css.js';\nimport { ButtonIconProps, LeftIcon, RightIcon } from './icon-helper';\nimport { ButtonProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport LiveRegion from '../internal/components/live-region';\n\ntype InternalButtonProps = Omit<ButtonProps, 'variant'> & {\n variant?: ButtonProps['variant'] | 'flashbar-icon' | 'breadcrumb-group' | 'menu-trigger' | 'modal-dismiss';\n __nativeAttributes?: Record<string, any>;\n __iconClass?: string;\n __activated?: boolean;\n} & InternalBaseComponentProps;\n\nexport const InternalButton = React.forwardRef(\n (\n {\n children,\n iconName,\n __iconClass,\n onClick,\n onFollow,\n iconAlign = 'left',\n iconUrl,\n iconSvg,\n iconAlt,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n wrapText = true,\n href,\n target,\n rel,\n download,\n formAction = 'submit',\n ariaLabel,\n ariaExpanded,\n __nativeAttributes,\n __internalRootRef = null,\n __activated = false,\n ...props\n }: InternalButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n checkSafeUrl('Button', href);\n const isAnchor = Boolean(href);\n const isNotInteractive = loading || disabled;\n const shouldHaveContent =\n children && ['icon', 'inline-icon', 'flashbar-icon', 'modal-dismiss'].indexOf(variant) === -1;\n\n const buttonRef = useRef<HTMLElement>(null);\n useForwardFocus(ref, buttonRef);\n\n const handleClick = useCallback(\n (event: React.MouseEvent) => {\n if (isNotInteractive) {\n return event.preventDefault();\n }\n\n if (isAnchor && isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, null, event);\n }\n\n const { altKey, button, ctrlKey, metaKey, shiftKey } = event;\n fireCancelableEvent(onClick, { altKey, button, ctrlKey, metaKey, shiftKey }, event);\n },\n [isAnchor, isNotInteractive, onClick, onFollow]\n );\n\n const buttonClass = clsx(props.className, styles.button, styles[`variant-${variant}`], {\n [styles.disabled]: isNotInteractive,\n [styles['button-no-wrap']]: !wrapText,\n [styles['button-no-text']]: !shouldHaveContent,\n [styles['is-activated']]: __activated,\n });\n\n const buttonProps = {\n ...props,\n ...__nativeAttributes,\n // https://github.com/microsoft/TypeScript/issues/36659\n ref: useMergeRefs(buttonRef as any, __internalRootRef),\n 'aria-label': ariaLabel,\n 'aria-expanded': ariaExpanded,\n className: buttonClass,\n onClick: handleClick,\n } as const;\n const iconProps: ButtonIconProps = {\n loading,\n iconName,\n iconAlign,\n iconUrl,\n iconSvg,\n iconAlt,\n variant,\n iconClass: __iconClass,\n iconSize: variant === 'modal-dismiss' ? 'medium' : 'normal',\n };\n const buttonContent = (\n <>\n <LeftIcon {...iconProps} />\n {shouldHaveContent && <span className={styles.content}>{children}</span>}\n <RightIcon {...iconProps} />\n </>\n );\n\n if (isAnchor) {\n return (\n // https://github.com/yannickcr/eslint-plugin-react/issues/2962\n // eslint-disable-next-line react/jsx-no-target-blank\n <>\n <a\n {...buttonProps}\n href={href}\n target={target}\n // security recommendation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n tabIndex={isNotInteractive ? -1 : undefined}\n aria-disabled={isNotInteractive ? true : undefined}\n download={download}\n >\n {buttonContent}\n </a>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n return (\n <>\n <button\n {...buttonProps}\n type={formAction === 'none' ? 'button' : 'submit'}\n disabled={disabled}\n aria-disabled={loading && !disabled ? true : undefined}\n >\n {buttonContent}\n </button>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n);\n\nexport default InternalButton;\n"]}
|