@oneplatformdev/react-native-uikit 1.2.5 → 1.2.7
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/README.md
CHANGED
|
@@ -96,6 +96,7 @@ export const typography = {
|
|
|
96
96
|
font: 'extraBold',
|
|
97
97
|
fontSize: 18,
|
|
98
98
|
lineHeight: 24,
|
|
99
|
+
color: 'premium',
|
|
99
100
|
},
|
|
100
101
|
} as const;
|
|
101
102
|
```
|
|
@@ -209,7 +210,7 @@ Package import: `import { Typography } from '@oneplatformdev/react-native-uikit'
|
|
|
209
210
|
<Typography variant="body">Hello</Typography>
|
|
210
211
|
```
|
|
211
212
|
|
|
212
|
-
Prefer `text` (`string | number`) for simple content. Use `children` for composed or custom content; TypeScript disallows supplying both, and neither is also valid. Typography retains React Native `TextProps`, styles, and ref forwarding. Its main visual props are `variant`, `weight`, `color`, `size`, and `lineHeight
|
|
213
|
+
Prefer `text` (`string | number`) for simple content. Use `children` for composed or custom content; TypeScript disallows supplying both, and neither is also valid. Typography retains React Native `TextProps`, styles, and ref forwarding. Its main visual props are `variant`, `weight`, `color`, `size`, and `lineHeight`. A variant may define an optional `color` token; an explicit `color` prop overrides it, otherwise Typography uses the theme's `text` color. Caller `style` is applied last and can override either color. Customize typography/font/color tokens through `createTheme` and the extension interfaces described above. Owned/local source installation: **available** with `npx @oneplatformdev/react-native-uikit add typography`.
|
|
213
214
|
|
|
214
215
|
## Button
|
|
215
216
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ type TypographyStyleProps = Pick<TypographyProps, 'variant' | 'weight' | 'color'
|
|
|
8
8
|
export const getTypographyStyle = (
|
|
9
9
|
{ colors, fonts, typography }: UITheme,
|
|
10
10
|
scaling: ScalingFunctions,
|
|
11
|
-
{ variant = 'body', weight, color
|
|
11
|
+
{ variant = 'body', weight, color, size, lineHeight }: TypographyStyleProps,
|
|
12
12
|
): TextStyle => {
|
|
13
13
|
const token = typography[variant] as UITypographyToken;
|
|
14
14
|
const font = fonts[weight ?? token.font];
|
|
@@ -16,7 +16,7 @@ export const getTypographyStyle = (
|
|
|
16
16
|
|
|
17
17
|
return {
|
|
18
18
|
...font,
|
|
19
|
-
color: colors[color],
|
|
19
|
+
color: colors[color ?? token.color ?? 'text'],
|
|
20
20
|
fontSize: scaling.scaleFontSize(size ?? token.fontSize),
|
|
21
21
|
lineHeight: resolvedLineHeight === undefined ? undefined : scaling.scaleLineHeight(resolvedLineHeight),
|
|
22
22
|
letterSpacing: token.letterSpacing,
|
package/src/theme/types.ts
CHANGED
|
@@ -102,6 +102,7 @@ export type UIRadius = DefaultUIRadius & ExtendedUIRadius;
|
|
|
102
102
|
export type UITypographyToken = {
|
|
103
103
|
font: UIFontKey;
|
|
104
104
|
fontSize: number;
|
|
105
|
+
color?: UIColorKey;
|
|
105
106
|
lineHeight?: number;
|
|
106
107
|
letterSpacing?: number;
|
|
107
108
|
includeFontPadding?: TextStyle['includeFontPadding'];
|