@cloudscape-design/components-themeable 3.0.1051 → 3.0.1053

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 (77) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/alert/styles.scss +12 -2
  3. package/lib/internal/scss/internal/components/button-trigger/styles.scss +4 -2
  4. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  5. package/lib/internal/template/alert/index.d.ts.map +1 -1
  6. package/lib/internal/template/alert/index.js +2 -2
  7. package/lib/internal/template/alert/index.js.map +1 -1
  8. package/lib/internal/template/alert/interfaces.d.ts +46 -0
  9. package/lib/internal/template/alert/interfaces.d.ts.map +1 -1
  10. package/lib/internal/template/alert/interfaces.js.map +1 -1
  11. package/lib/internal/template/alert/internal.d.ts +1 -0
  12. package/lib/internal/template/alert/internal.d.ts.map +1 -1
  13. package/lib/internal/template/alert/internal.js +4 -3
  14. package/lib/internal/template/alert/internal.js.map +1 -1
  15. package/lib/internal/template/alert/style.d.ts +23 -0
  16. package/lib/internal/template/alert/style.d.ts.map +1 -0
  17. package/lib/internal/template/alert/style.js +36 -0
  18. package/lib/internal/template/alert/style.js.map +1 -0
  19. package/lib/internal/template/alert/styles.css.js +27 -27
  20. package/lib/internal/template/alert/styles.scoped.css +47 -46
  21. package/lib/internal/template/alert/styles.selectors.js +27 -27
  22. package/lib/internal/template/button-dropdown/internal.d.ts.map +1 -1
  23. package/lib/internal/template/button-dropdown/internal.js +2 -2
  24. package/lib/internal/template/button-dropdown/internal.js.map +1 -1
  25. package/lib/internal/template/container/interfaces.d.ts +46 -0
  26. package/lib/internal/template/container/interfaces.d.ts.map +1 -1
  27. package/lib/internal/template/container/interfaces.js.map +1 -1
  28. package/lib/internal/template/container/internal.d.ts +1 -1
  29. package/lib/internal/template/container/internal.d.ts.map +1 -1
  30. package/lib/internal/template/container/internal.js +9 -7
  31. package/lib/internal/template/container/internal.js.map +1 -1
  32. package/lib/internal/template/container/style.d.ts +7 -0
  33. package/lib/internal/template/container/style.d.ts.map +1 -0
  34. package/lib/internal/template/container/style.js +58 -0
  35. package/lib/internal/template/container/style.js.map +1 -0
  36. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  37. package/lib/internal/template/internal/components/button-trigger/styles.css.js +13 -13
  38. package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +36 -31
  39. package/lib/internal/template/internal/components/button-trigger/styles.selectors.js +13 -13
  40. package/lib/internal/template/internal/environment.js +2 -2
  41. package/lib/internal/template/internal/environment.json +2 -2
  42. package/lib/internal/template/package.json +0 -1
  43. package/package.json +1 -1
  44. package/lib/internal/scss/top-navigation/1.0-beta/styles.scss +0 -219
  45. package/lib/internal/template/test-utils/dom/top-navigation/1.0-beta/index.d.ts +0 -28
  46. package/lib/internal/template/test-utils/dom/top-navigation/1.0-beta/index.js +0 -72
  47. package/lib/internal/template/test-utils/dom/top-navigation/1.0-beta/index.js.map +0 -1
  48. package/lib/internal/template/test-utils/selectors/top-navigation/1.0-beta/index.d.ts +0 -28
  49. package/lib/internal/template/test-utils/selectors/top-navigation/1.0-beta/index.js +0 -72
  50. package/lib/internal/template/test-utils/selectors/top-navigation/1.0-beta/index.js.map +0 -1
  51. package/lib/internal/template/top-navigation/1.0-beta/index.d.ts +0 -10
  52. package/lib/internal/template/top-navigation/1.0-beta/index.d.ts.map +0 -1
  53. package/lib/internal/template/top-navigation/1.0-beta/index.js +0 -19
  54. package/lib/internal/template/top-navigation/1.0-beta/index.js.map +0 -1
  55. package/lib/internal/template/top-navigation/1.0-beta/interfaces.d.ts +0 -103
  56. package/lib/internal/template/top-navigation/1.0-beta/interfaces.d.ts.map +0 -1
  57. package/lib/internal/template/top-navigation/1.0-beta/interfaces.js +0 -2
  58. package/lib/internal/template/top-navigation/1.0-beta/interfaces.js.map +0 -1
  59. package/lib/internal/template/top-navigation/1.0-beta/internal.d.ts +0 -7
  60. package/lib/internal/template/top-navigation/1.0-beta/internal.d.ts.map +0 -1
  61. package/lib/internal/template/top-navigation/1.0-beta/internal.js +0 -93
  62. package/lib/internal/template/top-navigation/1.0-beta/internal.js.map +0 -1
  63. package/lib/internal/template/top-navigation/1.0-beta/parts/overflow-menu.d.ts +0 -17
  64. package/lib/internal/template/top-navigation/1.0-beta/parts/overflow-menu.d.ts.map +0 -1
  65. package/lib/internal/template/top-navigation/1.0-beta/parts/overflow-menu.js +0 -54
  66. package/lib/internal/template/top-navigation/1.0-beta/parts/overflow-menu.js.map +0 -1
  67. package/lib/internal/template/top-navigation/1.0-beta/parts/utility.d.ts +0 -10
  68. package/lib/internal/template/top-navigation/1.0-beta/parts/utility.d.ts.map +0 -1
  69. package/lib/internal/template/top-navigation/1.0-beta/parts/utility.js +0 -56
  70. package/lib/internal/template/top-navigation/1.0-beta/parts/utility.js.map +0 -1
  71. package/lib/internal/template/top-navigation/1.0-beta/styles.css.js +0 -28
  72. package/lib/internal/template/top-navigation/1.0-beta/styles.scoped.css +0 -360
  73. package/lib/internal/template/top-navigation/1.0-beta/styles.selectors.js +0 -29
  74. package/lib/internal/template/top-navigation/1.0-beta/use-top-navigation.d.ts +0 -25
  75. package/lib/internal/template/top-navigation/1.0-beta/use-top-navigation.d.ts.map +0 -1
  76. package/lib/internal/template/top-navigation/1.0-beta/use-top-navigation.js +0 -154
  77. package/lib/internal/template/top-navigation/1.0-beta/use-top-navigation.js.map +0 -1
@@ -1,360 +0,0 @@
1
- /*
2
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- SPDX-License-Identifier: Apache-2.0
4
- */
5
- /*
6
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
- SPDX-License-Identifier: Apache-2.0
8
- */
9
- /*
10
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
- SPDX-License-Identifier: Apache-2.0
12
- */
13
- /*
14
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
15
- SPDX-License-Identifier: Apache-2.0
16
- */
17
- /*
18
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
- SPDX-License-Identifier: Apache-2.0
20
- */
21
- /*
22
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
23
- SPDX-License-Identifier: Apache-2.0
24
- */
25
- /*
26
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
27
- SPDX-License-Identifier: Apache-2.0
28
- */
29
- /*
30
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
31
- SPDX-License-Identifier: Apache-2.0
32
- */
33
- /*
34
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
35
- SPDX-License-Identifier: Apache-2.0
36
- */
37
- /*
38
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
39
- SPDX-License-Identifier: Apache-2.0
40
- */
41
- /*
42
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
43
- SPDX-License-Identifier: Apache-2.0
44
- */
45
- /*
46
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
47
- SPDX-License-Identifier: Apache-2.0
48
- */
49
- /*
50
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
51
- SPDX-License-Identifier: Apache-2.0
52
- */
53
- /*
54
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
55
- SPDX-License-Identifier: Apache-2.0
56
- */
57
- /*
58
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
59
- SPDX-License-Identifier: Apache-2.0
60
- */
61
- /*
62
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
63
- SPDX-License-Identifier: Apache-2.0
64
- */
65
- /*
66
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
67
- SPDX-License-Identifier: Apache-2.0
68
- */
69
- /*
70
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
71
- SPDX-License-Identifier: Apache-2.0
72
- */
73
- /*
74
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
75
- SPDX-License-Identifier: Apache-2.0
76
- */
77
- /*
78
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
79
- SPDX-License-Identifier: Apache-2.0
80
- */
81
- /*
82
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
83
- SPDX-License-Identifier: Apache-2.0
84
- */
85
- /*
86
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
87
- SPDX-License-Identifier: Apache-2.0
88
- */
89
- /*
90
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
- SPDX-License-Identifier: Apache-2.0
92
- */
93
- /*
94
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
- SPDX-License-Identifier: Apache-2.0
96
- */
97
- /*
98
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
99
- SPDX-License-Identifier: Apache-2.0
100
- */
101
- /*
102
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
103
- SPDX-License-Identifier: Apache-2.0
104
- */
105
- /*
106
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
107
- SPDX-License-Identifier: Apache-2.0
108
- */
109
- /*
110
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
111
- SPDX-License-Identifier: Apache-2.0
112
- */
113
- /* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
114
- /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
115
- /*
116
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
117
- SPDX-License-Identifier: Apache-2.0
118
- */
119
- /*
120
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
121
- SPDX-License-Identifier: Apache-2.0
122
- */
123
- /*
124
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
125
- SPDX-License-Identifier: Apache-2.0
126
- */
127
- /*
128
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
129
- SPDX-License-Identifier: Apache-2.0
130
- */
131
- /*
132
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
133
- SPDX-License-Identifier: Apache-2.0
134
- */
135
- /*
136
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
137
- SPDX-License-Identifier: Apache-2.0
138
- */
139
- /*
140
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
141
- SPDX-License-Identifier: Apache-2.0
142
- */
143
- /* Style used for links in slots/components that are text heavy, to help links stand out among
144
- surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
145
- .awsui_top-navigation_1ca1i_dkdy5_145:not(#\9) {
146
- border-collapse: separate;
147
- border-spacing: 0;
148
- box-sizing: border-box;
149
- caption-side: top;
150
- cursor: auto;
151
- direction: inherit;
152
- empty-cells: show;
153
- font-family: serif;
154
- font-style: normal;
155
- font-variant: normal;
156
- font-stretch: normal;
157
- hyphens: none;
158
- letter-spacing: normal;
159
- list-style: disc outside none;
160
- tab-size: 8;
161
- text-align: start;
162
- text-indent: 0;
163
- text-shadow: none;
164
- text-transform: none;
165
- visibility: visible;
166
- white-space: normal;
167
- word-spacing: normal;
168
- font-size: var(--font-size-body-m-vv54cm, 14px);
169
- line-height: var(--line-height-body-m-bedeoh, 22px);
170
- color: var(--color-text-body-default-5qid0u, #16191f);
171
- font-weight: 400;
172
- font-family: var(--font-family-base-8x5ngf, "Noto Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
173
- -webkit-font-smoothing: auto;
174
- -moz-osx-font-smoothing: auto;
175
- background: var(--color-background-container-content-aemn43, #ffffff);
176
- }
177
- .awsui_top-navigation_1ca1i_dkdy5_145 > .awsui_padding-box_1ca1i_dkdy5_177:not(#\9) {
178
- display: flex;
179
- flex-direction: row;
180
- flex-wrap: nowrap;
181
- justify-content: space-between;
182
- align-items: center;
183
- box-sizing: border-box;
184
- block-size: calc(var(--space-xxxl-qhelse, 40px) + var(--space-scaled-m-sw9kcx, 16px));
185
- padding-block: 0;
186
- padding-inline-start: var(--space-l-3cws6j, 20px);
187
- padding-inline-end: 0;
188
- }
189
- .awsui_top-navigation_1ca1i_dkdy5_145.awsui_medium_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177:not(#\9), .awsui_top-navigation_1ca1i_dkdy5_145.awsui_narrow_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177:not(#\9) {
190
- block-size: calc(var(--space-xxxl-qhelse, 40px) + var(--space-scaled-xs-sppte9, 8px));
191
- }
192
- .awsui_top-navigation_1ca1i_dkdy5_145.awsui_narrow_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177:not(#\9) {
193
- block-size: var(--space-xxxl-qhelse, 40px);
194
- padding-block: 0;
195
- padding-inline-start: var(--space-xs-kw7k3v, 8px);
196
- padding-inline-end: 0;
197
- }
198
-
199
- .awsui_hidden_1ca1i_dkdy5_199:not(#\9) {
200
- position: absolute !important;
201
- inset-block-start: -9999px !important;
202
- inset-inline-start: -9999px !important;
203
- visibility: hidden;
204
- inline-size: 9000px;
205
- }
206
-
207
- /* stylelint-disable-next-line selector-combinator-disallowed-list, selector-max-universal */
208
- .awsui_hidden_1ca1i_dkdy5_199 *:not(#\9):not(#awsui_\9 _1ca1i_dkdy5_1) {
209
- visibility: hidden;
210
- }
211
-
212
- .awsui_identity_1ca1i_dkdy5_212 > .awsui_identity-link_1ca1i_dkdy5_212:not(#\9) {
213
- display: flex;
214
- align-items: center;
215
- text-decoration: none;
216
- color: var(--color-text-top-navigation-title-4lkrln, #16191f);
217
- }
218
- .awsui_identity_1ca1i_dkdy5_212 > .awsui_identity-link_1ca1i_dkdy5_212:not(#\9):hover {
219
- color: var(--color-text-accent-rvq171, #0073bb);
220
- }
221
- body[data-awsui-focus-visible=true] .awsui_identity_1ca1i_dkdy5_212 > .awsui_identity-link_1ca1i_dkdy5_212:not(#\9):focus {
222
- outline: thin dotted;
223
- outline: var(--border-link-focus-ring-outline-c5423y, 5px auto Highlight);
224
- outline-offset: 2px;
225
- outline-color: var(--color-border-item-focused-r5f6xl, #0073bb);
226
- border-start-start-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
227
- border-start-end-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
228
- border-end-start-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
229
- border-end-end-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
230
- box-shadow: 0 0 0 var(--border-link-focus-ring-shadow-spread-woh62o, 0px) var(--color-border-item-focused-r5f6xl, #0073bb);
231
- }
232
- .awsui_identity_1ca1i_dkdy5_212.awsui_no-logo_1ca1i_dkdy5_232:not(#\9) {
233
- min-inline-size: 100px;
234
- }
235
-
236
- .awsui_logo_1ca1i_dkdy5_236:not(#\9) {
237
- display: block;
238
- max-block-size: var(--space-xxl-q0lyvp, 32px);
239
- margin-inline-start: var(--space-s-4a5hs8, 12px);
240
- inline-size: auto;
241
- min-inline-size: 10px;
242
- }
243
- .awsui_logo_1ca1i_dkdy5_236.awsui_narrow_1ca1i_dkdy5_189:not(#\9) {
244
- max-block-size: var(--space-xl-4dmkh1, 24px);
245
- }
246
-
247
- .awsui_title_1ca1i_dkdy5_247:not(#\9) {
248
- font-size: var(--font-size-heading-m-56jjln, 18px);
249
- line-height: var(--line-height-heading-m-irezqt, 22px);
250
- letter-spacing: var(--letter-spacing-heading-m-93y02s, normal);
251
- font-weight: var(--font-weight-heading-m-1efgny, 400);
252
- -webkit-font-smoothing: var(--font-smoothing-webkit-px4az4, auto);
253
- -moz-osx-font-smoothing: var(--font-smoothing-moz-osx-ev3sgf, auto);
254
- margin-inline-start: var(--space-s-4a5hs8, 12px);
255
- white-space: nowrap;
256
- overflow: hidden;
257
- text-overflow: ellipsis;
258
- }
259
- .awsui_no-logo_1ca1i_dkdy5_232 > .awsui_identity-link_1ca1i_dkdy5_212 > .awsui_title_1ca1i_dkdy5_247:not(#\9) {
260
- font-weight: 700;
261
- }
262
-
263
- .awsui_inputs_1ca1i_dkdy5_263:not(#\9) {
264
- flex: 1;
265
- min-inline-size: 0;
266
- display: flex;
267
- justify-content: center;
268
- }
269
-
270
- .awsui_search_1ca1i_dkdy5_270:not(#\9) {
271
- inline-size: 100%;
272
- max-inline-size: 340px;
273
- padding-inline-start: var(--space-xxxl-qhelse, 40px);
274
- }
275
- .awsui_search-expanded_1ca1i_dkdy5_275:not(#\9) {
276
- max-inline-size: none;
277
- padding-inline-start: var(--space-s-4a5hs8, 12px);
278
- }
279
-
280
- .awsui_utilities_1ca1i_dkdy5_280:not(#\9) {
281
- display: flex;
282
- flex-shrink: 0;
283
- flex-direction: row;
284
- align-items: stretch;
285
- padding-inline-start: var(--space-m-n2lypl, 16px);
286
- block-size: 100%;
287
- }
288
- .awsui_medium_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177 > .awsui_utilities_1ca1i_dkdy5_280:not(#\9), .awsui_narrow_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177 > .awsui_utilities_1ca1i_dkdy5_280:not(#\9) {
289
- padding-inline-start: 0;
290
- }
291
-
292
- .awsui_utility-wrapper_1ca1i_dkdy5_292:not(#\9) {
293
- display: flex;
294
- position: relative;
295
- flex-shrink: 0;
296
- align-items: center;
297
- }
298
- .awsui_utility-wrapper_1ca1i_dkdy5_292:not(#\9)::after {
299
- display: block;
300
- position: absolute;
301
- content: "";
302
- inline-size: 1px;
303
- inset-inline-end: 0;
304
- inset-block: var(--space-s-4a5hs8, 12px);
305
- background: var(--color-border-divider-default-ipvpev, #eaeded);
306
- }
307
- .awsui_utility-wrapper_1ca1i_dkdy5_292.awsui_utility-wrapper-last_1ca1i_dkdy5_307:not(#\9):not(.awsui_utility-type-button-primary-button_1ca1i_dkdy5_307) {
308
- padding-inline-end: 0;
309
- }
310
- .awsui_utility-wrapper_1ca1i_dkdy5_292.awsui_utility-wrapper-last_1ca1i_dkdy5_307:not(#\9):not(.awsui_utility-type-button-primary-button_1ca1i_dkdy5_307)::after {
311
- display: none;
312
- }
313
- .awsui_medium_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177 > .awsui_utilities_1ca1i_dkdy5_280 > .awsui_utility-wrapper_1ca1i_dkdy5_292:not(#\9)::after, .awsui_narrow_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177 > .awsui_utilities_1ca1i_dkdy5_280 > .awsui_utility-wrapper_1ca1i_dkdy5_292:not(#\9)::after {
314
- inset-block: var(--space-xs-kw7k3v, 8px);
315
- }
316
-
317
- .awsui_utility-wrapper-last_1ca1i_dkdy5_307:not(#\9) {
318
- margin-inline-end: var(--space-s-4a5hs8, 12px);
319
- }
320
- .awsui_utility-wrapper-last_1ca1i_dkdy5_307.awsui_utility-type-menu-dropdown_1ca1i_dkdy5_320:not(#\9) {
321
- margin-inline-end: 0;
322
- }
323
- .awsui_narrow_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177 > .awsui_utilities_1ca1i_dkdy5_280 > .awsui_utility-wrapper-last_1ca1i_dkdy5_307:not(#\9) {
324
- margin-inline-end: 0;
325
- }
326
- .awsui_narrow_1ca1i_dkdy5_189 > .awsui_padding-box_1ca1i_dkdy5_177 > .awsui_utilities_1ca1i_dkdy5_280 > .awsui_utility-wrapper-last_1ca1i_dkdy5_307.awsui_utility-type-button-primary-button_1ca1i_dkdy5_307:not(#\9) {
327
- padding-inline-end: var(--space-l-3cws6j, 20px);
328
- }
329
-
330
- .awsui_utility-type-menu-dropdown_1ca1i_dkdy5_320:not(#\9) {
331
- padding-block: 0;
332
- padding-inline: var(--space-s-4a5hs8, 12px);
333
- align-items: stretch;
334
- }
335
-
336
- .awsui_utility-type-button-link_1ca1i_dkdy5_336:not(#\9),
337
- .awsui_utility-type-button-primary-button_1ca1i_dkdy5_307:not(#\9) {
338
- padding-block: 0;
339
- padding-inline: var(--space-m-n2lypl, 16px);
340
- }
341
-
342
- .awsui_utility-type-button-primary-button_1ca1i_dkdy5_307:not(#\9) {
343
- inset-inline-start: -1px;
344
- border-inline-start: 1px solid var(--color-background-container-content-aemn43, #ffffff);
345
- }
346
- .awsui_utility-type-button-primary-button_1ca1i_dkdy5_307:not(#\9)::after {
347
- display: none;
348
- }
349
-
350
- .awsui_utility-link-icon_1ca1i_dkdy5_350:not(#\9) {
351
- margin-inline-end: var(--space-xxs-jnczic, 4px);
352
- }
353
-
354
- .awsui_utility-button-external-icon_1ca1i_dkdy5_354:not(#\9) {
355
- display: inline-block;
356
- }
357
-
358
- .awsui_trigger_1ca1i_dkdy5_358:not(#\9) {
359
- /*used in test-utils*/
360
- }
@@ -1,29 +0,0 @@
1
-
2
- // es-module interop with Babel and Typescript
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- module.exports.default = {
5
- "top-navigation": "awsui_top-navigation_1ca1i_dkdy5_145",
6
- "padding-box": "awsui_padding-box_1ca1i_dkdy5_177",
7
- "medium": "awsui_medium_1ca1i_dkdy5_189",
8
- "narrow": "awsui_narrow_1ca1i_dkdy5_189",
9
- "hidden": "awsui_hidden_1ca1i_dkdy5_199",
10
- "\t": "awsui_\t_1ca1i_dkdy5_1",
11
- "identity": "awsui_identity_1ca1i_dkdy5_212",
12
- "identity-link": "awsui_identity-link_1ca1i_dkdy5_212",
13
- "no-logo": "awsui_no-logo_1ca1i_dkdy5_232",
14
- "logo": "awsui_logo_1ca1i_dkdy5_236",
15
- "title": "awsui_title_1ca1i_dkdy5_247",
16
- "inputs": "awsui_inputs_1ca1i_dkdy5_263",
17
- "search": "awsui_search_1ca1i_dkdy5_270",
18
- "search-expanded": "awsui_search-expanded_1ca1i_dkdy5_275",
19
- "utilities": "awsui_utilities_1ca1i_dkdy5_280",
20
- "utility-wrapper": "awsui_utility-wrapper_1ca1i_dkdy5_292",
21
- "utility-wrapper-last": "awsui_utility-wrapper-last_1ca1i_dkdy5_307",
22
- "utility-type-button-primary-button": "awsui_utility-type-button-primary-button_1ca1i_dkdy5_307",
23
- "utility-type-menu-dropdown": "awsui_utility-type-menu-dropdown_1ca1i_dkdy5_320",
24
- "utility-type-button-link": "awsui_utility-type-button-link_1ca1i_dkdy5_336",
25
- "utility-link-icon": "awsui_utility-link-icon_1ca1i_dkdy5_350",
26
- "utility-button-external-icon": "awsui_utility-button-external-icon_1ca1i_dkdy5_354",
27
- "trigger": "awsui_trigger_1ca1i_dkdy5_358"
28
- };
29
-
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { TopNavigationProps } from './interfaces';
3
- interface UseTopNavigationParams {
4
- __internalRootRef?: React.MutableRefObject<HTMLElement> | null;
5
- identity: TopNavigationProps['identity'];
6
- search: TopNavigationProps['search'];
7
- utilities: NonNullable<TopNavigationProps['utilities']>;
8
- }
9
- interface ResponsiveState {
10
- hideUtilityText?: boolean;
11
- hideSearch?: boolean;
12
- hideUtilities?: number[];
13
- hideTitle?: boolean;
14
- }
15
- interface UseTopNavigation {
16
- ref: React.Ref<HTMLDivElement>;
17
- virtualRef: React.Ref<HTMLDivElement>;
18
- responsiveState: ResponsiveState;
19
- breakpoint: 'default' | 'xxs' | 's';
20
- isSearchExpanded: boolean;
21
- onSearchUtilityClick: () => void;
22
- }
23
- export declare function useTopNavigation({ __internalRootRef: mainRef, identity, search, utilities, }: UseTopNavigationParams): UseTopNavigation;
24
- export {};
25
- //# sourceMappingURL=use-top-navigation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-top-navigation.d.ts","sourceRoot":"","sources":["../../../../src/top-navigation/1.0-beta/use-top-navigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAMpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,UAAU,sBAAsB;IAC9B,iBAAiB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAC/D,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrC,SAAS,EAAE,WAAW,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;CACzD;AAED,UAAU,eAAe;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAeD,UAAU,gBAAgB;IACxB,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC/B,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEtC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,SAAS,GAAG,KAAK,GAAG,GAAG,CAAC;IACpC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC;AAKD,wBAAgB,gBAAgB,CAAC,EAC/B,iBAAiB,EAAE,OAAO,EAC1B,QAAQ,EACR,MAAM,EACN,SAAS,GACV,EAAE,sBAAsB,GAAG,gBAAgB,CA0F3C"}
@@ -1,154 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { useEffect, useMemo, useRef, useState } from 'react';
4
- import { useContainerQuery } from '@cloudscape-design/component-toolkit';
5
- import { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';
6
- import { useContainerBreakpoints } from '../../internal/hooks/container-queries';
7
- import styles from './styles.css.js';
8
- // A small buffer to make calculations more lenient against browser lag or padding adjustments.
9
- const RESPONSIVENESS_BUFFER = 20;
10
- export function useTopNavigation({ __internalRootRef: mainRef, identity, search, utilities, }) {
11
- // Refs and breakpoints
12
- const virtualRef = useRef(null);
13
- const [breakpoint, breakpointRef] = useContainerBreakpoints(['xxs', 's']);
14
- // Responsiveness state
15
- // The component works by calculating the possible resize states that it can
16
- // be in, and having a state variable to track which state we're currently in.
17
- const hasSearch = !!search;
18
- const hasTitleWithLogo = identity && !!identity.logo && !!identity.title;
19
- const responsiveStates = useMemo(() => {
20
- return generateResponsiveStateKeys(utilities, hasSearch, hasTitleWithLogo);
21
- }, [utilities, hasSearch, hasTitleWithLogo]);
22
- // To hide/show elements dynamically, we need to know how much space they take up,
23
- // even if they're not being rendered. The top navigation elements are hidden/resized
24
- // based on the available size or if a search bar is open, and they need to be available
25
- // for calculations so we know where to toggle them. So we render a second, more stable
26
- // top-nav off screen to do these calculations against.
27
- //
28
- // We can't "affix" these values to pixels because they can depend on spacing tokens.
29
- // It's easier to render all of these utilities separately rather than figuring out
30
- // spacing token values, icon sizes, text widths, etc.
31
- //
32
- // TODO: Some of these values can be memoized to improve perf.
33
- const [responsiveState, containerQueryRef] = useContainerQuery(() => {
34
- var _a, _b, _c, _d;
35
- if (!(mainRef === null || mainRef === void 0 ? void 0 : mainRef.current) || !virtualRef.current) {
36
- return responsiveStates[0];
37
- }
38
- const sizeConfiguration = {
39
- hasSearch: !!search,
40
- // Get widths and paddings from the visible top navigation
41
- availableWidth: getContentBoxWidth(mainRef.current.querySelector(`.${styles['padding-box']}`)),
42
- utilitiesLeftPadding: parseFloat(getComputedStyle(virtualRef.current.querySelector(`.${styles.utilities}`)).paddingLeft),
43
- // Get widths from the hidden top navigation
44
- fullIdentityWidth: virtualRef.current.querySelector(`.${styles.identity}`).getBoundingClientRect().width,
45
- titleWidth: (_b = (_a = virtualRef.current.querySelector(`.${styles.title}`)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width) !== null && _b !== void 0 ? _b : 0,
46
- searchSlotWidth: (_d = (_c = virtualRef.current.querySelector(`.${styles.search}`)) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().width) !== null && _d !== void 0 ? _d : 0,
47
- searchUtilityWidth: virtualRef.current.querySelector('[data-utility-special="search"]').getBoundingClientRect()
48
- .width,
49
- utilityWithLabelWidths: Array.prototype.slice
50
- .call(virtualRef.current.querySelectorAll(`[data-utility-hide="false"]`))
51
- .map((element) => element.getBoundingClientRect().width),
52
- utilityWithoutLabelWidths: Array.prototype.slice
53
- .call(virtualRef.current.querySelectorAll(`[data-utility-hide="true"]`))
54
- .map((element) => element.getBoundingClientRect().width),
55
- menuTriggerUtilityWidth: virtualRef.current
56
- .querySelector('[data-utility-special="menu-trigger"]')
57
- .getBoundingClientRect().width,
58
- };
59
- return determineBestResponsiveState(responsiveStates, sizeConfiguration);
60
- }, [mainRef, search, responsiveStates]);
61
- // Search slot expansion on small screens
62
- const [isSearchMinimized, setSearchMinimized] = useState(true);
63
- const isSearchExpanded = !isSearchMinimized && breakpoint !== 's' && hasSearch && (responsiveState === null || responsiveState === void 0 ? void 0 : responsiveState.hideSearch);
64
- // If the search was expanded, and then the screen resized so that the
65
- // expansion is no longer necessary. So we implicitly minimize it.
66
- useEffect(() => {
67
- if (!(responsiveState === null || responsiveState === void 0 ? void 0 : responsiveState.hideSearch)) {
68
- setSearchMinimized(true);
69
- }
70
- }, [responsiveState]);
71
- // If the search is expanded after clicking on the search utility, move
72
- // the focus to the input. Since this is a user-controlled slot, we're just
73
- // assuming that it contains an input, though it's a pretty safe guess.
74
- useEffect(() => {
75
- var _a, _b;
76
- if (isSearchExpanded) {
77
- (_b = (_a = mainRef === null || mainRef === void 0 ? void 0 : mainRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`.${styles.search} input`)) === null || _b === void 0 ? void 0 : _b.focus();
78
- }
79
- }, [isSearchExpanded, mainRef]);
80
- const mergedRef = useMergeRefs(...(mainRef ? [mainRef] : []), containerQueryRef, breakpointRef);
81
- return {
82
- ref: mergedRef,
83
- virtualRef: virtualRef,
84
- responsiveState: responsiveState !== null && responsiveState !== void 0 ? responsiveState : responsiveStates[0],
85
- breakpoint: breakpoint !== null && breakpoint !== void 0 ? breakpoint : 'default',
86
- isSearchExpanded: !!isSearchExpanded,
87
- onSearchUtilityClick: () => setSearchMinimized(isSearchMinimized => !isSearchMinimized),
88
- };
89
- }
90
- /**
91
- * Get the width of the content box (assuming the element's box-sizing is border-box).
92
- */
93
- function getContentBoxWidth(element) {
94
- const style = getComputedStyle(element);
95
- return parseFloat(style.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);
96
- }
97
- /**
98
- * Generates the series of responsive steps that can be performed on the header in order.
99
- */
100
- function generateResponsiveStateKeys(utilities, canHideSearch, canHideTitle) {
101
- const states = [{}];
102
- if (utilities.some(utility => utility.text)) {
103
- states.push({ hideUtilityText: true });
104
- }
105
- if (canHideSearch) {
106
- states.push({
107
- hideUtilityText: true,
108
- hideSearch: true,
109
- });
110
- }
111
- const hiddenUtilties = [];
112
- for (let i = 0; i < utilities.length; i++) {
113
- if (!utilities[i].disableUtilityCollapse) {
114
- hiddenUtilties.push(i);
115
- states.push({
116
- hideUtilityText: true,
117
- hideSearch: canHideSearch || undefined,
118
- hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,
119
- });
120
- }
121
- }
122
- if (canHideTitle) {
123
- states.push({
124
- hideUtilityText: true,
125
- hideSearch: canHideSearch || undefined,
126
- hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,
127
- hideTitle: true,
128
- });
129
- }
130
- return states;
131
- }
132
- /**
133
- * Determines the best responsive state configuration of the top navigation, based on the given list of possible responsive states
134
- * and the current sizes of all elements inside the navigation bar.
135
- */
136
- function determineBestResponsiveState(possibleStates, sizes) {
137
- const { hasSearch, availableWidth, utilitiesLeftPadding, fullIdentityWidth, titleWidth, searchSlotWidth, searchUtilityWidth, utilityWithLabelWidths, utilityWithoutLabelWidths, menuTriggerUtilityWidth, } = sizes;
138
- // Iterate through each state and calculate its expected required width.
139
- for (const state of possibleStates) {
140
- const searchWidth = hasSearch ? (state.hideSearch ? searchUtilityWidth : searchSlotWidth) : 0;
141
- const utilitiesWidth = (state.hideUtilityText ? utilityWithoutLabelWidths : utilityWithLabelWidths)
142
- .filter((_width, i) => !state.hideUtilities || state.hideUtilities.indexOf(i) === -1)
143
- .reduce((sum, width) => sum + width, 0);
144
- const menuTriggerWidth = state.hideUtilities ? menuTriggerUtilityWidth : 0;
145
- const identityWidth = state.hideTitle ? fullIdentityWidth - titleWidth : fullIdentityWidth;
146
- const expectedInnerWidth = identityWidth + searchWidth + utilitiesLeftPadding + utilitiesWidth + menuTriggerWidth;
147
- if (expectedInnerWidth <= availableWidth - RESPONSIVENESS_BUFFER) {
148
- return state;
149
- }
150
- }
151
- // If nothing matches, pick the smallest possible state.
152
- return possibleStates[possibleStates.length - 1];
153
- }
154
- //# sourceMappingURL=use-top-navigation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-top-navigation.js","sourceRoot":"","sources":["../../../../src/top-navigation/1.0-beta/use-top-navigation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAuCrC,+FAA+F;AAC/F,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,UAAU,gBAAgB,CAAC,EAC/B,iBAAiB,EAAE,OAAO,EAC1B,QAAQ,EACR,MAAM,EACN,SAAS,GACc;IACvB,uBAAuB;IACvB,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,uBAAuB,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAE1E,uBAAuB;IACvB,4EAA4E;IAC5E,8EAA8E;IAC9E,MAAM,SAAS,GA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G,oBAAoB,GAAG,cAAc,GAAG,gBAAgB,CAAC;QAClH,IAAI,kBAAkB,IAAI,cAAc,GAAG,qBAAqB,EAAE;YAChE,OAAO,KAAK,CAAC;SACd;KACF;IAED,wDAAwD;IACxD,OAAO,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useContainerBreakpoints } from '../../internal/hooks/container-queries';\nimport { TopNavigationProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface UseTopNavigationParams {\n __internalRootRef?: React.MutableRefObject<HTMLElement> | null;\n identity: TopNavigationProps['identity'];\n search: TopNavigationProps['search'];\n utilities: NonNullable<TopNavigationProps['utilities']>;\n}\n\ninterface ResponsiveState {\n hideUtilityText?: boolean;\n hideSearch?: boolean;\n hideUtilities?: number[];\n hideTitle?: boolean;\n}\n\ninterface TopNavigationSizeConfiguration {\n hasSearch: boolean;\n availableWidth: number;\n utilitiesLeftPadding: number;\n fullIdentityWidth: number;\n titleWidth: number;\n searchSlotWidth: number;\n searchUtilityWidth: number;\n utilityWithLabelWidths: number[];\n utilityWithoutLabelWidths: number[];\n menuTriggerUtilityWidth: number;\n}\n\ninterface UseTopNavigation {\n ref: React.Ref<HTMLDivElement>;\n virtualRef: React.Ref<HTMLDivElement>;\n\n responsiveState: ResponsiveState;\n breakpoint: 'default' | 'xxs' | 's';\n isSearchExpanded: boolean;\n onSearchUtilityClick: () => void;\n}\n\n// A small buffer to make calculations more lenient against browser lag or padding adjustments.\nconst RESPONSIVENESS_BUFFER = 20;\n\nexport function useTopNavigation({\n __internalRootRef: mainRef,\n identity,\n search,\n utilities,\n}: UseTopNavigationParams): UseTopNavigation {\n // Refs and breakpoints\n const virtualRef = useRef<HTMLDivElement | null>(null);\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['xxs', 's']);\n\n // Responsiveness state\n // The component works by calculating the possible resize states that it can\n // be in, and having a state variable to track which state we're currently in.\n const hasSearch = !!search;\n const hasTitleWithLogo = identity && !!identity.logo && !!identity.title;\n const responsiveStates = useMemo<ReadonlyArray<ResponsiveState>>(() => {\n return generateResponsiveStateKeys(utilities, hasSearch, hasTitleWithLogo);\n }, [utilities, hasSearch, hasTitleWithLogo]);\n\n // To hide/show elements dynamically, we need to know how much space they take up,\n // even if they're not being rendered. The top navigation elements are hidden/resized\n // based on the available size or if a search bar is open, and they need to be available\n // for calculations so we know where to toggle them. So we render a second, more stable\n // top-nav off screen to do these calculations against.\n //\n // We can't \"affix\" these values to pixels because they can depend on spacing tokens.\n // It's easier to render all of these utilities separately rather than figuring out\n // spacing token values, icon sizes, text widths, etc.\n //\n // TODO: Some of these values can be memoized to improve perf.\n const [responsiveState, containerQueryRef] = useContainerQuery<ResponsiveState>(() => {\n if (!mainRef?.current || !virtualRef.current) {\n return responsiveStates[0];\n }\n\n const sizeConfiguration = {\n hasSearch: !!search,\n\n // Get widths and paddings from the visible top navigation\n availableWidth: getContentBoxWidth(mainRef.current.querySelector(`.${styles['padding-box']}`)!),\n utilitiesLeftPadding: parseFloat(\n getComputedStyle(virtualRef.current.querySelector(`.${styles.utilities}`)!).paddingLeft\n ),\n\n // Get widths from the hidden top navigation\n fullIdentityWidth: virtualRef.current.querySelector(`.${styles.identity}`)!.getBoundingClientRect().width,\n titleWidth: virtualRef.current.querySelector(`.${styles.title}`)?.getBoundingClientRect().width ?? 0,\n searchSlotWidth: virtualRef.current.querySelector(`.${styles.search}`)?.getBoundingClientRect().width ?? 0,\n searchUtilityWidth: virtualRef.current.querySelector('[data-utility-special=\"search\"]')!.getBoundingClientRect()\n .width,\n utilityWithLabelWidths: Array.prototype.slice\n .call(virtualRef.current.querySelectorAll(`[data-utility-hide=\"false\"]`))\n .map((element: Element) => element.getBoundingClientRect().width),\n utilityWithoutLabelWidths: Array.prototype.slice\n .call(virtualRef.current.querySelectorAll(`[data-utility-hide=\"true\"]`))\n .map((element: Element) => element.getBoundingClientRect().width),\n menuTriggerUtilityWidth: virtualRef.current\n .querySelector('[data-utility-special=\"menu-trigger\"]')!\n .getBoundingClientRect().width,\n };\n\n return determineBestResponsiveState(responsiveStates, sizeConfiguration);\n }, [mainRef, search, responsiveStates]);\n\n // Search slot expansion on small screens\n const [isSearchMinimized, setSearchMinimized] = useState(true);\n const isSearchExpanded = !isSearchMinimized && breakpoint !== 's' && hasSearch && responsiveState?.hideSearch;\n\n // If the search was expanded, and then the screen resized so that the\n // expansion is no longer necessary. So we implicitly minimize it.\n useEffect(() => {\n if (!responsiveState?.hideSearch) {\n setSearchMinimized(true);\n }\n }, [responsiveState]);\n\n // If the search is expanded after clicking on the search utility, move\n // the focus to the input. Since this is a user-controlled slot, we're just\n // assuming that it contains an input, though it's a pretty safe guess.\n useEffect(() => {\n if (isSearchExpanded) {\n mainRef?.current?.querySelector<HTMLInputElement>(`.${styles.search} input`)?.focus();\n }\n }, [isSearchExpanded, mainRef]);\n\n const mergedRef = useMergeRefs(...(mainRef ? [mainRef] : []), containerQueryRef, breakpointRef);\n\n return {\n ref: mergedRef,\n virtualRef: virtualRef,\n responsiveState: responsiveState ?? responsiveStates[0],\n breakpoint: breakpoint ?? 'default',\n isSearchExpanded: !!isSearchExpanded,\n onSearchUtilityClick: () => setSearchMinimized(isSearchMinimized => !isSearchMinimized),\n };\n}\n\n/**\n * Get the width of the content box (assuming the element's box-sizing is border-box).\n */\nfunction getContentBoxWidth(element: Element): number {\n const style = getComputedStyle(element);\n return parseFloat(style.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);\n}\n\n/**\n * Generates the series of responsive steps that can be performed on the header in order.\n */\nfunction generateResponsiveStateKeys(\n utilities: ReadonlyArray<TopNavigationProps.Utility>,\n canHideSearch: boolean,\n canHideTitle: boolean\n): ReadonlyArray<ResponsiveState> {\n const states: ResponsiveState[] = [{}];\n if (utilities.some(utility => utility.text)) {\n states.push({ hideUtilityText: true });\n }\n if (canHideSearch) {\n states.push({\n hideUtilityText: true,\n hideSearch: true,\n });\n }\n const hiddenUtilties = [];\n for (let i = 0; i < utilities.length; i++) {\n if (!utilities[i].disableUtilityCollapse) {\n hiddenUtilties.push(i);\n states.push({\n hideUtilityText: true,\n hideSearch: canHideSearch || undefined,\n hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,\n });\n }\n }\n if (canHideTitle) {\n states.push({\n hideUtilityText: true,\n hideSearch: canHideSearch || undefined,\n hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,\n hideTitle: true,\n });\n }\n return states;\n}\n\n/**\n * Determines the best responsive state configuration of the top navigation, based on the given list of possible responsive states\n * and the current sizes of all elements inside the navigation bar.\n */\nfunction determineBestResponsiveState(\n possibleStates: ReadonlyArray<ResponsiveState>,\n sizes: TopNavigationSizeConfiguration\n): ResponsiveState {\n const {\n hasSearch,\n availableWidth,\n utilitiesLeftPadding,\n fullIdentityWidth,\n titleWidth,\n searchSlotWidth,\n searchUtilityWidth,\n utilityWithLabelWidths,\n utilityWithoutLabelWidths,\n menuTriggerUtilityWidth,\n } = sizes;\n // Iterate through each state and calculate its expected required width.\n for (const state of possibleStates) {\n const searchWidth = hasSearch ? (state.hideSearch ? searchUtilityWidth : searchSlotWidth) : 0;\n const utilitiesWidth: number = (state.hideUtilityText ? utilityWithoutLabelWidths : utilityWithLabelWidths)\n .filter((_width, i) => !state.hideUtilities || state.hideUtilities.indexOf(i) === -1)\n .reduce((sum, width) => sum + width, 0);\n const menuTriggerWidth = state.hideUtilities ? menuTriggerUtilityWidth : 0;\n const identityWidth = state.hideTitle ? fullIdentityWidth - titleWidth : fullIdentityWidth;\n const expectedInnerWidth = identityWidth + searchWidth + utilitiesLeftPadding + utilitiesWidth + menuTriggerWidth;\n if (expectedInnerWidth <= availableWidth - RESPONSIVENESS_BUFFER) {\n return state;\n }\n }\n\n // If nothing matches, pick the smallest possible state.\n return possibleStates[possibleStates.length - 1];\n}\n"]}