@transferwise/components 46.129.0 → 46.130.0
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/card/Card.js.map +1 -1
- package/build/card/Card.mjs.map +1 -1
- package/build/common/{card/Card.js → baseCard/BaseCard.js} +4 -4
- package/build/common/baseCard/BaseCard.js.map +1 -0
- package/build/common/{card/Card.mjs → baseCard/BaseCard.mjs} +4 -4
- package/build/common/baseCard/BaseCard.mjs.map +1 -0
- package/build/criticalBanner/CriticalCommsBanner.js +68 -3
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +69 -4
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/index.js +4 -4
- package/build/index.mjs +1 -1
- package/build/main.css +83 -65
- package/build/promoCard/PromoCard.js +2 -2
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs +2 -2
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/styles/criticalBanner/CriticalCommsBanner.css +33 -15
- package/build/styles/listItem/ListItem.css +1 -1
- package/build/styles/main.css +83 -65
- package/build/types/card/Card.d.ts +1 -1
- package/build/types/common/{card/Card.d.ts → baseCard/BaseCard.d.ts} +8 -8
- package/build/types/common/baseCard/BaseCard.d.ts.map +1 -0
- package/build/types/common/baseCard/index.d.ts +3 -0
- package/build/types/common/baseCard/index.d.ts.map +1 -0
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +4 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/criticalBanner/index.d.ts +1 -0
- package/build/types/criticalBanner/index.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +3 -3
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/card/Card.story.tsx +3 -2
- package/src/card/Card.tsx +1 -1
- package/src/common/{card/Card.less → baseCard/BaseCard.less} +1 -1
- package/src/common/{card/Card.story.tsx → baseCard/BaseCard.story.tsx} +5 -5
- package/src/common/{card/Card.test.tsx → baseCard/BaseCard.test.tsx} +11 -12
- package/src/common/{card/Card.tsx → baseCard/BaseCard.tsx} +9 -9
- package/src/common/baseCard/index.ts +2 -0
- package/src/criticalBanner/CriticalCommsBanner.css +33 -15
- package/src/criticalBanner/CriticalCommsBanner.less +46 -36
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +9 -15
- package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +70 -0
- package/src/criticalBanner/CriticalCommsBanner.test.tsx +66 -0
- package/src/criticalBanner/CriticalCommsBanner.tsx +54 -5
- package/src/criticalBanner/index.ts +1 -0
- package/src/index.ts +2 -1
- package/src/listItem/ListItem.css +1 -1
- package/src/listItem/ListItem.less +4 -2
- package/src/listItem/_stories/Breakpoints/ListItem.noMedia.test.story.tsx +62 -0
- package/src/listItem/_stories/Breakpoints/ListItem.sideMedia.test.story.tsx +62 -0
- package/src/listItem/_stories/Breakpoints/ListItem.stackedMedia.test.story.tsx +62 -0
- package/src/listItem/_stories/ListItem.story.tsx +3 -2
- package/src/main.css +83 -65
- package/src/main.less +2 -2
- package/src/promoCard/PromoCard.tsx +6 -5
- package/build/common/card/Card.js.map +0 -1
- package/build/common/card/Card.mjs.map +0 -1
- package/build/types/common/card/Card.d.ts.map +0 -1
- package/build/types/common/card/index.d.ts +0 -3
- package/build/types/common/card/index.d.ts.map +0 -1
- package/src/common/card/index.ts +0 -2
- /package/build/styles/common/{card/Card.css → baseCard/BaseCard.css} +0 -0
- /package/src/common/{card/Card.css → baseCard/BaseCard.css} +0 -0
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import Alert from '
|
|
1
|
+
import { Alert as AlertIcon, ClockBorderless as ClockIcon } from '@transferwise/icons';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
import Alert from '../alert';
|
|
6
|
+
import { Sentiment } from '../common';
|
|
7
|
+
import Circle, { CircleProps } from '../common/circle';
|
|
8
|
+
import SentimentSurface from '../sentimentSurface';
|
|
9
|
+
|
|
10
|
+
export type CriticalCommsBannerSentiment =
|
|
11
|
+
| `${Sentiment.WARNING}`
|
|
12
|
+
| `${Sentiment.NEGATIVE}`
|
|
13
|
+
| `${Sentiment.NEUTRAL}`;
|
|
3
14
|
|
|
4
15
|
export type CriticalCommsBannerProps = {
|
|
5
16
|
title: string;
|
|
@@ -9,20 +20,58 @@ export type CriticalCommsBannerProps = {
|
|
|
9
20
|
href?: string;
|
|
10
21
|
onClick?: () => void;
|
|
11
22
|
};
|
|
23
|
+
sentiment?: CriticalCommsBannerSentiment;
|
|
12
24
|
className?: string;
|
|
13
25
|
};
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
const makeSurface = (sentiment: CriticalCommsBannerSentiment) => {
|
|
28
|
+
const Surface = (props: PropsWithChildren<Pick<CircleProps, 'className'>>) => (
|
|
29
|
+
<SentimentSurface as="span" emphasis="elevated" sentiment={sentiment} {...props} />
|
|
30
|
+
);
|
|
31
|
+
Surface.displayName = `CriticalCommsSurface(${sentiment})`;
|
|
32
|
+
return Surface;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const iconBySentiment: Record<CriticalCommsBannerSentiment, React.ReactNode> = {
|
|
36
|
+
[Sentiment.NEGATIVE]: (
|
|
37
|
+
<Circle as={makeSurface(Sentiment.NEGATIVE)} size={32} className="status-circle negative">
|
|
38
|
+
<AlertIcon className="status-icon light" />
|
|
39
|
+
</Circle>
|
|
40
|
+
),
|
|
41
|
+
[Sentiment.WARNING]: (
|
|
42
|
+
<Circle as={makeSurface(Sentiment.WARNING)} size={32} className="status-circle warning">
|
|
43
|
+
<AlertIcon className="status-icon dark" />
|
|
44
|
+
</Circle>
|
|
45
|
+
),
|
|
46
|
+
[Sentiment.NEUTRAL]: (
|
|
47
|
+
<Circle as={makeSurface(Sentiment.NEUTRAL)} size={32} className="status-circle neutral">
|
|
48
|
+
<ClockIcon className="status-icon dark" />
|
|
49
|
+
</Circle>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function CriticalCommsBanner({
|
|
54
|
+
title,
|
|
55
|
+
subtitle,
|
|
56
|
+
action,
|
|
57
|
+
sentiment = Sentiment.NEGATIVE,
|
|
58
|
+
className,
|
|
59
|
+
}: CriticalCommsBannerProps) {
|
|
16
60
|
return (
|
|
17
|
-
<
|
|
61
|
+
<SentimentSurface
|
|
62
|
+
sentiment={sentiment}
|
|
63
|
+
emphasis="elevated"
|
|
64
|
+
className={clsx('critical-comms', className)}
|
|
65
|
+
>
|
|
18
66
|
<Alert
|
|
19
67
|
title={title}
|
|
20
68
|
message={subtitle}
|
|
21
69
|
action={{ onClick: action?.onClick, target: action?.href, text: action?.label }}
|
|
22
70
|
className={className}
|
|
23
|
-
type=
|
|
71
|
+
type={sentiment}
|
|
72
|
+
icon={iconBySentiment[sentiment]}
|
|
24
73
|
/>
|
|
25
|
-
</
|
|
74
|
+
</SentimentSurface>
|
|
26
75
|
);
|
|
27
76
|
}
|
|
28
77
|
|
package/src/index.ts
CHANGED
|
@@ -154,8 +154,9 @@ export { Chip, default as Chips } from './chips';
|
|
|
154
154
|
export { default as CircularButton } from './circularButton';
|
|
155
155
|
export { default as Option } from './common/Option';
|
|
156
156
|
export { default as BottomSheet } from './common/bottomSheet';
|
|
157
|
-
export { default as BaseCard } from './common/
|
|
157
|
+
export { default as BaseCard } from './common/baseCard';
|
|
158
158
|
export { default as CriticalCommsBanner } from './criticalBanner';
|
|
159
|
+
export type { CriticalCommsBannerProps } from './criticalBanner';
|
|
159
160
|
export { default as DateInput } from './dateInput';
|
|
160
161
|
export { default as DateLookup } from './dateLookup';
|
|
161
162
|
export { default as Decision } from './decision';
|
|
@@ -599,7 +599,7 @@
|
|
|
599
599
|
.wds-list-item.disabled--has-prompt-reason .wds-list-item-prompt {
|
|
600
600
|
opacity: 0.93;
|
|
601
601
|
}
|
|
602
|
-
.wds-list-item-spotlight {
|
|
602
|
+
.wds-list-item-spotlight .wds-list-item-gridWrapper {
|
|
603
603
|
padding-left: 12px;
|
|
604
604
|
padding-left: var(--size-12);
|
|
605
605
|
padding-right: 12px;
|
|
@@ -266,8 +266,10 @@
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
&-spotlight {
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
.wds-list-item-gridWrapper {
|
|
270
|
+
padding-left: var(--size-12);
|
|
271
|
+
padding-right: var(--size-12);
|
|
272
|
+
}
|
|
271
273
|
|
|
272
274
|
&-active {
|
|
273
275
|
background-color: var(--color-background-neutral);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import List from '../../../list';
|
|
3
|
+
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
4
|
+
import {
|
|
5
|
+
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
6
|
+
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
7
|
+
SB_LIST_ITEM_PROMPTS as PROMPT,
|
|
8
|
+
SB_LIST_ITEM_TEXT as TEXT,
|
|
9
|
+
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
10
|
+
} from '../subcomponents';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: ListItem,
|
|
14
|
+
title: 'Content/ListItem/tests/Breakpoints/NoMedia',
|
|
15
|
+
tags: ['!autodocs', '!manifest'],
|
|
16
|
+
parameters: {
|
|
17
|
+
controls: { disable: true },
|
|
18
|
+
actions: { disable: true },
|
|
19
|
+
knobs: { disable: true },
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<ListItemProps>;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<ListItemProps>;
|
|
24
|
+
|
|
25
|
+
const widths = [240, 241];
|
|
26
|
+
|
|
27
|
+
const sharedProps: Partial<ListItemProps> = {
|
|
28
|
+
subtitle: TEXT.subtitle,
|
|
29
|
+
valueTitle: TEXT.valueTitle,
|
|
30
|
+
valueSubtitle: TEXT.valueSubtitle,
|
|
31
|
+
additionalInfo: INFO.nonInteractive,
|
|
32
|
+
control: CONTROLS.switch,
|
|
33
|
+
prompt: PROMPT.interactive,
|
|
34
|
+
media: MEDIA.avatarSingle,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const NoMedia: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div
|
|
40
|
+
style={{
|
|
41
|
+
display: 'grid',
|
|
42
|
+
gridTemplateColumns: widths.map((w) => `${w}px`).join(' '),
|
|
43
|
+
gap: 16,
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{widths.map((w) => (
|
|
47
|
+
<div key={w} style={{ textAlign: 'center', fontWeight: 'bold' }}>
|
|
48
|
+
{w}px
|
|
49
|
+
</div>
|
|
50
|
+
))}
|
|
51
|
+
{widths.map((w) => (
|
|
52
|
+
<div key={w} style={{ width: w }}>
|
|
53
|
+
<List>
|
|
54
|
+
<ListItem {...sharedProps} title="Inactive Spotlight" spotlight="inactive" />
|
|
55
|
+
<ListItem {...sharedProps} title="Active Spotlight" spotlight="active" />
|
|
56
|
+
<ListItem {...sharedProps} title="No Spotlight" />
|
|
57
|
+
</List>
|
|
58
|
+
</div>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import List from '../../../list';
|
|
3
|
+
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
4
|
+
import {
|
|
5
|
+
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
6
|
+
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
7
|
+
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
8
|
+
SB_LIST_ITEM_PROMPTS as PROMPT,
|
|
9
|
+
SB_LIST_ITEM_TEXT as TEXT,
|
|
10
|
+
} from '../subcomponents';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: ListItem,
|
|
14
|
+
title: 'Content/ListItem/tests/Breakpoints/SideMedia',
|
|
15
|
+
tags: ['!autodocs', '!manifest'],
|
|
16
|
+
parameters: {
|
|
17
|
+
controls: { disable: true },
|
|
18
|
+
actions: { disable: true },
|
|
19
|
+
knobs: { disable: true },
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<ListItemProps>;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<ListItemProps>;
|
|
24
|
+
|
|
25
|
+
const widths = [332, 333];
|
|
26
|
+
|
|
27
|
+
const sharedProps: Partial<ListItemProps> = {
|
|
28
|
+
subtitle: TEXT.subtitle,
|
|
29
|
+
valueTitle: TEXT.valueTitle,
|
|
30
|
+
valueSubtitle: TEXT.valueSubtitle,
|
|
31
|
+
additionalInfo: INFO.nonInteractive,
|
|
32
|
+
control: CONTROLS.switch,
|
|
33
|
+
prompt: PROMPT.interactive,
|
|
34
|
+
media: MEDIA.avatarSingle,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const SideMedia: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div
|
|
40
|
+
style={{
|
|
41
|
+
display: 'grid',
|
|
42
|
+
gridTemplateColumns: widths.map((w) => `${w}px`).join(' '),
|
|
43
|
+
gap: 16,
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{widths.map((w) => (
|
|
47
|
+
<div key={w} style={{ textAlign: 'center', fontWeight: 'bold' }}>
|
|
48
|
+
{w}px
|
|
49
|
+
</div>
|
|
50
|
+
))}
|
|
51
|
+
{widths.map((w) => (
|
|
52
|
+
<div key={w} style={{ width: w }}>
|
|
53
|
+
<List>
|
|
54
|
+
<ListItem {...sharedProps} title="Inactive Spotlight" spotlight="inactive" />
|
|
55
|
+
<ListItem {...sharedProps} title="Active Spotlight" spotlight="active" />
|
|
56
|
+
<ListItem {...sharedProps} title="No Spotlight" />
|
|
57
|
+
</List>
|
|
58
|
+
</div>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import List from '../../../list';
|
|
3
|
+
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
4
|
+
import {
|
|
5
|
+
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
6
|
+
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
7
|
+
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
8
|
+
SB_LIST_ITEM_PROMPTS as PROMPT,
|
|
9
|
+
SB_LIST_ITEM_TEXT as TEXT,
|
|
10
|
+
} from '../subcomponents';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: ListItem,
|
|
14
|
+
title: 'Content/ListItem/tests/Breakpoints/StackedMedia',
|
|
15
|
+
tags: ['!autodocs', '!manifest'],
|
|
16
|
+
parameters: {
|
|
17
|
+
controls: { disable: true },
|
|
18
|
+
actions: { disable: true },
|
|
19
|
+
knobs: { disable: true },
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<ListItemProps>;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<ListItemProps>;
|
|
24
|
+
|
|
25
|
+
const widths = [308, 309];
|
|
26
|
+
|
|
27
|
+
const sharedProps: Partial<ListItemProps> = {
|
|
28
|
+
subtitle: TEXT.subtitle,
|
|
29
|
+
valueTitle: TEXT.valueTitle,
|
|
30
|
+
valueSubtitle: TEXT.valueSubtitle,
|
|
31
|
+
additionalInfo: INFO.nonInteractive,
|
|
32
|
+
control: CONTROLS.switch,
|
|
33
|
+
prompt: PROMPT.interactive,
|
|
34
|
+
media: MEDIA.avatarSingle,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const StackedMedia: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div
|
|
40
|
+
style={{
|
|
41
|
+
display: 'grid',
|
|
42
|
+
gridTemplateColumns: widths.map((w) => `${w}px`).join(' '),
|
|
43
|
+
gap: 16,
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{widths.map((w) => (
|
|
47
|
+
<div key={w} style={{ textAlign: 'center', fontWeight: 'bold' }}>
|
|
48
|
+
{w}px
|
|
49
|
+
</div>
|
|
50
|
+
))}
|
|
51
|
+
{widths.map((w) => (
|
|
52
|
+
<div key={w} style={{ width: w }}>
|
|
53
|
+
<List>
|
|
54
|
+
<ListItem {...sharedProps} title="Inactive Spotlight" spotlight="inactive" />
|
|
55
|
+
<ListItem {...sharedProps} title="Active Spotlight" spotlight="active" />
|
|
56
|
+
<ListItem {...sharedProps} title="No Spotlight" />
|
|
57
|
+
</List>
|
|
58
|
+
</div>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
@@ -428,8 +428,9 @@ export const Spotlight: StoryObj<PreviewStoryArgs> = {
|
|
|
428
428
|
|
|
429
429
|
return (
|
|
430
430
|
<List>
|
|
431
|
-
<ListItem {...props} {...previewProps} spotlight="inactive" />
|
|
432
|
-
<ListItem {...props} {...previewProps} spotlight="active" />
|
|
431
|
+
<ListItem {...props} {...previewProps} title="Inactive Spotlight" spotlight="inactive" />
|
|
432
|
+
<ListItem {...props} {...previewProps} title="Active Spotlight" spotlight="active" />
|
|
433
|
+
<ListItem {...props} {...previewProps} title="No Spotlight" />
|
|
433
434
|
</List>
|
|
434
435
|
);
|
|
435
436
|
},
|
package/src/main.css
CHANGED
|
@@ -485,37 +485,55 @@
|
|
|
485
485
|
--color-sentiment-background-surface-hover: #CAF1F1;
|
|
486
486
|
--color-sentiment-background-surface-active: #B6ECEC;
|
|
487
487
|
}
|
|
488
|
-
.
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
.critical-comms {
|
|
489
|
+
border-radius: 16px;
|
|
490
|
+
border-radius: var(--radius-medium);
|
|
491
|
+
overflow: hidden;
|
|
491
492
|
}
|
|
492
|
-
.
|
|
493
|
-
color: var(--color-
|
|
493
|
+
.critical-comms .alert {
|
|
494
|
+
background-color: var(--color-sentiment-background-surface);
|
|
495
|
+
color: var(--color-sentiment-content-primary);
|
|
496
|
+
margin-bottom: 0;
|
|
497
|
+
}
|
|
498
|
+
.critical-comms .alert .np-text-title-body {
|
|
499
|
+
color: var(--color-sentiment-content-primary);
|
|
494
500
|
}
|
|
495
|
-
.
|
|
501
|
+
.critical-comms .status-circle.negative {
|
|
496
502
|
background-color: #ffffff;
|
|
497
503
|
background-color: var(--color-background-screen);
|
|
498
504
|
}
|
|
499
|
-
.
|
|
500
|
-
color:
|
|
505
|
+
.critical-comms .status-circle.negative .status-icon {
|
|
506
|
+
color: #37517e;
|
|
507
|
+
color: var(--color-content-primary);
|
|
501
508
|
}
|
|
502
|
-
.
|
|
509
|
+
.critical-comms .alert__message .alert__action {
|
|
503
510
|
margin-top: 16px;
|
|
504
511
|
margin-top: var(--size-16);
|
|
505
512
|
}
|
|
506
|
-
.
|
|
507
|
-
--Button-
|
|
508
|
-
--Button-
|
|
509
|
-
--Button-
|
|
513
|
+
.critical-comms .wds-Button {
|
|
514
|
+
--Button-color: var(--color-content-primary);
|
|
515
|
+
--Button-color-hover: var(--color-content-primary);
|
|
516
|
+
--Button-color-active: var(--color-content-primary);
|
|
517
|
+
--Button-background: var(--color-background-screen);
|
|
518
|
+
--Button-background-hover: var(--color-sentiment-interactive-primary-hover);
|
|
519
|
+
--Button-background-active: var(--color-sentiment-interactive-primary-active);
|
|
520
|
+
}
|
|
521
|
+
.critical-comms .alert-warning .wds-Button {
|
|
522
|
+
--Button-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover);
|
|
523
|
+
--Button-background-active: var(--color-sentiment-interactive-secondary-neutral-active);
|
|
510
524
|
}
|
|
511
525
|
@media (min-width: 768px) {
|
|
512
|
-
.
|
|
526
|
+
.critical-comms .alert-warning .alert__message,
|
|
527
|
+
.critical-comms .alert-negative .alert__message,
|
|
528
|
+
.critical-comms .alert-neutral .alert__message {
|
|
513
529
|
flex-direction: row;
|
|
514
530
|
justify-content: space-between;
|
|
515
531
|
align-items: center;
|
|
516
532
|
width: 100%;
|
|
517
533
|
}
|
|
518
|
-
.
|
|
534
|
+
.critical-comms .alert-warning .alert__message .alert__action,
|
|
535
|
+
.critical-comms .alert-negative .alert__message .alert__action,
|
|
536
|
+
.critical-comms .alert-neutral .alert__message .alert__action {
|
|
519
537
|
margin-top: 0;
|
|
520
538
|
margin-left: 16px;
|
|
521
539
|
margin-left: var(--padding-small);
|
|
@@ -1969,6 +1987,55 @@
|
|
|
1969
1987
|
border-radius: var(--radius-full);
|
|
1970
1988
|
box-shadow: inset 0 0 0 var(--circle-border-width) var(--circle-border-color);
|
|
1971
1989
|
}
|
|
1990
|
+
/* @define Card */
|
|
1991
|
+
.np-Card {
|
|
1992
|
+
--Card-background-color: var(--color-background-neutral);
|
|
1993
|
+
--Card-border-radius: var(--size-32);
|
|
1994
|
+
--Card-flex-gap: var(--size-16);
|
|
1995
|
+
--Card-padding: var(--size-24);
|
|
1996
|
+
--Card-closeButton-position: var(--size-16);
|
|
1997
|
+
--Card-max-width: initial;
|
|
1998
|
+
display: flex;
|
|
1999
|
+
flex-direction: column;
|
|
2000
|
+
align-items: stretch;
|
|
2001
|
+
background-color: rgba(134,167,189,0.10196);
|
|
2002
|
+
background-color: var(--Card-background-color);
|
|
2003
|
+
border-radius: 32px;
|
|
2004
|
+
border-radius: var(--Card-border-radius);
|
|
2005
|
+
gap: 16px;
|
|
2006
|
+
gap: var(--Card-flex-gap);
|
|
2007
|
+
padding: 24px;
|
|
2008
|
+
padding: var(--Card-padding);
|
|
2009
|
+
position: relative;
|
|
2010
|
+
box-sizing: border-box;
|
|
2011
|
+
overflow: hidden;
|
|
2012
|
+
}
|
|
2013
|
+
@media (min-width: 576px) {
|
|
2014
|
+
.np-Card {
|
|
2015
|
+
max-width: var(--Card-max-width);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
.np-Card.is-disabled .np-Card-closeButton {
|
|
2019
|
+
cursor: not-allowed;
|
|
2020
|
+
}
|
|
2021
|
+
.np-theme-personal--dark .np-Card {
|
|
2022
|
+
--Card-background-color: var(--color-background-elevated);
|
|
2023
|
+
}
|
|
2024
|
+
.np-Card-closeButton {
|
|
2025
|
+
position: absolute;
|
|
2026
|
+
z-index: 100;
|
|
2027
|
+
top: var(--Card-closeButton-position);
|
|
2028
|
+
right: var(--Card-closeButton-position);
|
|
2029
|
+
}
|
|
2030
|
+
[dir="rtl"] .np-Card-closeButton {
|
|
2031
|
+
left: var(--Card-closeButton-position);
|
|
2032
|
+
right: auto;
|
|
2033
|
+
}
|
|
2034
|
+
.np-Card--small {
|
|
2035
|
+
--Card-border-radius: var(--size-16);
|
|
2036
|
+
--Card-closeButton-position: var(--size-8);
|
|
2037
|
+
--Card-padding: var(--size-16);
|
|
2038
|
+
}
|
|
1972
2039
|
.np-bottom-sheet {
|
|
1973
2040
|
border-radius: 10px 10px 0 0;
|
|
1974
2041
|
}
|
|
@@ -2022,55 +2089,6 @@
|
|
|
2022
2089
|
padding: 0 16px 16px;
|
|
2023
2090
|
padding: 0 var(--size-16) var(--size-16);
|
|
2024
2091
|
}
|
|
2025
|
-
/* @define Card */
|
|
2026
|
-
.np-Card {
|
|
2027
|
-
--Card-background-color: var(--color-background-neutral);
|
|
2028
|
-
--Card-border-radius: var(--size-32);
|
|
2029
|
-
--Card-flex-gap: var(--size-16);
|
|
2030
|
-
--Card-padding: var(--size-24);
|
|
2031
|
-
--Card-closeButton-position: var(--size-16);
|
|
2032
|
-
--Card-max-width: initial;
|
|
2033
|
-
display: flex;
|
|
2034
|
-
flex-direction: column;
|
|
2035
|
-
align-items: stretch;
|
|
2036
|
-
background-color: rgba(134,167,189,0.10196);
|
|
2037
|
-
background-color: var(--Card-background-color);
|
|
2038
|
-
border-radius: 32px;
|
|
2039
|
-
border-radius: var(--Card-border-radius);
|
|
2040
|
-
gap: 16px;
|
|
2041
|
-
gap: var(--Card-flex-gap);
|
|
2042
|
-
padding: 24px;
|
|
2043
|
-
padding: var(--Card-padding);
|
|
2044
|
-
position: relative;
|
|
2045
|
-
box-sizing: border-box;
|
|
2046
|
-
overflow: hidden;
|
|
2047
|
-
}
|
|
2048
|
-
@media (min-width: 576px) {
|
|
2049
|
-
.np-Card {
|
|
2050
|
-
max-width: var(--Card-max-width);
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
|
-
.np-Card.is-disabled .np-Card-closeButton {
|
|
2054
|
-
cursor: not-allowed;
|
|
2055
|
-
}
|
|
2056
|
-
.np-theme-personal--dark .np-Card {
|
|
2057
|
-
--Card-background-color: var(--color-background-elevated);
|
|
2058
|
-
}
|
|
2059
|
-
.np-Card-closeButton {
|
|
2060
|
-
position: absolute;
|
|
2061
|
-
z-index: 100;
|
|
2062
|
-
top: var(--Card-closeButton-position);
|
|
2063
|
-
right: var(--Card-closeButton-position);
|
|
2064
|
-
}
|
|
2065
|
-
[dir="rtl"] .np-Card-closeButton {
|
|
2066
|
-
left: var(--Card-closeButton-position);
|
|
2067
|
-
right: auto;
|
|
2068
|
-
}
|
|
2069
|
-
.np-Card--small {
|
|
2070
|
-
--Card-border-radius: var(--size-16);
|
|
2071
|
-
--Card-closeButton-position: var(--size-8);
|
|
2072
|
-
--Card-padding: var(--size-16);
|
|
2073
|
-
}
|
|
2074
2092
|
.np-close-button {
|
|
2075
2093
|
transition: color 0.15s ease-in-out;
|
|
2076
2094
|
color: #00a2dd;
|
|
@@ -3692,7 +3710,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3692
3710
|
.wds-list-item.disabled--has-prompt-reason .wds-list-item-prompt {
|
|
3693
3711
|
opacity: 0.93;
|
|
3694
3712
|
}
|
|
3695
|
-
.wds-list-item-spotlight {
|
|
3713
|
+
.wds-list-item-spotlight .wds-list-item-gridWrapper {
|
|
3696
3714
|
padding-left: 12px;
|
|
3697
3715
|
padding-left: var(--size-12);
|
|
3698
3716
|
padding-right: 12px;
|
package/src/main.less
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
@import "./chips/Chip.less";
|
|
20
20
|
@import "./circularButton/CircularButton.less";
|
|
21
21
|
@import "./common/circle/Circle.less";
|
|
22
|
+
@import "./common/baseCard/BaseCard.less";
|
|
22
23
|
@import "./common/bottomSheet/BottomSheet.less";
|
|
23
|
-
@import "./common/card/Card.less";
|
|
24
24
|
@import "./common/closeButton/CloseButton.less";
|
|
25
25
|
@import "./common/Option/Option.less";
|
|
26
26
|
@import "./common/panel/Panel.less";
|
|
@@ -90,4 +90,4 @@
|
|
|
90
90
|
@import "./prompt/ActionPrompt/ActionPrompt.less";
|
|
91
91
|
|
|
92
92
|
// List all less files in src in alphabetical order: find -s src -type f -name '*.less' ! -name 'main.less'
|
|
93
|
-
// Make sure you are not referencing main.less itself in this file!
|
|
93
|
+
// Make sure you are not referencing main.less itself in this file!
|
|
@@ -4,7 +4,7 @@ import React, { forwardRef, FunctionComponent, useEffect, useId, useState } from
|
|
|
4
4
|
|
|
5
5
|
import Body from '../body';
|
|
6
6
|
import { Typography } from '../common';
|
|
7
|
-
import
|
|
7
|
+
import BaseCard, { type BaseCardProps } from '../common/baseCard';
|
|
8
8
|
import Display from '../display';
|
|
9
9
|
import Image from '../image/Image';
|
|
10
10
|
import Title from '../title';
|
|
@@ -82,7 +82,7 @@ export interface PromoCardCommonProps {
|
|
|
82
82
|
ref?: ReferenceType;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<
|
|
85
|
+
export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<BaseCardProps, 'children'> {
|
|
86
86
|
/**
|
|
87
87
|
* Optional prop to prompts a user to save the linked URL instead of
|
|
88
88
|
* navigating to it
|
|
@@ -121,7 +121,8 @@ export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps
|
|
|
121
121
|
value?: never;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export interface PromoCardCheckedProps
|
|
124
|
+
export interface PromoCardCheckedProps
|
|
125
|
+
extends PromoCardCommonProps, Omit<BaseCardProps, 'children'> {
|
|
125
126
|
/** Specify the initial checked attribute of the PromoCard */
|
|
126
127
|
defaultChecked?: boolean;
|
|
127
128
|
|
|
@@ -368,7 +369,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
|
|
|
368
369
|
}, [defaultChecked, isChecked]);
|
|
369
370
|
|
|
370
371
|
return (
|
|
371
|
-
<
|
|
372
|
+
<BaseCard {...commonProps} {...checkedProps} {...props}>
|
|
372
373
|
{(value === state || checked) && (
|
|
373
374
|
<span className="np-Card-check">
|
|
374
375
|
<Check size={24} aria-hidden="true" />
|
|
@@ -386,7 +387,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
|
|
|
386
387
|
)}
|
|
387
388
|
|
|
388
389
|
<PromoCardIndicator label={indicatorLabel} icon={getIconType()} isSmall={isSmall} />
|
|
389
|
-
</
|
|
390
|
+
</BaseCard>
|
|
390
391
|
);
|
|
391
392
|
},
|
|
392
393
|
) as PolymorphicPromoCard;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../src/common/card/Card.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { MouseEvent, type ReactNode, forwardRef, useRef } from 'react';\n\nimport { CloseButton } from '../closeButton';\nimport { stopPropagation } from '../domHelpers';\n\nexport interface CardProps {\n /** Content to display inside Card. */\n children: ReactNode;\n\n /** Optional prop to specify classNames onto the Card */\n className?: string;\n\n /** Optional prop to specify the ID on to Card */\n id?: string;\n\n /** Specify whether the Card is disabled, or not */\n isDisabled?: boolean;\n\n /** Specify whether the Card is sized small or not */\n isSmall?: boolean;\n\n /** Optionally specify Card onDismiss function */\n onDismiss?: () => void;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n}\n\n/**\n * Card component.\n *\n * A card is a container for content that is used to group related information.\n * It can be used to display information in a structured way, and can be\n * customized with various props to suit different use cases.\n *\n * @param {Object} props - The component props.\n * @param {ReactNode} children - The content to display inside the card.\n * @param {string} className - Optional class name(s) to add to the card container.\n * @param {string} id - Optional ID to add to the card container.\n * @param {boolean} isDisabled - Whether the card is disabled or not.\n * @param {boolean} isSmall - Whether the card is small or not.\n * @param {(event_: MouseEvent<HTMLButtonElement>) => void} onDismiss - Optional function to call when the card is dismissed.\n * @param {string} testId - Optional ID to add to the card container for testing purposes.\n * @returns {React.JSX.Element} - The card component.\n * @example\n * <Card>\n * <p>Hello World!</p>\n * </Card>\n */\nconst Card = forwardRef<HTMLDivElement, CardProps>(\n (\n {\n className,\n children = null,\n id,\n isDisabled = false,\n isSmall = false,\n onDismiss,\n testId,\n ...props\n },\n ref,\n ) => {\n const closeButtonReference = useRef(null);\n\n return (\n <div\n ref={ref}\n className={clsx(\n 'np-Card',\n {\n 'np-Card--small': !!isSmall,\n 'is-disabled': !!isDisabled,\n },\n className,\n )}\n id={id}\n data-testid={testId}\n {...props}\n >\n {onDismiss && (\n <CloseButton\n ref={closeButtonReference}\n className=\"np-Card-closeButton\"\n size={isSmall ? 'sm' : 'md'}\n isDisabled={isDisabled}\n testId=\"close-button\"\n onClick={(e) => {\n stopPropagation(e);\n onDismiss();\n }}\n />\n )}\n {children}\n </div>\n );\n },\n);\n\nCard.displayName = 'Card';\n\nexport default Card;\n"],"names":["Card","forwardRef","className","children","id","isDisabled","isSmall","onDismiss","testId","props","ref","closeButtonReference","useRef","_jsxs","clsx","_jsx","CloseButton","size","onClick","e","stopPropagation","displayName"],"mappings":";;;;;;;;;;AAkDA,MAAMA,IAAI,gBAAGC,gBAAU,CACrB,CACE;EACEC,SAAS;AACTC,EAAAA,QAAQ,GAAG,IAAI;EACfC,EAAE;AACFC,EAAAA,UAAU,GAAG,KAAK;AAClBC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,MAAM;EACN,GAAGC;AAAK,CACT,EACDC,GAAG,KACD;AACF,EAAA,MAAMC,oBAAoB,GAAGC,YAAM,CAAC,IAAI,CAAC;AAEzC,EAAA,oBACEC,eAAA,CAAA,KAAA,EAAA;AACEH,IAAAA,GAAG,EAAEA,GAAI;AACTR,IAAAA,SAAS,EAAEY,SAAI,CACb,SAAS,EACT;MACE,gBAAgB,EAAE,CAAC,CAACR,OAAO;MAC3B,aAAa,EAAE,CAAC,CAACD;KAClB,EACDH,SAAS,CACT;AACFE,IAAAA,EAAE,EAAEA,EAAG;AACP,IAAA,aAAA,EAAaI,MAAO;AAAA,IAAA,GAChBC,KAAK;AAAAN,IAAAA,QAAA,EAAA,CAERI,SAAS,iBACRQ,cAAA,CAACC,uBAAW,EAAA;AACVN,MAAAA,GAAG,EAAEC,oBAAqB;AAC1BT,MAAAA,SAAS,EAAC,qBAAqB;AAC/Be,MAAAA,IAAI,EAAEX,OAAO,GAAG,IAAI,GAAG,IAAK;AAC5BD,MAAAA,UAAU,EAAEA,UAAW;AACvBG,MAAAA,MAAM,EAAC,cAAc;MACrBU,OAAO,EAAGC,CAAC,IAAI;QACbC,gCAAe,CAACD,CAAC,CAAC;AAClBZ,QAAAA,SAAS,EAAE;AACb,MAAA;KAAE,CAEL,EACAJ,QAAQ;AAAA,GACN,CAAC;AAEV,CAAC;AAGHH,IAAI,CAACqB,WAAW,GAAG,MAAM;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Card.mjs","sources":["../../../src/common/card/Card.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { MouseEvent, type ReactNode, forwardRef, useRef } from 'react';\n\nimport { CloseButton } from '../closeButton';\nimport { stopPropagation } from '../domHelpers';\n\nexport interface CardProps {\n /** Content to display inside Card. */\n children: ReactNode;\n\n /** Optional prop to specify classNames onto the Card */\n className?: string;\n\n /** Optional prop to specify the ID on to Card */\n id?: string;\n\n /** Specify whether the Card is disabled, or not */\n isDisabled?: boolean;\n\n /** Specify whether the Card is sized small or not */\n isSmall?: boolean;\n\n /** Optionally specify Card onDismiss function */\n onDismiss?: () => void;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n}\n\n/**\n * Card component.\n *\n * A card is a container for content that is used to group related information.\n * It can be used to display information in a structured way, and can be\n * customized with various props to suit different use cases.\n *\n * @param {Object} props - The component props.\n * @param {ReactNode} children - The content to display inside the card.\n * @param {string} className - Optional class name(s) to add to the card container.\n * @param {string} id - Optional ID to add to the card container.\n * @param {boolean} isDisabled - Whether the card is disabled or not.\n * @param {boolean} isSmall - Whether the card is small or not.\n * @param {(event_: MouseEvent<HTMLButtonElement>) => void} onDismiss - Optional function to call when the card is dismissed.\n * @param {string} testId - Optional ID to add to the card container for testing purposes.\n * @returns {React.JSX.Element} - The card component.\n * @example\n * <Card>\n * <p>Hello World!</p>\n * </Card>\n */\nconst Card = forwardRef<HTMLDivElement, CardProps>(\n (\n {\n className,\n children = null,\n id,\n isDisabled = false,\n isSmall = false,\n onDismiss,\n testId,\n ...props\n },\n ref,\n ) => {\n const closeButtonReference = useRef(null);\n\n return (\n <div\n ref={ref}\n className={clsx(\n 'np-Card',\n {\n 'np-Card--small': !!isSmall,\n 'is-disabled': !!isDisabled,\n },\n className,\n )}\n id={id}\n data-testid={testId}\n {...props}\n >\n {onDismiss && (\n <CloseButton\n ref={closeButtonReference}\n className=\"np-Card-closeButton\"\n size={isSmall ? 'sm' : 'md'}\n isDisabled={isDisabled}\n testId=\"close-button\"\n onClick={(e) => {\n stopPropagation(e);\n onDismiss();\n }}\n />\n )}\n {children}\n </div>\n );\n },\n);\n\nCard.displayName = 'Card';\n\nexport default Card;\n"],"names":["Card","forwardRef","className","children","id","isDisabled","isSmall","onDismiss","testId","props","ref","closeButtonReference","useRef","_jsxs","clsx","_jsx","CloseButton","size","onClick","e","stopPropagation","displayName"],"mappings":";;;;;;AAkDA,MAAMA,IAAI,gBAAGC,UAAU,CACrB,CACE;EACEC,SAAS;AACTC,EAAAA,QAAQ,GAAG,IAAI;EACfC,EAAE;AACFC,EAAAA,UAAU,GAAG,KAAK;AAClBC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,MAAM;EACN,GAAGC;AAAK,CACT,EACDC,GAAG,KACD;AACF,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAC,IAAI,CAAC;AAEzC,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;AACEH,IAAAA,GAAG,EAAEA,GAAI;AACTR,IAAAA,SAAS,EAAEY,IAAI,CACb,SAAS,EACT;MACE,gBAAgB,EAAE,CAAC,CAACR,OAAO;MAC3B,aAAa,EAAE,CAAC,CAACD;KAClB,EACDH,SAAS,CACT;AACFE,IAAAA,EAAE,EAAEA,EAAG;AACP,IAAA,aAAA,EAAaI,MAAO;AAAA,IAAA,GAChBC,KAAK;AAAAN,IAAAA,QAAA,EAAA,CAERI,SAAS,iBACRQ,GAAA,CAACC,WAAW,EAAA;AACVN,MAAAA,GAAG,EAAEC,oBAAqB;AAC1BT,MAAAA,SAAS,EAAC,qBAAqB;AAC/Be,MAAAA,IAAI,EAAEX,OAAO,GAAG,IAAI,GAAG,IAAK;AAC5BD,MAAAA,UAAU,EAAEA,UAAW;AACvBG,MAAAA,MAAM,EAAC,cAAc;MACrBU,OAAO,EAAGC,CAAC,IAAI;QACbC,eAAe,CAACD,CAAC,CAAC;AAClBZ,QAAAA,SAAS,EAAE;AACb,MAAA;KAAE,CAEL,EACAJ,QAAQ;AAAA,GACN,CAAC;AAEV,CAAC;AAGHH,IAAI,CAACqB,WAAW,GAAG,MAAM;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/common/card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAC;AAKvE,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,QAAQ,EAAE,SAAS,CAAC;IAEpB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,mDAAmD;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,IAAI,sGAgDT,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,cAAc,QAAQ,CAAC"}
|
package/src/common/card/index.ts
DELETED
|
File without changes
|
|
File without changes
|