@ornikar/bumper 2.5.1-canary.9789a78a274b9d336c93fc42d4a6561d0d61ff73.0 → 2.6.1-canary.5ea5493c945a003792345fbeb7191d0e206ed8da.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +13 -8
  2. package/dist/definitions/components/primitives/Pressable.d.ts +26 -0
  3. package/dist/definitions/components/primitives/Pressable.d.ts.map +1 -0
  4. package/dist/definitions/components/typography/Typography.d.ts +44 -0
  5. package/dist/definitions/components/typography/Typography.d.ts.map +1 -0
  6. package/dist/definitions/components/typography/utils/{getTypeAndWeightValues.d.ts → getVariantAndWeightValues.d.ts} +2 -2
  7. package/dist/definitions/components/typography/utils/getVariantAndWeightValues.d.ts.map +1 -0
  8. package/dist/definitions/index.d.ts +4 -2
  9. package/dist/definitions/index.d.ts.map +1 -1
  10. package/dist/definitions/story-components/StoryTitle.d.ts +2 -2
  11. package/dist/definitions/tamagui.config.d.ts +3 -3
  12. package/dist/definitions/tokens/fonts.d.ts +7 -5
  13. package/dist/definitions/tokens/fonts.d.ts.map +1 -1
  14. package/dist/index-metro.es.android.js +114 -32
  15. package/dist/index-metro.es.android.js.map +1 -1
  16. package/dist/index-metro.es.ios.js +114 -32
  17. package/dist/index-metro.es.ios.js.map +1 -1
  18. package/dist/index-node-22.17.cjs.js +113 -31
  19. package/dist/index-node-22.17.cjs.js.map +1 -1
  20. package/dist/index-node-22.17.cjs.web.js +113 -31
  21. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  22. package/dist/index-node-22.17.es.mjs +113 -32
  23. package/dist/index-node-22.17.es.mjs.map +1 -1
  24. package/dist/index-node-22.17.es.web.mjs +113 -32
  25. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  26. package/dist/index.es.js +112 -32
  27. package/dist/index.es.js.map +1 -1
  28. package/dist/index.es.web.js +112 -32
  29. package/dist/index.es.web.js.map +1 -1
  30. package/dist/tsbuildinfo +1 -1
  31. package/package.json +8 -8
  32. package/src/components/breakpoints/__snapshots_web__/breakpoints.stories.tsx.snap +1 -1
  33. package/src/components/breakpoints/breakpoints.stories.tsx +1 -1
  34. package/src/components/primitives/Pressable.stories.tsx +25 -0
  35. package/src/components/primitives/Pressable.tsx +35 -0
  36. package/src/components/primitives/__snapshots__/Pressable.stories.tsx.snap +53 -0
  37. package/src/components/primitives/__snapshots_web__/Center.stories.tsx.snap +1 -1
  38. package/src/components/primitives/__snapshots_web__/Pressable.stories.tsx.snap +37 -0
  39. package/src/components/primitives/__snapshots_web__/Stack.stories.tsx.snap +1 -1
  40. package/src/components/primitives/__snapshots_web__/View.stories.tsx.snap +1 -1
  41. package/src/components/typography/Typography.stories.tsx +45 -17
  42. package/src/components/typography/{Typograhy.tsx → Typography.tsx} +53 -27
  43. package/src/components/typography/__snapshots__/Typography.stories.tsx.snap +599 -60
  44. package/src/components/typography/__snapshots_web__/Typography.stories.tsx.snap +229 -2
  45. package/src/components/typography/utils/{getTypeAndWeightValues.test.tsx → getVariantAndWeightValues.test.tsx} +32 -2
  46. package/src/components/typography/utils/{getTypeAndWeightValues.tsx → getVariantAndWeightValues.tsx} +14 -3
  47. package/src/index.ts +4 -2
  48. package/src/story-components/StoryTitle.tsx +1 -1
  49. package/src/themes/__snapshots__/light.stories.tsx.snap +1 -1
  50. package/src/themes/__snapshots_web__/light.stories.tsx.snap +1 -1
  51. package/src/themes/light.stories.tsx +1 -1
  52. package/src/tokens/fonts.ts +45 -10
  53. package/src/tokens/palettes/__snapshots__/deepPurpleColorPalette.stories.tsx.snap +1 -1
  54. package/src/tokens/palettes/__snapshots_web__/deepPurpleColorPalette.stories.tsx.snap +1 -1
  55. package/src/tokens/palettes/deepPurpleColorPalette.stories.tsx +1 -1
  56. package/dist/definitions/components/typography/Typograhy.d.ts +0 -40
  57. package/dist/definitions/components/typography/Typograhy.d.ts.map +0 -1
  58. package/dist/definitions/components/typography/utils/getTypeAndWeightValues.d.ts.map +0 -1
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.1-canary.5ea5493c945a003792345fbeb7191d0e206ed8da.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "directory": "@ornikar/bumper",
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@storybook/preview-api": ">=8.6.15",
35
- "react": "^18.3.1",
36
- "react-dom": "^18.3.1",
35
+ "react": "^19.0.0",
36
+ "react-dom": "^19.0.0",
37
37
  "react-native": ">=0.76.9"
38
38
  },
39
39
  "peerDependenciesMeta": {
@@ -52,11 +52,11 @@
52
52
  "@testing-library/dom": "10.4.1",
53
53
  "@testing-library/react": "16.3.1",
54
54
  "@testing-library/react-native": "13.3.3",
55
- "@types/react": "18.3.27",
56
- "react": "18.3.1",
57
- "react-dom": "18.3.1",
58
- "react-native": "0.76.9",
59
- "react-test-renderer": "18.3.1"
55
+ "@types/react": "19.0.10",
56
+ "react": "19.0.0",
57
+ "react-dom": "19.0.0",
58
+ "react-native": "0.79.6",
59
+ "react-test-renderer": "19.0.0"
60
60
  },
61
61
  "expo": {},
62
62
  "exports": {
@@ -3,7 +3,7 @@
3
3
  exports[`bumper/utils/Breakpoints Breakpoints 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="css-view-175oi2r r-flex-13awgt0"
6
+ class="css-view-g5y9jx r-flex-13awgt0"
7
7
  >
8
8
  <span
9
9
  class=""
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryFn } from '@storybook/react';
2
2
  import type { View } from '@tamagui/core';
3
3
  import type { ReactElement } from 'react';
4
- import { Typography } from '../typography/Typograhy';
4
+ import { Typography } from '../typography/Typography';
5
5
  import { SwitchBreakpoints } from './SwitchBreakpoins';
6
6
  import { useBreakpointValue } from './hooks/useBreakpointValue';
7
7
  import { useCurrentBreakpointName } from './hooks/useCurrentBreakpointName';
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryFn } from '@storybook/react';
2
+ import { Typography } from '../typography/Typography';
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
+ `;
@@ -3,7 +3,7 @@
3
3
  exports[`bumper/Primitives Center 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="css-view-175oi2r r-flex-13awgt0"
6
+ class="css-view-g5y9jx r-flex-13awgt0"
7
7
  >
8
8
  <span
9
9
  class=""
@@ -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-g5y9jx 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
+ `;
@@ -3,7 +3,7 @@
3
3
  exports[`bumper/Primitives Stack 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="css-view-175oi2r r-flex-13awgt0"
6
+ class="css-view-g5y9jx r-flex-13awgt0"
7
7
  >
8
8
  <span
9
9
  class=""
@@ -3,7 +3,7 @@
3
3
  exports[`bumper/Primitives View 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="css-view-175oi2r r-flex-13awgt0"
6
+ class="css-view-g5y9jx r-flex-13awgt0"
7
7
  >
8
8
  <span
9
9
  class=""
@@ -1,11 +1,17 @@
1
1
  import type { Meta, StoryFn } from '@storybook/react';
2
2
  import type { FC } from 'react';
3
3
  import { StorySection } from '../../story-components/StorySection';
4
- import type { BodyFontVariants, FontVariants, HeadingFontVariants, LabelFontVariants } from '../../tokens/fonts';
4
+ import type {
5
+ BodyFontVariants,
6
+ ContentCapsVariants,
7
+ FontVariants,
8
+ HeadingFontVariants,
9
+ LabelFontVariants,
10
+ } from '../../tokens/fonts';
5
11
  import { VStack } from '../primitives/Stack';
6
12
  import { View } from '../primitives/View';
7
- import type { TypographyTextProps } from './Typograhy';
8
- import { Typography } from './Typograhy';
13
+ import type { TypographyTextProps } from './Typography';
14
+ import { Typography } from './Typography';
9
15
 
10
16
  export default {
11
17
  title: 'bumper/Typography/Typography',
@@ -19,12 +25,13 @@ interface TypographyTypeWithComponent<T extends FontVariants> {
19
25
  }
20
26
 
21
27
  const headingVariants: TypographyTypeWithComponent<HeadingFontVariants>[] = [
22
- { component: Typography.Text, variant: 'heading-2xl', weights: [undefined] },
23
- { component: Typography.Text, variant: 'heading-xl', weights: [undefined] },
24
- { component: Typography.Text, variant: 'heading-l', weights: [undefined] },
25
- { component: Typography.Text, variant: 'heading-m', weights: [undefined] },
26
- { component: Typography.Text, variant: 'heading-s', weights: [undefined] },
27
- { component: Typography.Text, variant: 'heading-xs', weights: [undefined] },
28
+ { component: Typography.Text, variant: 'heading-2xl', weights: ['semibold'] },
29
+ { component: Typography.Text, variant: 'heading-xl', weights: ['semibold'] },
30
+ { component: Typography.Text, variant: 'heading-l', weights: ['semibold'] },
31
+ { component: Typography.Text, variant: 'heading-m', weights: ['semibold'] },
32
+ { component: Typography.Text, variant: 'heading-s', weights: ['semibold'] },
33
+ { component: Typography.Text, variant: 'heading-xs', weights: ['semibold'] },
34
+ { component: Typography.Text, variant: 'heading-2xs', weights: ['semibold'] },
28
35
  ];
29
36
 
30
37
  const bodyVariants: TypographyTypeWithComponent<BodyFontVariants>[] = [
@@ -36,10 +43,20 @@ const bodyVariants: TypographyTypeWithComponent<BodyFontVariants>[] = [
36
43
  ];
37
44
 
38
45
  const labelVariants: TypographyTypeWithComponent<LabelFontVariants>[] = [
39
- { component: Typography.Text, variant: 'label-xl', weights: [undefined] },
40
- { component: Typography.Text, variant: 'label-l', weights: [undefined] },
41
- { component: Typography.Text, variant: 'label-m', weights: [undefined] },
42
- { component: Typography.Text, variant: 'label-s', weights: [undefined] },
46
+ { component: Typography.Text, variant: 'label-xl', weights: ['semibold'] },
47
+ { component: Typography.Text, variant: 'label-l', weights: ['semibold'] },
48
+ { component: Typography.Text, variant: 'label-m', weights: ['semibold'] },
49
+ { component: Typography.Text, variant: 'label-s', weights: ['semibold'] },
50
+ ];
51
+
52
+ const contentCapsVariants: TypographyTypeWithComponent<ContentCapsVariants>[] = [
53
+ { component: Typography.Text, variant: 'content-caps-3xl', weights: ['bold'] },
54
+ { component: Typography.Text, variant: 'content-caps-2xl', weights: ['bold'] },
55
+ { component: Typography.Text, variant: 'content-caps-xl', weights: ['bold'] },
56
+ { component: Typography.Text, variant: 'content-caps-l', weights: ['bold'] },
57
+ { component: Typography.Text, variant: 'content-caps-m', weights: ['bold'] },
58
+ { component: Typography.Text, variant: 'content-caps-s', weights: ['bold'] },
59
+ { component: Typography.Text, variant: 'content-caps-xs', weights: ['bold'] },
43
60
  ];
44
61
 
45
62
  interface TypographyTypesProps {
@@ -53,7 +70,7 @@ function TypographyVariants({ types }: TypographyTypesProps) {
53
70
  return type.weights.map((weight) => (
54
71
  <VStack key={`${type.variant}-${weight}`} marginBottom="$space.16">
55
72
  <Typography.Text variant="heading-s">{`${type.variant.split('-').join(' ')} - ${
56
- weight || 'semibold'
73
+ weight || ''
57
74
  }`}</Typography.Text>
58
75
  <View
59
76
  paddingVertical="$space.4"
@@ -62,8 +79,8 @@ function TypographyVariants({ types }: TypographyTypesProps) {
62
79
  backgroundColor="$bg.base.mid.default"
63
80
  marginTop="$space.4"
64
81
  >
65
- {/* Don't know why it's expecting BodyFontVariants type */}
66
- <Typography.Text variant={type.variant as BodyFontVariants} weight={weight}>
82
+ {/* @ts-expect-error some variants does not support specific weight */}
83
+ <Typography.Text variant={type.variant} weight={weight}>
67
84
  The quick brown fox jumps over the lazy dog
68
85
  </Typography.Text>
69
86
  </View>
@@ -118,7 +135,7 @@ export const TypographyStory: StoryFn<typeof Typography.Text> = (args) => (
118
135
  <Typography.Text color="$content.base.hi">color is content.base.hi</Typography.Text>
119
136
  </Typography.Text>
120
137
  </Typography.Text>
121
- </Typography.Text>{' '}
138
+ </Typography.Text>
122
139
  </Typography.Text>
123
140
  </StorySection.SubSection>
124
141
  <StorySection title="Heading">
@@ -130,6 +147,17 @@ export const TypographyStory: StoryFn<typeof Typography.Text> = (args) => (
130
147
  <StorySection title="Label">
131
148
  <TypographyVariants types={labelVariants} />
132
149
  </StorySection>
150
+ <StorySection title="Content Caps">
151
+ <TypographyVariants types={contentCapsVariants} />
152
+ </StorySection>
153
+ <StorySection title="Accessibility">
154
+ <Typography.Header1>role: heading aria-level: 1</Typography.Header1>
155
+ <Typography.Header2>role: heading aria-level: 2</Typography.Header2>
156
+ <Typography.Header3>role: heading aria-level: 3</Typography.Header3>
157
+ <Typography.Header4>role: heading aria-level: 4</Typography.Header4>
158
+ <Typography.Header5>role: heading aria-level: 5</Typography.Header5>
159
+ <Typography.Header6>role: heading aria-level: 6</Typography.Header6>
160
+ </StorySection>
133
161
  </StorySection>
134
162
  </>
135
163
  );
@@ -1,17 +1,23 @@
1
- import type { GetProps, GetThemeValueForKey } from '@tamagui/core';
1
+ import type { GetProps, GetThemeValueForKey, TamaguiComponent, WithMediaProps } from '@tamagui/core';
2
2
  import { Text, styled } from '@tamagui/core';
3
3
  import { createContext, useContext } from 'react';
4
4
  import { type Except } from 'type-fest';
5
- import type { BodyFontVariants, FontVariants, HeadingFontVariants, LabelFontVariants } from '../../tokens/fonts';
6
- import { getVariantAndWeightValues } from './utils/getTypeAndWeightValues';
5
+ import type {
6
+ BodyFontVariants,
7
+ ContentCapsVariants,
8
+ FontVariants,
9
+ HeadingFontVariants,
10
+ LabelFontVariants,
11
+ } from '../../tokens/fonts';
12
+ import { getVariantAndWeightValues } from './utils/getVariantAndWeightValues';
13
+
14
+ // Should use type from tamagui (PropsWithoutMediaStyles) when fixed: https://github.com/tamagui/tamagui/pull/3783
15
+ type PropsWithoutMedia<A> = {
16
+ // remove all media
17
+ [Key in keyof A as Key extends `$${string}` ? never : Key]?: A[Key];
18
+ };
7
19
 
8
- export type TypographyVariantContextValue = FontVariants | null;
9
- export type TypographyWeightContextValue = 'regular' | 'bold' | null;
10
- export type TypograhyColorContextValue = TypograhyColorProps | null;
11
-
12
- const TypographyVariantContext = createContext<TypographyVariantContextValue>(null);
13
- const TypographyWeightContext = createContext<TypographyWeightContextValue>(null);
14
- const TypograhyColorContext = createContext<TypograhyColorContextValue>(null);
20
+ type OverrideTamaguiComponentProps<A> = PropsWithoutMedia<A> & WithMediaProps<PropsWithoutMedia<A>>;
15
21
 
16
22
  const InternalTypography = styled(Text, {
17
23
  fontFamily: '$GTStandard',
@@ -49,9 +55,13 @@ const InternalTypography = styled(Text, {
49
55
 
50
56
  export type InternalTypographyProps = GetProps<typeof InternalTypography>;
51
57
 
52
- // Create a type for color props that matches strings containing '$content.'
53
- type ContainsOneString<T extends string> = `${string}${T}${string}`;
54
- type TypograhyColorProps = ContainsOneString<'$content.'>;
58
+ export type TypographyVariantContextValue = FontVariants | null;
59
+ export type TypographyWeightContextValue = 'regular' | 'bold' | 'semibold' | null;
60
+ export type TypograhyColorContextValue = InternalTypographyProps['color'] | null;
61
+
62
+ const TypographyVariantContext = createContext<TypographyVariantContextValue>(null);
63
+ const TypographyWeightContext = createContext<TypographyWeightContextValue>(null);
64
+ const TypograhyColorContext = createContext<TypograhyColorContextValue>(null);
55
65
 
56
66
  // Remove font-related style props from InternalTypography Props
57
67
  type TypographyExcludedFontStyleProps =
@@ -61,24 +71,28 @@ type TypographyExcludedFontStyleProps =
61
71
  | 'fontStyle'
62
72
  | 'fontVariant'
63
73
  | 'fontWeight';
64
- type TypographyPropsWithoutFontStyleProps = Except<
65
- InternalTypographyProps,
66
- TypographyExcludedFontStyleProps | 'color'
67
- > & {
68
- color?: TypograhyColorProps;
69
- };
74
+
75
+ type TypographyPropsWithoutFontStyleProps = Except<InternalTypographyProps, TypographyExcludedFontStyleProps>;
70
76
 
71
77
  export interface BodyProps extends TypographyPropsWithoutFontStyleProps {
72
78
  variant?: BodyFontVariants;
73
- weight?: Exclude<InternalTypographyProps['weight'], 'semibold'>;
79
+ weight?: 'regular' | 'bold';
74
80
  }
75
81
  export interface HeadingLabelProps extends TypographyPropsWithoutFontStyleProps {
76
82
  variant: HeadingFontVariants | LabelFontVariants;
77
- weight?: never;
83
+ weight?: 'semibold';
78
84
  }
79
- export type TypographyTextProps = BodyProps | HeadingLabelProps;
85
+ export interface ContentCapsProps extends TypographyPropsWithoutFontStyleProps {
86
+ variant: ContentCapsVariants;
87
+ weight?: 'bold';
88
+ }
89
+
90
+ export type TypographyTextProps =
91
+ | OverrideTamaguiComponentProps<BodyProps>
92
+ | OverrideTamaguiComponentProps<HeadingLabelProps>
93
+ | OverrideTamaguiComponentProps<ContentCapsProps>;
80
94
 
81
- const TypographyText = InternalTypography.styleable<TypographyTextProps>((props, ref) => {
95
+ const TypographyBase = InternalTypography.styleable<TypographyTextProps, TypographyTextProps>((props, ref) => {
82
96
  const typographyVariantAncestorValue = useContext(TypographyVariantContext);
83
97
  const typographyWeightAncestorValue = useContext(TypographyWeightContext);
84
98
  const typographyColorAncestorValue = useContext(TypograhyColorContext);
@@ -101,22 +115,22 @@ const TypographyText = InternalTypography.styleable<TypographyTextProps>((props,
101
115
  />
102
116
  );
103
117
 
118
+ // If a variant is provided, we set it in the context for children to be able to inherit variant value
104
119
  content = props.variant ? (
105
- // If a variant is provided, we set it in the context for children to be able to inherit variant value
106
120
  <TypographyVariantContext.Provider value={props.variant}>{content}</TypographyVariantContext.Provider>
107
121
  ) : (
108
122
  content
109
123
  );
110
124
 
125
+ // If a weight is provided, we set it in the context for children to be able to inherit weight value
111
126
  content = props.weight ? (
112
- // If a weight is provided, we set it in the context for children to be able to inherit weight value
113
127
  <TypographyWeightContext.Provider value={props.weight}>{content}</TypographyWeightContext.Provider>
114
128
  ) : (
115
129
  content
116
130
  );
117
131
 
132
+ // If a color is provided, we set it in the context for children to be able to inherit color value
118
133
  content = props.color ? (
119
- // If a color is provided, we set it in the context for children to be able to inherit color value
120
134
  <TypograhyColorContext.Provider value={props.color}>{content}</TypograhyColorContext.Provider>
121
135
  ) : (
122
136
  content
@@ -125,6 +139,18 @@ const TypographyText = InternalTypography.styleable<TypographyTextProps>((props,
125
139
  return content;
126
140
  });
127
141
 
142
+ const createHeading = (level: number): TamaguiComponent<TypographyTextProps> => {
143
+ return TypographyBase.styleable<TypographyTextProps, TypographyTextProps>((props, ref) => {
144
+ return <TypographyBase ref={ref} {...props} role="heading" aria-level={level} />;
145
+ });
146
+ };
147
+
128
148
  export const Typography = {
129
- Text: TypographyText,
149
+ Text: TypographyBase,
150
+ Header1: createHeading(1),
151
+ Header2: createHeading(2),
152
+ Header3: createHeading(3),
153
+ Header4: createHeading(4),
154
+ Header5: createHeading(5),
155
+ Header6: createHeading(6),
130
156
  };