@latte-macchiat-io/latte-vanilla-components 0.0.277 → 0.0.278

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.277",
3
+ "version": "0.0.278",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -0,0 +1,2 @@
1
+ export { Paragraph, type ParagraphProps } from '.';
2
+ export { type ParagraphVariants } from './styles.css';
@@ -0,0 +1,12 @@
1
+ import { clsx } from 'clsx';
2
+
3
+ import { paragraphRecipe, type ParagraphVariants } from './styles.css';
4
+
5
+ export type ParagraphProps = React.HTMLAttributes<HTMLDivElement> &
6
+ ParagraphVariants & {
7
+ children: React.ReactNode;
8
+ };
9
+
10
+ export const Paragraph = ({ align, className, children }: ParagraphProps) => (
11
+ <p className={clsx(paragraphRecipe({ align }), className)}>{children}</p>
12
+ );
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+
4
+ import { Paragraph } 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 Paragraph> = {
8
+ title: 'Latte Components / 1. Global / Paragraph',
9
+ component: Paragraph,
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: <>Lorem ispum</>,
28
+ },
29
+ };
@@ -0,0 +1,60 @@
1
+ import { globalStyle } from '@vanilla-extract/css';
2
+ import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
+
4
+ import { queries } from '../../styles/mediaqueries';
5
+ import { themeContract } from '../../theme/contract.css';
6
+ import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
7
+
8
+ export const paragraphRecipe = recipe(
9
+ {
10
+ base: [
11
+ {
12
+ fontWeight: 300,
13
+
14
+ '@media': {
15
+ ...generateResponsiveMedia({
16
+ paddingBottom: themeContract.paragraph.paddingBottom,
17
+ }),
18
+ },
19
+ },
20
+ ],
21
+
22
+ variants: {
23
+ align: {
24
+ left: {
25
+ alignItems: 'flex-start',
26
+ justifyContent: 'flex-start',
27
+ },
28
+ center: {
29
+ alignItems: 'center',
30
+ justifyContent: 'center',
31
+ },
32
+ right: {
33
+ alignItems: 'flex-end',
34
+ justifyContent: 'flex-end',
35
+ },
36
+ },
37
+ },
38
+
39
+ defaultVariants: {
40
+ align: 'left',
41
+ },
42
+ },
43
+ 'actions'
44
+ );
45
+
46
+ globalStyle('p:last-of-type', {
47
+ paddingBottom: 0,
48
+ });
49
+
50
+ globalStyle('p + ul', {
51
+ paddingTop: 15,
52
+
53
+ '@media': {
54
+ [queries.sm]: {
55
+ paddingTop: 30,
56
+ },
57
+ },
58
+ });
59
+
60
+ export type ParagraphVariants = RecipeVariants<typeof paragraphRecipe>;
@@ -0,0 +1,24 @@
1
+ const themeParagraphBase = {
2
+ paragraph: {
3
+ paddingBottom: {
4
+ mobile: '15px',
5
+ sm: '15px',
6
+ md: '30px',
7
+ lg: '30px',
8
+ xl: '50px',
9
+ '2xl': '50px',
10
+ },
11
+ },
12
+ };
13
+
14
+ export const themeParagraphLight = {
15
+ paragraph: {
16
+ ...themeParagraphBase.paragraph,
17
+ },
18
+ };
19
+
20
+ export const themeParagraphDark = {
21
+ paragraph: {
22
+ ...themeParagraphBase.paragraph,
23
+ },
24
+ };
@@ -15,6 +15,7 @@ import { themeModalDark, themeModalLight } from '../components/Modal/theme';
15
15
  import { themeNavDark, themeNavLight } from '../components/Nav/theme';
16
16
  import { themeNavLegalDark, themeNavLegalLight } from '../components/NavLegal/theme';
17
17
  import { themeNavSocialDark, themeNavSocialLight } from '../components/NavSocial/theme';
18
+ import { themeParagraphDark, themeParagraphLight } from '../components/Paragraph/theme';
18
19
  import { themeSectionDark, themeSectionLight } from '../components/Section/theme';
19
20
  import { themeVideoDark, themeVideoLight } from '../components/Video/theme';
20
21
 
@@ -124,6 +125,7 @@ export const baseLightTheme = {
124
125
 
125
126
  ...themeSectionLight,
126
127
  ...themeHeadingLight,
128
+ ...themeParagraphLight,
127
129
 
128
130
  ...themeActionsLight,
129
131
  ...themeButtonLight,
@@ -255,6 +257,7 @@ export const baseDarkTheme = {
255
257
 
256
258
  ...themeSectionDark,
257
259
  ...themeHeadingDark,
260
+ ...themeParagraphDark,
258
261
 
259
262
  ...themeActionsDark,
260
263
  ...themeButtonDark,
@@ -374,6 +374,17 @@ export const themeContract = createGlobalThemeContract({
374
374
  },
375
375
  },
376
376
 
377
+ paragraph: {
378
+ paddingBottom: {
379
+ mobile: 'latte-paragraph-paddingBottom-mobile',
380
+ sm: 'latte-paragraph-paddingBottom-sm',
381
+ md: 'latte-paragraph-paddingBottom-md',
382
+ lg: 'latte-paragraph-paddingBottom-lg',
383
+ xl: 'latte-paragraph-paddingBottom-xl',
384
+ '2xl': 'latte-paragraph-paddingBottom-2xl',
385
+ },
386
+ },
387
+
377
388
  columns: {
378
389
  gap: {
379
390
  mobile: 'latte-columns-gap-mobile',
@@ -21,6 +21,7 @@ export type ThemeOverrides = {
21
21
  icon?: Partial<typeof baseLightTheme.icon>;
22
22
  columns?: Partial<typeof baseLightTheme.columns>;
23
23
  heading?: Partial<typeof baseLightTheme.heading>;
24
+ paragraph?: Partial<typeof baseLightTheme.paragraph>;
24
25
  modal?: Partial<typeof baseLightTheme.modal>;
25
26
  keyNumber?: Partial<typeof baseLightTheme.keyNumber>;
26
27
  header?: Partial<typeof baseLightTheme.header>;
@@ -53,6 +54,7 @@ const createAppTheme = (selector: string, overrides: ThemeOverrides = {}) => {
53
54
  icon: { ...baseLightTheme.icon, ...overrides.icon },
54
55
  columns: { ...baseLightTheme.columns, ...overrides.columns },
55
56
  heading: { ...baseLightTheme.heading, ...overrides.heading },
57
+ paragraph: { ...baseLightTheme.paragraph, ...overrides.paragraph },
56
58
  modal: { ...baseLightTheme.modal, ...overrides.modal },
57
59
  keyNumber: { ...baseLightTheme.keyNumber, ...overrides.keyNumber },
58
60
  header: { ...baseLightTheme.header, ...overrides.header },
@@ -86,6 +88,7 @@ const createAppDarkTheme = (selector: string, overrides: ThemeOverrides = {}) =>
86
88
  icon: { ...baseDarkTheme.icon, ...overrides.icon },
87
89
  columns: { ...baseDarkTheme.columns, ...overrides.columns },
88
90
  heading: { ...baseDarkTheme.heading, ...overrides.heading },
91
+ paragraph: { ...baseDarkTheme.paragraph, ...overrides.paragraph },
89
92
  modal: { ...baseDarkTheme.modal, ...overrides.modal },
90
93
  keyNumber: { ...baseDarkTheme.keyNumber, ...overrides.keyNumber },
91
94
  header: { ...baseDarkTheme.header, ...overrides.header },