@ornikar/bumper 3.1.0 → 3.2.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 (81) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/definitions/shared/storybook/StoryTitle.d.ts +1 -1
  3. package/dist/definitions/system/content/icon/Icon.d.ts +6 -1
  4. package/dist/definitions/system/content/icon/Icon.d.ts.map +1 -1
  5. package/dist/definitions/system/content/typography/Typography.d.ts +10 -52
  6. package/dist/definitions/system/content/typography/Typography.d.ts.map +1 -1
  7. package/dist/definitions/system/content/typography/TypographyIcon.d.ts +5 -2
  8. package/dist/definitions/system/content/typography/TypographyIcon.d.ts.map +1 -1
  9. package/dist/definitions/system/content/typography/TypographyLink.d.ts +1 -1
  10. package/dist/definitions/system/content/typography/TypographyLink.d.ts.map +1 -1
  11. package/dist/definitions/system/content/typography/TypographyView.d.ts +2 -2
  12. package/dist/definitions/system/content/typography/TypographyView.d.ts.map +1 -1
  13. package/dist/definitions/system/content/typography/utils/typographyContext.d.ts +8 -13
  14. package/dist/definitions/system/content/typography/utils/typographyContext.d.ts.map +1 -1
  15. package/dist/definitions/system/core/hooks/useProps.d.ts +3 -0
  16. package/dist/definitions/system/core/hooks/useProps.d.ts.map +1 -0
  17. package/dist/definitions/system/dataDisplays/Badge/Badge.d.ts.map +1 -1
  18. package/dist/definitions/system/types.d.ts +1 -2
  19. package/dist/definitions/system/types.d.ts.map +1 -1
  20. package/dist/index-metro.es.android.js +69 -160
  21. package/dist/index-metro.es.android.js.map +1 -1
  22. package/dist/index-metro.es.ios.js +69 -160
  23. package/dist/index-metro.es.ios.js.map +1 -1
  24. package/dist/index-node-22.22.cjs.js +71 -163
  25. package/dist/index-node-22.22.cjs.js.map +1 -1
  26. package/dist/index-node-22.22.cjs.web.js +71 -163
  27. package/dist/index-node-22.22.cjs.web.js.map +1 -1
  28. package/dist/index-node-22.22.es.mjs +72 -164
  29. package/dist/index-node-22.22.es.mjs.map +1 -1
  30. package/dist/index-node-22.22.es.web.mjs +72 -164
  31. package/dist/index-node-22.22.es.web.mjs.map +1 -1
  32. package/dist/index.es.js +69 -158
  33. package/dist/index.es.js.map +1 -1
  34. package/dist/index.es.web.js +69 -158
  35. package/dist/index.es.web.js.map +1 -1
  36. package/dist/tsbuildinfo +1 -1
  37. package/package.json +1 -1
  38. package/src/.eslintrc.json +2 -2
  39. package/src/system/content/icon/Icon.tsx +10 -4
  40. package/src/system/content/icon/__snapshots_web__/Icon.features.stories.tsx.snap +11 -22
  41. package/src/system/content/typography/Typography.tsx +66 -75
  42. package/src/system/content/typography/TypographyIcon.tsx +14 -19
  43. package/src/system/content/typography/TypographyLink.features.stories.tsx +34 -8
  44. package/src/system/content/typography/TypographyLink.stories.tsx +2 -1
  45. package/src/system/content/typography/TypographyLink.tsx +2 -0
  46. package/src/system/content/typography/TypographyView.tsx +10 -17
  47. package/src/system/content/typography/__snapshots__/TypographyLink.features.stories.tsx.snap +164 -0
  48. package/src/system/content/typography/__snapshots_web__/Typography.features.stories.tsx.snap +40 -86
  49. package/src/system/content/typography/__snapshots_web__/Typography.stories.tsx.snap +0 -1
  50. package/src/system/content/typography/__snapshots_web__/TypographyIcon.features.stories.tsx.snap +42 -67
  51. package/src/system/content/typography/__snapshots_web__/TypographyIcon.stories.tsx.snap +1 -1
  52. package/src/system/content/typography/__snapshots_web__/TypographyLink.features.stories.tsx.snap +120 -20
  53. package/src/system/content/typography/__snapshots_web__/TypographyLink.stories.tsx.snap +1 -2
  54. package/src/system/content/typography/utils/typographyContext.ts +13 -25
  55. package/src/system/core/hooks/useProps.ts +9 -0
  56. package/src/system/core/primitives/ScrollView/__snapshots_web__/ScrollView.features.stories.tsx.snap +37 -74
  57. package/src/system/core/primitives/ScrollView/__snapshots_web__/ScrollView.stories.tsx.snap +10 -20
  58. package/src/system/core/primitives/__snapshots_web__/Center.features.stories.tsx.snap +5 -10
  59. package/src/system/core/primitives/__snapshots_web__/Center.stories.tsx.snap +1 -2
  60. package/src/system/core/primitives/__snapshots_web__/Pressable.features.stories.tsx.snap +9 -18
  61. package/src/system/core/primitives/__snapshots_web__/Pressable.stories.tsx.snap +0 -1
  62. package/src/system/core/primitives/__snapshots_web__/Stack.features.stories.tsx.snap +33 -66
  63. package/src/system/core/primitives/__snapshots_web__/Stack.stories.tsx.snap +3 -6
  64. package/src/system/core/primitives/__snapshots_web__/View.features.stories.tsx.snap +60 -120
  65. package/src/system/core/themes/light/__snapshots_web__/light.stories.tsx.snap +111 -222
  66. package/src/system/core/tokens/__snapshots_web__/breakpoints.stories.tsx.snap +11 -22
  67. package/src/system/core/tokens/__snapshots_web__/bumperIcon.stories.tsx.snap +7 -14
  68. package/src/system/core/tokens/__snapshots_web__/fonts.stories.tsx.snap +67 -134
  69. package/src/system/core/tokens/__snapshots_web__/radius.stories.tsx.snap +11 -22
  70. package/src/system/core/tokens/__snapshots_web__/size.stories.tsx.snap +25 -50
  71. package/src/system/core/tokens/__snapshots_web__/space.stories.tsx.snap +28 -56
  72. package/src/system/core/tokens/palettes/__snapshots_web__/deepPurpleColorPalette.stories.tsx.snap +133 -266
  73. package/src/system/dataDisplays/Badge/Badge.tsx +2 -1
  74. package/src/system/dataDisplays/Badge/__snapshots_web__/Badge.features.stories.tsx.snap +8 -16
  75. package/src/system/dataDisplays/Badge/__snapshots_web__/Badge.stories.tsx.snap +1 -2
  76. package/src/system/loading/loader/__snapshots_web__/Loader.features.stories.tsx.snap +2 -4
  77. package/src/system/types.ts +2 -1
  78. package/dist/definitions/system/content/typography/utils/getVariantAndWeightValues.d.ts +0 -10
  79. package/dist/definitions/system/content/typography/utils/getVariantAndWeightValues.d.ts.map +0 -1
  80. package/src/system/content/typography/utils/getVariantAndWeightValues.test.tsx +0 -178
  81. package/src/system/content/typography/utils/getVariantAndWeightValues.tsx +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/bumper",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "directory": "@ornikar/bumper",
@@ -24,8 +24,8 @@
24
24
  "paths": [
25
25
  {
26
26
  "name": "@tamagui/core",
27
- "importNames": ["View", "ViewProps"],
28
- "message": "Import `View` and `ViewProps` from `system/core/primitives/View` instead."
27
+ "importNames": ["View", "ViewProps", "useProps", "PropsWithoutMediaStyles"],
28
+ "message": "Import our internal bumper variations."
29
29
  },
30
30
  {
31
31
  "name": "react-native",
@@ -2,6 +2,7 @@ import type { ColorTokens, GetProps } from '@tamagui/core';
2
2
  import { styled, useStyle } from '@tamagui/core';
3
3
  import type { ReactElement, ReactNode } from 'react';
4
4
  import { cloneElement } from 'react';
5
+ import { useProps } from '../../core/hooks/useProps';
5
6
  import { View } from '../../core/primitives/View';
6
7
  import type { BumperIconTokens } from '../../core/tokens/bumperIcon';
7
8
  import type { TamaguiMediaProps } from '../../types';
@@ -35,14 +36,19 @@ interface InternalIconProps {
35
36
 
36
37
  export type IconProps = TamaguiMediaProps<InternalIconProps>;
37
38
 
38
- export function Icon({ icon, color = '$content.base.hi', size = '$icon.m', testID, alignSelf }: IconProps): ReactNode {
39
- const style = useStyle({ color });
39
+ export const InternalIcon = IconContainer.styleable<IconProps>((props) => {
40
+ const flattenProps = useProps(props);
41
+ const style = useStyle({ color: flattenProps.color || '$content.base.hi' });
40
42
 
41
- const clonedIcon = cloneElement(icon, { color: style.color });
43
+ const clonedIcon = cloneElement(flattenProps.icon, { color: style.color });
42
44
 
43
45
  return (
44
- <IconContainer size={size} testID={testID} alignSelf={alignSelf}>
46
+ <IconContainer size={flattenProps.size} testID={flattenProps.testID} alignSelf={flattenProps.alignSelf}>
45
47
  {clonedIcon}
46
48
  </IconContainer>
47
49
  );
50
+ });
51
+
52
+ export function Icon(props: IconProps): ReactNode {
53
+ return <InternalIcon {...props} />;
48
54
  }
@@ -32,8 +32,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
32
32
  />
33
33
  </div>
34
34
  <span
35
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
36
- data-disable-theme="true"
35
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
37
36
  >
38
37
  base.hi
39
38
  </span>
@@ -50,8 +49,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
50
49
  />
51
50
  </div>
52
51
  <span
53
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
54
- data-disable-theme="true"
52
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
55
53
  >
56
54
  base.mid
57
55
  </span>
@@ -68,8 +66,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
68
66
  />
69
67
  </div>
70
68
  <span
71
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
72
- data-disable-theme="true"
69
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
73
70
  >
74
71
  base.low
75
72
  </span>
@@ -86,8 +83,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
86
83
  />
87
84
  </div>
88
85
  <span
89
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
90
- data-disable-theme="true"
86
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
91
87
  >
92
88
  accent
93
89
  </span>
@@ -104,8 +100,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
104
100
  />
105
101
  </div>
106
102
  <span
107
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
108
- data-disable-theme="true"
103
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
109
104
  >
110
105
  success
111
106
  </span>
@@ -122,8 +117,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
122
117
  />
123
118
  </div>
124
119
  <span
125
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
126
- data-disable-theme="true"
120
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
127
121
  >
128
122
  warning
129
123
  </span>
@@ -140,8 +134,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
140
134
  />
141
135
  </div>
142
136
  <span
143
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
144
- data-disable-theme="true"
137
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
145
138
  >
146
139
  danger
147
140
  </span>
@@ -158,8 +151,7 @@ exports[`Bumper/Content/Icon/Features Colors 1`] = `
158
151
  />
159
152
  </div>
160
153
  <span
161
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
162
- data-disable-theme="true"
154
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
163
155
  >
164
156
  info
165
157
  </span>
@@ -204,8 +196,7 @@ exports[`Bumper/Content/Icon/Features Sizes 1`] = `
204
196
  />
205
197
  </div>
206
198
  <span
207
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
208
- data-disable-theme="true"
199
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
209
200
  >
210
201
  s (16)
211
202
  </span>
@@ -222,8 +213,7 @@ exports[`Bumper/Content/Icon/Features Sizes 1`] = `
222
213
  />
223
214
  </div>
224
215
  <span
225
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
226
- data-disable-theme="true"
216
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
227
217
  >
228
218
  m (20)
229
219
  </span>
@@ -240,8 +230,7 @@ exports[`Bumper/Content/Icon/Features Sizes 1`] = `
240
230
  />
241
231
  </div>
242
232
  <span
243
- class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fw-f-weight-re98715119 _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _col-content--ba1918259606"
244
- data-disable-theme="true"
233
+ class="font_GTStandard _WebkitFontSmoothing-_platformweb_antialiased _dsp-inline _bxs-border-box _ww-break-word _ws-pre-wrap _marginTop-0px _marginRight-0px _marginBottom-0px _marginLeft-0px _ff-f-family _fs-f-size-body47080 _lh-f-lineHeigh1960620717 _ls-f-letterSpa260968488 _fw-f-weight-re98715119 _col-content--ba1918259606"
245
234
  >
246
235
  l (24)
247
236
  </span>
@@ -1,27 +1,35 @@
1
- import type { ColorTokens, TextStyle } from '@tamagui/core';
1
+ import type { ColorTokens, GetProps } from '@tamagui/core';
2
2
  import { Text, styled } from '@tamagui/core';
3
3
  import type { ReactNode } from 'react';
4
- import type { BodyFontVariants, HeadingFontVariants, LabelFontVariants } from '../../core/tokens/GTStandardFont';
4
+ import { type Except } from 'type-fest';
5
+ import {
6
+ BODY_VARIANTS,
7
+ type BodyFontVariants,
8
+ HEADING_VARIANTS,
9
+ type HeadingFontVariants,
10
+ LABEL_VARIANTS,
11
+ type LabelFontVariants,
12
+ } from '../../core/tokens/GTStandardFont';
5
13
  import { CONTENT_CAPS_VARIANTS, type ContentCapsVariants } from '../../core/tokens/GTStandardNarrowFont';
6
14
  import type { FontVariants } from '../../core/tokens/fonts';
7
15
  import type { TamaguiMediaProps } from '../../types';
8
- import { getVariantAndWeightValues } from './utils/getVariantAndWeightValues';
9
- import {
10
- TypograhyColorContext,
11
- TypographyContext,
12
- TypographyVariantContext,
13
- TypographyWeightContext,
14
- useTypographyColor,
15
- useTypographyContext,
16
- useTypographyVariant,
17
- useTypographyWeight,
18
- } from './utils/typographyContext';
16
+ import { typographyStyleContext } from './utils/typographyContext';
17
+
18
+ interface TypographyWithoutMediaProps extends TypographyPropsWithoutFontStyleProps {}
19
19
 
20
- interface TypographyWithoutMediaProps {
20
+ // Remove font-related style props from InternalTypography Props
21
+ type TypographyExcludedFontStyleProps =
22
+ | 'fontFamily'
23
+ | 'fontSize'
24
+ | 'lineHeight'
25
+ | 'fontStyle'
26
+ | 'fontVariant'
27
+ | 'fontWeight'
28
+ | 'color';
29
+
30
+ type TypographyPropsWithoutFontStyleProps = Except<InternalTypographyProps, TypographyExcludedFontStyleProps> & {
21
31
  color?: ColorTokens;
22
- textAlign?: TextStyle['textAlign'];
23
- children: ReactNode;
24
- }
32
+ };
25
33
 
26
34
  export interface BodyProps extends TypographyWithoutMediaProps {
27
35
  variant?: BodyFontVariants;
@@ -41,24 +49,56 @@ export type TypographyTextProps =
41
49
  | TamaguiMediaProps<HeadingLabelProps>
42
50
  | TamaguiMediaProps<ContentCapsProps>;
43
51
 
44
- const InternalTypographyBase = styled(Text, {
52
+ export const InternalTypography = styled(Text, {
53
+ context: typographyStyleContext,
45
54
  fontFamily: '$GTStandard',
55
+ fontSize: '$body-m',
56
+ lineHeight: '$body-m',
57
+ letterSpacing: '$body-m',
58
+ fontWeight: '$regular',
46
59
  color: '$content.base.hi',
47
60
  '$platform-web': {
48
61
  WebkitFontSmoothing: 'antialiased',
49
62
  },
50
63
  variants: {
51
- variant: (variant: FontVariants | undefined) => {
52
- if (!variant) return {};
53
- const isContentCapsVariant = (CONTENT_CAPS_VARIANTS as readonly string[]).includes(variant);
54
-
55
- return {
56
- fontFamily: isContentCapsVariant ? '$GTStandardNarrow' : '$GTStandard',
57
- textTransform: isContentCapsVariant ? 'uppercase' : undefined,
64
+ variant: (variant: FontVariants) => {
65
+ const commonVariantStyles = {
58
66
  fontSize: `$${variant}`,
59
67
  lineHeight: `$${variant}`,
60
68
  letterSpacing: `$${variant}`,
61
69
  };
70
+
71
+ // Body variant
72
+ if ((BODY_VARIANTS as readonly string[]).includes(variant)) {
73
+ return {
74
+ ...commonVariantStyles,
75
+ };
76
+ }
77
+ // Content Caps variant
78
+ if ((CONTENT_CAPS_VARIANTS as readonly string[]).includes(variant)) {
79
+ return {
80
+ fontFamily: '$GTStandardNarrow',
81
+ textTransform: 'uppercase',
82
+ fontWeight: '$bold',
83
+ ...commonVariantStyles,
84
+ };
85
+ }
86
+ // Heading variants
87
+ if ((HEADING_VARIANTS as readonly string[]).includes(variant)) {
88
+ return {
89
+ fontWeight: '$semibold',
90
+ ...commonVariantStyles,
91
+ };
92
+ }
93
+ // Label variants
94
+ if ((LABEL_VARIANTS as readonly string[]).includes(variant)) {
95
+ return {
96
+ fontWeight: '$semibold',
97
+ ...commonVariantStyles,
98
+ };
99
+ }
100
+
101
+ return undefined;
62
102
  },
63
103
  weight: {
64
104
  regular: {
@@ -73,60 +113,11 @@ const InternalTypographyBase = styled(Text, {
73
113
  },
74
114
  } as const,
75
115
  defaultVariants: {
76
- variant: 'body-m',
77
116
  weight: 'regular',
78
117
  },
79
118
  });
80
119
 
81
- export const InternalTypography = InternalTypographyBase.styleable<TypographyTextProps>((props, ref) => {
82
- const typographyVariantAncestorValue = useTypographyVariant();
83
- const typographyWeightAncestorValue = useTypographyWeight();
84
- const typographyColorAncestorValue = useTypographyColor();
85
- const typographyContext = useTypographyContext();
86
-
87
- const { variant, weight } = getVariantAndWeightValues(
88
- props.weight,
89
- props.variant,
90
- typographyWeightAncestorValue,
91
- typographyVariantAncestorValue,
92
- );
93
- const color = props.color || typographyColorAncestorValue || undefined;
94
-
95
- let content = (
96
- <InternalTypographyBase
97
- ref={ref}
98
- {...props}
99
- {...(color ? { color } : undefined)}
100
- {...(weight ? { weight } : undefined)}
101
- {...(variant ? { variant } : undefined)}
102
- />
103
- );
104
-
105
- content = typographyContext ? content : <TypographyContext.Provider value>{content}</TypographyContext.Provider>;
106
-
107
- // If a variant is provided, we set it in the context for children to be able to inherit variant value
108
- content = props.variant ? (
109
- <TypographyVariantContext.Provider value={props.variant}>{content}</TypographyVariantContext.Provider>
110
- ) : (
111
- content
112
- );
113
-
114
- // If a weight is provided, we set it in the context for children to be able to inherit weight value
115
- content = props.weight ? (
116
- <TypographyWeightContext.Provider value={props.weight}>{content}</TypographyWeightContext.Provider>
117
- ) : (
118
- content
119
- );
120
-
121
- // If a color is provided, we set it in the context for children to be able to inherit color value
122
- content = props.color ? (
123
- <TypograhyColorContext.Provider value={props.color}>{content}</TypograhyColorContext.Provider>
124
- ) : (
125
- content
126
- );
127
-
128
- return content;
129
- });
120
+ export type InternalTypographyProps = GetProps<typeof InternalTypography>;
130
121
 
131
122
  export function TypographyBase(props: TypographyTextProps): ReactNode {
132
123
  return <InternalTypography {...props} />;
@@ -1,33 +1,28 @@
1
+ import { styled } from '@tamagui/core';
1
2
  import { type ReactNode } from 'react';
2
3
  import type { Except } from 'type-fest';
4
+ import type { TamaguiMediaProps } from '../../types';
3
5
  import type { IconProps } from '../icon/Icon';
4
- import { Icon } from '../icon/Icon';
6
+ import { InternalIcon } from '../icon/Icon';
5
7
  import type { TypographyTextProps } from './Typography';
6
8
  import { TypographyView } from './TypographyView';
7
- import { useTypographyColor } from './utils/typographyContext';
9
+ import { typographyStyleContext } from './utils/typographyContext';
8
10
 
9
- export interface TypographyIconProps extends Except<IconProps, 'color'> {
11
+ interface TypographyIconWithoutMediaProps extends Except<IconProps, 'color'> {
10
12
  color?: TypographyTextProps['color'];
11
13
  }
12
14
 
13
- function TypographyIconInternal(props: TypographyIconProps): ReactNode {
15
+ const TypographyIconInternal = styled(InternalIcon, {
16
+ name: 'TypographyIconInternal',
17
+ context: typographyStyleContext,
18
+ });
19
+
20
+ export type TypographyIconProps = TamaguiMediaProps<TypographyIconWithoutMediaProps>;
21
+
22
+ export function TypographyIcon(props: TypographyIconProps): ReactNode {
14
23
  return (
15
24
  <TypographyView>
16
- <Icon {...props} />
25
+ <TypographyIconInternal {...props} />
17
26
  </TypographyView>
18
27
  );
19
28
  }
20
-
21
- function TypographyIconInheritColor(props: TypographyIconProps): ReactNode {
22
- const typographyColorAncestorValue = useTypographyColor();
23
-
24
- return <TypographyIconInternal color={typographyColorAncestorValue || undefined} {...props} />;
25
- }
26
-
27
- export function TypographyIcon({ color, ...props }: TypographyIconProps): ReactNode {
28
- if (color) {
29
- return <TypographyIconInternal color={color} {...props} />;
30
- }
31
-
32
- return <TypographyIconInheritColor {...props} />;
33
- }
@@ -1,8 +1,10 @@
1
+ import { action } from '@storybook/addon-actions';
1
2
  import type { Meta, StoryObj } from '@storybook/react';
2
3
  import { VStack } from '../../core/primitives/Stack';
3
4
  import type { BodyProps } from './Typography';
4
5
  import type { TypographyLinkProps } from './TypographyLink';
5
6
  import { InternalTypographyLink, TypographyLink } from './TypographyLink';
7
+ import { Typography } from '.';
6
8
 
7
9
  const meta: Meta<Extract<TypographyLinkProps, BodyProps>> = {
8
10
  title: 'Bumper/Content/TypographyLink/Features',
@@ -16,7 +18,7 @@ export const DisabledFalse: Story = {
16
18
  args: {
17
19
  disabled: false,
18
20
  children: 'Enabled link (clickable with pointer cursor)',
19
- onPress: () => alert('Link clicked!'),
21
+ onPress: action('Link clicked!'),
20
22
  },
21
23
  };
22
24
 
@@ -24,7 +26,7 @@ export const DisabledTrue: Story = {
24
26
  args: {
25
27
  disabled: true,
26
28
  children: 'Disabled link (not-allowed cursor, onPress removed)',
27
- onPress: () => alert('This should not be called'),
29
+ onPress: action('This should not be called'),
28
30
  },
29
31
  };
30
32
 
@@ -32,7 +34,7 @@ export const NoUnderlineFalse: Story = {
32
34
  args: {
33
35
  noUnderline: false,
34
36
  children: 'Link with underline (default)',
35
- onPress: () => alert('Link clicked!'),
37
+ onPress: action('Link clicked!'),
36
38
  },
37
39
  };
38
40
 
@@ -40,23 +42,47 @@ export const NoUnderlineTrue: Story = {
40
42
  args: {
41
43
  noUnderline: true,
42
44
  children: 'Link without underline',
43
- onPress: () => alert('Link clicked!'),
45
+ onPress: action('Link clicked!'),
44
46
  },
45
47
  };
46
48
 
49
+ export const NestedInContentCaps: Story = {
50
+ render: () => (
51
+ <Typography.Text variant="content-caps-m">
52
+ content caps with <TypographyLink onPress={action('Link clicked!')}>a nested link</TypographyLink>
53
+ </Typography.Text>
54
+ ),
55
+ };
56
+
57
+ export const NestedInHeading: Story = {
58
+ render: () => (
59
+ <Typography.Text variant="heading-m">
60
+ Heading with <TypographyLink onPress={action('Link clicked!')}>a nested link</TypographyLink>
61
+ </Typography.Text>
62
+ ),
63
+ };
64
+
65
+ export const NestedInBodyBold: Story = {
66
+ render: () => (
67
+ <Typography.Text variant="body-l" weight="bold" color="$content.accent">
68
+ Bold accent text with <TypographyLink onPress={action('Link clicked!')}>a nested link</TypographyLink>
69
+ </Typography.Text>
70
+ ),
71
+ };
72
+
47
73
  export const StateHover: Story = {
48
74
  render: () => (
49
75
  <VStack gap="$space.16">
50
- <InternalTypographyLink forceStyle="hover" onPress={() => alert('Link clicked!')}>
76
+ <InternalTypographyLink forceStyle="hover" onPress={action('Link clicked!')}>
51
77
  Forced hover state - underline removed (hoverStyle applied)
52
78
  </InternalTypographyLink>
53
- <InternalTypographyLink noUnderline forceStyle="hover" onPress={() => alert('Link clicked!')}>
79
+ <InternalTypographyLink noUnderline forceStyle="hover" onPress={action('Link clicked!')}>
54
80
  Forced hover state with noUnderline - no visual change
55
81
  </InternalTypographyLink>
56
- <InternalTypographyLink disabled forceStyle="hover" onPress={() => alert('Link clicked!')}>
82
+ <InternalTypographyLink disabled forceStyle="hover" onPress={action('Link clicked!')}>
57
83
  Forced hover state on disabled - underline removed (hoverStyle applied)
58
84
  </InternalTypographyLink>
59
- <InternalTypographyLink disabled noUnderline forceStyle="hover" onPress={() => alert('Link clicked!')}>
85
+ <InternalTypographyLink disabled noUnderline forceStyle="hover" onPress={action('Link clicked!')}>
60
86
  Forced hover state with noUnderline on disabled - no visual change
61
87
  </InternalTypographyLink>
62
88
  </VStack>
@@ -1,3 +1,4 @@
1
+ import { action } from '@storybook/addon-actions';
1
2
  import type { Meta, StoryObj } from '@storybook/react';
2
3
  import { contentColorArgType } from '../../../shared/storybook/helpers/argsHelpers';
3
4
  import type { BodyProps } from './Typography';
@@ -68,6 +69,6 @@ export const Default: Story = {
68
69
  disabled: false,
69
70
  noUnderline: false,
70
71
  children: 'This is a link',
71
- onPress: () => alert('Link clicked!'),
72
+ onPress: action('Link clicked!'),
72
73
  },
73
74
  };
@@ -3,6 +3,7 @@ import type { ReactNode } from 'react';
3
3
  import type { TamaguiMediaProps } from '../../types';
4
4
  import type { TypographyTextProps } from './Typography';
5
5
  import { InternalTypography } from './Typography';
6
+ import { typographyStyleContext } from './utils/typographyContext';
6
7
 
7
8
  export interface TypographyLinkWithoutMediaProps {
8
9
  disabled?: boolean;
@@ -14,6 +15,7 @@ export type TypographyLinkProps = TypographyTextProps & TamaguiMediaProps<Typogr
14
15
 
15
16
  export const InternalTypographyLink = styled(InternalTypography, {
16
17
  name: 'TypographyLink',
18
+ context: typographyStyleContext,
17
19
  role: 'link',
18
20
  variants: {
19
21
  disabled: {
@@ -2,13 +2,6 @@ import type { GetProps } from '@tamagui/core';
2
2
  import { styled } from '@tamagui/core';
3
3
  import type { ReactNode } from 'react';
4
4
  import { View } from '../../core/primitives/View';
5
- import { useTypographyContext } from './utils/typographyContext';
6
-
7
- const InternalTypographyView = styled(View, {
8
- name: 'TypographyView',
9
- });
10
-
11
- type TypographyViewProps = GetProps<typeof InternalTypographyView>;
12
5
 
13
6
  /**
14
7
  *
@@ -21,15 +14,15 @@ type TypographyViewProps = GetProps<typeof InternalTypographyView>;
21
14
  *
22
15
  * Inside a Typography component, always use TypographyView to wrap external components like Icon or Svg
23
16
  */
24
- export function TypographyView(props: TypographyViewProps): ReactNode {
25
- const isInTypographyContext = useTypographyContext();
17
+ const InternalTypographyView = styled(View, {
18
+ name: 'TypographyViewInternal',
19
+ '$platform-web': {
20
+ display: 'inline-flex',
21
+ },
22
+ });
26
23
 
27
- return (
28
- <InternalTypographyView
29
- {...props}
30
- $platform-web={
31
- isInTypographyContext ? { ...props['$platform-web'], display: 'inline-flex' } : props['$platform-web']
32
- }
33
- />
34
- );
24
+ type TypographyViewProps = GetProps<typeof InternalTypographyView>;
25
+
26
+ export function TypographyView(props: TypographyViewProps): ReactNode {
27
+ return <InternalTypographyView {...props} />;
35
28
  }