@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.
Files changed (72) hide show
  1. package/package.json +1 -1
  2. package/src/components/Button/index.tsx +0 -1
  3. package/src/components/Carousel/export.tsx +2 -4
  4. package/src/components/Carousel/index.tsx +159 -191
  5. package/src/components/Carousel/theme.ts +102 -0
  6. package/src/components/Columns/export.tsx +2 -5
  7. package/src/components/Columns/index.tsx +9 -15
  8. package/src/components/Columns/styles.css.ts +3 -1
  9. package/src/components/Columns/theme.ts +24 -0
  10. package/src/components/ConsentCookie/export.tsx +2 -4
  11. package/src/components/ConsentCookie/index.tsx +104 -0
  12. package/src/components/Footer/export.tsx +1 -4
  13. package/src/components/Footer/index.tsx +1 -9
  14. package/src/components/Footer/theme.ts +51 -0
  15. package/src/components/Form/Form.tsx +0 -3
  16. package/src/components/Form/Row/Row.tsx +0 -3
  17. package/src/components/Form/TextField/Input/Input.tsx +0 -3
  18. package/src/components/Form/TextField/Label/Label.tsx +0 -3
  19. package/src/components/Form/TextField/TextField.tsx +0 -3
  20. package/src/components/Form/TextField/Textarea/Textarea.tsx +0 -3
  21. package/src/components/Form/export.tsx +17 -3
  22. package/src/components/Header/export.tsx +1 -4
  23. package/src/components/Header/index.tsx +19 -35
  24. package/src/components/Header/styles.css.ts +2 -2
  25. package/src/components/Header/theme.ts +51 -0
  26. package/src/components/Heading/export.tsx +1 -0
  27. package/src/components/Heading/index.tsx +3 -9
  28. package/src/components/Icon/export.tsx +1 -4
  29. package/src/components/Icon/index.tsx +4 -5
  30. package/src/components/Icon/theme.ts +17 -0
  31. package/src/components/KeyNumber/export.tsx +2 -4
  32. package/src/components/KeyNumber/index.tsx +3 -3
  33. package/src/components/KeyNumber/theme.ts +22 -0
  34. package/src/components/LanguageSwitcher/export.tsx +2 -4
  35. package/src/components/LanguageSwitcher/index.tsx +37 -63
  36. package/src/components/Logo/export.tsx +1 -4
  37. package/src/components/Logo/index.tsx +2 -5
  38. package/src/components/Logo/styles.css.ts +2 -2
  39. package/src/components/Main/export.tsx +1 -4
  40. package/src/components/Main/index.tsx +1 -9
  41. package/src/components/Main/theme.ts +19 -0
  42. package/src/components/Modal/export.tsx +2 -4
  43. package/src/components/Modal/index.tsx +4 -5
  44. package/src/components/Modal/theme.ts +31 -0
  45. package/src/components/Nav/export.tsx +1 -4
  46. package/src/components/Nav/index.tsx +6 -14
  47. package/src/components/Nav/styles.css.ts +3 -1
  48. package/src/components/Nav/theme.ts +24 -0
  49. package/src/components/NavLegal/export.tsx +1 -4
  50. package/src/components/NavLegal/index.tsx +1 -7
  51. package/src/components/NavLegal/theme.ts +24 -0
  52. package/src/components/NavSocial/export.tsx +2 -5
  53. package/src/components/NavSocial/index.tsx +14 -18
  54. package/src/components/NavSocial/theme.ts +34 -0
  55. package/src/components/Section/export.tsx +2 -6
  56. package/src/components/Section/index.tsx +4 -8
  57. package/src/components/Section/theme.ts +40 -0
  58. package/src/components/Video/export.tsx +2 -2
  59. package/src/components/Video/index.tsx +78 -84
  60. package/src/components/Video/theme.ts +104 -0
  61. package/src/index.ts +19 -49
  62. package/src/theme/baseThemeValues.ts +40 -712
  63. package/src/theme/contract.css.ts +0 -16
  64. package/src/utils/useWindowSize.ts +29 -0
  65. package/src/components/ConsentCookie/ConsentCookie.tsx +0 -200
  66. package/src/components/Header/HeaderOverlay/index.tsx +0 -32
  67. package/src/components/Header/HeaderOverlay/styles.css.ts +0 -33
  68. package/src/components/Header/ToggleNav/index.tsx +0 -29
  69. package/src/components/Header/ToggleNav/styles.css.ts +0 -40
  70. package/src/components/ThemeTest/ThemeTest.css.ts +0 -11
  71. package/src/components/ThemeTest/ThemeTest.tsx +0 -12
  72. /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 { forwardRef, useEffect, useRef, useState } from 'react';
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 = forwardRef<HTMLDivElement, VideoProps>(
33
- (
34
- {
35
- video,
36
- poster,
37
- isAutoPlay = false,
38
- startMuted = false,
39
- showControls = false,
40
- hidePlayButton = false,
41
- isPlayingFullScreen = false,
42
- onPlay,
43
- onClose,
44
- onEnded,
45
- size,
46
- css,
47
- className,
48
- },
49
- ref
50
- ) => {
51
- const videoRef = useRef<HTMLVideoElement>(null);
52
- const [isPlaying, setIsPlaying] = useState(false);
53
- const [isMuted, setIsMuted] = useState(isAutoPlay || startMuted);
54
-
55
- const playVideo = () => {
56
- onPlay?.();
57
- videoRef.current?.play();
58
- setIsPlaying(true);
59
- };
60
-
61
- const closeVideo = () => {
62
- onClose?.();
63
- videoRef.current?.pause();
64
- setIsPlaying(false);
65
- };
66
-
67
- const pauseVideo = () => {
68
- videoRef.current?.pause();
69
- setIsPlaying(false);
70
- };
71
-
72
- const toggleMutedVideo = () => {
73
- const newIsMuted = !isMuted;
74
- setIsMuted(newIsMuted);
75
- if (videoRef.current) videoRef.current.muted = newIsMuted;
76
- };
77
-
78
- const handleVideoEnded = () => {
79
- onEnded?.();
80
- closeVideo();
81
- };
82
-
83
- useEffect(() => {
84
- if (videoRef.current) videoRef.current.muted = isMuted;
85
- }, [isMuted]);
86
-
87
- return (
88
- <div ref={ref} className={clsx(videoRecipe({ size }), css, className)}>
89
- <video ref={videoRef} className={videoElement} playsInline muted={isMuted} autoPlay={isAutoPlay} onEnded={handleVideoEnded}>
90
- <source src={video} type="video/mp4" />
91
- </video>
92
-
93
- {poster && (
94
- <div className={videoPoster} data-playing={isPlaying}>
95
- <img src={poster} alt="Video poster" className={posterImage} />
96
- </div>
97
- )}
98
-
99
- {!hidePlayButton && !isAutoPlay && (
100
- <button className={playButton} data-playing={isPlaying} onClick={playVideo} aria-label="Play video" type="button" />
101
- )}
102
-
103
- {isPlayingFullScreen && <button className={closeButton} onClick={closeVideo} aria-label="Close video" type="button" />}
104
-
105
- {isPlaying && showControls && <button className={pauseButton} onClick={pauseVideo} aria-label="Pause video" type="button" />}
106
-
107
- {showControls && (
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 { Section, type SectionProps } from './components/Section';
17
- export { type SectionVariants } from './components/Section/styles.css';
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 { Heading, type HeadingProps } from './components/Heading';
21
+ export * from './components/Header/export';
22
+ export * from './components/Footer/export';
30
23
 
31
- export { Modal, type ModalProps } from './components/Modal';
32
- export { type ModalVariants } from './components/Modal/styles.css';
24
+ export * from './components/Nav/export';
33
25
 
34
- export { Logo, type LogoProps } from './components/Logo';
26
+ export * from './components/Icon/export';
35
27
 
36
- export { Columns, type ColumnsProps } from './components/Columns';
28
+ export * from './components/Heading/export';
37
29
 
38
- export { Carousel, type CarouselProps } from './components/Carousel';
39
- export { type CarouselVariants } from './components/Carousel/styles.css';
30
+ export * from './components/Modal/export';
40
31
 
41
- export { ConsentCookie, type ConsentCookieProps } from './components/ConsentCookie/ConsentCookie';
42
- export { type ConsentCookieVariants } from './components/ConsentCookie/ConsentCookie.css';
32
+ export * from './components/Logo/export';
43
33
 
44
- export { KeyNumber, type KeyNumberProps } from './components/KeyNumber';
45
- export { type KeyNumberVariants } from './components/KeyNumber/styles.css';
34
+ export * from './components/ConsentCookie/export';
46
35
 
47
- export { NavSocial, type NavSocialProps } from './components/NavSocial';
48
- export { type Social } from './components/NavSocial/types';
36
+ export * from './components/KeyNumber/export';
49
37
 
50
- export { NavLegal, type NavLegalProps } from './components/NavLegal';
38
+ export * from './components/NavSocial/export';
39
+ export * from './components/NavLegal/export';
51
40
 
52
- export { LanguageSwitcher, type LanguageSwitcherProps, type Locale } from './components/LanguageSwitcher';
53
- export { type LanguageSwitcherVariants } from './components/LanguageSwitcher/styles.css';
41
+ export * from './components/LanguageSwitcher/export';
54
42
 
55
43
  // Video Components
56
- export { Video, type VideoProps } from './components/Video';
57
- export { type VideoVariants } from './components/Video/styles.css';
44
+ export * from './components/Video/export';
58
45
 
59
46
  // Form Components
60
- export { Form, type FormProps } from './components/Form/Form';
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';