@cloudscape-design/components 3.0.278 → 3.0.279

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 (65) hide show
  1. package/collection-preferences/content-display/styles.css.js +11 -11
  2. package/collection-preferences/content-display/styles.scoped.css +17 -18
  3. package/collection-preferences/content-display/styles.selectors.js +11 -11
  4. package/collection-preferences/index.d.ts +1 -1
  5. package/collection-preferences/index.d.ts.map +1 -1
  6. package/collection-preferences/index.js +6 -4
  7. package/collection-preferences/index.js.map +1 -1
  8. package/collection-preferences/interfaces.d.ts +42 -12
  9. package/collection-preferences/interfaces.d.ts.map +1 -1
  10. package/collection-preferences/interfaces.js.map +1 -1
  11. package/collection-preferences/styles.css.js +37 -32
  12. package/collection-preferences/styles.scoped.css +44 -40
  13. package/collection-preferences/styles.selectors.js +37 -32
  14. package/collection-preferences/utils.d.ts +12 -1
  15. package/collection-preferences/utils.d.ts.map +1 -1
  16. package/collection-preferences/utils.js +15 -1
  17. package/collection-preferences/utils.js.map +1 -1
  18. package/internal/base-component/styles.scoped.css +8 -0
  19. package/internal/environment.js +1 -1
  20. package/internal/manifest.json +1 -1
  21. package/package.json +1 -1
  22. package/table/body-cell/styles.css.js +28 -23
  23. package/table/body-cell/styles.scoped.css +111 -55
  24. package/table/body-cell/styles.selectors.js +28 -23
  25. package/table/body-cell/td-element.d.ts +3 -0
  26. package/table/body-cell/td-element.d.ts.map +1 -1
  27. package/table/body-cell/td-element.js +16 -2
  28. package/table/body-cell/td-element.js.map +1 -1
  29. package/table/header-cell/index.d.ts +4 -1
  30. package/table/header-cell/index.d.ts.map +1 -1
  31. package/table/header-cell/index.js +9 -2
  32. package/table/header-cell/index.js.map +1 -1
  33. package/table/header-cell/styles.css.js +24 -19
  34. package/table/header-cell/styles.scoped.css +67 -32
  35. package/table/header-cell/styles.selectors.js +24 -19
  36. package/table/interfaces.d.ts +14 -0
  37. package/table/interfaces.d.ts.map +1 -1
  38. package/table/interfaces.js.map +1 -1
  39. package/table/internal.d.ts.map +1 -1
  40. package/table/internal.js +19 -6
  41. package/table/internal.js.map +1 -1
  42. package/table/thead.d.ts +2 -0
  43. package/table/thead.d.ts.map +1 -1
  44. package/table/thead.js +12 -4
  45. package/table/thead.js.map +1 -1
  46. package/table/use-sticky-columns.d.ts.map +1 -1
  47. package/table/use-sticky-columns.js +5 -1
  48. package/table/use-sticky-columns.js.map +1 -1
  49. package/table/utils.d.ts +4 -0
  50. package/table/utils.d.ts.map +1 -1
  51. package/table/utils.js +8 -0
  52. package/table/utils.js.map +1 -1
  53. package/test-utils/dom/collection-preferences/index.d.ts +2 -0
  54. package/test-utils/dom/collection-preferences/index.js +6 -1
  55. package/test-utils/dom/collection-preferences/index.js.map +1 -1
  56. package/test-utils/dom/collection-preferences/sticky-columns-preference.d.ts +9 -0
  57. package/test-utils/dom/collection-preferences/sticky-columns-preference.js +23 -0
  58. package/test-utils/dom/collection-preferences/sticky-columns-preference.js.map +1 -0
  59. package/test-utils/selectors/collection-preferences/index.d.ts +2 -0
  60. package/test-utils/selectors/collection-preferences/index.js +6 -1
  61. package/test-utils/selectors/collection-preferences/index.js.map +1 -1
  62. package/test-utils/selectors/collection-preferences/sticky-columns-preference.d.ts +9 -0
  63. package/test-utils/selectors/collection-preferences/sticky-columns-preference.js +23 -0
  64. package/test-utils/selectors/collection-preferences/sticky-columns-preference.js.map +1 -0
  65. package/test-utils/tsconfig.tsbuildinfo +1 -1
@@ -1,24 +1,29 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "header-cell": "awsui_header-cell_1spae_12dot_93",
5
- "header-cell-sticky": "awsui_header-cell-sticky_1spae_12dot_105",
6
- "header-cell-stuck": "awsui_header-cell-stuck_1spae_12dot_108",
7
- "header-cell-variant-full-page": "awsui_header-cell-variant-full-page_1spae_12dot_108",
8
- "header-cell-hidden": "awsui_header-cell-hidden_1spae_12dot_111",
9
- "header-cell-sortable": "awsui_header-cell-sortable_1spae_12dot_114",
10
- "header-cell-resizable": "awsui_header-cell-resizable_1spae_12dot_129",
11
- "sorting-icon": "awsui_sorting-icon_1spae_12dot_133",
12
- "edit-icon": "awsui_edit-icon_1spae_12dot_141",
13
- "header-cell-content": "awsui_header-cell-content_1spae_12dot_147",
14
- "header-cell-fake-focus": "awsui_header-cell-fake-focus_1spae_12dot_176",
15
- "header-cell-disabled": "awsui_header-cell-disabled_1spae_12dot_194",
16
- "header-cell-sorted": "awsui_header-cell-sorted_1spae_12dot_194",
17
- "header-cell-text": "awsui_header-cell-text_1spae_12dot_208",
18
- "header-cell-text-wrap": "awsui_header-cell-text-wrap_1spae_12dot_213",
19
- "header-cell-ascending": "awsui_header-cell-ascending_1spae_12dot_219",
20
- "header-cell-descending": "awsui_header-cell-descending_1spae_12dot_220",
21
- "is-visual-refresh": "awsui_is-visual-refresh_1spae_12dot_230",
22
- "has-striped-rows": "awsui_has-striped-rows_1spae_12dot_241"
4
+ "header-cell": "awsui_header-cell_1spae_9syim_93",
5
+ "header-cell-sticky": "awsui_header-cell-sticky_1spae_9syim_105",
6
+ "header-cell-stuck": "awsui_header-cell-stuck_1spae_9syim_108",
7
+ "header-cell-variant-full-page": "awsui_header-cell-variant-full-page_1spae_9syim_108",
8
+ "header-cell-hidden": "awsui_header-cell-hidden_1spae_9syim_111",
9
+ "header-cell-sortable": "awsui_header-cell-sortable_1spae_9syim_114",
10
+ "sticky-cell": "awsui_sticky-cell_1spae_9syim_117",
11
+ "sticky-cell-pad-left": "awsui_sticky-cell-pad-left_1spae_9syim_125",
12
+ "has-selection": "awsui_has-selection_1spae_9syim_125",
13
+ "sticky-cell-last-left": "awsui_sticky-cell-last-left_1spae_9syim_128",
14
+ "header-cell-resizable": "awsui_header-cell-resizable_1spae_9syim_132",
15
+ "sticky-cell-last-right": "awsui_sticky-cell-last-right_1spae_9syim_135",
16
+ "sorting-icon": "awsui_sorting-icon_1spae_9syim_165",
17
+ "edit-icon": "awsui_edit-icon_1spae_9syim_173",
18
+ "header-cell-content": "awsui_header-cell-content_1spae_9syim_179",
19
+ "header-cell-fake-focus": "awsui_header-cell-fake-focus_1spae_9syim_208",
20
+ "header-cell-disabled": "awsui_header-cell-disabled_1spae_9syim_226",
21
+ "header-cell-sorted": "awsui_header-cell-sorted_1spae_9syim_226",
22
+ "header-cell-text": "awsui_header-cell-text_1spae_9syim_240",
23
+ "header-cell-text-wrap": "awsui_header-cell-text-wrap_1spae_9syim_245",
24
+ "header-cell-ascending": "awsui_header-cell-ascending_1spae_9syim_251",
25
+ "header-cell-descending": "awsui_header-cell-descending_1spae_9syim_252",
26
+ "is-visual-refresh": "awsui_is-visual-refresh_1spae_9syim_262",
27
+ "has-striped-rows": "awsui_has-striped-rows_1spae_9syim_273"
23
28
  };
24
29
 
@@ -90,7 +90,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
90
90
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
- .awsui_header-cell_1spae_12dot_93:not(#\9) {
93
+ .awsui_header-cell_1spae_9syim_93:not(#\9) {
94
94
  position: relative;
95
95
  text-align: left;
96
96
  box-sizing: border-box;
@@ -102,19 +102,51 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
102
102
  -moz-osx-font-smoothing: var(--font-smoothing-moz-osx-nkh1jb, grayscale);
103
103
  padding: var(--space-scaled-xxs-95dhkm, 4px) var(--space-scaled-xs-6859qs, 8px);
104
104
  }
105
- .awsui_header-cell-sticky_1spae_12dot_105:not(#\9) {
105
+ .awsui_header-cell-sticky_1spae_9syim_105:not(#\9) {
106
106
  border-bottom: var(--border-table-sticky-width-h1tlxy, 2px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
107
107
  }
108
- .awsui_header-cell-stuck_1spae_12dot_108:not(#\9):not(.awsui_header-cell-variant-full-page_1spae_12dot_108) {
108
+ .awsui_header-cell-stuck_1spae_9syim_108:not(#\9):not(.awsui_header-cell-variant-full-page_1spae_9syim_108) {
109
109
  border-bottom-color: transparent;
110
110
  }
111
- .awsui_header-cell-variant-full-page_1spae_12dot_108.awsui_header-cell-hidden_1spae_12dot_111:not(#\9) {
111
+ .awsui_header-cell-variant-full-page_1spae_9syim_108.awsui_header-cell-hidden_1spae_9syim_111:not(#\9) {
112
112
  border-bottom-color: transparent;
113
113
  }
114
- .awsui_header-cell_1spae_12dot_93:not(#\9):last-child, .awsui_header-cell_1spae_12dot_93.awsui_header-cell-sortable_1spae_12dot_114:not(#\9) {
114
+ .awsui_header-cell_1spae_9syim_93:not(#\9):last-child, .awsui_header-cell_1spae_9syim_93.awsui_header-cell-sortable_1spae_9syim_114:not(#\9) {
115
115
  padding-right: var(--space-xs-rsr2qu, 8px);
116
116
  }
117
- .awsui_header-cell_1spae_12dot_93:not(#\9):not(:last-child):before {
117
+ .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell_1spae_9syim_117:not(#\9) {
118
+ position: sticky;
119
+ background: var(--color-background-table-header-i1pa1g, #ffffff);
120
+ z-index: 798;
121
+ transition-property: padding;
122
+ transition-duration: var(--motion-duration-transition-show-quick-w3nd9c, 90ms);
123
+ transition-timing-function: var(--motion-easing-sticky-yt83ho, cubic-bezier(1, 0, 0.83, 1));
124
+ }
125
+ .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell-pad-left_1spae_9syim_125:not(#\9):not(.awsui_has-selection_1spae_9syim_125) {
126
+ padding-left: var(--space-table-horizontal-mj7h0h, 20px);
127
+ }
128
+ .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell-last-left_1spae_9syim_128:not(#\9) {
129
+ box-shadow: var(--shadow-sticky-column-first-h2plme, 4px 0px 20px 1px rgba(0, 7, 22, 0.1));
130
+ clip-path: inset(0px -24px 0px 0px);
131
+ }
132
+ .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell-last-left_1spae_9syim_128:not(#\9):not(.awsui_header-cell-resizable_1spae_9syim_132):before {
133
+ display: none;
134
+ }
135
+ .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell-last-right_1spae_9syim_135:not(#\9) {
136
+ box-shadow: var(--shadow-sticky-column-last-s13kkz, -4px 0 20px 1px rgba(0, 28, 36, 0.1));
137
+ clip-path: inset(0 0 0 -24px);
138
+ }
139
+ @media (prefers-reduced-motion: reduce) {
140
+ .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell_1spae_9syim_117:not(#\9) {
141
+ animation: none;
142
+ transition: none;
143
+ }
144
+ }
145
+ .awsui-motion-disabled .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell_1spae_9syim_117:not(#\9), .awsui-mode-entering .awsui_header-cell_1spae_9syim_93.awsui_sticky-cell_1spae_9syim_117:not(#\9) {
146
+ animation: none;
147
+ transition: none;
148
+ }
149
+ .awsui_header-cell_1spae_9syim_93:not(#\9):not(:last-child):before {
118
150
  content: "";
119
151
  position: absolute;
120
152
  right: 0;
@@ -126,11 +158,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
126
158
  border-left: var(--border-divider-section-width-4wm2it, 2px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
127
159
  box-sizing: border-box;
128
160
  }
129
- .awsui_header-cell-resizable_1spae_12dot_129:not(#\9):not(:last-child):before {
161
+ .awsui_header-cell-resizable_1spae_9syim_132:not(#\9):not(:last-child):before {
130
162
  border-left-color: var(--color-border-divider-interactive-default-4pf6ra, #7d8998);
131
163
  }
132
164
 
133
- .awsui_sorting-icon_1spae_12dot_133:not(#\9) {
165
+ .awsui_sorting-icon_1spae_9syim_165:not(#\9) {
134
166
  position: absolute;
135
167
  top: 50%;
136
168
  transform: translateY(-50%);
@@ -138,31 +170,31 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
138
170
  color: var(--color-text-column-sorting-icon-q5sr09, #414d5c);
139
171
  }
140
172
 
141
- .awsui_edit-icon_1spae_12dot_141:not(#\9) {
173
+ .awsui_edit-icon_1spae_9syim_173:not(#\9) {
142
174
  margin-left: var(--space-xxs-ynfts5, 4px);
143
175
  margin-top: var(--space-scaled-xxs-95dhkm, 4px);
144
176
  color: inherit;
145
177
  }
146
178
 
147
- .awsui_header-cell-content_1spae_12dot_147:not(#\9) {
179
+ .awsui_header-cell-content_1spae_9syim_179:not(#\9) {
148
180
  position: relative;
149
181
  padding: var(--space-scaled-xxs-95dhkm, 4px) var(--space-s-hv8c1d, 12px);
150
182
  }
151
- .awsui_header-cell-sortable_1spae_12dot_114 > .awsui_header-cell-content_1spae_12dot_147:not(#\9) {
183
+ .awsui_header-cell-sortable_1spae_9syim_114 > .awsui_header-cell-content_1spae_9syim_179:not(#\9) {
152
184
  padding-right: calc(var(--space-xl-a39hup, 24px) + var(--space-xxs-ynfts5, 4px));
153
185
  }
154
- .awsui_header-cell-content_1spae_12dot_147:not(#\9):focus {
186
+ .awsui_header-cell-content_1spae_9syim_179:not(#\9):focus {
155
187
  outline: none;
156
188
  text-decoration: none;
157
189
  }
158
- body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147:not(#\9):focus {
190
+ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_9syim_179:not(#\9):focus {
159
191
  position: relative;
160
192
  }
161
- body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147:not(#\9):focus {
193
+ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_9syim_179:not(#\9):focus {
162
194
  outline: 2px dotted transparent;
163
195
  outline-offset: calc(var(--space-table-header-focus-outline-gutter-rbx7m7, 0px) - 1px);
164
196
  }
165
- body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147:not(#\9):focus::before {
197
+ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_9syim_179:not(#\9):focus::before {
166
198
  content: " ";
167
199
  display: block;
168
200
  position: absolute;
@@ -173,14 +205,14 @@ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147:n
173
205
  border-radius: var(--border-radius-control-default-focus-ring-7661kz, 4px);
174
206
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
175
207
  }
176
- body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147.awsui_header-cell-fake-focus_1spae_12dot_176:not(#\9) {
208
+ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_9syim_179.awsui_header-cell-fake-focus_1spae_9syim_208:not(#\9) {
177
209
  position: relative;
178
210
  }
179
- body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147.awsui_header-cell-fake-focus_1spae_12dot_176:not(#\9) {
211
+ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_9syim_179.awsui_header-cell-fake-focus_1spae_9syim_208:not(#\9) {
180
212
  outline: 2px dotted transparent;
181
213
  outline-offset: calc(var(--space-table-header-focus-outline-gutter-rbx7m7, 0px) - 1px);
182
214
  }
183
- body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147.awsui_header-cell-fake-focus_1spae_12dot_176:not(#\9)::before {
215
+ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_9syim_179.awsui_header-cell-fake-focus_1spae_9syim_208:not(#\9)::before {
184
216
  content: " ";
185
217
  display: block;
186
218
  position: absolute;
@@ -191,33 +223,33 @@ body[data-awsui-focus-visible=true] .awsui_header-cell-content_1spae_12dot_147.a
191
223
  border-radius: var(--border-radius-control-default-focus-ring-7661kz, 4px);
192
224
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
193
225
  }
194
- .awsui_header-cell-disabled_1spae_12dot_194.awsui_header-cell-sorted_1spae_12dot_194 > .awsui_header-cell-content_1spae_12dot_147 > .awsui_sorting-icon_1spae_12dot_133:not(#\9) {
226
+ .awsui_header-cell-disabled_1spae_9syim_226.awsui_header-cell-sorted_1spae_9syim_226 > .awsui_header-cell-content_1spae_9syim_179 > .awsui_sorting-icon_1spae_9syim_165:not(#\9) {
195
227
  color: var(--color-text-interactive-disabled-3pbb07, #9ba7b6);
196
228
  }
197
229
 
198
- .awsui_header-cell-sortable_1spae_12dot_114:not(#\9):not(.awsui_header-cell-disabled_1spae_12dot_194) > .awsui_header-cell-content_1spae_12dot_147 {
230
+ .awsui_header-cell-sortable_1spae_9syim_114:not(#\9):not(.awsui_header-cell-disabled_1spae_9syim_226) > .awsui_header-cell-content_1spae_9syim_179 {
199
231
  cursor: pointer;
200
232
  }
201
- .awsui_header-cell-sortable_1spae_12dot_114:not(#\9):not(.awsui_header-cell-disabled_1spae_12dot_194) > .awsui_header-cell-content_1spae_12dot_147:hover, .awsui_header-cell-sortable_1spae_12dot_114:not(#\9):not(.awsui_header-cell-disabled_1spae_12dot_194).awsui_header-cell-sorted_1spae_12dot_194 > .awsui_header-cell-content_1spae_12dot_147 {
233
+ .awsui_header-cell-sortable_1spae_9syim_114:not(#\9):not(.awsui_header-cell-disabled_1spae_9syim_226) > .awsui_header-cell-content_1spae_9syim_179:hover, .awsui_header-cell-sortable_1spae_9syim_114:not(#\9):not(.awsui_header-cell-disabled_1spae_9syim_226).awsui_header-cell-sorted_1spae_9syim_226 > .awsui_header-cell-content_1spae_9syim_179 {
202
234
  color: var(--color-text-interactive-active-vol84d, #000716);
203
235
  }
204
- .awsui_header-cell-sortable_1spae_12dot_114:not(#\9):not(.awsui_header-cell-disabled_1spae_12dot_194) > .awsui_header-cell-content_1spae_12dot_147:hover > .awsui_sorting-icon_1spae_12dot_133, .awsui_header-cell-sortable_1spae_12dot_114:not(#\9):not(.awsui_header-cell-disabled_1spae_12dot_194).awsui_header-cell-sorted_1spae_12dot_194 > .awsui_header-cell-content_1spae_12dot_147 > .awsui_sorting-icon_1spae_12dot_133 {
236
+ .awsui_header-cell-sortable_1spae_9syim_114:not(#\9):not(.awsui_header-cell-disabled_1spae_9syim_226) > .awsui_header-cell-content_1spae_9syim_179:hover > .awsui_sorting-icon_1spae_9syim_165, .awsui_header-cell-sortable_1spae_9syim_114:not(#\9):not(.awsui_header-cell-disabled_1spae_9syim_226).awsui_header-cell-sorted_1spae_9syim_226 > .awsui_header-cell-content_1spae_9syim_179 > .awsui_sorting-icon_1spae_9syim_165 {
205
237
  color: var(--color-text-interactive-active-vol84d, #000716);
206
238
  }
207
239
 
208
- .awsui_header-cell-text_1spae_12dot_208:not(#\9) {
240
+ .awsui_header-cell-text_1spae_9syim_240:not(#\9) {
209
241
  line-height: var(--font-heading-xs-line-height-5x131j, 18px);
210
242
  padding-top: calc(var(--space-xxxs-k2w98v, 2px) / 2);
211
243
  padding-bottom: calc(var(--space-xxxs-k2w98v, 2px) / 2);
212
244
  }
213
- .awsui_header-cell-text_1spae_12dot_208:not(#\9):not(.awsui_header-cell-text-wrap_1spae_12dot_213) {
245
+ .awsui_header-cell-text_1spae_9syim_240:not(#\9):not(.awsui_header-cell-text-wrap_1spae_9syim_245) {
214
246
  white-space: nowrap;
215
247
  overflow: hidden;
216
248
  text-overflow: ellipsis;
217
249
  }
218
250
 
219
- .awsui_header-cell-ascending_1spae_12dot_219:not(#\9),
220
- .awsui_header-cell-descending_1spae_12dot_220:not(#\9) {
251
+ .awsui_header-cell-ascending_1spae_9syim_251:not(#\9),
252
+ .awsui_header-cell-descending_1spae_9syim_252:not(#\9) {
221
253
  /* used in test-utils */
222
254
  }
223
255
 
@@ -227,26 +259,29 @@ with the left edge of the table as closely as possible. If the
227
259
  last header cell is sortable the sort icon should align with the
228
260
  settings icon in the pagination slot.
229
261
  */
230
- .awsui_header-cell_1spae_12dot_93:not(#\9):not(.awsui_is-visual-refresh_1spae_12dot_230):first-child {
262
+ .awsui_header-cell_1spae_9syim_93:not(#\9):not(.awsui_is-visual-refresh_1spae_9syim_262):first-child {
231
263
  padding-left: var(--space-xs-rsr2qu, 8px);
232
264
  }
233
265
 
234
- .awsui_header-cell_1spae_12dot_93.awsui_is-visual-refresh_1spae_12dot_230:not(#\9) {
266
+ .awsui_header-cell_1spae_9syim_93.awsui_is-visual-refresh_1spae_9syim_262:not(#\9) {
235
267
  /*
236
268
  Striped rows requires additional left padding because the
237
269
  shaded background makes the child content appear too close
238
270
  to the table edge.
239
271
  */
240
272
  }
241
- .awsui_header-cell_1spae_12dot_93.awsui_is-visual-refresh_1spae_12dot_230:not(#\9):first-child:not(.awsui_has-striped-rows_1spae_12dot_241) {
273
+ .awsui_header-cell_1spae_9syim_93.awsui_is-visual-refresh_1spae_9syim_262:not(#\9):first-child:not(.awsui_has-striped-rows_1spae_9syim_273) {
242
274
  padding-left: var(--space-xxxs-k2w98v, 2px);
243
275
  }
244
- .awsui_header-cell_1spae_12dot_93.awsui_is-visual-refresh_1spae_12dot_230:not(#\9):first-child.awsui_has-striped-rows_1spae_12dot_241 {
276
+ .awsui_header-cell_1spae_9syim_93.awsui_is-visual-refresh_1spae_9syim_262:not(#\9):first-child:not(.awsui_has-striped-rows_1spae_9syim_273).awsui_sticky-cell-pad-left_1spae_9syim_125 {
277
+ padding-left: var(--space-table-horizontal-mj7h0h, 20px);
278
+ }
279
+ .awsui_header-cell_1spae_9syim_93.awsui_is-visual-refresh_1spae_9syim_262:not(#\9):first-child.awsui_has-striped-rows_1spae_9syim_273 {
245
280
  padding-left: var(--space-xxs-ynfts5, 4px);
246
281
  }
247
- .awsui_header-cell_1spae_12dot_93.awsui_is-visual-refresh_1spae_12dot_230:not(#\9):first-child > .awsui_header-cell-content_1spae_12dot_147 {
282
+ .awsui_header-cell_1spae_9syim_93.awsui_is-visual-refresh_1spae_9syim_262:not(#\9):first-child > .awsui_header-cell-content_1spae_9syim_179 {
248
283
  padding-left: 0;
249
284
  }
250
- .awsui_header-cell_1spae_12dot_93.awsui_is-visual-refresh_1spae_12dot_230:not(#\9):last-child.awsui_header-cell-sortable_1spae_12dot_114 {
285
+ .awsui_header-cell_1spae_9syim_93.awsui_is-visual-refresh_1spae_9syim_262:not(#\9):last-child.awsui_header-cell-sortable_1spae_9syim_114 {
251
286
  padding-right: var(--space-xxxs-k2w98v, 2px);
252
287
  }
@@ -2,24 +2,29 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "header-cell": "awsui_header-cell_1spae_12dot_93",
6
- "header-cell-sticky": "awsui_header-cell-sticky_1spae_12dot_105",
7
- "header-cell-stuck": "awsui_header-cell-stuck_1spae_12dot_108",
8
- "header-cell-variant-full-page": "awsui_header-cell-variant-full-page_1spae_12dot_108",
9
- "header-cell-hidden": "awsui_header-cell-hidden_1spae_12dot_111",
10
- "header-cell-sortable": "awsui_header-cell-sortable_1spae_12dot_114",
11
- "header-cell-resizable": "awsui_header-cell-resizable_1spae_12dot_129",
12
- "sorting-icon": "awsui_sorting-icon_1spae_12dot_133",
13
- "edit-icon": "awsui_edit-icon_1spae_12dot_141",
14
- "header-cell-content": "awsui_header-cell-content_1spae_12dot_147",
15
- "header-cell-fake-focus": "awsui_header-cell-fake-focus_1spae_12dot_176",
16
- "header-cell-disabled": "awsui_header-cell-disabled_1spae_12dot_194",
17
- "header-cell-sorted": "awsui_header-cell-sorted_1spae_12dot_194",
18
- "header-cell-text": "awsui_header-cell-text_1spae_12dot_208",
19
- "header-cell-text-wrap": "awsui_header-cell-text-wrap_1spae_12dot_213",
20
- "header-cell-ascending": "awsui_header-cell-ascending_1spae_12dot_219",
21
- "header-cell-descending": "awsui_header-cell-descending_1spae_12dot_220",
22
- "is-visual-refresh": "awsui_is-visual-refresh_1spae_12dot_230",
23
- "has-striped-rows": "awsui_has-striped-rows_1spae_12dot_241"
5
+ "header-cell": "awsui_header-cell_1spae_9syim_93",
6
+ "header-cell-sticky": "awsui_header-cell-sticky_1spae_9syim_105",
7
+ "header-cell-stuck": "awsui_header-cell-stuck_1spae_9syim_108",
8
+ "header-cell-variant-full-page": "awsui_header-cell-variant-full-page_1spae_9syim_108",
9
+ "header-cell-hidden": "awsui_header-cell-hidden_1spae_9syim_111",
10
+ "header-cell-sortable": "awsui_header-cell-sortable_1spae_9syim_114",
11
+ "sticky-cell": "awsui_sticky-cell_1spae_9syim_117",
12
+ "sticky-cell-pad-left": "awsui_sticky-cell-pad-left_1spae_9syim_125",
13
+ "has-selection": "awsui_has-selection_1spae_9syim_125",
14
+ "sticky-cell-last-left": "awsui_sticky-cell-last-left_1spae_9syim_128",
15
+ "header-cell-resizable": "awsui_header-cell-resizable_1spae_9syim_132",
16
+ "sticky-cell-last-right": "awsui_sticky-cell-last-right_1spae_9syim_135",
17
+ "sorting-icon": "awsui_sorting-icon_1spae_9syim_165",
18
+ "edit-icon": "awsui_edit-icon_1spae_9syim_173",
19
+ "header-cell-content": "awsui_header-cell-content_1spae_9syim_179",
20
+ "header-cell-fake-focus": "awsui_header-cell-fake-focus_1spae_9syim_208",
21
+ "header-cell-disabled": "awsui_header-cell-disabled_1spae_9syim_226",
22
+ "header-cell-sorted": "awsui_header-cell-sorted_1spae_9syim_226",
23
+ "header-cell-text": "awsui_header-cell-text_1spae_9syim_240",
24
+ "header-cell-text-wrap": "awsui_header-cell-text-wrap_1spae_9syim_245",
25
+ "header-cell-ascending": "awsui_header-cell-ascending_1spae_9syim_251",
26
+ "header-cell-descending": "awsui_header-cell-descending_1spae_9syim_252",
27
+ "is-visual-refresh": "awsui_is-visual-refresh_1spae_9syim_262",
28
+ "has-striped-rows": "awsui_has-striped-rows_1spae_9syim_273"
24
29
  };
25
30
 
@@ -166,6 +166,16 @@ export interface TableProps<T = any> extends BaseComponentProps {
166
166
  * to prevent the user from sorting before items are fully loaded.
167
167
  */
168
168
  sortingDisabled?: boolean;
169
+ /**
170
+ * Specifies the number of first and/or last columns that should be sticky.
171
+ *
172
+ * If the available scrollable space is less than a certain threshold, the feature is deactivated.
173
+ *
174
+ * Use it in conjunction with the sticky columns preference of the
175
+ * [collection preferences](/components/collection-preferences/) component.
176
+ *
177
+ */
178
+ stickyColumns?: TableProps.StickyColumns;
169
179
  /**
170
180
  * Specifies an array that represents the table columns in the order in which they will be displayed, together with their visibility.
171
181
  *
@@ -310,6 +320,10 @@ export declare namespace TableProps {
310
320
  isRowHeader?: boolean;
311
321
  cell(item: ItemType): React.ReactNode;
312
322
  } & SortingColumn<ItemType>;
323
+ interface StickyColumns {
324
+ first?: number;
325
+ last?: number;
326
+ }
313
327
  type SelectionType = 'single' | 'multi';
314
328
  type Variant = 'container' | 'embedded' | 'stacked' | 'full-page';
315
329
  interface SelectionState<T> {
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["table/interfaces.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,uBAAuB,GAAG,UAAU,CAAC,uBAAuB,CAAC;AAYpE,MAAM,WAAW,mBAAmB;IAClC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;KAAE,GAAG,GAAG,CAAC,OAAO,CAAC;CAC9E;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,kBAAkB;IAC7D;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;;OAGG;IACH,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAExB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;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AC;KAC5C;IACD,UAAiB,SAAS;QACxB,MAAM,EAAE,OAAO,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB;IACD,UAAiB,gBAAgB,CAAC,CAAC;QACjC,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,CAAC,CAAC;KACT;IACD,UAAiB,sBAAsB,CAAC,CAAC;QACvC,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,CAAC,CAAC;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB;IAED,UAAiB,wBAAwB;QACvC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;KAC/B;IAED,UAAiB,gBAAgB;QAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,GAAG;QAClB;;;WAGG;QACH,WAAW,IAAI,IAAI,CAAC;QAEpB;;WAEG;QACH,UAAU,CAAC,IAAI,IAAI,CAAC;KACrB;IAED,KAAY,kBAAkB,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,IAAI,CAC9D,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAClC,QAAQ,EAAE,SAAS,KAChB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAE1B,UAAiB,uBAAuB;QACtC,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,OAAO,CAAC;KAClB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["table/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler, CancelableEventHandler } from '../internal/events';\nimport { Optional } from '../internal/types';\nimport ColumnDisplayProperties = TableProps.ColumnDisplayProperties;\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface TableForwardRefType {\n <T>(props: TableProps<T> & { ref?: React.Ref<TableProps.Ref> }): JSX.Element;\n}\n\nexport interface TableProps<T = any> extends BaseComponentProps {\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Footer of the table container.\n */\n footer?: React.ReactNode;\n\n /**\n * Displayed when the `items` property is an empty array. Use it to render an empty or no-match state.\n */\n empty?: React.ReactNode;\n\n /**\n * Specifies the data that's displayed in the table rows. Each item contains the data for one row. The display of a row is handled\n * by the `cell` property of each column definition in the `columnDefinitions` property.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the table in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text that's displayed when the table is in a loading state.\n */\n loadingText?: string;\n\n /**\n * Specifies a property that uniquely identifies an individual item.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used to connect `items` and `selectedItems` values when they reference different objects.\n */\n trackBy?: TableProps.TrackBy<T>;\n\n /**\n * The columns configuration object\n * * `id` (string) - Specifies a unique column identifier. The property is used 1) as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering,\n * and 2) to match entries in the `columnDisplay` property, if defined.\n * * `header` (ReactNode) - Determines the display of the column header.\n * * `cell` ((item) => ReactNode) - Determines the display of a cell's content. You receive the current table row\n * item as an argument.\n * * `width` (string | number) - Specifies the column width. Corresponds to the `width` css-property. If the width is not set,\n * the browser automatically adjusts the column width based on the content. When `resizableColumns` property is\n * set to `true`, additional constraints apply: 1) string values are not allowed, and 2) the last visible column always\n * fills the remaining space of the table so the specified width is ignored.\n * * `minWidth` (string | number) - Specifies the minimum column width. Corresponds to the `min-width` css-property. When\n * `resizableColumns` property is set to `true`, additional constraints apply: 1) string values are not allowed,\n * and 2) the column can't resize below than the specified width (defaults to \"120px\"). We recommend that you set a minimum width\n * of at least 176px for columns that are editable.\n * * `maxWidth` (string | number) - Specifies the maximum column width. Corresponds to the `max-width` css-property.\n * Note that when the `resizableColumns` property is set to `true` this property is ignored.\n * * `ariaLabel` (LabelData => string) - An optional function that's called to provide an `aria-label` for the cell header.\n * It receives the current sorting state of this column, the direction it's sorted in, and an indication of\n * whether the sorting is disabled, as three Boolean values: `sorted`, `descending` and `disabled`.\n * We recommend that you use this for sortable columns to provide more meaningful labels based on the\n * current sorting direction.\n * * `sortingField` (string) - Enables default column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. Provide the name of the property within each item that should be used for sorting by this column.\n * For more complex sorting use `sortingComparator` instead.\n * * `sortingComparator` ((T, T) => number) - Enables custom column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. This property accepts a custom comparator that is used to compare two items.\n * The comparator must implement ascending ordering, and the output is inverted automatically in case of descending order.\n * If present, the `sortingField` property is ignored.\n * * `editConfig` (EditConfig) - Enables inline editing in column when present. The value is used to configure the editing behavior.\n * * * `editConfig.ariaLabel` (string) - Specifies a label for the edit control. Visually hidden but read by screen readers.\n * * * `editConfig.errorIconAriaLabel` (string) - Specifies an ariaLabel for the error icon that is displayed when the validation fails.\n * * * `editConfig.editIconAriaLabel` (string) - Specifies an alternate text for the edit icon used in column header.\n * * * `editConfig.constraintText` (string) - Constraint text that is displayed below the edit control.\n * * * `editConfig.validation` ((item, value) => string) - A function that allows you to validate the value of the edit control.\n * Return a string from the function to display an error message. Return `undefined` (or no return) from the function to indicate that the value is valid.\n * * * `editConfig.editingCell` ((item, cellContext) => ReactNode) - Determines the display of a cell's content when inline editing is active on a cell;\n * You receive the current table row `item` and a `cellContext` object as arguments.\n * The `cellContext` object contains the following properties:\n * * * `cellContext.currentValue` - State to keep track of a value in input fields while editing.\n * * * `cellContext.setValue` - Function to update `currentValue`. This should be called when the value in input field changes.\n * * `isRowHeader` (boolean) - Specifies that cells in this column should be used as row headers.\n */\n columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<T>>;\n /**\n * Specifies the selection type (`'single' | 'multi'`).\n */\n selectionType?: TableProps.SelectionType;\n /**\n * List of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n\n /**\n * Use this slot to add filtering controls to the table.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the table.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the table.\n */\n preferences?: React.ReactNode;\n\n /**\n * Determines whether a given item is disabled. If an item is disabled, the user can't select it.\n */\n isItemDisabled?: TableProps.IsItemDisabled<T>;\n\n /**\n * Specifies if text wraps within table cells. If set to `true`, long text within cells may wrap onto\n * multiple lines instead of being truncated with an ellipsis.\n */\n wrapLines?: boolean;\n\n /**\n * Specifies if table rows alternate being shaded and unshaded. If set to `true`, every other row will be shaded.\n */\n stripedRows?: boolean;\n\n /**\n * Toggles the content density of the table. Defaults to `'comfortable'`.\n */\n contentDensity?: 'comfortable' | 'compact';\n\n /**\n * Specifies if columns can be resized. If set to `true`, users can resize the columns in the table.\n */\n resizableColumns?: boolean;\n\n /**\n * Specifies alternative text for the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Specifies the alternative text for an item.\n * * `allItemsSelectionLabel` ((SelectionState) => string) - Specifies the alternative text for multi-selection column header.\n * * `selectionGroupLabel` (string) - Specifies the alternative text for the whole selection and single-selection column header.\n * It is prefixed to `itemSelectionLabel` and `allItemsSelectionLabel` when they are set.\n * * `tableLabel` (string) - Provides an alternative text for the table. If you use a header for this table, you may reuse the string\n * to provide a caption-like description. For example, tableLabel=Instances will be announced as 'Instances table'.\n * You can use the first argument of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The `itemSelectionLabel` for individual\n * items also receives the corresponding `Item` object. You can use the `selectionGroupLabel` to\n * add a meaningful description to the whole selection.\n *\n * * `activateEditLabel` (EditableColumnDefinition, Item) => string -\n * Specifies an alternative text for the edit button in editable cells.\n * * `cancelEditLabel` (EditableColumnDefinition) => string -\n * Specifies an alternative text for the cancel button in editable cells.\n * * `submitEditLabel` (EditableColumnDefinition) => string -\n * Specifies an alternative text for the submit button in editable cells.\n * * `successfulEditLabel` (EditableColumnDefinition) => string -\n * Specifies an alternative text for the success icon in editable cells. This text is also announced to screen readers.\n * * `submittingEditText` (EditableColumnDefinition) => string -\n * Specifies a text that is announced to screen readers when a cell edit operation is submitted.\n */\n ariaLabels?: TableProps.AriaLabels<T>;\n\n /**\n * Specifies the definition object of the currently sorted column. Make sure you pass an object that's\n * present in the `columnDefinitions` array.\n */\n sortingColumn?: TableProps.SortingColumn<T>;\n /**\n * Specifies whether to use a descending sort order.\n */\n sortingDescending?: boolean;\n /**\n * Specifies if sorting buttons are disabled. For example, use this property\n * to prevent the user from sorting before items are fully loaded.\n */\n sortingDisabled?: boolean;\n\n /**\n * Specifies an array that represents the table columns in the order in which they will be displayed, together with their visibility.\n *\n * If not set, all columns are displayed and the order is dictated by the `columnDefinitions` property.\n *\n * Use it in conjunction with the content display preference of the [collection preferences](/components/collection-preferences/) component.\n */\n columnDisplay?: ReadonlyArray<ColumnDisplayProperties>;\n\n /**\n * Specifies an array containing the `id`s of visible columns. If not set, all columns are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of ids doesn't influence the order in which columns are displayed - this is dictated by the `columnDefinitions` property.\n * */\n visibleColumns?: ReadonlyArray<string>;\n\n /**\n * Fired when the user resizes a table column. The event detail contains an array of column widths in pixels,\n * including the hidden via preferences columns. Use this event to persist the column widths.\n */\n onColumnWidthsChange?: NonCancelableEventHandler<TableProps.ColumnWidthsChangeDetail>;\n\n /**\n * Called when either the column to sort by or the direction of sorting changes upon user interaction.\n * The event detail contains the current sortingColumn and isDescending.\n */\n onSortingChange?: NonCancelableEventHandler<TableProps.SortingState<T>>;\n\n /**\n * Fired when a user interaction triggers a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<TableProps.SelectionChangeDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row. The event detail contains the index of the\n * clicked row and the row object itself. Use this event to define a row click behavior.\n */\n onRowClick?: NonCancelableEventHandler<TableProps.OnRowClickDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row with the right mouse click. The event detail\n * contains the index of the clicked row and the row object itself. Use this event to override\n * the default browser context menu behavior.\n */\n onRowContextMenu?: CancelableEventHandler<TableProps.OnRowContextMenuDetail<T>>;\n\n /**\n * If set to `true`, the table header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n\n /**\n * Specifies a vertical offset (in pixels) for the sticky header. For example, use this if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Specify a table variant with one of the following:\n * * `container` - Use this variant to have the table displayed within a container.\n * * `embedded` - Use this variant within a parent container (such as a modal, expandable\n * section, container or split panel).\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * * `full-page` – Use this variant when the table is the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `embedded`, `stacked`, and `full-page` variants\n */\n variant?: TableProps.Variant;\n\n /**\n * Use this property to inform screen readers how many items there are in a table.\n * It specifies the total count of all items in a table.\n * If there is an unknown total of items in a table, leave this property undefined. */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of items is currently displayed in the table.\n * It specifies the index (1-based) of the first item in the table.\n * If the table has no pagination, leave this property undefined. */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * Requires the properties firstIndex and totalItemsCount to be set correctly.\n */\n renderAriaLive?: (data: TableProps.LiveAnnouncement) => string;\n /**\n * Specifies a function that will be called after user submits an inline edit.\n * Return a promise to keep loading state while the submit request is in progress.\n */\n submitEdit?: TableProps.SubmitEditFunction<T>;\n\n /**\n * Called whenever user cancels an inline edit. Use this function to reset any\n * validation states, or show warning for unsaved changes.\n */\n onEditCancel?: CancelableEventHandler;\n}\n\nexport namespace TableProps {\n export type TrackBy<T> = string | ((item: T) => string);\n\n export interface CellContext<V> {\n currentValue: Optional<V>;\n setValue: (value: V | undefined) => void;\n }\n\n export interface EditConfig<T, V = any> {\n /**\n * Specifies a label for the edit control. Visually hidden but read\n * by screen readers.\n */\n ariaLabel?: string;\n /**\n * Specifies an ariaLabel for the error icon that is displayed when\n * the validation fails.\n */\n errorIconAriaLabel?: string;\n /**\n * Specifies an alternate text for the edit icon used in column header.\n */\n editIconAriaLabel?: string;\n /**\n * Constraint text that is displayed below the edit control.\n */\n constraintText?: string;\n /**\n * A function that allows you to validate the value of the edit control. Return\n * a string from the function to display an error message. Return\n * `undefined` (or no return) from the function to indicate that the value is valid.\n * @param item - The item that is being edited.\n * @param value - The current value of the edit control.\n */\n validation?: (item: T, value: Optional<V>) => Optional<string>;\n\n /**\n * Determines the display of a cell's content when inline edit is active.\n */\n editingCell(item: T, ctx: TableProps.CellContext<any>): React.ReactNode;\n }\n\n export type ColumnDefinition<ItemType> = {\n id?: string;\n header: React.ReactNode;\n ariaLabel?(data: LabelData): string;\n width?: number | string;\n minWidth?: number | string;\n maxWidth?: number | string;\n editConfig?: EditConfig<ItemType>;\n isRowHeader?: boolean;\n cell(item: ItemType): React.ReactNode;\n } & SortingColumn<ItemType>;\n\n export type SelectionType = 'single' | 'multi';\n export type Variant = 'container' | 'embedded' | 'stacked' | 'full-page';\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n export type IsItemDisabled<T> = (item: T) => boolean;\n export interface AriaLabels<T> {\n allItemsSelectionLabel?: (data: TableProps.SelectionState<T>) => string;\n itemSelectionLabel?: (data: TableProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel?: string;\n tableLabel?: string;\n // do not use <T> to prevent overly strict validation on consumer end\n // it works, practically, we are only interested in `id` and `header` properties only\n activateEditLabel?: (column: ColumnDefinition<any>, item: T) => string;\n cancelEditLabel?: (column: ColumnDefinition<any>) => string;\n submitEditLabel?: (column: ColumnDefinition<any>) => string;\n submittingEditText?: (column: ColumnDefinition<any>) => string;\n successfulEditLabel?: (column: ColumnDefinition<any>) => string;\n }\n export interface SortingState<T> {\n isDescending?: boolean;\n sortingColumn: SortingColumn<T>;\n }\n export interface SortingColumn<T> {\n sortingField?: string;\n sortingComparator?: (a: T, b: T) => number;\n }\n export interface LabelData {\n sorted: boolean;\n descending: boolean;\n disabled: boolean;\n }\n export interface OnRowClickDetail<T> {\n rowIndex: number;\n item: T;\n }\n export interface OnRowContextMenuDetail<T> {\n rowIndex: number;\n item: T;\n clientX: number;\n clientY: number;\n }\n\n export interface ColumnWidthsChangeDetail {\n widths: ReadonlyArray<number>;\n }\n\n export interface LiveAnnouncement {\n totalItemsCount?: number;\n firstIndex: number;\n lastIndex: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled and you call this function, the table\n * scroll parent scrolls to reveal the first row of the table.\n */\n scrollToTop(): void;\n\n /**\n * Dismiss an inline edit if currently active.\n */\n cancelEdit?(): void;\n }\n\n export type SubmitEditFunction<ItemType, ValueType = unknown> = (\n item: ItemType,\n column: ColumnDefinition<ItemType>,\n newValue: ValueType\n ) => Promise<void> | void;\n\n export interface ColumnDisplayProperties {\n id: string;\n visible: boolean;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["table/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler, CancelableEventHandler } from '../internal/events';\nimport { Optional } from '../internal/types';\nimport ColumnDisplayProperties = TableProps.ColumnDisplayProperties;\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface TableForwardRefType {\n <T>(props: TableProps<T> & { ref?: React.Ref<TableProps.Ref> }): JSX.Element;\n}\n\nexport interface TableProps<T = any> extends BaseComponentProps {\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Footer of the table container.\n */\n footer?: React.ReactNode;\n\n /**\n * Displayed when the `items` property is an empty array. Use it to render an empty or no-match state.\n */\n empty?: React.ReactNode;\n\n /**\n * Specifies the data that's displayed in the table rows. Each item contains the data for one row. The display of a row is handled\n * by the `cell` property of each column definition in the `columnDefinitions` property.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the table in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text that's displayed when the table is in a loading state.\n */\n loadingText?: string;\n\n /**\n * Specifies a property that uniquely identifies an individual item.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used to connect `items` and `selectedItems` values when they reference different objects.\n */\n trackBy?: TableProps.TrackBy<T>;\n\n /**\n * The columns configuration object\n * * `id` (string) - Specifies a unique column identifier. The property is used 1) as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering,\n * and 2) to match entries in the `columnDisplay` property, if defined.\n * * `header` (ReactNode) - Determines the display of the column header.\n * * `cell` ((item) => ReactNode) - Determines the display of a cell's content. You receive the current table row\n * item as an argument.\n * * `width` (string | number) - Specifies the column width. Corresponds to the `width` css-property. If the width is not set,\n * the browser automatically adjusts the column width based on the content. When `resizableColumns` property is\n * set to `true`, additional constraints apply: 1) string values are not allowed, and 2) the last visible column always\n * fills the remaining space of the table so the specified width is ignored.\n * * `minWidth` (string | number) - Specifies the minimum column width. Corresponds to the `min-width` css-property. When\n * `resizableColumns` property is set to `true`, additional constraints apply: 1) string values are not allowed,\n * and 2) the column can't resize below than the specified width (defaults to \"120px\"). We recommend that you set a minimum width\n * of at least 176px for columns that are editable.\n * * `maxWidth` (string | number) - Specifies the maximum column width. Corresponds to the `max-width` css-property.\n * Note that when the `resizableColumns` property is set to `true` this property is ignored.\n * * `ariaLabel` (LabelData => string) - An optional function that's called to provide an `aria-label` for the cell header.\n * It receives the current sorting state of this column, the direction it's sorted in, and an indication of\n * whether the sorting is disabled, as three Boolean values: `sorted`, `descending` and `disabled`.\n * We recommend that you use this for sortable columns to provide more meaningful labels based on the\n * current sorting direction.\n * * `sortingField` (string) - Enables default column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. Provide the name of the property within each item that should be used for sorting by this column.\n * For more complex sorting use `sortingComparator` instead.\n * * `sortingComparator` ((T, T) => number) - Enables custom column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. This property accepts a custom comparator that is used to compare two items.\n * The comparator must implement ascending ordering, and the output is inverted automatically in case of descending order.\n * If present, the `sortingField` property is ignored.\n * * `editConfig` (EditConfig) - Enables inline editing in column when present. The value is used to configure the editing behavior.\n * * * `editConfig.ariaLabel` (string) - Specifies a label for the edit control. Visually hidden but read by screen readers.\n * * * `editConfig.errorIconAriaLabel` (string) - Specifies an ariaLabel for the error icon that is displayed when the validation fails.\n * * * `editConfig.editIconAriaLabel` (string) - Specifies an alternate text for the edit icon used in column header.\n * * * `editConfig.constraintText` (string) - Constraint text that is displayed below the edit control.\n * * * `editConfig.validation` ((item, value) => string) - A function that allows you to validate the value of the edit control.\n * Return a string from the function to display an error message. Return `undefined` (or no return) from the function to indicate that the value is valid.\n * * * `editConfig.editingCell` ((item, cellContext) => ReactNode) - Determines the display of a cell's content when inline editing is active on a cell;\n * You receive the current table row `item` and a `cellContext` object as arguments.\n * The `cellContext` object contains the following properties:\n * * * `cellContext.currentValue` - State to keep track of a value in input fields while editing.\n * * * `cellContext.setValue` - Function to update `currentValue`. This should be called when the value in input field changes.\n * * `isRowHeader` (boolean) - Specifies that cells in this column should be used as row headers.\n */\n columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<T>>;\n /**\n * Specifies the selection type (`'single' | 'multi'`).\n */\n selectionType?: TableProps.SelectionType;\n /**\n * List of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n\n /**\n * Use this slot to add filtering controls to the table.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the table.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the table.\n */\n preferences?: React.ReactNode;\n\n /**\n * Determines whether a given item is disabled. If an item is disabled, the user can't select it.\n */\n isItemDisabled?: TableProps.IsItemDisabled<T>;\n\n /**\n * Specifies if text wraps within table cells. If set to `true`, long text within cells may wrap onto\n * multiple lines instead of being truncated with an ellipsis.\n */\n wrapLines?: boolean;\n\n /**\n * Specifies if table rows alternate being shaded and unshaded. If set to `true`, every other row will be shaded.\n */\n stripedRows?: boolean;\n\n /**\n * Toggles the content density of the table. Defaults to `'comfortable'`.\n */\n contentDensity?: 'comfortable' | 'compact';\n\n /**\n * Specifies if columns can be resized. If set to `true`, users can resize the columns in the table.\n */\n resizableColumns?: boolean;\n\n /**\n * Specifies alternative text for the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Specifies the alternative text for an item.\n * * `allItemsSelectionLabel` ((SelectionState) => string) - Specifies the alternative text for multi-selection column header.\n * * `selectionGroupLabel` (string) - Specifies the alternative text for the whole selection and single-selection column header.\n * It is prefixed to `itemSelectionLabel` and `allItemsSelectionLabel` when they are set.\n * * `tableLabel` (string) - Provides an alternative text for the table. If you use a header for this table, you may reuse the string\n * to provide a caption-like description. For example, tableLabel=Instances will be announced as 'Instances table'.\n * You can use the first argument of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The `itemSelectionLabel` for individual\n * items also receives the corresponding `Item` object. You can use the `selectionGroupLabel` to\n * add a meaningful description to the whole selection.\n *\n * * `activateEditLabel` (EditableColumnDefinition, Item) => string -\n * Specifies an alternative text for the edit button in editable cells.\n * * `cancelEditLabel` (EditableColumnDefinition) => string -\n * Specifies an alternative text for the cancel button in editable cells.\n * * `submitEditLabel` (EditableColumnDefinition) => string -\n * Specifies an alternative text for the submit button in editable cells.\n * * `successfulEditLabel` (EditableColumnDefinition) => string -\n * Specifies an alternative text for the success icon in editable cells. This text is also announced to screen readers.\n * * `submittingEditText` (EditableColumnDefinition) => string -\n * Specifies a text that is announced to screen readers when a cell edit operation is submitted.\n */\n ariaLabels?: TableProps.AriaLabels<T>;\n\n /**\n * Specifies the definition object of the currently sorted column. Make sure you pass an object that's\n * present in the `columnDefinitions` array.\n */\n sortingColumn?: TableProps.SortingColumn<T>;\n /**\n * Specifies whether to use a descending sort order.\n */\n sortingDescending?: boolean;\n /**\n * Specifies if sorting buttons are disabled. For example, use this property\n * to prevent the user from sorting before items are fully loaded.\n */\n sortingDisabled?: boolean;\n\n /**\n * Specifies the number of first and/or last columns that should be sticky.\n *\n * If the available scrollable space is less than a certain threshold, the feature is deactivated.\n *\n * Use it in conjunction with the sticky columns preference of the\n * [collection preferences](/components/collection-preferences/) component.\n *\n */\n stickyColumns?: TableProps.StickyColumns;\n\n /**\n * Specifies an array that represents the table columns in the order in which they will be displayed, together with their visibility.\n *\n * If not set, all columns are displayed and the order is dictated by the `columnDefinitions` property.\n *\n * Use it in conjunction with the content display preference of the [collection preferences](/components/collection-preferences/) component.\n */\n columnDisplay?: ReadonlyArray<ColumnDisplayProperties>;\n\n /**\n * Specifies an array containing the `id`s of visible columns. If not set, all columns are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of ids doesn't influence the order in which columns are displayed - this is dictated by the `columnDefinitions` property.\n * */\n visibleColumns?: ReadonlyArray<string>;\n\n /**\n * Fired when the user resizes a table column. The event detail contains an array of column widths in pixels,\n * including the hidden via preferences columns. Use this event to persist the column widths.\n */\n onColumnWidthsChange?: NonCancelableEventHandler<TableProps.ColumnWidthsChangeDetail>;\n\n /**\n * Called when either the column to sort by or the direction of sorting changes upon user interaction.\n * The event detail contains the current sortingColumn and isDescending.\n */\n onSortingChange?: NonCancelableEventHandler<TableProps.SortingState<T>>;\n\n /**\n * Fired when a user interaction triggers a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<TableProps.SelectionChangeDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row. The event detail contains the index of the\n * clicked row and the row object itself. Use this event to define a row click behavior.\n */\n onRowClick?: NonCancelableEventHandler<TableProps.OnRowClickDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row with the right mouse click. The event detail\n * contains the index of the clicked row and the row object itself. Use this event to override\n * the default browser context menu behavior.\n */\n onRowContextMenu?: CancelableEventHandler<TableProps.OnRowContextMenuDetail<T>>;\n\n /**\n * If set to `true`, the table header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n\n /**\n * Specifies a vertical offset (in pixels) for the sticky header. For example, use this if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Specify a table variant with one of the following:\n * * `container` - Use this variant to have the table displayed within a container.\n * * `embedded` - Use this variant within a parent container (such as a modal, expandable\n * section, container or split panel).\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * * `full-page` – Use this variant when the table is the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `embedded`, `stacked`, and `full-page` variants\n */\n variant?: TableProps.Variant;\n\n /**\n * Use this property to inform screen readers how many items there are in a table.\n * It specifies the total count of all items in a table.\n * If there is an unknown total of items in a table, leave this property undefined. */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of items is currently displayed in the table.\n * It specifies the index (1-based) of the first item in the table.\n * If the table has no pagination, leave this property undefined. */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * Requires the properties firstIndex and totalItemsCount to be set correctly.\n */\n renderAriaLive?: (data: TableProps.LiveAnnouncement) => string;\n /**\n * Specifies a function that will be called after user submits an inline edit.\n * Return a promise to keep loading state while the submit request is in progress.\n */\n submitEdit?: TableProps.SubmitEditFunction<T>;\n\n /**\n * Called whenever user cancels an inline edit. Use this function to reset any\n * validation states, or show warning for unsaved changes.\n */\n onEditCancel?: CancelableEventHandler;\n}\n\nexport namespace TableProps {\n export type TrackBy<T> = string | ((item: T) => string);\n\n export interface CellContext<V> {\n currentValue: Optional<V>;\n setValue: (value: V | undefined) => void;\n }\n\n export interface EditConfig<T, V = any> {\n /**\n * Specifies a label for the edit control. Visually hidden but read\n * by screen readers.\n */\n ariaLabel?: string;\n /**\n * Specifies an ariaLabel for the error icon that is displayed when\n * the validation fails.\n */\n errorIconAriaLabel?: string;\n /**\n * Specifies an alternate text for the edit icon used in column header.\n */\n editIconAriaLabel?: string;\n /**\n * Constraint text that is displayed below the edit control.\n */\n constraintText?: string;\n /**\n * A function that allows you to validate the value of the edit control. Return\n * a string from the function to display an error message. Return\n * `undefined` (or no return) from the function to indicate that the value is valid.\n * @param item - The item that is being edited.\n * @param value - The current value of the edit control.\n */\n validation?: (item: T, value: Optional<V>) => Optional<string>;\n\n /**\n * Determines the display of a cell's content when inline edit is active.\n */\n editingCell(item: T, ctx: TableProps.CellContext<any>): React.ReactNode;\n }\n\n export type ColumnDefinition<ItemType> = {\n id?: string;\n header: React.ReactNode;\n ariaLabel?(data: LabelData): string;\n width?: number | string;\n minWidth?: number | string;\n maxWidth?: number | string;\n editConfig?: EditConfig<ItemType>;\n isRowHeader?: boolean;\n cell(item: ItemType): React.ReactNode;\n } & SortingColumn<ItemType>;\n\n export interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n export type SelectionType = 'single' | 'multi';\n export type Variant = 'container' | 'embedded' | 'stacked' | 'full-page';\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n export type IsItemDisabled<T> = (item: T) => boolean;\n export interface AriaLabels<T> {\n allItemsSelectionLabel?: (data: TableProps.SelectionState<T>) => string;\n itemSelectionLabel?: (data: TableProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel?: string;\n tableLabel?: string;\n // do not use <T> to prevent overly strict validation on consumer end\n // it works, practically, we are only interested in `id` and `header` properties only\n activateEditLabel?: (column: ColumnDefinition<any>, item: T) => string;\n cancelEditLabel?: (column: ColumnDefinition<any>) => string;\n submitEditLabel?: (column: ColumnDefinition<any>) => string;\n submittingEditText?: (column: ColumnDefinition<any>) => string;\n successfulEditLabel?: (column: ColumnDefinition<any>) => string;\n }\n export interface SortingState<T> {\n isDescending?: boolean;\n sortingColumn: SortingColumn<T>;\n }\n export interface SortingColumn<T> {\n sortingField?: string;\n sortingComparator?: (a: T, b: T) => number;\n }\n export interface LabelData {\n sorted: boolean;\n descending: boolean;\n disabled: boolean;\n }\n export interface OnRowClickDetail<T> {\n rowIndex: number;\n item: T;\n }\n export interface OnRowContextMenuDetail<T> {\n rowIndex: number;\n item: T;\n clientX: number;\n clientY: number;\n }\n\n export interface ColumnWidthsChangeDetail {\n widths: ReadonlyArray<number>;\n }\n\n export interface LiveAnnouncement {\n totalItemsCount?: number;\n firstIndex: number;\n lastIndex: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled and you call this function, the table\n * scroll parent scrolls to reveal the first row of the table.\n */\n scrollToTop(): void;\n\n /**\n * Dismiss an inline edit if currently active.\n */\n cancelEdit?(): void;\n }\n\n export type SubmitEditFunction<ItemType, ValueType = unknown> = (\n item: ItemType,\n column: ColumnDefinition<ItemType>,\n newValue: ValueType\n ) => Promise<void> | void;\n\n export interface ColumnDisplayProperties {\n id: string;\n visible: boolean;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["table/internal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,cAAc,CAAC;AAoC/D,QAAA,MAAM,aAAa,qBAyZK,CAAC;AAEzB,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["table/internal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,cAAc,CAAC;AAqC/D,QAAA,MAAM,aAAa,qBA6aK,CAAC;AAEzB,eAAe,aAAa,CAAC"}
package/table/internal.js CHANGED
@@ -2,7 +2,7 @@ import { __awaiter, __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import clsx from 'clsx';
5
- import React, { useImperativeHandle, useRef, useState } from 'react';
5
+ import React, { useImperativeHandle, useMemo, useRef, useState } from 'react';
6
6
  import { getVisualContextClassname } from '../internal/components/visual-context';
7
7
  import InternalContainer from '../container/internal';
8
8
  import { getBaseProps } from '../internal/base-component';
@@ -32,18 +32,17 @@ import LiveRegion from '../internal/components/live-region';
32
32
  import useTableFocusNavigation from './use-table-focus-navigation';
33
33
  import { TableTdElement } from './body-cell/td-element';
34
34
  import { useMobile } from '../internal/hooks/use-mobile';
35
+ import { useStickyColumns, selectionColumnId } from './use-sticky-columns';
35
36
  const InternalTable = React.forwardRef((_a, ref) => {
36
37
  var _b, _c;
37
- var { header, footer, empty, filter, pagination, preferences, items, columnDefinitions, trackBy, loading, loadingText, selectionType, selectedItems, isItemDisabled, ariaLabels, onSelectionChange, onSortingChange, sortingColumn, sortingDescending, sortingDisabled, visibleColumns, stickyHeader, stickyHeaderVerticalOffset, onRowClick, onRowContextMenu, wrapLines, stripedRows, contentDensity, submitEdit, onEditCancel, resizableColumns, onColumnWidthsChange, variant, __internalRootRef, totalItemsCount, firstIndex, renderAriaLive, columnDisplay } = _a, rest = __rest(_a, ["header", "footer", "empty", "filter", "pagination", "preferences", "items", "columnDefinitions", "trackBy", "loading", "loadingText", "selectionType", "selectedItems", "isItemDisabled", "ariaLabels", "onSelectionChange", "onSortingChange", "sortingColumn", "sortingDescending", "sortingDisabled", "visibleColumns", "stickyHeader", "stickyHeaderVerticalOffset", "onRowClick", "onRowContextMenu", "wrapLines", "stripedRows", "contentDensity", "submitEdit", "onEditCancel", "resizableColumns", "onColumnWidthsChange", "variant", "__internalRootRef", "totalItemsCount", "firstIndex", "renderAriaLive", "columnDisplay"]);
38
+ var { header, footer, empty, filter, pagination, preferences, items, columnDefinitions, trackBy, loading, loadingText, selectionType, selectedItems, isItemDisabled, ariaLabels, onSelectionChange, onSortingChange, sortingColumn, sortingDescending, sortingDisabled, visibleColumns, stickyHeader, stickyHeaderVerticalOffset, onRowClick, onRowContextMenu, wrapLines, stripedRows, contentDensity, submitEdit, onEditCancel, resizableColumns, onColumnWidthsChange, variant, __internalRootRef, totalItemsCount, firstIndex, renderAriaLive, stickyColumns, columnDisplay } = _a, rest = __rest(_a, ["header", "footer", "empty", "filter", "pagination", "preferences", "items", "columnDefinitions", "trackBy", "loading", "loadingText", "selectionType", "selectedItems", "isItemDisabled", "ariaLabels", "onSelectionChange", "onSortingChange", "sortingColumn", "sortingDescending", "sortingDisabled", "visibleColumns", "stickyHeader", "stickyHeaderVerticalOffset", "onRowClick", "onRowContextMenu", "wrapLines", "stripedRows", "contentDensity", "submitEdit", "onEditCancel", "resizableColumns", "onColumnWidthsChange", "variant", "__internalRootRef", "totalItemsCount", "firstIndex", "renderAriaLive", "stickyColumns", "columnDisplay"]);
38
39
  const baseProps = getBaseProps(rest);
39
40
  const isMobile = useMobile();
40
41
  stickyHeader = stickyHeader && supportsStickyPosition();
41
42
  const [containerWidth, wrapperMeasureRef] = useContainerQuery(({ width }) => width);
42
43
  const wrapperRefObject = useRef(null);
43
- const wrapperRef = useMergeRefs(wrapperMeasureRef, wrapperRefObject);
44
44
  const [tableWidth, tableMeasureRef] = useContainerQuery(({ width }) => width);
45
45
  const tableRefObject = useRef(null);
46
- const tableRef = useMergeRefs(tableMeasureRef, tableRefObject);
47
46
  const secondaryWrapperRef = React.useRef(null);
48
47
  const theadRef = useRef(null);
49
48
  const stickyHeaderRef = React.useRef(null);
@@ -93,6 +92,16 @@ const InternalTable = React.forwardRef((_a, ref) => {
93
92
  const hasHeader = !!(header || filter || pagination || preferences);
94
93
  const hasSelection = !!selectionType;
95
94
  const hasFooter = !!footer;
95
+ const noStickyColumns = !(stickyColumns === null || stickyColumns === void 0 ? void 0 : stickyColumns.first) && !(stickyColumns === null || stickyColumns === void 0 ? void 0 : stickyColumns.last);
96
+ const visibleColumnsWithSelection = useMemo(() => {
97
+ const columnIds = visibleColumnDefinitions.map((it, index) => { var _a; return (_a = it.id) !== null && _a !== void 0 ? _a : index.toString(); });
98
+ return hasSelection ? [selectionColumnId.toString(), ...columnIds] : columnIds !== null && columnIds !== void 0 ? columnIds : [];
99
+ }, [visibleColumnDefinitions, hasSelection]);
100
+ const stickyState = useStickyColumns({
101
+ visibleColumns: visibleColumnsWithSelection,
102
+ stickyColumnsFirst: noStickyColumns ? 0 : ((stickyColumns === null || stickyColumns === void 0 ? void 0 : stickyColumns.first) || 0) + (hasSelection ? 1 : 0),
103
+ stickyColumnsLast: (stickyColumns === null || stickyColumns === void 0 ? void 0 : stickyColumns.last) || 0,
104
+ });
96
105
  const theadProps = {
97
106
  containerWidth,
98
107
  selectionType,
@@ -115,7 +124,10 @@ const InternalTable = React.forwardRef((_a, ref) => {
115
124
  },
116
125
  singleSelectionHeaderAriaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.selectionGroupLabel,
117
126
  stripedRows,
127
+ stickyState,
118
128
  };
129
+ const wrapperRef = useMergeRefs(wrapperMeasureRef, wrapperRefObject, stickyState.refs.wrapper);
130
+ const tableRef = useMergeRefs(tableMeasureRef, tableRefObject, stickyState.refs.table);
119
131
  // Allows keyboard users to scroll horizontally with arrow keys by making the wrapper part of the tab sequence
120
132
  const isWrapperScrollable = tableWidth && containerWidth && tableWidth > containerWidth;
121
133
  const wrapperProps = isWrapperScrollable
@@ -181,9 +193,10 @@ const InternalTable = React.forwardRef((_a, ref) => {
181
193
  (_a = stickyHeaderRef.current) === null || _a === void 0 ? void 0 : _a.scrollToRow(currentTarget);
182
194
  }
183
195
  } }, focusMarkers.item, { onClick: onRowClickHandler && onRowClickHandler.bind(null, rowIndex, item), onContextMenu: onRowContextMenuHandler && onRowContextMenuHandler.bind(null, rowIndex, item), "aria-rowindex": firstIndex ? firstIndex + rowIndex + 1 : undefined }),
184
- selectionType !== undefined && (React.createElement(TableTdElement, { className: clsx(styles['selection-control']), isVisualRefresh: isVisualRefresh, isFirstRow: firstVisible, isLastRow: lastVisible, isSelected: isSelected, isNextSelected: isNextSelected, isPrevSelected: isPrevSelected, wrapLines: false, isEvenRow: isEven, stripedRows: stripedRows, hasSelection: hasSelection, hasFooter: hasFooter },
196
+ selectionType !== undefined && (React.createElement(TableTdElement, { className: clsx(styles['selection-control']), isVisualRefresh: isVisualRefresh, isFirstRow: firstVisible, isLastRow: lastVisible, isSelected: isSelected, isNextSelected: isNextSelected, isPrevSelected: isPrevSelected, wrapLines: false, isEvenRow: isEven, stripedRows: stripedRows, hasSelection: hasSelection, hasFooter: hasFooter, stickyState: stickyState, columnId: selectionColumnId.toString() },
185
197
  React.createElement(SelectionControl, Object.assign({ onFocusDown: moveFocusDown, onFocusUp: moveFocusUp, onShiftToggle: updateShiftToggle }, getItemSelectionProps(item))))),
186
198
  visibleColumnDefinitions.map((column, colIndex) => {
199
+ var _a;
187
200
  const isEditing = !!currentEditCell && currentEditCell[0] === rowIndex && currentEditCell[1] === colIndex;
188
201
  const successfulEdit = !!lastSuccessfulEditCell &&
189
202
  lastSuccessfulEditCell[0] === rowIndex &&
@@ -206,7 +219,7 @@ const InternalTable = React.forwardRef((_a, ref) => {
206
219
  setLastSuccessfulEditCell([rowIndex, colIndex]);
207
220
  }
208
221
  }
209
- }, submitEdit: wrapWithInlineLoadingState(submitEdit), hasFooter: hasFooter, stripedRows: stripedRows, isEvenRow: isEven, isVisualRefresh: isVisualRefresh }));
222
+ }, submitEdit: wrapWithInlineLoadingState(submitEdit), hasFooter: hasFooter, stripedRows: stripedRows, isEvenRow: isEven, columnId: (_a = column.id) !== null && _a !== void 0 ? _a : colIndex.toString(), stickyState: stickyState, isVisualRefresh: isVisualRefresh }));
210
223
  })));
211
224
  })))),
212
225
  resizableColumns && React.createElement(ResizeTracker, null)),