@ornikar/bumper 1.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.
Files changed (108) hide show
  1. package/.eslintrc.json +3 -0
  2. package/.vscode/settings.json +3 -0
  3. package/CHANGELOG.md +20 -0
  4. package/dist/definitions/components/breakpoints/SwitchBreakpoins.d.ts +5 -0
  5. package/dist/definitions/components/breakpoints/SwitchBreakpoins.d.ts.map +1 -0
  6. package/dist/definitions/components/breakpoints/hooks/useBreakpointValue.d.ts +3 -0
  7. package/dist/definitions/components/breakpoints/hooks/useBreakpointValue.d.ts.map +1 -0
  8. package/dist/definitions/components/breakpoints/hooks/useCurrentBreakpointName.d.ts +3 -0
  9. package/dist/definitions/components/breakpoints/hooks/useCurrentBreakpointName.d.ts.map +1 -0
  10. package/dist/definitions/components/breakpoints/hooks/useWindowSize.d.ts +2 -0
  11. package/dist/definitions/components/breakpoints/hooks/useWindowSize.d.ts.map +1 -0
  12. package/dist/definitions/components/breakpoints/utils/breakpointsUtils.d.ts +10 -0
  13. package/dist/definitions/components/breakpoints/utils/breakpointsUtils.d.ts.map +1 -0
  14. package/dist/definitions/components/primitives/Stacks.d.ts +9 -0
  15. package/dist/definitions/components/primitives/Stacks.d.ts.map +1 -0
  16. package/dist/definitions/components/primitives/View.d.ts +5 -0
  17. package/dist/definitions/components/primitives/View.d.ts.map +1 -0
  18. package/dist/definitions/components/typography/Typograhy.d.ts +40 -0
  19. package/dist/definitions/components/typography/Typograhy.d.ts.map +1 -0
  20. package/dist/definitions/components/typography/utils/getTypeAndWeightValues.d.ts +9 -0
  21. package/dist/definitions/components/typography/utils/getTypeAndWeightValues.d.ts.map +1 -0
  22. package/dist/definitions/core/BumperDecorator.d.ts +2 -0
  23. package/dist/definitions/core/BumperDecorator.d.ts.map +1 -0
  24. package/dist/definitions/core/BumperProvider.d.ts +6 -0
  25. package/dist/definitions/core/BumperProvider.d.ts.map +1 -0
  26. package/dist/definitions/index.d.ts +10 -0
  27. package/dist/definitions/index.d.ts.map +1 -0
  28. package/dist/definitions/story-components/StorySection.d.ts +20 -0
  29. package/dist/definitions/story-components/StorySection.d.ts.map +1 -0
  30. package/dist/definitions/story-components/StoryTitle.d.ts +6 -0
  31. package/dist/definitions/story-components/StoryTitle.d.ts.map +1 -0
  32. package/dist/definitions/tamagui.config.d.ts +148 -0
  33. package/dist/definitions/tamagui.config.d.ts.map +1 -0
  34. package/dist/definitions/themes/light.d.ts +53 -0
  35. package/dist/definitions/themes/light.d.ts.map +1 -0
  36. package/dist/definitions/themes/palettes/deepPurpleColorPalette.d.ts +86 -0
  37. package/dist/definitions/themes/palettes/deepPurpleColorPalette.d.ts.map +1 -0
  38. package/dist/definitions/themes/utils/breakpoints.d.ts +15 -0
  39. package/dist/definitions/themes/utils/breakpoints.d.ts.map +1 -0
  40. package/dist/definitions/tokens/fonts.d.ts +18 -0
  41. package/dist/definitions/tokens/fonts.d.ts.map +1 -0
  42. package/dist/definitions/tokens/size.d.ts +11 -0
  43. package/dist/definitions/tokens/size.d.ts.map +1 -0
  44. package/dist/definitions/tokens/space.d.ts +16 -0
  45. package/dist/definitions/tokens/space.d.ts.map +1 -0
  46. package/dist/index-metro.es.android.js +396 -0
  47. package/dist/index-metro.es.android.js.map +1 -0
  48. package/dist/index-metro.es.ios.js +396 -0
  49. package/dist/index-metro.es.ios.js.map +1 -0
  50. package/dist/index-node-22.17.cjs.js +405 -0
  51. package/dist/index-node-22.17.cjs.js.map +1 -0
  52. package/dist/index-node-22.17.cjs.web.js +405 -0
  53. package/dist/index-node-22.17.cjs.web.js.map +1 -0
  54. package/dist/index-node-22.17.es.mjs +395 -0
  55. package/dist/index-node-22.17.es.mjs.map +1 -0
  56. package/dist/index-node-22.17.es.web.mjs +395 -0
  57. package/dist/index-node-22.17.es.web.mjs.map +1 -0
  58. package/dist/index.es.js +392 -0
  59. package/dist/index.es.js.map +1 -0
  60. package/dist/index.es.web.js +392 -0
  61. package/dist/index.es.web.js.map +1 -0
  62. package/dist/tsbuildinfo +1 -0
  63. package/package.json +79 -0
  64. package/src/.eslintrc.json +20 -0
  65. package/src/components/breakpoints/SwitchBreakpoins.tsx +12 -0
  66. package/src/components/breakpoints/__snapshots__/breakpoints.stories.tsx.snap +49 -0
  67. package/src/components/breakpoints/__snapshots_web__/breakpoints.stories.tsx.snap +43 -0
  68. package/src/components/breakpoints/breakpoints.stories.tsx +45 -0
  69. package/src/components/breakpoints/hooks/useBreakpointValue.ts +12 -0
  70. package/src/components/breakpoints/hooks/useCurrentBreakpointName.ts +20 -0
  71. package/src/components/breakpoints/hooks/useWindowSize.ts +1 -0
  72. package/src/components/breakpoints/utils/breakpointsUtils.test.ts +85 -0
  73. package/src/components/breakpoints/utils/breakpointsUtils.ts +28 -0
  74. package/src/components/primitives/Stack.stories.tsx +62 -0
  75. package/src/components/primitives/Stacks.ts +19 -0
  76. package/src/components/primitives/View.stories.tsx +13 -0
  77. package/src/components/primitives/View.ts +5 -0
  78. package/src/components/primitives/__snapshots__/Stack.stories.tsx.snap +376 -0
  79. package/src/components/primitives/__snapshots__/View.stories.tsx.snap +25 -0
  80. package/src/components/primitives/__snapshots_web__/Stack.stories.tsx.snap +190 -0
  81. package/src/components/primitives/__snapshots_web__/View.stories.tsx.snap +28 -0
  82. package/src/components/typography/Typograhy.tsx +130 -0
  83. package/src/components/typography/Typography.stories.tsx +144 -0
  84. package/src/components/typography/__snapshots__/Typography.stories.tsx.snap +1471 -0
  85. package/src/components/typography/__snapshots_web__/Typography.stories.tsx.snap +605 -0
  86. package/src/components/typography/utils/getTypeAndWeightValues.test.tsx +147 -0
  87. package/src/components/typography/utils/getTypeAndWeightValues.tsx +32 -0
  88. package/src/core/BumperDecorator.tsx +11 -0
  89. package/src/core/BumperProvider.tsx +15 -0
  90. package/src/index.ts +11 -0
  91. package/src/story-components/StorySection.tsx +70 -0
  92. package/src/story-components/StoryTitle.tsx +16 -0
  93. package/src/tamagui.config.ts +43 -0
  94. package/src/themes/__snapshots__/light.stories.tsx.snap +2192 -0
  95. package/src/themes/__snapshots_web__/light.stories.tsx.snap +985 -0
  96. package/src/themes/light.stories.tsx +38 -0
  97. package/src/themes/light.ts +59 -0
  98. package/src/themes/palettes/__snapshots__/deepPurpleColorPalette.stories.tsx.snap +2770 -0
  99. package/src/themes/palettes/__snapshots_web__/deepPurpleColorPalette.stories.tsx.snap +1213 -0
  100. package/src/themes/palettes/deepPurpleColorPalette.stories.tsx +37 -0
  101. package/src/themes/palettes/deepPurpleColorPalette.ts +147 -0
  102. package/src/themes/utils/breakpoints.ts +15 -0
  103. package/src/tokens/fonts.ts +95 -0
  104. package/src/tokens/size.ts +10 -0
  105. package/src/tokens/space.ts +15 -0
  106. package/tsconfig.build.json +25 -0
  107. package/tsconfig.eslint.json +6 -0
  108. package/tsconfig.json +21 -0
@@ -0,0 +1,37 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import type { GetThemeValueForKey } from '@tamagui/core';
3
+ import { View } from '../../components/primitives/View';
4
+ import { Typography } from '../../components/typography/Typograhy';
5
+ import { StorySection } from '../../story-components/StorySection';
6
+ import { deepPurpleColorPalette } from './deepPurpleColorPalette';
7
+
8
+ export default {
9
+ title: 'bumper/Core Tokens',
10
+ component: View,
11
+ } satisfies Meta<typeof View>;
12
+
13
+ const TokenView = ({ tokenName, tokenValue }: { tokenName: string; tokenValue: string }) => {
14
+ return (
15
+ <View
16
+ key={tokenName}
17
+ padding="$8"
18
+ borderBottomWidth="$2"
19
+ borderBottomColor="$border.base.mid"
20
+ backgroundColor="$bg.base.low.default"
21
+ >
22
+ <Typography.Text>{tokenName}</Typography.Text>
23
+ <Typography.Text>{tokenValue}</Typography.Text>
24
+ <View backgroundColor={tokenValue as GetThemeValueForKey<'backgroundColor'>} width="$20" height="$20" />
25
+ </View>
26
+ );
27
+ };
28
+
29
+ export const TypographyHeadingStory: ComponentStory<typeof View> = () => (
30
+ <StorySection title="Palette">
31
+ {Object.entries(deepPurpleColorPalette).map(([tokenName, tokenValue]) => (
32
+ <TokenView key={tokenName} tokenName={tokenName} tokenValue={tokenValue} />
33
+ ))}
34
+ </StorySection>
35
+ );
36
+
37
+ TypographyHeadingStory.storyName = 'Deep Purple Palette';
@@ -0,0 +1,147 @@
1
+ import type { IntRange, UnionToIntersection } from 'type-fest';
2
+
3
+ interface ColorScaleKeysMap {
4
+ deepPurple: IntRange<5, 10>;
5
+ beige: IntRange<1, 7>;
6
+ lightning: 4 | 5 | 8 | 9;
7
+ rainbow:
8
+ | 'pink'
9
+ | 'brick'
10
+ | 'orange'
11
+ | 'gold'
12
+ | 'sun'
13
+ | 'green-pine'
14
+ | 'green-grass'
15
+ | 'green-apple'
16
+ | 'blue-electric'
17
+ | 'blue-sky';
18
+ grey: 0 | 1 | 2 | 3 | 5 | 7 | 9;
19
+ blue: 1 | 2 | 6 | 7;
20
+ green: 1 | 2 | 6 | 7;
21
+ yellow: 1 | 2 | 6 | 7;
22
+ red: 1 | 2 | 6 | 7;
23
+ 'beige-alpha': '25' | '40' | '50';
24
+ 'grey-alpha': '25' | '35' | '50';
25
+ 'white-alpha': '10' | '20' | '60' | '80' | '90';
26
+ }
27
+
28
+ type CreateColorScale<K extends keyof ColorScaleKeysMap> = Record<ColorScaleKeysMap[K], string>;
29
+
30
+ type ColorScales = {
31
+ [K in keyof ColorScaleKeysMap]: CreateColorScale<K>;
32
+ };
33
+
34
+ type CreateTokens<K extends keyof ColorScaleKeysMap> = {
35
+ [Key in ColorScaleKeysMap[K] as `${K}.${Key}`]: string;
36
+ };
37
+
38
+ type ColorScaleTokens = UnionToIntersection<
39
+ {
40
+ [K in keyof ColorScaleKeysMap]: CreateTokens<K>;
41
+ }[keyof ColorScaleKeysMap]
42
+ >;
43
+
44
+ const createColorScale = <const T extends Record<string | number, string>>(colorScale: T): T => colorScale;
45
+
46
+ export const colorScales: ColorScales = {
47
+ deepPurple: createColorScale({
48
+ 5: '#936C93',
49
+ 6: '#7A587A',
50
+ 7: '#6E4D6E',
51
+ 8: '#563B56',
52
+ 9: '#452F45',
53
+ }),
54
+ beige: createColorScale({
55
+ 1: '#F7F4EE',
56
+ 2: '#F1ECE4',
57
+ 3: '#EAE3D6',
58
+ 4: '#E5DCCA',
59
+ 5: '#DDD0B8',
60
+ 6: '#C1B59F',
61
+ }),
62
+ lightning: createColorScale({
63
+ 4: '#FFF966',
64
+ 5: '#FFF500',
65
+ 8: '#594D0D',
66
+ 9: '#43390A',
67
+ }),
68
+ rainbow: createColorScale({
69
+ pink: '#E4A4F9',
70
+ brick: '#951D12',
71
+ orange: '#DB6E2E',
72
+ gold: '#9A7600',
73
+ sun: '#EFD346',
74
+ 'green-pine': '#1C5D47',
75
+ 'green-grass': '#4DA00A',
76
+ 'green-apple': '#DEF985',
77
+ 'blue-electric': '#2850C4',
78
+ 'blue-sky': '#B2F0FD',
79
+ }),
80
+ grey: createColorScale({
81
+ 0: '#ffffff',
82
+ 1: '#ECECEC',
83
+ 2: '#CDCED0',
84
+ 3: '#A8A8A8',
85
+ 5: '#838383',
86
+ 7: '#505050',
87
+ 9: '#101010',
88
+ }),
89
+ blue: createColorScale({
90
+ 1: '#E9F4FC',
91
+ 2: '#BCDFF6',
92
+ 6: '#1772AB',
93
+ 7: '#125A87',
94
+ }),
95
+ green: createColorScale({
96
+ 1: '#ECFEDD',
97
+ 2: '#DBFAC1',
98
+ 6: '#438D06',
99
+ 7: '#357105',
100
+ }),
101
+ yellow: createColorScale({
102
+ 1: '#FDF8E7',
103
+ 2: '#FAEBB8',
104
+ 6: '#EFC11F',
105
+ 7: '#BA930B',
106
+ }),
107
+ red: createColorScale({
108
+ 1: '#FDE4E3',
109
+ 2: '#FAB8B8',
110
+ 6: '#F14847',
111
+ 7: '#BD100F',
112
+ }),
113
+ 'beige-alpha': createColorScale({
114
+ '25': '#C1B59F40',
115
+ '40': '#C1B59F66',
116
+ '50': '#C1B59F80',
117
+ }),
118
+ 'grey-alpha': createColorScale({
119
+ '25': '#10101040',
120
+ '35': '#10101059',
121
+ '50': '#10101080',
122
+ }),
123
+ 'white-alpha': createColorScale({
124
+ '10': '#FFFFFF1A',
125
+ '20': '#FFFFFF33',
126
+ '60': '#FFFFFF99',
127
+ '80': '#FFFFFFCC',
128
+ '90': '#FFFFFFE5',
129
+ }),
130
+ } as const;
131
+
132
+ const transformColorScalesToTokens = (): ColorScaleTokens => {
133
+ return Object.fromEntries(
134
+ Object.entries(colorScales).flatMap(([colorName, colorScale]) => {
135
+ return Object.entries(colorScale).map(([scaleNumber, colorValue]) => {
136
+ return [`${colorName}.${scaleNumber}`, colorValue];
137
+ });
138
+ }),
139
+ ) as ColorScaleTokens;
140
+ };
141
+
142
+ export const deepPurpleColorPalette = {
143
+ ...transformColorScalesToTokens(),
144
+ white: '#FFFFFF',
145
+ black: '#000000',
146
+ transparent: 'transparent',
147
+ };
@@ -0,0 +1,15 @@
1
+ export enum BreakpointNameEnum {
2
+ BASE = 'base',
3
+ SMALL = 'small',
4
+ MEDIUM = 'medium',
5
+ LARGE = 'large',
6
+ WIDE = 'wide',
7
+ }
8
+
9
+ export const breakpoints = {
10
+ [BreakpointNameEnum.BASE]: 0,
11
+ [BreakpointNameEnum.SMALL]: 480,
12
+ [BreakpointNameEnum.MEDIUM]: 768,
13
+ [BreakpointNameEnum.LARGE]: 1024,
14
+ [BreakpointNameEnum.WIDE]: 1280,
15
+ };
@@ -0,0 +1,95 @@
1
+ import { createFont } from '@tamagui/core';
2
+
3
+ export const HEADING_VARIANTS = [
4
+ 'heading-2xl',
5
+ 'heading-xl',
6
+ 'heading-l',
7
+ 'heading-m',
8
+ 'heading-s',
9
+ 'heading-xs',
10
+ ] as const;
11
+ export const BODY_VARIANTS = ['body-xl', 'body-l', 'body-m', 'body-s', 'body-xs'] as const;
12
+ export const LABEL_VARIANTS = ['label-xl', 'label-l', 'label-m', 'label-s'] as const;
13
+ export const VARIANTS = [...HEADING_VARIANTS, ...BODY_VARIANTS, ...LABEL_VARIANTS] as const;
14
+
15
+ export type FontVariants = (typeof VARIANTS)[number];
16
+ export type BodyFontVariants = (typeof BODY_VARIANTS)[number];
17
+ export type LabelFontVariants = (typeof LABEL_VARIANTS)[number];
18
+ export type HeadingFontVariants = (typeof HEADING_VARIANTS)[number];
19
+
20
+ export type GTStandardFontWeight = '500' | '600' | '700';
21
+
22
+ const GTStandardFaces: Record<GTStandardFontWeight, Record<string, string>> = {
23
+ 500: { normal: 'GTStandardRegular' },
24
+ 600: { normal: 'GTStandardSemibold' },
25
+ 700: { normal: 'GTStandardBold' },
26
+ };
27
+
28
+ const size: Record<FontVariants, number> = {
29
+ 'heading-2xl': 56,
30
+ 'heading-xl': 48,
31
+ 'heading-l': 38,
32
+ 'heading-m': 24,
33
+ 'heading-s': 20,
34
+ 'heading-xs': 16,
35
+ 'body-xl': 24,
36
+ 'body-l': 18,
37
+ 'body-m': 16,
38
+ 'body-s': 14,
39
+ 'body-xs': 12,
40
+ 'label-xl': 18,
41
+ 'label-l': 16,
42
+ 'label-m': 14,
43
+ 'label-s': 12,
44
+ };
45
+
46
+ const lineHeight: Record<FontVariants, number> = {
47
+ 'heading-2xl': 64,
48
+ 'heading-xl': 56,
49
+ 'heading-l': 48,
50
+ 'heading-m': 32,
51
+ 'heading-s': 20,
52
+ 'heading-xs': 18,
53
+ 'body-xl': 32,
54
+ 'body-l': 26,
55
+ 'body-m': 24,
56
+ 'body-s': 20,
57
+ 'body-xs': 16,
58
+ 'label-xl': 26,
59
+ 'label-l': 24,
60
+ 'label-m': 20,
61
+ 'label-s': 16,
62
+ };
63
+
64
+ const letterSpacing: Record<FontVariants, number> = {
65
+ 'heading-2xl': 0,
66
+ 'heading-xl': 0,
67
+ 'heading-l': 0,
68
+ 'heading-m': 0,
69
+ 'heading-s': 0,
70
+ 'heading-xs': 0,
71
+ 'body-xl': 0.3,
72
+ 'body-l': 0.3,
73
+ 'body-m': 0.3,
74
+ 'body-s': 0.3,
75
+ 'body-xs': 0.3,
76
+ 'label-xl': 0,
77
+ 'label-l': 0,
78
+ 'label-m': 0,
79
+ 'label-s': 0,
80
+ };
81
+
82
+ const weight: Record<string, GTStandardFontWeight> = {
83
+ bold: '700',
84
+ semibold: '600',
85
+ regular: '500',
86
+ };
87
+
88
+ export const fonts = createFont({
89
+ family: 'GTStandard',
90
+ size,
91
+ lineHeight,
92
+ letterSpacing,
93
+ weight,
94
+ face: GTStandardFaces,
95
+ });
@@ -0,0 +1,10 @@
1
+ export const sizeTokens = {
2
+ 16: 16,
3
+ 20: 20,
4
+ 24: 24,
5
+ 32: 32,
6
+ 80: 80,
7
+ 128: 128,
8
+ 176: 176,
9
+ 208: 208,
10
+ };
@@ -0,0 +1,15 @@
1
+ export const spaceTokens = {
2
+ 0: 0,
3
+ 2: 2,
4
+ 4: 4,
5
+ 8: 8,
6
+ 12: 12,
7
+ 16: 16,
8
+ 24: 24,
9
+ 32: 32,
10
+ 40: 40,
11
+ 48: 48,
12
+ 56: 56,
13
+ 64: 64,
14
+ 80: 80,
15
+ };
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist/definitions",
5
+ "tsBuildInfoFile": "dist/tsbuildinfo",
6
+ "noEmit": false,
7
+ "emitDeclarationOnly": true,
8
+ "paths": {
9
+ "@ornikar/bumper": ["./src/index.ts"]
10
+ }
11
+ },
12
+ "exclude": [
13
+ "dist",
14
+ "**/__mocks__",
15
+ "**/__tests__",
16
+ "**/*.test.ts",
17
+ "**/*.test.tsx",
18
+ "**/*.stories.ts",
19
+ "**/*.stories.tsx",
20
+ "**/stories.ts",
21
+ "**/stories.tsx",
22
+ "**/stories/**",
23
+ "**/stories-list.ts"
24
+ ]
25
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true
5
+ }
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "composite": true,
6
+ "incremental": true,
7
+ "isolatedModules": true,
8
+ "moduleDetection": "force",
9
+ "noEmit": false,
10
+ "noEmitOnError": true,
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "outDir": "../../node_modules/.cache/tsc/@ornikar/bumper",
14
+ "tsBuildInfoFile": "../../node_modules/.cache/tsc/@ornikar/bumper/tsbuildinfo",
15
+ "paths": {
16
+ "@ornikar/bumper": ["./src/index.ts"]
17
+ },
18
+ "jsx": "react-jsx"
19
+ },
20
+ "include": ["src", "../../typings"]
21
+ }