@cloudscape-design/components-themeable 3.0.976 → 3.0.977
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/components/selectable-item/styles.scss +21 -8
- package/lib/internal/template/alert/index.js +3 -3
- package/lib/internal/template/alert/index.js.map +1 -1
- package/lib/internal/template/alert/interfaces.d.ts +10 -0
- package/lib/internal/template/alert/interfaces.d.ts.map +1 -1
- package/lib/internal/template/alert/interfaces.js.map +1 -1
- package/lib/internal/template/flashbar/flash.js +3 -5
- package/lib/internal/template/flashbar/flash.js.map +1 -1
- package/lib/internal/template/flashbar/interfaces.d.ts +2 -0
- package/lib/internal/template/flashbar/interfaces.d.ts.map +1 -1
- package/lib/internal/template/flashbar/interfaces.js.map +1 -1
- package/lib/internal/template/form/index.js +1 -1
- package/lib/internal/template/form/index.js.map +1 -1
- package/lib/internal/template/form/interfaces.d.ts +3 -1
- package/lib/internal/template/form/interfaces.d.ts.map +1 -1
- package/lib/internal/template/form/interfaces.js.map +1 -1
- package/lib/internal/template/form-field/index.d.ts.map +1 -1
- package/lib/internal/template/form-field/index.js +1 -0
- package/lib/internal/template/form-field/index.js.map +1 -1
- package/lib/internal/template/form-field/interfaces.d.ts +3 -1
- package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
- package/lib/internal/template/form-field/interfaces.js.map +1 -1
- package/lib/internal/template/form-field/internal.d.ts.map +1 -1
- package/lib/internal/template/form-field/internal.js +2 -3
- package/lib/internal/template/form-field/internal.js.map +1 -1
- package/lib/internal/template/internal/analytics/hooks/use-funnel.d.ts +1 -1
- package/lib/internal/template/internal/analytics/interfaces.d.ts +12 -5
- package/lib/internal/template/internal/analytics/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/analytics/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.d.ts +66 -0
- package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.js +4 -0
- package/lib/internal/template/internal/components/drag-handle/hooks/interfaces.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.d.ts +35 -0
- package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.js +259 -0
- package/lib/internal/template/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.js +2 -2
- package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +1 -0
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +4 -4
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +1 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +3 -3
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -1
- package/lib/internal/template/internal/components/selectable-item/styles.css.js +21 -21
- package/lib/internal/template/internal/components/selectable-item/styles.scoped.css +56 -43
- package/lib/internal/template/internal/components/selectable-item/styles.selectors.js +21 -21
- package/lib/internal/template/internal/do-not-use/drag-handle.d.ts +5 -0
- package/lib/internal/template/internal/do-not-use/drag-handle.d.ts.map +1 -0
- package/lib/internal/template/internal/do-not-use/drag-handle.js +6 -0
- package/lib/internal/template/internal/do-not-use/drag-handle.js.map +1 -0
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/package.json +1 -0
- package/lib/internal/template/wizard/interfaces.d.ts +3 -1
- package/lib/internal/template/wizard/interfaces.d.ts.map +1 -1
- package/lib/internal/template/wizard/interfaces.js.map +1 -1
- package/lib/internal/template/wizard/wizard-form.d.ts.map +1 -1
- package/lib/internal/template/wizard/wizard-form.js +2 -2
- package/lib/internal/template/wizard/wizard-form.js.map +1 -1
- package/package.json +1 -1
|
@@ -68,6 +68,12 @@
|
|
|
68
68
|
border-color: awsui.$color-border-dropdown-item-dimmed-hover;
|
|
69
69
|
background-color: awsui.$color-background-dropdown-item-dimmed;
|
|
70
70
|
}
|
|
71
|
+
&.is-keyboard {
|
|
72
|
+
border-color: awsui.$color-border-dropdown-item-focused;
|
|
73
|
+
&:not(.visual-refresh) {
|
|
74
|
+
box-shadow: inset 0 0 0 awsui.$border-control-focus-ring-shadow-spread awsui.$color-border-item-focused;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
&.selected {
|
|
@@ -80,8 +86,22 @@
|
|
|
80
86
|
border-end-end-radius: 0;
|
|
81
87
|
}
|
|
82
88
|
&.highlighted {
|
|
83
|
-
border-color: awsui.$color-border-dropdown-item-
|
|
89
|
+
border-color: awsui.$color-border-dropdown-item-selected;
|
|
84
90
|
z-index: 3;
|
|
91
|
+
outline: awsui.$border-item-width solid awsui.$color-border-dropdown-item-hover;
|
|
92
|
+
outline-offset: calc(-2 * #{awsui.$border-item-width});
|
|
93
|
+
&.is-keyboard {
|
|
94
|
+
border-color: awsui.$color-border-dropdown-item-selected;
|
|
95
|
+
outline-color: awsui.$color-border-dropdown-item-focused;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:not(.visual-refresh) {
|
|
99
|
+
border-color: awsui.$color-border-dropdown-item-hover;
|
|
100
|
+
outline: none;
|
|
101
|
+
&.is-keyboard {
|
|
102
|
+
border-color: awsui.$color-border-dropdown-item-focused;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
85
105
|
}
|
|
86
106
|
}
|
|
87
107
|
|
|
@@ -90,13 +110,6 @@
|
|
|
90
110
|
border-start-end-radius: 0;
|
|
91
111
|
}
|
|
92
112
|
|
|
93
|
-
&.highlighted.is-keyboard {
|
|
94
|
-
border-color: awsui.$color-border-dropdown-item-focused;
|
|
95
|
-
&:not(.visual-refresh) {
|
|
96
|
-
box-shadow: inset 0 0 0 awsui.$border-control-focus-ring-shadow-spread awsui.$color-border-item-focused;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
113
|
&.parent {
|
|
101
114
|
font-weight: bold;
|
|
102
115
|
color: awsui.$color-text-dropdown-group-label;
|
|
@@ -44,7 +44,7 @@ const Alert = React.forwardRef((_a, ref) => {
|
|
|
44
44
|
stepNameSelector,
|
|
45
45
|
subStepAllSelector: getSubStepAllSelector(),
|
|
46
46
|
subStepIdentifier,
|
|
47
|
-
subStepErrorContext,
|
|
47
|
+
errorContext: analyticsMetadata.errorContext || subStepErrorContext,
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
else if (stepNameSelector) {
|
|
@@ -58,7 +58,7 @@ const Alert = React.forwardRef((_a, ref) => {
|
|
|
58
58
|
totalSubSteps: subStepCount.current,
|
|
59
59
|
funnelIdentifier,
|
|
60
60
|
subStepAllSelector: getSubStepAllSelector(),
|
|
61
|
-
stepErrorContext,
|
|
61
|
+
errorContext: analyticsMetadata.errorContext || stepErrorContext,
|
|
62
62
|
subStepConfiguration: (_e = subStepConfiguration.current) === null || _e === void 0 ? void 0 : _e.get(stepNumber),
|
|
63
63
|
stepErrorSelector: '#' + messageSlotId,
|
|
64
64
|
});
|
|
@@ -67,7 +67,7 @@ const Alert = React.forwardRef((_a, ref) => {
|
|
|
67
67
|
FunnelMetrics.funnelError({
|
|
68
68
|
funnelIdentifier,
|
|
69
69
|
funnelInteractionId,
|
|
70
|
-
funnelErrorContext,
|
|
70
|
+
errorContext: analyticsMetadata.errorContext || funnelErrorContext,
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/alert/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAkC,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,aAAa,MAAM,YAAY,CAAC;AAEvC,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AAIpE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CAAC,EAAuD,EAAE,GAA8B,EAAE,EAAE;QAA3F,EAAE,IAAI,GAAG,MAAM,EAAE,OAAO,GAAG,IAAI,OAAwB,EAAnB,KAAK,cAAzC,mBAA2C,CAAF;IACxC,MAA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B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjC,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getSubStepAllSelector, getTextFromSelector } from '../internal/analytics/selectors';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { GeneratedAnalyticsMetadataAlertComponent } from './analytics-metadata/interfaces';\nimport { AlertProps } from './interfaces';\nimport InternalAlert from './internal';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\n\nexport { AlertProps };\n\nconst Alert = React.forwardRef(\n ({ type = 'info', visible = true, ...props }: AlertProps, ref: React.Ref<AlertProps.Ref>) => {\n const analyticsMetadata = getAnalyticsMetadataProps(props as BasePropsWithAnalyticsMetadata);\n const baseComponentProps = useBaseComponent<HTMLDivElement>(\n 'Alert',\n {\n props: { type, visible, dismissible: props.dismissible },\n },\n analyticsMetadata\n );\n\n const { funnelIdentifier, funnelInteractionId, funnelErrorContext, submissionAttempt, funnelState, errorCount } =\n useFunnel();\n const { stepNumber, stepNameSelector, stepIdentifier, subStepCount, stepErrorContext, subStepConfiguration } =\n useFunnelStep();\n const { subStepSelector, subStepNameSelector, subStepIdentifier, subStepErrorContext } = useFunnelSubStep();\n\n const messageSlotId = useUniqueId('alert-');\n\n useEffect(() => {\n if (funnelInteractionId && visible && type === 'error' && funnelState.current !== 'complete') {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.\n const errorIsVisible = (baseComponentProps.__internalRootRef.current?.getBoundingClientRect()?.width ?? 0) > 0;\n\n if (errorIsVisible) {\n if (subStepSelector) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n funnelIdentifier,\n stepIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n subStepIdentifier,\n errorContext: analyticsMetadata.errorContext || subStepErrorContext,\n });\n } else if (stepNameSelector) {\n FunnelMetrics.funnelStepError({\n funnelInteractionId,\n stepNumber,\n stepNameSelector,\n stepName,\n stepIdentifier,\n currentDocument: baseComponentProps.__internalRootRef.current?.ownerDocument,\n totalSubSteps: subStepCount.current,\n funnelIdentifier,\n subStepAllSelector: getSubStepAllSelector(),\n errorContext: analyticsMetadata.errorContext || stepErrorContext,\n subStepConfiguration: subStepConfiguration.current?.get(stepNumber),\n stepErrorSelector: '#' + messageSlotId,\n });\n } else {\n FunnelMetrics.funnelError({\n funnelIdentifier,\n funnelInteractionId,\n errorContext: analyticsMetadata.errorContext || funnelErrorContext,\n });\n }\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, visible, submissionAttempt, errorCount]);\n\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataAlertComponent = {\n name: 'awsui.Alert',\n label: `.${analyticsSelectors.header}`,\n properties: {\n type,\n },\n };\n\n return (\n <InternalAlert\n type={type}\n visible={visible}\n {...props}\n {...baseComponentProps}\n ref={ref}\n messageSlotId={messageSlotId}\n {...getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })}\n />\n );\n }\n);\n\napplyDisplayName(Alert, 'Alert');\nexport default Alert;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ErrorContext } from '../internal/analytics/interfaces';
|
|
2
3
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
4
|
import { NonCancelableEventHandler } from '../internal/events';
|
|
4
5
|
export declare namespace AlertProps {
|
|
@@ -16,6 +17,9 @@ export declare namespace AlertProps {
|
|
|
16
17
|
infoIconAriaLabel?: string;
|
|
17
18
|
dismissAriaLabel?: string;
|
|
18
19
|
}
|
|
20
|
+
interface AnalyticsMetadata {
|
|
21
|
+
errorContext?: ErrorContext;
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
export interface AlertProps extends BaseComponentProps {
|
|
21
25
|
/**
|
|
@@ -82,5 +86,11 @@ export interface AlertProps extends BaseComponentProps {
|
|
|
82
86
|
* @i18n
|
|
83
87
|
*/
|
|
84
88
|
i18nStrings?: AlertProps.I18nStrings;
|
|
89
|
+
/**
|
|
90
|
+
* Specifies additional analytics-related metadata.
|
|
91
|
+
* * `errorContext` - Identifies the error category and sub-category.
|
|
92
|
+
* @analytics
|
|
93
|
+
*/
|
|
94
|
+
analyticsMetadata?: AlertProps.AnalyticsMetadata;
|
|
85
95
|
}
|
|
86
96
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/alert/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,yBAAiB,UAAU,CAAC;IAC1B,KAAY,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAE5D,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;IAED,UAAiB,WAAW;QAK1B,oBAAoB,CAAC,EAAE,MAAM,CA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|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/alert/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';\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace AlertProps {\n export type Type = 'success' | 'error' | 'warning' | 'info';\n\n export interface Ref {\n /**\n * Sets focus on the alert content.\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /*\n * Specifies the ARIA label for the alert icon for type `success`.\n * @property {string} [successIconAriaLabel] - optional\n */\n successIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `error`.\n * @property {string} [errorIconAriaLabel] - optional\n */\n errorIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `warning`.\n * @property {string} [warningIconAriaLabel] - optional\n */\n warningIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `info`.\n * @property {string} [infoIconAriaLabel] - optional\n */\n infoIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the dismiss button.\n * @property {string} [dismissAriaLabel] - optional\n */\n dismissAriaLabel?: string;\n }\n}\n\nexport interface AlertProps extends BaseComponentProps {\n /**\n * Specifies the type of message you want to display.\n */\n type?: AlertProps.Type;\n\n /**\n * Provides a text alternative for the icon.\n *\n * @deprecated Use the label properties inside `i18nStrings` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n statusIconAriaLabel?: string;\n\n /**\n * Determines whether the alert is displayed.\n * @deprecated Use conditional rendering in your code instead of this prop.\n */\n visible?: boolean;\n /**\n * Adds a close button to the alert when set to `true`.\n * An `onDismiss` event is fired when a user clicks the button.\n */\n dismissible?: boolean;\n /**\n * Adds an aria-label to the dismiss button.\n * @i18n\n *\n * @deprecated Use `i18nStrings.dismissAriaLabel` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n dismissAriaLabel?: string;\n /**\n * Primary text displayed in the element.\n */\n children?: React.ReactNode;\n /**\n * Heading text.\n */\n header?: React.ReactNode;\n /**\n * Displays an action button next to the message area when set.\n * An `onButtonClick` event is fired when the user clicks it.\n * @deprecated Replaced by `action`.\n */\n buttonText?: React.ReactNode;\n /**\n * Specifies an action for the alert message.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add a button.\n */\n action?: React.ReactNode;\n /**\n * Fired when the user clicks the close icon that is displayed\n * when the `dismissible` property is set to `true`.\n */\n onDismiss?: NonCancelableEventHandler;\n /**\n * Fired when the user clicks the action button.\n * **Deprecated** Replaced by `action`.\n */\n onButtonClick?: NonCancelableEventHandler;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @property {AlertProps.I18nStrings} [i18nStrings] - optional\n * @i18n\n */\n i18nStrings?: AlertProps.I18nStrings;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/alert/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';\n\nimport { ErrorContext } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace AlertProps {\n export type Type = 'success' | 'error' | 'warning' | 'info';\n\n export interface Ref {\n /**\n * Sets focus on the alert content.\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /*\n * Specifies the ARIA label for the alert icon for type `success`.\n * @property {string} [successIconAriaLabel] - optional\n */\n successIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `error`.\n * @property {string} [errorIconAriaLabel] - optional\n */\n errorIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `warning`.\n * @property {string} [warningIconAriaLabel] - optional\n */\n warningIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `info`.\n * @property {string} [infoIconAriaLabel] - optional\n */\n infoIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the dismiss button.\n * @property {string} [dismissAriaLabel] - optional\n */\n dismissAriaLabel?: string;\n }\n\n export interface AnalyticsMetadata {\n errorContext?: ErrorContext;\n }\n}\n\nexport interface AlertProps extends BaseComponentProps {\n /**\n * Specifies the type of message you want to display.\n */\n type?: AlertProps.Type;\n\n /**\n * Provides a text alternative for the icon.\n *\n * @deprecated Use the label properties inside `i18nStrings` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n statusIconAriaLabel?: string;\n\n /**\n * Determines whether the alert is displayed.\n * @deprecated Use conditional rendering in your code instead of this prop.\n */\n visible?: boolean;\n /**\n * Adds a close button to the alert when set to `true`.\n * An `onDismiss` event is fired when a user clicks the button.\n */\n dismissible?: boolean;\n /**\n * Adds an aria-label to the dismiss button.\n * @i18n\n *\n * @deprecated Use `i18nStrings.dismissAriaLabel` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n dismissAriaLabel?: string;\n /**\n * Primary text displayed in the element.\n */\n children?: React.ReactNode;\n /**\n * Heading text.\n */\n header?: React.ReactNode;\n /**\n * Displays an action button next to the message area when set.\n * An `onButtonClick` event is fired when the user clicks it.\n * @deprecated Replaced by `action`.\n */\n buttonText?: React.ReactNode;\n /**\n * Specifies an action for the alert message.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add a button.\n */\n action?: React.ReactNode;\n /**\n * Fired when the user clicks the close icon that is displayed\n * when the `dismissible` property is set to `true`.\n */\n onDismiss?: NonCancelableEventHandler;\n /**\n * Fired when the user clicks the action button.\n * **Deprecated** Replaced by `action`.\n */\n onButtonClick?: NonCancelableEventHandler;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @property {AlertProps.I18nStrings} [i18nStrings] - optional\n * @i18n\n */\n i18nStrings?: AlertProps.I18nStrings;\n /**\n * Specifies additional analytics-related metadata.\n * * `errorContext` - Identifies the error category and sub-category.\n * @analytics\n */\n analyticsMetadata?: AlertProps.AnalyticsMetadata;\n}\n"]}
|
|
@@ -9,7 +9,6 @@ import { ActionsWrapper } from '../alert/actions-wrapper';
|
|
|
9
9
|
import { InternalButton } from '../button/internal';
|
|
10
10
|
import InternalIcon from '../icon/internal';
|
|
11
11
|
import { DATA_ATTR_ANALYTICS_FLASHBAR, DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS, } from '../internal/analytics/selectors';
|
|
12
|
-
import { getAnalyticsMetadataProps } from '../internal/base-component';
|
|
13
12
|
import { getVisualContextClassname } from '../internal/components/visual-context';
|
|
14
13
|
import { PACKAGE_VERSION } from '../internal/environment';
|
|
15
14
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
@@ -45,7 +44,7 @@ export const focusFlashById = throttle((element, itemId) => {
|
|
|
45
44
|
(_a = element === null || element === void 0 ? void 0 : element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
46
45
|
}, FOCUS_THROTTLE_DELAY, { trailing: false });
|
|
47
46
|
export const Flash = React.forwardRef((_a, ref) => {
|
|
48
|
-
var { id, header, content, dismissible, dismissLabel, loading, action, buttonText, onButtonClick, onDismiss, className, transitionState, ariaRole, i18nStrings, type = 'info' } = _a, props = __rest(_a, ["id", "header", "content", "dismissible", "dismissLabel", "loading", "action", "buttonText", "onButtonClick", "onDismiss", "className", "transitionState", "ariaRole", "i18nStrings", "type"]);
|
|
47
|
+
var { id, header, content, dismissible, dismissLabel, loading, action, buttonText, onButtonClick, onDismiss, className, transitionState, ariaRole, i18nStrings, type = 'info', analyticsMetadata } = _a, props = __rest(_a, ["id", "header", "content", "dismissible", "dismissLabel", "loading", "action", "buttonText", "onButtonClick", "onDismiss", "className", "transitionState", "ariaRole", "i18nStrings", "type", "analyticsMetadata"]);
|
|
49
48
|
if (isDevelopment) {
|
|
50
49
|
if (buttonText && !onButtonClick) {
|
|
51
50
|
warnOnce('Flashbar', `You provided a \`buttonText\` prop without an \`onButtonClick\` handler. This will render a non-interactive action button.`);
|
|
@@ -54,9 +53,8 @@ export const Flash = React.forwardRef((_a, ref) => {
|
|
|
54
53
|
warnOnce('Flashbar', `You have set the \`dismissible\` prop without an \`onDismiss\` handler. This will render a non-interactive dismiss button.`);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
const analyticsMetadata = getAnalyticsMetadataProps(props);
|
|
58
56
|
const [containerWidth, containerMeasureRef] = useContainerWidth();
|
|
59
|
-
const elementRef = useComponentMetadata('Flash', PACKAGE_VERSION,
|
|
57
|
+
const elementRef = useComponentMetadata('Flash', PACKAGE_VERSION, analyticsMetadata);
|
|
60
58
|
const mergedRef = useMergeRefs(ref, elementRef, containerMeasureRef);
|
|
61
59
|
const flashIconId = useUniqueId('flash-icon');
|
|
62
60
|
const flashMessageId = useUniqueId('flash-message');
|
|
@@ -75,7 +73,7 @@ export const Flash = React.forwardRef((_a, ref) => {
|
|
|
75
73
|
const analyticsAttributes = {
|
|
76
74
|
[DATA_ATTR_ANALYTICS_FLASHBAR]: effectiveType,
|
|
77
75
|
};
|
|
78
|
-
if (analyticsMetadata.suppressFlowMetricEvents) {
|
|
76
|
+
if (analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.suppressFlowMetricEvents) {
|
|
79
77
|
analyticsAttributes[DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS] = 'true';
|
|
80
78
|
}
|
|
81
79
|
return (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flash.js","sourceRoot":"","sources":["../../../src/flashbar/flash.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,oBAAoB,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE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AC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAC3F,EACD,GAAG,EAAE,UAAU,IAEd,OAAO,CACJ;oBACN,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,sBAAsB,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,EACtG,GAAG,EAAE,qBAAqB,GACrB,CACH,CACF;YACN,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAC1C,eAAe,EAAE;oBACf,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC;oBACjC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC;iBACtC,EACD,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;QACL,WAAW,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC;QACrD,QAAQ,KAAK,QAAQ,IAAI,CACxB,oBAAC,kBAAkB,IAAC,OAAO,EAAE,CAAC,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,CAAC,GAAI,CAC1F,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useComponentMetadata, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ActionsWrapper } from '../alert/actions-wrapper';\nimport { InternalButton } from '../button/internal';\nimport InternalIcon from '../icon/internal';\nimport {\n DATA_ATTR_ANALYTICS_FLASHBAR,\n DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS,\n} from '../internal/analytics/selectors';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isDevelopment } from '../internal/is-development';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { throttle } from '../internal/utils/throttle';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalSpinner from '../spinner/internal';\nimport { GeneratedAnalyticsMetadataFlashbarDismiss } from './analytics-metadata/interfaces';\nimport { FlashbarProps } from './interfaces';\nimport { FOCUS_THROTTLE_DELAY } from './utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst ICON_TYPES = {\n success: 'status-positive',\n warning: 'status-warning',\n info: 'status-info',\n error: 'status-negative',\n 'in-progress': 'status-in-progress',\n} as const;\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.flashbar.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('flash', awsuiPluginsInternal.flashContent);\n\nfunction dismissButton(\n dismissLabel: FlashbarProps.MessageDefinition['dismissLabel'],\n onDismiss: FlashbarProps.MessageDefinition['onDismiss']\n) {\n return (\n <div\n className={styles['dismiss-button-wrapper']}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataFlashbarDismiss>)}\n >\n <InternalButton\n onClick={onDismiss}\n className={styles['dismiss-button']}\n variant=\"flashbar-icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissLabel}\n />\n </div>\n );\n}\n\nexport const focusFlashById = throttle(\n (element: HTMLElement | null, itemId: string) => {\n const selector = `[data-itemid=\"${CSS.escape(itemId)}\"] .${styles['flash-focus-container']}`;\n element?.querySelector<HTMLElement>(selector)?.focus();\n },\n FOCUS_THROTTLE_DELAY,\n { trailing: false }\n);\n\ninterface FlashProps extends FlashbarProps.MessageDefinition {\n className: string;\n transitionState?: string;\n i18nStrings?: FlashbarProps.I18nStrings;\n}\n\nexport const Flash = React.forwardRef(\n (\n {\n id,\n header,\n content,\n dismissible,\n dismissLabel,\n loading,\n action,\n buttonText,\n onButtonClick,\n onDismiss,\n className,\n transitionState,\n ariaRole,\n i18nStrings,\n type = 'info',\n ...props\n }: FlashProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n if (isDevelopment) {\n if (buttonText && !onButtonClick) {\n warnOnce(\n 'Flashbar',\n `You provided a \\`buttonText\\` prop without an \\`onButtonClick\\` handler. This will render a non-interactive action button.`\n );\n }\n\n if (dismissible && !onDismiss) {\n warnOnce(\n 'Flashbar',\n `You have set the \\`dismissible\\` prop without an \\`onDismiss\\` handler. This will render a non-interactive dismiss button.`\n );\n }\n }\n\n const analyticsMetadata = getAnalyticsMetadataProps(\n props as BasePropsWithAnalyticsMetadata & FlashbarProps.MessageDefinition\n );\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n const elementRef = useComponentMetadata('Flash', PACKAGE_VERSION, { ...analyticsMetadata });\n const mergedRef = useMergeRefs(ref, elementRef, containerMeasureRef);\n const flashIconId = useUniqueId('flash-icon');\n const flashMessageId = useUniqueId('flash-message');\n\n const headerRefObject = useRef<HTMLDivElement>(null);\n const contentRefObject = useRef<HTMLDivElement>(null);\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children: content });\n\n const headerRef = useMergeRefs(headerRefAction, headerRefContent, headerRefObject);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent, contentRefObject);\n\n const statusIconAriaLabel =\n props.statusIconAriaLabel ||\n i18nStrings?.[`${loading || type === 'in-progress' ? 'inProgress' : type}IconAriaLabel`];\n\n const iconType = ICON_TYPES[type];\n const icon = loading ? (\n <span role=\"img\" aria-label={statusIconAriaLabel}>\n <InternalSpinner />\n </span>\n ) : (\n <InternalIcon name={iconType} ariaLabel={statusIconAriaLabel} />\n );\n\n const effectiveType = loading ? 'info' : type;\n\n const analyticsAttributes: Record<string, string> = {\n [DATA_ATTR_ANALYTICS_FLASHBAR]: effectiveType,\n };\n\n if (analyticsMetadata.suppressFlowMetricEvents) {\n analyticsAttributes[DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS] = 'true';\n }\n\n return (\n // We're not using \"polite\" or \"assertive\" here, just turning default behavior off.\n // eslint-disable-next-line @cloudscape-design/prefer-live-region\n <div\n ref={mergedRef}\n role={ariaRole}\n aria-live={ariaRole ? 'off' : undefined}\n data-itemid={id}\n className={clsx(\n styles.flash,\n styles[`flash-type-${effectiveType}`],\n className,\n transitionState && {\n [styles.enter]: transitionState === 'enter',\n [styles.entering]: transitionState === 'entering',\n [styles.entered]: transitionState === 'entered',\n [styles.exit]: transitionState === 'exit',\n [styles.exiting]: transitionState === 'exiting',\n [styles.exited]: transitionState === 'exited',\n },\n getVisualContextClassname(type === 'warning' && !loading ? 'flashbar-warning' : 'flashbar'),\n initialHidden && styles['initial-hidden']\n )}\n {...analyticsAttributes}\n >\n <div className={styles['flash-body']}>\n <div\n className={styles['flash-focus-container']}\n tabIndex={-1}\n role=\"group\"\n aria-labelledby={`${flashIconId} ${flashMessageId}`}\n >\n <div className={clsx(styles['flash-icon'], styles['flash-text'])} id={flashIconId}>\n {icon}\n </div>\n <div className={clsx(styles['flash-message'], styles['flash-text'])} id={flashMessageId}>\n <div\n className={clsx(\n styles['flash-header'],\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(styles['header-replacement'], headerReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(\n styles['flash-content'],\n contentReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={contentRef}\n >\n {content}\n </div>\n <div\n className={clsx(styles['content-replacement'], contentReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles['action-button-wrapper']}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={onButtonClick}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && dismissButton(dismissLabel, onDismiss)}\n {ariaRole === 'status' && (\n <InternalLiveRegion sources={[statusIconAriaLabel, headerRefObject, contentRefObject]} />\n )}\n </div>\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"flash.js","sourceRoot":"","sources":["../../../src/flashbar/flash.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,oBAAoB,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAGjH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,4BAA4B,EAC5B,wCAAwC,GACzC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAA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AAM,CAAC,aAAa,CAAC;oBACjC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC;iBACtC,EACD,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;QACL,WAAW,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC;QACrD,QAAQ,KAAK,QAAQ,IAAI,CACxB,oBAAC,kBAAkB,IAAC,OAAO,EAAE,CAAC,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,CAAC,GAAI,CAC1F,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useComponentMetadata, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\nimport { AnalyticsMetadata } from '@cloudscape-design/component-toolkit/internal/base-component/metrics/interfaces';\n\nimport { ActionsWrapper } from '../alert/actions-wrapper';\nimport { InternalButton } from '../button/internal';\nimport InternalIcon from '../icon/internal';\nimport {\n DATA_ATTR_ANALYTICS_FLASHBAR,\n DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS,\n} from '../internal/analytics/selectors';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isDevelopment } from '../internal/is-development';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { throttle } from '../internal/utils/throttle';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalSpinner from '../spinner/internal';\nimport { GeneratedAnalyticsMetadataFlashbarDismiss } from './analytics-metadata/interfaces';\nimport { FlashbarProps } from './interfaces';\nimport { FOCUS_THROTTLE_DELAY } from './utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst ICON_TYPES = {\n success: 'status-positive',\n warning: 'status-warning',\n info: 'status-info',\n error: 'status-negative',\n 'in-progress': 'status-in-progress',\n} as const;\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.flashbar.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('flash', awsuiPluginsInternal.flashContent);\n\nfunction dismissButton(\n dismissLabel: FlashbarProps.MessageDefinition['dismissLabel'],\n onDismiss: FlashbarProps.MessageDefinition['onDismiss']\n) {\n return (\n <div\n className={styles['dismiss-button-wrapper']}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataFlashbarDismiss>)}\n >\n <InternalButton\n onClick={onDismiss}\n className={styles['dismiss-button']}\n variant=\"flashbar-icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissLabel}\n />\n </div>\n );\n}\n\nexport const focusFlashById = throttle(\n (element: HTMLElement | null, itemId: string) => {\n const selector = `[data-itemid=\"${CSS.escape(itemId)}\"] .${styles['flash-focus-container']}`;\n element?.querySelector<HTMLElement>(selector)?.focus();\n },\n FOCUS_THROTTLE_DELAY,\n { trailing: false }\n);\n\ninterface FlashProps extends FlashbarProps.MessageDefinition {\n className: string;\n transitionState?: string;\n i18nStrings?: FlashbarProps.I18nStrings;\n}\n\nexport const Flash = React.forwardRef(\n (\n {\n id,\n header,\n content,\n dismissible,\n dismissLabel,\n loading,\n action,\n buttonText,\n onButtonClick,\n onDismiss,\n className,\n transitionState,\n ariaRole,\n i18nStrings,\n type = 'info',\n analyticsMetadata,\n ...props\n }: FlashProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n if (isDevelopment) {\n if (buttonText && !onButtonClick) {\n warnOnce(\n 'Flashbar',\n `You provided a \\`buttonText\\` prop without an \\`onButtonClick\\` handler. This will render a non-interactive action button.`\n );\n }\n\n if (dismissible && !onDismiss) {\n warnOnce(\n 'Flashbar',\n `You have set the \\`dismissible\\` prop without an \\`onDismiss\\` handler. This will render a non-interactive dismiss button.`\n );\n }\n }\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n\n const elementRef = useComponentMetadata('Flash', PACKAGE_VERSION, analyticsMetadata as AnalyticsMetadata);\n\n const mergedRef = useMergeRefs(ref, elementRef, containerMeasureRef);\n const flashIconId = useUniqueId('flash-icon');\n const flashMessageId = useUniqueId('flash-message');\n\n const headerRefObject = useRef<HTMLDivElement>(null);\n const contentRefObject = useRef<HTMLDivElement>(null);\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children: content });\n\n const headerRef = useMergeRefs(headerRefAction, headerRefContent, headerRefObject);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent, contentRefObject);\n\n const statusIconAriaLabel =\n props.statusIconAriaLabel ||\n i18nStrings?.[`${loading || type === 'in-progress' ? 'inProgress' : type}IconAriaLabel`];\n\n const iconType = ICON_TYPES[type];\n const icon = loading ? (\n <span role=\"img\" aria-label={statusIconAriaLabel}>\n <InternalSpinner />\n </span>\n ) : (\n <InternalIcon name={iconType} ariaLabel={statusIconAriaLabel} />\n );\n\n const effectiveType = loading ? 'info' : type;\n\n const analyticsAttributes: Record<string, string> = {\n [DATA_ATTR_ANALYTICS_FLASHBAR]: effectiveType,\n };\n\n if (analyticsMetadata?.suppressFlowMetricEvents) {\n analyticsAttributes[DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS] = 'true';\n }\n\n return (\n // We're not using \"polite\" or \"assertive\" here, just turning default behavior off.\n // eslint-disable-next-line @cloudscape-design/prefer-live-region\n <div\n ref={mergedRef}\n role={ariaRole}\n aria-live={ariaRole ? 'off' : undefined}\n data-itemid={id}\n className={clsx(\n styles.flash,\n styles[`flash-type-${effectiveType}`],\n className,\n transitionState && {\n [styles.enter]: transitionState === 'enter',\n [styles.entering]: transitionState === 'entering',\n [styles.entered]: transitionState === 'entered',\n [styles.exit]: transitionState === 'exit',\n [styles.exiting]: transitionState === 'exiting',\n [styles.exited]: transitionState === 'exited',\n },\n getVisualContextClassname(type === 'warning' && !loading ? 'flashbar-warning' : 'flashbar'),\n initialHidden && styles['initial-hidden']\n )}\n {...analyticsAttributes}\n >\n <div className={styles['flash-body']}>\n <div\n className={styles['flash-focus-container']}\n tabIndex={-1}\n role=\"group\"\n aria-labelledby={`${flashIconId} ${flashMessageId}`}\n >\n <div className={clsx(styles['flash-icon'], styles['flash-text'])} id={flashIconId}>\n {icon}\n </div>\n <div className={clsx(styles['flash-message'], styles['flash-text'])} id={flashMessageId}>\n <div\n className={clsx(\n styles['flash-header'],\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(styles['header-replacement'], headerReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(\n styles['flash-content'],\n contentReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={contentRef}\n >\n {content}\n </div>\n <div\n className={clsx(styles['content-replacement'], contentReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles['action-button-wrapper']}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={onButtonClick}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && dismissButton(dismissLabel, onDismiss)}\n {ariaRole === 'status' && (\n <InternalLiveRegion sources={[statusIconAriaLabel, headerRefObject, contentRefObject]} />\n )}\n </div>\n );\n }\n);\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../button/interfaces';
|
|
3
|
+
import { ErrorContext } from '../internal/analytics/interfaces';
|
|
3
4
|
import { BaseComponentProps } from '../internal/base-component';
|
|
4
5
|
export declare namespace FlashbarProps {
|
|
5
6
|
interface MessageDefinition {
|
|
@@ -20,6 +21,7 @@ export declare namespace FlashbarProps {
|
|
|
20
21
|
}
|
|
21
22
|
interface ItemAnalyticsMetadata {
|
|
22
23
|
suppressFlowMetricEvents?: boolean;
|
|
24
|
+
errorContext?: ErrorContext;
|
|
23
25
|
}
|
|
24
26
|
interface I18nStrings {
|
|
25
27
|
ariaLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,iBAAiB;QAChC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC;QAC1B,QAAQ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AAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;QACvC,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;QACnC,iBAAiB,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC;KACzD;IAED,UAAiB,qBAAqB;QACpC,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B;IAED,UAAiB,WAAW;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;KAC/B;IAED,KAAY,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,CAAC;IAC5E,KAAY,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;CAC3C;AAED,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAEtD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC;CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n statusIconAriaLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n ariaRole?: FlashbarProps.AriaRole;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n analyticsMetadata?: FlashbarProps.ItemAnalyticsMetadata;\n }\n\n export interface ItemAnalyticsMetadata {\n suppressFlowMetricEvents?: boolean;\n }\n\n export interface I18nStrings {\n ariaLabel?: string;\n errorIconAriaLabel?: string;\n infoIconAriaLabel?: string;\n inProgressIconAriaLabel?: string;\n notificationBarAriaLabel?: string;\n notificationBarText?: string;\n successIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error' | 'in-progress';\n export type AriaRole = 'alert' | 'status';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `statusIconAriaLabel` (string) - Specifies an `aria-label` for to the status icon for improved accessibility.\n * If not provided, `i18nStrings.{type}IconAriaLabel` will be used as a fallback.\n * * `ariaRole` (string) - For flash messages added after page load, specifies how this message is communicated to assistive\n * technology. Use \"status\" for status updates or informational content. Use \"alert\" for important messages that need the\n * user's attention.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called.\n * If the `action` property is set, this property is ignored. **Deprecated**, replaced by `action`.\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n * * `analyticsMetadata` (FlashbarProps.ItemAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * * `suppressFlowMetricEvents` - Prevent this item from generating events related to flow metrics.\n * @analytics\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n\n /**\n * Specifies whether flash messages should be stacked.\n */\n stackItems?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component. The object should contain:\n *\n * * `ariaLabel` - Specifies the ARIA label for the list of notifications.\n *\n * If `stackItems` is set to `true`, it should also contain:\n *\n * * `notificationBarAriaLabel` - (optional) Specifies the ARIA label for the notification bar\n * * `notificationBarText` - (optional) Specifies the text shown in the notification bar\n * * `errorIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `error`.\n * * `warningIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `warning`.\n * * `infoIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `info`.\n * * `successIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `success`.\n * * `inProgressIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `in-progress` or with `loading` set to `true`.\n * @i18n\n */\n i18nStrings?: FlashbarProps.I18nStrings;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { ErrorContext } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n statusIconAriaLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n ariaRole?: FlashbarProps.AriaRole;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n analyticsMetadata?: FlashbarProps.ItemAnalyticsMetadata;\n }\n\n export interface ItemAnalyticsMetadata {\n suppressFlowMetricEvents?: boolean;\n errorContext?: ErrorContext;\n }\n\n export interface I18nStrings {\n ariaLabel?: string;\n errorIconAriaLabel?: string;\n infoIconAriaLabel?: string;\n inProgressIconAriaLabel?: string;\n notificationBarAriaLabel?: string;\n notificationBarText?: string;\n successIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error' | 'in-progress';\n export type AriaRole = 'alert' | 'status';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `statusIconAriaLabel` (string) - Specifies an `aria-label` for to the status icon for improved accessibility.\n * If not provided, `i18nStrings.{type}IconAriaLabel` will be used as a fallback.\n * * `ariaRole` (string) - For flash messages added after page load, specifies how this message is communicated to assistive\n * technology. Use \"status\" for status updates or informational content. Use \"alert\" for important messages that need the\n * user's attention.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called.\n * If the `action` property is set, this property is ignored. **Deprecated**, replaced by `action`.\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n * * `analyticsMetadata` (FlashbarProps.ItemAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * * `suppressFlowMetricEvents` - Prevent this item from generating events related to flow metrics.\n * @analytics\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n\n /**\n * Specifies whether flash messages should be stacked.\n */\n stackItems?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component. The object should contain:\n *\n * * `ariaLabel` - Specifies the ARIA label for the list of notifications.\n *\n * If `stackItems` is set to `true`, it should also contain:\n *\n * * `notificationBarAriaLabel` - (optional) Specifies the ARIA label for the notification bar\n * * `notificationBarText` - (optional) Specifies the text shown in the notification bar\n * * `errorIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `error`.\n * * `warningIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `warning`.\n * * `infoIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `info`.\n * * `successIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `success`.\n * * `inProgressIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `in-progress` or with `loading` set to `true`.\n * @i18n\n */\n i18nStrings?: FlashbarProps.I18nStrings;\n}\n"]}
|
|
@@ -40,7 +40,7 @@ const FormWithAnalytics = (_a) => {
|
|
|
40
40
|
totalSubSteps: funnelStepInfo.current.subStepCount.current,
|
|
41
41
|
funnelIdentifier,
|
|
42
42
|
subStepAllSelector: getSubStepAllSelector(),
|
|
43
|
-
|
|
43
|
+
errorContext: funnelStepInfo.current.stepErrorContext,
|
|
44
44
|
subStepConfiguration: (_b = funnelStepInfo.current.subStepConfiguration.current) === null || _b === void 0 ? void 0 : _b.get(funnelStepInfo.current.stepNumber),
|
|
45
45
|
stepErrorSelector: '#' + errorSlotId,
|
|
46
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAkC,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,EAAE,aAAa,EAAsB,MAAM,oCAAoC,CAAC;AACvF,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC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AAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,kBAAkB,EACvD,cAAc,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,QAAQ,EAC3C,kBAAkB,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,YAAY,EACnD,kBAAkB,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,YAAY,EACnD,UAAU,EAAC,aAAa,EACxB,mBAAmB,EAAE,EAAE,EACvB,gBAAgB,EAAE,CAAC,EACnB,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC,kBAAkB,EAAE,IAAI,kBAAkB,CAAC,MAAM,EAAE,CAAC;QAEhF,oBAAC,mBAAmB,IAClB,cAAc,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,kBAAkB,EACrD,gBAAgB,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,YAAY,EACjD,UAAU,EAAE,CAAC;YAEb,oBAAC,iBAAiB,kBAAC,OAAO,EAAE,OAAO,IAAM,KAAK,EAAM,kBAAkB,EAAI,CACtD,CACN,CACnB,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { AnalyticsFunnel, AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\nimport { useFunnel, useFunnelNameSelector, useFunnelStepRef } from '../internal/analytics/hooks/use-funnel';\nimport { getSubStepAllSelector, getTextFromSelector } from '../internal/analytics/selectors';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport { ButtonContext, ButtonContextProps } from '../internal/context/button-context';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { FormProps } from './interfaces';\nimport InternalForm from './internal';\n\nimport headerStyles from '../header/styles.css.js';\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\n\nexport { FormProps };\n\nconst FormWithAnalytics = ({\n variant = 'full-page',\n actions,\n errorText,\n __internalRootRef,\n ...props\n}: FormProps & ReturnType<typeof useBaseComponent<HTMLElement>>) => {\n const {\n funnelIdentifier,\n funnelInteractionId,\n funnelProps,\n funnelSubmit,\n funnelNextOrSubmitAttempt,\n errorCount,\n submissionAttempt,\n funnelErrorContext,\n } = useFunnel();\n\n const funnelStepInfo = useFunnelStepRef();\n\n const handleActionButtonClick: ButtonContextProps['onClick'] = ({ variant }) => {\n if (variant === 'primary') {\n funnelNextOrSubmitAttempt();\n funnelSubmit();\n }\n };\n\n const errorSlotId = useUniqueId('form-error-');\n\n useEffect(() => {\n if (funnelInteractionId && errorText) {\n errorCount.current++;\n\n const stepName = getTextFromSelector(funnelStepInfo.current.stepNameSelector);\n\n FunnelMetrics.funnelStepError({\n funnelInteractionId,\n stepNumber: funnelStepInfo.current.stepNumber,\n stepNameSelector: funnelStepInfo.current.stepNameSelector,\n stepName,\n stepIdentifier: funnelStepInfo.current.stepIdentifier,\n currentDocument: __internalRootRef.current?.ownerDocument,\n totalSubSteps: funnelStepInfo.current.subStepCount.current,\n funnelIdentifier,\n subStepAllSelector: getSubStepAllSelector(),\n errorContext: funnelStepInfo.current.stepErrorContext,\n subStepConfiguration: funnelStepInfo.current.subStepConfiguration.current?.get(\n funnelStepInfo.current.stepNumber\n ),\n stepErrorSelector: '#' + errorSlotId,\n });\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n }, [\n funnelInteractionId,\n funnelIdentifier,\n errorText,\n submissionAttempt,\n errorCount,\n funnelErrorContext,\n errorSlotId,\n __internalRootRef,\n funnelStepInfo,\n ]);\n\n return (\n <ButtonContext.Provider value={{ onClick: handleActionButtonClick }}>\n <InternalForm\n variant={variant}\n actions={actions}\n errorText={errorText}\n __errorSlotId={errorSlotId}\n {...props}\n {...funnelProps}\n {...funnelStepInfo.current.funnelStepProps}\n __internalRootRef={__internalRootRef}\n __injectAnalyticsComponentMetadata={true}\n />\n </ButtonContext.Provider>\n );\n};\n\nexport default function Form({ variant = 'full-page', ...props }: FormProps) {\n const analyticsMetadata = getAnalyticsMetadataProps(props as BasePropsWithAnalyticsMetadata);\n const baseComponentProps = useBaseComponent<HTMLElement>(\n 'Form',\n {\n props: {\n variant,\n flowType: analyticsMetadata?.flowType,\n },\n metadata: {\n hasResourceType: Boolean(analyticsMetadata?.resourceType),\n hasInstanceIdentifier: Boolean(analyticsMetadata?.instanceIdentifier),\n },\n },\n analyticsMetadata\n );\n const inheritedFunnelNameSelector = useFunnelNameSelector();\n const funnelNameSelector =\n inheritedFunnelNameSelector || `.${analyticsSelectors.header} .${headerStyles['heading-text']}`;\n\n return (\n <AnalyticsFunnel\n funnelIdentifier={analyticsMetadata?.instanceIdentifier}\n funnelFlowType={analyticsMetadata?.flowType}\n funnelErrorContext={analyticsMetadata?.errorContext}\n funnelResourceType={analyticsMetadata?.resourceType}\n funnelType=\"single-page\"\n optionalStepNumbers={[]}\n totalFunnelSteps={1}\n funnelNameSelectors={() => [funnelNameSelector, `.${analyticsSelectors.header}`]}\n >\n <AnalyticsFunnelStep\n stepIdentifier={analyticsMetadata?.instanceIdentifier}\n stepErrorContext={analyticsMetadata?.errorContext}\n stepNumber={1}\n >\n <FormWithAnalytics variant={variant} {...props} {...baseComponentProps} />\n </AnalyticsFunnelStep>\n </AnalyticsFunnel>\n );\n}\n\napplyDisplayName(Form, 'Form');\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FlowType } from '../internal/analytics/interfaces';
|
|
2
|
+
import { ErrorContext, FlowType } from '../internal/analytics/interfaces';
|
|
3
3
|
import { BaseComponentProps } from '../internal/base-component';
|
|
4
4
|
export declare namespace FormProps {
|
|
5
5
|
interface AnalyticsMetadata {
|
|
6
6
|
instanceIdentifier?: string;
|
|
7
7
|
flowType?: FlowType;
|
|
8
8
|
resourceType?: string;
|
|
9
|
+
errorContext?: ErrorContext;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
export interface FormProps extends BaseComponentProps {
|
|
@@ -46,6 +47,7 @@ export interface FormProps extends BaseComponentProps {
|
|
|
46
47
|
* * `instanceIdentifier` - A unique string that identifies this component instance in your application.
|
|
47
48
|
* * `flowType` - Identifies the type of flow represented by the component.
|
|
48
49
|
* * `resourceType` - Identifies the type of resource represented by the flow. **Note:** This API is currently experimental.
|
|
50
|
+
* * `errorContext` - Identifies the error category and sub-category.
|
|
49
51
|
* @analytics
|
|
50
52
|
*/
|
|
51
53
|
analyticsMetadata?: FormProps.AnalyticsMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/form/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/form/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,yBAAiB,SAAS,CAAC;IACzB,UAAiB,iBAAiB;QAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B;CACF;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IAEnC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAC,iBAAiB,CAAC;CACjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/form/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';\n\nimport { FlowType } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport namespace FormProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n resourceType?: string;\n }\n}\n\nexport interface FormProps extends BaseComponentProps {\n /**\n * Specifies the main form content.\n */\n children?: React.ReactNode;\n\n /**\n * Specifies the form title and optional description. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Specifies a form-level validation message.\n */\n errorText?: React.ReactNode;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * Specifies actions for the form. You should wrap action buttons in a [space between component](/components/space-between) with `direction=\"horizontal\"` and `size=\"xs\"`.\n */\n actions?: React.ReactNode;\n\n /**\n * Specifies left-aligned secondary actions for the form. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Specify a form variant with one of the following:\n * * `full-page` - Use this variant when the form contains the entire content of the page.\n * * `embedded` - Use this variant when the form doesn't occupy the full page.\n * @deprecated You can safely remove this property as there is no longer any visual difference between `full-page` and `embedded` variants.\n */\n variant?: 'full-page' | 'embedded';\n\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * * `flowType` - Identifies the type of flow represented by the component.\n * * `resourceType` - Identifies the type of resource represented by the flow. **Note:** This API is currently experimental.\n * @analytics\n */\n analyticsMetadata?: FormProps.AnalyticsMetadata;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/form/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';\n\nimport { ErrorContext, FlowType } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport namespace FormProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n resourceType?: string;\n errorContext?: ErrorContext;\n }\n}\n\nexport interface FormProps extends BaseComponentProps {\n /**\n * Specifies the main form content.\n */\n children?: React.ReactNode;\n\n /**\n * Specifies the form title and optional description. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Specifies a form-level validation message.\n */\n errorText?: React.ReactNode;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * Specifies actions for the form. You should wrap action buttons in a [space between component](/components/space-between) with `direction=\"horizontal\"` and `size=\"xs\"`.\n */\n actions?: React.ReactNode;\n\n /**\n * Specifies left-aligned secondary actions for the form. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Specify a form variant with one of the following:\n * * `full-page` - Use this variant when the form contains the entire content of the page.\n * * `embedded` - Use this variant when the form doesn't occupy the full page.\n * @deprecated You can safely remove this property as there is no longer any visual difference between `full-page` and `embedded` variants.\n */\n variant?: 'full-page' | 'embedded';\n\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * * `flowType` - Identifies the type of flow represented by the component.\n * * `resourceType` - Identifies the type of resource represented by the flow. **Note:** This API is currently experimental.\n * * `errorContext` - Identifies the error category and sub-category.\n * @analytics\n */\n analyticsMetadata?: FormProps.AnalyticsMetadata;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/form-field/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,OAAe,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/form-field/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,OAAe,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,eA+B9E"}
|
|
@@ -17,6 +17,7 @@ export default function FormField(_a) {
|
|
|
17
17
|
},
|
|
18
18
|
metadata: {
|
|
19
19
|
hasInstanceIdentifier: Boolean(analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.instanceIdentifier),
|
|
20
|
+
hasErrorContext: Boolean(analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.errorContext),
|
|
20
21
|
},
|
|
21
22
|
}, analyticsMetadata);
|
|
22
23
|
return (React.createElement(InternalFormField, Object.assign({ stretch: stretch }, props, { __hideLabel: false, __analyticsMetadata: analyticsMetadata }, baseComponentProps, getAnalyticsMetadataAttribute({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form-field/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAkC,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAE3C,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AAIpE,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAA6C;QAA7C,EAAE,OAAO,GAAG,KAAK,OAA4B,EAAvB,KAAK,cAA3B,WAA6B,CAAF;IAC3D,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,KAAuC,CAAC,CAAC;IAC7F,MAAM,kBAAkB,GAAG,gBAAgB,CACzC,WAAW,EACX;QACE,KAAK,EAAE;YACL,OAAO;SACR;QACD,QAAQ,EAAE;YACR,qBAAqB,EAAE,OAAO,CAAC,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form-field/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAkC,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAE3C,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AAIpE,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAA6C;QAA7C,EAAE,OAAO,GAAG,KAAK,OAA4B,EAAvB,KAAK,cAA3B,WAA6B,CAAF;IAC3D,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,KAAuC,CAAC,CAAC;IAC7F,MAAM,kBAAkB,GAAG,gBAAgB,CACzC,WAAW,EACX;QACE,KAAK,EAAE;YACL,OAAO;SACR;QACD,QAAQ,EAAE;YACR,qBAAqB,EAAE,OAAO,CAAC,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,kBAAkB,CAAC;YACrE,eAAe,EAAE,OAAO,CAAC,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,YAAY,CAAC;SAC1D;KACF,EACD,iBAAiB,CAClB,CAAC;IAEF,OAAO,CACL,oBAAC,iBAAiB,kBAChB,OAAO,EAAE,OAAO,IACZ,KAAK,IACT,WAAW,EAAE,KAAK,EAClB,mBAAmB,EAAE,iBAAiB,IAClC,kBAAkB,EAClB,6BAA6B,CAAC;QAChC,SAAS,EAAE;YACT,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,IAAI,kBAAkB,CAAC,KAAK,EAAE;SACU;KAClD,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { GeneratedAnalyticsMetadataFormFieldComponent } from './analytics-metadata/interfaces';\nimport { FormFieldProps } from './interfaces';\nimport InternalFormField from './internal';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\n\nexport { FormFieldProps };\n\nexport default function FormField({ stretch = false, ...props }: FormFieldProps) {\n const analyticsMetadata = getAnalyticsMetadataProps(props as BasePropsWithAnalyticsMetadata);\n const baseComponentProps = useBaseComponent(\n 'FormField',\n {\n props: {\n stretch,\n },\n metadata: {\n hasInstanceIdentifier: Boolean(analyticsMetadata?.instanceIdentifier),\n hasErrorContext: Boolean(analyticsMetadata?.errorContext),\n },\n },\n analyticsMetadata\n );\n\n return (\n <InternalFormField\n stretch={stretch}\n {...props}\n __hideLabel={false}\n __analyticsMetadata={analyticsMetadata}\n {...baseComponentProps}\n {...getAnalyticsMetadataAttribute({\n component: {\n name: 'awsui.FormField',\n label: `.${analyticsSelectors.label}`,\n } as GeneratedAnalyticsMetadataFormFieldComponent,\n })}\n />\n );\n}\n\napplyDisplayName(FormField, 'FormField');\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
import { AnalyticsMetadata } from '../internal/analytics/interfaces';
|
|
2
|
+
import { AnalyticsMetadata, ErrorContext } from '../internal/analytics/interfaces';
|
|
3
3
|
import { BaseComponentProps } from '../internal/base-component';
|
|
4
4
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
5
5
|
export interface FormFieldProps extends BaseComponentProps {
|
|
@@ -68,6 +68,7 @@ export interface FormFieldProps extends BaseComponentProps {
|
|
|
68
68
|
/**
|
|
69
69
|
* Specifies additional analytics-related metadata.
|
|
70
70
|
* * `instanceIdentifier` - A unique string that identifies this component instance in your application.
|
|
71
|
+
* * `errorContext` - Identifies the error category and sub-category.
|
|
71
72
|
* @analytics
|
|
72
73
|
*/
|
|
73
74
|
analyticsMetadata?: FormFieldProps.AnalyticsMetadata;
|
|
@@ -75,6 +76,7 @@ export interface FormFieldProps extends BaseComponentProps {
|
|
|
75
76
|
export declare namespace FormFieldProps {
|
|
76
77
|
interface AnalyticsMetadata {
|
|
77
78
|
instanceIdentifier?: string;
|
|
79
|
+
errorContext?: ErrorContext;
|
|
78
80
|
}
|
|
79
81
|
interface I18nStrings {
|
|
80
82
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/form-field/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/form-field/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC;IAEzC;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEjC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC;CACtD;AAED,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,iBAAiB;QAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B;IAED,UAAiB,WAAW;QAC1B;;WAEG;QACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAE5B;;WAEG;QACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;KAC/B;CACF;AAED,MAAM,WAAW,sBAAuB,SAAQ,cAAc,EAAE,0BAA0B,CAAC,cAAc,CAAC;IACxG;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;IACxC,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/form-field/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { CSSProperties } from 'react';\n\nimport { AnalyticsMetadata } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface FormFieldProps extends BaseComponentProps {\n /**\n * The ID of the primary form control. You can use this to set the\n * `for` attribute of a label for accessibility.\n *\n * If you don't set this property, the control group automatically sets\n * the label to the ID of an inner form control (for example, an [input](/components/input) component).\n * This only works well if you're using a single control in the form field.\n */\n controlId?: string;\n\n /**\n * Determines whether the primary control should expand to 12 columns.\n *\n * By default (or when this property is set to `false`), the primary control\n * occupies 9 columns. The secondary control uses the remaining 3 columns.\n * On smaller viewports, both components occupy 12 columns and stack on top of each other.\n *\n * If this property is set to `true`, the primary control uses the full\n * 12 columns. The secondary control (if present) also uses 12 columns, and the two\n * controls stack on top of each other.\n */\n stretch?: boolean;\n\n /**\n * The main label for the form field.\n */\n label?: React.ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: FormFieldProps.I18nStrings;\n\n /**\n * Use to display an 'Info' link next to the label.\n */\n info?: React.ReactNode;\n\n /**\n * The primary form control (for example, input, textarea, etc.).\n * @displayname control\n */\n children?: React.ReactNode;\n\n /**\n * A secondary control. You can use this for custom actions and content.\n */\n secondaryControl?: React.ReactNode;\n\n /**\n * Detailed information about the form field that's displayed below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Constraint text that's displayed below the control. Use this to provide\n * additional information about valid formats, etc.\n */\n constraintText?: React.ReactNode;\n\n /**\n * Text that displays as a validation error message. If this is set to a\n * non-empty string, it will render the form field as invalid.\n */\n errorText?: React.ReactNode;\n\n /**\n * Text that displays as a validation warning message. If this is set to a\n * non-empty string, it will render the form field in a warning state.\n */\n warningText?: React.ReactNode;\n\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * @analytics\n */\n analyticsMetadata?: FormFieldProps.AnalyticsMetadata;\n}\n\nexport namespace FormFieldProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n }\n\n export interface I18nStrings {\n /**\n * Provides a text alternative for the error icon in the error message.\n */\n errorIconAriaLabel?: string;\n\n /**\n * Provides a text alternative for the warning icon in the warning message.\n */\n warningIconAriaLabel?: string;\n }\n}\n\nexport interface InternalFormFieldProps extends FormFieldProps, InternalBaseComponentProps<HTMLDivElement> {\n /**\n * Visually hide the label.\n */\n __hideLabel?: boolean;\n\n /**\n * Disable the gutter applied by default.\n */\n __disableGutters?: boolean;\n __analyticsMetadata?: AnalyticsMetadata;\n __style?: CSSProperties;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/form-field/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { CSSProperties } from 'react';\n\nimport { AnalyticsMetadata, ErrorContext } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface FormFieldProps extends BaseComponentProps {\n /**\n * The ID of the primary form control. You can use this to set the\n * `for` attribute of a label for accessibility.\n *\n * If you don't set this property, the control group automatically sets\n * the label to the ID of an inner form control (for example, an [input](/components/input) component).\n * This only works well if you're using a single control in the form field.\n */\n controlId?: string;\n\n /**\n * Determines whether the primary control should expand to 12 columns.\n *\n * By default (or when this property is set to `false`), the primary control\n * occupies 9 columns. The secondary control uses the remaining 3 columns.\n * On smaller viewports, both components occupy 12 columns and stack on top of each other.\n *\n * If this property is set to `true`, the primary control uses the full\n * 12 columns. The secondary control (if present) also uses 12 columns, and the two\n * controls stack on top of each other.\n */\n stretch?: boolean;\n\n /**\n * The main label for the form field.\n */\n label?: React.ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: FormFieldProps.I18nStrings;\n\n /**\n * Use to display an 'Info' link next to the label.\n */\n info?: React.ReactNode;\n\n /**\n * The primary form control (for example, input, textarea, etc.).\n * @displayname control\n */\n children?: React.ReactNode;\n\n /**\n * A secondary control. You can use this for custom actions and content.\n */\n secondaryControl?: React.ReactNode;\n\n /**\n * Detailed information about the form field that's displayed below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Constraint text that's displayed below the control. Use this to provide\n * additional information about valid formats, etc.\n */\n constraintText?: React.ReactNode;\n\n /**\n * Text that displays as a validation error message. If this is set to a\n * non-empty string, it will render the form field as invalid.\n */\n errorText?: React.ReactNode;\n\n /**\n * Text that displays as a validation warning message. If this is set to a\n * non-empty string, it will render the form field in a warning state.\n */\n warningText?: React.ReactNode;\n\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * * `errorContext` - Identifies the error category and sub-category.\n * @analytics\n */\n analyticsMetadata?: FormFieldProps.AnalyticsMetadata;\n}\n\nexport namespace FormFieldProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n errorContext?: ErrorContext;\n }\n\n export interface I18nStrings {\n /**\n * Provides a text alternative for the error icon in the error message.\n */\n errorIconAriaLabel?: string;\n\n /**\n * Provides a text alternative for the warning icon in the warning message.\n */\n warningIconAriaLabel?: string;\n }\n}\n\nexport interface InternalFormFieldProps extends FormFieldProps, InternalBaseComponentProps<HTMLDivElement> {\n /**\n * Visually hide the label.\n */\n __hideLabel?: boolean;\n\n /**\n * Disable the gutter applied by default.\n */\n __disableGutters?: boolean;\n __analyticsMetadata?: AnalyticsMetadata;\n __style?: CSSProperties;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAyBjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAMtD,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,UAAU,qBAAqB;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,C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AC,EAAE,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,mBAAmB,eAqBvF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,qBAAqB,eAqB7F;AAED,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,iBAAiB,EACjB,QAAQ,GACT,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,eAMA;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,SAAS,EACT,OAAe,EACf,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,iBAAwB,EACxB,gBAAwB,EACxB,mBAA+B,EAC/B,OAAY,EACZ,GAAG,IAAI,EACR,EAAE,sBAAsB,eA+JxB"}
|
|
@@ -57,7 +57,7 @@ export default function InternalFormField(_a) {
|
|
|
57
57
|
const formFieldId = controlId || generatedControlId;
|
|
58
58
|
const { funnelIdentifier, funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();
|
|
59
59
|
const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();
|
|
60
|
-
const {
|
|
60
|
+
const { subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();
|
|
61
61
|
const showWarning = warningText && !errorText;
|
|
62
62
|
if (warningText && errorText) {
|
|
63
63
|
warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');
|
|
@@ -96,12 +96,11 @@ export default function InternalFormField(_a) {
|
|
|
96
96
|
stepName,
|
|
97
97
|
stepNameSelector,
|
|
98
98
|
stepIdentifier,
|
|
99
|
-
subStepErrorContext,
|
|
100
99
|
fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,
|
|
101
100
|
fieldLabelSelector: getFieldSlotSeletor(slotIds.label),
|
|
102
101
|
subStepAllSelector: getSubStepAllSelector(),
|
|
103
102
|
fieldIdentifier: __analyticsMetadata === null || __analyticsMetadata === void 0 ? void 0 : __analyticsMetadata.instanceIdentifier,
|
|
104
|
-
|
|
103
|
+
errorContext: __analyticsMetadata === null || __analyticsMetadata === void 0 ? void 0 : __analyticsMetadata.errorContext,
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
106
|
return () => {
|