@cloudscape-design/components-themeable 3.0.363 → 3.0.365
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/alert/styles.scss +41 -10
- package/lib/internal/scss/breadcrumb-group/item/styles.scss +1 -1
- package/lib/internal/scss/internal/styles/links.scss +2 -0
- package/lib/internal/scss/link/constants.scss +7 -6
- package/lib/internal/template/alert/index.d.ts +3 -2
- package/lib/internal/template/alert/index.d.ts.map +1 -1
- package/lib/internal/template/alert/index.js +4 -3
- package/lib/internal/template/alert/index.js.map +1 -1
- package/lib/internal/template/alert/interfaces.d.ts +6 -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/alert/internal.d.ts +5 -5
- package/lib/internal/template/alert/internal.d.ts.map +1 -1
- package/lib/internal/template/alert/internal.js +22 -14
- package/lib/internal/template/alert/internal.js.map +1 -1
- package/lib/internal/template/alert/styles.css.js +24 -19
- package/lib/internal/template/alert/styles.scoped.css +72 -35
- package/lib/internal/template/alert/styles.selectors.js +24 -19
- package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +30 -30
- package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
- package/lib/internal/template/app-layout/visual-refresh/background.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/background.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh/background.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/context.d.ts +2 -1
- package/lib/internal/template/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/context.js +9 -11
- package/lib/internal/template/app-layout/visual-refresh/context.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/layout.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/layout.js +3 -11
- package/lib/internal/template/app-layout/visual-refresh/layout.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/use-background-overlap.d.ts +16 -0
- package/lib/internal/template/app-layout/visual-refresh/use-background-overlap.d.ts.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh/use-background-overlap.js +41 -0
- package/lib/internal/template/app-layout/visual-refresh/use-background-overlap.js.map +1 -0
- package/lib/internal/template/attribute-editor/styles.css.js +14 -14
- package/lib/internal/template/attribute-editor/styles.scoped.css +30 -31
- package/lib/internal/template/attribute-editor/styles.selectors.js +14 -14
- package/lib/internal/template/breadcrumb-group/item/styles.css.js +9 -9
- package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +21 -21
- package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +9 -9
- package/lib/internal/template/button/styles.css.js +20 -20
- package/lib/internal/template/button/styles.scoped.css +152 -152
- package/lib/internal/template/button/styles.selectors.js +20 -20
- package/lib/internal/template/cards/index.d.ts.map +1 -1
- package/lib/internal/template/cards/index.js +9 -7
- package/lib/internal/template/cards/index.js.map +1 -1
- package/lib/internal/template/help-panel/index.d.ts.map +1 -1
- package/lib/internal/template/help-panel/index.js +3 -1
- package/lib/internal/template/help-panel/index.js.map +1 -1
- package/lib/internal/template/help-panel/styles.css.js +4 -4
- package/lib/internal/template/help-panel/styles.scoped.css +71 -72
- package/lib/internal/template/help-panel/styles.selectors.js +4 -4
- package/lib/internal/template/internal/base-component/styles.scoped.css +11 -26
- package/lib/internal/template/internal/components/token-list/styles.css.js +9 -9
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +22 -22
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +9 -9
- package/lib/internal/template/internal/context/link-default-variant-context.d.ts +6 -0
- package/lib/internal/template/internal/context/link-default-variant-context.d.ts.map +1 -0
- package/lib/internal/template/internal/context/link-default-variant-context.js +7 -0
- package/lib/internal/template/internal/context/link-default-variant-context.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/internal/generated/theming/index.cjs +0 -40
- package/lib/internal/template/internal/generated/theming/index.js +0 -40
- package/lib/internal/template/internal/hooks/container-queries/use-resize-observer.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/container-queries/use-resize-observer.js +1 -9
- package/lib/internal/template/internal/hooks/container-queries/use-resize-observer.js.map +1 -1
- package/lib/internal/template/internal/hooks/container-queries/utils.d.ts +4 -0
- package/lib/internal/template/internal/hooks/container-queries/utils.d.ts.map +1 -0
- package/lib/internal/template/internal/hooks/container-queries/utils.js +10 -0
- package/lib/internal/template/internal/hooks/container-queries/utils.js.map +1 -0
- package/lib/internal/template/internal/hooks/use-dynamic-overlap/index.d.ts +1 -1
- package/lib/internal/template/internal/hooks/use-dynamic-overlap/index.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/use-dynamic-overlap/index.js +11 -5
- package/lib/internal/template/internal/hooks/use-dynamic-overlap/index.js.map +1 -1
- package/lib/internal/template/link/index.d.ts.map +1 -1
- package/lib/internal/template/link/index.js +2 -2
- package/lib/internal/template/link/index.js.map +1 -1
- package/lib/internal/template/link/interfaces.d.ts +7 -0
- package/lib/internal/template/link/interfaces.d.ts.map +1 -1
- package/lib/internal/template/link/interfaces.js.map +1 -1
- package/lib/internal/template/link/internal.d.ts.map +1 -1
- package/lib/internal/template/link/internal.js +4 -1
- package/lib/internal/template/link/internal.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +91 -90
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/popover/internal.d.ts.map +1 -1
- package/lib/internal/template/popover/internal.js +3 -1
- package/lib/internal/template/popover/internal.js.map +1 -1
- package/lib/internal/template/table/internal.d.ts.map +1 -1
- package/lib/internal/template/table/internal.js +58 -56
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/table/sticky-columns/index.d.ts +2 -1
- package/lib/internal/template/table/sticky-columns/index.d.ts.map +1 -1
- package/lib/internal/template/table/sticky-columns/index.js +1 -1
- package/lib/internal/template/table/sticky-columns/index.js.map +1 -1
- package/lib/internal/template/table/sticky-columns/interfaces.d.ts +31 -0
- package/lib/internal/template/table/sticky-columns/interfaces.d.ts.map +1 -0
- package/lib/internal/template/table/sticky-columns/interfaces.js +4 -0
- package/lib/internal/template/table/sticky-columns/interfaces.js.map +1 -0
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.d.ts +1 -25
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.d.ts.map +1 -1
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.js +18 -51
- package/lib/internal/template/table/sticky-columns/use-sticky-columns.js.map +1 -1
- package/lib/internal/template/table/sticky-columns/utils.d.ts +5 -0
- package/lib/internal/template/table/sticky-columns/utils.d.ts.map +1 -0
- package/lib/internal/template/table/sticky-columns/utils.js +42 -0
- package/lib/internal/template/table/sticky-columns/utils.js.map +1 -0
- package/lib/internal/template/tag-editor/styles.css.js +3 -3
- package/lib/internal/template/tag-editor/styles.scoped.css +12 -12
- package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
- package/lib/internal/template/text-content/styles.css.js +1 -1
- package/lib/internal/template/text-content/styles.scoped.css +72 -74
- package/lib/internal/template/text-content/styles.selectors.js +1 -1
- package/lib/internal/template/tutorial-panel/components/tutorial-detail-view/congratulation-screen.js +1 -1
- package/lib/internal/template/tutorial-panel/components/tutorial-detail-view/congratulation-screen.js.map +1 -1
- package/lib/internal/template/tutorial-panel/components/tutorial-list/index.js +1 -1
- package/lib/internal/template/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/lib/internal/template/wizard/wizard-navigation.js +1 -1
- package/lib/internal/template/wizard/wizard-navigation.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
@use 'sass:map';
|
|
7
7
|
@use '../internal/styles/tokens' as awsui;
|
|
8
8
|
@use '../internal/styles' as styles;
|
|
9
|
+
@use '../internal/hooks/focus-visible' as focus-visible;
|
|
9
10
|
|
|
10
11
|
@use './motion';
|
|
11
12
|
|
|
@@ -25,6 +26,9 @@
|
|
|
25
26
|
display: flex;
|
|
26
27
|
justify-content: flex-start;
|
|
27
28
|
align-items: flex-start;
|
|
29
|
+
// display: grid;
|
|
30
|
+
grid-template-columns: auto auto 1fr;
|
|
31
|
+
|
|
28
32
|
border-radius: awsui.$border-radius-alert;
|
|
29
33
|
border: awsui.$border-field-width solid;
|
|
30
34
|
padding: awsui.$space-alert-vertical awsui.$space-alert-horizontal;
|
|
@@ -43,13 +47,30 @@
|
|
|
43
47
|
|
|
44
48
|
.action {
|
|
45
49
|
white-space: nowrap;
|
|
46
|
-
margin-left: awsui.$space-
|
|
50
|
+
margin-left: awsui.$space-alert-action-left;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
.action-button {
|
|
50
54
|
/* used in test-utils */
|
|
51
55
|
}
|
|
52
56
|
|
|
57
|
+
.alert-focus-wrapper {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex: 1 1 0%;
|
|
60
|
+
|
|
61
|
+
&:focus {
|
|
62
|
+
outline: none;
|
|
63
|
+
}
|
|
64
|
+
@include focus-visible.when-visible {
|
|
65
|
+
@include styles.focus-highlight(awsui.$space-button-focus-outline-gutter);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.alert-mobile-block {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex: 1 1 0%;
|
|
72
|
+
}
|
|
73
|
+
|
|
53
74
|
.text {
|
|
54
75
|
padding: awsui.$border-field-width 0; // To account for vertical misalignment due to button borders
|
|
55
76
|
margin: awsui.$space-scaled-xxs awsui.$space-xxs;
|
|
@@ -58,18 +79,28 @@
|
|
|
58
79
|
}
|
|
59
80
|
&.message {
|
|
60
81
|
margin-right: awsui.$space-alert-message-right;
|
|
61
|
-
& + .action {
|
|
62
|
-
margin-left: awsui.$space-alert-action-left;
|
|
63
|
-
}
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
|
|
67
85
|
/* stylelint-disable selector-max-type */
|
|
68
|
-
.root.breakpoint-default > div > .alert
|
|
69
|
-
|
|
70
|
-
& > .
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
.root.breakpoint-default > div > .alert {
|
|
87
|
+
// Below the breakpoint, arrange actions below the content
|
|
88
|
+
& > .alert-mobile-block {
|
|
89
|
+
display: block;
|
|
90
|
+
& > .action {
|
|
91
|
+
margin-bottom: awsui.$space-xxs;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Indent actions according to the size of the alert icon
|
|
96
|
+
&.icon-size-medium > .alert-mobile-block > .action {
|
|
97
|
+
margin-left: calc(#{awsui.$size-icon-medium} + #{awsui.$space-xs});
|
|
98
|
+
}
|
|
99
|
+
&.icon-size-big > .alert-mobile-block > .action {
|
|
100
|
+
margin-left: calc(#{awsui.$size-icon-big} + #{awsui.$space-xs});
|
|
101
|
+
}
|
|
102
|
+
&.icon-size-normal > .alert-mobile-block > .action {
|
|
103
|
+
margin-left: calc(#{awsui.$size-icon-normal} + #{awsui.$space-xs});
|
|
73
104
|
}
|
|
74
105
|
}
|
|
75
106
|
/* stylelint-enable selector-max-type */
|
|
@@ -122,7 +153,7 @@ $_text-colors: (
|
|
|
122
153
|
.type-#{$type} {
|
|
123
154
|
border-color: #{map.get($_border-colors, $type)};
|
|
124
155
|
background-color: #{map.get($_background-colors, $type)};
|
|
125
|
-
> .icon {
|
|
156
|
+
> .alert-mobile-block > .alert-focus-wrapper > .icon {
|
|
126
157
|
color: #{map.get($_text-colors, $type)};
|
|
127
158
|
}
|
|
128
159
|
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
text-decoration: map.get($variant, 'decoration');
|
|
20
20
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
21
21
|
text-decoration-color: map.get($variant, 'decoration-color');
|
|
22
|
+
text-decoration-thickness: map.get($variant, 'decoration-thickness');
|
|
22
23
|
|
|
23
24
|
@include styles.with-motion {
|
|
24
25
|
transition-property: color, text-decoration;
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
text-decoration: underline;
|
|
45
46
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
46
47
|
text-decoration-color: map.get($variant, 'decoration-color-hover');
|
|
48
|
+
text-decoration-thickness: map.get($variant, 'decoration-thickness');
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -22,11 +22,11 @@ $link-variants: (
|
|
|
22
22
|
'text-color-default': awsui.$color-text-link-default,
|
|
23
23
|
'text-color-hover': awsui.$color-text-link-hover,
|
|
24
24
|
'text-color-active': awsui.$color-text-link-hover,
|
|
25
|
-
'font-weight':
|
|
26
|
-
'decoration':
|
|
27
|
-
'decoration-color':
|
|
25
|
+
'font-weight': inherit,
|
|
26
|
+
'decoration': underline,
|
|
27
|
+
'decoration-color': currentColor,
|
|
28
28
|
'decoration-color-hover': currentColor,
|
|
29
|
-
'letter-spacing':
|
|
29
|
+
'letter-spacing': normal,
|
|
30
30
|
),
|
|
31
31
|
'info': (
|
|
32
32
|
'text-color-default': awsui.$color-text-link-default,
|
|
@@ -43,9 +43,10 @@ $link-variants: (
|
|
|
43
43
|
'text-color-hover': awsui.$color-text-link-hover,
|
|
44
44
|
'text-color-active': awsui.$color-text-link-hover,
|
|
45
45
|
'font-weight': awsui.$font-box-value-large-weight,
|
|
46
|
-
'decoration':
|
|
47
|
-
'decoration-color':
|
|
46
|
+
'decoration': underline,
|
|
47
|
+
'decoration-color': currentColor,
|
|
48
48
|
'decoration-color-hover': currentColor,
|
|
49
|
+
'decoration-thickness': 0.3rem,
|
|
49
50
|
),
|
|
50
51
|
'top-navigation': (
|
|
51
52
|
'text-color-default': awsui.$color-text-interactive-default,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { AlertProps } from './interfaces';
|
|
3
3
|
export { AlertProps };
|
|
4
|
-
|
|
4
|
+
declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<AlertProps.Ref>>;
|
|
5
|
+
export default Alert;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["alert/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["alert/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,mFA2CV,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
|
@@ -8,7 +8,7 @@ import useBaseComponent from '../internal/hooks/use-base-component';
|
|
|
8
8
|
import { FunnelMetrics } from '../internal/analytics';
|
|
9
9
|
import { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
|
|
10
10
|
import { getNameFromSelector, getSubStepAllSelector } from '../internal/analytics/selectors';
|
|
11
|
-
|
|
11
|
+
const Alert = React.forwardRef((_a, ref) => {
|
|
12
12
|
var { type = 'info', visible = true } = _a, props = __rest(_a, ["type", "visible"]);
|
|
13
13
|
const baseComponentProps = useBaseComponent('Alert');
|
|
14
14
|
const { funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();
|
|
@@ -43,7 +43,8 @@ export default function Alert(_a) {
|
|
|
43
43
|
}
|
|
44
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
45
|
}, [funnelInteractionId, visible, submissionAttempt, errorCount]);
|
|
46
|
-
return React.createElement(InternalAlert, Object.assign({ type: type, visible: visible }, props, baseComponentProps));
|
|
47
|
-
}
|
|
46
|
+
return React.createElement(InternalAlert, Object.assign({ type: type, visible: visible }, props, baseComponentProps, { ref: ref }));
|
|
47
|
+
});
|
|
48
48
|
applyDisplayName(Alert, 'Alert');
|
|
49
|
+
export default Alert;
|
|
49
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["alert/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAI7F,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["alert/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAI7F,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CAAC,EAAuD,EAAE,GAA8B,EAAE,EAAE;QAA3F,EAAE,I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,IAAM,KAAK,EAAM,kBAAkB,IAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACtG,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\nimport React, { useEffect } from 'react';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { AlertProps } from './interfaces';\nimport InternalAlert from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getNameFromSelector, getSubStepAllSelector } from '../internal/analytics/selectors';\n\nexport { AlertProps };\n\nconst Alert = React.forwardRef(\n ({ type = 'info', visible = true, ...props }: AlertProps, ref: React.Ref<AlertProps.Ref>) => {\n const baseComponentProps = useBaseComponent('Alert');\n\n const { funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n useEffect(() => {\n if (funnelInteractionId && visible && type === 'error' && funnelState.current !== 'complete') {\n const stepName = getNameFromSelector(stepNameSelector);\n const subStepName = getNameFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n if (subStepSelector) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n });\n } else {\n FunnelMetrics.funnelError({\n funnelInteractionId,\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 return <InternalAlert type={type} visible={visible} {...props} {...baseComponentProps} ref={ref} />;\n }\n);\n\napplyDisplayName(Alert, 'Alert');\nexport default Alert;\n"]}
|
|
@@ -3,6 +3,12 @@ import { BaseComponentProps } from '../internal/base-component';
|
|
|
3
3
|
import { NonCancelableEventHandler } from '../internal/events';
|
|
4
4
|
export declare namespace AlertProps {
|
|
5
5
|
type Type = 'success' | 'error' | 'warning' | 'info';
|
|
6
|
+
interface Ref {
|
|
7
|
+
/**
|
|
8
|
+
* Sets focus on the alert content.
|
|
9
|
+
*/
|
|
10
|
+
focus(): void;
|
|
11
|
+
}
|
|
6
12
|
}
|
|
7
13
|
export interface AlertProps extends BaseComponentProps {
|
|
8
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["alert/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,yBAAiB,UAAU,CAAC;IAC1B,KAAY,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["alert/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;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;CACF;AAED,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAEvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,yBAAyB,CAAC;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["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';\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\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 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 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"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["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';\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\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 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 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"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { AlertProps } from './interfaces';
|
|
3
3
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
export
|
|
4
|
+
declare const InternalAlert: React.ForwardRefExoticComponent<AlertProps & {
|
|
5
|
+
type: AlertProps.Type;
|
|
6
|
+
} & InternalBaseComponentProps & React.RefAttributes<AlertProps.Ref>>;
|
|
7
|
+
export default InternalAlert;
|
|
8
8
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["alert/internal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["alert/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAYtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAgBlF,QAAA,MAAM,aAAa;;qEA8FlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { InternalButton } from '../button/internal';
|
|
7
7
|
import InternalIcon from '../icon/internal';
|
|
@@ -11,19 +11,23 @@ import styles from './styles.css.js';
|
|
|
11
11
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
12
12
|
import { useContainerBreakpoints } from '../internal/hooks/container-queries';
|
|
13
13
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
14
|
+
import useForwardFocus from '../internal/hooks/forward-focus';
|
|
14
15
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
15
16
|
import { useInternalI18n } from '../i18n/context';
|
|
16
17
|
import { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';
|
|
18
|
+
import { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';
|
|
17
19
|
const typeToIcon = {
|
|
18
20
|
error: 'status-negative',
|
|
19
21
|
warning: 'status-warning',
|
|
20
22
|
success: 'status-positive',
|
|
21
23
|
info: 'status-info',
|
|
22
24
|
};
|
|
23
|
-
|
|
25
|
+
const InternalAlert = React.forwardRef((_a, ref) => {
|
|
24
26
|
var { type, statusIconAriaLabel, visible = true, dismissible, dismissAriaLabel, children, header, buttonText, action, onDismiss, onButtonClick, __internalRootRef = null } = _a, rest = __rest(_a, ["type", "statusIconAriaLabel", "visible", "dismissible", "dismissAriaLabel", "children", "header", "buttonText", "action", "onDismiss", "onButtonClick", "__internalRootRef"]);
|
|
25
27
|
const baseProps = getBaseProps(rest);
|
|
26
28
|
const i18n = useInternalI18n('alert');
|
|
29
|
+
const focusRef = useRef(null);
|
|
30
|
+
useForwardFocus(ref, focusRef);
|
|
27
31
|
const [breakpoint, breakpointRef] = useContainerBreakpoints(['xs']);
|
|
28
32
|
const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);
|
|
29
33
|
const isRefresh = useVisualRefresh();
|
|
@@ -34,16 +38,20 @@ export default function InternalAlert(_a) {
|
|
|
34
38
|
[DATA_ATTR_ANALYTICS_ALERT]: type,
|
|
35
39
|
};
|
|
36
40
|
return (React.createElement("div", Object.assign({}, baseProps, analyticsAttributes, { "aria-hidden": !visible, className: clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, styles[`breakpoint-${breakpoint}`]), ref: mergedRef }),
|
|
37
|
-
React.createElement(
|
|
38
|
-
React.createElement(
|
|
39
|
-
React.createElement("div", { className: clsx(styles.
|
|
40
|
-
React.createElement(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
41
|
+
React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
|
|
42
|
+
React.createElement(VisualContext, { contextName: "alert" },
|
|
43
|
+
React.createElement("div", { className: clsx(styles.alert, styles[`type-${type}`], styles[`icon-size-${size}`]) },
|
|
44
|
+
React.createElement("div", { className: styles['alert-mobile-block'] },
|
|
45
|
+
React.createElement("div", { className: styles['alert-focus-wrapper'], tabIndex: -1, ref: focusRef },
|
|
46
|
+
React.createElement("div", { className: clsx(styles.icon, styles.text), role: "img", "aria-label": statusIconAriaLabel },
|
|
47
|
+
React.createElement(InternalIcon, { name: typeToIcon[type], size: size })),
|
|
48
|
+
React.createElement("div", { className: styles.body },
|
|
49
|
+
React.createElement("div", { className: clsx(styles.message, styles.text) },
|
|
50
|
+
header && React.createElement("div", { className: styles.header }, header),
|
|
51
|
+
React.createElement("div", { className: styles.content }, children)))),
|
|
52
|
+
hasAction && React.createElement("div", { className: styles.action }, actionButton)),
|
|
53
|
+
dismissible && (React.createElement("div", { className: styles.dismiss },
|
|
54
|
+
React.createElement(InternalButton, { className: styles['dismiss-button'], variant: "icon", iconName: "close", formAction: "none", ariaLabel: i18n('dismissAriaLabel', dismissAriaLabel), onClick: () => fireNonCancelableEvent(onDismiss) }))))))));
|
|
55
|
+
});
|
|
56
|
+
export default InternalAlert;
|
|
49
57
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["alert/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["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;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAE7F,MAAM,UAAU,GAA+C;IAC7D,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,iBAAiB;IAC1B,IAAI,EAAE,aAAa;CACpB,CAAC;AAIF,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EAcqB,E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D;oBACL,WAAW,IAAI,CACd,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO;wBAC5B,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EACrD,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';\nimport { InternalButton } from '../button/internal';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { AlertProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\nimport { useInternalI18n } from '../i18n/context';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\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'> & InternalBaseComponentProps;\n\nconst InternalAlert = React.forwardRef(\n (\n {\n type,\n statusIconAriaLabel,\n visible = true,\n dismissible,\n dismissAriaLabel,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef = null,\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 [breakpoint, breakpointRef] = useContainerBreakpoints(['xs']);\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh ? 'normal' : header && children ? 'big' : 'normal';\n\n const actionButton = action || (\n <InternalButton\n className={styles['action-button']}\n onClick={() => fireNonCancelableEvent(onButtonClick)}\n formAction=\"none\"\n >\n {buttonText}\n </InternalButton>\n );\n\n const hasAction = Boolean(action || buttonText);\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n styles[`breakpoint-${breakpoint}`]\n )}\n ref={mergedRef}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <VisualContext contextName=\"alert\">\n <div className={clsx(styles.alert, styles[`type-${type}`], styles[`icon-size-${size}`])}>\n <div className={styles['alert-mobile-block']}>\n <div className={styles['alert-focus-wrapper']} tabIndex={-1} ref={focusRef}>\n <div className={clsx(styles.icon, styles.text)} role=\"img\" aria-label={statusIconAriaLabel}>\n <InternalIcon name={typeToIcon[type]} size={size} />\n </div>\n <div className={styles.body}>\n <div className={clsx(styles.message, styles.text)}>\n {header && <div className={styles.header}>{header}</div>}\n <div className={styles.content}>{children}</div>\n </div>\n </div>\n </div>\n {hasAction && <div className={styles.action}>{actionButton}</div>}\n </div>\n {dismissible && (\n <div className={styles.dismiss}>\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={i18n('dismissAriaLabel', 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,24 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"alert": "
|
|
5
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
6
|
-
"root": "
|
|
7
|
-
"hidden": "
|
|
8
|
-
"body": "
|
|
9
|
-
"header": "
|
|
10
|
-
"action": "
|
|
11
|
-
"action-button": "awsui_action-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
4
|
+
"alert": "awsui_alert_mx3cw_1pmxt_93",
|
|
5
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_mx3cw_1pmxt_1",
|
|
6
|
+
"root": "awsui_root_mx3cw_1pmxt_119",
|
|
7
|
+
"hidden": "awsui_hidden_mx3cw_1pmxt_135",
|
|
8
|
+
"body": "awsui_body_mx3cw_1pmxt_161",
|
|
9
|
+
"header": "awsui_header_mx3cw_1pmxt_167",
|
|
10
|
+
"action": "awsui_action_mx3cw_1pmxt_171",
|
|
11
|
+
"action-button": "awsui_action-button_mx3cw_1pmxt_176",
|
|
12
|
+
"alert-focus-wrapper": "awsui_alert-focus-wrapper_mx3cw_1pmxt_180",
|
|
13
|
+
"alert-mobile-block": "awsui_alert-mobile-block_mx3cw_1pmxt_206",
|
|
14
|
+
"text": "awsui_text_mx3cw_1pmxt_211",
|
|
15
|
+
"icon": "awsui_icon_mx3cw_1pmxt_215",
|
|
16
|
+
"message": "awsui_message_mx3cw_1pmxt_218",
|
|
17
|
+
"breakpoint-default": "awsui_breakpoint-default_mx3cw_1pmxt_223",
|
|
18
|
+
"icon-size-medium": "awsui_icon-size-medium_mx3cw_1pmxt_229",
|
|
19
|
+
"icon-size-big": "awsui_icon-size-big_mx3cw_1pmxt_232",
|
|
20
|
+
"icon-size-normal": "awsui_icon-size-normal_mx3cw_1pmxt_235",
|
|
21
|
+
"content": "awsui_content_mx3cw_1pmxt_245",
|
|
22
|
+
"dismiss": "awsui_dismiss_mx3cw_1pmxt_249",
|
|
23
|
+
"dismiss-button": "awsui_dismiss-button_mx3cw_1pmxt_255",
|
|
24
|
+
"type-error": "awsui_type-error_mx3cw_1pmxt_263",
|
|
25
|
+
"type-warning": "awsui_type-warning_mx3cw_1pmxt_271",
|
|
26
|
+
"type-success": "awsui_type-success_mx3cw_1pmxt_279",
|
|
27
|
+
"type-info": "awsui_type-info_mx3cw_1pmxt_287"
|
|
23
28
|
};
|
|
24
29
|
|