@cloudscape-design/components 3.0.678 → 3.0.679
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/internal/components/filtering-token/styles.css.js +7 -7
- package/internal/components/filtering-token/styles.scoped.css +14 -14
- package/internal/components/filtering-token/styles.selectors.js +7 -7
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/theming/index.cjs +2 -0
- package/internal/generated/theming/index.cjs.d.ts +8 -0
- package/internal/generated/theming/index.d.ts +8 -0
- package/internal/generated/theming/index.js +2 -0
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/table/index.d.ts.map +1 -1
- package/table/index.js +1 -0
- package/table/index.js.map +1 -1
- package/top-navigation/internal.d.ts.map +1 -1
- package/top-navigation/internal.js +3 -2
- package/top-navigation/internal.js.map +1 -1
- package/top-navigation/parts/utility.d.ts.map +1 -1
- package/top-navigation/parts/utility.js +15 -1
- package/top-navigation/parts/utility.js.map +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"token": "
|
|
6
|
-
"show-operation": "awsui_show-
|
|
7
|
-
"select": "
|
|
8
|
-
"token-content": "awsui_token-
|
|
9
|
-
"dismiss-button": "awsui_dismiss-
|
|
10
|
-
"token-disabled": "awsui_token-
|
|
4
|
+
"root": "awsui_root_10m3l_9o8ze_101",
|
|
5
|
+
"token": "awsui_token_10m3l_9o8ze_106",
|
|
6
|
+
"show-operation": "awsui_show-operation_10m3l_9o8ze_121",
|
|
7
|
+
"select": "awsui_select_10m3l_9o8ze_127",
|
|
8
|
+
"token-content": "awsui_token-content_10m3l_9o8ze_131",
|
|
9
|
+
"dismiss-button": "awsui_dismiss-button_10m3l_9o8ze_136",
|
|
10
|
+
"token-disabled": "awsui_token-disabled_10m3l_9o8ze_178"
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -98,12 +98,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
98
98
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
99
99
|
SPDX-License-Identifier: Apache-2.0
|
|
100
100
|
*/
|
|
101
|
-
.
|
|
101
|
+
.awsui_root_10m3l_9o8ze_101:not(#\9) {
|
|
102
102
|
display: flex;
|
|
103
103
|
align-content: stretch;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.
|
|
106
|
+
.awsui_token_10m3l_9o8ze_106:not(#\9) {
|
|
107
|
+
flex-grow: 1;
|
|
107
108
|
border-block: var(--border-field-width-09w7vk, 2px) solid var(--color-border-item-selected-k00wlz, #0972d3);
|
|
108
109
|
border-inline: var(--border-field-width-09w7vk, 2px) solid var(--color-border-item-selected-k00wlz, #0972d3);
|
|
109
110
|
display: flex;
|
|
@@ -114,26 +115,25 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
114
115
|
border-end-start-radius: var(--border-radius-token-923jqq, 8px);
|
|
115
116
|
border-end-end-radius: var(--border-radius-token-923jqq, 8px);
|
|
116
117
|
color: var(--color-text-body-default-at06ol, #000716);
|
|
117
|
-
block-size: 100%;
|
|
118
118
|
box-sizing: border-box;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.awsui_show-
|
|
121
|
+
.awsui_show-operation_10m3l_9o8ze_121:not(#\9) {
|
|
122
122
|
border-inline-start: none;
|
|
123
123
|
border-start-start-radius: 0;
|
|
124
124
|
border-end-start-radius: 0;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
.
|
|
127
|
+
.awsui_select_10m3l_9o8ze_127:not(#\9) {
|
|
128
128
|
/* used in test-utils */
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
.awsui_token-
|
|
131
|
+
.awsui_token-content_10m3l_9o8ze_131:not(#\9) {
|
|
132
132
|
padding-block: var(--space-scaled-xxs-7597g1, 4px);
|
|
133
133
|
padding-inline: var(--space-field-horizontal-gg19kw, 12px);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
.awsui_dismiss-
|
|
136
|
+
.awsui_dismiss-button_10m3l_9o8ze_136:not(#\9) {
|
|
137
137
|
inline-size: 30px;
|
|
138
138
|
margin-block: 0;
|
|
139
139
|
margin-inline: 0;
|
|
@@ -145,14 +145,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
145
145
|
background-color: transparent;
|
|
146
146
|
border-inline-start: var(--border-field-width-09w7vk, 2px) solid var(--color-border-item-selected-k00wlz, #0972d3);
|
|
147
147
|
}
|
|
148
|
-
body[data-awsui-focus-visible=true] .awsui_dismiss-
|
|
148
|
+
body[data-awsui-focus-visible=true] .awsui_dismiss-button_10m3l_9o8ze_136:not(#\9):focus {
|
|
149
149
|
position: relative;
|
|
150
150
|
}
|
|
151
|
-
body[data-awsui-focus-visible=true] .awsui_dismiss-
|
|
151
|
+
body[data-awsui-focus-visible=true] .awsui_dismiss-button_10m3l_9o8ze_136:not(#\9):focus {
|
|
152
152
|
outline: 2px dotted transparent;
|
|
153
153
|
outline-offset: calc(var(--space-filtering-token-dismiss-button-focus-outline-gutter-76gsim, -5px) - 1px);
|
|
154
154
|
}
|
|
155
|
-
body[data-awsui-focus-visible=true] .awsui_dismiss-
|
|
155
|
+
body[data-awsui-focus-visible=true] .awsui_dismiss-button_10m3l_9o8ze_136:not(#\9):focus::before {
|
|
156
156
|
content: " ";
|
|
157
157
|
display: block;
|
|
158
158
|
position: absolute;
|
|
@@ -166,22 +166,22 @@ body[data-awsui-focus-visible=true] .awsui_dismiss-button_10m3l_lwl1e_136:not(#\
|
|
|
166
166
|
border-end-end-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
|
|
167
167
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-b2ntyl, #0972d3);
|
|
168
168
|
}
|
|
169
|
-
.awsui_dismiss-
|
|
169
|
+
.awsui_dismiss-button_10m3l_9o8ze_136:not(#\9):focus {
|
|
170
170
|
outline: none;
|
|
171
171
|
text-decoration: none;
|
|
172
172
|
}
|
|
173
|
-
.awsui_dismiss-
|
|
173
|
+
.awsui_dismiss-button_10m3l_9o8ze_136:not(#\9):hover {
|
|
174
174
|
cursor: pointer;
|
|
175
175
|
color: var(--color-text-interactive-hover-mj8add, #000716);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
.awsui_token-
|
|
178
|
+
.awsui_token-disabled_10m3l_9o8ze_178:not(#\9) {
|
|
179
179
|
border-color: var(--color-border-control-disabled-bv2kkn, #d1d5db);
|
|
180
180
|
background-color: var(--color-background-container-content-4un1ap, #ffffff);
|
|
181
181
|
color: var(--color-text-disabled-f4c52h, #9ba7b6);
|
|
182
182
|
pointer-events: none;
|
|
183
183
|
}
|
|
184
|
-
.awsui_token-
|
|
184
|
+
.awsui_token-disabled_10m3l_9o8ze_178 > .awsui_dismiss-button_10m3l_9o8ze_136:not(#\9) {
|
|
185
185
|
color: var(--color-text-interactive-disabled-z7a3t4, #9ba7b6);
|
|
186
186
|
border-color: var(--color-border-control-disabled-bv2kkn, #d1d5db);
|
|
187
187
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"token": "
|
|
7
|
-
"show-operation": "awsui_show-
|
|
8
|
-
"select": "
|
|
9
|
-
"token-content": "awsui_token-
|
|
10
|
-
"dismiss-button": "awsui_dismiss-
|
|
11
|
-
"token-disabled": "awsui_token-
|
|
5
|
+
"root": "awsui_root_10m3l_9o8ze_101",
|
|
6
|
+
"token": "awsui_token_10m3l_9o8ze_106",
|
|
7
|
+
"show-operation": "awsui_show-operation_10m3l_9o8ze_121",
|
|
8
|
+
"select": "awsui_select_10m3l_9o8ze_127",
|
|
9
|
+
"token-content": "awsui_token-content_10m3l_9o8ze_131",
|
|
10
|
+
"dismiss-button": "awsui_dismiss-button_10m3l_9o8ze_136",
|
|
11
|
+
"token-disabled": "awsui_token-disabled_10m3l_9o8ze_178"
|
|
12
12
|
};
|
|
13
13
|
|
package/internal/environment.js
CHANGED
|
@@ -9602,6 +9602,7 @@ module.exports.preset = {
|
|
|
9602
9602
|
"colorBackgroundLayoutToggleSelectedHover",
|
|
9603
9603
|
"colorBackgroundNotificationBlue",
|
|
9604
9604
|
"colorBackgroundNotificationGreen",
|
|
9605
|
+
"colorBackgroundNotificationGrey",
|
|
9605
9606
|
"colorBackgroundNotificationRed",
|
|
9606
9607
|
"colorBackgroundNotificationYellow",
|
|
9607
9608
|
"colorBackgroundPopover",
|
|
@@ -9917,6 +9918,7 @@ module.exports.preset = {
|
|
|
9917
9918
|
"colorBackgroundLayoutToggleSelectedHover",
|
|
9918
9919
|
"colorBackgroundNotificationBlue",
|
|
9919
9920
|
"colorBackgroundNotificationGreen",
|
|
9921
|
+
"colorBackgroundNotificationGrey",
|
|
9920
9922
|
"colorBackgroundNotificationRed",
|
|
9921
9923
|
"colorBackgroundNotificationYellow",
|
|
9922
9924
|
"colorBackgroundPopover",
|
|
@@ -93,6 +93,7 @@ export declare interface TypedOverride {
|
|
|
93
93
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
94
94
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
95
95
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
96
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
96
97
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
97
98
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
98
99
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -317,6 +318,7 @@ export declare interface TypedOverride {
|
|
|
317
318
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
318
319
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
319
320
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
321
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
320
322
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
321
323
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
322
324
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -541,6 +543,7 @@ export declare interface TypedOverride {
|
|
|
541
543
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
542
544
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
543
545
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
546
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
544
547
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
545
548
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
546
549
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -765,6 +768,7 @@ export declare interface TypedOverride {
|
|
|
765
768
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
766
769
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
767
770
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
771
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
768
772
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
769
773
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
770
774
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -989,6 +993,7 @@ export declare interface TypedOverride {
|
|
|
989
993
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
990
994
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
991
995
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
996
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
992
997
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
993
998
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
994
999
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -1213,6 +1218,7 @@ export declare interface TypedOverride {
|
|
|
1213
1218
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1214
1219
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1215
1220
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1221
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1216
1222
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1217
1223
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1218
1224
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -1437,6 +1443,7 @@ export declare interface TypedOverride {
|
|
|
1437
1443
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1438
1444
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1439
1445
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1446
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1440
1447
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1441
1448
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1442
1449
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -1661,6 +1668,7 @@ export declare interface TypedOverride {
|
|
|
1661
1668
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1662
1669
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1663
1670
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1671
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1664
1672
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1665
1673
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1666
1674
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -93,6 +93,7 @@ export declare interface TypedOverride {
|
|
|
93
93
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
94
94
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
95
95
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
96
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
96
97
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
97
98
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
98
99
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -317,6 +318,7 @@ export declare interface TypedOverride {
|
|
|
317
318
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
318
319
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
319
320
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
321
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
320
322
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
321
323
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
322
324
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -541,6 +543,7 @@ export declare interface TypedOverride {
|
|
|
541
543
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
542
544
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
543
545
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
546
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
544
547
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
545
548
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
546
549
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -765,6 +768,7 @@ export declare interface TypedOverride {
|
|
|
765
768
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
766
769
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
767
770
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
771
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
768
772
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
769
773
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
770
774
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -989,6 +993,7 @@ export declare interface TypedOverride {
|
|
|
989
993
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
990
994
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
991
995
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
996
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
992
997
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
993
998
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
994
999
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -1213,6 +1218,7 @@ export declare interface TypedOverride {
|
|
|
1213
1218
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1214
1219
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1215
1220
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1221
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1216
1222
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1217
1223
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1218
1224
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -1437,6 +1443,7 @@ export declare interface TypedOverride {
|
|
|
1437
1443
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1438
1444
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1439
1445
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1446
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1440
1447
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1441
1448
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1442
1449
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -1661,6 +1668,7 @@ export declare interface TypedOverride {
|
|
|
1661
1668
|
colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1662
1669
|
colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1663
1670
|
colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1671
|
+
colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1664
1672
|
colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1665
1673
|
colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
1666
1674
|
colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
|
|
@@ -9602,6 +9602,7 @@ export var preset = {
|
|
|
9602
9602
|
"colorBackgroundLayoutToggleSelectedHover",
|
|
9603
9603
|
"colorBackgroundNotificationBlue",
|
|
9604
9604
|
"colorBackgroundNotificationGreen",
|
|
9605
|
+
"colorBackgroundNotificationGrey",
|
|
9605
9606
|
"colorBackgroundNotificationRed",
|
|
9606
9607
|
"colorBackgroundNotificationYellow",
|
|
9607
9608
|
"colorBackgroundPopover",
|
|
@@ -9917,6 +9918,7 @@ export var preset = {
|
|
|
9917
9918
|
"colorBackgroundLayoutToggleSelectedHover",
|
|
9918
9919
|
"colorBackgroundNotificationBlue",
|
|
9919
9920
|
"colorBackgroundNotificationGreen",
|
|
9921
|
+
"colorBackgroundNotificationGrey",
|
|
9920
9922
|
"colorBackgroundNotificationRed",
|
|
9921
9923
|
"colorBackgroundNotificationYellow",
|
|
9922
9924
|
"colorBackgroundPopover",
|
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
package/table/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM/D,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM/D,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,QAAA,MAAM,KAAK,qBAoDa,CAAC;AAGzB,eAAe,KAAK,CAAC"}
|
package/table/index.js
CHANGED
|
@@ -21,6 +21,7 @@ const Table = React.forwardRef((_a, ref) => {
|
|
|
21
21
|
},
|
|
22
22
|
metadata: {
|
|
23
23
|
expandableRows: !!props.expandableRows,
|
|
24
|
+
progressiveLoading: !!props.getLoadingStatus,
|
|
24
25
|
inlineEdit: props.columnDefinitions.some(def => !!def.editConfig),
|
|
25
26
|
disabledInlineEdit: props.columnDefinitions.some(def => { var _a; return !!((_a = def.editConfig) === null || _a === void 0 ? void 0 : _a.disabledReason); }),
|
|
26
27
|
},
|
package/table/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,aAAa,EAAE,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAG3F,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CACE,EAOgB,EAChB,GAA8B,EAC9B,EAAE;QATF,EACE,KAAK,GAAG,EAAE,EACV,aAAa,GAAG,EAAE,EAClB,OAAO,GAAG,WAAW,EACrB,c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inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { TableForwardRefType, TableProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalTable, { InternalTableAsSubstep } from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\n\nexport { TableProps };\nconst Table = React.forwardRef(\n <T,>(\n {\n items = [],\n selectedItems = [],\n variant = 'container',\n contentDensity = 'comfortable',\n firstIndex = 1,\n ...props\n }: TableProps<T>,\n ref: React.Ref<TableProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Table', {\n props: {\n contentDensity,\n resizableColumns: props.resizableColumns,\n selectionType: props.selectionType,\n stickyHeader: props.stickyHeader,\n stripedRows: props.stripedRows,\n variant,\n wrapLines: props.wrapLines,\n enableKeyboardNavigation: props.enableKeyboardNavigation,\n },\n metadata: {\n expandableRows: !!props.expandableRows,\n inlineEdit: props.columnDefinitions.some(def => !!def.editConfig),\n disabledInlineEdit: props.columnDefinitions.some(def => !!def.editConfig?.disabledReason),\n },\n });\n\n const tableProps: Parameters<typeof InternalTable<T>>[0] = {\n items,\n selectedItems,\n variant,\n contentDensity,\n firstIndex,\n ...props,\n ...baseComponentProps,\n ref,\n };\n\n if (variant === 'borderless' || variant === 'embedded') {\n return <InternalTable {...tableProps} />;\n }\n\n return (\n <AnalyticsFunnelSubStep>\n <InternalTableAsSubstep {...tableProps} />\n </AnalyticsFunnelSubStep>\n );\n }\n) as TableForwardRefType;\n\napplyDisplayName(Table, 'Table');\nexport default Table;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,aAAa,EA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B,KACrB,GAAG,GACJ,CAAC;IAEF,IAAI,OAAO,KAAK,YAAY,IAAI,OAAO,KAAK,UAAU,EAAE;QACtD,OAAO,oBAAC,aAAa,oBAAK,UAAU,EAAI,CAAC;KAC1C;IAED,OAAO,CACL,oBAAC,sBAAsB;QACrB,oBAAC,sBAAsB,oBAAK,UAAU,EAAI,CACnB,CAC1B,CAAC;AACJ,CAAC,CACqB,CAAC;AAEzB,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjC,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { TableForwardRefType, TableProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalTable, { InternalTableAsSubstep } from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\n\nexport { TableProps };\nconst Table = React.forwardRef(\n <T,>(\n {\n items = [],\n selectedItems = [],\n variant = 'container',\n contentDensity = 'comfortable',\n firstIndex = 1,\n ...props\n }: TableProps<T>,\n ref: React.Ref<TableProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Table', {\n props: {\n contentDensity,\n resizableColumns: props.resizableColumns,\n selectionType: props.selectionType,\n stickyHeader: props.stickyHeader,\n stripedRows: props.stripedRows,\n variant,\n wrapLines: props.wrapLines,\n enableKeyboardNavigation: props.enableKeyboardNavigation,\n },\n metadata: {\n expandableRows: !!props.expandableRows,\n progressiveLoading: !!props.getLoadingStatus,\n inlineEdit: props.columnDefinitions.some(def => !!def.editConfig),\n disabledInlineEdit: props.columnDefinitions.some(def => !!def.editConfig?.disabledReason),\n },\n });\n\n const tableProps: Parameters<typeof InternalTable<T>>[0] = {\n items,\n selectedItems,\n variant,\n contentDensity,\n firstIndex,\n ...props,\n ...baseComponentProps,\n ref,\n };\n\n if (variant === 'borderless' || variant === 'embedded') {\n return <InternalTable {...tableProps} />;\n }\n\n return (\n <AnalyticsFunnelSubStep>\n <InternalTableAsSubstep {...tableProps} />\n </AnalyticsFunnelSubStep>\n );\n }\n) as TableForwardRefType;\n\napplyDisplayName(Table, 'Table');\nexport default Table;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/top-navigation/internal.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/top-navigation/internal.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD,MAAM,MAAM,0BAA0B,GAAG,YAAY,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,0BAA0B,CAAC;AAEpH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACN,GAAG,SAAS,EACb,EAAE,0BAA0B,eAyO5B"}
|
|
@@ -15,6 +15,7 @@ import styles from './styles.css.js';
|
|
|
15
15
|
import { checkSafeUrl } from '../internal/utils/check-safe-url';
|
|
16
16
|
import { useInternalI18n } from '../i18n/context';
|
|
17
17
|
import { isDevelopment, warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
18
|
+
import { hasCheckboxItems } from '../button-dropdown/utils/utils';
|
|
18
19
|
export default function InternalTopNavigation(_a) {
|
|
19
20
|
var { __internalRootRef, identity, i18nStrings, utilities, search } = _a, restProps = __rest(_a, ["__internalRootRef", "identity", "i18nStrings", "utilities", "search"]);
|
|
20
21
|
checkSafeUrl('TopNavigation', identity.href);
|
|
@@ -29,8 +30,8 @@ export default function InternalTopNavigation(_a) {
|
|
|
29
30
|
// ButtonDropdown supports checkbox items but we don't support these in TopNavigation. Shown an error in development mode
|
|
30
31
|
// to alert users of this and that it might change in the future.
|
|
31
32
|
if (isDevelopment) {
|
|
32
|
-
if (utilities.some(item => item.type === 'menu-dropdown' && item.items
|
|
33
|
-
warnOnce('TopNavigation', 'The TopNavigation component does not support menu-dropdown items with `itemType` equal to `checkbox
|
|
33
|
+
if (utilities.some(item => item.type === 'menu-dropdown' && hasCheckboxItems(item.items))) {
|
|
34
|
+
warnOnce('TopNavigation', 'The TopNavigation component does not support menu-dropdown items with `itemType` equal to `checkbox`.');
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
const onIdentityClick = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/top-navigation/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE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AAC,CACpE,CACZ,CACP,CACG,CACF,CACE,CACX,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,6CAAS,SAAS,IAAE,GAAG,EAAE,iBAAiB;QACxC,oBAAC,aAAa,IAAC,WAAW,EAAC,gBAAgB;YAExC,OAAO,CAAC,IAAI,CAAC;YAEb,OAAO,CAAC,KAAK,CAAC;YAEd,kBAAkB,IAAI,gBAAgB,IAAI,CACzC,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;gBAC5C,oBAAC,YAAY,IACX,UAAU,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,EAC9C,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gCAAgC,EACnE,iBAAiB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,6BAA6B,EAC7D,KAAK,EAAE,SAAS,CAAC,MAAM,CACrB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,eAAe,CAAC,aAAa,IAAI,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;wBACnF,CAAC,OAAO,CAAC,sBAAsB,CAClC,EACD,OAAO,EAAE,kBAAkB,GAC3B,CACE,CACP,CACa,CACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport VisualContext from '../internal/components/visual-context';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\n\nimport { TopNavigationProps } from './interfaces';\nimport { useTopNavigation } from './use-top-navigation.js';\nimport Utility from './parts/utility';\nimport OverflowMenu from './parts/overflow-menu';\nimport { ButtonTrigger } from '../internal/components/menu-dropdown';\n\nimport styles from './styles.css.js';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { SomeRequired } from '../internal/types';\nimport { useInternalI18n } from '../i18n/context';\nimport { isDevelopment, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport type InternalTopNavigationProps = SomeRequired<TopNavigationProps, 'utilities'> & InternalBaseComponentProps;\n\nexport default function InternalTopNavigation({\n __internalRootRef,\n identity,\n i18nStrings,\n utilities,\n search,\n ...restProps\n}: InternalTopNavigationProps) {\n checkSafeUrl('TopNavigation', identity.href);\n const baseProps = getBaseProps(restProps);\n const { mainRef, virtualRef, breakpoint, responsiveState, isSearchExpanded, onSearchUtilityClick } = useTopNavigation(\n { identity, search, utilities }\n );\n const [overflowMenuOpen, setOverflowMenuOpen] = useState(false);\n const overflowMenuTriggerRef = useRef<HTMLButtonElement>(null);\n const isNarrowViewport = breakpoint === 'default';\n const isMediumViewport = breakpoint === 'xxs';\n const isLargeViewport = breakpoint === 's';\n const i18n = useInternalI18n('top-navigation');\n\n // ButtonDropdown supports checkbox items but we don't support these in TopNavigation. Shown an error in development mode\n // to alert users of this and that it might change in the future.\n if (isDevelopment) {\n if (\n utilities.some(item => item.type === 'menu-dropdown' && item.items.some(item => item.itemType === 'checkbox'))\n ) {\n warnOnce(\n 'TopNavigation',\n 'The TopNavigation component does not support menu-dropdown items with `itemType` equal to `checkbox`, this might change in the future.'\n );\n }\n }\n\n const onIdentityClick = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireCancelableEvent(identity.onFollow, {}, event);\n }\n };\n\n const toggleOverflowMenu = () => {\n setOverflowMenuOpen(overflowMenuOpen => !overflowMenuOpen);\n };\n\n const menuTriggerVisible = !isSearchExpanded && responsiveState.hideUtilities;\n\n useEffect(() => {\n setOverflowMenuOpen(false);\n }, [menuTriggerVisible]);\n\n useEffectOnUpdate(() => {\n if (!overflowMenuOpen) {\n overflowMenuTriggerRef.current?.focus();\n }\n }, [overflowMenuOpen]);\n\n // Render the top nav twice; once as the top nav that users can see, and another\n // \"virtual\" top nav used just for calculations. The virtual top nav doesn't react to\n // layout changes and renders two sets of utilities: one with labels and one without.\n const content = (isVirtual: boolean) => {\n const Wrapper = isVirtual ? 'div' : 'header';\n const showIdentity = isVirtual || !isSearchExpanded;\n const showTitle = isVirtual || !responsiveState.hideTitle;\n const showSearchSlot = search && (isVirtual || !responsiveState.hideSearch || isSearchExpanded);\n const showSearchUtility = isVirtual || (search && responsiveState.hideSearch);\n const showUtilities = isVirtual || !isSearchExpanded;\n const showMenuTrigger = isVirtual || menuTriggerVisible;\n\n return (\n <Wrapper\n ref={isVirtual ? virtualRef : mainRef}\n aria-hidden={isVirtual ? true : undefined}\n // Wrapper is an alias for \"div\" or \"header\".\n // eslint-disable-next-line react/forbid-component-props\n className={clsx(styles['top-navigation'], {\n [styles.virtual]: isVirtual,\n [styles.hidden]: isVirtual,\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n })}\n >\n <div className={styles['padding-box']}>\n {showIdentity && (\n <div className={clsx(styles.identity, !identity.logo && styles['no-logo'])}>\n <a className={styles['identity-link']} href={identity.href} onClick={onIdentityClick}>\n {identity.logo && (\n <img\n role=\"img\"\n src={identity.logo?.src}\n alt={identity.logo?.alt}\n className={clsx(styles.logo, {\n [styles.narrow]: isNarrowViewport,\n })}\n />\n )}\n {showTitle && <span className={styles.title}>{identity.title}</span>}\n </a>\n </div>\n )}\n\n {showSearchSlot && (\n <div className={styles.inputs}>\n <div className={clsx(styles.search, !isVirtual && isSearchExpanded && styles['search-expanded'])}>\n {search}\n </div>\n </div>\n )}\n\n <div className={styles.utilities}>\n {showSearchUtility && (\n <div\n className={clsx(\n styles['utility-wrapper'],\n styles['utility-type-button'],\n styles['utility-type-button-link'],\n {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n }\n )}\n data-utility-special=\"search\"\n >\n <Utility\n hideText={true}\n definition={{\n type: 'button',\n iconName: isSearchExpanded ? 'close' : 'search',\n ariaLabel: isSearchExpanded\n ? i18n('i18nStrings.searchDismissIconAriaLabel', i18nStrings?.searchDismissIconAriaLabel)\n : i18n('i18nStrings.searchIconAriaLabel', i18nStrings?.searchIconAriaLabel),\n onClick: onSearchUtilityClick,\n }}\n />\n </div>\n )}\n\n {showUtilities &&\n utilities\n .filter(\n (_utility, i) =>\n isVirtual || !responsiveState.hideUtilities || responsiveState.hideUtilities.indexOf(i) === -1\n )\n .map((utility, i) => {\n const hideText = !!responsiveState.hideUtilityText;\n const isLast = (isVirtual || !showMenuTrigger) && i === utilities.length - 1;\n const offsetRight = isLast && isLargeViewport ? 'xxl' : isLast ? 'l' : undefined;\n\n return (\n <div\n key={i}\n className={clsx(\n styles['utility-wrapper'],\n styles[`utility-type-${utility.type}`],\n utility.type === 'button' && styles[`utility-type-button-${utility.variant ?? 'link'}`],\n {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n }\n )}\n data-utility-index={i}\n data-utility-hide={`${hideText}`}\n >\n <Utility hideText={hideText} definition={utility} offsetRight={offsetRight} />\n </div>\n );\n })}\n\n {isVirtual &&\n utilities.map((utility, i) => {\n const hideText = !responsiveState.hideUtilityText;\n const isLast = !showMenuTrigger && i === utilities.length - 1;\n const offsetRight = isLast && isLargeViewport ? 'xxl' : isLast ? 'l' : undefined;\n\n return (\n <div\n key={i}\n className={clsx(\n styles['utility-wrapper'],\n styles[`utility-type-${utility.type}`],\n utility.type === 'button' && styles[`utility-type-button-${utility.variant ?? 'link'}`],\n {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n }\n )}\n data-utility-index={i}\n data-utility-hide={`${hideText}`}\n >\n <Utility hideText={hideText} definition={utility} offsetRight={offsetRight} />\n </div>\n );\n })}\n\n {showMenuTrigger && (\n <div\n className={clsx(styles['utility-wrapper'], styles['utility-type-menu-dropdown'], {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n })}\n data-utility-special=\"menu-trigger\"\n >\n <ButtonTrigger\n expanded={overflowMenuOpen}\n onClick={toggleOverflowMenu}\n offsetRight=\"l\"\n ref={!isVirtual ? overflowMenuTriggerRef : undefined}\n >\n {i18n('i18nStrings.overflowMenuTriggerText', i18nStrings?.overflowMenuTriggerText)}\n </ButtonTrigger>\n </div>\n )}\n </div>\n </div>\n </Wrapper>\n );\n };\n\n return (\n <div {...baseProps} ref={__internalRootRef}>\n <VisualContext contextName=\"top-navigation\">\n {/* Render virtual content first to ensure React refs for content will be assigned on the actual nodes. */}\n {content(true)}\n\n {content(false)}\n\n {menuTriggerVisible && overflowMenuOpen && (\n <div className={styles['overflow-menu-drawer']}>\n <OverflowMenu\n headerText={i18nStrings?.overflowMenuTitleText}\n dismissIconAriaLabel={i18nStrings?.overflowMenuDismissIconAriaLabel}\n backIconAriaLabel={i18nStrings?.overflowMenuBackIconAriaLabel}\n items={utilities.filter(\n (utility, i) =>\n (!responsiveState.hideUtilities || responsiveState.hideUtilities.indexOf(i) !== -1) &&\n !utility.disableUtilityCollapse\n )}\n onClose={toggleOverflowMenu}\n />\n </div>\n )}\n </VisualContext>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/top-navigation/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAA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G,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,IAEnD,IAAI,CAAC,qCAAqC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uBAAuB,CAAC,CACpE,CACZ,CACP,CACG,CACF,CACE,CACX,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,6CAAS,SAAS,IAAE,GAAG,EAAE,iBAAiB;QACxC,oBAAC,aAAa,IAAC,WAAW,EAAC,gBAAgB;YAExC,OAAO,CAAC,IAAI,CAAC;YAEb,OAAO,CAAC,KAAK,CAAC;YAEd,kBAAkB,IAAI,gBAAgB,IAAI,CACzC,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;gBAC5C,oBAAC,YAAY,IACX,UAAU,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,EAC9C,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gCAAgC,EACnE,iBAAiB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,6BAA6B,EAC7D,KAAK,EAAE,SAAS,CAAC,MAAM,CACrB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,eAAe,CAAC,aAAa,IAAI,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;wBACnF,CAAC,OAAO,CAAC,sBAAsB,CAClC,EACD,OAAO,EAAE,kBAAkB,GAC3B,CACE,CACP,CACa,CACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport VisualContext from '../internal/components/visual-context';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\n\nimport { TopNavigationProps } from './interfaces';\nimport { useTopNavigation } from './use-top-navigation.js';\nimport Utility from './parts/utility';\nimport OverflowMenu from './parts/overflow-menu';\nimport { ButtonTrigger } from '../internal/components/menu-dropdown';\n\nimport styles from './styles.css.js';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { SomeRequired } from '../internal/types';\nimport { useInternalI18n } from '../i18n/context';\nimport { isDevelopment, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { hasCheckboxItems } from '../button-dropdown/utils/utils';\n\nexport type InternalTopNavigationProps = SomeRequired<TopNavigationProps, 'utilities'> & InternalBaseComponentProps;\n\nexport default function InternalTopNavigation({\n __internalRootRef,\n identity,\n i18nStrings,\n utilities,\n search,\n ...restProps\n}: InternalTopNavigationProps) {\n checkSafeUrl('TopNavigation', identity.href);\n const baseProps = getBaseProps(restProps);\n const { mainRef, virtualRef, breakpoint, responsiveState, isSearchExpanded, onSearchUtilityClick } = useTopNavigation(\n { identity, search, utilities }\n );\n const [overflowMenuOpen, setOverflowMenuOpen] = useState(false);\n const overflowMenuTriggerRef = useRef<HTMLButtonElement>(null);\n const isNarrowViewport = breakpoint === 'default';\n const isMediumViewport = breakpoint === 'xxs';\n const isLargeViewport = breakpoint === 's';\n const i18n = useInternalI18n('top-navigation');\n\n // ButtonDropdown supports checkbox items but we don't support these in TopNavigation. Shown an error in development mode\n // to alert users of this and that it might change in the future.\n if (isDevelopment) {\n if (utilities.some(item => item.type === 'menu-dropdown' && hasCheckboxItems(item.items))) {\n warnOnce(\n 'TopNavigation',\n 'The TopNavigation component does not support menu-dropdown items with `itemType` equal to `checkbox`.'\n );\n }\n }\n\n const onIdentityClick = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireCancelableEvent(identity.onFollow, {}, event);\n }\n };\n\n const toggleOverflowMenu = () => {\n setOverflowMenuOpen(overflowMenuOpen => !overflowMenuOpen);\n };\n\n const menuTriggerVisible = !isSearchExpanded && responsiveState.hideUtilities;\n\n useEffect(() => {\n setOverflowMenuOpen(false);\n }, [menuTriggerVisible]);\n\n useEffectOnUpdate(() => {\n if (!overflowMenuOpen) {\n overflowMenuTriggerRef.current?.focus();\n }\n }, [overflowMenuOpen]);\n\n // Render the top nav twice; once as the top nav that users can see, and another\n // \"virtual\" top nav used just for calculations. The virtual top nav doesn't react to\n // layout changes and renders two sets of utilities: one with labels and one without.\n const content = (isVirtual: boolean) => {\n const Wrapper = isVirtual ? 'div' : 'header';\n const showIdentity = isVirtual || !isSearchExpanded;\n const showTitle = isVirtual || !responsiveState.hideTitle;\n const showSearchSlot = search && (isVirtual || !responsiveState.hideSearch || isSearchExpanded);\n const showSearchUtility = isVirtual || (search && responsiveState.hideSearch);\n const showUtilities = isVirtual || !isSearchExpanded;\n const showMenuTrigger = isVirtual || menuTriggerVisible;\n\n return (\n <Wrapper\n ref={isVirtual ? virtualRef : mainRef}\n aria-hidden={isVirtual ? true : undefined}\n // Wrapper is an alias for \"div\" or \"header\".\n // eslint-disable-next-line react/forbid-component-props\n className={clsx(styles['top-navigation'], {\n [styles.virtual]: isVirtual,\n [styles.hidden]: isVirtual,\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n })}\n >\n <div className={styles['padding-box']}>\n {showIdentity && (\n <div className={clsx(styles.identity, !identity.logo && styles['no-logo'])}>\n <a className={styles['identity-link']} href={identity.href} onClick={onIdentityClick}>\n {identity.logo && (\n <img\n role=\"img\"\n src={identity.logo?.src}\n alt={identity.logo?.alt}\n className={clsx(styles.logo, {\n [styles.narrow]: isNarrowViewport,\n })}\n />\n )}\n {showTitle && <span className={styles.title}>{identity.title}</span>}\n </a>\n </div>\n )}\n\n {showSearchSlot && (\n <div className={styles.inputs}>\n <div className={clsx(styles.search, !isVirtual && isSearchExpanded && styles['search-expanded'])}>\n {search}\n </div>\n </div>\n )}\n\n <div className={styles.utilities}>\n {showSearchUtility && (\n <div\n className={clsx(\n styles['utility-wrapper'],\n styles['utility-type-button'],\n styles['utility-type-button-link'],\n {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n }\n )}\n data-utility-special=\"search\"\n >\n <Utility\n hideText={true}\n definition={{\n type: 'button',\n iconName: isSearchExpanded ? 'close' : 'search',\n ariaLabel: isSearchExpanded\n ? i18n('i18nStrings.searchDismissIconAriaLabel', i18nStrings?.searchDismissIconAriaLabel)\n : i18n('i18nStrings.searchIconAriaLabel', i18nStrings?.searchIconAriaLabel),\n onClick: onSearchUtilityClick,\n }}\n />\n </div>\n )}\n\n {showUtilities &&\n utilities\n .filter(\n (_utility, i) =>\n isVirtual || !responsiveState.hideUtilities || responsiveState.hideUtilities.indexOf(i) === -1\n )\n .map((utility, i) => {\n const hideText = !!responsiveState.hideUtilityText;\n const isLast = (isVirtual || !showMenuTrigger) && i === utilities.length - 1;\n const offsetRight = isLast && isLargeViewport ? 'xxl' : isLast ? 'l' : undefined;\n\n return (\n <div\n key={i}\n className={clsx(\n styles['utility-wrapper'],\n styles[`utility-type-${utility.type}`],\n utility.type === 'button' && styles[`utility-type-button-${utility.variant ?? 'link'}`],\n {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n }\n )}\n data-utility-index={i}\n data-utility-hide={`${hideText}`}\n >\n <Utility hideText={hideText} definition={utility} offsetRight={offsetRight} />\n </div>\n );\n })}\n\n {isVirtual &&\n utilities.map((utility, i) => {\n const hideText = !responsiveState.hideUtilityText;\n const isLast = !showMenuTrigger && i === utilities.length - 1;\n const offsetRight = isLast && isLargeViewport ? 'xxl' : isLast ? 'l' : undefined;\n\n return (\n <div\n key={i}\n className={clsx(\n styles['utility-wrapper'],\n styles[`utility-type-${utility.type}`],\n utility.type === 'button' && styles[`utility-type-button-${utility.variant ?? 'link'}`],\n {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n }\n )}\n data-utility-index={i}\n data-utility-hide={`${hideText}`}\n >\n <Utility hideText={hideText} definition={utility} offsetRight={offsetRight} />\n </div>\n );\n })}\n\n {showMenuTrigger && (\n <div\n className={clsx(styles['utility-wrapper'], styles['utility-type-menu-dropdown'], {\n [styles.narrow]: isNarrowViewport,\n [styles.medium]: isMediumViewport,\n })}\n data-utility-special=\"menu-trigger\"\n >\n <ButtonTrigger\n expanded={overflowMenuOpen}\n onClick={toggleOverflowMenu}\n offsetRight=\"l\"\n ref={!isVirtual ? overflowMenuTriggerRef : undefined}\n >\n {i18n('i18nStrings.overflowMenuTriggerText', i18nStrings?.overflowMenuTriggerText)}\n </ButtonTrigger>\n </div>\n )}\n </div>\n </div>\n </Wrapper>\n );\n };\n\n return (\n <div {...baseProps} ref={__internalRootRef}>\n <VisualContext contextName=\"top-navigation\">\n {/* Render virtual content first to ensure React refs for content will be assigned on the actual nodes. */}\n {content(true)}\n\n {content(false)}\n\n {menuTriggerVisible && overflowMenuOpen && (\n <div className={styles['overflow-menu-drawer']}>\n <OverflowMenu\n headerText={i18nStrings?.overflowMenuTitleText}\n dismissIconAriaLabel={i18nStrings?.overflowMenuDismissIconAriaLabel}\n backIconAriaLabel={i18nStrings?.overflowMenuBackIconAriaLabel}\n items={utilities.filter(\n (utility, i) =>\n (!responsiveState.hideUtilities || responsiveState.hideUtilities.indexOf(i) !== -1) &&\n !utility.disableUtilityCollapse\n )}\n onClose={toggleOverflowMenu}\n />\n </div>\n )}\n </VisualContext>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../src/top-navigation/parts/utility.tsx"],"names":[],"mappings":";AAQA,OAAqB,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAQnD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC;IACvC,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../src/top-navigation/parts/utility.tsx"],"names":[],"mappings":";AAQA,OAAqB,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAQnD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC;IACvC,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,YAAY,sBA2GlF"}
|
|
@@ -44,8 +44,9 @@ export default function Utility({ hideText, definition, offsetRight }) {
|
|
|
44
44
|
else if (definition.type === 'menu-dropdown') {
|
|
45
45
|
const title = definition.title || definition.text;
|
|
46
46
|
const shouldShowTitle = shouldHideText || !definition.text;
|
|
47
|
+
const items = excludeCheckboxes(definition.items);
|
|
47
48
|
checkSafeUrlRecursively(definition.items);
|
|
48
|
-
return (React.createElement(MenuDropdown, Object.assign({}, definition, { title: shouldShowTitle ? title : '', ariaLabel: ariaLabel, offsetRight: offsetRight }), !shouldHideText && definition.text));
|
|
49
|
+
return (React.createElement(MenuDropdown, Object.assign({}, definition, { items: items, title: shouldShowTitle ? title : '', ariaLabel: ariaLabel, offsetRight: offsetRight }), !shouldHideText && definition.text));
|
|
49
50
|
}
|
|
50
51
|
return null;
|
|
51
52
|
}
|
|
@@ -59,4 +60,17 @@ function checkSafeUrlRecursively(itemOrGroup) {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
function excludeCheckboxes(items) {
|
|
64
|
+
return items
|
|
65
|
+
.map(item => {
|
|
66
|
+
if (item.itemType === 'checkbox') {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
if ('items' in item) {
|
|
70
|
+
return Object.assign(Object.assign({}, item), { items: excludeCheckboxes(item.items) });
|
|
71
|
+
}
|
|
72
|
+
return item;
|
|
73
|
+
})
|
|
74
|
+
.filter(item => item !== null);
|
|
75
|
+
}
|
|
62
76
|
//# sourceMappingURL=utility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.js","sourceRoot":"","sources":["../../../../src/top-navigation/parts/utility.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,YAAmC,MAAM,yCAAyC,CAAC;AAI1F,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAQ/D,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAgB;;IACjF,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,CAAC,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;IA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AM,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,SAAS,IAAG,UAAU,CAAC,IAAI,CAAQ,CAC7F,CACY,CACV,CACR,CAAC;SACH;KACF;SAAM,IAAI,UAAU,CAAC,IAAI,KAAK,eAAe,EAAE;QAC9C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC;QAClD,MAAM,eAAe,GAAG,cAAc,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAE3D,uBAAuB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAE1C,OAAO,CACL,oBAAC,YAAY,oBACP,UAAU,IACd,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EACnC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,KAEvB,CAAC,cAAc,IAAI,UAAU,CAAC,IAAI,CACtB,CAChB,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,uBAAuB,CAAC,WAAuC;IACtE,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,YAAY,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;SAC1C;QAED,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;KACF;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../button/internal';\nimport InternalLink from '../../link/internal';\nimport InternalIcon from '../../icon/internal';\nimport MenuDropdown, { MenuDropdownProps } from '../../internal/components/menu-dropdown';\n\nimport { TopNavigationProps } from '../interfaces';\n\nimport styles from '../styles.css.js';\nimport { checkSafeUrl } from '../../internal/utils/check-safe-url';\nimport { joinStrings } from '../../internal/utils/strings';\nimport { fireCancelableEvent } from '../../internal/events';\nimport { isLinkItem } from '../../button-dropdown/utils/utils';\n\nexport interface UtilityProps {\n hideText: boolean;\n definition: TopNavigationProps.Utility;\n offsetRight?: MenuDropdownProps['offsetRight'];\n}\n\nexport default function Utility({ hideText, definition, offsetRight }: UtilityProps) {\n const hasIcon = !!definition.iconName || !!definition.iconUrl || !!definition.iconAlt || !!definition.iconSvg;\n const shouldHideText = hideText && !definition.disableTextCollapse && hasIcon;\n let ariaLabel = definition.ariaLabel ?? definition.text;\n\n if (definition.type === 'button') {\n ariaLabel = definition.ariaLabel\n ? definition.ariaLabel\n : joinStrings(definition.text, definition.externalIconAriaLabel);\n checkSafeUrl('TopNavigation', definition.href);\n if (definition.variant === 'primary-button') {\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalButton\n variant=\"primary\"\n href={definition.href}\n target={definition.external ? '_blank' : undefined}\n onClick={definition.onClick}\n onFollow={definition.onFollow}\n ariaLabel={ariaLabel}\n iconName={definition.iconName}\n iconUrl={definition.iconUrl}\n iconAlt={definition.iconAlt}\n iconSvg={definition.iconSvg}\n >\n {shouldHideText ? null : (\n <>\n {definition.text}\n {definition.external && (\n <>\n {' '}\n <span\n className={clsx(styles['utility-button-external-icon'], styles[`offset-right-${offsetRight}`])}\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" />\n </span>\n </>\n )}\n </>\n )}\n </InternalButton>\n </span>\n );\n } else {\n // Link\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalLink\n variant=\"top-navigation\"\n href={definition.href}\n target={definition.target}\n rel={definition.rel}\n external={definition.external}\n onFollow={evt => {\n fireCancelableEvent(\n definition.onFollow,\n { href: definition.href, target: definition.target, external: definition.external },\n evt\n );\n fireCancelableEvent(\n definition.onClick,\n { href: definition.href, target: definition.target, external: definition.external },\n evt\n );\n }}\n ariaLabel={ariaLabel}\n >\n {hasIcon && (\n <InternalIcon\n name={definition.iconName}\n url={definition.iconUrl}\n alt={definition.iconAlt}\n svg={definition.iconSvg}\n badge={definition.badge}\n />\n )}\n {!shouldHideText && definition.text && (\n <span className={hasIcon ? styles['utility-link-icon'] : undefined}>{definition.text}</span>\n )}\n </InternalLink>\n </span>\n );\n }\n } else if (definition.type === 'menu-dropdown') {\n const title = definition.title || definition.text;\n const shouldShowTitle = shouldHideText || !definition.text;\n\n checkSafeUrlRecursively(definition.items);\n\n return (\n <MenuDropdown\n {...definition}\n title={shouldShowTitle ? title : ''}\n ariaLabel={ariaLabel}\n offsetRight={offsetRight}\n >\n {!shouldHideText && definition.text}\n </MenuDropdown>\n );\n }\n\n return null;\n}\n\nfunction checkSafeUrlRecursively(itemOrGroup: MenuDropdownProps['items']) {\n for (const item of itemOrGroup) {\n if (isLinkItem(item)) {\n checkSafeUrl('TopNavigation', item.href);\n }\n\n if ('items' in item) {\n checkSafeUrlRecursively(item.items);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utility.js","sourceRoot":"","sources":["../../../../src/top-navigation/parts/utility.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,YAAmC,MAAM,yCAAyC,CAAC;AAI1F,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OA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AC;SAC1C;QAED,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;KACF;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAiC;IAC1D,OAAO,KAAK;SACT,GAAG,CAAC,IAAI,CAAC,EAAE;QACV,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE;YAChC,OAAO,IAAI,CAAC;SACb;QACD,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,uCACK,IAAI,KACP,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IACpC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAA+B,CAAC;AACjE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../button/internal';\nimport InternalLink from '../../link/internal';\nimport InternalIcon from '../../icon/internal';\nimport MenuDropdown, { MenuDropdownProps } from '../../internal/components/menu-dropdown';\n\nimport { TopNavigationProps } from '../interfaces';\n\nimport styles from '../styles.css.js';\nimport { checkSafeUrl } from '../../internal/utils/check-safe-url';\nimport { joinStrings } from '../../internal/utils/strings';\nimport { fireCancelableEvent } from '../../internal/events';\nimport { isLinkItem } from '../../button-dropdown/utils/utils';\n\nexport interface UtilityProps {\n hideText: boolean;\n definition: TopNavigationProps.Utility;\n offsetRight?: MenuDropdownProps['offsetRight'];\n}\n\nexport default function Utility({ hideText, definition, offsetRight }: UtilityProps) {\n const hasIcon = !!definition.iconName || !!definition.iconUrl || !!definition.iconAlt || !!definition.iconSvg;\n const shouldHideText = hideText && !definition.disableTextCollapse && hasIcon;\n let ariaLabel = definition.ariaLabel ?? definition.text;\n\n if (definition.type === 'button') {\n ariaLabel = definition.ariaLabel\n ? definition.ariaLabel\n : joinStrings(definition.text, definition.externalIconAriaLabel);\n checkSafeUrl('TopNavigation', definition.href);\n if (definition.variant === 'primary-button') {\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalButton\n variant=\"primary\"\n href={definition.href}\n target={definition.external ? '_blank' : undefined}\n onClick={definition.onClick}\n onFollow={definition.onFollow}\n ariaLabel={ariaLabel}\n iconName={definition.iconName}\n iconUrl={definition.iconUrl}\n iconAlt={definition.iconAlt}\n iconSvg={definition.iconSvg}\n >\n {shouldHideText ? null : (\n <>\n {definition.text}\n {definition.external && (\n <>\n {' '}\n <span\n className={clsx(styles['utility-button-external-icon'], styles[`offset-right-${offsetRight}`])}\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" />\n </span>\n </>\n )}\n </>\n )}\n </InternalButton>\n </span>\n );\n } else {\n // Link\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalLink\n variant=\"top-navigation\"\n href={definition.href}\n target={definition.target}\n rel={definition.rel}\n external={definition.external}\n onFollow={evt => {\n fireCancelableEvent(\n definition.onFollow,\n { href: definition.href, target: definition.target, external: definition.external },\n evt\n );\n fireCancelableEvent(\n definition.onClick,\n { href: definition.href, target: definition.target, external: definition.external },\n evt\n );\n }}\n ariaLabel={ariaLabel}\n >\n {hasIcon && (\n <InternalIcon\n name={definition.iconName}\n url={definition.iconUrl}\n alt={definition.iconAlt}\n svg={definition.iconSvg}\n badge={definition.badge}\n />\n )}\n {!shouldHideText && definition.text && (\n <span className={hasIcon ? styles['utility-link-icon'] : undefined}>{definition.text}</span>\n )}\n </InternalLink>\n </span>\n );\n }\n } else if (definition.type === 'menu-dropdown') {\n const title = definition.title || definition.text;\n const shouldShowTitle = shouldHideText || !definition.text;\n\n const items = excludeCheckboxes(definition.items);\n\n checkSafeUrlRecursively(definition.items);\n\n return (\n <MenuDropdown\n {...definition}\n items={items}\n title={shouldShowTitle ? title : ''}\n ariaLabel={ariaLabel}\n offsetRight={offsetRight}\n >\n {!shouldHideText && definition.text}\n </MenuDropdown>\n );\n }\n\n return null;\n}\n\nfunction checkSafeUrlRecursively(itemOrGroup: MenuDropdownProps['items']) {\n for (const item of itemOrGroup) {\n if (isLinkItem(item)) {\n checkSafeUrl('TopNavigation', item.href);\n }\n\n if ('items' in item) {\n checkSafeUrlRecursively(item.items);\n }\n }\n}\n\nfunction excludeCheckboxes(items: MenuDropdownProps['items']): MenuDropdownProps['items'] {\n return items\n .map(item => {\n if (item.itemType === 'checkbox') {\n return null;\n }\n if ('items' in item) {\n return {\n ...item,\n items: excludeCheckboxes(item.items),\n };\n }\n return item;\n })\n .filter(item => item !== null) as MenuDropdownProps['items'];\n}\n"]}
|