@transferwise/components 0.0.0-experimental-14ff413 → 0.0.0-experimental-8bafa84
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/build/field/Field.js +4 -4
- package/build/field/Field.mjs +4 -4
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +4 -4
- package/build/listItem/Prompt/ListItemPrompt.mjs +4 -4
- package/build/main.css +85 -29
- package/build/prompt/ActionPrompt/ActionPrompt.js +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +145 -0
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +143 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -0
- package/build/prompt/CriticalBanner/helpers.js +29 -0
- package/build/prompt/CriticalBanner/helpers.js.map +1 -0
- package/build/prompt/CriticalBanner/helpers.mjs +26 -0
- package/build/prompt/CriticalBanner/helpers.mjs.map +1 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +2 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +2 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
- package/build/prompt/common/Expander/Expander.js +46 -0
- package/build/prompt/common/Expander/Expander.js.map +1 -0
- package/build/prompt/common/Expander/Expander.mjs +43 -0
- package/build/prompt/common/Expander/Expander.mjs.map +1 -0
- package/build/prompt/helpers/promptMedia.js +52 -0
- package/build/prompt/helpers/promptMedia.js.map +1 -0
- package/build/prompt/helpers/promptMedia.mjs +50 -0
- package/build/prompt/helpers/promptMedia.mjs.map +1 -0
- package/build/styles/main.css +85 -29
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +39 -0
- package/build/styles/prompt/common/Expander/Expander.css +8 -0
- package/build/typeahead/Typeahead.js +4 -4
- package/build/typeahead/Typeahead.mjs +4 -4
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +2 -11
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +43 -0
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts +18 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/index.d.ts +3 -0
- package/build/types/prompt/CriticalBanner/index.d.ts.map +1 -0
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +8 -3
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
- package/build/types/prompt/common/Expander/Expander.d.ts +22 -0
- package/build/types/prompt/common/Expander/Expander.d.ts.map +1 -0
- package/build/types/prompt/helpers/promptMedia.d.ts +22 -0
- package/build/types/prompt/helpers/promptMedia.d.ts.map +1 -0
- package/build/types/prompt/index.d.ts +2 -0
- package/build/types/prompt/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/main.css +85 -29
- package/src/main.less +3 -1
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +9 -62
- package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +131 -0
- package/src/prompt/CriticalBanner/CriticalBanner.css +39 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +45 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +476 -0
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +67 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +189 -0
- package/src/prompt/CriticalBanner/helpers.ts +39 -0
- package/src/prompt/CriticalBanner/index.ts +2 -0
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +9 -2
- package/src/prompt/common/Expander/Expander.css +8 -0
- package/src/prompt/common/Expander/Expander.less +9 -0
- package/src/prompt/common/Expander/Expander.test.tsx +176 -0
- package/src/prompt/common/Expander/Expander.tsx +81 -0
- package/src/prompt/helpers/promptMedia.tsx +79 -0
- package/src/prompt/index.ts +4 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +43 -17
package/build/field/Field.js
CHANGED
|
@@ -26,16 +26,16 @@ require('react-intl');
|
|
|
26
26
|
require('../common/closeButton/CloseButton.messages.js');
|
|
27
27
|
var jsxRuntime = require('react/jsx-runtime');
|
|
28
28
|
var InlinePrompt = require('../prompt/InlinePrompt/InlinePrompt.js');
|
|
29
|
-
require('../statusIcon/StatusIcon.js');
|
|
30
29
|
require('../body/Body.js');
|
|
31
30
|
require('../button/Button.resolver.js');
|
|
31
|
+
require('../sentimentSurface/SentimentSurface.js');
|
|
32
|
+
require('../primitives/PrimitiveButton/PrimitiveButton.js');
|
|
33
|
+
require('../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
|
|
32
34
|
require('../badge/Badge.js');
|
|
33
35
|
require('@wise/art');
|
|
36
|
+
require('../statusIcon/StatusIcon.js');
|
|
34
37
|
require('@transferwise/neptune-validation');
|
|
35
38
|
require('../provider/direction/DirectionProvider.js');
|
|
36
|
-
require('../sentimentSurface/SentimentSurface.js');
|
|
37
|
-
require('../primitives/PrimitiveButton/PrimitiveButton.js');
|
|
38
|
-
require('../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
|
|
39
39
|
require('../link/Link.messages.js');
|
|
40
40
|
var contexts = require('../inputs/contexts.js');
|
|
41
41
|
var Label = require('../label/Label.js');
|
package/build/field/Field.mjs
CHANGED
|
@@ -24,16 +24,16 @@ import 'react-intl';
|
|
|
24
24
|
import '../common/closeButton/CloseButton.messages.mjs';
|
|
25
25
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
26
26
|
import { InlinePrompt } from '../prompt/InlinePrompt/InlinePrompt.mjs';
|
|
27
|
-
import '../statusIcon/StatusIcon.mjs';
|
|
28
27
|
import '../body/Body.mjs';
|
|
29
28
|
import '../button/Button.resolver.mjs';
|
|
29
|
+
import '../sentimentSurface/SentimentSurface.mjs';
|
|
30
|
+
import '../primitives/PrimitiveButton/PrimitiveButton.mjs';
|
|
31
|
+
import '../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
|
|
30
32
|
import '../badge/Badge.mjs';
|
|
31
33
|
import '@wise/art';
|
|
34
|
+
import '../statusIcon/StatusIcon.mjs';
|
|
32
35
|
import '@transferwise/neptune-validation';
|
|
33
36
|
import '../provider/direction/DirectionProvider.mjs';
|
|
34
|
-
import '../sentimentSurface/SentimentSurface.mjs';
|
|
35
|
-
import '../primitives/PrimitiveButton/PrimitiveButton.mjs';
|
|
36
|
-
import '../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
|
|
37
37
|
import '../link/Link.messages.mjs';
|
|
38
38
|
import { FieldLabelContextProvider, InputIdContextProvider, InputDescribedByProvider, InputInvalidProvider } from '../inputs/contexts.mjs';
|
|
39
39
|
import { Label as LabelNamespace } from '../label/Label.mjs';
|
package/build/index.js
CHANGED
|
@@ -54,6 +54,7 @@ var InlineAlert = require('./inlineAlert/InlineAlert.js');
|
|
|
54
54
|
var InlinePrompt = require('./prompt/InlinePrompt/InlinePrompt.js');
|
|
55
55
|
var ActionPrompt = require('./prompt/ActionPrompt/ActionPrompt.js');
|
|
56
56
|
var InfoPrompt = require('./prompt/InfoPrompt/InfoPrompt.js');
|
|
57
|
+
var CriticalBanner = require('./prompt/CriticalBanner/CriticalBanner.js');
|
|
57
58
|
var InputWithDisplayFormat = require('./inputWithDisplayFormat/InputWithDisplayFormat.js');
|
|
58
59
|
var Input = require('./inputs/Input.js');
|
|
59
60
|
var InputGroup = require('./inputs/InputGroup.js');
|
|
@@ -221,6 +222,7 @@ exports.InlineAlert = InlineAlert.default;
|
|
|
221
222
|
exports.InlinePrompt = InlinePrompt.InlinePrompt;
|
|
222
223
|
exports.ActionPrompt = ActionPrompt.ActionPrompt;
|
|
223
224
|
exports.InfoPrompt = InfoPrompt.InfoPrompt;
|
|
225
|
+
exports.CriticalBanner = CriticalBanner.CriticalBanner;
|
|
224
226
|
exports.InputWithDisplayFormat = InputWithDisplayFormat.default;
|
|
225
227
|
exports.Input = Input.Input;
|
|
226
228
|
exports.InputGroup = InputGroup.InputGroup;
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/index.mjs
CHANGED
|
@@ -52,6 +52,7 @@ export { default as InlineAlert } from './inlineAlert/InlineAlert.mjs';
|
|
|
52
52
|
export { InlinePrompt } from './prompt/InlinePrompt/InlinePrompt.mjs';
|
|
53
53
|
export { ActionPrompt } from './prompt/ActionPrompt/ActionPrompt.mjs';
|
|
54
54
|
export { InfoPrompt } from './prompt/InfoPrompt/InfoPrompt.mjs';
|
|
55
|
+
export { CriticalBanner } from './prompt/CriticalBanner/CriticalBanner.mjs';
|
|
55
56
|
export { default as InputWithDisplayFormat } from './inputWithDisplayFormat/InputWithDisplayFormat.mjs';
|
|
56
57
|
export { Input } from './inputs/Input.mjs';
|
|
57
58
|
export { InputGroup } from './inputs/InputGroup.mjs';
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -27,16 +27,16 @@ require('../../common/closeButton/CloseButton.messages.js');
|
|
|
27
27
|
var jsxRuntime = require('react/jsx-runtime');
|
|
28
28
|
var ListItemContext = require('../ListItemContext.js');
|
|
29
29
|
var InlinePrompt = require('../../prompt/InlinePrompt/InlinePrompt.js');
|
|
30
|
-
require('../../statusIcon/StatusIcon.js');
|
|
31
30
|
require('../../body/Body.js');
|
|
32
31
|
require('../../button/Button.resolver.js');
|
|
32
|
+
require('../../sentimentSurface/SentimentSurface.js');
|
|
33
|
+
require('../../primitives/PrimitiveButton/PrimitiveButton.js');
|
|
34
|
+
require('../../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
|
|
33
35
|
require('../../badge/Badge.js');
|
|
34
36
|
require('@wise/art');
|
|
37
|
+
require('../../statusIcon/StatusIcon.js');
|
|
35
38
|
require('@transferwise/neptune-validation');
|
|
36
39
|
require('../../provider/direction/DirectionProvider.js');
|
|
37
|
-
require('../../sentimentSurface/SentimentSurface.js');
|
|
38
|
-
require('../../primitives/PrimitiveButton/PrimitiveButton.js');
|
|
39
|
-
require('../../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
|
|
40
40
|
require('../../link/Link.messages.js');
|
|
41
41
|
|
|
42
42
|
const Prompt = ({
|
|
@@ -25,16 +25,16 @@ import '../../common/closeButton/CloseButton.messages.mjs';
|
|
|
25
25
|
import { jsx } from 'react/jsx-runtime';
|
|
26
26
|
import { ListItemContext } from '../ListItemContext.mjs';
|
|
27
27
|
import { InlinePrompt } from '../../prompt/InlinePrompt/InlinePrompt.mjs';
|
|
28
|
-
import '../../statusIcon/StatusIcon.mjs';
|
|
29
28
|
import '../../body/Body.mjs';
|
|
30
29
|
import '../../button/Button.resolver.mjs';
|
|
30
|
+
import '../../sentimentSurface/SentimentSurface.mjs';
|
|
31
|
+
import '../../primitives/PrimitiveButton/PrimitiveButton.mjs';
|
|
32
|
+
import '../../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
|
|
31
33
|
import '../../badge/Badge.mjs';
|
|
32
34
|
import '@wise/art';
|
|
35
|
+
import '../../statusIcon/StatusIcon.mjs';
|
|
33
36
|
import '@transferwise/neptune-validation';
|
|
34
37
|
import '../../provider/direction/DirectionProvider.mjs';
|
|
35
|
-
import '../../sentimentSurface/SentimentSurface.mjs';
|
|
36
|
-
import '../../primitives/PrimitiveButton/PrimitiveButton.mjs';
|
|
37
|
-
import '../../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
|
|
38
38
|
import '../../link/Link.messages.mjs';
|
|
39
39
|
|
|
40
40
|
const Prompt = ({
|
package/build/main.css
CHANGED
|
@@ -32176,6 +32176,91 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32176
32176
|
padding: 0;
|
|
32177
32177
|
}
|
|
32178
32178
|
|
|
32179
|
+
.wds-action-prompt {
|
|
32180
|
+
--Prompt-padding: var(--size-16);
|
|
32181
|
+
--Prompt-actions-gap: var(--size-8);
|
|
32182
|
+
--Prompt-gap: var(--size-10) var(--size-16);
|
|
32183
|
+
--Prompt-border-radius: var(--radius-large);
|
|
32184
|
+
}
|
|
32185
|
+
|
|
32186
|
+
.wds-action-prompt--media-image {
|
|
32187
|
+
width: 48px;
|
|
32188
|
+
width: var(--size-48);
|
|
32189
|
+
height: 48px;
|
|
32190
|
+
height: var(--size-48);
|
|
32191
|
+
-o-object-fit: contain;
|
|
32192
|
+
object-fit: contain;
|
|
32193
|
+
}
|
|
32194
|
+
|
|
32195
|
+
@media (max-width: 767px) {
|
|
32196
|
+
.wds-action-prompt--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
32197
|
+
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
32198
|
+
min-width: -moz-fit-content;
|
|
32199
|
+
min-width: fit-content;
|
|
32200
|
+
}
|
|
32201
|
+
}
|
|
32202
|
+
|
|
32203
|
+
.wds-action-prompt__content {
|
|
32204
|
+
max-width: calc(48px * 10);
|
|
32205
|
+
max-width: calc(var(--size-48) * 10);
|
|
32206
|
+
}
|
|
32207
|
+
|
|
32208
|
+
.wds-critical-banner {
|
|
32209
|
+
--Prompt-padding: var(--size-16);
|
|
32210
|
+
--Prompt-actions-gap: var(--size-8);
|
|
32211
|
+
--Prompt-gap: var(--size-10) var(--size-16);
|
|
32212
|
+
--Prompt-border-radius: 0;
|
|
32213
|
+
}
|
|
32214
|
+
|
|
32215
|
+
.wds-critical-banner--media-image {
|
|
32216
|
+
width: 48px;
|
|
32217
|
+
width: var(--size-48);
|
|
32218
|
+
height: 48px;
|
|
32219
|
+
height: var(--size-48);
|
|
32220
|
+
-o-object-fit: contain;
|
|
32221
|
+
object-fit: contain;
|
|
32222
|
+
}
|
|
32223
|
+
|
|
32224
|
+
@media (max-width: 767px) {
|
|
32225
|
+
.wds-critical-banner--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
32226
|
+
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
32227
|
+
min-width: -moz-fit-content;
|
|
32228
|
+
min-width: fit-content;
|
|
32229
|
+
}
|
|
32230
|
+
}
|
|
32231
|
+
|
|
32232
|
+
.wds-critical-banner__description--collapsed {
|
|
32233
|
+
display: -webkit-box;
|
|
32234
|
+
-webkit-line-clamp: 2;
|
|
32235
|
+
-webkit-box-orient: vertical;
|
|
32236
|
+
overflow: hidden;
|
|
32237
|
+
}
|
|
32238
|
+
|
|
32239
|
+
.wds-critical-banner .wds-prompt__content-wrapper {
|
|
32240
|
+
grid-template-columns: auto 1fr auto;
|
|
32241
|
+
align-items: flex-start;
|
|
32242
|
+
}
|
|
32243
|
+
|
|
32244
|
+
.wds-critical-banner__text-wrapper {
|
|
32245
|
+
min-width: 0;
|
|
32246
|
+
}
|
|
32247
|
+
|
|
32248
|
+
@media (max-width: 767px) {
|
|
32249
|
+
.wds-critical-banner .wds-prompt__actions-wrapper {
|
|
32250
|
+
grid-column: span 3;
|
|
32251
|
+
}
|
|
32252
|
+
}
|
|
32253
|
+
|
|
32254
|
+
.wds-expander-toggle {
|
|
32255
|
+
align-self: flex-start;
|
|
32256
|
+
flex-shrink: 0;
|
|
32257
|
+
transition: transform 0.2s ease-in-out;
|
|
32258
|
+
}
|
|
32259
|
+
|
|
32260
|
+
.wds-expander-toggle--collapsed {
|
|
32261
|
+
transform: rotate(180deg);
|
|
32262
|
+
}
|
|
32263
|
+
|
|
32179
32264
|
.wds-radio-group .np-radio:last-child label {
|
|
32180
32265
|
margin-bottom: 0;
|
|
32181
32266
|
}
|
|
@@ -34600,32 +34685,3 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
34600
34685
|
.np-list-item__action {
|
|
34601
34686
|
flex-shrink: 0;
|
|
34602
34687
|
}
|
|
34603
|
-
|
|
34604
|
-
.wds-action-prompt {
|
|
34605
|
-
--Prompt-padding: var(--size-16);
|
|
34606
|
-
--Prompt-actions-gap: var(--size-8);
|
|
34607
|
-
--Prompt-gap: var(--size-10) var(--size-16);
|
|
34608
|
-
--Prompt-border-radius: var(--radius-large);
|
|
34609
|
-
}
|
|
34610
|
-
|
|
34611
|
-
.wds-action-prompt--media-image {
|
|
34612
|
-
width: 48px;
|
|
34613
|
-
width: var(--size-48);
|
|
34614
|
-
height: 48px;
|
|
34615
|
-
height: var(--size-48);
|
|
34616
|
-
-o-object-fit: contain;
|
|
34617
|
-
object-fit: contain;
|
|
34618
|
-
}
|
|
34619
|
-
|
|
34620
|
-
@media (max-width: 767px) {
|
|
34621
|
-
.wds-action-prompt--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
34622
|
-
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
34623
|
-
min-width: -moz-fit-content;
|
|
34624
|
-
min-width: fit-content;
|
|
34625
|
-
}
|
|
34626
|
-
}
|
|
34627
|
-
|
|
34628
|
-
.wds-action-prompt__content {
|
|
34629
|
-
max-width: calc(48px * 10);
|
|
34630
|
-
max-width: calc(var(--size-48) * 10);
|
|
34631
|
-
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
|
-
var StatusIcon = require('../../statusIcon/StatusIcon.js');
|
|
6
5
|
var Body = require('../../body/Body.js');
|
|
7
6
|
var Button_resolver = require('../../button/Button.resolver.js');
|
|
8
7
|
require('../../common/theme.js');
|
|
@@ -24,14 +23,13 @@ require('../../common/propsValues/variant.js');
|
|
|
24
23
|
require('../../common/propsValues/scroll.js');
|
|
25
24
|
require('../../common/propsValues/markdownNodeType.js');
|
|
26
25
|
require('../../common/fileType.js');
|
|
27
|
-
|
|
26
|
+
require('@transferwise/icons');
|
|
28
27
|
require('react-intl');
|
|
29
28
|
require('../../common/closeButton/CloseButton.messages.js');
|
|
30
29
|
var jsxRuntime = require('react/jsx-runtime');
|
|
31
|
-
var AvatarView = require('../../avatarView/AvatarView.js');
|
|
32
|
-
var Image = require('../../image/Image.js');
|
|
33
30
|
var PrimitivePrompt = require('../PrimitivePrompt/PrimitivePrompt.js');
|
|
34
31
|
var useScreenSize = require('../../common/hooks/useScreenSize.js');
|
|
32
|
+
var promptMedia = require('../helpers/promptMedia.js');
|
|
35
33
|
|
|
36
34
|
const ActionPrompt = ({
|
|
37
35
|
sentiment = 'neutral',
|
|
@@ -51,42 +49,12 @@ const ActionPrompt = ({
|
|
|
51
49
|
const titleId = React.useId();
|
|
52
50
|
const descId = React.useId();
|
|
53
51
|
const ariaLabelledByIds = [media['aria-hidden'] ? undefined : mediaId, ariaLabel ? undefined : titleId].filter(Boolean).join(' ');
|
|
54
|
-
const renderMedia = () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
alt: media['aria-label'] ?? ''
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (media?.avatar) {
|
|
64
|
-
const badge = media.avatar.badge ? media.avatar.badge : sentiment === 'proposition' ? {} : {
|
|
65
|
-
status: sentiment
|
|
66
|
-
};
|
|
67
|
-
return /*#__PURE__*/jsxRuntime.jsx(AvatarView.default, {
|
|
68
|
-
...media.avatar,
|
|
69
|
-
badge: badge,
|
|
70
|
-
"aria-label": media['aria-label'],
|
|
71
|
-
"aria-hidden": media['aria-hidden'],
|
|
72
|
-
id: mediaId,
|
|
73
|
-
size: 48,
|
|
74
|
-
children: media.avatar.asset
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return sentiment === 'proposition' ? /*#__PURE__*/jsxRuntime.jsx(AvatarView.default, {
|
|
78
|
-
id: mediaId,
|
|
79
|
-
size: 48,
|
|
80
|
-
"aria-label": media['aria-label'],
|
|
81
|
-
"aria-hidden": media['aria-hidden'],
|
|
82
|
-
children: /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {})
|
|
83
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(StatusIcon.default, {
|
|
84
|
-
id: mediaId,
|
|
85
|
-
size: 48,
|
|
86
|
-
sentiment: sentiment,
|
|
87
|
-
iconLabel: media['aria-hidden'] ? null : media['aria-label']
|
|
88
|
-
});
|
|
89
|
-
};
|
|
52
|
+
const renderMedia = () => promptMedia.renderPromptMedia({
|
|
53
|
+
media,
|
|
54
|
+
sentiment,
|
|
55
|
+
mediaId,
|
|
56
|
+
imgClassName: 'wds-action-prompt--media-image'
|
|
57
|
+
});
|
|
90
58
|
return /*#__PURE__*/jsxRuntime.jsx(PrimitivePrompt.PrimitivePrompt, {
|
|
91
59
|
id: id,
|
|
92
60
|
sentiment: sentiment,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionPrompt.js","sources":["../../../src/prompt/ActionPrompt/ActionPrompt.tsx"],"sourcesContent":["import { AriaAttributes, ReactNode, useId } from 'react';\nimport { clsx } from 'clsx';\n\nimport
|
|
1
|
+
{"version":3,"file":"ActionPrompt.js","sources":["../../../src/prompt/ActionPrompt/ActionPrompt.tsx"],"sourcesContent":["import { AriaAttributes, ReactNode, useId } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\nimport { Breakpoint, Typography } from '../../common';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\nimport { useScreenSize } from '../../common/hooks/useScreenSize';\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\n\nexport type ActionPromptProps = {\n title: ReactNode;\n description?: ReactNode;\n /** @default {} */\n media?: PromptMedia;\n action: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n 'aria-label'?: AriaAttributes['aria-label'];\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid' | 'onDismiss'> & {\n /**\n * The sentiment determines the colour scheme\n * @default 'neutral'\n */\n sentiment?: PrimitivePromptProps['sentiment'];\n };\n\n/**\n * Use an action prompt for optional feedback that doesn't require immediate action, such as feature upsells, warnings, or suggestions. These prompts are typically used outside of core product flows (e.g., Launchpad, Recipient, or Transaction screens) and can be addressed at the user's convenience.\n *\n * If your message is about immediate user feedback (e.g., form submission errors, download failures, missing data warnings), use an [info prompt](https://storybook.wise.design/?path=/docs/prompts-infoprompt--docs) instead.\n *\n * Guidance can be found in the [design system](https://wise.design/components/action-prompt).\n */\nexport const ActionPrompt = ({\n sentiment = 'neutral',\n title,\n description,\n onDismiss,\n media = {},\n action,\n actionSecondary,\n id,\n className,\n 'data-testid': testId,\n 'aria-label': ariaLabel,\n}: ActionPromptProps) => {\n const isMobile = !useScreenSize(Breakpoint.MEDIUM);\n\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n ariaLabel ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const renderMedia = () =>\n renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-action-prompt--media-image',\n });\n\n return (\n <PrimitivePrompt\n id={id}\n sentiment={sentiment}\n data-testid={testId}\n className={clsx(\n 'wds-action-prompt',\n { 'wds-action-prompt--with-two-actions': !!actionSecondary },\n className,\n )}\n media={renderMedia()}\n actions={\n <>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n block={isMobile}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {/* @ts-expect-error onClick type mismatch */}\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n block={isMobile}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n </>\n }\n role=\"region\"\n onDismiss={onDismiss}\n {...(ariaLabel\n ? { 'aria-label': ariaLabel }\n : {\n 'aria-labelledby': ariaLabelledByIds,\n 'aria-describedby': descId,\n })}\n >\n <div className={clsx('d-flex', 'flex-column', 'justify-content-center')}>\n <Body id={titleId} type={Typography.BODY_LARGE_BOLD} className=\"wds-action-prompt__content\">\n {title}\n </Body>\n {description && (\n <Body id={descId} className=\"wds-action-prompt__content\">\n {description}\n </Body>\n )}\n </div>\n </PrimitivePrompt>\n );\n};\n\nexport default ActionPrompt;\n"],"names":["ActionPrompt","sentiment","title","description","onDismiss","media","action","actionSecondary","id","className","testId","ariaLabel","isMobile","useScreenSize","Breakpoint","MEDIUM","mediaId","useId","titleId","descId","ariaLabelledByIds","undefined","filter","Boolean","join","renderMedia","renderPromptMedia","imgClassName","_jsx","PrimitivePrompt","clsx","actions","_jsxs","_Fragment","children","Button","v2","size","priority","href","block","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD"],"mappings":"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"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useId } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import StatusIcon from '../../statusIcon/StatusIcon.mjs';
|
|
4
3
|
import Body from '../../body/Body.mjs';
|
|
5
4
|
import Button from '../../button/Button.resolver.mjs';
|
|
6
5
|
import '../../common/theme.mjs';
|
|
@@ -22,14 +21,13 @@ import '../../common/propsValues/variant.mjs';
|
|
|
22
21
|
import '../../common/propsValues/scroll.mjs';
|
|
23
22
|
import '../../common/propsValues/markdownNodeType.mjs';
|
|
24
23
|
import '../../common/fileType.mjs';
|
|
25
|
-
import
|
|
24
|
+
import '@transferwise/icons';
|
|
26
25
|
import 'react-intl';
|
|
27
26
|
import '../../common/closeButton/CloseButton.messages.mjs';
|
|
28
27
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
29
|
-
import AvatarView from '../../avatarView/AvatarView.mjs';
|
|
30
|
-
import Image from '../../image/Image.mjs';
|
|
31
28
|
import { PrimitivePrompt } from '../PrimitivePrompt/PrimitivePrompt.mjs';
|
|
32
29
|
import { useScreenSize } from '../../common/hooks/useScreenSize.mjs';
|
|
30
|
+
import { renderPromptMedia } from '../helpers/promptMedia.mjs';
|
|
33
31
|
|
|
34
32
|
const ActionPrompt = ({
|
|
35
33
|
sentiment = 'neutral',
|
|
@@ -49,42 +47,12 @@ const ActionPrompt = ({
|
|
|
49
47
|
const titleId = useId();
|
|
50
48
|
const descId = useId();
|
|
51
49
|
const ariaLabelledByIds = [media['aria-hidden'] ? undefined : mediaId, ariaLabel ? undefined : titleId].filter(Boolean).join(' ');
|
|
52
|
-
const renderMedia = () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
alt: media['aria-label'] ?? ''
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (media?.avatar) {
|
|
62
|
-
const badge = media.avatar.badge ? media.avatar.badge : sentiment === 'proposition' ? {} : {
|
|
63
|
-
status: sentiment
|
|
64
|
-
};
|
|
65
|
-
return /*#__PURE__*/jsx(AvatarView, {
|
|
66
|
-
...media.avatar,
|
|
67
|
-
badge: badge,
|
|
68
|
-
"aria-label": media['aria-label'],
|
|
69
|
-
"aria-hidden": media['aria-hidden'],
|
|
70
|
-
id: mediaId,
|
|
71
|
-
size: 48,
|
|
72
|
-
children: media.avatar.asset
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return sentiment === 'proposition' ? /*#__PURE__*/jsx(AvatarView, {
|
|
76
|
-
id: mediaId,
|
|
77
|
-
size: 48,
|
|
78
|
-
"aria-label": media['aria-label'],
|
|
79
|
-
"aria-hidden": media['aria-hidden'],
|
|
80
|
-
children: /*#__PURE__*/jsx(GiftBox, {})
|
|
81
|
-
}) : /*#__PURE__*/jsx(StatusIcon, {
|
|
82
|
-
id: mediaId,
|
|
83
|
-
size: 48,
|
|
84
|
-
sentiment: sentiment,
|
|
85
|
-
iconLabel: media['aria-hidden'] ? null : media['aria-label']
|
|
86
|
-
});
|
|
87
|
-
};
|
|
50
|
+
const renderMedia = () => renderPromptMedia({
|
|
51
|
+
media,
|
|
52
|
+
sentiment,
|
|
53
|
+
mediaId,
|
|
54
|
+
imgClassName: 'wds-action-prompt--media-image'
|
|
55
|
+
});
|
|
88
56
|
return /*#__PURE__*/jsx(PrimitivePrompt, {
|
|
89
57
|
id: id,
|
|
90
58
|
sentiment: sentiment,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionPrompt.mjs","sources":["../../../src/prompt/ActionPrompt/ActionPrompt.tsx"],"sourcesContent":["import { AriaAttributes, ReactNode, useId } from 'react';\nimport { clsx } from 'clsx';\n\nimport
|
|
1
|
+
{"version":3,"file":"ActionPrompt.mjs","sources":["../../../src/prompt/ActionPrompt/ActionPrompt.tsx"],"sourcesContent":["import { AriaAttributes, ReactNode, useId } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\nimport { Breakpoint, Typography } from '../../common';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\nimport { useScreenSize } from '../../common/hooks/useScreenSize';\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\n\nexport type ActionPromptProps = {\n title: ReactNode;\n description?: ReactNode;\n /** @default {} */\n media?: PromptMedia;\n action: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n 'aria-label'?: AriaAttributes['aria-label'];\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid' | 'onDismiss'> & {\n /**\n * The sentiment determines the colour scheme\n * @default 'neutral'\n */\n sentiment?: PrimitivePromptProps['sentiment'];\n };\n\n/**\n * Use an action prompt for optional feedback that doesn't require immediate action, such as feature upsells, warnings, or suggestions. These prompts are typically used outside of core product flows (e.g., Launchpad, Recipient, or Transaction screens) and can be addressed at the user's convenience.\n *\n * If your message is about immediate user feedback (e.g., form submission errors, download failures, missing data warnings), use an [info prompt](https://storybook.wise.design/?path=/docs/prompts-infoprompt--docs) instead.\n *\n * Guidance can be found in the [design system](https://wise.design/components/action-prompt).\n */\nexport const ActionPrompt = ({\n sentiment = 'neutral',\n title,\n description,\n onDismiss,\n media = {},\n action,\n actionSecondary,\n id,\n className,\n 'data-testid': testId,\n 'aria-label': ariaLabel,\n}: ActionPromptProps) => {\n const isMobile = !useScreenSize(Breakpoint.MEDIUM);\n\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n ariaLabel ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const renderMedia = () =>\n renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-action-prompt--media-image',\n });\n\n return (\n <PrimitivePrompt\n id={id}\n sentiment={sentiment}\n data-testid={testId}\n className={clsx(\n 'wds-action-prompt',\n { 'wds-action-prompt--with-two-actions': !!actionSecondary },\n className,\n )}\n media={renderMedia()}\n actions={\n <>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n block={isMobile}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {/* @ts-expect-error onClick type mismatch */}\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n block={isMobile}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n </>\n }\n role=\"region\"\n onDismiss={onDismiss}\n {...(ariaLabel\n ? { 'aria-label': ariaLabel }\n : {\n 'aria-labelledby': ariaLabelledByIds,\n 'aria-describedby': descId,\n })}\n >\n <div className={clsx('d-flex', 'flex-column', 'justify-content-center')}>\n <Body id={titleId} type={Typography.BODY_LARGE_BOLD} className=\"wds-action-prompt__content\">\n {title}\n </Body>\n {description && (\n <Body id={descId} className=\"wds-action-prompt__content\">\n {description}\n </Body>\n )}\n </div>\n </PrimitivePrompt>\n );\n};\n\nexport default ActionPrompt;\n"],"names":["ActionPrompt","sentiment","title","description","onDismiss","media","action","actionSecondary","id","className","testId","ariaLabel","isMobile","useScreenSize","Breakpoint","MEDIUM","mediaId","useId","titleId","descId","ariaLabelledByIds","undefined","filter","Boolean","join","renderMedia","renderPromptMedia","imgClassName","_jsx","PrimitivePrompt","clsx","actions","_jsxs","_Fragment","children","Button","v2","size","priority","href","block","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD"],"mappings":"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"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var Body = require('../../body/Body.js');
|
|
6
|
+
var Button_resolver = require('../../button/Button.resolver.js');
|
|
7
|
+
require('../../common/theme.js');
|
|
8
|
+
require('../../common/direction.js');
|
|
9
|
+
require('../../common/propsValues/control.js');
|
|
10
|
+
var breakpoint = require('../../common/propsValues/breakpoint.js');
|
|
11
|
+
require('../../common/propsValues/size.js');
|
|
12
|
+
var typography = require('../../common/propsValues/typography.js');
|
|
13
|
+
require('../../common/propsValues/width.js');
|
|
14
|
+
require('../../common/propsValues/type.js');
|
|
15
|
+
require('../../common/propsValues/dateMode.js');
|
|
16
|
+
require('../../common/propsValues/monthFormat.js');
|
|
17
|
+
require('../../common/propsValues/position.js');
|
|
18
|
+
require('../../common/propsValues/layouts.js');
|
|
19
|
+
require('../../common/propsValues/status.js');
|
|
20
|
+
require('../../common/propsValues/sentiment.js');
|
|
21
|
+
require('../../common/propsValues/profileType.js');
|
|
22
|
+
require('../../common/propsValues/variant.js');
|
|
23
|
+
require('../../common/propsValues/scroll.js');
|
|
24
|
+
require('../../common/propsValues/markdownNodeType.js');
|
|
25
|
+
require('../../common/fileType.js');
|
|
26
|
+
require('@transferwise/icons');
|
|
27
|
+
require('react-intl');
|
|
28
|
+
require('../../common/closeButton/CloseButton.messages.js');
|
|
29
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
30
|
+
var LiveRegion = require('../../common/liveRegion/LiveRegion.js');
|
|
31
|
+
var PrimitivePrompt = require('../PrimitivePrompt/PrimitivePrompt.js');
|
|
32
|
+
var useScreenSize = require('../../common/hooks/useScreenSize.js');
|
|
33
|
+
var promptMedia = require('../helpers/promptMedia.js');
|
|
34
|
+
var Expander = require('../common/Expander/Expander.js');
|
|
35
|
+
var helpers = require('./helpers.js');
|
|
36
|
+
|
|
37
|
+
const CriticalBanner = ({
|
|
38
|
+
sentiment = 'negative',
|
|
39
|
+
title,
|
|
40
|
+
description,
|
|
41
|
+
media = {},
|
|
42
|
+
action,
|
|
43
|
+
actionSecondary,
|
|
44
|
+
expanded,
|
|
45
|
+
onToggle,
|
|
46
|
+
id,
|
|
47
|
+
className,
|
|
48
|
+
'data-testid': testId,
|
|
49
|
+
'aria-label': ariaLabel
|
|
50
|
+
}) => {
|
|
51
|
+
const isMobile = !useScreenSize.useScreenSize(breakpoint.Breakpoint.MEDIUM);
|
|
52
|
+
const mediaId = React.useId();
|
|
53
|
+
const titleId = React.useId();
|
|
54
|
+
const descId = React.useId();
|
|
55
|
+
const ariaLabelledByIds = [media['aria-hidden'] ? undefined : mediaId, ariaLabel || !title ? undefined : titleId].filter(Boolean).join(' ');
|
|
56
|
+
const hasActions = action || actionSecondary;
|
|
57
|
+
return /*#__PURE__*/jsxRuntime.jsx(LiveRegion.LiveRegion, {
|
|
58
|
+
"aria-live": "assertive",
|
|
59
|
+
announceOnChange: helpers.buildAnnouncementString({
|
|
60
|
+
title,
|
|
61
|
+
description,
|
|
62
|
+
expanded,
|
|
63
|
+
actionLabel: action?.label,
|
|
64
|
+
actionSecondaryLabel: actionSecondary?.label
|
|
65
|
+
}),
|
|
66
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(PrimitivePrompt.PrimitivePrompt, {
|
|
67
|
+
id: id,
|
|
68
|
+
sentiment: sentiment,
|
|
69
|
+
emphasis: sentiment === 'neutral' ? 'base' : 'elevated',
|
|
70
|
+
"data-testid": testId,
|
|
71
|
+
className: clsx.clsx('wds-critical-banner', {
|
|
72
|
+
'wds-critical-banner--collapsed': !expanded,
|
|
73
|
+
'wds-critical-banner--with-two-actions': !!actionSecondary
|
|
74
|
+
}, className),
|
|
75
|
+
media: promptMedia.renderPromptMedia({
|
|
76
|
+
media,
|
|
77
|
+
sentiment,
|
|
78
|
+
mediaId,
|
|
79
|
+
imgClassName: 'wds-critical-banner--media-image'
|
|
80
|
+
}),
|
|
81
|
+
actions: Expander.shouldShowWhenExpanded({
|
|
82
|
+
expanded,
|
|
83
|
+
hasContent: !!hasActions
|
|
84
|
+
}) ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
85
|
+
children: [actionSecondary &&
|
|
86
|
+
/*#__PURE__*/
|
|
87
|
+
// @ts-expect-error onClick type mismatch
|
|
88
|
+
jsxRuntime.jsx(Button_resolver.default, {
|
|
89
|
+
v2: true,
|
|
90
|
+
size: "md",
|
|
91
|
+
priority: "secondary",
|
|
92
|
+
href: actionSecondary.href,
|
|
93
|
+
block: isMobile,
|
|
94
|
+
onClick: actionSecondary?.onClick,
|
|
95
|
+
children: actionSecondary.label
|
|
96
|
+
}), action &&
|
|
97
|
+
/*#__PURE__*/
|
|
98
|
+
// @ts-expect-error onClick type mismatch
|
|
99
|
+
jsxRuntime.jsx(Button_resolver.default, {
|
|
100
|
+
v2: true,
|
|
101
|
+
size: "md",
|
|
102
|
+
priority: "primary",
|
|
103
|
+
href: action.href,
|
|
104
|
+
block: isMobile,
|
|
105
|
+
onClick: action.onClick,
|
|
106
|
+
children: action.label
|
|
107
|
+
})]
|
|
108
|
+
}) : undefined,
|
|
109
|
+
role: "region",
|
|
110
|
+
...(ariaLabel ? {
|
|
111
|
+
'aria-label': ariaLabel
|
|
112
|
+
} : {
|
|
113
|
+
'aria-labelledby': ariaLabelledByIds,
|
|
114
|
+
'aria-describedby': descId
|
|
115
|
+
}),
|
|
116
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
117
|
+
className: clsx.clsx('d-flex', 'flex-column', 'justify-content-center', 'wds-critical-banner__text-wrapper'),
|
|
118
|
+
children: [title && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
|
|
119
|
+
id: titleId,
|
|
120
|
+
type: typography.Typography.BODY_LARGE_BOLD,
|
|
121
|
+
className: "wds-critical-banner__content",
|
|
122
|
+
children: title
|
|
123
|
+
}), Expander.shouldShowWhenExpanded({
|
|
124
|
+
expanded,
|
|
125
|
+
hasContent: !!description,
|
|
126
|
+
alwaysShow: !title
|
|
127
|
+
}) && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
|
|
128
|
+
id: descId,
|
|
129
|
+
className: clsx.clsx('wds-critical-banner__content', {
|
|
130
|
+
'wds-critical-banner__description--collapsed': !expanded && !title
|
|
131
|
+
}),
|
|
132
|
+
children: description
|
|
133
|
+
})]
|
|
134
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Expander.ExpanderToggle, {
|
|
135
|
+
expanded: expanded,
|
|
136
|
+
size: 24,
|
|
137
|
+
className: "wds-critical-banner__toggle",
|
|
138
|
+
onToggle: onToggle
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
exports.CriticalBanner = CriticalBanner;
|
|
145
|
+
//# sourceMappingURL=CriticalBanner.js.map
|