@cloudscape-design/components 3.0.625 → 3.0.627
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/button/styles.css.js +19 -19
- package/button/styles.scoped.css +159 -151
- package/button/styles.selectors.js +19 -19
- package/drawer/styles.css.js +3 -3
- package/drawer/styles.scoped.css +13 -13
- package/drawer/styles.selectors.js +3 -3
- package/help-panel/styles.css.js +4 -4
- package/help-panel/styles.scoped.css +71 -71
- package/help-panel/styles.selectors.js +4 -4
- package/internal/base-component/styles.scoped.css +20 -0
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.d.ts +5 -0
- package/internal/generated/styles/tokens.js +5 -0
- package/internal/generated/theming/index.cjs +75 -0
- package/internal/generated/theming/index.js +75 -0
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/side-navigation/styles.css.js +28 -28
- package/side-navigation/styles.scoped.css +44 -43
- package/side-navigation/styles.selectors.js +28 -28
- package/table/body-cell/disabled-inline-editor.d.ts +1 -1
- package/table/body-cell/disabled-inline-editor.d.ts.map +1 -1
- package/table/body-cell/disabled-inline-editor.js +2 -2
- package/table/body-cell/disabled-inline-editor.js.map +1 -1
- package/table/body-cell/index.d.ts +1 -0
- package/table/body-cell/index.d.ts.map +1 -1
- package/table/body-cell/index.js +2 -2
- package/table/body-cell/index.js.map +1 -1
- package/table/body-cell/styles.css.js +44 -43
- package/table/body-cell/styles.scoped.css +167 -165
- package/table/body-cell/styles.selectors.js +44 -43
- package/table/interfaces.d.ts +2 -0
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +7 -1
- package/table/internal.js.map +1 -1
- package/top-navigation/internal.d.ts.map +1 -1
- package/top-navigation/internal.js +1 -2
- package/top-navigation/internal.js.map +1 -1
|
@@ -96,7 +96,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
96
96
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
97
97
|
SPDX-License-Identifier: Apache-2.0
|
|
98
98
|
*/
|
|
99
|
-
.
|
|
99
|
+
.awsui_root_l0dv0_4v038_99:not(#\9) {
|
|
100
100
|
border-collapse: separate;
|
|
101
101
|
border-spacing: 0;
|
|
102
102
|
box-sizing: border-box;
|
|
@@ -134,7 +134,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
134
134
|
word-break: break-word;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
.
|
|
137
|
+
.awsui_header_l0dv0_4v038_136:not(#\9) {
|
|
138
138
|
font-size: var(--font-panel-header-size-edjz3l, 18px);
|
|
139
139
|
line-height: var(--font-panel-header-line-height-kxi4u2, 22px);
|
|
140
140
|
font-weight: var(--font-weight-heading-l-f8711v, 700);
|
|
@@ -142,12 +142,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
142
142
|
-moz-osx-font-smoothing: var(--font-smoothing-moz-osx-foywby, grayscale);
|
|
143
143
|
margin-block: 0;
|
|
144
144
|
margin-inline: 0;
|
|
145
|
-
padding-block: var(--space-
|
|
145
|
+
padding-block: var(--space-panel-header-vertical-gv9pti, 20px);
|
|
146
146
|
padding-inline-start: var(--space-panel-nav-left-b1g0mt, 28px);
|
|
147
147
|
padding-inline-end: calc(var(--space-scaled-xxl-wbot5q, 32px) + var(--space-xl-lmui9r, 24px));
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.awsui_header-
|
|
150
|
+
.awsui_header-link_l0dv0_4v038_149:not(#\9) {
|
|
151
151
|
font-size: var(--font-panel-header-size-edjz3l, 18px);
|
|
152
152
|
line-height: var(--font-panel-header-line-height-kxi4u2, 22px);
|
|
153
153
|
font-weight: var(--font-weight-heading-l-f8711v, 700);
|
|
@@ -157,27 +157,27 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
157
157
|
min-block-size: var(--font-panel-header-line-height-kxi4u2, 22px);
|
|
158
158
|
display: flex;
|
|
159
159
|
}
|
|
160
|
-
.awsui_header-link--has-
|
|
160
|
+
.awsui_header-link--has-logo_l0dv0_4v038_159 > .awsui_header-link-text_l0dv0_4v038_159:not(#\9) {
|
|
161
161
|
font-weight: 400;
|
|
162
162
|
align-self: center;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
.awsui_header-
|
|
165
|
+
.awsui_header-logo_l0dv0_4v038_164:not(#\9) {
|
|
166
166
|
margin-inline-end: var(--space-s-34lx8l, 12px);
|
|
167
167
|
margin-block-start: var(--space-xxxs-zbmxqb, 2px);
|
|
168
168
|
max-inline-size: calc(1.25 * var(--size-icon-big-zkdryd, 32px));
|
|
169
169
|
align-self: flex-start;
|
|
170
170
|
}
|
|
171
|
-
.awsui_header-logo--
|
|
171
|
+
.awsui_header-logo--stretched_l0dv0_4v038_170:not(#\9) {
|
|
172
172
|
max-inline-size: 100%;
|
|
173
173
|
margin-inline-end: 0;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
.awsui_list-
|
|
177
|
-
margin-block-start: var(--space-
|
|
176
|
+
.awsui_list-container_l0dv0_4v038_175:not(#\9) {
|
|
177
|
+
margin-block-start: var(--space-panel-content-top-wac3yp, 20px);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
.
|
|
180
|
+
.awsui_list_l0dv0_4v038_175:not(#\9) {
|
|
181
181
|
margin-block: 0;
|
|
182
182
|
margin-inline: 0;
|
|
183
183
|
padding-block: 0;
|
|
@@ -185,22 +185,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
185
185
|
padding-inline-start: var(--space-l-t419sm, 20px);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
.awsui_list-variant-
|
|
188
|
+
.awsui_list-variant-root_l0dv0_4v038_187:not(#\9) {
|
|
189
189
|
margin-block: 0;
|
|
190
190
|
margin-inline: 0;
|
|
191
191
|
padding-block: 0;
|
|
192
192
|
padding-inline-start: var(--space-panel-nav-left-b1g0mt, 28px);
|
|
193
193
|
padding-inline-end: var(--space-panel-side-right-xofg51, 24px);
|
|
194
194
|
}
|
|
195
|
-
.awsui_list-variant-root--
|
|
196
|
-
margin-block-end: var(--space-
|
|
195
|
+
.awsui_list-variant-root--last_l0dv0_4v038_194:not(#\9) {
|
|
196
|
+
margin-block-end: var(--space-panel-content-bottom-7k6er3, 40px);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
.awsui_list-variant-expandable-link-
|
|
199
|
+
.awsui_list-variant-expandable-link-group_l0dv0_4v038_198:not(#\9) {
|
|
200
200
|
padding-inline-start: var(--space-xxxl-4x2gki, 40px);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
.awsui_list-
|
|
203
|
+
.awsui_list-item_l0dv0_4v038_202:not(#\9) {
|
|
204
204
|
margin-block: var(--space-scaled-xs-26e2du, 8px);
|
|
205
205
|
margin-inline: 0;
|
|
206
206
|
padding-block: 0;
|
|
@@ -208,35 +208,35 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
208
208
|
list-style: none;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
.
|
|
212
|
-
.awsui_expandable-link-
|
|
211
|
+
.awsui_section_l0dv0_4v038_210:not(#\9),
|
|
212
|
+
.awsui_expandable-link-group_l0dv0_4v038_211:not(#\9) {
|
|
213
213
|
margin-inline-start: calc(-1 * var(--space-l-t419sm, 20px));
|
|
214
214
|
}
|
|
215
|
-
.awsui_section--no-
|
|
216
|
-
.awsui_expandable-link-group--no-
|
|
215
|
+
.awsui_section--no-ident_l0dv0_4v038_214:not(#\9),
|
|
216
|
+
.awsui_expandable-link-group--no-ident_l0dv0_4v038_215:not(#\9) {
|
|
217
217
|
margin-inline-start: 0;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
.
|
|
220
|
+
.awsui_section_l0dv0_4v038_210:not(#\9) {
|
|
221
221
|
margin-block: calc(var(--space-scaled-2x-l-ujnz41, 20px) - var(--border-divider-section-width-1061zr, 1px));
|
|
222
222
|
/* stylelint-disable-next-line selector-max-type */
|
|
223
223
|
}
|
|
224
|
-
.
|
|
224
|
+
.awsui_section_l0dv0_4v038_210.awsui_refresh_l0dv0_4v038_223:not(#\9) {
|
|
225
225
|
margin-block: calc(var(--space-scaled-2x-m-owtj1o, 16px) - var(--border-divider-section-width-1061zr, 1px));
|
|
226
226
|
}
|
|
227
|
-
.
|
|
227
|
+
.awsui_section_l0dv0_4v038_210 > div:not(#\9) {
|
|
228
228
|
padding-block: 0;
|
|
229
229
|
padding-inline: 0;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
.awsui_list-variant-section-
|
|
232
|
+
.awsui_list-variant-section-group_l0dv0_4v038_231:not(#\9) {
|
|
233
233
|
margin-block: 0;
|
|
234
234
|
margin-inline: 0;
|
|
235
235
|
padding-block: 0;
|
|
236
236
|
padding-inline: 0;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
.awsui_section-
|
|
239
|
+
.awsui_section-group_l0dv0_4v038_238:not(#\9) {
|
|
240
240
|
font-size: var(--font-size-heading-m-sjd256, 18px);
|
|
241
241
|
line-height: var(--line-height-heading-m-50evfk, 22px);
|
|
242
242
|
letter-spacing: var(--letter-spacing-heading-m-0w575i, -0.01em);
|
|
@@ -247,11 +247,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
247
247
|
margin-inline: 0;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.awsui_section-group-
|
|
250
|
+
.awsui_section-group-title_l0dv0_4v038_249:not(#\9) {
|
|
251
251
|
/* used in test-utils */
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
.
|
|
254
|
+
.awsui_link_l0dv0_4v038_253:not(#\9) {
|
|
255
255
|
font-size: var(--font-size-body-m-x4okxb, 14px);
|
|
256
256
|
line-height: var(--line-height-body-m-30ar75, 20px);
|
|
257
257
|
color: var(--color-text-body-secondary-w9jvno, #414d5c);
|
|
@@ -260,30 +260,30 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
260
260
|
-moz-osx-font-smoothing: auto;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
.awsui_link-
|
|
263
|
+
.awsui_link-active_l0dv0_4v038_262:not(#\9) {
|
|
264
264
|
font-weight: var(--font-wayfinding-link-active-weight-rbmzei, 700);
|
|
265
265
|
-webkit-font-smoothing: var(--font-smoothing-webkit-m8nc84, antialiased);
|
|
266
266
|
-moz-osx-font-smoothing: var(--font-smoothing-moz-osx-foywby, grayscale);
|
|
267
267
|
color: var(--color-text-accent-n2acxv, #0972d3);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
.awsui_header-
|
|
271
|
-
.
|
|
270
|
+
.awsui_header-link_l0dv0_4v038_149:not(#\9),
|
|
271
|
+
.awsui_link_l0dv0_4v038_253:not(#\9) {
|
|
272
272
|
text-decoration: none;
|
|
273
273
|
}
|
|
274
|
-
.awsui_header-
|
|
275
|
-
.
|
|
274
|
+
.awsui_header-link_l0dv0_4v038_149:not(#\9):hover,
|
|
275
|
+
.awsui_link_l0dv0_4v038_253:not(#\9):hover {
|
|
276
276
|
color: var(--color-text-accent-n2acxv, #0972d3);
|
|
277
277
|
}
|
|
278
|
-
.awsui_header-
|
|
279
|
-
.
|
|
278
|
+
.awsui_header-link_l0dv0_4v038_149:not(#\9):focus,
|
|
279
|
+
.awsui_link_l0dv0_4v038_253:not(#\9):focus {
|
|
280
280
|
outline: none;
|
|
281
281
|
}
|
|
282
|
-
.awsui_header-
|
|
282
|
+
.awsui_header-link_l0dv0_4v038_149:not(#\9):hover, .awsui_header-link_l0dv0_4v038_149:not(#\9):focus, .awsui_link_l0dv0_4v038_253:not(#\9):hover, .awsui_link_l0dv0_4v038_253:not(#\9):focus {
|
|
283
283
|
text-decoration: none;
|
|
284
284
|
}
|
|
285
|
-
body[data-awsui-focus-visible=true] .awsui_header-
|
|
286
|
-
body[data-awsui-focus-visible=true] .
|
|
285
|
+
body[data-awsui-focus-visible=true] .awsui_header-link_l0dv0_4v038_149:not(#\9):focus,
|
|
286
|
+
body[data-awsui-focus-visible=true] .awsui_link_l0dv0_4v038_253:not(#\9):focus {
|
|
287
287
|
outline: thin dotted;
|
|
288
288
|
outline: var(--border-link-focus-ring-outline-kkfop6, 0);
|
|
289
289
|
outline-offset: 2px;
|
|
@@ -295,25 +295,26 @@ body[data-awsui-focus-visible=true] .awsui_link_l0dv0_s3klw_253:not(#\9):focus {
|
|
|
295
295
|
box-shadow: 0 0 0 var(--border-link-focus-ring-shadow-spread-v8hkrl, 2px) var(--color-border-item-focused-b2ntyl, #0972d3);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
.
|
|
298
|
+
.awsui_info_l0dv0_4v038_299:not(#\9) {
|
|
299
299
|
margin-inline-start: var(--space-xs-zb16t3, 8px);
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
.awsui_external-
|
|
302
|
+
.awsui_external-icon_l0dv0_4v038_303:not(#\9) {
|
|
303
303
|
margin-inline-start: var(--space-xxs-p8yyaw, 4px);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
.
|
|
306
|
+
.awsui_divider_l0dv0_4v038_307:not(#\9) {
|
|
307
307
|
border-block: none;
|
|
308
308
|
border-inline: none;
|
|
309
|
-
border-block-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
|
|
310
309
|
}
|
|
311
310
|
|
|
312
|
-
.awsui_divider-
|
|
311
|
+
.awsui_divider-default_l0dv0_4v038_312:not(#\9) {
|
|
313
312
|
margin-block: var(--space-scaled-2x-xl-udij7m, 24px);
|
|
314
|
-
margin-inline: calc(-1 * var(--space-
|
|
313
|
+
margin-inline: calc(-1 * var(--space-panel-divider-margin-horizontal-sbik1z, 8px));
|
|
314
|
+
border-block-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
.awsui_divider-
|
|
317
|
+
.awsui_divider-header_l0dv0_4v038_318:not(#\9) {
|
|
318
318
|
margin-block-start: 0;
|
|
319
|
+
border-block-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-panel-header-lf0q4c, #b6bec9);
|
|
319
320
|
}
|
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"header": "
|
|
7
|
-
"header-link": "awsui_header-
|
|
8
|
-
"header-link--has-logo": "awsui_header-link--has-
|
|
9
|
-
"header-link-text": "awsui_header-link-
|
|
10
|
-
"header-logo": "awsui_header-
|
|
11
|
-
"header-logo--stretched": "awsui_header-logo--
|
|
12
|
-
"list-container": "awsui_list-
|
|
13
|
-
"list": "
|
|
14
|
-
"list-variant-root": "awsui_list-variant-
|
|
15
|
-
"list-variant-root--last": "awsui_list-variant-root--
|
|
16
|
-
"list-variant-expandable-link-group": "awsui_list-variant-expandable-link-
|
|
17
|
-
"list-item": "awsui_list-
|
|
18
|
-
"section": "
|
|
19
|
-
"expandable-link-group": "awsui_expandable-link-
|
|
20
|
-
"section--no-ident": "awsui_section--no-
|
|
21
|
-
"expandable-link-group--no-ident": "awsui_expandable-link-group--no-
|
|
22
|
-
"refresh": "
|
|
23
|
-
"list-variant-section-group": "awsui_list-variant-section-
|
|
24
|
-
"section-group": "awsui_section-
|
|
25
|
-
"section-group-title": "awsui_section-group-
|
|
26
|
-
"link": "
|
|
27
|
-
"link-active": "awsui_link-
|
|
28
|
-
"info": "
|
|
29
|
-
"external-icon": "awsui_external-
|
|
30
|
-
"divider": "
|
|
31
|
-
"divider-default": "awsui_divider-
|
|
32
|
-
"divider-header": "awsui_divider-
|
|
5
|
+
"root": "awsui_root_l0dv0_4v038_99",
|
|
6
|
+
"header": "awsui_header_l0dv0_4v038_136",
|
|
7
|
+
"header-link": "awsui_header-link_l0dv0_4v038_149",
|
|
8
|
+
"header-link--has-logo": "awsui_header-link--has-logo_l0dv0_4v038_159",
|
|
9
|
+
"header-link-text": "awsui_header-link-text_l0dv0_4v038_159",
|
|
10
|
+
"header-logo": "awsui_header-logo_l0dv0_4v038_164",
|
|
11
|
+
"header-logo--stretched": "awsui_header-logo--stretched_l0dv0_4v038_170",
|
|
12
|
+
"list-container": "awsui_list-container_l0dv0_4v038_175",
|
|
13
|
+
"list": "awsui_list_l0dv0_4v038_175",
|
|
14
|
+
"list-variant-root": "awsui_list-variant-root_l0dv0_4v038_187",
|
|
15
|
+
"list-variant-root--last": "awsui_list-variant-root--last_l0dv0_4v038_194",
|
|
16
|
+
"list-variant-expandable-link-group": "awsui_list-variant-expandable-link-group_l0dv0_4v038_198",
|
|
17
|
+
"list-item": "awsui_list-item_l0dv0_4v038_202",
|
|
18
|
+
"section": "awsui_section_l0dv0_4v038_210",
|
|
19
|
+
"expandable-link-group": "awsui_expandable-link-group_l0dv0_4v038_211",
|
|
20
|
+
"section--no-ident": "awsui_section--no-ident_l0dv0_4v038_214",
|
|
21
|
+
"expandable-link-group--no-ident": "awsui_expandable-link-group--no-ident_l0dv0_4v038_215",
|
|
22
|
+
"refresh": "awsui_refresh_l0dv0_4v038_223",
|
|
23
|
+
"list-variant-section-group": "awsui_list-variant-section-group_l0dv0_4v038_231",
|
|
24
|
+
"section-group": "awsui_section-group_l0dv0_4v038_238",
|
|
25
|
+
"section-group-title": "awsui_section-group-title_l0dv0_4v038_249",
|
|
26
|
+
"link": "awsui_link_l0dv0_4v038_253",
|
|
27
|
+
"link-active": "awsui_link-active_l0dv0_4v038_262",
|
|
28
|
+
"info": "awsui_info_l0dv0_4v038_299",
|
|
29
|
+
"external-icon": "awsui_external-icon_l0dv0_4v038_303",
|
|
30
|
+
"divider": "awsui_divider_l0dv0_4v038_307",
|
|
31
|
+
"divider-default": "awsui_divider-default_l0dv0_4v038_312",
|
|
32
|
+
"divider-header": "awsui_divider-header_l0dv0_4v038_318"
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -3,6 +3,6 @@ import { TableBodyCellProps } from './index';
|
|
|
3
3
|
interface DisabledInlineEditorProps<ItemType> extends TableBodyCellProps<ItemType> {
|
|
4
4
|
editDisabledReason: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function DisabledInlineEditor<ItemType>({ className, item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason, isVisualRefresh, interactiveCell, ...rest }: DisabledInlineEditorProps<ItemType>): JSX.Element;
|
|
6
|
+
export declare function DisabledInlineEditor<ItemType>({ className, item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason, isVisualRefresh, interactiveCell, resizableColumns, ...rest }: DisabledInlineEditorProps<ItemType>): JSX.Element;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=disabled-inline-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disabled-inline-editor.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI7C,UAAU,yBAAyB,CAAC,QAAQ,CAAE,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAChF,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,EAC7C,SAAS,EACT,IAAI,EACJ,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,eAAsB,EACtB,GAAG,IAAI,EACR,EAAE,yBAAyB,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"disabled-inline-editor.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI7C,UAAU,yBAAyB,CAAC,QAAQ,CAAE,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAChF,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,EAC7C,SAAS,EACT,IAAI,EACJ,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,eAAsB,EACtB,gBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,yBAAyB,CAAC,QAAQ,CAAC,eAqGrC"}
|
|
@@ -16,7 +16,7 @@ import styles from './styles.css.js';
|
|
|
16
16
|
import { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';
|
|
17
17
|
export function DisabledInlineEditor(_a) {
|
|
18
18
|
var _b;
|
|
19
|
-
var { className, item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason, isVisualRefresh, interactiveCell = true } = _a, rest = __rest(_a, ["className", "item", "column", "ariaLabels", "isEditing", "onEditStart", "onEditEnd", "editDisabledReason", "isVisualRefresh", "interactiveCell"]);
|
|
19
|
+
var { className, item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason, isVisualRefresh, interactiveCell = true, resizableColumns = false } = _a, rest = __rest(_a, ["className", "item", "column", "ariaLabels", "isEditing", "onEditStart", "onEditEnd", "editDisabledReason", "isVisualRefresh", "interactiveCell", "resizableColumns"]);
|
|
20
20
|
const clickAwayRef = useClickAway(() => {
|
|
21
21
|
if (isEditing) {
|
|
22
22
|
onEditEnd(true);
|
|
@@ -42,7 +42,7 @@ export function DisabledInlineEditor(_a) {
|
|
|
42
42
|
const { targetProps, descriptionEl } = useHiddenDescription(editDisabledReason);
|
|
43
43
|
const portalClasses = usePortalModeClasses(portalRef);
|
|
44
44
|
const { tabIndex } = useSingleTabStopNavigation(buttonRef);
|
|
45
|
-
return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: { 'data-inline-editing-active': isEditing.toString() }, className: clsx(className, styles['body-cell-editable'], interactiveCell && styles['body-cell-interactive'], isEditing && styles['body-cell-edit-disabled-popover'], isVisualRefresh && styles['is-visual-refresh']), onClick: interactiveCell && !isEditing ? onClick : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false), ref: clickAwayRef }),
|
|
45
|
+
return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: { 'data-inline-editing-active': isEditing.toString() }, className: clsx(className, styles['body-cell-editable'], interactiveCell && styles['body-cell-interactive'], resizableColumns && styles['resizable-columns'], isEditing && styles['body-cell-edit-disabled-popover'], isVisualRefresh && styles['is-visual-refresh']), onClick: interactiveCell && !isEditing ? onClick : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false), ref: clickAwayRef }),
|
|
46
46
|
column.cell(item),
|
|
47
47
|
React.createElement("div", { className: styles['body-cell-editor-wrapper'] },
|
|
48
48
|
React.createElement("button", Object.assign({ ref: buttonRef, tabIndex: tabIndex, className: clsx(styles['body-cell-editor'], styles['body-cell-editor-disabled']), "aria-label": (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.activateEditLabel) === null || _b === void 0 ? void 0 : _b.call(ariaLabels, column, item), "aria-haspopup": "dialog", "aria-disabled": "true", onClick: !interactiveCell && !isEditing ? onClick : undefined, onFocus: () => setHasFocus(true), onBlur: () => setHasFocus(false), onKeyDown: handleEscape }, targetProps),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disabled-inline-editor.js","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,oBAAoB,MAAM,oDAAoD,CAAC;AACtF,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AAEnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AAMvG,MAAM,UAAU,oBAAoB,CAAW,
|
|
1
|
+
{"version":3,"file":"disabled-inline-editor.js","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,oBAAoB,MAAM,oDAAoD,CAAC;AACtF,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AAEnE,OAAO,MAAM,MAAM,iBA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AI,CAAC,EAChC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAChC,SAAS,EAAE,YAAY,IACnB,WAAW;gBAEd,QAAQ,IAAI,oBAAC,IAAI,IAAC,IAAI,EAAC,cAAc,EAAC,OAAO,EAAC,QAAQ,EAAC,iBAAiB,EAAE,OAAO,GAAI;gBACrF,aAAa,CACP,CACL;QAEL,SAAS,IAAI,CACZ,8BAAM,GAAG,EAAE,SAAS;YAClB,oBAAC,MAAM;gBACL,8BAAM,SAAS,EAAE,aAAa;oBAC5B,oBAAC,gBAAgB,IACf,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAC,KAAK,EACd,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,oBAAC,KAAK,IAAC,QAAQ,EAAE,QAAQ,GAAI,EAChD,gBAAgB,EAAE,IAAI,EACtB,MAAM,EAAE,IAAI;wBAEZ,oBAAC,WAAW,IACV,aAAa,EAAE,KAAK,EACpB,gBAAgB,EAAE,SAAS,EAC3B,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC,EACnB,eAAe,EAAC,MAAM;4BAEtB,2CAAgB,QAAQ,IAAE,kBAAkB,CAAQ,CACxC,CACG,CACd,CACA,CACJ,CACR,CACc,CAClB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport useHiddenDescription from '../../button-dropdown/utils/use-hidden-description';\nimport Icon from '../../icon/internal';\nimport PopoverContainer from '../../popover/container';\nimport PopoverBody from '../../popover/body';\nimport Portal from '../../internal/components/portal';\nimport { usePortalModeClasses } from '../../internal/hooks/use-portal-mode-classes';\nimport Arrow from '../../popover/arrow';\nimport { useClickAway } from './click-away';\nimport { TableTdElement, TableTdElementProps } from './td-element';\nimport { TableBodyCellProps } from './index';\nimport styles from './styles.css.js';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\n\ninterface DisabledInlineEditorProps<ItemType> extends TableBodyCellProps<ItemType> {\n editDisabledReason: string;\n}\n\nexport function DisabledInlineEditor<ItemType>({\n className,\n item,\n column,\n ariaLabels,\n isEditing,\n onEditStart,\n onEditEnd,\n editDisabledReason,\n isVisualRefresh,\n interactiveCell = true,\n resizableColumns = false,\n ...rest\n}: DisabledInlineEditorProps<ItemType>) {\n const clickAwayRef = useClickAway(() => {\n if (isEditing) {\n onEditEnd(true);\n }\n });\n\n const [hasHover, setHasHover] = useState(false);\n const [hasFocus, setHasFocus] = useState(false);\n // When a cell is both expandable and editable the icon is always shown.\n const showIcon = hasHover || hasFocus || isEditing || !interactiveCell;\n\n const iconRef = useRef(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const portalRef = useRef<HTMLSpanElement>(null);\n\n function handleEscape(event: React.KeyboardEvent): void {\n if (event.key === 'Escape') {\n onEditEnd(true);\n }\n }\n\n const onClick = () => {\n onEditStart();\n buttonRef.current?.focus();\n };\n\n const { targetProps, descriptionEl } = useHiddenDescription(editDisabledReason);\n const portalClasses = usePortalModeClasses(portalRef);\n\n const { tabIndex } = useSingleTabStopNavigation(buttonRef);\n\n return (\n <TableTdElement\n {...rest}\n nativeAttributes={\n { 'data-inline-editing-active': isEditing.toString() } as TableTdElementProps['nativeAttributes']\n }\n className={clsx(\n className,\n styles['body-cell-editable'],\n interactiveCell && styles['body-cell-interactive'],\n resizableColumns && styles['resizable-columns'],\n isEditing && styles['body-cell-edit-disabled-popover'],\n isVisualRefresh && styles['is-visual-refresh']\n )}\n onClick={interactiveCell && !isEditing ? onClick : undefined}\n onMouseEnter={() => setHasHover(true)}\n onMouseLeave={() => setHasHover(false)}\n ref={clickAwayRef}\n >\n {column.cell(item)}\n\n <div className={styles['body-cell-editor-wrapper']}>\n <button\n ref={buttonRef}\n tabIndex={tabIndex}\n className={clsx(styles['body-cell-editor'], styles['body-cell-editor-disabled'])}\n aria-label={ariaLabels?.activateEditLabel?.(column, item)}\n aria-haspopup=\"dialog\"\n aria-disabled=\"true\"\n onClick={!interactiveCell && !isEditing ? onClick : undefined}\n onFocus={() => setHasFocus(true)}\n onBlur={() => setHasFocus(false)}\n onKeyDown={handleEscape}\n {...targetProps}\n >\n {showIcon && <Icon name=\"lock-private\" variant=\"normal\" __internalRootRef={iconRef} />}\n {descriptionEl}\n </button>\n </div>\n\n {isEditing && (\n <span ref={portalRef}>\n <Portal>\n <span className={portalClasses}>\n <PopoverContainer\n size=\"medium\"\n fixedWidth={false}\n position=\"top\"\n trackRef={iconRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={true}\n zIndex={2000}\n >\n <PopoverBody\n dismissButton={false}\n dismissAriaLabel={undefined}\n header={null}\n onDismiss={() => {}}\n overflowVisible=\"both\"\n >\n <span aria-live=\"polite\">{editDisabledReason}</span>\n </PopoverBody>\n </PopoverContainer>\n </span>\n </Portal>\n </span>\n )}\n </TableTdElement>\n );\n}\n"]}
|
|
@@ -5,6 +5,7 @@ export interface TableBodyCellProps<ItemType> extends TableTdElementProps {
|
|
|
5
5
|
column: TableProps.ColumnDefinition<ItemType>;
|
|
6
6
|
item: ItemType;
|
|
7
7
|
isEditing: boolean;
|
|
8
|
+
resizableColumns?: boolean;
|
|
8
9
|
successfulEdit?: boolean;
|
|
9
10
|
onEditStart: () => void;
|
|
10
11
|
onEditEnd: (cancelled: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAYnE,MAAM,WAAW,kBAAkB,CAAC,QAAQ,CAAE,SAAQ,mBAAmB;IACvE,MAAM,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AE,UAAU,EAAE,OAAO,CAAA;CAAE,eAexD"}
|
package/table/body-cell/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const submitHandlerFallback = () => {
|
|
|
17
17
|
};
|
|
18
18
|
function TableCellEditable(_a) {
|
|
19
19
|
var _b, _c, _d;
|
|
20
|
-
var { className, item, column, isEditing, onEditStart, onEditEnd, submitEdit, ariaLabels, isVisualRefresh, successfulEdit = false, interactiveCell = true } = _a, rest = __rest(_a, ["className", "item", "column", "isEditing", "onEditStart", "onEditEnd", "submitEdit", "ariaLabels", "isVisualRefresh", "successfulEdit", "interactiveCell"]);
|
|
20
|
+
var { className, item, column, isEditing, onEditStart, onEditEnd, submitEdit, ariaLabels, isVisualRefresh, resizableColumns = false, successfulEdit = false, interactiveCell = true } = _a, rest = __rest(_a, ["className", "item", "column", "isEditing", "onEditStart", "onEditEnd", "submitEdit", "ariaLabels", "isVisualRefresh", "resizableColumns", "successfulEdit", "interactiveCell"]);
|
|
21
21
|
const i18n = useInternalI18n('table');
|
|
22
22
|
const editActivateRef = useRef(null);
|
|
23
23
|
const tdNativeAttributes = {
|
|
@@ -49,7 +49,7 @@ function TableCellEditable(_a) {
|
|
|
49
49
|
}
|
|
50
50
|
}, [hasFocus, successfulEdit, prevHasFocus, prevSuccessfulEdit]);
|
|
51
51
|
const { tabIndex: editActivateTabIndex } = useSingleTabStopNavigation(editActivateRef);
|
|
52
|
-
return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: tdNativeAttributes, className: clsx(className, styles['body-cell-editable'], interactiveCell && styles['body-cell-interactive'], isEditing && styles['body-cell-edit-active'], showSuccessIcon && showIcon && styles['body-cell-has-success'], isVisualRefresh && styles['is-visual-refresh']), onClick: interactiveCell && !isEditing ? onEditStart : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false) }), isEditing ? (React.createElement(InlineEditor, { ariaLabels: ariaLabels, column: column, item: item, onEditEnd: options => {
|
|
52
|
+
return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: tdNativeAttributes, className: clsx(className, styles['body-cell-editable'], interactiveCell && styles['body-cell-interactive'], resizableColumns && styles['resizable-columns'], isEditing && styles['body-cell-edit-active'], showSuccessIcon && showIcon && styles['body-cell-has-success'], isVisualRefresh && styles['is-visual-refresh']), onClick: interactiveCell && !isEditing ? onEditStart : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false) }), isEditing ? (React.createElement(InlineEditor, { ariaLabels: ariaLabels, column: column, item: item, onEditEnd: options => {
|
|
53
53
|
setShowSuccessIcon(false);
|
|
54
54
|
isFocusMoveNeededRef.current = options.refocusCell;
|
|
55
55
|
onEditEnd(options.cancelled);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,qBAAqB,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,UAAU,MAAM,gDAAgD,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;AAClF,CAAC,CAAC;AAcF,SAAS,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c,CAClB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAW,EAGiB;;QAHjB,EACtC,UAAU,OAE6C,EADpD,IAAI,cAF+B,cAGvC,CADQ;IAEP,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IACxD,MAAM,kBAAkB,GAAG,MAAA,MAAA,IAAI,CAAC,MAAM,CAAC,UAAU,0CAAE,cAAc,mDAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/E,6FAA6F;IAC7F,iEAAiE;IACjE,IAAI,kBAAkB,IAAI,CAAC,sBAAsB,EAAE;QACjD,OAAO,oBAAC,oBAAoB,kBAAC,kBAAkB,EAAE,kBAAkB,IAAM,IAAI,EAAI,CAAC;KACnF;IACD,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,EAAE;QAC7D,OAAO,oBAAC,iBAAiB,oBAAK,IAAI,EAAI,CAAC;KACxC;IAED,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC9B,OAAO,oBAAC,cAAc,oBAAK,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAkB,CAAC;AACxE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport React, { useEffect, useRef, useState } from 'react';\nimport Icon from '../../icon/internal';\nimport { TableProps } from '../interfaces';\nimport { TableTdElement, TableTdElementProps } from './td-element';\nimport { InlineEditor } from './inline-editor';\nimport LiveRegion from '../../internal/components/live-region/index.js';\nimport { useInternalI18n } from '../../i18n/context';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context.js';\nimport { DisabledInlineEditor } from './disabled-inline-editor';\n\nconst submitHandlerFallback = () => {\n throw new Error('The function `handleSubmit` is required for editable columns');\n};\n\nexport interface TableBodyCellProps<ItemType> extends TableTdElementProps {\n column: TableProps.ColumnDefinition<ItemType>;\n item: ItemType;\n isEditing: boolean;\n successfulEdit?: boolean;\n onEditStart: () => void;\n onEditEnd: (cancelled: boolean) => void;\n submitEdit?: TableProps.SubmitEditFunction<ItemType>;\n ariaLabels: TableProps['ariaLabels'];\n interactiveCell?: boolean;\n}\n\nfunction TableCellEditable<ItemType>({\n className,\n item,\n column,\n isEditing,\n onEditStart,\n onEditEnd,\n submitEdit,\n ariaLabels,\n isVisualRefresh,\n successfulEdit = false,\n interactiveCell = true,\n ...rest\n}: TableBodyCellProps<ItemType>) {\n const i18n = useInternalI18n('table');\n const editActivateRef = useRef<HTMLButtonElement>(null);\n const tdNativeAttributes = {\n 'data-inline-editing-active': isEditing.toString(),\n };\n const isFocusMoveNeededRef = useRef(false);\n\n useEffect(() => {\n if (!isEditing && editActivateRef.current && isFocusMoveNeededRef.current) {\n isFocusMoveNeededRef.current = false;\n editActivateRef.current.focus();\n }\n }, [isEditing]);\n // To improve the initial page render performance we only show the edit icon when necessary.\n const [hasHover, setHasHover] = useState(false);\n const [hasFocus, setHasFocus] = useState(false);\n // When a cell is both expandable and editable the icon is always shown.\n const showIcon = hasHover || hasFocus || !interactiveCell;\n\n const prevSuccessfulEdit = usePrevious(successfulEdit);\n const prevHasFocus = usePrevious(hasFocus);\n const [showSuccessIcon, setShowSuccessIcon] = useState(false);\n\n useEffect(() => {\n // Hide the success icon after a successful edit, when cell loses focus.\n if (successfulEdit && prevSuccessfulEdit && !hasFocus && prevHasFocus) {\n setShowSuccessIcon(false);\n }\n // Show success icon right after a successful edit, when `successfulEdit` switches to true.\n if (successfulEdit && !prevSuccessfulEdit) {\n setShowSuccessIcon(true);\n }\n }, [hasFocus, successfulEdit, prevHasFocus, prevSuccessfulEdit]);\n\n const { tabIndex: editActivateTabIndex } = useSingleTabStopNavigation(editActivateRef);\n\n return (\n <TableTdElement\n {...rest}\n nativeAttributes={tdNativeAttributes as TableTdElementProps['nativeAttributes']}\n className={clsx(\n className,\n styles['body-cell-editable'],\n interactiveCell && styles['body-cell-interactive'],\n isEditing && styles['body-cell-edit-active'],\n showSuccessIcon && showIcon && styles['body-cell-has-success'],\n isVisualRefresh && styles['is-visual-refresh']\n )}\n onClick={interactiveCell && !isEditing ? onEditStart : undefined}\n onMouseEnter={() => setHasHover(true)}\n onMouseLeave={() => setHasHover(false)}\n >\n {isEditing ? (\n <InlineEditor\n ariaLabels={ariaLabels}\n column={column}\n item={item}\n onEditEnd={options => {\n setShowSuccessIcon(false);\n isFocusMoveNeededRef.current = options.refocusCell;\n onEditEnd(options.cancelled);\n }}\n submitEdit={submitEdit ?? submitHandlerFallback}\n />\n ) : (\n <>\n {column.cell(item)}\n\n {showSuccessIcon && showIcon && (\n <>\n <span\n className={styles['body-cell-success']}\n aria-label={ariaLabels?.successfulEditLabel?.(column)}\n role=\"img\"\n onMouseDown={e => {\n // Prevent the editor's Button blur event to be fired when clicking the success icon.\n // This prevents unfocusing the button and triggers the `TableTdElement` onClick event which initiates the edit mode.\n e.preventDefault();\n }}\n >\n <Icon name=\"status-positive\" variant=\"success\" />\n </span>\n <LiveRegion>\n {i18n('ariaLabels.successfulEditLabel', ariaLabels?.successfulEditLabel?.(column))}\n </LiveRegion>\n </>\n )}\n\n <div className={styles['body-cell-editor-wrapper']}>\n <button\n className={styles['body-cell-editor']}\n aria-label={ariaLabels?.activateEditLabel?.(column, item)}\n ref={editActivateRef}\n onClick={!interactiveCell && !isEditing ? onEditStart : undefined}\n onFocus={() => setHasFocus(true)}\n onBlur={() => setHasFocus(false)}\n tabIndex={editActivateTabIndex}\n >\n {showIcon && <Icon name=\"edit\" />}\n </button>\n </div>\n </>\n )}\n </TableTdElement>\n );\n}\n\nexport function TableBodyCell<ItemType>({\n isEditable,\n ...rest\n}: TableBodyCellProps<ItemType> & { isEditable: boolean }) {\n const isExpandableColumnCell = rest.level !== undefined;\n const editDisabledReason = rest.column.editConfig?.disabledReason?.(rest.item);\n\n // Inline editing is deactivated for expandable column because editable cells are interactive\n // and cannot include interactive content such as expand toggles.\n if (editDisabledReason && !isExpandableColumnCell) {\n return <DisabledInlineEditor editDisabledReason={editDisabledReason} {...rest} />;\n }\n if ((isEditable || rest.isEditing) && !isExpandableColumnCell) {\n return <TableCellEditable {...rest} />;\n }\n\n const { column, item } = rest;\n return <TableTdElement {...rest}>{column.cell(item)}</TableTdElement>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,qBAAqB,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,UAAU,MAAM,gDAAgD,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;AAClF,CAAC,CAAC;AAeF,SAAS,iBAAiB,CAAW,EAcN;;QAdM,EACnC,SAAS,EACT,IAAI,EACJ,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,GAAG,KAAK,EACxB,cA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6C,EADpD,IAAI,cAF+B,cAGvC,CADQ;IAEP,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IACxD,MAAM,kBAAkB,GAAG,MAAA,MAAA,IAAI,CAAC,MAAM,CAAC,UAAU,0CAAE,cAAc,mDAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/E,6FAA6F;IAC7F,iEAAiE;IACjE,IAAI,kBAAkB,IAAI,CAAC,sBAAsB,EAAE;QACjD,OAAO,oBAAC,oBAAoB,kBAAC,kBAAkB,EAAE,kBAAkB,IAAM,IAAI,EAAI,CAAC;KACnF;IACD,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,EAAE;QAC7D,OAAO,oBAAC,iBAAiB,oBAAK,IAAI,EAAI,CAAC;KACxC;IAED,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC9B,OAAO,oBAAC,cAAc,oBAAK,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAkB,CAAC;AACxE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport React, { useEffect, useRef, useState } from 'react';\nimport Icon from '../../icon/internal';\nimport { TableProps } from '../interfaces';\nimport { TableTdElement, TableTdElementProps } from './td-element';\nimport { InlineEditor } from './inline-editor';\nimport LiveRegion from '../../internal/components/live-region/index.js';\nimport { useInternalI18n } from '../../i18n/context';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context.js';\nimport { DisabledInlineEditor } from './disabled-inline-editor';\n\nconst submitHandlerFallback = () => {\n throw new Error('The function `handleSubmit` is required for editable columns');\n};\n\nexport interface TableBodyCellProps<ItemType> extends TableTdElementProps {\n column: TableProps.ColumnDefinition<ItemType>;\n item: ItemType;\n isEditing: boolean;\n resizableColumns?: boolean;\n successfulEdit?: boolean;\n onEditStart: () => void;\n onEditEnd: (cancelled: boolean) => void;\n submitEdit?: TableProps.SubmitEditFunction<ItemType>;\n ariaLabels: TableProps['ariaLabels'];\n interactiveCell?: boolean;\n}\n\nfunction TableCellEditable<ItemType>({\n className,\n item,\n column,\n isEditing,\n onEditStart,\n onEditEnd,\n submitEdit,\n ariaLabels,\n isVisualRefresh,\n resizableColumns = false,\n successfulEdit = false,\n interactiveCell = true,\n ...rest\n}: TableBodyCellProps<ItemType>) {\n const i18n = useInternalI18n('table');\n const editActivateRef = useRef<HTMLButtonElement>(null);\n const tdNativeAttributes = {\n 'data-inline-editing-active': isEditing.toString(),\n };\n const isFocusMoveNeededRef = useRef(false);\n\n useEffect(() => {\n if (!isEditing && editActivateRef.current && isFocusMoveNeededRef.current) {\n isFocusMoveNeededRef.current = false;\n editActivateRef.current.focus();\n }\n }, [isEditing]);\n // To improve the initial page render performance we only show the edit icon when necessary.\n const [hasHover, setHasHover] = useState(false);\n const [hasFocus, setHasFocus] = useState(false);\n // When a cell is both expandable and editable the icon is always shown.\n const showIcon = hasHover || hasFocus || !interactiveCell;\n\n const prevSuccessfulEdit = usePrevious(successfulEdit);\n const prevHasFocus = usePrevious(hasFocus);\n const [showSuccessIcon, setShowSuccessIcon] = useState(false);\n\n useEffect(() => {\n // Hide the success icon after a successful edit, when cell loses focus.\n if (successfulEdit && prevSuccessfulEdit && !hasFocus && prevHasFocus) {\n setShowSuccessIcon(false);\n }\n // Show success icon right after a successful edit, when `successfulEdit` switches to true.\n if (successfulEdit && !prevSuccessfulEdit) {\n setShowSuccessIcon(true);\n }\n }, [hasFocus, successfulEdit, prevHasFocus, prevSuccessfulEdit]);\n\n const { tabIndex: editActivateTabIndex } = useSingleTabStopNavigation(editActivateRef);\n\n return (\n <TableTdElement\n {...rest}\n nativeAttributes={tdNativeAttributes as TableTdElementProps['nativeAttributes']}\n className={clsx(\n className,\n styles['body-cell-editable'],\n interactiveCell && styles['body-cell-interactive'],\n resizableColumns && styles['resizable-columns'],\n isEditing && styles['body-cell-edit-active'],\n showSuccessIcon && showIcon && styles['body-cell-has-success'],\n isVisualRefresh && styles['is-visual-refresh']\n )}\n onClick={interactiveCell && !isEditing ? onEditStart : undefined}\n onMouseEnter={() => setHasHover(true)}\n onMouseLeave={() => setHasHover(false)}\n >\n {isEditing ? (\n <InlineEditor\n ariaLabels={ariaLabels}\n column={column}\n item={item}\n onEditEnd={options => {\n setShowSuccessIcon(false);\n isFocusMoveNeededRef.current = options.refocusCell;\n onEditEnd(options.cancelled);\n }}\n submitEdit={submitEdit ?? submitHandlerFallback}\n />\n ) : (\n <>\n {column.cell(item)}\n\n {showSuccessIcon && showIcon && (\n <>\n <span\n className={styles['body-cell-success']}\n aria-label={ariaLabels?.successfulEditLabel?.(column)}\n role=\"img\"\n onMouseDown={e => {\n // Prevent the editor's Button blur event to be fired when clicking the success icon.\n // This prevents unfocusing the button and triggers the `TableTdElement` onClick event which initiates the edit mode.\n e.preventDefault();\n }}\n >\n <Icon name=\"status-positive\" variant=\"success\" />\n </span>\n <LiveRegion>\n {i18n('ariaLabels.successfulEditLabel', ariaLabels?.successfulEditLabel?.(column))}\n </LiveRegion>\n </>\n )}\n\n <div className={styles['body-cell-editor-wrapper']}>\n <button\n className={styles['body-cell-editor']}\n aria-label={ariaLabels?.activateEditLabel?.(column, item)}\n ref={editActivateRef}\n onClick={!interactiveCell && !isEditing ? onEditStart : undefined}\n onFocus={() => setHasFocus(true)}\n onBlur={() => setHasFocus(false)}\n tabIndex={editActivateTabIndex}\n >\n {showIcon && <Icon name=\"edit\" />}\n </button>\n </div>\n </>\n )}\n </TableTdElement>\n );\n}\n\nexport function TableBodyCell<ItemType>({\n isEditable,\n ...rest\n}: TableBodyCellProps<ItemType> & { isEditable: boolean }) {\n const isExpandableColumnCell = rest.level !== undefined;\n const editDisabledReason = rest.column.editConfig?.disabledReason?.(rest.item);\n\n // Inline editing is deactivated for expandable column because editable cells are interactive\n // and cannot include interactive content such as expand toggles.\n if (editDisabledReason && !isExpandableColumnCell) {\n return <DisabledInlineEditor editDisabledReason={editDisabledReason} {...rest} />;\n }\n if ((isEditable || rest.isEditing) && !isExpandableColumnCell) {\n return <TableCellEditable {...rest} />;\n }\n\n const { column, item } = rest;\n return <TableTdElement {...rest}>{column.cell(item)}</TableTdElement>;\n}\n"]}
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"expandable-toggle-wrapper": "awsui_expandable-toggle-
|
|
5
|
-
"body-cell": "awsui_body-
|
|
6
|
-
"body-cell-content": "awsui_body-cell-
|
|
7
|
-
"body-cell-wrap": "awsui_body-cell-
|
|
8
|
-
"is-visual-refresh": "awsui_is-visual-
|
|
9
|
-
"has-striped-rows": "awsui_has-striped-
|
|
10
|
-
"body-cell-expandable-level-1": "awsui_body-cell-expandable-level-
|
|
11
|
-
"body-cell-expandable-level-2": "awsui_body-cell-expandable-level-
|
|
12
|
-
"body-cell-expandable-level-3": "awsui_body-cell-expandable-level-
|
|
13
|
-
"body-cell-expandable-level-4": "awsui_body-cell-expandable-level-
|
|
14
|
-
"body-cell-expandable-level-5": "awsui_body-cell-expandable-level-
|
|
15
|
-
"body-cell-expandable-level-6": "awsui_body-cell-expandable-level-
|
|
16
|
-
"body-cell-expandable-level-7": "awsui_body-cell-expandable-level-
|
|
17
|
-
"body-cell-expandable-level-8": "awsui_body-cell-expandable-level-
|
|
18
|
-
"body-cell-expandable-level-9": "awsui_body-cell-expandable-level-
|
|
19
|
-
"body-cell-expandable-level-next": "awsui_body-cell-expandable-level-
|
|
20
|
-
"body-cell-edit-active": "awsui_body-cell-edit-
|
|
21
|
-
"body-cell-interactive": "awsui_body-cell-
|
|
22
|
-
"body-cell-editable": "awsui_body-cell-
|
|
23
|
-
"has-striped-rows-sticky-cell-pad-inline-start": "awsui_has-striped-rows-sticky-cell-pad-inline-
|
|
24
|
-
"has-selection": "awsui_has-
|
|
25
|
-
"body-cell-first-row": "awsui_body-cell-first-
|
|
26
|
-
"body-cell-last-row": "awsui_body-cell-last-
|
|
27
|
-
"body-cell-selected": "awsui_body-cell-
|
|
28
|
-
"has-footer": "awsui_has-
|
|
29
|
-
"body-cell-shaded": "awsui_body-cell-
|
|
30
|
-
"sticky-cell": "awsui_sticky-
|
|
31
|
-
"sticky-cell-pad-left": "awsui_sticky-cell-pad-
|
|
32
|
-
"sticky-cell-last-inline-end": "awsui_sticky-cell-last-inline-
|
|
33
|
-
"sticky-cell-last-inline-start": "awsui_sticky-cell-last-inline-
|
|
34
|
-
"body-cell-next-selected": "awsui_body-cell-next-
|
|
35
|
-
"body-cell-prev-selected": "awsui_body-cell-prev-
|
|
36
|
-
"body-cell-editor-wrapper": "awsui_body-cell-editor-
|
|
37
|
-
"body-cell-success": "awsui_body-cell-
|
|
38
|
-
"body-cell-editor": "awsui_body-cell-
|
|
39
|
-
"body-cell-editor-disabled": "awsui_body-cell-editor-
|
|
40
|
-
"body-cell-editor-form": "awsui_body-cell-editor-
|
|
41
|
-
"body-cell-editor-row": "awsui_body-cell-editor-
|
|
42
|
-
"body-cell-editor-controls": "awsui_body-cell-editor-
|
|
43
|
-
"body-cell-expandable": "awsui_body-cell-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"body-cell-
|
|
4
|
+
"expandable-toggle-wrapper": "awsui_expandable-toggle-wrapper_c6tup_1mo0y_99",
|
|
5
|
+
"body-cell": "awsui_body-cell_c6tup_1mo0y_107",
|
|
6
|
+
"body-cell-content": "awsui_body-cell-content_c6tup_1mo0y_121",
|
|
7
|
+
"body-cell-wrap": "awsui_body-cell-wrap_c6tup_1mo0y_124",
|
|
8
|
+
"is-visual-refresh": "awsui_is-visual-refresh_c6tup_1mo0y_136",
|
|
9
|
+
"has-striped-rows": "awsui_has-striped-rows_c6tup_1mo0y_148",
|
|
10
|
+
"body-cell-expandable-level-1": "awsui_body-cell-expandable-level-1_c6tup_1mo0y_151",
|
|
11
|
+
"body-cell-expandable-level-2": "awsui_body-cell-expandable-level-2_c6tup_1mo0y_154",
|
|
12
|
+
"body-cell-expandable-level-3": "awsui_body-cell-expandable-level-3_c6tup_1mo0y_157",
|
|
13
|
+
"body-cell-expandable-level-4": "awsui_body-cell-expandable-level-4_c6tup_1mo0y_160",
|
|
14
|
+
"body-cell-expandable-level-5": "awsui_body-cell-expandable-level-5_c6tup_1mo0y_163",
|
|
15
|
+
"body-cell-expandable-level-6": "awsui_body-cell-expandable-level-6_c6tup_1mo0y_166",
|
|
16
|
+
"body-cell-expandable-level-7": "awsui_body-cell-expandable-level-7_c6tup_1mo0y_169",
|
|
17
|
+
"body-cell-expandable-level-8": "awsui_body-cell-expandable-level-8_c6tup_1mo0y_172",
|
|
18
|
+
"body-cell-expandable-level-9": "awsui_body-cell-expandable-level-9_c6tup_1mo0y_175",
|
|
19
|
+
"body-cell-expandable-level-next": "awsui_body-cell-expandable-level-next_c6tup_1mo0y_178",
|
|
20
|
+
"body-cell-edit-active": "awsui_body-cell-edit-active_c6tup_1mo0y_181",
|
|
21
|
+
"body-cell-interactive": "awsui_body-cell-interactive_c6tup_1mo0y_181",
|
|
22
|
+
"body-cell-editable": "awsui_body-cell-editable_c6tup_1mo0y_181",
|
|
23
|
+
"has-striped-rows-sticky-cell-pad-inline-start": "awsui_has-striped-rows-sticky-cell-pad-inline-start_c6tup_1mo0y_247",
|
|
24
|
+
"has-selection": "awsui_has-selection_c6tup_1mo0y_280",
|
|
25
|
+
"body-cell-first-row": "awsui_body-cell-first-row_c6tup_1mo0y_316",
|
|
26
|
+
"body-cell-last-row": "awsui_body-cell-last-row_c6tup_1mo0y_319",
|
|
27
|
+
"body-cell-selected": "awsui_body-cell-selected_c6tup_1mo0y_319",
|
|
28
|
+
"has-footer": "awsui_has-footer_c6tup_1mo0y_319",
|
|
29
|
+
"body-cell-shaded": "awsui_body-cell-shaded_c6tup_1mo0y_329",
|
|
30
|
+
"sticky-cell": "awsui_sticky-cell_c6tup_1mo0y_355",
|
|
31
|
+
"sticky-cell-pad-left": "awsui_sticky-cell-pad-left_c6tup_1mo0y_363",
|
|
32
|
+
"sticky-cell-last-inline-end": "awsui_sticky-cell-last-inline-end_c6tup_1mo0y_410",
|
|
33
|
+
"sticky-cell-last-inline-start": "awsui_sticky-cell-last-inline-start_c6tup_1mo0y_418",
|
|
34
|
+
"body-cell-next-selected": "awsui_body-cell-next-selected_c6tup_1mo0y_449",
|
|
35
|
+
"body-cell-prev-selected": "awsui_body-cell-prev-selected_c6tup_1mo0y_453",
|
|
36
|
+
"body-cell-editor-wrapper": "awsui_body-cell-editor-wrapper_c6tup_1mo0y_477",
|
|
37
|
+
"body-cell-success": "awsui_body-cell-success_c6tup_1mo0y_484",
|
|
38
|
+
"body-cell-editor": "awsui_body-cell-editor_c6tup_1mo0y_477",
|
|
39
|
+
"body-cell-editor-disabled": "awsui_body-cell-editor-disabled_c6tup_1mo0y_511",
|
|
40
|
+
"body-cell-editor-form": "awsui_body-cell-editor-form_c6tup_1mo0y_520",
|
|
41
|
+
"body-cell-editor-row": "awsui_body-cell-editor-row_c6tup_1mo0y_530",
|
|
42
|
+
"body-cell-editor-controls": "awsui_body-cell-editor-controls_c6tup_1mo0y_540",
|
|
43
|
+
"body-cell-expandable": "awsui_body-cell-expandable_c6tup_1mo0y_151",
|
|
44
|
+
"resizable-columns": "awsui_resizable-columns_c6tup_1mo0y_564",
|
|
45
|
+
"expandable-cell-content": "awsui_expandable-cell-content_c6tup_1mo0y_567",
|
|
46
|
+
"body-cell-edit-disabled-popover": "awsui_body-cell-edit-disabled-popover_c6tup_1mo0y_615",
|
|
47
|
+
"body-cell-has-success": "awsui_body-cell-has-success_c6tup_1mo0y_618"
|
|
47
48
|
};
|
|
48
49
|
|