@latte-macchiat-io/latte-vanilla-components 0.0.177 → 0.0.178
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 +3 -1
- package/src/assets/styles/mediaqueries.tsx +24 -0
- package/src/components/Actions/Actions.tsx +132 -0
- package/src/components/Actions/export.tsx +4 -0
- package/src/components/{Main/stories.ts → Actions/stories.tsx} +14 -13
- package/src/components/Button/Button.tsx +132 -0
- package/src/components/Button/export.tsx +5 -0
- package/src/components/Carousel/Carousel.tsx +328 -0
- package/src/components/Carousel/export.tsx +4 -0
- package/src/components/Columns/Columns.tsx +142 -0
- package/src/components/Columns/export.tsx +5 -0
- package/src/components/ConsentCookie/ConsentCookie.tsx +202 -0
- package/src/components/ConsentCookie/export.tsx +4 -0
- package/src/components/{Icon/stories.ts → ConsentCookie/stories.tsx} +7 -8
- package/src/components/Footer/Footer.tsx +130 -0
- package/src/components/Footer/export.tsx +4 -0
- package/src/components/Footer/stories.tsx +26 -0
- package/src/components/Form/Form.tsx +127 -0
- package/src/components/Form/Row/Row.tsx +137 -0
- package/src/components/Form/Row/index.tsx +0 -0
- package/src/components/Form/Row/stories.tsx +41 -0
- package/src/components/Form/TextField/Input/Input.tsx +139 -0
- package/src/components/Form/TextField/Input/export.tsx +6 -0
- package/src/components/Form/TextField/Label/Label.tsx +133 -0
- package/src/components/Form/TextField/Label/export.tsx +4 -0
- package/src/components/Form/TextField/TextField.tsx +200 -0
- package/src/components/Form/TextField/Textarea/Textarea.tsx +135 -0
- package/src/components/Form/TextField/Textarea/export.tsx +6 -0
- package/src/components/Form/TextField/Textarea/stories.tsx +44 -0
- package/src/components/Form/TextField/export.tsx +4 -0
- package/src/components/Form/export.tsx +4 -0
- package/src/components/Header/Header.tsx +158 -0
- package/src/components/Header/HeaderOverlay/index.tsx +32 -0
- package/src/components/Header/ToggleNav/index.tsx +32 -0
- package/src/components/Header/export.tsx +4 -0
- package/src/components/Header/stories.tsx +26 -0
- package/src/components/Icon/Icon.tsx +159 -0
- package/src/components/Icon/export.tsx +4 -0
- package/src/components/KeyNumber/KeyNumber.tsx +166 -0
- package/src/components/KeyNumber/export.tsx +4 -0
- package/src/components/LanguageSwitcher/LanguageSwitcher.tsx +168 -0
- package/src/components/LanguageSwitcher/export.tsx +4 -0
- package/src/components/Logo/Logo.tsx +137 -0
- package/src/components/Logo/export.tsx +4 -0
- package/src/components/Logo/stories.tsx +28 -0
- package/src/components/Main/Main.tsx +130 -0
- package/src/components/Main/export.tsx +4 -0
- package/src/components/Modal/Modal.tsx +194 -0
- package/src/components/Modal/export.tsx +4 -0
- package/src/components/Modal/types.tsx +5 -0
- package/src/components/Nav/Nav.tsx +129 -0
- package/src/components/Nav/export.tsx +4 -0
- package/src/components/Nav/stories.tsx +28 -0
- package/src/components/NavLegal/NavLegal.tsx +133 -0
- package/src/components/NavLegal/export.tsx +4 -0
- package/src/components/NavLegal/stories.tsx +28 -0
- package/src/components/NavLegal/types.tsx +1 -0
- package/src/components/NavSocial/NavSocial.tsx +169 -0
- package/src/components/NavSocial/export.tsx +5 -0
- package/src/components/{Columns/stories.ts → NavSocial/stories.tsx} +12 -14
- package/src/components/NavSocial/types.tsx +1 -0
- package/src/components/Section/Section.tsx +130 -0
- package/src/components/Section/export.tsx +6 -0
- package/src/components/ToRemove/ToRemove.tsx +3 -0
- package/src/components/Video/Video.tsx +243 -0
- package/src/components/Video/export.tsx +2 -0
- package/src/components/VideoFullWidth/VideoFullWidth.tsx +152 -0
- package/src/components/VideoFullWidth/export.tsx +2 -0
- package/src/components/Button/stories.ts +0 -127
- package/src/components/Section/stories.ts +0 -64
@@ -0,0 +1,142 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
import { columnsRecipe, type ColumnsVariants, columnWidths } from './Columns.css';
|
4
|
+
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
5
|
+
|
6
|
+
export interface ColumnsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<ColumnsVariants> {
|
7
|
+
css?: string;
|
8
|
+
columns?: (keyof typeof columnWidths)[];
|
9
|
+
as?: 'div' | 'section' | 'article';
|
10
|
+
}
|
11
|
+
|
12
|
+
export const Columns = forwardRef<HTMLDivElement, ColumnsProps>(
|
13
|
+
(
|
14
|
+
{
|
15
|
+
children,
|
16
|
+
columns,
|
17
|
+
align,
|
18
|
+
spacing,
|
19
|
+
wrap,
|
20
|
+
reverse,
|
21
|
+
alignItems,
|
22
|
+
as: Component = 'div',
|
23
|
+
css,
|
24
|
+
className,
|
25
|
+
// Extract sprinkles props
|
26
|
+
margin,
|
27
|
+
marginTop,
|
28
|
+
marginBottom,
|
29
|
+
marginLeft,
|
30
|
+
marginRight,
|
31
|
+
padding,
|
32
|
+
paddingTop,
|
33
|
+
paddingBottom,
|
34
|
+
paddingLeft,
|
35
|
+
paddingRight,
|
36
|
+
gap,
|
37
|
+
display,
|
38
|
+
flexDirection,
|
39
|
+
justifyContent,
|
40
|
+
flexWrap,
|
41
|
+
flex,
|
42
|
+
width,
|
43
|
+
height,
|
44
|
+
minWidth,
|
45
|
+
maxWidth,
|
46
|
+
minHeight,
|
47
|
+
position,
|
48
|
+
top,
|
49
|
+
bottom,
|
50
|
+
left,
|
51
|
+
right,
|
52
|
+
zIndex,
|
53
|
+
fontSize,
|
54
|
+
fontFamily,
|
55
|
+
lineHeight,
|
56
|
+
textAlign,
|
57
|
+
fontWeight,
|
58
|
+
color,
|
59
|
+
backgroundColor,
|
60
|
+
borderRadius,
|
61
|
+
borderWidth,
|
62
|
+
borderStyle,
|
63
|
+
borderColor,
|
64
|
+
boxShadow,
|
65
|
+
opacity,
|
66
|
+
overflow,
|
67
|
+
overflowX,
|
68
|
+
overflowY,
|
69
|
+
...htmlProps
|
70
|
+
},
|
71
|
+
ref
|
72
|
+
) => {
|
73
|
+
const childrenArray = Array.isArray(children) ? children : [children];
|
74
|
+
|
75
|
+
return (
|
76
|
+
<Component
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
78
|
+
ref={ref as any}
|
79
|
+
className={clsx(
|
80
|
+
columnsRecipe({ align, spacing, wrap, reverse, alignItems }),
|
81
|
+
sprinkles({
|
82
|
+
margin,
|
83
|
+
marginTop,
|
84
|
+
marginBottom,
|
85
|
+
marginLeft,
|
86
|
+
marginRight,
|
87
|
+
padding,
|
88
|
+
paddingTop,
|
89
|
+
paddingBottom,
|
90
|
+
paddingLeft,
|
91
|
+
paddingRight,
|
92
|
+
gap,
|
93
|
+
display,
|
94
|
+
flexDirection,
|
95
|
+
justifyContent,
|
96
|
+
flexWrap,
|
97
|
+
flex,
|
98
|
+
width,
|
99
|
+
height,
|
100
|
+
minWidth,
|
101
|
+
maxWidth,
|
102
|
+
minHeight,
|
103
|
+
position,
|
104
|
+
top,
|
105
|
+
bottom,
|
106
|
+
left,
|
107
|
+
right,
|
108
|
+
zIndex,
|
109
|
+
fontSize,
|
110
|
+
fontFamily,
|
111
|
+
lineHeight,
|
112
|
+
textAlign,
|
113
|
+
fontWeight,
|
114
|
+
color,
|
115
|
+
backgroundColor,
|
116
|
+
borderRadius,
|
117
|
+
borderWidth,
|
118
|
+
borderStyle,
|
119
|
+
borderColor,
|
120
|
+
boxShadow,
|
121
|
+
opacity,
|
122
|
+
overflow,
|
123
|
+
overflowX,
|
124
|
+
overflowY,
|
125
|
+
}),
|
126
|
+
css,
|
127
|
+
className
|
128
|
+
)}
|
129
|
+
{...htmlProps}>
|
130
|
+
{columns && columns.length > 0
|
131
|
+
? childrenArray.map((child, index) => (
|
132
|
+
<div key={index} className={clsx(columns[index] && columnWidths[columns[index]])}>
|
133
|
+
{child}
|
134
|
+
</div>
|
135
|
+
))
|
136
|
+
: children}
|
137
|
+
</Component>
|
138
|
+
);
|
139
|
+
}
|
140
|
+
);
|
141
|
+
|
142
|
+
Columns.displayName = 'Columns';
|
@@ -0,0 +1,202 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef, useEffect, useState } from 'react';
|
3
|
+
import { consentActions, consentContent, type ConsentCookieVariants, consentRecipe } from './ConsentCookie.css';
|
4
|
+
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
5
|
+
import { getCookie, setCookie } from '../../utils/cookie';
|
6
|
+
import { Button } from '../Button/Button';
|
7
|
+
|
8
|
+
// Declare window object including gtag to avoid TypeScript errors
|
9
|
+
declare const window: Window &
|
10
|
+
typeof globalThis & {
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
12
|
+
gtag: any;
|
13
|
+
};
|
14
|
+
|
15
|
+
export interface ConsentCookieProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<ConsentCookieVariants> {
|
16
|
+
css?: string;
|
17
|
+
cookieName?: string;
|
18
|
+
cookieExpirationDays?: number;
|
19
|
+
onAccept?: () => void;
|
20
|
+
onReject?: () => void;
|
21
|
+
translations?: {
|
22
|
+
actions: {
|
23
|
+
accept: string;
|
24
|
+
reject: string;
|
25
|
+
};
|
26
|
+
};
|
27
|
+
enableGoogleAnalytics?: boolean;
|
28
|
+
}
|
29
|
+
|
30
|
+
export const ConsentCookie = forwardRef<HTMLDivElement, ConsentCookieProps>(
|
31
|
+
(
|
32
|
+
{
|
33
|
+
children,
|
34
|
+
variant,
|
35
|
+
cookieName = 'consent',
|
36
|
+
cookieExpirationDays = 365,
|
37
|
+
onAccept,
|
38
|
+
onReject,
|
39
|
+
translations,
|
40
|
+
enableGoogleAnalytics = true,
|
41
|
+
css,
|
42
|
+
className,
|
43
|
+
// Extract sprinkles props
|
44
|
+
margin,
|
45
|
+
marginTop,
|
46
|
+
marginBottom,
|
47
|
+
marginLeft,
|
48
|
+
marginRight,
|
49
|
+
padding,
|
50
|
+
paddingTop,
|
51
|
+
paddingBottom,
|
52
|
+
paddingLeft,
|
53
|
+
paddingRight,
|
54
|
+
gap,
|
55
|
+
display,
|
56
|
+
flexDirection,
|
57
|
+
justifyContent,
|
58
|
+
flexWrap,
|
59
|
+
flex,
|
60
|
+
width,
|
61
|
+
height,
|
62
|
+
minWidth,
|
63
|
+
maxWidth,
|
64
|
+
minHeight,
|
65
|
+
zIndex,
|
66
|
+
fontSize,
|
67
|
+
fontFamily,
|
68
|
+
lineHeight,
|
69
|
+
textAlign,
|
70
|
+
fontWeight,
|
71
|
+
color,
|
72
|
+
backgroundColor,
|
73
|
+
borderRadius,
|
74
|
+
borderWidth,
|
75
|
+
borderStyle,
|
76
|
+
borderColor,
|
77
|
+
boxShadow,
|
78
|
+
opacity,
|
79
|
+
overflow,
|
80
|
+
overflowX,
|
81
|
+
overflowY,
|
82
|
+
...htmlProps
|
83
|
+
},
|
84
|
+
ref
|
85
|
+
) => {
|
86
|
+
const [showConsent, setShowConsent] = useState(false);
|
87
|
+
|
88
|
+
const handleAccept = () => {
|
89
|
+
setShowConsent(false);
|
90
|
+
setCookie(cookieName, 'true', cookieExpirationDays);
|
91
|
+
|
92
|
+
if (enableGoogleAnalytics && typeof window !== 'undefined' && typeof window.gtag !== 'undefined') {
|
93
|
+
window.gtag('consent', 'update', {
|
94
|
+
analytics_storage: 'granted',
|
95
|
+
});
|
96
|
+
}
|
97
|
+
|
98
|
+
onAccept?.();
|
99
|
+
};
|
100
|
+
|
101
|
+
const handleReject = () => {
|
102
|
+
setShowConsent(false);
|
103
|
+
setCookie(cookieName, 'false', cookieExpirationDays);
|
104
|
+
|
105
|
+
if (enableGoogleAnalytics && typeof window !== 'undefined' && typeof window.gtag !== 'undefined') {
|
106
|
+
window.gtag('consent', 'update', {
|
107
|
+
analytics_storage: 'denied',
|
108
|
+
});
|
109
|
+
}
|
110
|
+
|
111
|
+
onReject?.();
|
112
|
+
};
|
113
|
+
|
114
|
+
useEffect(() => {
|
115
|
+
const consentValue = getCookie(cookieName);
|
116
|
+
const shouldShowConsent = consentValue !== 'true' && consentValue !== 'false';
|
117
|
+
const areCookiesAccepted = consentValue === 'true';
|
118
|
+
|
119
|
+
if (shouldShowConsent) {
|
120
|
+
setShowConsent(true);
|
121
|
+
}
|
122
|
+
|
123
|
+
// Set initial Google Analytics consent
|
124
|
+
if (enableGoogleAnalytics && typeof window !== 'undefined' && typeof window.gtag !== 'undefined') {
|
125
|
+
const gAnalyticsConsent = areCookiesAccepted ? 'granted' : 'denied';
|
126
|
+
window.gtag('consent', 'update', {
|
127
|
+
analytics_storage: gAnalyticsConsent,
|
128
|
+
});
|
129
|
+
}
|
130
|
+
}, [cookieName, enableGoogleAnalytics]);
|
131
|
+
|
132
|
+
if (!showConsent) return null;
|
133
|
+
|
134
|
+
return (
|
135
|
+
<div
|
136
|
+
ref={ref}
|
137
|
+
className={clsx(
|
138
|
+
consentRecipe({ variant }),
|
139
|
+
sprinkles({
|
140
|
+
margin,
|
141
|
+
marginTop,
|
142
|
+
marginBottom,
|
143
|
+
marginLeft,
|
144
|
+
marginRight,
|
145
|
+
padding,
|
146
|
+
paddingTop,
|
147
|
+
paddingBottom,
|
148
|
+
paddingLeft,
|
149
|
+
paddingRight,
|
150
|
+
gap,
|
151
|
+
display,
|
152
|
+
flexDirection,
|
153
|
+
justifyContent,
|
154
|
+
flexWrap,
|
155
|
+
flex,
|
156
|
+
width,
|
157
|
+
height,
|
158
|
+
minWidth,
|
159
|
+
maxWidth,
|
160
|
+
minHeight,
|
161
|
+
zIndex,
|
162
|
+
fontSize,
|
163
|
+
fontFamily,
|
164
|
+
lineHeight,
|
165
|
+
textAlign,
|
166
|
+
fontWeight,
|
167
|
+
color,
|
168
|
+
backgroundColor,
|
169
|
+
borderRadius,
|
170
|
+
borderWidth,
|
171
|
+
borderStyle,
|
172
|
+
borderColor,
|
173
|
+
boxShadow,
|
174
|
+
opacity,
|
175
|
+
overflow,
|
176
|
+
overflowX,
|
177
|
+
overflowY,
|
178
|
+
}),
|
179
|
+
css,
|
180
|
+
className
|
181
|
+
)}
|
182
|
+
role="dialog"
|
183
|
+
aria-modal="true"
|
184
|
+
aria-labelledby="consent-title"
|
185
|
+
{...htmlProps}>
|
186
|
+
<div className={consentContent}>
|
187
|
+
{children}
|
188
|
+
<div className={consentActions}>
|
189
|
+
<Button variant="outline" size="sm" onClick={handleReject}>
|
190
|
+
{translations?.actions.reject || 'Reject'}
|
191
|
+
</Button>
|
192
|
+
<Button variant="primary" size="sm" onClick={handleAccept}>
|
193
|
+
{translations?.actions.accept || 'Accept'}
|
194
|
+
</Button>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
);
|
199
|
+
}
|
200
|
+
);
|
201
|
+
|
202
|
+
ConsentCookie.displayName = 'ConsentCookie';
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// import type { Meta, StoryObj } from '@storybook/react';
|
2
|
-
//
|
3
|
-
// import {
|
2
|
+
//
|
3
|
+
// import { ConsentCookie } from '.';
|
4
4
|
//
|
5
5
|
// // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
6
|
-
// const meta = {
|
7
|
-
// title: 'Latte Components /
|
8
|
-
// component:
|
6
|
+
// const meta: Meta<typeof ConsentCookie> = {
|
7
|
+
// title: 'Latte Components / 5. Consent / Cookie',
|
8
|
+
// component: ConsentCookie,
|
9
9
|
// parameters: {
|
10
10
|
// // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
11
11
|
// layout: 'centered',
|
@@ -15,7 +15,7 @@
|
|
15
15
|
// // More on argTypes: https://storybook.js.org/docs/api/argtypes
|
16
16
|
// argTypes: {},
|
17
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
|
-
// }
|
18
|
+
// };
|
19
19
|
//
|
20
20
|
// export default meta;
|
21
21
|
// type Story = StoryObj<typeof meta>;
|
@@ -23,7 +23,6 @@
|
|
23
23
|
// // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
24
24
|
// export const Default: Story = {
|
25
25
|
// args: {
|
26
|
-
//
|
27
|
-
// theme: defaultTheme,
|
26
|
+
// children: 'Cookies with your latte? In accordance with our cookies policy',
|
28
27
|
// },
|
29
28
|
// };
|
@@ -0,0 +1,130 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
import { footerRecipe, type FooterVariants } from './Footer.css';
|
4
|
+
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
5
|
+
|
6
|
+
export interface FooterProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Sprinkles, NonNullable<FooterVariants> {
|
7
|
+
css?: string;
|
8
|
+
as?: 'footer' | 'div';
|
9
|
+
}
|
10
|
+
|
11
|
+
export const Footer = forwardRef<HTMLElement, FooterProps>(
|
12
|
+
(
|
13
|
+
{
|
14
|
+
children,
|
15
|
+
variant,
|
16
|
+
size,
|
17
|
+
layout,
|
18
|
+
as: Component = 'footer',
|
19
|
+
css,
|
20
|
+
className,
|
21
|
+
// Extract sprinkles props
|
22
|
+
margin,
|
23
|
+
marginTop,
|
24
|
+
marginBottom,
|
25
|
+
marginLeft,
|
26
|
+
marginRight,
|
27
|
+
padding,
|
28
|
+
paddingTop,
|
29
|
+
paddingBottom,
|
30
|
+
paddingLeft,
|
31
|
+
paddingRight,
|
32
|
+
gap,
|
33
|
+
display,
|
34
|
+
flexDirection,
|
35
|
+
justifyContent,
|
36
|
+
flexWrap,
|
37
|
+
flex,
|
38
|
+
width,
|
39
|
+
height,
|
40
|
+
minWidth,
|
41
|
+
maxWidth,
|
42
|
+
minHeight,
|
43
|
+
position,
|
44
|
+
top,
|
45
|
+
bottom,
|
46
|
+
left,
|
47
|
+
right,
|
48
|
+
zIndex,
|
49
|
+
fontSize,
|
50
|
+
fontFamily,
|
51
|
+
lineHeight,
|
52
|
+
textAlign,
|
53
|
+
fontWeight,
|
54
|
+
color,
|
55
|
+
backgroundColor,
|
56
|
+
borderRadius,
|
57
|
+
borderWidth,
|
58
|
+
borderStyle,
|
59
|
+
borderColor,
|
60
|
+
boxShadow,
|
61
|
+
opacity,
|
62
|
+
overflow,
|
63
|
+
overflowX,
|
64
|
+
overflowY,
|
65
|
+
...htmlProps
|
66
|
+
},
|
67
|
+
ref
|
68
|
+
) => {
|
69
|
+
return (
|
70
|
+
<Component
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
72
|
+
ref={ref as any}
|
73
|
+
className={clsx(
|
74
|
+
footerRecipe({ variant, size, layout }),
|
75
|
+
sprinkles({
|
76
|
+
margin,
|
77
|
+
marginTop,
|
78
|
+
marginBottom,
|
79
|
+
marginLeft,
|
80
|
+
marginRight,
|
81
|
+
padding,
|
82
|
+
paddingTop,
|
83
|
+
paddingBottom,
|
84
|
+
paddingLeft,
|
85
|
+
paddingRight,
|
86
|
+
gap,
|
87
|
+
display,
|
88
|
+
flexDirection,
|
89
|
+
justifyContent,
|
90
|
+
flexWrap,
|
91
|
+
flex,
|
92
|
+
width,
|
93
|
+
height,
|
94
|
+
minWidth,
|
95
|
+
maxWidth,
|
96
|
+
minHeight,
|
97
|
+
position,
|
98
|
+
top,
|
99
|
+
bottom,
|
100
|
+
left,
|
101
|
+
right,
|
102
|
+
zIndex,
|
103
|
+
fontSize,
|
104
|
+
fontFamily,
|
105
|
+
lineHeight,
|
106
|
+
textAlign,
|
107
|
+
fontWeight,
|
108
|
+
color,
|
109
|
+
backgroundColor,
|
110
|
+
borderRadius,
|
111
|
+
borderWidth,
|
112
|
+
borderStyle,
|
113
|
+
borderColor,
|
114
|
+
boxShadow,
|
115
|
+
opacity,
|
116
|
+
overflow,
|
117
|
+
overflowX,
|
118
|
+
overflowY,
|
119
|
+
}),
|
120
|
+
css,
|
121
|
+
className
|
122
|
+
)}
|
123
|
+
{...htmlProps}>
|
124
|
+
{children}
|
125
|
+
</Component>
|
126
|
+
);
|
127
|
+
}
|
128
|
+
);
|
129
|
+
|
130
|
+
Footer.displayName = 'Footer';
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
|
3
|
+
import { Footer } from '../../index';
|
4
|
+
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
6
|
+
const meta: Meta<typeof Footer> = {
|
7
|
+
title: 'Latte Components / Layout / Footer',
|
8
|
+
component: Footer,
|
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,127 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
import { formRecipe, type FormVariants } from './Form.css';
|
4
|
+
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
5
|
+
|
6
|
+
export interface FormProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'color'>, Sprinkles, NonNullable<FormVariants> {
|
7
|
+
css?: string;
|
8
|
+
children: React.ReactNode;
|
9
|
+
}
|
10
|
+
|
11
|
+
export const Form = forwardRef<HTMLFormElement, FormProps>(
|
12
|
+
(
|
13
|
+
{
|
14
|
+
children,
|
15
|
+
spacing,
|
16
|
+
layout,
|
17
|
+
css,
|
18
|
+
className,
|
19
|
+
// Extract sprinkles props
|
20
|
+
margin,
|
21
|
+
marginTop,
|
22
|
+
marginBottom,
|
23
|
+
marginLeft,
|
24
|
+
marginRight,
|
25
|
+
padding,
|
26
|
+
paddingTop,
|
27
|
+
paddingBottom,
|
28
|
+
paddingLeft,
|
29
|
+
paddingRight,
|
30
|
+
gap,
|
31
|
+
display,
|
32
|
+
flexDirection,
|
33
|
+
justifyContent,
|
34
|
+
flexWrap,
|
35
|
+
flex,
|
36
|
+
width,
|
37
|
+
height,
|
38
|
+
minWidth,
|
39
|
+
maxWidth,
|
40
|
+
minHeight,
|
41
|
+
position,
|
42
|
+
top,
|
43
|
+
bottom,
|
44
|
+
left,
|
45
|
+
right,
|
46
|
+
zIndex,
|
47
|
+
fontSize,
|
48
|
+
fontFamily,
|
49
|
+
lineHeight,
|
50
|
+
textAlign,
|
51
|
+
fontWeight,
|
52
|
+
color,
|
53
|
+
backgroundColor,
|
54
|
+
borderRadius,
|
55
|
+
borderWidth,
|
56
|
+
borderStyle,
|
57
|
+
borderColor,
|
58
|
+
boxShadow,
|
59
|
+
opacity,
|
60
|
+
overflow,
|
61
|
+
overflowX,
|
62
|
+
overflowY,
|
63
|
+
...htmlProps
|
64
|
+
},
|
65
|
+
ref
|
66
|
+
) => {
|
67
|
+
return (
|
68
|
+
<form
|
69
|
+
ref={ref}
|
70
|
+
className={clsx(
|
71
|
+
formRecipe({ spacing, layout }),
|
72
|
+
sprinkles({
|
73
|
+
margin,
|
74
|
+
marginTop,
|
75
|
+
marginBottom,
|
76
|
+
marginLeft,
|
77
|
+
marginRight,
|
78
|
+
padding,
|
79
|
+
paddingTop,
|
80
|
+
paddingBottom,
|
81
|
+
paddingLeft,
|
82
|
+
paddingRight,
|
83
|
+
gap,
|
84
|
+
display,
|
85
|
+
flexDirection,
|
86
|
+
justifyContent,
|
87
|
+
flexWrap,
|
88
|
+
flex,
|
89
|
+
width,
|
90
|
+
height,
|
91
|
+
minWidth,
|
92
|
+
maxWidth,
|
93
|
+
minHeight,
|
94
|
+
position,
|
95
|
+
top,
|
96
|
+
bottom,
|
97
|
+
left,
|
98
|
+
right,
|
99
|
+
zIndex,
|
100
|
+
fontSize,
|
101
|
+
fontFamily,
|
102
|
+
lineHeight,
|
103
|
+
textAlign,
|
104
|
+
fontWeight,
|
105
|
+
color,
|
106
|
+
backgroundColor,
|
107
|
+
borderRadius,
|
108
|
+
borderWidth,
|
109
|
+
borderStyle,
|
110
|
+
borderColor,
|
111
|
+
boxShadow,
|
112
|
+
opacity,
|
113
|
+
overflow,
|
114
|
+
overflowX,
|
115
|
+
overflowY,
|
116
|
+
}),
|
117
|
+
css,
|
118
|
+
className
|
119
|
+
)}
|
120
|
+
{...htmlProps}>
|
121
|
+
{children}
|
122
|
+
</form>
|
123
|
+
);
|
124
|
+
}
|
125
|
+
);
|
126
|
+
|
127
|
+
Form.displayName = 'Form';
|