@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
@@ -0,0 +1,243 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef, useEffect, useRef, useState } from 'react';
|
3
|
+
import {
|
4
|
+
closeButton,
|
5
|
+
pauseButton,
|
6
|
+
playButton,
|
7
|
+
posterImage,
|
8
|
+
soundButton,
|
9
|
+
videoElement,
|
10
|
+
videoPoster,
|
11
|
+
videoRecipe,
|
12
|
+
type VideoVariants,
|
13
|
+
} from './Video.css';
|
14
|
+
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
15
|
+
import { Icon } from '../Icon/Icon';
|
16
|
+
|
17
|
+
export interface VideoProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<VideoVariants> {
|
18
|
+
css?: string;
|
19
|
+
video: string;
|
20
|
+
poster?: string;
|
21
|
+
isAutoPlay?: boolean;
|
22
|
+
startMuted?: boolean;
|
23
|
+
showControls?: boolean;
|
24
|
+
hidePlayButton?: boolean;
|
25
|
+
isVideoFullWidth?: boolean;
|
26
|
+
isPlayingFullScreen?: boolean;
|
27
|
+
onPlay?: () => void;
|
28
|
+
onClose?: () => void;
|
29
|
+
onEnded?: () => void;
|
30
|
+
}
|
31
|
+
|
32
|
+
export const Video = forwardRef<HTMLDivElement, VideoProps>(
|
33
|
+
(
|
34
|
+
{
|
35
|
+
video,
|
36
|
+
poster,
|
37
|
+
isAutoPlay = false,
|
38
|
+
startMuted = false,
|
39
|
+
showControls = false,
|
40
|
+
hidePlayButton = false,
|
41
|
+
isVideoFullWidth = false,
|
42
|
+
isPlayingFullScreen = false,
|
43
|
+
onPlay,
|
44
|
+
onClose,
|
45
|
+
onEnded,
|
46
|
+
size,
|
47
|
+
aspectRatio,
|
48
|
+
css,
|
49
|
+
className,
|
50
|
+
// Extract sprinkles props
|
51
|
+
margin,
|
52
|
+
marginTop,
|
53
|
+
marginBottom,
|
54
|
+
marginLeft,
|
55
|
+
marginRight,
|
56
|
+
padding,
|
57
|
+
paddingTop,
|
58
|
+
paddingBottom,
|
59
|
+
paddingLeft,
|
60
|
+
paddingRight,
|
61
|
+
gap,
|
62
|
+
display,
|
63
|
+
flexDirection,
|
64
|
+
justifyContent,
|
65
|
+
flexWrap,
|
66
|
+
flex,
|
67
|
+
width,
|
68
|
+
height,
|
69
|
+
minWidth,
|
70
|
+
maxWidth,
|
71
|
+
minHeight,
|
72
|
+
position,
|
73
|
+
top,
|
74
|
+
bottom,
|
75
|
+
left,
|
76
|
+
right,
|
77
|
+
zIndex,
|
78
|
+
fontSize,
|
79
|
+
fontFamily,
|
80
|
+
lineHeight,
|
81
|
+
textAlign,
|
82
|
+
fontWeight,
|
83
|
+
color,
|
84
|
+
backgroundColor,
|
85
|
+
borderRadius,
|
86
|
+
borderWidth,
|
87
|
+
borderStyle,
|
88
|
+
borderColor,
|
89
|
+
boxShadow,
|
90
|
+
opacity,
|
91
|
+
overflow,
|
92
|
+
overflowX,
|
93
|
+
overflowY,
|
94
|
+
...htmlProps
|
95
|
+
},
|
96
|
+
ref
|
97
|
+
) => {
|
98
|
+
const videoRef = useRef<HTMLVideoElement>(null);
|
99
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
100
|
+
const [isMuted, setIsMuted] = useState(isAutoPlay || startMuted);
|
101
|
+
|
102
|
+
const playVideo = () => {
|
103
|
+
if (onPlay) onPlay();
|
104
|
+
videoRef.current?.play();
|
105
|
+
setIsPlaying(true);
|
106
|
+
};
|
107
|
+
|
108
|
+
const closeVideo = () => {
|
109
|
+
if (onClose) onClose();
|
110
|
+
videoRef.current?.pause();
|
111
|
+
setIsPlaying(false);
|
112
|
+
};
|
113
|
+
|
114
|
+
const pauseVideo = () => {
|
115
|
+
videoRef.current?.pause();
|
116
|
+
setIsPlaying(false);
|
117
|
+
};
|
118
|
+
|
119
|
+
const toggleMutedVideo = () => {
|
120
|
+
const newIsMuted = !isMuted;
|
121
|
+
setIsMuted(newIsMuted);
|
122
|
+
if (videoRef.current) videoRef.current.muted = newIsMuted;
|
123
|
+
};
|
124
|
+
|
125
|
+
const handleVideoEnded = () => {
|
126
|
+
if (onEnded) onEnded();
|
127
|
+
closeVideo();
|
128
|
+
};
|
129
|
+
|
130
|
+
const onEscape = (event: KeyboardEvent) => {
|
131
|
+
if (event.key === 'Escape') closeVideo();
|
132
|
+
};
|
133
|
+
|
134
|
+
useEffect(() => {
|
135
|
+
window.addEventListener('keydown', onEscape);
|
136
|
+
|
137
|
+
return () => {
|
138
|
+
window.removeEventListener('keydown', onEscape);
|
139
|
+
};
|
140
|
+
}, []);
|
141
|
+
|
142
|
+
useEffect(() => {
|
143
|
+
if (videoRef.current) {
|
144
|
+
videoRef.current.muted = isMuted;
|
145
|
+
}
|
146
|
+
}, [isMuted]);
|
147
|
+
|
148
|
+
return (
|
149
|
+
<div
|
150
|
+
ref={ref}
|
151
|
+
className={clsx(
|
152
|
+
videoRecipe({
|
153
|
+
size: isVideoFullWidth ? 'fullWidth' : size,
|
154
|
+
aspectRatio,
|
155
|
+
}),
|
156
|
+
sprinkles({
|
157
|
+
margin,
|
158
|
+
marginTop,
|
159
|
+
marginBottom,
|
160
|
+
marginLeft,
|
161
|
+
marginRight,
|
162
|
+
padding,
|
163
|
+
paddingTop,
|
164
|
+
paddingBottom,
|
165
|
+
paddingLeft,
|
166
|
+
paddingRight,
|
167
|
+
gap,
|
168
|
+
display,
|
169
|
+
flexDirection,
|
170
|
+
justifyContent,
|
171
|
+
flexWrap,
|
172
|
+
flex,
|
173
|
+
width,
|
174
|
+
height,
|
175
|
+
minWidth,
|
176
|
+
maxWidth,
|
177
|
+
minHeight,
|
178
|
+
position,
|
179
|
+
top,
|
180
|
+
bottom,
|
181
|
+
left,
|
182
|
+
right,
|
183
|
+
zIndex,
|
184
|
+
fontSize,
|
185
|
+
fontFamily,
|
186
|
+
lineHeight,
|
187
|
+
textAlign,
|
188
|
+
fontWeight,
|
189
|
+
color,
|
190
|
+
backgroundColor,
|
191
|
+
borderRadius,
|
192
|
+
borderWidth,
|
193
|
+
borderStyle,
|
194
|
+
borderColor,
|
195
|
+
boxShadow,
|
196
|
+
opacity,
|
197
|
+
overflow,
|
198
|
+
overflowX,
|
199
|
+
overflowY,
|
200
|
+
}),
|
201
|
+
css,
|
202
|
+
className
|
203
|
+
)}
|
204
|
+
{...htmlProps}>
|
205
|
+
<video ref={videoRef} className={videoElement} playsInline muted={isMuted} autoPlay={isAutoPlay} onEnded={handleVideoEnded}>
|
206
|
+
<source src={video} type="video/mp4" />
|
207
|
+
</video>
|
208
|
+
|
209
|
+
{poster && (
|
210
|
+
<div className={videoPoster} data-playing={isPlaying}>
|
211
|
+
<img src={poster} alt="Video poster" className={posterImage} sizes="2560" />
|
212
|
+
</div>
|
213
|
+
)}
|
214
|
+
|
215
|
+
{!hidePlayButton && !isAutoPlay && (
|
216
|
+
<button className={playButton} data-playing={isPlaying} onClick={playVideo} aria-label="Play video" type="button">
|
217
|
+
<Icon icon="play" size="lg" />
|
218
|
+
</button>
|
219
|
+
)}
|
220
|
+
|
221
|
+
{isPlayingFullScreen && (
|
222
|
+
<button className={closeButton} onClick={closeVideo} aria-label="Close video" type="button">
|
223
|
+
<Icon icon="close" size="md" />
|
224
|
+
</button>
|
225
|
+
)}
|
226
|
+
|
227
|
+
{isPlaying && showControls && (
|
228
|
+
<button className={pauseButton} onClick={pauseVideo} aria-label="Pause video" type="button">
|
229
|
+
<Icon icon="pause" size="md" />
|
230
|
+
</button>
|
231
|
+
)}
|
232
|
+
|
233
|
+
{showControls && (
|
234
|
+
<button className={soundButton} onClick={toggleMutedVideo} aria-label={isMuted ? 'Unmute video' : 'Mute video'} type="button">
|
235
|
+
<Icon icon={isMuted ? 'volumeMute' : 'volumeUp'} size="md" />
|
236
|
+
</button>
|
237
|
+
)}
|
238
|
+
</div>
|
239
|
+
);
|
240
|
+
}
|
241
|
+
);
|
242
|
+
|
243
|
+
Video.displayName = 'Video';
|
@@ -0,0 +1,152 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
import { videoFullWidthRecipe, type VideoFullWidthVariants } from './VideoFullWidth.css';
|
4
|
+
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
5
|
+
import { Video } from '../Video/Video';
|
6
|
+
|
7
|
+
export interface VideoFullWidthProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<VideoFullWidthVariants> {
|
8
|
+
css?: string;
|
9
|
+
video: string;
|
10
|
+
poster?: string;
|
11
|
+
isAutoPlay?: boolean;
|
12
|
+
startMuted?: boolean;
|
13
|
+
showControls?: boolean;
|
14
|
+
onPlay?: () => void;
|
15
|
+
onClose?: () => void;
|
16
|
+
onEnded?: () => void;
|
17
|
+
}
|
18
|
+
|
19
|
+
export const VideoFullWidth = forwardRef<HTMLDivElement, VideoFullWidthProps>(
|
20
|
+
(
|
21
|
+
{
|
22
|
+
video,
|
23
|
+
poster,
|
24
|
+
isAutoPlay = false,
|
25
|
+
startMuted = false,
|
26
|
+
showControls = false,
|
27
|
+
onPlay,
|
28
|
+
onClose,
|
29
|
+
onEnded,
|
30
|
+
aspectRatio,
|
31
|
+
css,
|
32
|
+
className,
|
33
|
+
// Extract sprinkles props
|
34
|
+
margin,
|
35
|
+
marginTop,
|
36
|
+
marginBottom,
|
37
|
+
marginLeft,
|
38
|
+
marginRight,
|
39
|
+
padding,
|
40
|
+
paddingTop,
|
41
|
+
paddingBottom,
|
42
|
+
paddingLeft,
|
43
|
+
paddingRight,
|
44
|
+
gap,
|
45
|
+
display,
|
46
|
+
flexDirection,
|
47
|
+
justifyContent,
|
48
|
+
flexWrap,
|
49
|
+
flex,
|
50
|
+
width,
|
51
|
+
height,
|
52
|
+
minWidth,
|
53
|
+
maxWidth,
|
54
|
+
minHeight,
|
55
|
+
position,
|
56
|
+
top,
|
57
|
+
bottom,
|
58
|
+
left,
|
59
|
+
right,
|
60
|
+
zIndex,
|
61
|
+
fontSize,
|
62
|
+
fontFamily,
|
63
|
+
lineHeight,
|
64
|
+
textAlign,
|
65
|
+
fontWeight,
|
66
|
+
color,
|
67
|
+
backgroundColor,
|
68
|
+
borderRadius,
|
69
|
+
borderWidth,
|
70
|
+
borderStyle,
|
71
|
+
borderColor,
|
72
|
+
boxShadow,
|
73
|
+
opacity,
|
74
|
+
overflow,
|
75
|
+
overflowX,
|
76
|
+
overflowY,
|
77
|
+
...htmlProps
|
78
|
+
},
|
79
|
+
ref
|
80
|
+
) => {
|
81
|
+
return (
|
82
|
+
<div
|
83
|
+
ref={ref}
|
84
|
+
className={clsx(
|
85
|
+
videoFullWidthRecipe({ aspectRatio }),
|
86
|
+
sprinkles({
|
87
|
+
margin,
|
88
|
+
marginTop,
|
89
|
+
marginBottom,
|
90
|
+
marginLeft,
|
91
|
+
marginRight,
|
92
|
+
padding,
|
93
|
+
paddingTop,
|
94
|
+
paddingBottom,
|
95
|
+
paddingLeft,
|
96
|
+
paddingRight,
|
97
|
+
gap,
|
98
|
+
display,
|
99
|
+
flexDirection,
|
100
|
+
justifyContent,
|
101
|
+
flexWrap,
|
102
|
+
flex,
|
103
|
+
width,
|
104
|
+
height,
|
105
|
+
minWidth,
|
106
|
+
maxWidth,
|
107
|
+
minHeight,
|
108
|
+
position,
|
109
|
+
top,
|
110
|
+
bottom,
|
111
|
+
left,
|
112
|
+
right,
|
113
|
+
zIndex,
|
114
|
+
fontSize,
|
115
|
+
fontFamily,
|
116
|
+
lineHeight,
|
117
|
+
textAlign,
|
118
|
+
fontWeight,
|
119
|
+
color,
|
120
|
+
backgroundColor,
|
121
|
+
borderRadius,
|
122
|
+
borderWidth,
|
123
|
+
borderStyle,
|
124
|
+
borderColor,
|
125
|
+
boxShadow,
|
126
|
+
opacity,
|
127
|
+
overflow,
|
128
|
+
overflowX,
|
129
|
+
overflowY,
|
130
|
+
}),
|
131
|
+
css,
|
132
|
+
className
|
133
|
+
)}
|
134
|
+
{...htmlProps}>
|
135
|
+
<Video
|
136
|
+
video={video}
|
137
|
+
poster={poster}
|
138
|
+
isAutoPlay={isAutoPlay}
|
139
|
+
startMuted={startMuted}
|
140
|
+
showControls={showControls}
|
141
|
+
onPlay={onPlay}
|
142
|
+
onClose={onClose}
|
143
|
+
onEnded={onEnded}
|
144
|
+
isVideoFullWidth
|
145
|
+
size="fullWidth"
|
146
|
+
/>
|
147
|
+
</div>
|
148
|
+
);
|
149
|
+
}
|
150
|
+
);
|
151
|
+
|
152
|
+
VideoFullWidth.displayName = 'VideoFullWidth';
|
@@ -1,113 +0,0 @@
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
2
|
-
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
3
|
-
import { themeContract } from '../../theme';
|
4
|
-
import { queries } from '../../styles/mediaqueries';
|
5
|
-
|
6
|
-
const actionsBase = style({
|
7
|
-
display: 'flex',
|
8
|
-
flexWrap: 'wrap',
|
9
|
-
|
10
|
-
gap: themeContract.space.sm,
|
11
|
-
paddingTop: themeContract.space.sm,
|
12
|
-
width: '100%',
|
13
|
-
|
14
|
-
'@media': {
|
15
|
-
[queries.lg]: {
|
16
|
-
gap: themeContract.space.md,
|
17
|
-
paddingTop: themeContract.space.md,
|
18
|
-
},
|
19
|
-
},
|
20
|
-
});
|
21
|
-
|
22
|
-
export const actionsRecipe = recipe({
|
23
|
-
base: actionsBase,
|
24
|
-
|
25
|
-
variants: {
|
26
|
-
align: {
|
27
|
-
left: {
|
28
|
-
justifyContent: 'flex-start',
|
29
|
-
alignItems: 'flex-start',
|
30
|
-
},
|
31
|
-
center: {
|
32
|
-
justifyContent: 'center',
|
33
|
-
alignItems: 'center',
|
34
|
-
},
|
35
|
-
right: {
|
36
|
-
justifyContent: 'flex-end',
|
37
|
-
alignItems: 'flex-end',
|
38
|
-
},
|
39
|
-
},
|
40
|
-
direction: {
|
41
|
-
row: {
|
42
|
-
flexDirection: 'row',
|
43
|
-
},
|
44
|
-
column: {
|
45
|
-
flexDirection: 'column',
|
46
|
-
},
|
47
|
-
'row-reverse': {
|
48
|
-
flexDirection: 'row-reverse',
|
49
|
-
},
|
50
|
-
'column-reverse': {
|
51
|
-
flexDirection: 'column-reverse',
|
52
|
-
},
|
53
|
-
},
|
54
|
-
spacing: {
|
55
|
-
none: {
|
56
|
-
gap: '0',
|
57
|
-
paddingTop: '0',
|
58
|
-
},
|
59
|
-
xs: {
|
60
|
-
gap: themeContract.space.xs,
|
61
|
-
paddingTop: themeContract.space.xs,
|
62
|
-
},
|
63
|
-
sm: {
|
64
|
-
gap: themeContract.space.sm,
|
65
|
-
paddingTop: themeContract.space.sm,
|
66
|
-
},
|
67
|
-
md: {
|
68
|
-
gap: themeContract.space.md,
|
69
|
-
paddingTop: themeContract.space.md,
|
70
|
-
},
|
71
|
-
lg: {
|
72
|
-
gap: themeContract.space.lg,
|
73
|
-
paddingTop: themeContract.space.lg,
|
74
|
-
},
|
75
|
-
xl: {
|
76
|
-
gap: themeContract.space.xl,
|
77
|
-
paddingTop: themeContract.space.xl,
|
78
|
-
},
|
79
|
-
},
|
80
|
-
wrap: {
|
81
|
-
true: {
|
82
|
-
flexWrap: 'wrap',
|
83
|
-
},
|
84
|
-
false: {
|
85
|
-
flexWrap: 'nowrap',
|
86
|
-
},
|
87
|
-
},
|
88
|
-
fullWidth: {
|
89
|
-
true: {
|
90
|
-
width: '100%',
|
91
|
-
|
92
|
-
// selectors: {
|
93
|
-
// '& > *': {
|
94
|
-
// flex: '1',
|
95
|
-
// },
|
96
|
-
// },
|
97
|
-
},
|
98
|
-
false: {
|
99
|
-
width: 'auto',
|
100
|
-
},
|
101
|
-
},
|
102
|
-
},
|
103
|
-
|
104
|
-
defaultVariants: {
|
105
|
-
align: 'left',
|
106
|
-
direction: 'row',
|
107
|
-
spacing: 'sm',
|
108
|
-
wrap: true,
|
109
|
-
fullWidth: false,
|
110
|
-
},
|
111
|
-
});
|
112
|
-
|
113
|
-
export type ActionsVariants = RecipeVariants<typeof actionsRecipe>;
|
@@ -1,119 +0,0 @@
|
|
1
|
-
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
2
|
-
import { themeContract } from '../../theme';
|
3
|
-
|
4
|
-
export const buttonRecipe = recipe({
|
5
|
-
base: {
|
6
|
-
display: 'inline-flex',
|
7
|
-
alignItems: 'center',
|
8
|
-
justifyContent: 'center',
|
9
|
-
padding: themeContract.space.md,
|
10
|
-
borderRadius: themeContract.radii.md,
|
11
|
-
border: 'none',
|
12
|
-
cursor: 'pointer',
|
13
|
-
fontFamily: themeContract.fonts.body,
|
14
|
-
fontSize: themeContract.fontSizes.md,
|
15
|
-
fontWeight: '500',
|
16
|
-
lineHeight: themeContract.lineHeights.tight,
|
17
|
-
textDecoration: 'none',
|
18
|
-
transition: 'all 0.2s ease-in-out',
|
19
|
-
outline: 'none',
|
20
|
-
|
21
|
-
':hover': {
|
22
|
-
transform: 'translateY(-1px)',
|
23
|
-
boxShadow: themeContract.shadows.md,
|
24
|
-
},
|
25
|
-
|
26
|
-
':active': {
|
27
|
-
transform: 'translateY(0)',
|
28
|
-
},
|
29
|
-
|
30
|
-
':focus-visible': {
|
31
|
-
outline: '2px solid',
|
32
|
-
outlineColor: themeContract.colors.primary,
|
33
|
-
outlineOffset: '2px',
|
34
|
-
},
|
35
|
-
|
36
|
-
':disabled': {
|
37
|
-
opacity: '0.5',
|
38
|
-
cursor: 'not-allowed',
|
39
|
-
transform: 'none',
|
40
|
-
boxShadow: 'none',
|
41
|
-
},
|
42
|
-
},
|
43
|
-
|
44
|
-
variants: {
|
45
|
-
variant: {
|
46
|
-
primary: {
|
47
|
-
backgroundColor: themeContract.colors.primary,
|
48
|
-
color: themeContract.colors.background,
|
49
|
-
|
50
|
-
':hover': {
|
51
|
-
backgroundColor: themeContract.colors.accent,
|
52
|
-
},
|
53
|
-
},
|
54
|
-
secondary: {
|
55
|
-
backgroundColor: themeContract.colors.secondary,
|
56
|
-
color: themeContract.colors.text,
|
57
|
-
|
58
|
-
':hover': {
|
59
|
-
backgroundColor: themeContract.colors.surface,
|
60
|
-
},
|
61
|
-
},
|
62
|
-
outline: {
|
63
|
-
backgroundColor: 'transparent',
|
64
|
-
color: themeContract.colors.text,
|
65
|
-
border: `1px solid ${themeContract.colors.border}`,
|
66
|
-
|
67
|
-
':hover': {
|
68
|
-
backgroundColor: themeContract.colors.surface,
|
69
|
-
borderColor: themeContract.colors.primary,
|
70
|
-
},
|
71
|
-
},
|
72
|
-
ghost: {
|
73
|
-
backgroundColor: 'transparent',
|
74
|
-
color: themeContract.colors.text,
|
75
|
-
|
76
|
-
':hover': {
|
77
|
-
backgroundColor: themeContract.colors.surface,
|
78
|
-
},
|
79
|
-
},
|
80
|
-
danger: {
|
81
|
-
backgroundColor: themeContract.colors.error,
|
82
|
-
color: themeContract.colors.background,
|
83
|
-
|
84
|
-
':hover': {
|
85
|
-
opacity: '0.9',
|
86
|
-
},
|
87
|
-
},
|
88
|
-
},
|
89
|
-
size: {
|
90
|
-
sm: {
|
91
|
-
padding: `${themeContract.space.xs} ${themeContract.space.sm}`,
|
92
|
-
fontSize: themeContract.fontSizes.sm,
|
93
|
-
borderRadius: themeContract.radii.sm,
|
94
|
-
},
|
95
|
-
md: {
|
96
|
-
padding: `${themeContract.space.sm} ${themeContract.space.md}`,
|
97
|
-
fontSize: themeContract.fontSizes.md,
|
98
|
-
borderRadius: themeContract.radii.md,
|
99
|
-
},
|
100
|
-
lg: {
|
101
|
-
padding: `${themeContract.space.md} ${themeContract.space.lg}`,
|
102
|
-
fontSize: themeContract.fontSizes.lg,
|
103
|
-
borderRadius: themeContract.radii.lg,
|
104
|
-
},
|
105
|
-
},
|
106
|
-
fullWidth: {
|
107
|
-
true: {
|
108
|
-
width: '100%',
|
109
|
-
},
|
110
|
-
},
|
111
|
-
},
|
112
|
-
|
113
|
-
defaultVariants: {
|
114
|
-
variant: 'primary',
|
115
|
-
size: 'md',
|
116
|
-
},
|
117
|
-
});
|
118
|
-
|
119
|
-
export type ButtonVariants = RecipeVariants<typeof buttonRecipe>;
|