@ornikar/bumper 3.0.3 → 3.1.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 +9 -0
- package/dist/definitions/shared/storybook/StoryTitle.d.ts +2 -2
- package/dist/definitions/system/content/typography/Typography.d.ts +57 -15
- package/dist/definitions/system/content/typography/Typography.d.ts.map +1 -1
- package/dist/definitions/system/content/typography/TypographyLink.d.ts +12 -4
- package/dist/definitions/system/content/typography/TypographyLink.d.ts.map +1 -1
- package/dist/definitions/system/content/typography/index.d.ts +10 -16
- package/dist/definitions/system/content/typography/index.d.ts.map +1 -1
- package/dist/definitions/system/content/typography/utils/getVariantAndWeightValues.d.ts +2 -2
- package/dist/definitions/system/content/typography/utils/getVariantAndWeightValues.d.ts.map +1 -1
- package/dist/definitions/system/content/typography/utils/typographyContext.d.ts +2 -2
- package/dist/definitions/system/content/typography/utils/typographyContext.d.ts.map +1 -1
- package/dist/definitions/system/dataDisplays/Badge/Badge.d.ts +3 -3
- package/dist/definitions/system/dataDisplays/Badge/Badge.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +22 -19
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +22 -19
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.22.cjs.js +26 -18
- package/dist/index-node-22.22.cjs.js.map +1 -1
- package/dist/index-node-22.22.cjs.web.js +26 -18
- package/dist/index-node-22.22.cjs.web.js.map +1 -1
- package/dist/index-node-22.22.es.mjs +27 -19
- package/dist/index-node-22.22.es.mjs.map +1 -1
- package/dist/index-node-22.22.es.web.mjs +27 -19
- package/dist/index-node-22.22.es.web.mjs.map +1 -1
- package/dist/index.es.js +22 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +22 -19
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/shared/storybook/StoryTitle.tsx +2 -2
- package/src/system/content/typography/Typography.tsx +38 -43
- package/src/system/content/typography/TypographyLink.features.stories.tsx +12 -10
- package/src/system/content/typography/TypographyLink.stories.tsx +3 -1
- package/src/system/content/typography/TypographyLink.tsx +16 -4
- package/src/system/content/typography/utils/getVariantAndWeightValues.tsx +2 -2
- package/src/system/content/typography/utils/typographyContext.ts +2 -2
- package/src/system/dataDisplays/Badge/Badge.tsx +18 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled } from '@tamagui/core';
|
|
2
|
-
import {
|
|
2
|
+
import { InternalTypography } from '../../system/content/typography/Typography';
|
|
3
3
|
|
|
4
|
-
export const StoryTitle = styled(
|
|
4
|
+
export const StoryTitle = styled(InternalTypography, {
|
|
5
5
|
variants: {
|
|
6
6
|
level: {
|
|
7
7
|
1: { variant: 'heading-xl', marginBottom: '$space.8' },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ColorTokens,
|
|
1
|
+
import type { ColorTokens, TextStyle } from '@tamagui/core';
|
|
2
2
|
import { Text, styled } from '@tamagui/core';
|
|
3
|
-
import {
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
4
|
import type { BodyFontVariants, HeadingFontVariants, LabelFontVariants } from '../../core/tokens/GTStandardFont';
|
|
5
5
|
import { CONTENT_CAPS_VARIANTS, type ContentCapsVariants } from '../../core/tokens/GTStandardNarrowFont';
|
|
6
6
|
import type { FontVariants } from '../../core/tokens/fonts';
|
|
@@ -17,7 +17,31 @@ import {
|
|
|
17
17
|
useTypographyWeight,
|
|
18
18
|
} from './utils/typographyContext';
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
interface TypographyWithoutMediaProps {
|
|
21
|
+
color?: ColorTokens;
|
|
22
|
+
textAlign?: TextStyle['textAlign'];
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface BodyProps extends TypographyWithoutMediaProps {
|
|
27
|
+
variant?: BodyFontVariants;
|
|
28
|
+
weight?: 'regular' | 'bold';
|
|
29
|
+
}
|
|
30
|
+
export interface HeadingLabelProps extends TypographyWithoutMediaProps {
|
|
31
|
+
variant: HeadingFontVariants | LabelFontVariants;
|
|
32
|
+
weight?: 'semibold';
|
|
33
|
+
}
|
|
34
|
+
export interface ContentCapsProps extends TypographyWithoutMediaProps {
|
|
35
|
+
variant: ContentCapsVariants;
|
|
36
|
+
weight?: 'bold';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type TypographyTextProps =
|
|
40
|
+
| TamaguiMediaProps<BodyProps>
|
|
41
|
+
| TamaguiMediaProps<HeadingLabelProps>
|
|
42
|
+
| TamaguiMediaProps<ContentCapsProps>;
|
|
43
|
+
|
|
44
|
+
const InternalTypographyBase = styled(Text, {
|
|
21
45
|
fontFamily: '$GTStandard',
|
|
22
46
|
color: '$content.base.hi',
|
|
23
47
|
'$platform-web': {
|
|
@@ -54,41 +78,7 @@ const InternalTypography = styled(Text, {
|
|
|
54
78
|
},
|
|
55
79
|
});
|
|
56
80
|
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
// Remove font-related style props from InternalTypography Props
|
|
60
|
-
type TypographyExcludedFontStyleProps =
|
|
61
|
-
| 'fontFamily'
|
|
62
|
-
| 'fontSize'
|
|
63
|
-
| 'lineHeight'
|
|
64
|
-
| 'fontStyle'
|
|
65
|
-
| 'fontVariant'
|
|
66
|
-
| 'fontWeight'
|
|
67
|
-
| 'color';
|
|
68
|
-
|
|
69
|
-
type TypographyPropsWithoutFontStyleProps = Except<InternalTypographyProps, TypographyExcludedFontStyleProps> & {
|
|
70
|
-
color?: ColorTokens;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export interface BodyProps extends TypographyPropsWithoutFontStyleProps {
|
|
74
|
-
variant?: BodyFontVariants;
|
|
75
|
-
weight?: 'regular' | 'bold';
|
|
76
|
-
}
|
|
77
|
-
export interface HeadingLabelProps extends TypographyPropsWithoutFontStyleProps {
|
|
78
|
-
variant: HeadingFontVariants | LabelFontVariants;
|
|
79
|
-
weight?: 'semibold';
|
|
80
|
-
}
|
|
81
|
-
export interface ContentCapsProps extends TypographyPropsWithoutFontStyleProps {
|
|
82
|
-
variant: ContentCapsVariants;
|
|
83
|
-
weight?: 'bold';
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type TypographyTextProps =
|
|
87
|
-
| TamaguiMediaProps<BodyProps>
|
|
88
|
-
| TamaguiMediaProps<HeadingLabelProps>
|
|
89
|
-
| TamaguiMediaProps<ContentCapsProps>;
|
|
90
|
-
|
|
91
|
-
export const TypographyBase = InternalTypography.styleable<TypographyTextProps, TypographyTextProps>((props, ref) => {
|
|
81
|
+
export const InternalTypography = InternalTypographyBase.styleable<TypographyTextProps>((props, ref) => {
|
|
92
82
|
const typographyVariantAncestorValue = useTypographyVariant();
|
|
93
83
|
const typographyWeightAncestorValue = useTypographyWeight();
|
|
94
84
|
const typographyColorAncestorValue = useTypographyColor();
|
|
@@ -103,7 +93,7 @@ export const TypographyBase = InternalTypography.styleable<TypographyTextProps,
|
|
|
103
93
|
const color = props.color || typographyColorAncestorValue || undefined;
|
|
104
94
|
|
|
105
95
|
let content = (
|
|
106
|
-
<
|
|
96
|
+
<InternalTypographyBase
|
|
107
97
|
ref={ref}
|
|
108
98
|
{...props}
|
|
109
99
|
{...(color ? { color } : undefined)}
|
|
@@ -138,8 +128,13 @@ export const TypographyBase = InternalTypography.styleable<TypographyTextProps,
|
|
|
138
128
|
return content;
|
|
139
129
|
});
|
|
140
130
|
|
|
141
|
-
export
|
|
142
|
-
return
|
|
143
|
-
|
|
144
|
-
|
|
131
|
+
export function TypographyBase(props: TypographyTextProps): ReactNode {
|
|
132
|
+
return <InternalTypography {...props} />;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export const createHeading = (level: number): ((props: TypographyTextProps) => ReactNode) => {
|
|
136
|
+
// eslint-disable-next-line func-names
|
|
137
|
+
return function (props: TypographyTextProps): ReactNode {
|
|
138
|
+
return <InternalTypography role="heading" aria-level={level} {...props} />;
|
|
139
|
+
};
|
|
145
140
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { VStack } from '../../core/primitives/Stack';
|
|
3
|
-
import {
|
|
3
|
+
import type { BodyProps } from './Typography';
|
|
4
|
+
import type { TypographyLinkProps } from './TypographyLink';
|
|
5
|
+
import { InternalTypographyLink, TypographyLink } from './TypographyLink';
|
|
4
6
|
|
|
5
|
-
const meta: Meta<
|
|
7
|
+
const meta: Meta<Extract<TypographyLinkProps, BodyProps>> = {
|
|
6
8
|
title: 'Bumper/Content/TypographyLink/Features',
|
|
7
9
|
component: TypographyLink,
|
|
8
10
|
};
|
|
@@ -45,18 +47,18 @@ export const NoUnderlineTrue: Story = {
|
|
|
45
47
|
export const StateHover: Story = {
|
|
46
48
|
render: () => (
|
|
47
49
|
<VStack gap="$space.16">
|
|
48
|
-
<
|
|
50
|
+
<InternalTypographyLink forceStyle="hover" onPress={() => alert('Link clicked!')}>
|
|
49
51
|
Forced hover state - underline removed (hoverStyle applied)
|
|
50
|
-
</
|
|
51
|
-
<
|
|
52
|
+
</InternalTypographyLink>
|
|
53
|
+
<InternalTypographyLink noUnderline forceStyle="hover" onPress={() => alert('Link clicked!')}>
|
|
52
54
|
Forced hover state with noUnderline - no visual change
|
|
53
|
-
</
|
|
54
|
-
<
|
|
55
|
+
</InternalTypographyLink>
|
|
56
|
+
<InternalTypographyLink disabled forceStyle="hover" onPress={() => alert('Link clicked!')}>
|
|
55
57
|
Forced hover state on disabled - underline removed (hoverStyle applied)
|
|
56
|
-
</
|
|
57
|
-
<
|
|
58
|
+
</InternalTypographyLink>
|
|
59
|
+
<InternalTypographyLink disabled noUnderline forceStyle="hover" onPress={() => alert('Link clicked!')}>
|
|
58
60
|
Forced hover state with noUnderline on disabled - no visual change
|
|
59
|
-
</
|
|
61
|
+
</InternalTypographyLink>
|
|
60
62
|
</VStack>
|
|
61
63
|
),
|
|
62
64
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { contentColorArgType } from '../../../shared/storybook/helpers/argsHelpers';
|
|
3
|
+
import type { BodyProps } from './Typography';
|
|
4
|
+
import type { TypographyLinkProps } from './TypographyLink';
|
|
3
5
|
import { TypographyLink } from './TypographyLink';
|
|
4
6
|
|
|
5
|
-
const meta: Meta<
|
|
7
|
+
const meta: Meta<Extract<TypographyLinkProps, BodyProps>> = {
|
|
6
8
|
title: 'Bumper/Content/TypographyLink',
|
|
7
9
|
component: TypographyLink,
|
|
8
10
|
tags: ['autodocs'],
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import type { GetProps } from '@tamagui/core';
|
|
2
1
|
import { styled } from '@tamagui/core';
|
|
3
|
-
import {
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { TamaguiMediaProps } from '../../types';
|
|
4
|
+
import type { TypographyTextProps } from './Typography';
|
|
5
|
+
import { InternalTypography } from './Typography';
|
|
4
6
|
|
|
5
|
-
export
|
|
7
|
+
export interface TypographyLinkWithoutMediaProps {
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
noUnderline?: boolean;
|
|
10
|
+
onPress: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type TypographyLinkProps = TypographyTextProps & TamaguiMediaProps<TypographyLinkWithoutMediaProps>;
|
|
14
|
+
|
|
15
|
+
export const InternalTypographyLink = styled(InternalTypography, {
|
|
6
16
|
name: 'TypographyLink',
|
|
7
17
|
role: 'link',
|
|
8
18
|
variants: {
|
|
@@ -35,4 +45,6 @@ export const TypographyLink = styled(TypographyBase, {
|
|
|
35
45
|
},
|
|
36
46
|
});
|
|
37
47
|
|
|
38
|
-
export
|
|
48
|
+
export function TypographyLink(props: TypographyLinkProps): ReactNode {
|
|
49
|
+
return <InternalTypographyLink {...props} />;
|
|
50
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BODY_VARIANTS, HEADING_VARIANTS, LABEL_VARIANTS } from '../../../core/tokens/GTStandardFont';
|
|
2
2
|
import { CONTENT_CAPS_VARIANTS } from '../../../core/tokens/GTStandardNarrowFont';
|
|
3
3
|
import type { FontVariants } from '../../../core/tokens/fonts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TypographyTextProps } from '../Typography';
|
|
5
5
|
import type { TypographyVariantContextValue, TypographyWeightContextValue } from './typographyContext';
|
|
6
6
|
|
|
7
7
|
interface VariantAndWeightValues {
|
|
8
|
-
weight:
|
|
8
|
+
weight: TypographyTextProps['weight'] | undefined;
|
|
9
9
|
variant: FontVariants | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { ColorTokens } from '@tamagui/core';
|
|
1
2
|
import { createContext, useContext } from 'react';
|
|
2
3
|
import type { FontVariants } from '../../../core/tokens/fonts';
|
|
3
|
-
import type { TypographyTextProps } from '../Typography';
|
|
4
4
|
|
|
5
5
|
export type TypographyVariantContextValue = FontVariants | null;
|
|
6
6
|
export type TypographyWeightContextValue = 'regular' | 'bold' | 'semibold' | null;
|
|
7
|
-
export type TypograhyColorContextValue =
|
|
7
|
+
export type TypograhyColorContextValue = ColorTokens | null;
|
|
8
8
|
type TypographyContextValue = boolean;
|
|
9
9
|
|
|
10
10
|
export const TypographyVariantContext = createContext<TypographyVariantContextValue>(null);
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { styled } from '@tamagui/core';
|
|
1
|
+
import { styled, useProps } from '@tamagui/core';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { InternalTypography } from '../../content/typography/Typography';
|
|
4
4
|
import { Center } from '../../core/primitives/Center';
|
|
5
5
|
import type { TamaguiMediaProps } from '../../types';
|
|
6
6
|
|
|
7
|
+
export interface BadgeWithoutMediaProps {
|
|
8
|
+
/** The count to display. If undefined, it renders as a dot. */
|
|
9
|
+
count?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Maximum count to display. Shows "{max}+" when count exceeds max.
|
|
12
|
+
* @default 9
|
|
13
|
+
*/
|
|
14
|
+
maxCount?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type BadgeProps = TamaguiMediaProps<BadgeWithoutMediaProps>;
|
|
18
|
+
|
|
7
19
|
const DOT_SIZE = 8;
|
|
8
20
|
const MIN_COUNT_WIDTH = 16;
|
|
9
21
|
|
|
@@ -24,19 +36,9 @@ const BadgeCount = styled(BadgeBase, {
|
|
|
24
36
|
paddingHorizontal: '$space.4',
|
|
25
37
|
});
|
|
26
38
|
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
count?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Maximum count to display. Shows "{max}+" when count exceeds max.
|
|
32
|
-
* @default 9
|
|
33
|
-
*/
|
|
34
|
-
maxCount?: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type BadgeProps = TamaguiMediaProps<InternalBadgeProps>;
|
|
39
|
+
export function Badge(props: BadgeProps): ReactNode {
|
|
40
|
+
const { count, maxCount = 9 } = useProps(props);
|
|
38
41
|
|
|
39
|
-
export function Badge({ count, maxCount = 9 }: BadgeProps): ReactNode {
|
|
40
42
|
if (count === undefined) {
|
|
41
43
|
return <BadgeDot />;
|
|
42
44
|
}
|
|
@@ -45,7 +47,7 @@ export function Badge({ count, maxCount = 9 }: BadgeProps): ReactNode {
|
|
|
45
47
|
|
|
46
48
|
return (
|
|
47
49
|
<BadgeCount>
|
|
48
|
-
<
|
|
50
|
+
<InternalTypography
|
|
49
51
|
variant="content-caps-xs"
|
|
50
52
|
weight="bold"
|
|
51
53
|
color="$content.base.onContrasted.hi"
|
|
@@ -53,7 +55,7 @@ export function Badge({ count, maxCount = 9 }: BadgeProps): ReactNode {
|
|
|
53
55
|
paddingBottom={1}
|
|
54
56
|
>
|
|
55
57
|
{displayCount}
|
|
56
|
-
</
|
|
58
|
+
</InternalTypography>
|
|
57
59
|
</BadgeCount>
|
|
58
60
|
);
|
|
59
61
|
}
|