@latte-macchiat-io/latte-vanilla-components 0.0.205 → 0.0.207

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": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.205",
3
+ "version": "0.0.207",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -9,8 +9,8 @@ export type HeadingProps = React.HTMLAttributes<HTMLHeadingElement> &
9
9
  children: React.ReactNode;
10
10
  };
11
11
 
12
- export const Heading = ({ as, size, weight, align, className, children }: HeadingProps) => {
12
+ export const Heading = ({ as, size, align, className, children }: HeadingProps) => {
13
13
  const Component = as as AllowedHeading;
14
14
 
15
- return <Component className={clsx(headingRecipe({ size, weight, align }), className)}>{children}</Component>;
15
+ return <Component className={clsx(headingRecipe({ size, align }), className)}>{children}</Component>;
16
16
  };
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+
4
+ import { Heading } from '.';
5
+
6
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
7
+ const meta: Meta<typeof Heading> = {
8
+ title: 'Latte Components / 1. Global / Heading',
9
+ component: Heading,
10
+ parameters: {
11
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
12
+ layout: 'centered',
13
+ },
14
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
15
+ tags: ['autodocs'],
16
+ // More on argTypes: https://storybook.js.org/docs/api/argtypes
17
+ argTypes: {},
18
+ // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
19
+ };
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
25
+ export const Default: Story = {
26
+ args: {
27
+ children: <>Title</>,
28
+ },
29
+ };
@@ -1,7 +1,8 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
- import { sprinkles } from '../../styles/sprinkles.css';
3
+
4
4
  import { themeContract } from '../../theme/contract.css';
5
+ import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
6
 
6
7
  export const headingRecipe = recipe({
7
8
  base: style({
@@ -11,41 +12,93 @@ export const headingRecipe = recipe({
11
12
  }),
12
13
 
13
14
  variants: {
14
- size: {
15
- h1: [
16
- sprinkles({
17
- fontSize: { mobile: '2xl', md: '3xl', lg: '4xl' },
18
- lineHeight: { mobile: 'tight', md: 'tight', lg: 'tight' },
19
- }),
20
- ],
21
- h2: sprinkles({
22
- fontSize: { mobile: 'xl', md: '2xl', lg: '3xl' },
23
- lineHeight: { mobile: 'tight', md: 'tight', lg: 'tight' },
24
- }),
25
- h3: sprinkles({
26
- fontSize: { mobile: 'lg', md: 'xl', lg: '2xl' },
27
- lineHeight: { mobile: 'normal', md: 'tight', lg: 'tight' },
28
- }),
29
- h4: sprinkles({
30
- fontSize: { mobile: 'md', md: 'lg', lg: 'xl' },
31
- lineHeight: { mobile: 'normal', md: 'normal', lg: 'tight' },
32
- }),
33
- h5: sprinkles({
34
- fontSize: { mobile: 'sm', md: 'md', lg: 'lg' },
35
- lineHeight: { mobile: 'normal', md: 'normal', lg: 'normal' },
36
- }),
37
- h6: sprinkles({
38
- fontSize: { mobile: 'xs', md: 'sm', lg: 'md' },
39
- lineHeight: { mobile: 'relaxed', md: 'normal', lg: 'normal' },
40
- }),
15
+ level: {
16
+ h1: {
17
+ fontWeight: themeContract.heading.h1.fontWeight,
18
+ fontFamily: themeContract.heading.h1.fontFamily,
19
+ },
20
+
21
+ h2: {
22
+ fontWeight: themeContract.heading.h2.fontWeight,
23
+ fontFamily: themeContract.heading.h2.fontFamily,
24
+ },
25
+
26
+ h3: {
27
+ fontWeight: themeContract.heading.h3.fontWeight,
28
+ fontFamily: themeContract.heading.h3.fontFamily,
29
+ },
30
+
31
+ h4: {
32
+ fontWeight: themeContract.heading.h4.fontWeight,
33
+ fontFamily: themeContract.heading.h4.fontFamily,
34
+ },
35
+
36
+ h5: {
37
+ fontWeight: themeContract.heading.h5.fontWeight,
38
+ fontFamily: themeContract.heading.h5.fontFamily,
39
+ },
40
+
41
+ h6: {
42
+ fontWeight: themeContract.heading.h6.fontWeight,
43
+ fontFamily: themeContract.heading.h6.fontFamily,
44
+ },
41
45
  },
42
46
 
43
- weight: {
44
- light: { fontWeight: themeContract.fontWeights.light },
45
- normal: { fontWeight: themeContract.fontWeights.normal },
46
- medium: { fontWeight: themeContract.fontWeights.medium },
47
- semibold: { fontWeight: themeContract.fontWeights.semibold },
48
- bold: { fontWeight: themeContract.fontWeights.bold },
47
+ size: {
48
+ xxl: {
49
+ lineHeight: themeContract.heading.size.xxl.lineHeight,
50
+ '@media': {
51
+ ...generateResponsiveMedia({
52
+ fontSize: themeContract.heading.size.xxl.fontSize,
53
+ paddingBottom: themeContract.heading.size.xxl.fontSize,
54
+ }),
55
+ },
56
+ },
57
+ xl: {
58
+ lineHeight: themeContract.heading.size.xl.lineHeight,
59
+ '@media': {
60
+ ...generateResponsiveMedia({
61
+ fontSize: themeContract.heading.size.xl.fontSize,
62
+ paddingBottom: themeContract.heading.size.xl.fontSize,
63
+ }),
64
+ },
65
+ },
66
+ lg: {
67
+ lineHeight: themeContract.heading.size.lg.lineHeight,
68
+ '@media': {
69
+ ...generateResponsiveMedia({
70
+ fontSize: themeContract.heading.size.lg.fontSize,
71
+ paddingBottom: themeContract.heading.size.lg.fontSize,
72
+ }),
73
+ },
74
+ },
75
+ md: {
76
+ lineHeight: themeContract.heading.size.md.lineHeight,
77
+ '@media': {
78
+ ...generateResponsiveMedia({
79
+ fontSize: themeContract.heading.size.md.fontSize,
80
+ paddingBottom: themeContract.heading.size.md.fontSize,
81
+ }),
82
+ },
83
+ },
84
+ sm: {
85
+ lineHeight: themeContract.heading.size.sm.lineHeight,
86
+ '@media': {
87
+ ...generateResponsiveMedia({
88
+ fontSize: themeContract.heading.size.sm.fontSize,
89
+ paddingBottom: themeContract.heading.size.sm.fontSize,
90
+ }),
91
+ },
92
+ },
93
+ xs: {
94
+ lineHeight: themeContract.heading.size.xs.lineHeight,
95
+ '@media': {
96
+ ...generateResponsiveMedia({
97
+ fontSize: themeContract.heading.size.xs.fontSize,
98
+ paddingBottom: themeContract.heading.size.xs.fontSize,
99
+ }),
100
+ },
101
+ },
49
102
  },
50
103
 
51
104
  align: {
@@ -56,9 +109,9 @@ export const headingRecipe = recipe({
56
109
  },
57
110
 
58
111
  defaultVariants: {
59
- size: 'h2',
112
+ size: 'xl',
113
+ level: 'h2',
60
114
  align: 'left',
61
- weight: 'medium',
62
115
  },
63
116
  });
64
117
 
@@ -0,0 +1,84 @@
1
+ const themeHeadingBase = {
2
+ heading: {
3
+ h1: {
4
+ color: '',
5
+ fontWeight: '800',
6
+ fontFamily: `var(--font-outfit)`,
7
+ },
8
+
9
+ h2: {
10
+ color: '',
11
+ fontWeight: '800',
12
+ fontFamily: `var(--font-outfit)`,
13
+ },
14
+
15
+ h3: {
16
+ color: '',
17
+ fontWeight: '800',
18
+ fontFamily: `var(--font-outfit)`,
19
+ },
20
+
21
+ h4: {
22
+ color: '',
23
+ fontWeight: '800',
24
+ fontFamily: `var(--font-outfit)`,
25
+ },
26
+
27
+ h5: {
28
+ color: '',
29
+ fontWeight: '800',
30
+ fontFamily: `var(--font-outfit)`,
31
+ },
32
+
33
+ h6: {
34
+ color: '',
35
+ fontWeight: '800',
36
+ fontFamily: `var(--font-outfit)`,
37
+ },
38
+
39
+ size: {
40
+ xxl: {
41
+ lineHeight: '1.2em',
42
+ paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
43
+ fontSize: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
44
+ },
45
+ xl: {
46
+ lineHeight: '1.2em',
47
+ fontSize: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
48
+ paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
49
+ },
50
+ lg: {
51
+ lineHeight: '1.2em',
52
+ fontSize: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
53
+ paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
54
+ },
55
+ md: {
56
+ lineHeight: '1.2em',
57
+ fontSize: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
58
+ paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
59
+ },
60
+ sm: {
61
+ lineHeight: '1.2em',
62
+ fontSize: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
63
+ paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
64
+ },
65
+ xs: {
66
+ lineHeight: '1.2em',
67
+ fontSize: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
68
+ paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
69
+ },
70
+ },
71
+ },
72
+ };
73
+
74
+ export const themeHeadingLight = {
75
+ heading: {
76
+ ...themeHeadingBase.heading,
77
+ },
78
+ };
79
+
80
+ export const themeHeadingDark = {
81
+ heading: {
82
+ ...themeHeadingBase.heading,
83
+ },
84
+ };
@@ -4,6 +4,7 @@ import { themeCarouselDark, themeCarouselLight } from '../components/Carousel/th
4
4
  import { themeColumnsDark, themeColumnsLight } from '../components/Columns/theme';
5
5
  import { themeFooterDark, themeFooterLight } from '../components/Footer/theme';
6
6
  import { themeHeaderDark, themeHeaderLight } from '../components/Header/theme';
7
+ import { themeHeadingDark, themeHeadingLight } from '../components/Heading/theme';
7
8
  import { themeIconDark, themeIconLight } from '../components/Icon/theme';
8
9
  import { themeKeyNumberDark, themeKeyNumberLight } from '../components/KeyNumber/theme';
9
10
  import { themeMainDark, themeMainLight } from '../components/Main/theme';
@@ -119,6 +120,7 @@ export const baseLightTheme = {
119
120
  },
120
121
 
121
122
  ...themeSectionLight,
123
+ ...themeHeadingLight,
122
124
 
123
125
  ...themeActionsLight,
124
126
  ...themeButtonLight,
@@ -243,6 +245,7 @@ export const baseDarkTheme = {
243
245
  },
244
246
 
245
247
  ...themeSectionDark,
248
+ ...themeHeadingDark,
246
249
 
247
250
  ...themeActionsDark,
248
251
  ...themeButtonDark,
@@ -210,6 +210,155 @@ export const themeContract = createGlobalThemeContract({
210
210
  },
211
211
  },
212
212
 
213
+ heading: {
214
+ h1: {
215
+ color: 'latte-heading-h1-color',
216
+ fontWeight: 'latte-heading-h1-fontWeight',
217
+ fontFamily: 'latte-heading-h1-fontFamily',
218
+ },
219
+ h2: {
220
+ color: 'latte-heading-h2-color',
221
+ fontWeight: 'latte-heading-h2-fontWeight',
222
+ fontFamily: 'latte-heading-h2-fontFamily',
223
+ },
224
+ h3: {
225
+ color: 'latte-heading-h3-color',
226
+ fontWeight: 'latte-heading-h3-fontWeight',
227
+ fontFamily: 'latte-heading-h3-fontFamily',
228
+ },
229
+ h4: {
230
+ color: 'latte-heading-h4-color',
231
+ fontWeight: 'latte-heading-h4-fontWeight',
232
+ fontFamily: 'latte-heading-h4-fontFamily',
233
+ },
234
+ h5: {
235
+ color: 'latte-heading-h5-color',
236
+ fontWeight: 'latte-heading-h5-fontWeight',
237
+ fontFamily: 'latte-heading-h5-fontFamily',
238
+ },
239
+ h6: {
240
+ color: 'latte-heading-h6-color',
241
+ fontWeight: 'latte-heading-h6-fontWeight',
242
+ fontFamily: 'latte-heading-h6-fontFamily',
243
+ },
244
+ size: {
245
+ xxl: {
246
+ lineHeight: 'latte-heading-size-xxl-lineHeight',
247
+ fontSize: {
248
+ mobile: 'latte-heading-size-xxl-fontSize-mobile',
249
+ sm: 'latte-heading-size-xxl-fontSize--sm',
250
+ md: 'latte-heading-size-xxl-fontSize--md',
251
+ lg: 'latte-heading-size-xxl-fontSize--lg',
252
+ xl: 'latte-heading-size-xxl-fontSize--xl',
253
+ '2xl': 'latte-heading-size-xxl-fontSize--2xl',
254
+ },
255
+ paddingBottom: {
256
+ mobile: 'latte-heading-size-xxl-paddingBottom-mobile',
257
+ sm: 'latte-heading-size-xxl-paddingBottom-sm',
258
+ md: 'latte-heading-size-xxl-paddingBottom-md',
259
+ lg: 'latte-heading-size-xxl-paddingBottom-lg',
260
+ xl: 'latte-heading-size-xxl-paddingBottom-xl',
261
+ '2xl': 'latte-heading-size-xxl-paddingBottom-2xl',
262
+ },
263
+ },
264
+ xl: {
265
+ lineHeight: 'latte-heading-size-xl-lineHeight',
266
+ fontSize: {
267
+ mobile: 'latte-heading-size-xl-fontSize-mobile',
268
+ sm: 'latte-heading-size-xl-fontSize--sm',
269
+ md: 'latte-heading-size-xl-fontSize--md',
270
+ lg: 'latte-heading-size-xl-fontSize--lg',
271
+ xl: 'latte-heading-size-xl-fontSize--xl',
272
+ '2xl': 'latte-heading-size-xl-fontSize--2xl',
273
+ },
274
+ paddingBottom: {
275
+ mobile: 'latte-heading-size-xl-paddingBottom-mobile',
276
+ sm: 'latte-heading-size-xl-paddingBottom-sm',
277
+ md: 'latte-heading-size-xl-paddingBottom-md',
278
+ lg: 'latte-heading-size-xl-paddingBottom-lg',
279
+ xl: 'latte-heading-size-xl-paddingBottom-xl',
280
+ '2xl': 'latte-heading-size-xl-paddingBottom-2xl',
281
+ },
282
+ },
283
+ lg: {
284
+ lineHeight: 'latte-heading-size-lg-lineHeight',
285
+ fontSize: {
286
+ mobile: 'latte-heading-size-lg-fontSize-mobile',
287
+ sm: 'latte-heading-size-lg-fontSize--sm',
288
+ md: 'latte-heading-size-lg-fontSize--md',
289
+ lg: 'latte-heading-size-lg-fontSize--lg',
290
+ xl: 'latte-heading-size-lg-fontSize--xl',
291
+ '2xl': 'latte-heading-size-lg-fontSize--2xl',
292
+ },
293
+ paddingBottom: {
294
+ mobile: 'latte-heading-size-lg-paddingBottom-mobile',
295
+ sm: 'latte-heading-size-lg-paddingBottom-sm',
296
+ md: 'latte-heading-size-lg-paddingBottom-md',
297
+ lg: 'latte-heading-size-lg-paddingBottom-lg',
298
+ xl: 'latte-heading-size-lg-paddingBottom-xl',
299
+ '2xl': 'latte-heading-size-lg-paddingBottom-2xl',
300
+ },
301
+ },
302
+ md: {
303
+ lineHeight: 'latte-heading-size-md-lineHeight',
304
+ fontSize: {
305
+ mobile: 'latte-heading-size-md-fontSize-mobile',
306
+ sm: 'latte-heading-size-md-fontSize--sm',
307
+ md: 'latte-heading-size-md-fontSize--md',
308
+ lg: 'latte-heading-size-md-fontSize--lg',
309
+ xl: 'latte-heading-size-md-fontSize--xl',
310
+ '2xl': 'latte-heading-size-md-fontSize--2xl',
311
+ },
312
+ paddingBottom: {
313
+ mobile: 'latte-heading-size-md-paddingBottom-mobile',
314
+ sm: 'latte-heading-size-md-paddingBottom-sm',
315
+ md: 'latte-heading-size-md-paddingBottom-md',
316
+ lg: 'latte-heading-size-md-paddingBottom-lg',
317
+ xl: 'latte-heading-size-md-paddingBottom-xl',
318
+ '2xl': 'latte-heading-size-md-paddingBottom-2xl',
319
+ },
320
+ },
321
+ sm: {
322
+ lineHeight: 'latte-heading-size-sm-lineHeight',
323
+ fontSize: {
324
+ mobile: 'latte-heading-size-sm-fontSize-mobile',
325
+ sm: 'latte-heading-size-sm-fontSize--sm',
326
+ md: 'latte-heading-size-sm-fontSize--md',
327
+ lg: 'latte-heading-size-sm-fontSize--lg',
328
+ xl: 'latte-heading-size-sm-fontSize--xl',
329
+ '2xl': 'latte-heading-size-sm-fontSize--2xl',
330
+ },
331
+ paddingBottom: {
332
+ mobile: 'latte-heading-size-sm-paddingBottom-mobile',
333
+ sm: 'latte-heading-size-sm-paddingBottom-sm',
334
+ md: 'latte-heading-size-sm-paddingBottom-md',
335
+ lg: 'latte-heading-size-sm-paddingBottom-lg',
336
+ xl: 'latte-heading-size-sm-paddingBottom-xl',
337
+ '2xl': 'latte-heading-size-sm-paddingBottom-2xl',
338
+ },
339
+ },
340
+ xs: {
341
+ lineHeight: 'latte-heading-size-xs-lineHeight',
342
+ fontSize: {
343
+ mobile: 'latte-heading-size-xs-fontSize-mobile',
344
+ sm: 'latte-heading-size-xs-fontSize--sm',
345
+ md: 'latte-heading-size-xs-fontSize--md',
346
+ lg: 'latte-heading-size-xs-fontSize--lg',
347
+ xl: 'latte-heading-size-xs-fontSize--xl',
348
+ '2xl': 'latte-heading-size-xs-fontSize--2xl',
349
+ },
350
+ paddingBottom: {
351
+ mobile: 'latte-heading-size-xs-paddingBottom-mobile',
352
+ sm: 'latte-heading-size-xs-paddingBottom-sm',
353
+ md: 'latte-heading-size-xs-paddingBottom-md',
354
+ lg: 'latte-heading-size-xs-paddingBottom-lg',
355
+ xl: 'latte-heading-size-xs-paddingBottom-xl',
356
+ '2xl': 'latte-heading-size-xs-paddingBottom-2xl',
357
+ },
358
+ },
359
+ },
360
+ },
361
+
213
362
  columns: {
214
363
  gap: {
215
364
  mobile: 'latte-columns-gap-mobile',
@@ -20,6 +20,7 @@ export type ThemeOverrides = {
20
20
  button?: Partial<typeof baseLightTheme.button>;
21
21
  icon?: Partial<typeof baseLightTheme.icon>;
22
22
  columns?: Partial<typeof baseLightTheme.columns>;
23
+ heading?: Partial<typeof baseLightTheme.heading>;
23
24
  modal?: Partial<typeof baseLightTheme.modal>;
24
25
  keyNumber?: Partial<typeof baseLightTheme.keyNumber>;
25
26
  header?: Partial<typeof baseLightTheme.header>;
@@ -50,6 +51,7 @@ const createAppTheme = (selector: string, overrides: ThemeOverrides = {}) => {
50
51
  button: { ...baseLightTheme.button, ...overrides.button },
51
52
  icon: { ...baseLightTheme.icon, ...overrides.icon },
52
53
  columns: { ...baseLightTheme.columns, ...overrides.columns },
54
+ heading: { ...baseLightTheme.heading, ...overrides.heading },
53
55
  modal: { ...baseLightTheme.modal, ...overrides.modal },
54
56
  keyNumber: { ...baseLightTheme.keyNumber, ...overrides.keyNumber },
55
57
  header: { ...baseLightTheme.header, ...overrides.header },
@@ -81,6 +83,7 @@ const createAppDarkTheme = (selector: string, overrides: ThemeOverrides = {}) =>
81
83
  button: { ...baseDarkTheme.button, ...overrides.button },
82
84
  icon: { ...baseDarkTheme.icon, ...overrides.icon },
83
85
  columns: { ...baseDarkTheme.columns, ...overrides.columns },
86
+ heading: { ...baseLightTheme.heading, ...overrides.heading },
84
87
  modal: { ...baseDarkTheme.modal, ...overrides.modal },
85
88
  keyNumber: { ...baseDarkTheme.keyNumber, ...overrides.keyNumber },
86
89
  header: { ...baseDarkTheme.header, ...overrides.header },