@ornikar/bumper 3.11.0 → 3.12.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 +11 -0
- package/dist/definitions/index.d.ts +2 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/system/dataDisplays/Sticker/Sticker.d.ts +18 -0
- package/dist/definitions/system/dataDisplays/Sticker/Sticker.d.ts.map +1 -0
- package/dist/definitions/system/dataDisplays/Sticker/components/StickerLabel.d.ts +7 -0
- package/dist/definitions/system/dataDisplays/Sticker/components/StickerLabel.d.ts.map +1 -0
- package/dist/definitions/system/dataDisplays/Sticker/context.d.ts +3 -0
- package/dist/definitions/system/dataDisplays/Sticker/context.d.ts.map +1 -0
- package/dist/definitions/system/dataDisplays/Sticker/types.d.ts +24 -0
- package/dist/definitions/system/dataDisplays/Sticker/types.d.ts.map +1 -0
- package/dist/definitions/system/layout/divider/Divider.d.ts.map +1 -1
- package/dist/definitions/system/types.d.ts +10 -9
- package/dist/definitions/system/types.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +146 -9
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +146 -9
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.22.cjs.js +145 -6
- package/dist/index-node-22.22.cjs.js.map +1 -1
- package/dist/index-node-22.22.cjs.web.js +145 -6
- package/dist/index-node-22.22.cjs.web.js.map +1 -1
- package/dist/index-node-22.22.es.mjs +145 -7
- package/dist/index-node-22.22.es.mjs.map +1 -1
- package/dist/index-node-22.22.es.web.mjs +145 -7
- package/dist/index-node-22.22.es.web.mjs.map +1 -1
- package/dist/index.es.js +141 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +141 -9
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/docs/migration/Sticker.md +222 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/system/dataDisplays/Sticker/Sticker.features.stories.tsx +50 -0
- package/src/system/dataDisplays/Sticker/Sticker.mdx +38 -0
- package/src/system/dataDisplays/Sticker/Sticker.stories.tsx +49 -0
- package/src/system/dataDisplays/Sticker/Sticker.tsx +52 -0
- package/src/system/dataDisplays/Sticker/__snapshots__/Sticker.features.stories.tsx.snap +747 -0
- package/src/system/dataDisplays/Sticker/__snapshots__/Sticker.stories.tsx.snap +52 -0
- package/src/system/dataDisplays/Sticker/__snapshots_web__/Sticker.features.stories.tsx.snap +294 -0
- package/src/system/dataDisplays/Sticker/__snapshots_web__/Sticker.stories.tsx.snap +35 -0
- package/src/system/dataDisplays/Sticker/components/StickerLabel.tsx +33 -0
- package/src/system/dataDisplays/Sticker/context.ts +10 -0
- package/src/system/dataDisplays/Sticker/types.ts +61 -0
- package/src/system/layout/divider/Divider.tsx +7 -2
- package/src/system/layout/divider/__snapshots_web__/Divider.features.stories.tsx.snap +7 -0
- package/src/system/layout/divider/__snapshots_web__/Divider.stories.tsx.snap +1 -0
- package/src/system/types.ts +26 -14
package/src/system/types.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
TokensParsed,
|
|
5
5
|
WithMediaProps,
|
|
6
6
|
} from '@tamagui/core';
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Rewrite of Tamagui PropsWithoutMediaStyles to make all responsive props optionnal.
|
|
@@ -29,14 +30,14 @@ export type TamaguiMediaProps<A> = PropsWithoutMediaStyles<A> & WithMediaProps<I
|
|
|
29
30
|
export type DefaultIgnoredKeys = 'children';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
* Maps a component's variant-prop interface `
|
|
33
|
-
* style objects of type `
|
|
33
|
+
* Maps a component's variant-prop interface `VariantProps` to a Tamagui `variants` config whose
|
|
34
|
+
* entries produce style objects of type `StyleProps`.
|
|
34
35
|
*
|
|
35
|
-
* For each key `K` of `
|
|
36
|
+
* For each key `K` of `VariantProps`, the entry must be either:
|
|
36
37
|
* - a record keyed by the prop's literal values (with `boolean` props normalised to `'true' | 'false'`),
|
|
37
|
-
* where each value is a
|
|
38
|
+
* where each value is a `StyleProps` or a function returning `StyleProps`, or
|
|
38
39
|
* - a function that receives the raw prop value and a {@link VariantGoodiesParams} context and returns
|
|
39
|
-
* a
|
|
40
|
+
* a `StyleProps` (or `undefined`).
|
|
40
41
|
*
|
|
41
42
|
* Pass a union of keys as `IgnoredKeys` to skip props that should never be variants (e.g.
|
|
42
43
|
* event handlers). Ignored keys are stripped only from both the top-level map, not from `params.props`.
|
|
@@ -45,13 +46,24 @@ export type DefaultIgnoredKeys = 'children';
|
|
|
45
46
|
* config is inferred `as const` while still being checked against the component's prop types, e.g.
|
|
46
47
|
* `{ ... } as const satisfies PropsToTamaguiVariants<MyVariantProps, ViewProps, 'size'>`.
|
|
47
48
|
*/
|
|
48
|
-
export type PropsToTamaguiVariants<
|
|
49
|
-
[K in keyof
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
? Record<
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
export type PropsToTamaguiVariants<VariantProps, StyleProps, IgnoredKeys extends keyof VariantProps = never> = {
|
|
50
|
+
[K in keyof VariantProps as K extends IgnoredKeys | Extract<keyof VariantProps, DefaultIgnoredKeys>
|
|
51
|
+
? never
|
|
52
|
+
: K]: NonNullable<VariantProps[K]> extends boolean
|
|
53
|
+
? Record<
|
|
54
|
+
'true' | 'false',
|
|
55
|
+
| StyleProps
|
|
56
|
+
| ((value: boolean | string | number, params: VariantGoodiesParams<VariantProps & StyleProps>) => StyleProps)
|
|
57
|
+
>
|
|
58
|
+
: NonNullable<VariantProps[K]> extends PropertyKey
|
|
59
|
+
?
|
|
60
|
+
| Record<NonNullable<VariantProps[K]>, StyleProps>
|
|
61
|
+
| ((
|
|
62
|
+
value: NonNullable<VariantProps[K]>,
|
|
63
|
+
params: VariantGoodiesParams<VariantProps & StyleProps>,
|
|
64
|
+
) => StyleProps | undefined)
|
|
65
|
+
: NonNullable<VariantProps[K]> extends ReactNode
|
|
66
|
+
? StyleProps
|
|
55
67
|
: never;
|
|
56
68
|
};
|
|
57
69
|
|
|
@@ -62,7 +74,7 @@ export type PropsToTamaguiVariants<T, V, IgnoredKeys extends keyof T = never> =
|
|
|
62
74
|
* props (e.g. read `disabled` or `isOnContrasted` while resolving `type`).
|
|
63
75
|
* - `tokens`: Tamagui's parsed token map, for resolving design tokens from inside the variant.
|
|
64
76
|
*/
|
|
65
|
-
interface VariantGoodiesParams<
|
|
66
|
-
props:
|
|
77
|
+
interface VariantGoodiesParams<Props> {
|
|
78
|
+
props: Props;
|
|
67
79
|
tokens: TokensParsed;
|
|
68
80
|
}
|