@transferwise/components 46.104.0 → 46.105.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/header/Header.js +60 -43
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +57 -43
- 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/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/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/listItem/ListItem.js +4 -2
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +4 -2
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/main.css +24 -14
- package/build/styles/header/Header.css +21 -14
- package/build/styles/listItem/ListItem.css +3 -0
- package/build/styles/main.css +24 -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 +27 -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.map +1 -1
- package/build/types/listItem/_stories/subcomponents.d.ts +1 -1
- package/build/types/listItem/_stories/subcomponents.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 +1 -1
- package/src/actionButton/ActionButton.story.tsx +1 -1
- 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.spec.tsx +25 -1
- package/src/button/Button.story.tsx +1 -1
- package/src/button/LegacyButton.story.tsx +1 -1
- package/src/header/Header.accessibility.docs.mdx +85 -0
- package/src/header/Header.css +21 -14
- package/src/header/Header.less +17 -10
- package/src/header/Header.spec.tsx +68 -50
- package/src/header/Header.story.tsx +190 -36
- package/src/header/Header.tsx +96 -65
- package/src/header/index.ts +1 -0
- package/src/i18n/cs.json +2 -0
- package/src/i18n/es.json +2 -0
- package/src/i18n/th.json +2 -0
- package/src/iconButton/iconButton.spec.tsx +31 -0
- package/src/index.ts +1 -0
- package/src/listItem/Button/ListItemButton.spec.tsx +23 -1
- package/src/listItem/IconButton/ListItemIconButton.spec.tsx +14 -2
- package/src/listItem/ListItem.css +3 -0
- package/src/listItem/ListItem.less +4 -0
- package/src/listItem/ListItem.tsx +4 -2
- package/src/listItem/Navigation/ListItemNavigation.spec.tsx +8 -0
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +4 -2
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +20 -0
- package/src/listItem/_stories/ListItem.story.tsx +1 -1
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +3 -0
- package/src/listItem/_stories/subcomponents.tsx +2 -0
- package/src/main.css +24 -14
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +15 -4
- package/src/select/Select.story.tsx +1 -1
- package/src/title/Title.tsx +25 -12
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;
|