@newtonedev/components 0.1.13 → 0.1.15
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/dist/composites/actions/Button/Button.d.ts +17 -20
- package/dist/composites/actions/Button/Button.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.styles.d.ts +12 -24
- package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.types.d.ts +14 -13
- package/dist/composites/actions/Button/Button.types.d.ts.map +1 -1
- package/dist/composites/actions/Button/index.d.ts +1 -1
- package/dist/composites/actions/Button/index.d.ts.map +1 -1
- package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts +10 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts.map +1 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts +35 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts.map +1 -0
- package/dist/composites/branding/LogoMonogram/index.d.ts +3 -0
- package/dist/composites/branding/LogoMonogram/index.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts +9 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts +26 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/index.d.ts +3 -0
- package/dist/composites/branding/LogoWordmark/index.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.d.ts +25 -0
- package/dist/composites/display/Chip/Chip.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.styles.d.ts +29 -0
- package/dist/composites/display/Chip/Chip.styles.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.types.d.ts +63 -0
- package/dist/composites/display/Chip/Chip.types.d.ts.map +1 -0
- package/dist/composites/display/Chip/index.d.ts +3 -0
- package/dist/composites/display/Chip/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/Select.d.ts.map +1 -1
- package/dist/composites/form-controls/Select/Select.styles.d.ts +2 -2
- package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts +2 -2
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts +2 -2
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -1
- package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -1
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts +2 -2
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -1
- package/dist/composites/layout/Card/Card.d.ts.map +1 -1
- package/dist/composites/layout/Card/Card.styles.d.ts +2 -2
- package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -1
- package/dist/composites/layout/ContentCard/ContentCard.d.ts +33 -0
- package/dist/composites/layout/ContentCard/ContentCard.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts +10 -0
- package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/ContentCard.types.d.ts +52 -0
- package/dist/composites/layout/ContentCard/ContentCard.types.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/index.d.ts +3 -0
- package/dist/composites/layout/ContentCard/index.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.d.ts +25 -0
- package/dist/composites/layout/Divider/Divider.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.styles.d.ts +8 -0
- package/dist/composites/layout/Divider/Divider.styles.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.types.d.ts +25 -0
- package/dist/composites/layout/Divider/Divider.types.d.ts.map +1 -0
- package/dist/composites/layout/Divider/index.d.ts +3 -0
- package/dist/composites/layout/Divider/index.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -1
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts +4 -3
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts +4 -3
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -1
- package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -1
- package/dist/composites/overlays/Popover/Popover.styles.d.ts +2 -2
- package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts +2 -2
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts +2 -2
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts +2 -2
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -1
- package/dist/index.cjs +935 -523
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +860 -473
- package/dist/index.js.map +1 -1
- package/dist/primitives/Frame/Frame.d.ts +1 -35
- package/dist/primitives/Frame/Frame.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.styles.d.ts +13 -4
- package/dist/primitives/Frame/Frame.styles.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.types.d.ts +99 -1
- package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
- package/dist/primitives/Frame/index.d.ts +1 -1
- package/dist/primitives/Frame/index.d.ts.map +1 -1
- package/dist/primitives/Icon/Icon.d.ts.map +1 -1
- package/dist/primitives/Icon/Icon.types.d.ts +2 -2
- package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
- package/dist/primitives/Text/Text.d.ts +5 -3
- package/dist/primitives/Text/Text.d.ts.map +1 -1
- package/dist/primitives/Text/Text.spans.d.ts.map +1 -1
- package/dist/primitives/Text/Text.types.d.ts +3 -6
- package/dist/primitives/Text/Text.types.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.d.ts +1 -1
- package/dist/primitives/Wrapper/Wrapper.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts +9 -1
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts +31 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +1 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/composites/actions/Button/Button.styles.ts +90 -182
- package/src/composites/actions/Button/Button.tsx +37 -33
- package/src/composites/actions/Button/Button.types.ts +16 -15
- package/src/composites/actions/Button/index.ts +1 -1
- package/src/composites/branding/LogoMonogram/LogoMonogram.tsx +29 -0
- package/src/composites/branding/LogoMonogram/LogoMonogram.types.ts +35 -0
- package/src/composites/branding/LogoMonogram/index.ts +2 -0
- package/src/composites/branding/LogoWordmark/LogoWordmark.tsx +29 -0
- package/src/composites/branding/LogoWordmark/LogoWordmark.types.ts +25 -0
- package/src/composites/branding/LogoWordmark/index.ts +2 -0
- package/src/composites/display/Chip/Chip.styles.ts +189 -0
- package/src/composites/display/Chip/Chip.tsx +97 -0
- package/src/composites/display/Chip/Chip.types.ts +74 -0
- package/src/composites/display/Chip/index.ts +2 -0
- package/src/composites/form-controls/Select/Select.styles.ts +10 -10
- package/src/composites/form-controls/Select/Select.tsx +9 -6
- package/src/composites/form-controls/Select/SelectOption.tsx +10 -7
- package/src/composites/form-controls/TextInput/TextInput.styles.ts +12 -8
- package/src/composites/form-controls/TextInput/TextInput.tsx +7 -4
- package/src/composites/form-controls/Toggle/Toggle.styles.ts +10 -7
- package/src/composites/form-controls/Toggle/Toggle.tsx +4 -3
- package/src/composites/layout/AppShell/AppShell.styles.ts +8 -3
- package/src/composites/layout/AppShell/AppShell.tsx +6 -2
- package/src/composites/layout/Card/Card.styles.ts +10 -4
- package/src/composites/layout/Card/Card.tsx +4 -3
- package/src/composites/layout/ContentCard/ContentCard.styles.ts +44 -0
- package/src/composites/layout/ContentCard/ContentCard.tsx +71 -0
- package/src/composites/layout/ContentCard/ContentCard.types.ts +60 -0
- package/src/composites/layout/ContentCard/index.ts +2 -0
- package/src/composites/layout/Divider/Divider.styles.ts +30 -0
- package/src/composites/layout/Divider/Divider.tsx +46 -0
- package/src/composites/layout/Divider/Divider.types.ts +28 -0
- package/src/composites/layout/Divider/index.ts +2 -0
- package/src/composites/layout/Navbar/Navbar.styles.ts +7 -5
- package/src/composites/layout/Navbar/Navbar.tsx +4 -3
- package/src/composites/layout/Sidebar/Sidebar.styles.ts +7 -5
- package/src/composites/layout/Sidebar/Sidebar.tsx +4 -3
- package/src/composites/overlays/Popover/Popover.styles.ts +7 -5
- package/src/composites/overlays/Popover/Popover.tsx +4 -3
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +5 -5
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.tsx +4 -3
- package/src/composites/range-inputs/HueSlider/HueSlider.styles.ts +7 -7
- package/src/composites/range-inputs/HueSlider/HueSlider.tsx +1 -1
- package/src/composites/range-inputs/Slider/Slider.styles.ts +9 -9
- package/src/composites/range-inputs/Slider/Slider.tsx +1 -1
- package/src/index.ts +49 -10
- package/src/primitives/Frame/Frame.styles.ts +55 -12
- package/src/primitives/Frame/Frame.tsx +139 -140
- package/src/primitives/Frame/Frame.types.ts +119 -1
- package/src/primitives/Frame/index.ts +4 -0
- package/src/primitives/Icon/Icon.tsx +9 -6
- package/src/primitives/Icon/Icon.types.ts +2 -2
- package/src/primitives/Text/Text.spans.ts +9 -5
- package/src/primitives/Text/Text.tsx +26 -15
- package/src/primitives/Text/Text.types.ts +3 -6
- package/src/primitives/Wrapper/Wrapper.styles.ts +32 -0
- package/src/primitives/Wrapper/Wrapper.tsx +22 -3
- package/src/primitives/Wrapper/Wrapper.types.ts +45 -0
- package/src/registry/registry.ts +5 -21
- package/dist/_COMPONENT_TEMPLATE/ComponentName.d.ts +0 -70
- package/dist/_COMPONENT_TEMPLATE/ComponentName.d.ts.map +0 -1
- package/dist/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts +0 -23
- package/dist/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts.map +0 -1
- package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts +0 -45
- package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts.map +0 -1
- package/dist/_COMPONENT_TEMPLATE/index.d.ts +0 -3
- package/dist/_COMPONENT_TEMPLATE/index.d.ts.map +0 -1
|
@@ -4,7 +4,7 @@ import { srgbToHex } from 'newtone';
|
|
|
4
4
|
import { oklchToP3Css } from '@newtonedev/colors';
|
|
5
5
|
import type { Oklch } from '@newtonedev/colors';
|
|
6
6
|
import type { ColorScaleSliderProps } from './ColorScaleSlider.types';
|
|
7
|
-
import { useTokens } from 'newtone-api';
|
|
7
|
+
import { useTokens, useNewtoneTheme } from 'newtone-api';
|
|
8
8
|
import { getColorScaleSliderStyles, THUMB_SIZE } from './ColorScaleSlider.styles';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -30,9 +30,10 @@ export function ColorScaleSlider({
|
|
|
30
30
|
style,
|
|
31
31
|
}: ColorScaleSliderProps) {
|
|
32
32
|
const tokens = useTokens(1);
|
|
33
|
+
const { gamut } = useNewtoneTheme();
|
|
33
34
|
|
|
34
35
|
const styles = React.useMemo(
|
|
35
|
-
() => getColorScaleSliderStyles(tokens,
|
|
36
|
+
() => getColorScaleSliderStyles(tokens, disabled),
|
|
36
37
|
[tokens, disabled]
|
|
37
38
|
);
|
|
38
39
|
|
|
@@ -146,7 +147,7 @@ export function ColorScaleSlider({
|
|
|
146
147
|
>
|
|
147
148
|
<View style={styles.gradientTrack}>
|
|
148
149
|
{visibleColors.map((color, i) => (
|
|
149
|
-
<View key={i} style={[styles.segment, { backgroundColor:
|
|
150
|
+
<View key={i} style={[styles.segment, { backgroundColor: gamut === 'p3' ? oklchToP3Css(color.oklch) : srgbToHex(color.srgb) }]} />
|
|
150
151
|
))}
|
|
151
152
|
</View>
|
|
152
153
|
<Animated.View style={[styles.thumb, { left: thumbAnim }]} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
import { srgbToHex, gamutMapToSrgb } from 'newtone';
|
|
3
|
-
import type { ResolvedTokens
|
|
3
|
+
import type { ResolvedTokens } from 'newtone-api';
|
|
4
4
|
|
|
5
5
|
const TRACK_HEIGHT = 22;
|
|
6
6
|
export const THUMB_SIZE = 18;
|
|
@@ -22,7 +22,7 @@ export function buildHueSegments(min: number, max: number): string[] {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function getHueSliderStyles(tokens: ResolvedTokens,
|
|
25
|
+
export function getHueSliderStyles(tokens: ResolvedTokens, disabled: boolean) {
|
|
26
26
|
return StyleSheet.create({
|
|
27
27
|
container: {
|
|
28
28
|
gap: tokens.spacing['04'],
|
|
@@ -37,23 +37,23 @@ export function getHueSliderStyles(tokens: ResolvedTokens, gamut: ColorGamut, di
|
|
|
37
37
|
fontFamily: tokens.typography.fonts.main.family,
|
|
38
38
|
fontSize: tokens.typography.fontSizes['04'],
|
|
39
39
|
fontWeight: tokens.typography.fonts.main.weights.medium as any,
|
|
40
|
-
color: tokens.
|
|
40
|
+
color: tokens.colors.primary.main.fontTertiary,
|
|
41
41
|
},
|
|
42
42
|
value: {
|
|
43
43
|
fontFamily: tokens.typography.fonts.main.family,
|
|
44
44
|
fontSize: tokens.typography.fontSizes['04'],
|
|
45
45
|
fontWeight: tokens.typography.fonts.main.weights.medium as any,
|
|
46
|
-
color: tokens.
|
|
46
|
+
color: tokens.colors.primary.main.divider,
|
|
47
47
|
},
|
|
48
48
|
valueInput: {
|
|
49
49
|
width: 48,
|
|
50
50
|
paddingVertical: 0,
|
|
51
51
|
paddingHorizontal: 4,
|
|
52
52
|
borderWidth: 1,
|
|
53
|
-
borderColor: tokens.
|
|
53
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
54
54
|
borderRadius: 4,
|
|
55
55
|
backgroundColor: 'transparent',
|
|
56
|
-
color: tokens.
|
|
56
|
+
color: tokens.colors.primary.main.divider,
|
|
57
57
|
fontFamily: tokens.typography.fonts.main.family,
|
|
58
58
|
fontSize: tokens.typography.fontSizes['04'],
|
|
59
59
|
fontWeight: tokens.typography.fonts.main.weights.medium as any,
|
|
@@ -83,7 +83,7 @@ export function getHueSliderStyles(tokens: ResolvedTokens, gamut: ColorGamut, di
|
|
|
83
83
|
borderRadius: THUMB_SIZE / 2,
|
|
84
84
|
backgroundColor: '#ffffff',
|
|
85
85
|
borderWidth: 2,
|
|
86
|
-
borderColor: tokens.
|
|
86
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
87
87
|
},
|
|
88
88
|
});
|
|
89
89
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import type { ResolvedTokens
|
|
2
|
+
import type { ResolvedTokens } from 'newtone-api';
|
|
3
3
|
|
|
4
4
|
const TRACK_HEIGHT = 6;
|
|
5
5
|
export const THUMB_SIZE = 16;
|
|
6
6
|
|
|
7
|
-
export function getSliderStyles(tokens: ResolvedTokens,
|
|
7
|
+
export function getSliderStyles(tokens: ResolvedTokens, disabled: boolean) {
|
|
8
8
|
return StyleSheet.create({
|
|
9
9
|
container: {
|
|
10
10
|
gap: tokens.spacing['04'],
|
|
@@ -19,23 +19,23 @@ export function getSliderStyles(tokens: ResolvedTokens, gamut: ColorGamut, disab
|
|
|
19
19
|
fontFamily: tokens.typography.fonts.main.family,
|
|
20
20
|
fontSize: tokens.typography.fontSizes['04'],
|
|
21
21
|
fontWeight: tokens.typography.fonts.main.weights.medium as any,
|
|
22
|
-
color: tokens.
|
|
22
|
+
color: tokens.colors.primary.main.fontTertiary,
|
|
23
23
|
},
|
|
24
24
|
value: {
|
|
25
25
|
fontFamily: tokens.typography.fonts.main.family,
|
|
26
26
|
fontSize: tokens.typography.fontSizes['04'],
|
|
27
27
|
fontWeight: tokens.typography.fonts.main.weights.medium as any,
|
|
28
|
-
color: tokens.
|
|
28
|
+
color: tokens.colors.primary.main.divider,
|
|
29
29
|
},
|
|
30
30
|
valueInput: {
|
|
31
31
|
width: 48,
|
|
32
32
|
paddingVertical: 0,
|
|
33
33
|
paddingHorizontal: 4,
|
|
34
34
|
borderWidth: 1,
|
|
35
|
-
borderColor: tokens.
|
|
35
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
36
36
|
borderRadius: 4,
|
|
37
37
|
backgroundColor: 'transparent',
|
|
38
|
-
color: tokens.
|
|
38
|
+
color: tokens.colors.primary.main.divider,
|
|
39
39
|
fontFamily: tokens.typography.fonts.main.family,
|
|
40
40
|
fontSize: tokens.typography.fontSizes['04'],
|
|
41
41
|
fontWeight: tokens.typography.fonts.main.weights.medium as any,
|
|
@@ -52,21 +52,21 @@ export function getSliderStyles(tokens: ResolvedTokens, gamut: ColorGamut, disab
|
|
|
52
52
|
right: 0,
|
|
53
53
|
height: TRACK_HEIGHT,
|
|
54
54
|
borderRadius: TRACK_HEIGHT / 2,
|
|
55
|
-
backgroundColor: tokens.
|
|
55
|
+
backgroundColor: tokens.colors.primary.main.fontSecondary,
|
|
56
56
|
},
|
|
57
57
|
trackFill: {
|
|
58
58
|
position: 'absolute',
|
|
59
59
|
left: 0,
|
|
60
60
|
height: TRACK_HEIGHT,
|
|
61
61
|
borderRadius: TRACK_HEIGHT / 2,
|
|
62
|
-
backgroundColor: tokens.
|
|
62
|
+
backgroundColor: tokens.colors.primary.emphasis.divider,
|
|
63
63
|
},
|
|
64
64
|
thumb: {
|
|
65
65
|
position: 'absolute',
|
|
66
66
|
width: THUMB_SIZE,
|
|
67
67
|
height: THUMB_SIZE,
|
|
68
68
|
borderRadius: THUMB_SIZE / 2,
|
|
69
|
-
backgroundColor: tokens.
|
|
69
|
+
backgroundColor: tokens.colors.primary.emphasis.divider,
|
|
70
70
|
},
|
|
71
71
|
});
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export {
|
|
3
3
|
NewtoneProvider,
|
|
4
4
|
useNewtoneTheme,
|
|
5
|
+
useScheme,
|
|
5
6
|
FrameContext,
|
|
6
7
|
useFrameContext,
|
|
7
8
|
useBreakpoint,
|
|
@@ -11,18 +12,22 @@ export {
|
|
|
11
12
|
DEFAULT_ROLE_SCALES,
|
|
12
13
|
useTokens,
|
|
13
14
|
computeTokens,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
computeSwatches,
|
|
16
|
+
computeColors,
|
|
17
|
+
resolveTheme,
|
|
18
|
+
PRIMARY_DEFAULTS,
|
|
19
|
+
SECONDARY_DEFAULTS,
|
|
20
|
+
TERTIARY_DEFAULTS,
|
|
16
21
|
SUCCESS_DEFAULTS,
|
|
17
22
|
WARNING_DEFAULTS,
|
|
18
23
|
ERROR_DEFAULTS,
|
|
24
|
+
NON_PRIMARY_RELATIVE_DEFAULTS,
|
|
25
|
+
DEFAULT_THEME_MAPPINGS,
|
|
19
26
|
buildGoogleFontsUrl,
|
|
20
27
|
measureAvgCharWidth,
|
|
21
28
|
useLocalCalibration,
|
|
22
29
|
useTypographyCalibrations,
|
|
23
30
|
enqueueObservation,
|
|
24
|
-
migrateV1ToV2,
|
|
25
|
-
isV2TokenOverrides,
|
|
26
31
|
} from 'newtone-api';
|
|
27
32
|
export type {
|
|
28
33
|
ColorMode,
|
|
@@ -36,11 +41,16 @@ export type {
|
|
|
36
41
|
FontConfig,
|
|
37
42
|
FontWeights,
|
|
38
43
|
FontSlot,
|
|
39
|
-
TokenOverrides,
|
|
40
44
|
TokenColor,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
TokenName,
|
|
46
|
+
ContrastLevel,
|
|
47
|
+
PaletteId,
|
|
48
|
+
ThemeName,
|
|
49
|
+
AppearanceName,
|
|
50
|
+
ColorRef,
|
|
51
|
+
AppearanceMapping,
|
|
52
|
+
ThemeMapping,
|
|
53
|
+
ThemeMappings,
|
|
44
54
|
FontSizeScale,
|
|
45
55
|
LineHeightScale,
|
|
46
56
|
RoleSizeStep,
|
|
@@ -53,8 +63,21 @@ export type {
|
|
|
53
63
|
FrameContextValue,
|
|
54
64
|
UseTokensResult,
|
|
55
65
|
PaletteDefaults,
|
|
66
|
+
ContrastLevelDefaults,
|
|
67
|
+
SwatchDefaults,
|
|
68
|
+
RelativeContrastDefaults,
|
|
69
|
+
RelativePaletteDefaults,
|
|
70
|
+
PaletteKeySteps,
|
|
71
|
+
RelativeSwatchDefaults,
|
|
56
72
|
ResolvedTokens,
|
|
57
|
-
|
|
73
|
+
ResolvedSwatches,
|
|
74
|
+
PaletteColors,
|
|
75
|
+
ContrastLevelColors,
|
|
76
|
+
ElevationColors,
|
|
77
|
+
ElevationName,
|
|
78
|
+
AppearanceTokens,
|
|
79
|
+
ThemeTokens,
|
|
80
|
+
ResolvedColor,
|
|
58
81
|
DynamicRange,
|
|
59
82
|
ColorResult,
|
|
60
83
|
Srgb,
|
|
@@ -108,11 +131,20 @@ export type {
|
|
|
108
131
|
|
|
109
132
|
// Composite Components
|
|
110
133
|
export { Button } from './composites/actions/Button/Button';
|
|
111
|
-
export type { ButtonProps, ButtonVariant,
|
|
134
|
+
export type { ButtonProps, ButtonVariant, ButtonSize, ButtonIconPosition } from './composites/actions/Button/Button.types';
|
|
112
135
|
|
|
113
136
|
export { Card } from './composites/layout/Card/Card';
|
|
114
137
|
export type { CardProps } from './composites/layout/Card/Card.types';
|
|
115
138
|
|
|
139
|
+
export { Chip } from './composites/display/Chip/Chip';
|
|
140
|
+
export type { ChipProps, ChipVariant, ChipSemantic, ChipSize } from './composites/display/Chip/Chip.types';
|
|
141
|
+
|
|
142
|
+
export { Divider } from './composites/layout/Divider/Divider';
|
|
143
|
+
export type { DividerProps, DividerOrientation } from './composites/layout/Divider/Divider.types';
|
|
144
|
+
|
|
145
|
+
export { ContentCard } from './composites/layout/ContentCard/ContentCard';
|
|
146
|
+
export type { ContentCardProps, ContentCardVariant } from './composites/layout/ContentCard/ContentCard.types';
|
|
147
|
+
|
|
116
148
|
export { TextInput } from './composites/form-controls/TextInput/TextInput';
|
|
117
149
|
export type { TextInputProps } from './composites/form-controls/TextInput/TextInput.types';
|
|
118
150
|
|
|
@@ -145,6 +177,13 @@ export type { SidebarProps } from './composites/layout/Sidebar/Sidebar.types';
|
|
|
145
177
|
export { Navbar } from './composites/layout/Navbar/Navbar';
|
|
146
178
|
export type { NavbarProps } from './composites/layout/Navbar/Navbar.types';
|
|
147
179
|
|
|
180
|
+
// Branding
|
|
181
|
+
export { LogoMonogram } from './composites/branding/LogoMonogram/LogoMonogram';
|
|
182
|
+
export type { LogoMonogramProps } from './composites/branding/LogoMonogram/LogoMonogram.types';
|
|
183
|
+
|
|
184
|
+
export { LogoWordmark } from './composites/branding/LogoWordmark/LogoWordmark';
|
|
185
|
+
export type { LogoWordmarkProps } from './composites/branding/LogoWordmark/LogoWordmark.types';
|
|
186
|
+
|
|
148
187
|
// Component registry + code generation
|
|
149
188
|
export type {
|
|
150
189
|
CategoryMeta,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ViewStyle } from 'react-native';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
|
-
import type { ResolvedTokens,
|
|
4
|
-
import type { FrameElevation } from 'newtone-api';
|
|
3
|
+
import type { ResolvedTokens, AppearanceTokens } from 'newtone-api';
|
|
4
|
+
import type { FrameElevation, ThemeName, AppearanceName } from 'newtone-api';
|
|
5
5
|
import type {
|
|
6
6
|
PaddingProp,
|
|
7
7
|
GapProp,
|
|
@@ -11,6 +11,9 @@ import type {
|
|
|
11
11
|
Justification,
|
|
12
12
|
RadiusProp,
|
|
13
13
|
LayoutMode,
|
|
14
|
+
PositionType,
|
|
15
|
+
OffsetValue,
|
|
16
|
+
OverflowMode,
|
|
14
17
|
} from './Frame.types';
|
|
15
18
|
import {
|
|
16
19
|
resolvePadding,
|
|
@@ -27,9 +30,12 @@ import {
|
|
|
27
30
|
|
|
28
31
|
export interface FrameStyleInput {
|
|
29
32
|
readonly tokens: ResolvedTokens;
|
|
30
|
-
readonly gamut: ColorGamut;
|
|
31
33
|
readonly frameElevation: FrameElevation;
|
|
32
34
|
|
|
35
|
+
// Theme / Appearance
|
|
36
|
+
readonly theme?: ThemeName;
|
|
37
|
+
readonly appearance?: AppearanceName;
|
|
38
|
+
|
|
33
39
|
// Layout
|
|
34
40
|
readonly layout?: LayoutMode;
|
|
35
41
|
readonly direction?: Direction;
|
|
@@ -54,6 +60,16 @@ export interface FrameStyleInput {
|
|
|
54
60
|
readonly minHeight?: number;
|
|
55
61
|
readonly maxHeight?: number;
|
|
56
62
|
|
|
63
|
+
// Positioning
|
|
64
|
+
readonly position?: PositionType;
|
|
65
|
+
readonly top?: OffsetValue;
|
|
66
|
+
readonly right?: OffsetValue;
|
|
67
|
+
readonly bottom?: OffsetValue;
|
|
68
|
+
readonly left?: OffsetValue;
|
|
69
|
+
readonly zIndex?: number;
|
|
70
|
+
readonly overflow?: OverflowMode;
|
|
71
|
+
readonly opacity?: number;
|
|
72
|
+
|
|
57
73
|
// Appearance
|
|
58
74
|
readonly radius?: RadiusProp;
|
|
59
75
|
readonly bordered?: boolean;
|
|
@@ -87,8 +103,9 @@ export interface FrameStyles {
|
|
|
87
103
|
export function getFrameStyles(input: FrameStyleInput): FrameStyles {
|
|
88
104
|
const {
|
|
89
105
|
tokens,
|
|
90
|
-
gamut,
|
|
91
106
|
frameElevation,
|
|
107
|
+
theme = 'primary',
|
|
108
|
+
appearance = 'main',
|
|
92
109
|
layout = 'flex',
|
|
93
110
|
direction = 'vertical',
|
|
94
111
|
wrap = false,
|
|
@@ -105,6 +122,14 @@ export function getFrameStyles(input: FrameStyleInput): FrameStyles {
|
|
|
105
122
|
maxWidth,
|
|
106
123
|
minHeight,
|
|
107
124
|
maxHeight,
|
|
125
|
+
position,
|
|
126
|
+
top,
|
|
127
|
+
right,
|
|
128
|
+
bottom,
|
|
129
|
+
left,
|
|
130
|
+
zIndex,
|
|
131
|
+
overflow,
|
|
132
|
+
opacity,
|
|
108
133
|
radius,
|
|
109
134
|
bordered = false,
|
|
110
135
|
disabled = false,
|
|
@@ -116,9 +141,12 @@ export function getFrameStyles(input: FrameStyleInput): FrameStyles {
|
|
|
116
141
|
const container: Record<string, unknown> = {};
|
|
117
142
|
|
|
118
143
|
// ── Background & foreground ──
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
144
|
+
// Resolve the appearance tokens for the selected theme + appearance.
|
|
145
|
+
const appearanceTokens: AppearanceTokens = tokens.colors[theme][appearance];
|
|
146
|
+
|
|
147
|
+
// Set the surface color and default text color from the resolved appearance.
|
|
148
|
+
container.backgroundColor = appearanceTokens.background;
|
|
149
|
+
container.color = appearanceTokens.fontPrimary;
|
|
122
150
|
|
|
123
151
|
// ── Layout mode ──
|
|
124
152
|
if (layout === 'flex') {
|
|
@@ -172,6 +200,15 @@ export function getFrameStyles(input: FrameStyleInput): FrameStyles {
|
|
|
172
200
|
if (minHeight !== undefined) container.minHeight = minHeight;
|
|
173
201
|
if (maxHeight !== undefined) container.maxHeight = maxHeight;
|
|
174
202
|
|
|
203
|
+
// ── Positioning ──
|
|
204
|
+
// Set CSS position mode and offsets for absolute/fixed/sticky positioning.
|
|
205
|
+
if (position) container.position = position;
|
|
206
|
+
if (top !== undefined) container.top = top;
|
|
207
|
+
if (right !== undefined) container.right = right;
|
|
208
|
+
if (bottom !== undefined) container.bottom = bottom;
|
|
209
|
+
if (left !== undefined) container.left = left;
|
|
210
|
+
if (zIndex !== undefined) container.zIndex = zIndex;
|
|
211
|
+
|
|
175
212
|
// ── Radius ──
|
|
176
213
|
// Round the corners of the Frame (e.g. for cards, buttons, pills).
|
|
177
214
|
if (radius !== undefined) {
|
|
@@ -188,11 +225,15 @@ export function getFrameStyles(input: FrameStyleInput): FrameStyles {
|
|
|
188
225
|
}
|
|
189
226
|
}
|
|
190
227
|
|
|
228
|
+
// ── Overflow ──
|
|
229
|
+
// Explicit overflow prop overrides the auto-overflow from radius.
|
|
230
|
+
if (overflow) container.overflow = overflow;
|
|
231
|
+
|
|
191
232
|
// ── Border ──
|
|
192
233
|
// Add a thin border using the theme's border color.
|
|
193
234
|
if (bordered) {
|
|
194
235
|
container.borderWidth = 1;
|
|
195
|
-
container.borderColor =
|
|
236
|
+
container.borderColor = appearanceTokens.fontTertiary;
|
|
196
237
|
}
|
|
197
238
|
|
|
198
239
|
// ── Outer shadow (elevation 2) ──
|
|
@@ -207,9 +248,11 @@ export function getFrameStyles(input: FrameStyleInput): FrameStyles {
|
|
|
207
248
|
container.elevation = 4; // Android-specific shadow depth
|
|
208
249
|
}
|
|
209
250
|
|
|
210
|
-
// ──
|
|
211
|
-
//
|
|
212
|
-
if (
|
|
251
|
+
// ── Opacity ──
|
|
252
|
+
// Explicit opacity takes precedence over the disabled fade.
|
|
253
|
+
if (opacity !== undefined) {
|
|
254
|
+
container.opacity = opacity;
|
|
255
|
+
} else if (disabled) {
|
|
213
256
|
container.opacity = 0.5;
|
|
214
257
|
}
|
|
215
258
|
|
|
@@ -217,7 +260,7 @@ export function getFrameStyles(input: FrameStyleInput): FrameStyles {
|
|
|
217
260
|
// When the user is pressing an interactive Frame, shift the background
|
|
218
261
|
// to a darker "sunken" shade to give visual feedback.
|
|
219
262
|
const pressed = StyleSheet.create({
|
|
220
|
-
s: { backgroundColor:
|
|
263
|
+
s: { backgroundColor: appearanceTokens.fontSecondary },
|
|
221
264
|
}).s;
|
|
222
265
|
|
|
223
266
|
// ── Grid web style (web-only) ──
|