@ornikar/bumper 2.5.1-canary.9789a78a274b9d336c93fc42d4a6561d0d61ff73.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/bumper",
3
- "version": "2.5.1-canary.9789a78a274b9d336c93fc42d4a6561d0d61ff73.0",
3
+ "version": "2.6.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "directory": "@ornikar/bumper",
@@ -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
+ }
@@ -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
+ `;
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';