@cloudscape-design/components 3.0.381 → 3.0.382
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.
- package/attribute-editor/interfaces.d.ts.map +1 -1
- package/attribute-editor/interfaces.js.map +1 -1
- package/attribute-editor/row.d.ts.map +1 -1
- package/attribute-editor/row.js +7 -1
- package/attribute-editor/row.js.map +1 -1
- package/container/interfaces.d.ts +2 -4
- package/container/interfaces.d.ts.map +1 -1
- package/container/interfaces.js.map +1 -1
- package/container/styles.css.js +28 -28
- package/container/styles.scoped.css +57 -52
- package/container/styles.selectors.js +28 -28
- package/internal/analytics/components/analytics-funnel.d.ts +1 -1
- package/internal/analytics/components/analytics-funnel.js +1 -1
- package/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/wizard/internal.d.ts.map +1 -1
- package/wizard/internal.js +38 -1
- package/wizard/internal.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAY/D,MAAM,WAAW,6BAA6B;IAC5C,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAA;KAAE,GAAG,GAAG,CAAC,OAAO,CAAC;CAClG;AAED,yBAAiB,oBAAoB,CAAC;IACpC,UAAiB,uBAAuB,CAAC,CAAC;QACxC,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;KACpB;IAED,K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AAC,KAAK,MAAM,CAAC;IAE5C;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAEzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAElE;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;;;;;OAUG;IACH,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnE;;OAEG;IACH,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;IAE7C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAE9F;;OAEG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["attribute-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface AttributeEditorForwardRefType {\n <T>(props: AttributeEditorProps<T> & { ref?: React.Ref<AttributeEditorProps.Ref> }): JSX.Element;\n}\n\nexport namespace AttributeEditorProps {\n export interface IsItemRemovableFunction<T> {\n (item: T): boolean;\n }\n\n export type FieldRenderable<T> = (item: T, itemIndex: number) => React.ReactNode;\n export interface FieldDefinition<T> {\n label?: React.ReactNode;\n info?: React.ReactNode;\n control?: FieldRenderable<T> | React.ReactNode;\n errorText?: FieldRenderable<T> | React.ReactNode;\n constraintText?: FieldRenderable<T> | React.ReactNode;\n }\n\n export interface RemoveButtonClickDetail {\n itemIndex: number;\n }\n\n export interface Ref {\n /**\n * Focuses the 'remove' button for the given row index.\n */\n focusRemoveButton(itemIndex: number): void;\n /**\n * Focuses the 'add' button. Use this, for example, after a user removes the last row.\n */\n focusAddButton(): void;\n }\n\n export interface I18nStrings<T = any> {\n errorIconAriaLabel?: string;\n itemRemovedAriaLive?: string;\n\n /**\n * @deprecated Use `removeButtonAriaLabel` on the component instead.\n */\n removeButtonAriaLabel?: (item: T) => string;\n }\n}\n\nexport interface AttributeEditorProps<T> extends BaseComponentProps {\n /**\n * Displayed when there are no items to display.\n */\n empty?: React.ReactNode;\n\n /**\n * Displayed below the add button. Use it for additional information related to the attribute editor.\n */\n additionalInfo?: React.ReactNode;\n\n /**\n * Specifies the text that's displayed in the add button.\n */\n addButtonText: string;\n\n /**\n * Specifies the text that's displayed in the remove button.\n * @i18n\n */\n removeButtonText?: string;\n\n /**\n * Adds an `aria-label` to the remove button.\n */\n removeButtonAriaLabel?: (item: T) => string;\n\n /**\n * Specifies the items that serve as the data source for all rows.\n * The display of a row is handled by the `definition` property.\n */\n items?: ReadonlyArray<T>;\n\n /**\n * Function that determines whether an item is removable. When this function returns `false`, the remove\n * button is not rendered and the user can't remove the item.\n * By default, all items are removable.\n */\n isItemRemovable?: AttributeEditorProps.IsItemRemovableFunction<T>;\n\n /**\n * Determines whether the add button is disabled.\n */\n disableAddButton?: boolean;\n\n /**\n * Defines the editor configuration. Each object in the array represents one form field in the row.\n * * `label` (ReactNode) - Text label for the form field.\n * * `info` (ReactNode) - Info link for the form field.\n * * `errorText` ((item, itemIndex) => ReactNode) - Error message text to display as a control validation message.\n * It renders the form field as invalid if the returned value is not `null` or `undefined`.\n * * `constraintText` ((item, itemIndex) => ReactNode) - Text to display as a constraint message below the field.\n * * `control` ((item, itemIndex) => ReactNode) - A control to use as the input for the field.\n *\n * A maximum of four fields are supported.\n */\n definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>;\n\n /**\n * Called when add button is clicked.\n */\n onAddButtonClick?: NonCancelableEventHandler;\n\n /**\n * Called when remove button is clicked.\n * The event `detail` contains the index of the corresponding item.\n */\n onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: AttributeEditorProps.I18nStrings<T>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["attribute-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface AttributeEditorForwardRefType {\n <T>(props: AttributeEditorProps<T> & { ref?: React.Ref<AttributeEditorProps.Ref> }): JSX.Element;\n}\n\nexport namespace AttributeEditorProps {\n export interface IsItemRemovableFunction<T> {\n (item: T): boolean;\n }\n\n export type FieldRenderable<T> = (item: T, itemIndex: number) => React.ReactNode;\n export interface FieldDefinition<T> {\n label?: React.ReactNode;\n info?: React.ReactNode;\n control?: FieldRenderable<T> | React.ReactNode;\n errorText?: FieldRenderable<T> | React.ReactNode;\n constraintText?: FieldRenderable<T> | React.ReactNode;\n }\n\n export interface RemoveButtonClickDetail {\n itemIndex: number;\n }\n\n export interface Ref {\n /**\n * Focuses the 'remove' button for the given row index.\n */\n focusRemoveButton(itemIndex: number): void;\n /**\n * Focuses the 'add' button. Use this, for example, after a user removes the last row.\n */\n focusAddButton(): void;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n export interface I18nStrings<T = any> {\n errorIconAriaLabel?: string;\n itemRemovedAriaLive?: string;\n\n /**\n * @deprecated Use `removeButtonAriaLabel` on the component instead.\n */\n removeButtonAriaLabel?: (item: T) => string;\n }\n}\n\nexport interface AttributeEditorProps<T> extends BaseComponentProps {\n /**\n * Displayed when there are no items to display.\n */\n empty?: React.ReactNode;\n\n /**\n * Displayed below the add button. Use it for additional information related to the attribute editor.\n */\n additionalInfo?: React.ReactNode;\n\n /**\n * Specifies the text that's displayed in the add button.\n */\n addButtonText: string;\n\n /**\n * Specifies the text that's displayed in the remove button.\n * @i18n\n */\n removeButtonText?: string;\n\n /**\n * Adds an `aria-label` to the remove button.\n */\n removeButtonAriaLabel?: (item: T) => string;\n\n /**\n * Specifies the items that serve as the data source for all rows.\n * The display of a row is handled by the `definition` property.\n */\n items?: ReadonlyArray<T>;\n\n /**\n * Function that determines whether an item is removable. When this function returns `false`, the remove\n * button is not rendered and the user can't remove the item.\n * By default, all items are removable.\n */\n isItemRemovable?: AttributeEditorProps.IsItemRemovableFunction<T>;\n\n /**\n * Determines whether the add button is disabled.\n */\n disableAddButton?: boolean;\n\n /**\n * Defines the editor configuration. Each object in the array represents one form field in the row.\n * * `label` (ReactNode) - Text label for the form field.\n * * `info` (ReactNode) - Info link for the form field.\n * * `errorText` ((item, itemIndex) => ReactNode) - Error message text to display as a control validation message.\n * It renders the form field as invalid if the returned value is not `null` or `undefined`.\n * * `constraintText` ((item, itemIndex) => ReactNode) - Text to display as a constraint message below the field.\n * * `control` ((item, itemIndex) => ReactNode) - A control to use as the input for the field.\n *\n * A maximum of four fields are supported.\n */\n definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>;\n\n /**\n * Called when add button is clicked.\n */\n onAddButtonClick?: NonCancelableEventHandler;\n\n /**\n * Called when remove button is clicked.\n * The event `detail` contains the index of the corresponding item.\n */\n onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: AttributeEditorProps.I18nStrings<T>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/row.tsx"],"names":[],"mappings":";AAMA,OAA6B,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AASvF,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,WAAW,EAAE,oBAAoB,CAAC,WAAW,GAAG,SAAS,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IACrD,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAC9F,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;CAC7C;
|
|
1
|
+
{"version":3,"file":"row.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/row.tsx"],"names":[],"mappings":";AAMA,OAA6B,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AASvF,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,WAAW,EAAE,oBAAoB,CAAC,WAAW,GAAG,SAAS,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IACrD,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAC9F,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;CAC7C;AAmBD,eAAO,MAAM,GAAG,6BA6EgB,WAAW,CAAC"}
|
package/attribute-editor/row.js
CHANGED
|
@@ -13,7 +13,13 @@ import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
|
13
13
|
import { useInternalI18n } from '../i18n/context';
|
|
14
14
|
const Divider = () => React.createElement(InternalBox, { className: styles.divider, padding: { top: 'l' } });
|
|
15
15
|
function render(item, itemIndex, slot) {
|
|
16
|
-
|
|
16
|
+
if (isSlotFunction(slot)) {
|
|
17
|
+
return slot(item, itemIndex);
|
|
18
|
+
}
|
|
19
|
+
return slot;
|
|
20
|
+
function isSlotFunction(slot) {
|
|
21
|
+
return typeof slot === 'function';
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
const GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }];
|
|
19
25
|
const REMOVABLE_GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }, { colspan: { default: 12, xs: 3 } }];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.js","sourceRoot":"lib/default/","sources":["attribute-editor/row.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,oBAAgD,MAAM,2BAA2B,CAAC;AAGzF,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AACvF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAI,CAAC;AAexF,SAAS,MAAM,CACb,IAAO,EACP,SAAiB,EACjB,IAA2E;IAE3E,
|
|
1
|
+
{"version":3,"file":"row.js","sourceRoot":"lib/default/","sources":["attribute-editor/row.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,oBAAgD,MAAM,2BAA2B,CAAC;AAGzF,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAo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AAK,CAAC,IAAI,QAAQ;QACnF,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,gBAAgB,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,QAAQ;QACnF,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,gBAAgB;KAC1C,CAAC,IAED,QAAQ,CACL,CACP,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport InternalBox from '../box/internal';\nimport styles from './styles.css.js';\nimport React, { useCallback } from 'react';\nimport InternalFormField from '../form-field/internal';\nimport InternalColumnLayout, { ColumnLayoutBreakpoint } from '../column-layout/internal';\nimport { AttributeEditorProps } from './interfaces';\nimport { ButtonProps } from '../button/interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport InternalGrid from '../grid/internal';\nimport { InternalButton } from '../button/internal';\nimport clsx from 'clsx';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useInternalI18n } from '../i18n/context';\n\nconst Divider = () => <InternalBox className={styles.divider} padding={{ top: 'l' }} />;\n\nexport interface RowProps<T> {\n breakpoint: ColumnLayoutBreakpoint | null;\n item: T;\n definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>;\n i18nStrings: AttributeEditorProps.I18nStrings | undefined;\n index: number;\n removable: boolean;\n removeButtonText?: string;\n removeButtonRefs: Array<ButtonProps.Ref | undefined>;\n onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;\n removeButtonAriaLabel?: (item: T) => string;\n}\n\nfunction render<T>(\n item: T,\n itemIndex: number,\n slot: AttributeEditorProps.FieldRenderable<T> | React.ReactNode | undefined\n) {\n if (isSlotFunction(slot)) {\n return slot(item, itemIndex);\n }\n return slot;\n\n function isSlotFunction(slot: unknown): slot is AttributeEditorProps.FieldRenderable<T> {\n return typeof slot === 'function';\n }\n}\n\nconst GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }];\nconst REMOVABLE_GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }, { colspan: { default: 12, xs: 3 } }];\nexport const Row = React.memo(\n <T,>({\n breakpoint,\n item,\n definition,\n i18nStrings = {},\n index,\n removable,\n removeButtonText,\n removeButtonRefs,\n onRemoveButtonClick,\n removeButtonAriaLabel,\n }: RowProps<T>) => {\n const i18n = useInternalI18n('attribute-editor');\n const isNarrowViewport = breakpoint === 'default' || breakpoint === 'xxs';\n const isWideViewport = !isNarrowViewport;\n\n const handleRemoveClick = useCallback(() => {\n fireNonCancelableEvent(onRemoveButtonClick, { itemIndex: index });\n }, [onRemoveButtonClick, index]);\n\n const firstControlId = useUniqueId('first-control-id-');\n\n return (\n <InternalBox className={styles.row} margin={{ bottom: 's' }}>\n <div role=\"group\" aria-labelledby={`${firstControlId}-label ${firstControlId}`}>\n <InternalGrid\n __breakpoint={breakpoint}\n gridDefinition={removable ? REMOVABLE_GRID_DEFINITION : GRID_DEFINITION}\n >\n <InternalColumnLayout\n className={styles['row-control']}\n columns={definition.length}\n __breakpoint={breakpoint}\n >\n {definition.map(({ info, label, constraintText, errorText, control }, defIndex) => (\n <InternalFormField\n key={defIndex}\n className={styles.field}\n label={label}\n info={info}\n constraintText={render(item, index, constraintText)}\n errorText={render(item, index, errorText)}\n stretch={true}\n i18nStrings={{ errorIconAriaLabel: i18nStrings.errorIconAriaLabel }}\n __hideLabel={isWideViewport && index > 0}\n controlId={defIndex === 0 ? firstControlId : undefined}\n >\n {render(item, index, control)}\n </InternalFormField>\n ))}\n </InternalColumnLayout>\n {removable && (\n <ButtonContainer\n index={index}\n isNarrowViewport={isNarrowViewport}\n hasLabel={definition.some(row => row.label)}\n >\n <InternalButton\n className={styles['remove-button']}\n formAction=\"none\"\n ref={ref => {\n removeButtonRefs[index] = ref ?? undefined;\n }}\n ariaLabel={(removeButtonAriaLabel ?? i18nStrings.removeButtonAriaLabel)?.(item)}\n onClick={handleRemoveClick}\n >\n {i18n('removeButtonText', removeButtonText)}\n </InternalButton>\n </ButtonContainer>\n )}\n </InternalGrid>\n </div>\n {isNarrowViewport && <Divider />}\n </InternalBox>\n );\n }\n) as <T>(props: RowProps<T>) => JSX.Element;\n\ninterface ButtonContainer {\n index: number;\n children: React.ReactNode;\n isNarrowViewport: boolean;\n hasLabel: boolean;\n}\n\nconst ButtonContainer = ({ index, children, isNarrowViewport, hasLabel }: ButtonContainer) => (\n <div\n className={clsx({\n [styles['button-container-haslabel']]: !isNarrowViewport && index === 0 && hasLabel,\n [styles['button-container-nolabel']]: !isNarrowViewport && index === 0 && !hasLabel,\n [styles['right-align']]: isNarrowViewport,\n })}\n >\n {children}\n </div>\n);\n"]}
|
|
@@ -14,7 +14,7 @@ export interface ContainerProps extends BaseComponentProps {
|
|
|
14
14
|
* Use this slot to render a media element. Supported element types are 'img', 'video', and 'picture'.
|
|
15
15
|
* You can define different positions and sizes for the media element within the container.
|
|
16
16
|
*
|
|
17
|
-
* * `content` - Use this slot to render your media element. We support `img`, `video` and `
|
|
17
|
+
* * `content` - Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.
|
|
18
18
|
*
|
|
19
19
|
* * `position` - Defines the media slot's position within the container. Defaults to `top`.
|
|
20
20
|
*
|
|
@@ -61,9 +61,7 @@ export interface ContainerProps extends BaseComponentProps {
|
|
|
61
61
|
export declare namespace ContainerProps {
|
|
62
62
|
interface Media {
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
* Use this slot to render your media element. We support `img`, `video` and `picture` elements.
|
|
66
|
-
*
|
|
64
|
+
* Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.
|
|
67
65
|
*/
|
|
68
66
|
content: React.ReactNode;
|
|
69
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["container/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,M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G;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAED,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,KAAK;QACpB;;WAEG;QACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QAEzB;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;QAE1B;;;;;;WAMG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAExB;;;;;;WAMG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC1B;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["container/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';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Heading element of the container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Determines whether the container header has padding. If `true`, removes the default padding from the header.\n */\n disableHeaderPaddings?: boolean;\n\n /**\n *\n * Use this slot to render a media element. Supported element types are 'img', 'video', and 'picture'.\n * You can define different positions and sizes for the media element within the container.\n *\n * * `content` - Use this slot to render your media element. We support `img`, `video` and `
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["container/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';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Heading element of the container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Determines whether the container header has padding. If `true`, removes the default padding from the header.\n */\n disableHeaderPaddings?: boolean;\n\n /**\n *\n * Use this slot to render a media element. Supported element types are 'img', 'video', and 'picture'.\n * You can define different positions and sizes for the media element within the container.\n *\n * * `content` - Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.\n *\n * * `position` - Defines the media slot's position within the container. Defaults to `top`.\n *\n * * `width` - Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it.\n * Note: This value is considered only when `position` is set to `side`.\n * If no width is provided, the media slot will take a maximum of 66% of the container's width.\n *\n * * `height` - Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it. * Note: This value is only considered if `position` is set to `top`.\n * If no height is provided, the media slot will be displayed at its full height.\n *\n */\n media?: ContainerProps.Media;\n\n /**\n * Main content of the container.\n */\n children?: React.ReactNode;\n\n /**\n * Determines whether the container content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Enabling this property will make the container to fit into available height. If content is too short, the container\n * will stretch, if too long, the container will shrink and show vertical scrollbar.\n *\n * Use this property to align heights of multiple containers displayed in a single row. It is recommended to stretch\n * all containers to the height of the longest one, to avoid extra vertical scroll areas.\n */\n fitHeight?: boolean;\n\n /**\n * Footer of the container.\n */\n footer?: React.ReactNode;\n\n /**\n * Specify a container variant with one of the following:\n * * `default` - Use this variant in standalone context.\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * @visualrefresh `stacked` variant\n */\n variant?: 'default' | 'stacked';\n}\n\nexport namespace ContainerProps {\n export interface Media {\n /**\n * Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.\n */\n content: React.ReactNode;\n\n /**\n * Defines the media slot's position within the container. Defaults to `top`.\n */\n position?: 'top' | 'side';\n\n /**\n * Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.\n * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.\n *\n * Note: This value is considered only when `position` is set to `side`.\n * If no width is provided, the media slot will take a maximum of 66% of the container's width.\n */\n width?: string | number;\n\n /**\n * Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.\n * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.\n *\n * Note: This value is only considered if `position` is set to `top`.\n * If no height is provided, the media slot will be displayed at its full height.\n */\n height?: string | number;\n }\n}\n"]}
|
package/container/styles.css.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"fit-height": "awsui_fit-
|
|
6
|
-
"with-side-media": "awsui_with-side-
|
|
7
|
-
"variant-default": "awsui_variant-
|
|
8
|
-
"variant-stacked": "awsui_variant-
|
|
9
|
-
"sticky-enabled": "awsui_sticky-
|
|
10
|
-
"with-top-media": "awsui_with-top-
|
|
11
|
-
"content-wrapper": "awsui_content-
|
|
12
|
-
"content-wrapper-fit-height": "awsui_content-wrapper-fit-
|
|
13
|
-
"media": "
|
|
14
|
-
"media-top": "awsui_media-
|
|
15
|
-
"media-side": "awsui_media-
|
|
16
|
-
"header": "
|
|
17
|
-
"header-with-media": "awsui_header-with-
|
|
18
|
-
"header-sticky-disabled": "awsui_header-sticky-
|
|
19
|
-
"header-sticky-enabled": "awsui_header-sticky-
|
|
20
|
-
"header-stuck": "awsui_header-
|
|
21
|
-
"header-variant-cards": "awsui_header-variant-
|
|
22
|
-
"header-dynamic-height": "awsui_header-dynamic-
|
|
23
|
-
"with-paddings": "awsui_with-
|
|
24
|
-
"with-hidden-content": "awsui_with-hidden-
|
|
25
|
-
"header-variant-full-page": "awsui_header-variant-full-
|
|
26
|
-
"dark-header": "awsui_dark-
|
|
27
|
-
"content": "
|
|
28
|
-
"content-fit-height": "awsui_content-fit-
|
|
29
|
-
"content-with-media": "awsui_content-with-
|
|
30
|
-
"footer": "
|
|
31
|
-
"with-divider": "awsui_with-
|
|
4
|
+
"root": "awsui_root_14iqq_1x1rn_97",
|
|
5
|
+
"fit-height": "awsui_fit-height_14iqq_1x1rn_111",
|
|
6
|
+
"with-side-media": "awsui_with-side-media_14iqq_1x1rn_116",
|
|
7
|
+
"variant-default": "awsui_variant-default_14iqq_1x1rn_119",
|
|
8
|
+
"variant-stacked": "awsui_variant-stacked_14iqq_1x1rn_119",
|
|
9
|
+
"sticky-enabled": "awsui_sticky-enabled_14iqq_1x1rn_172",
|
|
10
|
+
"with-top-media": "awsui_with-top-media_14iqq_1x1rn_184",
|
|
11
|
+
"content-wrapper": "awsui_content-wrapper_14iqq_1x1rn_189",
|
|
12
|
+
"content-wrapper-fit-height": "awsui_content-wrapper-fit-height_14iqq_1x1rn_194",
|
|
13
|
+
"media": "awsui_media_14iqq_1x1rn_199",
|
|
14
|
+
"media-top": "awsui_media-top_14iqq_1x1rn_216",
|
|
15
|
+
"media-side": "awsui_media-side_14iqq_1x1rn_221",
|
|
16
|
+
"header": "awsui_header_14iqq_1x1rn_227",
|
|
17
|
+
"header-with-media": "awsui_header-with-media_14iqq_1x1rn_232",
|
|
18
|
+
"header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_1x1rn_238",
|
|
19
|
+
"header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_1x1rn_242",
|
|
20
|
+
"header-stuck": "awsui_header-stuck_14iqq_1x1rn_248",
|
|
21
|
+
"header-variant-cards": "awsui_header-variant-cards_14iqq_1x1rn_254",
|
|
22
|
+
"header-dynamic-height": "awsui_header-dynamic-height_14iqq_1x1rn_257",
|
|
23
|
+
"with-paddings": "awsui_with-paddings_14iqq_1x1rn_263",
|
|
24
|
+
"with-hidden-content": "awsui_with-hidden-content_14iqq_1x1rn_269",
|
|
25
|
+
"header-variant-full-page": "awsui_header-variant-full-page_14iqq_1x1rn_319",
|
|
26
|
+
"dark-header": "awsui_dark-header_14iqq_1x1rn_337",
|
|
27
|
+
"content": "awsui_content_14iqq_1x1rn_189",
|
|
28
|
+
"content-fit-height": "awsui_content-fit-height_14iqq_1x1rn_345",
|
|
29
|
+
"content-with-media": "awsui_content-with-media_14iqq_1x1rn_354",
|
|
30
|
+
"footer": "awsui_footer_14iqq_1x1rn_358",
|
|
31
|
+
"with-divider": "awsui_with-divider_14iqq_1x1rn_361"
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -94,7 +94,7 @@ 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
|
-
.
|
|
97
|
+
.awsui_root_14iqq_1x1rn_97:not(#\9) {
|
|
98
98
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
99
99
|
border-collapse: separate;
|
|
100
100
|
border-spacing: 0;
|
|
@@ -134,20 +134,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
134
134
|
word-wrap: break-word;
|
|
135
135
|
position: relative;
|
|
136
136
|
}
|
|
137
|
-
.
|
|
137
|
+
.awsui_root_14iqq_1x1rn_97.awsui_fit-height_14iqq_1x1rn_111:not(#\9) {
|
|
138
138
|
display: flex;
|
|
139
139
|
flex-direction: column;
|
|
140
140
|
height: 100%;
|
|
141
141
|
}
|
|
142
|
-
.
|
|
142
|
+
.awsui_root_14iqq_1x1rn_97.awsui_fit-height_14iqq_1x1rn_111.awsui_with-side-media_14iqq_1x1rn_116:not(#\9) {
|
|
143
143
|
flex-direction: row;
|
|
144
144
|
}
|
|
145
|
-
.
|
|
145
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-default_14iqq_1x1rn_119:not(#\9), .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9) {
|
|
146
146
|
border-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
147
147
|
box-sizing: border-box;
|
|
148
148
|
background-color: var(--color-background-container-content-4un1ap, #ffffff);
|
|
149
149
|
}
|
|
150
|
-
.
|
|
150
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-default_14iqq_1x1rn_119:not(#\9)::before, .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9)::before {
|
|
151
151
|
content: "";
|
|
152
152
|
position: absolute;
|
|
153
153
|
left: 0px;
|
|
@@ -162,7 +162,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
162
162
|
border-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
163
163
|
z-index: 1;
|
|
164
164
|
}
|
|
165
|
-
.
|
|
165
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-default_14iqq_1x1rn_119:not(#\9)::after, .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9)::after {
|
|
166
166
|
content: "";
|
|
167
167
|
position: absolute;
|
|
168
168
|
left: 0px;
|
|
@@ -177,128 +177,133 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
177
177
|
mix-blend-mode: multiply;
|
|
178
178
|
}
|
|
179
179
|
@media screen and (-ms-high-contrast: active) {
|
|
180
|
-
.
|
|
180
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-default_14iqq_1x1rn_119:not(#\9), .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9) {
|
|
181
181
|
border: var(--border-field-width-09w7vk, 2px) solid var(--color-border-container-top-736buh, transparent);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
.
|
|
184
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9):not(:last-child), .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9):not(:last-child)::before, .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9):not(:last-child)::after {
|
|
185
185
|
border-bottom-right-radius: 0;
|
|
186
186
|
border-bottom-left-radius: 0;
|
|
187
187
|
}
|
|
188
|
-
.
|
|
188
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119 + .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9), .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119 + .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9)::before, .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119 + .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9)::after {
|
|
189
189
|
border-top-left-radius: 0;
|
|
190
190
|
border-top-right-radius: 0;
|
|
191
191
|
}
|
|
192
|
-
.
|
|
192
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119 + .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9)::before {
|
|
193
193
|
border-top: var(--border-divider-section-width-8a5uu9, 2px) solid var(--color-border-divider-default-et9j7s, #e9ebed);
|
|
194
194
|
}
|
|
195
|
-
.
|
|
195
|
+
.awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119 + .awsui_root_14iqq_1x1rn_97.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9)::after {
|
|
196
196
|
box-shadow: var(--shadow-container-stacked-4gw245, -1px 1px 1px 0px #e9ebed, 1px 1px 1px 0px #e9ebed, 0px 9px 8px -7px rgba(0, 7, 22, 0.12), 8px 0px 8px -7px rgba(0, 7, 22, 0.12), -8px 0px 8px -7px rgba(0, 7, 22, 0.12));
|
|
197
197
|
}
|
|
198
|
-
.
|
|
198
|
+
.awsui_root_14iqq_1x1rn_97.awsui_sticky-enabled_14iqq_1x1rn_172:not(#\9)::before {
|
|
199
199
|
top: calc(-1 * var(--border-container-top-width-uugwwl, 0px));
|
|
200
200
|
}
|
|
201
|
-
.
|
|
201
|
+
.awsui_root_14iqq_1x1rn_97.awsui_sticky-enabled_14iqq_1x1rn_172.awsui_variant-stacked_14iqq_1x1rn_119:not(#\9)::before {
|
|
202
202
|
top: calc(-1 * var(--border-divider-section-width-8a5uu9, 2px));
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
.awsui_with-side-
|
|
205
|
+
.awsui_with-side-media_14iqq_1x1rn_116:not(#\9) {
|
|
206
206
|
display: flex;
|
|
207
207
|
flex-direction: row;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
.awsui_with-top-
|
|
210
|
+
.awsui_with-top-media_14iqq_1x1rn_184:not(#\9) {
|
|
211
211
|
display: flex;
|
|
212
212
|
flex-direction: column;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
.awsui_content-
|
|
215
|
+
.awsui_content-wrapper_14iqq_1x1rn_189:not(#\9) {
|
|
216
216
|
display: flex;
|
|
217
217
|
flex-direction: column;
|
|
218
218
|
width: 100%;
|
|
219
219
|
}
|
|
220
|
-
.awsui_content-wrapper-fit-
|
|
220
|
+
.awsui_content-wrapper-fit-height_14iqq_1x1rn_194:not(#\9) {
|
|
221
221
|
height: 100%;
|
|
222
222
|
overflow: hidden;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
.
|
|
225
|
+
.awsui_media_14iqq_1x1rn_199:not(#\9) {
|
|
226
226
|
overflow: hidden;
|
|
227
227
|
flex-shrink: 0;
|
|
228
228
|
}
|
|
229
|
-
.
|
|
230
|
-
.
|
|
231
|
-
.
|
|
229
|
+
.awsui_media_14iqq_1x1rn_199 img:not(#\9),
|
|
230
|
+
.awsui_media_14iqq_1x1rn_199 video:not(#\9),
|
|
231
|
+
.awsui_media_14iqq_1x1rn_199 picture:not(#\9) {
|
|
232
232
|
width: 100%;
|
|
233
233
|
height: 100%;
|
|
234
234
|
object-fit: cover;
|
|
235
235
|
object-position: center;
|
|
236
236
|
}
|
|
237
|
-
.
|
|
237
|
+
.awsui_media_14iqq_1x1rn_199 iframe:not(#\9) {
|
|
238
|
+
width: 100%;
|
|
239
|
+
height: 100%;
|
|
240
|
+
border: 0;
|
|
241
|
+
}
|
|
242
|
+
.awsui_media-top_14iqq_1x1rn_216:not(#\9) {
|
|
238
243
|
max-height: 66%;
|
|
239
244
|
border-top-left-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
240
245
|
border-top-right-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
241
246
|
}
|
|
242
|
-
.awsui_media-
|
|
247
|
+
.awsui_media-side_14iqq_1x1rn_221:not(#\9) {
|
|
243
248
|
max-width: 66%;
|
|
244
249
|
border-top-left-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
245
250
|
border-bottom-left-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
246
251
|
}
|
|
247
252
|
|
|
248
|
-
.
|
|
253
|
+
.awsui_header_14iqq_1x1rn_227:not(#\9) {
|
|
249
254
|
background-color: var(--color-background-container-header-8b9fgi, #ffffff);
|
|
250
255
|
border-top-left-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
251
256
|
border-top-right-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
252
257
|
}
|
|
253
|
-
.
|
|
258
|
+
.awsui_header_14iqq_1x1rn_227.awsui_header-with-media_14iqq_1x1rn_232:not(#\9) {
|
|
254
259
|
background: none;
|
|
255
260
|
}
|
|
256
|
-
.
|
|
261
|
+
.awsui_header_14iqq_1x1rn_227.awsui_header-with-media_14iqq_1x1rn_232:not(#\9):not(:empty) {
|
|
257
262
|
border-bottom: none;
|
|
258
263
|
}
|
|
259
|
-
.awsui_header-sticky-
|
|
264
|
+
.awsui_header-sticky-disabled_14iqq_1x1rn_238:not(#\9) {
|
|
260
265
|
position: relative;
|
|
261
266
|
z-index: 1;
|
|
262
267
|
}
|
|
263
|
-
.awsui_header-sticky-
|
|
268
|
+
.awsui_header-sticky-enabled_14iqq_1x1rn_242:not(#\9) {
|
|
264
269
|
top: 0;
|
|
265
270
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
266
271
|
position: sticky;
|
|
267
272
|
z-index: 800;
|
|
268
273
|
}
|
|
269
|
-
.awsui_header-
|
|
274
|
+
.awsui_header-stuck_14iqq_1x1rn_248:not(#\9) {
|
|
270
275
|
border-radius: 0;
|
|
271
276
|
}
|
|
272
|
-
.awsui_header-
|
|
277
|
+
.awsui_header-stuck_14iqq_1x1rn_248:not(#\9)::before {
|
|
273
278
|
border: 0;
|
|
274
279
|
}
|
|
275
|
-
.awsui_header-
|
|
280
|
+
.awsui_header-stuck_14iqq_1x1rn_248:not(#\9):not(.awsui_header-variant-cards_14iqq_1x1rn_254) {
|
|
276
281
|
box-shadow: var(--shadow-sticky-embedded-uvh5ry, 0px 2px 0px 0px #e9ebed, 0px 16px 16px -12px rgba(0, 7, 22, 0.1));
|
|
277
282
|
}
|
|
278
|
-
.awsui_header-dynamic-
|
|
283
|
+
.awsui_header-dynamic-height_14iqq_1x1rn_257.awsui_header-stuck_14iqq_1x1rn_248:not(#\9) {
|
|
279
284
|
margin-bottom: calc(var(--line-height-heading-xl-avbttk, 30px) - var(--line-height-heading-l-mmm3my, 24px));
|
|
280
285
|
}
|
|
281
|
-
.
|
|
286
|
+
.awsui_header_14iqq_1x1rn_227:not(#\9):not(:empty) {
|
|
282
287
|
border-bottom: var(--border-container-sticky-width-6asz33, 0px) solid var(--color-border-container-divider-p2uygo, transparent);
|
|
283
288
|
}
|
|
284
|
-
.
|
|
289
|
+
.awsui_header_14iqq_1x1rn_227.awsui_with-paddings_14iqq_1x1rn_263:not(#\9) {
|
|
285
290
|
padding: var(--space-container-header-top-5qav00, 12px) var(--space-container-horizontal-wfukh3, 20px) var(--space-container-header-bottom-vj01hn, 8px);
|
|
286
291
|
}
|
|
287
|
-
.
|
|
292
|
+
.awsui_header_14iqq_1x1rn_227.awsui_with-paddings_14iqq_1x1rn_263.awsui_header-variant-cards_14iqq_1x1rn_254:not(#\9) {
|
|
288
293
|
padding: var(--space-container-header-top-5qav00, 12px) var(--space-container-horizontal-wfukh3, 20px);
|
|
289
294
|
}
|
|
290
|
-
.
|
|
295
|
+
.awsui_header_14iqq_1x1rn_227.awsui_with-hidden-content_14iqq_1x1rn_269:not(#\9) {
|
|
291
296
|
border-bottom-left-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
292
297
|
border-bottom-right-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
293
298
|
}
|
|
294
|
-
.awsui_header-variant-
|
|
299
|
+
.awsui_header-variant-cards_14iqq_1x1rn_254:not(#\9) {
|
|
295
300
|
border-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
296
301
|
box-sizing: border-box;
|
|
297
302
|
}
|
|
298
|
-
.awsui_header-variant-
|
|
303
|
+
.awsui_header-variant-cards_14iqq_1x1rn_254:not(#\9):not(.awsui_header-sticky-enabled_14iqq_1x1rn_242) {
|
|
299
304
|
position: relative;
|
|
300
305
|
}
|
|
301
|
-
.awsui_header-variant-
|
|
306
|
+
.awsui_header-variant-cards_14iqq_1x1rn_254:not(#\9)::before {
|
|
302
307
|
content: "";
|
|
303
308
|
position: absolute;
|
|
304
309
|
left: 0px;
|
|
@@ -313,7 +318,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
313
318
|
border-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
314
319
|
z-index: 1;
|
|
315
320
|
}
|
|
316
|
-
.awsui_header-variant-
|
|
321
|
+
.awsui_header-variant-cards_14iqq_1x1rn_254:not(#\9)::after {
|
|
317
322
|
content: "";
|
|
318
323
|
position: absolute;
|
|
319
324
|
left: 0px;
|
|
@@ -328,19 +333,19 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
328
333
|
mix-blend-mode: multiply;
|
|
329
334
|
}
|
|
330
335
|
@media screen and (-ms-high-contrast: active) {
|
|
331
|
-
.awsui_header-variant-
|
|
336
|
+
.awsui_header-variant-cards_14iqq_1x1rn_254:not(#\9) {
|
|
332
337
|
border: var(--border-field-width-09w7vk, 2px) solid var(--color-border-container-top-736buh, transparent);
|
|
333
338
|
}
|
|
334
339
|
}
|
|
335
|
-
.awsui_header-variant-
|
|
340
|
+
.awsui_header-variant-cards_14iqq_1x1rn_254.awsui_header-stuck_14iqq_1x1rn_248:not(#\9)::after, .awsui_header-variant-cards_14iqq_1x1rn_254.awsui_header-stuck_14iqq_1x1rn_248:not(#\9)::before {
|
|
336
341
|
border: 0;
|
|
337
342
|
border-top-left-radius: 0;
|
|
338
343
|
border-top-right-radius: 0;
|
|
339
344
|
}
|
|
340
|
-
.awsui_header-variant-full-
|
|
345
|
+
.awsui_header-variant-full-page_14iqq_1x1rn_319.awsui_header-stuck_14iqq_1x1rn_248:not(#\9) {
|
|
341
346
|
box-shadow: none;
|
|
342
347
|
}
|
|
343
|
-
.awsui_header-variant-full-
|
|
348
|
+
.awsui_header-variant-full-page_14iqq_1x1rn_319.awsui_header-stuck_14iqq_1x1rn_248:not(#\9)::after {
|
|
344
349
|
content: "";
|
|
345
350
|
position: absolute;
|
|
346
351
|
right: 0;
|
|
@@ -355,30 +360,30 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
355
360
|
The dynamic height dark header needs a background that will cover
|
|
356
361
|
the default white background of the container component.
|
|
357
362
|
*/
|
|
358
|
-
.awsui_dark-
|
|
363
|
+
.awsui_dark-header_14iqq_1x1rn_337:not(#\9) {
|
|
359
364
|
background-color: var(--color-background-layout-main-nx09lr, #ffffff);
|
|
360
365
|
color: var(--color-text-body-default-2sxhhn, #000716);
|
|
361
366
|
}
|
|
362
367
|
|
|
363
|
-
.
|
|
368
|
+
.awsui_content_14iqq_1x1rn_189:not(#\9) {
|
|
364
369
|
flex: 1;
|
|
365
370
|
}
|
|
366
|
-
.awsui_content-fit-
|
|
371
|
+
.awsui_content-fit-height_14iqq_1x1rn_345:not(#\9) {
|
|
367
372
|
overflow: auto;
|
|
368
373
|
}
|
|
369
|
-
.
|
|
374
|
+
.awsui_content_14iqq_1x1rn_189.awsui_with-paddings_14iqq_1x1rn_263:not(#\9) {
|
|
370
375
|
padding: var(--space-scaled-l-0hpmd7, 20px) var(--space-container-horizontal-wfukh3, 20px);
|
|
371
376
|
}
|
|
372
|
-
.
|
|
377
|
+
.awsui_header_14iqq_1x1rn_227 + .awsui_content_14iqq_1x1rn_189.awsui_with-paddings_14iqq_1x1rn_263:not(#\9) {
|
|
373
378
|
padding-top: var(--space-container-content-top-1ae0r3, 4px);
|
|
374
379
|
}
|
|
375
|
-
.
|
|
380
|
+
.awsui_header_14iqq_1x1rn_227 + .awsui_content_14iqq_1x1rn_189.awsui_with-paddings_14iqq_1x1rn_263.awsui_content-with-media_14iqq_1x1rn_354:not(#\9) {
|
|
376
381
|
padding-top: 0;
|
|
377
382
|
}
|
|
378
383
|
|
|
379
|
-
.
|
|
384
|
+
.awsui_footer_14iqq_1x1rn_358.awsui_with-paddings_14iqq_1x1rn_263:not(#\9) {
|
|
380
385
|
padding: var(--space-scaled-s-aqzyko, 12px) var(--space-container-horizontal-wfukh3, 20px);
|
|
381
386
|
}
|
|
382
|
-
.
|
|
387
|
+
.awsui_footer_14iqq_1x1rn_358.awsui_with-divider_14iqq_1x1rn_361:not(#\9) {
|
|
383
388
|
border-top: var(--border-divider-section-width-8a5uu9, 2px) solid var(--color-border-divider-default-et9j7s, #e9ebed);
|
|
384
389
|
}
|
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"fit-height": "awsui_fit-
|
|
7
|
-
"with-side-media": "awsui_with-side-
|
|
8
|
-
"variant-default": "awsui_variant-
|
|
9
|
-
"variant-stacked": "awsui_variant-
|
|
10
|
-
"sticky-enabled": "awsui_sticky-
|
|
11
|
-
"with-top-media": "awsui_with-top-
|
|
12
|
-
"content-wrapper": "awsui_content-
|
|
13
|
-
"content-wrapper-fit-height": "awsui_content-wrapper-fit-
|
|
14
|
-
"media": "
|
|
15
|
-
"media-top": "awsui_media-
|
|
16
|
-
"media-side": "awsui_media-
|
|
17
|
-
"header": "
|
|
18
|
-
"header-with-media": "awsui_header-with-
|
|
19
|
-
"header-sticky-disabled": "awsui_header-sticky-
|
|
20
|
-
"header-sticky-enabled": "awsui_header-sticky-
|
|
21
|
-
"header-stuck": "awsui_header-
|
|
22
|
-
"header-variant-cards": "awsui_header-variant-
|
|
23
|
-
"header-dynamic-height": "awsui_header-dynamic-
|
|
24
|
-
"with-paddings": "awsui_with-
|
|
25
|
-
"with-hidden-content": "awsui_with-hidden-
|
|
26
|
-
"header-variant-full-page": "awsui_header-variant-full-
|
|
27
|
-
"dark-header": "awsui_dark-
|
|
28
|
-
"content": "
|
|
29
|
-
"content-fit-height": "awsui_content-fit-
|
|
30
|
-
"content-with-media": "awsui_content-with-
|
|
31
|
-
"footer": "
|
|
32
|
-
"with-divider": "awsui_with-
|
|
5
|
+
"root": "awsui_root_14iqq_1x1rn_97",
|
|
6
|
+
"fit-height": "awsui_fit-height_14iqq_1x1rn_111",
|
|
7
|
+
"with-side-media": "awsui_with-side-media_14iqq_1x1rn_116",
|
|
8
|
+
"variant-default": "awsui_variant-default_14iqq_1x1rn_119",
|
|
9
|
+
"variant-stacked": "awsui_variant-stacked_14iqq_1x1rn_119",
|
|
10
|
+
"sticky-enabled": "awsui_sticky-enabled_14iqq_1x1rn_172",
|
|
11
|
+
"with-top-media": "awsui_with-top-media_14iqq_1x1rn_184",
|
|
12
|
+
"content-wrapper": "awsui_content-wrapper_14iqq_1x1rn_189",
|
|
13
|
+
"content-wrapper-fit-height": "awsui_content-wrapper-fit-height_14iqq_1x1rn_194",
|
|
14
|
+
"media": "awsui_media_14iqq_1x1rn_199",
|
|
15
|
+
"media-top": "awsui_media-top_14iqq_1x1rn_216",
|
|
16
|
+
"media-side": "awsui_media-side_14iqq_1x1rn_221",
|
|
17
|
+
"header": "awsui_header_14iqq_1x1rn_227",
|
|
18
|
+
"header-with-media": "awsui_header-with-media_14iqq_1x1rn_232",
|
|
19
|
+
"header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_1x1rn_238",
|
|
20
|
+
"header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_1x1rn_242",
|
|
21
|
+
"header-stuck": "awsui_header-stuck_14iqq_1x1rn_248",
|
|
22
|
+
"header-variant-cards": "awsui_header-variant-cards_14iqq_1x1rn_254",
|
|
23
|
+
"header-dynamic-height": "awsui_header-dynamic-height_14iqq_1x1rn_257",
|
|
24
|
+
"with-paddings": "awsui_with-paddings_14iqq_1x1rn_263",
|
|
25
|
+
"with-hidden-content": "awsui_with-hidden-content_14iqq_1x1rn_269",
|
|
26
|
+
"header-variant-full-page": "awsui_header-variant-full-page_14iqq_1x1rn_319",
|
|
27
|
+
"dark-header": "awsui_dark-header_14iqq_1x1rn_337",
|
|
28
|
+
"content": "awsui_content_14iqq_1x1rn_189",
|
|
29
|
+
"content-fit-height": "awsui_content-fit-height_14iqq_1x1rn_345",
|
|
30
|
+
"content-with-media": "awsui_content-with-media_14iqq_1x1rn_354",
|
|
31
|
+
"footer": "awsui_footer_14iqq_1x1rn_358",
|
|
32
|
+
"with-divider": "awsui_with-divider_14iqq_1x1rn_361"
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FunnelStepContextValue } from '../context/analytics-context';
|
|
3
3
|
import { FunnelProps, FunnelStepProps } from '../interfaces';
|
|
4
|
-
export declare const FUNNEL_VERSION = "1.
|
|
4
|
+
export declare const FUNNEL_VERSION = "1.1";
|
|
5
5
|
type AnalyticsFunnelProps = {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
} & Pick<FunnelProps, 'funnelType' | 'optionalStepNumbers' | 'totalFunnelSteps'>;
|
|
@@ -10,7 +10,7 @@ import { PACKAGE_VERSION } from '../../environment';
|
|
|
10
10
|
import { FunnelMetrics } from '../index';
|
|
11
11
|
import { DATA_ATTR_FUNNEL_STEP, getFunnelNameSelector, getNameFromSelector, getSubStepAllSelector, getSubStepNameSelector, getSubStepSelector, } from '../selectors';
|
|
12
12
|
import { useDebounceCallback } from '../../hooks/use-debounce-callback';
|
|
13
|
-
export const FUNNEL_VERSION = '1.
|
|
13
|
+
export const FUNNEL_VERSION = '1.1';
|
|
14
14
|
export const AnalyticsFunnel = (props) => {
|
|
15
15
|
const { isInFunnel } = useFunnel();
|
|
16
16
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-funnel.js","sourceRoot":"lib/default/","sources":["internal/analytics/components/analytics-funnel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,GAKd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,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Ae;QACf,oBAAoB;KACrB,CAAC,CAAC;IAEH,OAAO,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAAiC,CAAC;AACnG,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n FunnelStepContext,\n FunnelSubStepContext,\n FunnelContext,\n FunnelContextValue,\n FunnelStepContextValue,\n FunnelState,\n FunnelSubStepContextValue,\n} from '../context/analytics-context';\nimport { useFunnel, useFunnelStep } from '../hooks/use-funnel';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\n\nimport { PACKAGE_VERSION } from '../../environment';\n\nimport { FunnelMetrics } from '../index';\nimport { FunnelProps, FunnelStepProps, SubStepConfiguration } from '../interfaces';\n\nimport {\n DATA_ATTR_FUNNEL_STEP,\n getFunnelNameSelector,\n getNameFromSelector,\n getSubStepAllSelector,\n getSubStepNameSelector,\n getSubStepSelector,\n} from '../selectors';\nimport { useDebounceCallback } from '../../hooks/use-debounce-callback';\n\nexport const FUNNEL_VERSION = '1.0';\n\ntype AnalyticsFunnelProps = { children?: React.ReactNode } & Pick<\n FunnelProps,\n 'funnelType' | 'optionalStepNumbers' | 'totalFunnelSteps'\n>;\n\nexport const AnalyticsFunnel = (props: AnalyticsFunnelProps) => {\n const { isInFunnel } = useFunnel();\n /*\n If the current funnel component is a Form (i.e. single-page funnel), it should\n defer its funnel-handling to a parent Form element, if present.\n Wizards (i.e. multi-page funnels) always take highest precedence for handling funnels,\n and do not defer to any other element.\n */\n if (isInFunnel && props.funnelType === 'single-page') {\n return <>{props.children}</>;\n }\n\n return <InnerAnalyticsFunnel {...props} />;\n};\n\nconst InnerAnalyticsFunnel = ({ children, ...props }: AnalyticsFunnelProps) => {\n const [funnelInteractionId, setFunnelInteractionId] = useState<string>('');\n const [submissionAttempt, setSubmissionAttempt] = useState(0);\n const isVisualRefresh = useVisualRefresh();\n const funnelState = useRef<FunnelState>('default');\n const errorCount = useRef<number>(0);\n const loadingButtonCount = useRef<number>(0);\n const wizardCount = useRef<number>(0);\n const latestFocusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n\n // This useEffect hook is run once on component mount to initiate the funnel analytics.\n // It first calls the 'funnelStart' method from FunnelMetrics, providing all necessary details\n // about the funnel, and receives a unique interaction id.\n // This unique interaction id is then stored in the state for further use.\n //\n // On component unmount, it checks whether the funnel was successfully completed.\n // Based on this, it either calls 'funnelComplete' or 'funnelCancelled' method from FunnelMetrics.\n //\n // The eslint-disable is required as we deliberately want this effect to run only once on mount and unmount,\n // hence we do not provide any dependencies.\n useEffect(() => {\n /*\n We run this effect with a delay, in order to detect whether this funnel contains a Wizard.\n If it does contain a Wizard, that Wizard should take precedence for handling the funnel, and\n this current funnel component should do nothing.\n */\n const handle = setTimeout(() => {\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n\n // Reset the state, in case the component was re-mounted.\n funnelState.current = 'default';\n\n const funnelInteractionId = FunnelMetrics.funnelStart({\n funnelNameSelector: getFunnelNameSelector(),\n optionalStepNumbers: props.optionalStepNumbers,\n funnelType: props.funnelType,\n totalFunnelSteps: props.totalFunnelSteps,\n componentVersion: PACKAGE_VERSION,\n theme: isVisualRefresh ? 'vr' : 'classic',\n funnelVersion: FUNNEL_VERSION,\n });\n\n setFunnelInteractionId(funnelInteractionId);\n }, 1);\n\n /*\n A funnel counts as \"successful\" if it is unmounted after being \"complete\".\n */\n /* eslint-disable react-hooks/exhaustive-deps */\n return () => {\n clearTimeout(handle);\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n\n if (funnelState.current === 'validating') {\n // Finish the validation phase early.\n FunnelMetrics.funnelComplete({ funnelInteractionId });\n funnelState.current = 'complete';\n }\n\n if (funnelState.current === 'complete') {\n FunnelMetrics.funnelSuccessful({ funnelInteractionId });\n } else {\n FunnelMetrics.funnelCancelled({ funnelInteractionId });\n funnelState.current = 'cancelled';\n }\n };\n }, []);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n const funnelSubmit = () => {\n funnelState.current = 'validating';\n\n /*\n When the user attempts to submit the form, we wait for 50 milliseconds before checking\n if any form validation errors are present. This value was chosen to give enough time\n for validation and rerendering to occur, but be low enough that the user will not\n be able to take further action in the meantime.\n */\n const VALIDATION_WAIT_DELAY = 50;\n /*\n Loading is expected to take longer than validation, so we can keep the pressure on the CPU low.\n */\n const LOADING_WAIT_DELAY = 100;\n\n const checkForCompleteness = () => {\n if (funnelState.current === 'complete') {\n return;\n }\n\n if (loadingButtonCount.current > 0) {\n setTimeout(checkForCompleteness, LOADING_WAIT_DELAY);\n return;\n }\n\n if (errorCount.current === 0) {\n /*\n If no validation errors are rendered, we treat the funnel as complete.\n */\n FunnelMetrics.funnelComplete({ funnelInteractionId });\n funnelState.current = 'complete';\n } else {\n funnelState.current = 'default';\n }\n };\n\n setTimeout(checkForCompleteness, VALIDATION_WAIT_DELAY);\n };\n\n const funnelNextOrSubmitAttempt = () => setSubmissionAttempt(i => i + 1);\n\n const funnelCancel = () => {};\n\n const funnelContextValue: FunnelContextValue = {\n funnelInteractionId,\n setFunnelInteractionId,\n funnelType: props.funnelType,\n optionalStepNumbers: props.optionalStepNumbers,\n totalFunnelSteps: props.totalFunnelSteps,\n funnelSubmit,\n funnelCancel,\n submissionAttempt,\n funnelNextOrSubmitAttempt,\n funnelState,\n errorCount,\n loadingButtonCount,\n latestFocusCleanupFunction,\n isInFunnel: true,\n wizardCount,\n };\n\n return <FunnelContext.Provider value={funnelContextValue}>{children}</FunnelContext.Provider>;\n};\n\ntype AnalyticsFunnelStepProps = {\n children?: React.ReactNode | ((props: FunnelStepContextValue) => React.ReactNode);\n} & Pick<FunnelStepProps, 'stepNumber' | 'stepNameSelector'>;\n\nexport const AnalyticsFunnelStep = (props: AnalyticsFunnelStepProps) => {\n /*\n This wrapper is used to apply a `key` property to the actual (inner) AnalyticsFunnelStep\n element. This allows us to keep the state and effects separate per step.\n */\n return <InnerAnalyticsFunnelStep {...props} key={props.stepNumber} />;\n};\n\nfunction useStepChangeListener(handler: (stepConfiguration: SubStepConfiguration[]) => void) {\n /*\n Chosen so that it's hopefully shorter than a user interaction, but gives enough time for the\n amount of containers to stabilise.\n */\n const SUBSTEP_CHANGE_DEBOUNCE = 50;\n\n const listenForSubStepChanges = useRef(false);\n useEffect(() => {\n // We prevent emitting the event on the first render.\n const handle = setTimeout(() => (listenForSubStepChanges.current = true), SUBSTEP_CHANGE_DEBOUNCE);\n\n return () => {\n clearTimeout(handle);\n listenForSubStepChanges.current = false;\n };\n }, []);\n\n /* We debounce this handler, so that multiple containers can change at once without causing \n too many events. */\n const stepChangeCallback = useDebounceCallback(() => {\n // We don't want to emit the event after the component has been unmounted.\n if (!listenForSubStepChanges.current) {\n return;\n }\n\n const subSteps = Array.from(document.querySelectorAll(getSubStepAllSelector())) as HTMLElement[];\n\n const subStepConfiguration = subSteps.map((substep, index) => {\n const name = substep.querySelector(getSubStepNameSelector())?.textContent ?? '';\n return {\n name,\n number: index + 1,\n };\n });\n\n handler(subStepConfiguration);\n }, SUBSTEP_CHANGE_DEBOUNCE);\n\n return stepChangeCallback;\n}\n\nconst InnerAnalyticsFunnelStep = ({ children, stepNumber, stepNameSelector }: AnalyticsFunnelStepProps) => {\n const { funnelInteractionId, funnelState, funnelType } = useFunnel();\n const parentStep = useFunnelStep();\n const parentStepExists = parentStep.isInStep;\n const parentStepFunnelInteractionId = parentStep.funnelInteractionId;\n\n const funnelStepProps = { [DATA_ATTR_FUNNEL_STEP]: stepNumber };\n\n const subStepCount = useRef<number>(0);\n\n const onStepChange = useStepChangeListener(subStepConfiguration => {\n if (!funnelInteractionId) {\n return;\n }\n const stepName = getNameFromSelector(stepNameSelector) ?? '';\n\n FunnelMetrics.funnelStepChange({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n subStepConfiguration,\n });\n });\n\n // This useEffect hook is used to track the start and completion of interaction with the step.\n // On mount, if there is a valid funnel interaction id, it calls the 'funnelStepStart' method from FunnelMetrics\n // to record the beginning of the interaction with the current step.\n // On unmount, it does a similar thing but this time calling 'funnelStepComplete' to record the completion of the interaction.\n useEffect(() => {\n if (!funnelInteractionId) {\n // This step is not inside an active funnel.\n return;\n }\n if (parentStepExists && parentStepFunnelInteractionId) {\n /*\n This step is inside another step, which already reports events as\n part of an active funnel (i.e. that step is not a parent of a Wizard).\n Thus, this current step does not need to report any events.\n */\n return;\n }\n\n const stepName = getNameFromSelector(stepNameSelector);\n\n if (funnelState.current === 'default') {\n FunnelMetrics.funnelStepStart({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n if (funnelState.current !== 'cancelled') {\n FunnelMetrics.funnelStepComplete({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n totalSubSteps: subStepCount.current,\n });\n }\n };\n }, [\n funnelInteractionId,\n stepNumber,\n stepNameSelector,\n funnelState,\n parentStepExists,\n funnelType,\n parentStepFunnelInteractionId,\n ]);\n\n const contextValue: FunnelStepContextValue = {\n stepNumber,\n stepNameSelector,\n funnelStepProps,\n subStepCount,\n isInStep: true,\n funnelInteractionId,\n onStepChange,\n };\n\n /*\n If this step is inside another step which already reports events as part of an active\n funnel (i.e. that step is not a parent of a Wizard), the current step becomes invisible\n in the hierarchy by passing the context of its parent through.\n */\n const effectiveContextValue = parentStepExists && parentStepFunnelInteractionId ? parentStep : contextValue;\n\n return (\n <FunnelStepContext.Provider value={effectiveContextValue}>\n {typeof children === 'function' ? children(effectiveContextValue) : children}\n </FunnelStepContext.Provider>\n );\n};\ninterface AnalyticsFunnelSubStepProps {\n children?: React.ReactNode;\n}\n\nexport const AnalyticsFunnelSubStep = ({ children }: AnalyticsFunnelSubStepProps) => {\n const subStepId = useUniqueId('substep');\n const subStepSelector = getSubStepSelector(subStepId);\n const subStepNameSelector = getSubStepNameSelector(subStepId);\n const subStepRef = useRef<HTMLDivElement | null>(null);\n const { subStepCount, onStepChange } = useFunnelStep();\n const mousePressed = useRef<boolean>(false);\n const isFocusedSubStep = useRef<boolean>(false);\n const focusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n const { funnelState, funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n\n const newContext: FunnelSubStepContextValue = {\n subStepSelector,\n subStepNameSelector,\n subStepId,\n subStepRef,\n mousePressed,\n isFocusedSubStep,\n focusCleanupFunction,\n isNestedSubStep: false,\n };\n\n const inheritedContext = { ...useContext(FunnelSubStepContext), isNestedSubStep: true };\n\n const isNested = Boolean(inheritedContext.subStepId);\n\n useEffect(() => {\n if (!isNested) {\n subStepCount.current++;\n onStepChange();\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n subStepCount.current--;\n onStepChange();\n };\n }\n }, [isNested, subStepCount, onStepChange]);\n\n const context = isNested ? inheritedContext : newContext;\n\n useEffect(() => {\n const onMouseDown = () => (mousePressed.current = true);\n\n const onMouseUp = async () => {\n mousePressed.current = false;\n\n if (!isFocusedSubStep.current) {\n return;\n }\n\n /*\n Some mouse events result in an element being focused. However,\n this happens only _after_ the onMouseUp event. We yield the\n event loop here, so that `document.activeElement` has the\n correct new value. \n */\n await new Promise(r => setTimeout(r, 1));\n\n if (!subStepRef.current || !subStepRef.current.contains(document.activeElement)) {\n isFocusedSubStep.current = false;\n\n /*\n Run this substep's own focus cleanup function if another substep\n hasn't already done it for us.\n */\n focusCleanupFunction.current?.();\n }\n };\n window.addEventListener('mousedown', onMouseDown);\n window.addEventListener('mouseup', onMouseUp);\n return () => {\n window.removeEventListener('mousedown', onMouseDown);\n window.removeEventListener('mouseup', onMouseUp);\n };\n }, [\n funnelInteractionId,\n funnelState,\n stepNameSelector,\n stepNumber,\n subStepNameSelector,\n subStepSelector,\n focusCleanupFunction,\n ]);\n\n return <FunnelSubStepContext.Provider value={context}>{children}</FunnelSubStepContext.Provider>;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"analytics-funnel.js","sourceRoot":"lib/default/","sources":["internal/analytics/components/analytics-funnel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,GAKd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAOpC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC;IACnC;;;;;MAKE;IACF,IAAI,UAAU,IAAI,KAAK,CAAC,UAAU,KAAK,aAAa,EAAE;QACpD,OAAO,0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CAAC,CAAC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QAExD,MAAM,SAAS,GAAG,GAAS,EAAE;;YAC3B,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;YAE7B,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;gBAC7B,OAAO;aACR;YAED;;;;;cAKE;YACF,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAEzC,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBAC/E,gBAAgB,CAAC,OAAO,GAAG,KAAK,CAAC;gBAEjC;;;mBAGG;gBACH,MAAA,oBAAoB,CAAC,OAAO,oEAAI,CAAC;aAClC;QACH,CAAC,CAAA,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAClD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACrD,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,mBAAmB;QACnB,WAAW;QACX,gBAAgB;QAChB,UAAU;QACV,mBAAmB;QACnB,eAAe;QACf,oBAAoB;KACrB,CAAC,CAAC;IAEH,OAAO,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAAiC,CAAC;AACnG,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n FunnelStepContext,\n FunnelSubStepContext,\n FunnelContext,\n FunnelContextValue,\n FunnelStepContextValue,\n FunnelState,\n FunnelSubStepContextValue,\n} from '../context/analytics-context';\nimport { useFunnel, useFunnelStep } from '../hooks/use-funnel';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\n\nimport { PACKAGE_VERSION } from '../../environment';\n\nimport { FunnelMetrics } from '../index';\nimport { FunnelProps, FunnelStepProps, SubStepConfiguration } from '../interfaces';\n\nimport {\n DATA_ATTR_FUNNEL_STEP,\n getFunnelNameSelector,\n getNameFromSelector,\n getSubStepAllSelector,\n getSubStepNameSelector,\n getSubStepSelector,\n} from '../selectors';\nimport { useDebounceCallback } from '../../hooks/use-debounce-callback';\n\nexport const FUNNEL_VERSION = '1.1';\n\ntype AnalyticsFunnelProps = { children?: React.ReactNode } & Pick<\n FunnelProps,\n 'funnelType' | 'optionalStepNumbers' | 'totalFunnelSteps'\n>;\n\nexport const AnalyticsFunnel = (props: AnalyticsFunnelProps) => {\n const { isInFunnel } = useFunnel();\n /*\n If the current funnel component is a Form (i.e. single-page funnel), it should\n defer its funnel-handling to a parent Form element, if present.\n Wizards (i.e. multi-page funnels) always take highest precedence for handling funnels,\n and do not defer to any other element.\n */\n if (isInFunnel && props.funnelType === 'single-page') {\n return <>{props.children}</>;\n }\n\n return <InnerAnalyticsFunnel {...props} />;\n};\n\nconst InnerAnalyticsFunnel = ({ children, ...props }: AnalyticsFunnelProps) => {\n const [funnelInteractionId, setFunnelInteractionId] = useState<string>('');\n const [submissionAttempt, setSubmissionAttempt] = useState(0);\n const isVisualRefresh = useVisualRefresh();\n const funnelState = useRef<FunnelState>('default');\n const errorCount = useRef<number>(0);\n const loadingButtonCount = useRef<number>(0);\n const wizardCount = useRef<number>(0);\n const latestFocusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n\n // This useEffect hook is run once on component mount to initiate the funnel analytics.\n // It first calls the 'funnelStart' method from FunnelMetrics, providing all necessary details\n // about the funnel, and receives a unique interaction id.\n // This unique interaction id is then stored in the state for further use.\n //\n // On component unmount, it checks whether the funnel was successfully completed.\n // Based on this, it either calls 'funnelComplete' or 'funnelCancelled' method from FunnelMetrics.\n //\n // The eslint-disable is required as we deliberately want this effect to run only once on mount and unmount,\n // hence we do not provide any dependencies.\n useEffect(() => {\n /*\n We run this effect with a delay, in order to detect whether this funnel contains a Wizard.\n If it does contain a Wizard, that Wizard should take precedence for handling the funnel, and\n this current funnel component should do nothing.\n */\n const handle = setTimeout(() => {\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n\n // Reset the state, in case the component was re-mounted.\n funnelState.current = 'default';\n\n const funnelInteractionId = FunnelMetrics.funnelStart({\n funnelNameSelector: getFunnelNameSelector(),\n optionalStepNumbers: props.optionalStepNumbers,\n funnelType: props.funnelType,\n totalFunnelSteps: props.totalFunnelSteps,\n componentVersion: PACKAGE_VERSION,\n theme: isVisualRefresh ? 'vr' : 'classic',\n funnelVersion: FUNNEL_VERSION,\n });\n\n setFunnelInteractionId(funnelInteractionId);\n }, 1);\n\n /*\n A funnel counts as \"successful\" if it is unmounted after being \"complete\".\n */\n /* eslint-disable react-hooks/exhaustive-deps */\n return () => {\n clearTimeout(handle);\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n\n if (funnelState.current === 'validating') {\n // Finish the validation phase early.\n FunnelMetrics.funnelComplete({ funnelInteractionId });\n funnelState.current = 'complete';\n }\n\n if (funnelState.current === 'complete') {\n FunnelMetrics.funnelSuccessful({ funnelInteractionId });\n } else {\n FunnelMetrics.funnelCancelled({ funnelInteractionId });\n funnelState.current = 'cancelled';\n }\n };\n }, []);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n const funnelSubmit = () => {\n funnelState.current = 'validating';\n\n /*\n When the user attempts to submit the form, we wait for 50 milliseconds before checking\n if any form validation errors are present. This value was chosen to give enough time\n for validation and rerendering to occur, but be low enough that the user will not\n be able to take further action in the meantime.\n */\n const VALIDATION_WAIT_DELAY = 50;\n /*\n Loading is expected to take longer than validation, so we can keep the pressure on the CPU low.\n */\n const LOADING_WAIT_DELAY = 100;\n\n const checkForCompleteness = () => {\n if (funnelState.current === 'complete') {\n return;\n }\n\n if (loadingButtonCount.current > 0) {\n setTimeout(checkForCompleteness, LOADING_WAIT_DELAY);\n return;\n }\n\n if (errorCount.current === 0) {\n /*\n If no validation errors are rendered, we treat the funnel as complete.\n */\n FunnelMetrics.funnelComplete({ funnelInteractionId });\n funnelState.current = 'complete';\n } else {\n funnelState.current = 'default';\n }\n };\n\n setTimeout(checkForCompleteness, VALIDATION_WAIT_DELAY);\n };\n\n const funnelNextOrSubmitAttempt = () => setSubmissionAttempt(i => i + 1);\n\n const funnelCancel = () => {};\n\n const funnelContextValue: FunnelContextValue = {\n funnelInteractionId,\n setFunnelInteractionId,\n funnelType: props.funnelType,\n optionalStepNumbers: props.optionalStepNumbers,\n totalFunnelSteps: props.totalFunnelSteps,\n funnelSubmit,\n funnelCancel,\n submissionAttempt,\n funnelNextOrSubmitAttempt,\n funnelState,\n errorCount,\n loadingButtonCount,\n latestFocusCleanupFunction,\n isInFunnel: true,\n wizardCount,\n };\n\n return <FunnelContext.Provider value={funnelContextValue}>{children}</FunnelContext.Provider>;\n};\n\ntype AnalyticsFunnelStepProps = {\n children?: React.ReactNode | ((props: FunnelStepContextValue) => React.ReactNode);\n} & Pick<FunnelStepProps, 'stepNumber' | 'stepNameSelector'>;\n\nexport const AnalyticsFunnelStep = (props: AnalyticsFunnelStepProps) => {\n /*\n This wrapper is used to apply a `key` property to the actual (inner) AnalyticsFunnelStep\n element. This allows us to keep the state and effects separate per step.\n */\n return <InnerAnalyticsFunnelStep {...props} key={props.stepNumber} />;\n};\n\nfunction useStepChangeListener(handler: (stepConfiguration: SubStepConfiguration[]) => void) {\n /*\n Chosen so that it's hopefully shorter than a user interaction, but gives enough time for the\n amount of containers to stabilise.\n */\n const SUBSTEP_CHANGE_DEBOUNCE = 50;\n\n const listenForSubStepChanges = useRef(false);\n useEffect(() => {\n // We prevent emitting the event on the first render.\n const handle = setTimeout(() => (listenForSubStepChanges.current = true), SUBSTEP_CHANGE_DEBOUNCE);\n\n return () => {\n clearTimeout(handle);\n listenForSubStepChanges.current = false;\n };\n }, []);\n\n /* We debounce this handler, so that multiple containers can change at once without causing \n too many events. */\n const stepChangeCallback = useDebounceCallback(() => {\n // We don't want to emit the event after the component has been unmounted.\n if (!listenForSubStepChanges.current) {\n return;\n }\n\n const subSteps = Array.from(document.querySelectorAll<HTMLElement>(getSubStepAllSelector()));\n\n const subStepConfiguration = subSteps.map((substep, index) => {\n const name = substep.querySelector(getSubStepNameSelector())?.textContent ?? '';\n return {\n name,\n number: index + 1,\n };\n });\n\n handler(subStepConfiguration);\n }, SUBSTEP_CHANGE_DEBOUNCE);\n\n return stepChangeCallback;\n}\n\nconst InnerAnalyticsFunnelStep = ({ children, stepNumber, stepNameSelector }: AnalyticsFunnelStepProps) => {\n const { funnelInteractionId, funnelState, funnelType } = useFunnel();\n const parentStep = useFunnelStep();\n const parentStepExists = parentStep.isInStep;\n const parentStepFunnelInteractionId = parentStep.funnelInteractionId;\n\n const funnelStepProps = { [DATA_ATTR_FUNNEL_STEP]: stepNumber };\n\n const subStepCount = useRef<number>(0);\n\n const onStepChange = useStepChangeListener(subStepConfiguration => {\n if (!funnelInteractionId) {\n return;\n }\n const stepName = getNameFromSelector(stepNameSelector) ?? '';\n\n FunnelMetrics.funnelStepChange({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n subStepConfiguration,\n });\n });\n\n // This useEffect hook is used to track the start and completion of interaction with the step.\n // On mount, if there is a valid funnel interaction id, it calls the 'funnelStepStart' method from FunnelMetrics\n // to record the beginning of the interaction with the current step.\n // On unmount, it does a similar thing but this time calling 'funnelStepComplete' to record the completion of the interaction.\n useEffect(() => {\n if (!funnelInteractionId) {\n // This step is not inside an active funnel.\n return;\n }\n if (parentStepExists && parentStepFunnelInteractionId) {\n /*\n This step is inside another step, which already reports events as\n part of an active funnel (i.e. that step is not a parent of a Wizard).\n Thus, this current step does not need to report any events.\n */\n return;\n }\n\n const stepName = getNameFromSelector(stepNameSelector);\n\n if (funnelState.current === 'default') {\n FunnelMetrics.funnelStepStart({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n if (funnelState.current !== 'cancelled') {\n FunnelMetrics.funnelStepComplete({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n totalSubSteps: subStepCount.current,\n });\n }\n };\n }, [\n funnelInteractionId,\n stepNumber,\n stepNameSelector,\n funnelState,\n parentStepExists,\n funnelType,\n parentStepFunnelInteractionId,\n ]);\n\n const contextValue: FunnelStepContextValue = {\n stepNumber,\n stepNameSelector,\n funnelStepProps,\n subStepCount,\n isInStep: true,\n funnelInteractionId,\n onStepChange,\n };\n\n /*\n If this step is inside another step which already reports events as part of an active\n funnel (i.e. that step is not a parent of a Wizard), the current step becomes invisible\n in the hierarchy by passing the context of its parent through.\n */\n const effectiveContextValue = parentStepExists && parentStepFunnelInteractionId ? parentStep : contextValue;\n\n return (\n <FunnelStepContext.Provider value={effectiveContextValue}>\n {typeof children === 'function' ? children(effectiveContextValue) : children}\n </FunnelStepContext.Provider>\n );\n};\ninterface AnalyticsFunnelSubStepProps {\n children?: React.ReactNode;\n}\n\nexport const AnalyticsFunnelSubStep = ({ children }: AnalyticsFunnelSubStepProps) => {\n const subStepId = useUniqueId('substep');\n const subStepSelector = getSubStepSelector(subStepId);\n const subStepNameSelector = getSubStepNameSelector(subStepId);\n const subStepRef = useRef<HTMLDivElement | null>(null);\n const { subStepCount, onStepChange } = useFunnelStep();\n const mousePressed = useRef<boolean>(false);\n const isFocusedSubStep = useRef<boolean>(false);\n const focusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n const { funnelState, funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n\n const newContext: FunnelSubStepContextValue = {\n subStepSelector,\n subStepNameSelector,\n subStepId,\n subStepRef,\n mousePressed,\n isFocusedSubStep,\n focusCleanupFunction,\n isNestedSubStep: false,\n };\n\n const inheritedContext = { ...useContext(FunnelSubStepContext), isNestedSubStep: true };\n\n const isNested = Boolean(inheritedContext.subStepId);\n\n useEffect(() => {\n if (!isNested) {\n subStepCount.current++;\n onStepChange();\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n subStepCount.current--;\n onStepChange();\n };\n }\n }, [isNested, subStepCount, onStepChange]);\n\n const context = isNested ? inheritedContext : newContext;\n\n useEffect(() => {\n const onMouseDown = () => (mousePressed.current = true);\n\n const onMouseUp = async () => {\n mousePressed.current = false;\n\n if (!isFocusedSubStep.current) {\n return;\n }\n\n /*\n Some mouse events result in an element being focused. However,\n this happens only _after_ the onMouseUp event. We yield the\n event loop here, so that `document.activeElement` has the\n correct new value. \n */\n await new Promise(r => setTimeout(r, 1));\n\n if (!subStepRef.current || !subStepRef.current.contains(document.activeElement)) {\n isFocusedSubStep.current = false;\n\n /*\n Run this substep's own focus cleanup function if another substep\n hasn't already done it for us.\n */\n focusCleanupFunction.current?.();\n }\n };\n window.addEventListener('mousedown', onMouseDown);\n window.addEventListener('mouseup', onMouseUp);\n return () => {\n window.removeEventListener('mousedown', onMouseDown);\n window.removeEventListener('mouseup', onMouseUp);\n };\n }, [\n funnelInteractionId,\n funnelState,\n stepNameSelector,\n stepNumber,\n subStepNameSelector,\n subStepSelector,\n focusCleanupFunction,\n ]);\n\n return <FunnelSubStepContext.Provider value={context}>{children}</FunnelSubStepContext.Provider>;\n};\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
package/wizard/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,KAAK,mBAAmB,GAAG,WAAW,GAAG,0BAA0B,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,gBAAgB,EAChB,iBAAyB,EACzB,WAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,KAAK,mBAAmB,GAAG,WAAW,GAAG,0BAA0B,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,gBAAgB,EAChB,iBAAyB,EACzB,WAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,eAgJrB"}
|
package/wizard/internal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { getBaseProps } from '../internal/base-component';
|
|
7
7
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
@@ -69,6 +69,7 @@ export default function InternalWizard(_a) {
|
|
|
69
69
|
navigationEvent(actualActiveStepIndex + 1, 'next');
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
+
useFunnelChangeEvent(funnelInteractionId, steps);
|
|
72
73
|
const i18n = useInternalI18n('wizard');
|
|
73
74
|
const skipToButtonLabel = i18n('i18nStrings.skipToButtonLabel', (_b = rest.i18nStrings) === null || _b === void 0 ? void 0 : _b.skipToButtonLabel, format => task => format({ task__title: task.title }));
|
|
74
75
|
const i18nStrings = Object.assign(Object.assign({}, rest.i18nStrings), { skipToButtonLabel, stepNumberLabel: i18n('i18nStrings.stepNumberLabel', (_c = rest.i18nStrings) === null || _c === void 0 ? void 0 : _c.stepNumberLabel, format => stepNumber => format({ stepNumber })), collapsedStepsLabel: i18n('i18nStrings.collapsedStepsLabel', (_d = rest.i18nStrings) === null || _d === void 0 ? void 0 : _d.collapsedStepsLabel, format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })), navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', (_e = rest.i18nStrings) === null || _e === void 0 ? void 0 : _e.navigationAriaLabel), cancelButton: i18n('i18nStrings.cancelButton', (_f = rest.i18nStrings) === null || _f === void 0 ? void 0 : _f.cancelButton), previousButton: i18n('i18nStrings.previousButton', (_g = rest.i18nStrings) === null || _g === void 0 ? void 0 : _g.previousButton), nextButton: i18n('i18nStrings.nextButton', (_h = rest.i18nStrings) === null || _h === void 0 ? void 0 : _h.nextButton), optional: i18n('i18nStrings.optional', (_j = rest.i18nStrings) === null || _j === void 0 ? void 0 : _j.optional) });
|
|
@@ -85,4 +86,40 @@ export default function InternalWizard(_a) {
|
|
|
85
86
|
isVisualRefresh && React.createElement("div", { className: clsx(styles.background, 'awsui-context-content-header') }),
|
|
86
87
|
React.createElement(WizardForm, { steps: steps, isVisualRefresh: isVisualRefresh, showCollapsedSteps: smallContainer, i18nStrings: i18nStrings, submitButtonText: submitButtonText, activeStepIndex: actualActiveStepIndex, isPrimaryLoading: isLoadingNextStep, allowSkipTo: allowSkipTo, secondaryActions: secondaryActions, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onSkipToClick: onSkipToClick, onPrimaryClick: onPrimaryClick })))));
|
|
87
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* This hook observes the step configuration and emits the `funnelChange` event when the steps change.
|
|
91
|
+
*/
|
|
92
|
+
function useFunnelChangeEvent(funnelInteractionId, steps) {
|
|
93
|
+
const listenForStepChanges = useRef(false);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
// We prevent emitting the event before the funnel has stabilised.
|
|
96
|
+
const handle = setTimeout(() => (listenForStepChanges.current = true), 0);
|
|
97
|
+
return () => {
|
|
98
|
+
clearTimeout(handle);
|
|
99
|
+
listenForStepChanges.current = false;
|
|
100
|
+
};
|
|
101
|
+
}, [funnelInteractionId]);
|
|
102
|
+
const stepTitles = steps.map(step => step.title).join();
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!funnelInteractionId || !listenForStepChanges.current) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const stepConfiguration = steps.map((step, index) => {
|
|
108
|
+
var _a;
|
|
109
|
+
return ({
|
|
110
|
+
name: step.title,
|
|
111
|
+
number: index + 1,
|
|
112
|
+
isOptional: (_a = step.isOptional) !== null && _a !== void 0 ? _a : false,
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
FunnelMetrics.funnelChange({
|
|
116
|
+
funnelInteractionId,
|
|
117
|
+
stepConfiguration,
|
|
118
|
+
});
|
|
119
|
+
// This dependency array does not include `steps`, because `steps` is not stable across renders.
|
|
120
|
+
// We use `stepTitles` as a stable proxy.
|
|
121
|
+
//
|
|
122
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
123
|
+
}, [funnelInteractionId, stepTitles]);
|
|
124
|
+
}
|
|
88
125
|
//# sourceMappingURL=internal.js.map
|
package/wizard/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7F,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAInD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAYjB;;QAZiB,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,gBAAgB,EAChB,iBAAiB,GAAG,KAAK,EACzB,WAAW,GAAG,KAAK,EACnB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,iBAAiB,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AC5B,cAAc,EAAE,cAAc,GAC9B,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nimport { useInternalI18n } from '../i18n/context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel';\nimport { getNameFromSelector, getSubStepAllSelector } from '../internal/analytics/selectors';\n\nimport WizardForm from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\n\nimport { WizardProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalWizardProps = WizardProps & InternalBaseComponentProps;\n\nexport default function InternalWizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n submitButtonText,\n isLoadingNextStep = false,\n allowSkipTo = false,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n __internalRootRef,\n ...rest\n}: InternalWizardProps) {\n const baseProps = getBaseProps(rest);\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const { funnelInteractionId, funnelSubmit, funnelCancel, funnelProps, funnelNextOrSubmitAttempt } = useFunnel();\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n if (funnelInteractionId) {\n const stepNameSelector = `.${styles['form-header-component-wrapper']}`;\n const stepName = getNameFromSelector(stepNameSelector);\n\n FunnelMetrics.funnelStepNavigation({\n navigationType: reason,\n funnelInteractionId,\n stepNumber: actualActiveStepIndex + 1,\n stepName,\n stepNameSelector,\n destinationStepNumber: requestedStepIndex + 1,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n funnelCancel();\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n funnelNextOrSubmitAttempt();\n\n if (isLastStep) {\n funnelSubmit();\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n const i18n = useInternalI18n('wizard');\n const skipToButtonLabel = i18n(\n 'i18nStrings.skipToButtonLabel',\n rest.i18nStrings?.skipToButtonLabel,\n format => task => format({ task__title: task.title })\n );\n\n const i18nStrings: WizardProps.I18nStrings = {\n ...rest.i18nStrings,\n skipToButtonLabel,\n stepNumberLabel: i18n(\n 'i18nStrings.stepNumberLabel',\n rest.i18nStrings?.stepNumberLabel,\n format => stepNumber => format({ stepNumber })\n ),\n collapsedStepsLabel: i18n(\n 'i18nStrings.collapsedStepsLabel',\n rest.i18nStrings?.collapsedStepsLabel,\n format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })\n ),\n navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', rest.i18nStrings?.navigationAriaLabel),\n cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings?.cancelButton),\n previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings?.previousButton),\n nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings?.nextButton),\n optional: i18n('i18nStrings.optional', rest.i18nStrings?.optional),\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n return (\n <div {...baseProps} {...funnelProps} ref={ref} className={clsx(styles.root, baseProps.className)}>\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n {isVisualRefresh && <div className={clsx(styles.background, 'awsui-context-content-header')} />}\n <WizardForm\n steps={steps}\n isVisualRefresh={isVisualRefresh}\n showCollapsedSteps={smallContainer}\n i18nStrings={i18nStrings}\n submitButtonText={submitButtonText}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["wizard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7F,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAInD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAYjB;;QAZiB,EACrC,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,gBAAgB,EAChB,iBAAiB,GAAG,KAAK,EACzB,WAAW,GAAG,KAAK,EAC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AgG;QAChG,yCAAyC;QACzC,EAAE;QACF,uDAAuD;IACzD,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nimport { useInternalI18n } from '../i18n/context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel';\nimport { getNameFromSelector, getSubStepAllSelector } from '../internal/analytics/selectors';\n\nimport WizardForm from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\n\nimport { WizardProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalWizardProps = WizardProps & InternalBaseComponentProps;\n\nexport default function InternalWizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n submitButtonText,\n isLoadingNextStep = false,\n allowSkipTo = false,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n __internalRootRef,\n ...rest\n}: InternalWizardProps) {\n const baseProps = getBaseProps(rest);\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const { funnelInteractionId, funnelSubmit, funnelCancel, funnelProps, funnelNextOrSubmitAttempt } = useFunnel();\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n if (funnelInteractionId) {\n const stepNameSelector = `.${styles['form-header-component-wrapper']}`;\n const stepName = getNameFromSelector(stepNameSelector);\n\n FunnelMetrics.funnelStepNavigation({\n navigationType: reason,\n funnelInteractionId,\n stepNumber: actualActiveStepIndex + 1,\n stepName,\n stepNameSelector,\n destinationStepNumber: requestedStepIndex + 1,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n funnelCancel();\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n funnelNextOrSubmitAttempt();\n\n if (isLastStep) {\n funnelSubmit();\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n useFunnelChangeEvent(funnelInteractionId, steps);\n\n const i18n = useInternalI18n('wizard');\n const skipToButtonLabel = i18n(\n 'i18nStrings.skipToButtonLabel',\n rest.i18nStrings?.skipToButtonLabel,\n format => task => format({ task__title: task.title })\n );\n\n const i18nStrings: WizardProps.I18nStrings = {\n ...rest.i18nStrings,\n skipToButtonLabel,\n stepNumberLabel: i18n(\n 'i18nStrings.stepNumberLabel',\n rest.i18nStrings?.stepNumberLabel,\n format => stepNumber => format({ stepNumber })\n ),\n collapsedStepsLabel: i18n(\n 'i18nStrings.collapsedStepsLabel',\n rest.i18nStrings?.collapsedStepsLabel,\n format => (stepNumber, stepsCount) => format({ stepNumber, stepsCount })\n ),\n navigationAriaLabel: i18n('i18nStrings.navigationAriaLabel', rest.i18nStrings?.navigationAriaLabel),\n cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings?.cancelButton),\n previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings?.previousButton),\n nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings?.nextButton),\n optional: i18n('i18nStrings.optional', rest.i18nStrings?.optional),\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n return (\n <div {...baseProps} {...funnelProps} ref={ref} className={clsx(styles.root, baseProps.className)}>\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n {isVisualRefresh && <div className={clsx(styles.background, 'awsui-context-content-header')} />}\n <WizardForm\n steps={steps}\n isVisualRefresh={isVisualRefresh}\n showCollapsedSteps={smallContainer}\n i18nStrings={i18nStrings}\n submitButtonText={submitButtonText}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * This hook observes the step configuration and emits the `funnelChange` event when the steps change.\n */\nfunction useFunnelChangeEvent(funnelInteractionId: string | undefined, steps: WizardProps['steps']) {\n const listenForStepChanges = useRef(false);\n\n useEffect(() => {\n // We prevent emitting the event before the funnel has stabilised.\n const handle = setTimeout(() => (listenForStepChanges.current = true), 0);\n\n return () => {\n clearTimeout(handle);\n listenForStepChanges.current = false;\n };\n }, [funnelInteractionId]);\n\n const stepTitles = steps.map(step => step.title).join();\n useEffect(() => {\n if (!funnelInteractionId || !listenForStepChanges.current) {\n return;\n }\n\n const stepConfiguration = steps.map((step, index) => ({\n name: step.title,\n number: index + 1,\n isOptional: step.isOptional ?? false,\n }));\n\n FunnelMetrics.funnelChange({\n funnelInteractionId,\n stepConfiguration,\n });\n\n // This dependency array does not include `steps`, because `steps` is not stable across renders.\n // We use `stepTitles` as a stable proxy.\n //\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, stepTitles]);\n}\n"]}
|