@ornikar/bumper 2.5.0 → 2.6.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 +10 -0
- package/dist/definitions/components/primitives/Pressable.d.ts +26 -0
- package/dist/definitions/components/primitives/Pressable.d.ts.map +1 -0
- package/dist/definitions/core/BumperDecorator.d.ts +1 -1
- package/dist/definitions/core/BumperDecorator.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +2 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +29 -2
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +29 -2
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.17.cjs.js +29 -2
- package/dist/index-node-22.17.cjs.js.map +1 -1
- package/dist/index-node-22.17.cjs.web.js +29 -2
- package/dist/index-node-22.17.cjs.web.js.map +1 -1
- package/dist/index-node-22.17.es.mjs +28 -2
- package/dist/index-node-22.17.es.mjs.map +1 -1
- package/dist/index-node-22.17.es.web.mjs +28 -2
- package/dist/index-node-22.17.es.web.mjs.map +1 -1
- package/dist/index.es.js +27 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +27 -2
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/breakpoints/breakpoints.stories.tsx +2 -2
- package/src/components/primitives/Center.stories.tsx +2 -2
- package/src/components/primitives/Pressable.stories.tsx +25 -0
- package/src/components/primitives/Pressable.tsx +35 -0
- package/src/components/primitives/Stack.stories.tsx +2 -2
- package/src/components/primitives/View.stories.tsx +2 -2
- package/src/components/primitives/__snapshots__/Pressable.stories.tsx.snap +53 -0
- package/src/components/primitives/__snapshots_web__/Pressable.stories.tsx.snap +37 -0
- package/src/components/typography/Typography.stories.tsx +2 -2
- package/src/core/BumperDecorator.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/themes/light.stories.tsx +2 -2
- package/src/tokens/palettes/deepPurpleColorPalette.stories.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/bumper",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "@ornikar/bumper",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"@tamagui/core": "1.135.6"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@storybook/
|
|
34
|
+
"@storybook/preview-api": ">=8.6.15",
|
|
35
35
|
"react": "^18.3.1",
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
37
|
"react-native": ">=0.76.9"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
|
-
"@storybook/
|
|
40
|
+
"@storybook/preview-api": {
|
|
41
41
|
"optional": true
|
|
42
42
|
},
|
|
43
43
|
"react-dom": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
2
|
import type { View } from '@tamagui/core';
|
|
3
3
|
import type { ReactElement } from 'react';
|
|
4
4
|
import { Typography } from '../typography/Typograhy';
|
|
@@ -30,7 +30,7 @@ const SwitchBreakpointsComponent = (): ReactElement => {
|
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export const BreakpointsStory:
|
|
33
|
+
export const BreakpointsStory: StoryFn<typeof View> = () => {
|
|
34
34
|
return (
|
|
35
35
|
<>
|
|
36
36
|
<CurrentBreakpointNameComponent />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
2
|
import type { CenterProps } from './Center';
|
|
3
3
|
import { Center } from './Center';
|
|
4
4
|
import { View } from './View';
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
component: Center,
|
|
9
9
|
} satisfies Meta<CenterProps>;
|
|
10
10
|
|
|
11
|
-
export const CenterStory:
|
|
11
|
+
export const CenterStory: StoryFn<typeof Center> = () => (
|
|
12
12
|
<Center width="$size.120" height="$size.120" backgroundColor="$bg.accent.default">
|
|
13
13
|
<View width="$size.16" height="$size.16" backgroundColor="$bg.base.mid.default" />
|
|
14
14
|
</Center>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
|
+
import { Typography } from '../typography/Typograhy';
|
|
3
|
+
import type { CenterProps } from './Center';
|
|
4
|
+
import { Center } from './Center';
|
|
5
|
+
import { Pressable } from './Pressable';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'bumper/Primitives',
|
|
9
|
+
component: Center,
|
|
10
|
+
} satisfies Meta<CenterProps>;
|
|
11
|
+
|
|
12
|
+
export const PressableStory: StoryFn<typeof Pressable> = () => (
|
|
13
|
+
<Pressable
|
|
14
|
+
as={Center}
|
|
15
|
+
marginTop="$space.16"
|
|
16
|
+
padding="$space.24"
|
|
17
|
+
backgroundColor="$bg.accent.default"
|
|
18
|
+
pressStyle={{ opacity: 0.7 }}
|
|
19
|
+
onPress={() => null}
|
|
20
|
+
>
|
|
21
|
+
<Typography.Text color="$content.base.onContrasted.hi">Click me</Typography.Text>
|
|
22
|
+
</Pressable>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
PressableStory.storyName = 'Pressable';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { GetProps, TamaguiComponent } from '@tamagui/core';
|
|
2
|
+
import { View, styled } from '@tamagui/core';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import type { Except } from 'type-fest';
|
|
5
|
+
|
|
6
|
+
export type PressableProps<C extends TamaguiComponent = typeof View> = {
|
|
7
|
+
/**
|
|
8
|
+
* The Tamagui component to render as (`View`, `Stack`, etc.).
|
|
9
|
+
*
|
|
10
|
+
* @default View
|
|
11
|
+
*/
|
|
12
|
+
as?: C;
|
|
13
|
+
} & Except<GetProps<C>, 'as'>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A polymorphic Pressable component that can render as any Tamagui primitive.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <Pressable onPress={() => {}} />
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <Pressable
|
|
23
|
+
* as={HStack}
|
|
24
|
+
* onPress={() => {}}
|
|
25
|
+
* />
|
|
26
|
+
*/
|
|
27
|
+
export function Pressable<C extends TamaguiComponent = typeof View>({ as, ...rest }: PressableProps<C>): ReactNode {
|
|
28
|
+
const Component = styled(as ?? View, {
|
|
29
|
+
name: 'Pressable',
|
|
30
|
+
role: 'button',
|
|
31
|
+
cursor: 'pointer',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return <Component {...(rest as GetProps<C>)} />;
|
|
35
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
2
|
import type { StackProps } from './Stack';
|
|
3
3
|
import { HStack, Stack, VStack } from './Stack';
|
|
4
4
|
import { View } from './View';
|
|
@@ -36,7 +36,7 @@ const items = (
|
|
|
36
36
|
</>
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
export const StackStory:
|
|
39
|
+
export const StackStory: StoryFn<typeof Stack> = () => (
|
|
40
40
|
<>
|
|
41
41
|
<HStack gap="$space.4">{items}</HStack>
|
|
42
42
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
2
|
import type { ViewProps } from './View';
|
|
3
3
|
import { View } from './View';
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
component: View,
|
|
8
8
|
} satisfies Meta<ViewProps>;
|
|
9
9
|
|
|
10
|
-
export const ViewStory:
|
|
10
|
+
export const ViewStory: StoryFn<typeof View> = () => (
|
|
11
11
|
<View width="$size.120" height="$size.120" backgroundColor="$bg.accent.default" />
|
|
12
12
|
);
|
|
13
13
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`bumper/Primitives Pressable 1`] = `
|
|
4
|
+
<RNCSafeAreaProvider
|
|
5
|
+
onInsetsChange={[Function]}
|
|
6
|
+
style={
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
"flex": 1,
|
|
10
|
+
},
|
|
11
|
+
undefined,
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
<View
|
|
16
|
+
onBlur={[Function]}
|
|
17
|
+
onClick={[Function]}
|
|
18
|
+
onFocus={[Function]}
|
|
19
|
+
onResponderGrant={[Function]}
|
|
20
|
+
onResponderMove={[Function]}
|
|
21
|
+
onResponderRelease={[Function]}
|
|
22
|
+
onResponderTerminate={[Function]}
|
|
23
|
+
onResponderTerminationRequest={[Function]}
|
|
24
|
+
onStartShouldSetResponder={[Function]}
|
|
25
|
+
role="button"
|
|
26
|
+
style={
|
|
27
|
+
{
|
|
28
|
+
"alignItems": "center",
|
|
29
|
+
"backgroundColor": "#563B56",
|
|
30
|
+
"justifyContent": "center",
|
|
31
|
+
"marginTop": 16,
|
|
32
|
+
"opacity": 1,
|
|
33
|
+
"paddingBottom": 24,
|
|
34
|
+
"paddingLeft": 24,
|
|
35
|
+
"paddingRight": 24,
|
|
36
|
+
"paddingTop": 24,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
<Text
|
|
41
|
+
style={
|
|
42
|
+
{
|
|
43
|
+
"color": "#ffffff",
|
|
44
|
+
"fontFamily": "GTStandard",
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
suppressHighlighting={true}
|
|
48
|
+
>
|
|
49
|
+
Click me
|
|
50
|
+
</Text>
|
|
51
|
+
</View>
|
|
52
|
+
</RNCSafeAreaProvider>
|
|
53
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`bumper/Primitives Pressable 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="css-view-175oi2r r-flex-13awgt0"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
class=""
|
|
10
|
+
style="display: contents;"
|
|
11
|
+
>
|
|
12
|
+
<span
|
|
13
|
+
class=" "
|
|
14
|
+
style="display: contents;"
|
|
15
|
+
>
|
|
16
|
+
<span
|
|
17
|
+
class=" t_light is_Theme"
|
|
18
|
+
style="display: contents;"
|
|
19
|
+
>
|
|
20
|
+
<div
|
|
21
|
+
class="is_Pressable _opacity-0active-0--7 _display-flex _flexDirection-column _flexBasis-auto _boxSizing-border-box _position-relative _minHeight-0px _minWidth-0px _flexShrink-0 _justifyContent-center _alignItems-center _cursor-pointer _marginTop-t-space-spa1366020313 _paddingTop-t-space-spa1366020284 _paddingRight-t-space-spa1366020284 _paddingBottom-t-space-spa1366020284 _paddingLeft-t-space-spa1366020284 _backgroundColor-bg--accent-1633109644"
|
|
22
|
+
role="button"
|
|
23
|
+
tabindex="0"
|
|
24
|
+
>
|
|
25
|
+
<span
|
|
26
|
+
class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _display-inline _boxSizing-border-box _wordWrap-break-word _whiteSpace-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _fontFamily-f-family _color-content--ba254712717"
|
|
27
|
+
data-disable-theme="true"
|
|
28
|
+
>
|
|
29
|
+
Click me
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
</span>
|
|
33
|
+
</span>
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
</DocumentFragment>
|
|
37
|
+
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import { StorySection } from '../../story-components/StorySection';
|
|
4
4
|
import type { BodyFontVariants, FontVariants, HeadingFontVariants, LabelFontVariants } from '../../tokens/fonts';
|
|
@@ -74,7 +74,7 @@ function TypographyVariants({ types }: TypographyTypesProps) {
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export const TypographyStory:
|
|
77
|
+
export const TypographyStory: StoryFn<typeof Typography.Text> = (args) => (
|
|
78
78
|
<>
|
|
79
79
|
<StorySection.Demo>
|
|
80
80
|
<Typography.Text {...args} />
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,8 @@ export { BumperProvider } from './core/BumperProvider';
|
|
|
4
4
|
// Primitives
|
|
5
5
|
export type { CenterProps } from './components/primitives/Center';
|
|
6
6
|
export { Center } from './components/primitives/Center';
|
|
7
|
+
export type { PressableProps } from './components/primitives/Pressable';
|
|
8
|
+
export { Pressable } from './components/primitives/Pressable';
|
|
7
9
|
export type { HStackProps, StackProps, VStackProps } from './components/primitives/Stack';
|
|
8
10
|
export { HStack, Stack, VStack } from './components/primitives/Stack';
|
|
9
11
|
export type { ViewProps } from './components/primitives/View';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
2
|
import type { GetThemeValueForKey } from '@tamagui/core';
|
|
3
3
|
import { VStack } from '../components/primitives/Stack';
|
|
4
4
|
import { View } from '../components/primitives/View';
|
|
@@ -27,7 +27,7 @@ const TokenView = ({ tokenName, tokenValue }: { tokenName: string; tokenValue: s
|
|
|
27
27
|
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const TypographyHeadingStory:
|
|
30
|
+
export const TypographyHeadingStory: StoryFn<typeof View> = () => (
|
|
31
31
|
<StorySection title="Tokens">
|
|
32
32
|
{Object.entries(light).map(([tokenName, tokenValue]) => (
|
|
33
33
|
<TokenView key={tokenName} tokenName={tokenName} tokenValue={tokenValue} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
2
2
|
import type { GetThemeValueForKey } from '@tamagui/core';
|
|
3
3
|
import { View } from '../../components/primitives/View';
|
|
4
4
|
import { Typography } from '../../components/typography/Typograhy';
|
|
@@ -26,7 +26,7 @@ const TokenView = ({ tokenName, tokenValue }: { tokenName: string; tokenValue: s
|
|
|
26
26
|
);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export const TypographyHeadingStory:
|
|
29
|
+
export const TypographyHeadingStory: StoryFn<typeof View> = () => (
|
|
30
30
|
<StorySection title="Palette">
|
|
31
31
|
{Object.entries(deepPurpleColorPalette).map(([tokenName, tokenValue]) => (
|
|
32
32
|
<TokenView key={tokenName} tokenName={tokenName} tokenValue={tokenValue} />
|