@cloudscape-design/components-themeable 3.0.166 → 3.0.168

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.
Files changed (144) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/code-editor/resizable-box/styles.scss +37 -0
  3. package/lib/internal/scss/code-editor/styles.scss +1 -29
  4. package/lib/internal/scss/select/parts/styles.scss +9 -0
  5. package/lib/internal/scss/table/body-cell/styles.scss +131 -29
  6. package/lib/internal/scss/table/header-cell/styles.scss +15 -7
  7. package/lib/internal/template/attribute-editor/additional-info.d.ts +2 -1
  8. package/lib/internal/template/attribute-editor/additional-info.d.ts.map +1 -1
  9. package/lib/internal/template/attribute-editor/additional-info.js +4 -2
  10. package/lib/internal/template/attribute-editor/additional-info.js.map +1 -1
  11. package/lib/internal/template/attribute-editor/internal.d.ts.map +1 -1
  12. package/lib/internal/template/attribute-editor/internal.js +5 -2
  13. package/lib/internal/template/attribute-editor/internal.js.map +1 -1
  14. package/lib/internal/template/button/internal.d.ts +1 -0
  15. package/lib/internal/template/button/internal.d.ts.map +1 -1
  16. package/lib/internal/template/button/internal.js +2 -2
  17. package/lib/internal/template/button/internal.js.map +1 -1
  18. package/lib/internal/template/code-editor/index.d.ts.map +1 -1
  19. package/lib/internal/template/code-editor/index.js +5 -8
  20. package/lib/internal/template/code-editor/index.js.map +1 -1
  21. package/lib/internal/template/code-editor/pane.d.ts.map +1 -1
  22. package/lib/internal/template/code-editor/pane.js +4 -4
  23. package/lib/internal/template/code-editor/pane.js.map +1 -1
  24. package/lib/internal/template/code-editor/resizable-box/index.d.ts +9 -0
  25. package/lib/internal/template/code-editor/resizable-box/index.d.ts.map +1 -0
  26. package/lib/internal/template/code-editor/resizable-box/index.js +44 -0
  27. package/lib/internal/template/code-editor/resizable-box/index.js.map +1 -0
  28. package/lib/internal/template/code-editor/resizable-box/styles.css.js +8 -0
  29. package/lib/internal/template/code-editor/resizable-box/styles.scoped.css +62 -0
  30. package/lib/internal/template/code-editor/resizable-box/styles.selectors.js +9 -0
  31. package/lib/internal/template/code-editor/styles.css.js +32 -33
  32. package/lib/internal/template/code-editor/styles.scoped.css +157 -199
  33. package/lib/internal/template/code-editor/styles.selectors.js +32 -33
  34. package/lib/internal/template/form-field/interfaces.d.ts +10 -0
  35. package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
  36. package/lib/internal/template/form-field/interfaces.js.map +1 -1
  37. package/lib/internal/template/form-field/internal.d.ts +1 -1
  38. package/lib/internal/template/form-field/internal.d.ts.map +1 -1
  39. package/lib/internal/template/form-field/internal.js +5 -4
  40. package/lib/internal/template/form-field/internal.js.map +1 -1
  41. package/lib/internal/template/input/internal.d.ts.map +1 -1
  42. package/lib/internal/template/input/internal.js +16 -4
  43. package/lib/internal/template/input/internal.js.map +1 -1
  44. package/lib/internal/template/internal/components/live-region/index.d.ts +2 -1
  45. package/lib/internal/template/internal/components/live-region/index.d.ts.map +1 -1
  46. package/lib/internal/template/internal/components/live-region/index.js +29 -6
  47. package/lib/internal/template/internal/components/live-region/index.js.map +1 -1
  48. package/lib/internal/template/internal/context/form-field-context.d.ts +6 -2
  49. package/lib/internal/template/internal/context/form-field-context.d.ts.map +1 -1
  50. package/lib/internal/template/internal/context/form-field-context.js +7 -1
  51. package/lib/internal/template/internal/context/form-field-context.js.map +1 -1
  52. package/lib/internal/template/internal/environment.js +1 -1
  53. package/lib/internal/template/internal/types.d.ts +9 -0
  54. package/lib/internal/template/internal/types.d.ts.map +1 -1
  55. package/lib/internal/template/internal/types.js +0 -2
  56. package/lib/internal/template/internal/types.js.map +1 -1
  57. package/lib/internal/template/package.json +0 -1
  58. package/lib/internal/template/progress-bar/index.d.ts.map +1 -1
  59. package/lib/internal/template/progress-bar/index.js +14 -3
  60. package/lib/internal/template/progress-bar/index.js.map +1 -1
  61. package/lib/internal/template/select/parts/styles.css.js +9 -9
  62. package/lib/internal/template/select/parts/styles.scoped.css +27 -9
  63. package/lib/internal/template/select/parts/styles.selectors.js +9 -9
  64. package/lib/internal/template/table/body-cell/click-away.d.ts +9 -0
  65. package/lib/internal/template/table/body-cell/click-away.d.ts.map +1 -0
  66. package/lib/internal/template/table/body-cell/click-away.js +38 -0
  67. package/lib/internal/template/table/body-cell/click-away.js.map +1 -0
  68. package/lib/internal/template/table/body-cell/index.d.ts +10 -19
  69. package/lib/internal/template/table/body-cell/index.d.ts.map +1 -1
  70. package/lib/internal/template/table/body-cell/index.js +49 -9
  71. package/lib/internal/template/table/body-cell/index.js.map +1 -1
  72. package/lib/internal/template/table/body-cell/inline-editor.d.ts +12 -0
  73. package/lib/internal/template/table/body-cell/inline-editor.d.ts.map +1 -0
  74. package/lib/internal/template/table/body-cell/inline-editor.js +88 -0
  75. package/lib/internal/template/table/body-cell/inline-editor.js.map +1 -0
  76. package/lib/internal/template/table/body-cell/styles.css.js +18 -12
  77. package/lib/internal/template/table/body-cell/styles.scoped.css +229 -46
  78. package/lib/internal/template/table/body-cell/styles.selectors.js +18 -12
  79. package/lib/internal/template/table/body-cell/td-element.d.ts +21 -0
  80. package/lib/internal/template/table/body-cell/td-element.d.ts.map +1 -0
  81. package/lib/internal/template/table/body-cell/td-element.js +11 -0
  82. package/lib/internal/template/table/body-cell/td-element.js.map +1 -0
  83. package/lib/internal/template/table/body-cell/use-stable-scroll-position.d.ts +17 -0
  84. package/lib/internal/template/table/body-cell/use-stable-scroll-position.d.ts.map +1 -0
  85. package/lib/internal/template/table/body-cell/use-stable-scroll-position.js +48 -0
  86. package/lib/internal/template/table/body-cell/use-stable-scroll-position.js.map +1 -0
  87. package/lib/internal/template/table/header-cell/index.d.ts +8 -7
  88. package/lib/internal/template/table/header-cell/index.d.ts.map +1 -1
  89. package/lib/internal/template/table/header-cell/index.js +6 -2
  90. package/lib/internal/template/table/header-cell/index.js.map +1 -1
  91. package/lib/internal/template/table/header-cell/styles.css.js +19 -18
  92. package/lib/internal/template/table/header-cell/styles.scoped.css +40 -35
  93. package/lib/internal/template/table/header-cell/styles.selectors.js +19 -18
  94. package/lib/internal/template/table/interfaces.d.ts +73 -6
  95. package/lib/internal/template/table/interfaces.d.ts.map +1 -1
  96. package/lib/internal/template/table/interfaces.js.map +1 -1
  97. package/lib/internal/template/table/internal.d.ts.map +1 -1
  98. package/lib/internal/template/table/internal.js +68 -18
  99. package/lib/internal/template/table/internal.js.map +1 -1
  100. package/lib/internal/template/table/thead.d.ts.map +1 -1
  101. package/lib/internal/template/table/thead.js +1 -1
  102. package/lib/internal/template/table/thead.js.map +1 -1
  103. package/lib/internal/template/table/use-table-focus-navigation.d.ts +16 -0
  104. package/lib/internal/template/table/use-table-focus-navigation.d.ts.map +1 -0
  105. package/lib/internal/template/table/use-table-focus-navigation.js +131 -0
  106. package/lib/internal/template/table/use-table-focus-navigation.js.map +1 -0
  107. package/lib/internal/template/tabs/index.d.ts +1 -1
  108. package/lib/internal/template/tabs/index.d.ts.map +1 -1
  109. package/lib/internal/template/tabs/index.js +2 -2
  110. package/lib/internal/template/tabs/index.js.map +1 -1
  111. package/lib/internal/template/tabs/interfaces.d.ts +14 -0
  112. package/lib/internal/template/tabs/interfaces.d.ts.map +1 -1
  113. package/lib/internal/template/tabs/interfaces.js.map +1 -1
  114. package/lib/internal/template/tabs/tab-header-bar.d.ts +2 -1
  115. package/lib/internal/template/tabs/tab-header-bar.d.ts.map +1 -1
  116. package/lib/internal/template/tabs/tab-header-bar.js +3 -7
  117. package/lib/internal/template/tabs/tab-header-bar.js.map +1 -1
  118. package/lib/internal/template/tag-editor/index.d.ts.map +1 -1
  119. package/lib/internal/template/tag-editor/index.js +1 -1
  120. package/lib/internal/template/tag-editor/index.js.map +1 -1
  121. package/lib/internal/template/test-utils/dom/table/index.d.ts +4 -0
  122. package/lib/internal/template/test-utils/dom/table/index.js +21 -5
  123. package/lib/internal/template/test-utils/dom/table/index.js.map +1 -1
  124. package/lib/internal/template/test-utils/selectors/table/index.d.ts +4 -0
  125. package/lib/internal/template/test-utils/selectors/table/index.js +21 -5
  126. package/lib/internal/template/test-utils/selectors/table/index.js.map +1 -1
  127. package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
  128. package/package.json +1 -1
  129. package/lib/internal/template/code-editor/resize-handler.d.ts +0 -3
  130. package/lib/internal/template/code-editor/resize-handler.d.ts.map +0 -1
  131. package/lib/internal/template/code-editor/resize-handler.js +0 -7
  132. package/lib/internal/template/code-editor/resize-handler.js.map +0 -1
  133. package/lib/internal/template/internal/components/dynamic-aria-live/index.d.ts +0 -28
  134. package/lib/internal/template/internal/components/dynamic-aria-live/index.d.ts.map +0 -1
  135. package/lib/internal/template/internal/components/dynamic-aria-live/index.js +0 -38
  136. package/lib/internal/template/internal/components/dynamic-aria-live/index.js.map +0 -1
  137. package/lib/internal/template/internal/components/live-region/aria-liva-tag.d.ts +0 -13
  138. package/lib/internal/template/internal/components/live-region/aria-liva-tag.d.ts.map +0 -1
  139. package/lib/internal/template/internal/components/live-region/aria-liva-tag.js +0 -18
  140. package/lib/internal/template/internal/components/live-region/aria-liva-tag.js.map +0 -1
  141. package/lib/internal/template/internal/components/live-region/utils.d.ts +0 -8
  142. package/lib/internal/template/internal/components/live-region/utils.d.ts.map +0 -1
  143. package/lib/internal/template/internal/components/live-region/utils.js +0 -24
  144. package/lib/internal/template/internal/components/live-region/utils.js.map +0 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "7f4d906d5da45024d8614a4c6f6260a54626c264"
2
+ "commit": "e478d5a2ab5676508f799fb96e1e10be7b7a4eac"
3
3
  }
@@ -0,0 +1,37 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ @use '../../internal/styles/tokens' as awsui;
6
+ @use '../background-inline-svg.scss' as utils;
7
+
8
+ .resizable-box {
9
+ position: relative;
10
+ width: 100%;
11
+ }
12
+
13
+ .resizable-box-handle {
14
+ position: absolute;
15
+ right: 0;
16
+ bottom: 0;
17
+ z-index: 10; // above editor, when editor is overflowing
18
+
19
+ width: awsui.$space-l;
20
+ height: awsui.$space-l;
21
+
22
+ background-repeat: no-repeat;
23
+ background-origin: content-box;
24
+ box-sizing: border-box;
25
+ background-position: bottom right;
26
+ background-size: awsui.$space-l;
27
+ @include utils.background-inline-svg(
28
+ $path: '../assets/resize-handler.svg',
29
+ $stroke: 'colorStrokeCodeEditorResizeHandler'
30
+ );
31
+
32
+ cursor: ns-resize;
33
+ }
34
+
35
+ .resize-active {
36
+ user-select: none;
37
+ }
@@ -7,7 +7,6 @@
7
7
  @use '../internal/styles/tokens' as awsui;
8
8
  @use '../internal/styles/foundation' as foundation;
9
9
  @use '../internal/hooks/focus-visible' as focus-visible;
10
- @use './background-inline-svg.scss' as utils;
11
10
  @use './ace-editor';
12
11
  @use './pane';
13
12
 
@@ -19,33 +18,6 @@
19
18
  width: 100%;
20
19
  }
21
20
 
22
- .resizable-box {
23
- position: relative;
24
- width: 100%;
25
- }
26
-
27
- .resizable-box-handle {
28
- position: absolute;
29
- right: 0;
30
- bottom: 0;
31
- z-index: 10; // above editor, when editor is overflowing
32
-
33
- width: awsui.$space-l;
34
- height: awsui.$space-l;
35
-
36
- background-repeat: no-repeat;
37
- background-origin: content-box;
38
- box-sizing: border-box;
39
- background-position: bottom right;
40
- background-size: awsui.$space-l;
41
- @include utils.background-inline-svg(
42
- $path: './assets/resize-handler.svg',
43
- $stroke: 'colorStrokeCodeEditorResizeHandler'
44
- );
45
-
46
- cursor: ns-resize;
47
- }
48
-
49
21
  .editor {
50
22
  position: absolute;
51
23
  top: 0;
@@ -60,7 +32,7 @@
60
32
  }
61
33
  }
62
34
 
63
- .code-editor-refresh > .resizable-box > .editor {
35
+ .editor-refresh {
64
36
  border-top-left-radius: calc(awsui.$border-radius-code-editor - awsui.$border-item-width);
65
37
  border-top-right-radius: calc(awsui.$border-radius-code-editor - awsui.$border-item-width);
66
38
  }
@@ -5,6 +5,7 @@
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;
8
9
 
9
10
  .placeholder {
10
11
  @include styles.form-placeholder;
@@ -36,6 +37,14 @@ $checkbox-size: awsui.$size-control;
36
37
 
37
38
  .trigger {
38
39
  @include styles.text-overflow-ellipsis;
40
+ @include focus-visible.when-visible {
41
+ @include styles.focus-highlight(
42
+ (
43
+ 'vertical': calc(-1 * #{awsui.$space-scaled-xxs}),
44
+ 'horizontal': calc(-1 * #{awsui.$space-scaled-xs}),
45
+ )
46
+ );
47
+ }
39
48
  }
40
49
 
41
50
  .layout-strut {
@@ -3,7 +3,9 @@
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
6
+ @use '../../internal/styles' as styles;
6
7
  @use '../../internal/styles/tokens' as awsui;
8
+ @use '../../internal/hooks/focus-visible' as focus-visible;
7
9
 
8
10
  $cell-vertical-padding: awsui.$space-scaled-xs;
9
11
  // Calculate padding to prevent a shift in content after selection due to the difference
@@ -36,6 +38,35 @@ $border-placeholder: awsui.$border-item-width solid transparent;
36
38
  border-right: $border-placeholder;
37
39
  padding-right: $cell-edge-horizontal-padding;
38
40
  }
41
+ &.is-visual-refresh:first-child {
42
+ &:not(.has-striped-rows) {
43
+ padding-left: awsui.$space-xxxs;
44
+ &:not(.body-cell-edit-active).body-cell-editable:hover {
45
+ padding-left: calc(#{awsui.$space-xxxs} + #{awsui.$border-divider-list-width});
46
+ }
47
+ }
48
+
49
+ /*
50
+ Striped rows requires additional left padding because the
51
+ shaded background makes the child content appear too close
52
+ to the table edge.
53
+ */
54
+ &:first-child.has-striped-rows {
55
+ padding-left: awsui.$space-xxs;
56
+ }
57
+
58
+ /*
59
+ Remove the placeholder border if the row is not selectable.
60
+ Rows that are not selectable will reserve the horizontal space
61
+ that the placeholder border would consume.
62
+ */
63
+ &:not(.has-selection):not(.body-cell-editable) {
64
+ border-left: none;
65
+ }
66
+ }
67
+ &:first-child:not(.is-visual-refresh) {
68
+ padding-left: $cell-edge-horizontal-padding;
69
+ }
39
70
  &-first-row {
40
71
  border-top: $border-placeholder;
41
72
  }
@@ -47,7 +78,7 @@ $border-placeholder: awsui.$border-item-width solid transparent;
47
78
 
48
79
  &.has-footer {
49
80
  /*
50
- Add a bottom border to the body cells of the last row as a separator between the
81
+ Add a bottom border to the body cells of the last row as a separator between the
51
82
  table and the footer
52
83
  */
53
84
  border-bottom: awsui.$border-divider-section-width solid awsui.$color-border-divider-default;
@@ -104,38 +135,109 @@ $border-placeholder: awsui.$border-item-width solid transparent;
104
135
  &-selected:not(.body-cell-prev-selected) {
105
136
  padding-top: $cell-vertical-padding;
106
137
  }
107
- }
138
+ &-editor {
139
+ top: 0;
140
+ right: 0;
141
+ bottom: 0;
142
+ position: absolute;
108
143
 
109
- /*
110
- In Visual Refresh the first cell of each row should align with the
111
- left edge of the table as closely as possible.
112
- */
113
- .body-cell:not(.is-visual-refresh) {
114
- &:first-child {
115
- padding-left: $cell-edge-horizontal-padding;
116
- }
117
- }
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: flex-end;
118
147
 
119
- .body-cell.is-visual-refresh {
120
- /*
121
- Remove the placeholder border if the row is not selectable.
122
- Rows that are not selectable will reserve the horizontal space
123
- that the placeholder border would consume.
124
- */
125
- &:first-child:not(.has-selection) {
126
- border-left: none;
127
- }
148
+ padding-right: awsui.$space-xs;
149
+
150
+ &-form {
151
+ margin: calc(-1 * #{awsui.$space-xs}) calc(-1.5 * #{awsui.$space-xs});
152
+ .is-visual-refresh.body-cell:first-child.has-striped-rows > & {
153
+ margin-left: calc(-1 * #{awsui.$space-xxs});
154
+ }
155
+
156
+ .is-visual-refresh.body-cell:first-child:not(.has-striped-rows) > & {
157
+ margin-left: calc(-1 * #{awsui.$space-xxxs});
158
+ }
159
+ }
128
160
 
129
- &:first-child:not(.has-striped-rows) {
130
- padding-left: awsui.$space-xxxs;
161
+ &-row {
162
+ display: flex;
163
+ flex-flow: row nowrap;
164
+ align-items: center;
165
+ justify-content: space-between;
166
+ column-gap: awsui.$space-xxs;
167
+ & > :not(:last-child) {
168
+ flex-grow: 1;
169
+ }
170
+ }
171
+ &-controls {
172
+ flex-shrink: 0;
173
+ }
131
174
  }
175
+ &.body-cell-editable {
176
+ position: relative;
177
+ cursor: pointer;
178
+
179
+ &.body-cell-edit-active {
180
+ overflow: visible;
181
+ }
132
182
 
133
- /*
134
- Striped rows requires additional left padding because the
135
- shaded background makes the child content appear too close
136
- to the table edge.
137
- */
138
- &:first-child.has-striped-rows {
139
- padding-left: awsui.$space-xxs;
183
+ &:not(.body-cell-edit-active) {
184
+ & > .body-cell-editor {
185
+ opacity: 0;
186
+ }
187
+ &:hover {
188
+ position: relative;
189
+ background-color: awsui.$color-background-dropdown-item-hover;
190
+ border: awsui.$border-divider-list-width solid awsui.$color-border-control-default;
191
+ left: calc(-1 * #{awsui.$border-divider-list-width});
192
+ right: calc(-1 * #{awsui.$border-divider-list-width});
193
+ & > .body-cell-editor {
194
+ padding-right: calc(#{awsui.$space-xs} - (2 * #{awsui.$border-divider-list-width}));
195
+ }
196
+ &.body-cell-last-row.body-cell-selected,
197
+ &.body-cell-next-selected {
198
+ padding-top: calc(#{$cell-vertical-padding} - calc(#{awsui.$border-divider-list-width} / 2));
199
+ padding-bottom: calc(#{$cell-vertical-padding} - calc(#{awsui.$border-divider-list-width} / 2));
200
+ }
201
+ &.body-cell-last-row:not(.body-cell-selected) {
202
+ padding-top: calc(#{$cell-vertical-padding} - calc(#{awsui.$border-divider-list-width}));
203
+ }
204
+ &.body-cell-first-row:not(.body-cell-selected) {
205
+ padding-top: calc(#{$cell-vertical-padding} - calc(#{awsui.$border-divider-list-width}));
206
+ padding-bottom: calc(#{$cell-vertical-padding} - calc(#{awsui.$border-divider-list-width}));
207
+ }
208
+ }
209
+ &:hover,
210
+ &[data-awsui-focus-visible='true']:focus-within {
211
+ padding-right: calc(#{$cell-horizontal-padding} + #{awsui.$space-l});
212
+ & > .body-cell-editor {
213
+ opacity: 1;
214
+ }
215
+ }
216
+ &:hover:first-child {
217
+ left: 0;
218
+ right: 0;
219
+ }
220
+ &[data-awsui-focus-visible='true']:not(:hover):focus-within {
221
+ @include styles.focus-highlight(
222
+ (
223
+ 'vertical': calc(-1 * #{awsui.$space-scaled-xxs}),
224
+ 'horizontal': calc(-1 * #{awsui.$space-scaled-xxs}),
225
+ )
226
+ );
227
+ }
228
+ }
229
+ }
230
+ &-editable.is-visual-refresh:not(.body-cell-edit-active):hover {
231
+ &:first-child {
232
+ border-top-left-radius: awsui.$border-radius-control-default-focus-ring;
233
+ border-bottom-left-radius: awsui.$border-radius-control-default-focus-ring;
234
+ }
235
+ &:last-child {
236
+ border-top-right-radius: awsui.$border-radius-control-default-focus-ring;
237
+ border-bottom-right-radius: awsui.$border-radius-control-default-focus-ring;
238
+ }
239
+ &.body-cell-first-row > .body-cell-editor {
240
+ padding-top: awsui.$border-divider-list-width;
241
+ }
140
242
  }
141
243
  }
@@ -53,8 +53,10 @@
53
53
  color: awsui.$color-text-column-sorting-icon;
54
54
  }
55
55
 
56
- .header-cell-disabled.header-cell-sorted > .header-cell-content > .sorting-icon {
57
- color: awsui.$color-text-interactive-disabled;
56
+ .edit-icon {
57
+ margin-left: awsui.$space-xxs;
58
+ margin-top: awsui.$space-scaled-xxs;
59
+ color: inherit;
58
60
  }
59
61
 
60
62
  .header-cell-content {
@@ -76,6 +78,12 @@
76
78
  &.header-cell-fake-focus {
77
79
  @include styles.focus-highlight(awsui.$space-table-header-focus-outline-gutter);
78
80
  }
81
+
82
+ .header-cell-disabled.header-cell-sorted > & {
83
+ & > .sorting-icon {
84
+ color: awsui.$color-text-interactive-disabled;
85
+ }
86
+ }
79
87
  }
80
88
 
81
89
  .header-cell-sortable:not(.header-cell-disabled) {
@@ -85,7 +93,7 @@
85
93
  & > .header-cell-content:hover,
86
94
  &.header-cell-sorted > .header-cell-content {
87
95
  color: awsui.$color-text-interactive-active;
88
- > .sorting-icon {
96
+ & > .sorting-icon {
89
97
  color: awsui.$color-text-interactive-active;
90
98
  }
91
99
  }
@@ -106,8 +114,8 @@
106
114
 
107
115
  /*
108
116
  In Visual Refresh the first cell in the header should align
109
- with the left edge of the table as closely as possible. If the
110
- last header cell is sortable the sort icon should align with the
117
+ with the left edge of the table as closely as possible. If the
118
+ last header cell is sortable the sort icon should align with the
111
119
  settings icon in the pagination slot.
112
120
  */
113
121
  .header-cell:not(.is-visual-refresh) {
@@ -122,8 +130,8 @@ settings icon in the pagination slot.
122
130
  }
123
131
 
124
132
  /*
125
- Striped rows requires additional left padding because the
126
- shaded background makes the child content appear too close
133
+ Striped rows requires additional left padding because the
134
+ shaded background makes the child content appear too close
127
135
  to the table edge.
128
136
  */
129
137
  &:first-child.has-striped-rows {
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  interface AdditionalInfoProps {
3
3
  children: React.ReactNode;
4
+ id?: string;
4
5
  }
5
- export declare const AdditionalInfo: ({ children }: AdditionalInfoProps) => JSX.Element;
6
+ export declare const AdditionalInfo: ({ children, id }: AdditionalInfoProps) => JSX.Element;
6
7
  export {};
7
8
  //# sourceMappingURL=additional-info.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"additional-info.d.ts","sourceRoot":"","sources":["../../../src/attribute-editor/additional-info.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,iBAAkB,mBAAmB,gBAE/D,CAAC"}
1
+ {"version":3,"file":"additional-info.d.ts","sourceRoot":"","sources":["../../../src/attribute-editor/additional-info.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,cAAc,qBAAsB,mBAAmB,gBAMnE,CAAC"}
@@ -1,9 +1,11 @@
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 LiveRegion from '../internal/components/live-region';
4
5
  import styles from './styles.css.js';
5
6
  export var AdditionalInfo = function (_a) {
6
- var children = _a.children;
7
- return (React.createElement("div", { className: styles['additional-info'] }, children));
7
+ var children = _a.children, id = _a.id;
8
+ return (React.createElement(LiveRegion, { visible: true, tagName: "div", "data-testid": "info-live-region" },
9
+ React.createElement("div", { id: id, className: styles['additional-info'] }, children)));
8
10
  };
9
11
  //# sourceMappingURL=additional-info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"additional-info.js","sourceRoot":"","sources":["../../../src/attribute-editor/additional-info.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,EAAiC;QAA/B,QAAQ,cAAA;IAA4B,OAAA,CACnE,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAG,QAAQ,CAAO,CAC5D;AAFoE,CAEpE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport styles from './styles.css.js';\n\ninterface AdditionalInfoProps {\n children: React.ReactNode;\n}\n\nexport const AdditionalInfo = ({ children }: AdditionalInfoProps) => (\n <div className={styles['additional-info']}>{children}</div>\n);\n"]}
1
+ {"version":3,"file":"additional-info.js","sourceRoot":"","sources":["../../../src/attribute-editor/additional-info.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,EAAqC;QAAnC,QAAQ,cAAA,EAAE,EAAE,QAAA;IAA4B,OAAA,CACvE,oBAAC,UAAU,IAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,KAAK,iBAAa,kBAAkB;QACrE,6BAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAC9C,QAAQ,CACL,CACK,CACd;AANwE,CAMxE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport LiveRegion from '../internal/components/live-region';\nimport styles from './styles.css.js';\n\ninterface AdditionalInfoProps {\n children: React.ReactNode;\n id?: string;\n}\n\nexport const AdditionalInfo = ({ children, id }: AdditionalInfoProps) => (\n <LiveRegion visible={true} tagName=\"div\" data-testid=\"info-live-region\">\n <div id={id} className={styles['additional-info']}>\n {children}\n </div>\n </LiveRegion>\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/attribute-editor/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAwB,MAAM,cAAc,CAAC;AAanF,QAAA,MAAM,uBAAuB,+BAmEK,CAAC;AAEnC,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/attribute-editor/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAwB,MAAM,cAAc,CAAC;AAcnF,QAAA,MAAM,uBAAuB,+BAuEK,CAAC;AAEnC,eAAe,uBAAuB,CAAC"}
@@ -11,6 +11,7 @@ import styles from './styles.css.js';
11
11
  import { useContainerBreakpoints } from '../internal/hooks/container-queries';
12
12
  import InternalBox from '../box/internal';
13
13
  import { useMergeRefs } from '../internal/hooks/use-merge-refs';
14
+ import { useUniqueId } from '../internal/hooks/use-unique-id';
14
15
  var InternalAttributeEditor = React.forwardRef(function (_a, ref) {
15
16
  var additionalInfo = _a.additionalInfo, disableAddButton = _a.disableAddButton, definition = _a.definition, items = _a.items, _b = _a.isItemRemovable, isItemRemovable = _b === void 0 ? function () { return true; } : _b, empty = _a.empty, addButtonText = _a.addButtonText, removeButtonText = _a.removeButtonText, i18nStrings = _a.i18nStrings, onAddButtonClick = _a.onAddButtonClick, onRemoveButtonClick = _a.onRemoveButtonClick, _c = _a.__internalRootRef, __internalRootRef = _c === void 0 ? null : _c, props = __rest(_a, ["additionalInfo", "disableAddButton", "definition", "items", "isItemRemovable", "empty", "addButtonText", "removeButtonText", "i18nStrings", "onAddButtonClick", "onRemoveButtonClick", "__internalRootRef"]);
16
17
  var _d = useContainerBreakpoints(['default', 'xxs', 'xs']), breakpoint = _d[0], breakpointRef = _d[1];
@@ -26,12 +27,14 @@ var InternalAttributeEditor = React.forwardRef(function (_a, ref) {
26
27
  }
27
28
  }); });
28
29
  var mergedRef = useMergeRefs(breakpointRef, __internalRootRef);
30
+ var additionalInfoId = useUniqueId('attribute-editor-info');
31
+ var infoAriaDescribedBy = additionalInfo ? additionalInfoId : undefined;
29
32
  return (React.createElement("div", __assign({}, baseProps, { ref: mergedRef, className: clsx(baseProps.className, styles.root) }),
30
33
  React.createElement(InternalBox, { margin: { bottom: 'l' } },
31
34
  isEmpty && React.createElement("div", { className: clsx(styles.empty, wasNonEmpty.current && styles['empty-appear']) }, empty),
32
35
  items.map(function (item, index) { return (React.createElement(Row, { key: index, index: index, breakpoint: breakpoint, item: item, definition: definition, i18nStrings: i18nStrings, removable: isItemRemovable(item), removeButtonText: removeButtonText, removeButtonRefs: removeButtonRefs.current, onRemoveButtonClick: onRemoveButtonClick })); })),
33
- React.createElement(InternalButton, { className: styles['add-button'], disabled: disableAddButton, onClick: onAddButtonClick, formAction: "none" }, addButtonText),
34
- additionalInfo && React.createElement(AdditionalInfo, null, additionalInfo)));
36
+ React.createElement(InternalButton, { className: styles['add-button'], disabled: disableAddButton, onClick: onAddButtonClick, formAction: "none", __nativeAttributes: { 'aria-describedby': infoAriaDescribedBy } }, addButtonText),
37
+ additionalInfo && React.createElement(AdditionalInfo, { id: infoAriaDescribedBy }, additionalInfo)));
35
38
  });
36
39
  export default InternalAttributeEditor;
37
40
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/attribute-editor/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAKhE,IAAM,uBAAuB,GAAG,KAAK,CAAC,UAAU,CAC9C,UACE,EAckC,EAClC,GAAwC;IAdtC,IAAA,cAAc,oBAAA,EACd,gBAAgB,sBAAA,EAChB,UAAU,gBAAA,EACV,KAAK,WAAA,EACL,uBAA4B,EAA5B,eAAe,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA,EAC5B,KAAK,WAAA,EACL,aAAa,mBAAA,EACb,gBAAgB,sBAAA,EAChB,WAAW,iBAAA,EACX,gBAAgB,sBAAA,EAChB,mBAAmB,yBAAA,EACnB,yBAAwB,EAAxB,iBA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EACV,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,EAC1C,mBAAmB,EAAE,mBAAmB,GACxC,CACH,EAb2B,CAa3B,CAAC,CACU;QACd,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAC,MAAM,IAEhB,aAAa,CACC;QAChB,cAAc,IAAI,oBAAC,cAAc,QAAE,cAAc,CAAkB,CAChE,CACP,CAAC;AACJ,CAAC,CAC+B,CAAC;AAEnC,eAAe,uBAAuB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\n\nimport { AttributeEditorForwardRefType, AttributeEditorProps } from './interfaces';\nimport { AdditionalInfo } from './additional-info';\nimport { Row } from './row';\n\nimport styles from './styles.css.js';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport InternalBox from '../box/internal';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\n\ntype InternalAttributeEditorProps<T> = SomeRequired<AttributeEditorProps<T>, 'items'> & InternalBaseComponentProps;\n\nconst InternalAttributeEditor = React.forwardRef(\n <T,>(\n {\n additionalInfo,\n disableAddButton,\n definition,\n items,\n isItemRemovable = () => true,\n empty,\n addButtonText,\n removeButtonText,\n i18nStrings,\n onAddButtonClick,\n onRemoveButtonClick,\n __internalRootRef = null,\n ...props\n }: InternalAttributeEditorProps<T>,\n ref: React.Ref<AttributeEditorProps.Ref>\n ) => {\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['default', 'xxs', 'xs']);\n const removeButtonRefs = useRef<Array<ButtonProps.Ref | undefined>>([]);\n const wasNonEmpty = useRef<boolean>(false);\n\n const baseProps = getBaseProps(props);\n const isEmpty = items && items.length === 0;\n\n wasNonEmpty.current = wasNonEmpty.current || !isEmpty;\n\n useImperativeHandle(ref, () => ({\n focusRemoveButton(rowIndex: number) {\n removeButtonRefs.current[rowIndex]?.focus();\n },\n }));\n\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n return (\n <div {...baseProps} ref={mergedRef} className={clsx(baseProps.className, styles.root)}>\n <InternalBox margin={{ bottom: 'l' }}>\n {isEmpty && <div className={clsx(styles.empty, wasNonEmpty.current && styles['empty-appear'])}>{empty}</div>}\n {items.map((item, index) => (\n <Row\n key={index}\n index={index}\n breakpoint={breakpoint}\n item={item}\n definition={definition}\n i18nStrings={i18nStrings}\n removable={isItemRemovable(item)}\n removeButtonText={removeButtonText}\n removeButtonRefs={removeButtonRefs.current}\n onRemoveButtonClick={onRemoveButtonClick}\n />\n ))}\n </InternalBox>\n <InternalButton\n className={styles['add-button']}\n disabled={disableAddButton}\n onClick={onAddButtonClick}\n formAction=\"none\"\n >\n {addButtonText}\n </InternalButton>\n {additionalInfo && <AdditionalInfo>{additionalInfo}</AdditionalInfo>}\n </div>\n );\n }\n) as AttributeEditorForwardRefType;\n\nexport default InternalAttributeEditor;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/attribute-editor/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC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ACH,EAb2B,CAa3B,CAAC,CACU;QACd,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAC,MAAM,EACjB,kBAAkB,EAAE,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,IAE9D,aAAa,CACC;QAChB,cAAc,IAAI,oBAAC,cAAc,IAAC,EAAE,EAAE,mBAAmB,IAAG,cAAc,CAAkB,CACzF,CACP,CAAC;AACJ,CAAC,CAC+B,CAAC;AAEnC,eAAe,uBAAuB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\n\nimport { AttributeEditorForwardRefType, AttributeEditorProps } from './interfaces';\nimport { AdditionalInfo } from './additional-info';\nimport { Row } from './row';\n\nimport styles from './styles.css.js';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport InternalBox from '../box/internal';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\n\ntype InternalAttributeEditorProps<T> = SomeRequired<AttributeEditorProps<T>, 'items'> & InternalBaseComponentProps;\n\nconst InternalAttributeEditor = React.forwardRef(\n <T,>(\n {\n additionalInfo,\n disableAddButton,\n definition,\n items,\n isItemRemovable = () => true,\n empty,\n addButtonText,\n removeButtonText,\n i18nStrings,\n onAddButtonClick,\n onRemoveButtonClick,\n __internalRootRef = null,\n ...props\n }: InternalAttributeEditorProps<T>,\n ref: React.Ref<AttributeEditorProps.Ref>\n ) => {\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['default', 'xxs', 'xs']);\n const removeButtonRefs = useRef<Array<ButtonProps.Ref | undefined>>([]);\n const wasNonEmpty = useRef<boolean>(false);\n\n const baseProps = getBaseProps(props);\n const isEmpty = items && items.length === 0;\n\n wasNonEmpty.current = wasNonEmpty.current || !isEmpty;\n\n useImperativeHandle(ref, () => ({\n focusRemoveButton(rowIndex: number) {\n removeButtonRefs.current[rowIndex]?.focus();\n },\n }));\n\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const additionalInfoId = useUniqueId('attribute-editor-info');\n const infoAriaDescribedBy = additionalInfo ? additionalInfoId : undefined;\n\n return (\n <div {...baseProps} ref={mergedRef} className={clsx(baseProps.className, styles.root)}>\n <InternalBox margin={{ bottom: 'l' }}>\n {isEmpty && <div className={clsx(styles.empty, wasNonEmpty.current && styles['empty-appear'])}>{empty}</div>}\n {items.map((item, index) => (\n <Row\n key={index}\n index={index}\n breakpoint={breakpoint}\n item={item}\n definition={definition}\n i18nStrings={i18nStrings}\n removable={isItemRemovable(item)}\n removeButtonText={removeButtonText}\n removeButtonRefs={removeButtonRefs.current}\n onRemoveButtonClick={onRemoveButtonClick}\n />\n ))}\n </InternalBox>\n <InternalButton\n className={styles['add-button']}\n disabled={disableAddButton}\n onClick={onAddButtonClick}\n formAction=\"none\"\n __nativeAttributes={{ 'aria-describedby': infoAriaDescribedBy }}\n >\n {addButtonText}\n </InternalButton>\n {additionalInfo && <AdditionalInfo id={infoAriaDescribedBy}>{additionalInfo}</AdditionalInfo>}\n </div>\n );\n }\n) as AttributeEditorForwardRefType;\n\nexport default InternalAttributeEditor;\n"]}
@@ -6,6 +6,7 @@ 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
+ __hideFocusOutline?: boolean | undefined;
9
10
  } & InternalBaseComponentProps & React.RefAttributes<ButtonProps.Ref>>;
10
11
  export default InternalButton;
11
12
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,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;;;;sEAiI3G,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAalF,eAAO,MAAM,cAAc;cAPf,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe;;;;;sEAmI3G,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -13,7 +13,7 @@ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
13
13
  import LiveRegion from '../internal/components/live-region';
14
14
  export var InternalButton = React.forwardRef(function (_a, ref) {
15
15
  var _b;
16
- var children = _a.children, iconName = _a.iconName, __iconClass = _a.__iconClass, onClick = _a.onClick, onFollow = _a.onFollow, _c = _a.iconAlign, iconAlign = _c === void 0 ? 'left' : _c, iconUrl = _a.iconUrl, iconSvg = _a.iconSvg, iconAlt = _a.iconAlt, _d = _a.variant, variant = _d === void 0 ? 'normal' : _d, _e = _a.loading, loading = _e === void 0 ? false : _e, loadingText = _a.loadingText, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.wrapText, wrapText = _g === void 0 ? true : _g, href = _a.href, target = _a.target, download = _a.download, _h = _a.formAction, formAction = _h === void 0 ? 'submit' : _h, ariaLabel = _a.ariaLabel, ariaExpanded = _a.ariaExpanded, __nativeAttributes = _a.__nativeAttributes, _j = _a.__internalRootRef, __internalRootRef = _j === void 0 ? null : _j, _k = _a.__activated, __activated = _k === void 0 ? false : _k, props = __rest(_a, ["children", "iconName", "__iconClass", "onClick", "onFollow", "iconAlign", "iconUrl", "iconSvg", "iconAlt", "variant", "loading", "loadingText", "disabled", "wrapText", "href", "target", "download", "formAction", "ariaLabel", "ariaExpanded", "__nativeAttributes", "__internalRootRef", "__activated"]);
16
+ var children = _a.children, iconName = _a.iconName, __iconClass = _a.__iconClass, onClick = _a.onClick, onFollow = _a.onFollow, _c = _a.iconAlign, iconAlign = _c === void 0 ? 'left' : _c, iconUrl = _a.iconUrl, iconSvg = _a.iconSvg, iconAlt = _a.iconAlt, _d = _a.variant, variant = _d === void 0 ? 'normal' : _d, _e = _a.loading, loading = _e === void 0 ? false : _e, loadingText = _a.loadingText, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.wrapText, wrapText = _g === void 0 ? true : _g, href = _a.href, target = _a.target, download = _a.download, _h = _a.formAction, formAction = _h === void 0 ? 'submit' : _h, ariaLabel = _a.ariaLabel, ariaExpanded = _a.ariaExpanded, _j = _a.__hideFocusOutline, __hideFocusOutline = _j === void 0 ? false : _j, __nativeAttributes = _a.__nativeAttributes, _k = _a.__internalRootRef, __internalRootRef = _k === void 0 ? null : _k, _l = _a.__activated, __activated = _l === void 0 ? false : _l, props = __rest(_a, ["children", "iconName", "__iconClass", "onClick", "onFollow", "iconAlign", "iconUrl", "iconSvg", "iconAlt", "variant", "loading", "loadingText", "disabled", "wrapText", "href", "target", "download", "formAction", "ariaLabel", "ariaExpanded", "__hideFocusOutline", "__nativeAttributes", "__internalRootRef", "__activated"]);
17
17
  checkSafeUrl('Button', href);
18
18
  var focusVisible = useFocusVisible();
19
19
  var isAnchor = Boolean(href);
@@ -37,7 +37,7 @@ export var InternalButton = React.forwardRef(function (_a, ref) {
37
37
  _b[styles['button-no-text']] = !shouldHaveContent,
38
38
  _b[styles['is-activated']] = __activated,
39
39
  _b));
40
- var buttonProps = __assign(__assign(__assign(__assign({}, props), focusVisible), __nativeAttributes), {
40
+ var buttonProps = __assign(__assign(__assign(__assign({}, props), (__hideFocusOutline ? undefined : focusVisible)), __nativeAttributes), {
41
41
  // https://github.com/microsoft/TypeScript/issues/36659
42
42
  ref: useMergeRefs(buttonRef, __internalRootRef), 'aria-label': ariaLabel, 'aria-expanded': ariaExpanded, className: buttonClass, onClick: handleClick });
43
43
  var iconProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/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,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;AAS5D,MAAM,CAAC,IAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAC5C,UACE,EAyBsB,EACtB,GAA+B;;IAzB7B,IAAA,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,iBAAkB,EAAlB,SAAS,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O,KAAK,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;KAC5D,CAAC;IACF,IAAM,aAAa,GAAG,CACpB;QACE,oBAAC,QAAQ,eAAK,SAAS,EAAI;QAC1B,iBAAiB,IAAI,8BAAM,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAQ;QACxE,oBAAC,SAAS,eAAK,SAAS,EAAI,CAC3B,CACJ,CAAC;IAEF,IAAI,QAAQ,EAAE;QACZ,OAAO;QACL,+DAA+D;QAC/D,qDAAqD;QACrD;YACE,sCACM,WAAW,IACf,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM;gBACd,8FAA8F;gBAC9F,GAAG,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EAC5D,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,mBACtB,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAC5C,QAAQ,EAAE,QAAQ,KAEjB,aAAa,CACZ;YACH,OAAO,IAAI,WAAW,IAAI,oBAAC,UAAU,QAAE,WAAW,CAAc,CAChE,CACJ,CAAC;KACH;IACD,OAAO,CACL;QACE,2CAAY,WAAW,IAAE,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,KAC7F,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 useFocusVisible from '../internal/hooks/focus-visible';\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 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 focusVisible = useFocusVisible();\n const isAnchor = Boolean(href);\n const isDisabled = 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 (isAnchor && isDisabled) {\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, isDisabled, onClick, onFollow]\n );\n\n const buttonClass = clsx(props.className, styles.button, styles[`variant-${variant}`], {\n [styles.disabled]: isDisabled,\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 ...focusVisible,\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={target === '_blank' ? 'noopener noreferrer' : undefined}\n tabIndex={isDisabled ? -1 : undefined}\n aria-disabled={isDisabled ? true : undefined}\n download={download}\n >\n {buttonContent}\n </a>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n return (\n <>\n <button {...buttonProps} type={formAction === 'none' ? 'button' : 'submit'} disabled={isDisabled}>\n {buttonContent}\n </button>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n);\n\nexport default InternalButton;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;A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G,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EAC5D,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,mBACtB,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAC5C,QAAQ,EAAE,QAAQ,KAEjB,aAAa,CACZ;YACH,OAAO,IAAI,WAAW,IAAI,oBAAC,UAAU,QAAE,WAAW,CAAc,CAChE,CACJ,CAAC;KACH;IACD,OAAO,CACL;QACE,2CAAY,WAAW,IAAE,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,KAC7F,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 useFocusVisible from '../internal/hooks/focus-visible';\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 __hideFocusOutline?: 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 download,\n formAction = 'submit',\n ariaLabel,\n ariaExpanded,\n __hideFocusOutline = false,\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 focusVisible = useFocusVisible();\n const isAnchor = Boolean(href);\n const isDisabled = 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 (isAnchor && isDisabled) {\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, isDisabled, onClick, onFollow]\n );\n\n const buttonClass = clsx(props.className, styles.button, styles[`variant-${variant}`], {\n [styles.disabled]: isDisabled,\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 ...(__hideFocusOutline ? undefined : focusVisible),\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={target === '_blank' ? 'noopener noreferrer' : undefined}\n tabIndex={isDisabled ? -1 : undefined}\n aria-disabled={isDisabled ? true : undefined}\n download={download}\n >\n {buttonContent}\n </a>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n return (\n <>\n <button {...buttonProps} type={formAction === 'none' ? 'button' : 'submit'} disabled={isDisabled}>\n {buttonContent}\n </button>\n {loading && loadingText && <LiveRegion>{loadingText}</LiveRegion>}\n </>\n );\n }\n);\n\nexport default InternalButton;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA+B/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,eAAe,eA0TxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-editor/index.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA+B/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,eAAe,eAoTxD"}
@@ -3,7 +3,6 @@ import { __assign, __rest } from "tslib";
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import clsx from 'clsx';
6
- import { ResizableBox } from 'react-resizable';
7
6
  import { useMergeRefs } from '../internal/hooks/use-merge-refs';
8
7
  import { getBaseProps } from '../internal/base-component';
9
8
  import { KeyCode } from '../internal/keycode';
@@ -13,7 +12,7 @@ import { useChangeEffect } from './listeners';
13
12
  import { getDefaultConfig, getAceTheme, getLanguageLabel, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, getDefaultTheme, } from './util';
14
13
  import { fireNonCancelableEvent } from '../internal/events';
15
14
  import { setupEditor } from './setup-editor';
16
- import handler from './resize-handler';
15
+ import { ResizableBox } from './resizable-box';
17
16
  import PreferencesModal from './preferences-modal';
18
17
  import LoadingScreen from './loading-screen';
19
18
  import ErrorScreen from './error-screen';
@@ -192,14 +191,12 @@ export default function CodeEditor(props) {
192
191
  React.createElement(LiveRegion, { visible: true }, i18nStrings.loadingState))),
193
192
  !ace && !props.loading && (React.createElement(ErrorScreen, { recoveryText: i18nStrings.errorStateRecovery, onRecoveryClick: props.onRecoveryClick }, i18nStrings.errorState)),
194
193
  ace && !props.loading && (React.createElement(React.Fragment, null,
195
- React.createElement(ResizableBox, { className: styles['resizable-box'], width: Infinity, height: Math.max(editorHeight, 20), minConstraints: [Infinity, 20], axis: "y", handle: handler, onResize: function (e, data) {
196
- setEditorHeight(data.size.height);
194
+ React.createElement(ResizableBox, { height: Math.max(editorHeight, 20), minHeight: 20, onResize: function (height) {
195
+ setEditorHeight(height);
197
196
  onResize();
198
- fireNonCancelableEvent(onEditorContentResize, {
199
- height: data.size.height
200
- });
197
+ fireNonCancelableEvent(onEditorContentResize, { height: height });
201
198
  } },
202
- React.createElement("div", { ref: editorRef, className: clsx(styles.editor, styles.ace), onKeyDown: onEditorKeydown, tabIndex: 0, role: "group", "aria-label": i18nStrings.editorGroupAriaLabel })),
199
+ React.createElement("div", { ref: editorRef, className: clsx(styles.editor, styles.ace, isRefresh && styles['editor-refresh']), onKeyDown: onEditorKeydown, tabIndex: 0, role: "group", "aria-label": i18nStrings.editorGroupAriaLabel })),
203
200
  React.createElement("div", { role: "group", "aria-label": i18nStrings.statusBarGroupAriaLabel },
204
201
  React.createElement(StatusBar, { languageLabel: languageLabel, cursorPosition: i18nStrings.cursorPosition(cursorPosition.row + 1, cursorPosition.column + 1), errorCount: errorCount, warningCount: warningCount, paneStatus: paneStatus, onErrorPaneToggle: onErrorPaneToggle, onWarningPaneToggle: onWarningPaneToggle, onTabFocus: onTabFocus, onTabBlur: onTabBlur, errorsTabRef: errorsTabRef, warningsTabRef: warningsTabRef, i18nStrings: i18nStrings, isTabFocused: isTabFocused, paneId: paneId, onPreferencesOpen: onPreferencesOpen, isRefresh: isRefresh }),
205
202
  React.createElement(Pane, { id: paneId, visible: paneStatus !== 'hidden', annotations: currentAnnotations, highlighted: highlightedAnnotation, onAnnotationClick: onAnnotationClick, onAnnotationClear: onAnnotationClear, onClose: onPaneClose, onAllowlist: shouldHandleFocus, cursorPositionLabel: i18nStrings.cursorPosition, closeButtonAriaLabel: i18nStrings.paneCloseButtonAriaLabel })),