@cloudscape-design/components 3.0.1041 → 3.0.1043

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/alert/index.d.ts.map +1 -1
  2. package/alert/index.js +12 -87
  3. package/alert/interfaces.d.ts +45 -0
  4. package/alert/interfaces.d.ts.map +1 -1
  5. package/alert/interfaces.js.map +1 -1
  6. package/alert/internal-do-not-use-core.js +93 -0
  7. package/alert/internal-do-not-use-core.js.map +1 -0
  8. package/alert/internal.d.ts +1 -0
  9. package/alert/internal.d.ts.map +1 -1
  10. package/alert/internal.js +5 -4
  11. package/alert/internal.js.map +1 -1
  12. package/alert/style.d.ts +22 -0
  13. package/alert/style.d.ts.map +1 -0
  14. package/alert/style.js +36 -0
  15. package/alert/style.js.map +1 -0
  16. package/alert/styles.css.js +27 -27
  17. package/alert/styles.scoped.css +47 -46
  18. package/alert/styles.selectors.js +27 -27
  19. package/app-layout/utils/use-global-scroll-padding.js +1 -1
  20. package/app-layout/utils/use-global-scroll-padding.js.map +1 -1
  21. package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.d.ts.map +1 -1
  22. package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.js +2 -4
  23. package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.js.map +1 -1
  24. package/container/index.js +1 -1
  25. package/container/interfaces.d.ts +45 -0
  26. package/container/interfaces.d.ts.map +1 -1
  27. package/container/interfaces.js.map +1 -1
  28. package/container/internal.d.ts +1 -0
  29. package/container/internal.d.ts.map +1 -1
  30. package/container/internal.js +9 -7
  31. package/container/internal.js.map +1 -1
  32. package/container/style.d.ts +6 -0
  33. package/container/style.d.ts.map +1 -0
  34. package/container/style.js +58 -0
  35. package/container/style.js.map +1 -0
  36. package/internal/base-component/styles.scoped.css +1 -1
  37. package/internal/environment.js +2 -2
  38. package/internal/environment.json +2 -2
  39. package/internal/manifest.json +1 -1
  40. package/package.json +1 -1
  41. package/popover/conditional-live-region.d.ts +10 -0
  42. package/popover/conditional-live-region.d.ts.map +1 -0
  43. package/popover/conditional-live-region.js +12 -0
  44. package/popover/conditional-live-region.js.map +1 -0
  45. package/popover/internal.d.ts.map +1 -1
  46. package/popover/internal.js +4 -2
  47. package/popover/internal.js.map +1 -1
  48. package/alert/index.js.map +0 -1
  49. package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.css.js +0 -7
  50. package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.scoped.css +0 -7
  51. package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.selectors.js +0 -8
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alert/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAYzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,mFAkGV,CAAC;AAGF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alert/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAYzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,mFAmGV,CAAC;AAGF,eAAe,KAAK,CAAC"}
package/alert/index.js CHANGED
@@ -1,93 +1,18 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- 'use client';
4
- import { __rest } from "tslib";
5
- import React, { useEffect } from 'react';
6
- import { useUniqueId } from '@cloudscape-design/component-toolkit/internal';
7
- import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
8
- import { FunnelMetrics } from '../internal/analytics';
9
- import { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
10
- import { getSubStepAllSelector, getTextFromSelector } from '../internal/analytics/selectors';
11
- import { getAnalyticsMetadataProps } from '../internal/base-component';
12
- import useBaseComponent from '../internal/hooks/use-base-component';
3
+ import React from 'react';
4
+
5
+ import CoreComponent from './internal-do-not-use-core';
13
6
  import { applyDisplayName } from '../internal/utils/apply-display-name';
14
- import InternalAlert from './internal';
15
- import analyticsSelectors from './analytics-metadata/styles.css.js';
16
- const Alert = React.forwardRef((_a, ref) => {
17
- var { type = 'info', visible = true } = _a, props = __rest(_a, ["type", "visible"]);
18
- const analyticsMetadata = getAnalyticsMetadataProps(props);
19
- const baseComponentProps = useBaseComponent('Alert', {
20
- props: { type, visible, dismissible: props.dismissible },
21
- }, analyticsMetadata);
22
- const { funnelIdentifier, funnelInteractionId, funnelErrorContext, submissionAttempt, funnelState, errorCount } = useFunnel();
23
- const { stepNumber, stepNameSelector, stepIdentifier, subStepCount, stepErrorContext, subStepConfiguration } = useFunnelStep();
24
- const { subStepSelector, subStepNameSelector, subStepIdentifier, subStepErrorContext } = useFunnelSubStep();
25
- const messageSlotId = useUniqueId('alert-');
26
- useEffect(() => {
27
- var _a, _b, _c, _d, _e;
28
- if (funnelInteractionId && visible && type === 'error' && funnelState.current !== 'complete') {
29
- const stepName = getTextFromSelector(stepNameSelector);
30
- const subStepName = getTextFromSelector(subStepNameSelector);
31
- errorCount.current++;
32
- // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.
33
- const errorIsVisible = ((_c = (_b = (_a = baseComponentProps.__internalRootRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : 0) > 0;
34
- if (errorIsVisible) {
35
- if (subStepSelector) {
36
- FunnelMetrics.funnelSubStepError({
37
- funnelInteractionId,
38
- funnelIdentifier,
39
- stepIdentifier,
40
- subStepSelector,
41
- subStepName,
42
- subStepNameSelector,
43
- stepNumber,
44
- stepName,
45
- stepNameSelector,
46
- subStepAllSelector: getSubStepAllSelector(),
47
- subStepIdentifier,
48
- errorContext: analyticsMetadata.errorContext || subStepErrorContext,
49
- });
50
- }
51
- else if (stepNameSelector) {
52
- FunnelMetrics.funnelStepError({
53
- funnelInteractionId,
54
- stepNumber,
55
- stepNameSelector,
56
- stepName,
57
- stepIdentifier,
58
- currentDocument: (_d = baseComponentProps.__internalRootRef.current) === null || _d === void 0 ? void 0 : _d.ownerDocument,
59
- totalSubSteps: subStepCount.current,
60
- funnelIdentifier,
61
- subStepAllSelector: getSubStepAllSelector(),
62
- errorContext: analyticsMetadata.errorContext || stepErrorContext,
63
- subStepConfiguration: (_e = subStepConfiguration.current) === null || _e === void 0 ? void 0 : _e.get(stepNumber),
64
- stepErrorSelector: '#' + messageSlotId,
65
- });
66
- }
67
- else {
68
- FunnelMetrics.funnelError({
69
- funnelIdentifier,
70
- funnelInteractionId,
71
- errorContext: analyticsMetadata.errorContext || funnelErrorContext,
72
- });
73
- }
74
- }
75
- return () => {
76
- // eslint-disable-next-line react-hooks/exhaustive-deps
77
- errorCount.current--;
78
- };
79
- }
80
- // eslint-disable-next-line react-hooks/exhaustive-deps
81
- }, [funnelInteractionId, visible, submissionAttempt, errorCount]);
82
- const componentAnalyticsMetadata = {
83
- name: 'awsui.Alert',
84
- label: `.${analyticsSelectors.header}`,
85
- properties: {
86
- type,
87
- },
88
- };
89
- return (React.createElement(InternalAlert, Object.assign({ type: type, visible: visible }, props, baseComponentProps, { ref: ref, messageSlotId: messageSlotId }, getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata }))));
7
+ import { validateProps } from '../internal/base-component';
8
+
9
+
10
+
11
+ const Alert = React.forwardRef((props, ref) => {
12
+ validateProps('Alert', props, ["style"], {});
13
+ return React.createElement(CoreComponent, {ref,...props});
90
14
  });
15
+
16
+
91
17
  applyDisplayName(Alert, 'Alert');
92
18
  export default Alert;
93
- //# sourceMappingURL=index.js.map
@@ -20,6 +20,32 @@ export declare namespace AlertProps {
20
20
  interface AnalyticsMetadata {
21
21
  errorContext?: ErrorContext;
22
22
  }
23
+ interface Style {
24
+ root?: {
25
+ background?: string;
26
+ borderColor?: string;
27
+ borderRadius?: string;
28
+ borderWidth?: string;
29
+ color?: string;
30
+ focusRing?: {
31
+ borderColor?: string;
32
+ borderRadius?: string;
33
+ borderWidth?: string;
34
+ };
35
+ };
36
+ dismissButton?: {
37
+ color?: {
38
+ active?: string;
39
+ default?: string;
40
+ hover?: string;
41
+ };
42
+ focusRing?: {
43
+ borderColor?: string;
44
+ borderRadius?: string;
45
+ borderWidth?: string;
46
+ };
47
+ };
48
+ }
23
49
  }
24
50
  export interface AlertProps extends BaseComponentProps {
25
51
  /**
@@ -92,4 +118,23 @@ export interface AlertProps extends BaseComponentProps {
92
118
  * @analytics
93
119
  */
94
120
  analyticsMetadata?: AlertProps.AnalyticsMetadata;
121
+ /**
122
+ * Specifies an object of selectors and properties that are used to apply custom styles.
123
+ *
124
+ * - `root.background` - (string) (Optional) Background for alert.
125
+ * - `root.borderColor` - (string) (Optional) Border color for alert.
126
+ * - `root.borderRadius` (string) - (Optional) Alert border radius.
127
+ * - `root.borderWidth` (string) - (Optional) Alert border width.
128
+ * - `root.color` - (string) (Optional) Text color for alert.
129
+ * - `root.focusRing.borderColor` - (string) (Optional) Alert focus ring border color.
130
+ * - `root.focusRing.borderRadius` (string) - (Optional) Alert button focus ring border radius.
131
+ * - `root.focusRing.borderWidth` (string) - (Optional) Alert button focus ring border width.
132
+ * - `dismissButton.color.active` - (string) (Optional) Color for dismiss button active state.
133
+ * - `dismissButton.color.default` - (string) (Optional) Color for dismiss button default state.
134
+ * - `dismissButton.color.hover` - (string) (Optional) Color for dismiss button hover state.
135
+ * - `dismissButton.focusRing.borderColor` - (string) (Optional) Dismiss button focus ring border color.
136
+ * - `dismissButton.focusRing.borderRadius` (string) - (Optional) Dismiss button focus ring border radius.
137
+ * - `dismissButton.focusRing.borderWidth` (string) - (Optional) Dismiss button focus ring border width.
138
+ * @awsuiSystem core
139
+ */
95
140
  }
@@ -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,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,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,CAAC;QAK9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAK5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAK9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAK3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;IAED,UAAiB,iBAAiB;QAChC,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B;CACF;AAED,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAEvB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAA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EAAE,yBAAyB,CAAC;IAC1C;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC;IACrC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC;IACjD;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC;CAC1B"}
@@ -1 +1 @@
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"]}
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 export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n color?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n dismissButton?: {\n color?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\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 * Specifies an object of selectors and properties that are used to apply custom styles.\n *\n * - `root.background` - (string) (Optional) Background for alert.\n * - `root.borderColor` - (string) (Optional) Border color for alert.\n * - `root.borderRadius` (string) - (Optional) Alert border radius.\n * - `root.borderWidth` (string) - (Optional) Alert border width.\n * - `root.color` - (string) (Optional) Text color for alert.\n * - `root.focusRing.borderColor` - (string) (Optional) Alert focus ring border color.\n * - `root.focusRing.borderRadius` (string) - (Optional) Alert button focus ring border radius.\n * - `root.focusRing.borderWidth` (string) - (Optional) Alert button focus ring border width.\n * - `dismissButton.color.active` - (string) (Optional) Color for dismiss button active state.\n * - `dismissButton.color.default` - (string) (Optional) Color for dismiss button default state.\n * - `dismissButton.color.hover` - (string) (Optional) Color for dismiss button hover state.\n * - `dismissButton.focusRing.borderColor` - (string) (Optional) Dismiss button focus ring border color.\n * - `dismissButton.focusRing.borderRadius` (string) - (Optional) Dismiss button focus ring border radius.\n * - `dismissButton.focusRing.borderWidth` (string) - (Optional) Dismiss button focus ring border width.\n * @awsuiSystem core\n */\n style?: AlertProps.Style;\n}\n"]}
@@ -0,0 +1,93 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ 'use client';
4
+ import { __rest } from "tslib";
5
+ import React, { useEffect } from 'react';
6
+ import { useUniqueId } from '@cloudscape-design/component-toolkit/internal';
7
+ import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
8
+ import { FunnelMetrics } from '../internal/analytics';
9
+ import { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
10
+ import { getSubStepAllSelector, getTextFromSelector } from '../internal/analytics/selectors';
11
+ import { getAnalyticsMetadataProps } from '../internal/base-component';
12
+ import useBaseComponent from '../internal/hooks/use-base-component';
13
+ import { applyDisplayName } from '../internal/utils/apply-display-name';
14
+ import InternalAlert from './internal';
15
+ import analyticsSelectors from './analytics-metadata/styles.css.js';
16
+ const Alert = React.forwardRef((_a, ref) => {
17
+ var { type = 'info', visible = true, style } = _a, props = __rest(_a, ["type", "visible", "style"]);
18
+ const analyticsMetadata = getAnalyticsMetadataProps(props);
19
+ const baseComponentProps = useBaseComponent('Alert', {
20
+ props: { type, visible, dismissible: props.dismissible },
21
+ }, analyticsMetadata);
22
+ const { funnelIdentifier, funnelInteractionId, funnelErrorContext, submissionAttempt, funnelState, errorCount } = useFunnel();
23
+ const { stepNumber, stepNameSelector, stepIdentifier, subStepCount, stepErrorContext, subStepConfiguration } = useFunnelStep();
24
+ const { subStepSelector, subStepNameSelector, subStepIdentifier, subStepErrorContext } = useFunnelSubStep();
25
+ const messageSlotId = useUniqueId('alert-');
26
+ useEffect(() => {
27
+ var _a, _b, _c, _d, _e;
28
+ if (funnelInteractionId && visible && type === 'error' && funnelState.current !== 'complete') {
29
+ const stepName = getTextFromSelector(stepNameSelector);
30
+ const subStepName = getTextFromSelector(subStepNameSelector);
31
+ errorCount.current++;
32
+ // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.
33
+ const errorIsVisible = ((_c = (_b = (_a = baseComponentProps.__internalRootRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : 0) > 0;
34
+ if (errorIsVisible) {
35
+ if (subStepSelector) {
36
+ FunnelMetrics.funnelSubStepError({
37
+ funnelInteractionId,
38
+ funnelIdentifier,
39
+ stepIdentifier,
40
+ subStepSelector,
41
+ subStepName,
42
+ subStepNameSelector,
43
+ stepNumber,
44
+ stepName,
45
+ stepNameSelector,
46
+ subStepAllSelector: getSubStepAllSelector(),
47
+ subStepIdentifier,
48
+ errorContext: analyticsMetadata.errorContext || subStepErrorContext,
49
+ });
50
+ }
51
+ else if (stepNameSelector) {
52
+ FunnelMetrics.funnelStepError({
53
+ funnelInteractionId,
54
+ stepNumber,
55
+ stepNameSelector,
56
+ stepName,
57
+ stepIdentifier,
58
+ currentDocument: (_d = baseComponentProps.__internalRootRef.current) === null || _d === void 0 ? void 0 : _d.ownerDocument,
59
+ totalSubSteps: subStepCount.current,
60
+ funnelIdentifier,
61
+ subStepAllSelector: getSubStepAllSelector(),
62
+ errorContext: analyticsMetadata.errorContext || stepErrorContext,
63
+ subStepConfiguration: (_e = subStepConfiguration.current) === null || _e === void 0 ? void 0 : _e.get(stepNumber),
64
+ stepErrorSelector: '#' + messageSlotId,
65
+ });
66
+ }
67
+ else {
68
+ FunnelMetrics.funnelError({
69
+ funnelIdentifier,
70
+ funnelInteractionId,
71
+ errorContext: analyticsMetadata.errorContext || funnelErrorContext,
72
+ });
73
+ }
74
+ }
75
+ return () => {
76
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
+ errorCount.current--;
78
+ };
79
+ }
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+ }, [funnelInteractionId, visible, submissionAttempt, errorCount]);
82
+ const componentAnalyticsMetadata = {
83
+ name: 'awsui.Alert',
84
+ label: `.${analyticsSelectors.header}`,
85
+ properties: {
86
+ type,
87
+ },
88
+ };
89
+ return (React.createElement(InternalAlert, Object.assign({ type: type, visible: visible }, props, baseComponentProps, { ref: ref, messageSlotId: messageSlotId, style: style }, getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata }))));
90
+ });
91
+ applyDisplayName(Alert, 'Alert');
92
+ export default Alert;
93
+ //# sourceMappingURL=internal-do-not-use-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/alert/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,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,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,EAA8D,EAAE,GAA8B,EAAE,EAAE;QAAlG,EAAE,IAAI,GAAG,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,KAA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F,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,kBACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,IACZ,KAAK,EACL,kBAAkB,IACtB,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,IACR,6BAA6B,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,EAC5E,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,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\n'use client';\nimport React, { useEffect } from 'react';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\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 { 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, style, ...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 style={style}\n {...getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })}\n />\n );\n }\n);\n\napplyDisplayName(Alert, 'Alert');\nexport default Alert;\n"]}
@@ -5,5 +5,6 @@ declare const InternalAlert: React.ForwardRefExoticComponent<AlertProps & {
5
5
  type: AlertProps.Type;
6
6
  } & InternalBaseComponentProps<HTMLDivElement> & {
7
7
  messageSlotId?: string | undefined;
8
+ style?: AlertProps['style'];
8
9
  } & React.RefAttributes<AlertProps.Ref>>;
9
10
  export default InternalAlert;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAgBtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAQlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoB1C,QAAA,MAAM,aAAa;;;;wCAmKlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAgBtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAQlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsB1C,QAAA,MAAM,aAAa;;;;YANP,UAAU,CAAC,OAAO,CAAC;wCA4K9B,CAAC;AAEF,eAAe,aAAa,CAAC"}
package/alert/internal.js CHANGED
@@ -19,6 +19,7 @@ import { awsuiPluginsInternal } from '../internal/plugins/api';
19
19
  import { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';
20
20
  import useContainerWidth from '../internal/utils/use-container-width';
21
21
  import { ActionsWrapper } from './actions-wrapper';
22
+ import { getAlertStyles, getDismissButtonStyles } from './style';
22
23
  import analyticsSelectors from './analytics-metadata/styles.css.js';
23
24
  import styles from './styles.css.js';
24
25
  const typeToIcon = {
@@ -31,7 +32,7 @@ const useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert
31
32
  const useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);
32
33
  const InternalAlert = React.forwardRef((_a, ref) => {
33
34
  var _b, _c;
34
- var { type, i18nStrings, visible = true, dismissible, children, header, buttonText, action, onDismiss, onButtonClick, __internalRootRef = null, statusIconAriaLabel: deprecatedStatusIconAriaLabel, dismissAriaLabel: deprecatedDismissAriaLabel, messageSlotId } = _a, rest = __rest(_a, ["type", "i18nStrings", "visible", "dismissible", "children", "header", "buttonText", "action", "onDismiss", "onButtonClick", "__internalRootRef", "statusIconAriaLabel", "dismissAriaLabel", "messageSlotId"]);
35
+ var { type, i18nStrings, visible = true, dismissible, children, header, buttonText, action, onDismiss, onButtonClick, __internalRootRef = null, statusIconAriaLabel: deprecatedStatusIconAriaLabel, dismissAriaLabel: deprecatedDismissAriaLabel, messageSlotId, style } = _a, rest = __rest(_a, ["type", "i18nStrings", "visible", "dismissible", "children", "header", "buttonText", "action", "onDismiss", "onButtonClick", "__internalRootRef", "statusIconAriaLabel", "dismissAriaLabel", "messageSlotId", "style"]);
35
36
  const baseProps = getBaseProps(rest);
36
37
  const i18n = useInternalI18n('alert');
37
38
  const focusRef = useRef(null);
@@ -57,9 +58,9 @@ const InternalAlert = React.forwardRef((_a, ref) => {
57
58
  return (React.createElement("div", Object.assign({}, baseProps, analyticsAttributes, { "aria-hidden": !visible, className: clsx(styles.root, { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden }, baseProps.className), ref: containerRef }),
58
59
  React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
59
60
  React.createElement(VisualContext, { contextName: "alert" },
60
- React.createElement("div", { className: clsx(styles.alert, styles[`type-${type}`], styles[`icon-size-${size}`], hasAction && styles['with-action'], dismissible && styles['with-dismiss']) },
61
+ React.createElement("div", { className: clsx(styles.alert, styles[`type-${type}`], styles[`icon-size-${size}`], hasAction && styles['with-action'], dismissible && styles['with-dismiss']), style: getAlertStyles(style) },
61
62
  React.createElement("div", { className: styles['alert-wrapper'] },
62
- React.createElement("div", { className: styles['alert-focus-wrapper'], tabIndex: -1, ref: focusRef },
63
+ React.createElement("div", { className: styles['alert-focus-wrapper'], tabIndex: -1, ref: focusRef, role: "group" },
63
64
  React.createElement("div", { className: clsx(styles.icon, styles.text) },
64
65
  React.createElement(InternalIcon, { name: typeToIcon[type], size: size, ariaLabel: statusIconAriaLabel })),
65
66
  React.createElement("div", { className: clsx(styles.message, styles.text), id: messageSlotId },
@@ -74,7 +75,7 @@ const InternalAlert = React.forwardRef((_a, ref) => {
74
75
  dismissible && (React.createElement("div", Object.assign({ className: styles.dismiss }, getAnalyticsMetadataAttribute({
75
76
  action: 'dismiss',
76
77
  })),
77
- React.createElement(InternalButton, { className: styles['dismiss-button'], variant: "icon", iconName: "close", formAction: "none", ariaLabel: dismissAriaLabel, onClick: () => fireNonCancelableEvent(onDismiss) }))))))));
78
+ React.createElement(InternalButton, { className: styles['dismiss-button'], variant: "icon", iconName: "close", formAction: "none", ariaLabel: dismissAriaLabel, onClick: () => fireNonCancelableEvent(onDismiss), style: getDismissButtonStyles(style) }))))))));
78
79
  });
79
80
  export default InternalAlert;
80
81
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/alert/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,YAA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ACD,GAAG,EAAE,qBAAqB,GACrB,CACH,CACF;wBACN,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,eAAe,EAAE;gCACf,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC;gCACjC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC;6BACtC,EACD,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,aAAa,CAAC,EAC1D,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;oBACL,WAAW,IAAI,CACd,2CACE,SAAS,EAAE,MAAM,CAAC,OAAO,IACrB,6BAA6B,CAAC;wBAChC,MAAM,EAAE,SAAS;qBACiC,CAAC;wBAErD,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,GAChD,CACE,CACP,CACG,CACQ,CACmB,CACjC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,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 { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { SomeRequired } from '../internal/types';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { ActionsWrapper } from './actions-wrapper';\nimport { GeneratedAnalyticsMetadataAlertDismiss } from './analytics-metadata/interfaces';\nimport { AlertProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> &\n InternalBaseComponentProps<HTMLDivElement> & {\n messageSlotId?: string;\n };\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);\n\nconst InternalAlert = React.forwardRef(\n (\n {\n type,\n i18nStrings,\n visible = true,\n dismissible,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef = null,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n ...rest\n }: InternalAlertProps,\n ref: React.Ref<AlertProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const focusRef = useRef<HTMLDivElement>(null);\n useForwardFocus(ref, focusRef);\n\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 });\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n const containerRef = useMergeRefs(containerMeasureRef, __internalRootRef);\n const headerRef = useMergeRefs(headerRefAction, headerRefContent);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh\n ? 'normal'\n : headerReplacementType !== 'remove' && header && contentReplacementType !== 'remove' && children\n ? 'big'\n : 'normal';\n\n const hasAction = Boolean(action || buttonText || discoveredActions.length);\n\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n const statusIconAriaLabel = i18n(\n `i18nStrings.${type}IconAriaLabel`,\n i18nStrings?.[`${type}IconAriaLabel`] ?? deprecatedStatusIconAriaLabel\n );\n\n const dismissAriaLabel = i18n(\n 'i18nStrings.dismissAriaLabel',\n i18nStrings?.dismissAriaLabel ?? i18n('dismissAriaLabel', deprecatedDismissAriaLabel)\n );\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden },\n baseProps.className\n )}\n ref={containerRef}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <VisualContext contextName=\"alert\">\n <div\n className={clsx(\n styles.alert,\n styles[`type-${type}`],\n styles[`icon-size-${size}`],\n hasAction && styles['with-action'],\n dismissible && styles['with-dismiss']\n )}\n >\n <div className={styles['alert-wrapper']}>\n <div className={styles['alert-focus-wrapper']} tabIndex={-1} ref={focusRef}>\n <div className={clsx(styles.icon, styles.text)}>\n <InternalIcon name={typeToIcon[type]} size={size} ariaLabel={statusIconAriaLabel} />\n </div>\n <div className={clsx(styles.message, styles.text)} id={messageSlotId}>\n <div\n className={clsx(\n header && styles.header,\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors.header\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(\n styles['header-replacement'],\n headerReplacementType !== 'replaced' ? styles.hidden : analyticsSelectors.header\n )}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(styles.content, contentReplacementType !== 'original' && styles.hidden)}\n ref={contentRef}\n >\n {children}\n </div>\n <div\n className={clsx(\n styles['content-replacement'],\n contentReplacementType !== 'replaced' && styles.hidden\n )}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles.action}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={() => fireNonCancelableEvent(onButtonClick)}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && (\n <div\n className={styles.dismiss}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataAlertDismiss>)}\n >\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissAriaLabel}\n onClick={() => fireNonCancelableEvent(onDismiss)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </LinkDefaultVariantContext.Provider>\n </div>\n );\n }\n);\n\nexport default InternalAlert;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/alert/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,+CAA+C,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,cAAc,EA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U,IAAI,MAAM,CAAC,MAAM,CACvD,EACD,GAAG,EAAE,qBAAqB,GACrB,CACH,CACF;wBACN,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,eAAe,EAAE;gCACf,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC;gCACjC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC;6BACtC,EACD,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,aAAa,CAAC,EAC1D,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;oBACL,WAAW,IAAI,CACd,2CACE,SAAS,EAAE,MAAM,CAAC,OAAO,IACrB,6BAA6B,CAAC;wBAChC,MAAM,EAAE,SAAS;qBACiC,CAAC;wBAErD,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAChD,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GACpC,CACE,CACP,CACG,CACQ,CACmB,CACjC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,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 { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { SomeRequired } from '../internal/types';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { ActionsWrapper } from './actions-wrapper';\nimport { GeneratedAnalyticsMetadataAlertDismiss } from './analytics-metadata/interfaces';\nimport { AlertProps } from './interfaces';\nimport { getAlertStyles, getDismissButtonStyles } from './style';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> &\n InternalBaseComponentProps<HTMLDivElement> & {\n messageSlotId?: string;\n style?: AlertProps['style'];\n };\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);\n\nconst InternalAlert = React.forwardRef(\n (\n {\n type,\n i18nStrings,\n visible = true,\n dismissible,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef = null,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n style,\n ...rest\n }: InternalAlertProps,\n ref: React.Ref<AlertProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const focusRef = useRef<HTMLDivElement>(null);\n useForwardFocus(ref, focusRef);\n\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 });\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n const containerRef = useMergeRefs(containerMeasureRef, __internalRootRef);\n const headerRef = useMergeRefs(headerRefAction, headerRefContent);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh\n ? 'normal'\n : headerReplacementType !== 'remove' && header && contentReplacementType !== 'remove' && children\n ? 'big'\n : 'normal';\n\n const hasAction = Boolean(action || buttonText || discoveredActions.length);\n\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n const statusIconAriaLabel = i18n(\n `i18nStrings.${type}IconAriaLabel`,\n i18nStrings?.[`${type}IconAriaLabel`] ?? deprecatedStatusIconAriaLabel\n );\n\n const dismissAriaLabel = i18n(\n 'i18nStrings.dismissAriaLabel',\n i18nStrings?.dismissAriaLabel ?? i18n('dismissAriaLabel', deprecatedDismissAriaLabel)\n );\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden },\n baseProps.className\n )}\n ref={containerRef}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <VisualContext contextName=\"alert\">\n <div\n className={clsx(\n styles.alert,\n styles[`type-${type}`],\n styles[`icon-size-${size}`],\n hasAction && styles['with-action'],\n dismissible && styles['with-dismiss']\n )}\n style={getAlertStyles(style)}\n >\n <div className={styles['alert-wrapper']}>\n <div className={styles['alert-focus-wrapper']} tabIndex={-1} ref={focusRef} role=\"group\">\n <div className={clsx(styles.icon, styles.text)}>\n <InternalIcon name={typeToIcon[type]} size={size} ariaLabel={statusIconAriaLabel} />\n </div>\n <div className={clsx(styles.message, styles.text)} id={messageSlotId}>\n <div\n className={clsx(\n header && styles.header,\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors.header\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(\n styles['header-replacement'],\n headerReplacementType !== 'replaced' ? styles.hidden : analyticsSelectors.header\n )}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(styles.content, contentReplacementType !== 'original' && styles.hidden)}\n ref={contentRef}\n >\n {children}\n </div>\n <div\n className={clsx(\n styles['content-replacement'],\n contentReplacementType !== 'replaced' && styles.hidden\n )}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles.action}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={() => fireNonCancelableEvent(onButtonClick)}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && (\n <div\n className={styles.dismiss}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataAlertDismiss>)}\n >\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissAriaLabel}\n onClick={() => fireNonCancelableEvent(onDismiss)}\n style={getDismissButtonStyles(style)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </LinkDefaultVariantContext.Provider>\n </div>\n );\n }\n);\n\nexport default InternalAlert;\n"]}
@@ -0,0 +1,22 @@
1
+ import { AlertProps } from './interfaces';
2
+ export declare function getAlertStyles(style: AlertProps['style']): {
3
+ background: string | undefined;
4
+ borderColor: string | undefined;
5
+ borderRadius: string | undefined;
6
+ borderWidth: string | undefined;
7
+ color: string | undefined;
8
+ } | undefined;
9
+ export declare function getDismissButtonStyles(style: AlertProps['style']): {
10
+ root: {
11
+ color: {
12
+ active: string | undefined;
13
+ default: string | undefined;
14
+ hover: string | undefined;
15
+ };
16
+ focusRing: {
17
+ borderColor: string | undefined;
18
+ borderRadius: string | undefined;
19
+ borderWidth: string | undefined;
20
+ };
21
+ };
22
+ } | undefined;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/alert/style.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;;;;;;cAiBxD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;;;;;;;;;;;;;cAmBhE"}
package/alert/style.js ADDED
@@ -0,0 +1,36 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { SYSTEM } from '../internal/environment';
4
+ import customCssProps from '../internal/generated/custom-css-properties';
5
+ export function getAlertStyles(style) {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7
+ if (SYSTEM !== 'core' || !(style === null || style === void 0 ? void 0 : style.root)) {
8
+ return undefined;
9
+ }
10
+ return Object.assign({ background: (_a = style.root) === null || _a === void 0 ? void 0 : _a.background, borderColor: (_b = style.root) === null || _b === void 0 ? void 0 : _b.borderColor, borderRadius: (_c = style.root) === null || _c === void 0 ? void 0 : _c.borderRadius, borderWidth: (_d = style.root) === null || _d === void 0 ? void 0 : _d.borderWidth, color: (_e = style.root) === null || _e === void 0 ? void 0 : _e.color }, (((_f = style.root) === null || _f === void 0 ? void 0 : _f.focusRing) && {
11
+ [customCssProps.styleFocusRingBorderColor]: (_g = style.root.focusRing) === null || _g === void 0 ? void 0 : _g.borderColor,
12
+ [customCssProps.styleFocusRingBorderRadius]: (_h = style.root.focusRing) === null || _h === void 0 ? void 0 : _h.borderRadius,
13
+ [customCssProps.styleFocusRingBorderWidth]: (_j = style.root.focusRing) === null || _j === void 0 ? void 0 : _j.borderWidth,
14
+ }));
15
+ }
16
+ export function getDismissButtonStyles(style) {
17
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
18
+ if (SYSTEM !== 'core' || !(style === null || style === void 0 ? void 0 : style.dismissButton)) {
19
+ return undefined;
20
+ }
21
+ return {
22
+ root: {
23
+ color: {
24
+ active: (_b = (_a = style.dismissButton) === null || _a === void 0 ? void 0 : _a.color) === null || _b === void 0 ? void 0 : _b.active,
25
+ default: (_d = (_c = style.dismissButton) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d.default,
26
+ hover: (_f = (_e = style.dismissButton) === null || _e === void 0 ? void 0 : _e.color) === null || _f === void 0 ? void 0 : _f.hover,
27
+ },
28
+ focusRing: {
29
+ borderColor: (_h = (_g = style.dismissButton) === null || _g === void 0 ? void 0 : _g.focusRing) === null || _h === void 0 ? void 0 : _h.borderColor,
30
+ borderRadius: (_k = (_j = style.dismissButton) === null || _j === void 0 ? void 0 : _j.focusRing) === null || _k === void 0 ? void 0 : _k.borderRadius,
31
+ borderWidth: (_m = (_l = style.dismissButton) === null || _l === void 0 ? void 0 : _l.focusRing) === null || _m === void 0 ? void 0 : _m.borderWidth,
32
+ },
33
+ },
34
+ };
35
+ }
36
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/alert/style.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAGzE,MAAM,UAAU,cAAc,CAAC,KAA0B;;IACvD,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,CAAA,KAA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AAA,MAAA,KAAK,CAAC,aAAa,0CAAE,SAAS,0CAAE,WAAW;gBACxD,YAAY,EAAE,MAAA,MAAA,KAAK,CAAC,aAAa,0CAAE,SAAS,0CAAE,YAAY;gBAC1D,WAAW,EAAE,MAAA,MAAA,KAAK,CAAC,aAAa,0CAAE,SAAS,0CAAE,WAAW;aACzD;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { SYSTEM } from '../internal/environment';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { AlertProps } from './interfaces';\n\nexport function getAlertStyles(style: AlertProps['style']) {\n if (SYSTEM !== 'core' || !style?.root) {\n return undefined;\n }\n\n return {\n background: style.root?.background,\n borderColor: style.root?.borderColor,\n borderRadius: style.root?.borderRadius,\n borderWidth: style.root?.borderWidth,\n color: style.root?.color,\n ...(style.root?.focusRing && {\n [customCssProps.styleFocusRingBorderColor]: style.root.focusRing?.borderColor,\n [customCssProps.styleFocusRingBorderRadius]: style.root.focusRing?.borderRadius,\n [customCssProps.styleFocusRingBorderWidth]: style.root.focusRing?.borderWidth,\n }),\n };\n}\n\nexport function getDismissButtonStyles(style: AlertProps['style']) {\n if (SYSTEM !== 'core' || !style?.dismissButton) {\n return undefined;\n }\n\n return {\n root: {\n color: {\n active: style.dismissButton?.color?.active,\n default: style.dismissButton?.color?.default,\n hover: style.dismissButton?.color?.hover,\n },\n focusRing: {\n borderColor: style.dismissButton?.focusRing?.borderColor,\n borderRadius: style.dismissButton?.focusRing?.borderRadius,\n borderWidth: style.dismissButton?.focusRing?.borderWidth,\n },\n },\n };\n}\n"]}
@@ -1,32 +1,32 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "alert": "awsui_alert_mx3cw_1v2tf_193",
5
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_mx3cw_1v2tf_1",
6
- "root": "awsui_root_mx3cw_1v2tf_215",
7
- "hidden": "awsui_hidden_mx3cw_1v2tf_250",
8
- "alert-wrapper": "awsui_alert-wrapper_mx3cw_1v2tf_298",
9
- "initial-hidden": "awsui_initial-hidden_mx3cw_1v2tf_310",
10
- "header": "awsui_header_mx3cw_1v2tf_315",
11
- "header-replacement": "awsui_header-replacement_mx3cw_1v2tf_316",
12
- "action": "awsui_action_mx3cw_1v2tf_320",
13
- "action-slot": "awsui_action-slot_mx3cw_1v2tf_324",
14
- "action-button": "awsui_action-button_mx3cw_1v2tf_325",
15
- "alert-focus-wrapper": "awsui_alert-focus-wrapper_mx3cw_1v2tf_329",
16
- "text": "awsui_text_mx3cw_1v2tf_360",
17
- "icon": "awsui_icon_mx3cw_1v2tf_367",
18
- "message": "awsui_message_mx3cw_1v2tf_370",
19
- "action-wrapped": "awsui_action-wrapped_mx3cw_1v2tf_374",
20
- "icon-size-medium": "awsui_icon-size-medium_mx3cw_1v2tf_378",
21
- "icon-size-big": "awsui_icon-size-big_mx3cw_1v2tf_382",
22
- "icon-size-normal": "awsui_icon-size-normal_mx3cw_1v2tf_386",
23
- "content": "awsui_content_mx3cw_1v2tf_390",
24
- "content-replacement": "awsui_content-replacement_mx3cw_1v2tf_391",
25
- "dismiss": "awsui_dismiss_mx3cw_1v2tf_395",
26
- "dismiss-button": "awsui_dismiss-button_mx3cw_1v2tf_400",
27
- "type-error": "awsui_type-error_mx3cw_1v2tf_404",
28
- "type-warning": "awsui_type-warning_mx3cw_1v2tf_412",
29
- "type-success": "awsui_type-success_mx3cw_1v2tf_420",
30
- "type-info": "awsui_type-info_mx3cw_1v2tf_428"
4
+ "alert": "awsui_alert_mx3cw_1iibl_193",
5
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_mx3cw_1iibl_1",
6
+ "root": "awsui_root_mx3cw_1iibl_215",
7
+ "hidden": "awsui_hidden_mx3cw_1iibl_250",
8
+ "alert-wrapper": "awsui_alert-wrapper_mx3cw_1iibl_299",
9
+ "initial-hidden": "awsui_initial-hidden_mx3cw_1iibl_311",
10
+ "header": "awsui_header_mx3cw_1iibl_316",
11
+ "header-replacement": "awsui_header-replacement_mx3cw_1iibl_317",
12
+ "action": "awsui_action_mx3cw_1iibl_321",
13
+ "action-slot": "awsui_action-slot_mx3cw_1iibl_325",
14
+ "action-button": "awsui_action-button_mx3cw_1iibl_326",
15
+ "alert-focus-wrapper": "awsui_alert-focus-wrapper_mx3cw_1iibl_330",
16
+ "text": "awsui_text_mx3cw_1iibl_361",
17
+ "icon": "awsui_icon_mx3cw_1iibl_368",
18
+ "message": "awsui_message_mx3cw_1iibl_371",
19
+ "action-wrapped": "awsui_action-wrapped_mx3cw_1iibl_375",
20
+ "icon-size-medium": "awsui_icon-size-medium_mx3cw_1iibl_379",
21
+ "icon-size-big": "awsui_icon-size-big_mx3cw_1iibl_383",
22
+ "icon-size-normal": "awsui_icon-size-normal_mx3cw_1iibl_387",
23
+ "content": "awsui_content_mx3cw_1iibl_391",
24
+ "content-replacement": "awsui_content-replacement_mx3cw_1iibl_392",
25
+ "dismiss": "awsui_dismiss_mx3cw_1iibl_396",
26
+ "dismiss-button": "awsui_dismiss-button_mx3cw_1iibl_401",
27
+ "type-error": "awsui_type-error_mx3cw_1iibl_405",
28
+ "type-warning": "awsui_type-warning_mx3cw_1iibl_413",
29
+ "type-success": "awsui_type-success_mx3cw_1iibl_421",
30
+ "type-info": "awsui_type-info_mx3cw_1iibl_429"
31
31
  };
32
32