@cloudscape-design/components 3.0.1 → 3.0.4

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 (68) hide show
  1. package/alert/interfaces.d.ts +1 -0
  2. package/alert/interfaces.d.ts.map +1 -1
  3. package/alert/interfaces.js.map +1 -1
  4. package/app-layout/index.d.ts.map +1 -1
  5. package/app-layout/index.js +16 -11
  6. package/app-layout/index.js.map +1 -1
  7. package/app-layout/test-classes/styles.css.js +13 -12
  8. package/app-layout/test-classes/styles.scoped.css +17 -13
  9. package/app-layout/test-classes/styles.selectors.js +13 -12
  10. package/app-layout/visual-refresh/context.d.ts +4 -2
  11. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  12. package/app-layout/visual-refresh/context.js +31 -21
  13. package/app-layout/visual-refresh/context.js.map +1 -1
  14. package/app-layout/visual-refresh/layout.d.ts.map +1 -1
  15. package/app-layout/visual-refresh/layout.js +3 -13
  16. package/app-layout/visual-refresh/layout.js.map +1 -1
  17. package/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
  18. package/app-layout/visual-refresh/split-panel.js +6 -2
  19. package/app-layout/visual-refresh/split-panel.js.map +1 -1
  20. package/code-editor/preferences-modal.js +2 -2
  21. package/code-editor/preferences-modal.js.map +1 -1
  22. package/container/styles.css.js +15 -14
  23. package/container/styles.scoped.css +28 -24
  24. package/container/styles.selectors.js +15 -14
  25. package/container/use-sticky-header.d.ts.map +1 -1
  26. package/container/use-sticky-header.js +19 -12
  27. package/container/use-sticky-header.js.map +1 -1
  28. package/flashbar/interfaces.d.ts +4 -4
  29. package/flashbar/interfaces.js.map +1 -1
  30. package/form-field/internal.js +3 -3
  31. package/form-field/internal.js.map +1 -1
  32. package/internal/base-component/styles.scoped.css +3 -0
  33. package/internal/components/dropdown/dropdown-fit-handler.js +1 -1
  34. package/internal/components/dropdown/dropdown-fit-handler.js.map +1 -1
  35. package/internal/context/app-layout-context.d.ts +1 -1
  36. package/internal/context/app-layout-context.d.ts.map +1 -1
  37. package/internal/context/app-layout-context.js +3 -4
  38. package/internal/context/app-layout-context.js.map +1 -1
  39. package/internal/context/form-field-context.d.ts +1 -1
  40. package/internal/context/form-field-context.d.ts.map +1 -1
  41. package/internal/context/form-field-context.js +3 -4
  42. package/internal/context/form-field-context.js.map +1 -1
  43. package/internal/environment.js +1 -1
  44. package/internal/generated/theming/index.cjs +14 -3
  45. package/internal/generated/theming/index.js +14 -3
  46. package/internal/utils/scrollable-containers.js +1 -1
  47. package/internal/utils/scrollable-containers.js.map +1 -1
  48. package/package.json +1 -1
  49. package/select/utils/use-select.d.ts.map +1 -1
  50. package/select/utils/use-select.js +1 -0
  51. package/select/utils/use-select.js.map +1 -1
  52. package/split-panel/index.js +2 -2
  53. package/split-panel/index.js.map +1 -1
  54. package/split-panel/utils/size-utils.d.ts +11 -0
  55. package/split-panel/utils/size-utils.d.ts.map +1 -1
  56. package/split-panel/utils/size-utils.js +12 -1
  57. package/split-panel/utils/size-utils.js.map +1 -1
  58. package/tag-editor/index.js +1 -1
  59. package/tag-editor/index.js.map +1 -1
  60. package/tag-editor/interfaces.d.ts +1 -1
  61. package/tag-editor/interfaces.d.ts.map +1 -1
  62. package/tag-editor/interfaces.js.map +1 -1
  63. package/tutorial-panel/components/tutorial-list/index.js +1 -1
  64. package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
  65. package/internal/hooks/dom-context/index.d.ts +0 -14
  66. package/internal/hooks/dom-context/index.d.ts.map +0 -1
  67. package/internal/hooks/dom-context/index.js +0 -70
  68. package/internal/hooks/dom-context/index.js.map +0 -1
@@ -1,19 +1,20 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_14iqq_1tfbz_97",
5
- "variant-default": "awsui_variant-default_14iqq_1tfbz_109",
6
- "variant-stacked": "awsui_variant-stacked_14iqq_1tfbz_109",
7
- "header": "awsui_header_14iqq_1tfbz_132",
8
- "header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_1tfbz_136",
9
- "header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_1tfbz_140",
10
- "header-stuck": "awsui_header-stuck_14iqq_1tfbz_146",
11
- "header-dynamic-height": "awsui_header-dynamic-height_14iqq_1tfbz_151",
12
- "with-paddings": "awsui_with-paddings_14iqq_1tfbz_157",
13
- "header-variant-cards": "awsui_header-variant-cards_14iqq_1tfbz_160",
14
- "dark-header": "awsui_dark-header_14iqq_1tfbz_189",
15
- "content": "awsui_content_14iqq_1tfbz_193",
16
- "footer": "awsui_footer_14iqq_1tfbz_200",
17
- "with-divider": "awsui_with-divider_14iqq_1tfbz_203"
4
+ "root": "awsui_root_14iqq_1cpw0_97",
5
+ "variant-default": "awsui_variant-default_14iqq_1cpw0_109",
6
+ "variant-stacked": "awsui_variant-stacked_14iqq_1cpw0_109",
7
+ "header": "awsui_header_14iqq_1cpw0_132",
8
+ "header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_1cpw0_136",
9
+ "header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_1cpw0_140",
10
+ "header-stuck": "awsui_header-stuck_14iqq_1cpw0_146",
11
+ "header-dynamic-height": "awsui_header-dynamic-height_14iqq_1cpw0_151",
12
+ "with-paddings": "awsui_with-paddings_14iqq_1cpw0_157",
13
+ "header-variant-cards": "awsui_header-variant-cards_14iqq_1cpw0_160",
14
+ "header-variant-full-page": "awsui_header-variant-full-page_14iqq_1cpw0_184",
15
+ "dark-header": "awsui_dark-header_14iqq_1cpw0_192",
16
+ "content": "awsui_content_14iqq_1cpw0_196",
17
+ "footer": "awsui_footer_14iqq_1cpw0_203",
18
+ "with-divider": "awsui_with-divider_14iqq_1cpw0_206"
18
19
  };
19
20
 
@@ -94,7 +94,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
94
94
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
95
  SPDX-License-Identifier: Apache-2.0
96
96
  */
97
- .awsui_root_14iqq_1tfbz_97:not(#\9) {
97
+ .awsui_root_14iqq_1cpw0_97:not(#\9) {
98
98
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
99
99
  border-collapse: separate;
100
100
  border-spacing: 0;
@@ -137,7 +137,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
137
137
  display: block;
138
138
  word-wrap: break-word;
139
139
  }
140
- .awsui_root_14iqq_1tfbz_97.awsui_variant-default_14iqq_1tfbz_109:not(#\9), .awsui_root_14iqq_1tfbz_97.awsui_variant-stacked_14iqq_1tfbz_109:not(#\9) {
140
+ .awsui_root_14iqq_1cpw0_97.awsui_variant-default_14iqq_1cpw0_109:not(#\9), .awsui_root_14iqq_1cpw0_97.awsui_variant-stacked_14iqq_1cpw0_109:not(#\9) {
141
141
  box-shadow: 0px 0px 1px 1px #e9ebed, 0px 1px 8px 2px rgba(0, 7, 22, 0.12);
142
142
  box-shadow: var(--shadow-container-7nblnj, 0px 0px 1px 1px #e9ebed, 0px 1px 8px 2px rgba(0, 7, 22, 0.12));
143
143
  border-top: 0px solid transparent;
@@ -149,16 +149,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
149
149
  background-color: var(--color-background-container-content-i8i4a0, #ffffff);
150
150
  }
151
151
  @media screen and (-ms-high-contrast: active) {
152
- .awsui_root_14iqq_1tfbz_97.awsui_variant-default_14iqq_1tfbz_109:not(#\9), .awsui_root_14iqq_1tfbz_97.awsui_variant-stacked_14iqq_1tfbz_109:not(#\9) {
152
+ .awsui_root_14iqq_1cpw0_97.awsui_variant-default_14iqq_1cpw0_109:not(#\9), .awsui_root_14iqq_1cpw0_97.awsui_variant-stacked_14iqq_1cpw0_109:not(#\9) {
153
153
  border: 2px solid transparent;
154
154
  border: var(--border-field-width-idlekx, 2px) solid var(--color-border-container-top-srcvx4, transparent);
155
155
  }
156
156
  }
157
- .awsui_root_14iqq_1tfbz_97.awsui_variant-stacked_14iqq_1tfbz_109:not(#\9):not(:last-child) {
157
+ .awsui_root_14iqq_1cpw0_97.awsui_variant-stacked_14iqq_1cpw0_109:not(#\9):not(:last-child) {
158
158
  border-bottom-right-radius: 0;
159
159
  border-bottom-left-radius: 0;
160
160
  }
161
- .awsui_root_14iqq_1tfbz_97.awsui_variant-stacked_14iqq_1tfbz_109 + .awsui_root_14iqq_1tfbz_97.awsui_variant-stacked_14iqq_1tfbz_109:not(#\9) {
161
+ .awsui_root_14iqq_1cpw0_97.awsui_variant-stacked_14iqq_1cpw0_109 + .awsui_root_14iqq_1cpw0_97.awsui_variant-stacked_14iqq_1cpw0_109:not(#\9) {
162
162
  border-top: 2px solid #e9ebed;
163
163
  border-top: var(--border-divider-section-width-4wm2it, 2px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
164
164
  border-top-left-radius: 0;
@@ -167,41 +167,41 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
167
167
  box-shadow: var(--shadow-container-stacked-lumzae, -1px 1px 1px 0px #e9ebed, 1px 1px 1px 0px #e9ebed, 0px 9px 8px -7px rgba(0, 7, 22, 0.12), 8px 0px 8px -7px rgba(0, 7, 22, 0.12), -8px 0px 8px -7px rgba(0, 7, 22, 0.12));
168
168
  }
169
169
 
170
- .awsui_header_14iqq_1tfbz_132:not(#\9) {
170
+ .awsui_header_14iqq_1cpw0_132:not(#\9) {
171
171
  background-color: #ffffff;
172
172
  background-color: var(--color-background-container-header-4flbq5, #ffffff);
173
173
  border-radius: 16px;
174
174
  border-radius: var(--border-container-radius-8dqnwf, 16px);
175
175
  }
176
- .awsui_header-sticky-disabled_14iqq_1tfbz_136:not(#\9) {
176
+ .awsui_header-sticky-disabled_14iqq_1cpw0_136:not(#\9) {
177
177
  position: relative;
178
178
  z-index: 1;
179
179
  }
180
- .awsui_header-sticky-enabled_14iqq_1tfbz_140:not(#\9) {
180
+ .awsui_header-sticky-enabled_14iqq_1cpw0_140:not(#\9) {
181
181
  top: 0;
182
182
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
183
183
  position: sticky;
184
184
  z-index: 800;
185
185
  }
186
- .awsui_header-stuck_14iqq_1tfbz_146:not(#\9) {
187
- box-shadow: 0px 4px 20px 1px rgba(0, 7, 22, 0.1);
188
- box-shadow: var(--shadow-sticky-aijlo6, 0px 4px 20px 1px rgba(0, 7, 22, 0.1));
186
+ .awsui_header-stuck_14iqq_1cpw0_146:not(#\9) {
187
+ box-shadow: 0px 2px 0px 0px #e9ebed, 0px 16px 16px -12px rgba(0, 7, 22, 0.1);
188
+ box-shadow: var(--shadow-sticky-embedded-qit8ba, 0px 2px 0px 0px #e9ebed, 0px 16px 16px -12px rgba(0, 7, 22, 0.1));
189
189
  border: 0;
190
190
  border-radius: 0;
191
191
  }
192
- .awsui_header-dynamic-height_14iqq_1tfbz_151.awsui_header-stuck_14iqq_1tfbz_146:not(#\9) {
192
+ .awsui_header-dynamic-height_14iqq_1cpw0_151.awsui_header-stuck_14iqq_1cpw0_146:not(#\9) {
193
193
  margin-bottom: calc(40px - 30px);
194
194
  margin-bottom: calc(var(--font-heading-xl-line-height-doxfdj, 40px) - var(--font-heading-l-line-height-gev4n1, 30px));
195
195
  }
196
- .awsui_header_14iqq_1tfbz_132:not(#\9):not(:empty) {
196
+ .awsui_header_14iqq_1cpw0_132:not(#\9):not(:empty) {
197
197
  border-bottom: 0px solid transparent;
198
198
  border-bottom: var(--border-container-sticky-width-i7t7xe, 0px) solid var(--color-border-container-divider-4ade7z, transparent);
199
199
  }
200
- .awsui_header_14iqq_1tfbz_132.awsui_with-paddings_14iqq_1tfbz_157:not(#\9) {
200
+ .awsui_header_14iqq_1cpw0_132.awsui_with-paddings_14iqq_1cpw0_157:not(#\9) {
201
201
  padding: 12px 24px;
202
202
  padding: var(--space-container-header-vertical-zsjhel, 12px) var(--space-container-horizontal-ddrezg, 24px);
203
203
  }
204
- .awsui_header-variant-cards_14iqq_1tfbz_160:not(#\9) {
204
+ .awsui_header-variant-cards_14iqq_1cpw0_160:not(#\9) {
205
205
  box-shadow: 0px 0px 1px 1px #e9ebed, 0px 1px 8px 2px rgba(0, 7, 22, 0.12);
206
206
  box-shadow: var(--shadow-container-7nblnj, 0px 0px 1px 1px #e9ebed, 0px 1px 8px 2px rgba(0, 7, 22, 0.12));
207
207
  border-top: 0px solid transparent;
@@ -211,48 +211,52 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
211
211
  box-sizing: border-box;
212
212
  }
213
213
  @media screen and (-ms-high-contrast: active) {
214
- .awsui_header-variant-cards_14iqq_1tfbz_160:not(#\9) {
214
+ .awsui_header-variant-cards_14iqq_1cpw0_160:not(#\9) {
215
215
  border: 2px solid transparent;
216
216
  border: var(--border-field-width-idlekx, 2px) solid var(--color-border-container-top-srcvx4, transparent);
217
217
  }
218
218
  }
219
- .awsui_header-variant-cards_14iqq_1tfbz_160:not(#\9):not(:empty) {
219
+ .awsui_header-variant-cards_14iqq_1cpw0_160:not(#\9):not(:empty) {
220
220
  border-bottom: 1px solid #d5dbdb;
221
221
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
222
222
  }
223
223
  @supports (--css-variable-support-check: #000) {
224
- .awsui_header-variant-cards_14iqq_1tfbz_160:not(#\9):not(:empty) {
224
+ .awsui_header-variant-cards_14iqq_1cpw0_160:not(#\9):not(:empty) {
225
225
  border-bottom: 0;
226
226
  }
227
227
  }
228
- .awsui_header-variant-cards_14iqq_1tfbz_160.awsui_header-stuck_14iqq_1tfbz_146:not(#\9) {
228
+ .awsui_header-variant-cards_14iqq_1cpw0_160.awsui_header-stuck_14iqq_1cpw0_146:not(#\9) {
229
229
  border-top-left-radius: 0;
230
230
  border-top-right-radius: 0;
231
231
  }
232
+ .awsui_header-variant-full-page_14iqq_1cpw0_184.awsui_header-stuck_14iqq_1cpw0_146:not(#\9) {
233
+ box-shadow: 0px 4px 20px 1px rgba(0, 7, 22, 0.1);
234
+ box-shadow: var(--shadow-sticky-aijlo6, 0px 4px 20px 1px rgba(0, 7, 22, 0.1));
235
+ }
232
236
 
233
237
  /*
234
238
  The dynamic height dark header needs a background that will cover
235
239
  the default white background of the container component.
236
240
  */
237
- .awsui_dark-header_14iqq_1tfbz_189:not(#\9) {
241
+ .awsui_dark-header_14iqq_1cpw0_192:not(#\9) {
238
242
  background-color: #ffffff;
239
243
  background-color: var(--color-background-layout-main-sfhm4y, #ffffff);
240
244
  }
241
245
 
242
- .awsui_content_14iqq_1tfbz_193.awsui_with-paddings_14iqq_1tfbz_157:not(#\9) {
246
+ .awsui_content_14iqq_1cpw0_196.awsui_with-paddings_14iqq_1cpw0_157:not(#\9) {
243
247
  padding: 20px 24px;
244
248
  padding: var(--space-scaled-l-t03y3z, 20px) var(--space-container-horizontal-ddrezg, 24px);
245
249
  }
246
- .awsui_header_14iqq_1tfbz_132 + .awsui_content_14iqq_1tfbz_193.awsui_with-paddings_14iqq_1tfbz_157:not(#\9) {
250
+ .awsui_header_14iqq_1cpw0_132 + .awsui_content_14iqq_1cpw0_196.awsui_with-paddings_14iqq_1cpw0_157:not(#\9) {
247
251
  padding-top: 0px;
248
252
  padding-top: var(--space-container-content-top-fsd8nr, 0px);
249
253
  }
250
254
 
251
- .awsui_footer_14iqq_1tfbz_200.awsui_with-paddings_14iqq_1tfbz_157:not(#\9) {
255
+ .awsui_footer_14iqq_1cpw0_203.awsui_with-paddings_14iqq_1cpw0_157:not(#\9) {
252
256
  padding: 12px 24px;
253
257
  padding: var(--space-scaled-s-cu1hzn, 12px) var(--space-container-horizontal-ddrezg, 24px);
254
258
  }
255
- .awsui_footer_14iqq_1tfbz_200.awsui_with-divider_14iqq_1tfbz_203:not(#\9) {
259
+ .awsui_footer_14iqq_1cpw0_203.awsui_with-divider_14iqq_1cpw0_206:not(#\9) {
256
260
  border-top: 2px solid #e9ebed;
257
261
  border-top: var(--border-divider-section-width-4wm2it, 2px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
258
262
  }
@@ -2,19 +2,20 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_14iqq_1tfbz_97",
6
- "variant-default": "awsui_variant-default_14iqq_1tfbz_109",
7
- "variant-stacked": "awsui_variant-stacked_14iqq_1tfbz_109",
8
- "header": "awsui_header_14iqq_1tfbz_132",
9
- "header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_1tfbz_136",
10
- "header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_1tfbz_140",
11
- "header-stuck": "awsui_header-stuck_14iqq_1tfbz_146",
12
- "header-dynamic-height": "awsui_header-dynamic-height_14iqq_1tfbz_151",
13
- "with-paddings": "awsui_with-paddings_14iqq_1tfbz_157",
14
- "header-variant-cards": "awsui_header-variant-cards_14iqq_1tfbz_160",
15
- "dark-header": "awsui_dark-header_14iqq_1tfbz_189",
16
- "content": "awsui_content_14iqq_1tfbz_193",
17
- "footer": "awsui_footer_14iqq_1tfbz_200",
18
- "with-divider": "awsui_with-divider_14iqq_1tfbz_203"
5
+ "root": "awsui_root_14iqq_1cpw0_97",
6
+ "variant-default": "awsui_variant-default_14iqq_1cpw0_109",
7
+ "variant-stacked": "awsui_variant-stacked_14iqq_1cpw0_109",
8
+ "header": "awsui_header_14iqq_1cpw0_132",
9
+ "header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_1cpw0_136",
10
+ "header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_1cpw0_140",
11
+ "header-stuck": "awsui_header-stuck_14iqq_1cpw0_146",
12
+ "header-dynamic-height": "awsui_header-dynamic-height_14iqq_1cpw0_151",
13
+ "with-paddings": "awsui_with-paddings_14iqq_1cpw0_157",
14
+ "header-variant-cards": "awsui_header-variant-cards_14iqq_1cpw0_160",
15
+ "header-variant-full-page": "awsui_header-variant-full-page_14iqq_1cpw0_184",
16
+ "dark-header": "awsui_dark-header_14iqq_1cpw0_192",
17
+ "content": "awsui_content_14iqq_1cpw0_196",
18
+ "footer": "awsui_footer_14iqq_1cpw0_203",
19
+ "with-divider": "awsui_with-divider_14iqq_1cpw0_206"
19
20
  };
20
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"use-sticky-header.d.ts","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA6E,MAAM,OAAO,CAAC;AAQ7G,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB,mDAA8D,CAAC;AAE/F,eAAO,MAAM,eAAe,YACjB,UAAU,cAAc,CAAC,aACvB,UAAU,cAAc,CAAC;;;;;;;;;;CA8ErC,CAAC;AAEF,wBAAgB,uBAAuB,YAGtC"}
1
+ {"version":3,"file":"use-sticky-header.d.ts","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA6E,MAAM,OAAO,CAAC;AAQ7G,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB,mDAA8D,CAAC;AAE/F,eAAO,MAAM,eAAe,YACjB,UAAU,cAAc,CAAC,aACvB,UAAU,cAAc,CAAC;;;;;;;;;;CAuFrC,CAAC;AAEF,wBAAgB,uBAAuB,YAGtC"}
@@ -3,7 +3,7 @@
3
3
  import { useState, useLayoutEffect, useCallback, useEffect, createContext, useMemo } from 'react';
4
4
  import { useAppLayoutContext } from '../internal/context/app-layout-context';
5
5
  import { useMobile } from '../internal/hooks/use-mobile';
6
- import { supportsStickyPosition } from '../internal/utils/dom';
6
+ import { findUpUntil, supportsStickyPosition } from '../internal/utils/dom';
7
7
  import { getOverflowParents } from '../internal/utils/scrollable-containers';
8
8
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
9
9
  import customCssProps from '../internal/generated/custom-css-properties';
@@ -20,19 +20,26 @@ export var useStickyHeader = function (rootRef, headerRef, __stickyHeader, __sti
20
20
  : 0;
21
21
  return containerRootBorder + headerBorder;
22
22
  }, [currentRootRef, currentHeaderRef]);
23
- // Having no overflow parents, means that the component uses body scroll.
24
- // In that case, we reach into AppLayoutContext in case sticky header needs to be
25
- // offset down by the height of other sticky elements positioned on top of the view.
26
- var _a = useState(false), usesBodyScroll = _a[0], setState = _a[1];
27
- var _b = useState(false), isStuck = _b[0], setIsStuck = _b[1];
28
- useLayoutEffect(function () {
29
- var overflowParents = rootRef.current && getOverflowParents(rootRef.current).length;
30
- setState(!overflowParents);
31
- }, [rootRef]);
23
+ // We reach into AppLayoutContext in case sticky header needs to be offset down by the height
24
+ // of other sticky elements positioned on top of the view.
32
25
  var stickyOffsetTop = useAppLayoutContext().stickyOffsetTop;
33
- var effectiveStickyOffset = __stickyOffset !== null && __stickyOffset !== void 0 ? __stickyOffset : (usesBodyScroll ? stickyOffsetTop : 0);
34
26
  var isSticky = useSupportsStickyHeader() && !!__stickyHeader;
35
27
  var isRefresh = useVisualRefresh(rootRef);
28
+ // If it has overflow parents inside the app layout, we shouldn't apply a sticky offset.
29
+ var _a = useState(false), hasInnerOverflowParents = _a[0], setHasInnerOverflowParents = _a[1];
30
+ var _b = useState(false), isStuck = _b[0], setIsStuck = _b[1];
31
+ useLayoutEffect(function () {
32
+ if (rootRef.current) {
33
+ var overflowParents = getOverflowParents(rootRef.current);
34
+ var mainElement = findUpUntil(rootRef.current, function (elem) { return elem.tagName === 'MAIN'; });
35
+ // In both versions of the app layout, the scrolling element for disableBodyScroll
36
+ // is the <main>. If the closest overflow parent is also the closest <main> and we have
37
+ // offset values, it's safe to assume that it's the app layout scroll root and we
38
+ // should stop there.
39
+ setHasInnerOverflowParents(overflowParents.length > 0 && overflowParents[0] !== mainElement);
40
+ }
41
+ }, [rootRef]);
42
+ var effectiveStickyOffset = __stickyOffset !== null && __stickyOffset !== void 0 ? __stickyOffset : (hasInnerOverflowParents ? 0 : stickyOffsetTop);
36
43
  /**
37
44
  * The AppLayout refactor removed the need for passing the sticky offset in px all the time through the
38
45
  * AppLayoutDomContext provider because that information already exists on the DOM in a custom property
@@ -41,7 +48,7 @@ export var useStickyHeader = function (rootRef, headerRef, __stickyHeader, __sti
41
48
  * to the default offset calculated in AppLayoutDomContext.
42
49
  */
43
50
  var computedOffset = "".concat(effectiveStickyOffset - totalBorder, "px");
44
- if (usesBodyScroll && isRefresh) {
51
+ if (isRefresh && !hasInnerOverflowParents) {
45
52
  computedOffset = "var(".concat(customCssProps.offsetTopWithNotifications, ", ").concat(computedOffset, ")");
46
53
  }
47
54
  var stickyStyles = isSticky
@@ -1 +1 @@
1
- {"version":3,"file":"use-sticky-header.js","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAMzE,MAAM,CAAC,IAAM,mBAAmB,GAAG,aAAa,CAA2B,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AAE/F,MAAM,CAAC,IAAM,eAAe,GAAG,UAC7B,OAAkC,EAClC,SAAoC,EACpC,cAAwB,EACxB,cAAuB;IAEvB,IAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IACvC,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC;IAC3C,IAAM,WAAW,GAAG,OAAO,CAAC;QAC1B,IAAM,mBAA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QACR,OAAO,SAAA;QACP,YAAY,cAAA;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,uBAAuB;IACrC,IAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,OAAO,sBAAsB,EAAE,IAAI,CAAC,QAAQ,CAAC;AAC/C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { RefObject, useState, useLayoutEffect, useCallback, useEffect, createContext, useMemo } from 'react';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { supportsStickyPosition } from '../internal/utils/dom';\nimport { getOverflowParents } from '../internal/utils/scrollable-containers';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport customCssProps from '../internal/generated/custom-css-properties';\n\ninterface StickyHeaderContextProps {\n isStuck: boolean;\n}\n\nexport const StickyHeaderContext = createContext<StickyHeaderContextProps>({ isStuck: false });\n\nexport const useStickyHeader = (\n rootRef: RefObject<HTMLDivElement>,\n headerRef: RefObject<HTMLDivElement>,\n __stickyHeader?: boolean,\n __stickyOffset?: number\n) => {\n const currentRootRef = rootRef.current;\n const currentHeaderRef = headerRef.current;\n const totalBorder = useMemo(() => {\n const containerRootBorder = currentRootRef\n ? parseInt(getComputedStyle(currentRootRef).getPropertyValue('border-top-width'), 10)\n : 0;\n const headerBorder = currentHeaderRef\n ? parseInt(getComputedStyle(currentHeaderRef).getPropertyValue('border-top-width'), 10)\n : 0;\n return containerRootBorder + headerBorder;\n }, [currentRootRef, currentHeaderRef]);\n\n // Having no overflow parents, means that the component uses body scroll.\n // In that case, we reach into AppLayoutContext in case sticky header needs to be\n // offset down by the height of other sticky elements positioned on top of the view.\n const [usesBodyScroll, setState] = useState<boolean>(false);\n const [isStuck, setIsStuck] = useState(false);\n useLayoutEffect(() => {\n const overflowParents = rootRef.current && getOverflowParents(rootRef.current).length;\n setState(!overflowParents);\n }, [rootRef]);\n const { stickyOffsetTop } = useAppLayoutContext();\n const effectiveStickyOffset = __stickyOffset ?? (usesBodyScroll ? stickyOffsetTop : 0);\n const isSticky = useSupportsStickyHeader() && !!__stickyHeader;\n const isRefresh = useVisualRefresh(rootRef);\n\n /**\n * The AppLayout refactor removed the need for passing the sticky offset in px all the time through the\n * AppLayoutDomContext provider because that information already exists on the DOM in a custom property\n * on the Layout subcomponent. Thus, if the Container header is sticky, we are in Visual Refresh and use\n * body scroll then we will use that property. When a component is used outside AppLayout, we fall back\n * to the default offset calculated in AppLayoutDomContext.\n */\n let computedOffset = `${effectiveStickyOffset - totalBorder}px`;\n if (usesBodyScroll && isRefresh) {\n computedOffset = `var(${customCssProps.offsetTopWithNotifications}, ${computedOffset})`;\n }\n\n const stickyStyles = isSticky\n ? {\n style: {\n top: computedOffset,\n },\n }\n : {};\n\n // \"stuck\" state, when the header has moved from its original posititon has a\n // box-shadow, applied here by a \"header-stuck\" className\n const checkIfStuck = useCallback(() => {\n if (rootRef.current && headerRef.current) {\n const rootTop = rootRef.current.getBoundingClientRect().top;\n const headerTop = headerRef.current.getBoundingClientRect().top;\n if (rootTop + totalBorder < headerTop) {\n setIsStuck(true);\n } else {\n setIsStuck(false);\n }\n }\n }, [rootRef, headerRef, totalBorder]);\n useEffect(() => {\n if (isSticky) {\n window.addEventListener('scroll', checkIfStuck, true);\n window.addEventListener('resize', checkIfStuck);\n return () => {\n window.removeEventListener('scroll', checkIfStuck, true);\n window.removeEventListener('resize', checkIfStuck);\n };\n }\n }, [isSticky, checkIfStuck]);\n return {\n isSticky,\n isStuck,\n stickyStyles,\n };\n};\n\nexport function useSupportsStickyHeader() {\n const isMobile = useMobile();\n return supportsStickyPosition() && !isMobile;\n}\n"]}
1
+ {"version":3,"file":"use-sticky-header.js","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,QAAQ,EAAE,eAAe,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on.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { RefObject, useState, useLayoutEffect, useCallback, useEffect, createContext, useMemo } from 'react';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { findUpUntil, supportsStickyPosition } from '../internal/utils/dom';\nimport { getOverflowParents } from '../internal/utils/scrollable-containers';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport customCssProps from '../internal/generated/custom-css-properties';\n\ninterface StickyHeaderContextProps {\n isStuck: boolean;\n}\n\nexport const StickyHeaderContext = createContext<StickyHeaderContextProps>({ isStuck: false });\n\nexport const useStickyHeader = (\n rootRef: RefObject<HTMLDivElement>,\n headerRef: RefObject<HTMLDivElement>,\n __stickyHeader?: boolean,\n __stickyOffset?: number\n) => {\n const currentRootRef = rootRef.current;\n const currentHeaderRef = headerRef.current;\n const totalBorder = useMemo(() => {\n const containerRootBorder = currentRootRef\n ? parseInt(getComputedStyle(currentRootRef).getPropertyValue('border-top-width'), 10)\n : 0;\n const headerBorder = currentHeaderRef\n ? parseInt(getComputedStyle(currentHeaderRef).getPropertyValue('border-top-width'), 10)\n : 0;\n return containerRootBorder + headerBorder;\n }, [currentRootRef, currentHeaderRef]);\n\n // We reach into AppLayoutContext in case sticky header needs to be offset down by the height\n // of other sticky elements positioned on top of the view.\n const { stickyOffsetTop } = useAppLayoutContext();\n const isSticky = useSupportsStickyHeader() && !!__stickyHeader;\n const isRefresh = useVisualRefresh(rootRef);\n\n // If it has overflow parents inside the app layout, we shouldn't apply a sticky offset.\n const [hasInnerOverflowParents, setHasInnerOverflowParents] = useState(false);\n const [isStuck, setIsStuck] = useState(false);\n useLayoutEffect(() => {\n if (rootRef.current) {\n const overflowParents = getOverflowParents(rootRef.current);\n const mainElement = findUpUntil(rootRef.current, elem => elem.tagName === 'MAIN');\n // In both versions of the app layout, the scrolling element for disableBodyScroll\n // is the <main>. If the closest overflow parent is also the closest <main> and we have\n // offset values, it's safe to assume that it's the app layout scroll root and we\n // should stop there.\n setHasInnerOverflowParents(overflowParents.length > 0 && overflowParents[0] !== mainElement);\n }\n }, [rootRef]);\n\n const effectiveStickyOffset = __stickyOffset ?? (hasInnerOverflowParents ? 0 : stickyOffsetTop);\n\n /**\n * The AppLayout refactor removed the need for passing the sticky offset in px all the time through the\n * AppLayoutDomContext provider because that information already exists on the DOM in a custom property\n * on the Layout subcomponent. Thus, if the Container header is sticky, we are in Visual Refresh and use\n * body scroll then we will use that property. When a component is used outside AppLayout, we fall back\n * to the default offset calculated in AppLayoutDomContext.\n */\n let computedOffset = `${effectiveStickyOffset - totalBorder}px`;\n if (isRefresh && !hasInnerOverflowParents) {\n computedOffset = `var(${customCssProps.offsetTopWithNotifications}, ${computedOffset})`;\n }\n\n const stickyStyles = isSticky\n ? {\n style: {\n top: computedOffset,\n },\n }\n : {};\n\n // \"stuck\" state, when the header has moved from its original posititon has a\n // box-shadow, applied here by a \"header-stuck\" className\n const checkIfStuck = useCallback(() => {\n if (rootRef.current && headerRef.current) {\n const rootTop = rootRef.current.getBoundingClientRect().top;\n const headerTop = headerRef.current.getBoundingClientRect().top;\n if (rootTop + totalBorder < headerTop) {\n setIsStuck(true);\n } else {\n setIsStuck(false);\n }\n }\n }, [rootRef, headerRef, totalBorder]);\n useEffect(() => {\n if (isSticky) {\n window.addEventListener('scroll', checkIfStuck, true);\n window.addEventListener('resize', checkIfStuck);\n return () => {\n window.removeEventListener('scroll', checkIfStuck, true);\n window.removeEventListener('resize', checkIfStuck);\n };\n }\n }, [isSticky, checkIfStuck]);\n return {\n isSticky,\n isStuck,\n stickyStyles,\n };\n};\n\nexport function useSupportsStickyHeader() {\n const isMobile = useMobile();\n return supportsStickyPosition() && !isMobile;\n}\n"]}
@@ -35,12 +35,12 @@ export interface FlashbarProps extends BaseComponentProps {
35
35
  * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.
36
36
  * When a user clicks on this button the `onButtonClick` handler is called. If the `action` property is set, this property is ignored.
37
37
  * **Deprecated**, replaced by `action`.
38
- * *`id` (string) - Specifies a unique flash message identifier. This property is used in two ways:
39
- * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.
40
- * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.
41
- * @visualrefresh `id` property
42
38
  * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button
43
39
  * using the `action` property. **Deprecated**, replaced by `action`.
40
+ * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:
41
+ * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.
42
+ * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.
43
+ * @visualrefresh `id` property
44
44
  */
45
45
  items: ReadonlyArray<FlashbarProps.MessageDefinition>;
46
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { ButtonProps } from '../button/interfaces';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called. If the `action` property is set, this property is ignored.\n * **Deprecated**, replaced by `action`.\n * *`id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n * @visualrefresh `id` property\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { ButtonProps } from '../button/interfaces';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called. If the `action` property is set, this property is ignored.\n * **Deprecated**, replaced by `action`.\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n * @visualrefresh `id` property\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n}\n"]}
@@ -4,7 +4,7 @@ import { __assign, __rest } from "tslib";
4
4
  import React, { useRef } from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { getBaseProps } from '../internal/base-component';
7
- import { FormFieldDomContext, useFormFieldContext } from '../internal/context/form-field-context';
7
+ import { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';
8
8
  import { useUniqueId } from '../internal/hooks/use-unique-id';
9
9
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
10
10
  import InternalGrid from '../grid/internal';
@@ -46,8 +46,8 @@ export default function InternalFormField(_a) {
46
46
  description && (React.createElement("div", { className: styles.description, id: slotIds.description }, description)),
47
47
  React.createElement("div", { className: clsx(styles.controls, __hideLabel && styles['label-hidden']) },
48
48
  React.createElement(InternalGrid, { gridDefinition: gridDefinition },
49
- React.createElement(FormFieldDomContext.RootProvider, { value: __assign({ controlId: generatedControlId }, contextValuesWithoutControlId) }, children && React.createElement("div", { className: styles.control }, children)),
50
- secondaryControl && (React.createElement(FormFieldDomContext.RootProvider, { value: contextValuesWithoutControlId },
49
+ React.createElement(FormFieldContext.Provider, { value: __assign({ controlId: generatedControlId }, contextValuesWithoutControlId) }, children && React.createElement("div", { className: styles.control }, children)),
50
+ secondaryControl && (React.createElement(FormFieldContext.Provider, { value: contextValuesWithoutControlId },
51
51
  React.createElement("div", { className: styles['secondary-control'] }, secondaryControl))))),
52
52
  (constraintText || errorText) && (React.createElement("div", { className: styles.hints },
53
53
  errorText && React.createElement(FormFieldError, { id: slotIds.error }, errorText),
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OA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CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;YAC1E,oBAAC,YAAY,IAAC,cAAc,EAAE,cAAc;gBAC1C,oBAAC,mBAAmB,CAAC,YAAY,IAC/B,KAAK,aACH,SAAS,EAAE,kBAAkB,IAC1B,6BAA6B,KAGjC,QAAQ,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CAC5B;gBAElC,gBAAgB,IAAI,CACnB,oBAAC,mBAAmB,CAAC,YAAY,IAAC,KAAK,EAAE,6BAA6B;oBACpE,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAG,gBAAgB,CAAO,CACpC,CACpC,CACY,CACX;QAEL,CAAC,cAAc,IAAI,SAAS,CAAC,IAAI,CAChC,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,IAAG,SAAS,CAAkB;YAC5E,cAAc,IAAI,CACjB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAC/E,EAAE,EAAE,OAAO,CAAC,UAAU,IAErB,cAAc,CACX,CACP,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldDomContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { joinStrings } from '../internal/utils/strings';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport const FormFieldError = ({ id, children }: FormFieldErrorProps) => (\n <div className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span id={id} className={styles.error__message}>\n {children}\n </span>\n </div>\n);\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n __hideLabel,\n __internalRootRef = null,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const ref = useRef<HTMLElement>(null);\n const isRefresh = useVisualRefresh(ref);\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n };\n\n const mergedRef = useMergeRefs(ref, __internalRootRef);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition}>\n <FormFieldDomContext.RootProvider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldDomContext.RootProvider>\n\n {secondaryControl && (\n <FormFieldDomContext.RootProvider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldDomContext.RootProvider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && <FormFieldError id={slotIds.error}>{errorText}</FormFieldError>}\n {constraintText && (\n <div\n className={clsx(styles.constraint, errorText && styles['constraint-has-error'])}\n id={slotIds.constraint}\n >\n {constraintText}\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,YAA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R,CACP;QAED,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;YAC1E,oBAAC,YAAY,IAAC,cAAc,EAAE,cAAc;gBAC1C,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,aACH,SAAS,EAAE,kBAAkB,IAC1B,6BAA6B,KAGjC,QAAQ,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CACnC;gBAE3B,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,6BAA6B;oBAC7D,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAG,gBAAgB,CAAO,CAC3C,CAC7B,CACY,CACX;QAEL,CAAC,cAAc,IAAI,SAAS,CAAC,IAAI,CAChC,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,IAAG,SAAS,CAAkB;YAC5E,cAAc,IAAI,CACjB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAC/E,EAAE,EAAE,OAAO,CAAC,UAAU,IAErB,cAAc,CACX,CACP,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { joinStrings } from '../internal/utils/strings';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport const FormFieldError = ({ id, children }: FormFieldErrorProps) => (\n <div className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span id={id} className={styles.error__message}>\n {children}\n </span>\n </div>\n);\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n __hideLabel,\n __internalRootRef = null,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const ref = useRef<HTMLElement>(null);\n const isRefresh = useVisualRefresh(ref);\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n };\n\n const mergedRef = useMergeRefs(ref, __internalRootRef);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && <FormFieldError id={slotIds.error}>{errorText}</FormFieldError>}\n {constraintText && (\n <div\n className={clsx(styles.constraint, errorText && styles['constraint-has-error'])}\n id={slotIds.constraint}\n >\n {constraintText}\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
@@ -567,6 +567,7 @@
567
567
  --shadow-split-bottom-otfetg:0px -36px 36px -36px rgba(0, 7, 22, 0.10);
568
568
  --shadow-split-side-qv353u:-1px 0px 1px 0px #e9ebed, -36px 6px 36px -36px rgba(0, 7, 22, 0.10);
569
569
  --shadow-sticky-aijlo6:0px 4px 20px 1px rgba(0, 7, 22, 0.10);
570
+ --shadow-sticky-embedded-qit8ba:0px 2px 0px 0px #e9ebed, 0px 16px 16px -12px rgba(0, 7, 22, 0.10);
570
571
  }
571
572
 
572
573
  .awsui-dark-mode:not(#\9) {
@@ -902,6 +903,7 @@
902
903
  --shadow-split-bottom-otfetg:0px -36px 36px -36px rgba(0, 7, 22, 1);
903
904
  --shadow-split-side-qv353u:-1px 0px 1px 0px #192534, -36px 6px 36px -36px rgba(0, 7, 22, 1);
904
905
  --shadow-sticky-aijlo6:0px 4px 20px 1px rgba(0, 7, 22, 1);
906
+ --shadow-sticky-embedded-qit8ba:0px 2px 0px 0px #414d5c, 0px 16px 16px -12px rgba(0, 7, 22, 1);
905
907
  }
906
908
 
907
909
  .awsui-compact-mode:not(#\9) {
@@ -1304,6 +1306,7 @@
1304
1306
  --shadow-split-bottom-otfetg:0px -36px 36px -36px rgba(0, 7, 22, 1);
1305
1307
  --shadow-split-side-qv353u:-1px 0px 1px 0px #192534, -36px 6px 36px -36px rgba(0, 7, 22, 1);
1306
1308
  --shadow-sticky-aijlo6:0px 4px 20px 1px rgba(0, 7, 22, 1);
1309
+ --shadow-sticky-embedded-qit8ba:0px 2px 0px 0px #414d5c, 0px 16px 16px -12px rgba(0, 7, 22, 1);
1307
1310
  }
1308
1311
 
1309
1312
  .awsui-context-flashbar:not(#\9) {
@@ -107,7 +107,7 @@ export var getDropdownPosition = function (trigger, dropdown, overflowParents, m
107
107
  var dropUp = availableSpace.below < dropdown.offsetHeight && availableSpace.above > availableSpace.below;
108
108
  var availableHeight = dropUp ? availableSpace.above : availableSpace.below;
109
109
  // Try and crop the bottom item when all options can't be displayed, affordance for "there's more"
110
- var croppedHeight = Math.floor(availableHeight / 31) * 31 + 16;
110
+ var croppedHeight = stretchHeight ? availableHeight : Math.floor(availableHeight / 31) * 31 + 16;
111
111
  return {
112
112
  dropUp: dropUp,
113
113
  dropLeft: dropLeft,
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-fit-handler.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/dropdown-fit-handler.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAc,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,IAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,IAAM,uCAAuC,GAAG,EAAE,CAAC,CAAC,UAAU;AAC9D,IAAM,yCAAyC,GAAG,EAAE,CAAC;AAoBrD,IAAM,0BAA0B,GAAG,UAAC,OAAoB;IACtD,IAAM,OAAO,GAAG,kBAAkB,CAAC,OA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IAC1E,wBAAwB,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;IAC9C,eAAe,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;IACjC,eAAe,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;IAC/B,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;IAClC,eAAe,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;IAEhC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC/D,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAChE,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAE7D,IAAM,eAAe,GAAG,2BAA2B,CAAC,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;IAChH,IAAM,QAAQ,GAAG,QAAQ;QACvB,CAAC,CAAC,2BAA2B,CAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC;QACzF,CAAC,CAAC,mBAAmB,CACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,QAAQ,CACT,CAAC;IACN,IAAM,UAAU,GAAG,cAAc,CAAC,qBAAqB,EAAE,CAAC;IAC1D,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Dimensions, getOverflowParents, getOverflowParentDimensions } from '../../utils/scrollable-containers';\nimport styles from './styles.css.js';\n\nconst AVAILABLE_SPACE_RESERVE_DEFAULT = 50;\nconst AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL = 19; // 50 - 31\nconst AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL = 20;\n\ninterface AvailableSpace {\n above: number;\n below: number;\n left: number;\n right: number;\n}\nexport interface DropdownPosition {\n height: string;\n width: string;\n dropUp: boolean;\n dropLeft: boolean;\n left: string;\n}\nexport interface InteriorDropdownPosition extends DropdownPosition {\n bottom: string;\n top: string;\n}\n\nconst getClosestParentDimensions = (element: HTMLElement): any => {\n const parents = getOverflowParents(element).map(el => {\n const { height, width, top, left } = el.getBoundingClientRect();\n return {\n height,\n width,\n top,\n left,\n };\n });\n\n return parents.shift();\n};\n\nexport const getAvailableSpace = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n stretchWidth = false,\n stretchHeight = false,\n isMobile?: boolean\n): AvailableSpace => {\n const availableSpaceReserveVertical = stretchHeight\n ? 0\n : isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const availableSpaceReserveHorizontal = stretchWidth\n ? 0\n : isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const { bottom: triggerBottom, left: triggerLeft, right: triggerRight } = trigger.getBoundingClientRect();\n\n return overflowParents.reduce(\n ({ above, below, left, right }, overflowParent) => {\n const offsetTop = triggerBottom - overflowParent.top;\n const currentAbove = offsetTop - trigger.offsetHeight - availableSpaceReserveVertical;\n const currentBelow = overflowParent.height - offsetTop - availableSpaceReserveVertical;\n const currentLeft = triggerRight - overflowParent.left - availableSpaceReserveHorizontal;\n const currentRight = overflowParent.left + overflowParent.width - triggerLeft - availableSpaceReserveHorizontal;\n\n return {\n above: Math.min(above, currentAbove),\n below: Math.min(below, currentBelow),\n left: Math.min(left, currentLeft),\n right: Math.min(right, currentRight),\n };\n },\n { above: Number.MAX_VALUE, below: Number.MAX_VALUE, left: Number.MAX_VALUE, right: Number.MAX_VALUE }\n );\n};\n\nexport const getInteriorAvailableSpace = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n isMobile?: boolean\n): AvailableSpace => {\n const AVAILABLE_SPACE_RESERVE_VERTICAL = isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const AVAILABLE_SPACE_RESERVE_HORIZONTAL = isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const {\n bottom: triggerBottom,\n top: triggerTop,\n left: triggerLeft,\n right: triggerRight,\n } = trigger.getBoundingClientRect();\n\n return overflowParents.reduce(\n ({ above, below, left, right }, overflowParent) => {\n const currentAbove = triggerBottom - overflowParent.top - AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentBelow = overflowParent.height - triggerTop + overflowParent.top - AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentLeft = triggerLeft - overflowParent.left - AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n const currentRight =\n overflowParent.left + overflowParent.width - triggerRight - AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n\n return {\n above: Math.min(above, currentAbove),\n below: Math.min(below, currentBelow),\n left: Math.min(left, currentLeft),\n right: Math.min(right, currentRight),\n };\n },\n { above: Number.MAX_VALUE, below: Number.MAX_VALUE, left: Number.MAX_VALUE, right: Number.MAX_VALUE }\n );\n};\n\nexport const getDropdownPosition = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n minWidth?: number,\n preferCenter = false,\n stretchWidth = false,\n stretchHeight = false,\n isMobile?: boolean\n): DropdownPosition => {\n const availableSpace = getAvailableSpace(trigger, dropdown, overflowParents, stretchWidth, stretchHeight, isMobile);\n const triggerWidth = trigger.getBoundingClientRect().width;\n minWidth = minWidth ? Math.min(triggerWidth, minWidth) : triggerWidth;\n const requiredWidth = dropdown.getBoundingClientRect().width;\n // dropdown should not be smaller than the trigger\n const idealWidth = Math.max(requiredWidth, minWidth);\n\n let dropLeft: boolean;\n let left: number | null = null;\n let width = idealWidth;\n\n //1. Can it be positioned with ideal width to the right?\n if (idealWidth <= availableSpace.right) {\n dropLeft = false;\n //2. Can it be positioned with ideal width to the left?\n } else if (idealWidth <= availableSpace.left) {\n dropLeft = true;\n //3. Fit into biggest available space either on left or right\n } else {\n dropLeft = availableSpace.left > availableSpace.right;\n width = Math.max(availableSpace.left, availableSpace.right, minWidth);\n }\n\n if (preferCenter) {\n const spillOver = (idealWidth - triggerWidth) / 2;\n\n // availableSpace always includes the trigger width, but we want to exclude that\n const availableOutsideLeft = availableSpace.left - triggerWidth;\n const availableOutsideRight = availableSpace.right - triggerWidth;\n\n const fitsInCenter = availableOutsideLeft >= spillOver && availableOutsideRight >= spillOver;\n if (fitsInCenter) {\n left = -spillOver;\n }\n }\n\n const dropUp = availableSpace.below < dropdown.offsetHeight && availableSpace.above > availableSpace.below;\n const availableHeight = dropUp ? availableSpace.above : availableSpace.below;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = Math.floor(availableHeight / 31) * 31 + 16;\n\n return {\n dropUp,\n dropLeft,\n left: left === null ? 'auto' : `${left}px`,\n height: `${croppedHeight}px`,\n width: `${width}px`,\n };\n};\n\nexport const getInteriorDropdownPosition = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n isMobile?: boolean\n): InteriorDropdownPosition => {\n const availableSpace = getInteriorAvailableSpace(trigger, dropdown, overflowParents, isMobile);\n const { bottom: triggerBottom, top: triggerTop, width: triggerWidth } = trigger.getBoundingClientRect();\n const { top: parentDropdownTop, height: parentDropdownHeight } = getClosestParentDimensions(trigger);\n\n let dropLeft;\n\n let width = dropdown.getBoundingClientRect().width;\n const top = triggerTop - parentDropdownTop;\n if (width <= availableSpace.right) {\n dropLeft = false;\n } else if (width <= availableSpace.left) {\n dropLeft = true;\n } else {\n dropLeft = availableSpace.left > availableSpace.right;\n width = Math.max(availableSpace.left, availableSpace.right);\n }\n\n const left = dropLeft ? 0 - width : triggerWidth;\n\n const dropUp = availableSpace.below < dropdown.offsetHeight && availableSpace.above > availableSpace.below;\n const bottom = dropUp ? parentDropdownTop + parentDropdownHeight - triggerBottom : 0;\n const availableHeight = dropUp ? availableSpace.above : availableSpace.below;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = Math.floor(availableHeight / 31) * 31 + 16;\n\n return {\n dropUp,\n dropLeft,\n height: `${croppedHeight}px`,\n width: `${width}px`,\n top: `${top}px`,\n bottom: `${bottom}px`,\n left: `${left}px`,\n };\n};\n\nexport const calculatePosition = (\n dropdownElement: HTMLDivElement,\n triggerElement: HTMLDivElement,\n verticalContainerElement: HTMLDivElement,\n interior: boolean,\n expandToViewport: boolean,\n preferCenter: boolean,\n stretchWidth: boolean,\n stretchHeight: boolean,\n isMobile: boolean,\n minWidth?: number\n): [DropdownPosition, DOMRect] => {\n // cleaning previously assigned values,\n // so that they are not reused in case of screen resize and similar events\n verticalContainerElement.style.maxHeight = '';\n dropdownElement.style.width = '';\n dropdownElement.style.top = '';\n dropdownElement.style.bottom = '';\n dropdownElement.style.left = '';\n\n dropdownElement.classList.remove(styles['dropdown-drop-left']);\n dropdownElement.classList.remove(styles['dropdown-drop-right']);\n dropdownElement.classList.remove(styles['dropdown-drop-up']);\n\n const overflowParents = getOverflowParentDimensions(dropdownElement, interior, expandToViewport, stretchHeight);\n const position = interior\n ? getInteriorDropdownPosition(triggerElement, dropdownElement, overflowParents, isMobile)\n : getDropdownPosition(\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth,\n preferCenter,\n stretchWidth,\n stretchHeight,\n isMobile\n );\n const triggerBox = triggerElement.getBoundingClientRect();\n return [position, triggerBox];\n};\n"]}
1
+ {"version":3,"file":"dropdown-fit-handler.js","sourceRoot":"","sources":["../../../../../src/internal/components/drop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Q,EACR,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,QAAQ,CACT,CAAC;IACN,IAAM,UAAU,GAAG,cAAc,CAAC,qBAAqB,EAAE,CAAC;IAC1D,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Dimensions, getOverflowParents, getOverflowParentDimensions } from '../../utils/scrollable-containers';\nimport styles from './styles.css.js';\n\nconst AVAILABLE_SPACE_RESERVE_DEFAULT = 50;\nconst AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL = 19; // 50 - 31\nconst AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL = 20;\n\ninterface AvailableSpace {\n above: number;\n below: number;\n left: number;\n right: number;\n}\nexport interface DropdownPosition {\n height: string;\n width: string;\n dropUp: boolean;\n dropLeft: boolean;\n left: string;\n}\nexport interface InteriorDropdownPosition extends DropdownPosition {\n bottom: string;\n top: string;\n}\n\nconst getClosestParentDimensions = (element: HTMLElement): any => {\n const parents = getOverflowParents(element).map(el => {\n const { height, width, top, left } = el.getBoundingClientRect();\n return {\n height,\n width,\n top,\n left,\n };\n });\n\n return parents.shift();\n};\n\nexport const getAvailableSpace = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n stretchWidth = false,\n stretchHeight = false,\n isMobile?: boolean\n): AvailableSpace => {\n const availableSpaceReserveVertical = stretchHeight\n ? 0\n : isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const availableSpaceReserveHorizontal = stretchWidth\n ? 0\n : isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const { bottom: triggerBottom, left: triggerLeft, right: triggerRight } = trigger.getBoundingClientRect();\n\n return overflowParents.reduce(\n ({ above, below, left, right }, overflowParent) => {\n const offsetTop = triggerBottom - overflowParent.top;\n const currentAbove = offsetTop - trigger.offsetHeight - availableSpaceReserveVertical;\n const currentBelow = overflowParent.height - offsetTop - availableSpaceReserveVertical;\n const currentLeft = triggerRight - overflowParent.left - availableSpaceReserveHorizontal;\n const currentRight = overflowParent.left + overflowParent.width - triggerLeft - availableSpaceReserveHorizontal;\n\n return {\n above: Math.min(above, currentAbove),\n below: Math.min(below, currentBelow),\n left: Math.min(left, currentLeft),\n right: Math.min(right, currentRight),\n };\n },\n { above: Number.MAX_VALUE, below: Number.MAX_VALUE, left: Number.MAX_VALUE, right: Number.MAX_VALUE }\n );\n};\n\nexport const getInteriorAvailableSpace = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n isMobile?: boolean\n): AvailableSpace => {\n const AVAILABLE_SPACE_RESERVE_VERTICAL = isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const AVAILABLE_SPACE_RESERVE_HORIZONTAL = isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const {\n bottom: triggerBottom,\n top: triggerTop,\n left: triggerLeft,\n right: triggerRight,\n } = trigger.getBoundingClientRect();\n\n return overflowParents.reduce(\n ({ above, below, left, right }, overflowParent) => {\n const currentAbove = triggerBottom - overflowParent.top - AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentBelow = overflowParent.height - triggerTop + overflowParent.top - AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentLeft = triggerLeft - overflowParent.left - AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n const currentRight =\n overflowParent.left + overflowParent.width - triggerRight - AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n\n return {\n above: Math.min(above, currentAbove),\n below: Math.min(below, currentBelow),\n left: Math.min(left, currentLeft),\n right: Math.min(right, currentRight),\n };\n },\n { above: Number.MAX_VALUE, below: Number.MAX_VALUE, left: Number.MAX_VALUE, right: Number.MAX_VALUE }\n );\n};\n\nexport const getDropdownPosition = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n minWidth?: number,\n preferCenter = false,\n stretchWidth = false,\n stretchHeight = false,\n isMobile?: boolean\n): DropdownPosition => {\n const availableSpace = getAvailableSpace(trigger, dropdown, overflowParents, stretchWidth, stretchHeight, isMobile);\n const triggerWidth = trigger.getBoundingClientRect().width;\n minWidth = minWidth ? Math.min(triggerWidth, minWidth) : triggerWidth;\n const requiredWidth = dropdown.getBoundingClientRect().width;\n // dropdown should not be smaller than the trigger\n const idealWidth = Math.max(requiredWidth, minWidth);\n\n let dropLeft: boolean;\n let left: number | null = null;\n let width = idealWidth;\n\n //1. Can it be positioned with ideal width to the right?\n if (idealWidth <= availableSpace.right) {\n dropLeft = false;\n //2. Can it be positioned with ideal width to the left?\n } else if (idealWidth <= availableSpace.left) {\n dropLeft = true;\n //3. Fit into biggest available space either on left or right\n } else {\n dropLeft = availableSpace.left > availableSpace.right;\n width = Math.max(availableSpace.left, availableSpace.right, minWidth);\n }\n\n if (preferCenter) {\n const spillOver = (idealWidth - triggerWidth) / 2;\n\n // availableSpace always includes the trigger width, but we want to exclude that\n const availableOutsideLeft = availableSpace.left - triggerWidth;\n const availableOutsideRight = availableSpace.right - triggerWidth;\n\n const fitsInCenter = availableOutsideLeft >= spillOver && availableOutsideRight >= spillOver;\n if (fitsInCenter) {\n left = -spillOver;\n }\n }\n\n const dropUp = availableSpace.below < dropdown.offsetHeight && availableSpace.above > availableSpace.below;\n const availableHeight = dropUp ? availableSpace.above : availableSpace.below;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = stretchHeight ? availableHeight : Math.floor(availableHeight / 31) * 31 + 16;\n\n return {\n dropUp,\n dropLeft,\n left: left === null ? 'auto' : `${left}px`,\n height: `${croppedHeight}px`,\n width: `${width}px`,\n };\n};\n\nexport const getInteriorDropdownPosition = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<Dimensions>,\n isMobile?: boolean\n): InteriorDropdownPosition => {\n const availableSpace = getInteriorAvailableSpace(trigger, dropdown, overflowParents, isMobile);\n const { bottom: triggerBottom, top: triggerTop, width: triggerWidth } = trigger.getBoundingClientRect();\n const { top: parentDropdownTop, height: parentDropdownHeight } = getClosestParentDimensions(trigger);\n\n let dropLeft;\n\n let width = dropdown.getBoundingClientRect().width;\n const top = triggerTop - parentDropdownTop;\n if (width <= availableSpace.right) {\n dropLeft = false;\n } else if (width <= availableSpace.left) {\n dropLeft = true;\n } else {\n dropLeft = availableSpace.left > availableSpace.right;\n width = Math.max(availableSpace.left, availableSpace.right);\n }\n\n const left = dropLeft ? 0 - width : triggerWidth;\n\n const dropUp = availableSpace.below < dropdown.offsetHeight && availableSpace.above > availableSpace.below;\n const bottom = dropUp ? parentDropdownTop + parentDropdownHeight - triggerBottom : 0;\n const availableHeight = dropUp ? availableSpace.above : availableSpace.below;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = Math.floor(availableHeight / 31) * 31 + 16;\n\n return {\n dropUp,\n dropLeft,\n height: `${croppedHeight}px`,\n width: `${width}px`,\n top: `${top}px`,\n bottom: `${bottom}px`,\n left: `${left}px`,\n };\n};\n\nexport const calculatePosition = (\n dropdownElement: HTMLDivElement,\n triggerElement: HTMLDivElement,\n verticalContainerElement: HTMLDivElement,\n interior: boolean,\n expandToViewport: boolean,\n preferCenter: boolean,\n stretchWidth: boolean,\n stretchHeight: boolean,\n isMobile: boolean,\n minWidth?: number\n): [DropdownPosition, DOMRect] => {\n // cleaning previously assigned values,\n // so that they are not reused in case of screen resize and similar events\n verticalContainerElement.style.maxHeight = '';\n dropdownElement.style.width = '';\n dropdownElement.style.top = '';\n dropdownElement.style.bottom = '';\n dropdownElement.style.left = '';\n\n dropdownElement.classList.remove(styles['dropdown-drop-left']);\n dropdownElement.classList.remove(styles['dropdown-drop-right']);\n dropdownElement.classList.remove(styles['dropdown-drop-up']);\n\n const overflowParents = getOverflowParentDimensions(dropdownElement, interior, expandToViewport, stretchHeight);\n const position = interior\n ? getInteriorDropdownPosition(triggerElement, dropdownElement, overflowParents, isMobile)\n : getDropdownPosition(\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth,\n preferCenter,\n stretchWidth,\n stretchHeight,\n isMobile\n );\n const triggerBox = triggerElement.getBoundingClientRect();\n return [position, triggerBox];\n};\n"]}
@@ -2,7 +2,7 @@ export interface AppLayoutContextProps {
2
2
  stickyOffsetBottom: number;
3
3
  stickyOffsetTop: number;
4
4
  }
5
- export declare const AppLayoutDomContext: import("../hooks/dom-context").DomContextDeclaration<AppLayoutContextProps>;
5
+ export declare const AppLayoutContext: import("react").Context<AppLayoutContextProps>;
6
6
  export declare function useAppLayoutContext(): {
7
7
  stickyOffsetBottom: number;
8
8
  stickyOffsetTop: number;
@@ -1 +1 @@
1
- {"version":3,"file":"app-layout-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/app-layout-context.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,mBAAmB,6EAG9B,CAAC;AAEH,wBAAgB,mBAAmB;;;EAGlC"}
1
+ {"version":3,"file":"app-layout-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/app-layout-context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB,gDAG3B,CAAC;AAEH,wBAAgB,mBAAmB;;;EAGlC"}
@@ -1,14 +1,13 @@
1
1
  import { __assign } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import { useContext } from 'react';
5
- import { createDomContext } from '../hooks/dom-context';
6
- export var AppLayoutDomContext = createDomContext('app-layout-context', {
4
+ import { useContext, createContext } from 'react';
5
+ export var AppLayoutContext = createContext({
7
6
  stickyOffsetTop: 0,
8
7
  stickyOffsetBottom: 0
9
8
  });
10
9
  export function useAppLayoutContext() {
11
- var context = useContext(AppLayoutDomContext.context);
10
+ var context = useContext(AppLayoutContext);
12
11
  return __assign({}, context);
13
12
  }
14
13
  //# sourceMappingURL=app-layout-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-layout-context.js","sourceRoot":"","sources":["../../../../src/internal/context/app-layout-context.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAOxD,MAAM,CAAC,IAAM,mBAAmB,GAAG,gBAAgB,CAAwB,oBAAoB,EAAE;IAC/F,eAAe,EAAE,CAAC;IAClB,kBAAkB,EAAE,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,UAAU,mBAAmB;IACjC,IAAM,OAAO,GAAG,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACxD,oBAAY,OAAO,EAAG;AACxB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useContext } from 'react';\nimport { createDomContext } from '../hooks/dom-context';\n\nexport interface AppLayoutContextProps {\n stickyOffsetBottom: number;\n stickyOffsetTop: number;\n}\n\nexport const AppLayoutDomContext = createDomContext<AppLayoutContextProps>('app-layout-context', {\n stickyOffsetTop: 0,\n stickyOffsetBottom: 0,\n});\n\nexport function useAppLayoutContext() {\n const context = useContext(AppLayoutDomContext.context);\n return { ...context };\n}\n"]}
1
+ {"version":3,"file":"app-layout-context.js","sourceRoot":"","sources":["../../../../src/internal/context/app-layout-context.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOlD,MAAM,CAAC,IAAM,gBAAgB,GAAG,aAAa,CAAwB;IACnE,eAAe,EAAE,CAAC;IAClB,kBAAkB,EAAE,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,UAAU,mBAAmB;IACjC,IAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC7C,oBAAY,OAAO,EAAG;AACxB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useContext, createContext } from 'react';\n\nexport interface AppLayoutContextProps {\n stickyOffsetBottom: number;\n stickyOffsetTop: number;\n}\n\nexport const AppLayoutContext = createContext<AppLayoutContextProps>({\n stickyOffsetTop: 0,\n stickyOffsetBottom: 0,\n});\n\nexport function useAppLayoutContext() {\n const context = useContext(AppLayoutContext);\n return { ...context };\n}\n"]}
@@ -39,6 +39,6 @@ export interface FormFieldValidationControlProps extends FormFieldControlProps {
39
39
  */
40
40
  invalid?: boolean;
41
41
  }
42
- export declare const FormFieldDomContext: import("../hooks/dom-context").DomContextDeclaration<FormFieldValidationControlProps>;
42
+ export declare const FormFieldContext: import("react").Context<FormFieldValidationControlProps>;
43
43
  export declare function useFormFieldContext(props: FormFieldValidationControlProps): FormFieldValidationControlProps;
44
44
  //# sourceMappingURL=form-field-context.d.ts.map