@ornikar/bumper 1.1.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/.eslintrc.json +3 -0
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +20 -0
- package/dist/definitions/components/breakpoints/SwitchBreakpoins.d.ts +5 -0
- package/dist/definitions/components/breakpoints/SwitchBreakpoins.d.ts.map +1 -0
- package/dist/definitions/components/breakpoints/hooks/useBreakpointValue.d.ts +3 -0
- package/dist/definitions/components/breakpoints/hooks/useBreakpointValue.d.ts.map +1 -0
- package/dist/definitions/components/breakpoints/hooks/useCurrentBreakpointName.d.ts +3 -0
- package/dist/definitions/components/breakpoints/hooks/useCurrentBreakpointName.d.ts.map +1 -0
- package/dist/definitions/components/breakpoints/hooks/useWindowSize.d.ts +2 -0
- package/dist/definitions/components/breakpoints/hooks/useWindowSize.d.ts.map +1 -0
- package/dist/definitions/components/breakpoints/utils/breakpointsUtils.d.ts +10 -0
- package/dist/definitions/components/breakpoints/utils/breakpointsUtils.d.ts.map +1 -0
- package/dist/definitions/components/primitives/Stacks.d.ts +9 -0
- package/dist/definitions/components/primitives/Stacks.d.ts.map +1 -0
- package/dist/definitions/components/primitives/View.d.ts +5 -0
- package/dist/definitions/components/primitives/View.d.ts.map +1 -0
- package/dist/definitions/components/typography/Typograhy.d.ts +40 -0
- package/dist/definitions/components/typography/Typograhy.d.ts.map +1 -0
- package/dist/definitions/components/typography/utils/getTypeAndWeightValues.d.ts +9 -0
- package/dist/definitions/components/typography/utils/getTypeAndWeightValues.d.ts.map +1 -0
- package/dist/definitions/core/BumperDecorator.d.ts +2 -0
- package/dist/definitions/core/BumperDecorator.d.ts.map +1 -0
- package/dist/definitions/core/BumperProvider.d.ts +6 -0
- package/dist/definitions/core/BumperProvider.d.ts.map +1 -0
- package/dist/definitions/index.d.ts +10 -0
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/definitions/story-components/StorySection.d.ts +20 -0
- package/dist/definitions/story-components/StorySection.d.ts.map +1 -0
- package/dist/definitions/story-components/StoryTitle.d.ts +6 -0
- package/dist/definitions/story-components/StoryTitle.d.ts.map +1 -0
- package/dist/definitions/tamagui.config.d.ts +148 -0
- package/dist/definitions/tamagui.config.d.ts.map +1 -0
- package/dist/definitions/themes/light.d.ts +53 -0
- package/dist/definitions/themes/light.d.ts.map +1 -0
- package/dist/definitions/themes/palettes/deepPurpleColorPalette.d.ts +86 -0
- package/dist/definitions/themes/palettes/deepPurpleColorPalette.d.ts.map +1 -0
- package/dist/definitions/themes/utils/breakpoints.d.ts +15 -0
- package/dist/definitions/themes/utils/breakpoints.d.ts.map +1 -0
- package/dist/definitions/tokens/fonts.d.ts +18 -0
- package/dist/definitions/tokens/fonts.d.ts.map +1 -0
- package/dist/definitions/tokens/size.d.ts +11 -0
- package/dist/definitions/tokens/size.d.ts.map +1 -0
- package/dist/definitions/tokens/space.d.ts +16 -0
- package/dist/definitions/tokens/space.d.ts.map +1 -0
- package/dist/index-metro.es.android.js +396 -0
- package/dist/index-metro.es.android.js.map +1 -0
- package/dist/index-metro.es.ios.js +396 -0
- package/dist/index-metro.es.ios.js.map +1 -0
- package/dist/index-node-22.17.cjs.js +405 -0
- package/dist/index-node-22.17.cjs.js.map +1 -0
- package/dist/index-node-22.17.cjs.web.js +405 -0
- package/dist/index-node-22.17.cjs.web.js.map +1 -0
- package/dist/index-node-22.17.es.mjs +395 -0
- package/dist/index-node-22.17.es.mjs.map +1 -0
- package/dist/index-node-22.17.es.web.mjs +395 -0
- package/dist/index-node-22.17.es.web.mjs.map +1 -0
- package/dist/index.es.js +392 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.es.web.js +392 -0
- package/dist/index.es.web.js.map +1 -0
- package/dist/tsbuildinfo +1 -0
- package/package.json +79 -0
- package/src/.eslintrc.json +20 -0
- package/src/components/breakpoints/SwitchBreakpoins.tsx +12 -0
- package/src/components/breakpoints/__snapshots__/breakpoints.stories.tsx.snap +49 -0
- package/src/components/breakpoints/__snapshots_web__/breakpoints.stories.tsx.snap +43 -0
- package/src/components/breakpoints/breakpoints.stories.tsx +45 -0
- package/src/components/breakpoints/hooks/useBreakpointValue.ts +12 -0
- package/src/components/breakpoints/hooks/useCurrentBreakpointName.ts +20 -0
- package/src/components/breakpoints/hooks/useWindowSize.ts +1 -0
- package/src/components/breakpoints/utils/breakpointsUtils.test.ts +85 -0
- package/src/components/breakpoints/utils/breakpointsUtils.ts +28 -0
- package/src/components/primitives/Stack.stories.tsx +62 -0
- package/src/components/primitives/Stacks.ts +19 -0
- package/src/components/primitives/View.stories.tsx +13 -0
- package/src/components/primitives/View.ts +5 -0
- package/src/components/primitives/__snapshots__/Stack.stories.tsx.snap +376 -0
- package/src/components/primitives/__snapshots__/View.stories.tsx.snap +25 -0
- package/src/components/primitives/__snapshots_web__/Stack.stories.tsx.snap +190 -0
- package/src/components/primitives/__snapshots_web__/View.stories.tsx.snap +28 -0
- package/src/components/typography/Typograhy.tsx +130 -0
- package/src/components/typography/Typography.stories.tsx +144 -0
- package/src/components/typography/__snapshots__/Typography.stories.tsx.snap +1471 -0
- package/src/components/typography/__snapshots_web__/Typography.stories.tsx.snap +605 -0
- package/src/components/typography/utils/getTypeAndWeightValues.test.tsx +147 -0
- package/src/components/typography/utils/getTypeAndWeightValues.tsx +32 -0
- package/src/core/BumperDecorator.tsx +11 -0
- package/src/core/BumperProvider.tsx +15 -0
- package/src/index.ts +11 -0
- package/src/story-components/StorySection.tsx +70 -0
- package/src/story-components/StoryTitle.tsx +16 -0
- package/src/tamagui.config.ts +43 -0
- package/src/themes/__snapshots__/light.stories.tsx.snap +2192 -0
- package/src/themes/__snapshots_web__/light.stories.tsx.snap +985 -0
- package/src/themes/light.stories.tsx +38 -0
- package/src/themes/light.ts +59 -0
- package/src/themes/palettes/__snapshots__/deepPurpleColorPalette.stories.tsx.snap +2770 -0
- package/src/themes/palettes/__snapshots_web__/deepPurpleColorPalette.stories.tsx.snap +1213 -0
- package/src/themes/palettes/deepPurpleColorPalette.stories.tsx +37 -0
- package/src/themes/palettes/deepPurpleColorPalette.ts +147 -0
- package/src/themes/utils/breakpoints.ts +15 -0
- package/src/tokens/fonts.ts +95 -0
- package/src/tokens/size.ts +10 -0
- package/src/tokens/space.ts +15 -0
- package/tsconfig.build.json +25 -0
- package/tsconfig.eslint.json +6 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { BODY_VARIANTS, HEADING_VARIANTS, LABEL_VARIANTS } from '../../../tokens/fonts';
|
|
2
|
+
import { getVariantAndWeightValues } from './getTypeAndWeightValues';
|
|
3
|
+
|
|
4
|
+
describe('getVariantAndWeightValues', () => {
|
|
5
|
+
describe('when variant is a body size', () => {
|
|
6
|
+
it.each(BODY_VARIANTS.map((size) => [size, undefined, null, null, { weight: undefined, variant: size }]))(
|
|
7
|
+
'should return weight from prop and variant "%s" when weight prop is undefined and no ancestor values',
|
|
8
|
+
(variant, weight, ancestorWeight, ancestorVariant, expected) => {
|
|
9
|
+
expect(getVariantAndWeightValues(weight, variant, ancestorWeight, ancestorVariant)).toEqual(expected);
|
|
10
|
+
},
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
it('should return weight from prop when defined', () => {
|
|
14
|
+
expect(getVariantAndWeightValues('regular', 'body-l', null, null)).toEqual({
|
|
15
|
+
weight: 'regular',
|
|
16
|
+
variant: 'body-l',
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should return weight from ancestor when weight prop is undefined', () => {
|
|
21
|
+
expect(getVariantAndWeightValues(undefined, 'body-m', 'regular', null)).toEqual({
|
|
22
|
+
weight: 'regular',
|
|
23
|
+
variant: 'body-m',
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should prioritize weight prop over ancestor weight for body sizes', () => {
|
|
28
|
+
expect(getVariantAndWeightValues('bold', 'body-m', 'regular', null)).toEqual({
|
|
29
|
+
weight: 'bold',
|
|
30
|
+
variant: 'body-m',
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('when variant is a heading size', () => {
|
|
36
|
+
it.each(HEADING_VARIANTS.map((size) => [size, undefined, null, null, { weight: 'semibold', variant: size }]))(
|
|
37
|
+
'should return weight "semibold" for heading variant "%s"',
|
|
38
|
+
(variant, weight, ancestorWeight, ancestorVariant, expected) => {
|
|
39
|
+
expect(getVariantAndWeightValues(weight, variant, ancestorWeight, ancestorVariant)).toEqual(expected);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
it('should ignore weight prop for heading sizes and always return semibold', () => {
|
|
44
|
+
expect(getVariantAndWeightValues('regular', 'heading-m', null, null)).toEqual({
|
|
45
|
+
weight: 'semibold',
|
|
46
|
+
variant: 'heading-m',
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should ignore ancestor weight for heading sizes and always return semibold', () => {
|
|
51
|
+
expect(getVariantAndWeightValues(undefined, 'heading-m', 'bold', null)).toEqual({
|
|
52
|
+
weight: 'semibold',
|
|
53
|
+
variant: 'heading-m',
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('when variant is a label size', () => {
|
|
59
|
+
it.each(LABEL_VARIANTS.map((size) => [size, undefined, null, null, { weight: 'semibold', variant: size }]))(
|
|
60
|
+
'should return weight "semibold" for label variant "%s"',
|
|
61
|
+
(variant, weight, ancestorWeight, ancestorVariant, expected) => {
|
|
62
|
+
expect(getVariantAndWeightValues(weight, variant, ancestorWeight, ancestorVariant)).toEqual(expected);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
it('should ignore weight prop for label sizes and always return semibold', () => {
|
|
67
|
+
expect(getVariantAndWeightValues('regular', 'label-m', null, null)).toEqual({
|
|
68
|
+
weight: 'semibold',
|
|
69
|
+
variant: 'label-m',
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should ignore ancestor weight for label sizes and always return semibold', () => {
|
|
74
|
+
expect(getVariantAndWeightValues(undefined, 'label-m', 'bold', null)).toEqual({
|
|
75
|
+
weight: 'semibold',
|
|
76
|
+
variant: 'label-m',
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('when variant comes from ancestor', () => {
|
|
82
|
+
it('should use ancestor variant when variant prop is undefined', () => {
|
|
83
|
+
expect(getVariantAndWeightValues(undefined, undefined, null, 'body-m')).toEqual({
|
|
84
|
+
weight: undefined,
|
|
85
|
+
variant: 'body-m',
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should prioritize variant prop over ancestor type', () => {
|
|
90
|
+
expect(getVariantAndWeightValues(undefined, 'body-l', null, 'body-m')).toEqual({
|
|
91
|
+
weight: undefined,
|
|
92
|
+
variant: 'body-l',
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should return semibold weight when ancestor variant is a heading', () => {
|
|
97
|
+
expect(getVariantAndWeightValues(undefined, undefined, null, 'heading-m')).toEqual({
|
|
98
|
+
weight: 'semibold',
|
|
99
|
+
variant: 'heading-m',
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should return semibold weight when ancestor variant is a label', () => {
|
|
104
|
+
expect(getVariantAndWeightValues(undefined, undefined, null, 'label-m')).toEqual({
|
|
105
|
+
weight: 'semibold',
|
|
106
|
+
variant: 'label-m',
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should use ancestor weight when ancestor variant is a body size', () => {
|
|
111
|
+
expect(getVariantAndWeightValues(undefined, undefined, 'bold', 'body-m')).toEqual({
|
|
112
|
+
weight: 'bold',
|
|
113
|
+
variant: 'body-m',
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('when no variant is provided', () => {
|
|
119
|
+
it('should return weight from prop and undefined variant when no ancestor values', () => {
|
|
120
|
+
expect(getVariantAndWeightValues('regular', undefined, null, null)).toEqual({
|
|
121
|
+
weight: 'regular',
|
|
122
|
+
variant: undefined,
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should return weight from prop and undefined variant when ancestor variant is null', () => {
|
|
127
|
+
expect(getVariantAndWeightValues('bold', undefined, null, null)).toEqual({
|
|
128
|
+
weight: 'bold',
|
|
129
|
+
variant: undefined,
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should return undefined weight when weight prop is undefined and no variant', () => {
|
|
134
|
+
expect(getVariantAndWeightValues(undefined, undefined, null, null)).toEqual({
|
|
135
|
+
weight: undefined,
|
|
136
|
+
variant: undefined,
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('should ignore ancestor weight when no variant is provided', () => {
|
|
141
|
+
expect(getVariantAndWeightValues(undefined, undefined, 'bold', null)).toEqual({
|
|
142
|
+
weight: undefined,
|
|
143
|
+
variant: undefined,
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FontVariants } from '../../../tokens/fonts';
|
|
2
|
+
import { BODY_VARIANTS } from '../../../tokens/fonts';
|
|
3
|
+
import type {
|
|
4
|
+
InternalTypographyProps,
|
|
5
|
+
TypographyTextProps,
|
|
6
|
+
TypographyVariantContextValue,
|
|
7
|
+
TypographyWeightContextValue,
|
|
8
|
+
} from '../Typograhy';
|
|
9
|
+
|
|
10
|
+
interface VariantAndWeightValues {
|
|
11
|
+
weight: InternalTypographyProps['weight'] | undefined;
|
|
12
|
+
variant: FontVariants | undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getVariantAndWeightValues(
|
|
16
|
+
weightProp: TypographyTextProps['weight'],
|
|
17
|
+
variantProp: TypographyTextProps['variant'],
|
|
18
|
+
typographyWeightAncestorValue: TypographyWeightContextValue,
|
|
19
|
+
typographyVariantAncestorValue: TypographyVariantContextValue,
|
|
20
|
+
): VariantAndWeightValues {
|
|
21
|
+
const computedVariant = variantProp || typographyVariantAncestorValue || undefined;
|
|
22
|
+
|
|
23
|
+
if (computedVariant) {
|
|
24
|
+
if ((BODY_VARIANTS as readonly string[]).includes(computedVariant)) {
|
|
25
|
+
const computedWeight = weightProp || typographyWeightAncestorValue || undefined;
|
|
26
|
+
return { weight: computedWeight, variant: computedVariant };
|
|
27
|
+
}
|
|
28
|
+
return { weight: 'semibold', variant: computedVariant };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { weight: weightProp, variant: undefined };
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { makeDecorator } from '@storybook/addons';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { BumperProvider } from './BumperProvider';
|
|
4
|
+
|
|
5
|
+
export const BumperDecorator = makeDecorator({
|
|
6
|
+
name: 'BumperDecorator',
|
|
7
|
+
parameterName: 'bumper',
|
|
8
|
+
wrapper: (storyFn, context) => {
|
|
9
|
+
return <BumperProvider>{storyFn(context) as ReactNode}</BumperProvider>;
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TamaguiProvider } from '@tamagui/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { config } from '../tamagui.config';
|
|
4
|
+
|
|
5
|
+
export interface BumperProviderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function BumperProvider({ children }: BumperProviderProps): ReactNode {
|
|
10
|
+
return (
|
|
11
|
+
<TamaguiProvider config={config} defaultTheme="light">
|
|
12
|
+
{children}
|
|
13
|
+
</TamaguiProvider>
|
|
14
|
+
);
|
|
15
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { BumperDecorator } from './core/BumperDecorator';
|
|
2
|
+
export { BumperProvider } from './core/BumperProvider';
|
|
3
|
+
|
|
4
|
+
// Breakpoints
|
|
5
|
+
export { useBreakpointValue } from './components/breakpoints/hooks/useBreakpointValue';
|
|
6
|
+
export { useCurrentBreakpointName } from './components/breakpoints/hooks/useCurrentBreakpointName';
|
|
7
|
+
export { useWindowSize } from './components/breakpoints/hooks/useWindowSize';
|
|
8
|
+
export type { SwitchBreakpointsProps } from './components/breakpoints/SwitchBreakpoins';
|
|
9
|
+
export { SwitchBreakpoints } from './components/breakpoints/SwitchBreakpoins';
|
|
10
|
+
export type { ValueForBreakpoint } from './components/breakpoints/utils/breakpointsUtils';
|
|
11
|
+
export { getValueForBreakpoint } from './components/breakpoints/utils/breakpointsUtils';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { styled } from '@tamagui/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { Except } from 'type-fest';
|
|
4
|
+
import type { VStackProps } from '../components/primitives/Stacks';
|
|
5
|
+
import { VStack } from '../components/primitives/Stacks';
|
|
6
|
+
import { StoryTitle } from './StoryTitle';
|
|
7
|
+
|
|
8
|
+
const InternalStorySection = styled(VStack, {
|
|
9
|
+
paddingVertical: '$4',
|
|
10
|
+
paddingHorizontal: '$4',
|
|
11
|
+
variants: {
|
|
12
|
+
withBackground: {
|
|
13
|
+
true: {
|
|
14
|
+
backgroundColor: '$content.base.hi',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} as const,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type StorySectionProps = Except<VStackProps, 'marginBottom'> & {
|
|
21
|
+
title: ReactNode;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
level?: 1 | 2;
|
|
24
|
+
/** @private */
|
|
25
|
+
internalIsDemoSection?: boolean;
|
|
26
|
+
withBackground?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function StorySection({
|
|
30
|
+
title,
|
|
31
|
+
children,
|
|
32
|
+
level = 1,
|
|
33
|
+
internalIsDemoSection,
|
|
34
|
+
withBackground,
|
|
35
|
+
...props
|
|
36
|
+
}: StorySectionProps): ReactNode {
|
|
37
|
+
if (title === 'Demo' && !internalIsDemoSection) throw new Error('Use StorySection.Demo instead');
|
|
38
|
+
return (
|
|
39
|
+
<InternalStorySection {...props}>
|
|
40
|
+
<StoryTitle level={(level + 1) as 2 | 3}>{title}</StoryTitle>
|
|
41
|
+
{children}
|
|
42
|
+
</InternalStorySection>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type DemoSectionProps = Except<StorySectionProps, 'paddingBottom' | 'title' | 'internalIsDemoSection'> & {
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
StorySection.Demo = function DemoSection({ children, ...props }: DemoSectionProps): ReactNode {
|
|
51
|
+
return (
|
|
52
|
+
<StorySection internalIsDemoSection title="Demo" paddingBottom="$12" {...props}>
|
|
53
|
+
{children}
|
|
54
|
+
</StorySection>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
StorySection.SubSection = function SubSection({
|
|
59
|
+
title,
|
|
60
|
+
children,
|
|
61
|
+
withBackground,
|
|
62
|
+
...props
|
|
63
|
+
}: StorySectionProps): ReactNode {
|
|
64
|
+
return (
|
|
65
|
+
<InternalStorySection withBackground={withBackground} {...props}>
|
|
66
|
+
<StoryTitle level={3}>{title}</StoryTitle>
|
|
67
|
+
{children}
|
|
68
|
+
</InternalStorySection>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { styled } from '@tamagui/core';
|
|
2
|
+
import { Typography } from '../components/typography/Typograhy';
|
|
3
|
+
|
|
4
|
+
export const StoryTitle = styled(Typography.Text, {
|
|
5
|
+
variants: {
|
|
6
|
+
level: {
|
|
7
|
+
1: { variant: 'heading-xl', marginBottom: '$8' },
|
|
8
|
+
2: { variant: 'heading-l', marginBottom: '$4' },
|
|
9
|
+
3: { variant: 'heading-m', marginBottom: '$4' },
|
|
10
|
+
},
|
|
11
|
+
} as const,
|
|
12
|
+
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
level: 1,
|
|
15
|
+
},
|
|
16
|
+
} as const);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createTamagui, createTokens } from '@tamagui/core';
|
|
2
|
+
import { light } from './themes/light';
|
|
3
|
+
import { BreakpointNameEnum, breakpoints } from './themes/utils/breakpoints';
|
|
4
|
+
import { fonts } from './tokens/fonts';
|
|
5
|
+
import { sizeTokens } from './tokens/size';
|
|
6
|
+
import { spaceTokens } from './tokens/space';
|
|
7
|
+
|
|
8
|
+
const tokens = createTokens({
|
|
9
|
+
color: {},
|
|
10
|
+
space: spaceTokens,
|
|
11
|
+
size: sizeTokens,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const config = createTamagui({
|
|
15
|
+
tokens,
|
|
16
|
+
fonts: {
|
|
17
|
+
GTStandard: fonts,
|
|
18
|
+
},
|
|
19
|
+
themes: {
|
|
20
|
+
light,
|
|
21
|
+
},
|
|
22
|
+
media: {
|
|
23
|
+
[BreakpointNameEnum.BASE]: { minWidth: breakpoints[BreakpointNameEnum.BASE] },
|
|
24
|
+
[BreakpointNameEnum.SMALL]: { minWidth: breakpoints[BreakpointNameEnum.SMALL] },
|
|
25
|
+
[BreakpointNameEnum.MEDIUM]: { minWidth: breakpoints[BreakpointNameEnum.MEDIUM] },
|
|
26
|
+
[BreakpointNameEnum.LARGE]: { minWidth: breakpoints[BreakpointNameEnum.LARGE] },
|
|
27
|
+
[BreakpointNameEnum.WIDE]: { minWidth: breakpoints[BreakpointNameEnum.WIDE] },
|
|
28
|
+
},
|
|
29
|
+
settings: {
|
|
30
|
+
allowedStyleValues: 'strict',
|
|
31
|
+
disableSSR: true,
|
|
32
|
+
styleCompat: 'react-native',
|
|
33
|
+
autocompleteSpecificTokens: true,
|
|
34
|
+
debug: false,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
type Conf = typeof config;
|
|
39
|
+
|
|
40
|
+
// make imports typed
|
|
41
|
+
declare module '@tamagui/core' {
|
|
42
|
+
interface TamaguiCustomConfig extends Conf {}
|
|
43
|
+
}
|