@cloudscape-design/components 3.0.1071 → 3.0.1073
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/alert/interfaces.d.ts +0 -16
- package/alert/interfaces.d.ts.map +1 -1
- package/alert/interfaces.js.map +1 -1
- package/alert/styles.css.js +27 -27
- package/alert/styles.scoped.css +46 -46
- package/alert/styles.selectors.js +27 -27
- package/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +32 -32
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/app-layout/notifications/styles.css.js +3 -3
- package/app-layout/notifications/styles.scoped.css +7 -7
- package/app-layout/notifications/styles.selectors.js +3 -3
- package/app-layout/visual-refresh/styles.css.js +86 -86
- package/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -17
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +39 -39
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -17
- package/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +23 -23
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +46 -46
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +23 -23
- package/attribute-editor/styles.css.js +15 -15
- package/attribute-editor/styles.scoped.css +28 -28
- package/attribute-editor/styles.selectors.js +15 -15
- package/badge/interfaces.d.ts +0 -9
- package/badge/interfaces.d.ts.map +1 -1
- package/badge/interfaces.js.map +1 -1
- package/breadcrumb-group/item/styles.css.js +7 -7
- package/breadcrumb-group/item/styles.scoped.css +28 -28
- package/breadcrumb-group/item/styles.selectors.js +7 -7
- package/button/interfaces.d.ts +6 -12
- package/button/interfaces.d.ts.map +1 -1
- package/button/interfaces.js.map +1 -1
- package/button/style.d.ts.map +1 -1
- package/button/style.js +17 -12
- package/button/style.js.map +1 -1
- package/button/styles.css.js +22 -22
- package/button/styles.scoped.css +256 -212
- package/button/styles.selectors.js +22 -22
- package/button-dropdown/item-element/styles.css.js +16 -16
- package/button-dropdown/item-element/styles.scoped.css +27 -27
- package/button-dropdown/item-element/styles.selectors.js +16 -16
- package/button-group/index.d.ts.map +1 -1
- package/button-group/index.js +11 -44
- package/button-group/interfaces.d.ts +41 -1
- package/button-group/interfaces.d.ts.map +1 -1
- package/button-group/interfaces.js.map +1 -1
- package/button-group/internal-do-not-use-core.js +51 -0
- package/button-group/internal-do-not-use-core.js.map +1 -0
- package/button-group/internal.d.ts.map +1 -1
- package/button-group/internal.js +5 -3
- package/button-group/internal.js.map +1 -1
- package/button-group/item-element.d.ts +1 -0
- package/button-group/item-element.d.ts.map +1 -1
- package/button-group/item-element.js +4 -2
- package/button-group/item-element.js.map +1 -1
- package/button-group/style.d.ts +12 -0
- package/button-group/style.d.ts.map +1 -0
- package/button-group/style.js +37 -0
- package/button-group/style.js.map +1 -0
- package/checkbox/interfaces.d.ts +0 -1
- package/checkbox/interfaces.d.ts.map +1 -1
- package/checkbox/interfaces.js.map +1 -1
- package/checkbox/styles.css.js +3 -3
- package/checkbox/styles.scoped.css +11 -11
- package/checkbox/styles.selectors.js +3 -3
- package/container/interfaces.d.ts +0 -15
- package/container/interfaces.d.ts.map +1 -1
- package/container/interfaces.js.map +1 -1
- package/content-layout/styles.css.js +14 -14
- package/content-layout/styles.scoped.css +27 -27
- package/content-layout/styles.selectors.js +14 -14
- package/date-range-picker/time-offset.js +3 -3
- package/date-range-picker/time-offset.js.map +1 -1
- package/flashbar/collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/collapsible-flashbar.js +3 -5
- package/flashbar/collapsible-flashbar.js.map +1 -1
- package/flashbar/common.d.ts.map +1 -1
- package/flashbar/common.js +2 -5
- package/flashbar/common.js.map +1 -1
- package/flashbar/flash.d.ts +1 -1
- package/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js +4 -2
- package/flashbar/flash.js.map +1 -1
- package/flashbar/interfaces.d.ts +0 -24
- package/flashbar/interfaces.d.ts.map +1 -1
- package/flashbar/interfaces.js.map +1 -1
- package/flashbar/styles.css.js +50 -50
- package/flashbar/styles.scoped.css +187 -187
- package/flashbar/styles.selectors.js +50 -50
- package/flashbar/utils.d.ts +1 -1
- package/flashbar/utils.d.ts.map +1 -1
- package/flashbar/utils.js +1 -1
- package/flashbar/utils.js.map +1 -1
- package/help-panel/styles.css.js +6 -6
- package/help-panel/styles.scoped.css +73 -73
- package/help-panel/styles.selectors.js +6 -6
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/drag-handle-wrapper/styles.css.js +21 -21
- package/internal/components/drag-handle-wrapper/styles.scoped.css +44 -44
- package/internal/components/drag-handle-wrapper/styles.selectors.js +21 -21
- package/internal/components/dropdown/styles.css.js +20 -20
- package/internal/components/dropdown/styles.scoped.css +38 -38
- package/internal/components/dropdown/styles.selectors.js +20 -20
- package/internal/components/token-list/styles.css.js +10 -10
- package/internal/components/token-list/styles.scoped.css +25 -25
- package/internal/components/token-list/styles.selectors.js +10 -10
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/generated/custom-css-properties/index.d.ts +4 -0
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +83 -79
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/utils/date-time/format-time-offset.d.ts +11 -0
- package/internal/utils/date-time/format-time-offset.d.ts.map +1 -1
- package/internal/utils/date-time/format-time-offset.js +17 -0
- package/internal/utils/date-time/format-time-offset.js.map +1 -1
- package/internal/utils/date-time/index.d.ts +1 -1
- package/internal/utils/date-time/index.d.ts.map +1 -1
- package/internal/utils/date-time/index.js +1 -1
- package/internal/utils/date-time/index.js.map +1 -1
- package/link/interfaces.d.ts +0 -6
- package/link/interfaces.d.ts.map +1 -1
- package/link/interfaces.js.map +1 -1
- package/link/styles.css.js +20 -20
- package/link/styles.scoped.css +103 -103
- package/link/styles.selectors.js +20 -20
- package/package.json +1 -1
- package/radio-group/interfaces.d.ts +0 -1
- package/radio-group/interfaces.d.ts.map +1 -1
- package/radio-group/interfaces.js.map +1 -1
- package/radio-group/styles.css.js +10 -10
- package/radio-group/styles.scoped.css +22 -22
- package/radio-group/styles.selectors.js +10 -10
- package/slider/styles.css.js +26 -26
- package/slider/styles.scoped.css +86 -86
- package/slider/styles.selectors.js +26 -26
- package/spinner/styles.css.js +13 -13
- package/spinner/styles.scoped.css +39 -39
- package/spinner/styles.selectors.js +13 -13
- package/tag-editor/styles.css.js +3 -3
- package/tag-editor/styles.scoped.css +13 -13
- package/tag-editor/styles.selectors.js +3 -3
- package/text-content/styles.css.js +1 -1
- package/text-content/styles.scoped.css +66 -66
- package/text-content/styles.selectors.js +1 -1
- package/toggle/interfaces.d.ts +0 -1
- package/toggle/interfaces.d.ts.map +1 -1
- package/toggle/interfaces.js.map +1 -1
- package/toggle/styles.css.js +10 -10
- package/toggle/styles.scoped.css +23 -23
- package/toggle/styles.selectors.js +10 -10
- package/button-group/index.js.map +0 -1
package/toggle/styles.scoped.css
CHANGED
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
*/
|
|
143
143
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
144
144
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
145
|
-
.
|
|
145
|
+
.awsui_root_4yi2u_19asi_145:not(#\9) {
|
|
146
146
|
border-collapse: separate;
|
|
147
147
|
border-spacing: 0;
|
|
148
148
|
box-sizing: border-box;
|
|
@@ -175,15 +175,15 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
175
175
|
display: flex;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
.
|
|
179
|
-
--awsui-style-focus-ring-box-shadow-
|
|
178
|
+
.awsui_outline_4yi2u_19asi_178:not(#\9) {
|
|
179
|
+
--awsui-style-focus-ring-box-shadow-kiajpc: 0 0 0 var(--awsui-style-focus-ring-border-width-kiajpc, 2px) var(--awsui-style-focus-ring-border-color-kiajpc, var(--color-border-item-focused-uk47pl, #006ce0));
|
|
180
180
|
position: relative;
|
|
181
181
|
}
|
|
182
|
-
.
|
|
182
|
+
.awsui_outline_4yi2u_19asi_178:not(#\9) {
|
|
183
183
|
outline: 2px dotted transparent;
|
|
184
184
|
outline-offset: calc(2px - 1px);
|
|
185
185
|
}
|
|
186
|
-
.
|
|
186
|
+
.awsui_outline_4yi2u_19asi_178:not(#\9)::before {
|
|
187
187
|
content: " ";
|
|
188
188
|
display: block;
|
|
189
189
|
position: absolute;
|
|
@@ -191,14 +191,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
191
191
|
inset-block-start: calc(-1 * 2px);
|
|
192
192
|
inline-size: calc(100% + 2px + 2px);
|
|
193
193
|
block-size: calc(100% + 2px + 2px);
|
|
194
|
-
border-start-start-radius: var(--awsui-style-focus-ring-border-radius-
|
|
195
|
-
border-start-end-radius: var(--awsui-style-focus-ring-border-radius-
|
|
196
|
-
border-end-start-radius: var(--awsui-style-focus-ring-border-radius-
|
|
197
|
-
border-end-end-radius: var(--awsui-style-focus-ring-border-radius-
|
|
198
|
-
box-shadow: var(--awsui-style-focus-ring-box-shadow-
|
|
194
|
+
border-start-start-radius: var(--awsui-style-focus-ring-border-radius-kiajpc, var(--border-radius-control-default-focus-ring-1uabki, 4px));
|
|
195
|
+
border-start-end-radius: var(--awsui-style-focus-ring-border-radius-kiajpc, var(--border-radius-control-default-focus-ring-1uabki, 4px));
|
|
196
|
+
border-end-start-radius: var(--awsui-style-focus-ring-border-radius-kiajpc, var(--border-radius-control-default-focus-ring-1uabki, 4px));
|
|
197
|
+
border-end-end-radius: var(--awsui-style-focus-ring-border-radius-kiajpc, var(--border-radius-control-default-focus-ring-1uabki, 4px));
|
|
198
|
+
box-shadow: var(--awsui-style-focus-ring-box-shadow-kiajpc);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
.awsui_toggle-
|
|
201
|
+
.awsui_toggle-control_4yi2u_19asi_201:not(#\9) {
|
|
202
202
|
forced-color-adjust: none;
|
|
203
203
|
margin-block-start: calc((var(--line-height-body-m-2mh3ke, 20px) - 16px) / 2);
|
|
204
204
|
min-block-size: 16px;
|
|
@@ -211,20 +211,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
211
211
|
border-end-start-radius: 8px;
|
|
212
212
|
border-end-end-radius: 8px;
|
|
213
213
|
}
|
|
214
|
-
.awsui_toggle-control-
|
|
214
|
+
.awsui_toggle-control-checked_4yi2u_19asi_214:not(#\9) {
|
|
215
215
|
background: var(--color-background-control-checked-ka7kc2, #006ce0);
|
|
216
216
|
}
|
|
217
|
-
.awsui_toggle-control-
|
|
217
|
+
.awsui_toggle-control-disabled_4yi2u_19asi_217:not(#\9) {
|
|
218
218
|
background: var(--color-background-control-disabled-1f3718, #dedee3);
|
|
219
219
|
}
|
|
220
|
-
.awsui_toggle-control-
|
|
220
|
+
.awsui_toggle-control-disabled_4yi2u_19asi_217.awsui_toggle-control-checked_4yi2u_19asi_214:not(#\9) {
|
|
221
221
|
background: var(--color-background-toggle-checked-disabled-amxc0a, #b8e7ff);
|
|
222
222
|
}
|
|
223
|
-
.awsui_toggle-control-
|
|
223
|
+
.awsui_toggle-control-readonly_4yi2u_19asi_223:not(#\9) {
|
|
224
224
|
background: var(--color-background-control-disabled-1f3718, #dedee3);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
.awsui_toggle-
|
|
227
|
+
.awsui_toggle-handle_4yi2u_19asi_227:not(#\9) {
|
|
228
228
|
display: block;
|
|
229
229
|
position: absolute;
|
|
230
230
|
border-start-start-radius: 6px;
|
|
@@ -240,29 +240,29 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
240
240
|
transition: transform var(--motion-duration-fast-unntf6, 90ms) var(--motion-easing-ease-out-quart-p9axhm, cubic-bezier(0.165, 0.84, 0.44, 1)), background-color var(--motion-duration-fast-unntf6, 90ms) var(--motion-easing-ease-out-quart-p9axhm, cubic-bezier(0.165, 0.84, 0.44, 1));
|
|
241
241
|
}
|
|
242
242
|
@media (prefers-reduced-motion: reduce) {
|
|
243
|
-
.awsui_toggle-
|
|
243
|
+
.awsui_toggle-handle_4yi2u_19asi_227:not(#\9) {
|
|
244
244
|
animation: none;
|
|
245
245
|
transition: none;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
.awsui-motion-disabled .awsui_toggle-
|
|
248
|
+
.awsui-motion-disabled .awsui_toggle-handle_4yi2u_19asi_227:not(#\9), .awsui-mode-entering .awsui_toggle-handle_4yi2u_19asi_227:not(#\9) {
|
|
249
249
|
animation: none;
|
|
250
250
|
transition: none;
|
|
251
251
|
}
|
|
252
|
-
.awsui_toggle-handle-
|
|
252
|
+
.awsui_toggle-handle-checked_4yi2u_19asi_252:not(#\9) {
|
|
253
253
|
transform: translateX(8px);
|
|
254
254
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
255
255
|
}
|
|
256
|
-
.awsui_toggle-handle-
|
|
256
|
+
.awsui_toggle-handle-checked_4yi2u_19asi_252:not(#\9):dir(rtl) {
|
|
257
257
|
transform: translateX(-8px);
|
|
258
258
|
}
|
|
259
|
-
.awsui_toggle-handle-
|
|
259
|
+
.awsui_toggle-handle-disabled_4yi2u_19asi_259:not(#\9) {
|
|
260
260
|
background: var(--color-foreground-control-disabled-txi6cf, #ffffff);
|
|
261
261
|
box-shadow: none;
|
|
262
262
|
}
|
|
263
|
-
.awsui_toggle-handle-
|
|
263
|
+
.awsui_toggle-handle-readonly_4yi2u_19asi_263:not(#\9):not(.awsui_toggle-handle-disabled_4yi2u_19asi_259) {
|
|
264
264
|
box-shadow: none;
|
|
265
265
|
}
|
|
266
|
-
.awsui_toggle-handle-
|
|
266
|
+
.awsui_toggle-handle-readonly_4yi2u_19asi_263:not(#\9):not(.awsui_toggle-handle-disabled_4yi2u_19asi_259).awsui_toggle-handle-checked_4yi2u_19asi_252 {
|
|
267
267
|
background: var(--color-foreground-control-read-only-7ydvuj, #656871);
|
|
268
268
|
}
|
|
@@ -2,15 +2,15 @@
|
|
|
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
|
-
"outline": "
|
|
7
|
-
"toggle-control": "awsui_toggle-
|
|
8
|
-
"toggle-control-checked": "awsui_toggle-control-
|
|
9
|
-
"toggle-control-disabled": "awsui_toggle-control-
|
|
10
|
-
"toggle-control-readonly": "awsui_toggle-control-
|
|
11
|
-
"toggle-handle": "awsui_toggle-
|
|
12
|
-
"toggle-handle-checked": "awsui_toggle-handle-
|
|
13
|
-
"toggle-handle-disabled": "awsui_toggle-handle-
|
|
14
|
-
"toggle-handle-readonly": "awsui_toggle-handle-
|
|
5
|
+
"root": "awsui_root_4yi2u_19asi_145",
|
|
6
|
+
"outline": "awsui_outline_4yi2u_19asi_178",
|
|
7
|
+
"toggle-control": "awsui_toggle-control_4yi2u_19asi_201",
|
|
8
|
+
"toggle-control-checked": "awsui_toggle-control-checked_4yi2u_19asi_214",
|
|
9
|
+
"toggle-control-disabled": "awsui_toggle-control-disabled_4yi2u_19asi_217",
|
|
10
|
+
"toggle-control-readonly": "awsui_toggle-control-readonly_4yi2u_19asi_223",
|
|
11
|
+
"toggle-handle": "awsui_toggle-handle_4yi2u_19asi_227",
|
|
12
|
+
"toggle-handle-checked": "awsui_toggle-handle-checked_4yi2u_19asi_252",
|
|
13
|
+
"toggle-handle-disabled": "awsui_toggle-handle-disabled_4yi2u_19asi_259",
|
|
14
|
+
"toggle-handle-readonly": "awsui_toggle-handle-readonly_4yi2u_19asi_263"
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button-group/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,mBAAmB,MAAM,YAAY,CAAC;AAI7C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,CAAC,EAAwE,EAAE,GAAoC,EAAE,EAAE;QAAlH,EAAE,OAAO,EAAE,wBAAwB,GAAG,KAAK,OAA6B,EAAxB,IAAI,cAApD,uCAAsD,CAAF;IACnD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,aAAa,EAAE;QACzD,KAAK,EAAE;YACL,OAAO;YACP,wBAAwB;SACzB;QACD,QAAQ,EAAE;YACR,gBAAgB,EAAE,UAAU,CAAC,aAAa,CAAC;YAC3C,sBAAsB,EAAE,UAAU,CAAC,oBAAoB,CAAC;YACxD,mBAAmB,EAAE,UAAU,CAAC,iBAAiB,CAAC;YAClD,kBAAkB,EAAE,UAAU,CAAC,eAAe,CAAC;YAC/C,WAAW,EAAE,UAAU,CAAC,KAAK;SAC9B;KACF,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAE7C,MAAM,iBAAiB,GAAmD;QACxE,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACxB,CAAC;IAEF,OAAO,CACL,oBAAC,mBAAmB,oBACd,SAAS,EACT,kBAAkB,EAClB,aAAa,IACjB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,wBAAwB,EAAE,wBAAwB,IAC9C,6BAA6B,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,EACnE,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,aAAa,CAAC,WAAoD,EAAE;IAC3E,MAAM,QAAQ,GAAG,EAAE,aAAa,EAAE,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAEnH,SAAS,KAAK,CAAC,KAA8C;QAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEzB,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;gBACzB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACnB;SACF;IACH,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEhB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAC7C,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { GeneratedAnalyticsMetadataButtonGroupComponent } from './analytics-metadata/interfaces';\nimport { ButtonGroupProps } from './interfaces';\nimport InternalButtonGroup from './internal';\n\nexport { ButtonGroupProps };\n\nconst ButtonGroup = React.forwardRef(\n ({ variant, dropdownExpandToViewport = false, ...rest }: ButtonGroupProps, ref: React.Ref<ButtonGroupProps.Ref>) => {\n const baseProps = getBaseProps(rest);\n const itemCounts = getItemCounts(rest.items);\n const baseComponentProps = useBaseComponent('ButtonGroup', {\n props: {\n variant,\n dropdownExpandToViewport,\n },\n metadata: {\n iconButtonsCount: itemCounts['icon-button'],\n iconToggleButtonsCount: itemCounts['icon-toggle-button'],\n iconFileInputsCount: itemCounts['icon-file-input'],\n menuDropdownsCount: itemCounts['menu-dropdown'],\n groupsCount: itemCounts.group,\n },\n });\n\n const externalProps = getExternalProps(rest);\n\n const componentMetadata: GeneratedAnalyticsMetadataButtonGroupComponent = {\n name: 'awsui.ButtonGroup',\n label: { root: 'self' },\n };\n\n return (\n <InternalButtonGroup\n {...baseProps}\n {...baseComponentProps}\n {...externalProps}\n ref={ref}\n variant={variant}\n dropdownExpandToViewport={dropdownExpandToViewport}\n {...getAnalyticsMetadataAttribute({ component: componentMetadata })}\n />\n );\n }\n);\n\nfunction getItemCounts(allItems: readonly ButtonGroupProps.ItemOrGroup[] = []) {\n const counters = { 'icon-button': 0, 'icon-toggle-button': 0, 'icon-file-input': 0, 'menu-dropdown': 0, group: 0 };\n\n function count(items: readonly ButtonGroupProps.ItemOrGroup[]) {\n for (const item of items) {\n counters[item.type] += 1;\n\n if (item.type === 'group') {\n count(item.items);\n }\n }\n }\n count(allItems);\n\n return counters;\n}\n\napplyDisplayName(ButtonGroup, 'ButtonGroup');\nexport default ButtonGroup;\n"]}
|