@cloudscape-design/components 3.0.316 → 3.0.317

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 +1 @@
1
- {"version":3,"file":"expandable-section-header.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQlF,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,UAAU,4BAA4B;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;CACzC;AAcD,UAAU,4BAA6B,SAAQ,IAAI,CAAC,4BAA4B,EAAE,UAAU,GAAG,MAAM,CAAC;IACpG,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;IACxC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAkID,eAAO,MAAM,uBAAuB,oOAmBjC,4BAA4B,gBAuE9B,CAAC"}
1
+ {"version":3,"file":"expandable-section-header.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASlF,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,UAAU,4BAA4B;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;CACzC;AAcD,UAAU,4BAA6B,SAAQ,IAAI,CAAC,4BAA4B,EAAE,UAAU,GAAG,MAAM,CAAC;IACpG,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;IACxC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAqJD,eAAO,MAAM,uBAAuB,oOAmBjC,4BAA4B,gBA8E9B,CAAC"}
@@ -2,31 +2,42 @@ import React from 'react';
2
2
  import InternalIcon from '../icon/internal';
3
3
  import clsx from 'clsx';
4
4
  import styles from './styles.css.js';
5
- import InternalHeader from '../header/internal';
5
+ import InternalHeader, { Description as HeaderDescription } from '../header/internal';
6
6
  import { isDevelopment } from '../internal/is-development';
7
7
  import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
8
+ import { variantSupportsDescription } from './utils';
8
9
  export const componentName = 'ExpandableSection';
9
- const ExpandableDefaultHeader = ({ id, className, onClick, ariaLabel, ariaControls, expanded, children, icon, onKeyUp, onKeyDown, variant, }) => {
10
- return (React.createElement("div", { id: id, role: "button", className: clsx(className, styles['expand-button']), tabIndex: 0, onKeyUp: onKeyUp, onKeyDown: onKeyDown, onClick: onClick, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-expanded": expanded },
10
+ const ExpandableDeprecatedHeader = ({ id, className, onClick, ariaLabel, ariaControls, expanded, children, icon, onKeyUp, onKeyDown, variant, }) => {
11
+ return (React.createElement("div", { id: id, role: "button", className: clsx(className, styles['expand-button'], styles['click-target'], styles['header-deprecated']), tabIndex: 0, onKeyUp: onKeyUp, onKeyDown: onKeyDown, onClick: onClick, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-expanded": expanded },
11
12
  React.createElement("div", { className: clsx(styles['icon-container'], styles[`icon-container-${variant}`]) }, icon),
12
13
  children));
13
14
  };
14
15
  const ExpandableNavigationHeader = ({ id, className, onClick, ariaLabelledBy, ariaLabel, ariaControls, expanded, children, icon, }) => {
15
- return (React.createElement("div", { id: id, className: className, onClick: onClick },
16
+ return (React.createElement("div", { id: id, className: clsx(className, styles['click-target']), onClick: onClick },
16
17
  React.createElement("button", { className: clsx(styles['icon-container'], styles['expand-button']), "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-expanded": expanded, type: "button" }, icon),
17
18
  children));
18
19
  };
19
20
  const ExpandableHeaderTextWrapper = ({ id, descriptionId, className, onClick, ariaLabel, ariaControls, expanded, children, icon, headerDescription, headerCounter, headerInfo, headerActions, variant, headingTagOverride, onKeyUp, onKeyDown, }) => {
20
21
  const isContainer = variant === 'container';
22
+ const isDefault = variant === 'default';
21
23
  const HeadingTag = headingTagOverride || 'div';
22
24
  const hasInteractiveElements = isContainer && (headerInfo || headerActions);
23
25
  const listeners = { onClick, onKeyDown, onKeyUp };
24
- const wrapperListeners = hasInteractiveElements ? undefined : listeners;
26
+ // If interactive elements are present, constrain the clickable area to only the icon and the header text
27
+ // to prevent nesting interactive elements.
25
28
  const headerButtonListeners = hasInteractiveElements ? listeners : undefined;
26
- const headerButton = (React.createElement("span", Object.assign({ className: clsx(styles['expand-button'], isContainer ? styles['header-container-button'] : styles['header-button']), role: "button", tabIndex: 0, "aria-label": ariaLabel, "aria-labelledby": !ariaLabel && isContainer ? id : undefined, "aria-describedby": isContainer && headerDescription ? descriptionId : undefined, "aria-controls": ariaControls, "aria-expanded": expanded }, headerButtonListeners),
29
+ // For the default variant, include also the immediate wrapper around it to include the entire row
30
+ // for backwards compatibility, but exclude the description below.
31
+ const headingTagListeners = !headerButtonListeners && isDefault ? listeners : undefined;
32
+ // For all other cases, make the entire header clickable for backwards compatibility.
33
+ const wrapperListeners = !headerButtonListeners && !headingTagListeners ? listeners : undefined;
34
+ const description = variantSupportsDescription(variant) && headerDescription && (React.createElement("span", { id: descriptionId, className: styles[`description-${variant}`] }, headerDescription));
35
+ const headerButton = (React.createElement("span", Object.assign({ className: clsx(styles['expand-button'], isContainer ? styles['header-container-button'] : styles['header-button'], headerButtonListeners && styles['click-target']), role: "button", tabIndex: 0, "aria-label": ariaLabel, "aria-labelledby": !ariaLabel && description ? id : undefined, "aria-describedby": description ? descriptionId : undefined, "aria-controls": ariaControls, "aria-expanded": expanded }, headerButtonListeners),
27
36
  React.createElement("span", { className: clsx(styles['icon-container'], styles[`icon-container-${variant}`]) }, icon),
28
37
  React.createElement("span", { id: id }, children)));
29
- return (React.createElement("div", Object.assign({ className: clsx(className, hasInteractiveElements && styles['with-interactive-elements']) }, wrapperListeners), isContainer ? (React.createElement(InternalHeader, { variant: "h2", description: headerDescription && React.createElement("span", { id: descriptionId }, headerDescription), counter: headerCounter, info: headerInfo, actions: headerActions, headingTagOverride: headingTagOverride }, headerButton)) : (React.createElement(HeadingTag, { className: styles['header-wrapper'] }, headerButton))));
38
+ return (React.createElement("div", Object.assign({ className: clsx(className, wrapperListeners && styles['click-target']) }, wrapperListeners),
39
+ isContainer ? (React.createElement(InternalHeader, { variant: "h2", description: description, counter: headerCounter, info: headerInfo, actions: headerActions, headingTagOverride: headingTagOverride }, headerButton)) : (React.createElement(HeadingTag, Object.assign({ className: clsx(styles['header-wrapper'], headingTagListeners && styles['click-target']) }, headingTagListeners), headerButton)),
40
+ isDefault && description && React.createElement(HeaderDescription, { variantOverride: "h3" }, description)));
30
41
  };
31
42
  export const ExpandableSectionHeader = ({ id, descriptionId, className, variant, header, headerText, headerDescription, headerCounter, headerInfo, headerActions, headingTagOverride, expanded, ariaControls, ariaLabel, ariaLabelledBy, onKeyUp, onKeyDown, onClick, }) => {
32
43
  const icon = (React.createElement(InternalIcon, { size: variant === 'container' ? 'medium' : 'normal', className: clsx(styles.icon, expanded && styles.expanded), name: "caret-down-filled" }));
@@ -39,8 +50,11 @@ export const ExpandableSectionHeader = ({ id, descriptionId, className, variant,
39
50
  onClick: onClick,
40
51
  variant,
41
52
  };
42
- if ((headerDescription || headerCounter || headerInfo || headerActions) && variant !== 'container' && isDevelopment) {
43
- warnOnce(componentName, 'The `headerCounter`, `headerDescription`, `headerInfo` and `headerActions` props are only supported for the "container" variant.');
53
+ if ((headerCounter || headerInfo || headerActions) && variant !== 'container' && isDevelopment) {
54
+ warnOnce(componentName, 'The `headerCounter`, `headerInfo` and `headerActions` props are only supported for the "container" variant.');
55
+ }
56
+ if (headerDescription && variant !== 'container' && variant !== 'default' && isDevelopment) {
57
+ warnOnce(componentName, 'The `headerDescription` prop is only supported for the "default" and "container" variants.');
44
58
  }
45
59
  const wrapperClassName = clsx(styles.wrapper, styles[`wrapper-${variant}`], expanded && styles['wrapper-expanded']);
46
60
  if (variant === 'navigation') {
@@ -52,6 +66,6 @@ export const ExpandableSectionHeader = ({ id, descriptionId, className, variant,
52
66
  if (variant === 'container' && header && isDevelopment) {
53
67
  warnOnce(componentName, 'Use `headerText` instead of `header` to provide the button within the heading for a11y.');
54
68
  }
55
- return (React.createElement(ExpandableDefaultHeader, Object.assign({ className: clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded), onKeyUp: onKeyUp, onKeyDown: onKeyDown }, defaultHeaderProps), header));
69
+ return (React.createElement(ExpandableDeprecatedHeader, Object.assign({ className: clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded), onKeyUp: onKeyUp, onKeyDown: onKeyDown }, defaultHeaderProps), header));
56
70
  };
57
71
  //# sourceMappingURL=expandable-section-header.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"expandable-section-header.js","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAyCjD,MAAM,uBAAuB,GAAG,CAAC,EAC/B,EAAE,EACF,SAAS,EACT,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EACT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. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ExpandableSectionProps } from './interfaces';\nimport React, { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';\nimport InternalIcon from '../icon/internal';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalHeader from '../header/internal';\nimport { isDevelopment } from '../internal/is-development';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport const componentName = 'ExpandableSection';\n\ninterface ExpandableDefaultHeaderProps {\n id: string;\n descriptionId?: string;\n className?: string;\n children?: ReactNode;\n expanded: boolean;\n ariaControls: string;\n ariaLabel?: string;\n onKeyUp: KeyboardEventHandler;\n onKeyDown: KeyboardEventHandler;\n onClick: MouseEventHandler;\n icon: JSX.Element;\n variant: ExpandableSectionProps.Variant;\n}\n\ninterface ExpandableNavigationHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'onKeyUp' | 'onKeyDown'> {\n ariaLabelledBy?: string;\n}\n\ninterface ExpandableHeaderTextWrapperProps extends ExpandableDefaultHeaderProps {\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n}\n\ninterface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'children' | 'icon'> {\n variant: ExpandableSectionProps.Variant;\n header?: ReactNode;\n headerText?: ReactNode;\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n ariaLabelledBy?: string;\n}\n\nconst ExpandableDefaultHeader = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n onKeyUp,\n onKeyDown,\n variant,\n}: ExpandableDefaultHeaderProps) => {\n return (\n <div\n id={id}\n role=\"button\"\n className={clsx(className, styles['expand-button'])}\n tabIndex={0}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n >\n <div className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</div>\n {children}\n </div>\n );\n};\n\nconst ExpandableNavigationHeader = ({\n id,\n className,\n onClick,\n ariaLabelledBy,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n}: ExpandableNavigationHeaderProps) => {\n return (\n <div id={id} className={className} onClick={onClick}>\n <button\n className={clsx(styles['icon-container'], styles['expand-button'])}\n aria-labelledby={ariaLabelledBy}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n type=\"button\"\n >\n {icon}\n </button>\n {children}\n </div>\n );\n};\n\nconst ExpandableHeaderTextWrapper = ({\n id,\n descriptionId,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n variant,\n headingTagOverride,\n onKeyUp,\n onKeyDown,\n}: ExpandableHeaderTextWrapperProps) => {\n const isContainer = variant === 'container';\n const HeadingTag = headingTagOverride || 'div';\n const hasInteractiveElements = isContainer && (headerInfo || headerActions);\n const listeners = { onClick, onKeyDown, onKeyUp };\n const wrapperListeners = hasInteractiveElements ? undefined : listeners;\n const headerButtonListeners = hasInteractiveElements ? listeners : undefined;\n const headerButton = (\n <span\n className={clsx(\n styles['expand-button'],\n isContainer ? styles['header-container-button'] : styles['header-button']\n )}\n role=\"button\"\n tabIndex={0}\n aria-label={ariaLabel}\n aria-labelledby={!ariaLabel && isContainer ? id : undefined}\n aria-describedby={isContainer && headerDescription ? descriptionId : undefined}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n {...headerButtonListeners}\n >\n <span className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</span>\n <span id={id}>{children}</span>\n </span>\n );\n\n return (\n <div\n className={clsx(className, hasInteractiveElements && styles['with-interactive-elements'])}\n {...wrapperListeners}\n >\n {isContainer ? (\n <InternalHeader\n variant=\"h2\"\n description={headerDescription && <span id={descriptionId}>{headerDescription}</span>}\n counter={headerCounter}\n info={headerInfo}\n actions={headerActions}\n headingTagOverride={headingTagOverride}\n >\n {headerButton}\n </InternalHeader>\n ) : (\n <HeadingTag className={styles['header-wrapper']}>{headerButton}</HeadingTag>\n )}\n </div>\n );\n};\n\nexport const ExpandableSectionHeader = ({\n id,\n descriptionId,\n className,\n variant,\n header,\n headerText,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n headingTagOverride,\n expanded,\n ariaControls,\n ariaLabel,\n ariaLabelledBy,\n onKeyUp,\n onKeyDown,\n onClick,\n}: ExpandableSectionHeaderProps) => {\n const icon = (\n <InternalIcon\n size={variant === 'container' ? 'medium' : 'normal'}\n className={clsx(styles.icon, expanded && styles.expanded)}\n name=\"caret-down-filled\"\n />\n );\n const defaultHeaderProps = {\n id: id,\n icon: icon,\n expanded: expanded,\n ariaControls: ariaControls,\n ariaLabel: ariaLabel,\n onClick: onClick,\n variant,\n };\n\n if ((headerDescription || headerCounter || headerInfo || headerActions) && variant !== 'container' && isDevelopment) {\n warnOnce(\n componentName,\n 'The `headerCounter`, `headerDescription`, `headerInfo` and `headerActions` props are only supported for the \"container\" variant.'\n );\n }\n\n const wrapperClassName = clsx(styles.wrapper, styles[`wrapper-${variant}`], expanded && styles['wrapper-expanded']);\n if (variant === 'navigation') {\n return (\n <ExpandableNavigationHeader\n className={clsx(className, wrapperClassName)}\n ariaLabelledBy={ariaLabelledBy}\n {...defaultHeaderProps}\n >\n {headerText ?? header}\n </ExpandableNavigationHeader>\n );\n }\n\n if (headerText) {\n return (\n <ExpandableHeaderTextWrapper\n className={clsx(className, wrapperClassName, expanded && styles.expanded)}\n descriptionId={descriptionId}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headerInfo={headerInfo}\n headerActions={headerActions}\n headingTagOverride={headingTagOverride}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {headerText}\n </ExpandableHeaderTextWrapper>\n );\n }\n\n if (variant === 'container' && header && isDevelopment) {\n warnOnce(componentName, 'Use `headerText` instead of `header` to provide the button within the heading for a11y.');\n }\n\n return (\n <ExpandableDefaultHeader\n className={clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded)}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {header}\n </ExpandableDefaultHeader>\n );\n};\n"]}
1
+ {"version":3,"file":"expandable-section-header.js","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,EAAE,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAyCjD,MAAM,0BAA0B,GAAG,CAAC,EAClC,EAAE,EACF,SAAS,EACT,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EACT,OAAO,GACsB,EAAE,EAAE;IACjC,OAAO,CACL,6BACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC,EACxG,QAAQ,EAAE,CAAC,EACX,OAAO,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EACtB,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,IAChB,kBAAkB,GAErB,UAAU,CACiB,CAC/B,CAAC;KACH;IAED,IAAI,OAAO,KAAK,WAAW,IAAI,MAAM,IAAI,aAAa,EAAE;QACtD,QAAQ,CAAC,aAAa,EAAE,yFAAyF,CAAC,CAAC;KACpH;IAED,OAAO,CACL,oBAAC,0BAA0B,kBACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,EAC3F,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,IAChB,kBAAkB,GAErB,MAAM,CACoB,CAC9B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ExpandableSectionProps } from './interfaces';\nimport React, { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';\nimport InternalIcon from '../icon/internal';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalHeader, { Description as HeaderDescription } from '../header/internal';\nimport { isDevelopment } from '../internal/is-development';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { variantSupportsDescription } from './utils';\n\nexport const componentName = 'ExpandableSection';\n\ninterface ExpandableDefaultHeaderProps {\n id: string;\n descriptionId?: string;\n className?: string;\n children?: ReactNode;\n expanded: boolean;\n ariaControls: string;\n ariaLabel?: string;\n onKeyUp: KeyboardEventHandler;\n onKeyDown: KeyboardEventHandler;\n onClick: MouseEventHandler;\n icon: JSX.Element;\n variant: ExpandableSectionProps.Variant;\n}\n\ninterface ExpandableNavigationHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'onKeyUp' | 'onKeyDown'> {\n ariaLabelledBy?: string;\n}\n\ninterface ExpandableHeaderTextWrapperProps extends ExpandableDefaultHeaderProps {\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n}\n\ninterface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'children' | 'icon'> {\n variant: ExpandableSectionProps.Variant;\n header?: ReactNode;\n headerText?: ReactNode;\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n ariaLabelledBy?: string;\n}\n\nconst ExpandableDeprecatedHeader = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n onKeyUp,\n onKeyDown,\n variant,\n}: ExpandableDefaultHeaderProps) => {\n return (\n <div\n id={id}\n role=\"button\"\n className={clsx(className, styles['expand-button'], styles['click-target'], styles['header-deprecated'])}\n tabIndex={0}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n >\n <div className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</div>\n {children}\n </div>\n );\n};\n\nconst ExpandableNavigationHeader = ({\n id,\n className,\n onClick,\n ariaLabelledBy,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n}: ExpandableNavigationHeaderProps) => {\n return (\n <div id={id} className={clsx(className, styles['click-target'])} onClick={onClick}>\n <button\n className={clsx(styles['icon-container'], styles['expand-button'])}\n aria-labelledby={ariaLabelledBy}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n type=\"button\"\n >\n {icon}\n </button>\n {children}\n </div>\n );\n};\n\nconst ExpandableHeaderTextWrapper = ({\n id,\n descriptionId,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n variant,\n headingTagOverride,\n onKeyUp,\n onKeyDown,\n}: ExpandableHeaderTextWrapperProps) => {\n const isContainer = variant === 'container';\n const isDefault = variant === 'default';\n const HeadingTag = headingTagOverride || 'div';\n const hasInteractiveElements = isContainer && (headerInfo || headerActions);\n const listeners = { onClick, onKeyDown, onKeyUp };\n\n // If interactive elements are present, constrain the clickable area to only the icon and the header text\n // to prevent nesting interactive elements.\n const headerButtonListeners = hasInteractiveElements ? listeners : undefined;\n // For the default variant, include also the immediate wrapper around it to include the entire row\n // for backwards compatibility, but exclude the description below.\n const headingTagListeners = !headerButtonListeners && isDefault ? listeners : undefined;\n // For all other cases, make the entire header clickable for backwards compatibility.\n const wrapperListeners = !headerButtonListeners && !headingTagListeners ? listeners : undefined;\n\n const description = variantSupportsDescription(variant) && headerDescription && (\n <span id={descriptionId} className={styles[`description-${variant}`]}>\n {headerDescription}\n </span>\n );\n\n const headerButton = (\n <span\n className={clsx(\n styles['expand-button'],\n isContainer ? styles['header-container-button'] : styles['header-button'],\n headerButtonListeners && styles['click-target']\n )}\n role=\"button\"\n tabIndex={0}\n aria-label={ariaLabel}\n aria-labelledby={!ariaLabel && description ? id : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n {...headerButtonListeners}\n >\n <span className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</span>\n <span id={id}>{children}</span>\n </span>\n );\n\n return (\n <div className={clsx(className, wrapperListeners && styles['click-target'])} {...wrapperListeners}>\n {isContainer ? (\n <InternalHeader\n variant=\"h2\"\n description={description}\n counter={headerCounter}\n info={headerInfo}\n actions={headerActions}\n headingTagOverride={headingTagOverride}\n >\n {headerButton}\n </InternalHeader>\n ) : (\n <HeadingTag\n className={clsx(styles['header-wrapper'], headingTagListeners && styles['click-target'])}\n {...headingTagListeners}\n >\n {headerButton}\n </HeadingTag>\n )}\n {isDefault && description && <HeaderDescription variantOverride=\"h3\">{description}</HeaderDescription>}\n </div>\n );\n};\n\nexport const ExpandableSectionHeader = ({\n id,\n descriptionId,\n className,\n variant,\n header,\n headerText,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n headingTagOverride,\n expanded,\n ariaControls,\n ariaLabel,\n ariaLabelledBy,\n onKeyUp,\n onKeyDown,\n onClick,\n}: ExpandableSectionHeaderProps) => {\n const icon = (\n <InternalIcon\n size={variant === 'container' ? 'medium' : 'normal'}\n className={clsx(styles.icon, expanded && styles.expanded)}\n name=\"caret-down-filled\"\n />\n );\n const defaultHeaderProps = {\n id: id,\n icon: icon,\n expanded: expanded,\n ariaControls: ariaControls,\n ariaLabel: ariaLabel,\n onClick: onClick,\n variant,\n };\n\n if ((headerCounter || headerInfo || headerActions) && variant !== 'container' && isDevelopment) {\n warnOnce(\n componentName,\n 'The `headerCounter`, `headerInfo` and `headerActions` props are only supported for the \"container\" variant.'\n );\n }\n\n if (headerDescription && variant !== 'container' && variant !== 'default' && isDevelopment) {\n warnOnce(\n componentName,\n 'The `headerDescription` prop is only supported for the \"default\" and \"container\" variants.'\n );\n }\n\n const wrapperClassName = clsx(styles.wrapper, styles[`wrapper-${variant}`], expanded && styles['wrapper-expanded']);\n if (variant === 'navigation') {\n return (\n <ExpandableNavigationHeader\n className={clsx(className, wrapperClassName)}\n ariaLabelledBy={ariaLabelledBy}\n {...defaultHeaderProps}\n >\n {headerText ?? header}\n </ExpandableNavigationHeader>\n );\n }\n\n if (headerText) {\n return (\n <ExpandableHeaderTextWrapper\n className={clsx(className, wrapperClassName, expanded && styles.expanded)}\n descriptionId={descriptionId}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headerInfo={headerInfo}\n headerActions={headerActions}\n headingTagOverride={headingTagOverride}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {headerText}\n </ExpandableHeaderTextWrapper>\n );\n }\n\n if (variant === 'container' && header && isDevelopment) {\n warnOnce(componentName, 'Use `headerText` instead of `header` to provide the button within the heading for a11y.');\n }\n\n return (\n <ExpandableDeprecatedHeader\n className={clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded)}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {header}\n </ExpandableDeprecatedHeader>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/internal.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,KAAK,8BAA8B,GAAG,sBAAsB,GAAG,0BAA0B,CAAC;AAE1F,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,EACf,QAAQ,EACR,OAAmB,EACnB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,8BAA8B,eA6FhC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/internal.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,KAAK,8BAA8B,GAAG,sBAAsB,GAAG,0BAA0B,CAAC;AAE1F,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,EACf,QAAQ,EACR,OAAmB,EACnB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,8BAA8B,eA6FhC"}
@@ -12,6 +12,7 @@ import { fireNonCancelableEvent } from '../internal/events';
12
12
  import styles from './styles.css.js';
13
13
  import { ExpandableSectionContainer } from './expandable-section-container';
14
14
  import { ExpandableSectionHeader } from './expandable-section-header';
15
+ import { variantSupportsDescription } from './utils';
15
16
  export default function InternalExpandableSection(_a) {
16
17
  var { expanded: controlledExpanded, defaultExpanded, onChange, variant = 'default', children, header, headerText, headerCounter, headerDescription, headerInfo, headerActions, headingTagOverride, disableContentPaddings, headerAriaLabel, __internalRootRef } = _a, props = __rest(_a, ["expanded", "defaultExpanded", "onChange", "variant", "children", "header", "headerText", "headerCounter", "headerDescription", "headerInfo", "headerActions", "headingTagOverride", "disableContentPaddings", "headerAriaLabel", "__internalRootRef"]);
17
18
  const ref = useRef(null);
@@ -53,6 +54,6 @@ export default function InternalExpandableSection(_a) {
53
54
  };
54
55
  return (React.createElement(ExpandableSectionContainer, Object.assign({}, baseProps, { expanded: expanded, className: clsx(baseProps.className, styles.root), variant: variant, disableContentPaddings: disableContentPaddings, header: React.createElement(ExpandableSectionHeader, Object.assign({ id: triggerControlId, descriptionId: descriptionId, className: clsx(styles.header, styles[`header-${variant}`]), variant: variant, expanded: !!expanded, header: header, headerText: headerText, headerDescription: headerDescription, headerCounter: headerCounter, headerInfo: headerInfo, headerActions: headerActions, headingTagOverride: headingTagOverride }, triggerProps)), __internalRootRef: __internalRootRef }),
55
56
  React.createElement(CSSTransition, { in: expanded, timeout: 30, classNames: { enter: styles['content-enter'] }, nodeRef: ref },
56
- React.createElement("div", { id: controlId, ref: ref, className: clsx(styles.content, styles[`content-${variant}`], expanded && styles['content-expanded']), role: "group", "aria-label": triggerProps.ariaLabel, "aria-labelledby": triggerProps.ariaLabelledBy, "aria-describedby": variant === 'container' && headerDescription ? descriptionId : undefined }, children))));
57
+ React.createElement("div", { id: controlId, ref: ref, className: clsx(styles.content, styles[`content-${variant}`], expanded && styles['content-expanded']), role: "group", "aria-label": triggerProps.ariaLabel, "aria-labelledby": triggerProps.ariaLabelledBy, "aria-describedby": variantSupportsDescription(variant) && headerDescription ? descriptionId : undefined }, children))));
57
58
  }
58
59
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["expandable-section/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAiB,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAI5D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAKtE,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAiBjB;QAjBiB,EAChD,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,EACf,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,OAEc,EAD5B,KAAK,cAhBwC,uPAiBjD,CADS;IAER,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,WAAW,EAAE,CAAC;IAChC,MAAM,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AI,MAAM,CAAC,kBAAkB,CAAC,CAAC,EACrG,IAAI,EAAC,OAAO,gBACA,YAAY,CAAC,SAAS,qBACjB,YAAY,CAAC,cAAc,sBAC1B,OAAO,KAAK,WAAW,IAAI,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,IAEzF,QAAQ,CACL,CACQ,CACW,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEvent, useCallback, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport { ExpandableSectionProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport { ExpandableSectionContainer } from './expandable-section-container';\nimport { ExpandableSectionHeader } from './expandable-section-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\ntype InternalExpandableSectionProps = ExpandableSectionProps & InternalBaseComponentProps;\n\nexport default function InternalExpandableSection({\n expanded: controlledExpanded,\n defaultExpanded,\n onChange,\n variant = 'default',\n children,\n header,\n headerText,\n headerCounter,\n headerDescription,\n headerInfo,\n headerActions,\n headingTagOverride,\n disableContentPaddings,\n headerAriaLabel,\n __internalRootRef,\n ...props\n}: InternalExpandableSectionProps) {\n const ref = useRef<HTMLDivElement>(null);\n const controlId = useUniqueId();\n const triggerControlId = `${controlId}-trigger`;\n const descriptionId = `${controlId}-description`;\n\n const baseProps = getBaseProps(props);\n const [expanded, setExpanded] = useControllable(controlledExpanded, onChange, defaultExpanded, {\n componentName: 'ExpandableSection',\n controlledProp: 'expanded',\n changeHandler: 'onChange',\n });\n\n const onExpandChange = useCallback(\n (expanded: boolean) => {\n setExpanded(expanded);\n fireNonCancelableEvent(onChange, { expanded });\n },\n [onChange, setExpanded]\n );\n\n const onClick = useCallback(() => {\n onExpandChange(!expanded);\n }, [onExpandChange, expanded]);\n\n const onKeyUp = useCallback(\n (event: KeyboardEvent<Element>) => {\n const interactionKeys = [KeyCode.enter, KeyCode.space];\n\n if (interactionKeys.indexOf(event.keyCode) !== -1) {\n onExpandChange(!expanded);\n }\n },\n [onExpandChange, expanded]\n );\n\n const onKeyDown = useCallback((event: KeyboardEvent<Element>) => {\n if (event.keyCode === KeyCode.space) {\n // Prevent the page from scrolling when toggling the component with the space bar.\n event.preventDefault();\n }\n }, []);\n\n const triggerProps = {\n ariaControls: controlId,\n ariaLabel: headerAriaLabel,\n ariaLabelledBy: headerAriaLabel ? undefined : triggerControlId,\n onKeyUp,\n onKeyDown,\n onClick,\n };\n\n return (\n <ExpandableSectionContainer\n {...baseProps}\n expanded={expanded}\n className={clsx(baseProps.className, styles.root)}\n variant={variant}\n disableContentPaddings={disableContentPaddings}\n header={\n <ExpandableSectionHeader\n id={triggerControlId}\n descriptionId={descriptionId}\n className={clsx(styles.header, styles[`header-${variant}`])}\n variant={variant}\n expanded={!!expanded}\n header={header}\n headerText={headerText}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headerInfo={headerInfo}\n headerActions={headerActions}\n headingTagOverride={headingTagOverride}\n {...triggerProps}\n />\n }\n __internalRootRef={__internalRootRef}\n >\n <CSSTransition in={expanded} timeout={30} classNames={{ enter: styles['content-enter'] }} nodeRef={ref}>\n <div\n id={controlId}\n ref={ref}\n className={clsx(styles.content, styles[`content-${variant}`], expanded && styles['content-expanded'])}\n role=\"group\"\n aria-label={triggerProps.ariaLabel}\n aria-labelledby={triggerProps.ariaLabelledBy}\n aria-describedby={variant === 'container' && headerDescription ? descriptionId : undefined}\n >\n {children}\n </div>\n </CSSTransition>\n </ExpandableSectionContainer>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["expandable-section/intern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AC,IAAI,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,IAErG,QAAQ,CACL,CACQ,CACW,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEvent, useCallback, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport { ExpandableSectionProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport { ExpandableSectionContainer } from './expandable-section-container';\nimport { ExpandableSectionHeader } from './expandable-section-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { variantSupportsDescription } from './utils';\n\ntype InternalExpandableSectionProps = ExpandableSectionProps & InternalBaseComponentProps;\n\nexport default function InternalExpandableSection({\n expanded: controlledExpanded,\n defaultExpanded,\n onChange,\n variant = 'default',\n children,\n header,\n headerText,\n headerCounter,\n headerDescription,\n headerInfo,\n headerActions,\n headingTagOverride,\n disableContentPaddings,\n headerAriaLabel,\n __internalRootRef,\n ...props\n}: InternalExpandableSectionProps) {\n const ref = useRef<HTMLDivElement>(null);\n const controlId = useUniqueId();\n const triggerControlId = `${controlId}-trigger`;\n const descriptionId = `${controlId}-description`;\n\n const baseProps = getBaseProps(props);\n const [expanded, setExpanded] = useControllable(controlledExpanded, onChange, defaultExpanded, {\n componentName: 'ExpandableSection',\n controlledProp: 'expanded',\n changeHandler: 'onChange',\n });\n\n const onExpandChange = useCallback(\n (expanded: boolean) => {\n setExpanded(expanded);\n fireNonCancelableEvent(onChange, { expanded });\n },\n [onChange, setExpanded]\n );\n\n const onClick = useCallback(() => {\n onExpandChange(!expanded);\n }, [onExpandChange, expanded]);\n\n const onKeyUp = useCallback(\n (event: KeyboardEvent<Element>) => {\n const interactionKeys = [KeyCode.enter, KeyCode.space];\n\n if (interactionKeys.indexOf(event.keyCode) !== -1) {\n onExpandChange(!expanded);\n }\n },\n [onExpandChange, expanded]\n );\n\n const onKeyDown = useCallback((event: KeyboardEvent<Element>) => {\n if (event.keyCode === KeyCode.space) {\n // Prevent the page from scrolling when toggling the component with the space bar.\n event.preventDefault();\n }\n }, []);\n\n const triggerProps = {\n ariaControls: controlId,\n ariaLabel: headerAriaLabel,\n ariaLabelledBy: headerAriaLabel ? undefined : triggerControlId,\n onKeyUp,\n onKeyDown,\n onClick,\n };\n\n return (\n <ExpandableSectionContainer\n {...baseProps}\n expanded={expanded}\n className={clsx(baseProps.className, styles.root)}\n variant={variant}\n disableContentPaddings={disableContentPaddings}\n header={\n <ExpandableSectionHeader\n id={triggerControlId}\n descriptionId={descriptionId}\n className={clsx(styles.header, styles[`header-${variant}`])}\n variant={variant}\n expanded={!!expanded}\n header={header}\n headerText={headerText}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headerInfo={headerInfo}\n headerActions={headerActions}\n headingTagOverride={headingTagOverride}\n {...triggerProps}\n />\n }\n __internalRootRef={__internalRootRef}\n >\n <CSSTransition in={expanded} timeout={30} classNames={{ enter: styles['content-enter'] }} nodeRef={ref}>\n <div\n id={controlId}\n ref={ref}\n className={clsx(styles.content, styles[`content-${variant}`], expanded && styles['content-expanded'])}\n role=\"group\"\n aria-label={triggerProps.ariaLabel}\n aria-labelledby={triggerProps.ariaLabelledBy}\n aria-describedby={variantSupportsDescription(variant) && headerDescription ? descriptionId : undefined}\n >\n {children}\n </div>\n </CSSTransition>\n </ExpandableSectionContainer>\n );\n}\n"]}
@@ -1,32 +1,34 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "content-enter": "awsui_content-enter_gwq0h_ohtdp_97",
5
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_ohtdp_1",
6
- "trigger-expanded": "awsui_trigger-expanded_gwq0h_ohtdp_119",
7
- "icon": "awsui_icon_gwq0h_ohtdp_133",
8
- "root": "awsui_root_gwq0h_ohtdp_151",
9
- "expand-button": "awsui_expand-button_gwq0h_ohtdp_168",
10
- "expanded": "awsui_expanded_gwq0h_ohtdp_175",
11
- "icon-container": "awsui_icon-container_gwq0h_ohtdp_179",
12
- "icon-container-container": "awsui_icon-container-container_gwq0h_ohtdp_184",
13
- "wrapper": "awsui_wrapper_gwq0h_ohtdp_188",
14
- "wrapper-default": "awsui_wrapper-default_gwq0h_ohtdp_196",
15
- "wrapper-footer": "awsui_wrapper-footer_gwq0h_ohtdp_199",
16
- "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_ohtdp_205",
17
- "wrapper-container": "awsui_wrapper-container_gwq0h_ohtdp_219",
18
- "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_ohtdp_225",
19
- "header": "awsui_header_gwq0h_ohtdp_229",
20
- "header-wrapper": "awsui_header-wrapper_gwq0h_ohtdp_232",
21
- "header-button": "awsui_header-button_gwq0h_ohtdp_239",
22
- "header-container-button": "awsui_header-container-button_gwq0h_ohtdp_243",
23
- "with-interactive-elements": "awsui_with-interactive-elements_gwq0h_ohtdp_261",
24
- "header-container": "awsui_header-container_gwq0h_ohtdp_243",
25
- "header-navigation": "awsui_header-navigation_gwq0h_ohtdp_273",
26
- "content": "awsui_content_gwq0h_ohtdp_97",
27
- "content-default": "awsui_content-default_gwq0h_ohtdp_309",
28
- "content-footer": "awsui_content-footer_gwq0h_ohtdp_312",
29
- "content-expanded": "awsui_content-expanded_gwq0h_ohtdp_315",
30
- "focusable": "awsui_focusable_gwq0h_ohtdp_319"
4
+ "content-enter": "awsui_content-enter_gwq0h_1g5j6_97",
5
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_1g5j6_1",
6
+ "trigger-expanded": "awsui_trigger-expanded_gwq0h_1g5j6_119",
7
+ "icon": "awsui_icon_gwq0h_1g5j6_133",
8
+ "root": "awsui_root_gwq0h_1g5j6_151",
9
+ "expand-button": "awsui_expand-button_gwq0h_1g5j6_168",
10
+ "expanded": "awsui_expanded_gwq0h_1g5j6_175",
11
+ "icon-container": "awsui_icon-container_gwq0h_1g5j6_179",
12
+ "icon-container-container": "awsui_icon-container-container_gwq0h_1g5j6_184",
13
+ "wrapper": "awsui_wrapper_gwq0h_1g5j6_188",
14
+ "wrapper-default": "awsui_wrapper-default_gwq0h_1g5j6_195",
15
+ "wrapper-footer": "awsui_wrapper-footer_gwq0h_1g5j6_198",
16
+ "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_1g5j6_204",
17
+ "wrapper-container": "awsui_wrapper-container_gwq0h_1g5j6_207",
18
+ "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_1g5j6_224",
19
+ "header": "awsui_header_gwq0h_1g5j6_228",
20
+ "header-wrapper": "awsui_header-wrapper_gwq0h_1g5j6_231",
21
+ "header-deprecated": "awsui_header-deprecated_gwq0h_1g5j6_231",
22
+ "header-button": "awsui_header-button_gwq0h_1g5j6_241",
23
+ "header-container-button": "awsui_header-container-button_gwq0h_1g5j6_245",
24
+ "header-container": "awsui_header-container_gwq0h_1g5j6_245",
25
+ "header-navigation": "awsui_header-navigation_gwq0h_1g5j6_269",
26
+ "content": "awsui_content_gwq0h_1g5j6_97",
27
+ "content-default": "awsui_content-default_gwq0h_1g5j6_305",
28
+ "content-footer": "awsui_content-footer_gwq0h_1g5j6_308",
29
+ "content-expanded": "awsui_content-expanded_gwq0h_1g5j6_311",
30
+ "focusable": "awsui_focusable_gwq0h_1g5j6_315",
31
+ "click-target": "awsui_click-target_gwq0h_1g5j6_326",
32
+ "description-default": "awsui_description-default_gwq0h_1g5j6_333"
31
33
  };
32
34
 
@@ -94,10 +94,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
94
94
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
95
  SPDX-License-Identifier: Apache-2.0
96
96
  */
97
- .awsui_content-enter_gwq0h_ohtdp_97:not(#\9) {
98
- animation: awsui_awsui-motion-fade-in_gwq0h_ohtdp_1 var(--motion-duration-show-paced-uryptc, 180ms) var(--motion-easing-show-paced-tbgeqx, ease-out);
97
+ .awsui_content-enter_gwq0h_1g5j6_97:not(#\9) {
98
+ animation: awsui_awsui-motion-fade-in_gwq0h_1g5j6_1 var(--motion-duration-show-paced-uryptc, 180ms) var(--motion-easing-show-paced-tbgeqx, ease-out);
99
99
  }
100
- @keyframes awsui_awsui-motion-fade-in_gwq0h_ohtdp_1 {
100
+ @keyframes awsui_awsui-motion-fade-in_gwq0h_1g5j6_1 {
101
101
  from {
102
102
  opacity: 0.2;
103
103
  }
@@ -106,40 +106,40 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
106
106
  }
107
107
  }
108
108
  @media (prefers-reduced-motion: reduce) {
109
- .awsui_content-enter_gwq0h_ohtdp_97:not(#\9) {
109
+ .awsui_content-enter_gwq0h_1g5j6_97:not(#\9) {
110
110
  animation: none;
111
111
  transition: none;
112
112
  }
113
113
  }
114
- .awsui-motion-disabled .awsui_content-enter_gwq0h_ohtdp_97:not(#\9), .awsui-mode-entering .awsui_content-enter_gwq0h_ohtdp_97:not(#\9) {
114
+ .awsui-motion-disabled .awsui_content-enter_gwq0h_1g5j6_97:not(#\9), .awsui-mode-entering .awsui_content-enter_gwq0h_1g5j6_97:not(#\9) {
115
115
  animation: none;
116
116
  transition: none;
117
117
  }
118
118
 
119
- .awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9) {
119
+ .awsui_trigger-expanded_gwq0h_1g5j6_119:not(#\9) {
120
120
  transition: border-bottom-color var(--motion-duration-show-paced-uryptc, 180ms) var(--motion-easing-show-paced-tbgeqx, ease-out);
121
121
  }
122
122
  @media (prefers-reduced-motion: reduce) {
123
- .awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9) {
123
+ .awsui_trigger-expanded_gwq0h_1g5j6_119:not(#\9) {
124
124
  animation: none;
125
125
  transition: none;
126
126
  }
127
127
  }
128
- .awsui-motion-disabled .awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9), .awsui-mode-entering .awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9) {
128
+ .awsui-motion-disabled .awsui_trigger-expanded_gwq0h_1g5j6_119:not(#\9), .awsui-mode-entering .awsui_trigger-expanded_gwq0h_1g5j6_119:not(#\9) {
129
129
  animation: none;
130
130
  transition: none;
131
131
  }
132
132
 
133
- .awsui_icon_gwq0h_ohtdp_133:not(#\9) {
133
+ .awsui_icon_gwq0h_1g5j6_133:not(#\9) {
134
134
  transition: transform var(--motion-duration-rotate-90-jfxxiy, 135ms) var(--motion-easing-rotate-90-ax5lt7, cubic-bezier(0.165, 0.84, 0.44, 1));
135
135
  }
136
136
  @media (prefers-reduced-motion: reduce) {
137
- .awsui_icon_gwq0h_ohtdp_133:not(#\9) {
137
+ .awsui_icon_gwq0h_1g5j6_133:not(#\9) {
138
138
  animation: none;
139
139
  transition: none;
140
140
  }
141
141
  }
142
- .awsui-motion-disabled .awsui_icon_gwq0h_ohtdp_133:not(#\9), .awsui-mode-entering .awsui_icon_gwq0h_ohtdp_133:not(#\9) {
142
+ .awsui-motion-disabled .awsui_icon_gwq0h_1g5j6_133:not(#\9), .awsui-mode-entering .awsui_icon_gwq0h_1g5j6_133:not(#\9) {
143
143
  animation: none;
144
144
  transition: none;
145
145
  }
@@ -148,7 +148,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
148
148
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
149
149
  SPDX-License-Identifier: Apache-2.0
150
150
  */
151
- .awsui_root_gwq0h_ohtdp_151:not(#\9) {
151
+ .awsui_root_gwq0h_1g5j6_151:not(#\9) {
152
152
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
153
153
  border-collapse: separate;
154
154
  border-spacing: 0;
@@ -191,89 +191,91 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
191
191
  display: block;
192
192
  }
193
193
 
194
- .awsui_expand-button_gwq0h_ohtdp_168:not(#\9) {
194
+ .awsui_expand-button_gwq0h_1g5j6_168:not(#\9) {
195
195
  /* used in test-utils */
196
196
  }
197
197
 
198
- .awsui_icon_gwq0h_ohtdp_133:not(#\9) {
198
+ .awsui_icon_gwq0h_1g5j6_133:not(#\9) {
199
199
  transform: rotate(-90deg);
200
200
  }
201
- .awsui_icon_gwq0h_ohtdp_133.awsui_expanded_gwq0h_ohtdp_175:not(#\9) {
201
+ .awsui_icon_gwq0h_1g5j6_133.awsui_expanded_gwq0h_1g5j6_175:not(#\9) {
202
202
  transform: rotate(0deg);
203
203
  }
204
204
 
205
- .awsui_icon-container_gwq0h_ohtdp_179:not(#\9) {
205
+ .awsui_icon-container_gwq0h_1g5j6_179:not(#\9) {
206
206
  position: relative;
207
207
  margin-left: calc((var(--font-body-m-line-height-rfgrp9, 22px) - var(--size-icon-normal-jq6jat, 16px)) / -2);
208
208
  margin-right: calc(var(--space-xxs-ja5cp8, 4px) + var(--border-divider-list-width-um3zli, 1px));
209
209
  }
210
- .awsui_icon-container-container_gwq0h_ohtdp_184:not(#\9) {
210
+ .awsui_icon-container-container_gwq0h_1g5j6_184:not(#\9) {
211
211
  margin-right: var(--space-xs-edba2s, 8px);
212
212
  }
213
213
 
214
- .awsui_wrapper_gwq0h_ohtdp_188:not(#\9) {
214
+ .awsui_wrapper_gwq0h_1g5j6_188:not(#\9) {
215
215
  box-sizing: border-box;
216
- display: flex;
217
216
  border: none;
218
217
  width: 100%;
219
218
  line-height: var(--font-body-m-line-height-rfgrp9, 22px);
220
219
  text-align: left;
221
220
  }
222
- .awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9) {
221
+ .awsui_wrapper-default_gwq0h_1g5j6_195:not(#\9) {
223
222
  padding: var(--space-scaled-xxs-t2t62i, 4px) var(--space-xxs-ja5cp8, 4px);
224
223
  }
225
- .awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9) {
224
+ .awsui_wrapper-footer_gwq0h_1g5j6_198:not(#\9) {
226
225
  padding: var(--space-scaled-xxs-t2t62i, 4px) 0;
227
226
  }
228
- .awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9), .awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9) {
227
+ .awsui_wrapper-default_gwq0h_1g5j6_195:not(#\9), .awsui_wrapper-footer_gwq0h_1g5j6_198:not(#\9) {
229
228
  border: var(--border-divider-section-width-orq175, 2px) solid transparent;
230
229
  }
231
- .awsui_wrapper-navigation_gwq0h_ohtdp_205:not(#\9) {
230
+ .awsui_wrapper-navigation_gwq0h_1g5j6_204:not(#\9) {
232
231
  border-left: var(--border-divider-section-width-orq175, 2px) solid transparent;
233
232
  }
234
- .awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9), .awsui_wrapper-navigation_gwq0h_ohtdp_205:not(#\9), .awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9) {
235
- color: var(--color-text-expandable-section-default-fvf8va, #000716);
233
+ .awsui_wrapper-navigation_gwq0h_1g5j6_204:not(#\9), .awsui_wrapper-container_gwq0h_1g5j6_207:not(#\9) {
234
+ display: flex;
236
235
  font-weight: var(--font-heading-s-weight-5y5giq, 800);
236
+ }
237
+ .awsui_wrapper-default_gwq0h_1g5j6_195:not(#\9), .awsui_wrapper-navigation_gwq0h_1g5j6_204:not(#\9), .awsui_wrapper-footer_gwq0h_1g5j6_198:not(#\9) {
238
+ color: var(--color-text-expandable-section-default-fvf8va, #000716);
237
239
  -webkit-font-smoothing: var(--font-smoothing-webkit-fyh4as, antialiased);
238
240
  -moz-osx-font-smoothing: var(--font-smoothing-moz-osx-pa2uqe, grayscale);
239
241
  font-size: var(--font-expandable-heading-size-mkp9vq, 16px);
240
242
  letter-spacing: var(--font-heading-s-letter-spacing-j4vcrt, -0.005em);
241
243
  }
242
- .awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9):hover, .awsui_wrapper-navigation_gwq0h_ohtdp_205:not(#\9):hover, .awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9):hover {
243
- color: var(--color-text-expandable-section-hover-o9ggrx, #0972d3);
244
- }
245
- .awsui_wrapper-container_gwq0h_ohtdp_219:not(#\9) {
244
+ .awsui_wrapper-container_gwq0h_1g5j6_207:not(#\9) {
246
245
  padding: var(--space-container-header-vertical-di96ce, 12px) var(--space-container-horizontal-jxdgil, 20px);
247
246
  }
248
- body[data-awsui-focus-visible=true] .awsui_wrapper-container_gwq0h_ohtdp_219:not(#\9):focus {
247
+ body[data-awsui-focus-visible=true] .awsui_wrapper-container_gwq0h_1g5j6_207:not(#\9):focus {
249
248
  padding: calc(var(--space-scaled-s-913kwi, 12px) - var(--border-divider-section-width-orq175, 2px)) calc(var(--space-l-f4l5gr, 20px) - var(--border-divider-section-width-orq175, 2px));
250
249
  }
251
- .awsui_wrapper-default_gwq0h_ohtdp_196.awsui_wrapper-expanded_gwq0h_ohtdp_225:not(#\9) {
250
+ .awsui_wrapper-default_gwq0h_1g5j6_195.awsui_wrapper-expanded_gwq0h_1g5j6_224:not(#\9) {
252
251
  border-bottom-color: var(--color-border-divider-default-9o8zql, #e9ebed);
253
252
  }
254
253
 
255
- .awsui_header_gwq0h_ohtdp_229:not(#\9) {
254
+ .awsui_header_gwq0h_1g5j6_228:not(#\9) {
255
+ /* used in test-utils */
256
+ }
257
+ .awsui_header-wrapper_gwq0h_1g5j6_231:not(#\9), .awsui_header-deprecated_gwq0h_1g5j6_231:not(#\9) {
256
258
  display: flex;
259
+ font-weight: var(--font-heading-s-weight-5y5giq, 800);
257
260
  }
258
- .awsui_header-wrapper_gwq0h_ohtdp_232:not(#\9) {
259
- font-weight: inherit;
261
+ .awsui_header-wrapper_gwq0h_1g5j6_231:not(#\9) {
260
262
  font-size: inherit;
261
263
  letter-spacing: inherit;
262
264
  margin: 0;
263
265
  padding: 0;
264
266
  }
265
- .awsui_header-button_gwq0h_ohtdp_239:not(#\9) {
267
+ .awsui_header-button_gwq0h_1g5j6_241:not(#\9) {
266
268
  box-sizing: border-box;
267
269
  display: flex;
268
270
  }
269
- body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9):focus {
271
+ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_1g5j6_241:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_1g5j6_245:not(#\9):focus {
270
272
  position: relative;
271
273
  }
272
- body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9):focus {
274
+ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_1g5j6_241:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_1g5j6_245:not(#\9):focus {
273
275
  outline: 2px dotted transparent;
274
276
  outline-offset: calc(0px - 1px);
275
277
  }
276
- body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9):focus::before, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9):focus::before {
278
+ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_1g5j6_241:not(#\9):focus::before, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_1g5j6_245:not(#\9):focus::before {
277
279
  content: " ";
278
280
  display: block;
279
281
  position: absolute;
@@ -284,19 +286,13 @@ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9
284
286
  border-radius: var(--border-radius-control-default-focus-ring-muizvi, 4px);
285
287
  box-shadow: 0 0 0 2px var(--color-border-item-focused-4t19h5, #0972d3);
286
288
  }
287
- .awsui_header_gwq0h_ohtdp_229:not(#\9):not(.awsui_with-interactive-elements_gwq0h_ohtdp_261) {
288
- cursor: pointer;
289
- }
290
- .awsui_header-container_gwq0h_ohtdp_243:not(#\9) {
289
+ .awsui_header-container_gwq0h_1g5j6_245:not(#\9) {
291
290
  width: 100%;
292
291
  }
293
- .awsui_header-container_gwq0h_ohtdp_243 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9) {
292
+ .awsui_header-container_gwq0h_1g5j6_245 > .awsui_icon-container_gwq0h_1g5j6_179:not(#\9) {
294
293
  margin-top: var(--space-expandable-section-icon-offset-top-qfofw6, 4px);
295
294
  }
296
- .awsui_header-container_gwq0h_ohtdp_243.awsui_with-interactive-elements_gwq0h_ohtdp_261 .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9) {
297
- cursor: pointer;
298
- }
299
- .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9) {
295
+ .awsui_header-navigation_gwq0h_1g5j6_269 > .awsui_icon-container_gwq0h_1g5j6_179:not(#\9) {
300
296
  display: inline-flex;
301
297
  cursor: pointer;
302
298
  color: var(--color-text-expandable-section-navigation-icon-default-lzmj1u, #414d5c);
@@ -307,17 +303,17 @@ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9
307
303
  text-decoration: none;
308
304
  flex-direction: column;
309
305
  }
310
- .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):hover {
306
+ .awsui_header-navigation_gwq0h_1g5j6_269 > .awsui_icon-container_gwq0h_1g5j6_179:not(#\9):hover {
311
307
  color: var(--color-text-expandable-section-hover-o9ggrx, #0972d3);
312
308
  }
313
- body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):focus {
309
+ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_1g5j6_269 > .awsui_icon-container_gwq0h_1g5j6_179:not(#\9):focus {
314
310
  position: relative;
315
311
  }
316
- body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):focus {
312
+ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_1g5j6_269 > .awsui_icon-container_gwq0h_1g5j6_179:not(#\9):focus {
317
313
  outline: 2px dotted transparent;
318
314
  outline-offset: calc(2px - 1px);
319
315
  }
320
- body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):focus::before {
316
+ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_1g5j6_269 > .awsui_icon-container_gwq0h_1g5j6_179:not(#\9):focus::before {
321
317
  content: " ";
322
318
  display: block;
323
319
  position: absolute;
@@ -329,26 +325,37 @@ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_ohtdp_273 > .
329
325
  box-shadow: 0 0 0 2px var(--color-border-item-focused-4t19h5, #0972d3);
330
326
  }
331
327
 
332
- .awsui_content_gwq0h_ohtdp_97:not(#\9) {
328
+ .awsui_content_gwq0h_1g5j6_97:not(#\9) {
333
329
  display: none;
334
330
  }
335
- .awsui_content-default_gwq0h_ohtdp_309:not(#\9) {
331
+ .awsui_content-default_gwq0h_1g5j6_305:not(#\9) {
336
332
  padding: var(--space-scaled-xs-wbfgrv, 8px) 0;
337
333
  }
338
- .awsui_content-footer_gwq0h_ohtdp_312:not(#\9) {
334
+ .awsui_content-footer_gwq0h_1g5j6_308:not(#\9) {
339
335
  padding: var(--space-xs-edba2s, 8px) 0;
340
336
  }
341
- .awsui_content-expanded_gwq0h_ohtdp_315:not(#\9) {
337
+ .awsui_content-expanded_gwq0h_1g5j6_311:not(#\9) {
342
338
  display: block;
343
339
  }
344
340
 
345
- .awsui_focusable_gwq0h_ohtdp_319:not(#\9):focus {
341
+ .awsui_focusable_gwq0h_1g5j6_315:not(#\9):focus {
346
342
  outline: none;
347
343
  text-decoration: none;
348
344
  }
349
- body[data-awsui-focus-visible=true] .awsui_focusable_gwq0h_ohtdp_319:not(#\9):focus {
345
+ body[data-awsui-focus-visible=true] .awsui_focusable_gwq0h_1g5j6_315:not(#\9):focus {
350
346
  outline: 2px dotted transparent;
351
347
  border: var(--border-field-width-riro62, 2px) solid var(--color-border-item-focused-4t19h5, #0972d3);
352
348
  border-radius: var(--border-radius-control-default-focus-ring-muizvi, 4px);
353
349
  box-shadow: 0 0 0 var(--border-control-focus-ring-shadow-spread-cwek11, 0px) var(--color-border-item-focused-4t19h5, #0972d3);
350
+ }
351
+
352
+ .awsui_click-target_gwq0h_1g5j6_326:not(#\9) {
353
+ cursor: pointer;
354
+ }
355
+ .awsui_click-target_gwq0h_1g5j6_326:not(#\9):not(.awsui_wrapper-container_gwq0h_1g5j6_207):not(.awsui_header-container-button_gwq0h_1g5j6_245):hover {
356
+ color: var(--color-text-expandable-section-hover-o9ggrx, #0972d3);
357
+ }
358
+
359
+ .awsui_description-default_gwq0h_1g5j6_333:not(#\9) {
360
+ padding-left: calc(var(--size-icon-normal-jq6jat, 16px) + var(--space-xxs-ja5cp8, 4px) + var(--border-divider-list-width-um3zli, 1px) + (var(--font-body-m-line-height-rfgrp9, 22px) - var(--size-icon-normal-jq6jat, 16px)) / -2);
354
361
  }
@@ -2,32 +2,34 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "content-enter": "awsui_content-enter_gwq0h_ohtdp_97",
6
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_ohtdp_1",
7
- "trigger-expanded": "awsui_trigger-expanded_gwq0h_ohtdp_119",
8
- "icon": "awsui_icon_gwq0h_ohtdp_133",
9
- "root": "awsui_root_gwq0h_ohtdp_151",
10
- "expand-button": "awsui_expand-button_gwq0h_ohtdp_168",
11
- "expanded": "awsui_expanded_gwq0h_ohtdp_175",
12
- "icon-container": "awsui_icon-container_gwq0h_ohtdp_179",
13
- "icon-container-container": "awsui_icon-container-container_gwq0h_ohtdp_184",
14
- "wrapper": "awsui_wrapper_gwq0h_ohtdp_188",
15
- "wrapper-default": "awsui_wrapper-default_gwq0h_ohtdp_196",
16
- "wrapper-footer": "awsui_wrapper-footer_gwq0h_ohtdp_199",
17
- "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_ohtdp_205",
18
- "wrapper-container": "awsui_wrapper-container_gwq0h_ohtdp_219",
19
- "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_ohtdp_225",
20
- "header": "awsui_header_gwq0h_ohtdp_229",
21
- "header-wrapper": "awsui_header-wrapper_gwq0h_ohtdp_232",
22
- "header-button": "awsui_header-button_gwq0h_ohtdp_239",
23
- "header-container-button": "awsui_header-container-button_gwq0h_ohtdp_243",
24
- "with-interactive-elements": "awsui_with-interactive-elements_gwq0h_ohtdp_261",
25
- "header-container": "awsui_header-container_gwq0h_ohtdp_243",
26
- "header-navigation": "awsui_header-navigation_gwq0h_ohtdp_273",
27
- "content": "awsui_content_gwq0h_ohtdp_97",
28
- "content-default": "awsui_content-default_gwq0h_ohtdp_309",
29
- "content-footer": "awsui_content-footer_gwq0h_ohtdp_312",
30
- "content-expanded": "awsui_content-expanded_gwq0h_ohtdp_315",
31
- "focusable": "awsui_focusable_gwq0h_ohtdp_319"
5
+ "content-enter": "awsui_content-enter_gwq0h_1g5j6_97",
6
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_1g5j6_1",
7
+ "trigger-expanded": "awsui_trigger-expanded_gwq0h_1g5j6_119",
8
+ "icon": "awsui_icon_gwq0h_1g5j6_133",
9
+ "root": "awsui_root_gwq0h_1g5j6_151",
10
+ "expand-button": "awsui_expand-button_gwq0h_1g5j6_168",
11
+ "expanded": "awsui_expanded_gwq0h_1g5j6_175",
12
+ "icon-container": "awsui_icon-container_gwq0h_1g5j6_179",
13
+ "icon-container-container": "awsui_icon-container-container_gwq0h_1g5j6_184",
14
+ "wrapper": "awsui_wrapper_gwq0h_1g5j6_188",
15
+ "wrapper-default": "awsui_wrapper-default_gwq0h_1g5j6_195",
16
+ "wrapper-footer": "awsui_wrapper-footer_gwq0h_1g5j6_198",
17
+ "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_1g5j6_204",
18
+ "wrapper-container": "awsui_wrapper-container_gwq0h_1g5j6_207",
19
+ "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_1g5j6_224",
20
+ "header": "awsui_header_gwq0h_1g5j6_228",
21
+ "header-wrapper": "awsui_header-wrapper_gwq0h_1g5j6_231",
22
+ "header-deprecated": "awsui_header-deprecated_gwq0h_1g5j6_231",
23
+ "header-button": "awsui_header-button_gwq0h_1g5j6_241",
24
+ "header-container-button": "awsui_header-container-button_gwq0h_1g5j6_245",
25
+ "header-container": "awsui_header-container_gwq0h_1g5j6_245",
26
+ "header-navigation": "awsui_header-navigation_gwq0h_1g5j6_269",
27
+ "content": "awsui_content_gwq0h_1g5j6_97",
28
+ "content-default": "awsui_content-default_gwq0h_1g5j6_305",
29
+ "content-footer": "awsui_content-footer_gwq0h_1g5j6_308",
30
+ "content-expanded": "awsui_content-expanded_gwq0h_1g5j6_311",
31
+ "focusable": "awsui_focusable_gwq0h_1g5j6_315",
32
+ "click-target": "awsui_click-target_gwq0h_1g5j6_326",
33
+ "description-default": "awsui_description-default_gwq0h_1g5j6_333"
32
34
  };
33
35
 
@@ -0,0 +1,3 @@
1
+ import { ExpandableSectionProps } from './interfaces';
2
+ export declare function variantSupportsDescription(variant: ExpandableSectionProps.Variant): boolean;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,WAEjF"}
@@ -0,0 +1,4 @@
1
+ export function variantSupportsDescription(variant) {
2
+ return variant === 'container' || variant === 'default';
3
+ }
4
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["expandable-section/utils.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,0BAA0B,CAAC,OAAuC;IAChF,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,KAAK,SAAS,CAAC;AAC1D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ExpandableSectionProps } from './interfaces';\n\nexport function variantSupportsDescription(variant: ExpandableSectionProps.Variant) {\n return variant === 'container' || variant === 'default';\n}\n"]}
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
3
  import { HeaderProps } from './interfaces';
4
4
  import { SomeRequired } from '../internal/types';
@@ -6,5 +6,9 @@ interface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, Inte
6
6
  __disableActionsWrapping?: boolean;
7
7
  }
8
8
  export default function InternalHeader({ variant, headingTagOverride, children, actions, counter, description, info, __internalRootRef, __disableActionsWrapping, ...restProps }: InternalHeaderProps): JSX.Element;
9
+ export declare function Description({ children, variantOverride }: {
10
+ children: React.ReactNode;
11
+ variantOverride: string;
12
+ }): JSX.Element | null;
9
13
  export {};
10
14
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMjD,UAAU,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACpG,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAwB,EACxB,wBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,mBAAmB,eA8ErB"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMjD,UAAU,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACpG,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAwB,EACxB,wBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,mBAAmB,eAoErB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,sBAgBhH"}
@@ -31,7 +31,12 @@ export default function InternalHeader(_a) {
31
31
  " ",
32
32
  counter)),
33
33
  React.createElement(InfoLinkLabelContext.Provider, { value: headingId }, info && React.createElement("span", { className: styles.info }, info))),
34
- description && (React.createElement("p", { className: clsx(styles.description, styles[`description-variant-${variantOverride}`], isRefresh && styles[`description-variant-${variantOverride}-refresh`]) }, description))),
34
+ React.createElement(Description, { variantOverride: variantOverride }, description)),
35
35
  actions && (React.createElement("div", { className: clsx(styles.actions, styles[`actions-variant-${variantOverride}`], isRefresh && styles[`actions-variant-${variantOverride}-refresh`]) }, actions))));
36
36
  }
37
+ export function Description({ children, variantOverride }) {
38
+ const isRefresh = useVisualRefresh();
39
+ return ((children && (React.createElement("p", { className: clsx(styles.description, styles[`description-variant-${variantOverride}`], isRefresh && styles[`description-variant-${variantOverride}-refresh`]) }, children))) ||
40
+ null);
41
+ }
37
42
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAMhG,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAWjB;QAXiB,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAiB,GAAG,IAAI,EACxB,wBAAwB,OAEJ,EADjB,SAAS,cAVyB,2IAWtC,CADa;IAEZ,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,MAAM,UA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x';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const isMobile = useMobile();\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n const headingId = useUniqueId('heading');\n // If is mobile there is no need to have the dynamic variant because it's scrolled out of view\n const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles[`root-variant-${variantOverride}-refresh`],\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]],\n __disableActionsWrapping && [styles['root-no-wrap']]\n )}\n ref={__internalRootRef}\n >\n <div\n className={clsx(\n styles.main,\n styles[`main-variant-${variantOverride}`],\n isRefresh && styles[`main-variant-${variantOverride}-refresh`]\n )}\n >\n <div\n className={clsx(\n styles.title,\n styles[`title-variant-${variantOverride}`],\n isRefresh && styles[`title-variant-${variantOverride}-refresh`]\n )}\n >\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span\n {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME }}\n className={clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`])}\n id={headingId}\n >\n {children}\n </span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n <InfoLinkLabelContext.Provider value={headingId}>\n {info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n {description && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles[`description-variant-${variantOverride}-refresh`]\n )}\n >\n {description}\n </p>\n )}\n </div>\n {actions && (\n <div\n className={clsx(\n styles.actions,\n styles[`actions-variant-${variantOverride}`],\n isRefresh && styles[`actions-variant-${variantOverride}-refresh`]\n )}\n >\n {actions}\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAA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SAAS,IAAI,MAAM,CAAC,mBAAmB,eAAe,UAAU,CAAC,CAClE,IAEA,OAAO,CACJ,CACP,CACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,eAAe,EAA0D;IAC/G,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;IACrC,OAAO,CACL,CAAC,QAAQ,IAAI,CACX,2BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,uBAAuB,eAAe,EAAE,CAAC,EAChD,SAAS,IAAI,MAAM,CAAC,uBAAuB,eAAe,UAAU,CAAC,CACtE,IAEA,QAAQ,CACP,CACL,CAAC;QACF,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const isMobile = useMobile();\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n const headingId = useUniqueId('heading');\n // If is mobile there is no need to have the dynamic variant because it's scrolled out of view\n const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles[`root-variant-${variantOverride}-refresh`],\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]],\n __disableActionsWrapping && [styles['root-no-wrap']]\n )}\n ref={__internalRootRef}\n >\n <div\n className={clsx(\n styles.main,\n styles[`main-variant-${variantOverride}`],\n isRefresh && styles[`main-variant-${variantOverride}-refresh`]\n )}\n >\n <div\n className={clsx(\n styles.title,\n styles[`title-variant-${variantOverride}`],\n isRefresh && styles[`title-variant-${variantOverride}-refresh`]\n )}\n >\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span\n {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME }}\n className={clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`])}\n id={headingId}\n >\n {children}\n </span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n <InfoLinkLabelContext.Provider value={headingId}>\n {info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n <Description variantOverride={variantOverride}>{description}</Description>\n </div>\n {actions && (\n <div\n className={clsx(\n styles.actions,\n styles[`actions-variant-${variantOverride}`],\n isRefresh && styles[`actions-variant-${variantOverride}-refresh`]\n )}\n >\n {actions}\n </div>\n )}\n </div>\n );\n}\n\nexport function Description({ children, variantOverride }: { children: React.ReactNode; variantOverride: string }) {\n const isRefresh = useVisualRefresh();\n return (\n (children && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles[`description-variant-${variantOverride}-refresh`]\n )}\n >\n {children}\n </p>\n )) ||\n null\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
 
2
2
  export var PACKAGE_SOURCE = 'components';
3
- export var PACKAGE_VERSION = '3.0.0 (ec2ddd9)';
3
+ export var PACKAGE_VERSION = '3.0.0 (c511e1c)';
4
4
  export var THEME = 'open-source-visual-refresh';
5
5
  export var ALWAYS_VISUAL_REFRESH = true;
6
6
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "ec2ddd92e84dd4ed9500a850fbb19ba4c3641366"
2
+ "commit": "c511e1c1dbae1b1d16dab62deb58f22fd1744e27"
3
3
  }
package/package.json CHANGED
@@ -136,7 +136,7 @@
136
136
  "./internal/base-component/index.js",
137
137
  "./internal/base-component/styles.css.js"
138
138
  ],
139
- "version": "3.0.316",
139
+ "version": "3.0.317",
140
140
  "repository": {
141
141
  "type": "git",
142
142
  "url": "https://github.com/cloudscape-design/components.git"