@latte-macchiat-io/latte-vanilla-components 0.0.201 → 0.0.203
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/Actions/index.tsx +3 -6
- package/src/components/Actions/stories.tsx +7 -1
- package/src/components/Button/export.tsx +2 -5
- package/src/components/Button/index.tsx +19 -14
- package/src/components/Button/stories.tsx +12 -219
- package/src/components/Button/theme.ts +149 -0
- package/src/components/Carousel/export.tsx +2 -4
- package/src/components/Carousel/index.tsx +159 -191
- package/src/components/Carousel/theme.ts +102 -0
- package/src/components/Columns/export.tsx +2 -5
- package/src/components/Columns/index.tsx +10 -15
- package/src/components/Columns/styles.css.ts +3 -1
- package/src/components/Columns/theme.ts +24 -0
- package/src/components/ConsentCookie/export.tsx +2 -4
- package/src/components/ConsentCookie/index.tsx +104 -0
- package/src/components/Footer/export.tsx +1 -4
- package/src/components/Footer/index.tsx +1 -8
- package/src/components/Footer/theme.ts +51 -0
- package/src/components/Form/export.tsx +17 -3
- package/src/components/Header/export.tsx +1 -4
- package/src/components/Header/index.tsx +19 -35
- package/src/components/Header/styles.css.ts +2 -2
- package/src/components/Header/theme.ts +51 -0
- package/src/components/Heading/export.tsx +1 -0
- package/src/components/Heading/index.tsx +3 -8
- package/src/components/Icon/export.tsx +1 -4
- package/src/components/Icon/index.tsx +4 -5
- package/src/components/Icon/theme.ts +17 -0
- package/src/components/KeyNumber/export.tsx +2 -4
- package/src/components/KeyNumber/index.tsx +3 -3
- package/src/components/KeyNumber/theme.ts +22 -0
- package/src/components/LanguageSwitcher/export.tsx +2 -4
- package/src/components/LanguageSwitcher/index.tsx +37 -63
- package/src/components/Logo/export.tsx +1 -4
- package/src/components/Logo/index.tsx +2 -5
- package/src/components/Logo/styles.css.ts +2 -2
- package/src/components/Main/export.tsx +1 -4
- package/src/components/Main/index.tsx +1 -9
- package/src/components/Main/theme.ts +19 -0
- package/src/components/Modal/export.tsx +2 -4
- package/src/components/Modal/index.tsx +4 -5
- package/src/components/Modal/theme.ts +31 -0
- package/src/components/Nav/export.tsx +1 -4
- package/src/components/Nav/index.tsx +6 -14
- package/src/components/Nav/styles.css.ts +3 -1
- package/src/components/Nav/theme.ts +24 -0
- package/src/components/NavLegal/export.tsx +1 -4
- package/src/components/NavLegal/index.tsx +1 -7
- package/src/components/NavLegal/theme.ts +24 -0
- package/src/components/NavSocial/export.tsx +2 -5
- package/src/components/NavSocial/index.tsx +14 -18
- package/src/components/NavSocial/theme.ts +34 -0
- package/src/components/Section/export.tsx +2 -6
- package/src/components/Section/index.tsx +4 -8
- package/src/components/Section/theme.ts +40 -0
- package/src/components/Video/export.tsx +2 -2
- package/src/components/Video/index.tsx +78 -83
- package/src/components/Video/theme.ts +104 -0
- package/src/index.ts +19 -51
- package/src/theme/baseThemeValues.ts +46 -965
- package/src/theme/contract.css.ts +0 -16
- package/src/utils/useWindowSize.ts +29 -0
- package/src/components/ConsentCookie/ConsentCookie.tsx +0 -200
- package/src/components/Header/HeaderOverlay/index.tsx +0 -32
- package/src/components/Header/HeaderOverlay/styles.css.ts +0 -33
- package/src/components/Header/ToggleNav/index.tsx +0 -29
- package/src/components/Header/ToggleNav/styles.css.ts +0 -40
- package/src/components/ThemeTest/ThemeTest.css.ts +0 -11
- package/src/components/ThemeTest/ThemeTest.tsx +0 -12
- /package/src/components/ConsentCookie/{ConsentCookie.css.ts → styles.css.ts} +0 -0
package/package.json
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { clsx } from 'clsx';
|
2
|
-
import { forwardRef } from 'react';
|
3
2
|
|
4
3
|
import { actionsRecipe, type ActionsVariants } from './styles.css';
|
5
4
|
|
@@ -8,8 +7,6 @@ export type ActionsProps = React.HTMLAttributes<HTMLDivElement> &
|
|
8
7
|
children: React.ReactNode;
|
9
8
|
};
|
10
9
|
|
11
|
-
export const Actions =
|
12
|
-
<div
|
13
|
-
|
14
|
-
</div>
|
15
|
-
));
|
10
|
+
export const Actions = ({ align, direction, className, children }: ActionsProps) => (
|
11
|
+
<div className={clsx(actionsRecipe({ align, direction }), className)}>{children}</div>
|
12
|
+
);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
2
2
|
import React from 'react';
|
3
3
|
|
4
|
+
import { Button } from '../Button';
|
4
5
|
import { Actions } from '.';
|
5
6
|
|
6
7
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
@@ -24,6 +25,11 @@ type Story = StoryObj<typeof meta>;
|
|
24
25
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
25
26
|
export const Default: Story = {
|
26
27
|
args: {
|
27
|
-
children:
|
28
|
+
children: (
|
29
|
+
<>
|
30
|
+
<Button>hello</Button>
|
31
|
+
<Button>hello</Button>
|
32
|
+
</>
|
33
|
+
),
|
28
34
|
},
|
29
35
|
};
|
@@ -1,5 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
// export { Type as ButtonType, Size as ButtonSize, Style as ButtonStyle, Variant as ButtonVariant } from './types';
|
4
|
-
|
5
|
-
// export { styles as ButtonStyles } from './styles.css';
|
1
|
+
export { Button, type ButtonProps } from './';
|
2
|
+
export { type ButtonVariants } from './styles.css';
|
@@ -1,27 +1,32 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { clsx } from 'clsx';
|
4
|
-
import { type ComponentPropsWithoutRef, forwardRef } from 'react';
|
5
4
|
|
6
5
|
import { buttonRecipe, type ButtonVariants } from './styles.css';
|
7
6
|
|
8
|
-
export type ButtonProps =
|
7
|
+
export type ButtonProps = React.HTMLAttributes<HTMLButtonElement> &
|
9
8
|
ButtonVariants & {
|
10
9
|
css?: string;
|
11
10
|
isPending?: boolean;
|
12
11
|
isDisabled?: boolean;
|
12
|
+
translation?: {
|
13
|
+
isPendingLabel: string;
|
14
|
+
};
|
13
15
|
};
|
14
16
|
|
15
|
-
export const Button =
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
export const Button = ({
|
18
|
+
size,
|
19
|
+
style,
|
20
|
+
variant,
|
21
|
+
onClick,
|
22
|
+
children,
|
23
|
+
fullWidth,
|
24
|
+
className,
|
25
|
+
isPending = false,
|
26
|
+
isDisabled = false,
|
27
|
+
translation = { isPendingLabel: 'Loading...' },
|
28
|
+
}: ButtonProps) => (
|
29
|
+
<button onClick={onClick} disabled={isDisabled || isPending} className={clsx(buttonRecipe({ variant, style, size, fullWidth }), className)}>
|
30
|
+
{isPending ? translation.isPendingLabel : children}
|
31
|
+
</button>
|
27
32
|
);
|
@@ -1,235 +1,28 @@
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
2
|
-
|
3
|
-
import { Section } from '../Section';
|
2
|
+
|
4
3
|
import { Button } from '.';
|
5
4
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
6
6
|
const meta: Meta<typeof Button> = {
|
7
|
-
title: '
|
7
|
+
title: 'Latte Components / 1. Global / Button',
|
8
8
|
component: Button,
|
9
9
|
parameters: {
|
10
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
10
11
|
layout: 'centered',
|
11
|
-
docs: {
|
12
|
-
description: {
|
13
|
-
component: `
|
14
|
-
The Button component is a versatile, accessible button that supports multiple variants, sizes, and states.
|
15
|
-
|
16
|
-
## Features
|
17
|
-
- Multiple variants (primary, secondary, ghost, destructive)
|
18
|
-
- Different sizes (small, medium, large)
|
19
|
-
- Full width option
|
20
|
-
- Loading/pending state
|
21
|
-
- Fully accessible (ARIA compliant)
|
22
|
-
- Theme-aware colors
|
23
|
-
- TypeScript support
|
24
|
-
`,
|
25
|
-
},
|
26
|
-
},
|
27
12
|
},
|
13
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
28
14
|
tags: ['autodocs'],
|
29
|
-
argTypes:
|
30
|
-
|
31
|
-
|
32
|
-
options: ['primary', 'secondary', 'ghost', 'destructive'],
|
33
|
-
description: 'Visual style of the button',
|
34
|
-
},
|
35
|
-
size: {
|
36
|
-
control: 'select',
|
37
|
-
options: ['small', 'medium', 'large'],
|
38
|
-
description: 'Size of the button',
|
39
|
-
},
|
40
|
-
fullWidth: {
|
41
|
-
control: 'boolean',
|
42
|
-
description: 'Whether the button should take full width of its container',
|
43
|
-
},
|
44
|
-
isPending: {
|
45
|
-
control: 'boolean',
|
46
|
-
description: 'Shows loading state',
|
47
|
-
},
|
48
|
-
disabled: {
|
49
|
-
control: 'boolean',
|
50
|
-
description: 'Disables the button',
|
51
|
-
},
|
52
|
-
children: {
|
53
|
-
control: 'text',
|
54
|
-
description: 'Button content',
|
55
|
-
},
|
56
|
-
},
|
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
|
57
18
|
};
|
58
19
|
|
59
20
|
export default meta;
|
60
|
-
type Story = StoryObj<typeof
|
61
|
-
|
62
|
-
// Basic Stories
|
63
|
-
export const Primary: Story = {
|
64
|
-
args: {
|
65
|
-
variant: 'primary',
|
66
|
-
children: 'Primary Button',
|
67
|
-
},
|
68
|
-
};
|
69
|
-
|
70
|
-
export const Secondary: Story = {
|
71
|
-
args: {
|
72
|
-
variant: 'secondary',
|
73
|
-
children: 'Secondary Button',
|
74
|
-
},
|
75
|
-
};
|
76
|
-
|
77
|
-
// Size Variants
|
78
|
-
export const Small: Story = {
|
79
|
-
args: {
|
80
|
-
variant: 'primary',
|
81
|
-
size: 'sm',
|
82
|
-
children: 'Small Button',
|
83
|
-
},
|
84
|
-
};
|
21
|
+
type Story = StoryObj<typeof meta>;
|
85
22
|
|
86
|
-
|
23
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
24
|
+
export const Default: Story = {
|
87
25
|
args: {
|
88
|
-
|
89
|
-
size: 'md',
|
90
|
-
children: 'Medium Button',
|
91
|
-
},
|
92
|
-
};
|
93
|
-
|
94
|
-
export const Large: Story = {
|
95
|
-
args: {
|
96
|
-
variant: 'primary',
|
97
|
-
size: 'lg',
|
98
|
-
children: 'Large Button',
|
99
|
-
},
|
100
|
-
};
|
101
|
-
|
102
|
-
// States
|
103
|
-
export const Loading: Story = {
|
104
|
-
args: {
|
105
|
-
variant: 'primary',
|
106
|
-
children: 'Loading Button',
|
107
|
-
isPending: true,
|
108
|
-
},
|
109
|
-
};
|
110
|
-
|
111
|
-
export const Disabled: Story = {
|
112
|
-
args: {
|
113
|
-
variant: 'primary',
|
114
|
-
children: 'Disabled Button',
|
115
|
-
disabled: true,
|
116
|
-
},
|
117
|
-
};
|
118
|
-
|
119
|
-
export const FullWidth: Story = {
|
120
|
-
args: {
|
121
|
-
variant: 'primary',
|
122
|
-
children: 'Full Width Button',
|
123
|
-
fullWidth: true,
|
124
|
-
},
|
125
|
-
parameters: {
|
126
|
-
layout: 'padded',
|
127
|
-
},
|
128
|
-
};
|
129
|
-
|
130
|
-
// All Variants Showcase
|
131
|
-
export const AllVariants: Story = {
|
132
|
-
render: () => (
|
133
|
-
<Section>
|
134
|
-
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap', alignItems: 'center' }}>
|
135
|
-
<Button variant="primary">Primary</Button>
|
136
|
-
<Button variant="secondary">Secondary</Button>
|
137
|
-
</div>
|
138
|
-
</Section>
|
139
|
-
),
|
140
|
-
parameters: {
|
141
|
-
docs: {
|
142
|
-
description: {
|
143
|
-
story: 'All available button variants displayed together.',
|
144
|
-
},
|
145
|
-
},
|
146
|
-
},
|
147
|
-
};
|
148
|
-
|
149
|
-
// All Sizes Showcase
|
150
|
-
export const AllSizes: Story = {
|
151
|
-
render: () => (
|
152
|
-
<Section>
|
153
|
-
<div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
|
154
|
-
<Button variant="primary" size="sm">
|
155
|
-
Small
|
156
|
-
</Button>
|
157
|
-
<Button variant="primary" size="md">
|
158
|
-
Medium
|
159
|
-
</Button>
|
160
|
-
<Button variant="primary" size="lg">
|
161
|
-
Large
|
162
|
-
</Button>
|
163
|
-
</div>
|
164
|
-
</Section>
|
165
|
-
),
|
166
|
-
parameters: {
|
167
|
-
docs: {
|
168
|
-
description: {
|
169
|
-
story: 'All available button sizes displayed together.',
|
170
|
-
},
|
171
|
-
},
|
172
|
-
},
|
173
|
-
};
|
174
|
-
|
175
|
-
// Interactive Example
|
176
|
-
export const InteractiveExample: Story = {
|
177
|
-
render: () => (
|
178
|
-
<Section>
|
179
|
-
<div style={{ display: 'grid', gap: '2rem' }}>
|
180
|
-
<div>
|
181
|
-
<h3>Call to Action</h3>
|
182
|
-
<div style={{ display: 'flex', gap: '1rem' }}>
|
183
|
-
<Button variant="primary" size="lg">
|
184
|
-
Get Started
|
185
|
-
</Button>
|
186
|
-
<Button variant="secondary" size="lg">
|
187
|
-
Learn More
|
188
|
-
</Button>
|
189
|
-
</div>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<div>
|
193
|
-
<h3>Form Actions</h3>
|
194
|
-
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
195
|
-
<Button variant="primary">Save</Button>
|
196
|
-
<Button variant="secondary">Cancel</Button>
|
197
|
-
</div>
|
198
|
-
</div>
|
199
|
-
|
200
|
-
<div>
|
201
|
-
<h3>Navigation</h3>
|
202
|
-
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
203
|
-
<Button variant="primary">Next →</Button>
|
204
|
-
</div>
|
205
|
-
</div>
|
206
|
-
</div>
|
207
|
-
</Section>
|
208
|
-
),
|
209
|
-
parameters: {
|
210
|
-
docs: {
|
211
|
-
description: {
|
212
|
-
story: 'Real-world usage examples showing different button combinations.',
|
213
|
-
},
|
214
|
-
},
|
215
|
-
},
|
216
|
-
};
|
217
|
-
|
218
|
-
// With Custom Styling
|
219
|
-
export const WithCustomStyling: Story = {
|
220
|
-
render: () => (
|
221
|
-
<Section>
|
222
|
-
<div style={{ display: 'flex', gap: '1rem', flexDirection: 'column' }}>
|
223
|
-
<Button variant="primary">Rounded Button</Button>
|
224
|
-
<Button variant="secondary">Large Text Button</Button>
|
225
|
-
</div>
|
226
|
-
</Section>
|
227
|
-
),
|
228
|
-
parameters: {
|
229
|
-
docs: {
|
230
|
-
description: {
|
231
|
-
story: 'Buttons with custom styling using sprinkles utilities.',
|
232
|
-
},
|
233
|
-
},
|
26
|
+
children: 'Button',
|
234
27
|
},
|
235
28
|
};
|
@@ -0,0 +1,149 @@
|
|
1
|
+
const themeButtonBase = {
|
2
|
+
button: {
|
3
|
+
minWidth: '100',
|
4
|
+
fontWeight: '500',
|
5
|
+
letterSpacing: '0.2',
|
6
|
+
borderRadius: '15px',
|
7
|
+
fontFamily: 'system-ui, sans-serif',
|
8
|
+
transition: 'all 0.3s ease-in-out',
|
9
|
+
|
10
|
+
size: {
|
11
|
+
small: {
|
12
|
+
paddingTop: {
|
13
|
+
mobile: '5px',
|
14
|
+
sm: '5px',
|
15
|
+
md: '5px',
|
16
|
+
lg: '5px',
|
17
|
+
xl: '5px',
|
18
|
+
'2xl': '5px',
|
19
|
+
},
|
20
|
+
paddingLeft: {
|
21
|
+
mobile: '5px',
|
22
|
+
sm: '5px',
|
23
|
+
md: '5px',
|
24
|
+
lg: '5px',
|
25
|
+
xl: '5px',
|
26
|
+
'2xl': '5px',
|
27
|
+
},
|
28
|
+
paddingRight: {
|
29
|
+
mobile: '5px',
|
30
|
+
sm: '5px',
|
31
|
+
md: '5px',
|
32
|
+
lg: '5px',
|
33
|
+
xl: '5px',
|
34
|
+
'2xl': '5px',
|
35
|
+
},
|
36
|
+
paddingBottom: {
|
37
|
+
mobile: '5px',
|
38
|
+
sm: '5px',
|
39
|
+
md: '5px',
|
40
|
+
lg: '5px',
|
41
|
+
xl: '5px',
|
42
|
+
'2xl': '5px',
|
43
|
+
},
|
44
|
+
},
|
45
|
+
medium: {
|
46
|
+
paddingTop: {
|
47
|
+
mobile: '5px',
|
48
|
+
sm: '5px',
|
49
|
+
md: '10px',
|
50
|
+
lg: '10px',
|
51
|
+
xl: '15px',
|
52
|
+
'2xl': '15px',
|
53
|
+
},
|
54
|
+
paddingLeft: {
|
55
|
+
mobile: '5px',
|
56
|
+
sm: '5px',
|
57
|
+
md: '10px',
|
58
|
+
lg: '10px',
|
59
|
+
xl: '15px',
|
60
|
+
'2xl': '15px',
|
61
|
+
},
|
62
|
+
paddingRight: {
|
63
|
+
mobile: '5px',
|
64
|
+
sm: '5px',
|
65
|
+
md: '10px',
|
66
|
+
lg: '10px',
|
67
|
+
xl: '15px',
|
68
|
+
'2xl': '15px',
|
69
|
+
},
|
70
|
+
paddingBottom: {
|
71
|
+
mobile: '5px',
|
72
|
+
sm: '5px',
|
73
|
+
md: '10px',
|
74
|
+
lg: '10px',
|
75
|
+
xl: '15px',
|
76
|
+
'2xl': '15px',
|
77
|
+
},
|
78
|
+
},
|
79
|
+
large: {
|
80
|
+
paddingTop: {
|
81
|
+
mobile: '10px',
|
82
|
+
sm: '10px',
|
83
|
+
md: '15px',
|
84
|
+
lg: '15px',
|
85
|
+
xl: '20px',
|
86
|
+
'2xl': '20px',
|
87
|
+
},
|
88
|
+
paddingLeft: {
|
89
|
+
mobile: '10px',
|
90
|
+
sm: '10px',
|
91
|
+
md: '15px',
|
92
|
+
lg: '15px',
|
93
|
+
xl: '20px',
|
94
|
+
'2xl': '20px',
|
95
|
+
},
|
96
|
+
paddingRight: {
|
97
|
+
mobile: '10px',
|
98
|
+
sm: '10px',
|
99
|
+
md: '15px',
|
100
|
+
lg: '15px',
|
101
|
+
xl: '20px',
|
102
|
+
'2xl': '20px',
|
103
|
+
},
|
104
|
+
paddingBottom: {
|
105
|
+
mobile: '10px',
|
106
|
+
sm: '10px',
|
107
|
+
md: '15px',
|
108
|
+
lg: '15px',
|
109
|
+
xl: '20px',
|
110
|
+
'2xl': '20px',
|
111
|
+
},
|
112
|
+
},
|
113
|
+
},
|
114
|
+
},
|
115
|
+
};
|
116
|
+
|
117
|
+
export const themeButtonLight = {
|
118
|
+
button: {
|
119
|
+
...themeButtonBase.button,
|
120
|
+
|
121
|
+
variant: {
|
122
|
+
primary: {
|
123
|
+
color: '#FF7377',
|
124
|
+
backgroundColor: '#FF7377',
|
125
|
+
},
|
126
|
+
secondary: {
|
127
|
+
color: '#FF7377',
|
128
|
+
backgroundColor: '#FF7377',
|
129
|
+
},
|
130
|
+
},
|
131
|
+
},
|
132
|
+
};
|
133
|
+
|
134
|
+
export const themeButtonDark = {
|
135
|
+
button: {
|
136
|
+
...themeButtonBase.button,
|
137
|
+
|
138
|
+
variant: {
|
139
|
+
primary: {
|
140
|
+
color: '#FF7377',
|
141
|
+
backgroundColor: '#FF7377',
|
142
|
+
},
|
143
|
+
secondary: {
|
144
|
+
color: '#FF7377',
|
145
|
+
backgroundColor: '#FF7377',
|
146
|
+
},
|
147
|
+
},
|
148
|
+
},
|
149
|
+
};
|