@cloudscape-design/components 3.0.680 → 3.0.682

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 (245) 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/column-layout/flexible-column-layout/index.d.ts +2 -2
  54. package/column-layout/flexible-column-layout/index.d.ts.map +1 -1
  55. package/column-layout/flexible-column-layout/index.js +3 -2
  56. package/column-layout/flexible-column-layout/index.js.map +1 -1
  57. package/column-layout/flexible-column-layout/styles.css.js +5 -5
  58. package/column-layout/flexible-column-layout/styles.scoped.css +99 -4
  59. package/column-layout/flexible-column-layout/styles.selectors.js +5 -5
  60. package/column-layout/grid-column-layout.d.ts +2 -2
  61. package/column-layout/grid-column-layout.d.ts.map +1 -1
  62. package/column-layout/grid-column-layout.js +2 -2
  63. package/column-layout/grid-column-layout.js.map +1 -1
  64. package/column-layout/interfaces.d.ts +4 -0
  65. package/column-layout/interfaces.d.ts.map +1 -1
  66. package/column-layout/interfaces.js.map +1 -1
  67. package/column-layout/internal.d.ts +1 -1
  68. package/column-layout/internal.d.ts.map +1 -1
  69. package/column-layout/internal.js +2 -2
  70. package/column-layout/internal.js.map +1 -1
  71. package/date-picker/index.d.ts.map +1 -1
  72. package/date-picker/index.js +2 -2
  73. package/date-picker/index.js.map +1 -1
  74. package/date-range-picker/calendar/grids/grid.d.ts +2 -1
  75. package/date-range-picker/calendar/grids/grid.d.ts.map +1 -1
  76. package/date-range-picker/calendar/grids/grid.js +55 -7
  77. package/date-range-picker/calendar/grids/grid.js.map +1 -1
  78. package/date-range-picker/calendar/grids/index.d.ts +2 -1
  79. package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
  80. package/date-range-picker/calendar/grids/index.js +20 -12
  81. package/date-range-picker/calendar/grids/index.js.map +1 -1
  82. package/date-range-picker/calendar/grids/styles.css.js +28 -27
  83. package/date-range-picker/calendar/grids/styles.scoped.css +46 -42
  84. package/date-range-picker/calendar/grids/styles.selectors.js +28 -27
  85. package/date-range-picker/calendar/index.d.ts +2 -1
  86. package/date-range-picker/calendar/index.d.ts.map +1 -1
  87. package/date-range-picker/calendar/index.js +2 -2
  88. package/date-range-picker/calendar/index.js.map +1 -1
  89. package/date-range-picker/dropdown.d.ts +2 -2
  90. package/date-range-picker/dropdown.d.ts.map +1 -1
  91. package/date-range-picker/dropdown.js +2 -2
  92. package/date-range-picker/dropdown.js.map +1 -1
  93. package/date-range-picker/index.d.ts.map +1 -1
  94. package/date-range-picker/index.js +2 -2
  95. package/date-range-picker/index.js.map +1 -1
  96. package/date-range-picker/interfaces.d.ts +9 -0
  97. package/date-range-picker/interfaces.d.ts.map +1 -1
  98. package/date-range-picker/interfaces.js.map +1 -1
  99. package/grid/internal.d.ts +4 -0
  100. package/grid/internal.d.ts.map +1 -1
  101. package/grid/internal.js +3 -2
  102. package/grid/internal.js.map +1 -1
  103. package/index.d.ts +1 -0
  104. package/index.d.ts.map +1 -1
  105. package/index.js +1 -0
  106. package/index.js.map +1 -1
  107. package/internal/base-component/styles.scoped.css +12 -10
  108. package/internal/components/option/interfaces.d.ts +2 -0
  109. package/internal/components/option/interfaces.d.ts.map +1 -1
  110. package/internal/components/option/interfaces.js.map +1 -1
  111. package/internal/components/selectable-item/index.d.ts +1 -0
  112. package/internal/components/selectable-item/index.d.ts.map +1 -1
  113. package/internal/components/selectable-item/index.js +3 -0
  114. package/internal/components/selectable-item/index.js.map +1 -1
  115. package/internal/components/tooltip/index.d.ts +3 -1
  116. package/internal/components/tooltip/index.d.ts.map +1 -1
  117. package/internal/components/tooltip/index.js +3 -3
  118. package/internal/components/tooltip/index.js.map +1 -1
  119. package/internal/environment.js +1 -1
  120. package/internal/environment.json +1 -1
  121. package/internal/generated/styles/tokens.d.ts +2 -0
  122. package/internal/generated/styles/tokens.js +4 -2
  123. package/internal/generated/theming/index.cjs +78 -12
  124. package/internal/generated/theming/index.cjs.d.ts +16 -0
  125. package/internal/generated/theming/index.d.ts +16 -0
  126. package/internal/generated/theming/index.js +78 -12
  127. package/{button-dropdown/utils/use-hidden-description.d.ts → internal/hooks/use-hidden-description/index.d.ts} +2 -1
  128. package/internal/hooks/use-hidden-description/index.d.ts.map +1 -0
  129. package/{button-dropdown/utils/use-hidden-description.js → internal/hooks/use-hidden-description/index.js} +3 -2
  130. package/internal/hooks/use-hidden-description/index.js.map +1 -0
  131. package/internal/manifest.json +1 -1
  132. package/key-value-pairs/index.d.ts +5 -0
  133. package/key-value-pairs/index.d.ts.map +1 -0
  134. package/key-value-pairs/index.js +18 -0
  135. package/key-value-pairs/index.js.map +1 -0
  136. package/key-value-pairs/interfaces.d.ts +42 -0
  137. package/key-value-pairs/interfaces.d.ts.map +1 -0
  138. package/key-value-pairs/interfaces.js +2 -0
  139. package/key-value-pairs/interfaces.js.map +1 -0
  140. package/key-value-pairs/internal.d.ts +5 -0
  141. package/key-value-pairs/internal.d.ts.map +1 -0
  142. package/key-value-pairs/internal.js +41 -0
  143. package/key-value-pairs/internal.js.map +1 -0
  144. package/key-value-pairs/styles.css.js +13 -0
  145. package/key-value-pairs/styles.scoped.css +210 -0
  146. package/key-value-pairs/styles.selectors.js +14 -0
  147. package/package.json +2 -1
  148. package/segmented-control/interfaces.d.ts +2 -0
  149. package/segmented-control/interfaces.d.ts.map +1 -1
  150. package/segmented-control/interfaces.js.map +1 -1
  151. package/segmented-control/internal-segmented-control.d.ts.map +1 -1
  152. package/segmented-control/internal-segmented-control.js +11 -8
  153. package/segmented-control/internal-segmented-control.js.map +1 -1
  154. package/segmented-control/segment.d.ts.map +1 -1
  155. package/segmented-control/segment.js +14 -4
  156. package/segmented-control/segment.js.map +1 -1
  157. package/segmented-control/styles.css.js +15 -14
  158. package/segmented-control/styles.scoped.css +37 -33
  159. package/segmented-control/styles.selectors.js +15 -14
  160. package/select/interfaces.d.ts +1 -0
  161. package/select/interfaces.d.ts.map +1 -1
  162. package/select/interfaces.js.map +1 -1
  163. package/select/parts/filter.d.ts +1 -1
  164. package/select/parts/item.d.ts.map +1 -1
  165. package/select/parts/item.js +13 -3
  166. package/select/parts/item.js.map +1 -1
  167. package/select/parts/multiselect-item.d.ts.map +1 -1
  168. package/select/parts/multiselect-item.js +15 -3
  169. package/select/parts/multiselect-item.js.map +1 -1
  170. package/select/parts/styles.css.js +17 -16
  171. package/select/parts/styles.scoped.css +21 -17
  172. package/select/parts/styles.selectors.js +17 -16
  173. package/split-panel/icons/styles.css.js +22 -22
  174. package/split-panel/icons/styles.scoped.css +25 -25
  175. package/split-panel/icons/styles.selectors.js +22 -22
  176. package/table/body-cell/disabled-inline-editor.js +1 -1
  177. package/table/body-cell/disabled-inline-editor.js.map +1 -1
  178. package/tabs/interfaces.d.ts +5 -0
  179. package/tabs/interfaces.d.ts.map +1 -1
  180. package/tabs/interfaces.js.map +1 -1
  181. package/tabs/styles.css.js +28 -25
  182. package/tabs/styles.scoped.css +60 -49
  183. package/tabs/styles.selectors.js +28 -25
  184. package/tabs/tab-header-bar.d.ts.map +1 -1
  185. package/tabs/tab-header-bar.js +38 -14
  186. package/tabs/tab-header-bar.js.map +1 -1
  187. package/test-utils/dom/button/index.d.ts +1 -0
  188. package/test-utils/dom/button/index.js +6 -2
  189. package/test-utils/dom/button/index.js.map +1 -1
  190. package/test-utils/dom/button-dropdown/index.d.ts +2 -1
  191. package/test-utils/dom/button-dropdown/index.js +5 -1
  192. package/test-utils/dom/button-dropdown/index.js.map +1 -1
  193. package/test-utils/dom/calendar/index.d.ts +4 -1
  194. package/test-utils/dom/calendar/index.js +8 -1
  195. package/test-utils/dom/calendar/index.js.map +1 -1
  196. package/test-utils/dom/date-range-picker/index.d.ts +4 -1
  197. package/test-utils/dom/date-range-picker/index.js +8 -2
  198. package/test-utils/dom/date-range-picker/index.js.map +1 -1
  199. package/test-utils/dom/index.d.ts +3 -0
  200. package/test-utils/dom/index.js +10 -2
  201. package/test-utils/dom/index.js.map +1 -1
  202. package/test-utils/dom/internal/dropdown-host.js.map +1 -1
  203. package/test-utils/dom/internal/option.d.ts +1 -0
  204. package/test-utils/dom/internal/option.js +4 -0
  205. package/test-utils/dom/internal/option.js.map +1 -1
  206. package/test-utils/dom/key-value-pairs/index.d.ts +14 -0
  207. package/test-utils/dom/key-value-pairs/index.js +38 -0
  208. package/test-utils/dom/key-value-pairs/index.js.map +1 -0
  209. package/test-utils/dom/segmented-control/index.d.ts +9 -0
  210. package/test-utils/dom/segmented-control/index.js +15 -0
  211. package/test-utils/dom/segmented-control/index.js.map +1 -1
  212. package/test-utils/dom/tabs/index.d.ts +9 -2
  213. package/test-utils/dom/tabs/index.js +15 -2
  214. package/test-utils/dom/tabs/index.js.map +1 -1
  215. package/test-utils/selectors/button/index.d.ts +1 -0
  216. package/test-utils/selectors/button/index.js +6 -2
  217. package/test-utils/selectors/button/index.js.map +1 -1
  218. package/test-utils/selectors/button-dropdown/index.d.ts +2 -1
  219. package/test-utils/selectors/button-dropdown/index.js +5 -1
  220. package/test-utils/selectors/button-dropdown/index.js.map +1 -1
  221. package/test-utils/selectors/calendar/index.d.ts +4 -1
  222. package/test-utils/selectors/calendar/index.js +8 -1
  223. package/test-utils/selectors/calendar/index.js.map +1 -1
  224. package/test-utils/selectors/date-range-picker/index.d.ts +4 -1
  225. package/test-utils/selectors/date-range-picker/index.js +8 -2
  226. package/test-utils/selectors/date-range-picker/index.js.map +1 -1
  227. package/test-utils/selectors/index.d.ts +3 -0
  228. package/test-utils/selectors/index.js +10 -2
  229. package/test-utils/selectors/index.js.map +1 -1
  230. package/test-utils/selectors/internal/dropdown-host.js.map +1 -1
  231. package/test-utils/selectors/internal/option.d.ts +1 -0
  232. package/test-utils/selectors/internal/option.js +4 -0
  233. package/test-utils/selectors/internal/option.js.map +1 -1
  234. package/test-utils/selectors/key-value-pairs/index.d.ts +14 -0
  235. package/test-utils/selectors/key-value-pairs/index.js +38 -0
  236. package/test-utils/selectors/key-value-pairs/index.js.map +1 -0
  237. package/test-utils/selectors/segmented-control/index.d.ts +9 -0
  238. package/test-utils/selectors/segmented-control/index.js +15 -0
  239. package/test-utils/selectors/segmented-control/index.js.map +1 -1
  240. package/test-utils/selectors/tabs/index.d.ts +9 -2
  241. package/test-utils/selectors/tabs/index.js +15 -2
  242. package/test-utils/selectors/tabs/index.js.map +1 -1
  243. package/test-utils/tsconfig.tsbuildinfo +1 -1
  244. package/button-dropdown/utils/use-hidden-description.d.ts.map +0 -1
  245. package/button-dropdown/utils/use-hidden-description.js.map +0 -1
@@ -0,0 +1,210 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /*
6
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ SPDX-License-Identifier: Apache-2.0
8
+ */
9
+ /*
10
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
+ SPDX-License-Identifier: Apache-2.0
12
+ */
13
+ /*
14
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
15
+ SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ /*
18
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
+ SPDX-License-Identifier: Apache-2.0
20
+ */
21
+ /*
22
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
23
+ SPDX-License-Identifier: Apache-2.0
24
+ */
25
+ /*
26
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
27
+ SPDX-License-Identifier: Apache-2.0
28
+ */
29
+ /*
30
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
31
+ SPDX-License-Identifier: Apache-2.0
32
+ */
33
+ /*
34
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
35
+ SPDX-License-Identifier: Apache-2.0
36
+ */
37
+ /*
38
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
39
+ SPDX-License-Identifier: Apache-2.0
40
+ */
41
+ /*
42
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
43
+ SPDX-License-Identifier: Apache-2.0
44
+ */
45
+ /*
46
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
47
+ SPDX-License-Identifier: Apache-2.0
48
+ */
49
+ /*
50
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
51
+ SPDX-License-Identifier: Apache-2.0
52
+ */
53
+ /*
54
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
55
+ SPDX-License-Identifier: Apache-2.0
56
+ */
57
+ /*
58
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
59
+ SPDX-License-Identifier: Apache-2.0
60
+ */
61
+ /*
62
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
63
+ SPDX-License-Identifier: Apache-2.0
64
+ */
65
+ /*
66
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
67
+ SPDX-License-Identifier: Apache-2.0
68
+ */
69
+ /* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
70
+ /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
71
+ /*
72
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
73
+ SPDX-License-Identifier: Apache-2.0
74
+ */
75
+ /*
76
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
77
+ SPDX-License-Identifier: Apache-2.0
78
+ */
79
+ /*
80
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
81
+ SPDX-License-Identifier: Apache-2.0
82
+ */
83
+ /*
84
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
85
+ SPDX-License-Identifier: Apache-2.0
86
+ */
87
+ /* Style used for links in slots/components that are text heavy, to help links stand out among
88
+ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
89
+ /*
90
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
+ SPDX-License-Identifier: Apache-2.0
92
+ */
93
+ /*
94
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
+ SPDX-License-Identifier: Apache-2.0
96
+ */
97
+ .awsui_key-value-pairs_1y9fy_s6ox4_97:not(#\9) {
98
+ border-collapse: separate;
99
+ border-spacing: 0;
100
+ box-sizing: border-box;
101
+ caption-side: top;
102
+ cursor: auto;
103
+ direction: inherit;
104
+ empty-cells: show;
105
+ font-family: serif;
106
+ font-size: medium;
107
+ font-style: normal;
108
+ font-variant: normal;
109
+ font-weight: 400;
110
+ font-stretch: normal;
111
+ line-height: normal;
112
+ -webkit-hyphens: none;
113
+ hyphens: none;
114
+ letter-spacing: normal;
115
+ list-style: disc outside none;
116
+ tab-size: 8;
117
+ text-align: start;
118
+ text-indent: 0;
119
+ text-shadow: none;
120
+ text-transform: none;
121
+ visibility: visible;
122
+ white-space: normal;
123
+ word-spacing: normal;
124
+ font-size: var(--font-size-body-m-x4okxb, 14px);
125
+ line-height: var(--line-height-body-m-30ar75, 20px);
126
+ color: var(--color-text-body-default-at06ol, #000716);
127
+ font-weight: 400;
128
+ font-family: var(--font-family-base-dnvic8, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
129
+ -webkit-font-smoothing: auto;
130
+ -moz-osx-font-smoothing: auto;
131
+ }
132
+
133
+ .awsui_group-title_1y9fy_s6ox4_132:not(#\9) {
134
+ padding-block-end: var(--space-scaled-m-mo5yse, 16px);
135
+ }
136
+
137
+ .awsui_group-list_1y9fy_s6ox4_136:not(#\9) {
138
+ margin-block-start: 0;
139
+ margin-block-end: 0;
140
+ margin-inline-start: 0;
141
+ margin-inline-end: 0;
142
+ display: flex;
143
+ flex-direction: column;
144
+ row-gap: var(--space-scaled-m-mo5yse, 16px);
145
+ }
146
+
147
+ .awsui_group-list-item_1y9fy_s6ox4_146:not(#\9) {
148
+ /* used in test-utils */
149
+ }
150
+
151
+ .awsui_term_1y9fy_s6ox4_150:not(#\9) {
152
+ font-size: var(--font-size-body-m-x4okxb, 14px);
153
+ line-height: var(--line-height-body-m-30ar75, 20px);
154
+ font-weight: var(--font-display-label-weight-815ja9, 700);
155
+ color: var(--color-text-label-rj4jdv, #000716);
156
+ margin-block-end: var(--space-key-value-gap-0517k5, 0px);
157
+ }
158
+
159
+ .awsui_key-label_1y9fy_s6ox4_158:not(#\9) {
160
+ margin-inline-end: var(--space-xs-zb16t3, 8px);
161
+ }
162
+ .awsui_key-label_1y9fy_s6ox4_158:not(#\9):only-child {
163
+ margin-block: 0;
164
+ margin-inline: 0;
165
+ }
166
+
167
+ .awsui_detail_1y9fy_s6ox4_166:not(#\9) {
168
+ border-collapse: separate;
169
+ border-spacing: 0;
170
+ box-sizing: border-box;
171
+ caption-side: top;
172
+ cursor: auto;
173
+ direction: inherit;
174
+ empty-cells: show;
175
+ font-family: serif;
176
+ font-size: medium;
177
+ font-style: normal;
178
+ font-variant: normal;
179
+ font-weight: 400;
180
+ font-stretch: normal;
181
+ line-height: normal;
182
+ -webkit-hyphens: none;
183
+ hyphens: none;
184
+ letter-spacing: normal;
185
+ list-style: disc outside none;
186
+ tab-size: 8;
187
+ text-align: start;
188
+ text-indent: 0;
189
+ text-shadow: none;
190
+ text-transform: none;
191
+ visibility: visible;
192
+ white-space: normal;
193
+ word-spacing: normal;
194
+ font-size: var(--font-size-body-m-x4okxb, 14px);
195
+ line-height: var(--line-height-body-m-30ar75, 20px);
196
+ color: var(--color-text-body-default-at06ol, #000716);
197
+ font-weight: 400;
198
+ font-family: var(--font-family-base-dnvic8, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
199
+ -webkit-font-smoothing: auto;
200
+ -moz-osx-font-smoothing: auto;
201
+ margin-inline-start: 0;
202
+ margin-block-start: 0;
203
+ margin-block-end: 0;
204
+ }
205
+
206
+ .awsui_info_1y9fy_s6ox4_204:not(#\9) {
207
+ display: inline-flex;
208
+ padding-inline-start: var(--space-xs-zb16t3, 8px);
209
+ border-inline-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
210
+ }
@@ -0,0 +1,14 @@
1
+
2
+ // es-module interop with Babel and Typescript
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ module.exports.default = {
5
+ "key-value-pairs": "awsui_key-value-pairs_1y9fy_s6ox4_97",
6
+ "group-title": "awsui_group-title_1y9fy_s6ox4_132",
7
+ "group-list": "awsui_group-list_1y9fy_s6ox4_136",
8
+ "group-list-item": "awsui_group-list-item_1y9fy_s6ox4_146",
9
+ "term": "awsui_term_1y9fy_s6ox4_150",
10
+ "key-label": "awsui_key-label_1y9fy_s6ox4_158",
11
+ "detail": "awsui_detail_1y9fy_s6ox4_166",
12
+ "info": "awsui_info_1y9fy_s6ox4_204"
13
+ };
14
+
package/package.json CHANGED
@@ -49,6 +49,7 @@
49
49
  "./hotspot": "./hotspot/index.js",
50
50
  "./icon": "./icon/index.js",
51
51
  "./input": "./input/index.js",
52
+ "./key-value-pairs": "./key-value-pairs/index.js",
52
53
  "./line-chart": "./line-chart/index.js",
53
54
  "./link": "./link/index.js",
54
55
  "./mixed-line-bar-chart": "./mixed-line-bar-chart/index.js",
@@ -120,7 +121,7 @@
120
121
  "./internal/base-component/index.js",
121
122
  "./internal/base-component/styles.css.js"
122
123
  ],
123
- "version": "3.0.680",
124
+ "version": "3.0.682",
124
125
  "repository": {
125
126
  "type": "git",
126
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,oBAAoB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;;;;;;;;;OAWG;IACH,OAAO,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,EAA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B,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,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,GACc;IACtB,MAAM,cAAc,GAAG,MAAM,CAAsC,EAAE,CAAC,CAAC;IACvE,MAAM,eAAe,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACtD,OAAO,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,MAAM,qBAAqB,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,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;AACpC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,GACc;IACtB,MAAM,cAAc,GAAG,MAAM,CAAsC,EAAE,CAAC,CAAC;IACvE,MAAM,eAAe,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACtD,OAAO,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,MAAM,qBAAqB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,MAAM,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AAC,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/segmented-control/segment.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AASrC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAgB,EAC7G,GAAiC,EACjC,EAAE;IACF,OAAO,CACL,gCACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,EACnG,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ,kBACJ,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,gBAC7B,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;QAEtC,CAAC,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CACnC,oBAAC,YAAY,IACX,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EACjF,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,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,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAC5E,OAAO,OAAO,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAShE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EACE,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,QAAQ,EACR,EAAE,GACW,EACf,GAAiC,EACjC,EAAE;IACF,MAAM,SAAS,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAC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KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,IACxE,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,mBAChC,EAAE;QAEd,CAAC,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CACnC,oBAAC,YAAY,IACX,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EACjF,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,GACzC,CACH;QACD,kCAAO,IAAI,CAAQ;QAElB,oBAAoB,IAAI,CACvB;YACG,aAAa;YACb,WAAW,IAAI,CACd,oBAAC,OAAO,IAAC,SAAS,EAAE,MAAM,CAAC,yBAAyB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,cAAe,GAAI,CACvG,CACA,CACJ,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