@cloudscape-design/components 3.0.337 → 3.0.339

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 (197) hide show
  1. package/alert/index.d.ts.map +1 -1
  2. package/alert/index.js +36 -1
  3. package/alert/index.js.map +1 -1
  4. package/app-layout/styles.css.js +17 -17
  5. package/app-layout/styles.scoped.css +21 -21
  6. package/app-layout/styles.selectors.js +17 -17
  7. package/app-layout/visual-refresh/styles.css.js +69 -69
  8. package/app-layout/visual-refresh/styles.scoped.css +173 -169
  9. package/app-layout/visual-refresh/styles.selectors.js +69 -69
  10. package/area-chart/chart-container.d.ts +2 -2
  11. package/area-chart/chart-container.d.ts.map +1 -1
  12. package/area-chart/chart-container.js +1 -1
  13. package/area-chart/chart-container.js.map +1 -1
  14. package/area-chart/interfaces.d.ts +5 -1
  15. package/area-chart/interfaces.d.ts.map +1 -1
  16. package/area-chart/interfaces.js.map +1 -1
  17. package/area-chart/internal.d.ts +1 -1
  18. package/area-chart/internal.d.ts.map +1 -1
  19. package/area-chart/internal.js +2 -2
  20. package/area-chart/internal.js.map +1 -1
  21. package/attribute-editor/interfaces.d.ts +7 -0
  22. package/attribute-editor/interfaces.d.ts.map +1 -1
  23. package/attribute-editor/interfaces.js.map +1 -1
  24. package/attribute-editor/internal.d.ts.map +1 -1
  25. package/attribute-editor/internal.js +2 -2
  26. package/attribute-editor/internal.js.map +1 -1
  27. package/attribute-editor/row.d.ts +3 -2
  28. package/attribute-editor/row.d.ts.map +1 -1
  29. package/attribute-editor/row.js +2 -2
  30. package/attribute-editor/row.js.map +1 -1
  31. package/box/styles.css.js +189 -189
  32. package/box/styles.scoped.css +257 -257
  33. package/box/styles.selectors.js +189 -189
  34. package/button/styles.css.js +20 -20
  35. package/button/styles.scoped.css +154 -154
  36. package/button/styles.selectors.js +20 -20
  37. package/button-dropdown/category-elements/styles.css.js +13 -13
  38. package/button-dropdown/category-elements/styles.scoped.css +25 -25
  39. package/button-dropdown/category-elements/styles.selectors.js +13 -13
  40. package/button-dropdown/item-element/styles.css.js +14 -14
  41. package/button-dropdown/item-element/styles.scoped.css +20 -20
  42. package/button-dropdown/item-element/styles.selectors.js +14 -14
  43. package/cards/styles.css.js +38 -38
  44. package/cards/styles.scoped.css +57 -62
  45. package/cards/styles.selectors.js +38 -38
  46. package/container/styles.css.js +28 -28
  47. package/container/styles.scoped.css +57 -54
  48. package/container/styles.selectors.js +28 -28
  49. package/content-layout/styles.css.js +7 -7
  50. package/content-layout/styles.scoped.css +13 -13
  51. package/content-layout/styles.selectors.js +7 -7
  52. package/expandable-section/styles.css.js +29 -29
  53. package/expandable-section/styles.scoped.css +61 -61
  54. package/expandable-section/styles.selectors.js +29 -29
  55. package/flashbar/styles.css.js +46 -46
  56. package/flashbar/styles.scoped.css +146 -146
  57. package/flashbar/styles.selectors.js +46 -46
  58. package/form-field/internal.js +3 -2
  59. package/form-field/internal.js.map +1 -1
  60. package/header/internal.d.ts.map +1 -1
  61. package/header/internal.js +5 -5
  62. package/header/internal.js.map +1 -1
  63. package/header/styles.css.js +33 -44
  64. package/header/styles.scoped.css +85 -91
  65. package/header/styles.selectors.js +33 -44
  66. package/help-panel/styles.css.js +4 -4
  67. package/help-panel/styles.scoped.css +80 -80
  68. package/help-panel/styles.selectors.js +4 -4
  69. package/icon/styles.css.js +21 -21
  70. package/icon/styles.scoped.css +54 -54
  71. package/icon/styles.selectors.js +21 -21
  72. package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
  73. package/internal/analytics/components/analytics-funnel.js +16 -15
  74. package/internal/analytics/components/analytics-funnel.js.map +1 -1
  75. package/internal/analytics/context/analytics-context.d.ts +6 -7
  76. package/internal/analytics/context/analytics-context.d.ts.map +1 -1
  77. package/internal/analytics/context/analytics-context.js +2 -6
  78. package/internal/analytics/context/analytics-context.js.map +1 -1
  79. package/internal/analytics/hooks/use-funnel.d.ts +4 -7
  80. package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
  81. package/internal/analytics/hooks/use-funnel.js +10 -8
  82. package/internal/analytics/hooks/use-funnel.js.map +1 -1
  83. package/internal/base-component/styles.scoped.css +45 -35
  84. package/internal/components/button-trigger/index.d.ts +2 -1
  85. package/internal/components/button-trigger/index.d.ts.map +1 -1
  86. package/internal/components/button-trigger/index.js +2 -2
  87. package/internal/components/button-trigger/index.js.map +1 -1
  88. package/internal/components/cartesian-chart/interfaces.d.ts +10 -2
  89. package/internal/components/cartesian-chart/interfaces.d.ts.map +1 -1
  90. package/internal/components/cartesian-chart/interfaces.js.map +1 -1
  91. package/internal/components/dropdown/index.d.ts +1 -1
  92. package/internal/components/dropdown/index.d.ts.map +1 -1
  93. package/internal/components/dropdown/index.js +4 -4
  94. package/internal/components/dropdown/index.js.map +1 -1
  95. package/internal/components/dropdown/interfaces.d.ts +8 -0
  96. package/internal/components/dropdown/interfaces.d.ts.map +1 -1
  97. package/internal/components/dropdown/interfaces.js.map +1 -1
  98. package/internal/components/menu-dropdown/styles.css.js +7 -7
  99. package/internal/components/menu-dropdown/styles.scoped.css +14 -14
  100. package/internal/components/menu-dropdown/styles.selectors.js +7 -7
  101. package/internal/environment.js +1 -1
  102. package/internal/generated/theming/index.cjs +153 -120
  103. package/internal/generated/theming/index.js +153 -120
  104. package/internal/manifest.json +1 -1
  105. package/link/internal.d.ts.map +1 -1
  106. package/link/internal.js +3 -2
  107. package/link/internal.js.map +1 -1
  108. package/link/styles.css.js +20 -20
  109. package/link/styles.scoped.css +83 -83
  110. package/link/styles.selectors.js +20 -20
  111. package/mixed-line-bar-chart/internal.d.ts +1 -1
  112. package/mixed-line-bar-chart/internal.d.ts.map +1 -1
  113. package/mixed-line-bar-chart/internal.js +2 -2
  114. package/mixed-line-bar-chart/internal.js.map +1 -1
  115. package/modal/styles.css.js +23 -23
  116. package/modal/styles.scoped.css +40 -40
  117. package/modal/styles.selectors.js +23 -23
  118. package/package.json +1 -1
  119. package/pagination/styles.css.js +9 -9
  120. package/pagination/styles.scoped.css +24 -24
  121. package/pagination/styles.selectors.js +9 -9
  122. package/popover/styles.css.js +50 -50
  123. package/popover/styles.scoped.css +65 -65
  124. package/popover/styles.selectors.js +50 -50
  125. package/property-filter/index.d.ts.map +1 -1
  126. package/property-filter/index.js +4 -3
  127. package/property-filter/index.js.map +1 -1
  128. package/property-filter/interfaces.d.ts +16 -5
  129. package/property-filter/interfaces.d.ts.map +1 -1
  130. package/property-filter/interfaces.js.map +1 -1
  131. package/s3-resource-selector/index.d.ts.map +1 -1
  132. package/s3-resource-selector/index.js +2 -2
  133. package/s3-resource-selector/index.js.map +1 -1
  134. package/s3-resource-selector/interfaces.d.ts +7 -0
  135. package/s3-resource-selector/interfaces.d.ts.map +1 -1
  136. package/s3-resource-selector/interfaces.js.map +1 -1
  137. package/s3-resource-selector/s3-in-context/index.d.ts +1 -0
  138. package/s3-resource-selector/s3-in-context/index.d.ts.map +1 -1
  139. package/s3-resource-selector/s3-in-context/index.js +2 -2
  140. package/s3-resource-selector/s3-in-context/index.js.map +1 -1
  141. package/segmented-control/styles.css.js +14 -14
  142. package/segmented-control/styles.scoped.css +35 -35
  143. package/segmented-control/styles.selectors.js +14 -14
  144. package/select/utils/use-select.d.ts +5 -7
  145. package/select/utils/use-select.d.ts.map +1 -1
  146. package/select/utils/use-select.js +6 -0
  147. package/select/utils/use-select.js.map +1 -1
  148. package/side-navigation/styles.css.js +28 -28
  149. package/side-navigation/styles.scoped.css +49 -49
  150. package/side-navigation/styles.selectors.js +28 -28
  151. package/spinner/styles.css.js +13 -13
  152. package/spinner/styles.scoped.css +22 -22
  153. package/spinner/styles.selectors.js +13 -13
  154. package/split-panel/styles.css.js +56 -56
  155. package/split-panel/styles.scoped.css +80 -80
  156. package/split-panel/styles.selectors.js +56 -56
  157. package/table/body-cell/index.d.ts.map +1 -1
  158. package/table/body-cell/index.js +22 -3
  159. package/table/body-cell/index.js.map +1 -1
  160. package/table/body-cell/styles.css.js +28 -28
  161. package/table/body-cell/styles.scoped.css +93 -77
  162. package/table/body-cell/styles.selectors.js +28 -28
  163. package/table/header-cell/styles.css.js +24 -24
  164. package/table/header-cell/styles.scoped.css +41 -41
  165. package/table/header-cell/styles.selectors.js +24 -24
  166. package/table/styles.css.js +34 -34
  167. package/table/styles.scoped.css +45 -52
  168. package/table/styles.selectors.js +34 -34
  169. package/tabs/styles.css.js +21 -21
  170. package/tabs/styles.scoped.css +41 -41
  171. package/tabs/styles.selectors.js +21 -21
  172. package/tag-editor/styles.css.js +3 -3
  173. package/tag-editor/styles.scoped.css +11 -11
  174. package/tag-editor/styles.selectors.js +3 -3
  175. package/text-content/styles.css.js +1 -1
  176. package/text-content/styles.scoped.css +71 -71
  177. package/text-content/styles.selectors.js +1 -1
  178. package/top-navigation/1.0-beta/styles.css.js +25 -25
  179. package/top-navigation/1.0-beta/styles.scoped.css +45 -45
  180. package/top-navigation/1.0-beta/styles.selectors.js +25 -25
  181. package/top-navigation/styles.css.js +47 -47
  182. package/top-navigation/styles.scoped.css +74 -74
  183. package/top-navigation/styles.selectors.js +47 -47
  184. package/tutorial-panel/components/tutorial-detail-view/styles.css.js +20 -20
  185. package/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +22 -22
  186. package/tutorial-panel/components/tutorial-detail-view/styles.selectors.js +20 -20
  187. package/wizard/interfaces.d.ts +10 -3
  188. package/wizard/interfaces.d.ts.map +1 -1
  189. package/wizard/interfaces.js.map +1 -1
  190. package/wizard/internal.d.ts +1 -1
  191. package/wizard/internal.d.ts.map +1 -1
  192. package/wizard/internal.js +5 -5
  193. package/wizard/internal.js.map +1 -1
  194. package/wizard/wizard-form.d.ts +2 -1
  195. package/wizard/wizard-form.d.ts.map +1 -1
  196. package/wizard/wizard-form.js +2 -2
  197. package/wizard/wizard-form.js.map +1 -1
@@ -90,7 +90,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
90
90
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
- .awsui_tutorial-list_1u70p_s4act_93:not(#\9) {
93
+ .awsui_tutorial-list_1u70p_1p1ln_93:not(#\9) {
94
94
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
95
95
  border-collapse: separate;
96
96
  border-spacing: 0;
@@ -131,22 +131,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
131
131
  margin: 0;
132
132
  }
133
133
 
134
- .awsui_tutorial-title_1u70p_s4act_108:not(#\9) {
134
+ .awsui_tutorial-title_1u70p_1p1ln_108:not(#\9) {
135
135
  display: flex;
136
136
  align-items: flex-start;
137
137
  margin-left: calc(-1 * var(--space-xxs-ja5cp8, 4px));
138
138
  padding-bottom: var(--space-xxxs-j6dpcy, 2px);
139
139
  }
140
140
 
141
- .awsui_task_1u70p_s4act_115:not(#\9) {
141
+ .awsui_task_1u70p_1p1ln_115:not(#\9) {
142
142
  list-style: none;
143
143
  padding-top: 0;
144
144
  }
145
- .awsui_task_1u70p_s4act_115:not(#\9):not(:first-child) {
145
+ .awsui_task_1u70p_1p1ln_115:not(#\9):not(:first-child) {
146
146
  margin-top: var(--space-xl-gsucfg, 24px);
147
147
  }
148
148
 
149
- .awsui_task-title_1u70p_s4act_123:not(#\9) {
149
+ .awsui_task-title_1u70p_1p1ln_123:not(#\9) {
150
150
  display: flex;
151
151
  align-items: flex-start;
152
152
  padding-left: var(--border-divider-section-width-orq175, 2px);
@@ -154,60 +154,60 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
154
154
  line-height: var(--font-heading-s-line-height-uruujc, 20px);
155
155
  letter-spacing: var(--font-heading-s-letter-spacing-j4vcrt, -0.005em);
156
156
  }
157
- .awsui_task-title--status_1u70p_s4act_131:not(#\9) {
157
+ .awsui_task-title--status_1u70p_1p1ln_131:not(#\9) {
158
158
  line-height: inherit;
159
159
  }
160
160
 
161
- .awsui_current-task_1u70p_s4act_135:not(#\9) {
161
+ .awsui_current-task_1u70p_1p1ln_135:not(#\9) {
162
162
  font-weight: 700;
163
163
  }
164
164
 
165
- .awsui_successful-task_1u70p_s4act_139:not(#\9) {
165
+ .awsui_successful-task_1u70p_1p1ln_139:not(#\9) {
166
166
  color: var(--color-text-status-success-6id1zv, #037f0c);
167
167
  }
168
168
 
169
- .awsui_congratulation-message_1u70p_s4act_143:not(#\9) {
169
+ .awsui_congratulation-message_1u70p_1p1ln_143:not(#\9) {
170
170
  display: flex;
171
171
  font-size: var(--font-heading-s-size-ep2ts9, 16px);
172
172
  line-height: var(--font-heading-s-line-height-uruujc, 20px);
173
173
  letter-spacing: var(--font-heading-s-letter-spacing-j4vcrt, -0.005em);
174
- font-weight: var(--font-heading-xs-weight-dxq16u, 800);
174
+ font-weight: var(--font-heading-xs-weight-xog3y8, 700);
175
175
  color: var(--color-text-status-success-6id1zv, #037f0c);
176
176
  }
177
- .awsui_congratulation-message--status_1u70p_s4act_151:not(#\9) {
177
+ .awsui_congratulation-message--status_1u70p_1p1ln_151:not(#\9) {
178
178
  line-height: inherit;
179
179
  }
180
180
 
181
- .awsui_plaintext-congratulation-description_1u70p_s4act_155:not(#\9) {
181
+ .awsui_plaintext-congratulation-description_1u70p_1p1ln_155:not(#\9) {
182
182
  white-space: pre-line;
183
183
  }
184
184
 
185
- .awsui_divider_1u70p_s4act_159:not(#\9) {
185
+ .awsui_divider_1u70p_1p1ln_159:not(#\9) {
186
186
  border-bottom: var(--border-divider-section-width-orq175, 2px) solid var(--color-border-divider-default-9o8zql, #e9ebed);
187
187
  }
188
188
 
189
- .awsui_step-list_1u70p_s4act_163:not(#\9) {
189
+ .awsui_step-list_1u70p_1p1ln_163:not(#\9) {
190
190
  list-style: none;
191
191
  padding: 0 0 0 var(--space-xxxs-j6dpcy, 2px);
192
192
  }
193
193
 
194
- .awsui_step_1u70p_s4act_163:not(#\9):not(:first-child) {
194
+ .awsui_step_1u70p_1p1ln_163:not(#\9):not(:first-child) {
195
195
  padding-top: var(--space-xxs-ja5cp8, 4px);
196
196
  }
197
197
 
198
- .awsui_expandable-section-wrapper_1u70p_s4act_172:not(#\9) {
198
+ .awsui_expandable-section-wrapper_1u70p_1p1ln_172:not(#\9) {
199
199
  width: 100%;
200
200
  }
201
201
 
202
- .awsui_expandable-section-header_1u70p_s4act_176:not(#\9) {
202
+ .awsui_expandable-section-header_1u70p_1p1ln_176:not(#\9) {
203
203
  font-size: var(--font-body-m-size-7dign1, 14px);
204
204
  line-height: var(--font-body-m-line-height-ghizru, 20px);
205
205
  }
206
206
 
207
- .awsui_step-title_1u70p_s4act_181:not(#\9),
208
- .awsui_feedback-link_1u70p_s4act_182:not(#\9),
209
- .awsui_dismiss-button_1u70p_s4act_183:not(#\9),
210
- .awsui_completion-screen-title_1u70p_s4act_184:not(#\9),
211
- .awsui_completion-screen-description_1u70p_s4act_185:not(#\9) {
207
+ .awsui_step-title_1u70p_1p1ln_181:not(#\9),
208
+ .awsui_feedback-link_1u70p_1p1ln_182:not(#\9),
209
+ .awsui_dismiss-button_1u70p_1p1ln_183:not(#\9),
210
+ .awsui_completion-screen-title_1u70p_1p1ln_184:not(#\9),
211
+ .awsui_completion-screen-description_1u70p_1p1ln_185:not(#\9) {
212
212
  /* used in test-utils */
213
213
  }
@@ -2,25 +2,25 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "tutorial-list": "awsui_tutorial-list_1u70p_s4act_93",
6
- "tutorial-title": "awsui_tutorial-title_1u70p_s4act_108",
7
- "task": "awsui_task_1u70p_s4act_115",
8
- "task-title": "awsui_task-title_1u70p_s4act_123",
9
- "task-title--status": "awsui_task-title--status_1u70p_s4act_131",
10
- "current-task": "awsui_current-task_1u70p_s4act_135",
11
- "successful-task": "awsui_successful-task_1u70p_s4act_139",
12
- "congratulation-message": "awsui_congratulation-message_1u70p_s4act_143",
13
- "congratulation-message--status": "awsui_congratulation-message--status_1u70p_s4act_151",
14
- "plaintext-congratulation-description": "awsui_plaintext-congratulation-description_1u70p_s4act_155",
15
- "divider": "awsui_divider_1u70p_s4act_159",
16
- "step-list": "awsui_step-list_1u70p_s4act_163",
17
- "step": "awsui_step_1u70p_s4act_163",
18
- "expandable-section-wrapper": "awsui_expandable-section-wrapper_1u70p_s4act_172",
19
- "expandable-section-header": "awsui_expandable-section-header_1u70p_s4act_176",
20
- "step-title": "awsui_step-title_1u70p_s4act_181",
21
- "feedback-link": "awsui_feedback-link_1u70p_s4act_182",
22
- "dismiss-button": "awsui_dismiss-button_1u70p_s4act_183",
23
- "completion-screen-title": "awsui_completion-screen-title_1u70p_s4act_184",
24
- "completion-screen-description": "awsui_completion-screen-description_1u70p_s4act_185"
5
+ "tutorial-list": "awsui_tutorial-list_1u70p_1p1ln_93",
6
+ "tutorial-title": "awsui_tutorial-title_1u70p_1p1ln_108",
7
+ "task": "awsui_task_1u70p_1p1ln_115",
8
+ "task-title": "awsui_task-title_1u70p_1p1ln_123",
9
+ "task-title--status": "awsui_task-title--status_1u70p_1p1ln_131",
10
+ "current-task": "awsui_current-task_1u70p_1p1ln_135",
11
+ "successful-task": "awsui_successful-task_1u70p_1p1ln_139",
12
+ "congratulation-message": "awsui_congratulation-message_1u70p_1p1ln_143",
13
+ "congratulation-message--status": "awsui_congratulation-message--status_1u70p_1p1ln_151",
14
+ "plaintext-congratulation-description": "awsui_plaintext-congratulation-description_1u70p_1p1ln_155",
15
+ "divider": "awsui_divider_1u70p_1p1ln_159",
16
+ "step-list": "awsui_step-list_1u70p_1p1ln_163",
17
+ "step": "awsui_step_1u70p_1p1ln_163",
18
+ "expandable-section-wrapper": "awsui_expandable-section-wrapper_1u70p_1p1ln_172",
19
+ "expandable-section-header": "awsui_expandable-section-header_1u70p_1p1ln_176",
20
+ "step-title": "awsui_step-title_1u70p_1p1ln_181",
21
+ "feedback-link": "awsui_feedback-link_1u70p_1p1ln_182",
22
+ "dismiss-button": "awsui_dismiss-button_1u70p_1p1ln_183",
23
+ "completion-screen-title": "awsui_completion-screen-title_1u70p_1p1ln_184",
24
+ "completion-screen-description": "awsui_completion-screen-description_1u70p_1p1ln_185"
25
25
  };
26
26
 
@@ -43,13 +43,17 @@ export interface WizardProps extends BaseComponentProps {
43
43
  * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.
44
44
  * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.
45
45
  * - `nextButton` (string) - The text of the button that enables the user to move to the next step.
46
- * - `submitButton` (string) - The text of the button that enables the user to submit the form.
46
+ * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property.
47
47
  * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.
48
48
  * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.
49
49
  * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.
50
50
  * @i18n
51
51
  */
52
- i18nStrings: WizardProps.I18nStrings;
52
+ i18nStrings?: WizardProps.I18nStrings;
53
+ /**
54
+ * The text of the button that enables the user to submit the form.
55
+ */
56
+ submitButtonText?: string;
53
57
  /**
54
58
  * Renders the *next* or *submit* button in a loading state.
55
59
  *
@@ -102,6 +106,10 @@ export declare namespace WizardProps {
102
106
  isOptional?: boolean;
103
107
  }
104
108
  interface I18nStrings {
109
+ /**
110
+ * @deprecated Use `submitButtonText` on the component instead.
111
+ */
112
+ submitButton?: string;
105
113
  stepNumberLabel?(stepNumber: number): string;
106
114
  collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;
107
115
  skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;
@@ -110,7 +118,6 @@ export declare namespace WizardProps {
110
118
  cancelButton?: string;
111
119
  previousButton?: string;
112
120
  nextButton?: string;
113
- submitButton: string;
114
121
  optional?: string;
115
122
  nextButtonLoadingAnnouncement?: string;
116
123
  submitButtonLoadingAnnouncement?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts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C;QAClB,6BAA6B,CAAC,EAAE,MAAM,CAAC;QACvC,+BAA+B,CAAC,EAAE,MAAM,CAAC;KAC1C;IAED,UAAiB,cAAc;QAC7B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC;KACtC;IAED,KAAY,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;CACtE"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.\n * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.\n * @i18n\n */\n i18nStrings: WizardProps.I18nStrings;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n }\n\n export interface I18nStrings {\n stepNumberLabel?(stepNumber: number): string;\n collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton?: string;\n previousButton?: string;\n nextButton?: string;\n submitButton: string;\n optional?: string;\n nextButtonLoadingAnnouncement?: string;\n submitButtonLoadingAnnouncement?: string;\n }\n\n export interface NavigateDetail {\n requestedStepIndex: number;\n reason: WizardProps.NavigationReason;\n }\n\n export type NavigationReason = 'next' | 'previous' | 'step' | 'skip';\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.\n * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.\n * @i18n\n */\n i18nStrings?: WizardProps.I18nStrings;\n\n /**\n * The text of the button that enables the user to submit the form.\n */\n submitButtonText?: string;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `submitButtonText` on the component instead.\n */\n submitButton?: string;\n\n stepNumberLabel?(stepNumber: number): string;\n collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton?: string;\n previousButton?: string;\n nextButton?: string;\n optional?: string;\n nextButtonLoadingAnnouncement?: string;\n submitButtonLoadingAnnouncement?: string;\n }\n\n export interface NavigateDetail {\n requestedStepIndex: number;\n reason: WizardProps.NavigationReason;\n }\n\n export type NavigationReason = 'next' | 'previous' | 'step' | 'skip';\n}\n"]}
@@ -2,6 +2,6 @@
2
2
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
3
  import { WizardProps } from './interfaces';
4
4
  type InternalWizardProps = WizardProps & InternalBaseComponentProps;
5
- export default function InternalWizard({ steps, activeStepIndex: controlledActiveStepIndex, isLoadingNextStep, allowSkipTo, secondaryActions, onCancel, onSubmit, onNavigate, __internalRootRef, ...rest }: InternalWizardProps): JSX.Element;
5
+ export default function InternalWizard({ steps, activeStepIndex: controlledActiveStepIndex, submitButtonText, isLoadingNextStep, allowSkipTo, secondaryActions, onCancel, onSubmit, onNavigate, __internalRootRef, ...rest }: InternalWizardProps): JSX.Element;
6
6
  export {};
7
7
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,KAAK,mBAAmB,GAAG,WAAW,GAAG,0BAA0B,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,iBAAyB,EACzB,WAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,eA6IrB"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,KAAK,mBAAmB,GAAG,WAAW,GAAG,0BAA0B,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,gBAAgB,EAChB,iBAAyB,EACzB,WAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,eA8IrB"}
@@ -18,8 +18,8 @@ import WizardForm from './wizard-form';
18
18
  import WizardNavigation from './wizard-navigation';
19
19
  import styles from './styles.css.js';
20
20
  export default function InternalWizard(_a) {
21
- var _b, _c;
22
- var { steps, activeStepIndex: controlledActiveStepIndex, isLoadingNextStep = false, allowSkipTo = false, secondaryActions, onCancel, onSubmit, onNavigate, __internalRootRef } = _a, rest = __rest(_a, ["steps", "activeStepIndex", "isLoadingNextStep", "allowSkipTo", "secondaryActions", "onCancel", "onSubmit", "onNavigate", "__internalRootRef"]);
21
+ var _b, _c, _d, _e, _f, _g, _h, _j;
22
+ var { steps, activeStepIndex: controlledActiveStepIndex, submitButtonText, isLoadingNextStep = false, allowSkipTo = false, secondaryActions, onCancel, onSubmit, onNavigate, __internalRootRef } = _a, rest = __rest(_a, ["steps", "activeStepIndex", "submitButtonText", "isLoadingNextStep", "allowSkipTo", "secondaryActions", "onCancel", "onSubmit", "onNavigate", "__internalRootRef"]);
23
23
  const baseProps = getBaseProps(rest);
24
24
  const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);
25
25
  const ref = useMergeRefs(breakpointsRef, __internalRootRef);
@@ -70,8 +70,8 @@ export default function InternalWizard(_a) {
70
70
  }
71
71
  };
72
72
  const i18n = useInternalI18n('wizard');
73
- const skipToButtonLabel = i18n('i18nStrings.skipToButtonLabel', rest.i18nStrings.skipToButtonLabel, format => task => format({ task__title: task.title }));
74
- const i18nStrings = Object.assign(Object.assign({}, rest.i18nStrings), { skipToButtonLabel, stepNumberLabel: i18n('i18nStrings.stepNumberLabel', (_b = rest.i18nStrings) === null || _b === void 0 ? void 0 : _b.stepNumberLabel, format => stepNumber => format({ stepNumber })), collapsedStepsLabel: i18n('i18nStrings.collapsedStepsLabel', (_c = rest.i18nStrings) === null || _c === void 0 ? void 0 : _c.collapsedStepsLabel, format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })), navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', rest.i18nStrings.navigationAriaLabel), cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings.cancelButton), previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings.previousButton), nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings.nextButton), optional: i18n('i18nStrings.optional', rest.i18nStrings.optional) });
73
+ const skipToButtonLabel = i18n('i18nStrings.skipToButtonLabel', (_b = rest.i18nStrings) === null || _b === void 0 ? void 0 : _b.skipToButtonLabel, format => task => format({ task__title: task.title }));
74
+ const i18nStrings = Object.assign(Object.assign({}, rest.i18nStrings), { skipToButtonLabel, stepNumberLabel: i18n('i18nStrings.stepNumberLabel', (_c = rest.i18nStrings) === null || _c === void 0 ? void 0 : _c.stepNumberLabel, format => stepNumber => format({ stepNumber })), collapsedStepsLabel: i18n('i18nStrings.collapsedStepsLabel', (_d = rest.i18nStrings) === null || _d === void 0 ? void 0 : _d.collapsedStepsLabel, format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })), navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', (_e = rest.i18nStrings) === null || _e === void 0 ? void 0 : _e.navigationAriaLabel), cancelButton: i18n('i18nStrings.cancelButton', (_f = rest.i18nStrings) === null || _f === void 0 ? void 0 : _f.cancelButton), previousButton: i18n('i18nStrings.previousButton', (_g = rest.i18nStrings) === null || _g === void 0 ? void 0 : _g.previousButton), nextButton: i18n('i18nStrings.nextButton', (_h = rest.i18nStrings) === null || _h === void 0 ? void 0 : _h.nextButton), optional: i18n('i18nStrings.optional', (_j = rest.i18nStrings) === null || _j === void 0 ? void 0 : _j.optional) });
75
75
  if (activeStepIndex && activeStepIndex >= steps.length) {
76
76
  warnOnce('Wizard', `You have set \`activeStepIndex\` to ${activeStepIndex} but you have provided only ${steps.length} steps. Its value is ignored and the component uses ${steps.length - 1} instead.`);
77
77
  }
@@ -83,6 +83,6 @@ export default function InternalWizard(_a) {
83
83
  React.createElement(WizardNavigation, { activeStepIndex: actualActiveStepIndex, farthestStepIndex: farthestStepIndex.current, allowSkipTo: allowSkipTo, hidden: smallContainer, i18nStrings: i18nStrings, isVisualRefresh: isVisualRefresh, isLoadingNextStep: isLoadingNextStep, onStepClick: onStepClick, onSkipToClick: onSkipToClick, steps: steps }),
84
84
  React.createElement("div", { className: clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container']) },
85
85
  isVisualRefresh && React.createElement("div", { className: clsx(styles.background, 'awsui-context-content-header') }),
86
- React.createElement(WizardForm, { steps: steps, isVisualRefresh: isVisualRefresh, showCollapsedSteps: smallContainer, i18nStrings: i18nStrings, activeStepIndex: actualActiveStepIndex, isPrimaryLoading: isLoadingNextStep, allowSkipTo: allowSkipTo, secondaryActions: secondaryActions, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onSkipToClick: onSkipToClick, onPrimaryClick: onPrimaryClick })))));
86
+ React.createElement(WizardForm, { steps: steps, isVisualRefresh: isVisualRefresh, showCollapsedSteps: smallContainer, i18nStrings: i18nStrings, submitButtonText: submitButtonText, activeStepIndex: actualActiveStepIndex, isPrimaryLoading: isLoadingNextStep, allowSkipTo: allowSkipTo, secondaryActions: secondaryActions, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onSkipToClick: onSkipToClick, onPrimaryClick: onPrimaryClick })))));
87
87
  }
88
88
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,mBAA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BAC/F,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,cAAc,EAClC,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,qBAAqB,EACtC,gBAAgB,EAAE,iBAAiB,EACnC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACE,CACF,CACF,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';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nimport { useInternalI18n } from '../internal/i18n/context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel';\nimport { getNameFromSelector, getSubStepAllSelector } from '../internal/analytics/selectors';\n\nimport WizardForm from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\n\nimport { WizardProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalWizardProps = WizardProps & InternalBaseComponentProps;\n\nexport default function InternalWizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n isLoadingNextStep = false,\n allowSkipTo = false,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n __internalRootRef,\n ...rest\n}: InternalWizardProps) {\n const baseProps = getBaseProps(rest);\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const { funnelInteractionId, funnelSubmit, funnelCancel, funnelProps, funnelNextOrSubmitAttempt } = useFunnel();\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n if (funnelInteractionId) {\n const stepNameSelector = `.${styles['form-header-component-wrapper']}`;\n const stepName = getNameFromSelector(stepNameSelector);\n\n FunnelMetrics.funnelStepNavigation({\n navigationType: reason,\n funnelInteractionId,\n stepNumber: actualActiveStepIndex + 1,\n stepName,\n stepNameSelector,\n destinationStepNumber: requestedStepIndex + 1,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n funnelCancel();\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n funnelNextOrSubmitAttempt();\n\n if (isLastStep) {\n funnelSubmit();\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n const i18n = useInternalI18n('wizard');\n const skipToButtonLabel = i18n(\n 'i18nStrings.skipToButtonLabel',\n rest.i18nStrings.skipToButtonLabel,\n format => task => format({ task__title: task.title })\n );\n\n const i18nStrings: WizardProps.I18nStrings = {\n ...rest.i18nStrings,\n skipToButtonLabel,\n stepNumberLabel: i18n(\n 'i18nStrings.stepNumberLabel',\n rest.i18nStrings?.stepNumberLabel,\n format => stepNumber => format({ stepNumber })\n ),\n collapsedStepsLabel: i18n(\n 'i18nStrings.collapsedStepsLabel',\n rest.i18nStrings?.collapsedStepsLabel,\n format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })\n ),\n navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', rest.i18nStrings.navigationAriaLabel),\n cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings.cancelButton),\n previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings.previousButton),\n nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings.nextButton),\n optional: i18n('i18nStrings.optional', rest.i18nStrings.optional),\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n return (\n <div {...baseProps} {...funnelProps} ref={ref} className={clsx(styles.root, baseProps.className)}>\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n {isVisualRefresh && <div className={clsx(styles.background, 'awsui-context-content-header')} />}\n <WizardForm\n steps={steps}\n isVisualRefresh={isVisualRefresh}\n showCollapsedSteps={smallContainer}\n i18nStrings={i18nStrings}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7F,OAAO,UAAU,MAAM,eAAe,C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,IACT,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,cAAc,EAClC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,qBAAqB,EACtC,gBAAgB,EAAE,iBAAiB,EACnC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACE,CACF,CACF,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';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nimport { useInternalI18n } from '../internal/i18n/context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel';\nimport { getNameFromSelector, getSubStepAllSelector } from '../internal/analytics/selectors';\n\nimport WizardForm from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\n\nimport { WizardProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalWizardProps = WizardProps & InternalBaseComponentProps;\n\nexport default function InternalWizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n submitButtonText,\n isLoadingNextStep = false,\n allowSkipTo = false,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n __internalRootRef,\n ...rest\n}: InternalWizardProps) {\n const baseProps = getBaseProps(rest);\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const { funnelInteractionId, funnelSubmit, funnelCancel, funnelProps, funnelNextOrSubmitAttempt } = useFunnel();\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n if (funnelInteractionId) {\n const stepNameSelector = `.${styles['form-header-component-wrapper']}`;\n const stepName = getNameFromSelector(stepNameSelector);\n\n FunnelMetrics.funnelStepNavigation({\n navigationType: reason,\n funnelInteractionId,\n stepNumber: actualActiveStepIndex + 1,\n stepName,\n stepNameSelector,\n destinationStepNumber: requestedStepIndex + 1,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n funnelCancel();\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n funnelNextOrSubmitAttempt();\n\n if (isLastStep) {\n funnelSubmit();\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n const i18n = useInternalI18n('wizard');\n const skipToButtonLabel = i18n(\n 'i18nStrings.skipToButtonLabel',\n rest.i18nStrings?.skipToButtonLabel,\n format => task => format({ task__title: task.title })\n );\n\n const i18nStrings: WizardProps.I18nStrings = {\n ...rest.i18nStrings,\n skipToButtonLabel,\n stepNumberLabel: i18n(\n 'i18nStrings.stepNumberLabel',\n rest.i18nStrings?.stepNumberLabel,\n format => stepNumber => format({ stepNumber })\n ),\n collapsedStepsLabel: i18n(\n 'i18nStrings.collapsedStepsLabel',\n rest.i18nStrings?.collapsedStepsLabel,\n format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })\n ),\n navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', rest.i18nStrings?.navigationAriaLabel),\n cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings?.cancelButton),\n previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings?.previousButton),\n nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings?.nextButton),\n optional: i18n('i18nStrings.optional', rest.i18nStrings?.optional),\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n return (\n <div {...baseProps} {...funnelProps} ref={ref} className={clsx(styles.root, baseProps.className)}>\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n {isVisualRefresh && <div className={clsx(styles.background, 'awsui-context-content-header')} />}\n <WizardForm\n steps={steps}\n isVisualRefresh={isVisualRefresh}\n showCollapsedSteps={smallContainer}\n i18nStrings={i18nStrings}\n submitButtonText={submitButtonText}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -6,6 +6,7 @@ interface WizardFormProps {
6
6
  isVisualRefresh: boolean;
7
7
  showCollapsedSteps: boolean;
8
8
  i18nStrings: WizardProps.I18nStrings;
9
+ submitButtonText?: string;
9
10
  isPrimaryLoading: boolean;
10
11
  allowSkipTo: boolean;
11
12
  secondaryActions?: React.ReactNode;
@@ -14,6 +15,6 @@ interface WizardFormProps {
14
15
  onPrimaryClick: () => void;
15
16
  onSkipToClick: (stepIndex: number) => void;
16
17
  }
17
- export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, showCollapsedSteps, i18nStrings, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }: WizardFormProps): JSX.Element;
18
+ export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, showCollapsedSteps, i18nStrings, submitButtonText, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }: WizardFormProps): JSX.Element;
18
19
  export {};
19
20
  //# sourceMappingURL=wizard-form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wizard-form.d.ts","sourceRoot":"lib/default/","sources":["wizard/wizard-form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAA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O,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,GACd,EAAE,eAAe,eAoEjB"}
@@ -10,7 +10,7 @@ import WizardFormHeader from './wizard-form-header';
10
10
  import styles from './styles.css.js';
11
11
  import { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';
12
12
  import { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';
13
- export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, showCollapsedSteps, i18nStrings, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }) {
13
+ export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, showCollapsedSteps, i18nStrings, submitButtonText, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }) {
14
14
  var _a;
15
15
  const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};
16
16
  const isLastStep = activeStepIndex >= steps.length - 1;
@@ -34,7 +34,7 @@ export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, sh
34
34
  React.createElement("span", { className: styles['form-header-component-wrapper'], tabIndex: -1, ref: stepHeaderRef },
35
35
  title,
36
36
  isOptional && React.createElement("i", null, ` - ${i18nStrings.optional}`)))),
37
- React.createElement(AnalyticsFunnelStep, { stepNameSelector: `.${styles['form-header-component-wrapper']}`, stepNumber: activeStepIndex + 1 }, ({ funnelStepProps }) => (React.createElement(InternalForm, Object.assign({ className: clsx(styles['form-component']), actions: React.createElement(WizardActions, { cancelButtonText: i18nStrings.cancelButton, primaryButtonText: isLastStep ? i18nStrings.submitButton : i18nStrings.nextButton, primaryButtonLoadingText: isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement, previousButtonText: i18nStrings.previousButton, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onPrimaryClick: onPrimaryClick, onSkipToClick: () => onSkipToClick(skipToTargetIndex), showPrevious: activeStepIndex !== 0, isPrimaryLoading: isPrimaryLoading, showSkipTo: showSkipTo, skipToButtonText: skipToButtonText }), secondaryActions: secondaryActions, errorText: errorText, errorIconAriaLabel: i18nStrings.errorIconAriaLabel }, funnelStepProps), content)))));
37
+ React.createElement(AnalyticsFunnelStep, { stepNameSelector: `.${styles['form-header-component-wrapper']}`, stepNumber: activeStepIndex + 1 }, ({ funnelStepProps }) => (React.createElement(InternalForm, Object.assign({ className: clsx(styles['form-component']), actions: React.createElement(WizardActions, { cancelButtonText: i18nStrings.cancelButton, primaryButtonText: isLastStep ? submitButtonText !== null && submitButtonText !== void 0 ? submitButtonText : i18nStrings.submitButton : i18nStrings.nextButton, primaryButtonLoadingText: isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement, previousButtonText: i18nStrings.previousButton, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onPrimaryClick: onPrimaryClick, onSkipToClick: () => onSkipToClick(skipToTargetIndex), showPrevious: activeStepIndex !== 0, isPrimaryLoading: isPrimaryLoading, showSkipTo: showSkipTo, skipToButtonText: skipToButtonText }), secondaryActions: secondaryActions, errorText: errorText, errorIconAriaLabel: i18nStrings.errorIconAriaLabel }, funnelStepProps), content)))));
38
38
  }
39
39
  function findSkipToTargetIndex(steps, activeStepIndex) {
40
40
  let nextRequiredStepIndex = activeStepIndex;
@@ -1 +1 @@
1
- {"version":3,"file":"wizard-form.js","sourceRoot":"lib/default/","sources":["wizard/wizard-form.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,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAiBxF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,GACG;;IAChB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IAClG,MAAM,UAAU,GAAG,eAAe,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACvD,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,MAAM,aAAa,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAE1D,iBAAiB,CAAC,GAAG,EAAE;;QACrB,IAAI,aAAa,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Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport WizardActions from './wizard-actions';\nimport { WizardProps } from './interfaces';\nimport WizardFormHeader from './wizard-form-header';\nimport styles from './styles.css.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\n\ninterface WizardFormProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n isVisualRefresh: boolean;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport default function WizardForm({\n steps,\n activeStepIndex,\n isVisualRefresh,\n showCollapsedSteps,\n i18nStrings,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps) {\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n const isMobile = useMobile();\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [activeStepIndex]);\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n return (\n <>\n <WizardFormHeader isMobile={isMobile || showCollapsedSteps} isVisualRefresh={isVisualRefresh}>\n <div className={clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'])}>\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader className={styles['form-header-component']} variant=\"h1\" description={description} info={info}>\n <span className={styles['form-header-component-wrapper']} tabIndex={-1} ref={stepHeaderRef}>\n {title}\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n <AnalyticsFunnelStep\n stepNameSelector={`.${styles['form-header-component-wrapper']}`}\n stepNumber={activeStepIndex + 1}\n >\n {({ funnelStepProps }) => (\n <InternalForm\n className={clsx(styles['form-component'])}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? i18nStrings.submitButton : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n {...funnelStepProps}\n >\n {content}\n </InternalForm>\n )}\n </AnalyticsFunnelStep>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}
1
+ {"version":3,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. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport WizardActions from './wizard-actions';\nimport { WizardProps } from './interfaces';\nimport WizardFormHeader from './wizard-form-header';\nimport styles from './styles.css.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\n\ninterface WizardFormProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n isVisualRefresh: boolean;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n submitButtonText?: string;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport default function WizardForm({\n steps,\n activeStepIndex,\n isVisualRefresh,\n showCollapsedSteps,\n i18nStrings,\n submitButtonText,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps) {\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n const isMobile = useMobile();\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [activeStepIndex]);\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n return (\n <>\n <WizardFormHeader isMobile={isMobile || showCollapsedSteps} isVisualRefresh={isVisualRefresh}>\n <div className={clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'])}>\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader className={styles['form-header-component']} variant=\"h1\" description={description} info={info}>\n <span className={styles['form-header-component-wrapper']} tabIndex={-1} ref={stepHeaderRef}>\n {title}\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n <AnalyticsFunnelStep\n stepNameSelector={`.${styles['form-header-component-wrapper']}`}\n stepNumber={activeStepIndex + 1}\n >\n {({ funnelStepProps }) => (\n <InternalForm\n className={clsx(styles['form-component'])}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? submitButtonText ?? i18nStrings.submitButton : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n {...funnelStepProps}\n >\n {content}\n </InternalForm>\n )}\n </AnalyticsFunnelStep>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}