@cloudscape-design/components 3.0.182 → 3.0.184

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.
@@ -1,25 +1,25 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "visible-content": "awsui_visible-content_tc96w_1b1c1_185",
5
- "visible-content-toggle": "awsui_visible-content-toggle_tc96w_1b1c1_186",
6
- "visible-content-groups": "awsui_visible-content-groups_tc96w_1b1c1_187",
7
- "visible-content-group": "awsui_visible-content-group_tc96w_1b1c1_187",
8
- "visible-content-title": "awsui_visible-content-title_tc96w_1b1c1_192",
9
- "visible-content-group-label": "awsui_visible-content-group-label_tc96w_1b1c1_200",
10
- "visible-content-option": "awsui_visible-content-option_tc96w_1b1c1_206",
11
- "visible-content-option-label": "awsui_visible-content-option-label_tc96w_1b1c1_217",
12
- "root": "awsui_root_tc96w_1b1c1_224",
13
- "modal-root": "awsui_modal-root_tc96w_1b1c1_225",
14
- "trigger-button": "awsui_trigger-button_tc96w_1b1c1_226",
15
- "cancel-button": "awsui_cancel-button_tc96w_1b1c1_227",
16
- "confirm-button": "awsui_confirm-button_tc96w_1b1c1_228",
17
- "custom": "awsui_custom_tc96w_1b1c1_229",
18
- "second-column-small": "awsui_second-column-small_tc96w_1b1c1_233",
19
- "wrap-lines": "awsui_wrap-lines_tc96w_1b1c1_237",
20
- "striped-rows": "awsui_striped-rows_tc96w_1b1c1_238",
21
- "page-size": "awsui_page-size_tc96w_1b1c1_239",
22
- "page-size-form-field": "awsui_page-size-form-field_tc96w_1b1c1_240",
23
- "page-size-radio-group": "awsui_page-size-radio-group_tc96w_1b1c1_241"
4
+ "visible-content": "awsui_visible-content_tc96w_17l6y_185",
5
+ "visible-content-toggle": "awsui_visible-content-toggle_tc96w_17l6y_186",
6
+ "visible-content-groups": "awsui_visible-content-groups_tc96w_17l6y_187",
7
+ "visible-content-group": "awsui_visible-content-group_tc96w_17l6y_187",
8
+ "visible-content-title": "awsui_visible-content-title_tc96w_17l6y_192",
9
+ "visible-content-group-label": "awsui_visible-content-group-label_tc96w_17l6y_201",
10
+ "visible-content-option": "awsui_visible-content-option_tc96w_17l6y_207",
11
+ "visible-content-option-label": "awsui_visible-content-option-label_tc96w_17l6y_218",
12
+ "root": "awsui_root_tc96w_17l6y_225",
13
+ "modal-root": "awsui_modal-root_tc96w_17l6y_226",
14
+ "trigger-button": "awsui_trigger-button_tc96w_17l6y_227",
15
+ "cancel-button": "awsui_cancel-button_tc96w_17l6y_228",
16
+ "confirm-button": "awsui_confirm-button_tc96w_17l6y_229",
17
+ "custom": "awsui_custom_tc96w_17l6y_230",
18
+ "second-column-small": "awsui_second-column-small_tc96w_17l6y_234",
19
+ "wrap-lines": "awsui_wrap-lines_tc96w_17l6y_238",
20
+ "striped-rows": "awsui_striped-rows_tc96w_17l6y_239",
21
+ "page-size": "awsui_page-size_tc96w_17l6y_240",
22
+ "page-size-form-field": "awsui_page-size-form-field_tc96w_17l6y_241",
23
+ "page-size-radio-group": "awsui_page-size-radio-group_tc96w_17l6y_242"
24
24
  };
25
25
 
@@ -182,62 +182,63 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
182
182
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
183
183
  SPDX-License-Identifier: Apache-2.0
184
184
  */
185
- .awsui_visible-content_tc96w_1b1c1_185:not(#\9),
186
- .awsui_visible-content-toggle_tc96w_1b1c1_186:not(#\9),
187
- .awsui_visible-content-groups_tc96w_1b1c1_187:not(#\9),
188
- .awsui_visible-content-group_tc96w_1b1c1_187:not(#\9) {
185
+ .awsui_visible-content_tc96w_17l6y_185:not(#\9),
186
+ .awsui_visible-content-toggle_tc96w_17l6y_186:not(#\9),
187
+ .awsui_visible-content-groups_tc96w_17l6y_187:not(#\9),
188
+ .awsui_visible-content-group_tc96w_17l6y_187:not(#\9) {
189
189
  /* used in test-utils */
190
190
  }
191
191
 
192
- .awsui_visible-content-title_tc96w_1b1c1_192:not(#\9) {
192
+ .awsui_visible-content-title_tc96w_17l6y_192:not(#\9) {
193
193
  font-size: var(--font-body-m-size-sregvd, 14px);
194
194
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
195
195
  font-weight: var(--font-display-label-weight-m18hjh, 700);
196
196
  color: var(--color-text-form-label-k3j0b4, #000716);
197
+ margin: 0;
197
198
  margin-bottom: var(--space-scaled-l-t03y3z, 20px);
198
199
  }
199
200
 
200
- .awsui_visible-content-group-label_tc96w_1b1c1_200:not(#\9) {
201
+ .awsui_visible-content-group-label_tc96w_17l6y_201:not(#\9) {
201
202
  color: var(--color-text-group-label-w9to2i, #414d5c);
202
203
  padding-bottom: var(--space-xs-rsr2qu, 8px);
203
204
  border-bottom: var(--border-divider-list-width-hacikr, 1px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
204
205
  }
205
206
 
206
- .awsui_visible-content-option_tc96w_1b1c1_206:not(#\9) {
207
+ .awsui_visible-content-option_tc96w_17l6y_207:not(#\9) {
207
208
  display: flex;
208
209
  flex-wrap: nowrap;
209
210
  justify-content: space-between;
210
211
  padding: var(--space-xs-rsr2qu, 8px) 0px var(--space-xs-rsr2qu, 8px) var(--space-scaled-l-t03y3z, 20px);
211
212
  border-bottom: var(--border-divider-list-width-hacikr, 1px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
212
213
  }
213
- .awsui_visible-content-option_tc96w_1b1c1_206:not(#\9):last-child {
214
+ .awsui_visible-content-option_tc96w_17l6y_207:not(#\9):last-child {
214
215
  border-bottom: none;
215
216
  }
216
217
 
217
- .awsui_visible-content-option-label_tc96w_1b1c1_217:not(#\9) {
218
+ .awsui_visible-content-option-label_tc96w_17l6y_218:not(#\9) {
218
219
  overflow: hidden;
219
220
  text-overflow: ellipsis;
220
221
  padding-right: var(--space-l-4vl6xu, 20px);
221
222
  flex-grow: 1;
222
223
  }
223
224
 
224
- .awsui_root_tc96w_1b1c1_224:not(#\9),
225
- .awsui_modal-root_tc96w_1b1c1_225:not(#\9),
226
- .awsui_trigger-button_tc96w_1b1c1_226:not(#\9),
227
- .awsui_cancel-button_tc96w_1b1c1_227:not(#\9),
228
- .awsui_confirm-button_tc96w_1b1c1_228:not(#\9),
229
- .awsui_custom_tc96w_1b1c1_229:not(#\9) {
225
+ .awsui_root_tc96w_17l6y_225:not(#\9),
226
+ .awsui_modal-root_tc96w_17l6y_226:not(#\9),
227
+ .awsui_trigger-button_tc96w_17l6y_227:not(#\9),
228
+ .awsui_cancel-button_tc96w_17l6y_228:not(#\9),
229
+ .awsui_confirm-button_tc96w_17l6y_229:not(#\9),
230
+ .awsui_custom_tc96w_17l6y_230:not(#\9) {
230
231
  /* used in test-utils */
231
232
  }
232
233
 
233
- .awsui_second-column-small_tc96w_1b1c1_233:not(#\9) {
234
+ .awsui_second-column-small_tc96w_17l6y_234:not(#\9) {
234
235
  padding-top: calc(2 * var(--space-scaled-l-t03y3z, 20px));
235
236
  }
236
237
 
237
- .awsui_wrap-lines_tc96w_1b1c1_237:not(#\9),
238
- .awsui_striped-rows_tc96w_1b1c1_238:not(#\9),
239
- .awsui_page-size_tc96w_1b1c1_239:not(#\9),
240
- .awsui_page-size-form-field_tc96w_1b1c1_240:not(#\9),
241
- .awsui_page-size-radio-group_tc96w_1b1c1_241:not(#\9) {
238
+ .awsui_wrap-lines_tc96w_17l6y_238:not(#\9),
239
+ .awsui_striped-rows_tc96w_17l6y_239:not(#\9),
240
+ .awsui_page-size_tc96w_17l6y_240:not(#\9),
241
+ .awsui_page-size-form-field_tc96w_17l6y_241:not(#\9),
242
+ .awsui_page-size-radio-group_tc96w_17l6y_242:not(#\9) {
242
243
  /* used in test-utils */
243
244
  }
@@ -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
- "visible-content": "awsui_visible-content_tc96w_1b1c1_185",
6
- "visible-content-toggle": "awsui_visible-content-toggle_tc96w_1b1c1_186",
7
- "visible-content-groups": "awsui_visible-content-groups_tc96w_1b1c1_187",
8
- "visible-content-group": "awsui_visible-content-group_tc96w_1b1c1_187",
9
- "visible-content-title": "awsui_visible-content-title_tc96w_1b1c1_192",
10
- "visible-content-group-label": "awsui_visible-content-group-label_tc96w_1b1c1_200",
11
- "visible-content-option": "awsui_visible-content-option_tc96w_1b1c1_206",
12
- "visible-content-option-label": "awsui_visible-content-option-label_tc96w_1b1c1_217",
13
- "root": "awsui_root_tc96w_1b1c1_224",
14
- "modal-root": "awsui_modal-root_tc96w_1b1c1_225",
15
- "trigger-button": "awsui_trigger-button_tc96w_1b1c1_226",
16
- "cancel-button": "awsui_cancel-button_tc96w_1b1c1_227",
17
- "confirm-button": "awsui_confirm-button_tc96w_1b1c1_228",
18
- "custom": "awsui_custom_tc96w_1b1c1_229",
19
- "second-column-small": "awsui_second-column-small_tc96w_1b1c1_233",
20
- "wrap-lines": "awsui_wrap-lines_tc96w_1b1c1_237",
21
- "striped-rows": "awsui_striped-rows_tc96w_1b1c1_238",
22
- "page-size": "awsui_page-size_tc96w_1b1c1_239",
23
- "page-size-form-field": "awsui_page-size-form-field_tc96w_1b1c1_240",
24
- "page-size-radio-group": "awsui_page-size-radio-group_tc96w_1b1c1_241"
5
+ "visible-content": "awsui_visible-content_tc96w_17l6y_185",
6
+ "visible-content-toggle": "awsui_visible-content-toggle_tc96w_17l6y_186",
7
+ "visible-content-groups": "awsui_visible-content-groups_tc96w_17l6y_187",
8
+ "visible-content-group": "awsui_visible-content-group_tc96w_17l6y_187",
9
+ "visible-content-title": "awsui_visible-content-title_tc96w_17l6y_192",
10
+ "visible-content-group-label": "awsui_visible-content-group-label_tc96w_17l6y_201",
11
+ "visible-content-option": "awsui_visible-content-option_tc96w_17l6y_207",
12
+ "visible-content-option-label": "awsui_visible-content-option-label_tc96w_17l6y_218",
13
+ "root": "awsui_root_tc96w_17l6y_225",
14
+ "modal-root": "awsui_modal-root_tc96w_17l6y_226",
15
+ "trigger-button": "awsui_trigger-button_tc96w_17l6y_227",
16
+ "cancel-button": "awsui_cancel-button_tc96w_17l6y_228",
17
+ "confirm-button": "awsui_confirm-button_tc96w_17l6y_229",
18
+ "custom": "awsui_custom_tc96w_17l6y_230",
19
+ "second-column-small": "awsui_second-column-small_tc96w_17l6y_234",
20
+ "wrap-lines": "awsui_wrap-lines_tc96w_17l6y_238",
21
+ "striped-rows": "awsui_striped-rows_tc96w_17l6y_239",
22
+ "page-size": "awsui_page-size_tc96w_17l6y_240",
23
+ "page-size-form-field": "awsui_page-size-form-field_tc96w_17l6y_241",
24
+ "page-size-radio-group": "awsui_page-size-radio-group_tc96w_17l6y_242"
25
25
  };
26
26
 
@@ -31,7 +31,7 @@ export default function VisibleContentPreference(_a) {
31
31
  };
32
32
  var outerGroupLabelId = "".concat(idPrefix, "-outer");
33
33
  return (React.createElement("div", { className: styles['visible-content'] },
34
- React.createElement("div", __assign({}, className('title'), { id: outerGroupLabelId }), title),
34
+ React.createElement("h3", __assign({}, className('title'), { id: outerGroupLabelId }), title),
35
35
  React.createElement(InternalSpaceBetween, __assign({}, className('groups'), { size: "xs" }), options.map(function (optionGroup, optionGroupIndex) {
36
36
  var groupLabelId = "".concat(idPrefix, "-").concat(optionGroupIndex);
37
37
  return (React.createElement("div", __assign({ key: optionGroupIndex }, className('group'), { role: "group", "aria-labelledby": "".concat(outerGroupLabelId, " ").concat(groupLabelId) }),
@@ -1 +1 @@
1
- {"version":3,"file":"visible-content.js","sourceRoot":"","sources":["../../../src/collection-preferences/visible-content.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,IAAM,SAAS,GAAG,UAAC,EAA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,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,WAAW;oBAC3C,OAAA,eAAe,CAAC,MAAM,EAAE,gBAAgB,EAAE,WAAW,CAAC;gBAAtD,CAAsD,CACvD,CACG,CACF,CACP,CAAC;QACJ,CAAC,CAAC,CACmB,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalToggle from '../toggle/internal';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\n\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nconst isVisible = (id: string, visibleIds: ReadonlyArray<string>) => visibleIds.indexOf(id) !== -1;\n\ninterface ClassNameProps {\n className: string;\n}\nconst className = (suffix: string): ClassNameProps => ({\n className: styles[`visible-content-${suffix}`],\n});\n\ninterface VisibleContentPreferenceProps extends CollectionPreferencesProps.VisibleContentPreference {\n onChange: (value: ReadonlyArray<string>) => void;\n value?: ReadonlyArray<string>;\n}\n\nexport default function VisibleContentPreference({\n title,\n options,\n value = [],\n onChange,\n}: VisibleContentPreferenceProps) {\n const idPrefix = useUniqueId('visible-content');\n\n const flatOptionsIds = options.reduce<string[]>(\n (ids, group) => [...ids, ...group.options.reduce<string[]>((groupIds, option) => [...groupIds, option.id], [])],\n []\n );\n\n const onToggle = (id: string) => {\n if (!isVisible(id, value)) {\n onChange(\n [...value, id].sort((firstId, secondId) => flatOptionsIds.indexOf(firstId) - flatOptionsIds.indexOf(secondId))\n );\n } else {\n onChange(value.filter(currentId => currentId !== id));\n }\n };\n\n const selectionOption = (\n option: CollectionPreferencesProps.VisibleContentOption,\n optionGroupIndex: number,\n optionIndex: number\n ) => {\n const labelId = `${idPrefix}-${optionGroupIndex}-${optionIndex}`;\n return (\n <div key={optionIndex} {...className('option')}>\n <label {...className('option-label')} htmlFor={labelId}>\n {option.label}\n </label>\n <div {...className('toggle')}>\n <InternalToggle\n checked={isVisible(option.id, value)}\n onChange={() => onToggle(option.id)}\n disabled={option.editable === false}\n controlId={labelId}\n />\n </div>\n </div>\n );\n };\n\n const outerGroupLabelId = `${idPrefix}-outer`;\n return (\n <div className={styles['visible-content']}>\n <div {...className('title')} id={outerGroupLabelId}>\n {title}\n </div>\n <InternalSpaceBetween {...className('groups')} size=\"xs\">\n {options.map((optionGroup, optionGroupIndex) => {\n const groupLabelId = `${idPrefix}-${optionGroupIndex}`;\n return (\n <div\n key={optionGroupIndex}\n {...className('group')}\n role=\"group\"\n aria-labelledby={`${outerGroupLabelId} ${groupLabelId}`}\n >\n <div {...className('group-label')} id={groupLabelId}>\n {optionGroup.label}\n </div>\n <div>\n {optionGroup.options.map((option, optionIndex) =>\n selectionOption(option, optionGroupIndex, optionIndex)\n )}\n </div>\n </div>\n );\n })}\n </InternalSpaceBetween>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"visible-content.js","sourceRoot":"","sources":["../../../src/collection-preferences/visible-content.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,IAAM,SAAS,GAAG,UAAC,EAAU,EAAE,UAAiC,IAAK,OAAA,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAA7B,CAA6B,CAAC;AAKnG,IAAM,SAAS,GAAG,UAAC,MAAc,IAAqB,OAAA,CAAC;IACrD,SAAS,EAAE,MAAM,CAAC,0BAAmB,MAAM,CAAE,CAAC;CAC/C,CAAC,EAFoD,CAEpD,CAAC;AAOH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAA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\nimport React from 'react';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalToggle from '../toggle/internal';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\n\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nconst isVisible = (id: string, visibleIds: ReadonlyArray<string>) => visibleIds.indexOf(id) !== -1;\n\ninterface ClassNameProps {\n className: string;\n}\nconst className = (suffix: string): ClassNameProps => ({\n className: styles[`visible-content-${suffix}`],\n});\n\ninterface VisibleContentPreferenceProps extends CollectionPreferencesProps.VisibleContentPreference {\n onChange: (value: ReadonlyArray<string>) => void;\n value?: ReadonlyArray<string>;\n}\n\nexport default function VisibleContentPreference({\n title,\n options,\n value = [],\n onChange,\n}: VisibleContentPreferenceProps) {\n const idPrefix = useUniqueId('visible-content');\n\n const flatOptionsIds = options.reduce<string[]>(\n (ids, group) => [...ids, ...group.options.reduce<string[]>((groupIds, option) => [...groupIds, option.id], [])],\n []\n );\n\n const onToggle = (id: string) => {\n if (!isVisible(id, value)) {\n onChange(\n [...value, id].sort((firstId, secondId) => flatOptionsIds.indexOf(firstId) - flatOptionsIds.indexOf(secondId))\n );\n } else {\n onChange(value.filter(currentId => currentId !== id));\n }\n };\n\n const selectionOption = (\n option: CollectionPreferencesProps.VisibleContentOption,\n optionGroupIndex: number,\n optionIndex: number\n ) => {\n const labelId = `${idPrefix}-${optionGroupIndex}-${optionIndex}`;\n return (\n <div key={optionIndex} {...className('option')}>\n <label {...className('option-label')} htmlFor={labelId}>\n {option.label}\n </label>\n <div {...className('toggle')}>\n <InternalToggle\n checked={isVisible(option.id, value)}\n onChange={() => onToggle(option.id)}\n disabled={option.editable === false}\n controlId={labelId}\n />\n </div>\n </div>\n );\n };\n\n const outerGroupLabelId = `${idPrefix}-outer`;\n return (\n <div className={styles['visible-content']}>\n <h3 {...className('title')} id={outerGroupLabelId}>\n {title}\n </h3>\n <InternalSpaceBetween {...className('groups')} size=\"xs\">\n {options.map((optionGroup, optionGroupIndex) => {\n const groupLabelId = `${idPrefix}-${optionGroupIndex}`;\n return (\n <div\n key={optionGroupIndex}\n {...className('group')}\n role=\"group\"\n aria-labelledby={`${outerGroupLabelId} ${groupLabelId}`}\n >\n <div {...className('group-label')} id={groupLabelId}>\n {optionGroup.label}\n </div>\n <div>\n {optionGroup.options.map((option, optionIndex) =>\n selectionOption(option, optionGroupIndex, optionIndex)\n )}\n </div>\n </div>\n );\n })}\n </InternalSpaceBetween>\n </div>\n );\n}\n"]}
@@ -34,7 +34,7 @@ export interface FlashbarProps extends BaseComponentProps {
34
34
  * When a user clicks on this button the `onDismiss` handler is called.
35
35
  * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.
36
36
  * * `statusIconAriaLabel` (string) - Specifies an `aria-label` for to the status icon for improved accessibility.
37
- * * `ariaRole` (boolean) - For flash messages added after page load, specifies how this message is communicated to assistive
37
+ * * `ariaRole` (string) - For flash messages added after page load, specifies how this message is communicated to assistive
38
38
  * technology. Use "status" for status updates or informational content. Use "alert" for important messages that need the
39
39
  * user's attention.
40
40
  * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,
@@ -44,11 +44,9 @@ export interface FlashbarProps extends BaseComponentProps {
44
44
  * If the `action` property is set, this property is ignored. **Deprecated**, replaced by `action`.
45
45
  * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button
46
46
  * using the `action` property. **Deprecated**, replaced by `action`.
47
- * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:
47
+ * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:
48
48
  * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.
49
49
  * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.
50
- *
51
- * @visualrefresh `id` property
52
50
  */
53
51
  items: ReadonlyArray<FlashbarProps.MessageDefinition>;
54
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","s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IACvD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC;IAC7C,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;CACvD;AAED,yBAAiB,oBAAoB,CAAC;IACpC,UAAiB,UAAU;QACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { ButtonProps } from '../button/interfaces';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n statusIconAriaLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n ariaRole?: FlashbarProps.AriaRole;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error';\n export type AriaRole = 'alert' | 'status';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `statusIconAriaLabel` (string) - Specifies an `aria-label` for to the status icon for improved accessibility.\n * * `ariaRole` (boolean) - For flash messages added after page load, specifies how this message is communicated to assistive\n * technology. Use \"status\" for status updates or informational content. Use \"alert\" for important messages that need the\n * user's attention.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called.\n * If the `action` property is set, this property is ignored. **Deprecated**, replaced by `action`.\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n *\n * @visualrefresh `id` property\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n}\n\nexport interface StackedFlashbarProps {\n stackItems: true;\n ariaLabels?: StackedFlashbarProps.AriaLabels;\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n}\n\nexport namespace StackedFlashbarProps {\n export interface AriaLabels {\n stackCollapseLabel?: string;\n stackExpandLabel?: string;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { ButtonProps } from '../button/interfaces';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n statusIconAriaLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n ariaRole?: FlashbarProps.AriaRole;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error';\n export type AriaRole = 'alert' | 'status';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `statusIconAriaLabel` (string) - Specifies an `aria-label` for to the status icon for improved accessibility.\n * * `ariaRole` (string) - For flash messages added after page load, specifies how this message is communicated to assistive\n * technology. Use \"status\" for status updates or informational content. Use \"alert\" for important messages that need the\n * user's attention.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called.\n * If the `action` property is set, this property is ignored. **Deprecated**, replaced by `action`.\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n}\n\nexport interface StackedFlashbarProps {\n stackItems: true;\n ariaLabels?: StackedFlashbarProps.AriaLabels;\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n}\n\nexport namespace StackedFlashbarProps {\n export interface AriaLabels {\n stackCollapseLabel?: string;\n stackExpandLabel?: string;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
 
2
- export var PACKAGE_VERSION = '3.0.0 (e46a00a)';
2
+ export var PACKAGE_VERSION = '3.0.0 (ed68979)';
3
3
  export var THEME = 'open-source-visual-refresh';
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "e46a00a79d74167ce64e90c215164d0c3e18fe71"
2
+ "commit": "ed68979606c1e81f9bd6d30c27f27aaa4b6501b0"
3
3
  }
package/package.json CHANGED
@@ -81,7 +81,7 @@
81
81
  "./internal/base-component/index.js",
82
82
  "./internal/base-component/styles.css.js"
83
83
  ],
84
- "version": "3.0.182",
84
+ "version": "3.0.184",
85
85
  "repository": {
86
86
  "type": "git",
87
87
  "url": "https://github.com/cloudscape-design/components.git"
@@ -55,6 +55,13 @@ export interface SideNavigationProps extends BaseComponentProps {
55
55
  * Although there is no technical limitation to the nesting level,
56
56
  * our UX recommendation is to use only one level.
57
57
  *
58
+ * #### Section Group
59
+ * Aggregates a set of items that are conceptually related to each other, and can be displayed under a single heading to provide further organization.
60
+ * You can nest sections, links, link groups and expandable link groups within a section group depending on your information architecture needs.
61
+ * - `type`: `'section-group'`.
62
+ * - `title` (string) - Specifies the text to display as a title of the section group.
63
+ * - `items` (array) - Specifies the content of the section header group. You can use `Section`, `Link`, `LinkGroup`, `ExpandableLinkGroup`.
64
+ *
58
65
  * #### LinkGroup
59
66
  * Object that represents a group of links.
60
67
  * - `type`: `'link-group'`.
@@ -130,6 +137,11 @@ export declare namespace SideNavigationProps {
130
137
  items: ReadonlyArray<Item>;
131
138
  defaultExpanded?: boolean;
132
139
  }
140
+ interface SectionGroup {
141
+ type: 'section-group';
142
+ title: string;
143
+ items: ReadonlyArray<Section | Link | LinkGroup | ExpandableLinkGroup>;
144
+ }
133
145
  interface LinkGroup {
134
146
  type: 'link-group';
135
147
  text: string;
@@ -143,7 +155,7 @@ export declare namespace SideNavigationProps {
143
155
  items: ReadonlyArray<Item>;
144
156
  defaultExpanded?: boolean;
145
157
  }
146
- type Item = Divider | Link | Section | LinkGroup | ExpandableLinkGroup;
158
+ type Item = Divider | Link | Section | LinkGroup | ExpandableLinkGroup | SectionGroup;
147
159
  interface ChangeDetail {
148
160
  item: Section | ExpandableLinkGroup;
149
161
  expanded: boolean;
@@ -152,7 +164,7 @@ export declare namespace SideNavigationProps {
152
164
  interface FollowDetail extends BaseNavigationDetail {
153
165
  text?: string;
154
166
  href: string;
155
- type?: 'link' | 'link-group' | 'expandable-link-group';
167
+ type?: 'link' | 'link-group' | 'expandable-link-group' | 'section-header';
156
168
  info?: React.ReactNode;
157
169
  }
158
170
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/interfaces.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE7G,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC;IAEpC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuD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AAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B;IAED,KAAY,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,GAAG,mBAAmB,GAAG,YAAY,CAAC;IAE7F,UAAiB,YAAY;QAC3B,IAAI,EAAE,OAAO,GAAG,mBAAmB,CAAC;QACpC,QAAQ,EAAE,OAAO,CAAC;QAClB,iBAAiB,EAAE,aAAa,CAAC,OAAO,GAAG,mBAAmB,CAAC,CAAC;KACjE;IAED,UAAiB,YAAa,SAAQ,oBAAoB;QACxD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,uBAAuB,GAAG,gBAAgB,CAAC;QAC1E,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KACxB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/side-navigation/interfaces.tsx"],"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 { BaseNavigationDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';\n\nexport interface SideNavigationProps extends BaseComponentProps {\n /**\n * Controls the header that appears at the top of the navigation component.\n *\n * It contains the following:\n * - `text` (string) - Specifies the header text.\n * - `href` (string) - Specifies the `href` that the header links to.\n * - `logo` (object) - Specifies a logo image.\n */\n header?: SideNavigationProps.Header;\n\n /**\n * Specifies the `href` of the currently active link.\n * All items within the navigation with a matching `href` are highlighted.\n *\n * `Sections` and `Expandable Page Groups` that contain a highlighted item\n * are automatically expanded, unless their definitions have the `defaultExpanded`\n * property explicitly set to `false`.\n */\n activeHref?: string;\n\n /**\n * Specifies the items to be displayed in the navigation.\n * Allowed objects are: `Link`, `Divider`, `Section`, `LinkGroup` and `ExpandableLinkGroup`.\n *\n * You can inject extra properties (for example, an ID)\n * in order to identify the item when it's used in an event `detail`\n * (for more information, see the events section below).\n *\n * #### Link\n * Object that represents an anchor in the navigation.\n * Links are rendered as `<a>` tags.\n * - `type` - `'link'`.\n * - `text` (string) - Specifies the link text.\n * - `href` (string) - Specifies the `href` of the link.\n * - `external` (boolean) - Determines whether to display an external link icon next to the link.\n * If set to `true`, an external link icon appears next to the link.\n * The anchor also has the attributes `target=\"_blank\"` and `rel=\"noopener\"`.\n * Additionally, the `activeHref` property won't be modified when a user chooses the link.\n * - `externalIconAriaLabel` (string) - Adds an aria-label to the external icon.\n * - `info` (ReactNode) - Enables you to display content next to the link. Although it is technically possible to insert any content,\n * our UX guidelines allow only to add a Badge and/or a \"New\" label.\n *\n * #### Divider\n * Object that represents a horizontal divider between navigation content.\n * It contains `type`: `'divider'` only.\n *\n * #### Section\n * Object that represents a section within the navigation.\n * - `type`: `'section'`.\n * - `text` (string) - Specifies the text to display as a title of the section.\n * - `defaultExpanded` (boolean) - Determines whether the section should be expanded by default. Default value is `true`.\n * - `items` (array) - Specifies the content of the section. You can use any valid item from this list.\n * Although there is no technical limitation to the nesting level,\n * our UX recommendation is to use only one level.\n *\n * #### LinkGroup\n * Object that represents a group of links.\n * - `type`: `'link-group'`.\n * - `text` (string) - Specifies the text of the group link.\n * - `href` (string) - Specifies the `href` of the group link.\n * - `items` (array) - Specifies the content of the section. You can use any valid item from this list.\n * Although there is no technical limitation to the nesting level,\n * our UX recommendation is to use only one level.\n *\n * #### ExpandableLinkGroup\n *\n * Object that represents an expandable group of links.\n * - `type`: `'expandable-link-group'`.\n * - `text` (string) - Specifies the text of the group link.\n * - `href` (string) - Specifies the `href` of the group link.\n * - `defaultExpanded` (boolean) - Specifies whether the group should be expanded by default.\n * If not explicitly set, the group is collapsed by default, unless one of the nested links is active.\n * - `items` (array) - Specifies the content of the section. You can use any valid item from this list.\n * Although there is no technical limitation to the nesting level,\n * our UX recommendation is to use only one level.\n */\n items?: ReadonlyArray<SideNavigationProps.Item>;\n\n /**\n * Fired when an anchor is clicked without any modifier (that is, CTRL, ALT, SHIFT).\n * The event `detail` contains a definition of the clicked item.\n * Use this event to prevent default browser navigation (by calling `preventDefault` method)\n * and branch your own routing.\n *\n * If the event is prevented the `activeHref` property won't be automatically set\n * to the href of the clicked item so you'll have to do it yourself.\n */\n onFollow?: CancelableEventHandler<SideNavigationProps.FollowDetail>;\n\n /**\n * Fired when the expansion state of `Section` or `ExpandablePageGroup` items changes\n * as a result of a user interaction. The event `detail` contains an object with information about the changed item.\n *\n * - `item` (object) - Specifies the item that was changed.\n * - `expanded` (boolean) - Specifies whether the item is expanded or not.\n * - `expandableParents` (array) - A list of parent items that have a type of `Section`\n * or `ExpandablePageGroup`. Use this `expandableParents` array to set their expanded\n * state to `true` if you want your data model to keep track of the current state\n * of the navigation items.\n *\n * Note: If the expansion is a result of the activation of a nested link\n * upon changing the `activeHref` property, this event isn't raised.\n */\n onChange?: NonCancelableEventHandler<SideNavigationProps.ChangeDetail>;\n}\n\nexport namespace SideNavigationProps {\n export interface Logo {\n src: string;\n alt?: string;\n }\n export interface Header {\n text?: string;\n href: string;\n logo?: Logo;\n }\n\n export interface Divider {\n type: 'divider';\n }\n\n export interface Link {\n type: 'link';\n text: string;\n href: string;\n external?: boolean;\n externalIconAriaLabel?: string;\n info?: React.ReactNode;\n }\n\n export interface Section {\n type: 'section';\n text: string;\n items: ReadonlyArray<Item>;\n defaultExpanded?: boolean;\n }\n\n export interface LinkGroup {\n type: 'link-group';\n text: string;\n href: string;\n items: ReadonlyArray<Item>;\n }\n\n export interface ExpandableLinkGroup {\n type: 'expandable-link-group';\n text: string;\n href: string;\n items: ReadonlyArray<Item>;\n defaultExpanded?: boolean;\n }\n\n export type Item = Divider | Link | Section | LinkGroup | ExpandableLinkGroup;\n\n export interface ChangeDetail {\n item: Section | ExpandableLinkGroup;\n expanded: boolean;\n expandableParents: ReadonlyArray<Section | ExpandableLinkGroup>;\n }\n\n export interface FollowDetail extends BaseNavigationDetail {\n text?: string;\n href: string;\n type?: 'link' | 'link-group' | 'expandable-link-group';\n info?: React.ReactNode;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/side-navigation/interfaces.tsx"],"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 { BaseNavigationDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';\n\nexport interface SideNavigationProps extends BaseComponentProps {\n /**\n * Controls the header that appears at the top of the navigation component.\n *\n * It contains the following:\n * - `text` (string) - Specifies the header text.\n * - `href` (string) - Specifies the `href` that the header links to.\n * - `logo` (object) - Specifies a logo image.\n */\n header?: SideNavigationProps.Header;\n\n /**\n * Specifies the `href` of the currently active link.\n * All items within the navigation with a matching `href` are highlighted.\n *\n * `Sections` and `Expandable Page Groups` that contain a highlighted item\n * are automatically expanded, unless their definitions have the `defaultExpanded`\n * property explicitly set to `false`.\n */\n activeHref?: string;\n\n /**\n * Specifies the items to be displayed in the navigation.\n * Allowed objects are: `Link`, `Divider`, `Section`, `LinkGroup` and `ExpandableLinkGroup`.\n *\n * You can inject extra properties (for example, an ID)\n * in order to identify the item when it's used in an event `detail`\n * (for more information, see the events section below).\n *\n * #### Link\n * Object that represents an anchor in the navigation.\n * Links are rendered as `<a>` tags.\n * - `type` - `'link'`.\n * - `text` (string) - Specifies the link text.\n * - `href` (string) - Specifies the `href` of the link.\n * - `external` (boolean) - Determines whether to display an external link icon next to the link.\n * If set to `true`, an external link icon appears next to the link.\n * The anchor also has the attributes `target=\"_blank\"` and `rel=\"noopener\"`.\n * Additionally, the `activeHref` property won't be modified when a user chooses the link.\n * - `externalIconAriaLabel` (string) - Adds an aria-label to the external icon.\n * - `info` (ReactNode) - Enables you to display content next to the link. Although it is technically possible to insert any content,\n * our UX guidelines allow only to add a Badge and/or a \"New\" label.\n *\n * #### Divider\n * Object that represents a horizontal divider between navigation content.\n * It contains `type`: `'divider'` only.\n *\n * #### Section\n * Object that represents a section within the navigation.\n * - `type`: `'section'`.\n * - `text` (string) - Specifies the text to display as a title of the section.\n * - `defaultExpanded` (boolean) - Determines whether the section should be expanded by default. Default value is `true`.\n * - `items` (array) - Specifies the content of the section. You can use any valid item from this list.\n * Although there is no technical limitation to the nesting level,\n * our UX recommendation is to use only one level.\n *\n * #### Section Group\n * Aggregates a set of items that are conceptually related to each other, and can be displayed under a single heading to provide further organization.\n * You can nest sections, links, link groups and expandable link groups within a section group depending on your information architecture needs.\n * - `type`: `'section-group'`.\n * - `title` (string) - Specifies the text to display as a title of the section group.\n * - `items` (array) - Specifies the content of the section header group. You can use `Section`, `Link`, `LinkGroup`, `ExpandableLinkGroup`.\n *\n * #### LinkGroup\n * Object that represents a group of links.\n * - `type`: `'link-group'`.\n * - `text` (string) - Specifies the text of the group link.\n * - `href` (string) - Specifies the `href` of the group link.\n * - `items` (array) - Specifies the content of the section. You can use any valid item from this list.\n * Although there is no technical limitation to the nesting level,\n * our UX recommendation is to use only one level.\n *\n * #### ExpandableLinkGroup\n *\n * Object that represents an expandable group of links.\n * - `type`: `'expandable-link-group'`.\n * - `text` (string) - Specifies the text of the group link.\n * - `href` (string) - Specifies the `href` of the group link.\n * - `defaultExpanded` (boolean) - Specifies whether the group should be expanded by default.\n * If not explicitly set, the group is collapsed by default, unless one of the nested links is active.\n * - `items` (array) - Specifies the content of the section. You can use any valid item from this list.\n * Although there is no technical limitation to the nesting level,\n * our UX recommendation is to use only one level.\n */\n items?: ReadonlyArray<SideNavigationProps.Item>;\n\n /**\n * Fired when an anchor is clicked without any modifier (that is, CTRL, ALT, SHIFT).\n * The event `detail` contains a definition of the clicked item.\n * Use this event to prevent default browser navigation (by calling `preventDefault` method)\n * and branch your own routing.\n *\n * If the event is prevented the `activeHref` property won't be automatically set\n * to the href of the clicked item so you'll have to do it yourself.\n */\n onFollow?: CancelableEventHandler<SideNavigationProps.FollowDetail>;\n\n /**\n * Fired when the expansion state of `Section` or `ExpandablePageGroup` items changes\n * as a result of a user interaction. The event `detail` contains an object with information about the changed item.\n *\n * - `item` (object) - Specifies the item that was changed.\n * - `expanded` (boolean) - Specifies whether the item is expanded or not.\n * - `expandableParents` (array) - A list of parent items that have a type of `Section`\n * or `ExpandablePageGroup`. Use this `expandableParents` array to set their expanded\n * state to `true` if you want your data model to keep track of the current state\n * of the navigation items.\n *\n * Note: If the expansion is a result of the activation of a nested link\n * upon changing the `activeHref` property, this event isn't raised.\n */\n onChange?: NonCancelableEventHandler<SideNavigationProps.ChangeDetail>;\n}\n\nexport namespace SideNavigationProps {\n export interface Logo {\n src: string;\n alt?: string;\n }\n export interface Header {\n text?: string;\n href: string;\n logo?: Logo;\n }\n\n export interface Divider {\n type: 'divider';\n }\n\n export interface Link {\n type: 'link';\n text: string;\n href: string;\n external?: boolean;\n externalIconAriaLabel?: string;\n info?: React.ReactNode;\n }\n\n export interface Section {\n type: 'section';\n text: string;\n items: ReadonlyArray<Item>;\n defaultExpanded?: boolean;\n }\n\n export interface SectionGroup {\n type: 'section-group';\n title: string;\n items: ReadonlyArray<Section | Link | LinkGroup | ExpandableLinkGroup>;\n }\n export interface LinkGroup {\n type: 'link-group';\n text: string;\n href: string;\n items: ReadonlyArray<Item>;\n }\n\n export interface ExpandableLinkGroup {\n type: 'expandable-link-group';\n text: string;\n href: string;\n items: ReadonlyArray<Item>;\n defaultExpanded?: boolean;\n }\n\n export type Item = Divider | Link | Section | LinkGroup | ExpandableLinkGroup | SectionGroup;\n\n export interface ChangeDetail {\n item: Section | ExpandableLinkGroup;\n expanded: boolean;\n expandableParents: ReadonlyArray<Section | ExpandableLinkGroup>;\n }\n\n export interface FollowDetail extends BaseNavigationDetail {\n text?: string;\n href: string;\n type?: 'link' | 'link-group' | 'expandable-link-group' | 'section-header';\n info?: React.ReactNode;\n }\n}\n"]}
@@ -11,7 +11,7 @@ export interface HeaderProps extends BaseItemComponentProps {
11
11
  export declare function Header({ definition, activeHref, fireFollow }: HeaderProps): JSX.Element;
12
12
  export interface ItemListProps extends BaseItemComponentProps {
13
13
  items: ReadonlyArray<SideNavigationProps.Item>;
14
- variant: 'section' | 'link-group' | 'expandable-link-group' | 'root';
14
+ variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';
15
15
  }
16
16
  export declare function ItemList({ variant, items, activeHref, fireChange, fireFollow }: ItemListProps): JSX.Element;
17
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAMzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,OAAO,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACrH,UAAU,EAAE,CACV,IAAI,EACA,mBAAmB,CAAC,IAAI,GACxB,mBAAmB,CAAC,MAAM,GAC1B,mBAAmB,CAAC,SAAS,GAC7B,mBAAmB,CAAC,mBAAmB,EAC3C,KAAK,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,KAChC,IAAI,CAAC;CACX;AAED,MAAM,WAAW,WAAY,SAAQ,sBAAsB;IACzD,UAAU,EAAE,mBAAmB,CAAC,MAAM,CAAC;CACxC;AAED,wBAAgB,MAAM,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,WAAW,eAqCzE;AAED,MAAM,WAAW,aAAc,SAAQ,sBAAsB;IAC3D,KAAK,EAAE,aAAa,CAAC,m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AE,UAAU,EAAE,EAAE,aAAa,eAuC7F"}
@@ -5,6 +5,7 @@ import React, { useCallback, useState, useEffect, useMemo } from 'react';
5
5
  import clsx from 'clsx';
6
6
  import InternalExpandableSection from '../expandable-section/internal';
7
7
  import InternalIcon from '../icon/internal';
8
+ import InternalBox from '../box/internal';
8
9
  import styles from './styles.css.js';
9
10
  import { isPlainLeftClick } from '../internal/events';
10
11
  import useFocusVisible from '../internal/hooks/focus-visible';
@@ -33,9 +34,10 @@ export function ItemList(_a) {
33
34
  var variant = _a.variant, items = _a.items, activeHref = _a.activeHref, fireChange = _a.fireChange, fireFollow = _a.fireFollow;
34
35
  return (React.createElement("ul", { className: clsx(styles.list, styles["list-variant-".concat(variant)]) }, items.map(function (item, i) { return (React.createElement("li", { key: i, className: styles['list-item'] },
35
36
  item.type === 'link' && (React.createElement(Link, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow })),
36
- item.type === 'section' && (React.createElement(Section, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow })),
37
+ item.type === 'section' && (React.createElement(Section, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, variant: variant })),
38
+ item.type === 'section-group' && (React.createElement(SectionGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow })),
37
39
  item.type === 'link-group' && (React.createElement(LinkGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow })),
38
- item.type === 'expandable-link-group' && (React.createElement(ExpandableLinkGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow })),
40
+ item.type === 'expandable-link-group' && (React.createElement(ExpandableLinkGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, variant: variant })),
39
41
  ((i === 0 && item.type === 'divider') || (items[i + 1] && items[i + 1].type === 'divider')) && (React.createElement(Divider, { variant: "default" })))); })));
40
42
  }
41
43
  function Divider(_a) {
@@ -64,7 +66,7 @@ function Link(_a) {
64
66
  }
65
67
  function Section(_a) {
66
68
  var _b;
67
- var definition = _a.definition, activeHref = _a.activeHref, fireFollow = _a.fireFollow, fireChange = _a.fireChange;
69
+ var definition = _a.definition, activeHref = _a.activeHref, fireFollow = _a.fireFollow, fireChange = _a.fireChange, variant = _a.variant;
68
70
  var _c = useState((_b = definition.defaultExpanded) !== null && _b !== void 0 ? _b : true), expanded = _c[0], setExpanded = _c[1];
69
71
  var onExpandedChange = useCallback(function (e) {
70
72
  fireChange(definition, e.detail.expanded);
@@ -74,9 +76,15 @@ function Section(_a) {
74
76
  var _a;
75
77
  setExpanded((_a = definition.defaultExpanded) !== null && _a !== void 0 ? _a : true);
76
78
  }, [definition]);
77
- return (React.createElement(InternalExpandableSection, { variant: "footer", expanded: expanded, onChange: onExpandedChange, className: styles.section, headerText: definition.text },
79
+ return (React.createElement(InternalExpandableSection, { variant: "footer", expanded: expanded, onChange: onExpandedChange, className: clsx(styles.section, variant === 'section-group' && styles['section--no-ident']), headerText: definition.text },
78
80
  React.createElement(ItemList, { variant: "section", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref })));
79
81
  }
82
+ function SectionGroup(_a) {
83
+ var definition = _a.definition, activeHref = _a.activeHref, fireFollow = _a.fireFollow, fireChange = _a.fireChange;
84
+ return (React.createElement("div", { className: styles['section-group'] },
85
+ React.createElement(InternalBox, { className: styles['section-group-title'], variant: "h3" }, definition.title),
86
+ React.createElement(ItemList, { variant: "section-group", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref })));
87
+ }
80
88
  function LinkGroup(_a) {
81
89
  var definition = _a.definition, activeHref = _a.activeHref, fireFollow = _a.fireFollow, fireChange = _a.fireChange;
82
90
  checkSafeUrl('SideNavigation', definition.href);
@@ -85,7 +93,7 @@ function LinkGroup(_a) {
85
93
  React.createElement(ItemList, { variant: "link-group", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref })));
86
94
  }
87
95
  function ExpandableLinkGroup(_a) {
88
- var definition = _a.definition, fireFollow = _a.fireFollow, fireChange = _a.fireChange, activeHref = _a.activeHref;
96
+ var definition = _a.definition, fireFollow = _a.fireFollow, fireChange = _a.fireChange, activeHref = _a.activeHref, variant = _a.variant;
89
97
  // Check whether the definition contains an active link and memoize it to avoid
90
98
  // rechecking every time.
91
99
  var containsActiveLink = useMemo(function () {
@@ -119,7 +127,7 @@ function ExpandableLinkGroup(_a) {
119
127
  fireChange(definition, true);
120
128
  }
121
129
  };
122
- return (React.createElement(InternalExpandableSection, { className: styles['expandable-link-group'], variant: "navigation", expanded: userExpanded !== null && userExpanded !== void 0 ? userExpanded : expanded, onChange: onExpandedChange, headerText: React.createElement(Link, { definition: { type: 'link', href: definition.href, text: definition.text }, expanded: userExpanded !== null && userExpanded !== void 0 ? userExpanded : expanded, fireFollow: onHeaderFollow, fireChange: fireChange, activeHref: activeHref }) },
130
+ return (React.createElement(InternalExpandableSection, { className: clsx(styles['expandable-link-group'], variant === 'section-group' && styles['expandable-link-group--no-ident']), variant: "navigation", expanded: userExpanded !== null && userExpanded !== void 0 ? userExpanded : expanded, onChange: onExpandedChange, headerText: React.createElement(Link, { definition: { type: 'link', href: definition.href, text: definition.text }, expanded: userExpanded !== null && userExpanded !== void 0 ? userExpanded : expanded, fireFollow: onHeaderFollow, fireChange: fireChange, activeHref: activeHref }) },
123
131
  React.createElement(ItemList, { variant: "expandable-link-group", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref })));
124
132
  }
125
133
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/side-navigation/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,yBAAyB,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CAAC,QAAQ,CAAC,CAAC;QAC1C,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC,EACD,CAAC,UAAU,EAAE,UAAU,CAAC,CACzB,CAAC;IAEF,IAAM,cAAc,GAA4B,UAAC,CAAC,EAAE,KAAK;QACvD,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9B,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,QAAQ,EAAE;YACb,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,yBAAyB,IACxB,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAC1C,OAAO,EAAC,YAAY,EACpB,QAAQ,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,QAAQ,EAClC,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EACR,oBAAC,IAAI,IACH,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,EAC1E,QAAQ,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,QAAQ,EAClC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,GACtB;QAGJ,oBAAC,QAAQ,IACP,OAAO,EAAC,uBAAuB,EAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,GACtB,CACwB,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useState, useEffect, useMemo } from 'react';\nimport clsx from 'clsx';\nimport { ExpandableSectionProps } from '../expandable-section/interfaces';\nimport InternalExpandableSection from '../expandable-section/internal';\nimport InternalIcon from '../icon/internal';\n\nimport { SideNavigationProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { NonCancelableCustomEvent, isPlainLeftClick } from '../internal/events';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { hasActiveLink } from './util';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\n\ninterface BaseItemComponentProps {\n activeHref?: string;\n fireChange: (item: SideNavigationProps.Section | SideNavigationProps.ExpandableLinkGroup, expanded: boolean) => void;\n fireFollow: (\n item:\n | SideNavigationProps.Link\n | SideNavigationProps.Header\n | SideNavigationProps.LinkGroup\n | SideNavigationProps.ExpandableLinkGroup,\n event: React.SyntheticEvent | Event\n ) => void;\n}\n\nexport interface HeaderProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Header;\n}\n\nexport function Header({ definition, activeHref, fireFollow }: HeaderProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const focusVisible = useFocusVisible();\n\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n return (\n <>\n <h2 className={styles.header}>\n <a\n {...focusVisible}\n href={definition.href}\n className={clsx(styles['header-link'], { [styles['header-link--has-logo']]: !!definition.logo })}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n onClick={onClick}\n >\n {definition.logo && (\n <img\n className={clsx(styles['header-logo'], {\n [styles['header-logo--stretched']]: !definition.text,\n })}\n {...definition.logo}\n />\n )}\n <span className={styles['header-link-text']}>{definition.text}</span>\n </a>\n </h2>\n <Divider variant=\"header\" />\n </>\n );\n}\n\nexport interface ItemListProps extends BaseItemComponentProps {\n items: ReadonlyArray<SideNavigationProps.Item>;\n variant: 'section' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nexport function ItemList({ variant, items, activeHref, fireChange, fireFollow }: ItemListProps) {\n return (\n <ul className={clsx(styles.list, styles[`list-variant-${variant}`])}>\n {items.map((item, i) => (\n <li key={i} className={styles['list-item']}>\n {item.type === 'link' && (\n <Link definition={item} activeHref={activeHref} fireChange={fireChange} fireFollow={fireFollow} />\n )}\n {item.type === 'section' && (\n <Section definition={item} activeHref={activeHref} fireChange={fireChange} fireFollow={fireFollow} />\n )}\n {item.type === 'link-group' && (\n <LinkGroup definition={item} activeHref={activeHref} fireChange={fireChange} fireFollow={fireFollow} />\n )}\n {item.type === 'expandable-link-group' && (\n <ExpandableLinkGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n />\n )}\n {((i === 0 && item.type === 'divider') || (items[i + 1] && items[i + 1].type === 'divider')) && (\n <Divider variant=\"default\" />\n )}\n </li>\n ))}\n </ul>\n );\n}\n\ninterface DividerProps {\n variant: 'default' | 'header';\n}\n\nfunction Divider({ variant = 'default' }: DividerProps) {\n return <hr className={clsx(styles.divider, styles[`divider-${variant}`])} />;\n}\n\ninterface LinkProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Link;\n expanded?: boolean;\n}\n\nfunction Link({ definition, expanded, activeHref, fireFollow }: LinkProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const isActive = definition.href === activeHref;\n const focusVisible = useFocusVisible();\n\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n // Prevent the click event from toggling outer expandable sections.\n event.stopPropagation();\n\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n return (\n <>\n {/* https://github.com/yannickcr/eslint-plugin-react/issues/2962 */}\n {/* eslint-disable-next-line react/jsx-no-target-blank */}\n <a\n {...focusVisible}\n href={definition.href}\n className={clsx(styles.link, { [styles['link-active']]: isActive })}\n target={definition.external ? '_blank' : undefined}\n rel={definition.external ? 'noopener noreferrer' : undefined}\n aria-expanded={expanded}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n onClick={onClick}\n >\n {definition.text}\n {definition.external && (\n <span\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" className={styles['external-icon']} />\n </span>\n )}\n </a>\n {definition.info && <span className={styles.info}>{definition.info}</span>}\n </>\n );\n}\n\ninterface SectionProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Section;\n}\n\nfunction Section({ definition, activeHref, fireFollow, fireChange }: SectionProps) {\n const [expanded, setExpanded] = useState<boolean>(definition.defaultExpanded ?? true);\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n useEffect(() => {\n setExpanded(definition.defaultExpanded ?? true);\n }, [definition]);\n\n return (\n <InternalExpandableSection\n variant=\"footer\"\n expanded={expanded}\n onChange={onExpandedChange}\n className={styles.section}\n headerText={definition.text}\n >\n <ItemList\n variant=\"section\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n </InternalExpandableSection>\n );\n}\n\ninterface LinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.LinkGroup;\n}\n\nfunction LinkGroup({ definition, activeHref, fireFollow, fireChange }: LinkGroupProps) {\n checkSafeUrl('SideNavigation', definition.href);\n\n return (\n <>\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text }}\n fireFollow={(_, event) => fireFollow(definition, event)}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n <ItemList\n variant=\"link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n </>\n );\n}\n\ninterface ExpandableLinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.ExpandableLinkGroup;\n}\n\nfunction ExpandableLinkGroup({ definition, fireFollow, fireChange, activeHref }: ExpandableLinkGroupProps) {\n // Check whether the definition contains an active link and memoize it to avoid\n // rechecking every time.\n const containsActiveLink = useMemo(() => {\n return activeHref ? hasActiveLink(definition.items, activeHref) : false;\n }, [activeHref, definition.items]);\n\n const [expanded, setExpanded] = useState<boolean>(() => {\n return definition.defaultExpanded ?? (definition.href === activeHref || containsActiveLink);\n });\n\n const [userExpanded, setUserExpanded] = useState<boolean | undefined>();\n\n // Reset user expansion status when the items property is updated.\n useEffect(() => setUserExpanded(undefined), [definition]);\n\n // By default, the expandable section is open when there's an active link inside.\n useEffect(() => {\n setExpanded(definition.href === activeHref || containsActiveLink);\n }, [definition.href, containsActiveLink, activeHref]);\n\n // If the definition object itself is updated, reset the expansion state to default.\n useEffect(() => {\n if (definition.defaultExpanded !== undefined) {\n setExpanded(definition.defaultExpanded);\n }\n }, [definition]);\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setUserExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n const onHeaderFollow: LinkProps['fireFollow'] = (_, event) => {\n fireFollow(definition, event);\n setUserExpanded(true);\n if (!expanded) {\n fireChange(definition, true);\n }\n };\n\n return (\n <InternalExpandableSection\n className={styles['expandable-link-group']}\n variant=\"navigation\"\n expanded={userExpanded ?? expanded}\n onChange={onExpandedChange}\n headerText={\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text }}\n expanded={userExpanded ?? expanded}\n fireFollow={onHeaderFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n }\n >\n <ItemList\n variant=\"expandable-link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n </InternalExpandableSection>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/side-navigation/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,C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,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,yBAAyB,IACxB,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,uBAAuB,CAAC,EAC/B,OAAO,KAAK,eAAe,IAAI,MAAM,CAAC,iCAAiC,CAAC,CACzE,EACD,OAAO,EAAC,YAAY,EACpB,QAAQ,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,QAAQ,EAClC,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EACR,oBAAC,IAAI,IACH,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,EAC1E,QAAQ,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,QAAQ,EAClC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,GACtB;QAGJ,oBAAC,QAAQ,IACP,OAAO,EAAC,uBAAuB,EAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,GACtB,CACwB,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useState, useEffect, useMemo } from 'react';\nimport clsx from 'clsx';\nimport { ExpandableSectionProps } from '../expandable-section/interfaces';\nimport InternalExpandableSection from '../expandable-section/internal';\nimport InternalIcon from '../icon/internal';\nimport InternalBox from '../box/internal';\nimport { SideNavigationProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { NonCancelableCustomEvent, isPlainLeftClick } from '../internal/events';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { hasActiveLink } from './util';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\n\ninterface BaseItemComponentProps {\n activeHref?: string;\n fireChange: (item: SideNavigationProps.Section | SideNavigationProps.ExpandableLinkGroup, expanded: boolean) => void;\n fireFollow: (\n item:\n | SideNavigationProps.Link\n | SideNavigationProps.Header\n | SideNavigationProps.LinkGroup\n | SideNavigationProps.ExpandableLinkGroup,\n event: React.SyntheticEvent | Event\n ) => void;\n}\n\nexport interface HeaderProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Header;\n}\n\nexport function Header({ definition, activeHref, fireFollow }: HeaderProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const focusVisible = useFocusVisible();\n\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n return (\n <>\n <h2 className={styles.header}>\n <a\n {...focusVisible}\n href={definition.href}\n className={clsx(styles['header-link'], { [styles['header-link--has-logo']]: !!definition.logo })}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n onClick={onClick}\n >\n {definition.logo && (\n <img\n className={clsx(styles['header-logo'], {\n [styles['header-logo--stretched']]: !definition.text,\n })}\n {...definition.logo}\n />\n )}\n <span className={styles['header-link-text']}>{definition.text}</span>\n </a>\n </h2>\n <Divider variant=\"header\" />\n </>\n );\n}\n\nexport interface ItemListProps extends BaseItemComponentProps {\n items: ReadonlyArray<SideNavigationProps.Item>;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nexport function ItemList({ variant, items, activeHref, fireChange, fireFollow }: ItemListProps) {\n return (\n <ul className={clsx(styles.list, styles[`list-variant-${variant}`])}>\n {items.map((item, i) => (\n <li key={i} className={styles['list-item']}>\n {item.type === 'link' && (\n <Link definition={item} activeHref={activeHref} fireChange={fireChange} fireFollow={fireFollow} />\n )}\n {item.type === 'section' && (\n <Section\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n variant={variant}\n />\n )}\n {item.type === 'section-group' && (\n <SectionGroup definition={item} activeHref={activeHref} fireChange={fireChange} fireFollow={fireFollow} />\n )}\n {item.type === 'link-group' && (\n <LinkGroup definition={item} activeHref={activeHref} fireChange={fireChange} fireFollow={fireFollow} />\n )}\n {item.type === 'expandable-link-group' && (\n <ExpandableLinkGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n variant={variant}\n />\n )}\n {((i === 0 && item.type === 'divider') || (items[i + 1] && items[i + 1].type === 'divider')) && (\n <Divider variant=\"default\" />\n )}\n </li>\n ))}\n </ul>\n );\n}\n\ninterface DividerProps {\n variant: 'default' | 'header';\n}\n\nfunction Divider({ variant = 'default' }: DividerProps) {\n return <hr className={clsx(styles.divider, styles[`divider-${variant}`])} />;\n}\n\ninterface LinkProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Link;\n expanded?: boolean;\n}\n\nfunction Link({ definition, expanded, activeHref, fireFollow }: LinkProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const isActive = definition.href === activeHref;\n const focusVisible = useFocusVisible();\n\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n // Prevent the click event from toggling outer expandable sections.\n event.stopPropagation();\n\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n return (\n <>\n {/* https://github.com/yannickcr/eslint-plugin-react/issues/2962 */}\n {/* eslint-disable-next-line react/jsx-no-target-blank */}\n <a\n {...focusVisible}\n href={definition.href}\n className={clsx(styles.link, { [styles['link-active']]: isActive })}\n target={definition.external ? '_blank' : undefined}\n rel={definition.external ? 'noopener noreferrer' : undefined}\n aria-expanded={expanded}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n onClick={onClick}\n >\n {definition.text}\n {definition.external && (\n <span\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" className={styles['external-icon']} />\n </span>\n )}\n </a>\n {definition.info && <span className={styles.info}>{definition.info}</span>}\n </>\n );\n}\n\ninterface SectionProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Section;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nfunction Section({ definition, activeHref, fireFollow, fireChange, variant }: SectionProps) {\n const [expanded, setExpanded] = useState<boolean>(definition.defaultExpanded ?? true);\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n useEffect(() => {\n setExpanded(definition.defaultExpanded ?? true);\n }, [definition]);\n\n return (\n <InternalExpandableSection\n variant=\"footer\"\n expanded={expanded}\n onChange={onExpandedChange}\n className={clsx(styles.section, variant === 'section-group' && styles['section--no-ident'])}\n headerText={definition.text}\n >\n <ItemList\n variant=\"section\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n </InternalExpandableSection>\n );\n}\n\ninterface SectionGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.SectionGroup;\n}\n\nfunction SectionGroup({ definition, activeHref, fireFollow, fireChange }: SectionGroupProps) {\n return (\n <div className={styles['section-group']}>\n <InternalBox className={styles['section-group-title']} variant=\"h3\">\n {definition.title}\n </InternalBox>\n <ItemList\n variant=\"section-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n </div>\n );\n}\n\ninterface LinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.LinkGroup;\n}\n\nfunction LinkGroup({ definition, activeHref, fireFollow, fireChange }: LinkGroupProps) {\n checkSafeUrl('SideNavigation', definition.href);\n\n return (\n <>\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text }}\n fireFollow={(_, event) => fireFollow(definition, event)}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n <ItemList\n variant=\"link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n </>\n );\n}\n\ninterface ExpandableLinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.ExpandableLinkGroup;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nfunction ExpandableLinkGroup({ definition, fireFollow, fireChange, activeHref, variant }: ExpandableLinkGroupProps) {\n // Check whether the definition contains an active link and memoize it to avoid\n // rechecking every time.\n const containsActiveLink = useMemo(() => {\n return activeHref ? hasActiveLink(definition.items, activeHref) : false;\n }, [activeHref, definition.items]);\n\n const [expanded, setExpanded] = useState<boolean>(() => {\n return definition.defaultExpanded ?? (definition.href === activeHref || containsActiveLink);\n });\n\n const [userExpanded, setUserExpanded] = useState<boolean | undefined>();\n\n // Reset user expansion status when the items property is updated.\n useEffect(() => setUserExpanded(undefined), [definition]);\n\n // By default, the expandable section is open when there's an active link inside.\n useEffect(() => {\n setExpanded(definition.href === activeHref || containsActiveLink);\n }, [definition.href, containsActiveLink, activeHref]);\n\n // If the definition object itself is updated, reset the expansion state to default.\n useEffect(() => {\n if (definition.defaultExpanded !== undefined) {\n setExpanded(definition.defaultExpanded);\n }\n }, [definition]);\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setUserExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n const onHeaderFollow: LinkProps['fireFollow'] = (_, event) => {\n fireFollow(definition, event);\n setUserExpanded(true);\n if (!expanded) {\n fireChange(definition, true);\n }\n };\n\n return (\n <InternalExpandableSection\n className={clsx(\n styles['expandable-link-group'],\n variant === 'section-group' && styles['expandable-link-group--no-ident']\n )}\n variant=\"navigation\"\n expanded={userExpanded ?? expanded}\n onChange={onExpandedChange}\n headerText={\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text }}\n expanded={userExpanded ?? expanded}\n fireFollow={onHeaderFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n }\n >\n <ItemList\n variant=\"expandable-link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n />\n </InternalExpandableSection>\n );\n}\n"]}