@ornikar/bumper 3.9.1 → 3.10.1
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 +24 -0
- package/dist/definitions/shared/storybook/StorySection.d.ts.map +1 -1
- package/dist/definitions/shared/storybook/StoryTitle.d.ts.map +1 -1
- package/dist/definitions/system/actions/Button/Button.d.ts +4 -4
- package/dist/definitions/system/actions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/system/actions/IconButton/IconButton.d.ts.map +1 -1
- package/dist/definitions/system/content/icon/Icon.d.ts.map +1 -1
- package/dist/definitions/system/content/typography/Typography.d.ts +15 -10
- package/dist/definitions/system/content/typography/Typography.d.ts.map +1 -1
- package/dist/definitions/system/content/typography/TypographyLink.d.ts +1 -0
- package/dist/definitions/system/content/typography/TypographyLink.d.ts.map +1 -1
- package/dist/definitions/system/core/tokens/palettes/deepPurpleColorPalette.d.ts +70 -69
- package/dist/definitions/system/core/tokens/palettes/deepPurpleColorPalette.d.ts.map +1 -1
- package/dist/definitions/system/loading/loader/Loader.d.ts +2 -2
- package/dist/definitions/system/loading/loader/Loader.d.ts.map +1 -1
- package/dist/definitions/system/loading/loader/LoaderBackgroundCircle.d.ts +2 -1
- package/dist/definitions/system/loading/loader/LoaderBackgroundCircle.d.ts.map +1 -1
- package/dist/definitions/system/loading/loader/LoaderCircleWrapper.d.ts +2 -1
- package/dist/definitions/system/loading/loader/LoaderCircleWrapper.d.ts.map +1 -1
- package/dist/definitions/system/types.d.ts +38 -1
- package/dist/definitions/system/types.d.ts.map +1 -1
- package/dist/definitions/tamagui.config.d.ts +142 -2
- package/dist/definitions/tamagui.config.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +86 -84
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +86 -84
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.22.cjs.js +86 -84
- package/dist/index-node-22.22.cjs.js.map +1 -1
- package/dist/index-node-22.22.cjs.web.js +86 -84
- package/dist/index-node-22.22.cjs.web.js.map +1 -1
- package/dist/index-node-22.22.es.mjs +86 -84
- package/dist/index-node-22.22.es.mjs.map +1 -1
- package/dist/index-node-22.22.es.web.mjs +86 -84
- package/dist/index-node-22.22.es.web.mjs.map +1 -1
- package/dist/index.es.js +86 -84
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +86 -84
- package/dist/index.es.web.js.map +1 -1
- package/dist/storybook-metro.es.android.js +81 -80
- package/dist/storybook-metro.es.android.js.map +1 -1
- package/dist/storybook-metro.es.ios.js +81 -80
- package/dist/storybook-metro.es.ios.js.map +1 -1
- package/dist/storybook-node-22.22.cjs.js +81 -80
- package/dist/storybook-node-22.22.cjs.js.map +1 -1
- package/dist/storybook-node-22.22.cjs.web.js +81 -80
- package/dist/storybook-node-22.22.cjs.web.js.map +1 -1
- package/dist/storybook-node-22.22.es.mjs +81 -80
- package/dist/storybook-node-22.22.es.mjs.map +1 -1
- package/dist/storybook-node-22.22.es.web.mjs +81 -80
- package/dist/storybook-node-22.22.es.web.mjs.map +1 -1
- package/dist/storybook.es.js +81 -80
- package/dist/storybook.es.js.map +1 -1
- package/dist/storybook.es.web.js +81 -80
- package/dist/storybook.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/docs/migration/Typography.md +123 -35
- package/package.json +2 -2
- package/src/.eslintrc.json +2 -5
- package/src/shared/storybook/StorySection.tsx +8 -1
- package/src/shared/storybook/StoryTitle.tsx +8 -2
- package/src/system/actions/Button/Button.mdx +1 -1
- package/src/system/actions/Button/Button.tsx +5 -3
- package/src/system/actions/Button/__snapshots__/Button.features.stories.tsx.snap +10 -10
- package/src/system/actions/Button/__snapshots_web__/Button.features.stories.tsx.snap +2 -2
- package/src/system/actions/Button/utils/contentColor.ts +1 -1
- package/src/system/actions/IconButton/IconButton.tsx +3 -2
- package/src/system/actions/IconButton/__snapshots__/IconButton.features.stories.tsx.snap +10 -10
- package/src/system/actions/IconButton/__snapshots_web__/IconButton.features.stories.tsx.snap +2 -2
- package/src/system/content/icon/Icon.tsx +7 -2
- package/src/system/content/typography/Typography.features.stories.tsx +2 -2
- package/src/system/content/typography/Typography.stories.tsx +2 -2
- package/src/system/content/typography/Typography.tsx +21 -19
- package/src/system/content/typography/TypographyLink.features.stories.tsx +2 -2
- package/src/system/content/typography/TypographyLink.stories.tsx +2 -2
- package/src/system/content/typography/TypographyLink.tsx +4 -2
- package/src/system/core/themes/light/__snapshots__/light.stories.tsx.snap +7 -7
- package/src/system/core/themes/light/__snapshots_web__/light.stories.tsx.snap +7 -7
- package/src/system/core/themes/light/light.ts +73 -73
- package/src/system/core/tokens/palettes/__snapshots__/deepPurpleColorPalette.stories.tsx.snap +141 -70
- package/src/system/core/tokens/palettes/__snapshots_web__/deepPurpleColorPalette.stories.tsx.snap +91 -70
- package/src/system/core/tokens/palettes/deepPurpleColorPalette.ts +9 -8
- package/src/system/loading/loader/Loader.tsx +16 -15
- package/src/system/loading/loader/LoaderBackgroundCircle.tsx +8 -1
- package/src/system/loading/loader/LoaderCircleWrapper.tsx +11 -1
- package/src/system/types.ts +51 -2
- package/src/tamagui.config.ts +2 -1
|
@@ -15,7 +15,7 @@ interface ColorScaleKeysMap {
|
|
|
15
15
|
| 'green-apple'
|
|
16
16
|
| 'blue-electric'
|
|
17
17
|
| 'blue-sky';
|
|
18
|
-
grey: 0 | 1 | 2 | 3 | 5 | 7 | 9;
|
|
18
|
+
grey: 0 | 1 | 2 | 3 | 4 | 5 | 7 | 9;
|
|
19
19
|
blue: 1 | 2 | 4 | 6 | 7;
|
|
20
20
|
green: 1 | 2 | 6 | 7;
|
|
21
21
|
yellow: 1 | 2 | 6 | 7;
|
|
@@ -34,7 +34,7 @@ type ColorScales = {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
type CreateTokens<K extends keyof ColorScaleKeysMap> = {
|
|
37
|
-
[Key in ColorScaleKeysMap[K] as
|
|
37
|
+
[Key in ColorScaleKeysMap[K] as `palette.${K}.${Key}`]: string;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
type ColorScaleTokens = UnionToIntersection<
|
|
@@ -84,8 +84,9 @@ export const colorScales: ColorScales = {
|
|
|
84
84
|
grey: createColorScale({
|
|
85
85
|
0: '#ffffff',
|
|
86
86
|
1: '#ECECEC',
|
|
87
|
-
2: '#
|
|
88
|
-
3: '#
|
|
87
|
+
2: '#DCDCDC',
|
|
88
|
+
3: '#BABABA',
|
|
89
|
+
4: '#A8A8A8',
|
|
89
90
|
5: '#838383',
|
|
90
91
|
7: '#505050',
|
|
91
92
|
9: '#101010',
|
|
@@ -147,7 +148,7 @@ const transformColorScalesToTokens = (): ColorScaleTokens => {
|
|
|
147
148
|
return Object.fromEntries(
|
|
148
149
|
Object.entries(colorScales).flatMap(([colorName, colorScale]) => {
|
|
149
150
|
return Object.entries(colorScale).map(([scaleNumber, colorValue]) => {
|
|
150
|
-
return [
|
|
151
|
+
return [`palette.${colorName}.${scaleNumber}`, colorValue];
|
|
151
152
|
});
|
|
152
153
|
}),
|
|
153
154
|
) as ColorScaleTokens;
|
|
@@ -155,7 +156,7 @@ const transformColorScalesToTokens = (): ColorScaleTokens => {
|
|
|
155
156
|
|
|
156
157
|
export const deepPurpleColorPalette = {
|
|
157
158
|
...transformColorScalesToTokens(),
|
|
158
|
-
white: '#FFFFFF',
|
|
159
|
-
black: '#000000',
|
|
160
|
-
transparent: 'transparent',
|
|
159
|
+
'palette.white': '#FFFFFF',
|
|
160
|
+
'palette.black': '#000000',
|
|
161
|
+
'palette.transparent': 'transparent',
|
|
161
162
|
};
|
|
@@ -2,8 +2,9 @@ import { styled, useStyle } from '@tamagui/core';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
|
5
|
+
import type { ViewProps } from '../../core/primitives/View';
|
|
5
6
|
import { View } from '../../core/primitives/View';
|
|
6
|
-
import type { TamaguiMediaProps } from '../../types';
|
|
7
|
+
import type { PropsToTamaguiVariants, TamaguiMediaProps } from '../../types';
|
|
7
8
|
import { LoaderBackgroundCircle } from './LoaderBackgroundCircle';
|
|
8
9
|
import { LoaderCircleWrapper } from './LoaderCircleWrapper';
|
|
9
10
|
import { LoaderForegroundCircle } from './LoaderForegroundCircle';
|
|
@@ -12,19 +13,7 @@ import { LOADER_ANIMATION, LOADER_SIZE_CONFIG } from './loaderConfig';
|
|
|
12
13
|
|
|
13
14
|
const { icon, page } = LOADER_SIZE_CONFIG;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
name: 'Loader',
|
|
17
|
-
position: 'relative',
|
|
18
|
-
rotate: '-90deg',
|
|
19
|
-
variants: {
|
|
20
|
-
size: {
|
|
21
|
-
icon: { width: icon.size, height: icon.size },
|
|
22
|
-
page: { width: page.size, height: page.size },
|
|
23
|
-
},
|
|
24
|
-
} as const,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
interface InternalLoaderProps {
|
|
16
|
+
interface InternalLoaderWithoutMediaProps {
|
|
28
17
|
/** The size of the loader. `'icon'` renders a small 20px loader, `'page'` renders a larger 48px loader.
|
|
29
18
|
* @default 'page'
|
|
30
19
|
* */
|
|
@@ -37,7 +26,19 @@ interface InternalLoaderProps {
|
|
|
37
26
|
testID?: string;
|
|
38
27
|
}
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
const LoaderContainer = styled(View, {
|
|
30
|
+
name: 'Loader',
|
|
31
|
+
position: 'relative',
|
|
32
|
+
rotate: '-90deg',
|
|
33
|
+
variants: {
|
|
34
|
+
size: {
|
|
35
|
+
icon: { width: icon.size, height: icon.size },
|
|
36
|
+
page: { width: page.size, height: page.size },
|
|
37
|
+
},
|
|
38
|
+
} as const satisfies PropsToTamaguiVariants<InternalLoaderWithoutMediaProps, ViewProps>,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export type LoaderProps = TamaguiMediaProps<InternalLoaderWithoutMediaProps>;
|
|
41
42
|
|
|
42
43
|
export function Loader({ size = 'page', isOnContrasted = false, testID }: LoaderProps): ReactNode {
|
|
43
44
|
const backgroundStyle = useStyle({ color: '$border.base.mid' });
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { styled } from '@tamagui/core';
|
|
2
|
+
import type { CircleProps } from 'react-native-svg';
|
|
2
3
|
import { Circle } from 'react-native-svg';
|
|
4
|
+
import type { PropsToTamaguiVariants } from '../../types';
|
|
5
|
+
import type { LoaderSize } from './loaderConfig';
|
|
3
6
|
import { LOADER_SIZE_CONFIG } from './loaderConfig';
|
|
4
7
|
|
|
5
8
|
const { icon, page } = LOADER_SIZE_CONFIG;
|
|
6
9
|
|
|
10
|
+
interface LoaderBackgroundCircleVariantProps {
|
|
11
|
+
size?: LoaderSize;
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
export const LoaderBackgroundCircle = styled(Circle, {
|
|
8
15
|
fill: 'none',
|
|
9
16
|
variants: {
|
|
@@ -11,5 +18,5 @@ export const LoaderBackgroundCircle = styled(Circle, {
|
|
|
11
18
|
icon: { strokeWidth: icon.strokeWidth, cx: icon.center, cy: icon.center, r: icon.radius },
|
|
12
19
|
page: { strokeWidth: page.strokeWidth, cx: page.center, cy: page.center, r: page.radius },
|
|
13
20
|
},
|
|
14
|
-
} as const,
|
|
21
|
+
} as const satisfies PropsToTamaguiVariants<LoaderBackgroundCircleVariantProps, CircleProps>,
|
|
15
22
|
});
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { styled } from '@tamagui/core';
|
|
2
|
+
import type { SvgProps } from 'react-native-svg';
|
|
2
3
|
import Svg from 'react-native-svg';
|
|
4
|
+
import type { ViewProps } from '../../core/primitives/View';
|
|
5
|
+
import type { PropsToTamaguiVariants } from '../../types';
|
|
6
|
+
import type { LoaderSize } from './loaderConfig';
|
|
3
7
|
import { LOADER_SIZE_CONFIG } from './loaderConfig';
|
|
4
8
|
|
|
5
9
|
const { icon, page } = LOADER_SIZE_CONFIG;
|
|
6
10
|
|
|
11
|
+
interface LoaderCircleWrapperVariantProps {
|
|
12
|
+
size?: LoaderSize;
|
|
13
|
+
isForeground?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
export const LoaderCircleWrapper = styled(Svg, {
|
|
8
17
|
variants: {
|
|
9
18
|
size: {
|
|
@@ -14,6 +23,7 @@ export const LoaderCircleWrapper = styled(Svg, {
|
|
|
14
23
|
true: {
|
|
15
24
|
position: 'absolute',
|
|
16
25
|
},
|
|
26
|
+
false: {},
|
|
17
27
|
},
|
|
18
|
-
} as const,
|
|
28
|
+
} as const satisfies PropsToTamaguiVariants<LoaderCircleWrapperVariantProps, SvgProps & ViewProps>,
|
|
19
29
|
});
|
package/src/system/types.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
// eslint-disable-next-line no-restricted-imports
|
|
3
|
+
PropsWithoutMediaStyles as InternalPropsWithoutMediaStyles,
|
|
4
|
+
TokensParsed,
|
|
5
|
+
WithMediaProps,
|
|
6
|
+
} from '@tamagui/core';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* Rewrite of Tamagui PropsWithoutMediaStyles to make all responsive props optionnal.
|
|
@@ -17,3 +21,48 @@ export type PropsWithoutMediaStyles<A> = {
|
|
|
17
21
|
* pass breakpoint-specific prop objects alongside regular props.
|
|
18
22
|
*/
|
|
19
23
|
export type TamaguiMediaProps<A> = PropsWithoutMediaStyles<A> & WithMediaProps<InternalPropsWithoutMediaStyles<A>>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A list of keys to ignore as variants.
|
|
27
|
+
* If you do not want to ignore keys globally, you should instead use the third param of the {@link PropsToTamaguiVariants}.
|
|
28
|
+
*/
|
|
29
|
+
export type DefaultIgnoredKeys = 'children';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Maps a component's variant-prop interface `T` to a Tamagui `variants` config whose entries produce
|
|
33
|
+
* style objects of type `V`.
|
|
34
|
+
*
|
|
35
|
+
* For each key `K` of `T`, the entry must be either:
|
|
36
|
+
* - a record keyed by the prop's literal values (with `boolean` props normalised to `'true' | 'false'`),
|
|
37
|
+
* where each value is a style `V` or a function returning `V`, or
|
|
38
|
+
* - a function that receives the raw prop value and a {@link VariantGoodiesParams} context and returns
|
|
39
|
+
* a style `V` (or `undefined`).
|
|
40
|
+
*
|
|
41
|
+
* Pass a union of keys as `IgnoredKeys` to skip props that should never be variants (e.g.
|
|
42
|
+
* event handlers). Ignored keys are stripped only from both the top-level map, not from `params.props`.
|
|
43
|
+
*
|
|
44
|
+
* Intended to be used with `satisfies` on the `variants` field of a `styled(...)` call so that the
|
|
45
|
+
* config is inferred `as const` while still being checked against the component's prop types, e.g.
|
|
46
|
+
* `{ ... } as const satisfies PropsToTamaguiVariants<MyVariantProps, ViewProps, 'size'>`.
|
|
47
|
+
*/
|
|
48
|
+
export type PropsToTamaguiVariants<T, V, IgnoredKeys extends keyof T = never> = {
|
|
49
|
+
[K in keyof T as K extends IgnoredKeys | Extract<keyof T, DefaultIgnoredKeys> ? never : K]: NonNullable<
|
|
50
|
+
T[K]
|
|
51
|
+
> extends boolean
|
|
52
|
+
? Record<'true' | 'false', V | ((value: boolean | string | number, params: VariantGoodiesParams<T>) => V)>
|
|
53
|
+
: NonNullable<T[K]> extends PropertyKey
|
|
54
|
+
? Record<NonNullable<T[K]>, V> | ((value: NonNullable<T[K]>, params: VariantGoodiesParams<T>) => V | undefined)
|
|
55
|
+
: never;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Second argument passed to function-form variants declared via {@link PropsToTamaguiVariants}.
|
|
60
|
+
*
|
|
61
|
+
* - `props`: the flattened props of the instance being styled, so a variant can branch on sibling
|
|
62
|
+
* props (e.g. read `disabled` or `isOnContrasted` while resolving `type`).
|
|
63
|
+
* - `tokens`: Tamagui's parsed token map, for resolving design tokens from inside the variant.
|
|
64
|
+
*/
|
|
65
|
+
interface VariantGoodiesParams<T> {
|
|
66
|
+
props: T;
|
|
67
|
+
tokens: TokensParsed;
|
|
68
|
+
}
|
package/src/tamagui.config.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from './system/core/tokens/GTStandardNarrowFont';
|
|
17
17
|
import { BreakpointNameEnum, breakpoints } from './system/core/tokens/breakpoints';
|
|
18
18
|
import { bumperIconTokens } from './system/core/tokens/bumperIcon';
|
|
19
|
+
import { deepPurpleColorPalette } from './system/core/tokens/palettes/deepPurpleColorPalette';
|
|
19
20
|
import { radiusTokens } from './system/core/tokens/radius';
|
|
20
21
|
import { sizeTokens } from './system/core/tokens/size';
|
|
21
22
|
import { spaceTokens } from './system/core/tokens/space';
|
|
@@ -39,7 +40,7 @@ export const GTStandardNarrowFont = createFont({
|
|
|
39
40
|
});
|
|
40
41
|
|
|
41
42
|
const tokens = createTokens({
|
|
42
|
-
color:
|
|
43
|
+
color: deepPurpleColorPalette,
|
|
43
44
|
space: spaceTokens,
|
|
44
45
|
size: sizeTokens,
|
|
45
46
|
radius: radiusTokens,
|