@cloudscape-design/components 3.0.671 → 3.0.673

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 (126) hide show
  1. package/checkbox/base-checkbox.d.ts +7 -0
  2. package/checkbox/base-checkbox.d.ts.map +1 -1
  3. package/checkbox/base-checkbox.js.map +1 -1
  4. package/checkbox/internal.d.ts.map +1 -1
  5. package/checkbox/internal.js +3 -3
  6. package/checkbox/internal.js.map +1 -1
  7. package/date-picker/interfaces.d.ts +1 -1
  8. package/date-picker/interfaces.js.map +1 -1
  9. package/date-range-picker/index.d.ts.map +1 -1
  10. package/date-range-picker/index.js +1 -3
  11. package/date-range-picker/index.js.map +1 -1
  12. package/input/interfaces.d.ts +1 -1
  13. package/input/interfaces.js.map +1 -1
  14. package/internal/base-component/styles.scoped.css +5 -0
  15. package/internal/components/abstract-switch/index.d.ts +2 -1
  16. package/internal/components/abstract-switch/index.d.ts.map +1 -1
  17. package/internal/components/abstract-switch/index.js +2 -2
  18. package/internal/components/abstract-switch/index.js.map +1 -1
  19. package/internal/components/button-trigger/index.d.ts.map +1 -1
  20. package/internal/components/button-trigger/index.js +5 -2
  21. package/internal/components/button-trigger/index.js.map +1 -1
  22. package/internal/components/button-trigger/styles.css.js +11 -11
  23. package/internal/components/button-trigger/styles.scoped.css +26 -26
  24. package/internal/components/button-trigger/styles.selectors.js +11 -11
  25. package/internal/components/checkbox-icon/index.d.ts +2 -1
  26. package/internal/components/checkbox-icon/index.d.ts.map +1 -1
  27. package/internal/components/checkbox-icon/index.js +6 -2
  28. package/internal/components/checkbox-icon/index.js.map +1 -1
  29. package/internal/components/checkbox-icon/styles.css.js +9 -7
  30. package/internal/components/checkbox-icon/styles.scoped.css +11 -8
  31. package/internal/components/checkbox-icon/styles.selectors.js +9 -7
  32. package/internal/environment.js +1 -1
  33. package/internal/environment.json +1 -1
  34. package/internal/generated/styles/tokens.d.ts +1 -0
  35. package/internal/generated/styles/tokens.js +1 -0
  36. package/internal/generated/theming/index.cjs +33 -0
  37. package/internal/generated/theming/index.cjs.d.ts +8 -0
  38. package/internal/generated/theming/index.d.ts +8 -0
  39. package/internal/generated/theming/index.js +33 -0
  40. package/internal/manifest.json +1 -1
  41. package/multiselect/internal.d.ts.map +1 -1
  42. package/multiselect/internal.js +3 -3
  43. package/multiselect/internal.js.map +1 -1
  44. package/package.json +1 -1
  45. package/radio-group/interfaces.d.ts +6 -0
  46. package/radio-group/interfaces.d.ts.map +1 -1
  47. package/radio-group/interfaces.js.map +1 -1
  48. package/radio-group/internal.d.ts.map +1 -1
  49. package/radio-group/internal.js +3 -3
  50. package/radio-group/internal.js.map +1 -1
  51. package/radio-group/radio-button.d.ts +1 -0
  52. package/radio-group/radio-button.d.ts.map +1 -1
  53. package/radio-group/radio-button.js +7 -3
  54. package/radio-group/radio-button.js.map +1 -1
  55. package/radio-group/styles.css.js +10 -9
  56. package/radio-group/styles.scoped.css +19 -15
  57. package/radio-group/styles.selectors.js +10 -9
  58. package/select/interfaces.d.ts +5 -0
  59. package/select/interfaces.d.ts.map +1 -1
  60. package/select/interfaces.js.map +1 -1
  61. package/select/internal.d.ts.map +1 -1
  62. package/select/internal.js +2 -2
  63. package/select/internal.js.map +1 -1
  64. package/select/parts/trigger.d.ts +1 -0
  65. package/select/parts/trigger.d.ts.map +1 -1
  66. package/select/parts/trigger.js +2 -2
  67. package/select/parts/trigger.js.map +1 -1
  68. package/slider/interfaces.d.ts +6 -0
  69. package/slider/interfaces.d.ts.map +1 -1
  70. package/slider/interfaces.js.map +1 -1
  71. package/slider/internal.d.ts +1 -1
  72. package/slider/internal.d.ts.map +1 -1
  73. package/slider/internal.js +15 -6
  74. package/slider/internal.js.map +1 -1
  75. package/slider/styles.css.js +27 -25
  76. package/slider/styles.scoped.css +129 -62
  77. package/slider/styles.selectors.js +27 -25
  78. package/slider/tick-marks.d.ts +1 -0
  79. package/slider/tick-marks.d.ts.map +1 -1
  80. package/slider/tick-marks.js +2 -1
  81. package/slider/tick-marks.js.map +1 -1
  82. package/slider/utils.d.ts +1 -0
  83. package/slider/utils.d.ts.map +1 -1
  84. package/slider/utils.js +1 -0
  85. package/slider/utils.js.map +1 -1
  86. package/tiles/interfaces.d.ts +6 -0
  87. package/tiles/interfaces.d.ts.map +1 -1
  88. package/tiles/interfaces.js.map +1 -1
  89. package/tiles/internal.d.ts.map +1 -1
  90. package/tiles/internal.js +3 -3
  91. package/tiles/internal.js.map +1 -1
  92. package/tiles/styles.css.js +30 -29
  93. package/tiles/styles.scoped.css +75 -70
  94. package/tiles/styles.selectors.js +30 -29
  95. package/tiles/tile.d.ts +1 -0
  96. package/tiles/tile.d.ts.map +1 -1
  97. package/tiles/tile.js +4 -4
  98. package/tiles/tile.js.map +1 -1
  99. package/toggle/internal.d.ts.map +1 -1
  100. package/toggle/internal.js +4 -2
  101. package/toggle/internal.js.map +1 -1
  102. package/toggle/styles.css.js +10 -8
  103. package/toggle/styles.scoped.css +23 -14
  104. package/toggle/styles.selectors.js +10 -8
  105. package/token-group/dismiss-button.d.ts +1 -0
  106. package/token-group/dismiss-button.d.ts.map +1 -1
  107. package/token-group/dismiss-button.js +7 -2
  108. package/token-group/dismiss-button.js.map +1 -1
  109. package/token-group/interfaces.d.ts +5 -0
  110. package/token-group/interfaces.d.ts.map +1 -1
  111. package/token-group/interfaces.js.map +1 -1
  112. package/token-group/internal.d.ts +1 -1
  113. package/token-group/internal.d.ts.map +1 -1
  114. package/token-group/internal.js +2 -2
  115. package/token-group/internal.js.map +1 -1
  116. package/token-group/styles.css.js +10 -9
  117. package/token-group/styles.scoped.css +33 -19
  118. package/token-group/styles.selectors.js +10 -9
  119. package/token-group/token.d.ts +2 -1
  120. package/token-group/token.d.ts.map +1 -1
  121. package/token-group/token.js +3 -3
  122. package/token-group/token.js.map +1 -1
  123. package/top-navigation/1.0-beta/interfaces.d.ts +1 -1
  124. package/top-navigation/1.0-beta/interfaces.js.map +1 -1
  125. package/top-navigation/interfaces.d.ts +1 -1
  126. package/top-navigation/interfaces.js.map +1 -1
@@ -130,6 +130,7 @@ export declare interface TypedOverride {
130
130
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
131
131
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
132
132
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
133
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
133
134
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
134
135
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
135
136
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -353,6 +354,7 @@ export declare interface TypedOverride {
353
354
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
354
355
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
355
356
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
357
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
356
358
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
357
359
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
358
360
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -576,6 +578,7 @@ export declare interface TypedOverride {
576
578
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
577
579
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
578
580
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
581
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
579
582
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
580
583
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
581
584
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -799,6 +802,7 @@ export declare interface TypedOverride {
799
802
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
800
803
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
801
804
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
805
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
802
806
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
803
807
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
804
808
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1022,6 +1026,7 @@ export declare interface TypedOverride {
1022
1026
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1023
1027
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1024
1028
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1029
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1025
1030
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1026
1031
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1027
1032
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1245,6 +1250,7 @@ export declare interface TypedOverride {
1245
1250
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1246
1251
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1247
1252
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1253
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1248
1254
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1249
1255
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1250
1256
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1468,6 +1474,7 @@ export declare interface TypedOverride {
1468
1474
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1469
1475
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1470
1476
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1477
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1471
1478
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1472
1479
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1473
1480
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1691,6 +1698,7 @@ export declare interface TypedOverride {
1691
1698
  colorBorderStatusWarning?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1692
1699
  colorForegroundControlDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1693
1700
  colorForegroundControlDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1701
+ colorForegroundControlReadOnly?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1694
1702
  colorTextAccent?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1695
1703
  colorTextBodyDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1696
1704
  colorTextBodySecondary?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1285,6 +1285,10 @@ export var preset = {
1285
1285
  "light": "{colorWhite}",
1286
1286
  "dark": "{colorGrey800}"
1287
1287
  },
1288
+ "colorForegroundControlReadOnly": {
1289
+ "light": "{colorGrey550}",
1290
+ "dark": "{colorGrey450}"
1291
+ },
1288
1292
  "colorShadowDefault": {
1289
1293
  "light": "{colorGreyTransparentHeavy}",
1290
1294
  "dark": "{colorGreyTransparentHeavy}"
@@ -3431,6 +3435,10 @@ export var preset = {
3431
3435
  "light": "{colorGrey800}",
3432
3436
  "dark": "{colorGrey800}"
3433
3437
  },
3438
+ "colorForegroundControlReadOnly": {
3439
+ "light": "{colorGrey450}",
3440
+ "dark": "{colorGrey450}"
3441
+ },
3434
3442
  "colorShadowDefault": {
3435
3443
  "light": "{colorGreyTransparentHeavy}",
3436
3444
  "dark": "{colorGreyTransparentHeavy}"
@@ -4497,6 +4505,10 @@ export var preset = {
4497
4505
  "light": "{colorGrey800}",
4498
4506
  "dark": "{colorGrey800}"
4499
4507
  },
4508
+ "colorForegroundControlReadOnly": {
4509
+ "light": "{colorGrey450}",
4510
+ "dark": "{colorGrey450}"
4511
+ },
4500
4512
  "colorShadowDefault": {
4501
4513
  "light": "{colorGreyTransparentHeavy}",
4502
4514
  "dark": "{colorGreyTransparentHeavy}"
@@ -5495,6 +5507,10 @@ export var preset = {
5495
5507
  "light": "{colorWhite}",
5496
5508
  "dark": "{colorGrey800}"
5497
5509
  },
5510
+ "colorForegroundControlReadOnly": {
5511
+ "light": "{colorGrey550}",
5512
+ "dark": "{colorGrey450}"
5513
+ },
5498
5514
  "colorShadowDefault": {
5499
5515
  "light": "{colorGreyTransparentHeavy}",
5500
5516
  "dark": "{colorGreyTransparentHeavy}"
@@ -6493,6 +6509,10 @@ export var preset = {
6493
6509
  "light": "{colorWhite}",
6494
6510
  "dark": "{colorGrey800}"
6495
6511
  },
6512
+ "colorForegroundControlReadOnly": {
6513
+ "light": "{colorGrey550}",
6514
+ "dark": "{colorGrey450}"
6515
+ },
6496
6516
  "colorShadowDefault": {
6497
6517
  "light": "{colorGreyTransparentHeavy}",
6498
6518
  "dark": "{colorGreyTransparentHeavy}"
@@ -7491,6 +7511,10 @@ export var preset = {
7491
7511
  "light": "{colorWhite}",
7492
7512
  "dark": "{colorGrey800}"
7493
7513
  },
7514
+ "colorForegroundControlReadOnly": {
7515
+ "light": "{colorGrey550}",
7516
+ "dark": "{colorGrey450}"
7517
+ },
7494
7518
  "colorShadowDefault": {
7495
7519
  "light": "{colorGreyTransparentHeavy}",
7496
7520
  "dark": "{colorGreyTransparentHeavy}"
@@ -8491,6 +8515,10 @@ export var preset = {
8491
8515
  "light": "{colorGrey800}",
8492
8516
  "dark": "{colorGrey800}"
8493
8517
  },
8518
+ "colorForegroundControlReadOnly": {
8519
+ "light": "{colorGrey450}",
8520
+ "dark": "{colorGrey450}"
8521
+ },
8494
8522
  "colorShadowDefault": {
8495
8523
  "light": "{colorGreyTransparentHeavy}",
8496
8524
  "dark": "{colorGreyTransparentHeavy}"
@@ -9209,6 +9237,7 @@ export var preset = {
9209
9237
  "colorBorderTutorial": "color",
9210
9238
  "colorForegroundControlDefault": "color",
9211
9239
  "colorForegroundControlDisabled": "color",
9240
+ "colorForegroundControlReadOnly": "color",
9212
9241
  "colorShadowDefault": "color",
9213
9242
  "colorShadowMedium": "color",
9214
9243
  "colorShadowSide": "color",
@@ -9610,6 +9639,7 @@ export var preset = {
9610
9639
  "colorBorderStatusWarning",
9611
9640
  "colorForegroundControlDefault",
9612
9641
  "colorForegroundControlDisabled",
9642
+ "colorForegroundControlReadOnly",
9613
9643
  "colorTextAccent",
9614
9644
  "colorTextBodyDefault",
9615
9645
  "colorTextBodySecondary",
@@ -9928,6 +9958,7 @@ export var preset = {
9928
9958
  "colorBorderStatusWarning",
9929
9959
  "colorForegroundControlDefault",
9930
9960
  "colorForegroundControlDisabled",
9961
+ "colorForegroundControlReadOnly",
9931
9962
  "colorTextAccent",
9932
9963
  "colorTextBodyDefault",
9933
9964
  "colorTextBodySecondary",
@@ -10409,6 +10440,7 @@ export var preset = {
10409
10440
  "colorBorderTutorial": "color-border-tutorial",
10410
10441
  "colorForegroundControlDefault": "color-foreground-control-default",
10411
10442
  "colorForegroundControlDisabled": "color-foreground-control-disabled",
10443
+ "colorForegroundControlReadOnly": "color-foreground-control-read-only",
10412
10444
  "colorShadowDefault": "color-shadow-default",
10413
10445
  "colorShadowMedium": "color-shadow-medium",
10414
10446
  "colorShadowSide": "color-shadow-side",
@@ -11118,6 +11150,7 @@ export var preset = {
11118
11150
  "colorBorderTutorial": "--color-border-tutorial-kk53ya",
11119
11151
  "colorForegroundControlDefault": "--color-foreground-control-default-wq2gpa",
11120
11152
  "colorForegroundControlDisabled": "--color-foreground-control-disabled-zmz2k2",
11153
+ "colorForegroundControlReadOnly": "--color-foreground-control-read-only-ibiswj",
11121
11154
  "colorShadowDefault": "--color-shadow-default-8jp634",
11122
11155
  "colorShadowMedium": "--color-shadow-medium-wuskz4",
11123
11156
  "colorShadowSide": "--color-shadow-side-75ahs7",
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "7ab93c5b2891b8dce415c7a96309f6ba8f0c6ce0"
2
+ "commit": "c5cfbc0a8e6ee2f6390d87ec0695611fb0b0c72e"
3
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AA2B3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,QAAA,MAAM,mBAAmB;;8CAuUxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AA2B3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,QAAA,MAAM,mBAAmB;;8CA0UxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -31,7 +31,7 @@ import { useInternalI18n } from '../i18n/context';
31
31
  import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
32
32
  const InternalMultiselect = React.forwardRef((_a, externalRef) => {
33
33
  var _b;
34
- var { options = [], filteringType = 'none', filteringPlaceholder, filteringAriaLabel, filteringClearAriaLabel, filteringResultsText, ariaRequired, placeholder, disabled, ariaLabel, statusType = 'finished', empty, loadingText, finishedText, errorText, noMatch, renderHighlightedAriaLive, selectedOptions = [], deselectAriaLabel, keepOpen = true, tokenLimit, i18nStrings, onBlur, onFocus, onLoadItems, onChange, virtualScroll, inlineTokens = false, hideTokens = false, expandToViewport, tokenLimitShowFewerAriaLabel, tokenLimitShowMoreAriaLabel, __internalRootRef = null, autoFocus } = _a, restProps = __rest(_a, ["options", "filteringType", "filteringPlaceholder", "filteringAriaLabel", "filteringClearAriaLabel", "filteringResultsText", "ariaRequired", "placeholder", "disabled", "ariaLabel", "statusType", "empty", "loadingText", "finishedText", "errorText", "noMatch", "renderHighlightedAriaLive", "selectedOptions", "deselectAriaLabel", "keepOpen", "tokenLimit", "i18nStrings", "onBlur", "onFocus", "onLoadItems", "onChange", "virtualScroll", "inlineTokens", "hideTokens", "expandToViewport", "tokenLimitShowFewerAriaLabel", "tokenLimitShowMoreAriaLabel", "__internalRootRef", "autoFocus"]);
34
+ var { options = [], filteringType = 'none', filteringPlaceholder, filteringAriaLabel, filteringClearAriaLabel, filteringResultsText, ariaRequired, placeholder, disabled, readOnly, ariaLabel, statusType = 'finished', empty, loadingText, finishedText, errorText, noMatch, renderHighlightedAriaLive, selectedOptions = [], deselectAriaLabel, keepOpen = true, tokenLimit, i18nStrings, onBlur, onFocus, onLoadItems, onChange, virtualScroll, inlineTokens = false, hideTokens = false, expandToViewport, tokenLimitShowFewerAriaLabel, tokenLimitShowMoreAriaLabel, __internalRootRef = null, autoFocus } = _a, restProps = __rest(_a, ["options", "filteringType", "filteringPlaceholder", "filteringAriaLabel", "filteringClearAriaLabel", "filteringResultsText", "ariaRequired", "placeholder", "disabled", "readOnly", "ariaLabel", "statusType", "empty", "loadingText", "finishedText", "errorText", "noMatch", "renderHighlightedAriaLive", "selectedOptions", "deselectAriaLabel", "keepOpen", "tokenLimit", "i18nStrings", "onBlur", "onFocus", "onLoadItems", "onChange", "virtualScroll", "inlineTokens", "hideTokens", "expandToViewport", "tokenLimitShowFewerAriaLabel", "tokenLimitShowMoreAriaLabel", "__internalRootRef", "autoFocus"]);
35
35
  checkOptionValueField('Multiselect', 'options', options);
36
36
  const baseProps = getBaseProps(restProps);
37
37
  const formFieldContext = useFormFieldContext(restProps);
@@ -128,7 +128,7 @@ const InternalMultiselect = React.forwardRef((_a, externalRef) => {
128
128
  hasRecoveryCallback: !!onLoadItems,
129
129
  });
130
130
  const filter = (React.createElement(Filter, Object.assign({ clearAriaLabel: filteringClearAriaLabel, filteringType: filteringType, placeholder: filteringPlaceholder, ariaLabel: filteringAriaLabel, ariaRequired: ariaRequired, value: filteringValue }, getFilterProps())));
131
- const trigger = (React.createElement(Trigger, Object.assign({ placeholder: placeholder, disabled: disabled, triggerProps: getTriggerProps(disabled, autoFocus), selectedOption: null, selectedOptions: selectedOptions, triggerVariant: inlineTokens ? 'tokens' : 'placeholder', isOpen: isOpen }, formFieldContext, { controlId: controlId, ariaLabelledby: joinStrings(formFieldContext.ariaLabelledby, multiSelectAriaLabelId) })));
131
+ const trigger = (React.createElement(Trigger, Object.assign({ placeholder: placeholder, disabled: disabled, readOnly: readOnly, triggerProps: getTriggerProps(disabled, autoFocus), selectedOption: null, selectedOptions: selectedOptions, triggerVariant: inlineTokens ? 'tokens' : 'placeholder', isOpen: isOpen }, formFieldContext, { controlId: controlId, ariaLabelledby: joinStrings(formFieldContext.ariaLabelledby, multiSelectAriaLabelId) })));
132
132
  const menuProps = Object.assign(Object.assign({}, getMenuProps()), { onLoadMore: handleLoadMore, ariaLabelledby: joinStrings(multiSelectAriaLabelId, controlId), ariaDescribedby: dropdownStatus.content ? footerId : undefined });
133
133
  const announcement = useAnnouncement({
134
134
  announceSelected,
@@ -179,7 +179,7 @@ const InternalMultiselect = React.forwardRef((_a, externalRef) => {
179
179
  return (React.createElement("div", Object.assign({}, baseProps, { ref: mergedRef, className: clsx(styles.root, baseProps.className), onKeyPress: handleNativeSearch }),
180
180
  React.createElement(Dropdown, Object.assign({}, dropdownProps, { ariaLabelledby: dropdownProps.dropdownContentRole ? joinStrings(multiSelectAriaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined, open: isOpen, trigger: trigger, header: filter, onMouseDown: handleMouseDown, footer: dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: isOpen ? dropdownStatus.content : null, id: footerId })) : null, expandToViewport: expandToViewport, stretchBeyondTriggerWidth: true }),
181
181
  React.createElement(ListComponent, { listBottom: !dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: isOpen ? dropdownStatus.content : null, id: footerId })) : null, menuProps: menuProps, getOptionProps: getOptionProps, filteredOptions: filteredOptions, filteringValue: filteringValue, ref: scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, checkboxes: true, useInteractiveGroups: useInteractiveGroups, screenReaderContent: announcement, highlightType: highlightType })),
182
- showTokens && (React.createElement(InternalTokenGroup, { className: styles.tokens, alignment: "horizontal", limit: tokenLimit, items: tokens, onDismiss: handleTokenDismiss, i18nStrings: tokenGroupI18nStrings, limitShowMoreAriaLabel: tokenLimitShowMoreAriaLabel, limitShowFewerAriaLabel: tokenLimitShowFewerAriaLabel, disableOuterPadding: true })),
182
+ showTokens && (React.createElement(InternalTokenGroup, { className: styles.tokens, alignment: "horizontal", limit: tokenLimit, items: tokens, onDismiss: handleTokenDismiss, i18nStrings: tokenGroupI18nStrings, limitShowMoreAriaLabel: tokenLimitShowMoreAriaLabel, limitShowFewerAriaLabel: tokenLimitShowFewerAriaLabel, disableOuterPadding: true, readOnly: readOnly })),
183
183
  React.createElement(ScreenreaderOnly, { id: multiSelectAriaLabelId }, ariaLabel)));
184
184
  });
185
185
  export default InternalMultiselect;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC;AAE7E,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAa,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,SAA8B,MAAM,4BAA4B,CAAC;AACxE,OAAO,WAAW,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,M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c,CAAC,OAAO,KAAK,IAAI,EAClD,UAAU,EAAE,IAAI,EAChB,oBAAoB,EAAE,oBAAoB,EAC1C,mBAAmB,EAAE,YAAY,EACjC,aAAa,EAAE,aAAa,GAC5B,CACO;QACV,UAAU,IAAI,CACb,oBAAC,kBAAkB,IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,kBAAkB,EAC7B,WAAW,EAAE,qBAAqB,EAClC,sBAAsB,EAAE,2BAA2B,EACnD,uBAAuB,EAAE,4BAA4B,EACrD,mBAAmB,EAAE,IAAI,GACzB,CACH;QACD,oBAAC,gBAAgB,IAAC,EAAE,EAAE,sBAAsB,IAAG,SAAS,CAAoB,CACxE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\n\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport Dropdown from '../internal/components/dropdown';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\n\nimport { useSelect, MenuProps } from '../select/utils/use-select';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport PlainList, { SelectListProps } from '../select/parts/plain-list';\nimport VirtualList from '../select/parts/virtual-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport Filter from '../select/parts/filter';\nimport Trigger from '../select/parts/trigger';\n\nimport InternalTokenGroup from '../token-group/internal';\nimport { TokenGroupProps } from '../token-group/interfaces';\n\nimport { MultiselectProps } from './interfaces';\nimport styles from './styles.css.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../i18n/context';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\ntype InternalMultiselectProps = MultiselectProps & InternalBaseComponentProps & { inlineTokens?: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options = [],\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n ariaRequired,\n placeholder,\n disabled,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n renderHighlightedAriaLive,\n selectedOptions = [],\n deselectAriaLabel,\n keepOpen = true,\n tokenLimit,\n i18nStrings,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n inlineTokens = false,\n hideTokens = false,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef = null,\n autoFocus,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n checkOptionValueField('Multiselect', 'options', options);\n\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const i18n = useInternalI18n('multiselect');\n\n const i18nCommon = useInternalI18n('select');\n const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);\n const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const [filteringValue, setFilteringValue] = useState('');\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filtered);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [onChange, selectedOptions, filteredOptions]\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const multiSelectAriaLabelId = useUniqueId('multiselect-arialabel-');\n\n const footerId = useUniqueId('footer');\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: filteredOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n statusType,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: filteredOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n isFiltered,\n filteringResultsText: filteredText,\n onRecoveryClick: handleRecoveryClick,\n errorIconAriaLabel: errorIconAriaLabel,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n placeholder={placeholder}\n disabled={disabled}\n triggerProps={getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={inlineTokens ? 'tokens' : 'placeholder'}\n isOpen={isOpen}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, multiSelectAriaLabelId)}\n />\n );\n\n const menuProps: MenuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(multiSelectAriaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const showTokens = !hideTokens && !inlineTokens && tokens.length > 0;\n const handleTokenDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n const dropdownProps = getDropdownProps();\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyPress={handleNativeSearch}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={\n dropdownProps.dropdownContentRole ? joinStrings(multiSelectAriaLabelId, controlId) : undefined\n }\n ariaDescribedby={\n dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined\n }\n open={isOpen}\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n expandToViewport={expandToViewport}\n stretchBeyondTriggerWidth={true}\n >\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={useInteractiveGroups}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n </Dropdown>\n {showTokens && (\n <InternalTokenGroup\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n onDismiss={handleTokenDismiss}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n />\n )}\n <ScreenreaderOnly id={multiSelectAriaLabelId}>{ariaLabel}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,M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B,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,kBAAkB,EAC7B,WAAW,EAAE,qBAAqB,EAClC,sBAAsB,EAAE,2BAA2B,EACnD,uBAAuB,EAAE,4BAA4B,EACrD,mBAAmB,EAAE,IAAI,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH;QACD,oBAAC,gBAAgB,IAAC,EAAE,EAAE,sBAAsB,IAAG,SAAS,CAAoB,CACxE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\n\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport Dropdown from '../internal/components/dropdown';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\n\nimport { useSelect, MenuProps } from '../select/utils/use-select';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport PlainList, { SelectListProps } from '../select/parts/plain-list';\nimport VirtualList from '../select/parts/virtual-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport Filter from '../select/parts/filter';\nimport Trigger from '../select/parts/trigger';\n\nimport InternalTokenGroup from '../token-group/internal';\nimport { TokenGroupProps } from '../token-group/interfaces';\n\nimport { MultiselectProps } from './interfaces';\nimport styles from './styles.css.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../i18n/context';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\ntype InternalMultiselectProps = MultiselectProps & InternalBaseComponentProps & { inlineTokens?: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options = [],\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n renderHighlightedAriaLive,\n selectedOptions = [],\n deselectAriaLabel,\n keepOpen = true,\n tokenLimit,\n i18nStrings,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n inlineTokens = false,\n hideTokens = false,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef = null,\n autoFocus,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n checkOptionValueField('Multiselect', 'options', options);\n\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const i18n = useInternalI18n('multiselect');\n\n const i18nCommon = useInternalI18n('select');\n const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);\n const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const [filteringValue, setFilteringValue] = useState('');\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filtered);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [onChange, selectedOptions, filteredOptions]\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const multiSelectAriaLabelId = useUniqueId('multiselect-arialabel-');\n\n const footerId = useUniqueId('footer');\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: filteredOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n statusType,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: filteredOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n isFiltered,\n filteringResultsText: filteredText,\n onRecoveryClick: handleRecoveryClick,\n errorIconAriaLabel: errorIconAriaLabel,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerProps={getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={inlineTokens ? 'tokens' : 'placeholder'}\n isOpen={isOpen}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, multiSelectAriaLabelId)}\n />\n );\n\n const menuProps: MenuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(multiSelectAriaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const showTokens = !hideTokens && !inlineTokens && tokens.length > 0;\n const handleTokenDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n const dropdownProps = getDropdownProps();\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyPress={handleNativeSearch}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={\n dropdownProps.dropdownContentRole ? joinStrings(multiSelectAriaLabelId, controlId) : undefined\n }\n ariaDescribedby={\n dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined\n }\n open={isOpen}\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n expandToViewport={expandToViewport}\n stretchBeyondTriggerWidth={true}\n >\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={useInteractiveGroups}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n </Dropdown>\n {showTokens && (\n <InternalTokenGroup\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n onDismiss={handleTokenDismiss}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n readOnly={readOnly}\n />\n )}\n <ScreenreaderOnly id={multiSelectAriaLabelId}>{ariaLabel}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
package/package.json CHANGED
@@ -120,7 +120,7 @@
120
120
  "./internal/base-component/index.js",
121
121
  "./internal/base-component/styles.css.js"
122
122
  ],
123
- "version": "3.0.671",
123
+ "version": "3.0.673",
124
124
  "repository": {
125
125
  "type": "git",
126
126
  "url": "https://github.com/cloudscape-design/components.git"
@@ -45,6 +45,12 @@ export interface RadioGroupProps extends BaseComponentProps, FormFieldControlPro
45
45
  * @deprecated Has no effect.
46
46
  */
47
47
  controlId?: string;
48
+ /**
49
+ * Specifies if the whole group is read-only, which prevents the
50
+ * user from modifying the value, but does not prevent the value from
51
+ * being included in a form submission. A read-only control is still focusable.
52
+ */
53
+ readOnly?: boolean;
48
54
  }
49
55
  export declare namespace RadioGroupProps {
50
56
  interface RadioButtonDefinition {
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/radio-group/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,qBAAqB;IAChF;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAE7D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAEnE;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yBAAiB,eAAe,CAAC;IAC/B,UAAiB,qBAAqB;QACpC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAED,UAAiB,YAAY;QAC3B,KAAK,EAAE,MAAM,CAAC;K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M,CAAC;KACf;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/radio-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface RadioGroupProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specify a custom name for the radio buttons. If not provided, the radio group generates a random name.\n */\n name?: string;\n\n /**\n * Sets the value of the selected radio button.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * Specifies an array of radio buttons to display. Each of these objects have the following properties:\n *\n * - `value` (string) - Sets the value of the radio button. Assigned to the radio group when a user selects the radio button.\n * - `label` (ReactNode) - Specifies a label for the radio button.\n * - `description` (ReactNode) - (Optional) Specifies descriptive text that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the radio button is disabled, which prevents the user from selecting it.\n * - `controlId` (string) - (Optional) Sets the ID of the internal input. You can use it to relate a label element's `for` attribute to this control.\n * In general it's not recommended to set this because the ID is automatically set by the radio group component.\n */\n items?: ReadonlyArray<RadioGroupProps.RadioButtonDefinition>;\n\n /**\n * Adds `aria-label` to the group. If you are using this form element within a form field,\n * don't set this property because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` to the group.\n */\n ariaRequired?: boolean;\n\n /**\n * Adds `aria-controls` attribute to the radio group.\n * If the radio group controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n\n /**\n * Called when the user selects a different radio button. The event `detail` contains the current `value`.\n */\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n\n /**\n * @deprecated Has no effect.\n */\n controlId?: string;\n}\n\nexport namespace RadioGroupProps {\n export interface RadioButtonDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/radio-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface RadioGroupProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specify a custom name for the radio buttons. If not provided, the radio group generates a random name.\n */\n name?: string;\n\n /**\n * Sets the value of the selected radio button.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * Specifies an array of radio buttons to display. Each of these objects have the following properties:\n *\n * - `value` (string) - Sets the value of the radio button. Assigned to the radio group when a user selects the radio button.\n * - `label` (ReactNode) - Specifies a label for the radio button.\n * - `description` (ReactNode) - (Optional) Specifies descriptive text that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the radio button is disabled, which prevents the user from selecting it.\n * - `controlId` (string) - (Optional) Sets the ID of the internal input. You can use it to relate a label element's `for` attribute to this control.\n * In general it's not recommended to set this because the ID is automatically set by the radio group component.\n */\n items?: ReadonlyArray<RadioGroupProps.RadioButtonDefinition>;\n\n /**\n * Adds `aria-label` to the group. If you are using this form element within a form field,\n * don't set this property because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` to the group.\n */\n ariaRequired?: boolean;\n\n /**\n * Adds `aria-controls` attribute to the radio group.\n * If the radio group controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n\n /**\n * Called when the user selects a different radio button. The event `detail` contains the current `value`.\n */\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n\n /**\n * @deprecated Has no effect.\n */\n controlId?: string;\n\n /**\n * Specifies if the whole group is read-only, which prevents the\n * user from modifying the value, but does not prevent the value from\n * being included in a form submission. A read-only control is still focusable.\n */\n readOnly?: boolean;\n}\n\nexport namespace RadioGroupProps {\n export interface RadioButtonDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,QAAA,MAAM,kBAAkB,+HAmDvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,QAAA,MAAM,kBAAkB,+HAsDvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -10,13 +10,13 @@ import { useFormFieldContext } from '../internal/context/form-field-context';
10
10
  import { useUniqueId } from '../internal/hooks/use-unique-id';
11
11
  import useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';
12
12
  const InternalRadioGroup = React.forwardRef((_a, ref) => {
13
- var { name, value, items, ariaLabel, ariaRequired, ariaControls, onChange, __internalRootRef = null } = _a, props = __rest(_a, ["name", "value", "items", "ariaLabel", "ariaRequired", "ariaControls", "onChange", "__internalRootRef"]);
13
+ var { name, value, items, ariaLabel, ariaRequired, ariaControls, onChange, readOnly, __internalRootRef = null } = _a, props = __rest(_a, ["name", "value", "items", "ariaLabel", "ariaRequired", "ariaControls", "onChange", "readOnly", "__internalRootRef"]);
14
14
  const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);
15
15
  const baseProps = getBaseProps(props);
16
16
  const generatedName = useUniqueId('awsui-radio-');
17
17
  const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);
18
- return (React.createElement("div", Object.assign({ role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls }, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }), items &&
19
- items.map((item, index) => (React.createElement(RadioButton, { key: item.value, ref: index === radioButtonRefIndex ? radioButtonRef : undefined, checked: item.value === value, name: name || generatedName, value: item.value, label: item.label, description: item.description, disabled: item.disabled, onChange: onChange, controlId: item.controlId })))));
18
+ return (React.createElement("div", Object.assign({ role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls, "aria-readonly": readOnly ? 'true' : undefined }, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }), items &&
19
+ items.map((item, index) => (React.createElement(RadioButton, { key: item.value, ref: index === radioButtonRefIndex ? radioButtonRef : undefined, checked: item.value === value, name: name || generatedName, value: item.value, label: item.label, description: item.description, disabled: item.disabled, onChange: onChange, controlId: item.controlId, readOnly: readOnly })))));
20
20
  });
21
21
  export default InternalRadioGroup;
22
22
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.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,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACzB,oBAAC,WAAW,IACV,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,GAAG,EAAE,KAAK,KAAK,mBAAmB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAC/D,OAAO,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK,EAC7B,IAAI,EAAE,IAAI,IAAI,aAAa,EAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,IAAI,CAAC,SAAS,GACzB,CACH,CAAC,CACA,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { RadioGroupProps } from './interfaces';\nimport RadioButton from './radio-button';\nimport styles from './styles.css.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\n\ntype InternalRadioGroupProps = RadioGroupProps & InternalBaseComponentProps;\n\nconst InternalRadioGroup = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n onChange,\n __internalRootRef = null,\n ...props\n }: InternalRadioGroupProps,\n ref: React.Ref<RadioGroupProps.Ref>\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);\n const baseProps = getBaseProps(props);\n const generatedName = useUniqueId('awsui-radio-');\n\n const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n >\n {items &&\n items.map((item, index) => (\n <RadioButton\n key={item.value}\n ref={index === radioButtonRefIndex ? radioButtonRef : undefined}\n checked={item.value === value}\n name={name || generatedName}\n value={item.value}\n label={item.label}\n description={item.description}\n disabled={item.disabled}\n onChange={onChange}\n controlId={item.controlId}\n />\n ))}\n </div>\n );\n }\n);\n\nexport default InternalRadioGroup;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,yBAAyB,MAAM,6CAA6C,CAAC;AAIpF,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,CACE,EAW0B,EAC1B,GAAmC,EACnC,EAAE;QAbF,EACE,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,iBAAiB,GAAG,IAAI,OAEA,EADrB,KAAK,cAVV,oHAWC,CADS;IAIV,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IAElD,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC,GAAG,yBAAyB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAE3F,OAAO,CACL,2CACE,IAAI,EAAC,YAAY,qBACA,cAAc,gBACnB,SAAS,sBACH,eAAe,mBAClB,YAAY,mBACZ,YAAY,mBACZ,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IACxC,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,EACjD,GAAG,EAAE,iBAAiB,KAErB,KAAK;QACJ,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACzB,oBAAC,WAAW,IACV,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,GAAG,EAAE,KAAK,KAAK,mBAAmB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAC/D,OAAO,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK,EAC7B,IAAI,EAAE,IAAI,IAAI,aAAa,EAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CACA,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { RadioGroupProps } from './interfaces';\nimport RadioButton from './radio-button';\nimport styles from './styles.css.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\n\ntype InternalRadioGroupProps = RadioGroupProps & InternalBaseComponentProps;\n\nconst InternalRadioGroup = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n onChange,\n readOnly,\n __internalRootRef = null,\n ...props\n }: InternalRadioGroupProps,\n ref: React.Ref<RadioGroupProps.Ref>\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);\n const baseProps = getBaseProps(props);\n const generatedName = useUniqueId('awsui-radio-');\n\n const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n aria-readonly={readOnly ? 'true' : undefined}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n >\n {items &&\n items.map((item, index) => (\n <RadioButton\n key={item.value}\n ref={index === radioButtonRefIndex ? radioButtonRef : undefined}\n checked={item.value === value}\n name={name || generatedName}\n value={item.value}\n label={item.label}\n description={item.description}\n disabled={item.disabled}\n onChange={onChange}\n controlId={item.controlId}\n readOnly={readOnly}\n />\n ))}\n </div>\n );\n }\n);\n\nexport default InternalRadioGroup;\n"]}
@@ -5,6 +5,7 @@ interface RadioButtonProps extends RadioGroupProps.RadioButtonDefinition {
5
5
  name: string;
6
6
  checked: boolean;
7
7
  onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;
8
+ readOnly?: boolean;
8
9
  }
9
10
  declare const _default: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
10
11
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"radio-button.d.ts","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,UAAU,gBAAiB,SAAQ,eAAe,CAAC,qBAAqB;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;CACpE;;AAED,wBA8DG"}
1
+ {"version":3,"file":"radio-button.d.ts","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,UAAU,gBAAiB,SAAQ,eAAe,CAAC,qBAAqB;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;;AAED,wBAoEG"}
@@ -8,12 +8,12 @@ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
8
8
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
9
9
  import styles from './styles.css.js';
10
10
  import { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';
11
- export default React.forwardRef(function RadioButton({ name, label, value, checked, description, disabled, controlId, onChange }, ref) {
11
+ export default React.forwardRef(function RadioButton({ name, label, value, checked, description, disabled, controlId, onChange, readOnly }, ref) {
12
12
  const isVisualRefresh = useVisualRefresh();
13
13
  const radioButtonRef = useRef(null);
14
14
  const mergedRefs = useMergeRefs(radioButtonRef, ref);
15
15
  const { tabIndex } = useSingleTabStopNavigation(radioButtonRef);
16
- return (React.createElement(AbstractSwitch, { className: clsx(styles.radio, description && styles['radio--has-description']), controlClassName: styles['radio-control'], outlineClassName: styles.outline, label: label, description: description, disabled: disabled, controlId: controlId, nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { tabIndex: tabIndex, type: "radio", ref: mergedRefs, name: name, value: value, checked: checked,
16
+ return (React.createElement(AbstractSwitch, { className: clsx(styles.radio, description && styles['radio--has-description']), controlClassName: styles['radio-control'], outlineClassName: styles.outline, label: label, description: description, disabled: disabled, readOnly: readOnly, controlId: controlId, nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { tabIndex: tabIndex, type: "radio", ref: mergedRefs, name: name, value: value, checked: checked, "aria-disabled": readOnly && !disabled ? 'true' : undefined,
17
17
  // empty handler to suppress React controllability warning
18
18
  onChange: () => { } }))), onClick: () => {
19
19
  var _a;
@@ -23,10 +23,14 @@ export default React.forwardRef(function RadioButton({ name, label, value, check
23
23
  }
24
24
  fireNonCancelableEvent(onChange, { value });
25
25
  }, styledControl: React.createElement("svg", { viewBox: "0 0 100 100", focusable: "false", "aria-hidden": "true" },
26
- React.createElement("circle", { className: clsx(styles['styled-circle-border'], { [styles['styled-circle-disabled']]: disabled }), strokeWidth: isVisualRefresh ? 12 : 8, cx: 50, cy: 50, r: isVisualRefresh ? 44 : 46 }),
26
+ React.createElement("circle", { className: clsx(styles['styled-circle-border'], {
27
+ [styles['styled-circle-disabled']]: disabled,
28
+ [styles['styled-circle-readonly']]: readOnly,
29
+ }), strokeWidth: isVisualRefresh ? 12 : 8, cx: 50, cy: 50, r: isVisualRefresh ? 44 : 46 }),
27
30
  React.createElement("circle", { className: clsx(styles['styled-circle-fill'], {
28
31
  [styles['styled-circle-disabled']]: disabled,
29
32
  [styles['styled-circle-checked']]: checked,
33
+ [styles['styled-circle-readonly']]: readOnly,
30
34
  }), strokeWidth: 30, cx: 50, cy: 50, r: 35 })) }));
31
35
  });
32
36
  //# sourceMappingURL=radio-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-button.js","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AAQpG,eAAe,KAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAClD,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAoB,EAC7F,GAAgC;IAEhC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IAErD,MAAM,EAAE,QAAQ,EAAE,GAAG,0BAA0B,CAAC,cAAc,CAAC,CAAC;IAEhE,OAAO,CACL,oBAAC,cAAc,IACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAC9E,gBAAgB,EAA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C,EAAE,OAAO;iBAC3C,CAAC,EACF,WAAW,EAAE,EAAE,EACf,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,CAAC,EAAE,EAAE,GACL,CACE,GAER,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { RadioGroupProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\n\ninterface RadioButtonProps extends RadioGroupProps.RadioButtonDefinition {\n name: string;\n checked: boolean;\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n}\n\nexport default React.forwardRef(function RadioButton(\n { name, label, value, checked, description, disabled, controlId, onChange }: RadioButtonProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const isVisualRefresh = useVisualRefresh();\n const radioButtonRef = useRef<HTMLInputElement>(null);\n const mergedRefs = useMergeRefs(radioButtonRef, ref);\n\n const { tabIndex } = useSingleTabStopNavigation(radioButtonRef);\n\n return (\n <AbstractSwitch\n className={clsx(styles.radio, description && styles['radio--has-description'])}\n controlClassName={styles['radio-control']}\n outlineClassName={styles.outline}\n label={label}\n description={description}\n disabled={disabled}\n controlId={controlId}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n tabIndex={tabIndex}\n type=\"radio\"\n ref={mergedRefs}\n name={name}\n value={value}\n checked={checked}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n radioButtonRef.current?.focus();\n if (checked) {\n return;\n }\n fireNonCancelableEvent(onChange, { value });\n }}\n styledControl={\n <svg viewBox=\"0 0 100 100\" focusable=\"false\" aria-hidden=\"true\">\n <circle\n className={clsx(styles['styled-circle-border'], { [styles['styled-circle-disabled']]: disabled })}\n strokeWidth={isVisualRefresh ? 12 : 8}\n cx={50}\n cy={50}\n r={isVisualRefresh ? 44 : 46}\n />\n <circle\n className={clsx(styles['styled-circle-fill'], {\n [styles['styled-circle-disabled']]: disabled,\n [styles['styled-circle-checked']]: checked,\n })}\n strokeWidth={30}\n cx={50}\n cy={50}\n r={35}\n />\n </svg>\n }\n />\n );\n});\n"]}
1
+ {"version":3,"file":"radio-button.js","sourceRoot":"","sources":["../../../src/radio-group/radio-button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AASpG,eAAe,KAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAClD,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAoB,EACvG,GAAgC;IAEhC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IAErD,MAAM,EAAE,QAAQ,EAAE,GAAG,0BAA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,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EACrC,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAC5B;YACF,gCACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE;oBAC5C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;oBAC5C,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,OAAO;oBAC1C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;iBAC7C,CAAC,EACF,WAAW,EAAE,EAAE,EACf,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,CAAC,EAAE,EAAE,GACL,CACE,GAER,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { RadioGroupProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\n\ninterface RadioButtonProps extends RadioGroupProps.RadioButtonDefinition {\n name: string;\n checked: boolean;\n onChange?: NonCancelableEventHandler<RadioGroupProps.ChangeDetail>;\n readOnly?: boolean;\n}\n\nexport default React.forwardRef(function RadioButton(\n { name, label, value, checked, description, disabled, controlId, onChange, readOnly }: RadioButtonProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const isVisualRefresh = useVisualRefresh();\n const radioButtonRef = useRef<HTMLInputElement>(null);\n const mergedRefs = useMergeRefs(radioButtonRef, ref);\n\n const { tabIndex } = useSingleTabStopNavigation(radioButtonRef);\n\n return (\n <AbstractSwitch\n className={clsx(styles.radio, description && styles['radio--has-description'])}\n controlClassName={styles['radio-control']}\n outlineClassName={styles.outline}\n label={label}\n description={description}\n disabled={disabled}\n readOnly={readOnly}\n controlId={controlId}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n tabIndex={tabIndex}\n type=\"radio\"\n ref={mergedRefs}\n name={name}\n value={value}\n checked={checked}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n radioButtonRef.current?.focus();\n if (checked) {\n return;\n }\n fireNonCancelableEvent(onChange, { value });\n }}\n styledControl={\n <svg viewBox=\"0 0 100 100\" focusable=\"false\" aria-hidden=\"true\">\n <circle\n className={clsx(styles['styled-circle-border'], {\n [styles['styled-circle-disabled']]: disabled,\n [styles['styled-circle-readonly']]: readOnly,\n })}\n strokeWidth={isVisualRefresh ? 12 : 8}\n cx={50}\n cy={50}\n r={isVisualRefresh ? 44 : 46}\n />\n <circle\n className={clsx(styles['styled-circle-fill'], {\n [styles['styled-circle-disabled']]: disabled,\n [styles['styled-circle-checked']]: checked,\n [styles['styled-circle-readonly']]: readOnly,\n })}\n strokeWidth={30}\n cx={50}\n cy={50}\n r={35}\n />\n </svg>\n }\n />\n );\n});\n"]}
@@ -1,14 +1,15 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_1mabk_rbbno_97",
5
- "radio": "awsui_radio_1mabk_rbbno_133",
6
- "radio--has-description": "awsui_radio--has-description_1mabk_rbbno_141",
7
- "radio-control": "awsui_radio-control_1mabk_rbbno_145",
8
- "outline": "awsui_outline_1mabk_rbbno_153",
9
- "styled-circle-border": "awsui_styled-circle-border_1mabk_rbbno_175",
10
- "styled-circle-disabled": "awsui_styled-circle-disabled_1mabk_rbbno_179",
11
- "styled-circle-fill": "awsui_styled-circle-fill_1mabk_rbbno_184",
12
- "styled-circle-checked": "awsui_styled-circle-checked_1mabk_rbbno_190"
4
+ "root": "awsui_root_1mabk_fodq7_97",
5
+ "radio": "awsui_radio_1mabk_fodq7_133",
6
+ "radio--has-description": "awsui_radio--has-description_1mabk_fodq7_141",
7
+ "radio-control": "awsui_radio-control_1mabk_fodq7_145",
8
+ "outline": "awsui_outline_1mabk_fodq7_153",
9
+ "styled-circle-border": "awsui_styled-circle-border_1mabk_fodq7_175",
10
+ "styled-circle-disabled": "awsui_styled-circle-disabled_1mabk_fodq7_179",
11
+ "styled-circle-readonly": "awsui_styled-circle-readonly_1mabk_fodq7_179",
12
+ "styled-circle-fill": "awsui_styled-circle-fill_1mabk_fodq7_184",
13
+ "styled-circle-checked": "awsui_styled-circle-checked_1mabk_fodq7_190"
13
14
  };
14
15