@transferwise/components 46.101.0 → 46.103.0
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/common/initials.js +4 -1
- package/build/common/initials.js.map +1 -1
- package/build/common/initials.mjs +4 -1
- package/build/common/initials.mjs.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js +2 -3
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +1 -2
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/i18n/de.json +2 -0
- package/build/i18n/de.json.js +2 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +2 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/fr.json +2 -0
- package/build/i18n/fr.json.js +2 -0
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +2 -0
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +2 -0
- package/build/i18n/hu.json.js +2 -0
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +2 -0
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/it.json +2 -0
- package/build/i18n/it.json.js +2 -0
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +2 -0
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +2 -0
- package/build/i18n/ja.json.js +2 -0
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +2 -0
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/pl.json +2 -0
- package/build/i18n/pl.json.js +2 -0
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +2 -0
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +2 -0
- package/build/i18n/pt.json.js +2 -0
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +2 -0
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +2 -0
- package/build/i18n/ro.json.js +2 -0
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +2 -0
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +2 -0
- package/build/i18n/ru.json.js +2 -0
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +2 -0
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/tr.json +2 -0
- package/build/i18n/tr.json.js +2 -0
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +2 -0
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/i18n/zh-CN.json +2 -0
- package/build/i18n/zh-CN.json.js +2 -0
- package/build/i18n/zh-CN.json.js.map +1 -1
- package/build/i18n/zh-CN.json.mjs +2 -0
- package/build/i18n/zh-CN.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +2 -0
- package/build/i18n/zh-HK.json.js +2 -0
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +2 -0
- package/build/i18n/zh-HK.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 -2
- package/build/index.mjs +1 -1
- package/build/list/List.js +21 -0
- package/build/list/List.js.map +1 -0
- package/build/list/List.mjs +17 -0
- package/build/list/List.mjs.map +1 -0
- package/build/main.css +4 -2
- package/build/styles/avatarView/AvatarView.css +3 -1
- package/build/styles/button/Button.css +1 -1
- package/build/styles/main.css +4 -2
- package/build/switch/Switch.js +3 -1
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs +3 -1
- package/build/switch/Switch.mjs.map +1 -1
- package/build/test-utils/assets/placeholder-landscape.svg +1 -0
- package/build/test-utils/assets/placeholder-portrait.svg +1 -0
- 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/common/initials.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 +4 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/legacylistItem/index.d.ts +0 -2
- package/build/types/legacylistItem/index.d.ts.map +1 -1
- package/build/types/list/List.d.ts +11 -0
- package/build/types/list/List.d.ts.map +1 -0
- package/build/types/list/index.d.ts +3 -0
- package/build/types/list/index.d.ts.map +1 -0
- package/build/types/switch/Switch.d.ts +3 -1
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/avatarView/AvatarView.css +3 -1
- package/src/avatarView/AvatarView.less +2 -1
- package/src/button/Button.css +1 -1
- package/src/button/Button.less +1 -1
- package/src/button/Button.spec.tsx +18 -0
- package/src/button/Button.story.tsx +9 -4
- 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 +27 -8
- package/src/common/RadioButton/RadioButton.tsx +6 -1
- package/src/common/initials.spec.tsx +13 -0
- package/src/common/initials.ts +5 -0
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
- package/src/i18n/de.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/hu.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +2 -0
- package/src/i18n/pl.json +2 -0
- package/src/i18n/pt.json +2 -0
- package/src/i18n/ro.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/i18n/zh-CN.json +2 -0
- package/src/i18n/zh-HK.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 +4 -2
- package/src/legacylistItem/LegacyListItem.story.tsx +2 -2
- package/src/legacylistItem/LegacyListItem.tests.story.tsx +2 -1
- package/src/legacylistItem/index.ts +0 -2
- package/src/list/List.spec.tsx +52 -0
- package/src/list/List.story.tsx +20 -0
- package/src/list/List.tsx +15 -0
- package/src/list/index.ts +2 -0
- package/src/main.css +4 -2
- package/src/switch/Switch.tsx +6 -2
- package/src/test-utils/assets/placeholder-landscape.svg +1 -0
- package/src/test-utils/assets/placeholder-portrait.svg +1 -0
- package/build/legacylistItem/List.js +0 -17
- package/build/legacylistItem/List.js.map +0 -1
- package/build/legacylistItem/List.mjs +0 -15
- package/build/legacylistItem/List.mjs.map +0 -1
- package/build/types/legacylistItem/List.d.ts +0 -6
- package/build/types/legacylistItem/List.d.ts.map +0 -1
- package/src/legacylistItem/List.tsx +0 -10
- package/src/test-utils/Parameters.d.ts +0 -77
|
@@ -202,6 +202,24 @@ describe('Button', () => {
|
|
|
202
202
|
expect(button).not.toHaveAttribute('href');
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
+
|
|
206
|
+
describe('content id', () => {
|
|
207
|
+
it('should not set id for content by default', () => {
|
|
208
|
+
const { container } = render(<Button v2>clickMe</Button>);
|
|
209
|
+
|
|
210
|
+
expect(container.querySelector('[id$="_content"]')).not.toBeInTheDocument();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('should set id for content by default if `id` is passed as a button prop', () => {
|
|
214
|
+
const { container } = render(
|
|
215
|
+
<Button v2 id="myId">
|
|
216
|
+
clickMe
|
|
217
|
+
</Button>,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
expect(container.querySelector('#myId_content')).toBeInTheDocument();
|
|
221
|
+
});
|
|
222
|
+
});
|
|
205
223
|
});
|
|
206
224
|
});
|
|
207
225
|
});
|
|
@@ -4,7 +4,7 @@ import { Freeze, ArrowRight, ChevronRight } from '@transferwise/icons';
|
|
|
4
4
|
import { Flag } from '@wise/art';
|
|
5
5
|
import Button from './Button.resolver';
|
|
6
6
|
import type { ButtonProps, ButtonPriority } from './Button.types';
|
|
7
|
-
import { storyConfig } from '../test-utils';
|
|
7
|
+
import { lorem20, storyConfig } from '../test-utils';
|
|
8
8
|
|
|
9
9
|
const withContainer = (Story: any) => (
|
|
10
10
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
@@ -503,9 +503,14 @@ export const DisplayBlock: StoryObj<PreviewStoryArgs> = {
|
|
|
503
503
|
const [props, previewProps] = getPropsForPreview(args);
|
|
504
504
|
|
|
505
505
|
return (
|
|
506
|
-
<
|
|
507
|
-
|
|
508
|
-
|
|
506
|
+
<div className="d-flex flex-column gap-y-1">
|
|
507
|
+
<Button {...props} {...previewProps}>
|
|
508
|
+
Full-width button
|
|
509
|
+
</Button>
|
|
510
|
+
<Button {...props} {...previewProps}>
|
|
511
|
+
{lorem20}
|
|
512
|
+
</Button>
|
|
513
|
+
</div>
|
|
509
514
|
);
|
|
510
515
|
},
|
|
511
516
|
argTypes: {
|
package/src/button/Button.tsx
CHANGED
|
@@ -62,7 +62,11 @@ const Button = forwardRef<ButtonReferenceType, NewButtonProps>(
|
|
|
62
62
|
data-testid="button-loader-indicator"
|
|
63
63
|
/>
|
|
64
64
|
)}
|
|
65
|
-
<span
|
|
65
|
+
<span
|
|
66
|
+
className="wds-Button-label"
|
|
67
|
+
id={props.id ? `${props.id}_content` : undefined}
|
|
68
|
+
aria-hidden={loading}
|
|
69
|
+
>
|
|
66
70
|
{size === 'lg' ? (
|
|
67
71
|
<span className="wds-Button-labelText">{children}</span>
|
|
68
72
|
) : (
|
|
@@ -5,7 +5,7 @@ export type ButtonSentiment = 'default' | 'negative';
|
|
|
5
5
|
export type ButtonPriority = 'primary' | 'secondary' | 'secondary-neutral' | 'tertiary';
|
|
6
6
|
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
7
7
|
export type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;
|
|
8
|
-
type ButtonAddonIcon = {
|
|
8
|
+
export type ButtonAddonIcon = {
|
|
9
9
|
type: 'icon';
|
|
10
10
|
value: ReactNode;
|
|
11
11
|
};
|
package/src/button/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default } from './Button.resolver';
|
|
2
|
-
export type { ButtonProps as NewButtonProps } from './Button.types';
|
|
2
|
+
export type { ButtonProps as NewButtonProps, ButtonAddonIcon } from './Button.types';
|
|
3
3
|
|
|
4
4
|
// export legacy button props for backwards compatibility with legacy Button interface
|
|
5
5
|
// delete this when migration to new Button is done (or aleast no more deep imports, use following query)
|
|
@@ -29,21 +29,40 @@ export const Basic: Story = {
|
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* The `indeterminate` state is predominantly visual and should match the [native HTML checkbox
|
|
34
|
+
* implementation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/indeterminate).
|
|
35
|
+
* It is used to indicate a mixed state, where some but not all items are selected, but does not
|
|
36
|
+
* change the `checked` state of the input itself – it remains either checked or unchecked.
|
|
37
|
+
*
|
|
38
|
+
* In the example below the 1st checkbox is unchecked and the 2nd checkbox is checked.
|
|
39
|
+
*/
|
|
32
40
|
export const Indeterminate: Story = {
|
|
33
41
|
args: {
|
|
34
|
-
'aria-label': 'Group checkbox with indeterminate state',
|
|
35
42
|
indeterminate: true,
|
|
36
43
|
},
|
|
37
44
|
render: (args) => {
|
|
38
|
-
const [
|
|
45
|
+
const [checked1, setChecked1] = useState<boolean | undefined>(false);
|
|
46
|
+
const [checked2, setChecked2] = useState<boolean | undefined>(true);
|
|
39
47
|
|
|
40
48
|
return (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
<>
|
|
50
|
+
<CheckboxButton
|
|
51
|
+
{...args}
|
|
52
|
+
checked={checked1}
|
|
53
|
+
indeterminate={args.indeterminate}
|
|
54
|
+
aria-label="Initially disabled checkbox with indeterminate state"
|
|
55
|
+
onChange={() => setChecked1((current) => !current)}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<CheckboxButton
|
|
59
|
+
{...args}
|
|
60
|
+
checked={checked2}
|
|
61
|
+
indeterminate={args.indeterminate}
|
|
62
|
+
aria-label="Initially enabled checkbox with indeterminate state"
|
|
63
|
+
onChange={() => setChecked2((current) => !current)}
|
|
64
|
+
/>
|
|
65
|
+
</>
|
|
47
66
|
);
|
|
48
67
|
},
|
|
49
68
|
};
|
|
@@ -8,6 +8,8 @@ export interface RadioButtonProps<T extends string | number = string> {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
value?: T;
|
|
10
10
|
readOnly?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
'aria-describedby'?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export default function RadioButton<T extends string | number = ''>({
|
|
@@ -18,17 +20,20 @@ export default function RadioButton<T extends string | number = ''>({
|
|
|
18
20
|
onChange,
|
|
19
21
|
disabled,
|
|
20
22
|
readOnly,
|
|
23
|
+
className,
|
|
24
|
+
'aria-describedby': ariaDescribedBy,
|
|
21
25
|
}: RadioButtonProps<T>) {
|
|
22
26
|
return (
|
|
23
27
|
<>
|
|
24
28
|
<input
|
|
25
29
|
type="radio"
|
|
26
|
-
className=
|
|
30
|
+
className={clsx('sr-only', className)}
|
|
27
31
|
id={id}
|
|
28
32
|
value={value}
|
|
29
33
|
name={name}
|
|
30
34
|
checked={checked}
|
|
31
35
|
disabled={disabled || readOnly}
|
|
36
|
+
aria-describedby={ariaDescribedBy}
|
|
32
37
|
onChange={() => {
|
|
33
38
|
if (!checked) {
|
|
34
39
|
onChange?.(value);
|
|
@@ -39,4 +39,17 @@ describe('getInitials', () => {
|
|
|
39
39
|
it('handles single character', () => {
|
|
40
40
|
expect(getInitials('Q')).toBe('Q');
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
it('handles names with (parenthesized) values', () => {
|
|
44
|
+
expect(getInitials('Squirrel (GBP)')).toBe('S');
|
|
45
|
+
expect(getInitials('Fantastic Squirrel (USD)')).toBe('FS');
|
|
46
|
+
expect(getInitials('Squirrel [GBP]')).toBe('S');
|
|
47
|
+
expect(getInitials('Fantastic Squirrel [USD]')).toBe('FS');
|
|
48
|
+
expect(getInitials('Squirrel {GBP}')).toBe('S');
|
|
49
|
+
expect(getInitials('Fantastic Squirrel {USD}')).toBe('FS');
|
|
50
|
+
expect(getInitials('Squirrel <GBP>')).toBe('S');
|
|
51
|
+
expect(getInitials('Fantastic Squirrel <USD>')).toBe('FS');
|
|
52
|
+
expect(getInitials('(Super) Fantastic Squirrel')).toBe('FS');
|
|
53
|
+
expect(getInitials('Super (Fantastic) Squirrel')).toBe('SS');
|
|
54
|
+
});
|
|
42
55
|
});
|
package/src/common/initials.ts
CHANGED
|
@@ -5,6 +5,7 @@ export function getInitials(name: string) {
|
|
|
5
5
|
|
|
6
6
|
const allInitials = name
|
|
7
7
|
.split(' ')
|
|
8
|
+
.filter((part) => !startsWithParenthesis(part))
|
|
8
9
|
.map((part) => part[0])
|
|
9
10
|
.join('')
|
|
10
11
|
.toUpperCase();
|
|
@@ -14,4 +15,8 @@ export function getInitials(name: string) {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
return allInitials[0] + allInitials.slice(-1);
|
|
18
|
+
|
|
19
|
+
function startsWithParenthesis(part: string) {
|
|
20
|
+
return /^[({[<]/.test(part);
|
|
21
|
+
}
|
|
17
22
|
}
|
|
@@ -6,7 +6,7 @@ import BottomSheet from '../../common/bottomSheet';
|
|
|
6
6
|
import Option from '../../common/Option';
|
|
7
7
|
import { Check, ChevronDown } from '@transferwise/icons';
|
|
8
8
|
import { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';
|
|
9
|
-
import
|
|
9
|
+
import List from '../../list';
|
|
10
10
|
|
|
11
11
|
export interface AnimatedLabelProps {
|
|
12
12
|
activeLabel: number;
|
package/src/i18n/de.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Hochladen fehlgeschlagen. Bitte versuche es erneut",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Fertig hochgeladen!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Bitte wähle eine Datei aus, die kleiner als {maxSize} MB ist",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Bitte stelle eine kleinere Datei zur Verfügung",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Dateityp wird nicht unterstützt. Bitte versuche es erneut mit einer anderen Datei",
|
|
49
50
|
"neptune.Upload.psButtonText": "Abbrechen",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Wird hochgeladen...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Oder wähle eine Datei aus",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Datei zum Hochladen in dieses Feld ziehen",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Zieh eine Datei in dieses Feld, die kleiner als {maxSize} MB ist",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Ziehe eine Datei hierher",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Alle Dateiformate",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Datei zum Hochladen in dieses Feld ziehen",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, kleiner als {size} MB",
|
package/src/i18n/fr.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Échec du téléchargement. Veuillez réessayer",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Téléchargement terminé !",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Veuillez fournir un fichier de moins de {maxSize} Mo",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Veuillez fournir un fichier plus petit",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Format non pris en charge. Veuillez réessayer avec un fichier différent",
|
|
49
50
|
"neptune.Upload.psButtonText": "Annuler",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Téléchargement...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Ou sélectionnez un fichier",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Déposer un fichier pour démarrer le téléchargement",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Glissez-déposez un fichier de moins de {maxSize} Mo",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Glissez et déposez un fichier",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Tous types de fichiers",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Déposer un fichier pour démarrer le téléchargement",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, inférieur à {size} Mo",
|
package/src/i18n/hu.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Feltöltés sikertelen. Kérünk, próbáld újra",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Feltöltés sikeres",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Kérünk, olyan fájlt küldj el, amely kisebb mint {maxSize}MB",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Kérünk, egy kisebb fájlt küldj",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Nem támogatott fájltípus. Kérünk, próbáld újra másik fájllal",
|
|
49
50
|
"neptune.Upload.psButtonText": "Mégsem",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Feltöltés...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Húzd át a fájlt",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Összes fájltípus",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",
|
package/src/i18n/it.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Caricamento fallito. Per favore riprova",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Caricamento completato!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Carica un file inferiore a {maxSize}MB",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Fornisci un file più piccolo",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Formato del documento non supportato. Riprova con un formato diverso",
|
|
49
50
|
"neptune.Upload.psButtonText": "Annulla",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Caricamento...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "O seleziona un documento",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Rilascia il documento per iniziare il caricamento",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Trascina e rilascia un file inferiore a {maxSize}MB",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Trascina e rilascia un file",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Tutti i tipi di file",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Rilascia file per iniziare a caricare",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, minore di {size}MB",
|
package/src/i18n/ja.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "アップロードに失敗しました。もう一度やり直してください。",
|
|
46
46
|
"neptune.Upload.csSuccessText": "アップロードが完了しました。",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "{maxSize}MB以下のファイルをアップロードしてください",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "より小さいファイルをアップロードしてください",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "ファイルの種類はサポートされていません。別のファイルで再度お試しください",
|
|
49
50
|
"neptune.Upload.psButtonText": "キャンセルする",
|
|
50
51
|
"neptune.Upload.psProcessingText": "アップロードしています…",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "またはファイルを選択する",
|
|
53
54
|
"neptune.Upload.usDropMessage": "ファイルをドロップしてアップロードする",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "{maxSize}MB以下のファイルをドラッグ&ドロップしてください",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "ファイルをドラッグ&ドロップ",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "すべてのファイル種類",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "ファイルをドロップしてアップロードする",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}、{size}MB以下",
|
package/src/i18n/pl.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Przesyłanie nie powiodło się. Proszę spróbować ponownie",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Przesyłanie zakończone!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Prosimy przesłać plik mniejszy niż {maxSize} MB",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Prosimy przesłać mniejszy plik",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Nieobsługiwany typ pliku. Spróbuj ponownie z innym plikiem",
|
|
49
50
|
"neptune.Upload.psButtonText": "Anuluj",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Przesyłanie...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Lub wybierz plik",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Upuść plik, aby rozpocząć przesyłanie",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Przeciągnij i upuść plik nie większy niż {maxSize} MB",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Przeciągnij i upuść plik",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Wszystkie typy plików",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Upuść plik, żeby rozpocząć przesyłanie",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, mniejsze niż {size}MB",
|
package/src/i18n/pt.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Falha no envio. Por favor, tente novamente",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Envio concluído!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Por favor, envie um arquivo com menos de {maxSize}MB",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Forneça um arquivo menor",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Não trabalhamos com este tipo de arquivo. Por favor, tente novamente com um arquivo diferente",
|
|
49
50
|
"neptune.Upload.psButtonText": "Cancelar",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Enviando...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Ou escolha um arquivo",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Arraste o arquivo para iniciar o envio",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Selecione e envie um arquivo com menos de {maxSize}MB",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Arraste e solte um arquivo",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Todos os tipos de arquivos",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Arraste o arquivo para iniciar o envio",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, com menos de {size}MB",
|
package/src/i18n/ro.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Încărcare eșuată. Te rugăm să încerci din nou",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Încărcare completă!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Te rugăm să furnizezi un fișier mai mic de {maxSize} MB",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Te rugăm să furnizezi un fișier mai mic",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Tipul de fișier nu a fost acceptat. Te rugăm să încerci din nou cu un alt fișier",
|
|
49
50
|
"neptune.Upload.psButtonText": "Anulează",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Se încarcă...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Sau selectează un fișier",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Atașează fișierul pentru a începe încărcarea",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Glisează și atașează un fișier mai mic de {maxSize} MB",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Glisează și lipește un fișier",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Toate tipurile de fișiere",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Trage fișierul pentru a începe încărcarea",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, de maximum {size}MB",
|
package/src/i18n/ru.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Загрузка не удалась. Пожалуйста, попробуйте снова",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Загрузка завершена!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Пожалуйста, загрузите файл размером менее {maxSize} Мб",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Пожалуйста, загрузите файл меньшего размера",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Тип файла не поддерживается. Пожалуйста, попробуйте еще раз с другим файлом",
|
|
49
50
|
"neptune.Upload.psButtonText": "Отменить",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Загружаем...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Или выберите файл",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Перетащите файл, чтобы начать загрузку",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "Перетащите файл размером не более {maxSize} Mб",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Перетащите файл",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Все типы файлов",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Перетащите файл, чтобы начать загрузку",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, не превышающий {size} MB",
|
package/src/i18n/tr.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "Yükleme başarısız. Lütfen yine deneyin",
|
|
46
46
|
"neptune.Upload.csSuccessText": "Yükleme tamamlandı!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "Lütfen {maxSize} MB'den küçük bir dosya sağlayın",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "Lütfen daha küçük bir dosya gönderin",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "Desteklenmeyen dosya biçimi. Lütfen başka bir dosyayla tekrar deneyin",
|
|
49
50
|
"neptune.Upload.psButtonText": "İptal edin",
|
|
50
51
|
"neptune.Upload.psProcessingText": "Yükleniyor...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "Veya bir dosya seçin",
|
|
53
54
|
"neptune.Upload.usDropMessage": "Yüklemeyi başlatmak için dosyayı bırakın",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "{maxSize} MB'den küçük bir dosya sürükleyin ve bırakın",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "Dosyayı sürükleyip bırakın",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "Tüm belge tipleri",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "Yüklemeyi başlatmak için dosyayı bırakın",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes}, en fazla {size}MB",
|
package/src/i18n/zh-CN.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "上传失败。请重试",
|
|
46
46
|
"neptune.Upload.csSuccessText": "上传完毕!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "请提供一个小于 {maxSize} MB 的文件",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "请提供更小的文件。",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "不支持该文件类型,请试试其他文件",
|
|
49
50
|
"neptune.Upload.psButtonText": "取消",
|
|
50
51
|
"neptune.Upload.psProcessingText": "正在上传…",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "或选择文件",
|
|
53
54
|
"neptune.Upload.usDropMessage": "拖放文件开始上传",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "拖放一个不超过 {maxSize} MB 的文件",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "拖放文件",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "所有文件类型",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "拖放文件开始上传",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes},小于 {size} MB",
|
package/src/i18n/zh-HK.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"neptune.Upload.csFailureText": "上載失敗,請重試。",
|
|
46
46
|
"neptune.Upload.csSuccessText": "上載完成!",
|
|
47
47
|
"neptune.Upload.csTooLargeMessage": "請提供一個小於{maxSize}MB的檔案",
|
|
48
|
+
"neptune.Upload.csTooLargeNoLimitMessage": "請提供較小的檔案",
|
|
48
49
|
"neptune.Upload.csWrongTypeMessage": "不支持檔案類型,請使用其他檔案重試",
|
|
49
50
|
"neptune.Upload.psButtonText": "取消",
|
|
50
51
|
"neptune.Upload.psProcessingText": "上載中...",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"neptune.Upload.usButtonText": "或者選擇一個檔案",
|
|
53
54
|
"neptune.Upload.usDropMessage": "拖放檔案以開始上載",
|
|
54
55
|
"neptune.Upload.usPlaceholder": "拖放一個不超過{maxSize}MB的檔案",
|
|
56
|
+
"neptune.Upload.usPlaceholderNoLimit": "拖放檔案",
|
|
55
57
|
"neptune.UploadButton.allFileTypes": "所有檔案類型",
|
|
56
58
|
"neptune.UploadButton.dropFiles": "拖放檔案以開始上載",
|
|
57
59
|
"neptune.UploadButton.instructions": "{fileTypes},小於{size}MB",
|
|
@@ -91,7 +91,7 @@ export const Basic: Story = {
|
|
|
91
91
|
gridTemplate: `auto auto / repeat(6, min-content)`,
|
|
92
92
|
}}
|
|
93
93
|
>
|
|
94
|
-
{['Primary', 'Secondary', 'Tertiary', '
|
|
94
|
+
{['Primary', 'Secondary', 'Tertiary', 'Minimal', 'Neg primary', 'Neg secondary'].map(
|
|
95
95
|
(variant) => (
|
|
96
96
|
<Body type="body-default-bold">{variant}</Body>
|
|
97
97
|
),
|
|
@@ -12,7 +12,7 @@ export type Props = {
|
|
|
12
12
|
Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'disabled'> &
|
|
13
13
|
Pick<
|
|
14
14
|
HTMLAttributes<HTMLDivElement>,
|
|
15
|
-
'className' | 'role' | 'children' | 'aria-label' | 'tabIndex'
|
|
15
|
+
'id' | 'className' | 'role' | 'children' | 'aria-label' | 'tabIndex'
|
|
16
16
|
>;
|
|
17
17
|
|
|
18
18
|
const IconButton = forwardRef(function IconButton(
|
package/src/image/Image.tsx
CHANGED
|
@@ -10,6 +10,9 @@ export interface ImageProps {
|
|
|
10
10
|
onLoad?: () => void;
|
|
11
11
|
onError?: () => void;
|
|
12
12
|
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specifies the [loading behavior of the image](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#loading).
|
|
15
|
+
*/
|
|
13
16
|
loading?: 'lazy' | 'eager';
|
|
14
17
|
stretch?: boolean;
|
|
15
18
|
role?: string;
|
package/src/image/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -50,7 +50,7 @@ export type {
|
|
|
50
50
|
export type { TextAreaProps } from './inputs/TextArea';
|
|
51
51
|
export type { InstructionsListProps } from './instructionsList';
|
|
52
52
|
export type { LabelProps, LabelOptionalProps, LabelDescriptionProps } from './label/Label';
|
|
53
|
-
export type {
|
|
53
|
+
export type { LegacyListItemProps } from './legacylistItem';
|
|
54
54
|
export type { LoaderProps } from './loader';
|
|
55
55
|
export type { MarkdownProps } from './markdown';
|
|
56
56
|
export type { ModalProps } from './modal';
|
|
@@ -108,6 +108,7 @@ export type {
|
|
|
108
108
|
TableCellStatus,
|
|
109
109
|
TableCellType,
|
|
110
110
|
} from './table';
|
|
111
|
+
export type { ListProps } from './list';
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
114
|
* Components
|
|
@@ -165,7 +166,7 @@ export { TextArea } from './inputs/TextArea';
|
|
|
165
166
|
export { default as InstructionsList } from './instructionsList';
|
|
166
167
|
export { Label } from './label/Label';
|
|
167
168
|
export { default as Link } from './link';
|
|
168
|
-
export {
|
|
169
|
+
export { default as LegacyListItem } from './legacylistItem';
|
|
169
170
|
export { default as Loader } from './loader';
|
|
170
171
|
export { default as Logo } from './logo';
|
|
171
172
|
export { default as Markdown } from './markdown';
|
|
@@ -209,6 +210,7 @@ export { default as Typeahead } from './typeahead';
|
|
|
209
210
|
export { default as Upload } from './upload';
|
|
210
211
|
export { default as UploadInput } from './uploadInput';
|
|
211
212
|
export { default as Table } from './table';
|
|
213
|
+
export { default as List } from './list';
|
|
212
214
|
|
|
213
215
|
/**
|
|
214
216
|
* Hooks
|
|
@@ -2,11 +2,11 @@ import { action } from 'storybook/actions';
|
|
|
2
2
|
import { Documents, FastFlag } from '@transferwise/icons';
|
|
3
3
|
import { ComponentProps } from 'react';
|
|
4
4
|
|
|
5
|
-
import { Button, IconButton } from '..';
|
|
5
|
+
import { Button, IconButton, List } from '..';
|
|
6
6
|
import AvatarView from '../avatarView';
|
|
7
7
|
import Info from '../info';
|
|
8
8
|
import Title from '../title/Title';
|
|
9
|
-
import LegacyListItem
|
|
9
|
+
import LegacyListItem from '.';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
component: LegacyListItem,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FastFlag } from '@transferwise/icons';
|
|
2
2
|
import Button from '../button';
|
|
3
3
|
import AvatarView from '../avatarView';
|
|
4
|
-
import LegacyListItem, {
|
|
4
|
+
import LegacyListItem, { type LegacyListItemProps } from '.';
|
|
5
|
+
import List from '../list';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
component: LegacyListItem,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { render, screen } from '../test-utils';
|
|
2
|
+
import List from './List';
|
|
3
|
+
|
|
4
|
+
describe('List', () => {
|
|
5
|
+
it('should render content', () => {
|
|
6
|
+
render(
|
|
7
|
+
<List>
|
|
8
|
+
<li>Item 1</li>
|
|
9
|
+
<li>Item 2</li>
|
|
10
|
+
</List>,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(screen.getByText('Item 1')).toBeInTheDocument();
|
|
14
|
+
expect(screen.getByText('Item 2')).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('`as` prop', () => {
|
|
18
|
+
it('renders `ul` by default', () => {
|
|
19
|
+
render(<List>Content</List>);
|
|
20
|
+
expect(screen.getByRole('list')).toBeInstanceOf(HTMLUListElement);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders as `ol`', () => {
|
|
24
|
+
render(<List as="ol">Content</List>);
|
|
25
|
+
expect(screen.getByRole('list')).toBeInstanceOf(HTMLOListElement);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('renders as `ul`', () => {
|
|
29
|
+
render(<List as="ul">Content</List>);
|
|
30
|
+
expect(screen.getByRole('list')).toBeInstanceOf(HTMLUListElement);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('renders as `div`', () => {
|
|
34
|
+
render(
|
|
35
|
+
<List as="div" data-testid="list">
|
|
36
|
+
Content
|
|
37
|
+
</List>,
|
|
38
|
+
);
|
|
39
|
+
expect(screen.getByTestId('list')).toBeInstanceOf(HTMLDivElement);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('accepts custom classname', () => {
|
|
44
|
+
render(<List className="custom-class">Content</List>);
|
|
45
|
+
expect(screen.getByRole('list')).toHaveClass('custom-class');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('accepts CSS style', () => {
|
|
49
|
+
render(<List style={{ color: 'red' }}>Content</List>);
|
|
50
|
+
expect(screen.getByRole('list')).toHaveStyle({ color: 'red' });
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import LegacyListItem from '../legacylistItem';
|
|
3
|
+
import List from './List';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: List,
|
|
7
|
+
title: 'Content/List',
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
} satisfies Meta<typeof List>;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof List>;
|
|
12
|
+
|
|
13
|
+
export const Basic: Story = {
|
|
14
|
+
render: (args) => (
|
|
15
|
+
<List {...args}>
|
|
16
|
+
<LegacyListItem title="First item" value="This is the first item." />
|
|
17
|
+
<LegacyListItem title="Second item" value="This is the second item." />
|
|
18
|
+
</List>
|
|
19
|
+
),
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
export interface ListProps {
|
|
5
|
+
as?: 'ul' | 'ol' | 'div';
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
id?: string;
|
|
10
|
+
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function List({ as: Element = 'ul', className, ...props }: ListProps) {
|
|
14
|
+
return <Element className={clsx('wds-list', 'list-unstyled', className)} {...props} />;
|
|
15
|
+
}
|