@transferwise/components 0.0.0-experimental-0192429 → 0.0.0-experimental-385bb2a
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/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -1
- package/build/main.css +4 -190
- package/build/styles/main.css +4 -190
- package/build/styles/typeahead/Typeahead.css +4 -4
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/test-utils/fake-data.d.ts +0 -1
- package/build/types/test-utils/fake-data.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +0 -2
- package/src/main.css +4 -190
- package/src/main.less +0 -1
- package/src/test-utils/fake-data.ts +0 -3
- package/src/typeahead/Typeahead.css +4 -4
- package/src/typeahead/Typeahead.less +2 -2
- package/build/styles/item/Item.css +0 -186
- package/build/types/item/Item.d.ts +0 -40
- package/build/types/item/Item.d.ts.map +0 -1
- package/build/types/item/ItemAdditionalInfo.d.ts +0 -9
- package/build/types/item/ItemAdditionalInfo.d.ts.map +0 -1
- package/build/types/item/ItemCheckbox.d.ts +0 -4
- package/build/types/item/ItemCheckbox.d.ts.map +0 -1
- package/build/types/item/ItemIconButton.d.ts +0 -4
- package/build/types/item/ItemIconButton.d.ts.map +0 -1
- package/build/types/item/ItemImage.d.ts +0 -4
- package/build/types/item/ItemImage.d.ts.map +0 -1
- package/build/types/item/ItemNavigation.d.ts +0 -4
- package/build/types/item/ItemNavigation.d.ts.map +0 -1
- package/build/types/item/index.d.ts +0 -5
- package/build/types/item/index.d.ts.map +0 -1
- package/build/types/item/prompt/Prompt.d.ts +0 -12
- package/build/types/item/prompt/Prompt.d.ts.map +0 -1
- package/src/item/Item.css +0 -186
- package/src/item/Item.less +0 -177
- package/src/item/Item.story.tsx +0 -93
- package/src/item/Item.tsx +0 -165
- package/src/item/ItemAdditionalInfo.tsx +0 -31
- package/src/item/ItemCheckbox.tsx +0 -16
- package/src/item/ItemIconButton.tsx +0 -15
- package/src/item/ItemImage.tsx +0 -11
- package/src/item/ItemNavigation.tsx +0 -16
- package/src/item/index.ts +0 -4
- package/src/item/prompt/Prompt.spec.tsx +0 -77
- package/src/item/prompt/Prompt.story.tsx +0 -170
- package/src/item/prompt/Prompt.tsx +0 -44
package/src/item/Item.css
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
.np-item {
|
|
2
|
-
padding: 16px;
|
|
3
|
-
padding: var(--size-16);
|
|
4
|
-
border-radius: 24px;
|
|
5
|
-
border-radius: var(--radius-large);
|
|
6
|
-
background-color: #ffffff;
|
|
7
|
-
background-color: var(--color-background-screen);
|
|
8
|
-
display: flex;
|
|
9
|
-
gap: 16px;
|
|
10
|
-
gap: var(--size-16);
|
|
11
|
-
align-items: center;
|
|
12
|
-
flex-direction: row;
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
}
|
|
15
|
-
.np-item:hover {
|
|
16
|
-
background-color: var(--color-background-screen-hover);
|
|
17
|
-
}
|
|
18
|
-
.np-item:active {
|
|
19
|
-
background-color: var(--color-background-screen-active);
|
|
20
|
-
}
|
|
21
|
-
.np-item-media {
|
|
22
|
-
flex: 0 0 auto;
|
|
23
|
-
align-items: flex-start;
|
|
24
|
-
}
|
|
25
|
-
.np-item-title {
|
|
26
|
-
color: #37517e;
|
|
27
|
-
color: var(--color-content-primary);
|
|
28
|
-
}
|
|
29
|
-
.np-item-additional-info {
|
|
30
|
-
color: #768e9c;
|
|
31
|
-
color: var(--color-content-tertiary);
|
|
32
|
-
}
|
|
33
|
-
.np-item-value {
|
|
34
|
-
flex: 0 0 auto;
|
|
35
|
-
}
|
|
36
|
-
.np-item-control {
|
|
37
|
-
flex: 0 0 auto;
|
|
38
|
-
}
|
|
39
|
-
.np-item-spotlight-active {
|
|
40
|
-
background-color: rgba(134,167,189,0.10196);
|
|
41
|
-
background-color: var(--color-background-neutral);
|
|
42
|
-
}
|
|
43
|
-
.np-item-spotlight-active:hover {
|
|
44
|
-
background-color: var(--color-background-neutral-hover);
|
|
45
|
-
}
|
|
46
|
-
.np-item-spotlight-active:active {
|
|
47
|
-
background-color: var(--color-background-neutral-active);
|
|
48
|
-
}
|
|
49
|
-
.np-item-spotlight-inactive {
|
|
50
|
-
background-color: rgba(134, 167, 189, 0.025);
|
|
51
|
-
border: 1px dashed rgba(0,0,0,0.10196);
|
|
52
|
-
border: 1px dashed var(--color-border-neutral);
|
|
53
|
-
}
|
|
54
|
-
@supports (color: color-mix(in lch, red, blue)) {
|
|
55
|
-
.np-item-spotlight-inactive {
|
|
56
|
-
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
.np-item-spotlight-inactive:hover {
|
|
60
|
-
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
61
|
-
}
|
|
62
|
-
.np-item-spotlight-inactive:active {
|
|
63
|
-
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
64
|
-
}
|
|
65
|
-
.np-item-prompt {
|
|
66
|
-
display: inline-flex;
|
|
67
|
-
padding-top: calc(8px / 2);
|
|
68
|
-
padding-top: calc(var(--padding-x-small) / 2);
|
|
69
|
-
padding-bottom: calc(8px / 2);
|
|
70
|
-
padding-bottom: calc(var(--padding-x-small) / 2);
|
|
71
|
-
padding-left: calc(8px - 1px);
|
|
72
|
-
padding-left: calc(var(--padding-x-small) - 1px);
|
|
73
|
-
padding-right: 8px;
|
|
74
|
-
padding-right: var(--padding-x-small);
|
|
75
|
-
border-radius: 10px;
|
|
76
|
-
border-radius: var(--radius-small);
|
|
77
|
-
word-break: break-word;
|
|
78
|
-
word-wrap: break-word;
|
|
79
|
-
}
|
|
80
|
-
.np-item-prompt .np-prompt-icon {
|
|
81
|
-
padding-right: calc(12px / 2);
|
|
82
|
-
padding-right: calc(var(--size-12) / 2);
|
|
83
|
-
padding-top: calc(4px - 1px);
|
|
84
|
-
padding-top: calc(var(--size-4) - 1px);
|
|
85
|
-
padding-bottom: calc(4px - 1px);
|
|
86
|
-
padding-bottom: calc(var(--size-4) - 1px);
|
|
87
|
-
}
|
|
88
|
-
.np-item-prompt .np-prompt-icon .tw-icon-tags,
|
|
89
|
-
.np-item-prompt .np-prompt-icon .tw-icon-confetti {
|
|
90
|
-
color: var(--color-sentiment-positive-primary);
|
|
91
|
-
}
|
|
92
|
-
.np-item-prompt a {
|
|
93
|
-
text-underline-offset: calc(4px / 2);
|
|
94
|
-
text-underline-offset: calc(var(--size-4) / 2);
|
|
95
|
-
}
|
|
96
|
-
.np-item-prompt.np-prompt-interactive {
|
|
97
|
-
-webkit-text-decoration: none;
|
|
98
|
-
text-decoration: none;
|
|
99
|
-
cursor: pointer;
|
|
100
|
-
border: none;
|
|
101
|
-
}
|
|
102
|
-
.np-item-prompt.negative {
|
|
103
|
-
background-color: var(--color-sentiment-negative-secondary);
|
|
104
|
-
color: var(--color-sentiment-negative-primary);
|
|
105
|
-
}
|
|
106
|
-
.np-item-prompt.negative a {
|
|
107
|
-
color: var(--color-sentiment-negative-primary);
|
|
108
|
-
}
|
|
109
|
-
.np-item-prompt.negative a:hover {
|
|
110
|
-
color: var(--color-sentiment-negative-primary-hover);
|
|
111
|
-
}
|
|
112
|
-
.np-item-prompt.negative a:active {
|
|
113
|
-
color: var(--color-sentiment-negative-primary-active);
|
|
114
|
-
}
|
|
115
|
-
.np-prompt-interactive.np-item-prompt.negative:hover {
|
|
116
|
-
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 95%, var(--color-sentiment-negative-primary));
|
|
117
|
-
}
|
|
118
|
-
.np-prompt-interactive.np-item-prompt.negative:active {
|
|
119
|
-
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
120
|
-
}
|
|
121
|
-
.np-item-prompt.positive,
|
|
122
|
-
.np-item-prompt.discount,
|
|
123
|
-
.np-item-prompt.savings {
|
|
124
|
-
background-color: var(--color-sentiment-positive-secondary);
|
|
125
|
-
color: var(--color-sentiment-positive-primary);
|
|
126
|
-
}
|
|
127
|
-
.np-item-prompt.positive a,
|
|
128
|
-
.np-item-prompt.discount a,
|
|
129
|
-
.np-item-prompt.savings a {
|
|
130
|
-
color: var(--color-sentiment-positive-primary);
|
|
131
|
-
}
|
|
132
|
-
.np-item-prompt.positive a:hover,
|
|
133
|
-
.np-item-prompt.discount a:hover,
|
|
134
|
-
.np-item-prompt.savings a:hover {
|
|
135
|
-
color: var(--color-sentiment-positive-primary-hover);
|
|
136
|
-
}
|
|
137
|
-
.np-item-prompt.positive a:active,
|
|
138
|
-
.np-item-prompt.discount a:active,
|
|
139
|
-
.np-item-prompt.savings a:active {
|
|
140
|
-
color: var(--color-sentiment-positive-primary-active);
|
|
141
|
-
}
|
|
142
|
-
.np-prompt-interactive.np-item-prompt.positive:hover,
|
|
143
|
-
.np-prompt-interactive.np-item-prompt.discount:hover,
|
|
144
|
-
.np-prompt-interactive.np-item-prompt.savings:hover {
|
|
145
|
-
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
146
|
-
}
|
|
147
|
-
.np-prompt-interactive.np-item-prompt.positive:active,
|
|
148
|
-
.np-prompt-interactive.np-item-prompt.discount:active,
|
|
149
|
-
.np-prompt-interactive.np-item-prompt.savings:active {
|
|
150
|
-
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
151
|
-
}
|
|
152
|
-
.np-item-prompt.neutral {
|
|
153
|
-
background-color: rgba(134,167,189,0.10196);
|
|
154
|
-
background-color: var(--color-background-neutral);
|
|
155
|
-
color: #37517e;
|
|
156
|
-
color: var(--color-content-primary);
|
|
157
|
-
}
|
|
158
|
-
.np-item-prompt.neutral a {
|
|
159
|
-
color: #37517e;
|
|
160
|
-
color: var(--color-content-primary);
|
|
161
|
-
}
|
|
162
|
-
.np-prompt-interactive.np-item-prompt.neutral:hover {
|
|
163
|
-
background-color: var(--color-background-neutral-hover);
|
|
164
|
-
}
|
|
165
|
-
.np-prompt-interactive.np-item-prompt.neutral:active {
|
|
166
|
-
background-color: var(--color-background-neutral-active);
|
|
167
|
-
}
|
|
168
|
-
.np-item-prompt.warning {
|
|
169
|
-
background-color: var(--color-sentiment-warning-secondary);
|
|
170
|
-
color: var(--color-sentiment-warning-content);
|
|
171
|
-
}
|
|
172
|
-
.np-item-prompt.warning a {
|
|
173
|
-
color: var(--color-sentiment-warning-content);
|
|
174
|
-
}
|
|
175
|
-
.np-item-prompt.warning a:hover {
|
|
176
|
-
color: var(--color-sentiment-warning-content-hover);
|
|
177
|
-
}
|
|
178
|
-
.np-item-prompt.warning a:active {
|
|
179
|
-
color: var(--color-sentiment-warning-content-active);
|
|
180
|
-
}
|
|
181
|
-
.np-prompt-interactive.np-item-prompt.warning:hover {
|
|
182
|
-
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 90%, var(--color-sentiment-warning-primary));
|
|
183
|
-
}
|
|
184
|
-
.np-prompt-interactive.np-item-prompt.warning:active {
|
|
185
|
-
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 80%, var(--color-sentiment-warning-primary));
|
|
186
|
-
}
|
package/src/item/Item.less
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
.np-item {
|
|
2
|
-
padding: var(--size-16);
|
|
3
|
-
border-radius: var(--radius-large);
|
|
4
|
-
background-color: var(--color-background-screen);
|
|
5
|
-
display: flex;
|
|
6
|
-
gap: var(--size-16);
|
|
7
|
-
align-items: center;
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
|
|
11
|
-
&:hover {
|
|
12
|
-
background-color: var(--color-background-screen-hover);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&:active {
|
|
16
|
-
background-color: var(--color-background-screen-active);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&-media {
|
|
20
|
-
flex: 0 0 auto;
|
|
21
|
-
align-items: flex-start;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&-title {
|
|
25
|
-
color: var(--color-content-primary);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&-additional-info {
|
|
29
|
-
color: var(--color-content-tertiary);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&-value {
|
|
33
|
-
flex: 0 0 auto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&-control {
|
|
37
|
-
flex: 0 0 auto;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&-spotlight {
|
|
41
|
-
&-active {
|
|
42
|
-
background-color: var(--color-background-neutral);
|
|
43
|
-
|
|
44
|
-
&:hover {
|
|
45
|
-
background-color: var(--color-background-neutral-hover);
|
|
46
|
-
}
|
|
47
|
-
&:active {
|
|
48
|
-
background-color: var(--color-background-neutral-active);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&-inactive {
|
|
53
|
-
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
54
|
-
border: 1px dashed var(--color-border-neutral);
|
|
55
|
-
|
|
56
|
-
&:hover {
|
|
57
|
-
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
58
|
-
}
|
|
59
|
-
&:active {
|
|
60
|
-
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&-prompt {
|
|
66
|
-
display: inline-flex;
|
|
67
|
-
padding-top: calc(var(--padding-x-small) / 2);
|
|
68
|
-
padding-bottom: calc(var(--padding-x-small) / 2);
|
|
69
|
-
padding-left: calc(var(--padding-x-small) - 1px);
|
|
70
|
-
padding-right: var(--padding-x-small);
|
|
71
|
-
border-radius: var(--radius-small);
|
|
72
|
-
word-break: break-word;
|
|
73
|
-
overflow-wrap: break-word;
|
|
74
|
-
|
|
75
|
-
.np-prompt-icon {
|
|
76
|
-
padding-right: calc(var(--size-12) / 2);
|
|
77
|
-
padding-top: calc(var(--size-4) - 1px);
|
|
78
|
-
padding-bottom: calc(var(--size-4) - 1px);
|
|
79
|
-
|
|
80
|
-
.tw-icon-tags,
|
|
81
|
-
.tw-icon-confetti {
|
|
82
|
-
color: var(--color-sentiment-positive-primary);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
a {
|
|
87
|
-
text-underline-offset: calc(var(--size-4) / 2);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&.np-prompt-interactive {
|
|
91
|
-
text-decoration: none;
|
|
92
|
-
cursor: pointer;
|
|
93
|
-
border: none;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&.negative {
|
|
97
|
-
background-color: var(--color-sentiment-negative-secondary);
|
|
98
|
-
color: var(--color-sentiment-negative-primary);
|
|
99
|
-
a {
|
|
100
|
-
color: var(--color-sentiment-negative-primary);
|
|
101
|
-
&:hover {
|
|
102
|
-
color: var(--color-sentiment-negative-primary-hover);
|
|
103
|
-
}
|
|
104
|
-
&:active {
|
|
105
|
-
color: var(--color-sentiment-negative-primary-active);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
.np-prompt-interactive& {
|
|
109
|
-
&:hover {
|
|
110
|
-
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 95%, var(--color-sentiment-negative-primary));
|
|
111
|
-
}
|
|
112
|
-
&:active {
|
|
113
|
-
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
&.positive,
|
|
118
|
-
&.discount,
|
|
119
|
-
&.savings {
|
|
120
|
-
background-color: var(--color-sentiment-positive-secondary);
|
|
121
|
-
color: var(--color-sentiment-positive-primary);
|
|
122
|
-
a {
|
|
123
|
-
color: var(--color-sentiment-positive-primary);
|
|
124
|
-
&:hover {
|
|
125
|
-
color: var(--color-sentiment-positive-primary-hover);
|
|
126
|
-
}
|
|
127
|
-
&:active {
|
|
128
|
-
color: var(--color-sentiment-positive-primary-active);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
.np-prompt-interactive& {
|
|
132
|
-
&:hover {
|
|
133
|
-
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
134
|
-
}
|
|
135
|
-
&:active {
|
|
136
|
-
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
&.neutral {
|
|
141
|
-
background-color: var(--color-background-neutral);
|
|
142
|
-
color: var(--color-content-primary);
|
|
143
|
-
a {
|
|
144
|
-
color: var(--color-content-primary);
|
|
145
|
-
}
|
|
146
|
-
.np-prompt-interactive& {
|
|
147
|
-
&:hover {
|
|
148
|
-
background-color: var(--color-background-neutral-hover);
|
|
149
|
-
}
|
|
150
|
-
&:active {
|
|
151
|
-
background-color: var(--color-background-neutral-active);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
&.warning {
|
|
156
|
-
background-color: var(--color-sentiment-warning-secondary);
|
|
157
|
-
color: var(--color-sentiment-warning-content);
|
|
158
|
-
a {
|
|
159
|
-
color: var(--color-sentiment-warning-content);
|
|
160
|
-
&:hover {
|
|
161
|
-
color: var(--color-sentiment-warning-content-hover);
|
|
162
|
-
}
|
|
163
|
-
&:active {
|
|
164
|
-
color: var(--color-sentiment-warning-content-active);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
.np-prompt-interactive& {
|
|
168
|
-
&:hover {
|
|
169
|
-
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 90%, var(--color-sentiment-warning-primary));
|
|
170
|
-
}
|
|
171
|
-
&:active {
|
|
172
|
-
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 80%, var(--color-sentiment-warning-primary));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
package/src/item/Item.story.tsx
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import Item, { Props as ItemProps } from './Item';
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { lorem10, lorem20, lorem40 } from '../test-utils';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: Item,
|
|
8
|
-
title: 'Content/Item',
|
|
9
|
-
} satisfies Meta<ItemProps>;
|
|
10
|
-
|
|
11
|
-
type Story = StoryObj<ItemProps>;
|
|
12
|
-
|
|
13
|
-
// TODO: delete this story later when we have more peace of the List Item puzzle
|
|
14
|
-
export const TempPlayground: Story = {
|
|
15
|
-
render: () => (
|
|
16
|
-
<div>
|
|
17
|
-
<Item
|
|
18
|
-
title="Test title"
|
|
19
|
-
subtitle="Test subtitle"
|
|
20
|
-
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
21
|
-
/>
|
|
22
|
-
<Item
|
|
23
|
-
title="Test title"
|
|
24
|
-
subtitle={lorem10}
|
|
25
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
26
|
-
/>
|
|
27
|
-
<Item
|
|
28
|
-
title="Test title"
|
|
29
|
-
subtitle={lorem10}
|
|
30
|
-
valueTitle="100 GBP"
|
|
31
|
-
valueSubtitle="100 USD"
|
|
32
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
33
|
-
/>
|
|
34
|
-
<Item
|
|
35
|
-
title="Test title"
|
|
36
|
-
subtitle="Test subtitle"
|
|
37
|
-
additionalInfo={
|
|
38
|
-
<Item.AdditionalInfo
|
|
39
|
-
action={{ label: 'Learn more', href: 'https://wise.com', target: '_blank' }}
|
|
40
|
-
>
|
|
41
|
-
{lorem10}
|
|
42
|
-
</Item.AdditionalInfo>
|
|
43
|
-
}
|
|
44
|
-
prompt={<Item.Prompt type="negative">You have done something wrong</Item.Prompt>}
|
|
45
|
-
/>
|
|
46
|
-
<Item
|
|
47
|
-
title="Test title"
|
|
48
|
-
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
49
|
-
prompt={
|
|
50
|
-
<Item.Prompt
|
|
51
|
-
type="discount"
|
|
52
|
-
action={{
|
|
53
|
-
href: 'https://wise.com',
|
|
54
|
-
target: '_blank',
|
|
55
|
-
'aria-label': 'clickable prompt',
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
The whole prompt is secretly clickable
|
|
59
|
-
</Item.Prompt>
|
|
60
|
-
}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
),
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const ItemRadio: Story = {
|
|
67
|
-
render: () => (
|
|
68
|
-
<div>
|
|
69
|
-
{/* Basic */}
|
|
70
|
-
{/* with additional info */}
|
|
71
|
-
{/* with prompt */}
|
|
72
|
-
{/* Disabled */}
|
|
73
|
-
{/* Spotlight */}
|
|
74
|
-
{/* Active */}
|
|
75
|
-
</div>
|
|
76
|
-
),
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const ItemButton: Story = {
|
|
80
|
-
render: () => (
|
|
81
|
-
<div>
|
|
82
|
-
{/* Basic */}
|
|
83
|
-
{/* with additional info */}
|
|
84
|
-
{/* with prompt */}
|
|
85
|
-
{/* partially interactive */}
|
|
86
|
-
{/* Disabled */}
|
|
87
|
-
{/* Spotlight */}
|
|
88
|
-
{/* Active */}
|
|
89
|
-
</div>
|
|
90
|
-
),
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// add intaces with dark mode
|
package/src/item/Item.tsx
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { createContext, ReactNode, useId, useMemo, useState } from 'react';
|
|
2
|
-
import { Typography } from '../common';
|
|
3
|
-
import Body from '../body';
|
|
4
|
-
import { Image } from './ItemImage';
|
|
5
|
-
import { AdditionalInfo } from './ItemAdditionalInfo';
|
|
6
|
-
import { IconButton } from './ItemIconButton';
|
|
7
|
-
import { Checkbox } from './ItemCheckbox';
|
|
8
|
-
import { Navigation } from './ItemNavigation';
|
|
9
|
-
import { clsx } from 'clsx';
|
|
10
|
-
import Prompt from './prompt/Prompt';
|
|
11
|
-
|
|
12
|
-
export type ItemTypes =
|
|
13
|
-
| 'none'
|
|
14
|
-
| 'navigation'
|
|
15
|
-
| 'radio'
|
|
16
|
-
| 'checkbox'
|
|
17
|
-
| 'switch'
|
|
18
|
-
| 'button'
|
|
19
|
-
| 'icon-button';
|
|
20
|
-
|
|
21
|
-
export type Props = {
|
|
22
|
-
as?: 'li' | 'div' | 'span';
|
|
23
|
-
inverted?: boolean;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
partialInteractivity?: boolean;
|
|
26
|
-
spotlight?: 'active' | 'inactive';
|
|
27
|
-
title: ReactNode;
|
|
28
|
-
subtitle?: ReactNode;
|
|
29
|
-
additionalInfo?: ReactNode;
|
|
30
|
-
valueTitle?: ReactNode;
|
|
31
|
-
valueSubtitle?: ReactNode;
|
|
32
|
-
media?: ReactNode;
|
|
33
|
-
control?: ReactNode;
|
|
34
|
-
prompt?: ReactNode;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type ItemContextData = {
|
|
38
|
-
setControlType: (type: ItemTypes) => void;
|
|
39
|
-
ids: {
|
|
40
|
-
label: string;
|
|
41
|
-
additionalInfo: string;
|
|
42
|
-
value: string;
|
|
43
|
-
control: string;
|
|
44
|
-
prompt: string;
|
|
45
|
-
};
|
|
46
|
-
props: Pick<Props, 'as' | 'disabled' | 'inverted'>;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// @ts-expect-error for now let's mock it with `null` value
|
|
50
|
-
// but actually by default we should specify `setControlType('none')`
|
|
51
|
-
export const ItemContext = createContext<ItemContextData>(null);
|
|
52
|
-
|
|
53
|
-
export const Item = ({
|
|
54
|
-
as: View = 'li',
|
|
55
|
-
title,
|
|
56
|
-
subtitle,
|
|
57
|
-
additionalInfo,
|
|
58
|
-
prompt,
|
|
59
|
-
inverted,
|
|
60
|
-
media,
|
|
61
|
-
spotlight = undefined,
|
|
62
|
-
valueTitle,
|
|
63
|
-
valueSubtitle,
|
|
64
|
-
control,
|
|
65
|
-
disabled,
|
|
66
|
-
}: Props) => {
|
|
67
|
-
/*
|
|
68
|
-
const returnType = (): ReactNode => {
|
|
69
|
-
switch (type) {
|
|
70
|
-
case 'Navigation':
|
|
71
|
-
return <Chevron orientation={Position.RIGHT} disabled />;
|
|
72
|
-
case 'Radio':
|
|
73
|
-
return <RadioButton name="Hello" checked />;
|
|
74
|
-
case 'Checkbox':
|
|
75
|
-
return <CheckboxButton name="Hello" checked />;
|
|
76
|
-
case 'Switch':
|
|
77
|
-
return <Switch onClick={() => console.log('clicked')} />;
|
|
78
|
-
case 'Button':
|
|
79
|
-
return <Button v2>Hello</Button>;
|
|
80
|
-
case 'IconButton':
|
|
81
|
-
return (
|
|
82
|
-
<IconButton size={40} priority="minimal">
|
|
83
|
-
<InfoCircle />
|
|
84
|
-
</IconButton>
|
|
85
|
-
);
|
|
86
|
-
case 'NonInteractive':
|
|
87
|
-
default:
|
|
88
|
-
return <></>;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
*/
|
|
92
|
-
const idPrefix = useId();
|
|
93
|
-
|
|
94
|
-
const [controlType, setControlType] = useState<ItemTypes>();
|
|
95
|
-
const ids = {
|
|
96
|
-
label: `${idPrefix}_label`,
|
|
97
|
-
value: `${idPrefix}_value`,
|
|
98
|
-
control: `${idPrefix}_control`,
|
|
99
|
-
prompt: `${idPrefix}_prompt`,
|
|
100
|
-
additionalInfo: `${idPrefix}_additional-info`,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const itemCtx = useMemo(
|
|
104
|
-
() => ({ setControlType, ids, props: { as: View, disabled, inverted } }),
|
|
105
|
-
[],
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<ItemContext.Provider value={itemCtx}>
|
|
110
|
-
<View
|
|
111
|
-
className={clsx('np-item', `np-item-${controlType}`, {
|
|
112
|
-
[`np-item-spotlight-${spotlight}`]: !!spotlight,
|
|
113
|
-
})}
|
|
114
|
-
aria-describedby={[ids.additionalInfo].join(' ')}
|
|
115
|
-
>
|
|
116
|
-
{media && <div className="np-item-media">{media}</div>}
|
|
117
|
-
|
|
118
|
-
{/* Title + Subtitle + Values + Additional Info - Group */}
|
|
119
|
-
<div>
|
|
120
|
-
{/* Title + Subtitle + Values - Group */}
|
|
121
|
-
<div className="d-flex justify-content-between">
|
|
122
|
-
<span>
|
|
123
|
-
{/* @ts-expect-error div can have role and aria-lavel props */}
|
|
124
|
-
<Body
|
|
125
|
-
type={Typography.BODY_LARGE_BOLD}
|
|
126
|
-
className="np-item-title"
|
|
127
|
-
// for a11y this needs to be a header but for SEO it shouldn't be `h*` tag
|
|
128
|
-
// so we enable header semantics via `role` and `aria-level` attrs
|
|
129
|
-
role="heading"
|
|
130
|
-
aria-level="4"
|
|
131
|
-
>
|
|
132
|
-
{title}
|
|
133
|
-
</Body>
|
|
134
|
-
<Body className="np-item-subtitle">{subtitle}</Body>
|
|
135
|
-
</span>
|
|
136
|
-
{(valueTitle || valueSubtitle) && (
|
|
137
|
-
<span id={ids.value} className="np-item-value">
|
|
138
|
-
<Body type={Typography.BODY_LARGE_BOLD} className="np-item-title-value">
|
|
139
|
-
{valueTitle}
|
|
140
|
-
</Body>
|
|
141
|
-
<Body className="np-item-subtitle-value">{valueSubtitle}</Body>
|
|
142
|
-
</span>
|
|
143
|
-
)}
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
{/* Additional Info and Prompt here */}
|
|
147
|
-
{Boolean(subtitle) && additionalInfo}
|
|
148
|
-
</div>
|
|
149
|
-
<Body className="np-item-control">{control}</Body>
|
|
150
|
-
{prompt}
|
|
151
|
-
</View>
|
|
152
|
-
</ItemContext.Provider>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/* eslint-disable functional/immutable-data */
|
|
157
|
-
Item.Image = Image;
|
|
158
|
-
Item.AdditionalInfo = AdditionalInfo;
|
|
159
|
-
Item.Checkbox = Checkbox;
|
|
160
|
-
Item.IconButton = IconButton;
|
|
161
|
-
Item.Navigation = Navigation;
|
|
162
|
-
Item.Prompt = Prompt;
|
|
163
|
-
/* eslint-enable functional/immutable-data */
|
|
164
|
-
|
|
165
|
-
export default Item;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, useContext } from 'react';
|
|
2
|
-
import { ItemContext, ItemContextData } from './Item';
|
|
3
|
-
import Body from '../body';
|
|
4
|
-
import Link, { LinkProps } from '../link';
|
|
5
|
-
import { Typography } from '../common';
|
|
6
|
-
|
|
7
|
-
export type ItemAdditionalInfoProps = PropsWithChildren<{
|
|
8
|
-
action?: Pick<LinkProps, 'href' | 'onClick' | 'target'> & { label?: string };
|
|
9
|
-
}>;
|
|
10
|
-
|
|
11
|
-
export const AdditionalInfo = function ({ children, action }: ItemAdditionalInfoProps) {
|
|
12
|
-
const { ids } = useContext<ItemContextData>(ItemContext);
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Body
|
|
16
|
-
type={Typography.BODY_DEFAULT}
|
|
17
|
-
id={ids.additionalInfo}
|
|
18
|
-
className="np-item-additional-info"
|
|
19
|
-
>
|
|
20
|
-
{children}
|
|
21
|
-
{action ? (
|
|
22
|
-
<>
|
|
23
|
-
{' '}
|
|
24
|
-
<Link href={action.href} target={action.target} onClick={action.onClick}>
|
|
25
|
-
{action.label}
|
|
26
|
-
</Link>
|
|
27
|
-
</>
|
|
28
|
-
) : null}
|
|
29
|
-
</Body>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect } from 'react';
|
|
2
|
-
import CheckboxButton from '../checkboxButton';
|
|
3
|
-
import { CheckboxButtonProps } from '../checkboxButton/CheckboxButton';
|
|
4
|
-
import { ItemContext, ItemContextData } from './Item';
|
|
5
|
-
|
|
6
|
-
export type ItemCheckboxProps = Pick<CheckboxButtonProps, 'checked' | 'indeterminate' | 'onChange'>;
|
|
7
|
-
|
|
8
|
-
export const Checkbox = function (props: ItemCheckboxProps) {
|
|
9
|
-
const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
10
|
-
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
setControlType('checkbox');
|
|
13
|
-
}, []);
|
|
14
|
-
|
|
15
|
-
return <CheckboxButton disabled={baseItemProps.disabled} {...props} />;
|
|
16
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect } from 'react';
|
|
2
|
-
import { default as IconButtonComp, IconButtonProps } from '../iconButton';
|
|
3
|
-
import { ItemContext, ItemContextData } from './Item';
|
|
4
|
-
|
|
5
|
-
export type ItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'>;
|
|
6
|
-
|
|
7
|
-
export const IconButton = function (props: ItemIconButtonProps) {
|
|
8
|
-
const { setControlType } = useContext<ItemContextData>(ItemContext);
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
setControlType('icon-button');
|
|
12
|
-
}, []);
|
|
13
|
-
|
|
14
|
-
return <IconButtonComp {...props} size={32} />;
|
|
15
|
-
};
|
package/src/item/ItemImage.tsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect } from 'react';
|
|
2
|
-
import Item, { ItemContext, ItemContextData } from './Item';
|
|
3
|
-
import { default as Img, ImageProps } from '../image/Image';
|
|
4
|
-
|
|
5
|
-
export type ItemImageProps = Pick<ImageProps, 'src' | 'alt'>;
|
|
6
|
-
|
|
7
|
-
export const Image = function (props: ItemImageProps) {
|
|
8
|
-
const { ids, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
9
|
-
|
|
10
|
-
return <Img {...props} />;
|
|
11
|
-
};
|