@transferwise/components 0.0.0-experimental-2242f8a → 0.0.0-experimental-5759f4d
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/button/Button.js +1 -0
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +1 -0
- package/build/button/Button.mjs.map +1 -1
- package/build/common/RadioButton/RadioButton.js +5 -2
- package/build/common/RadioButton/RadioButton.js.map +1 -1
- package/build/common/RadioButton/RadioButton.mjs +5 -2
- package/build/common/RadioButton/RadioButton.mjs.map +1 -1
- package/build/i18n/en.json +2 -0
- package/build/i18n/en.json.js +2 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +2 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/iconButton/IconButton.js.map +1 -1
- package/build/iconButton/IconButton.mjs.map +1 -1
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs.map +1 -1
- 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/AdditionalInfo/ListItemAdditionalInfo.js +56 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +54 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +21 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +19 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -0
- package/build/listItem/AvatarView/ListItemAvatarView.js +21 -0
- package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -0
- package/build/listItem/AvatarView/ListItemAvatarView.mjs +19 -0
- package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -0
- package/build/listItem/Button/ListItemButton.js +43 -0
- package/build/listItem/Button/ListItemButton.js.map +1 -0
- package/build/listItem/Button/ListItemButton.mjs +41 -0
- package/build/listItem/Button/ListItemButton.mjs.map +1 -0
- package/build/listItem/Checkbox/ListItemCheckbox.js +30 -0
- package/build/listItem/Checkbox/ListItemCheckbox.js.map +1 -0
- package/build/listItem/Checkbox/ListItemCheckbox.mjs +28 -0
- package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +1 -0
- package/build/listItem/IconButton/ListItemIconButton.js +42 -0
- package/build/listItem/IconButton/ListItemIconButton.js.map +1 -0
- package/build/listItem/IconButton/ListItemIconButton.mjs +40 -0
- package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -0
- package/build/listItem/Image/ListItemImage.js +27 -0
- package/build/listItem/Image/ListItemImage.js.map +1 -0
- package/build/listItem/Image/ListItemImage.mjs +25 -0
- package/build/listItem/Image/ListItemImage.mjs.map +1 -0
- package/build/listItem/ListItem.js +302 -0
- package/build/listItem/ListItem.js.map +1 -0
- package/build/listItem/ListItem.mjs +297 -0
- package/build/listItem/ListItem.mjs.map +1 -0
- package/build/listItem/ListItemContext.js +8 -0
- package/build/listItem/ListItemContext.js.map +1 -0
- package/build/listItem/ListItemContext.mjs +6 -0
- package/build/listItem/ListItemContext.mjs.map +1 -0
- package/build/listItem/Navigation/ListItemNavigation.js +45 -0
- package/build/listItem/Navigation/ListItemNavigation.js.map +1 -0
- package/build/listItem/Navigation/ListItemNavigation.mjs +43 -0
- package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -0
- package/build/listItem/Prompt/ListItemPrompt.js +59 -0
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -0
- package/build/listItem/Prompt/ListItemPrompt.mjs +54 -0
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -0
- package/build/listItem/Radio/ListItemRadio.js +30 -0
- package/build/listItem/Radio/ListItemRadio.js.map +1 -0
- package/build/listItem/Radio/ListItemRadio.mjs +28 -0
- package/build/listItem/Radio/ListItemRadio.mjs.map +1 -0
- package/build/listItem/Switch/ListItemSwitch.js +30 -0
- package/build/listItem/Switch/ListItemSwitch.js.map +1 -0
- package/build/listItem/Switch/ListItemSwitch.mjs +28 -0
- package/build/listItem/Switch/ListItemSwitch.mjs.map +1 -0
- package/build/listItem/useListItemControl.js +22 -0
- package/build/listItem/useListItemControl.js.map +1 -0
- package/build/listItem/useListItemControl.mjs +20 -0
- package/build/listItem/useListItemControl.mjs.map +1 -0
- package/build/main.css +657 -0
- package/build/styles/listItem/ListItem.css +657 -0
- package/build/styles/listItem/ListItem.grid.css +362 -0
- package/build/styles/main.css +657 -0
- package/build/switch/Switch.js +2 -0
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs +2 -0
- package/build/switch/Switch.mjs.map +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.types.d.ts +1 -1
- package/build/types/button/Button.types.d.ts.map +1 -1
- package/build/types/button/index.d.ts +1 -1
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/common/RadioButton/RadioButton.d.ts +3 -1
- package/build/types/common/RadioButton/RadioButton.d.ts.map +1 -1
- package/build/types/iconButton/IconButton.d.ts +2 -2
- package/build/types/iconButton/IconButton.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +3 -0
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/image/index.d.ts +1 -0
- package/build/types/image/index.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +15 -0
- package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +1 -0
- package/build/types/listItem/AdditionalInfo/index.d.ts +3 -0
- package/build/types/listItem/AdditionalInfo/index.d.ts.map +1 -0
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +18 -0
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +1 -0
- package/build/types/listItem/AvatarLayout/index.d.ts +3 -0
- package/build/types/listItem/AvatarLayout/index.d.ts.map +1 -0
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +16 -0
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -0
- package/build/types/listItem/AvatarView/index.d.ts +3 -0
- package/build/types/listItem/AvatarView/index.d.ts.map +1 -0
- package/build/types/listItem/Button/ListItemButton.d.ts +20 -0
- package/build/types/listItem/Button/ListItemButton.d.ts.map +1 -0
- package/build/types/listItem/Button/index.d.ts +3 -0
- package/build/types/listItem/Button/index.d.ts.map +1 -0
- package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +14 -0
- package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +1 -0
- package/build/types/listItem/Checkbox/index.d.ts +3 -0
- package/build/types/listItem/Checkbox/index.d.ts.map +1 -0
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts +18 -0
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +1 -0
- package/build/types/listItem/IconButton/index.d.ts +3 -0
- package/build/types/listItem/IconButton/index.d.ts.map +1 -0
- package/build/types/listItem/Image/ListItemImage.d.ts +25 -0
- package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -0
- package/build/types/listItem/Image/index.d.ts +3 -0
- package/build/types/listItem/Image/index.d.ts.map +1 -0
- package/build/types/listItem/ListItem.d.ts +113 -0
- package/build/types/listItem/ListItem.d.ts.map +1 -0
- package/build/types/listItem/ListItemContext.d.ts +18 -0
- package/build/types/listItem/ListItemContext.d.ts.map +1 -0
- package/build/types/listItem/Navigation/ListItemNavigation.d.ts +15 -0
- package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +1 -0
- package/build/types/listItem/Navigation/index.d.ts +3 -0
- package/build/types/listItem/Navigation/index.d.ts.map +1 -0
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts +16 -0
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -0
- package/build/types/listItem/Prompt/index.d.ts +3 -0
- package/build/types/listItem/Prompt/index.d.ts.map +1 -0
- package/build/types/listItem/Radio/ListItemRadio.d.ts +14 -0
- package/build/types/listItem/Radio/ListItemRadio.d.ts.map +1 -0
- package/build/types/listItem/Radio/index.d.ts +3 -0
- package/build/types/listItem/Radio/index.d.ts.map +1 -0
- package/build/types/listItem/Switch/ListItemSwitch.d.ts +14 -0
- package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +1 -0
- package/build/types/listItem/Switch/index.d.ts +3 -0
- package/build/types/listItem/Switch/index.d.ts.map +1 -0
- package/build/types/listItem/_stories/subcomponents.d.ts +18 -0
- package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -0
- package/build/types/listItem/index.d.ts +14 -0
- package/build/types/listItem/index.d.ts.map +1 -0
- package/build/types/listItem/useListItemControl.d.ts +5 -0
- package/build/types/listItem/useListItemControl.d.ts.map +1 -0
- package/build/types/switch/Switch.d.ts +2 -0
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +4 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts +6 -2
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +8 -0
- package/build/types/upload/Upload.messages.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +4 -2
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/upload/Upload.js +16 -9
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.messages.js +6 -0
- package/build/upload/Upload.messages.js.map +1 -1
- package/build/upload/Upload.messages.mjs +6 -0
- package/build/upload/Upload.messages.mjs.map +1 -1
- package/build/upload/Upload.mjs +16 -9
- package/build/upload/Upload.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +1 -1
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +7 -4
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +7 -4
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/package.json +1 -1
- package/src/button/Button.spec.tsx +18 -0
- package/src/button/Button.tsx +5 -1
- package/src/button/Button.types.ts +1 -1
- package/src/button/index.ts +1 -1
- package/src/checkboxButton/CheckboxButton.story.tsx +4 -4
- package/src/common/RadioButton/RadioButton.tsx +6 -1
- package/src/i18n/en.json +2 -0
- package/src/iconButton/IconButton.story.tsx +1 -1
- package/src/iconButton/IconButton.tsx +1 -1
- package/src/image/Image.tsx +3 -0
- package/src/image/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +145 -0
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +36 -0
- package/src/listItem/AdditionalInfo/index.ts +2 -0
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +118 -0
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +24 -0
- package/src/listItem/AvatarLayout/index.ts +2 -0
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +318 -0
- package/src/listItem/AvatarView/ListItemAvatarView.tsx +24 -0
- package/src/listItem/AvatarView/index.ts +2 -0
- package/src/listItem/Button/ListItemButton.spec.tsx +93 -0
- package/src/listItem/Button/ListItemButton.story.tsx +408 -0
- package/src/listItem/Button/ListItemButton.tsx +56 -0
- package/src/listItem/Button/index.ts +2 -0
- package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +107 -0
- package/src/listItem/Checkbox/ListItemCheckbox.tsx +33 -0
- package/src/listItem/Checkbox/index.ts +2 -0
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +236 -0
- package/src/listItem/IconButton/ListItemIconButton.tsx +56 -0
- package/src/listItem/IconButton/index.ts +2 -0
- package/src/listItem/Image/ListItemImage.story.tsx +39 -0
- package/src/listItem/Image/ListItemImage.tsx +40 -0
- package/src/listItem/Image/index.ts +2 -0
- package/src/listItem/ListItem.css +657 -0
- package/src/listItem/ListItem.grid.css +362 -0
- package/src/listItem/ListItem.grid.less +612 -0
- package/src/listItem/ListItem.less +312 -0
- package/src/listItem/ListItem.spec.tsx +97 -0
- package/src/listItem/ListItem.tsx +428 -0
- package/src/listItem/ListItemContext.tsx +22 -0
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +106 -0
- package/src/listItem/Navigation/ListItemNavigation.tsx +40 -0
- package/src/listItem/Navigation/index.ts +2 -0
- package/src/listItem/Prompt/ListItemPrompt.spec.tsx +49 -0
- package/src/listItem/Prompt/ListItemPrompt.story.tsx +199 -0
- package/src/listItem/Prompt/ListItemPrompt.tsx +32 -0
- package/src/listItem/Prompt/index.ts +2 -0
- package/src/listItem/Radio/ListItemRadio.story.tsx +98 -0
- package/src/listItem/Radio/ListItemRadio.tsx +33 -0
- package/src/listItem/Radio/index.ts +2 -0
- package/src/listItem/Switch/ListItemSwitch.story.tsx +69 -0
- package/src/listItem/Switch/ListItemSwitch.tsx +33 -0
- package/src/listItem/Switch/index.ts +2 -0
- package/src/listItem/_stories/ListItem.focus.test.story.tsx +250 -0
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +169 -0
- package/src/listItem/_stories/ListItem.story.tsx +670 -0
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +266 -0
- package/src/listItem/_stories/subcomponents.tsx +139 -0
- package/src/listItem/index.ts +14 -0
- package/src/listItem/useListItemControl.tsx +18 -0
- package/src/main.css +657 -0
- package/src/main.less +1 -0
- package/src/switch/Switch.tsx +4 -0
- package/src/upload/Upload.messages.ts +8 -0
- package/src/upload/Upload.spec.tsx +6 -0
- package/src/upload/Upload.story.tsx +118 -3
- package/src/upload/Upload.tests.story.tsx +5 -3
- package/src/upload/Upload.tsx +24 -15
- package/src/uploadInput/UploadInput.tests.story.tsx +7 -0
- package/src/uploadInput/UploadInput.tsx +2 -2
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +6 -0
- package/src/uploadInput/uploadButton/UploadButton.tsx +12 -6
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
@import "./ListItem.grid.less";
|
|
2
|
+
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/ring.less";
|
|
3
|
+
|
|
4
|
+
.wds-list-item {
|
|
5
|
+
list-style: none;
|
|
6
|
+
width: 100%;
|
|
7
|
+
border-radius: var(--radius-medium);
|
|
8
|
+
background-color: var(--color-background-screen);
|
|
9
|
+
position: relative;
|
|
10
|
+
padding: var(--size-12);
|
|
11
|
+
container-type: inline-size;
|
|
12
|
+
|
|
13
|
+
&:focus-within{
|
|
14
|
+
z-index: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-view {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-column: 1 / -1;
|
|
20
|
+
grid-row: 1 / -1;
|
|
21
|
+
grid-template-columns: subgrid;
|
|
22
|
+
grid-template-rows: subgrid;
|
|
23
|
+
|
|
24
|
+
&.fullyInteractive {
|
|
25
|
+
margin-bottom: 0;
|
|
26
|
+
&:before {
|
|
27
|
+
content: '';
|
|
28
|
+
position: absolute;
|
|
29
|
+
inset: 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
a {
|
|
35
|
+
text-underline-offset: calc(var(--size-4) / 2);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&-interactive {
|
|
39
|
+
.wds-list-item-control:focus-visible,
|
|
40
|
+
// checkboxes are complicated. i could update checkbox but i'd probably break something else
|
|
41
|
+
.np-checkbox-button:has(input[type="checkbox"]:focus-visible) .tw-checkbox-button {
|
|
42
|
+
outline: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:has(.wds-list-item-control:focus-visible),
|
|
46
|
+
&:has(input[type="checkbox"]:focus-visible) {
|
|
47
|
+
.ring();
|
|
48
|
+
outline-offset: -1px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.wds-list-item-additional-info {
|
|
52
|
+
.ring-offset-0
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
a.wds-list-item-control {
|
|
56
|
+
&, &:hover, &:focus {
|
|
57
|
+
text-decoration: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:has(.wds-list-item-control_pseudo-element) {
|
|
61
|
+
position: relative;
|
|
62
|
+
z-index: 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.wds-list-item-control_pseudo-element {
|
|
66
|
+
&:before {
|
|
67
|
+
content: '';
|
|
68
|
+
position: absolute;
|
|
69
|
+
inset: 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:not(.disabled, :disabled):hover {
|
|
75
|
+
background-color: var(--color-background-screen-hover);
|
|
76
|
+
|
|
77
|
+
.wds-list-item-control-wrapper {
|
|
78
|
+
.wds-Button {
|
|
79
|
+
background-color: var(--Button-background-hover);
|
|
80
|
+
color: var(--Button-color-hover);
|
|
81
|
+
transition: none;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:not(.disabled, :disabled):active {
|
|
87
|
+
background-color: var(--color-background-screen-active);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.wds-list-item-button-control {
|
|
91
|
+
.wds-Button {
|
|
92
|
+
transition: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:has(.wds-list-item-prompt:hover a, .wds-list-item-prompt:hover button) {
|
|
97
|
+
&:hover {
|
|
98
|
+
background-color: unset;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&-media {
|
|
104
|
+
grid-area: media;
|
|
105
|
+
|
|
106
|
+
&-image {
|
|
107
|
+
width: var(--item-media-image-size);
|
|
108
|
+
height: var(--item-media-image-size);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&-body {
|
|
113
|
+
grid-area: body;
|
|
114
|
+
width: 100%;
|
|
115
|
+
display: grid;
|
|
116
|
+
grid-template-columns: var(--wds-list-item-body-left, 1fr) var(--wds-list-item-body-right, max-content);
|
|
117
|
+
gap: var(--size-16);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&-title {
|
|
121
|
+
color: var(--color-content-primary);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&-additional-info {
|
|
125
|
+
grid-area: info;
|
|
126
|
+
color: var(--color-content-tertiary);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&-value {
|
|
130
|
+
align-items: end;
|
|
131
|
+
text-align: right;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&-control-wrapper {
|
|
135
|
+
grid-area: control;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&-control {
|
|
139
|
+
flex: 0 0 auto;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&.disabled {
|
|
143
|
+
filter: none;
|
|
144
|
+
opacity: 1;
|
|
145
|
+
|
|
146
|
+
label {
|
|
147
|
+
cursor: not-allowed;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.tw-icon-backslash-circle {
|
|
151
|
+
color: var(--color-content-tertiary);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&-spotlight {
|
|
156
|
+
&-active {
|
|
157
|
+
background-color: var(--color-background-neutral);
|
|
158
|
+
&:not(.disabled, :disabled):hover {
|
|
159
|
+
background-color: var(--color-background-neutral-hover);
|
|
160
|
+
}
|
|
161
|
+
&:not(.disabled, :disabled):active {
|
|
162
|
+
background-color: var(--color-background-neutral-active);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&-inactive {
|
|
167
|
+
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
168
|
+
border: 1px dashed var(--color-border-neutral);
|
|
169
|
+
&:not(.disabled, :disabled):hover {
|
|
170
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
171
|
+
}
|
|
172
|
+
&:not(.disabled, :disabled):active {
|
|
173
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&-prompt {
|
|
179
|
+
grid-area: prompt;
|
|
180
|
+
|
|
181
|
+
display: inline-flex;
|
|
182
|
+
justify-self: start;
|
|
183
|
+
text-align: left;
|
|
184
|
+
padding-top: calc(var(--padding-x-small) / 2);
|
|
185
|
+
padding-bottom: calc(var(--padding-x-small) / 2);
|
|
186
|
+
padding-left: calc(var(--padding-x-small) - 1px);
|
|
187
|
+
padding-right: var(--padding-x-small);
|
|
188
|
+
border-radius: var(--radius-small);
|
|
189
|
+
word-break: break-word;
|
|
190
|
+
overflow-wrap: break-word;
|
|
191
|
+
|
|
192
|
+
&:has(a),
|
|
193
|
+
&:has(button) {
|
|
194
|
+
position: relative;
|
|
195
|
+
z-index: 1;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
a, button {
|
|
199
|
+
text-underline-offset: calc(var(--size-4) / 2);
|
|
200
|
+
&:first-of-type {
|
|
201
|
+
&:before {
|
|
202
|
+
content: '';
|
|
203
|
+
position: absolute;
|
|
204
|
+
inset: 0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&.np-prompt-icon {
|
|
210
|
+
padding-left: calc(var(--padding-x-small) - 1px);
|
|
211
|
+
padding-right: var(--padding-x-small);
|
|
212
|
+
display: inline-flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
gap: var(--size-4);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.np-prompt-icon {
|
|
218
|
+
padding-right: calc(var(--size-12) / 2);
|
|
219
|
+
padding-top: calc(var(--size-4) - 1px);
|
|
220
|
+
padding-bottom: calc(var(--size-4) - 1px);
|
|
221
|
+
|
|
222
|
+
.tw-icon-tags,
|
|
223
|
+
.tw-icon-confetti {
|
|
224
|
+
color: var(--color-sentiment-positive-primary);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&.negative {
|
|
229
|
+
background-color: var(--color-sentiment-negative-secondary);
|
|
230
|
+
color: var(--color-sentiment-negative-primary);
|
|
231
|
+
a {
|
|
232
|
+
color: var(--color-sentiment-negative-primary);
|
|
233
|
+
&:hover {
|
|
234
|
+
color: var(--color-sentiment-negative-primary-hover);
|
|
235
|
+
}
|
|
236
|
+
&:active {
|
|
237
|
+
color: var(--color-sentiment-negative-primary-active);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
.wds-list-item-prompt&:has(a, button) {
|
|
241
|
+
&:hover {
|
|
242
|
+
background-color: var(--color-sentiment-negative-secondary-hover);
|
|
243
|
+
}
|
|
244
|
+
&:active {
|
|
245
|
+
background-color: var(--color-sentiment-negative-secondary-active);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
&.positive,
|
|
250
|
+
&.discount,
|
|
251
|
+
&.savings {
|
|
252
|
+
background-color: var(--color-sentiment-positive-secondary);
|
|
253
|
+
color: var(--color-sentiment-positive-primary);
|
|
254
|
+
a {
|
|
255
|
+
color: var(--color-sentiment-positive-primary);
|
|
256
|
+
&:hover {
|
|
257
|
+
color: var(--color-sentiment-positive-primary-hover);
|
|
258
|
+
}
|
|
259
|
+
&:active {
|
|
260
|
+
color: var(--color-sentiment-positive-primary-active);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
.wds-list-item-prompt&:has(a, button) {
|
|
264
|
+
&:hover {
|
|
265
|
+
background-color: var(--color-sentiment-positive-secondary-hover);
|
|
266
|
+
}
|
|
267
|
+
&:active {
|
|
268
|
+
background-color: var(--color-sentiment-positive-secondary-active);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
&.neutral {
|
|
273
|
+
background-color: var(--color-background-neutral);
|
|
274
|
+
color: var(--color-content-primary);
|
|
275
|
+
a {
|
|
276
|
+
color: var(--color-content-primary);
|
|
277
|
+
}
|
|
278
|
+
.wds-list-item-prompt&:has(a, button) {
|
|
279
|
+
&:hover {
|
|
280
|
+
background-color: var(--color-background-neutral-hover);
|
|
281
|
+
}
|
|
282
|
+
&:active {
|
|
283
|
+
background-color: var(--color-background-neutral-active);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
&.warning {
|
|
288
|
+
background-color: var(--color-sentiment-warning-secondary);
|
|
289
|
+
color: var(--color-sentiment-warning-content);
|
|
290
|
+
a {
|
|
291
|
+
color: var(--color-sentiment-warning-content);
|
|
292
|
+
&:hover {
|
|
293
|
+
color: var(--color-sentiment-warning-content-hover);
|
|
294
|
+
}
|
|
295
|
+
&:active {
|
|
296
|
+
color: var(--color-sentiment-warning-content-active);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
.wds-list-item-prompt&:has(a, button) {
|
|
300
|
+
&:hover {
|
|
301
|
+
// someday we'll have hover and active states for warning
|
|
302
|
+
// background-color: var(--color-sentiment-warning-secondary-hover);
|
|
303
|
+
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 92%, var(--color-sentiment-warning-primary));
|
|
304
|
+
}
|
|
305
|
+
&:active {
|
|
306
|
+
// background-color: var(--color-sentiment-warning-secondary-active);
|
|
307
|
+
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 84%, var(--color-sentiment-warning-primary));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { render, screen, mockMatchMedia } from '../test-utils';
|
|
2
|
+
import ListItem from './ListItem';
|
|
3
|
+
|
|
4
|
+
mockMatchMedia();
|
|
5
|
+
|
|
6
|
+
describe('ListItem', () => {
|
|
7
|
+
describe('aria and a11y attributes', () => {
|
|
8
|
+
it('sets id on the container', () => {
|
|
9
|
+
render(<ListItem id="custom-id" title="Test Title" />);
|
|
10
|
+
expect(screen.getByRole('listitem')).toHaveAttribute('id', 'custom-id');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('sets custom role on the container', () => {
|
|
14
|
+
render(<ListItem title="Test Title" role="button" />);
|
|
15
|
+
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('sets aria-labelledby when provided', () => {
|
|
19
|
+
render(<ListItem title="Test Title" aria-labelledby="Accessible label" />);
|
|
20
|
+
expect(screen.getByRole('listitem')).toHaveAttribute('aria-labelledby', 'Accessible label');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('sets aria-describedby with correct IDs for fully interactive list item with prompt and additionalInfo', () => {
|
|
24
|
+
render(
|
|
25
|
+
<ListItem
|
|
26
|
+
title="Title"
|
|
27
|
+
subtitle="Subtitle"
|
|
28
|
+
control={<ListItem.Button>Hello</ListItem.Button>}
|
|
29
|
+
additionalInfo={<ListItem.AdditionalInfo>Additional Info</ListItem.AdditionalInfo>}
|
|
30
|
+
prompt={<ListItem.Prompt sentiment="positive">Hello</ListItem.Prompt>}
|
|
31
|
+
/>,
|
|
32
|
+
);
|
|
33
|
+
const item = screen.getByRole('button');
|
|
34
|
+
const describedBy = item.getAttribute('aria-describedby') || '';
|
|
35
|
+
expect(describedBy).toMatch(/_additional-info/);
|
|
36
|
+
expect(describedBy).toMatch(/_prompt/);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('sets aria-describedby with correct IDs for partially interactive list item with title, subtitle, value, subvalue, prompt and additionalInfo', () => {
|
|
40
|
+
render(
|
|
41
|
+
<ListItem
|
|
42
|
+
title="Title"
|
|
43
|
+
subtitle="Subtitle"
|
|
44
|
+
valueTitle="100"
|
|
45
|
+
valueSubtitle="200"
|
|
46
|
+
control={<ListItem.Button partiallyInteractive>Hello</ListItem.Button>}
|
|
47
|
+
additionalInfo={<ListItem.AdditionalInfo>Additional Info</ListItem.AdditionalInfo>}
|
|
48
|
+
prompt={<ListItem.Prompt sentiment="negative">Hello</ListItem.Prompt>}
|
|
49
|
+
/>,
|
|
50
|
+
);
|
|
51
|
+
const item = screen.getByRole('button');
|
|
52
|
+
const describedBy = item.getAttribute('aria-describedby') || '';
|
|
53
|
+
expect(describedBy).toMatch(/_additional-info/);
|
|
54
|
+
expect(describedBy).toMatch(/_prompt/);
|
|
55
|
+
expect(describedBy).toMatch(/_title/);
|
|
56
|
+
expect(describedBy).toMatch(/_subtitle/);
|
|
57
|
+
expect(describedBy).toMatch(/_value/);
|
|
58
|
+
expect(describedBy).toMatch(/_value-subtitle/);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('sets aria-disabled when disabled', () => {
|
|
62
|
+
render(<ListItem title="Disabled" disabled />);
|
|
63
|
+
expect(screen.getByRole('listitem')).toHaveAttribute('aria-disabled', 'true');
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('spotlight', () => {
|
|
68
|
+
it('only fully interactive variant can have spotlight:active', () => {
|
|
69
|
+
render(<ListItem title="Test Title" spotlight="active" control={<ListItem.Navigation />} />);
|
|
70
|
+
const listItem = screen.getByRole('listitem');
|
|
71
|
+
expect(listItem).toHaveClass('wds-list-item-interactive');
|
|
72
|
+
expect(listItem).toHaveClass('wds-list-item-spotlight-active');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('only fully interactive variant can have spotlight:inactive', () => {
|
|
76
|
+
render(
|
|
77
|
+
<ListItem
|
|
78
|
+
title="Test Title"
|
|
79
|
+
spotlight="inactive"
|
|
80
|
+
control={<ListItem.Switch onClick={() => {}} />}
|
|
81
|
+
/>,
|
|
82
|
+
);
|
|
83
|
+
const listItem = screen.getByRole('listitem');
|
|
84
|
+
expect(listItem).toHaveClass('wds-list-item-interactive');
|
|
85
|
+
expect(listItem).toHaveClass('wds-list-item-spotlight-inactive');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('non interactive variant can have spotlight', () => {
|
|
89
|
+
render(<ListItem title="Test Title" spotlight="inactive" />);
|
|
90
|
+
const listItem = screen.getByRole('listitem');
|
|
91
|
+
expect(listItem).toHaveClass('wds-list-item-non-interactive');
|
|
92
|
+
expect(listItem).not.toHaveClass('wds-list-item-interactive');
|
|
93
|
+
expect(listItem).not.toHaveClass('wds-list-item-spotlight-inactive');
|
|
94
|
+
expect(listItem).not.toHaveClass('wds-list-item-spotlight-active');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|