@cloudscape-design/components-themeable 3.0.1352 → 3.0.1353
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 +35 -19
- package/lib/internal/scss/badge/styles.scss +55 -35
- package/lib/internal/scss/button/styles.scss +96 -52
- package/lib/internal/scss/icon/hover-motion.scss +175 -30
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/internal/styles/style-api.scss +45 -0
- package/lib/internal/template/alert/internal.d.ts +6 -0
- package/lib/internal/template/alert/internal.d.ts.map +1 -1
- package/lib/internal/template/alert/internal.js +4 -4
- package/lib/internal/template/alert/internal.js.map +1 -1
- package/lib/internal/template/alert/styles.css.js +27 -27
- package/lib/internal/template/alert/styles.scoped.css +149 -71
- package/lib/internal/template/alert/styles.selectors.js +27 -27
- package/lib/internal/template/badge/index.d.ts.map +1 -1
- package/lib/internal/template/badge/index.js +2 -1
- package/lib/internal/template/badge/index.js.map +1 -1
- package/lib/internal/template/badge/styles.css.js +10 -10
- package/lib/internal/template/badge/styles.scoped.css +91 -54
- package/lib/internal/template/badge/styles.selectors.js +10 -10
- package/lib/internal/template/button/index.d.ts.map +1 -1
- package/lib/internal/template/button/index.js +1 -1
- package/lib/internal/template/button/index.js.map +1 -1
- package/lib/internal/template/button/internal.d.ts +5 -0
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +3 -2
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/button/styles.css.js +23 -23
- package/lib/internal/template/button/styles.scoped.css +375 -302
- package/lib/internal/template/button/styles.selectors.js +23 -23
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/table/column-groups/utils.d.ts +1 -0
- package/lib/internal/template/table/column-groups/utils.d.ts.map +1 -1
- package/lib/internal/template/table/column-groups/utils.js +13 -11
- package/lib/internal/template/table/column-groups/utils.js.map +1 -1
- package/lib/internal/template/table/thead.js +6 -6
- package/lib/internal/template/table/thead.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
// expressive motion via the `$expressive-motion-themes` list in
|
|
8
8
|
// internal/styles/utils/theming.scss.
|
|
9
9
|
|
|
10
|
+
@use 'sass:list';
|
|
11
|
+
@use 'sass:map';
|
|
12
|
+
@use 'sass:meta';
|
|
10
13
|
@use '../internal/styles/utils/theming' as theming;
|
|
11
14
|
|
|
12
15
|
// Descendant combinators and type selectors are unavoidable here since the trigger
|
|
@@ -14,8 +17,10 @@
|
|
|
14
17
|
// stylelint-disable selector-combinator-disallowed-list, selector-max-type, selector-class-pattern
|
|
15
18
|
// stylelint-disable @cloudscape-design/no-implicit-descendant
|
|
16
19
|
|
|
17
|
-
$
|
|
18
|
-
$_ease-
|
|
20
|
+
$_ease-out: ease-out;
|
|
21
|
+
$_ease-symmetric: cubic-bezier(0.33, 0, 0.67, 1);
|
|
22
|
+
$_ease-decelerate: cubic-bezier(0.4, 0, 0.2, 1);
|
|
23
|
+
$_ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
19
24
|
|
|
20
25
|
// A disabled control must not react to hover.
|
|
21
26
|
$_enabled-only: ':not(:disabled):not([aria-disabled="true"])';
|
|
@@ -35,10 +40,6 @@ $_hover-trigger: '[#{$_trigger-attribute}~="hover"]#{$_enabled-only}';
|
|
|
35
40
|
$_target-attribute: 'data-awsui-motion-target';
|
|
36
41
|
$_animating-icon: ':is([#{$_target-attribute}], :where([#{$_target-attribute}] *))';
|
|
37
42
|
|
|
38
|
-
$_ease-out: ease-out;
|
|
39
|
-
$_ease-symmetric: cubic-bezier(0.33, 0, 0.67, 1);
|
|
40
|
-
$_ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
41
|
-
|
|
42
43
|
$icon-hover-motion: (
|
|
43
44
|
'announcement': (
|
|
44
45
|
(
|
|
@@ -723,6 +724,151 @@ $icon-hover-motion: (
|
|
|
723
724
|
),
|
|
724
725
|
);
|
|
725
726
|
|
|
727
|
+
// Motion declarations must sit under a mixin named *with-motion, with at most sass
|
|
728
|
+
// control flow in between, per the no-motion-outside-of-mixin stylelint rule. This is
|
|
729
|
+
// that mixin: it scopes @content to opted-in themes and adds the runtime motion gate
|
|
730
|
+
// ($_motion-on).
|
|
731
|
+
@mixin with-motion {
|
|
732
|
+
@include theming.expressive-motion-only($_motion-on) {
|
|
733
|
+
@content;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// Also fires on :focus-visible, covering a focus owner nested inside the trigger.
|
|
738
|
+
@mixin _on-hover-trigger($suffix) {
|
|
739
|
+
#{'#{$_hover-trigger}:hover #{$suffix}'},
|
|
740
|
+
#{'#{$_hover-trigger}:is(:focus-visible, :has([#{$_trigger-attribute}~="focus"]:focus-visible)) #{$suffix}'} {
|
|
741
|
+
@content;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
@function _target($part) {
|
|
746
|
+
@if not $part {
|
|
747
|
+
@return '> :global(#{$_opted-in})';
|
|
748
|
+
}
|
|
749
|
+
@return '> :global(#{$_opted-in} .#{$part})';
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// A single-spec entry needs a trailing comma or Prettier turns the list back into a bare map.
|
|
753
|
+
@function _specs($value) {
|
|
754
|
+
@if meta.type-of($value) == 'map' {
|
|
755
|
+
@return list.append((), $value);
|
|
756
|
+
}
|
|
757
|
+
@return $value;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
@mixin generic-hover-motion {
|
|
761
|
+
.icon > :global(#{$_opted-in}) {
|
|
762
|
+
@include with-motion {
|
|
763
|
+
transition-property: transform;
|
|
764
|
+
transition-duration: 250ms;
|
|
765
|
+
transition-timing-function: $_ease-decelerate;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
@include _on-hover-trigger('.icon#{$_animating-icon} > :global(#{$_opted-in})') {
|
|
770
|
+
@include with-motion {
|
|
771
|
+
transform: scale(0.94);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// Icons with BOTH a whole-icon spec and a part spec are excluded — the cancel would out-specify the whole-icon rule and reset it to none.
|
|
777
|
+
@mixin _cancel-floor-under-hover-parts {
|
|
778
|
+
$names: ();
|
|
779
|
+
$parts: ();
|
|
780
|
+
|
|
781
|
+
@each $name, $specs in $icon-hover-motion {
|
|
782
|
+
$whole-icon: false;
|
|
783
|
+
@each $spec in _specs($specs) {
|
|
784
|
+
@if not map.get($spec, part) {
|
|
785
|
+
$whole-icon: true;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
@if not $whole-icon {
|
|
790
|
+
$names: list.append($names, '.name-#{$name}', comma);
|
|
791
|
+
@each $spec in _specs($specs) {
|
|
792
|
+
$part: '.#{map.get($spec, part)}';
|
|
793
|
+
@if not list.index($parts, $part) {
|
|
794
|
+
$parts: list.append($parts, $part, comma);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
@if list.length($names) > 0 {
|
|
801
|
+
@include _on-hover-trigger('.icon#{$_animating-icon}:is(#{$names}) > :global(#{$_opted-in}:has(:is(#{$parts})))') {
|
|
802
|
+
@include with-motion {
|
|
803
|
+
transform: none;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
@mixin per-icon-hover-motion {
|
|
810
|
+
@each $name, $specs in $icon-hover-motion {
|
|
811
|
+
@each $spec in _specs($specs) {
|
|
812
|
+
$part: map.get($spec, part);
|
|
813
|
+
$target: _target($part);
|
|
814
|
+
$to: map.get($spec, to);
|
|
815
|
+
$animation: map.get($spec, animation);
|
|
816
|
+
$duration: map.get($spec, duration);
|
|
817
|
+
$easing: map.get($spec, easing);
|
|
818
|
+
$base: map.get($spec, base);
|
|
819
|
+
$origin: map.get($spec, origin);
|
|
820
|
+
|
|
821
|
+
$property: map.get($spec, property) or transform;
|
|
822
|
+
$iterations: map.get($spec, iterations) or 1;
|
|
823
|
+
$fill: map.get($spec, fill) or none;
|
|
824
|
+
$delay: map.get($spec, delay) or 0s;
|
|
825
|
+
|
|
826
|
+
@if $to or $base or $origin {
|
|
827
|
+
.icon.name-#{$name} #{$target} {
|
|
828
|
+
@include with-motion {
|
|
829
|
+
@if $to {
|
|
830
|
+
transition-property: #{$property};
|
|
831
|
+
transition-duration: $duration;
|
|
832
|
+
transition-timing-function: $easing;
|
|
833
|
+
}
|
|
834
|
+
@if $base {
|
|
835
|
+
@each $property, $value in $base {
|
|
836
|
+
#{$property}: #{$value};
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
@if $origin {
|
|
840
|
+
transform-origin: $origin;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
@include _on-hover-trigger('.icon#{$_animating-icon}.name-#{$name} #{$target}') {
|
|
847
|
+
@include with-motion {
|
|
848
|
+
@if $animation {
|
|
849
|
+
animation-name: $animation;
|
|
850
|
+
animation-duration: $duration;
|
|
851
|
+
animation-timing-function: $easing;
|
|
852
|
+
@if $iterations != 1 {
|
|
853
|
+
animation-iteration-count: $iterations;
|
|
854
|
+
}
|
|
855
|
+
@if $fill != none {
|
|
856
|
+
animation-fill-mode: $fill;
|
|
857
|
+
}
|
|
858
|
+
@if $delay != 0s {
|
|
859
|
+
animation-delay: $delay;
|
|
860
|
+
}
|
|
861
|
+
} @else if $to {
|
|
862
|
+
@each $property, $value in $to {
|
|
863
|
+
#{$property}: #{$value};
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
726
872
|
// @keyframes cannot nest under a class, so they're gated on the artefact instead of the selector.
|
|
727
873
|
@mixin keyframes {
|
|
728
874
|
@if theming.has-expressive-motion() {
|
|
@@ -1005,40 +1151,39 @@ $icon-hover-motion: (
|
|
|
1005
1151
|
}
|
|
1006
1152
|
}
|
|
1007
1153
|
|
|
1008
|
-
|
|
1009
|
-
@mixin with-motion {
|
|
1010
|
-
@include theming.expressive-motion-only($_motion-on) {
|
|
1011
|
-
@content;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1154
|
+
$_spec-keys: (part, animation, to, base, origin, duration, easing, delay, iterations, fill, property);
|
|
1014
1155
|
|
|
1015
|
-
|
|
1016
|
-
@
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
}
|
|
1156
|
+
@mixin _validate-specs {
|
|
1157
|
+
@each $name, $specs in $icon-hover-motion {
|
|
1158
|
+
@each $spec in _specs($specs) {
|
|
1159
|
+
@each $key, $value in $spec {
|
|
1160
|
+
@if not list.index($_spec-keys, $key) {
|
|
1161
|
+
@error 'Unknown key `#{$key}` in the $icon-hover-motion spec for `#{$name}`. ' +
|
|
1162
|
+
'Known keys: #{$_spec-keys}.';
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1022
1165
|
|
|
1023
|
-
@
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
transition-duration: $_duration-generic;
|
|
1028
|
-
transition-timing-function: $_ease-decelerate;
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1166
|
+
@if map.get($spec, animation) and map.get($spec, to) {
|
|
1167
|
+
@error 'The $icon-hover-motion spec for `#{$name}` sets both `animation` and `to`. ' +
|
|
1168
|
+
'Use `animation` for keyframe-driven motion or `to` for a transition, not both.';
|
|
1169
|
+
}
|
|
1031
1170
|
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1171
|
+
@if (map.get($spec, animation) or map.get($spec, to)) and not
|
|
1172
|
+
(map.get($spec, duration) and map.get($spec, easing))
|
|
1173
|
+
{
|
|
1174
|
+
@error 'The $icon-hover-motion spec for `#{$name}` sets motion but is missing `duration` or `easing`.';
|
|
1175
|
+
}
|
|
1035
1176
|
}
|
|
1036
1177
|
}
|
|
1037
1178
|
}
|
|
1038
1179
|
|
|
1039
1180
|
@mixin icon-hover-motion {
|
|
1181
|
+
@include _validate-specs; // checks if per-icon motion definitions are properly defined
|
|
1182
|
+
@include keyframes;
|
|
1040
1183
|
@media (prefers-reduced-motion: no-preference) {
|
|
1041
1184
|
@include generic-hover-motion;
|
|
1185
|
+
@include _cancel-floor-under-hover-parts; // ensures generic motion does not apply to icons with bespoke motion
|
|
1186
|
+
@include per-icon-hover-motion;
|
|
1042
1187
|
}
|
|
1043
1188
|
}
|
|
1044
1189
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@forward '@cloudscape-design/component-toolkit/internal/style-api';
|
|
7
|
+
|
|
8
|
+
@use '@cloudscape-design/component-toolkit/internal/style-api' as toolkit;
|
|
9
|
+
@use './tokens' as awsui;
|
|
10
|
+
@use './foundation' as foundation;
|
|
11
|
+
@use './forms/mixins' as forms;
|
|
12
|
+
|
|
13
|
+
// Shared, component-agnostic Style API v2 token groups + the helpers that consume them. Components
|
|
14
|
+
// combine these groups (see combine()), register() the public tokens, and re-anchor them with
|
|
15
|
+
// carriers() on their boundary element so descendants / pseudo-elements read them per instance.
|
|
16
|
+
|
|
17
|
+
// Common surface tokens (background / text / border / border-radius / border-width), shared by
|
|
18
|
+
// badge, alert, button, etc.
|
|
19
|
+
$surface: (color, background-color, border-color, border-width, border-radius);
|
|
20
|
+
|
|
21
|
+
// Focus-outline tokens, shared by every focusable component (button, alert dismiss, ...).
|
|
22
|
+
$focus-ring: (focus-ring-color, focus-ring-width, focus-ring-radius, focus-ring-gutter-block, focus-ring-gutter-inline);
|
|
23
|
+
|
|
24
|
+
// Carrier map for the focus-outline group: reads resolve to the inherited --awsui-internal-style-*
|
|
25
|
+
// carriers (re-anchored by carriers() on the component root), so the ring below reaches ::before.
|
|
26
|
+
$_focus-ring-carriers: toolkit.resolve($focus-ring, carrier);
|
|
27
|
+
|
|
28
|
+
// A wrapper for forms.focus-highlight with style API integration.
|
|
29
|
+
@mixin focus-highlight(
|
|
30
|
+
$gutter-block: awsui.$space-button-focus-outline-gutter,
|
|
31
|
+
$gutter-inline: awsui.$space-button-focus-outline-gutter,
|
|
32
|
+
$radius: awsui.$border-radius-control-default-focus-ring,
|
|
33
|
+
$width: foundation.$box-shadow-focused-width,
|
|
34
|
+
$color: awsui.$color-border-item-focused
|
|
35
|
+
) {
|
|
36
|
+
@include forms.focus-highlight(
|
|
37
|
+
$gutter: (
|
|
38
|
+
'vertical': var(#{toolkit.read($_focus-ring-carriers, focus-ring-gutter-block)}, #{$gutter-block}),
|
|
39
|
+
'horizontal': var(#{toolkit.read($_focus-ring-carriers, focus-ring-gutter-inline)}, #{$gutter-inline}),
|
|
40
|
+
),
|
|
41
|
+
$border-radius: var(#{toolkit.read($_focus-ring-carriers, focus-ring-radius)}, #{$radius}),
|
|
42
|
+
$box-shadow: 0 0 0 var(#{toolkit.read($_focus-ring-carriers, focus-ring-width)}, #{$width})
|
|
43
|
+
var(#{toolkit.read($_focus-ring-carriers, focus-ring-color)}, #{$color})
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
3
3
|
import { AlertProps } from './interfaces';
|
|
4
|
+
interface StyleClassNames {
|
|
5
|
+
root?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
dismissButton?: string;
|
|
8
|
+
}
|
|
4
9
|
declare const InternalAlert: React.ForwardRefExoticComponent<AlertProps & {
|
|
5
10
|
type: AlertProps.Type;
|
|
6
11
|
} & InternalBaseComponentProps & {
|
|
7
12
|
messageSlotId?: string;
|
|
8
13
|
style?: AlertProps["style"];
|
|
14
|
+
styleClassNames?: StyleClassNames;
|
|
9
15
|
} & React.RefAttributes<AlertProps.Ref>>;
|
|
10
16
|
export default InternalAlert;
|
|
11
17
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAehF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAehF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqB1C,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAKD,QAAA,MAAM,aAAa;;;oBAfC,MAAM;YACd,UAAU,CAAC,OAAO,CAAC;sBACT,eAAe;wCAwOpC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -29,7 +29,7 @@ const typeToIcon = {
|
|
|
29
29
|
};
|
|
30
30
|
const useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);
|
|
31
31
|
const useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);
|
|
32
|
-
const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dismissible, children, header, buttonText, action, onDismiss, onButtonClick, __internalRootRef, statusIconAriaLabel: deprecatedStatusIconAriaLabel, dismissAriaLabel: deprecatedDismissAriaLabel, messageSlotId, style, persistenceConfig, ...rest }, ref) => {
|
|
32
|
+
const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dismissible, children, header, buttonText, action, onDismiss, onButtonClick, __internalRootRef, statusIconAriaLabel: deprecatedStatusIconAriaLabel, dismissAriaLabel: deprecatedDismissAriaLabel, messageSlotId, style, persistenceConfig, styleClassNames, ...rest }, ref) => {
|
|
33
33
|
var _a, _b;
|
|
34
34
|
const baseProps = getBaseProps(rest);
|
|
35
35
|
const i18n = useInternalI18n('alert');
|
|
@@ -99,10 +99,10 @@ const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dis
|
|
|
99
99
|
return (React.createElement("div", { ...baseProps, ...analyticsAttributes, "aria-hidden": !visible, className: clsx(styles.root, { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden }, baseProps.className), ref: containerRef },
|
|
100
100
|
React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
|
|
101
101
|
React.createElement(VisualContext, { contextName: "alert" },
|
|
102
|
-
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) },
|
|
102
|
+
React.createElement("div", { className: clsx(styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.root, styles.alert, styles[`type-${type}`], styles[`icon-size-${size}`], hasAction && styles['with-action'], dismissible && styles['with-dismiss']), style: getAlertStyles(style) },
|
|
103
103
|
React.createElement("div", { className: styles['alert-wrapper'] },
|
|
104
104
|
React.createElement("div", { className: styles['alert-focus-wrapper'], ref: focusRef, role: "group", onBlur: handleBlur },
|
|
105
|
-
React.createElement("div", { className: clsx(styles.icon, styles.text), style: getIconStyles(style) },
|
|
105
|
+
React.createElement("div", { className: clsx(styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.icon, styles.icon, styles.text), style: getIconStyles(style) },
|
|
106
106
|
React.createElement(InternalIcon, { name: typeToIcon[type], size: size, ariaLabel: statusIconAriaLabel })),
|
|
107
107
|
React.createElement("div", { className: clsx(styles.message, styles.text), id: messageSlotId },
|
|
108
108
|
React.createElement("div", { className: clsx(header && styles.header, headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors.header), ref: headerRef }, header),
|
|
@@ -116,7 +116,7 @@ const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dis
|
|
|
116
116
|
dismissible && (React.createElement("div", { className: styles.dismiss, ...getAnalyticsMetadataAttribute({
|
|
117
117
|
action: 'dismiss',
|
|
118
118
|
}) },
|
|
119
|
-
React.createElement(InternalButton, { className: styles['dismiss-button'], variant: "icon", iconName: "close", formAction: "none", ariaLabel: dismissAriaLabel, onClick: dismiss, style: getDismissButtonStyles(style) }))))))));
|
|
119
|
+
React.createElement(InternalButton, { className: styles['dismiss-button'], variant: "icon", iconName: "close", formAction: "none", ariaLabel: dismissAriaLabel, onClick: dismiss, style: getDismissButtonStyles(style), styleClassNames: { root: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.dismissButton } }))))))));
|
|
120
120
|
});
|
|
121
121
|
export default InternalAlert;
|
|
122
122
|
//# 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,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CA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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, { useEffect, useImperativeHandle, useRef, useState } 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 { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { persistAlertDismiss, retrieveAlertDismiss } from '../internal/persistence';\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, getIconStyles } 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 & {\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,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n style,\n persistenceConfig,\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 useImperativeHandle(ref, () => ({\n focus: () => {\n if (focusRef.current) {\n focusRef.current.tabIndex = -1;\n focusRef.current.focus();\n }\n },\n }));\n const handleBlur = () => {\n if (focusRef.current) {\n focusRef.current.removeAttribute('tabindex');\n }\n };\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 const [isPersistentlyDismissed, setIsPersistentlyDismissed] = useState(\n !!(persistenceConfig && persistenceConfig.uniqueKey)\n );\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 useEffect(() => {\n let isMounted = true;\n if (persistenceConfig?.uniqueKey) {\n retrieveAlertDismiss(persistenceConfig)\n .then(dismissed => {\n if (isMounted) {\n setIsPersistentlyDismissed(!!dismissed);\n }\n })\n .catch(() => {\n if (isMounted) {\n setIsPersistentlyDismissed(false);\n }\n });\n }\n return () => {\n isMounted = false;\n };\n\n // Only track specific properties to avoid re-running when persistenceConfig object reference changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [persistenceConfig?.uniqueKey, persistenceConfig?.crossServicePersistence]);\n\n const dismiss = () => {\n fireNonCancelableEvent(onDismiss);\n if (persistenceConfig?.uniqueKey) {\n persistAlertDismiss(persistenceConfig);\n }\n };\n\n if (isPersistentlyDismissed) {\n return null;\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']} ref={focusRef} role=\"group\" onBlur={handleBlur}>\n <div className={clsx(styles.icon, styles.text)} style={getIconStyles(style)}>\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={dismiss}\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"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC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d,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,EACpC,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,aAAa,EAAE,GACzD,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, { useEffect, useImperativeHandle, useRef, useState } 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 { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { persistAlertDismiss, retrieveAlertDismiss } from '../internal/persistence';\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, getIconStyles } 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 & {\n messageSlotId?: string;\n style?: AlertProps['style'];\n styleClassNames?: StyleClassNames;\n };\n\n// Style API v2\ninterface StyleClassNames {\n root?: string;\n icon?: string;\n dismissButton?: 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,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n style,\n persistenceConfig,\n styleClassNames,\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 useImperativeHandle(ref, () => ({\n focus: () => {\n if (focusRef.current) {\n focusRef.current.tabIndex = -1;\n focusRef.current.focus();\n }\n },\n }));\n const handleBlur = () => {\n if (focusRef.current) {\n focusRef.current.removeAttribute('tabindex');\n }\n };\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 const [isPersistentlyDismissed, setIsPersistentlyDismissed] = useState(\n !!(persistenceConfig && persistenceConfig.uniqueKey)\n );\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 useEffect(() => {\n let isMounted = true;\n if (persistenceConfig?.uniqueKey) {\n retrieveAlertDismiss(persistenceConfig)\n .then(dismissed => {\n if (isMounted) {\n setIsPersistentlyDismissed(!!dismissed);\n }\n })\n .catch(() => {\n if (isMounted) {\n setIsPersistentlyDismissed(false);\n }\n });\n }\n return () => {\n isMounted = false;\n };\n\n // Only track specific properties to avoid re-running when persistenceConfig object reference changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [persistenceConfig?.uniqueKey, persistenceConfig?.crossServicePersistence]);\n\n const dismiss = () => {\n fireNonCancelableEvent(onDismiss);\n if (persistenceConfig?.uniqueKey) {\n persistAlertDismiss(persistenceConfig);\n }\n };\n\n if (isPersistentlyDismissed) {\n return null;\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 styleClassNames?.root,\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']} ref={focusRef} role=\"group\" onBlur={handleBlur}>\n <div className={clsx(styleClassNames?.icon, styles.icon, styles.text)} style={getIconStyles(style)}>\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={dismiss}\n style={getDismissButtonStyles(style)}\n styleClassNames={{ root: styleClassNames?.dismissButton }}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </LinkDefaultVariantContext.Provider>\n </div>\n );\n }\n);\n\nexport default InternalAlert;\n"]}
|
|
@@ -1,32 +1,32 @@
|
|
|
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
|
-
"alert-wrapper": "awsui_alert-
|
|
9
|
-
"initial-hidden": "awsui_initial-
|
|
10
|
-
"header": "
|
|
11
|
-
"header-replacement": "awsui_header-
|
|
12
|
-
"action": "
|
|
13
|
-
"action-slot": "awsui_action-
|
|
14
|
-
"action-button": "awsui_action-
|
|
15
|
-
"alert-focus-wrapper": "awsui_alert-focus-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"message": "
|
|
19
|
-
"action-wrapped": "awsui_action-
|
|
20
|
-
"icon-size-medium": "awsui_icon-size-
|
|
21
|
-
"icon-size-big": "awsui_icon-size-
|
|
22
|
-
"icon-size-normal": "awsui_icon-size-
|
|
23
|
-
"content": "
|
|
24
|
-
"content-replacement": "awsui_content-
|
|
25
|
-
"dismiss": "
|
|
26
|
-
"dismiss-button": "awsui_dismiss-
|
|
27
|
-
"type-error": "awsui_type-
|
|
28
|
-
"type-warning": "awsui_type-
|
|
29
|
-
"type-success": "awsui_type-
|
|
30
|
-
"type-info": "awsui_type-
|
|
4
|
+
"alert": "awsui_alert_mx3cw_1x3zi_201",
|
|
5
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_mx3cw_1x3zi_1",
|
|
6
|
+
"root": "awsui_root_mx3cw_1x3zi_272",
|
|
7
|
+
"hidden": "awsui_hidden_mx3cw_1x3zi_307",
|
|
8
|
+
"alert-wrapper": "awsui_alert-wrapper_mx3cw_1x3zi_370",
|
|
9
|
+
"initial-hidden": "awsui_initial-hidden_mx3cw_1x3zi_382",
|
|
10
|
+
"header": "awsui_header_mx3cw_1x3zi_387",
|
|
11
|
+
"header-replacement": "awsui_header-replacement_mx3cw_1x3zi_388",
|
|
12
|
+
"action": "awsui_action_mx3cw_1x3zi_392",
|
|
13
|
+
"action-slot": "awsui_action-slot_mx3cw_1x3zi_396",
|
|
14
|
+
"action-button": "awsui_action-button_mx3cw_1x3zi_397",
|
|
15
|
+
"alert-focus-wrapper": "awsui_alert-focus-wrapper_mx3cw_1x3zi_401",
|
|
16
|
+
"icon": "awsui_icon_mx3cw_1x3zi_433",
|
|
17
|
+
"text": "awsui_text_mx3cw_1x3zi_437",
|
|
18
|
+
"message": "awsui_message_mx3cw_1x3zi_447",
|
|
19
|
+
"action-wrapped": "awsui_action-wrapped_mx3cw_1x3zi_451",
|
|
20
|
+
"icon-size-medium": "awsui_icon-size-medium_mx3cw_1x3zi_455",
|
|
21
|
+
"icon-size-big": "awsui_icon-size-big_mx3cw_1x3zi_459",
|
|
22
|
+
"icon-size-normal": "awsui_icon-size-normal_mx3cw_1x3zi_463",
|
|
23
|
+
"content": "awsui_content_mx3cw_1x3zi_467",
|
|
24
|
+
"content-replacement": "awsui_content-replacement_mx3cw_1x3zi_468",
|
|
25
|
+
"dismiss": "awsui_dismiss_mx3cw_1x3zi_472",
|
|
26
|
+
"dismiss-button": "awsui_dismiss-button_mx3cw_1x3zi_478",
|
|
27
|
+
"type-error": "awsui_type-error_mx3cw_1x3zi_482",
|
|
28
|
+
"type-warning": "awsui_type-warning_mx3cw_1x3zi_490",
|
|
29
|
+
"type-success": "awsui_type-success_mx3cw_1x3zi_498",
|
|
30
|
+
"type-info": "awsui_type-info_mx3cw_1x3zi_506"
|
|
31
31
|
};
|
|
32
32
|
|