@latte-macchiat-io/latte-vanilla-components 0.0.508 → 0.0.509
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 +1 -1
- package/src/components/Spacer/export.tsx +1 -0
- package/src/components/Spacer/index.tsx +7 -0
- package/src/components/Spacer/stories.tsx +26 -0
- package/src/components/Spacer/styles.css.ts +13 -0
- package/src/components/Spacer/theme.ts +24 -0
- package/src/index.ts +2 -0
- package/src/theme/baseThemeValues.ts +3 -0
- package/src/theme/contract.css.ts +11 -0
- package/src/theme/createTheme.ts +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Spacer, type SpacerProps } from '.';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { Spacer } from '.';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta: Meta<typeof Spacer> = {
|
|
7
|
+
title: 'Latte Components / 1. Global / Actions',
|
|
8
|
+
component: Spacer,
|
|
9
|
+
parameters: {
|
|
10
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
16
|
+
argTypes: {},
|
|
17
|
+
// 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
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {},
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
|
|
3
|
+
import { themeContract } from '../../theme/contract.css';
|
|
4
|
+
|
|
5
|
+
import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
|
|
6
|
+
|
|
7
|
+
export const spacer = style({
|
|
8
|
+
'@media': {
|
|
9
|
+
...generateResponsiveMedia({
|
|
10
|
+
height: themeContract.spacer.height,
|
|
11
|
+
}),
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const themeSpacerBase = {
|
|
2
|
+
spacer: {
|
|
3
|
+
height: {
|
|
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 themeSpacerLight = {
|
|
15
|
+
spacer: {
|
|
16
|
+
...themeSpacerBase.spacer,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const themeSpacerDark = {
|
|
21
|
+
spacer: {
|
|
22
|
+
...themeSpacerBase.spacer,
|
|
23
|
+
},
|
|
24
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { themeNavLegalDark, themeNavLegalLight } from '../components/NavLegal/th
|
|
|
23
23
|
import { themeNavSocialDark, themeNavSocialLight } from '../components/NavSocial/theme';
|
|
24
24
|
import { themeParagraphDark, themeParagraphLight } from '../components/Paragraph/theme';
|
|
25
25
|
import { themeSectionDark, themeSectionLight } from '../components/Section/theme';
|
|
26
|
+
import { themeSpacerDark, themeSpacerLight } from '../components/Spacer/theme';
|
|
26
27
|
import { themeVideoDark, themeVideoLight } from '../components/Video/theme';
|
|
27
28
|
|
|
28
29
|
// Base theme values that can be imported and extended by apps
|
|
@@ -158,6 +159,7 @@ export const baseLightTheme = {
|
|
|
158
159
|
...themeBoxAlertLight,
|
|
159
160
|
|
|
160
161
|
...themeExpandCollapseLight,
|
|
162
|
+
...themeSpacerLight,
|
|
161
163
|
|
|
162
164
|
form: {
|
|
163
165
|
...themeFormLight.form,
|
|
@@ -301,6 +303,7 @@ export const baseDarkTheme = {
|
|
|
301
303
|
...themeBoxAlertDark,
|
|
302
304
|
|
|
303
305
|
...themeExpandCollapseDark,
|
|
306
|
+
...themeSpacerDark,
|
|
304
307
|
|
|
305
308
|
form: {
|
|
306
309
|
...themeFormDark.form,
|
|
@@ -740,6 +740,17 @@ export const themeContract = createGlobalThemeContract({
|
|
|
740
740
|
},
|
|
741
741
|
},
|
|
742
742
|
|
|
743
|
+
spacer: {
|
|
744
|
+
height: {
|
|
745
|
+
mobile: 'latte-spacer-height-mobile',
|
|
746
|
+
sm: 'latte-spacer-height-sm',
|
|
747
|
+
md: 'latte-spacer-height-md',
|
|
748
|
+
lg: 'latte-spacer-height-lg',
|
|
749
|
+
xl: 'latte-spacer-height-xl',
|
|
750
|
+
'2xl': 'latte-spacer-height-2xl',
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
|
|
743
754
|
modal: {
|
|
744
755
|
border: 'latte-modal-border',
|
|
745
756
|
borderRadius: 'latte-modal-borderRadius',
|
package/src/theme/createTheme.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type ThemeOverrides = {
|
|
|
38
38
|
boxAlert?: Partial<typeof baseLightTheme.boxAlert>;
|
|
39
39
|
consentCookie?: Partial<typeof baseLightTheme.consentCookie>;
|
|
40
40
|
expandCollapse?: Partial<typeof baseLightTheme.expandCollapse>;
|
|
41
|
+
spacer?: Partial<typeof baseLightTheme.spacer>;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
// Utility to create a theme with partial overrides over light theme base
|
|
@@ -77,6 +78,7 @@ const createAppTheme = (selector: string, overrides: ThemeOverrides = {}) => {
|
|
|
77
78
|
boxAlert: { ...baseLightTheme.boxAlert, ...overrides.boxAlert },
|
|
78
79
|
consentCookie: { ...baseLightTheme.consentCookie, ...overrides.consentCookie },
|
|
79
80
|
expandCollapse: { ...baseLightTheme.expandCollapse, ...overrides.expandCollapse },
|
|
81
|
+
spacer: { ...baseLightTheme.spacer, ...overrides.spacer },
|
|
80
82
|
});
|
|
81
83
|
};
|
|
82
84
|
|
|
@@ -117,6 +119,7 @@ const createAppDarkTheme = (selector: string, overrides: ThemeOverrides = {}) =>
|
|
|
117
119
|
boxAlert: { ...baseDarkTheme.boxAlert, ...overrides.boxAlert },
|
|
118
120
|
consentCookie: { ...baseDarkTheme.consentCookie, ...overrides.consentCookie },
|
|
119
121
|
expandCollapse: { ...baseLightTheme.expandCollapse, ...overrides.expandCollapse },
|
|
122
|
+
spacer: { ...baseLightTheme.spacer, ...overrides.spacer },
|
|
120
123
|
});
|
|
121
124
|
};
|
|
122
125
|
|