@scalewing/react-native 0.2.0 → 0.3.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/CHANGELOG.md +26 -0
- package/README.md +9 -7
- package/dist/components/Text.js +2 -0
- package/dist/map-button-style.js +2 -2
- package/dist/theme/ThemeProvider.d.ts +4 -3
- package/dist/theme/ThemeProvider.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @scalewing/react-native
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 247f158: Default accent is electric indigo, and glass fill is derived from the merged accent so ThemeProvider overlays retint frost.
|
|
8
|
+
|
|
9
|
+
Adds opt-in density (`xs` controls, `data` type, `sw-tabular`) and web `Badge`, `SegmentedControl`, and `Table`. Pin the previous teal with `colors={{ accent: '#0B615E', onAccent: '#FFFFFF' }}` (dark: `#7EDAD6` / `#101214`).
|
|
10
|
+
|
|
11
|
+
- 247f158: Adds a named palette catalog so products pick a reviewed light/dark overlay instead of copying hex. Apply with ThemeProvider `palette`, `data-palette` on the generated canvas, or `import '@scalewing/react/palette/<id>.css'` after styles.css. Default remains indigo. `colors` still wins over a named palette and may be `{ light, dark }` so end users can switch scheme without the product swapping hex.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [247f158]
|
|
16
|
+
- Updated dependencies [247f158]
|
|
17
|
+
- Updated dependencies [247f158]
|
|
18
|
+
- Updated dependencies [247f158]
|
|
19
|
+
- Updated dependencies [247f158]
|
|
20
|
+
- Updated dependencies [247f158]
|
|
21
|
+
- Updated dependencies [247f158]
|
|
22
|
+
- Updated dependencies [247f158]
|
|
23
|
+
- Updated dependencies [247f158]
|
|
24
|
+
- Updated dependencies [247f158]
|
|
25
|
+
- Updated dependencies [247f158]
|
|
26
|
+
- Updated dependencies [247f158]
|
|
27
|
+
- @scalewing/tokens@0.3.0
|
|
28
|
+
|
|
3
29
|
## 0.2.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -5,14 +5,16 @@ React Native / Expo primitives that consume the same Scalewing tokens as the DOM
|
|
|
5
5
|
```ts
|
|
6
6
|
import { Button, Card, Stack, Text, ThemeProvider } from '@scalewing/react-native';
|
|
7
7
|
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</
|
|
8
|
+
<ThemeProvider colorScheme="system" palette="cerulean">
|
|
9
|
+
<Card padding={4}>
|
|
10
|
+
<Stack gap={3}>
|
|
11
|
+
<Text variant="title">Kickoff</Text>
|
|
12
|
+
<Button onPress={() => undefined}>Save</Button>
|
|
13
|
+
</Stack>
|
|
14
|
+
</Card>
|
|
15
|
+
</ThemeProvider>
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
There is no CSS class API. `padding={4}` is spacing step 4, the same step as `sw-padding-4` on web. Field is web-only (`@scalewing/react`).
|
|
18
|
+
There is no CSS class API. `padding={4}` is spacing step 4, the same step as `sw-padding-4` on web. Field is web-only (`@scalewing/react`). `colorScheme` is `"light"`, `"dark"`, or `"system"`. Named palettes include both schemes; `colors` may be `{ light, dark }`.
|
|
17
19
|
|
|
18
20
|
React and React Native are peer dependencies so the host Expo app owns the runtime. Rationale: duplicating React Native inside this package would fight Metro and Expo upgrades.
|
package/dist/components/Text.js
CHANGED
|
@@ -4,10 +4,12 @@ import { useTheme } from '../theme/ThemeProvider.js';
|
|
|
4
4
|
export function Text({ color = 'text', style, truncate = false, variant = 'body', ...rest }) {
|
|
5
5
|
const theme = useTheme();
|
|
6
6
|
const type = theme.typography[variant];
|
|
7
|
+
const fontVariant = 'tabularNums' in type && type.tabularNums ? ['tabular-nums'] : undefined;
|
|
7
8
|
return (_jsx(NativeText, { numberOfLines: truncate ? 1 : undefined, style: [
|
|
8
9
|
{
|
|
9
10
|
color: theme.colors[color],
|
|
10
11
|
fontSize: type.fontSize,
|
|
12
|
+
fontVariant,
|
|
11
13
|
fontWeight: String(type.fontWeight),
|
|
12
14
|
letterSpacing: type.letterSpacing,
|
|
13
15
|
lineHeight: type.lineHeight,
|
package/dist/map-button-style.js
CHANGED
|
@@ -44,8 +44,8 @@ function buttonFill(theme, variant) {
|
|
|
44
44
|
};
|
|
45
45
|
case 'secondary':
|
|
46
46
|
return {
|
|
47
|
-
backgroundColor: theme.
|
|
48
|
-
borderColor: theme.
|
|
47
|
+
backgroundColor: theme.colors.surface,
|
|
48
|
+
borderColor: theme.colors.border,
|
|
49
49
|
};
|
|
50
50
|
case 'ghost':
|
|
51
51
|
return {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type ColorScheme, type
|
|
2
|
+
import { type ColorScheme, type PaletteId, type Theme, type ThemeColors } from '@scalewing/tokens';
|
|
3
3
|
export type ThemeProviderProps = {
|
|
4
4
|
colorScheme?: ColorScheme | 'system';
|
|
5
|
-
|
|
5
|
+
palette?: PaletteId;
|
|
6
|
+
colors?: ThemeColors;
|
|
6
7
|
children: ReactNode;
|
|
7
8
|
};
|
|
8
|
-
export declare function ThemeProvider({ colorScheme, colors, children, }: ThemeProviderProps): import("react").JSX.Element;
|
|
9
|
+
export declare function ThemeProvider({ colorScheme, palette, colors, children, }: ThemeProviderProps): import("react").JSX.Element;
|
|
9
10
|
export declare function useTheme(): Theme;
|
|
@@ -3,10 +3,10 @@ import { createContext, useContext, useMemo } from 'react';
|
|
|
3
3
|
import { useColorScheme, View } from 'react-native';
|
|
4
4
|
import { createTheme, } from '@scalewing/tokens';
|
|
5
5
|
const ThemeContext = createContext(null);
|
|
6
|
-
export function ThemeProvider({ colorScheme = 'system', colors, children, }) {
|
|
6
|
+
export function ThemeProvider({ colorScheme = 'system', palette, colors, children, }) {
|
|
7
7
|
const deviceScheme = useColorScheme() === 'dark' ? 'dark' : 'light';
|
|
8
8
|
const resolvedScheme = colorScheme === 'system' ? deviceScheme : colorScheme;
|
|
9
|
-
const theme = useMemo(() => createTheme({ colorScheme: resolvedScheme, colors }), [colors, resolvedScheme]);
|
|
9
|
+
const theme = useMemo(() => createTheme({ colorScheme: resolvedScheme, palette, colors }), [colors, palette, resolvedScheme]);
|
|
10
10
|
return (_jsx(ThemeContext.Provider, { value: theme, children: _jsx(View, { style: { backgroundColor: theme.colors.background, flex: 1 }, children: children }) }));
|
|
11
11
|
}
|
|
12
12
|
export function useTheme() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalewing/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Scalewing React Native layout primitives.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@scalewing/tokens": "0.
|
|
31
|
+
"@scalewing/tokens": "0.3.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^19.0.0",
|