@latte-macchiat-io/latte-vanilla-components 0.0.202 → 0.0.204
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/Button/index.tsx +0 -1
- 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 +9 -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 -9
- package/src/components/Footer/theme.ts +51 -0
- package/src/components/Form/Form.tsx +0 -3
- package/src/components/Form/Row/Row.tsx +0 -3
- package/src/components/Form/TextField/Input/Input.tsx +0 -3
- package/src/components/Form/TextField/Label/Label.tsx +0 -3
- package/src/components/Form/TextField/TextField.tsx +0 -3
- package/src/components/Form/TextField/Textarea/Textarea.tsx +0 -3
- 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 -9
- 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 -84
- package/src/components/Video/theme.ts +104 -0
- package/src/index.ts +19 -49
- package/src/theme/baseThemeValues.ts +40 -712
- 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
@@ -1,7 +1,8 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { clsx } from 'clsx';
|
4
|
-
import {
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
5
|
+
|
5
6
|
import {
|
6
7
|
closeButton,
|
7
8
|
pauseButton,
|
@@ -16,7 +17,6 @@ import {
|
|
16
17
|
|
17
18
|
export type VideoProps = React.HTMLAttributes<HTMLDivElement> &
|
18
19
|
VideoVariants & {
|
19
|
-
css?: string;
|
20
20
|
video: string;
|
21
21
|
poster?: string;
|
22
22
|
isAutoPlay?: boolean;
|
@@ -29,85 +29,79 @@ export type VideoProps = React.HTMLAttributes<HTMLDivElement> &
|
|
29
29
|
onEnded?: () => void;
|
30
30
|
};
|
31
31
|
|
32
|
-
export const Video =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
) => {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<
|
90
|
-
<
|
91
|
-
</
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<button className={soundButton} onClick={toggleMutedVideo} aria-label={isMuted ? 'Unmute video' : 'Mute video'} type="button" />
|
109
|
-
)}
|
110
|
-
</div>
|
111
|
-
);
|
112
|
-
}
|
113
|
-
);
|
32
|
+
export const Video = ({
|
33
|
+
video,
|
34
|
+
poster,
|
35
|
+
isAutoPlay = false,
|
36
|
+
startMuted = false,
|
37
|
+
showControls = false,
|
38
|
+
hidePlayButton = false,
|
39
|
+
isPlayingFullScreen = false,
|
40
|
+
onPlay,
|
41
|
+
onClose,
|
42
|
+
onEnded,
|
43
|
+
size,
|
44
|
+
className,
|
45
|
+
}: VideoProps) => {
|
46
|
+
const videoRef = useRef<HTMLVideoElement>(null);
|
47
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
48
|
+
const [isMuted, setIsMuted] = useState(isAutoPlay || startMuted);
|
49
|
+
|
50
|
+
const playVideo = () => {
|
51
|
+
onPlay?.();
|
52
|
+
videoRef.current?.play();
|
53
|
+
setIsPlaying(true);
|
54
|
+
};
|
55
|
+
|
56
|
+
const closeVideo = () => {
|
57
|
+
onClose?.();
|
58
|
+
videoRef.current?.pause();
|
59
|
+
setIsPlaying(false);
|
60
|
+
};
|
61
|
+
|
62
|
+
const pauseVideo = () => {
|
63
|
+
videoRef.current?.pause();
|
64
|
+
setIsPlaying(false);
|
65
|
+
};
|
66
|
+
|
67
|
+
const toggleMutedVideo = () => {
|
68
|
+
const newIsMuted = !isMuted;
|
69
|
+
setIsMuted(newIsMuted);
|
70
|
+
if (videoRef.current) videoRef.current.muted = newIsMuted;
|
71
|
+
};
|
72
|
+
|
73
|
+
const handleVideoEnded = () => {
|
74
|
+
onEnded?.();
|
75
|
+
closeVideo();
|
76
|
+
};
|
77
|
+
|
78
|
+
useEffect(() => {
|
79
|
+
if (videoRef.current) videoRef.current.muted = isMuted;
|
80
|
+
}, [isMuted]);
|
81
|
+
|
82
|
+
return (
|
83
|
+
<div className={clsx(videoRecipe({ size }), className)}>
|
84
|
+
<video ref={videoRef} className={videoElement} playsInline muted={isMuted} autoPlay={isAutoPlay} onEnded={handleVideoEnded}>
|
85
|
+
<source src={video} type="video/mp4" />
|
86
|
+
</video>
|
87
|
+
|
88
|
+
{poster && (
|
89
|
+
<div className={videoPoster} data-playing={isPlaying}>
|
90
|
+
<img src={poster} alt="Video poster" className={posterImage} />
|
91
|
+
</div>
|
92
|
+
)}
|
93
|
+
|
94
|
+
{!hidePlayButton && !isAutoPlay && (
|
95
|
+
<button className={playButton} data-playing={isPlaying} onClick={playVideo} aria-label="Play video" type="button" />
|
96
|
+
)}
|
97
|
+
|
98
|
+
{isPlayingFullScreen && <button className={closeButton} onClick={closeVideo} aria-label="Close video" type="button" />}
|
99
|
+
|
100
|
+
{isPlaying && showControls && <button className={pauseButton} onClick={pauseVideo} aria-label="Pause video" type="button" />}
|
101
|
+
|
102
|
+
{showControls && (
|
103
|
+
<button className={soundButton} onClick={toggleMutedVideo} aria-label={isMuted ? 'Unmute video' : 'Mute video'} type="button" />
|
104
|
+
)}
|
105
|
+
</div>
|
106
|
+
);
|
107
|
+
};
|
@@ -0,0 +1,104 @@
|
|
1
|
+
const themeVideoBase = {
|
2
|
+
video: {
|
3
|
+
playButton: {
|
4
|
+
border: 'none',
|
5
|
+
borderRadius: '1000px',
|
6
|
+
iconColor: '#FF7377',
|
7
|
+
backgroundColor: '#FF7377',
|
8
|
+
width: {
|
9
|
+
mobile: '50px',
|
10
|
+
sm: '50px',
|
11
|
+
md: '50px',
|
12
|
+
lg: '75px',
|
13
|
+
xl: '75px',
|
14
|
+
'2xl': '75px',
|
15
|
+
},
|
16
|
+
height: {
|
17
|
+
mobile: '50px',
|
18
|
+
sm: '50px',
|
19
|
+
md: '50px',
|
20
|
+
lg: '75px',
|
21
|
+
xl: '75px',
|
22
|
+
'2xl': '75px',
|
23
|
+
},
|
24
|
+
},
|
25
|
+
pauseButton: {
|
26
|
+
border: 'none',
|
27
|
+
borderRadius: '1000px',
|
28
|
+
iconColor: '#FF7377',
|
29
|
+
backgroundColor: '#FF7377',
|
30
|
+
width: {
|
31
|
+
mobile: '50px',
|
32
|
+
sm: '50px',
|
33
|
+
md: '50px',
|
34
|
+
lg: '75px',
|
35
|
+
xl: '75px',
|
36
|
+
'2xl': '75px',
|
37
|
+
},
|
38
|
+
height: {
|
39
|
+
mobile: '50px',
|
40
|
+
sm: '50px',
|
41
|
+
md: '50px',
|
42
|
+
lg: '75px',
|
43
|
+
xl: '75px',
|
44
|
+
'2xl': '75px',
|
45
|
+
},
|
46
|
+
},
|
47
|
+
soundButton: {
|
48
|
+
border: 'none',
|
49
|
+
borderRadius: '1000px',
|
50
|
+
iconColor: '#FF7377',
|
51
|
+
backgroundColor: '#FF7377',
|
52
|
+
width: {
|
53
|
+
mobile: '50px',
|
54
|
+
sm: '50px',
|
55
|
+
md: '50px',
|
56
|
+
lg: '75px',
|
57
|
+
xl: '75px',
|
58
|
+
'2xl': '75px',
|
59
|
+
},
|
60
|
+
height: {
|
61
|
+
mobile: '50px',
|
62
|
+
sm: '50px',
|
63
|
+
md: '50px',
|
64
|
+
lg: '75px',
|
65
|
+
xl: '75px',
|
66
|
+
'2xl': '75px',
|
67
|
+
},
|
68
|
+
},
|
69
|
+
closeButton: {
|
70
|
+
border: 'none',
|
71
|
+
borderRadius: '1000px',
|
72
|
+
iconColor: '#FF7377',
|
73
|
+
backgroundColor: '#FF7377',
|
74
|
+
width: {
|
75
|
+
mobile: '50px',
|
76
|
+
sm: '50px',
|
77
|
+
md: '50px',
|
78
|
+
lg: '75px',
|
79
|
+
xl: '75px',
|
80
|
+
'2xl': '75px',
|
81
|
+
},
|
82
|
+
height: {
|
83
|
+
mobile: '50px',
|
84
|
+
sm: '50px',
|
85
|
+
md: '50px',
|
86
|
+
lg: '75px',
|
87
|
+
xl: '75px',
|
88
|
+
'2xl': '75px',
|
89
|
+
},
|
90
|
+
},
|
91
|
+
},
|
92
|
+
};
|
93
|
+
|
94
|
+
export const themeVideoLight = {
|
95
|
+
video: {
|
96
|
+
...themeVideoBase.video,
|
97
|
+
},
|
98
|
+
};
|
99
|
+
|
100
|
+
export const themeVideoDark = {
|
101
|
+
video: {
|
102
|
+
...themeVideoBase.video,
|
103
|
+
},
|
104
|
+
};
|
package/src/index.ts
CHANGED
@@ -10,68 +10,38 @@ export { breakpoints, queries } from './styles/mediaqueries';
|
|
10
10
|
// Components
|
11
11
|
export { ThemeToggle } from './components/ThemeToggle';
|
12
12
|
|
13
|
-
export * from './components/Button/export';
|
14
13
|
export * from './components/Actions/export';
|
14
|
+
export * from './components/Button/export';
|
15
|
+
export * from './components/Carousel/export';
|
16
|
+
export * from './components/Columns/export';
|
15
17
|
|
16
|
-
export
|
17
|
-
export
|
18
|
-
|
19
|
-
export { Main, type MainProps } from './components/Main';
|
20
|
-
|
21
|
-
export { Header, type HeaderProps } from './components/Header';
|
22
|
-
|
23
|
-
export { Footer, type FooterProps } from './components/Footer';
|
24
|
-
|
25
|
-
export { Nav, type NavProps } from './components/Nav';
|
26
|
-
|
27
|
-
export { Icon, type IconProps } from './components/Icon';
|
18
|
+
export * from './components/Section/export';
|
19
|
+
export * from './components/Main/export';
|
28
20
|
|
29
|
-
export
|
21
|
+
export * from './components/Header/export';
|
22
|
+
export * from './components/Footer/export';
|
30
23
|
|
31
|
-
export
|
32
|
-
export { type ModalVariants } from './components/Modal/styles.css';
|
24
|
+
export * from './components/Nav/export';
|
33
25
|
|
34
|
-
export
|
26
|
+
export * from './components/Icon/export';
|
35
27
|
|
36
|
-
export
|
28
|
+
export * from './components/Heading/export';
|
37
29
|
|
38
|
-
export
|
39
|
-
export { type CarouselVariants } from './components/Carousel/styles.css';
|
30
|
+
export * from './components/Modal/export';
|
40
31
|
|
41
|
-
export
|
42
|
-
export { type ConsentCookieVariants } from './components/ConsentCookie/ConsentCookie.css';
|
32
|
+
export * from './components/Logo/export';
|
43
33
|
|
44
|
-
export
|
45
|
-
export { type KeyNumberVariants } from './components/KeyNumber/styles.css';
|
34
|
+
export * from './components/ConsentCookie/export';
|
46
35
|
|
47
|
-
export
|
48
|
-
export { type Social } from './components/NavSocial/types';
|
36
|
+
export * from './components/KeyNumber/export';
|
49
37
|
|
50
|
-
export
|
38
|
+
export * from './components/NavSocial/export';
|
39
|
+
export * from './components/NavLegal/export';
|
51
40
|
|
52
|
-
export
|
53
|
-
export { type LanguageSwitcherVariants } from './components/LanguageSwitcher/styles.css';
|
41
|
+
export * from './components/LanguageSwitcher/export';
|
54
42
|
|
55
43
|
// Video Components
|
56
|
-
export
|
57
|
-
export { type VideoVariants } from './components/Video/styles.css';
|
44
|
+
export * from './components/Video/export';
|
58
45
|
|
59
46
|
// Form Components
|
60
|
-
export
|
61
|
-
export { type FormVariants } from './components/Form/Form.css';
|
62
|
-
|
63
|
-
export { Row, type RowProps } from './components/Form/Row/Row';
|
64
|
-
export { type RowVariants } from './components/Form/Row/Row.css';
|
65
|
-
|
66
|
-
export { TextField, type TextFieldProps, type InputType } from './components/Form/TextField/TextField';
|
67
|
-
export { type TextFieldVariants } from './components/Form/TextField/TextField.css';
|
68
|
-
|
69
|
-
// Form TextField Subcomponents
|
70
|
-
export { Label, type LabelProps } from './components/Form/TextField/Label/Label';
|
71
|
-
export { type LabelVariants } from './components/Form/TextField/Label/Label.css';
|
72
|
-
|
73
|
-
export { Input, type InputProps, type InputType as InputFieldType } from './components/Form/TextField/Input/Input';
|
74
|
-
export { type InputVariants } from './components/Form/TextField/Input/Input.css';
|
75
|
-
|
76
|
-
export { Textarea, type TextareaProps } from './components/Form/TextField/Textarea/Textarea';
|
77
|
-
export { type TextareaVariants } from './components/Form/TextField/Textarea/Textarea.css';
|
47
|
+
export * from './components/Form/export';
|