@cloudscape-design/components 3.0.21 → 3.0.24

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 (156) hide show
  1. package/alert/styles.scoped.css +0 -34
  2. package/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
  3. package/annotation-context/annotation/annotation-popover.js +12 -16
  4. package/annotation-context/annotation/annotation-popover.js.map +1 -1
  5. package/annotation-context/annotation/styles.scoped.css +0 -18
  6. package/app-layout/content-wrapper/styles.scoped.css +0 -4
  7. package/app-layout/index.d.ts.map +1 -1
  8. package/app-layout/index.js +6 -4
  9. package/app-layout/index.js.map +1 -1
  10. package/app-layout/mobile-toolbar/styles.scoped.css +0 -9
  11. package/app-layout/styles.scoped.css +0 -20
  12. package/app-layout/toggles/styles.scoped.css +0 -16
  13. package/app-layout/visual-refresh/styles.scoped.css +0 -71
  14. package/area-chart/styles.scoped.css +0 -13
  15. package/attribute-editor/styles.scoped.css +0 -23
  16. package/autosuggest/internal.d.ts.map +1 -1
  17. package/autosuggest/internal.js +2 -7
  18. package/autosuggest/internal.js.map +1 -1
  19. package/badge/styles.scoped.css +0 -15
  20. package/box/styles.scoped.css +0 -171
  21. package/breadcrumb-group/item/styles.scoped.css +0 -11
  22. package/breadcrumb-group/styles.scoped.css +0 -10
  23. package/button/styles.scoped.css +0 -264
  24. package/button-dropdown/category-elements/styles.scoped.css +0 -26
  25. package/button-dropdown/item-element/styles.scoped.css +0 -22
  26. package/button-dropdown/mobile-expandable-group/styles.scoped.css +0 -5
  27. package/button-dropdown/styles.scoped.css +0 -7
  28. package/cards/styles.scoped.css +0 -45
  29. package/checkbox/styles.scoped.css +0 -11
  30. package/code-editor/styles.scoped.css +0 -87
  31. package/collection-preferences/styles.scoped.css +0 -12
  32. package/column-layout/styles.scoped.css +0 -12
  33. package/container/styles.scoped.css +0 -27
  34. package/date-picker/calendar/index.d.ts.map +1 -1
  35. package/date-picker/calendar/index.js +2 -2
  36. package/date-picker/calendar/index.js.map +1 -1
  37. package/date-picker/calendar/utils/locales.d.ts +2 -0
  38. package/date-picker/calendar/utils/locales.d.ts.map +1 -1
  39. package/date-picker/calendar/utils/locales.js +4 -0
  40. package/date-picker/calendar/utils/locales.js.map +1 -1
  41. package/date-picker/styles.scoped.css +0 -45
  42. package/date-range-picker/calendar/grids/day/styles.scoped.css +0 -45
  43. package/date-range-picker/calendar/index.d.ts +1 -1
  44. package/date-range-picker/calendar/index.d.ts.map +1 -1
  45. package/date-range-picker/calendar/index.js +3 -1
  46. package/date-range-picker/calendar/index.js.map +1 -1
  47. package/date-range-picker/dropdown.d.ts +1 -2
  48. package/date-range-picker/dropdown.d.ts.map +1 -1
  49. package/date-range-picker/dropdown.js.map +1 -1
  50. package/date-range-picker/index.d.ts.map +1 -1
  51. package/date-range-picker/index.js +1 -3
  52. package/date-range-picker/index.js.map +1 -1
  53. package/date-range-picker/relative-range/styles.scoped.css +0 -3
  54. package/date-range-picker/styles.scoped.css +0 -39
  55. package/expandable-section/styles.scoped.css +0 -33
  56. package/flashbar/styles.scoped.css +0 -36
  57. package/form/styles.scoped.css +0 -12
  58. package/form-field/styles.scoped.css +0 -26
  59. package/grid/styles.scoped.css +0 -6
  60. package/header/styles.scoped.css +0 -51
  61. package/help-panel/styles.scoped.css +0 -73
  62. package/hotspot/styles.scoped.css +0 -3
  63. package/icon/styles.scoped.css +0 -33
  64. package/input/styles.scoped.css +0 -49
  65. package/internal/base-component/styles.scoped.css +0 -1
  66. package/internal/components/abstract-switch/styles.scoped.css +0 -7
  67. package/internal/components/button-trigger/styles.scoped.css +0 -42
  68. package/internal/components/cartesian-chart/styles.scoped.css +0 -10
  69. package/internal/components/chart-filter/styles.scoped.css +0 -4
  70. package/internal/components/chart-legend/styles.scoped.css +0 -8
  71. package/internal/components/chart-plot/styles.scoped.css +0 -1
  72. package/internal/components/chart-popover/styles.scoped.css +0 -4
  73. package/internal/components/chart-series-details/styles.scoped.css +0 -12
  74. package/internal/components/chart-series-marker/styles.scoped.css +0 -7
  75. package/internal/components/chart-status-container/styles.scoped.css +0 -1
  76. package/internal/components/checkbox-icon/styles.scoped.css +0 -10
  77. package/internal/components/content-layout/styles.scoped.css +0 -5
  78. package/internal/components/dark-ribbon/styles.scoped.css +0 -1
  79. package/internal/components/dropdown/index.d.ts +1 -1
  80. package/internal/components/dropdown/index.d.ts.map +1 -1
  81. package/internal/components/dropdown/index.js +9 -3
  82. package/internal/components/dropdown/index.js.map +1 -1
  83. package/internal/components/dropdown/interfaces.d.ts +4 -0
  84. package/internal/components/dropdown/interfaces.d.ts.map +1 -1
  85. package/internal/components/dropdown/interfaces.js.map +1 -1
  86. package/internal/components/dropdown/styles.scoped.css +0 -17
  87. package/internal/components/dropdown-footer/styles.scoped.css +0 -6
  88. package/internal/components/dropdown-status/styles.scoped.css +0 -6
  89. package/internal/components/filtering-token/styles.scoped.css +0 -21
  90. package/internal/components/menu-dropdown/styles.scoped.css +0 -17
  91. package/internal/components/option/index.js +3 -3
  92. package/internal/components/option/index.js.map +1 -1
  93. package/internal/components/option/option-parts.js +3 -3
  94. package/internal/components/option/option-parts.js.map +1 -1
  95. package/internal/components/option/styles.scoped.css +0 -16
  96. package/internal/components/options-list/styles.scoped.css +0 -5
  97. package/internal/components/selectable-item/styles.scoped.css +0 -44
  98. package/internal/environment.js +1 -1
  99. package/link/styles.scoped.css +0 -77
  100. package/mixed-line-bar-chart/styles.scoped.css +0 -13
  101. package/modal/styles.scoped.css +0 -31
  102. package/multiselect/styles.scoped.css +0 -4
  103. package/package.json +1 -1
  104. package/pagination/styles.scoped.css +0 -22
  105. package/pie-chart/styles.scoped.css +0 -25
  106. package/popover/styles.scoped.css +0 -35
  107. package/progress-bar/internal.d.ts.map +1 -1
  108. package/progress-bar/internal.js +1 -1
  109. package/progress-bar/internal.js.map +1 -1
  110. package/progress-bar/styles.scoped.css +0 -25
  111. package/property-filter/controller.d.ts +3 -3
  112. package/property-filter/controller.d.ts.map +1 -1
  113. package/property-filter/interfaces.d.ts +7 -20
  114. package/property-filter/interfaces.d.ts.map +1 -1
  115. package/property-filter/interfaces.js.map +1 -1
  116. package/property-filter/styles.scoped.css +0 -22
  117. package/property-filter/use-load-items.d.ts +1 -1
  118. package/radio-group/styles.scoped.css +0 -22
  119. package/s3-resource-selector/s3-in-context/styles.scoped.css +0 -6
  120. package/segmented-control/styles.scoped.css +0 -36
  121. package/select/parts/styles.scoped.css +0 -6
  122. package/select/styles.scoped.css +0 -4
  123. package/side-navigation/styles.scoped.css +0 -38
  124. package/space-between/styles.scoped.css +0 -40
  125. package/spinner/styles.scoped.css +0 -17
  126. package/split-panel/styles.scoped.css +0 -65
  127. package/status-indicator/styles.scoped.css +0 -20
  128. package/table/body-cell/styles.scoped.css +0 -29
  129. package/table/header-cell/styles.scoped.css +0 -32
  130. package/table/resizer/styles.scoped.css +0 -6
  131. package/table/selection-control/styles.scoped.css +0 -3
  132. package/table/styles.scoped.css +0 -39
  133. package/tabs/styles.scoped.css +0 -41
  134. package/tabs/tab-header-bar.d.ts.map +1 -1
  135. package/tabs/tab-header-bar.js +3 -1
  136. package/tabs/tab-header-bar.js.map +1 -1
  137. package/tag-editor/styles.scoped.css +0 -12
  138. package/test-utils/dom/split-panel/index.d.ts +1 -0
  139. package/test-utils/dom/split-panel/index.js +3 -0
  140. package/test-utils/dom/split-panel/index.js.map +1 -1
  141. package/test-utils/selectors/split-panel/index.d.ts +1 -0
  142. package/test-utils/selectors/split-panel/index.js +3 -0
  143. package/test-utils/selectors/split-panel/index.js.map +1 -1
  144. package/test-utils/tsconfig.tsbuildinfo +1 -1
  145. package/text-content/styles.scoped.css +0 -54
  146. package/text-filter/styles.scoped.css +0 -7
  147. package/textarea/styles.scoped.css +0 -30
  148. package/tiles/styles.scoped.css +0 -55
  149. package/toggle/styles.scoped.css +0 -14
  150. package/token-group/styles.scoped.css +0 -35
  151. package/top-navigation/1.0-beta/styles.scoped.css +0 -40
  152. package/top-navigation/styles.scoped.css +0 -75
  153. package/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +0 -22
  154. package/tutorial-panel/components/tutorial-list/styles.scoped.css +0 -24
  155. package/tutorial-panel/styles.scoped.css +0 -5
  156. package/wizard/styles.scoped.css +0 -54
@@ -95,7 +95,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
95
95
  SPDX-License-Identifier: Apache-2.0
96
96
  */
97
97
  .awsui_button-trigger_18eso_10fjc_97 > .awsui_arrow_18eso_10fjc_97:not(#\9) {
98
- transition: transform 135ms cubic-bezier(0.165, 0.84, 0.44, 1);
99
98
  transition: transform var(--motion-duration-rotate-180-ofa1ir, 135ms) var(--motion-easing-rotate-180-3rbbga, cubic-bezier(0.165, 0.84, 0.44, 1));
100
99
  }
101
100
  @media (prefers-reduced-motion: reduce) {
@@ -143,81 +142,58 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
143
142
  widows: 2;
144
143
  word-spacing: normal;
145
144
  box-sizing: border-box;
146
- font-size: 14px;
147
145
  font-size: var(--font-body-m-size-sregvd, 14px);
148
- line-height: 22px;
149
146
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
150
- color: #000716;
151
147
  color: var(--color-text-body-default-ajf1h5, #000716);
152
148
  font-weight: 400;
153
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
154
149
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
155
150
  position: relative;
156
151
  display: flex;
157
152
  width: 100%;
158
153
  justify-content: space-between;
159
154
  align-items: center;
160
- padding: 4px 12px;
161
155
  padding: var(--space-scaled-xxs-95dhkm, 4px) var(--space-field-horizontal-89h2yr, 12px);
162
- background-color: #ffffff;
163
156
  background-color: var(--color-background-input-default-u57378, #ffffff);
164
- border-radius: 8px;
165
157
  border-radius: var(--border-radius-input-txq8zy, 8px);
166
- border: 2px solid #9ba7b6;
167
158
  border: var(--border-field-width-idlekx, 2px) solid var(--color-border-input-default-dtyu8d, #9ba7b6);
168
- min-height: 34px;
169
159
  min-height: var(--size-vertical-input-js5hfh, 34px);
170
160
  }
171
161
  .awsui_button-trigger_18eso_10fjc_97.awsui_has-caret_18eso_10fjc_135:not(#\9) {
172
- padding-right: 36px;
173
162
  padding-right: var(--space-field-icon-offset-25xih0, 36px);
174
163
  }
175
164
  .awsui_button-trigger_18eso_10fjc_97 > .awsui_placeholder_18eso_10fjc_138:not(#\9) {
176
- color: #5f6b7a;
177
165
  color: var(--color-text-input-placeholder-j53j3c, #5f6b7a);
178
166
  font-style: italic;
179
167
  }
180
168
  .awsui_button-trigger_18eso_10fjc_97 > .awsui_arrow_18eso_10fjc_97:not(#\9) {
181
169
  position: absolute;
182
- right: 12px;
183
170
  right: var(--space-field-horizontal-89h2yr, 12px);
184
- top: calc(50% - 22px / 2);
185
171
  top: calc(50% - var(--font-body-m-line-height-i7xxvv, 22px) / 2);
186
- color: #0972d3;
187
172
  color: var(--color-text-button-inline-icon-default-w65lqn, #0972d3);
188
173
  }
189
174
  .awsui_button-trigger_18eso_10fjc_97:not(#\9):hover > .awsui_arrow_18eso_10fjc_97 {
190
- color: #033160;
191
175
  color: var(--color-text-button-inline-icon-hover-wd5icp, #033160);
192
176
  }
193
177
  .awsui_button-trigger_18eso_10fjc_97.awsui_pressed_18eso_10fjc_151 > .awsui_arrow_18eso_10fjc_97:not(#\9) {
194
178
  transform: rotate(-180deg);
195
179
  }
196
180
  .awsui_button-trigger_18eso_10fjc_97.awsui_disabled_18eso_10fjc_154:not(#\9) {
197
- background-color: #e9ebed;
198
181
  background-color: var(--color-background-input-disabled-wu9j6u, #e9ebed);
199
- border: 2px solid #e9ebed;
200
182
  border: var(--border-field-width-idlekx, 2px) solid var(--color-border-input-disabled-x2lopj, #e9ebed);
201
- color: #9ba7b6;
202
183
  color: var(--color-text-input-disabled-oawyzo, #9ba7b6);
203
184
  cursor: auto;
204
185
  }
205
186
  .awsui_button-trigger_18eso_10fjc_97.awsui_disabled_18eso_10fjc_154 > .awsui_arrow_18eso_10fjc_97:not(#\9) {
206
- color: #9ba7b6;
207
187
  color: var(--color-text-button-inline-icon-disabled-gfhvz7, #9ba7b6);
208
188
  }
209
189
  .awsui_button-trigger_18eso_10fjc_97.awsui_disabled_18eso_10fjc_154.awsui_in-filtering-token_18eso_10fjc_163:not(#\9) {
210
- border-color: #d1d5db;
211
190
  border-color: var(--color-border-control-disabled-vx8bco, #d1d5db);
212
191
  }
213
192
  .awsui_button-trigger_18eso_10fjc_97.awsui_disabled_18eso_10fjc_154 > .awsui_placeholder_18eso_10fjc_138:not(#\9) {
214
- color: #9ba7b6;
215
193
  color: var(--color-text-input-placeholder-disabled-6928j8, #9ba7b6);
216
194
  }
217
195
  .awsui_button-trigger_18eso_10fjc_97.awsui_read-only_18eso_10fjc_169:not(#\9) {
218
- background-color: #ffffff;
219
196
  background-color: var(--color-background-input-default-u57378, #ffffff);
220
- border: 2px solid #e9ebed;
221
197
  border: var(--border-field-width-idlekx, 2px) solid var(--color-border-input-disabled-x2lopj, #e9ebed);
222
198
  }
223
199
  .awsui_button-trigger_18eso_10fjc_97:not(#\9):focus {
@@ -226,36 +202,25 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
226
202
  }
227
203
  .awsui_button-trigger_18eso_10fjc_97:not(#\9):not(.awsui_in-filtering-token_18eso_10fjc_163)[data-awsui-focus-visible=true]:focus {
228
204
  outline: 2px dotted transparent;
229
- border: 2px solid #0972d3;
230
205
  border: var(--border-field-width-idlekx, 2px) solid var(--color-border-item-focused-ap3b6s, #0972d3);
231
- border-radius: 8px;
232
206
  border-radius: var(--border-radius-input-txq8zy, 8px);
233
- box-shadow: 0 0 0 0px #0972d3;
234
207
  box-shadow: 0 0 0 var(--border-control-focus-ring-shadow-spread-srzyiu, 0px) var(--color-border-item-focused-ap3b6s, #0972d3);
235
208
  }
236
209
  .awsui_button-trigger_18eso_10fjc_97:not(#\9):not(.awsui_in-filtering-token_18eso_10fjc_163):invalid {
237
210
  box-shadow: none;
238
211
  }
239
212
  .awsui_button-trigger_18eso_10fjc_97:not(#\9):not(.awsui_in-filtering-token_18eso_10fjc_163).awsui_invalid_18eso_10fjc_186, .awsui_button-trigger_18eso_10fjc_97:not(#\9):not(.awsui_in-filtering-token_18eso_10fjc_163).awsui_invalid_18eso_10fjc_186:focus {
240
- color: #d91515;
241
213
  color: var(--color-text-status-error-5sesl6, #d91515);
242
- border-color: #d91515;
243
214
  border-color: var(--color-text-status-error-5sesl6, #d91515);
244
- padding-left: calc(
245
- 12px - (8px - 2px)
246
- );
247
215
  padding-left: calc(
248
216
  var(--space-field-horizontal-89h2yr, 12px) - (var(--border-invalid-width-5jpdqn, 8px) - var(--border-field-width-idlekx, 2px))
249
217
  );
250
- border-left-width: 8px;
251
218
  border-left-width: var(--border-invalid-width-5jpdqn, 8px);
252
219
  }
253
220
  .awsui_button-trigger_18eso_10fjc_97:not(#\9):not(.awsui_in-filtering-token_18eso_10fjc_163).awsui_invalid_18eso_10fjc_186:focus, .awsui_button-trigger_18eso_10fjc_97:not(#\9):not(.awsui_in-filtering-token_18eso_10fjc_163).awsui_invalid_18eso_10fjc_186:focus:focus {
254
- box-shadow: 0 0 0 2px #0972d3;
255
221
  box-shadow: 0 0 0 var(--border-control-invalid-focus-ring-shadow-spread-omt6il, 2px) var(--color-border-item-focused-ap3b6s, #0972d3);
256
222
  }
257
223
  .awsui_button-trigger_18eso_10fjc_97.awsui_in-filtering-token_18eso_10fjc_163:not(#\9) {
258
- border-color: #0972d3;
259
224
  border-color: var(--color-border-item-selected-ppkssz, #0972d3);
260
225
  border-top-right-radius: 0;
261
226
  border-bottom-right-radius: 0;
@@ -266,23 +231,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
266
231
  }
267
232
  .awsui_button-trigger_18eso_10fjc_97.awsui_in-filtering-token_18eso_10fjc_163[data-awsui-focus-visible=true]:not(#\9):focus {
268
233
  outline: 2px dotted transparent;
269
- outline-offset: calc(-5px - 1px);
270
234
  outline-offset: calc(var(--space-filtering-token-operation-select-focus-outline-gutter-awvnzl, -5px) - 1px);
271
235
  }
272
236
  .awsui_button-trigger_18eso_10fjc_97.awsui_in-filtering-token_18eso_10fjc_163[data-awsui-focus-visible=true]:not(#\9):focus::before {
273
237
  content: " ";
274
238
  display: block;
275
239
  position: absolute;
276
- left: calc(-1 * -5px);
277
240
  left: calc(-1 * var(--space-filtering-token-operation-select-focus-outline-gutter-awvnzl, -5px));
278
- top: calc(-1 * -5px);
279
241
  top: calc(-1 * var(--space-filtering-token-operation-select-focus-outline-gutter-awvnzl, -5px));
280
- width: calc(100% + 2 * -5px);
281
242
  width: calc(100% + 2 * var(--space-filtering-token-operation-select-focus-outline-gutter-awvnzl, -5px));
282
- height: calc(100% + 2 * -5px);
283
243
  height: calc(100% + 2 * var(--space-filtering-token-operation-select-focus-outline-gutter-awvnzl, -5px));
284
- border-radius: 4px;
285
244
  border-radius: var(--border-radius-control-default-focus-ring-7661kz, 4px);
286
- box-shadow: 0 0 0 2px #0972d3;
287
245
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
288
246
  }
@@ -8,7 +8,6 @@
8
8
  */
9
9
  .awsui_axis_f0fot_62k26_9:not(#\9),
10
10
  .awsui_vertical-marker_f0fot_62k26_10:not(#\9) {
11
- stroke: #d1d5db;
12
11
  stroke: var(--color-charts-line-axis-yo865k, #d1d5db);
13
12
  stroke-width: 1px;
14
13
  }
@@ -19,7 +18,6 @@
19
18
 
20
19
  .awsui_axis-label_f0fot_62k26_19:not(#\9) {
21
20
  font-weight: bold;
22
- fill: #000716;
23
21
  fill: var(--color-text-body-default-ajf1h5, #000716);
24
22
  }
25
23
 
@@ -29,21 +27,17 @@
29
27
  }
30
28
 
31
29
  .awsui_grid_f0fot_62k26_29:not(#\9) {
32
- stroke: #d1d5db;
33
30
  stroke: var(--color-charts-line-grid-6wil4m, #d1d5db);
34
31
  stroke-width: 1px;
35
32
  }
36
33
 
37
34
  .awsui_ticks__line_f0fot_62k26_34:not(#\9) {
38
- stroke: #d1d5db;
39
35
  stroke: var(--color-charts-line-tick-yidpvu, #d1d5db);
40
36
  stroke-width: 1px;
41
37
  }
42
38
 
43
39
  .awsui_ticks__text_f0fot_62k26_39:not(#\9) {
44
- font-size: 12px;
45
40
  font-size: var(--font-chart-detail-size-pm0amk, 12px);
46
- fill: #414d5c;
47
41
  fill: var(--color-text-body-secondary-fdstdf, #414d5c);
48
42
  }
49
43
 
@@ -96,16 +90,13 @@
96
90
  }
97
91
 
98
92
  .awsui_vertical-marker-circle_f0fot_62k26_92:not(#\9) {
99
- fill: #ffffff;
100
93
  fill: var(--color-background-container-content-i8i4a0, #ffffff);
101
94
  pointer-events: none;
102
- stroke-width: 2px;
103
95
  stroke-width: var(--border-line-chart-width-nj0hc5, 2px);
104
96
  }
105
97
 
106
98
  .awsui_vertical-marker-circle-active_f0fot_62k26_98:not(#\9) {
107
99
  cursor: pointer;
108
- stroke-width: 2px;
109
100
  stroke-width: var(--border-line-chart-width-nj0hc5, 2px);
110
101
  }
111
102
 
@@ -113,7 +104,6 @@
113
104
  outline: none;
114
105
  pointer-events: none;
115
106
  fill: none;
116
- stroke: #0972d3;
117
107
  stroke: var(--color-border-item-focused-ap3b6s, #0972d3);
118
108
  stroke-width: 2px;
119
109
  }
@@ -120,14 +120,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
120
120
  widows: 2;
121
121
  word-spacing: normal;
122
122
  box-sizing: border-box;
123
- font-size: 14px;
124
123
  font-size: var(--font-body-m-size-sregvd, 14px);
125
- line-height: 22px;
126
124
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
127
- color: #000716;
128
125
  color: var(--color-text-body-default-ajf1h5, #000716);
129
126
  font-weight: 400;
130
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
131
127
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
132
128
  }
133
129
 
@@ -91,7 +91,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
93
  .awsui_marker_1kjc7_10w04_93:not(#\9) {
94
- transition: opacity 90ms linear;
95
94
  transition: opacity var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear);
96
95
  }
97
96
  @media (prefers-reduced-motion: reduce) {
@@ -139,14 +138,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
139
138
  widows: 2;
140
139
  word-spacing: normal;
141
140
  box-sizing: border-box;
142
- font-size: 14px;
143
141
  font-size: var(--font-body-m-size-sregvd, 14px);
144
- line-height: 22px;
145
142
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
146
- color: #000716;
147
143
  color: var(--color-text-body-default-ajf1h5, #000716);
148
144
  font-weight: 400;
149
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
150
145
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
151
146
  }
152
147
  .awsui_root_1kjc7_10w04_111:not(#\9):focus {
@@ -168,7 +163,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
168
163
  .awsui_marker_1kjc7_10w04_93:not(#\9) {
169
164
  display: inline-flex;
170
165
  align-items: flex-start;
171
- margin-right: 16px;
172
166
  margin-right: var(--space-m-17eucw, 16px);
173
167
  padding: 0;
174
168
  cursor: pointer;
@@ -201,8 +195,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
201
195
  top: calc(-1 * 2px);
202
196
  width: calc(100% + 2 * 2px);
203
197
  height: calc(100% + 2 * 2px);
204
- border-radius: 4px;
205
198
  border-radius: var(--border-radius-control-default-focus-ring-7661kz, 4px);
206
- box-shadow: 0 0 0 2px #0972d3;
207
199
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
208
200
  }
@@ -111,7 +111,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
111
111
  outline: none;
112
112
  pointer-events: none;
113
113
  fill: none;
114
- stroke: #0972d3;
115
114
  stroke: var(--color-border-item-focused-ap3b6s, #0972d3);
116
115
  stroke-width: 2px;
117
116
  visibility: hidden;
@@ -120,14 +120,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
120
120
  widows: 2;
121
121
  word-spacing: normal;
122
122
  box-sizing: border-box;
123
- font-size: 14px;
124
123
  font-size: var(--font-body-m-size-sregvd, 14px);
125
- line-height: 22px;
126
124
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
127
- color: #000716;
128
125
  color: var(--color-text-body-default-ajf1h5, #000716);
129
126
  font-weight: 400;
130
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
131
127
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
132
128
  position: absolute;
133
129
  pointer-events: none;
@@ -91,9 +91,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
93
  .awsui_dimmed_10ipo_1pmg0_93:not(#\9) {
94
- transition: opacity 90ms linear;
95
94
  transition: opacity var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear);
96
- transition-delay: 90ms;
97
95
  transition-delay: var(--motion-duration-transition-quick-x85tae, 90ms);
98
96
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
99
97
  border-collapse: separate;
@@ -124,14 +122,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
124
122
  widows: 2;
125
123
  word-spacing: normal;
126
124
  box-sizing: border-box;
127
- font-size: 14px;
128
125
  font-size: var(--font-body-m-size-sregvd, 14px);
129
- line-height: 22px;
130
126
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
131
- color: #000716;
132
127
  color: var(--color-text-body-default-ajf1h5, #000716);
133
128
  font-weight: 400;
134
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
135
129
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
136
130
  }
137
131
  @media (prefers-reduced-motion: reduce) {
@@ -179,14 +173,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
179
173
  widows: 2;
180
174
  word-spacing: normal;
181
175
  box-sizing: border-box;
182
- font-size: 14px;
183
176
  font-size: var(--font-body-m-size-sregvd, 14px);
184
- line-height: 22px;
185
177
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
186
- color: #000716;
187
178
  color: var(--color-text-body-default-ajf1h5, #000716);
188
179
  font-weight: 400;
189
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
190
180
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
191
181
  }
192
182
 
@@ -205,9 +195,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
205
195
  .awsui_key_10ipo_1pmg0_143:not(#\9) {
206
196
  display: inline-flex;
207
197
  align-items: flex-start;
208
- color: #414d5c;
209
198
  color: var(--color-text-group-label-w9to2i, #414d5c);
210
- margin-right: 32px;
211
199
  margin-right: var(--space-xxl-2nvmf1, 32px);
212
200
  }
213
201
 
@@ -120,18 +120,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
120
120
  widows: 2;
121
121
  word-spacing: normal;
122
122
  box-sizing: border-box;
123
- font-size: 14px;
124
123
  font-size: var(--font-body-m-size-sregvd, 14px);
125
- line-height: 22px;
126
124
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
127
- color: #000716;
128
125
  color: var(--color-text-body-default-ajf1h5, #000716);
129
126
  font-weight: 400;
130
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
131
127
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
132
- margin-right: 4px;
133
128
  margin-right: var(--space-xxs-ynfts5, 4px);
134
- margin-top: 4px;
135
129
  margin-top: var(--space-xxs-ynfts5, 4px);
136
130
  border-radius: 2px;
137
131
  width: 14px;
@@ -155,7 +149,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
155
149
  display: block;
156
150
  margin: 2px;
157
151
  height: 10px;
158
- background-color: #ffffff;
159
152
  background-color: var(--color-background-container-content-i8i4a0, #ffffff);
160
153
  opacity: 0.5;
161
154
  }
@@ -11,6 +11,5 @@
11
11
  }
12
12
 
13
13
  .awsui_empty_11n0s_12rv1_13:not(#\9) {
14
- color: #5f6b7a;
15
14
  color: var(--color-text-empty-fjv325, #5f6b7a);
16
15
  }
@@ -98,25 +98,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
98
98
  left: 0;
99
99
  }
100
100
  .awsui_root_1fn7j_18k9z_93 > .awsui_styled-box_1fn7j_18k9z_100:not(#\9) {
101
- fill: #ffffff;
102
101
  fill: var(--color-background-control-default-4pa05r, #ffffff);
103
- stroke: #7d8998;
104
102
  stroke: var(--color-border-control-default-m3lmsh, #7d8998);
105
- stroke-width: 2px;
106
103
  stroke-width: var(--border-field-width-idlekx, 2px);
107
- transition: fill 90ms linear, stroke 90ms linear;
108
104
  transition: fill var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear), stroke var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear);
109
105
  }
110
106
  .awsui_root_1fn7j_18k9z_93 > .awsui_styled-box-checked_1fn7j_18k9z_106:not(#\9), .awsui_root_1fn7j_18k9z_93 > .awsui_styled-box-indeterminate_1fn7j_18k9z_106:not(#\9) {
111
- fill: #0972d3;
112
107
  fill: var(--color-background-control-checked-9admlu, #0972d3);
113
- stroke: #0972d3;
114
108
  stroke: var(--color-border-control-checked-4xvndc, #0972d3);
115
109
  }
116
110
  .awsui_root_1fn7j_18k9z_93 > .awsui_styled-box-disabled_1fn7j_18k9z_110:not(#\9) {
117
- fill: #d1d5db;
118
111
  fill: var(--color-background-control-disabled-zplipy, #d1d5db);
119
- stroke: #d1d5db;
120
112
  stroke: var(--color-border-control-disabled-vx8bco, #d1d5db);
121
113
  }
122
114
  @media (prefers-reduced-motion: reduce) {
@@ -130,12 +122,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
130
122
  transition: none;
131
123
  }
132
124
  .awsui_root_1fn7j_18k9z_93 > .awsui_styled-line_1fn7j_18k9z_124:not(#\9) {
133
- stroke: #ffffff;
134
125
  stroke: var(--color-foreground-control-default-7ajdem, #ffffff);
135
126
  stroke-width: 2;
136
127
  fill: none;
137
128
  }
138
129
  .awsui_root_1fn7j_18k9z_93 > .awsui_styled-line-disabled_1fn7j_18k9z_129:not(#\9) {
139
- stroke: #ffffff;
140
130
  stroke: var(--color-foreground-control-disabled-v6a97u, #ffffff);
141
131
  }
@@ -104,7 +104,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
104
104
  .awsui_layout_z2o52_i6vs5_93.awsui_is-visual-refresh_z2o52_i6vs5_93:not(#\9) {
105
105
  display: grid;
106
106
  grid-template-columns: 1fr;
107
- grid-template-rows: auto 36px 1fr;
108
107
  grid-template-rows: auto var(--space-dark-header-overlap-distance-hfejul, 36px) 1fr;
109
108
  min-height: 100%;
110
109
  }
@@ -112,7 +111,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
112
111
  grid-template-rows: auto 0 1fr;
113
112
  }
114
113
  .awsui_layout_z2o52_i6vs5_93.awsui_is-visual-refresh_z2o52_i6vs5_93 > .awsui_background_z2o52_i6vs5_96:not(#\9) {
115
- background-color: #ffffff;
116
114
  background-color: var(--color-background-layout-main-sfhm4y, #ffffff);
117
115
  grid-column: 1;
118
116
  grid-row: 1/3;
@@ -123,18 +121,15 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
123
121
  .awsui_layout_z2o52_i6vs5_93.awsui_is-visual-refresh_z2o52_i6vs5_93 > .awsui_header_z2o52_i6vs5_99:not(#\9) {
124
122
  grid-column: 1;
125
123
  grid-row: 1;
126
- padding-bottom: 24px;
127
124
  padding-bottom: var(--space-dark-header-padding-bottom-jg1586, 24px);
128
125
  }
129
126
  @media (min-width: 689px) {
130
127
  .awsui_layout_z2o52_i6vs5_93.awsui_is-visual-refresh_z2o52_i6vs5_93 > .awsui_header_z2o52_i6vs5_99.awsui_has-breadcrumbs_z2o52_i6vs5_127:not(#\9) {
131
- padding-top: 4px;
132
128
  padding-top: var(--space-xxs-ynfts5, 4px);
133
129
  }
134
130
  }
135
131
  @media (max-width: 688px) {
136
132
  .awsui_layout_z2o52_i6vs5_93.awsui_is-visual-refresh_z2o52_i6vs5_93 > .awsui_header_z2o52_i6vs5_99:not(#\9) {
137
- padding: 16px 0 24px;
138
133
  padding: var(--space-m-17eucw, 16px) 0 var(--space-dark-header-padding-bottom-jg1586, 24px);
139
134
  }
140
135
  }
@@ -7,7 +7,6 @@
7
7
  SPDX-License-Identifier: Apache-2.0
8
8
  */
9
9
  .awsui_background-fill_1fi2u_1fyw7_9:not(#\9) {
10
- background-color: #ffffff;
11
10
  background-color: var(--color-background-layout-main-sfhm4y, #ffffff);
12
11
  position: absolute;
13
12
  }
@@ -1,4 +1,4 @@
1
1
  import { DropdownProps } from './interfaces';
2
- declare const Dropdown: ({ children, trigger, open, onDropdownClose, onMouseDown, header, footer, dropdownId, stretchTriggerHeight, stretchWidth, stretchHeight, stretchToTriggerWidth, expandToViewport, preferCenter, interior, minWidth, hasContent, scrollable, }: DropdownProps) => JSX.Element;
2
+ declare const Dropdown: ({ children, trigger, open, onDropdownClose, onMouseDown, header, footer, dropdownId, stretchTriggerHeight, stretchWidth, stretchHeight, stretchToTriggerWidth, expandToViewport, preferCenter, interior, minWidth, hasContent, scrollable, trapFocus, }: DropdownProps) => JSX.Element;
3
3
  export default Dropdown;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAgG7C,QAAA,MAAM,QAAQ,iPAmBX,aAAa,gBA+Of,CAAC;AAMF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAkG7C,QAAA,MAAM,QAAQ,4PAoBX,aAAa,gBAiQf,CAAC;AAMF,eAAe,QAAQ,CAAC"}
@@ -13,6 +13,8 @@ import { useVisualRefresh } from '../../hooks/use-visual-mode';
13
13
  import { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';
14
14
  import { DropdownContextProvider } from './context';
15
15
  import { useMobile } from '../../hooks/use-mobile';
16
+ import TabTrap from '../tab-trap/index.js';
17
+ import { getFirstFocusable, getLastFocusable } from '../focus-lock/utils.js';
16
18
  var DropdownContainer = function (_a) {
17
19
  var children = _a.children, _b = _a.renderWithPortal, renderWithPortal = _b === void 0 ? false : _b, id = _a.id, open = _a.open;
18
20
  if (renderWithPortal) {
@@ -49,7 +51,7 @@ var TransitionContent = function (_a) {
49
51
  footer))))));
50
52
  };
51
53
  var Dropdown = function (_a) {
52
- var children = _a.children, trigger = _a.trigger, open = _a.open, onDropdownClose = _a.onDropdownClose, onMouseDown = _a.onMouseDown, header = _a.header, footer = _a.footer, dropdownId = _a.dropdownId, _b = _a.stretchTriggerHeight, stretchTriggerHeight = _b === void 0 ? false : _b, _c = _a.stretchWidth, stretchWidth = _c === void 0 ? true : _c, _d = _a.stretchHeight, stretchHeight = _d === void 0 ? false : _d, _e = _a.stretchToTriggerWidth, stretchToTriggerWidth = _e === void 0 ? true : _e, _f = _a.expandToViewport, expandToViewport = _f === void 0 ? false : _f, _g = _a.preferCenter, preferCenter = _g === void 0 ? false : _g, _h = _a.interior, interior = _h === void 0 ? false : _h, minWidth = _a.minWidth, _j = _a.hasContent, hasContent = _j === void 0 ? true : _j, _k = _a.scrollable, scrollable = _k === void 0 ? true : _k;
54
+ var children = _a.children, trigger = _a.trigger, open = _a.open, onDropdownClose = _a.onDropdownClose, onMouseDown = _a.onMouseDown, header = _a.header, footer = _a.footer, dropdownId = _a.dropdownId, _b = _a.stretchTriggerHeight, stretchTriggerHeight = _b === void 0 ? false : _b, _c = _a.stretchWidth, stretchWidth = _c === void 0 ? true : _c, _d = _a.stretchHeight, stretchHeight = _d === void 0 ? false : _d, _e = _a.stretchToTriggerWidth, stretchToTriggerWidth = _e === void 0 ? true : _e, _f = _a.expandToViewport, expandToViewport = _f === void 0 ? false : _f, _g = _a.preferCenter, preferCenter = _g === void 0 ? false : _g, _h = _a.interior, interior = _h === void 0 ? false : _h, minWidth = _a.minWidth, _j = _a.hasContent, hasContent = _j === void 0 ? true : _j, _k = _a.scrollable, scrollable = _k === void 0 ? true : _k, _l = _a.trapFocus, trapFocus = _l === void 0 ? false : _l;
53
55
  var triggerRef = useRef(null);
54
56
  var dropdownRef = useRef(null);
55
57
  // This container is only needed to apply max-height to. We can't move max-height to it's parent
@@ -59,7 +61,7 @@ var Dropdown = function (_a) {
59
61
  var fixedPosition = useRef(null);
60
62
  var isRefresh = useVisualRefresh(triggerRef);
61
63
  var dropdownClasses = usePortalModeClasses(triggerRef);
62
- var _l = useState('bottom-right'), position = _l[0], setPosition = _l[1];
64
+ var _m = useState('bottom-right'), position = _m[0], setPosition = _m[1];
63
65
  var isMobile = useMobile();
64
66
  var setDropdownPosition = function (position, triggerBox, target, verticalContainer) {
65
67
  var entireWidth = !interior && stretchWidth;
@@ -226,8 +228,12 @@ var Dropdown = function (_a) {
226
228
  }, [open, expandToViewport]);
227
229
  return (React.createElement("div", { className: clsx(styles.root, interior && styles.interior, stretchTriggerHeight && styles['stretch-trigger-height']) },
228
230
  React.createElement("div", { className: clsx(stretchTriggerHeight && styles['stretch-trigger-height']), ref: triggerRef }, trigger),
231
+ React.createElement(TabTrap, { focusNextCallback: function () { var _a; return dropdownRef.current && ((_a = getFirstFocusable(dropdownRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !trapFocus }),
229
232
  React.createElement(DropdownContainer, { renderWithPortal: expandToViewport && !interior, id: dropdownId, open: open },
230
- React.createElement(Transition, { "in": open !== null && open !== void 0 ? open : false, exit: false }, function (state, ref) { return (React.createElement(TransitionContent, { state: state, transitionRef: ref, dropdownClasses: dropdownClasses, open: open, stretchWidth: stretchWidth, interior: interior, header: header, hasContent: hasContent, expandToViewport: expandToViewport, footer: footer, onMouseDown: onMouseDown, isRefresh: isRefresh, dropdownRef: dropdownRef, verticalContainerRef: verticalContainerRef, position: position }, children)); }))));
233
+ React.createElement(Transition, { "in": open !== null && open !== void 0 ? open : false, exit: false }, function (state, ref) { return (React.createElement("div", { onBlur: function (event) { return trapFocus && event.stopPropagation(); } },
234
+ React.createElement(TabTrap, { focusNextCallback: function () { var _a; return triggerRef.current && ((_a = getLastFocusable(triggerRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !trapFocus }),
235
+ React.createElement(TransitionContent, { state: state, transitionRef: ref, dropdownClasses: dropdownClasses, open: open, stretchWidth: stretchWidth, interior: interior, header: header, hasContent: hasContent, expandToViewport: expandToViewport, footer: footer, onMouseDown: onMouseDown, isRefresh: isRefresh, dropdownRef: dropdownRef, verticalContainerRef: verticalContainerRef, position: position }, children),
236
+ React.createElement(TabTrap, { focusNextCallback: function () { var _a; return triggerRef.current && ((_a = getFirstFocusable(triggerRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !trapFocus }))); }))));
231
237
  };
232
238
  var isInteriorPosition = function (position) { return position.bottom !== undefined; };
233
239
  export default Dropdown;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAA8C,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAgC,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AASnD,IAAM,iBAAiB,GAAG,UAAC,EAAwE;QAAtE,QAAQ,cAAA,EAAE,wBAAwB,EAAxB,gBAAgB,mBAAG,KAAK,KAAA,EAAE,EAAE,QAAA,EAAE,IAAI,UAAA;IACvE,IAAI,gBAAgB,EAAE;QACpB,IAAI,IAAI,EAAE;YACR,OAAO,YAAY,CAAC,6BAAK,EAAE,EAAE,EAAE,IAAG,QAAQ,CAAO,EAAE,QAAQ,C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BAAwB,CAAC,CACzD;QAED,6BAAK,SAAS,EAAE,IAAI,CAAC,oBAAoB,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,IAC5F,OAAO,CACJ;QACN,oBAAC,iBAAiB,IAAC,gBAAgB,EAAE,gBAAgB,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI;YAC5F,oBAAC,UAAU,IAAC,IAAE,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,KAAK,EAAE,IAAI,EAAE,KAAK,IACvC,UAAC,KAAK,EAAE,GAAG,IAAK,OAAA,CACf,oBAAC,iBAAiB,IAChB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,GAAG,EAClB,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,QAAQ,EAAE,QAAQ,IAEjB,QAAQ,CACS,CACrB,EApBgB,CAoBhB,CACU,CACK,CAChB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,kBAAkB,GAAG,UACzB,QAAqD,IACZ,OAAC,QAAqC,CAAC,MAAM,KAAK,SAAS,EAA3D,CAA2D,CAAC;AAEvG,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { fireNonCancelableEvent } from '../../events';\nimport { DropdownProps } from './interfaces';\nimport { DropdownPosition, InteriorDropdownPosition, calculatePosition } from './dropdown-fit-handler';\nimport { Transition, TransitionStatus } from '../transition';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';\nimport { DropdownContextProvider, DropdownContextProviderProps } from './context';\nimport { useMobile } from '../../hooks/use-mobile';\n\ninterface DropdownContainerProps {\n children?: React.ReactNode;\n renderWithPortal?: boolean;\n id?: string;\n open?: boolean;\n}\n\nconst DropdownContainer = ({ children, renderWithPortal = false, id, open }: DropdownContainerProps) => {\n if (renderWithPortal) {\n if (open) {\n return createPortal(<div id={id}>{children}</div>, document.body);\n } else {\n return null;\n }\n } else {\n return <>{children}</>;\n }\n};\n\ninterface TransitionContentProps {\n state: TransitionStatus;\n transitionRef: React.MutableRefObject<any>;\n dropdownClasses: string;\n stretchWidth: boolean;\n interior: boolean;\n hasContent: boolean;\n isRefresh: boolean;\n dropdownRef: React.RefObject<HTMLDivElement>;\n verticalContainerRef: React.RefObject<HTMLDivElement>;\n expandToViewport?: boolean;\n header?: React.ReactNode;\n children?: React.ReactNode;\n footer?: React.ReactNode;\n position?: DropdownContextProviderProps['position'];\n open?: boolean;\n onMouseDown?: React.MouseEventHandler<Element>;\n}\n\nconst TransitionContent = ({\n state,\n transitionRef,\n dropdownClasses,\n stretchWidth,\n interior,\n hasContent,\n isRefresh,\n dropdownRef,\n verticalContainerRef,\n expandToViewport,\n header,\n children,\n footer,\n position,\n open,\n onMouseDown,\n}: TransitionContentProps) => {\n const contentRef = useMergeRefs(dropdownRef, transitionRef);\n return (\n <div\n className={clsx(styles.dropdown, dropdownClasses, {\n [styles.open]: open,\n [styles['with-limited-width']]: !stretchWidth,\n [styles['hide-upper-border']]: stretchWidth,\n [styles.interior]: interior,\n [styles['is-empty']]: !header && !hasContent,\n [styles.refresh]: isRefresh,\n [styles['use-portal']]: expandToViewport && !interior,\n })}\n ref={contentRef}\n data-open={open}\n data-animating={state !== 'exited'}\n onMouseDown={onMouseDown}\n >\n <div className={clsx(styles['dropdown-content-wrapper'], isRefresh && styles.refresh)}>\n <div className={styles['ie11-wrapper']}>\n <div ref={verticalContainerRef} className={styles['dropdown-content']}>\n <DropdownContextProvider position={position}>\n {header}\n {children}\n {footer}\n </DropdownContextProvider>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Dropdown = ({\n children,\n trigger,\n open,\n onDropdownClose,\n onMouseDown,\n header,\n footer,\n dropdownId,\n stretchTriggerHeight = false,\n stretchWidth = true,\n stretchHeight = false,\n stretchToTriggerWidth = true,\n expandToViewport = false,\n preferCenter = false,\n interior = false,\n minWidth,\n hasContent = true,\n scrollable = true,\n}: DropdownProps) => {\n const triggerRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n // This container is only needed to apply max-height to. We can't move max-height to it's parent\n // because of an IE11 issue with flexbox. https://github.com/philipwalton/flexbugs/issues/216\n const verticalContainerRef = useRef<HTMLDivElement>(null);\n // To keep track of the initial position (drop up/down) which is kept the same during fixed repositioning\n const fixedPosition = useRef<DropdownPosition | null>(null);\n\n const isRefresh = useVisualRefresh(triggerRef);\n\n const dropdownClasses = usePortalModeClasses(triggerRef);\n const [position, setPosition] = useState<DropdownContextProviderProps['position']>('bottom-right');\n\n const isMobile = useMobile();\n\n const setDropdownPosition = (\n position: DropdownPosition | InteriorDropdownPosition,\n triggerBox: DOMRect,\n target: HTMLDivElement,\n verticalContainer: HTMLDivElement\n ) => {\n const entireWidth = !interior && stretchWidth;\n if (!stretchWidth) {\n // 1px offset for dropdowns where the dropdown itself needs a border, rather than on the items\n verticalContainer.style.maxHeight = `${parseInt(position.height) + 1}px`;\n } else {\n verticalContainer.style.maxHeight = position.height;\n }\n\n if (entireWidth && !expandToViewport) {\n if (stretchToTriggerWidth) {\n target.classList.add(styles['occupy-entire-width']);\n }\n } else {\n target.style.width = position.width;\n }\n // Using styles for main dropdown to adjust its position as preferred alternative\n if (position.dropUp && !interior) {\n target.classList.add(styles['dropdown-drop-up']);\n if (!expandToViewport) {\n target.style.bottom = '100%';\n }\n } else {\n target.classList.remove(styles['dropdown-drop-up']);\n }\n target.classList.add(position.dropLeft ? styles['dropdown-drop-left'] : styles['dropdown-drop-right']);\n\n if (position.left && position.left !== 'auto') {\n target.style.left = position.left;\n }\n\n // Position normal overflow dropdowns with fixed positioning relative to viewport\n if (expandToViewport && !interior) {\n target.style.position = 'fixed';\n if (position.dropUp) {\n target.style.bottom = `calc(100% - ${triggerBox.top}px)`;\n } else {\n target.style.top = `${triggerBox.bottom}px`;\n }\n if (position.dropLeft) {\n target.style.left = `calc(${triggerBox.right}px - ${position.width})`;\n } else {\n target.style.left = `${triggerBox.left}px`;\n }\n // Keep track of the initial dropdown position and direction.\n // Dropdown direction doesn't need to change as the user scrolls, just needs to stay attached to the trigger.\n fixedPosition.current = position;\n return;\n }\n\n // For an interior dropdown (the fly out) we need exact values for positioning\n // and classes are not enough\n // usage of relative position is impossible due to overwrite of overflow-x\n if (interior && isInteriorPosition(position)) {\n if (position.dropUp) {\n target.style.bottom = position.bottom;\n } else {\n target.style.top = position.top;\n }\n target.style.left = position.left;\n }\n\n if (position.dropUp && position.dropLeft) {\n setPosition('top-left');\n } else if (position.dropUp) {\n setPosition('top-right');\n } else if (position.dropLeft) {\n setPosition('bottom-left');\n } else {\n setPosition('bottom-right');\n }\n };\n\n useLayoutEffect(() => {\n const onDropdownOpen = () => {\n if (open && dropdownRef.current && triggerRef.current && verticalContainerRef.current) {\n // calculate scroll width only for dropdowns that has a scrollbar and ignore it for date picker components\n if (scrollable) {\n dropdownRef.current.classList.add(styles.nowrap);\n }\n setDropdownPosition(\n ...calculatePosition(\n dropdownRef.current,\n triggerRef.current,\n verticalContainerRef.current,\n interior,\n expandToViewport,\n preferCenter,\n stretchWidth,\n stretchHeight,\n isMobile,\n minWidth\n ),\n dropdownRef.current,\n verticalContainerRef.current\n );\n if (scrollable) {\n dropdownRef.current.classList.remove(styles.nowrap);\n }\n }\n };\n onDropdownOpen();\n\n if (open) {\n // window may scroll when dropdown opens, for example when soft keyboard shows up\n window.addEventListener('scroll', onDropdownOpen);\n // only listen to window scroll within very short time after the dropdown opens\n // do not want to interfere dropdown position on scroll afterwards\n const timeoutId = setTimeout(() => {\n window.removeEventListener('scroll', onDropdownOpen);\n }, 500);\n\n return () => {\n clearTimeout(timeoutId);\n window.removeEventListener('scroll', onDropdownOpen);\n };\n }\n // See AWSUI-13040\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, dropdownRef, triggerRef, verticalContainerRef, interior, stretchWidth, isMobile]);\n\n // subscribe to outside click\n useEffect(() => {\n if (!open) {\n return;\n }\n const clickListener = (e: MouseEvent) => {\n if (!dropdownRef.current?.contains(e.target as Node)) {\n fireNonCancelableEvent(onDropdownClose);\n }\n };\n\n /*\n * This small delay allows the event that opened the dropdown to\n * finish bubbling, so that it is not immediately captured here.\n */\n const timeout = setTimeout(() => {\n window.addEventListener('click', clickListener);\n }, 0);\n\n return () => {\n clearTimeout(timeout);\n window.removeEventListener('click', clickListener);\n };\n }, [open, onDropdownClose]);\n\n // sync dropdown position on scroll and resize\n useLayoutEffect(() => {\n if (!expandToViewport || !open) {\n return;\n }\n const updateDropdownPosition = () => {\n if (triggerRef.current && dropdownRef.current && verticalContainerRef.current) {\n const triggerRect = triggerRef.current.getBoundingClientRect();\n const target = dropdownRef.current;\n if (fixedPosition.current) {\n if (fixedPosition.current.dropUp) {\n dropdownRef.current.style.bottom = `calc(100% - ${triggerRect.top}px)`;\n } else {\n target.style.top = `${triggerRect.bottom}px`;\n }\n if (fixedPosition.current.dropLeft) {\n target.style.left = `calc(${triggerRect.right}px - ${fixedPosition.current.width})`;\n } else {\n target.style.left = `${triggerRect.left}px`;\n }\n }\n }\n };\n\n updateDropdownPosition();\n\n window.addEventListener('scroll', updateDropdownPosition, true);\n window.addEventListener('resize', updateDropdownPosition, true);\n return () => {\n window.removeEventListener('scroll', updateDropdownPosition, true);\n window.removeEventListener('resize', updateDropdownPosition, true);\n };\n }, [open, expandToViewport]);\n\n return (\n <div\n className={clsx(\n styles.root,\n interior && styles.interior,\n stretchTriggerHeight && styles['stretch-trigger-height']\n )}\n >\n <div className={clsx(stretchTriggerHeight && styles['stretch-trigger-height'])} ref={triggerRef}>\n {trigger}\n </div>\n <DropdownContainer renderWithPortal={expandToViewport && !interior} id={dropdownId} open={open}>\n <Transition in={open ?? false} exit={false}>\n {(state, ref) => (\n <TransitionContent\n state={state}\n transitionRef={ref}\n dropdownClasses={dropdownClasses}\n open={open}\n stretchWidth={stretchWidth}\n interior={interior}\n header={header}\n hasContent={hasContent}\n expandToViewport={expandToViewport}\n footer={footer}\n onMouseDown={onMouseDown}\n isRefresh={isRefresh}\n dropdownRef={dropdownRef}\n verticalContainerRef={verticalContainerRef}\n position={position}\n >\n {children}\n </TransitionContent>\n )}\n </Transition>\n </DropdownContainer>\n </div>\n );\n};\n\nconst isInteriorPosition = (\n position: DropdownPosition | InteriorDropdownPosition\n): position is InteriorDropdownPosition => (position as InteriorDropdownPosition).bottom !== undefined;\n\nexport default Dropdown;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAA8C,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO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Content":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { fireNonCancelableEvent } from '../../events';\nimport { DropdownProps } from './interfaces';\nimport { DropdownPosition, InteriorDropdownPosition, calculatePosition } from './dropdown-fit-handler';\nimport { Transition, TransitionStatus } from '../transition';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';\nimport { DropdownContextProvider, DropdownContextProviderProps } from './context';\nimport { useMobile } from '../../hooks/use-mobile';\nimport TabTrap from '../tab-trap/index.js';\nimport { getFirstFocusable, getLastFocusable } from '../focus-lock/utils.js';\n\ninterface DropdownContainerProps {\n children?: React.ReactNode;\n renderWithPortal?: boolean;\n id?: string;\n open?: boolean;\n}\n\nconst DropdownContainer = ({ children, renderWithPortal = false, id, open }: DropdownContainerProps) => {\n if (renderWithPortal) {\n if (open) {\n return createPortal(<div id={id}>{children}</div>, document.body);\n } else {\n return null;\n }\n } else {\n return <>{children}</>;\n }\n};\n\ninterface TransitionContentProps {\n state: TransitionStatus;\n transitionRef: React.MutableRefObject<any>;\n dropdownClasses: string;\n stretchWidth: boolean;\n interior: boolean;\n hasContent: boolean;\n isRefresh: boolean;\n dropdownRef: React.RefObject<HTMLDivElement>;\n verticalContainerRef: React.RefObject<HTMLDivElement>;\n expandToViewport?: boolean;\n header?: React.ReactNode;\n children?: React.ReactNode;\n footer?: React.ReactNode;\n position?: DropdownContextProviderProps['position'];\n open?: boolean;\n onMouseDown?: React.MouseEventHandler<Element>;\n}\n\nconst TransitionContent = ({\n state,\n transitionRef,\n dropdownClasses,\n stretchWidth,\n interior,\n hasContent,\n isRefresh,\n dropdownRef,\n verticalContainerRef,\n expandToViewport,\n header,\n children,\n footer,\n position,\n open,\n onMouseDown,\n}: TransitionContentProps) => {\n const contentRef = useMergeRefs(dropdownRef, transitionRef);\n return (\n <div\n className={clsx(styles.dropdown, dropdownClasses, {\n [styles.open]: open,\n [styles['with-limited-width']]: !stretchWidth,\n [styles['hide-upper-border']]: stretchWidth,\n [styles.interior]: interior,\n [styles['is-empty']]: !header && !hasContent,\n [styles.refresh]: isRefresh,\n [styles['use-portal']]: expandToViewport && !interior,\n })}\n ref={contentRef}\n data-open={open}\n data-animating={state !== 'exited'}\n onMouseDown={onMouseDown}\n >\n <div className={clsx(styles['dropdown-content-wrapper'], isRefresh && styles.refresh)}>\n <div className={styles['ie11-wrapper']}>\n <div ref={verticalContainerRef} className={styles['dropdown-content']}>\n <DropdownContextProvider position={position}>\n {header}\n {children}\n {footer}\n </DropdownContextProvider>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Dropdown = ({\n children,\n trigger,\n open,\n onDropdownClose,\n onMouseDown,\n header,\n footer,\n dropdownId,\n stretchTriggerHeight = false,\n stretchWidth = true,\n stretchHeight = false,\n stretchToTriggerWidth = true,\n expandToViewport = false,\n preferCenter = false,\n interior = false,\n minWidth,\n hasContent = true,\n scrollable = true,\n trapFocus = false,\n}: DropdownProps) => {\n const triggerRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n // This container is only needed to apply max-height to. We can't move max-height to it's parent\n // because of an IE11 issue with flexbox. https://github.com/philipwalton/flexbugs/issues/216\n const verticalContainerRef = useRef<HTMLDivElement>(null);\n // To keep track of the initial position (drop up/down) which is kept the same during fixed repositioning\n const fixedPosition = useRef<DropdownPosition | null>(null);\n\n const isRefresh = useVisualRefresh(triggerRef);\n\n const dropdownClasses = usePortalModeClasses(triggerRef);\n const [position, setPosition] = useState<DropdownContextProviderProps['position']>('bottom-right');\n\n const isMobile = useMobile();\n\n const setDropdownPosition = (\n position: DropdownPosition | InteriorDropdownPosition,\n triggerBox: DOMRect,\n target: HTMLDivElement,\n verticalContainer: HTMLDivElement\n ) => {\n const entireWidth = !interior && stretchWidth;\n if (!stretchWidth) {\n // 1px offset for dropdowns where the dropdown itself needs a border, rather than on the items\n verticalContainer.style.maxHeight = `${parseInt(position.height) + 1}px`;\n } else {\n verticalContainer.style.maxHeight = position.height;\n }\n\n if (entireWidth && !expandToViewport) {\n if (stretchToTriggerWidth) {\n target.classList.add(styles['occupy-entire-width']);\n }\n } else {\n target.style.width = position.width;\n }\n // Using styles for main dropdown to adjust its position as preferred alternative\n if (position.dropUp && !interior) {\n target.classList.add(styles['dropdown-drop-up']);\n if (!expandToViewport) {\n target.style.bottom = '100%';\n }\n } else {\n target.classList.remove(styles['dropdown-drop-up']);\n }\n target.classList.add(position.dropLeft ? styles['dropdown-drop-left'] : styles['dropdown-drop-right']);\n\n if (position.left && position.left !== 'auto') {\n target.style.left = position.left;\n }\n\n // Position normal overflow dropdowns with fixed positioning relative to viewport\n if (expandToViewport && !interior) {\n target.style.position = 'fixed';\n if (position.dropUp) {\n target.style.bottom = `calc(100% - ${triggerBox.top}px)`;\n } else {\n target.style.top = `${triggerBox.bottom}px`;\n }\n if (position.dropLeft) {\n target.style.left = `calc(${triggerBox.right}px - ${position.width})`;\n } else {\n target.style.left = `${triggerBox.left}px`;\n }\n // Keep track of the initial dropdown position and direction.\n // Dropdown direction doesn't need to change as the user scrolls, just needs to stay attached to the trigger.\n fixedPosition.current = position;\n return;\n }\n\n // For an interior dropdown (the fly out) we need exact values for positioning\n // and classes are not enough\n // usage of relative position is impossible due to overwrite of overflow-x\n if (interior && isInteriorPosition(position)) {\n if (position.dropUp) {\n target.style.bottom = position.bottom;\n } else {\n target.style.top = position.top;\n }\n target.style.left = position.left;\n }\n\n if (position.dropUp && position.dropLeft) {\n setPosition('top-left');\n } else if (position.dropUp) {\n setPosition('top-right');\n } else if (position.dropLeft) {\n setPosition('bottom-left');\n } else {\n setPosition('bottom-right');\n }\n };\n\n useLayoutEffect(() => {\n const onDropdownOpen = () => {\n if (open && dropdownRef.current && triggerRef.current && verticalContainerRef.current) {\n // calculate scroll width only for dropdowns that has a scrollbar and ignore it for date picker components\n if (scrollable) {\n dropdownRef.current.classList.add(styles.nowrap);\n }\n setDropdownPosition(\n ...calculatePosition(\n dropdownRef.current,\n triggerRef.current,\n verticalContainerRef.current,\n interior,\n expandToViewport,\n preferCenter,\n stretchWidth,\n stretchHeight,\n isMobile,\n minWidth\n ),\n dropdownRef.current,\n verticalContainerRef.current\n );\n if (scrollable) {\n dropdownRef.current.classList.remove(styles.nowrap);\n }\n }\n };\n onDropdownOpen();\n\n if (open) {\n // window may scroll when dropdown opens, for example when soft keyboard shows up\n window.addEventListener('scroll', onDropdownOpen);\n // only listen to window scroll within very short time after the dropdown opens\n // do not want to interfere dropdown position on scroll afterwards\n const timeoutId = setTimeout(() => {\n window.removeEventListener('scroll', onDropdownOpen);\n }, 500);\n\n return () => {\n clearTimeout(timeoutId);\n window.removeEventListener('scroll', onDropdownOpen);\n };\n }\n // See AWSUI-13040\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, dropdownRef, triggerRef, verticalContainerRef, interior, stretchWidth, isMobile]);\n\n // subscribe to outside click\n useEffect(() => {\n if (!open) {\n return;\n }\n const clickListener = (e: MouseEvent) => {\n if (!dropdownRef.current?.contains(e.target as Node)) {\n fireNonCancelableEvent(onDropdownClose);\n }\n };\n\n /*\n * This small delay allows the event that opened the dropdown to\n * finish bubbling, so that it is not immediately captured here.\n */\n const timeout = setTimeout(() => {\n window.addEventListener('click', clickListener);\n }, 0);\n\n return () => {\n clearTimeout(timeout);\n window.removeEventListener('click', clickListener);\n };\n }, [open, onDropdownClose]);\n\n // sync dropdown position on scroll and resize\n useLayoutEffect(() => {\n if (!expandToViewport || !open) {\n return;\n }\n const updateDropdownPosition = () => {\n if (triggerRef.current && dropdownRef.current && verticalContainerRef.current) {\n const triggerRect = triggerRef.current.getBoundingClientRect();\n const target = dropdownRef.current;\n if (fixedPosition.current) {\n if (fixedPosition.current.dropUp) {\n dropdownRef.current.style.bottom = `calc(100% - ${triggerRect.top}px)`;\n } else {\n target.style.top = `${triggerRect.bottom}px`;\n }\n if (fixedPosition.current.dropLeft) {\n target.style.left = `calc(${triggerRect.right}px - ${fixedPosition.current.width})`;\n } else {\n target.style.left = `${triggerRect.left}px`;\n }\n }\n }\n };\n\n updateDropdownPosition();\n\n window.addEventListener('scroll', updateDropdownPosition, true);\n window.addEventListener('resize', updateDropdownPosition, true);\n return () => {\n window.removeEventListener('scroll', updateDropdownPosition, true);\n window.removeEventListener('resize', updateDropdownPosition, true);\n };\n }, [open, expandToViewport]);\n\n return (\n <div\n className={clsx(\n styles.root,\n interior && styles.interior,\n stretchTriggerHeight && styles['stretch-trigger-height']\n )}\n >\n <div className={clsx(stretchTriggerHeight && styles['stretch-trigger-height'])} ref={triggerRef}>\n {trigger}\n </div>\n\n <TabTrap\n focusNextCallback={() => dropdownRef.current && getFirstFocusable(dropdownRef.current)?.focus()}\n disabled={!open || !trapFocus}\n />\n\n <DropdownContainer renderWithPortal={expandToViewport && !interior} id={dropdownId} open={open}>\n <Transition in={open ?? false} exit={false}>\n {(state, ref) => (\n <div onBlur={event => trapFocus && event.stopPropagation()}>\n <TabTrap\n focusNextCallback={() => triggerRef.current && getLastFocusable(triggerRef.current)?.focus()}\n disabled={!open || !trapFocus}\n />\n\n <TransitionContent\n state={state}\n transitionRef={ref}\n dropdownClasses={dropdownClasses}\n open={open}\n stretchWidth={stretchWidth}\n interior={interior}\n header={header}\n hasContent={hasContent}\n expandToViewport={expandToViewport}\n footer={footer}\n onMouseDown={onMouseDown}\n isRefresh={isRefresh}\n dropdownRef={dropdownRef}\n verticalContainerRef={verticalContainerRef}\n position={position}\n >\n {children}\n </TransitionContent>\n\n <TabTrap\n focusNextCallback={() => triggerRef.current && getFirstFocusable(triggerRef.current)?.focus()}\n disabled={!open || !trapFocus}\n />\n </div>\n )}\n </Transition>\n </DropdownContainer>\n </div>\n );\n};\n\nconst isInteriorPosition = (\n position: DropdownPosition | InteriorDropdownPosition\n): position is InteriorDropdownPosition => (position as InteriorDropdownPosition).bottom !== undefined;\n\nexport default Dropdown;\n"]}
@@ -107,6 +107,10 @@ export interface DropdownProps extends ExpandToViewport {
107
107
  * Whether the dropdown will have a scrollbar or not
108
108
  */
109
109
  scrollable?: boolean;
110
+ /**
111
+ * Whether the dropdown will have a focus trap including trigger, header, content and footer.
112
+ */
113
+ trapFocus?: boolean;
110
114
  }
111
115
  export interface ExpandToViewport {
112
116
  /**