@cloudscape-design/components 3.0.681 → 3.0.683

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 (192) hide show
  1. package/button/index.d.ts.map +1 -1
  2. package/button/index.js +2 -2
  3. package/button/index.js.map +1 -1
  4. package/button/interfaces.d.ts +6 -0
  5. package/button/interfaces.d.ts.map +1 -1
  6. package/button/interfaces.js.map +1 -1
  7. package/button/internal.d.ts.map +1 -1
  8. package/button/internal.js +15 -4
  9. package/button/internal.js.map +1 -1
  10. package/button/styles.css.js +20 -19
  11. package/button/styles.scoped.css +161 -167
  12. package/button/styles.selectors.js +20 -19
  13. package/button/test-classes/styles.css.js +6 -0
  14. package/button/test-classes/styles.scoped.css +7 -0
  15. package/button/test-classes/styles.selectors.js +7 -0
  16. package/button-dropdown/category-elements/expandable-category-element.js +1 -1
  17. package/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
  18. package/button-dropdown/category-elements/mobile-expandable-category-element.js +1 -1
  19. package/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
  20. package/button-dropdown/index.d.ts.map +1 -1
  21. package/button-dropdown/index.js +2 -2
  22. package/button-dropdown/index.js.map +1 -1
  23. package/button-dropdown/interfaces.d.ts +7 -0
  24. package/button-dropdown/interfaces.d.ts.map +1 -1
  25. package/button-dropdown/interfaces.js.map +1 -1
  26. package/button-dropdown/internal.d.ts.map +1 -1
  27. package/button-dropdown/internal.js +4 -2
  28. package/button-dropdown/internal.js.map +1 -1
  29. package/button-dropdown/item-element/index.js +1 -1
  30. package/button-dropdown/item-element/index.js.map +1 -1
  31. package/calendar/grid/index.d.ts +3 -1
  32. package/calendar/grid/index.d.ts.map +1 -1
  33. package/calendar/grid/index.js +26 -6
  34. package/calendar/grid/index.js.map +1 -1
  35. package/calendar/grid/use-calendar-grid-keyboard-navigation.d.ts +2 -1
  36. package/calendar/grid/use-calendar-grid-keyboard-navigation.d.ts.map +1 -1
  37. package/calendar/grid/use-calendar-grid-keyboard-navigation.js +8 -5
  38. package/calendar/grid/use-calendar-grid-keyboard-navigation.js.map +1 -1
  39. package/calendar/interfaces.d.ts +9 -0
  40. package/calendar/interfaces.d.ts.map +1 -1
  41. package/calendar/interfaces.js.map +1 -1
  42. package/calendar/internal.d.ts +1 -1
  43. package/calendar/internal.d.ts.map +1 -1
  44. package/calendar/internal.js +7 -5
  45. package/calendar/internal.js.map +1 -1
  46. package/calendar/styles.css.js +21 -20
  47. package/calendar/styles.scoped.css +46 -42
  48. package/calendar/styles.selectors.js +21 -20
  49. package/calendar/utils/navigation.d.ts +10 -10
  50. package/calendar/utils/navigation.d.ts.map +1 -1
  51. package/calendar/utils/navigation.js +29 -29
  52. package/calendar/utils/navigation.js.map +1 -1
  53. package/date-picker/index.d.ts.map +1 -1
  54. package/date-picker/index.js +2 -2
  55. package/date-picker/index.js.map +1 -1
  56. package/date-range-picker/calendar/grids/grid.d.ts +2 -1
  57. package/date-range-picker/calendar/grids/grid.d.ts.map +1 -1
  58. package/date-range-picker/calendar/grids/grid.js +55 -7
  59. package/date-range-picker/calendar/grids/grid.js.map +1 -1
  60. package/date-range-picker/calendar/grids/index.d.ts +2 -1
  61. package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
  62. package/date-range-picker/calendar/grids/index.js +20 -12
  63. package/date-range-picker/calendar/grids/index.js.map +1 -1
  64. package/date-range-picker/calendar/grids/styles.css.js +28 -27
  65. package/date-range-picker/calendar/grids/styles.scoped.css +46 -42
  66. package/date-range-picker/calendar/grids/styles.selectors.js +28 -27
  67. package/date-range-picker/calendar/index.d.ts +2 -1
  68. package/date-range-picker/calendar/index.d.ts.map +1 -1
  69. package/date-range-picker/calendar/index.js +2 -2
  70. package/date-range-picker/calendar/index.js.map +1 -1
  71. package/date-range-picker/dropdown.d.ts +2 -2
  72. package/date-range-picker/dropdown.d.ts.map +1 -1
  73. package/date-range-picker/dropdown.js +2 -2
  74. package/date-range-picker/dropdown.js.map +1 -1
  75. package/date-range-picker/index.d.ts.map +1 -1
  76. package/date-range-picker/index.js +2 -2
  77. package/date-range-picker/index.js.map +1 -1
  78. package/date-range-picker/interfaces.d.ts +9 -0
  79. package/date-range-picker/interfaces.d.ts.map +1 -1
  80. package/date-range-picker/interfaces.js.map +1 -1
  81. package/internal/base-component/styles.scoped.css +12 -10
  82. package/internal/components/option/interfaces.d.ts +2 -0
  83. package/internal/components/option/interfaces.d.ts.map +1 -1
  84. package/internal/components/option/interfaces.js.map +1 -1
  85. package/internal/components/selectable-item/index.d.ts +1 -0
  86. package/internal/components/selectable-item/index.d.ts.map +1 -1
  87. package/internal/components/selectable-item/index.js +3 -0
  88. package/internal/components/selectable-item/index.js.map +1 -1
  89. package/internal/components/tooltip/index.d.ts +5 -2
  90. package/internal/components/tooltip/index.d.ts.map +1 -1
  91. package/internal/components/tooltip/index.js +6 -3
  92. package/internal/components/tooltip/index.js.map +1 -1
  93. package/internal/environment.js +1 -1
  94. package/internal/environment.json +1 -1
  95. package/internal/generated/styles/tokens.d.ts +2 -0
  96. package/internal/generated/styles/tokens.js +4 -2
  97. package/internal/generated/theming/index.cjs +78 -12
  98. package/internal/generated/theming/index.cjs.d.ts +16 -0
  99. package/internal/generated/theming/index.d.ts +16 -0
  100. package/internal/generated/theming/index.js +78 -12
  101. package/{button-dropdown/utils/use-hidden-description.d.ts → internal/hooks/use-hidden-description/index.d.ts} +2 -1
  102. package/internal/hooks/use-hidden-description/index.d.ts.map +1 -0
  103. package/{button-dropdown/utils/use-hidden-description.js → internal/hooks/use-hidden-description/index.js} +3 -2
  104. package/internal/hooks/use-hidden-description/index.js.map +1 -0
  105. package/internal/manifest.json +1 -1
  106. package/package.json +1 -1
  107. package/segmented-control/interfaces.d.ts +2 -0
  108. package/segmented-control/interfaces.d.ts.map +1 -1
  109. package/segmented-control/interfaces.js.map +1 -1
  110. package/segmented-control/internal-segmented-control.d.ts.map +1 -1
  111. package/segmented-control/internal-segmented-control.js +11 -8
  112. package/segmented-control/internal-segmented-control.js.map +1 -1
  113. package/segmented-control/segment.d.ts.map +1 -1
  114. package/segmented-control/segment.js +14 -4
  115. package/segmented-control/segment.js.map +1 -1
  116. package/segmented-control/styles.css.js +15 -14
  117. package/segmented-control/styles.scoped.css +37 -33
  118. package/segmented-control/styles.selectors.js +15 -14
  119. package/select/interfaces.d.ts +1 -0
  120. package/select/interfaces.d.ts.map +1 -1
  121. package/select/interfaces.js.map +1 -1
  122. package/select/parts/filter.d.ts +1 -1
  123. package/select/parts/item.d.ts.map +1 -1
  124. package/select/parts/item.js +13 -3
  125. package/select/parts/item.js.map +1 -1
  126. package/select/parts/multiselect-item.d.ts.map +1 -1
  127. package/select/parts/multiselect-item.js +15 -3
  128. package/select/parts/multiselect-item.js.map +1 -1
  129. package/select/parts/styles.css.js +17 -16
  130. package/select/parts/styles.scoped.css +21 -17
  131. package/select/parts/styles.selectors.js +17 -16
  132. package/split-panel/icons/styles.css.js +22 -22
  133. package/split-panel/icons/styles.scoped.css +25 -25
  134. package/split-panel/icons/styles.selectors.js +22 -22
  135. package/table/body-cell/disabled-inline-editor.js +1 -1
  136. package/table/body-cell/disabled-inline-editor.js.map +1 -1
  137. package/tabs/interfaces.d.ts +5 -0
  138. package/tabs/interfaces.d.ts.map +1 -1
  139. package/tabs/interfaces.js.map +1 -1
  140. package/tabs/styles.css.js +28 -25
  141. package/tabs/styles.scoped.css +60 -49
  142. package/tabs/styles.selectors.js +28 -25
  143. package/tabs/tab-header-bar.d.ts.map +1 -1
  144. package/tabs/tab-header-bar.js +38 -14
  145. package/tabs/tab-header-bar.js.map +1 -1
  146. package/test-utils/dom/button/index.d.ts +1 -0
  147. package/test-utils/dom/button/index.js +6 -2
  148. package/test-utils/dom/button/index.js.map +1 -1
  149. package/test-utils/dom/button-dropdown/index.d.ts +2 -1
  150. package/test-utils/dom/button-dropdown/index.js +5 -1
  151. package/test-utils/dom/button-dropdown/index.js.map +1 -1
  152. package/test-utils/dom/calendar/index.d.ts +4 -1
  153. package/test-utils/dom/calendar/index.js +8 -1
  154. package/test-utils/dom/calendar/index.js.map +1 -1
  155. package/test-utils/dom/date-range-picker/index.d.ts +4 -1
  156. package/test-utils/dom/date-range-picker/index.js +8 -2
  157. package/test-utils/dom/date-range-picker/index.js.map +1 -1
  158. package/test-utils/dom/internal/dropdown-host.js.map +1 -1
  159. package/test-utils/dom/internal/option.d.ts +1 -0
  160. package/test-utils/dom/internal/option.js +4 -0
  161. package/test-utils/dom/internal/option.js.map +1 -1
  162. package/test-utils/dom/segmented-control/index.d.ts +9 -0
  163. package/test-utils/dom/segmented-control/index.js +15 -0
  164. package/test-utils/dom/segmented-control/index.js.map +1 -1
  165. package/test-utils/dom/tabs/index.d.ts +9 -2
  166. package/test-utils/dom/tabs/index.js +15 -2
  167. package/test-utils/dom/tabs/index.js.map +1 -1
  168. package/test-utils/selectors/button/index.d.ts +1 -0
  169. package/test-utils/selectors/button/index.js +6 -2
  170. package/test-utils/selectors/button/index.js.map +1 -1
  171. package/test-utils/selectors/button-dropdown/index.d.ts +2 -1
  172. package/test-utils/selectors/button-dropdown/index.js +5 -1
  173. package/test-utils/selectors/button-dropdown/index.js.map +1 -1
  174. package/test-utils/selectors/calendar/index.d.ts +4 -1
  175. package/test-utils/selectors/calendar/index.js +8 -1
  176. package/test-utils/selectors/calendar/index.js.map +1 -1
  177. package/test-utils/selectors/date-range-picker/index.d.ts +4 -1
  178. package/test-utils/selectors/date-range-picker/index.js +8 -2
  179. package/test-utils/selectors/date-range-picker/index.js.map +1 -1
  180. package/test-utils/selectors/internal/dropdown-host.js.map +1 -1
  181. package/test-utils/selectors/internal/option.d.ts +1 -0
  182. package/test-utils/selectors/internal/option.js +4 -0
  183. package/test-utils/selectors/internal/option.js.map +1 -1
  184. package/test-utils/selectors/segmented-control/index.d.ts +9 -0
  185. package/test-utils/selectors/segmented-control/index.js +15 -0
  186. package/test-utils/selectors/segmented-control/index.js.map +1 -1
  187. package/test-utils/selectors/tabs/index.d.ts +9 -2
  188. package/test-utils/selectors/tabs/index.js +15 -2
  189. package/test-utils/selectors/tabs/index.js.map +1 -1
  190. package/test-utils/tsconfig.tsbuildinfo +1 -1
  191. package/button-dropdown/utils/use-hidden-description.d.ts.map +0 -1
  192. package/button-dropdown/utils/use-hidden-description.js.map +0 -1
@@ -783,7 +783,7 @@ export var preset = {
783
783
  },
784
784
  "colorBackgroundButtonPrimaryDisabled": {
785
785
  "light": "{colorGrey200}",
786
- "dark": "{colorGrey650}"
786
+ "dark": "{colorGrey700}"
787
787
  },
788
788
  "colorBackgroundButtonPrimaryHover": {
789
789
  "light": "{colorBorderButtonNormalHover}",
@@ -1073,6 +1073,10 @@ export var preset = {
1073
1073
  "light": "{colorGrey400}",
1074
1074
  "dark": "{colorGrey550}"
1075
1075
  },
1076
+ "colorTextButtonNormalDisabled": {
1077
+ "light": "{colorGrey500}",
1078
+ "dark": "{colorGrey500}"
1079
+ },
1076
1080
  "colorBorderButtonNormalHover": {
1077
1081
  "light": "{colorBlue800}",
1078
1082
  "dark": "{colorBlue400}"
@@ -1081,6 +1085,10 @@ export var preset = {
1081
1085
  "light": "{colorBackgroundButtonPrimaryDisabled}",
1082
1086
  "dark": "{colorBackgroundButtonPrimaryDisabled}"
1083
1087
  },
1088
+ "colorTextButtonPrimaryDisabled": {
1089
+ "light": "{colorGrey500}",
1090
+ "dark": "{colorGrey500}"
1091
+ },
1084
1092
  "colorBorderCalendarGrid": {
1085
1093
  "light": "transparent",
1086
1094
  "dark": "transparent"
@@ -2932,8 +2940,8 @@ export var preset = {
2932
2940
  "dark": "{colorBorderButtonNormalDefault}"
2933
2941
  },
2934
2942
  "colorBackgroundButtonPrimaryDisabled": {
2935
- "light": "{colorGrey650}",
2936
- "dark": "{colorGrey650}"
2943
+ "light": "{colorGrey700}",
2944
+ "dark": "{colorGrey700}"
2937
2945
  },
2938
2946
  "colorBackgroundButtonPrimaryHover": {
2939
2947
  "light": "{colorBorderButtonNormalHover}",
@@ -3223,6 +3231,10 @@ export var preset = {
3223
3231
  "light": "{colorGrey550}",
3224
3232
  "dark": "{colorGrey550}"
3225
3233
  },
3234
+ "colorTextButtonNormalDisabled": {
3235
+ "light": "{colorGrey500}",
3236
+ "dark": "{colorGrey500}"
3237
+ },
3226
3238
  "colorBorderButtonNormalHover": {
3227
3239
  "light": "{colorBlue400}",
3228
3240
  "dark": "{colorBlue400}"
@@ -3231,6 +3243,10 @@ export var preset = {
3231
3243
  "light": "{colorBackgroundButtonPrimaryDisabled}",
3232
3244
  "dark": "{colorBackgroundButtonPrimaryDisabled}"
3233
3245
  },
3246
+ "colorTextButtonPrimaryDisabled": {
3247
+ "light": "{colorGrey500}",
3248
+ "dark": "{colorGrey500}"
3249
+ },
3234
3250
  "colorBorderCalendarGrid": {
3235
3251
  "light": "transparent",
3236
3252
  "dark": "transparent"
@@ -4002,8 +4018,8 @@ export var preset = {
4002
4018
  "dark": "{colorBorderButtonNormalDefault}"
4003
4019
  },
4004
4020
  "colorBackgroundButtonPrimaryDisabled": {
4005
- "light": "{colorGrey650}",
4006
- "dark": "{colorGrey650}"
4021
+ "light": "{colorGrey700}",
4022
+ "dark": "{colorGrey700}"
4007
4023
  },
4008
4024
  "colorBackgroundButtonPrimaryHover": {
4009
4025
  "light": "{colorBorderButtonNormalHover}",
@@ -4293,6 +4309,10 @@ export var preset = {
4293
4309
  "light": "{colorGrey550}",
4294
4310
  "dark": "{colorGrey550}"
4295
4311
  },
4312
+ "colorTextButtonNormalDisabled": {
4313
+ "light": "{colorGrey500}",
4314
+ "dark": "{colorGrey500}"
4315
+ },
4296
4316
  "colorBorderButtonNormalHover": {
4297
4317
  "light": "{colorBlue400}",
4298
4318
  "dark": "{colorBlue400}"
@@ -4301,6 +4321,10 @@ export var preset = {
4301
4321
  "light": "{colorBackgroundButtonPrimaryDisabled}",
4302
4322
  "dark": "{colorBackgroundButtonPrimaryDisabled}"
4303
4323
  },
4324
+ "colorTextButtonPrimaryDisabled": {
4325
+ "light": "{colorGrey500}",
4326
+ "dark": "{colorGrey500}"
4327
+ },
4304
4328
  "colorBorderCalendarGrid": {
4305
4329
  "light": "transparent",
4306
4330
  "dark": "transparent"
@@ -5005,7 +5029,7 @@ export var preset = {
5005
5029
  },
5006
5030
  "colorBackgroundButtonPrimaryDisabled": {
5007
5031
  "light": "{colorGrey200}",
5008
- "dark": "{colorGrey650}"
5032
+ "dark": "{colorGrey700}"
5009
5033
  },
5010
5034
  "colorBackgroundButtonPrimaryHover": {
5011
5035
  "light": "{colorBorderButtonNormalHover}",
@@ -5295,6 +5319,10 @@ export var preset = {
5295
5319
  "light": "{colorGrey400}",
5296
5320
  "dark": "{colorGrey550}"
5297
5321
  },
5322
+ "colorTextButtonNormalDisabled": {
5323
+ "light": "{colorGrey500}",
5324
+ "dark": "{colorGrey500}"
5325
+ },
5298
5326
  "colorBorderButtonNormalHover": {
5299
5327
  "light": "{colorWhite}",
5300
5328
  "dark": "{colorWhite}"
@@ -5303,6 +5331,10 @@ export var preset = {
5303
5331
  "light": "{colorBackgroundButtonPrimaryDisabled}",
5304
5332
  "dark": "{colorBackgroundButtonPrimaryDisabled}"
5305
5333
  },
5334
+ "colorTextButtonPrimaryDisabled": {
5335
+ "light": "{colorGrey500}",
5336
+ "dark": "{colorGrey500}"
5337
+ },
5306
5338
  "colorBorderCalendarGrid": {
5307
5339
  "light": "transparent",
5308
5340
  "dark": "transparent"
@@ -6007,7 +6039,7 @@ export var preset = {
6007
6039
  },
6008
6040
  "colorBackgroundButtonPrimaryDisabled": {
6009
6041
  "light": "{colorGrey200}",
6010
- "dark": "{colorGrey650}"
6042
+ "dark": "{colorGrey700}"
6011
6043
  },
6012
6044
  "colorBackgroundButtonPrimaryHover": {
6013
6045
  "light": "{colorBorderButtonNormalHover}",
@@ -6297,6 +6329,10 @@ export var preset = {
6297
6329
  "light": "{colorGrey400}",
6298
6330
  "dark": "{colorGrey550}"
6299
6331
  },
6332
+ "colorTextButtonNormalDisabled": {
6333
+ "light": "{colorGrey500}",
6334
+ "dark": "{colorGrey500}"
6335
+ },
6300
6336
  "colorBorderButtonNormalHover": {
6301
6337
  "light": "{colorTextButtonNormalHover}",
6302
6338
  "dark": "{colorTextButtonNormalHover}"
@@ -6305,6 +6341,10 @@ export var preset = {
6305
6341
  "light": "{colorBackgroundButtonPrimaryDisabled}",
6306
6342
  "dark": "{colorBackgroundButtonPrimaryDisabled}"
6307
6343
  },
6344
+ "colorTextButtonPrimaryDisabled": {
6345
+ "light": "{colorGrey500}",
6346
+ "dark": "{colorGrey500}"
6347
+ },
6308
6348
  "colorBorderCalendarGrid": {
6309
6349
  "light": "transparent",
6310
6350
  "dark": "transparent"
@@ -7009,7 +7049,7 @@ export var preset = {
7009
7049
  },
7010
7050
  "colorBackgroundButtonPrimaryDisabled": {
7011
7051
  "light": "{colorGrey200}",
7012
- "dark": "{colorGrey650}"
7052
+ "dark": "{colorGrey700}"
7013
7053
  },
7014
7054
  "colorBackgroundButtonPrimaryHover": {
7015
7055
  "light": "{colorBorderButtonNormalHover}",
@@ -7299,6 +7339,10 @@ export var preset = {
7299
7339
  "light": "{colorGrey400}",
7300
7340
  "dark": "{colorGrey550}"
7301
7341
  },
7342
+ "colorTextButtonNormalDisabled": {
7343
+ "light": "{colorGrey500}",
7344
+ "dark": "{colorGrey500}"
7345
+ },
7302
7346
  "colorBorderButtonNormalHover": {
7303
7347
  "light": "{colorTextButtonNormalHover}",
7304
7348
  "dark": "{colorTextButtonNormalHover}"
@@ -7307,6 +7351,10 @@ export var preset = {
7307
7351
  "light": "{colorBackgroundButtonPrimaryDisabled}",
7308
7352
  "dark": "{colorBackgroundButtonPrimaryDisabled}"
7309
7353
  },
7354
+ "colorTextButtonPrimaryDisabled": {
7355
+ "light": "{colorGrey500}",
7356
+ "dark": "{colorGrey500}"
7357
+ },
7310
7358
  "colorBorderCalendarGrid": {
7311
7359
  "light": "transparent",
7312
7360
  "dark": "transparent"
@@ -8012,8 +8060,8 @@ export var preset = {
8012
8060
  "dark": "{colorBorderButtonNormalDefault}"
8013
8061
  },
8014
8062
  "colorBackgroundButtonPrimaryDisabled": {
8015
- "light": "{colorGrey650}",
8016
- "dark": "{colorGrey650}"
8063
+ "light": "{colorGrey700}",
8064
+ "dark": "{colorGrey700}"
8017
8065
  },
8018
8066
  "colorBackgroundButtonPrimaryHover": {
8019
8067
  "light": "{colorBorderButtonNormalHover}",
@@ -8303,6 +8351,10 @@ export var preset = {
8303
8351
  "light": "{colorGrey550}",
8304
8352
  "dark": "{colorGrey550}"
8305
8353
  },
8354
+ "colorTextButtonNormalDisabled": {
8355
+ "light": "{colorGrey500}",
8356
+ "dark": "{colorGrey500}"
8357
+ },
8306
8358
  "colorBorderButtonNormalHover": {
8307
8359
  "light": "{colorTextButtonNormalHover}",
8308
8360
  "dark": "{colorTextButtonNormalHover}"
@@ -8311,6 +8363,10 @@ export var preset = {
8311
8363
  "light": "{colorBackgroundButtonPrimaryDisabled}",
8312
8364
  "dark": "{colorBackgroundButtonPrimaryDisabled}"
8313
8365
  },
8366
+ "colorTextButtonPrimaryDisabled": {
8367
+ "light": "{colorGrey500}",
8368
+ "dark": "{colorGrey500}"
8369
+ },
8314
8370
  "colorBorderCalendarGrid": {
8315
8371
  "light": "transparent",
8316
8372
  "dark": "transparent"
@@ -9184,8 +9240,10 @@ export var preset = {
9184
9240
  "colorBorderButtonNormalActive": "color",
9185
9241
  "colorBorderButtonNormalDefault": "color",
9186
9242
  "colorBorderButtonNormalDisabled": "color",
9243
+ "colorTextButtonNormalDisabled": "color",
9187
9244
  "colorBorderButtonNormalHover": "color",
9188
9245
  "colorBorderButtonPrimaryDisabled": "color",
9246
+ "colorTextButtonPrimaryDisabled": "color",
9189
9247
  "colorBorderCalendarGrid": "color",
9190
9248
  "colorBorderCalendarGridSelectedFocusRing": "color",
9191
9249
  "colorBorderCodeEditorAceActiveLineLightTheme": "color",
@@ -9618,8 +9676,10 @@ export var preset = {
9618
9676
  "colorBorderButtonNormalActive",
9619
9677
  "colorBorderButtonNormalDefault",
9620
9678
  "colorBorderButtonNormalDisabled",
9679
+ "colorTextButtonNormalDisabled",
9621
9680
  "colorBorderButtonNormalHover",
9622
9681
  "colorBorderButtonPrimaryDisabled",
9682
+ "colorTextButtonPrimaryDisabled",
9623
9683
  "colorBorderContainerTop",
9624
9684
  "colorBorderControlDefault",
9625
9685
  "colorBorderDividerDefault",
@@ -9938,8 +9998,10 @@ export var preset = {
9938
9998
  "colorBorderButtonNormalActive",
9939
9999
  "colorBorderButtonNormalDefault",
9940
10000
  "colorBorderButtonNormalDisabled",
10001
+ "colorTextButtonNormalDisabled",
9941
10002
  "colorBorderButtonNormalHover",
9942
10003
  "colorBorderButtonPrimaryDisabled",
10004
+ "colorTextButtonPrimaryDisabled",
9943
10005
  "colorBorderContainerTop",
9944
10006
  "colorBorderControlDefault",
9945
10007
  "colorBorderDividerDefault",
@@ -10389,8 +10451,10 @@ export var preset = {
10389
10451
  "colorBorderButtonNormalActive": "color-border-button-normal-active",
10390
10452
  "colorBorderButtonNormalDefault": "color-border-button-normal-default",
10391
10453
  "colorBorderButtonNormalDisabled": "color-border-button-normal-disabled",
10454
+ "colorTextButtonNormalDisabled": "color-text-button-normal-disabled",
10392
10455
  "colorBorderButtonNormalHover": "color-border-button-normal-hover",
10393
10456
  "colorBorderButtonPrimaryDisabled": "color-border-button-primary-disabled",
10457
+ "colorTextButtonPrimaryDisabled": "color-text-button-primary-disabled",
10394
10458
  "colorBorderCalendarGrid": "color-border-calendar-grid",
10395
10459
  "colorBorderCalendarGridSelectedFocusRing": "color-border-calendar-grid-selected-focus-ring",
10396
10460
  "colorBorderCodeEditorAceActiveLineLightTheme": "color-border-code-editor-ace-active-line-light-theme",
@@ -11026,7 +11090,7 @@ export var preset = {
11026
11090
  "colorBackgroundButtonNormalHover": "--color-background-button-normal-hover-imnrq7",
11027
11091
  "colorBackgroundButtonPrimaryActive": "--color-background-button-primary-active-1ucrg4",
11028
11092
  "colorBackgroundButtonPrimaryDefault": "--color-background-button-primary-default-jrg2xu",
11029
- "colorBackgroundButtonPrimaryDisabled": "--color-background-button-primary-disabled-31l9pn",
11093
+ "colorBackgroundButtonPrimaryDisabled": "--color-background-button-primary-disabled-yblour",
11030
11094
  "colorBackgroundButtonPrimaryHover": "--color-background-button-primary-hover-l3mbyt",
11031
11095
  "colorBackgroundCalendarCurrentDate": "--color-background-calendar-current-date-kmb0ji",
11032
11096
  "colorBackgroundCellShaded": "--color-background-cell-shaded-7v0jy4",
@@ -11099,8 +11163,10 @@ export var preset = {
11099
11163
  "colorBorderButtonNormalActive": "--color-border-button-normal-active-tc4102",
11100
11164
  "colorBorderButtonNormalDefault": "--color-border-button-normal-default-x52rkp",
11101
11165
  "colorBorderButtonNormalDisabled": "--color-border-button-normal-disabled-40wkb4",
11166
+ "colorTextButtonNormalDisabled": "--color-text-button-normal-disabled-h3ul0e",
11102
11167
  "colorBorderButtonNormalHover": "--color-border-button-normal-hover-qs1x3s",
11103
- "colorBorderButtonPrimaryDisabled": "--color-border-button-primary-disabled-q34ikb",
11168
+ "colorBorderButtonPrimaryDisabled": "--color-border-button-primary-disabled-mewj5j",
11169
+ "colorTextButtonPrimaryDisabled": "--color-text-button-primary-disabled-gxu2gk",
11104
11170
  "colorBorderCalendarGrid": "--color-border-calendar-grid-u86q1u",
11105
11171
  "colorBorderCalendarGridSelectedFocusRing": "--color-border-calendar-grid-selected-focus-ring-thqa8y",
11106
11172
  "colorBorderCodeEditorAceActiveLineLightTheme": "--color-border-code-editor-ace-active-line-light-theme-37hmmo",
@@ -4,5 +4,6 @@ export default function useHiddenDescription(description?: string): {
4
4
  'aria-describedby': string | undefined;
5
5
  };
6
6
  descriptionEl: JSX.Element | null;
7
+ descriptionId: string;
7
8
  };
8
- //# sourceMappingURL=use-hidden-description.d.ts.map
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-hidden-description/index.tsx"],"names":[],"mappings":";AAMA,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,WAAW,CAAC,EAAE,MAAM;;;;;;EAahE"}
@@ -1,7 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import React from 'react';
4
- import { useUniqueId } from '../../internal/hooks/use-unique-id';
4
+ import { useUniqueId } from '../use-unique-id';
5
5
  export default function useHiddenDescription(description) {
6
6
  const id = useUniqueId();
7
7
  return {
@@ -9,6 +9,7 @@ export default function useHiddenDescription(description) {
9
9
  'aria-describedby': description ? id : undefined,
10
10
  },
11
11
  descriptionEl: description ? (React.createElement("span", { id: id, hidden: true }, description)) : null,
12
+ descriptionId: id,
12
13
  };
13
14
  }
14
- //# sourceMappingURL=use-hidden-description.js.map
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-hidden-description/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,WAAoB;IAC/D,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,OAAO;QACL,WAAW,EAAE;YACX,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;SACjD;QACD,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,CAC3B,8BAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,IACvB,WAAW,CACP,CACR,CAAC,CAAC,CAAC,IAAI;QACR,aAAa,EAAE,EAAE;KAClB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { useUniqueId } from '../use-unique-id';\n\nexport default function useHiddenDescription(description?: string) {\n const id = useUniqueId();\n return {\n targetProps: {\n 'aria-describedby': description ? id : undefined,\n },\n descriptionEl: description ? (\n <span id={id} hidden={true}>\n {description}\n </span>\n ) : null,\n descriptionId: id,\n };\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "e59783d007b5ad48ab685be61e500234a7d1929f"
2
+ "commit": "1dcf65791464d1c3ed0e0058de49c0f5953e7f23"
3
3
  }
package/package.json CHANGED
@@ -121,7 +121,7 @@
121
121
  "./internal/base-component/index.js",
122
122
  "./internal/base-component/styles.css.js"
123
123
  ],
124
- "version": "3.0.681",
124
+ "version": "3.0.683",
125
125
  "repository": {
126
126
  "type": "git",
127
127
  "url": "https://github.com/cloudscape-design/components.git"
@@ -12,6 +12,7 @@ export interface SegmentedControlProps extends BaseComponentProps {
12
12
  *
13
13
  * - `id` (string) - The ID of the segment.
14
14
  * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.
15
+ * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.
15
16
  * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).
16
17
  * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.
17
18
  * This is required when you use an icon without `text`.
@@ -39,6 +40,7 @@ export declare namespace SegmentedControlProps {
39
40
  interface Option {
40
41
  id: string;
41
42
  disabled?: boolean;
43
+ disabledReason?: string;
42
44
  iconName?: IconProps.Name;
43
45
  iconAlt?: string;
44
46
  iconUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,o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O,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEtD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;CAC1E;AAED,yBAAiB,qBAAqB,CAAC;IACrC,UAAiB,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,YAAY;QAC3B,UAAU,EAAE,MAAM,CAAC;KACpB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { IconProps } from '../icon/interfaces';\nimport React from 'react';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { IconProps } from '../icon/interfaces';\nimport React from 'react';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal-segmented-control.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAIrD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,GACT,EAAE,qBAAqB,eAqEvB"}
1
+ {"version":3,"file":"internal-segmented-control.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAIrD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,GACT,EAAE,qBAAqB,eA4EvB"}
@@ -13,7 +13,7 @@ export default function InternalSegmentedControl({ selectedId, options, label, a
13
13
  return option.id === selectedId;
14
14
  });
15
15
  const currentSelectedOption = selectedOptions.length ? selectedOptions[0] : null;
16
- const enabledSegments = (options || []).filter(option => !option.disabled);
16
+ const focusableSegments = (options || []).filter(option => !option.disabled || (option.disabled && !!option.disabledReason));
17
17
  const moveHighlight = (event, activeIndex) => {
18
18
  var _a;
19
19
  if (event.keyCode !== KeyCode.right && event.keyCode !== KeyCode.left) {
@@ -21,21 +21,21 @@ export default function InternalSegmentedControl({ selectedId, options, label, a
21
21
  }
22
22
  let nextIndex = activeIndex;
23
23
  handleKey(event, {
24
- onInlineStart: () => (nextIndex = activeIndex === 0 ? enabledSegments.length - 1 : activeIndex - 1),
25
- onInlineEnd: () => (nextIndex = activeIndex + 1 === enabledSegments.length ? 0 : activeIndex + 1),
24
+ onInlineStart: () => (nextIndex = activeIndex === 0 ? focusableSegments.length - 1 : activeIndex - 1),
25
+ onInlineEnd: () => (nextIndex = activeIndex + 1 === focusableSegments.length ? 0 : activeIndex + 1),
26
26
  });
27
- const nextSegmentId = enabledSegments[nextIndex].id;
27
+ const nextSegmentId = focusableSegments[nextIndex].id;
28
28
  (_a = segmentByIdRef.current[nextSegmentId]) === null || _a === void 0 ? void 0 : _a.focus();
29
29
  };
30
30
  return (React.createElement("div", { className: clsx(styles['segment-part'], styles[`segment-count-${options === null || options === void 0 ? void 0 : options.length}`]), "aria-label": label, "aria-labelledby": ariaLabelledby, role: "toolbar" }, options &&
31
31
  options.map((option, index) => {
32
32
  const isActive = selectedId === option.id;
33
- const enabledSegmentIndex = enabledSegments.indexOf(option);
33
+ const focusableSegmentIndex = focusableSegments.indexOf(option);
34
34
  let tabIndex = isActive ? 0 : -1;
35
- if (currentSelectedOption === null && enabledSegmentIndex === 0) {
35
+ if (currentSelectedOption === null && focusableSegmentIndex === 0) {
36
36
  tabIndex = 0;
37
37
  }
38
- return (React.createElement(Segment, { key: index, id: option.id, disabled: !!option.disabled, iconName: option.iconName, iconAlt: option.iconAlt, iconUrl: option.iconUrl, iconSvg: option.iconSvg, text: option.text, isActive: isActive, tabIndex: tabIndex, ref: node => {
38
+ return (React.createElement(Segment, { key: index, id: option.id, disabled: !!option.disabled, disabledReason: option.disabledReason, iconName: option.iconName, iconAlt: option.iconAlt, iconUrl: option.iconUrl, iconSvg: option.iconSvg, text: option.text, isActive: isActive, tabIndex: tabIndex, ref: node => {
39
39
  if (node) {
40
40
  segmentByIdRef.current[option.id] = node;
41
41
  }
@@ -43,10 +43,13 @@ export default function InternalSegmentedControl({ selectedId, options, label, a
43
43
  delete segmentByIdRef.current[option.id];
44
44
  }
45
45
  }, onClick: () => {
46
+ if (option.disabled) {
47
+ return;
48
+ }
46
49
  if (selectedId !== option.id) {
47
50
  fireNonCancelableEvent(onChange, { selectedId: option.id });
48
51
  }
49
- }, onKeyDown: event => moveHighlight(event, enabledSegmentIndex) }));
52
+ }, onKeyDown: event => moveHighlight(event, focusableSegmentIndex) }));
50
53
  })));
51
54
  }
52
55
  //# sourceMappingURL=internal-segmented-control.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal-segmented-control.js","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CA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,EAClB,GAAG,EAAE,IAAI,CAAC,EAAE;oBACV,IAAI,IAAI,EAAE;wBACR,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;qBAC1C;yBAAM;wBACL,OAAO,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;qBAC1C;gBACH,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,EAAE;wBAC5B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;qBAC7D;gBACH,CAAC,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,mBAAmB,CAAC,GAC7D,CACH,CAAC;QACJ,CAAC,CAAC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport handleKey from '../internal/utils/handle-key';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { SegmentedControlProps } from './interfaces';\nimport { Segment } from './segment';\nimport styles from './styles.css.js';\n\nexport default function InternalSegmentedControl({\n selectedId,\n options,\n label,\n ariaLabelledby,\n onChange,\n}: SegmentedControlProps) {\n const segmentByIdRef = useRef<{ [id: string]: HTMLButtonElement }>({});\n const selectedOptions = (options || []).filter(option => {\n return option.id === selectedId;\n });\n const currentSelectedOption = selectedOptions.length ? selectedOptions[0] : null;\n const enabledSegments = (options || []).filter(option => !option.disabled);\n\n const moveHighlight = (event: React.KeyboardEvent<HTMLButtonElement>, activeIndex: number) => {\n if (event.keyCode !== KeyCode.right && event.keyCode !== KeyCode.left) {\n return;\n }\n\n let nextIndex = activeIndex;\n\n handleKey(event, {\n onInlineStart: () => (nextIndex = activeIndex === 0 ? enabledSegments.length - 1 : activeIndex - 1),\n onInlineEnd: () => (nextIndex = activeIndex + 1 === enabledSegments.length ? 0 : activeIndex + 1),\n });\n\n const nextSegmentId = enabledSegments[nextIndex].id;\n segmentByIdRef.current[nextSegmentId]?.focus();\n };\n\n return (\n <div\n className={clsx(styles['segment-part'], styles[`segment-count-${options?.length}`])}\n aria-label={label}\n aria-labelledby={ariaLabelledby}\n role=\"toolbar\"\n >\n {options &&\n options.map((option: SegmentedControlProps.Option, index) => {\n const isActive = selectedId === option.id;\n const enabledSegmentIndex = enabledSegments.indexOf(option);\n let tabIndex = isActive ? 0 : -1;\n if (currentSelectedOption === null && enabledSegmentIndex === 0) {\n tabIndex = 0;\n }\n return (\n <Segment\n key={index}\n id={option.id}\n disabled={!!option.disabled}\n iconName={option.iconName}\n iconAlt={option.iconAlt}\n iconUrl={option.iconUrl}\n iconSvg={option.iconSvg}\n text={option.text}\n isActive={isActive}\n tabIndex={tabIndex}\n ref={node => {\n if (node) {\n segmentByIdRef.current[option.id] = node;\n } else {\n delete segmentByIdRef.current[option.id];\n }\n }}\n onClick={() => {\n if (selectedId !== option.id) {\n fireNonCancelableEvent(onChange, { selectedId: option.id });\n }\n }}\n onKeyDown={event => moveHighlight(event, enabledSegmentIndex)}\n />\n );\n })}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal-segmented-control.js","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;A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,EAAE,QAAQ,EAClB,GAAG,EAAE,IAAI,CAAC,EAAE;oBACV,IAAI,IAAI,EAAE;wBACR,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;qBAC1C;yBAAM;wBACL,OAAO,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;qBAC1C;gBACH,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,MAAM,CAAC,QAAQ,EAAE;wBACnB,OAAO;qBACR;oBAED,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,EAAE;wBAC5B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;qBAC7D;gBACH,CAAC,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,qBAAqB,CAAC,GAC/D,CACH,CAAC;QACJ,CAAC,CAAC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport handleKey from '../internal/utils/handle-key';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { SegmentedControlProps } from './interfaces';\nimport { Segment } from './segment';\nimport styles from './styles.css.js';\n\nexport default function InternalSegmentedControl({\n selectedId,\n options,\n label,\n ariaLabelledby,\n onChange,\n}: SegmentedControlProps) {\n const segmentByIdRef = useRef<{ [id: string]: HTMLButtonElement }>({});\n const selectedOptions = (options || []).filter(option => {\n return option.id === selectedId;\n });\n const currentSelectedOption = selectedOptions.length ? selectedOptions[0] : null;\n const focusableSegments = (options || []).filter(\n option => !option.disabled || (option.disabled && !!option.disabledReason)\n );\n\n const moveHighlight = (event: React.KeyboardEvent<HTMLButtonElement>, activeIndex: number) => {\n if (event.keyCode !== KeyCode.right && event.keyCode !== KeyCode.left) {\n return;\n }\n\n let nextIndex = activeIndex;\n\n handleKey(event, {\n onInlineStart: () => (nextIndex = activeIndex === 0 ? focusableSegments.length - 1 : activeIndex - 1),\n onInlineEnd: () => (nextIndex = activeIndex + 1 === focusableSegments.length ? 0 : activeIndex + 1),\n });\n\n const nextSegmentId = focusableSegments[nextIndex].id;\n segmentByIdRef.current[nextSegmentId]?.focus();\n };\n\n return (\n <div\n className={clsx(styles['segment-part'], styles[`segment-count-${options?.length}`])}\n aria-label={label}\n aria-labelledby={ariaLabelledby}\n role=\"toolbar\"\n >\n {options &&\n options.map((option: SegmentedControlProps.Option, index) => {\n const isActive = selectedId === option.id;\n const focusableSegmentIndex = focusableSegments.indexOf(option);\n let tabIndex = isActive ? 0 : -1;\n if (currentSelectedOption === null && focusableSegmentIndex === 0) {\n tabIndex = 0;\n }\n return (\n <Segment\n key={index}\n id={option.id}\n disabled={!!option.disabled}\n disabledReason={option.disabledReason}\n iconName={option.iconName}\n iconAlt={option.iconAlt}\n iconUrl={option.iconUrl}\n iconSvg={option.iconSvg}\n text={option.text}\n isActive={isActive}\n tabIndex={tabIndex}\n ref={node => {\n if (node) {\n segmentByIdRef.current[option.id] = node;\n } else {\n delete segmentByIdRef.current[option.id];\n }\n }}\n onClick={() => {\n if (option.disabled) {\n return;\n }\n\n if (selectedId !== option.id) {\n fireNonCancelableEvent(onChange, { selectedId: option.id });\n }\n }}\n onKeyDown={event => moveHighlight(event, focusableSegmentIndex)}\n />\n );\n })}\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/segment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAIrD,MAAM,WAAW,YAAa,SAAQ,qBAAqB,CAAC,MAAM;IAChE,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9D,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,OAAO,wFA+BnB,CAAC"}
1
+ {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/segment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAOrD,MAAM,WAAW,YAAa,SAAQ,qBAAqB,CAAC,MAAM;IAChE,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9D,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,OAAO,wFAkEnB,CAAC"}
@@ -1,12 +1,22 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import React from 'react';
3
+ import React, { useRef, useState } from 'react';
4
4
  import clsx from 'clsx';
5
5
  import InternalIcon from '../icon/internal';
6
6
  import styles from './styles.css.js';
7
- export const Segment = React.forwardRef(({ disabled, text, iconName, iconAlt, iconUrl, iconSvg, isActive, onClick, onKeyDown, tabIndex }, ref) => {
8
- return (React.createElement("button", { className: clsx(styles.segment, { [styles.disabled]: !!disabled }, { [styles.selected]: isActive }), ref: ref, onClick: onClick, onKeyDown: onKeyDown, disabled: disabled, type: "button", tabIndex: tabIndex, "aria-pressed": isActive ? 'true' : 'false', "aria-label": !text ? iconAlt : undefined },
7
+ import useHiddenDescription from '../internal/hooks/use-hidden-description';
8
+ import Tooltip from '../internal/components/tooltip';
9
+ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
10
+ export const Segment = React.forwardRef(({ disabled, disabledReason, text, iconName, iconAlt, iconUrl, iconSvg, isActive, onClick, onKeyDown, tabIndex, id, }, ref) => {
11
+ const buttonRef = useRef(null);
12
+ const [showTooltip, setShowTooltip] = useState(false);
13
+ const isDisabledWithReason = disabled && !!disabledReason;
14
+ const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);
15
+ return (React.createElement("button", Object.assign({ className: clsx(styles.segment, { [styles.disabled]: !!disabled }, { [styles.selected]: isActive }), ref: useMergeRefs(ref, buttonRef), onClick: onClick, onKeyDown: onKeyDown, disabled: disabled && !disabledReason, "aria-disabled": isDisabledWithReason ? 'true' : undefined, type: "button", tabIndex: tabIndex, "aria-pressed": isActive ? 'true' : 'false', "aria-label": !text ? iconAlt : undefined, onFocus: isDisabledWithReason ? () => setShowTooltip(true) : undefined, onBlur: isDisabledWithReason ? () => setShowTooltip(false) : undefined, onMouseEnter: isDisabledWithReason ? () => setShowTooltip(true) : undefined, onMouseLeave: isDisabledWithReason ? () => setShowTooltip(false) : undefined }, (isDisabledWithReason ? targetProps : {}), { "data-testid": id }),
9
16
  (iconName || iconUrl || iconSvg) && (React.createElement(InternalIcon, { className: clsx(styles.icon, text ? styles['with-text'] : styles['with-no-text']), name: iconName, url: iconUrl, svg: iconSvg, alt: iconAlt, variant: disabled ? 'disabled' : 'normal' })),
10
- React.createElement("span", null, text)));
17
+ React.createElement("span", null, text),
18
+ isDisabledWithReason && (React.createElement(React.Fragment, null,
19
+ descriptionEl,
20
+ showTooltip && (React.createElement(Tooltip, { className: styles['disabled-reason-tooltip'], trackRef: buttonRef, value: disabledReason }))))));
11
21
  });
12
22
  //# sourceMappingURL=segment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"segment.js","sourceRoot":"","sources":["../../../src/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AE,OAAO,EACZ,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,GACzC,CACH;QACD,kCAAO,IAAI,CAAQ,CACZ,CACV,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { SegmentedControlProps } from './interfaces';\nimport InternalIcon from '../icon/internal';\nimport styles from './styles.css.js';\n\nexport interface SegmentProps extends SegmentedControlProps.Option {\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n isActive: boolean;\n tabIndex: number;\n}\n\nexport const Segment = React.forwardRef(\n (\n { disabled, text, iconName, iconAlt, iconUrl, iconSvg, isActive, onClick, onKeyDown, tabIndex }: SegmentProps,\n ref: React.Ref<HTMLButtonElement>\n ) => {\n return (\n <button\n className={clsx(styles.segment, { [styles.disabled]: !!disabled }, { [styles.selected]: isActive })}\n ref={ref}\n onClick={onClick}\n onKeyDown={onKeyDown}\n disabled={disabled}\n type=\"button\"\n tabIndex={tabIndex}\n aria-pressed={isActive ? 'true' : 'false'}\n aria-label={!text ? iconAlt : undefined}\n >\n {(iconName || iconUrl || iconSvg) && (\n <InternalIcon\n className={clsx(styles.icon, text ? styles['with-text'] : styles['with-no-text'])}\n name={iconName}\n url={iconUrl}\n svg={iconSvg}\n alt={iconAlt}\n variant={disabled ? 'disabled' : 'normal'}\n />\n )}\n <span>{text}</span>\n </button>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"segment.js","sourceRoot":"","sources":["../../../src/segmented-control/segment.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,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,CACM,CACV,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { SegmentedControlProps } from './interfaces';\nimport InternalIcon from '../icon/internal';\nimport styles from './styles.css.js';\nimport useHiddenDescription from '../internal/hooks/use-hidden-description';\nimport Tooltip from '../internal/components/tooltip';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nexport interface SegmentProps extends SegmentedControlProps.Option {\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n isActive: boolean;\n tabIndex: number;\n}\n\nexport const Segment = React.forwardRef(\n (\n {\n disabled,\n disabledReason,\n text,\n iconName,\n iconAlt,\n iconUrl,\n iconSvg,\n isActive,\n onClick,\n onKeyDown,\n tabIndex,\n id,\n }: SegmentProps,\n ref: React.Ref<HTMLButtonElement>\n ) => {\n const buttonRef = useRef<HTMLElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const isDisabledWithReason = disabled && !!disabledReason;\n\n const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);\n\n return (\n <button\n className={clsx(styles.segment, { [styles.disabled]: !!disabled }, { [styles.selected]: isActive })}\n ref={useMergeRefs(ref, buttonRef)}\n onClick={onClick}\n onKeyDown={onKeyDown}\n disabled={disabled && !disabledReason}\n aria-disabled={isDisabledWithReason ? 'true' : undefined}\n type=\"button\"\n tabIndex={tabIndex}\n aria-pressed={isActive ? 'true' : 'false'}\n aria-label={!text ? iconAlt : undefined}\n onFocus={isDisabledWithReason ? () => setShowTooltip(true) : undefined}\n onBlur={isDisabledWithReason ? () => setShowTooltip(false) : undefined}\n onMouseEnter={isDisabledWithReason ? () => setShowTooltip(true) : undefined}\n onMouseLeave={isDisabledWithReason ? () => setShowTooltip(false) : undefined}\n {...(isDisabledWithReason ? targetProps : {})}\n data-testid={id}\n >\n {(iconName || iconUrl || iconSvg) && (\n <InternalIcon\n className={clsx(styles.icon, text ? styles['with-text'] : styles['with-no-text'])}\n name={iconName}\n url={iconUrl}\n svg={iconSvg}\n alt={iconAlt}\n variant={disabled ? 'disabled' : 'normal'}\n />\n )}\n <span>{text}</span>\n\n {isDisabledWithReason && (\n <>\n {descriptionEl}\n {showTooltip && (\n <Tooltip className={styles['disabled-reason-tooltip']} trackRef={buttonRef} value={disabledReason!} />\n )}\n </>\n )}\n </button>\n );\n }\n);\n"]}
@@ -1,19 +1,20 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "segment": "awsui_segment_8cbea_gkapv_101",
5
- "disabled": "awsui_disabled_8cbea_gkapv_181",
6
- "selected": "awsui_selected_8cbea_gkapv_189",
7
- "icon": "awsui_icon_8cbea_gkapv_210",
8
- "with-text": "awsui_with-text_8cbea_gkapv_214",
9
- "with-no-text": "awsui_with-no-text_8cbea_gkapv_220",
10
- "root": "awsui_root_8cbea_gkapv_229",
11
- "segment-part": "awsui_segment-part_8cbea_gkapv_264",
12
- "select": "awsui_select_8cbea_gkapv_189",
13
- "segment-count-2": "awsui_segment-count-2_8cbea_gkapv_283",
14
- "segment-count-3": "awsui_segment-count-3_8cbea_gkapv_287",
15
- "segment-count-4": "awsui_segment-count-4_8cbea_gkapv_291",
16
- "segment-count-5": "awsui_segment-count-5_8cbea_gkapv_295",
17
- "segment-count-6": "awsui_segment-count-6_8cbea_gkapv_299"
4
+ "segment": "awsui_segment_8cbea_8e18d_101",
5
+ "disabled": "awsui_disabled_8cbea_8e18d_181",
6
+ "selected": "awsui_selected_8cbea_8e18d_189",
7
+ "icon": "awsui_icon_8cbea_8e18d_210",
8
+ "with-text": "awsui_with-text_8cbea_8e18d_214",
9
+ "with-no-text": "awsui_with-no-text_8cbea_8e18d_220",
10
+ "root": "awsui_root_8cbea_8e18d_229",
11
+ "segment-part": "awsui_segment-part_8cbea_8e18d_264",
12
+ "select": "awsui_select_8cbea_8e18d_189",
13
+ "segment-count-2": "awsui_segment-count-2_8cbea_8e18d_283",
14
+ "segment-count-3": "awsui_segment-count-3_8cbea_8e18d_287",
15
+ "segment-count-4": "awsui_segment-count-4_8cbea_8e18d_291",
16
+ "segment-count-5": "awsui_segment-count-5_8cbea_8e18d_295",
17
+ "segment-count-6": "awsui_segment-count-6_8cbea_8e18d_299",
18
+ "disabled-reason-tooltip": "awsui_disabled-reason-tooltip_8cbea_8e18d_303"
18
19
  };
19
20