@transferwise/components 0.0.0-experimental-c239b44 → 0.0.0-experimental-e0993c8
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/header/Header.js +79 -41
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +76 -41
- package/build/header/Header.mjs.map +1 -1
- package/build/i18n/es.json +2 -0
- package/build/i18n/es.json.js +2 -0
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +2 -0
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/index.js +1 -1
- package/build/index.mjs +1 -1
- package/build/inputs/SelectInput.js +1 -1
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +1 -1
- package/build/listItem/IconButton/ListItemIconButton.js +1 -1
- package/build/listItem/IconButton/ListItemIconButton.js.map +1 -1
- package/build/listItem/IconButton/ListItemIconButton.mjs +1 -1
- package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -1
- package/build/listItem/ListItem.js +18 -18
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +18 -18
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/ListItemContext.js.map +1 -1
- package/build/listItem/ListItemContext.mjs.map +1 -1
- package/build/main.css +32 -14
- package/build/styles/header/Header.css +32 -14
- package/build/styles/main.css +32 -14
- package/build/title/Title.js +10 -4
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +6 -4
- package/build/title/Title.mjs.map +1 -1
- package/build/types/header/Header.d.ts +28 -11
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/header/index.d.ts +1 -0
- package/build/types/header/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/listItem/ListItem.d.ts +3 -3
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/ListItemContext.d.ts +2 -2
- package/build/types/listItem/ListItemContext.d.ts.map +1 -1
- package/build/types/title/Title.d.ts +4 -5
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/header/Header.accessibility.docs.mdx +85 -0
- package/src/header/Header.css +32 -14
- package/src/header/Header.less +28 -9
- package/src/header/Header.spec.tsx +68 -50
- package/src/header/Header.story.tsx +190 -36
- package/src/header/Header.tsx +122 -70
- package/src/header/index.ts +1 -0
- package/src/i18n/es.json +2 -0
- package/src/index.ts +1 -0
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +2 -2
- package/src/listItem/IconButton/ListItemIconButton.tsx +2 -2
- package/src/listItem/ListItem.spec.tsx +279 -221
- package/src/listItem/ListItem.tsx +20 -19
- package/src/listItem/ListItemContext.tsx +2 -2
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +6 -6
- package/src/listItem/_stories/ListItem.story.tsx +19 -12
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +43 -43
- package/src/listItem/test-utils.tsx +1 -1
- package/src/main.css +32 -14
- package/src/title/Title.tsx +25 -12
|
@@ -62,8 +62,8 @@ export type ListItemProps = {
|
|
|
62
62
|
* Can be only rendered if `subtitle` is also provided.
|
|
63
63
|
*/
|
|
64
64
|
additionalInfo?: ReactNode;
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
valueTitle?: ReactNode;
|
|
66
|
+
valueSubtitle?: ReactNode;
|
|
67
67
|
/**
|
|
68
68
|
* Requires one of the following as a sole child: <br />
|
|
69
69
|
* `<ListItem.AvatarView />`,
|
|
@@ -107,8 +107,8 @@ export const ListItem = ({
|
|
|
107
107
|
inverted,
|
|
108
108
|
media,
|
|
109
109
|
spotlight,
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
valueTitle,
|
|
111
|
+
valueSubtitle,
|
|
112
112
|
control = null,
|
|
113
113
|
disabled,
|
|
114
114
|
className,
|
|
@@ -123,8 +123,8 @@ export const ListItem = ({
|
|
|
123
123
|
const ids: ListItemContextData['ids'] = {
|
|
124
124
|
title: `${idPrefix}_title`,
|
|
125
125
|
...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),
|
|
126
|
-
...(
|
|
127
|
-
...(
|
|
126
|
+
...(valueTitle ? { valueTitle: `${idPrefix}_value-title` } : {}),
|
|
127
|
+
...(valueSubtitle ? { valueSubtitle: `${idPrefix}_value-subtitle` } : {}),
|
|
128
128
|
control: `${idPrefix}_control`,
|
|
129
129
|
...(prompt ? { prompt: `${idPrefix}_prompt` } : {}),
|
|
130
130
|
...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),
|
|
@@ -142,8 +142,8 @@ export const ListItem = ({
|
|
|
142
142
|
const titlesAndValues = [
|
|
143
143
|
inverted ? ids.subtitle : ids.title,
|
|
144
144
|
inverted ? ids.title : ids.subtitle,
|
|
145
|
-
inverted ? ids.
|
|
146
|
-
inverted ? ids.
|
|
145
|
+
inverted ? ids.valueSubtitle : ids.valueTitle,
|
|
146
|
+
inverted ? ids.valueTitle : ids.valueSubtitle,
|
|
147
147
|
].join(' ');
|
|
148
148
|
const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');
|
|
149
149
|
|
|
@@ -283,35 +283,36 @@ export const ListItem = ({
|
|
|
283
283
|
})()}
|
|
284
284
|
</span>
|
|
285
285
|
|
|
286
|
-
{(
|
|
286
|
+
{(valueTitle || valueSubtitle) && (
|
|
287
287
|
<span
|
|
288
288
|
className={clsx('wds-list-item-value', {
|
|
289
|
-
'flex-column':
|
|
290
|
-
'wds-list-item-body-center':
|
|
289
|
+
'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,
|
|
290
|
+
'wds-list-item-body-center':
|
|
291
|
+
(valueTitle && !valueSubtitle) || (!valueTitle && valueSubtitle),
|
|
291
292
|
})}
|
|
292
293
|
>
|
|
293
294
|
{(() => {
|
|
294
295
|
const values = [];
|
|
295
|
-
if (
|
|
296
|
+
if (valueTitle) {
|
|
296
297
|
values.push(
|
|
297
298
|
<Body
|
|
298
|
-
key={ids.
|
|
299
|
-
id={ids.
|
|
299
|
+
key={ids.valueTitle}
|
|
300
|
+
id={ids.valueTitle}
|
|
300
301
|
type={Typography.BODY_LARGE_BOLD}
|
|
301
302
|
className="wds-list-item-title-value"
|
|
302
303
|
>
|
|
303
|
-
{
|
|
304
|
+
{valueTitle}
|
|
304
305
|
</Body>,
|
|
305
306
|
);
|
|
306
307
|
}
|
|
307
|
-
if (
|
|
308
|
+
if (valueSubtitle) {
|
|
308
309
|
values.push(
|
|
309
310
|
<Body
|
|
310
|
-
key={ids.
|
|
311
|
-
id={ids.
|
|
311
|
+
key={ids.valueSubtitle}
|
|
312
|
+
id={ids.valueSubtitle}
|
|
312
313
|
className="wds-list-item-subtitle-value"
|
|
313
314
|
>
|
|
314
|
-
{
|
|
315
|
+
{valueSubtitle}
|
|
315
316
|
</Body>,
|
|
316
317
|
);
|
|
317
318
|
}
|
|
@@ -57,7 +57,7 @@ const variants = [
|
|
|
57
57
|
</ListItem.AvatarView>
|
|
58
58
|
}
|
|
59
59
|
/>,
|
|
60
|
-
<ListItem key="value" title="With value"
|
|
60
|
+
<ListItem key="value" title="With value" valueTitle="100 GBP" valueSubtitle="100 USD" />,
|
|
61
61
|
<ListItem
|
|
62
62
|
key="prompt"
|
|
63
63
|
title="With prompt"
|
|
@@ -84,7 +84,7 @@ const variants = [
|
|
|
84
84
|
<ListItem
|
|
85
85
|
key="button-value"
|
|
86
86
|
title="Button + value"
|
|
87
|
-
|
|
87
|
+
valueTitle="42 EUR"
|
|
88
88
|
control={
|
|
89
89
|
<ListItem.Button priority="secondary-neutral" onClick={() => {}}>
|
|
90
90
|
Pay
|
|
@@ -101,12 +101,12 @@ const variants = [
|
|
|
101
101
|
<Bank />
|
|
102
102
|
</ListItem.AvatarView>
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
valueTitle="1,000 USD"
|
|
105
105
|
/>,
|
|
106
106
|
<ListItem
|
|
107
107
|
key="prompt-value"
|
|
108
108
|
title="Prompt + value"
|
|
109
|
-
|
|
109
|
+
valueTitle="10 GBP"
|
|
110
110
|
prompt={<ListItem.Prompt sentiment="warning">Warning prompt!</ListItem.Prompt>}
|
|
111
111
|
/>,
|
|
112
112
|
<ListItem
|
|
@@ -128,7 +128,7 @@ const variants = [
|
|
|
128
128
|
<Savings />
|
|
129
129
|
</ListItem.AvatarView>
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
valueTitle="999 GBP"
|
|
132
132
|
prompt={
|
|
133
133
|
<ListItem.Prompt sentiment="positive">
|
|
134
134
|
<Link href="https://wise.com">See details</Link>
|
|
@@ -144,7 +144,7 @@ const variants = [
|
|
|
144
144
|
<Savings />
|
|
145
145
|
</ListItem.AvatarView>
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
valueTitle="999 GBP"
|
|
148
148
|
prompt={
|
|
149
149
|
<ListItem.Prompt sentiment="positive">
|
|
150
150
|
<Link href="https://wise.com">See details</Link>
|
|
@@ -55,8 +55,8 @@ export default {
|
|
|
55
55
|
args: {
|
|
56
56
|
title: 'List item title',
|
|
57
57
|
subtitle: 'Subtitle goes here',
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
valueTitle: '100 GBP',
|
|
59
|
+
valueSubtitle: '100 USD',
|
|
60
60
|
disabled: false,
|
|
61
61
|
spotlight: undefined,
|
|
62
62
|
inverted: false,
|
|
@@ -325,7 +325,7 @@ export const Responsiveness: StoryObj<PreviewStoryArgs> = {
|
|
|
325
325
|
* Due to platform limitations, the component is unable to automagically adjust its content to
|
|
326
326
|
* all possible configurations. <br />
|
|
327
327
|
* By default, it'll follow a CSS grid `1fr max-content` ratio of left side content (`title` and
|
|
328
|
-
* `subtitle`) to the right side content (`
|
|
328
|
+
* `subtitle`) to the right side content (`valueTitle` and `valueSubtitle`).
|
|
329
329
|
*
|
|
330
330
|
* To adjust the width of the right side content, you can use `valueColumnWidth` prop which accepts
|
|
331
331
|
* a number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration.
|
|
@@ -345,8 +345,8 @@ export const ContentRatio: StoryObj<PreviewStoryArgs> = {
|
|
|
345
345
|
args: {
|
|
346
346
|
valueColumnWidth: 70,
|
|
347
347
|
subtitle: lorem5,
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
valueTitle: `${lorem5} ${lorem5}`,
|
|
349
|
+
valueSubtitle: lorem5,
|
|
350
350
|
previewInteractivity: 'fully-interactive',
|
|
351
351
|
previewPrompt: 'interactive',
|
|
352
352
|
previewMedia: 'image',
|
|
@@ -448,7 +448,14 @@ export const Spotlight: StoryObj<PreviewStoryArgs> = {
|
|
|
448
448
|
*/
|
|
449
449
|
export const Interactivity: StoryObj<PreviewStoryArgs> = storySourceWithoutNoise({
|
|
450
450
|
argTypes: {
|
|
451
|
-
...hideControls([
|
|
451
|
+
...hideControls([
|
|
452
|
+
'title',
|
|
453
|
+
'subtitle',
|
|
454
|
+
'valueTitle',
|
|
455
|
+
'valueSubtitle',
|
|
456
|
+
'valueColumnWidth',
|
|
457
|
+
'inverted',
|
|
458
|
+
]),
|
|
452
459
|
},
|
|
453
460
|
args: {
|
|
454
461
|
subtitle: lorem10,
|
|
@@ -730,8 +737,8 @@ export const Disabled: Story = {
|
|
|
730
737
|
|
|
731
738
|
/**
|
|
732
739
|
* For backwards compatibility, all of the ListItem's content elements accept `ReactNode`.
|
|
733
|
-
* That said, most of them should be fed with plain text only. The exception is `
|
|
734
|
-
* and `
|
|
740
|
+
* That said, most of them should be fed with plain text only. The exception is `valueTitle`
|
|
741
|
+
* and `valueSubtitle` which can be augmented with sentiment colours, strikethrough or bold
|
|
735
742
|
* styles. <br />
|
|
736
743
|
*
|
|
737
744
|
* Please refer to the [design documentation](https://wise.design/components/list-item#content) for more details.
|
|
@@ -753,13 +760,13 @@ export const StylingLabels: Story = {
|
|
|
753
760
|
<List>
|
|
754
761
|
<ListItem
|
|
755
762
|
{...args}
|
|
756
|
-
|
|
757
|
-
|
|
763
|
+
valueTitle={<Emphasis text="<negative>100 GBP</negative>" />}
|
|
764
|
+
valueSubtitle={<s>125 GBP</s>}
|
|
758
765
|
/>
|
|
759
766
|
<ListItem
|
|
760
767
|
{...args}
|
|
761
|
-
|
|
762
|
-
|
|
768
|
+
valueTitle={<Emphasis text="<positive>100 GBP</positive>" />}
|
|
769
|
+
valueSubtitle={<strong>125 GBP</strong>}
|
|
763
770
|
/>
|
|
764
771
|
</List>
|
|
765
772
|
);
|
|
@@ -42,8 +42,8 @@ const infoWithLink = (
|
|
|
42
42
|
</ListItem.AdditionalInfo>
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
const
|
|
46
|
-
const
|
|
45
|
+
const valueTitle = '100 GBP';
|
|
46
|
+
const valueSubtitle = '200 USD';
|
|
47
47
|
const prompt = <ListItem.Prompt sentiment="positive">Finally, there is a prompt.</ListItem.Prompt>;
|
|
48
48
|
const promptWithLink = (
|
|
49
49
|
<ListItem.Prompt sentiment="positive">
|
|
@@ -71,35 +71,35 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
|
71
71
|
const additionalInfo = isInteractive ? infoWithLink : infoWithoutLink;
|
|
72
72
|
const variants = [
|
|
73
73
|
{ title },
|
|
74
|
-
{ title,
|
|
74
|
+
{ title, valueTitle },
|
|
75
75
|
{ title, subtitle },
|
|
76
|
-
{ title,
|
|
76
|
+
{ title, valueTitle, valueSubtitle },
|
|
77
77
|
{ title, subtitle, inverted: true },
|
|
78
|
-
{ title, subtitle,
|
|
79
|
-
{ title, subtitle,
|
|
80
|
-
{ title, subtitle,
|
|
81
|
-
{ title, subtitle,
|
|
78
|
+
{ title, subtitle, valueTitle },
|
|
79
|
+
{ title, subtitle, valueTitle, inverted: true },
|
|
80
|
+
{ title, subtitle, valueTitle, valueSubtitle },
|
|
81
|
+
{ title, subtitle, valueTitle, valueSubtitle, inverted: true },
|
|
82
82
|
{ media, title },
|
|
83
|
-
{ media, title,
|
|
83
|
+
{ media, title, valueTitle },
|
|
84
84
|
{ media, title, subtitle },
|
|
85
|
-
{ media, title,
|
|
86
|
-
{ media, title,
|
|
87
|
-
{ media, title,
|
|
85
|
+
{ media, title, valueTitle, valueSubtitle },
|
|
86
|
+
{ media, title, valueTitle },
|
|
87
|
+
{ media, title, valueSubtitle },
|
|
88
88
|
{ media, title, subtitle },
|
|
89
|
-
{ media, title, subtitle,
|
|
90
|
-
{ media, title, subtitle,
|
|
89
|
+
{ media, title, subtitle, valueTitle },
|
|
90
|
+
{ media, title, subtitle, valueTitle, valueSubtitle },
|
|
91
91
|
{ media, title, subtitle, additionalInfo: infoWithoutLink },
|
|
92
92
|
isInteractive ? { media, title, subtitle, additionalInfo: infoWithLink } : null,
|
|
93
|
-
{ media, title, subtitle, additionalInfo,
|
|
94
|
-
{ media, title, subtitle, additionalInfo,
|
|
95
|
-
{ media, title, subtitle, additionalInfo,
|
|
93
|
+
{ media, title, subtitle, additionalInfo, valueTitle },
|
|
94
|
+
{ media, title, subtitle, additionalInfo, valueTitle, valueSubtitle },
|
|
95
|
+
{ media, title, subtitle, additionalInfo, valueTitle, valueSubtitle, prompt },
|
|
96
96
|
{
|
|
97
97
|
media,
|
|
98
98
|
title,
|
|
99
99
|
subtitle,
|
|
100
100
|
additionalInfo,
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
valueTitle,
|
|
102
|
+
valueSubtitle,
|
|
103
103
|
prompt: promptWithLink,
|
|
104
104
|
},
|
|
105
105
|
{
|
|
@@ -107,8 +107,8 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
|
107
107
|
title,
|
|
108
108
|
subtitle,
|
|
109
109
|
additionalInfo,
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
valueTitle,
|
|
111
|
+
valueSubtitle,
|
|
112
112
|
prompt: promptWithLink,
|
|
113
113
|
inverted: true,
|
|
114
114
|
},
|
|
@@ -117,8 +117,8 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
|
117
117
|
title,
|
|
118
118
|
subtitle,
|
|
119
119
|
additionalInfo,
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
valueTitle,
|
|
121
|
+
valueSubtitle,
|
|
122
122
|
prompt: promptWithLink,
|
|
123
123
|
spotlight: 'active',
|
|
124
124
|
},
|
|
@@ -127,8 +127,8 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
|
127
127
|
title,
|
|
128
128
|
subtitle,
|
|
129
129
|
additionalInfo,
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
valueTitle,
|
|
131
|
+
valueSubtitle,
|
|
132
132
|
prompt: promptWithLink,
|
|
133
133
|
spotlight: 'inactive',
|
|
134
134
|
},
|
|
@@ -137,8 +137,8 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
|
137
137
|
title,
|
|
138
138
|
subtitle,
|
|
139
139
|
additionalInfo,
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
valueTitle,
|
|
141
|
+
valueSubtitle,
|
|
142
142
|
prompt: promptWithLink,
|
|
143
143
|
spotlight: 'inactive',
|
|
144
144
|
disabled: true,
|
|
@@ -186,8 +186,8 @@ export const ButtonControlLabel: Story = {
|
|
|
186
186
|
<ListItem
|
|
187
187
|
title="Fully interactive button."
|
|
188
188
|
subtitle="It uses default content hierarchy."
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
valueTitle="100 GBP"
|
|
190
|
+
valueSubtitle="200 USD"
|
|
191
191
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
192
192
|
control={CONTROLS.button}
|
|
193
193
|
prompt={PROMPTS.nonInteractive}
|
|
@@ -197,8 +197,8 @@ export const ButtonControlLabel: Story = {
|
|
|
197
197
|
inverted
|
|
198
198
|
title="Fully interactive button."
|
|
199
199
|
subtitle="It uses inverted content hierarchy."
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
valueTitle="100 GBP"
|
|
201
|
+
valueSubtitle="200 USD"
|
|
202
202
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
203
203
|
control={CONTROLS.button}
|
|
204
204
|
prompt={PROMPTS.nonInteractive}
|
|
@@ -207,8 +207,8 @@ export const ButtonControlLabel: Story = {
|
|
|
207
207
|
<ListItem
|
|
208
208
|
title="Fully interactive button as HTML anchor."
|
|
209
209
|
subtitle="It uses default content hierarchy."
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
valueTitle="100 GBP"
|
|
211
|
+
valueSubtitle="200 USD"
|
|
212
212
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
213
213
|
control={CONTROLS.buttonAsLink}
|
|
214
214
|
prompt={PROMPTS.nonInteractive}
|
|
@@ -218,8 +218,8 @@ export const ButtonControlLabel: Story = {
|
|
|
218
218
|
inverted
|
|
219
219
|
title="Fully interactive button as HTML anchor."
|
|
220
220
|
subtitle="It uses inverted content hierarchy."
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
valueTitle="100 GBP"
|
|
222
|
+
valueSubtitle="200 USD"
|
|
223
223
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
224
224
|
control={CONTROLS.buttonAsLink}
|
|
225
225
|
prompt={PROMPTS.nonInteractive}
|
|
@@ -228,8 +228,8 @@ export const ButtonControlLabel: Story = {
|
|
|
228
228
|
<ListItem
|
|
229
229
|
title="Partially interactive button."
|
|
230
230
|
subtitle="It uses default content hierarchy."
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
valueTitle="100 GBP"
|
|
232
|
+
valueSubtitle="200 USD"
|
|
233
233
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
234
234
|
control={CONTROLS.partialButton}
|
|
235
235
|
prompt={PROMPTS.nonInteractive}
|
|
@@ -239,8 +239,8 @@ export const ButtonControlLabel: Story = {
|
|
|
239
239
|
inverted
|
|
240
240
|
title="Partially interactive button."
|
|
241
241
|
subtitle="It uses inverted content hierarchy."
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
valueTitle="100 GBP"
|
|
243
|
+
valueSubtitle="200 USD"
|
|
244
244
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
245
245
|
control={CONTROLS.partialButton}
|
|
246
246
|
prompt={PROMPTS.nonInteractive}
|
|
@@ -249,8 +249,8 @@ export const ButtonControlLabel: Story = {
|
|
|
249
249
|
<ListItem
|
|
250
250
|
title="Partially interactive button as HTML anchor."
|
|
251
251
|
subtitle="It uses default content hierarchy."
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
valueTitle="100 GBP"
|
|
253
|
+
valueSubtitle="200 USD"
|
|
254
254
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
255
255
|
control={CONTROLS.buttonAsLink}
|
|
256
256
|
prompt={PROMPTS.nonInteractive}
|
|
@@ -260,8 +260,8 @@ export const ButtonControlLabel: Story = {
|
|
|
260
260
|
inverted
|
|
261
261
|
title="Partially interactive button as HTML anchor."
|
|
262
262
|
subtitle="It uses inverted content hierarchy."
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
valueTitle="100 GBP"
|
|
264
|
+
valueSubtitle="200 USD"
|
|
265
265
|
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
266
266
|
control={CONTROLS.buttonAsLink}
|
|
267
267
|
prompt={PROMPTS.nonInteractive}
|
package/src/main.css
CHANGED
|
@@ -2433,30 +2433,48 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2433
2433
|
fill: var(--color-interactive-primary);
|
|
2434
2434
|
}
|
|
2435
2435
|
.np-header {
|
|
2436
|
-
display:
|
|
2437
|
-
|
|
2438
|
-
|
|
2436
|
+
display: grid;
|
|
2437
|
+
grid-template-columns: 1fr auto;
|
|
2438
|
+
grid-column-gap: 24px;
|
|
2439
|
+
grid-column-gap: var(--size-24);
|
|
2440
|
+
-moz-column-gap: 24px;
|
|
2441
|
+
column-gap: 24px;
|
|
2442
|
+
-moz-column-gap: var(--size-24);
|
|
2443
|
+
column-gap: var(--size-24);
|
|
2444
|
+
align-items: center;
|
|
2445
|
+
margin-bottom: 8px;
|
|
2446
|
+
margin-bottom: var(--size-8);
|
|
2439
2447
|
max-width: 100%;
|
|
2440
2448
|
padding: 8px 0;
|
|
2441
2449
|
padding: var(--size-8) 0;
|
|
2450
|
+
width: 100%;
|
|
2451
|
+
}
|
|
2452
|
+
.np-header--group {
|
|
2453
|
+
align-items: flex-end;
|
|
2442
2454
|
border-bottom: 1px solid rgba(0,0,0,0.10196);
|
|
2443
2455
|
border-bottom: 1px solid var(--color-border-neutral);
|
|
2444
|
-
margin-bottom: 8px;
|
|
2445
|
-
margin-bottom: var(--size-8);
|
|
2446
|
-
-moz-column-gap: 24px;
|
|
2447
|
-
column-gap: 24px;
|
|
2448
|
-
-moz-column-gap: var(--size-24);
|
|
2449
|
-
column-gap: var(--size-24);
|
|
2450
2456
|
}
|
|
2451
2457
|
.np-header__title {
|
|
2452
2458
|
color: #5d7079;
|
|
2453
2459
|
color: var(--color-content-secondary);
|
|
2460
|
+
margin: 0;
|
|
2454
2461
|
}
|
|
2455
|
-
.np-
|
|
2456
|
-
margin
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2462
|
+
.np-header__action {
|
|
2463
|
+
margin: 0;
|
|
2464
|
+
height: 20px;
|
|
2465
|
+
display: flex;
|
|
2466
|
+
align-items: center;
|
|
2467
|
+
}
|
|
2468
|
+
.np-header__action-link {
|
|
2469
|
+
margin-bottom: -0.5px;
|
|
2470
|
+
}
|
|
2471
|
+
.np-header__action-button {
|
|
2472
|
+
margin-right: -17px;
|
|
2473
|
+
}
|
|
2474
|
+
@media (max-width: 320px) {
|
|
2475
|
+
.np-header__action-button {
|
|
2476
|
+
margin-right: -12.5px;
|
|
2477
|
+
}
|
|
2460
2478
|
}
|
|
2461
2479
|
.tw-image {
|
|
2462
2480
|
max-width: none;
|
package/src/title/Title.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import { LabelHTMLAttributes, LiHTMLAttributes
|
|
2
|
+
import React, { forwardRef, LabelHTMLAttributes, LiHTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { TitleTypes, Typography, Heading } from '../common';
|
|
5
5
|
|
|
@@ -25,16 +25,29 @@ type Props = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElement | HTMLLabe
|
|
|
25
25
|
type?: TitleTypes;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
28
|
+
const Title = React.forwardRef<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement, Props>(
|
|
29
|
+
({ as, type = DEFAULT_TYPE, className, ...props }, ref) => {
|
|
30
|
+
const mapping = titleTypeMapping[type as keyof typeof titleTypeMapping];
|
|
31
|
+
const isTypeSupported = mapping !== undefined;
|
|
32
|
+
if (isTypeSupported) {
|
|
33
|
+
const HeaderTag = as ?? mapping;
|
|
34
|
+
return (
|
|
35
|
+
<HeaderTag
|
|
36
|
+
ref={ref as React.Ref<any>}
|
|
37
|
+
{...props}
|
|
38
|
+
className={clsx(`np-text-${type}`, className)}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
43
|
+
return (
|
|
44
|
+
<HeaderTag
|
|
45
|
+
ref={ref as React.Ref<any>}
|
|
46
|
+
{...props}
|
|
47
|
+
className={clsx(`np-text-${DEFAULT_TYPE}`, className)}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
);
|
|
39
52
|
|
|
40
53
|
export default Title;
|