@cloudscape-design/components-themeable 3.0.1255 → 3.0.1257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +152 -142
- package/lib/internal/scss/token/mixins.scss +11 -6
- package/lib/internal/scss/token/styles.scss +28 -10
- package/lib/internal/template/alert/styles.css.js +27 -27
- package/lib/internal/template/alert/styles.scoped.css +50 -50
- package/lib/internal/template/alert/styles.selectors.js +27 -27
- package/lib/internal/template/annotation-context/annotation/styles.css.js +13 -13
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +21 -21
- package/lib/internal/template/annotation-context/annotation/styles.selectors.js +13 -13
- package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
- package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
- package/lib/internal/template/app-layout/visual-refresh/styles.css.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +32 -32
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +89 -89
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +32 -32
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +27 -27
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +54 -54
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +27 -27
- package/lib/internal/template/attribute-editor/styles.css.js +15 -15
- package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
- package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
- package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
- package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
- package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
- package/lib/internal/template/button/styles.css.js +22 -22
- package/lib/internal/template/button/styles.scoped.css +256 -256
- package/lib/internal/template/button/styles.selectors.js +22 -22
- package/lib/internal/template/button-dropdown/item-element/styles.css.js +21 -21
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +37 -37
- package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +21 -21
- package/lib/internal/template/checkbox/styles.css.js +3 -3
- package/lib/internal/template/checkbox/styles.scoped.css +11 -11
- package/lib/internal/template/checkbox/styles.selectors.js +3 -3
- package/lib/internal/template/content-layout/styles.css.js +14 -14
- package/lib/internal/template/content-layout/styles.scoped.css +27 -27
- package/lib/internal/template/content-layout/styles.selectors.js +14 -14
- package/lib/internal/template/file-token-group/styles.css.js +23 -23
- package/lib/internal/template/file-token-group/styles.scoped.css +36 -36
- package/lib/internal/template/file-token-group/styles.selectors.js +23 -23
- package/lib/internal/template/flashbar/styles.css.js +50 -50
- package/lib/internal/template/flashbar/styles.scoped.css +187 -187
- package/lib/internal/template/flashbar/styles.selectors.js +50 -50
- package/lib/internal/template/help-panel/styles.css.js +6 -6
- package/lib/internal/template/help-panel/styles.scoped.css +73 -73
- package/lib/internal/template/help-panel/styles.selectors.js +6 -6
- package/lib/internal/template/input/styles.css.js +13 -13
- package/lib/internal/template/input/styles.scoped.css +74 -74
- package/lib/internal/template/input/styles.selectors.js +13 -13
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +30 -30
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +58 -58
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +30 -30
- package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.d.ts +3 -2
- package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.d.ts.map +1 -1
- package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.js +5 -3
- package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.js.map +1 -1
- package/lib/internal/template/internal/components/dropdown/index.d.ts +1 -1
- package/lib/internal/template/internal/components/dropdown/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/dropdown/index.js +10 -7
- package/lib/internal/template/internal/components/dropdown/index.js.map +1 -1
- package/lib/internal/template/internal/components/dropdown/interfaces.d.ts +16 -0
- package/lib/internal/template/internal/components/dropdown/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/dropdown/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/dropdown/styles.css.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +39 -39
- package/lib/internal/template/internal/components/dropdown/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/radio-button/styles.css.js +7 -7
- package/lib/internal/template/internal/components/radio-button/styles.scoped.css +18 -18
- package/lib/internal/template/internal/components/radio-button/styles.selectors.js +7 -7
- package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts +10 -0
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/lib/internal/template/internal/generated/custom-css-properties/index.js +151 -141
- package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +103 -103
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts +1 -1
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-mouse-hover.js +13 -5
- package/lib/internal/template/mixed-line-bar-chart/hooks/use-mouse-hover.js.map +1 -1
- package/lib/internal/template/modal/styles.css.js +31 -31
- package/lib/internal/template/modal/styles.scoped.css +48 -48
- package/lib/internal/template/modal/styles.selectors.js +31 -31
- package/lib/internal/template/progress-bar/styles.css.js +18 -18
- package/lib/internal/template/progress-bar/styles.scoped.css +48 -48
- package/lib/internal/template/progress-bar/styles.selectors.js +18 -18
- package/lib/internal/template/prompt-input/styles.css.js +17 -17
- package/lib/internal/template/prompt-input/styles.scoped.css +79 -79
- package/lib/internal/template/prompt-input/styles.selectors.js +17 -17
- package/lib/internal/template/segmented-control/styles.css.js +16 -16
- package/lib/internal/template/segmented-control/styles.scoped.css +46 -46
- package/lib/internal/template/segmented-control/styles.selectors.js +16 -16
- package/lib/internal/template/slider/styles.css.js +26 -26
- package/lib/internal/template/slider/styles.scoped.css +165 -165
- package/lib/internal/template/slider/styles.selectors.js +26 -26
- package/lib/internal/template/spinner/styles.css.js +13 -13
- package/lib/internal/template/spinner/styles.scoped.css +39 -39
- package/lib/internal/template/spinner/styles.selectors.js +13 -13
- package/lib/internal/template/tabs/styles.css.js +30 -30
- package/lib/internal/template/tabs/styles.scoped.css +76 -76
- package/lib/internal/template/tabs/styles.selectors.js +30 -30
- package/lib/internal/template/tag-editor/styles.css.js +3 -3
- package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
- package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
- package/lib/internal/template/text-content/styles.css.js +1 -1
- package/lib/internal/template/text-content/styles.scoped.css +66 -66
- package/lib/internal/template/text-content/styles.selectors.js +1 -1
- package/lib/internal/template/textarea/styles.css.js +5 -5
- package/lib/internal/template/textarea/styles.scoped.css +45 -45
- package/lib/internal/template/textarea/styles.selectors.js +5 -5
- package/lib/internal/template/toggle/styles.css.js +10 -10
- package/lib/internal/template/toggle/styles.scoped.css +23 -23
- package/lib/internal/template/toggle/styles.selectors.js +10 -10
- package/lib/internal/template/token/interfaces.d.ts +37 -0
- package/lib/internal/template/token/interfaces.d.ts.map +1 -1
- package/lib/internal/template/token/interfaces.js.map +1 -1
- package/lib/internal/template/token/internal.d.ts.map +1 -1
- package/lib/internal/template/token/internal.js +3 -1
- package/lib/internal/template/token/internal.js.map +1 -1
- package/lib/internal/template/token/styles.css.js +14 -14
- package/lib/internal/template/token/styles.d.ts +3 -0
- package/lib/internal/template/token/styles.d.ts.map +1 -0
- package/lib/internal/template/token/styles.js +32 -0
- package/lib/internal/template/token/styles.js.map +1 -0
- package/lib/internal/template/token/styles.scoped.css +51 -45
- package/lib/internal/template/token/styles.selectors.js +14 -14
- package/package.json +1 -1
|
@@ -150,27 +150,27 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
150
150
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
151
151
|
SPDX-License-Identifier: Apache-2.0
|
|
152
152
|
*/
|
|
153
|
-
@keyframes awsui_drag-handle-
|
|
153
|
+
@keyframes awsui_drag-handle-entry_155yk_ysm3d_1 {
|
|
154
154
|
from {
|
|
155
|
-
transform: translate(var(--awsui-drag-handle-animation-inline-offset-
|
|
155
|
+
transform: translate(var(--awsui-drag-handle-animation-inline-offset-hzjhvz), var(--awsui-drag-handle-animation-block-offset-hzjhvz));
|
|
156
156
|
}
|
|
157
157
|
to {
|
|
158
158
|
transform: translate(0, 0);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
@keyframes awsui_drag-handle-
|
|
161
|
+
@keyframes awsui_drag-handle-exit_155yk_ysm3d_1 {
|
|
162
162
|
from {
|
|
163
163
|
transform: translate(0, 0);
|
|
164
164
|
}
|
|
165
165
|
to {
|
|
166
|
-
transform: translate(var(--awsui-drag-handle-animation-inline-offset-
|
|
166
|
+
transform: translate(var(--awsui-drag-handle-animation-inline-offset-hzjhvz), var(--awsui-drag-handle-animation-block-offset-hzjhvz));
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
.awsui_direction-button-
|
|
170
|
-
--awsui-drag-handle-animation-inline-offset-
|
|
171
|
-
--awsui-drag-handle-animation-block-offset-
|
|
169
|
+
.awsui_direction-button-wrapper_155yk_ysm3d_169:not(#\9) {
|
|
170
|
+
--awsui-drag-handle-animation-inline-offset-hzjhvz: 0;
|
|
171
|
+
--awsui-drag-handle-animation-block-offset-hzjhvz: 0;
|
|
172
172
|
}
|
|
173
|
-
@keyframes awsui_awsui-motion-fade-
|
|
173
|
+
@keyframes awsui_awsui-motion-fade-in_155yk_ysm3d_1 {
|
|
174
174
|
from {
|
|
175
175
|
opacity: 0.2;
|
|
176
176
|
}
|
|
@@ -178,7 +178,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
178
178
|
opacity: 1;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
@keyframes awsui_awsui-motion-fade-out-
|
|
181
|
+
@keyframes awsui_awsui-motion-fade-out-0_155yk_ysm3d_1 {
|
|
182
182
|
from {
|
|
183
183
|
opacity: 1;
|
|
184
184
|
}
|
|
@@ -186,81 +186,81 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
186
186
|
opacity: 0;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
.awsui_direction-button-wrapper-motion-
|
|
189
|
+
.awsui_direction-button-wrapper-motion-enter_155yk_ysm3d_189:not(#\9), .awsui_direction-button-wrapper-motion-entering_155yk_ysm3d_189:not(#\9), .awsui_direction-button-wrapper-motion-exit_155yk_ysm3d_189:not(#\9), .awsui_direction-button-wrapper-motion-exiting_155yk_ysm3d_189:not(#\9) {
|
|
190
190
|
pointer-events: none;
|
|
191
191
|
}
|
|
192
|
-
.awsui_direction-button-wrapper-motion-
|
|
193
|
-
animation: awsui_drag-handle-
|
|
192
|
+
.awsui_direction-button-wrapper-motion-entering_155yk_ysm3d_189:not(#\9) {
|
|
193
|
+
animation: awsui_drag-handle-entry_155yk_ysm3d_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out), awsui_awsui-motion-fade-in_155yk_ysm3d_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out);
|
|
194
194
|
}
|
|
195
195
|
@media (prefers-reduced-motion: reduce) {
|
|
196
|
-
.awsui_direction-button-wrapper-motion-
|
|
196
|
+
.awsui_direction-button-wrapper-motion-entering_155yk_ysm3d_189:not(#\9) {
|
|
197
197
|
animation: none;
|
|
198
198
|
transition: none;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-
|
|
201
|
+
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-entering_155yk_ysm3d_189:not(#\9), .awsui-mode-entering .awsui_direction-button-wrapper-motion-entering_155yk_ysm3d_189:not(#\9) {
|
|
202
202
|
animation: none;
|
|
203
203
|
transition: none;
|
|
204
204
|
}
|
|
205
|
-
.awsui_direction-button-wrapper-motion-
|
|
206
|
-
animation: awsui_drag-handle-
|
|
205
|
+
.awsui_direction-button-wrapper-motion-exiting_155yk_ysm3d_189:not(#\9) {
|
|
206
|
+
animation: awsui_drag-handle-exit_155yk_ysm3d_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out) forwards, awsui_awsui-motion-fade-out-0_155yk_ysm3d_1 var(--motion-duration-complex-hv88cf, 270ms) var(--motion-easing-responsive-dxkfpl, ease-out) forwards;
|
|
207
207
|
}
|
|
208
208
|
@media (prefers-reduced-motion: reduce) {
|
|
209
|
-
.awsui_direction-button-wrapper-motion-
|
|
209
|
+
.awsui_direction-button-wrapper-motion-exiting_155yk_ysm3d_189:not(#\9) {
|
|
210
210
|
animation: none;
|
|
211
211
|
transition: none;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-
|
|
214
|
+
.awsui-motion-disabled .awsui_direction-button-wrapper-motion-exiting_155yk_ysm3d_189:not(#\9), .awsui-mode-entering .awsui_direction-button-wrapper-motion-exiting_155yk_ysm3d_189:not(#\9) {
|
|
215
215
|
animation: none;
|
|
216
216
|
transition: none;
|
|
217
217
|
}
|
|
218
218
|
@media (prefers-reduced-motion: reduce) {
|
|
219
|
-
.awsui_direction-button-
|
|
219
|
+
.awsui_direction-button-wrapper_155yk_ysm3d_169:not(#\9) {
|
|
220
220
|
animation: none;
|
|
221
221
|
transition: none;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
.awsui-motion-disabled .awsui_direction-button-
|
|
224
|
+
.awsui-motion-disabled .awsui_direction-button-wrapper_155yk_ysm3d_169:not(#\9), .awsui-mode-entering .awsui_direction-button-wrapper_155yk_ysm3d_169:not(#\9) {
|
|
225
225
|
animation: none;
|
|
226
226
|
transition: none;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
.awsui_direction-button-wrapper-block-
|
|
230
|
-
--awsui-drag-handle-animation-block-offset-
|
|
229
|
+
.awsui_direction-button-wrapper-block-start_155yk_ysm3d_229:not(#\9) {
|
|
230
|
+
--awsui-drag-handle-animation-block-offset-hzjhvz: 20px;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.awsui_direction-button-wrapper-block-
|
|
234
|
-
--awsui-drag-handle-animation-block-offset-
|
|
233
|
+
.awsui_direction-button-wrapper-block-end_155yk_ysm3d_233:not(#\9) {
|
|
234
|
+
--awsui-drag-handle-animation-block-offset-hzjhvz: -20px;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.awsui_direction-button-wrapper-inline-
|
|
237
|
+
.awsui_direction-button-wrapper-inline-start_155yk_ysm3d_237:not(#\9) {
|
|
238
238
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
239
239
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
240
240
|
}
|
|
241
|
-
.awsui_direction-button-wrapper-inline-
|
|
242
|
-
--awsui-drag-handle-animation-inline-offset-
|
|
241
|
+
.awsui_direction-button-wrapper-inline-start_155yk_ysm3d_237:not(#\9):dir(ltr) {
|
|
242
|
+
--awsui-drag-handle-animation-inline-offset-hzjhvz: 20px;
|
|
243
243
|
}
|
|
244
|
-
.awsui_direction-button-wrapper-inline-
|
|
245
|
-
--awsui-drag-handle-animation-inline-offset-
|
|
244
|
+
.awsui_direction-button-wrapper-inline-start_155yk_ysm3d_237:not(#\9):dir(rtl) {
|
|
245
|
+
--awsui-drag-handle-animation-inline-offset-hzjhvz: -20px;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
.awsui_direction-button-wrapper-inline-
|
|
248
|
+
.awsui_direction-button-wrapper-inline-end_155yk_ysm3d_248:not(#\9) {
|
|
249
249
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
250
250
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
251
251
|
}
|
|
252
|
-
.awsui_direction-button-wrapper-inline-
|
|
253
|
-
--awsui-drag-handle-animation-inline-offset-
|
|
252
|
+
.awsui_direction-button-wrapper-inline-end_155yk_ysm3d_248:not(#\9):dir(ltr) {
|
|
253
|
+
--awsui-drag-handle-animation-inline-offset-hzjhvz: -20px;
|
|
254
254
|
}
|
|
255
|
-
.awsui_direction-button-wrapper-inline-
|
|
256
|
-
--awsui-drag-handle-animation-inline-offset-
|
|
255
|
+
.awsui_direction-button-wrapper-inline-end_155yk_ysm3d_248:not(#\9):dir(rtl) {
|
|
256
|
+
--awsui-drag-handle-animation-inline-offset-hzjhvz: 20px;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
.
|
|
259
|
+
.awsui_contents_155yk_ysm3d_259:not(#\9) {
|
|
260
260
|
display: contents;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
.awsui_portal-
|
|
263
|
+
.awsui_portal-overlay_155yk_ysm3d_263:not(#\9) {
|
|
264
264
|
position: absolute;
|
|
265
265
|
inset-block-start: 0;
|
|
266
266
|
inset-inline-start: 0;
|
|
@@ -268,20 +268,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
268
268
|
z-index: 7000;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
.awsui_portal-overlay-
|
|
271
|
+
.awsui_portal-overlay-disabled_155yk_ysm3d_271:not(#\9) {
|
|
272
272
|
display: none;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
.awsui_portal-overlay-
|
|
275
|
+
.awsui_portal-overlay-contents_155yk_ysm3d_275:not(#\9) {
|
|
276
276
|
pointer-events: auto;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
.awsui_drag-
|
|
279
|
+
.awsui_drag-handle_155yk_ysm3d_279:not(#\9) {
|
|
280
280
|
position: relative;
|
|
281
281
|
display: inline-flex;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
.awsui_direction-button-
|
|
284
|
+
.awsui_direction-button-wrapper_155yk_ysm3d_169:not(#\9) {
|
|
285
285
|
position: absolute;
|
|
286
286
|
block-size: var(--space-static-xl-pek4x1, 24px);
|
|
287
287
|
inline-size: var(--space-static-xl-pek4x1, 24px);
|
|
@@ -289,67 +289,67 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
289
289
|
padding-inline: var(--space-static-xxs-0cgyf1, 4px);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
.awsui_direction-button-wrapper-
|
|
292
|
+
.awsui_direction-button-wrapper-hidden_155yk_ysm3d_292:not(#\9) {
|
|
293
293
|
display: none;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
.awsui_direction-button-wrapper-block-
|
|
296
|
+
.awsui_direction-button-wrapper-block-start_155yk_ysm3d_229:not(#\9) {
|
|
297
297
|
inset-block-start: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
298
298
|
inset-inline-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
.awsui_direction-button-wrapper-block-
|
|
301
|
+
.awsui_direction-button-wrapper-block-end_155yk_ysm3d_233:not(#\9) {
|
|
302
302
|
inset-block-end: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
303
303
|
inset-inline-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
.awsui_direction-button-wrapper-inline-
|
|
306
|
+
.awsui_direction-button-wrapper-inline-start_155yk_ysm3d_237:not(#\9) {
|
|
307
307
|
inset-inline-start: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
308
308
|
inset-block-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
.awsui_direction-button-wrapper-inline-
|
|
311
|
+
.awsui_direction-button-wrapper-inline-end_155yk_ysm3d_248:not(#\9) {
|
|
312
312
|
inset-inline-end: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
313
313
|
inset-block-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
.awsui_direction-button-wrapper-
|
|
316
|
+
.awsui_direction-button-wrapper-forced_155yk_ysm3d_316:not(#\9) {
|
|
317
317
|
inset-inline-start: calc(50% - (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)) / 2);
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
.awsui_direction-button-wrapper-forced-top-
|
|
320
|
+
.awsui_direction-button-wrapper-forced-top-0_155yk_ysm3d_320:not(#\9) {
|
|
321
321
|
inset-block-start: calc(-1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
.awsui_direction-button-wrapper-forced-top-
|
|
324
|
+
.awsui_direction-button-wrapper-forced-top-1_155yk_ysm3d_324:not(#\9) {
|
|
325
325
|
inset-block-start: calc(-2 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
.awsui_direction-button-wrapper-forced-top-
|
|
328
|
+
.awsui_direction-button-wrapper-forced-top-2_155yk_ysm3d_328:not(#\9) {
|
|
329
329
|
inset-block-start: calc(-3 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
.awsui_direction-button-wrapper-forced-top-
|
|
332
|
+
.awsui_direction-button-wrapper-forced-top-3_155yk_ysm3d_332:not(#\9) {
|
|
333
333
|
inset-block-start: calc(-4 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
.awsui_direction-button-wrapper-forced-bottom-
|
|
336
|
+
.awsui_direction-button-wrapper-forced-bottom-0_155yk_ysm3d_336:not(#\9) {
|
|
337
337
|
inset-block-start: calc(1 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
.awsui_direction-button-wrapper-forced-bottom-
|
|
340
|
+
.awsui_direction-button-wrapper-forced-bottom-1_155yk_ysm3d_340:not(#\9) {
|
|
341
341
|
inset-block-start: calc(2 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
.awsui_direction-button-wrapper-forced-bottom-
|
|
344
|
+
.awsui_direction-button-wrapper-forced-bottom-2_155yk_ysm3d_344:not(#\9) {
|
|
345
345
|
inset-block-start: calc(3 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
.awsui_direction-button-wrapper-forced-bottom-
|
|
348
|
+
.awsui_direction-button-wrapper-forced-bottom-3_155yk_ysm3d_348:not(#\9) {
|
|
349
349
|
inset-block-start: calc(4 * (var(--space-static-xl-pek4x1, 24px) + 2 * var(--space-static-xxs-0cgyf1, 4px)));
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
.awsui_direction-
|
|
352
|
+
.awsui_direction-button_155yk_ysm3d_169:not(#\9) {
|
|
353
353
|
position: absolute;
|
|
354
354
|
border-width: 0;
|
|
355
355
|
cursor: pointer;
|
|
@@ -368,14 +368,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
368
368
|
color: var(--color-text-direction-button-default-dkices, #ffffff);
|
|
369
369
|
box-shadow: var(--shadow-dropdown-skxpuu, 0 1px 1px 0 rgba(0, 28, 36, 0.3), 1px 1px 1px 0 rgba(0, 28, 36, 0.15), -1px 1px 1px 0 rgba(0, 28, 36, 0.15));
|
|
370
370
|
}
|
|
371
|
-
.awsui_direction-
|
|
371
|
+
.awsui_direction-button_155yk_ysm3d_169:not(#\9):not(.awsui_direction-button-disabled_155yk_ysm3d_371):hover {
|
|
372
372
|
background-color: var(--color-background-direction-button-hover-v5bxfc, #414750);
|
|
373
373
|
}
|
|
374
|
-
.awsui_direction-
|
|
374
|
+
.awsui_direction-button_155yk_ysm3d_169:not(#\9):not(.awsui_direction-button-disabled_155yk_ysm3d_371):active {
|
|
375
375
|
background-color: var(--color-background-direction-button-active-wn6s2j, #2a2e33);
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
.awsui_direction-button-
|
|
378
|
+
.awsui_direction-button-disabled_155yk_ysm3d_371:not(#\9) {
|
|
379
379
|
cursor: default;
|
|
380
380
|
background-color: var(--color-background-direction-button-disabled-rcznmi, #eaeded);
|
|
381
381
|
color: var(--color-text-direction-button-disabled-596cgx, #aab7b8);
|
|
@@ -2,35 +2,35 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"direction-button-wrapper": "awsui_direction-button-
|
|
6
|
-
"direction-button-wrapper-motion-enter": "awsui_direction-button-wrapper-motion-
|
|
7
|
-
"direction-button-wrapper-motion-entering": "awsui_direction-button-wrapper-motion-
|
|
8
|
-
"direction-button-wrapper-motion-exit": "awsui_direction-button-wrapper-motion-
|
|
9
|
-
"direction-button-wrapper-motion-exiting": "awsui_direction-button-wrapper-motion-
|
|
10
|
-
"drag-handle-entry": "awsui_drag-handle-
|
|
11
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
12
|
-
"drag-handle-exit": "awsui_drag-handle-
|
|
13
|
-
"awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-
|
|
14
|
-
"direction-button-wrapper-block-start": "awsui_direction-button-wrapper-block-
|
|
15
|
-
"direction-button-wrapper-block-end": "awsui_direction-button-wrapper-block-
|
|
16
|
-
"direction-button-wrapper-inline-start": "awsui_direction-button-wrapper-inline-
|
|
17
|
-
"direction-button-wrapper-inline-end": "awsui_direction-button-wrapper-inline-
|
|
18
|
-
"contents": "
|
|
19
|
-
"portal-overlay": "awsui_portal-
|
|
20
|
-
"portal-overlay-disabled": "awsui_portal-overlay-
|
|
21
|
-
"portal-overlay-contents": "awsui_portal-overlay-
|
|
22
|
-
"drag-handle": "awsui_drag-
|
|
23
|
-
"direction-button-wrapper-hidden": "awsui_direction-button-wrapper-
|
|
24
|
-
"direction-button-wrapper-forced": "awsui_direction-button-wrapper-
|
|
25
|
-
"direction-button-wrapper-forced-top-0": "awsui_direction-button-wrapper-forced-top-
|
|
26
|
-
"direction-button-wrapper-forced-top-1": "awsui_direction-button-wrapper-forced-top-
|
|
27
|
-
"direction-button-wrapper-forced-top-2": "awsui_direction-button-wrapper-forced-top-
|
|
28
|
-
"direction-button-wrapper-forced-top-3": "awsui_direction-button-wrapper-forced-top-
|
|
29
|
-
"direction-button-wrapper-forced-bottom-0": "awsui_direction-button-wrapper-forced-bottom-
|
|
30
|
-
"direction-button-wrapper-forced-bottom-1": "awsui_direction-button-wrapper-forced-bottom-
|
|
31
|
-
"direction-button-wrapper-forced-bottom-2": "awsui_direction-button-wrapper-forced-bottom-
|
|
32
|
-
"direction-button-wrapper-forced-bottom-3": "awsui_direction-button-wrapper-forced-bottom-
|
|
33
|
-
"direction-button": "awsui_direction-
|
|
34
|
-
"direction-button-disabled": "awsui_direction-button-
|
|
5
|
+
"direction-button-wrapper": "awsui_direction-button-wrapper_155yk_ysm3d_169",
|
|
6
|
+
"direction-button-wrapper-motion-enter": "awsui_direction-button-wrapper-motion-enter_155yk_ysm3d_189",
|
|
7
|
+
"direction-button-wrapper-motion-entering": "awsui_direction-button-wrapper-motion-entering_155yk_ysm3d_189",
|
|
8
|
+
"direction-button-wrapper-motion-exit": "awsui_direction-button-wrapper-motion-exit_155yk_ysm3d_189",
|
|
9
|
+
"direction-button-wrapper-motion-exiting": "awsui_direction-button-wrapper-motion-exiting_155yk_ysm3d_189",
|
|
10
|
+
"drag-handle-entry": "awsui_drag-handle-entry_155yk_ysm3d_1",
|
|
11
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_155yk_ysm3d_1",
|
|
12
|
+
"drag-handle-exit": "awsui_drag-handle-exit_155yk_ysm3d_1",
|
|
13
|
+
"awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-0_155yk_ysm3d_1",
|
|
14
|
+
"direction-button-wrapper-block-start": "awsui_direction-button-wrapper-block-start_155yk_ysm3d_229",
|
|
15
|
+
"direction-button-wrapper-block-end": "awsui_direction-button-wrapper-block-end_155yk_ysm3d_233",
|
|
16
|
+
"direction-button-wrapper-inline-start": "awsui_direction-button-wrapper-inline-start_155yk_ysm3d_237",
|
|
17
|
+
"direction-button-wrapper-inline-end": "awsui_direction-button-wrapper-inline-end_155yk_ysm3d_248",
|
|
18
|
+
"contents": "awsui_contents_155yk_ysm3d_259",
|
|
19
|
+
"portal-overlay": "awsui_portal-overlay_155yk_ysm3d_263",
|
|
20
|
+
"portal-overlay-disabled": "awsui_portal-overlay-disabled_155yk_ysm3d_271",
|
|
21
|
+
"portal-overlay-contents": "awsui_portal-overlay-contents_155yk_ysm3d_275",
|
|
22
|
+
"drag-handle": "awsui_drag-handle_155yk_ysm3d_279",
|
|
23
|
+
"direction-button-wrapper-hidden": "awsui_direction-button-wrapper-hidden_155yk_ysm3d_292",
|
|
24
|
+
"direction-button-wrapper-forced": "awsui_direction-button-wrapper-forced_155yk_ysm3d_316",
|
|
25
|
+
"direction-button-wrapper-forced-top-0": "awsui_direction-button-wrapper-forced-top-0_155yk_ysm3d_320",
|
|
26
|
+
"direction-button-wrapper-forced-top-1": "awsui_direction-button-wrapper-forced-top-1_155yk_ysm3d_324",
|
|
27
|
+
"direction-button-wrapper-forced-top-2": "awsui_direction-button-wrapper-forced-top-2_155yk_ysm3d_328",
|
|
28
|
+
"direction-button-wrapper-forced-top-3": "awsui_direction-button-wrapper-forced-top-3_155yk_ysm3d_332",
|
|
29
|
+
"direction-button-wrapper-forced-bottom-0": "awsui_direction-button-wrapper-forced-bottom-0_155yk_ysm3d_336",
|
|
30
|
+
"direction-button-wrapper-forced-bottom-1": "awsui_direction-button-wrapper-forced-bottom-1_155yk_ysm3d_340",
|
|
31
|
+
"direction-button-wrapper-forced-bottom-2": "awsui_direction-button-wrapper-forced-bottom-2_155yk_ysm3d_344",
|
|
32
|
+
"direction-button-wrapper-forced-bottom-3": "awsui_direction-button-wrapper-forced-bottom-3_155yk_ysm3d_348",
|
|
33
|
+
"direction-button": "awsui_direction-button_155yk_ysm3d_169",
|
|
34
|
+
"direction-button-disabled": "awsui_direction-button-disabled_155yk_ysm3d_371"
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -21,7 +21,7 @@ export declare const hasEnoughSpaceForFlexibleWidth: ({ triggerElement, dropdown
|
|
|
21
21
|
stretchHeight: boolean;
|
|
22
22
|
isMobile: boolean;
|
|
23
23
|
}) => boolean;
|
|
24
|
-
export declare const getDropdownPosition: ({ triggerElement, dropdownElement, overflowParents, minWidth: minWidthConstraint, maxWidth: maxWidthConstraint, preferCenter, matchTriggerWidth, stretchHeight, isMobile, }: {
|
|
24
|
+
export declare const getDropdownPosition: ({ triggerElement, dropdownElement, overflowParents, minWidth: minWidthConstraint, maxWidth: maxWidthConstraint, preferCenter, matchTriggerWidth, stretchHeight, isMobile, maxHeight, }: {
|
|
25
25
|
triggerElement: HTMLElement;
|
|
26
26
|
dropdownElement: HTMLElement;
|
|
27
27
|
overflowParents: ReadonlyArray<BoundingBox>;
|
|
@@ -31,6 +31,7 @@ export declare const getDropdownPosition: ({ triggerElement, dropdownElement, ov
|
|
|
31
31
|
matchTriggerWidth?: boolean;
|
|
32
32
|
stretchHeight?: boolean;
|
|
33
33
|
isMobile?: boolean;
|
|
34
|
+
maxHeight?: number;
|
|
34
35
|
}) => DropdownPosition;
|
|
35
|
-
export declare const calculatePosition: (dropdownElement: HTMLDivElement, triggerElement:
|
|
36
|
+
export declare const calculatePosition: (dropdownElement: HTMLDivElement, triggerElement: HTMLElement, verticalContainerElement: HTMLDivElement, interior: boolean, expandToViewport: boolean, preferCenter: boolean, matchTriggerWidth: boolean, stretchHeight: boolean, isMobile: boolean, minWidth?: DropdownWidthConstraint, maxWidth?: DropdownWidthConstraint, maxHeight?: number) => [DropdownPosition, LogicalDOMRect];
|
|
36
37
|
//# sourceMappingURL=dropdown-fit-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-fit-handler.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/dropdown-fit-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAmD,MAAM,mCAAmC,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAcvD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAkKD,eAAO,MAAM,8BAA8B,GAAI,yHAQ5C;IACD,cAAc,EAAE,WAAW,CAAC;IAC5B,eAAe,EAAE,WAAW,CAAC;IAC7B,kBAAkB,CAAC,EAAE,uBAAuB,CAAC;IAC7C,kBAAkB,CAAC,EAAE,uBAAuB,CAAC;IAC7C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB,YAoBA,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,
|
|
1
|
+
{"version":3,"file":"dropdown-fit-handler.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/dropdown-fit-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAmD,MAAM,mCAAmC,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,MAAM,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OAAO,EACzB,cAAc,OAAO,EACrB,mBAAmB,OAAO,EAC1B,eAAe,OAAO,EACtB,UAAU,OAAO,EACjB,WAAW,uBAAuB,EAClC,WAAW,uBAAuB,EAClC,YAAY,MAAM,KACjB,CAAC,gBAAgB,EAAE,cAAc,CAoCnC,CAAC"}
|
|
@@ -122,7 +122,7 @@ export const hasEnoughSpaceForFlexibleWidth = ({ triggerElement, dropdownElement
|
|
|
122
122
|
});
|
|
123
123
|
return idealWidth <= availableSpace.inlineStart || idealWidth <= availableSpace.inlineEnd;
|
|
124
124
|
};
|
|
125
|
-
export const getDropdownPosition = ({ triggerElement, dropdownElement, overflowParents, minWidth: minWidthConstraint, maxWidth: maxWidthConstraint, preferCenter = false, matchTriggerWidth = false, stretchHeight = false, isMobile = false, }) => {
|
|
125
|
+
export const getDropdownPosition = ({ triggerElement, dropdownElement, overflowParents, minWidth: minWidthConstraint, maxWidth: maxWidthConstraint, preferCenter = false, matchTriggerWidth = false, stretchHeight = false, isMobile = false, maxHeight, }) => {
|
|
126
126
|
// Determine the space available around the dropdown that it can grow in
|
|
127
127
|
const availableSpace = getAvailableSpace({
|
|
128
128
|
trigger: triggerElement,
|
|
@@ -167,11 +167,12 @@ export const getDropdownPosition = ({ triggerElement, dropdownElement, overflowP
|
|
|
167
167
|
const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;
|
|
168
168
|
// Try and crop the bottom item when all options can't be displayed, affordance for "there's more"
|
|
169
169
|
const croppedHeight = Math.max(stretchHeight ? availableHeight : Math.floor(availableHeight / 31) * 31 + 16, 15);
|
|
170
|
+
const blockSize = maxHeight ? `min(${croppedHeight}px, ${maxHeight}px)` : `${croppedHeight}px`;
|
|
170
171
|
return {
|
|
171
172
|
dropBlockStart,
|
|
172
173
|
dropInlineStart,
|
|
173
174
|
insetInlineStart: insetInlineStart === null ? 'auto' : `${insetInlineStart}px`,
|
|
174
|
-
blockSize
|
|
175
|
+
blockSize,
|
|
175
176
|
inlineSize: `${inlineSize}px`,
|
|
176
177
|
};
|
|
177
178
|
};
|
|
@@ -208,7 +209,7 @@ const getInteriorDropdownPosition = (trigger, dropdown, overflowParents, isMobil
|
|
|
208
209
|
insetInlineStart: `${insetInlineStart}px`,
|
|
209
210
|
};
|
|
210
211
|
};
|
|
211
|
-
export const calculatePosition = (dropdownElement, triggerElement, verticalContainerElement, interior, expandToViewport, preferCenter, matchTriggerWidth, stretchHeight, isMobile, minWidth, maxWidth) => {
|
|
212
|
+
export const calculatePosition = (dropdownElement, triggerElement, verticalContainerElement, interior, expandToViewport, preferCenter, matchTriggerWidth, stretchHeight, isMobile, minWidth, maxWidth, maxHeight) => {
|
|
212
213
|
// cleaning previously assigned values,
|
|
213
214
|
// so that they are not reused in case of screen resize and similar events
|
|
214
215
|
verticalContainerElement.style.maxBlockSize = '';
|
|
@@ -237,6 +238,7 @@ export const calculatePosition = (dropdownElement, triggerElement, verticalConta
|
|
|
237
238
|
matchTriggerWidth,
|
|
238
239
|
stretchHeight,
|
|
239
240
|
isMobile,
|
|
241
|
+
maxHeight,
|
|
240
242
|
});
|
|
241
243
|
const triggerBox = getLogicalBoundingClientRect(triggerElement);
|
|
242
244
|
return [position, triggerBox];
|
|
@@ -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,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAe,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAIjH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,MAAM,uCAAuC,GAAG,EAAE,CAAC,CAAC,UAAU;AAC9D,MAAM,yCAAyC,GAAG,EAAE,CAAC;AAoBrD,MAAM,0BAA0B,GAAG,CAAC,OA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MAAM,QAAQ,GAAG,QAAQ;QACvB,CAAC,CAAC,2BAA2B,CAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC;QACzF,CAAC,CAAC,mBAAmB,CAAC;YAClB,cAAc;YACd,eAAe;YACf,eAAe;YACf,QAAQ;YACR,QAAQ;YACR,YAAY;YACZ,iBAAiB;YACjB,aAAa;YACb,QAAQ;SACT,CAAC,CAAC;IACP,MAAM,UAAU,GAAG,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAChE,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 { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { BoundingBox, getOverflowParentDimensions, getOverflowParents } from '../../utils/scrollable-containers';\nimport { LogicalDOMRect } from './dropdown-position';\nimport { DropdownWidthConstraint } from './interfaces';\n\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 blockStart: number;\n blockEnd: number;\n inlineStart: number;\n inlineEnd: number;\n}\nexport interface DropdownPosition {\n blockSize: string;\n inlineSize: string;\n dropBlockStart: boolean;\n dropInlineStart: boolean;\n insetInlineStart: string;\n}\nexport interface InteriorDropdownPosition extends DropdownPosition {\n insetBlockEnd: string;\n insetBlockStart: string;\n}\n\nconst getClosestParentDimensions = (element: HTMLElement): any => {\n const parents = getOverflowParents(element).map(element => {\n const { blockSize, inlineSize, insetBlockStart, insetInlineStart } = getLogicalBoundingClientRect(element);\n return {\n blockSize,\n inlineSize,\n insetBlockStart,\n insetInlineStart,\n };\n });\n\n return parents.shift();\n};\n\nconst getAvailableSpace = ({\n trigger,\n overflowParents,\n stretchWidth = false,\n stretchHeight = false,\n isMobile,\n}: {\n trigger: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\n stretchWidth?: boolean;\n stretchHeight?: boolean;\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 {\n insetBlockEnd: triggerBlockEnd,\n insetInlineStart: triggerInlineStart,\n insetInlineEnd: triggerInlineEnd,\n } = getLogicalBoundingClientRect(trigger);\n\n return overflowParents.reduce(\n ({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {\n const offsetTop = triggerBlockEnd - overflowParent.insetBlockStart;\n const currentBlockStart = offsetTop - trigger.offsetHeight - availableSpaceReserveVertical;\n const currentBlockEnd = overflowParent.blockSize - offsetTop - availableSpaceReserveVertical;\n const currentInlineStart = triggerInlineEnd - overflowParent.insetInlineStart - availableSpaceReserveHorizontal;\n const currentInlineEnd =\n overflowParent.insetInlineStart +\n overflowParent.inlineSize -\n triggerInlineStart -\n availableSpaceReserveHorizontal;\n\n return {\n blockStart: Math.min(blockStart, currentBlockStart),\n blockEnd: Math.min(blockEnd, currentBlockEnd),\n inlineStart: Math.min(inlineStart, currentInlineStart),\n inlineEnd: Math.min(inlineEnd, currentInlineEnd),\n };\n },\n {\n blockStart: Number.MAX_VALUE,\n blockEnd: Number.MAX_VALUE,\n inlineStart: Number.MAX_VALUE,\n inlineEnd: Number.MAX_VALUE,\n }\n );\n};\n\nconst getInteriorAvailableSpace = ({\n trigger,\n overflowParents,\n isMobile,\n}: {\n trigger: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\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 insetBlockEnd: triggerBlockEnd,\n insetBlockStart: triggerBlockStart,\n insetInlineStart: triggerInlineStart,\n insetInlineEnd: triggerInlineEnd,\n } = getLogicalBoundingClientRect(trigger);\n\n return overflowParents.reduce(\n ({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {\n const currentBlockStart = triggerBlockEnd - overflowParent.insetBlockStart - AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentBlockEnd =\n overflowParent.blockSize -\n triggerBlockStart +\n overflowParent.insetBlockStart -\n AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentInlineStart =\n triggerInlineStart - overflowParent.insetInlineStart - AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n const currentInlineEnd =\n overflowParent.insetInlineStart +\n overflowParent.inlineSize -\n triggerInlineEnd -\n AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n\n return {\n blockStart: Math.min(blockStart, currentBlockStart),\n blockEnd: Math.min(blockEnd, currentBlockEnd),\n inlineStart: Math.min(inlineStart, currentInlineStart),\n inlineEnd: Math.min(inlineEnd, currentInlineEnd),\n };\n },\n {\n blockStart: Number.MAX_VALUE,\n blockEnd: Number.MAX_VALUE,\n inlineStart: Number.MAX_VALUE,\n inlineEnd: Number.MAX_VALUE,\n }\n );\n};\n\nconst resolveWidthConstraint = (\n constraint: DropdownWidthConstraint | undefined,\n triggerWidth: number,\n fallback: number\n): number => {\n if (constraint === 'trigger') {\n return triggerWidth;\n }\n if (typeof constraint === 'number') {\n return constraint;\n }\n return fallback;\n};\n\nconst getWidths = ({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n minWidthConstraint?: DropdownWidthConstraint;\n maxWidthConstraint?: DropdownWidthConstraint;\n}) => {\n const { inlineSize: triggerInlineSize } = getLogicalBoundingClientRect(triggerElement);\n const { inlineSize: requiredWidth } = getLogicalBoundingClientRect(dropdownElement);\n\n const minWidth = resolveWidthConstraint(minWidthConstraint, triggerInlineSize, 0);\n const maxWidth = resolveWidthConstraint(maxWidthConstraint, triggerInlineSize, Number.MAX_VALUE);\n\n const idealWidth = Math.min(Math.max(requiredWidth, minWidth), maxWidth);\n return { idealWidth, minWidth, triggerInlineSize };\n};\n\nexport const hasEnoughSpaceForFlexibleWidth = ({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n expandToViewport,\n stretchHeight,\n isMobile,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n minWidthConstraint?: DropdownWidthConstraint;\n maxWidthConstraint?: DropdownWidthConstraint;\n expandToViewport: boolean;\n stretchHeight: boolean;\n isMobile: boolean;\n}) => {\n const overflowParents = getOverflowParentDimensions({\n element: dropdownElement,\n excludeClosestParent: false,\n expandToViewport,\n canExpandOutsideViewport: stretchHeight,\n });\n const { idealWidth } = getWidths({\n triggerElement: triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n });\n const availableSpace = getAvailableSpace({\n trigger: triggerElement,\n overflowParents,\n stretchHeight,\n isMobile,\n });\n return idealWidth <= availableSpace.inlineStart || idealWidth <= availableSpace.inlineEnd;\n};\n\nexport const getDropdownPosition = ({\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth: minWidthConstraint,\n maxWidth: maxWidthConstraint,\n preferCenter = false,\n matchTriggerWidth = false,\n stretchHeight = false,\n isMobile = false,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\n minWidth?: DropdownWidthConstraint;\n maxWidth?: DropdownWidthConstraint;\n preferCenter?: boolean;\n matchTriggerWidth?: boolean;\n stretchHeight?: boolean;\n isMobile?: boolean;\n}): DropdownPosition => {\n // Determine the space available around the dropdown that it can grow in\n const availableSpace = getAvailableSpace({\n trigger: triggerElement,\n overflowParents,\n stretchWidth: matchTriggerWidth,\n stretchHeight,\n isMobile,\n });\n const { idealWidth, minWidth, triggerInlineSize } = getWidths({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n });\n\n let dropInlineStart: boolean;\n let insetInlineStart: number | null = null;\n let inlineSize = idealWidth;\n\n //1. Can it be positioned with ideal width to the right?\n if (idealWidth <= availableSpace.inlineEnd) {\n dropInlineStart = false;\n //2. Can it be positioned with ideal width to the left?\n } else if (idealWidth <= availableSpace.inlineStart) {\n dropInlineStart = true;\n //3. Fit into biggest available space either on left or right\n } else {\n dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;\n inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd, minWidth);\n }\n\n if (preferCenter) {\n const spillOver = (idealWidth - triggerInlineSize) / 2;\n\n // availableSpace always includes the trigger width, but we want to exclude that\n const availableOutsideLeft = availableSpace.inlineStart - triggerInlineSize;\n const availableOutsideRight = availableSpace.inlineEnd - triggerInlineSize;\n\n const fitsInCenter = availableOutsideLeft >= spillOver && availableOutsideRight >= spillOver;\n if (fitsInCenter) {\n insetInlineStart = -spillOver;\n }\n }\n\n const dropBlockStart =\n availableSpace.blockEnd < dropdownElement.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;\n const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = Math.max(stretchHeight ? availableHeight : Math.floor(availableHeight / 31) * 31 + 16, 15);\n\n return {\n dropBlockStart,\n dropInlineStart,\n insetInlineStart: insetInlineStart === null ? 'auto' : `${insetInlineStart}px`,\n blockSize: `${croppedHeight}px`,\n inlineSize: `${inlineSize}px`,\n };\n};\n\nconst getInteriorDropdownPosition = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<BoundingBox>,\n isMobile?: boolean\n): InteriorDropdownPosition => {\n const availableSpace = getInteriorAvailableSpace({ trigger, overflowParents, isMobile });\n const {\n insetBlockEnd: triggerBlockEnd,\n insetBlockStart: triggerBlockStart,\n inlineSize: triggerInlineSize,\n } = getLogicalBoundingClientRect(trigger);\n const { insetBlockStart: parentDropdownBlockStart, blockSize: parentDropdownHeight } =\n getClosestParentDimensions(trigger);\n\n let dropInlineStart;\n\n let { inlineSize } = getLogicalBoundingClientRect(dropdown);\n const insetBlockStart = triggerBlockStart - parentDropdownBlockStart;\n if (inlineSize <= availableSpace.inlineEnd) {\n dropInlineStart = false;\n } else if (inlineSize <= availableSpace.inlineStart) {\n dropInlineStart = true;\n } else {\n dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;\n inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd);\n }\n\n const insetInlineStart = dropInlineStart ? 0 - inlineSize : triggerInlineSize;\n\n const dropBlockStart =\n availableSpace.blockEnd < dropdown.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;\n const insetBlockEnd = dropBlockStart ? parentDropdownBlockStart + parentDropdownHeight - triggerBlockEnd : 0;\n const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;\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 dropBlockStart,\n dropInlineStart,\n blockSize: `${croppedHeight}px`,\n inlineSize: `${inlineSize}px`,\n insetBlockStart: `${insetBlockStart}px`,\n insetBlockEnd: `${insetBlockEnd}px`,\n insetInlineStart: `${insetInlineStart}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 matchTriggerWidth: boolean,\n stretchHeight: boolean,\n isMobile: boolean,\n minWidth?: DropdownWidthConstraint,\n maxWidth?: DropdownWidthConstraint\n): [DropdownPosition, LogicalDOMRect] => {\n // cleaning previously assigned values,\n // so that they are not reused in case of screen resize and similar events\n verticalContainerElement.style.maxBlockSize = '';\n dropdownElement.style.inlineSize = '';\n dropdownElement.style.insetBlockStart = '';\n dropdownElement.style.insetBlockEnd = '';\n dropdownElement.style.insetInlineStart = '';\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({\n element: dropdownElement,\n excludeClosestParent: interior,\n expandToViewport,\n canExpandOutsideViewport: stretchHeight,\n });\n const position = interior\n ? getInteriorDropdownPosition(triggerElement, dropdownElement, overflowParents, isMobile)\n : getDropdownPosition({\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth,\n maxWidth,\n preferCenter,\n matchTriggerWidth,\n stretchHeight,\n isMobile,\n });\n const triggerBox = getLogicalBoundingClientRect(triggerElement);\n return [position, triggerBox];\n};\n"]}
|
|
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,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAe,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAIjH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,MAAM,uCAAuC,GAAG,EAAE,CAAC,CAAC,UAAU;AAC9D,MAAM,yCAAyC,GAAG,EAAE,CAAC;AAoBrD,MAAM,0BAA0B,GAAG,CAAC,OA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AC;QAClD,OAAO,EAAE,eAAe;QACxB,oBAAoB,EAAE,QAAQ;QAC9B,gBAAgB;QAChB,wBAAwB,EAAE,aAAa;KACxC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAgD,QAAQ;QACpE,CAAC,CAAC,2BAA2B,CAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC;QACzF,CAAC,CAAC,mBAAmB,CAAC;YAClB,cAAc;YACd,eAAe;YACf,eAAe;YACf,QAAQ;YACR,QAAQ;YACR,YAAY;YACZ,iBAAiB;YACjB,aAAa;YACb,QAAQ;YACR,SAAS;SACV,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAChE,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 { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { BoundingBox, getOverflowParentDimensions, getOverflowParents } from '../../utils/scrollable-containers';\nimport { LogicalDOMRect } from './dropdown-position';\nimport { DropdownWidthConstraint } from './interfaces';\n\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 blockStart: number;\n blockEnd: number;\n inlineStart: number;\n inlineEnd: number;\n}\nexport interface DropdownPosition {\n blockSize: string;\n inlineSize: string;\n dropBlockStart: boolean;\n dropInlineStart: boolean;\n insetInlineStart: string;\n}\nexport interface InteriorDropdownPosition extends DropdownPosition {\n insetBlockEnd: string;\n insetBlockStart: string;\n}\n\nconst getClosestParentDimensions = (element: HTMLElement): any => {\n const parents = getOverflowParents(element).map(element => {\n const { blockSize, inlineSize, insetBlockStart, insetInlineStart } = getLogicalBoundingClientRect(element);\n return {\n blockSize,\n inlineSize,\n insetBlockStart,\n insetInlineStart,\n };\n });\n\n return parents.shift();\n};\n\nconst getAvailableSpace = ({\n trigger,\n overflowParents,\n stretchWidth = false,\n stretchHeight = false,\n isMobile,\n}: {\n trigger: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\n stretchWidth?: boolean;\n stretchHeight?: boolean;\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 {\n insetBlockEnd: triggerBlockEnd,\n insetInlineStart: triggerInlineStart,\n insetInlineEnd: triggerInlineEnd,\n } = getLogicalBoundingClientRect(trigger);\n\n return overflowParents.reduce(\n ({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {\n const offsetTop = triggerBlockEnd - overflowParent.insetBlockStart;\n const currentBlockStart = offsetTop - trigger.offsetHeight - availableSpaceReserveVertical;\n const currentBlockEnd = overflowParent.blockSize - offsetTop - availableSpaceReserveVertical;\n const currentInlineStart = triggerInlineEnd - overflowParent.insetInlineStart - availableSpaceReserveHorizontal;\n const currentInlineEnd =\n overflowParent.insetInlineStart +\n overflowParent.inlineSize -\n triggerInlineStart -\n availableSpaceReserveHorizontal;\n\n return {\n blockStart: Math.min(blockStart, currentBlockStart),\n blockEnd: Math.min(blockEnd, currentBlockEnd),\n inlineStart: Math.min(inlineStart, currentInlineStart),\n inlineEnd: Math.min(inlineEnd, currentInlineEnd),\n };\n },\n {\n blockStart: Number.MAX_VALUE,\n blockEnd: Number.MAX_VALUE,\n inlineStart: Number.MAX_VALUE,\n inlineEnd: Number.MAX_VALUE,\n }\n );\n};\n\nconst getInteriorAvailableSpace = ({\n trigger,\n overflowParents,\n isMobile,\n}: {\n trigger: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\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 insetBlockEnd: triggerBlockEnd,\n insetBlockStart: triggerBlockStart,\n insetInlineStart: triggerInlineStart,\n insetInlineEnd: triggerInlineEnd,\n } = getLogicalBoundingClientRect(trigger);\n\n return overflowParents.reduce(\n ({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {\n const currentBlockStart = triggerBlockEnd - overflowParent.insetBlockStart - AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentBlockEnd =\n overflowParent.blockSize -\n triggerBlockStart +\n overflowParent.insetBlockStart -\n AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentInlineStart =\n triggerInlineStart - overflowParent.insetInlineStart - AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n const currentInlineEnd =\n overflowParent.insetInlineStart +\n overflowParent.inlineSize -\n triggerInlineEnd -\n AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n\n return {\n blockStart: Math.min(blockStart, currentBlockStart),\n blockEnd: Math.min(blockEnd, currentBlockEnd),\n inlineStart: Math.min(inlineStart, currentInlineStart),\n inlineEnd: Math.min(inlineEnd, currentInlineEnd),\n };\n },\n {\n blockStart: Number.MAX_VALUE,\n blockEnd: Number.MAX_VALUE,\n inlineStart: Number.MAX_VALUE,\n inlineEnd: Number.MAX_VALUE,\n }\n );\n};\n\nconst resolveWidthConstraint = (\n constraint: DropdownWidthConstraint | undefined,\n triggerWidth: number,\n fallback: number\n): number => {\n if (constraint === 'trigger') {\n return triggerWidth;\n }\n if (typeof constraint === 'number') {\n return constraint;\n }\n return fallback;\n};\n\nconst getWidths = ({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n minWidthConstraint?: DropdownWidthConstraint;\n maxWidthConstraint?: DropdownWidthConstraint;\n}) => {\n const { inlineSize: triggerInlineSize } = getLogicalBoundingClientRect(triggerElement);\n const { inlineSize: requiredWidth } = getLogicalBoundingClientRect(dropdownElement);\n\n const minWidth = resolveWidthConstraint(minWidthConstraint, triggerInlineSize, 0);\n const maxWidth = resolveWidthConstraint(maxWidthConstraint, triggerInlineSize, Number.MAX_VALUE);\n\n const idealWidth = Math.min(Math.max(requiredWidth, minWidth), maxWidth);\n return { idealWidth, minWidth, triggerInlineSize };\n};\n\nexport const hasEnoughSpaceForFlexibleWidth = ({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n expandToViewport,\n stretchHeight,\n isMobile,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n minWidthConstraint?: DropdownWidthConstraint;\n maxWidthConstraint?: DropdownWidthConstraint;\n expandToViewport: boolean;\n stretchHeight: boolean;\n isMobile: boolean;\n}) => {\n const overflowParents = getOverflowParentDimensions({\n element: dropdownElement,\n excludeClosestParent: false,\n expandToViewport,\n canExpandOutsideViewport: stretchHeight,\n });\n const { idealWidth } = getWidths({\n triggerElement: triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n });\n const availableSpace = getAvailableSpace({\n trigger: triggerElement,\n overflowParents,\n stretchHeight,\n isMobile,\n });\n return idealWidth <= availableSpace.inlineStart || idealWidth <= availableSpace.inlineEnd;\n};\n\nexport const getDropdownPosition = ({\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth: minWidthConstraint,\n maxWidth: maxWidthConstraint,\n preferCenter = false,\n matchTriggerWidth = false,\n stretchHeight = false,\n isMobile = false,\n maxHeight,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\n minWidth?: DropdownWidthConstraint;\n maxWidth?: DropdownWidthConstraint;\n preferCenter?: boolean;\n matchTriggerWidth?: boolean;\n stretchHeight?: boolean;\n isMobile?: boolean;\n maxHeight?: number;\n}): DropdownPosition => {\n // Determine the space available around the dropdown that it can grow in\n const availableSpace = getAvailableSpace({\n trigger: triggerElement,\n overflowParents,\n stretchWidth: matchTriggerWidth,\n stretchHeight,\n isMobile,\n });\n const { idealWidth, minWidth, triggerInlineSize } = getWidths({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n });\n\n let dropInlineStart: boolean;\n let insetInlineStart: number | null = null;\n let inlineSize = idealWidth;\n\n //1. Can it be positioned with ideal width to the right?\n if (idealWidth <= availableSpace.inlineEnd) {\n dropInlineStart = false;\n //2. Can it be positioned with ideal width to the left?\n } else if (idealWidth <= availableSpace.inlineStart) {\n dropInlineStart = true;\n //3. Fit into biggest available space either on left or right\n } else {\n dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;\n inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd, minWidth);\n }\n\n if (preferCenter) {\n const spillOver = (idealWidth - triggerInlineSize) / 2;\n\n // availableSpace always includes the trigger width, but we want to exclude that\n const availableOutsideLeft = availableSpace.inlineStart - triggerInlineSize;\n const availableOutsideRight = availableSpace.inlineEnd - triggerInlineSize;\n\n const fitsInCenter = availableOutsideLeft >= spillOver && availableOutsideRight >= spillOver;\n if (fitsInCenter) {\n insetInlineStart = -spillOver;\n }\n }\n\n const dropBlockStart =\n availableSpace.blockEnd < dropdownElement.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;\n const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = Math.max(stretchHeight ? availableHeight : Math.floor(availableHeight / 31) * 31 + 16, 15);\n\n const blockSize = maxHeight ? `min(${croppedHeight}px, ${maxHeight}px)` : `${croppedHeight}px`;\n\n return {\n dropBlockStart,\n dropInlineStart,\n insetInlineStart: insetInlineStart === null ? 'auto' : `${insetInlineStart}px`,\n blockSize,\n inlineSize: `${inlineSize}px`,\n };\n};\n\nconst getInteriorDropdownPosition = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<BoundingBox>,\n isMobile?: boolean\n): InteriorDropdownPosition => {\n const availableSpace = getInteriorAvailableSpace({ trigger, overflowParents, isMobile });\n const {\n insetBlockEnd: triggerBlockEnd,\n insetBlockStart: triggerBlockStart,\n inlineSize: triggerInlineSize,\n } = getLogicalBoundingClientRect(trigger);\n const { insetBlockStart: parentDropdownBlockStart, blockSize: parentDropdownHeight } =\n getClosestParentDimensions(trigger);\n\n let dropInlineStart;\n\n let { inlineSize } = getLogicalBoundingClientRect(dropdown);\n const insetBlockStart = triggerBlockStart - parentDropdownBlockStart;\n if (inlineSize <= availableSpace.inlineEnd) {\n dropInlineStart = false;\n } else if (inlineSize <= availableSpace.inlineStart) {\n dropInlineStart = true;\n } else {\n dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;\n inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd);\n }\n\n const insetInlineStart = dropInlineStart ? 0 - inlineSize : triggerInlineSize;\n\n const dropBlockStart =\n availableSpace.blockEnd < dropdown.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;\n const insetBlockEnd = dropBlockStart ? parentDropdownBlockStart + parentDropdownHeight - triggerBlockEnd : 0;\n const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;\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 dropBlockStart,\n dropInlineStart,\n blockSize: `${croppedHeight}px`,\n inlineSize: `${inlineSize}px`,\n insetBlockStart: `${insetBlockStart}px`,\n insetBlockEnd: `${insetBlockEnd}px`,\n insetInlineStart: `${insetInlineStart}px`,\n };\n};\n\nexport const calculatePosition = (\n dropdownElement: HTMLDivElement,\n triggerElement: HTMLElement,\n verticalContainerElement: HTMLDivElement,\n interior: boolean,\n expandToViewport: boolean,\n preferCenter: boolean,\n matchTriggerWidth: boolean,\n stretchHeight: boolean,\n isMobile: boolean,\n minWidth?: DropdownWidthConstraint,\n maxWidth?: DropdownWidthConstraint,\n maxHeight?: number\n): [DropdownPosition, LogicalDOMRect] => {\n // cleaning previously assigned values,\n // so that they are not reused in case of screen resize and similar events\n verticalContainerElement.style.maxBlockSize = '';\n dropdownElement.style.inlineSize = '';\n dropdownElement.style.insetBlockStart = '';\n dropdownElement.style.insetBlockEnd = '';\n dropdownElement.style.insetInlineStart = '';\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({\n element: dropdownElement,\n excludeClosestParent: interior,\n expandToViewport,\n canExpandOutsideViewport: stretchHeight,\n });\n const position: DropdownPosition | InteriorDropdownPosition = interior\n ? getInteriorDropdownPosition(triggerElement, dropdownElement, overflowParents, isMobile)\n : getDropdownPosition({\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth,\n maxWidth,\n preferCenter,\n matchTriggerWidth,\n stretchHeight,\n isMobile,\n maxHeight,\n });\n\n const triggerBox = getLogicalBoundingClientRect(triggerElement);\n return [position, triggerBox];\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DropdownProps } from './interfaces';
|
|
2
|
-
declare const Dropdown: ({ content, trigger, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight, stretchHeight, minWidth, maxWidth, hideBlockBorder, expandToViewport, preferredAlignment, interior, scrollable, loopFocus, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }: DropdownProps) => JSX.Element;
|
|
2
|
+
declare const Dropdown: ({ content, trigger, triggerRef: externalTriggerRef, triggerId: externalTriggerId, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight, stretchHeight, minWidth, maxWidth, maxHeight, hideBlockBorder, expandToViewport, preferredAlignment, interior, scrollable, loopFocus, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }: 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":"AA0BA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA+I7C,QAAA,MAAM,QAAQ,GAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA+I7C,QAAA,MAAM,QAAQ,GAAI,4bAiCf,aAAa,gBAoXf,CAAC;AAMF,eAAe,QAAQ,CAAC"}
|
|
@@ -54,14 +54,16 @@ const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTrigger
|
|
|
54
54
|
content,
|
|
55
55
|
footer)))));
|
|
56
56
|
};
|
|
57
|
-
const Dropdown = ({ content, trigger, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight = false, stretchHeight = false, minWidth, maxWidth, hideBlockBorder = true, expandToViewport = false, preferredAlignment = 'start', interior = false, scrollable = true, loopFocus = expandToViewport, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
|
|
57
|
+
const Dropdown = ({ content, trigger, triggerRef: externalTriggerRef, triggerId: externalTriggerId, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight = false, stretchHeight = false, minWidth, maxWidth, maxHeight, hideBlockBorder = true, expandToViewport = false, preferredAlignment = 'start', interior = false, scrollable = true, loopFocus = expandToViewport, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
|
|
58
58
|
const wrapperRef = useRef(null);
|
|
59
|
-
const
|
|
59
|
+
const internalTriggerRef = useRef(null);
|
|
60
60
|
const dropdownRef = useRef(null);
|
|
61
61
|
const dropdownContainerRef = useRef(null);
|
|
62
62
|
const verticalContainerRef = useRef(null);
|
|
63
63
|
// To keep track of the initial position (drop up/down) which is kept the same during fixed repositioning
|
|
64
64
|
const fixedPosition = useRef(null);
|
|
65
|
+
// Use external trigger ref if provided, otherwise use internal ref
|
|
66
|
+
const triggerRef = externalTriggerRef || internalTriggerRef;
|
|
65
67
|
const isRefresh = useVisualRefresh();
|
|
66
68
|
const dropdownClasses = usePortalModeClasses(triggerRef);
|
|
67
69
|
const [position, setPosition] = useState('bottom-right');
|
|
@@ -182,7 +184,7 @@ const Dropdown = ({ content, trigger, open, onOutsideClick, onMouseDown, header,
|
|
|
182
184
|
if (scrollable) {
|
|
183
185
|
dropdownRef.current.classList.add(styles.nowrap);
|
|
184
186
|
}
|
|
185
|
-
setDropdownPosition(...calculatePosition(dropdownRef.current, triggerRef.current, verticalContainerRef.current, interior, expandToViewport, preferCenter, matchTriggerWidth, stretchHeight, isMobile, minWidth, maxWidth), dropdownRef.current, verticalContainerRef.current);
|
|
187
|
+
setDropdownPosition(...calculatePosition(dropdownRef.current, triggerRef.current, verticalContainerRef.current, interior, expandToViewport, preferCenter, matchTriggerWidth, stretchHeight, isMobile, minWidth, maxWidth, maxHeight), dropdownRef.current, verticalContainerRef.current);
|
|
186
188
|
if (scrollable) {
|
|
187
189
|
dropdownRef.current.classList.remove(styles.nowrap);
|
|
188
190
|
}
|
|
@@ -222,7 +224,7 @@ const Dropdown = ({ content, trigger, open, onOutsideClick, onMouseDown, header,
|
|
|
222
224
|
return () => {
|
|
223
225
|
window.removeEventListener('click', clickListener, true);
|
|
224
226
|
};
|
|
225
|
-
}, [open, onOutsideClick]);
|
|
227
|
+
}, [open, onOutsideClick, triggerRef]);
|
|
226
228
|
// subscribe to Escape key press
|
|
227
229
|
useEffect(() => {
|
|
228
230
|
// Only add the listener if onEscape callback is provided
|
|
@@ -263,8 +265,9 @@ const Dropdown = ({ content, trigger, open, onOutsideClick, onMouseDown, header,
|
|
|
263
265
|
return () => {
|
|
264
266
|
controller.abort();
|
|
265
267
|
};
|
|
266
|
-
}, [open, expandToViewport, isMobile]);
|
|
267
|
-
const
|
|
268
|
+
}, [open, expandToViewport, isMobile, triggerRef]);
|
|
269
|
+
const generatedReferrerId = useUniqueId();
|
|
270
|
+
const referrerId = externalTriggerId || generatedReferrerId;
|
|
268
271
|
// Compute CSS variable values for min/max width
|
|
269
272
|
// These will be used by the use-flexible-width CSS class
|
|
270
273
|
const getMinWidthCssValue = () => {
|
|
@@ -288,7 +291,7 @@ const Dropdown = ({ content, trigger, open, onOutsideClick, onMouseDown, header,
|
|
|
288
291
|
return '100%';
|
|
289
292
|
};
|
|
290
293
|
return (React.createElement("div", { className: clsx(styles.root, interior && styles.interior, stretchTriggerHeight && styles['stretch-trigger-height']), ref: wrapperRef, onFocus: focusHandler, onBlur: blurHandler },
|
|
291
|
-
React.createElement("div", { id: referrerId, className: clsx(stretchTriggerHeight && styles['stretch-trigger-height']), ref:
|
|
294
|
+
!externalTriggerRef && (React.createElement("div", { id: referrerId, className: clsx(stretchTriggerHeight && styles['stretch-trigger-height']), ref: internalTriggerRef }, trigger)),
|
|
292
295
|
React.createElement(TabTrap, { focusNextCallback: () => { var _a; return dropdownRef.current && ((_a = getFirstFocusable(dropdownRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !loopFocus }),
|
|
293
296
|
React.createElement(DropdownContainer, { triggerRef: triggerRef, renderWithPortal: expandToViewport && !interior, id: dropdownId, referrerId: referrerId, open: open },
|
|
294
297
|
React.createElement(Transition, { in: open !== null && open !== void 0 ? open : false, exit: false }, (state, ref) => (React.createElement("div", { ref: dropdownContainerRef },
|