@latte-macchiat-io/latte-vanilla-components 0.0.176 → 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 +9 -22
- 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/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/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/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/dist/components/Actions/Actions.css.ts +0 -113
- package/dist/components/Button/Button.css.ts +0 -119
- package/dist/components/Carousel/Carousel.css.ts +0 -179
- package/dist/components/Columns/Columns.css.ts +0 -185
- package/dist/components/ConsentCookie/ConsentCookie.css.ts +0 -167
- package/dist/components/Footer/Footer.css.ts +0 -108
- package/dist/components/Form/Form.css.ts +0 -64
- package/dist/components/Form/Row/Row.css.ts +0 -70
- package/dist/components/Form/TextField/Input/Input.css.ts +0 -106
- package/dist/components/Form/TextField/Label/Label.css.ts +0 -58
- package/dist/components/Form/TextField/TextField.css.ts +0 -139
- package/dist/components/Form/TextField/Textarea/Textarea.css.ts +0 -121
- package/dist/components/Header/Header.css.ts +0 -111
- package/dist/components/Header/HeaderOverlay/styles.css.ts +0 -33
- package/dist/components/Header/ToggleNav/styles.css.ts +0 -40
- package/dist/components/Icon/Icon.css.ts +0 -102
- package/dist/components/KeyNumber/KeyNumber.css.ts +0 -158
- package/dist/components/LanguageSwitcher/LanguageSwitcher.css.ts +0 -120
- package/dist/components/Logo/Logo.css.ts +0 -98
- package/dist/components/Main/Main.css.ts +0 -62
- package/dist/components/Modal/Modal.css.ts +0 -203
- package/dist/components/Nav/Nav.css.ts +0 -123
- package/dist/components/NavLegal/NavLegal.css.ts +0 -121
- package/dist/components/NavSocial/NavSocial.css.ts +0 -121
- package/dist/components/Section/Section.css.ts +0 -101
- package/dist/components/Video/Video.css.ts +0 -210
- package/dist/components/VideoFullWidth/VideoFullWidth.css.ts +0 -50
- package/dist/css/index.cjs +0 -1
- package/dist/css/index.js +0 -34
- package/dist/index.cjs.js +0 -2
- package/dist/index.es.js +0 -3863
- package/dist/styles/sprinkles.css.ts +0 -84
- package/dist/theme/contract.css.ts +0 -83
- package/dist/theme.css-CNjMk-g_.cjs +0 -1
- package/dist/theme.css-Dj6kL9o0.js +0 -3020
- package/dist/types/components/Actions/Actions.css.d.ts +0 -74
- package/dist/types/components/Actions/Actions.d.ts +0 -7
- package/dist/types/components/Actions/stories.d.ts +0 -0
- package/dist/types/components/Button/Button.css.d.ts +0 -65
- package/dist/types/components/Button/Button.d.ts +0 -8
- package/dist/types/components/Button/export.d.ts +0 -0
- package/dist/types/components/Button/stories.d.ts +0 -0
- package/dist/types/components/Carousel/Carousel.css.d.ts +0 -33
- package/dist/types/components/Carousel/Carousel.d.ts +0 -15
- package/dist/types/components/Carousel/export.d.ts +0 -0
- package/dist/types/components/Columns/Columns.css.d.ts +0 -104
- package/dist/types/components/Columns/Columns.d.ts +0 -8
- package/dist/types/components/Columns/export.d.ts +0 -0
- package/dist/types/components/Columns/stories.d.ts +0 -0
- package/dist/types/components/ConsentCookie/ConsentCookie.css.d.ts +0 -15
- package/dist/types/components/ConsentCookie/ConsentCookie.d.ts +0 -17
- package/dist/types/components/ConsentCookie/export.d.ts +0 -0
- package/dist/types/components/ConsentCookie/stories.d.ts +0 -0
- package/dist/types/components/Footer/Footer.css.d.ts +0 -50
- package/dist/types/components/Footer/Footer.d.ts +0 -7
- package/dist/types/components/Footer/export.d.ts +0 -0
- package/dist/types/components/Footer/stories.d.ts +0 -6
- package/dist/types/components/Form/Form.css.d.ts +0 -46
- package/dist/types/components/Form/Form.d.ts +0 -7
- package/dist/types/components/Form/Row/Row.css.d.ts +0 -51
- package/dist/types/components/Form/Row/Row.d.ts +0 -9
- package/dist/types/components/Form/Row/index.d.ts +0 -0
- package/dist/types/components/Form/Row/stories.d.ts +0 -0
- package/dist/types/components/Form/TextField/Input/Input.css.d.ts +0 -32
- package/dist/types/components/Form/TextField/Input/Input.d.ts +0 -10
- package/dist/types/components/Form/TextField/Input/export.d.ts +0 -0
- package/dist/types/components/Form/TextField/Label/Label.css.d.ts +0 -23
- package/dist/types/components/Form/TextField/Label/Label.d.ts +0 -9
- package/dist/types/components/Form/TextField/Label/export.d.ts +0 -0
- package/dist/types/components/Form/TextField/TextField.css.d.ts +0 -19
- package/dist/types/components/Form/TextField/TextField.d.ts +0 -21
- package/dist/types/components/Form/TextField/Textarea/Textarea.css.d.ts +0 -56
- package/dist/types/components/Form/TextField/Textarea/Textarea.d.ts +0 -8
- package/dist/types/components/Form/TextField/Textarea/export.d.ts +0 -0
- package/dist/types/components/Form/TextField/Textarea/stories.d.ts +0 -0
- package/dist/types/components/Form/TextField/export.d.ts +0 -0
- package/dist/types/components/Form/export.d.ts +0 -0
- package/dist/types/components/Header/Header.css.d.ts +0 -36
- package/dist/types/components/Header/Header.d.ts +0 -11
- package/dist/types/components/Header/HeaderOverlay/index.d.ts +0 -7
- package/dist/types/components/Header/HeaderOverlay/styles.css.d.ts +0 -5
- package/dist/types/components/Header/ToggleNav/index.d.ts +0 -9
- package/dist/types/components/Header/ToggleNav/styles.css.d.ts +0 -5
- package/dist/types/components/Header/export.d.ts +0 -0
- package/dist/types/components/Header/stories.d.ts +0 -6
- package/dist/types/components/Icon/Icon.css.d.ts +0 -45
- package/dist/types/components/Icon/Icon.d.ts +0 -12
- package/dist/types/components/Icon/export.d.ts +0 -0
- package/dist/types/components/Icon/path.d.ts +0 -19
- package/dist/types/components/Icon/stories.d.ts +0 -0
- package/dist/types/components/KeyNumber/KeyNumber.css.d.ts +0 -40
- package/dist/types/components/KeyNumber/KeyNumber.d.ts +0 -15
- package/dist/types/components/KeyNumber/export.d.ts +0 -0
- package/dist/types/components/LanguageSwitcher/LanguageSwitcher.css.d.ts +0 -18
- package/dist/types/components/LanguageSwitcher/LanguageSwitcher.d.ts +0 -16
- package/dist/types/components/LanguageSwitcher/export.d.ts +0 -0
- package/dist/types/components/Logo/Logo.css.d.ts +0 -54
- package/dist/types/components/Logo/Logo.d.ts +0 -8
- package/dist/types/components/Logo/export.d.ts +0 -0
- package/dist/types/components/Logo/stories.d.ts +0 -6
- package/dist/types/components/Main/Main.css.d.ts +0 -32
- package/dist/types/components/Main/Main.d.ts +0 -7
- package/dist/types/components/Main/export.d.ts +0 -0
- package/dist/types/components/Main/stories.d.ts +0 -0
- package/dist/types/components/Modal/Modal.css.d.ts +0 -82
- package/dist/types/components/Modal/Modal.d.ts +0 -15
- package/dist/types/components/Modal/export.d.ts +0 -0
- package/dist/types/components/Modal/types.d.ts +0 -5
- package/dist/types/components/Nav/Nav.css.d.ts +0 -52
- package/dist/types/components/Nav/Nav.d.ts +0 -7
- package/dist/types/components/Nav/export.d.ts +0 -0
- package/dist/types/components/Nav/stories.d.ts +0 -6
- package/dist/types/components/NavLegal/NavLegal.css.d.ts +0 -57
- package/dist/types/components/NavLegal/NavLegal.d.ts +0 -7
- package/dist/types/components/NavLegal/export.d.ts +0 -0
- package/dist/types/components/NavLegal/stories.d.ts +0 -6
- package/dist/types/components/NavSocial/NavSocial.css.d.ts +0 -30
- package/dist/types/components/NavSocial/NavSocial.d.ts +0 -15
- package/dist/types/components/NavSocial/export.d.ts +0 -0
- package/dist/types/components/NavSocial/stories.d.ts +0 -0
- package/dist/types/components/Section/Section.css.d.ts +0 -60
- package/dist/types/components/Section/Section.d.ts +0 -7
- package/dist/types/components/Section/export.d.ts +0 -0
- package/dist/types/components/Section/stories.d.ts +0 -0
- package/dist/types/components/ToRemove/ToRemove.d.ts +0 -1
- package/dist/types/components/Video/Video.css.d.ts +0 -43
- package/dist/types/components/Video/Video.d.ts +0 -17
- package/dist/types/components/Video/export.d.ts +0 -0
- package/dist/types/components/VideoFullWidth/VideoFullWidth.css.d.ts +0 -18
- package/dist/types/components/VideoFullWidth/VideoFullWidth.d.ts +0 -14
- package/dist/types/components/VideoFullWidth/export.d.ts +0 -0
- package/dist/types/css/index.d.ts +0 -28
- package/dist/types/index.d.ts +0 -58
- package/dist/types/styles/mediaqueries.d.ts +0 -16
- package/dist/types/styles/sprinkles.css.d.ts +0 -3423
- package/dist/types/theme/baseThemeValues.d.ts +0 -158
- package/dist/types/theme/contract.css.d.ts +0 -79
- package/dist/types/theme/index.d.ts +0 -3
- package/dist/types/theme/utils.d.ts +0 -86
- package/dist/types/utils/cookie.d.ts +0 -2
- package/dist/types/utils/deep-merge-objects.d.ts +0 -2
- package/dist/types/utils/theme.css.d.ts +0 -173
- package/dist/types/utils/use-breakpoint-key.d.ts +0 -1
- package/dist/types/utils/use-window-size.d.ts +0 -5
- package/dist/utils/theme.css.ts +0 -129
- package/src/components/Button/stories.ts +0 -127
- package/src/components/Section/stories.ts +0 -64
- package/src/css/index.ts +0 -33
- package/src/themes/dark.ts +0 -3
- package/src/themes/index.ts +0 -5
- package/src/themes/light.ts +0 -3
- /package/{dist/types/components/Actions/export.d.ts → src/components/Form/Row/index.tsx} +0 -0
- /package/{dist/types/components/NavLegal/types.d.ts → src/components/NavLegal/types.tsx} +0 -0
- /package/{dist/types/components/NavSocial/types.d.ts → src/components/NavSocial/types.tsx} +0 -0
package/package.json
CHANGED
@@ -1,32 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@latte-macchiat-io/latte-vanilla-components",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.178",
|
4
4
|
"description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
|
5
5
|
"type": "module",
|
6
|
-
"main": "./
|
7
|
-
"
|
8
|
-
"types": "./dist/types/index.d.ts",
|
6
|
+
"main": "./src/index.ts",
|
7
|
+
"types": "./src/index.ts",
|
9
8
|
"sideEffects": false,
|
10
9
|
"exports": {
|
11
|
-
".":
|
12
|
-
"types": "./dist/types/index.d.ts",
|
13
|
-
"import": "./dist/index.es.js",
|
14
|
-
"require": "./dist/index.cjs.js"
|
15
|
-
},
|
16
|
-
"./css": {
|
17
|
-
"types": "./dist/types/css/index.d.ts",
|
18
|
-
"import": "./dist/css/index.js",
|
19
|
-
"require": "./dist/css/index.cjs"
|
20
|
-
},
|
10
|
+
".": "./src/index.ts",
|
21
11
|
"./*.css.ts": "./src/*.css.ts",
|
22
|
-
"./src/*": "./src/*"
|
23
|
-
"./dist/*": "./dist/*"
|
12
|
+
"./src/*": "./src/*"
|
24
13
|
},
|
25
14
|
"files": [
|
26
|
-
"dist",
|
27
15
|
"src/**/*.css.ts",
|
28
16
|
"src/**/*.ts",
|
17
|
+
"src/**/*.tsx",
|
29
18
|
"!src/**/*.stories.ts",
|
19
|
+
"!src/**/stories.ts",
|
30
20
|
"!src/**/*.test.ts"
|
31
21
|
],
|
32
22
|
"peerDependencies": {
|
@@ -57,7 +47,6 @@
|
|
57
47
|
"@vanilla-extract/dynamic": "^2.1.5",
|
58
48
|
"@vanilla-extract/recipes": "^0.5.7",
|
59
49
|
"@vanilla-extract/sprinkles": "^1.6.5",
|
60
|
-
"@vitejs/plugin-react": "^5.0.2",
|
61
50
|
"clsx": "^2.1.1",
|
62
51
|
"eslint": "^9.15.0",
|
63
52
|
"eslint-config-prettier": "^10.0.1",
|
@@ -67,9 +56,7 @@
|
|
67
56
|
"prettier": "^3.4.2",
|
68
57
|
"storybook": "^8.5.2",
|
69
58
|
"typescript": "5.6.3",
|
70
|
-
"typescript-eslint": "^8.21.0"
|
71
|
-
"vite": "^7.1.4",
|
72
|
-
"vite-plugin-dts": "^4.5.4"
|
59
|
+
"typescript-eslint": "^8.21.0"
|
73
60
|
},
|
74
61
|
"engines": {
|
75
62
|
"node": ">=20.9.0",
|
@@ -81,7 +68,7 @@
|
|
81
68
|
]
|
82
69
|
},
|
83
70
|
"scripts": {
|
84
|
-
"build": "
|
71
|
+
"build": "echo \"Source-only distribution - no build needed\"",
|
85
72
|
"test": "echo \"Error: no test specified\" && exit 1",
|
86
73
|
"storybook": "storybook dev -p 6006",
|
87
74
|
"build-storybook": "storybook build",
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export const breakpoints1 = [
|
2
|
+
640 /* Small devices (portrait tablets and large phones, 640px and up) */, 768 /* Medium devices (landscape tablets, 768px and up) */,
|
3
|
+
1024 /* Large devices (laptops/desktops, 1024px and up) */, 1680 /* Extra large devices (large laptops and desktops, 1280px and up) */,
|
4
|
+
];
|
5
|
+
|
6
|
+
export const mq = breakpoints1.map((bp) => `(min-width: ${bp}px)`);
|
7
|
+
|
8
|
+
export const breakpoints = {
|
9
|
+
mobile: 0, // Mobile par défaut
|
10
|
+
sm: 640, // Mobile large
|
11
|
+
md: 768, // Tablette
|
12
|
+
lg: 1024, // Petit laptop
|
13
|
+
xl: 1280, // Desktop
|
14
|
+
'2xl': 1536, // Grand écran
|
15
|
+
} as const;
|
16
|
+
|
17
|
+
export const queries = {
|
18
|
+
mobile: `screen and (min-width: ${breakpoints.mobile}px)`,
|
19
|
+
sm: `screen and (min-width: ${breakpoints.sm}px)`,
|
20
|
+
md: `screen and (min-width: ${breakpoints.md}px)`,
|
21
|
+
lg: `screen and (min-width: ${breakpoints.lg}px)`,
|
22
|
+
xl: `screen and (min-width: ${breakpoints.xl}px)`,
|
23
|
+
'2xl': `screen and (min-width: ${breakpoints['2xl']}px)`,
|
24
|
+
};
|
@@ -0,0 +1,132 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
import { actionsRecipe, type ActionsVariants } from './Actions.css';
|
4
|
+
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
5
|
+
|
6
|
+
export interface ActionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<ActionsVariants> {
|
7
|
+
css?: string;
|
8
|
+
as?: 'div' | 'section' | 'footer';
|
9
|
+
}
|
10
|
+
|
11
|
+
export const Actions = forwardRef<HTMLDivElement, ActionsProps>(
|
12
|
+
(
|
13
|
+
{
|
14
|
+
children,
|
15
|
+
align,
|
16
|
+
direction,
|
17
|
+
spacing,
|
18
|
+
wrap,
|
19
|
+
fullWidth,
|
20
|
+
as: Component = 'div',
|
21
|
+
css,
|
22
|
+
className,
|
23
|
+
// Extract sprinkles props
|
24
|
+
margin,
|
25
|
+
marginTop,
|
26
|
+
marginBottom,
|
27
|
+
marginLeft,
|
28
|
+
marginRight,
|
29
|
+
padding,
|
30
|
+
paddingTop,
|
31
|
+
paddingBottom,
|
32
|
+
paddingLeft,
|
33
|
+
paddingRight,
|
34
|
+
gap,
|
35
|
+
display,
|
36
|
+
flexDirection,
|
37
|
+
justifyContent,
|
38
|
+
flexWrap,
|
39
|
+
flex,
|
40
|
+
width,
|
41
|
+
height,
|
42
|
+
minWidth,
|
43
|
+
maxWidth,
|
44
|
+
minHeight,
|
45
|
+
position,
|
46
|
+
top,
|
47
|
+
bottom,
|
48
|
+
left,
|
49
|
+
right,
|
50
|
+
zIndex,
|
51
|
+
fontSize,
|
52
|
+
fontFamily,
|
53
|
+
lineHeight,
|
54
|
+
textAlign,
|
55
|
+
fontWeight,
|
56
|
+
color,
|
57
|
+
backgroundColor,
|
58
|
+
borderRadius,
|
59
|
+
borderWidth,
|
60
|
+
borderStyle,
|
61
|
+
borderColor,
|
62
|
+
boxShadow,
|
63
|
+
opacity,
|
64
|
+
overflow,
|
65
|
+
overflowX,
|
66
|
+
overflowY,
|
67
|
+
...htmlProps
|
68
|
+
},
|
69
|
+
ref
|
70
|
+
) => {
|
71
|
+
return (
|
72
|
+
<Component
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
74
|
+
ref={ref as any}
|
75
|
+
className={clsx(
|
76
|
+
actionsRecipe({ align, direction, spacing, wrap, fullWidth }),
|
77
|
+
sprinkles({
|
78
|
+
margin,
|
79
|
+
marginTop,
|
80
|
+
marginBottom,
|
81
|
+
marginLeft,
|
82
|
+
marginRight,
|
83
|
+
padding,
|
84
|
+
paddingTop,
|
85
|
+
paddingBottom,
|
86
|
+
paddingLeft,
|
87
|
+
paddingRight,
|
88
|
+
gap,
|
89
|
+
display,
|
90
|
+
flexDirection,
|
91
|
+
justifyContent,
|
92
|
+
flexWrap,
|
93
|
+
flex,
|
94
|
+
width,
|
95
|
+
height,
|
96
|
+
minWidth,
|
97
|
+
maxWidth,
|
98
|
+
minHeight,
|
99
|
+
position,
|
100
|
+
top,
|
101
|
+
bottom,
|
102
|
+
left,
|
103
|
+
right,
|
104
|
+
zIndex,
|
105
|
+
fontSize,
|
106
|
+
fontFamily,
|
107
|
+
lineHeight,
|
108
|
+
textAlign,
|
109
|
+
fontWeight,
|
110
|
+
color,
|
111
|
+
backgroundColor,
|
112
|
+
borderRadius,
|
113
|
+
borderWidth,
|
114
|
+
borderStyle,
|
115
|
+
borderColor,
|
116
|
+
boxShadow,
|
117
|
+
opacity,
|
118
|
+
overflow,
|
119
|
+
overflowX,
|
120
|
+
overflowY,
|
121
|
+
}),
|
122
|
+
css,
|
123
|
+
className
|
124
|
+
)}
|
125
|
+
{...htmlProps}>
|
126
|
+
{children}
|
127
|
+
</Component>
|
128
|
+
);
|
129
|
+
}
|
130
|
+
);
|
131
|
+
|
132
|
+
Actions.displayName = 'Actions';
|
@@ -1,13 +1,15 @@
|
|
1
1
|
// import type { Meta, StoryObj } from '@storybook/react';
|
2
|
-
|
2
|
+
|
3
|
+
// import { Actions, Button } from '../../index';
|
4
|
+
// import { actionsStyle } from './styles.css';
|
5
|
+
|
3
6
|
// import { defaultTheme } from '../../assets/styles/default-theme';
|
4
|
-
// import {
|
5
|
-
|
6
|
-
//
|
7
|
+
// import { buttonStyle } from '../Button/styles.css';
|
8
|
+
|
7
9
|
// // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
8
|
-
// const meta = {
|
9
|
-
// title: 'Latte Components /
|
10
|
-
// component:
|
10
|
+
// const meta: Meta<typeof Actions> = {
|
11
|
+
// title: 'Latte Components / 3. Buttons / Actions',
|
12
|
+
// component: Actions,
|
11
13
|
// parameters: {
|
12
14
|
// // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
13
15
|
// layout: 'centered',
|
@@ -17,17 +19,16 @@
|
|
17
19
|
// // More on argTypes: https://storybook.js.org/docs/api/argtypes
|
18
20
|
// argTypes: {},
|
19
21
|
// // 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
|
20
|
-
// }
|
21
|
-
|
22
|
+
// };
|
23
|
+
|
22
24
|
// export default meta;
|
23
25
|
// type Story = StoryObj<typeof meta>;
|
24
|
-
|
26
|
+
|
25
27
|
// // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
26
28
|
// export const Default: Story = {
|
27
29
|
// args: {
|
28
|
-
// className: mainStyle,
|
29
30
|
// theme: defaultTheme,
|
30
|
-
//
|
31
|
-
//
|
31
|
+
// className: actionsStyle,
|
32
|
+
// children: <Button className={buttonStyle}>Button</Button>,
|
32
33
|
// },
|
33
34
|
// };
|
@@ -0,0 +1,132 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
import { buttonRecipe, type ButtonVariants } from './Button.css';
|
4
|
+
import { sprinkles, Sprinkles } from '../../styles/sprinkles.css';
|
5
|
+
|
6
|
+
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>, Sprinkles, NonNullable<ButtonVariants> {
|
7
|
+
css?: string;
|
8
|
+
isPending?: boolean;
|
9
|
+
asChild?: boolean;
|
10
|
+
}
|
11
|
+
|
12
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
13
|
+
(
|
14
|
+
{
|
15
|
+
variant,
|
16
|
+
size,
|
17
|
+
fullWidth,
|
18
|
+
isPending = false,
|
19
|
+
disabled,
|
20
|
+
css,
|
21
|
+
className,
|
22
|
+
children,
|
23
|
+
// Extract sprinkles props
|
24
|
+
margin,
|
25
|
+
marginTop,
|
26
|
+
marginBottom,
|
27
|
+
marginLeft,
|
28
|
+
marginRight,
|
29
|
+
padding,
|
30
|
+
paddingTop,
|
31
|
+
paddingBottom,
|
32
|
+
paddingLeft,
|
33
|
+
paddingRight,
|
34
|
+
gap,
|
35
|
+
display,
|
36
|
+
flexDirection,
|
37
|
+
justifyContent,
|
38
|
+
flexWrap,
|
39
|
+
flex,
|
40
|
+
width,
|
41
|
+
height,
|
42
|
+
minWidth,
|
43
|
+
maxWidth,
|
44
|
+
minHeight,
|
45
|
+
position,
|
46
|
+
top,
|
47
|
+
bottom,
|
48
|
+
left,
|
49
|
+
right,
|
50
|
+
zIndex,
|
51
|
+
fontSize,
|
52
|
+
fontFamily,
|
53
|
+
lineHeight,
|
54
|
+
textAlign,
|
55
|
+
fontWeight,
|
56
|
+
color,
|
57
|
+
backgroundColor,
|
58
|
+
borderRadius,
|
59
|
+
borderWidth,
|
60
|
+
borderStyle,
|
61
|
+
borderColor,
|
62
|
+
boxShadow,
|
63
|
+
opacity,
|
64
|
+
overflow,
|
65
|
+
overflowX,
|
66
|
+
overflowY,
|
67
|
+
...htmlProps
|
68
|
+
},
|
69
|
+
ref
|
70
|
+
) => {
|
71
|
+
return (
|
72
|
+
<button
|
73
|
+
ref={ref}
|
74
|
+
className={clsx(
|
75
|
+
buttonRecipe({ variant, size, fullWidth }),
|
76
|
+
sprinkles({
|
77
|
+
margin,
|
78
|
+
marginTop,
|
79
|
+
marginBottom,
|
80
|
+
marginLeft,
|
81
|
+
marginRight,
|
82
|
+
padding,
|
83
|
+
paddingTop,
|
84
|
+
paddingBottom,
|
85
|
+
paddingLeft,
|
86
|
+
paddingRight,
|
87
|
+
gap,
|
88
|
+
display,
|
89
|
+
flexDirection,
|
90
|
+
justifyContent,
|
91
|
+
flexWrap,
|
92
|
+
flex,
|
93
|
+
width,
|
94
|
+
height,
|
95
|
+
minWidth,
|
96
|
+
maxWidth,
|
97
|
+
minHeight,
|
98
|
+
position,
|
99
|
+
top,
|
100
|
+
bottom,
|
101
|
+
left,
|
102
|
+
right,
|
103
|
+
zIndex,
|
104
|
+
fontSize,
|
105
|
+
fontFamily,
|
106
|
+
lineHeight,
|
107
|
+
textAlign,
|
108
|
+
fontWeight,
|
109
|
+
color,
|
110
|
+
backgroundColor,
|
111
|
+
borderRadius,
|
112
|
+
borderWidth,
|
113
|
+
borderStyle,
|
114
|
+
borderColor,
|
115
|
+
boxShadow,
|
116
|
+
opacity,
|
117
|
+
overflow,
|
118
|
+
overflowX,
|
119
|
+
overflowY,
|
120
|
+
}),
|
121
|
+
css,
|
122
|
+
className
|
123
|
+
)}
|
124
|
+
disabled={disabled || isPending}
|
125
|
+
{...htmlProps}>
|
126
|
+
{isPending ? 'Loading...' : children}
|
127
|
+
</button>
|
128
|
+
);
|
129
|
+
}
|
130
|
+
);
|
131
|
+
|
132
|
+
Button.displayName = 'Button';
|