@transferwise/components 0.0.0-experimental-fc7d1b1 → 0.0.0-experimental-59a94f4
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/main.css +7 -6
- package/build/styles/circularButton/CircularButton.css +1 -0
- package/build/styles/listItem/ListItem.css +6 -6
- package/build/styles/main.css +7 -6
- package/build/types/listItem/ListItem.d.ts +2 -1
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/circularButton/CircularButton.css +1 -0
- package/src/circularButton/CircularButton.less +1 -0
- package/src/circularButton/CircularButton.tests.story.tsx +23 -0
- package/src/listItem/ListItem.css +6 -6
- package/src/listItem/ListItem.less +5 -7
- package/src/listItem/ListItem.spec.tsx +35 -0
- package/src/listItem/ListItem.story.tsx +28 -5
- package/src/listItem/ListItem.tsx +8 -1
- package/src/main.css +7 -6
package/build/main.css
CHANGED
|
@@ -1402,6 +1402,7 @@
|
|
|
1402
1402
|
}
|
|
1403
1403
|
.np-circular-btn-primary-default .np-circular-btn-label,
|
|
1404
1404
|
.np-circular-btn-secondary-default .np-circular-btn-label {
|
|
1405
|
+
text-align: center;
|
|
1405
1406
|
color: var(--color-interactive-primary);
|
|
1406
1407
|
}
|
|
1407
1408
|
.np-circular-btn-primary-default .np-circular-btn-label:not(.disabled):not(:disabled):hover,
|
|
@@ -2664,8 +2665,8 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2664
2665
|
.wds-list-item {
|
|
2665
2666
|
padding: 16px;
|
|
2666
2667
|
padding: var(--size-16);
|
|
2667
|
-
border-radius:
|
|
2668
|
-
border-radius: var(--radius-
|
|
2668
|
+
border-radius: 24px;
|
|
2669
|
+
border-radius: var(--radius-large);
|
|
2669
2670
|
background-color: #ffffff;
|
|
2670
2671
|
background-color: var(--color-background-screen);
|
|
2671
2672
|
gap: 16px;
|
|
@@ -2705,10 +2706,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2705
2706
|
background-color: rgba(134,167,189,0.10196);
|
|
2706
2707
|
background-color: var(--color-background-neutral);
|
|
2707
2708
|
}
|
|
2708
|
-
.wds-list-item-spotlight-active:hover {
|
|
2709
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):hover {
|
|
2709
2710
|
background-color: var(--color-background-neutral-hover);
|
|
2710
2711
|
}
|
|
2711
|
-
.wds-list-item-spotlight-active:active {
|
|
2712
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):active {
|
|
2712
2713
|
background-color: var(--color-background-neutral-active);
|
|
2713
2714
|
}
|
|
2714
2715
|
.wds-list-item-spotlight-inactive {
|
|
@@ -2721,10 +2722,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2721
2722
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
2722
2723
|
}
|
|
2723
2724
|
}
|
|
2724
|
-
.wds-list-item-spotlight-inactive:hover {
|
|
2725
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):hover {
|
|
2725
2726
|
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
2726
2727
|
}
|
|
2727
|
-
.wds-list-item-spotlight-inactive:active {
|
|
2728
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):active {
|
|
2728
2729
|
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
2729
2730
|
}
|
|
2730
2731
|
.wds-list-item-prompt {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
}
|
|
7
7
|
.np-circular-btn-primary-default .np-circular-btn-label,
|
|
8
8
|
.np-circular-btn-secondary-default .np-circular-btn-label {
|
|
9
|
+
text-align: center;
|
|
9
10
|
color: var(--color-interactive-primary);
|
|
10
11
|
}
|
|
11
12
|
.np-circular-btn-primary-default .np-circular-btn-label:not(.disabled):not(:disabled):hover,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.wds-list-item {
|
|
2
2
|
padding: 16px;
|
|
3
3
|
padding: var(--size-16);
|
|
4
|
-
border-radius:
|
|
5
|
-
border-radius: var(--radius-
|
|
4
|
+
border-radius: 24px;
|
|
5
|
+
border-radius: var(--radius-large);
|
|
6
6
|
background-color: #ffffff;
|
|
7
7
|
background-color: var(--color-background-screen);
|
|
8
8
|
gap: 16px;
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
background-color: rgba(134,167,189,0.10196);
|
|
43
43
|
background-color: var(--color-background-neutral);
|
|
44
44
|
}
|
|
45
|
-
.wds-list-item-spotlight-active:hover {
|
|
45
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):hover {
|
|
46
46
|
background-color: var(--color-background-neutral-hover);
|
|
47
47
|
}
|
|
48
|
-
.wds-list-item-spotlight-active:active {
|
|
48
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):active {
|
|
49
49
|
background-color: var(--color-background-neutral-active);
|
|
50
50
|
}
|
|
51
51
|
.wds-list-item-spotlight-inactive {
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
.wds-list-item-spotlight-inactive:hover {
|
|
61
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):hover {
|
|
62
62
|
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
63
63
|
}
|
|
64
|
-
.wds-list-item-spotlight-inactive:active {
|
|
64
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):active {
|
|
65
65
|
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
66
66
|
}
|
|
67
67
|
.wds-list-item-prompt {
|
package/build/styles/main.css
CHANGED
|
@@ -1402,6 +1402,7 @@
|
|
|
1402
1402
|
}
|
|
1403
1403
|
.np-circular-btn-primary-default .np-circular-btn-label,
|
|
1404
1404
|
.np-circular-btn-secondary-default .np-circular-btn-label {
|
|
1405
|
+
text-align: center;
|
|
1405
1406
|
color: var(--color-interactive-primary);
|
|
1406
1407
|
}
|
|
1407
1408
|
.np-circular-btn-primary-default .np-circular-btn-label:not(.disabled):not(:disabled):hover,
|
|
@@ -2664,8 +2665,8 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2664
2665
|
.wds-list-item {
|
|
2665
2666
|
padding: 16px;
|
|
2666
2667
|
padding: var(--size-16);
|
|
2667
|
-
border-radius:
|
|
2668
|
-
border-radius: var(--radius-
|
|
2668
|
+
border-radius: 24px;
|
|
2669
|
+
border-radius: var(--radius-large);
|
|
2669
2670
|
background-color: #ffffff;
|
|
2670
2671
|
background-color: var(--color-background-screen);
|
|
2671
2672
|
gap: 16px;
|
|
@@ -2705,10 +2706,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2705
2706
|
background-color: rgba(134,167,189,0.10196);
|
|
2706
2707
|
background-color: var(--color-background-neutral);
|
|
2707
2708
|
}
|
|
2708
|
-
.wds-list-item-spotlight-active:hover {
|
|
2709
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):hover {
|
|
2709
2710
|
background-color: var(--color-background-neutral-hover);
|
|
2710
2711
|
}
|
|
2711
|
-
.wds-list-item-spotlight-active:active {
|
|
2712
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):active {
|
|
2712
2713
|
background-color: var(--color-background-neutral-active);
|
|
2713
2714
|
}
|
|
2714
2715
|
.wds-list-item-spotlight-inactive {
|
|
@@ -2721,10 +2722,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2721
2722
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
2722
2723
|
}
|
|
2723
2724
|
}
|
|
2724
|
-
.wds-list-item-spotlight-inactive:hover {
|
|
2725
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):hover {
|
|
2725
2726
|
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
2726
2727
|
}
|
|
2727
|
-
.wds-list-item-spotlight-inactive:active {
|
|
2728
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):active {
|
|
2728
2729
|
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
2729
2730
|
}
|
|
2730
2731
|
.wds-list-item-prompt {
|
|
@@ -13,6 +13,7 @@ export type Props = {
|
|
|
13
13
|
media?: ReactNode;
|
|
14
14
|
control?: ReactNode;
|
|
15
15
|
prompt?: ReactNode;
|
|
16
|
+
className?: string;
|
|
16
17
|
};
|
|
17
18
|
export type ListItemContextData = {
|
|
18
19
|
setControlType: (type: ListItemTypes) => void;
|
|
@@ -27,7 +28,7 @@ export type ListItemContextData = {
|
|
|
27
28
|
};
|
|
28
29
|
export declare const ListItemContext: import("react").Context<ListItemContextData>;
|
|
29
30
|
export declare const ListItem: {
|
|
30
|
-
({ as: View, title, subtitle, additionalInfo, prompt, inverted, media, spotlight, valueTitle, valueSubtitle, control, disabled, }: Props): import("react").JSX.Element;
|
|
31
|
+
({ as: View, title, subtitle, additionalInfo, prompt, inverted, media, spotlight, valueTitle, valueSubtitle, control, disabled, className, }: Props): import("react").JSX.Element;
|
|
31
32
|
Image: ({ alt, size, ...props }: import("./ListItemMedia").ListItemImageProps) => import("react").JSX.Element;
|
|
32
33
|
AvatarView: ({ className, size, ...props }: import("./ListItemMedia").ListItemAvatarViewProps) => import("react").JSX.Element;
|
|
33
34
|
AvatarLayout: ({ className, size, ...props }: import("./ListItemMedia").ListItemAvatarLayoutProps) => import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/listItem/ListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAA4B,MAAM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n-label,
|
|
8
8
|
.np-circular-btn-secondary-default .np-circular-btn-label {
|
|
9
|
+
text-align: center;
|
|
9
10
|
color: var(--color-interactive-primary);
|
|
10
11
|
}
|
|
11
12
|
.np-circular-btn-primary-default .np-circular-btn-label:not(.disabled):not(:disabled):hover,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Freeze } from '@transferwise/icons';
|
|
2
|
+
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import CircularButton from './CircularButton';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: CircularButton,
|
|
8
|
+
title: 'Actions/CircularButton/Tests',
|
|
9
|
+
} satisfies Meta<typeof CircularButton>;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof CircularButton>;
|
|
12
|
+
|
|
13
|
+
export const CenteredText: Story = {
|
|
14
|
+
render: () => {
|
|
15
|
+
return (
|
|
16
|
+
<div style={{ maxWidth: '100px' }}>
|
|
17
|
+
<CircularButton priority="primary" type="default" icon={<Freeze />}>
|
|
18
|
+
Very long text for a circular button that will be centered
|
|
19
|
+
</CircularButton>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.wds-list-item {
|
|
2
2
|
padding: 16px;
|
|
3
3
|
padding: var(--size-16);
|
|
4
|
-
border-radius:
|
|
5
|
-
border-radius: var(--radius-
|
|
4
|
+
border-radius: 24px;
|
|
5
|
+
border-radius: var(--radius-large);
|
|
6
6
|
background-color: #ffffff;
|
|
7
7
|
background-color: var(--color-background-screen);
|
|
8
8
|
gap: 16px;
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
background-color: rgba(134,167,189,0.10196);
|
|
43
43
|
background-color: var(--color-background-neutral);
|
|
44
44
|
}
|
|
45
|
-
.wds-list-item-spotlight-active:hover {
|
|
45
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):hover {
|
|
46
46
|
background-color: var(--color-background-neutral-hover);
|
|
47
47
|
}
|
|
48
|
-
.wds-list-item-spotlight-active:active {
|
|
48
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):active {
|
|
49
49
|
background-color: var(--color-background-neutral-active);
|
|
50
50
|
}
|
|
51
51
|
.wds-list-item-spotlight-inactive {
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
.wds-list-item-spotlight-inactive:hover {
|
|
61
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):hover {
|
|
62
62
|
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
63
63
|
}
|
|
64
|
-
.wds-list-item-spotlight-inactive:active {
|
|
64
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):active {
|
|
65
65
|
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
66
66
|
}
|
|
67
67
|
.wds-list-item-prompt {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.wds-list-item {
|
|
2
2
|
padding: var(--size-16);
|
|
3
|
-
border-radius: var(--radius-
|
|
3
|
+
border-radius: var(--radius-large);
|
|
4
4
|
background-color: var(--color-background-screen);
|
|
5
5
|
gap: var(--size-16);
|
|
6
6
|
|
|
@@ -45,11 +45,10 @@
|
|
|
45
45
|
&-spotlight {
|
|
46
46
|
&-active {
|
|
47
47
|
background-color: var(--color-background-neutral);
|
|
48
|
-
|
|
49
|
-
&:hover {
|
|
48
|
+
&:not(.disabled, :disabled):hover {
|
|
50
49
|
background-color: var(--color-background-neutral-hover);
|
|
51
50
|
}
|
|
52
|
-
&:active {
|
|
51
|
+
&:not(.disabled, :disabled):active {
|
|
53
52
|
background-color: var(--color-background-neutral-active);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
@@ -57,11 +56,10 @@
|
|
|
57
56
|
&-inactive {
|
|
58
57
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
59
58
|
border: 1px dashed var(--color-border-neutral);
|
|
60
|
-
|
|
61
|
-
&:hover {
|
|
59
|
+
&:not(.disabled, :disabled):hover {
|
|
62
60
|
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
63
61
|
}
|
|
64
|
-
&:active {
|
|
62
|
+
&:not(.disabled, :disabled):active {
|
|
65
63
|
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
66
64
|
}
|
|
67
65
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { render, screen } from '../test-utils';
|
|
2
|
+
import ListItem from './ListItem';
|
|
3
|
+
|
|
4
|
+
describe('ListItem', () => {
|
|
5
|
+
describe('spotlight', () => {
|
|
6
|
+
it('only fully interactive variant can have spotlight:active', () => {
|
|
7
|
+
render(<ListItem title="Test Title" spotlight="active" control={<ListItem.Navigation />} />);
|
|
8
|
+
const listItem = screen.getByRole('listitem');
|
|
9
|
+
expect(listItem).toHaveClass('wds-list-item-interactive');
|
|
10
|
+
expect(listItem).toHaveClass('wds-list-item-spotlight-active');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('only fully interactive variant can have spotlight:inactive', () => {
|
|
14
|
+
render(
|
|
15
|
+
<ListItem
|
|
16
|
+
title="Test Title"
|
|
17
|
+
spotlight="inactive"
|
|
18
|
+
control={<ListItem.Switch onClick={() => {}} />}
|
|
19
|
+
/>,
|
|
20
|
+
);
|
|
21
|
+
const listItem = screen.getByRole('listitem');
|
|
22
|
+
expect(listItem).toHaveClass('wds-list-item-interactive');
|
|
23
|
+
expect(listItem).toHaveClass('wds-list-item-spotlight-inactive');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('non interactive variant can have spotlight', () => {
|
|
27
|
+
render(<ListItem title="Test Title" spotlight="inactive" />);
|
|
28
|
+
const listItem = screen.getByRole('listitem');
|
|
29
|
+
expect(listItem).toHaveClass('wds-list-item-non-interactive');
|
|
30
|
+
expect(listItem).not.toHaveClass('wds-list-item-interactive');
|
|
31
|
+
expect(listItem).not.toHaveClass('wds-list-item-spotlight-inactive');
|
|
32
|
+
expect(listItem).not.toHaveClass('wds-list-item-spotlight-active');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import ListItem, { Props as ItemProps } from './ListItem';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Bank,
|
|
6
|
+
BankTransfer,
|
|
7
|
+
FastFlag,
|
|
8
|
+
MultiCurrency,
|
|
9
|
+
Plus,
|
|
10
|
+
Receipt,
|
|
11
|
+
Savings,
|
|
12
|
+
} from '@transferwise/icons';
|
|
5
13
|
|
|
6
14
|
import { lorem10, lorem20, lorem40, lorem5 } from '../test-utils';
|
|
7
15
|
import { Flag } from '@wise/art';
|
|
@@ -138,16 +146,30 @@ export const TempPlayground: Story = {
|
|
|
138
146
|
/>
|
|
139
147
|
|
|
140
148
|
<ListItem
|
|
149
|
+
media={
|
|
150
|
+
<ListItem.AvatarView>
|
|
151
|
+
<Bank />
|
|
152
|
+
</ListItem.AvatarView>
|
|
153
|
+
}
|
|
154
|
+
spotlight="inactive"
|
|
141
155
|
title="Test title"
|
|
142
|
-
subtitle={
|
|
143
|
-
additionalInfo={<ListItem.AdditionalInfo>{
|
|
156
|
+
subtitle={lorem5}
|
|
157
|
+
additionalInfo={<ListItem.AdditionalInfo>{lorem10}</ListItem.AdditionalInfo>}
|
|
144
158
|
control={<ListItem.Checkbox indeterminate />}
|
|
159
|
+
className="m-t-2"
|
|
145
160
|
/>
|
|
146
161
|
|
|
147
162
|
<ListItem
|
|
163
|
+
media={
|
|
164
|
+
<ListItem.AvatarLayout
|
|
165
|
+
orientation="diagonal"
|
|
166
|
+
avatars={[{ asset: <BankTransfer /> }, { asset: <Bank /> }]}
|
|
167
|
+
/>
|
|
168
|
+
}
|
|
169
|
+
spotlight="active"
|
|
148
170
|
title="Test title"
|
|
149
|
-
subtitle={
|
|
150
|
-
additionalInfo={<ListItem.AdditionalInfo>{
|
|
171
|
+
subtitle={lorem5}
|
|
172
|
+
additionalInfo={<ListItem.AdditionalInfo>{lorem10}</ListItem.AdditionalInfo>}
|
|
151
173
|
control={
|
|
152
174
|
<ListItem.Switch
|
|
153
175
|
checked={checked}
|
|
@@ -156,6 +178,7 @@ export const TempPlayground: Story = {
|
|
|
156
178
|
}}
|
|
157
179
|
/>
|
|
158
180
|
}
|
|
181
|
+
className="m-t-2 m-b-4"
|
|
159
182
|
/>
|
|
160
183
|
</div>
|
|
161
184
|
);
|
|
@@ -33,6 +33,7 @@ export type Props = {
|
|
|
33
33
|
media?: ReactNode;
|
|
34
34
|
control?: ReactNode;
|
|
35
35
|
prompt?: ReactNode;
|
|
36
|
+
className?: string;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export type ListItemContextData = {
|
|
@@ -64,6 +65,7 @@ export const ListItem = ({
|
|
|
64
65
|
valueSubtitle,
|
|
65
66
|
control = null,
|
|
66
67
|
disabled,
|
|
68
|
+
className,
|
|
67
69
|
}: Props) => {
|
|
68
70
|
/*
|
|
69
71
|
const returnType = (): ReactNode => {
|
|
@@ -98,6 +100,10 @@ export const ListItem = ({
|
|
|
98
100
|
additionalInfo: `${idPrefix}_additional-info`,
|
|
99
101
|
};
|
|
100
102
|
|
|
103
|
+
// TODO: add partially interactive check from Button and IconButtons
|
|
104
|
+
// (https://transferwise.atlassian.net/browse/DS-7562)
|
|
105
|
+
const isFullyInteractive = controlType !== 'non-interactive';
|
|
106
|
+
|
|
101
107
|
const listItemContext = useMemo(
|
|
102
108
|
() => ({ setControlType, ids, props: { as: View, disabled, inverted } }),
|
|
103
109
|
[],
|
|
@@ -113,8 +119,9 @@ export const ListItem = ({
|
|
|
113
119
|
'd-flex flex-row',
|
|
114
120
|
{ 'align-items-center': !subtitle },
|
|
115
121
|
{
|
|
116
|
-
[`wds-list-item-spotlight-${spotlight}`]: !!spotlight,
|
|
122
|
+
[`wds-list-item-spotlight-${spotlight}`]: isFullyInteractive && !!spotlight,
|
|
117
123
|
},
|
|
124
|
+
className,
|
|
118
125
|
)}
|
|
119
126
|
aria-describedby={[ids.additionalInfo].join(' ')}
|
|
120
127
|
>
|
package/src/main.css
CHANGED
|
@@ -1402,6 +1402,7 @@
|
|
|
1402
1402
|
}
|
|
1403
1403
|
.np-circular-btn-primary-default .np-circular-btn-label,
|
|
1404
1404
|
.np-circular-btn-secondary-default .np-circular-btn-label {
|
|
1405
|
+
text-align: center;
|
|
1405
1406
|
color: var(--color-interactive-primary);
|
|
1406
1407
|
}
|
|
1407
1408
|
.np-circular-btn-primary-default .np-circular-btn-label:not(.disabled):not(:disabled):hover,
|
|
@@ -2664,8 +2665,8 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2664
2665
|
.wds-list-item {
|
|
2665
2666
|
padding: 16px;
|
|
2666
2667
|
padding: var(--size-16);
|
|
2667
|
-
border-radius:
|
|
2668
|
-
border-radius: var(--radius-
|
|
2668
|
+
border-radius: 24px;
|
|
2669
|
+
border-radius: var(--radius-large);
|
|
2669
2670
|
background-color: #ffffff;
|
|
2670
2671
|
background-color: var(--color-background-screen);
|
|
2671
2672
|
gap: 16px;
|
|
@@ -2705,10 +2706,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2705
2706
|
background-color: rgba(134,167,189,0.10196);
|
|
2706
2707
|
background-color: var(--color-background-neutral);
|
|
2707
2708
|
}
|
|
2708
|
-
.wds-list-item-spotlight-active:hover {
|
|
2709
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):hover {
|
|
2709
2710
|
background-color: var(--color-background-neutral-hover);
|
|
2710
2711
|
}
|
|
2711
|
-
.wds-list-item-spotlight-active:active {
|
|
2712
|
+
.wds-list-item-spotlight-active:not(.disabled):not(:disabled):active {
|
|
2712
2713
|
background-color: var(--color-background-neutral-active);
|
|
2713
2714
|
}
|
|
2714
2715
|
.wds-list-item-spotlight-inactive {
|
|
@@ -2721,10 +2722,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2721
2722
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
2722
2723
|
}
|
|
2723
2724
|
}
|
|
2724
|
-
.wds-list-item-spotlight-inactive:hover {
|
|
2725
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):hover {
|
|
2725
2726
|
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
2726
2727
|
}
|
|
2727
|
-
.wds-list-item-spotlight-inactive:active {
|
|
2728
|
+
.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):active {
|
|
2728
2729
|
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
2729
2730
|
}
|
|
2730
2731
|
.wds-list-item-prompt {
|