@transferwise/components 0.0.0-experimental-5acc778 → 0.0.0-experimental-0ffb1f6
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/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/checkboxOption/CheckboxOption.js.map +1 -1
- package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
- package/build/header/Header.js +44 -76
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +44 -73
- package/build/header/Header.mjs.map +1 -1
- package/build/i18n/cs.json +2 -0
- package/build/i18n/cs.json.js +2 -0
- package/build/i18n/cs.json.js.map +1 -1
- package/build/i18n/cs.json.mjs +2 -0
- package/build/i18n/cs.json.mjs.map +1 -1
- package/build/i18n/th.json +2 -0
- package/build/i18n/th.json.js +2 -0
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +2 -0
- package/build/i18n/th.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/legacylistItem/LegacyListItem.js.map +1 -1
- package/build/legacylistItem/LegacyListItem.mjs.map +1 -1
- package/build/main.css +14 -29
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/navigationOptionsList/NavigationOptionsList.js.map +1 -1
- package/build/navigationOptionsList/NavigationOptionsList.mjs.map +1 -1
- package/build/radioOption/RadioOption.js.map +1 -1
- package/build/radioOption/RadioOption.mjs.map +1 -1
- package/build/styles/header/Header.css +14 -29
- package/build/styles/main.css +14 -29
- package/build/summary/Summary.js +8 -0
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +8 -0
- package/build/summary/Summary.mjs.map +1 -1
- package/build/switchOption/SwitchOption.js +8 -0
- package/build/switchOption/SwitchOption.js.map +1 -1
- package/build/switchOption/SwitchOption.mjs +8 -0
- package/build/switchOption/SwitchOption.mjs.map +1 -1
- package/build/title/Title.js +4 -10
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +4 -6
- package/build/title/Title.mjs.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +8 -0
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/checkboxOption/CheckboxOption.d.ts +8 -0
- package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
- package/build/types/header/Header.d.ts +11 -27
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/header/index.d.ts +0 -1
- package/build/types/header/index.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/legacylistItem/LegacyListItem.d.ts +8 -0
- package/build/types/legacylistItem/LegacyListItem.d.ts.map +1 -1
- package/build/types/navigationOption/NavigationOption.d.ts +8 -0
- package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
- package/build/types/navigationOptionsList/NavigationOptionsList.d.ts +9 -0
- package/build/types/navigationOptionsList/NavigationOptionsList.d.ts.map +1 -1
- package/build/types/radioOption/RadioOption.d.ts +8 -0
- package/build/types/radioOption/RadioOption.d.ts.map +1 -1
- package/build/types/summary/Summary.d.ts +8 -0
- package/build/types/summary/Summary.d.ts.map +1 -1
- package/build/types/switchOption/SwitchOption.d.ts +8 -0
- package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
- package/build/types/title/Title.d.ts +5 -4
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/actionButton/ActionButton.story.tsx +1 -1
- package/src/actionOption/ActionOption.story.tsx +4 -0
- package/src/actionOption/ActionOption.tsx +8 -0
- package/src/avatar/Avatar.story.tsx +1 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
- package/src/badge/Badge.story.tsx +1 -1
- package/src/button/Button.story.tsx +1 -1
- package/src/button/LegacyButton.story.tsx +1 -1
- package/src/checkboxOption/CheckboxOption.story.tsx +4 -0
- package/src/checkboxOption/CheckboxOption.tsx +8 -0
- package/src/header/Header.css +14 -29
- package/src/header/Header.less +9 -24
- package/src/header/Header.spec.tsx +50 -68
- package/src/header/Header.story.tsx +36 -190
- package/src/header/Header.tsx +70 -110
- package/src/header/index.ts +0 -1
- package/src/i18n/cs.json +2 -0
- package/src/i18n/th.json +2 -0
- package/src/index.ts +0 -1
- package/src/legacylistItem/LegacyListItem.story.tsx +4 -0
- package/src/legacylistItem/LegacyListItem.tsx +8 -0
- package/src/listItem/_stories/ListItem.story.tsx +1 -1
- package/src/main.css +14 -29
- package/src/navigationOption/NavigationOption.story.tsx +4 -1
- package/src/navigationOption/NavigationOption.tsx +8 -0
- package/src/navigationOptionsList/NavigationOptionsList.story.tsx +4 -0
- package/src/navigationOptionsList/NavigationOptionsList.tsx +9 -0
- package/src/radioOption/RadioOption.story.tsx +4 -0
- package/src/radioOption/RadioOption.tsx +8 -0
- package/src/select/Select.story.tsx +1 -1
- package/src/summary/Summary.story.tsx +4 -0
- package/src/summary/Summary.tsx +8 -0
- package/src/switchOption/SwitchOption.story.tsx +4 -1
- package/src/switchOption/SwitchOption.tsx +8 -0
- package/src/title/Title.tsx +12 -25
- package/src/header/Header.accessibility.docs.mdx +0 -85
|
@@ -5,9 +5,13 @@ import { FastFlag as FastFlagIcon } from '@transferwise/icons';
|
|
|
5
5
|
import { Header, Nudge, Section, Title, Typography } from '..';
|
|
6
6
|
import RadioOption, { RadioOptionProps } from './RadioOption';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* > ⚠️ This component is **deprecated** and superseded by the [new ListItem component](?path=/docs/content-listitem--docs) with the [ListItem.Radio control](?path=/docs/content-listitem-listitem-radio--docs).
|
|
10
|
+
*/
|
|
8
11
|
export default {
|
|
9
12
|
component: RadioOption,
|
|
10
13
|
title: 'Option/RadioOption',
|
|
14
|
+
tags: ['deprecated'],
|
|
11
15
|
argTypes: {
|
|
12
16
|
disabled: { control: 'boolean' },
|
|
13
17
|
secondary: { control: 'text' },
|
|
@@ -15,6 +15,14 @@ export interface RadioOptionProps<T extends string | number = string>
|
|
|
15
15
|
isContainerAligned?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Please use `<ListItem />` instead.
|
|
20
|
+
* @deprecatedSince 46.104.0
|
|
21
|
+
* @see [Source](../listItem/ListItem.tsx)
|
|
22
|
+
* @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)
|
|
23
|
+
* @see [Design docs](https://wise.design/components/list-item)
|
|
24
|
+
* @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)
|
|
25
|
+
*/
|
|
18
26
|
function RadioOption<T extends string | number = ''>({
|
|
19
27
|
'aria-label': ariaLabel,
|
|
20
28
|
media,
|
|
@@ -9,7 +9,7 @@ import Select, { SelectItem, SelectOptionItem } from './Select';
|
|
|
9
9
|
const meta: Meta<typeof Select> = {
|
|
10
10
|
component: Select,
|
|
11
11
|
title: 'Forms/Select',
|
|
12
|
-
tags: ['
|
|
12
|
+
tags: ['deprecated'],
|
|
13
13
|
argTypes: {
|
|
14
14
|
id: { control: 'text' },
|
|
15
15
|
size: { control: 'radio', options: ['sm', 'md', 'lg'] },
|
|
@@ -5,9 +5,13 @@ import { Status } from '../common';
|
|
|
5
5
|
import { InfoPresentation } from '../info';
|
|
6
6
|
import Summary, { type Props as SummaryProps } from './Summary';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* > ⚠️ This component is **deprecated** and superseded by the [new ListItem component](?path=/docs/content-listitem--docs).
|
|
10
|
+
*/
|
|
8
11
|
export default {
|
|
9
12
|
component: Summary,
|
|
10
13
|
title: 'Content/Summary',
|
|
14
|
+
tags: ['deprecated'],
|
|
11
15
|
argTypes: {
|
|
12
16
|
title: { control: 'text' },
|
|
13
17
|
},
|
package/src/summary/Summary.tsx
CHANGED
|
@@ -90,6 +90,14 @@ export interface Props {
|
|
|
90
90
|
title: ReactNode;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Please use `<ListItem />` instead.
|
|
95
|
+
* @deprecatedSince 46.104.0
|
|
96
|
+
* @see [Source](../listItem/ListItem.tsx)
|
|
97
|
+
* @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)
|
|
98
|
+
* @see [Design docs](https://wise.design/components/list-item)
|
|
99
|
+
* @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)
|
|
100
|
+
*/
|
|
93
101
|
const Summary = ({
|
|
94
102
|
action,
|
|
95
103
|
as: Element = 'div',
|
|
@@ -6,10 +6,13 @@ import { Nudge, Title, Typography } from '..';
|
|
|
6
6
|
|
|
7
7
|
import SwitchOption, { type SwitchOptionProps } from './SwitchOption';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* > ⚠️ This component is **deprecated** and superseded by the [new ListItem component](?path=/docs/content-listitem--docs) with the [ListItem.Switch control](?path=/docs/content-listitem-listitem-switch--docs).
|
|
11
|
+
*/
|
|
9
12
|
const meta = {
|
|
10
13
|
component: SwitchOption,
|
|
11
14
|
title: 'Option/SwitchOption',
|
|
12
|
-
|
|
15
|
+
tags: ['deprecated'],
|
|
13
16
|
argTypes: {
|
|
14
17
|
title: { control: 'text' },
|
|
15
18
|
content: { control: 'text' },
|
|
@@ -26,6 +26,14 @@ const stopPropagation = (event?: MouseEvent<HTMLSpanElement>) => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Please use `<ListItem />` instead.
|
|
31
|
+
* @deprecatedSince 46.104.0
|
|
32
|
+
* @see [Source](../listItem/ListItem.tsx)
|
|
33
|
+
* @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)
|
|
34
|
+
* @see [Design docs](https://wise.design/components/list-item)
|
|
35
|
+
* @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)
|
|
36
|
+
*/
|
|
29
37
|
const SwitchOption = ({
|
|
30
38
|
checked,
|
|
31
39
|
complex,
|
package/src/title/Title.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import
|
|
2
|
+
import { LabelHTMLAttributes, LiHTMLAttributes, ReactHTML } from 'react';
|
|
3
3
|
|
|
4
4
|
import { TitleTypes, Typography, Heading } from '../common';
|
|
5
5
|
|
|
@@ -25,29 +25,16 @@ 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
|
-
|
|
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
|
-
);
|
|
28
|
+
function Title({ as, type = DEFAULT_TYPE, className, ...props }: Props) {
|
|
29
|
+
const mapping = titleTypeMapping[type];
|
|
30
|
+
const isTypeSupported = mapping !== undefined;
|
|
31
|
+
|
|
32
|
+
if (isTypeSupported) {
|
|
33
|
+
const HeaderTag = as ?? mapping;
|
|
34
|
+
return <HeaderTag {...props} className={clsx(`np-text-${type}`, className)} />;
|
|
35
|
+
}
|
|
36
|
+
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
37
|
+
return <HeaderTag {...props} className={clsx(`np-text-${DEFAULT_TYPE}`, className)} />;
|
|
38
|
+
}
|
|
52
39
|
|
|
53
40
|
export default Title;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
import { NavigationOption } from '..';
|
|
3
|
-
import { Bulb } from '@transferwise/icons';
|
|
4
|
-
import * as stories from './Header.story';
|
|
5
|
-
|
|
6
|
-
<Meta title="Typography/Header/Accessibility" />
|
|
7
|
-
|
|
8
|
-
# Accessibility
|
|
9
|
-
|
|
10
|
-
Given the `Header` is a key component for structuring content and conveying hierarchy, ensuring its accessibility is crucial for an inclusive experience.
|
|
11
|
-
|
|
12
|
-
<NavigationOption
|
|
13
|
-
media={<Bulb size={24} />}
|
|
14
|
-
title="Design guidance"
|
|
15
|
-
content="Before you start, familiarise yourself with the dedicated accessibility documentation."
|
|
16
|
-
href="https://wise.design/components/section-header#accessibility"
|
|
17
|
-
/>
|
|
18
|
-
|
|
19
|
-
<br />
|
|
20
|
-
<br />
|
|
21
|
-
|
|
22
|
-
## Semantic headings
|
|
23
|
-
|
|
24
|
-
The `Header` component should always use semantic HTML heading tags (`<h1>` to `<h6>`) to convey the document structure. Avoid using non-semantic tags unless absolutely necessary.
|
|
25
|
-
|
|
26
|
-
<Source dark code={`
|
|
27
|
-
// ✅ semantic heading
|
|
28
|
-
<Header as="h1">Main heading</Header>
|
|
29
|
-
|
|
30
|
-
// ⚠️ use with care
|
|
31
|
-
|
|
32
|
-
<Header as="div">Non-semantic heading</Header>
|
|
33
|
-
`}/>
|
|
34
|
-
|
|
35
|
-
**Additional resources:**
|
|
36
|
-
|
|
37
|
-
1. [Deque: Headings must follow a logical order](https://dequeuniversity.com/rules/axe/4.2/heading-order)
|
|
38
|
-
2. [MDN: Using headings](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements)
|
|
39
|
-
|
|
40
|
-
<br />
|
|
41
|
-
|
|
42
|
-
## ARIA roles
|
|
43
|
-
|
|
44
|
-
If the `Header` is used in a non-semantic context, ensure it is accessible by applying appropriate ARIA roles, such as `role="heading"`, and providing a `aria-level` attribute to indicate its level in the hierarchy.
|
|
45
|
-
|
|
46
|
-
<Source
|
|
47
|
-
dark
|
|
48
|
-
code={`
|
|
49
|
-
// ⚠️ use with care
|
|
50
|
-
<Header as="div" role="heading" aria-level="1">
|
|
51
|
-
Main heading
|
|
52
|
-
</Header>
|
|
53
|
-
`}
|
|
54
|
-
/>
|
|
55
|
-
|
|
56
|
-
<br />
|
|
57
|
-
|
|
58
|
-
## Accessibility with actions
|
|
59
|
-
|
|
60
|
-
When using the `Header` with actions (e.g., buttons or links), ensure the actions are accessible by providing clear labels and ARIA attributes.
|
|
61
|
-
|
|
62
|
-
<Source
|
|
63
|
-
dark
|
|
64
|
-
code={`
|
|
65
|
-
// ✅ accessible action
|
|
66
|
-
<Header
|
|
67
|
-
as="h2"
|
|
68
|
-
action={{
|
|
69
|
-
'aria-label': 'Edit section',
|
|
70
|
-
text: 'Edit',
|
|
71
|
-
onClick: () => alert('Edit clicked'),
|
|
72
|
-
}}
|
|
73
|
-
>
|
|
74
|
-
Section heading
|
|
75
|
-
</Header>
|
|
76
|
-
`}
|
|
77
|
-
/>
|
|
78
|
-
|
|
79
|
-
<br />
|
|
80
|
-
|
|
81
|
-
## Visual hierarchy
|
|
82
|
-
|
|
83
|
-
Ensure the `Header` visually aligns with its semantic level. For example, an `<h1>` should be the largest and most prominent, while an `<h6>` should be the smallest.
|
|
84
|
-
|
|
85
|
-
<Canvas of={stories.Playground} />
|