@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.
Files changed (70) hide show
  1. package/package.json +3 -1
  2. package/src/assets/styles/mediaqueries.tsx +24 -0
  3. package/src/components/Actions/Actions.tsx +132 -0
  4. package/src/components/Actions/export.tsx +4 -0
  5. package/src/components/{Main/stories.ts → Actions/stories.tsx} +14 -13
  6. package/src/components/Button/Button.tsx +132 -0
  7. package/src/components/Button/export.tsx +5 -0
  8. package/src/components/Carousel/Carousel.tsx +328 -0
  9. package/src/components/Carousel/export.tsx +4 -0
  10. package/src/components/Columns/Columns.tsx +142 -0
  11. package/src/components/Columns/export.tsx +5 -0
  12. package/src/components/ConsentCookie/ConsentCookie.tsx +202 -0
  13. package/src/components/ConsentCookie/export.tsx +4 -0
  14. package/src/components/{Icon/stories.ts → ConsentCookie/stories.tsx} +7 -8
  15. package/src/components/Footer/Footer.tsx +130 -0
  16. package/src/components/Footer/export.tsx +4 -0
  17. package/src/components/Footer/stories.tsx +26 -0
  18. package/src/components/Form/Form.tsx +127 -0
  19. package/src/components/Form/Row/Row.tsx +137 -0
  20. package/src/components/Form/Row/index.tsx +0 -0
  21. package/src/components/Form/Row/stories.tsx +41 -0
  22. package/src/components/Form/TextField/Input/Input.tsx +139 -0
  23. package/src/components/Form/TextField/Input/export.tsx +6 -0
  24. package/src/components/Form/TextField/Label/Label.tsx +133 -0
  25. package/src/components/Form/TextField/Label/export.tsx +4 -0
  26. package/src/components/Form/TextField/TextField.tsx +200 -0
  27. package/src/components/Form/TextField/Textarea/Textarea.tsx +135 -0
  28. package/src/components/Form/TextField/Textarea/export.tsx +6 -0
  29. package/src/components/Form/TextField/Textarea/stories.tsx +44 -0
  30. package/src/components/Form/TextField/export.tsx +4 -0
  31. package/src/components/Form/export.tsx +4 -0
  32. package/src/components/Header/Header.tsx +158 -0
  33. package/src/components/Header/HeaderOverlay/index.tsx +32 -0
  34. package/src/components/Header/ToggleNav/index.tsx +32 -0
  35. package/src/components/Header/export.tsx +4 -0
  36. package/src/components/Header/stories.tsx +26 -0
  37. package/src/components/Icon/Icon.tsx +159 -0
  38. package/src/components/Icon/export.tsx +4 -0
  39. package/src/components/KeyNumber/KeyNumber.tsx +166 -0
  40. package/src/components/KeyNumber/export.tsx +4 -0
  41. package/src/components/LanguageSwitcher/LanguageSwitcher.tsx +168 -0
  42. package/src/components/LanguageSwitcher/export.tsx +4 -0
  43. package/src/components/Logo/Logo.tsx +137 -0
  44. package/src/components/Logo/export.tsx +4 -0
  45. package/src/components/Logo/stories.tsx +28 -0
  46. package/src/components/Main/Main.tsx +130 -0
  47. package/src/components/Main/export.tsx +4 -0
  48. package/src/components/Modal/Modal.tsx +194 -0
  49. package/src/components/Modal/export.tsx +4 -0
  50. package/src/components/Modal/types.tsx +5 -0
  51. package/src/components/Nav/Nav.tsx +129 -0
  52. package/src/components/Nav/export.tsx +4 -0
  53. package/src/components/Nav/stories.tsx +28 -0
  54. package/src/components/NavLegal/NavLegal.tsx +133 -0
  55. package/src/components/NavLegal/export.tsx +4 -0
  56. package/src/components/NavLegal/stories.tsx +28 -0
  57. package/src/components/NavLegal/types.tsx +1 -0
  58. package/src/components/NavSocial/NavSocial.tsx +169 -0
  59. package/src/components/NavSocial/export.tsx +5 -0
  60. package/src/components/{Columns/stories.ts → NavSocial/stories.tsx} +12 -14
  61. package/src/components/NavSocial/types.tsx +1 -0
  62. package/src/components/Section/Section.tsx +130 -0
  63. package/src/components/Section/export.tsx +6 -0
  64. package/src/components/ToRemove/ToRemove.tsx +3 -0
  65. package/src/components/Video/Video.tsx +243 -0
  66. package/src/components/Video/export.tsx +2 -0
  67. package/src/components/VideoFullWidth/VideoFullWidth.tsx +152 -0
  68. package/src/components/VideoFullWidth/export.tsx +2 -0
  69. package/src/components/Button/stories.ts +0 -127
  70. package/src/components/Section/stories.ts +0 -64
@@ -0,0 +1,166 @@
1
+ import { clsx } from 'clsx';
2
+ import { forwardRef } from 'react';
3
+ import CountUp from 'react-countup';
4
+ import { useInView } from 'react-intersection-observer';
5
+ import { keyNumberLabel, keyNumberRecipe, keyNumberValue, type KeyNumberVariants } from './KeyNumber.css';
6
+ import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
7
+
8
+ export interface KeyNumberProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<KeyNumberVariants> {
9
+ css?: string;
10
+ value: number;
11
+ label: string;
12
+ suffix?: string;
13
+ prefix?: string;
14
+ duration?: number;
15
+ threshold?: number;
16
+ separator?: string;
17
+ decimals?: number;
18
+ as?: 'div' | 'section' | 'article';
19
+ }
20
+
21
+ export const KeyNumber = forwardRef<HTMLDivElement, KeyNumberProps>(
22
+ (
23
+ {
24
+ value,
25
+ label,
26
+ suffix = '',
27
+ prefix = '',
28
+ duration = 2,
29
+ threshold = 0.3,
30
+ separator = ',',
31
+ decimals = 0,
32
+ size,
33
+ variant,
34
+ align,
35
+ color,
36
+ as: Component = 'div',
37
+ css,
38
+ className,
39
+ // Extract sprinkles props
40
+ margin,
41
+ marginTop,
42
+ marginBottom,
43
+ marginLeft,
44
+ marginRight,
45
+ padding,
46
+ paddingTop,
47
+ paddingBottom,
48
+ paddingLeft,
49
+ paddingRight,
50
+ gap,
51
+ display,
52
+ flexDirection,
53
+ justifyContent,
54
+ flexWrap,
55
+ flex,
56
+ width,
57
+ height,
58
+ minWidth,
59
+ maxWidth,
60
+ minHeight,
61
+ position,
62
+ top,
63
+ bottom,
64
+ left,
65
+ right,
66
+ zIndex,
67
+ fontSize,
68
+ fontFamily,
69
+ lineHeight,
70
+ textAlign,
71
+ fontWeight,
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 [inViewRef, inView] = useInView({
87
+ threshold,
88
+ triggerOnce: true,
89
+ });
90
+
91
+ return (
92
+ <Component
93
+ ref={(node) => {
94
+ inViewRef(node);
95
+ if (ref) {
96
+ if (typeof ref === 'function') {
97
+ ref(node);
98
+ } else {
99
+ (ref as any).current = node;
100
+ }
101
+ }
102
+ }}
103
+ className={clsx(
104
+ keyNumberRecipe({ size, variant, align }),
105
+ sprinkles({
106
+ margin,
107
+ marginTop,
108
+ marginBottom,
109
+ marginLeft,
110
+ marginRight,
111
+ padding,
112
+ paddingTop,
113
+ paddingBottom,
114
+ paddingLeft,
115
+ paddingRight,
116
+ gap,
117
+ display,
118
+ flexDirection,
119
+ justifyContent,
120
+ flexWrap,
121
+ flex,
122
+ width,
123
+ height,
124
+ minWidth,
125
+ maxWidth,
126
+ minHeight,
127
+ position,
128
+ top,
129
+ bottom,
130
+ left,
131
+ right,
132
+ zIndex,
133
+ fontSize,
134
+ fontFamily,
135
+ lineHeight,
136
+ textAlign,
137
+ fontWeight,
138
+ backgroundColor,
139
+ borderRadius,
140
+ borderWidth,
141
+ borderStyle,
142
+ borderColor,
143
+ boxShadow,
144
+ opacity,
145
+ overflow,
146
+ overflowX,
147
+ overflowY,
148
+ }),
149
+ css,
150
+ className
151
+ )}
152
+ {...htmlProps}>
153
+ <div className={keyNumberValue}>
154
+ {prefix}
155
+ <span>
156
+ <CountUp end={inView ? value : 0} duration={duration} separator={separator} decimals={decimals} />
157
+ </span>
158
+ {suffix}
159
+ </div>
160
+ <p className={keyNumberLabel}>{label}</p>
161
+ </Component>
162
+ );
163
+ }
164
+ );
165
+
166
+ KeyNumber.displayName = 'KeyNumber';
@@ -0,0 +1,4 @@
1
+ // export { KeyNumber } from '.';
2
+ // export type { KeyNumberProps } from '.';
3
+
4
+ // export { styles as KeyNumberStyles } from './styles.css';
@@ -0,0 +1,168 @@
1
+ import { clsx } from 'clsx';
2
+ import { forwardRef } from 'react';
3
+ import { languageSwitcherIcon, languageSwitcherRecipe, languageSwitcherSelect, type LanguageSwitcherVariants } from './LanguageSwitcher.css';
4
+ import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
5
+ import { Icon } from '../Icon/Icon';
6
+
7
+ export interface Locale {
8
+ code: string;
9
+ name: string;
10
+ label?: string;
11
+ }
12
+
13
+ export interface LanguageSwitcherProps
14
+ extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'>,
15
+ Sprinkles,
16
+ NonNullable<LanguageSwitcherVariants> {
17
+ css?: string;
18
+ locales: Locale[];
19
+ currentLocale: string;
20
+ onChange: (locale: string) => void;
21
+ disabled?: boolean;
22
+ placeholder?: string;
23
+ }
24
+
25
+ export const LanguageSwitcher = forwardRef<HTMLDivElement, LanguageSwitcherProps>(
26
+ (
27
+ {
28
+ locales,
29
+ currentLocale,
30
+ onChange,
31
+ disabled = false,
32
+ placeholder,
33
+ variant,
34
+ size,
35
+ css,
36
+ className,
37
+ // Extract sprinkles props
38
+ margin,
39
+ marginTop,
40
+ marginBottom,
41
+ marginLeft,
42
+ marginRight,
43
+ padding,
44
+ paddingTop,
45
+ paddingBottom,
46
+ paddingLeft,
47
+ paddingRight,
48
+ gap,
49
+ display,
50
+ flexDirection,
51
+ justifyContent,
52
+ flexWrap,
53
+ flex,
54
+ width,
55
+ height,
56
+ minWidth,
57
+ maxWidth,
58
+ minHeight,
59
+ position,
60
+ top,
61
+ bottom,
62
+ left,
63
+ right,
64
+ zIndex,
65
+ fontSize,
66
+ fontFamily,
67
+ lineHeight,
68
+ textAlign,
69
+ fontWeight,
70
+ color,
71
+ backgroundColor,
72
+ borderRadius,
73
+ borderWidth,
74
+ borderStyle,
75
+ borderColor,
76
+ boxShadow,
77
+ opacity,
78
+ overflow,
79
+ overflowX,
80
+ overflowY,
81
+ ...htmlProps
82
+ },
83
+ ref
84
+ ) => {
85
+ const handleSelectChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
86
+ onChange(event.target.value);
87
+ };
88
+
89
+ return (
90
+ <div
91
+ ref={ref}
92
+ className={clsx(
93
+ languageSwitcherRecipe({ variant, size }),
94
+ sprinkles({
95
+ margin,
96
+ marginTop,
97
+ marginBottom,
98
+ marginLeft,
99
+ marginRight,
100
+ padding,
101
+ paddingTop,
102
+ paddingBottom,
103
+ paddingLeft,
104
+ paddingRight,
105
+ gap,
106
+ display,
107
+ flexDirection,
108
+ justifyContent,
109
+ flexWrap,
110
+ flex,
111
+ width,
112
+ height,
113
+ minWidth,
114
+ maxWidth,
115
+ minHeight,
116
+ position,
117
+ top,
118
+ bottom,
119
+ left,
120
+ right,
121
+ zIndex,
122
+ fontSize,
123
+ fontFamily,
124
+ lineHeight,
125
+ textAlign,
126
+ fontWeight,
127
+ color,
128
+ backgroundColor,
129
+ borderRadius,
130
+ borderWidth,
131
+ borderStyle,
132
+ borderColor,
133
+ boxShadow,
134
+ opacity,
135
+ overflow,
136
+ overflowX,
137
+ overflowY,
138
+ }),
139
+ css,
140
+ className
141
+ )}
142
+ {...htmlProps}>
143
+ <select
144
+ className={languageSwitcherSelect}
145
+ value={currentLocale}
146
+ onChange={handleSelectChange}
147
+ disabled={disabled}
148
+ aria-label="Switch language">
149
+ {placeholder && (
150
+ <option value="" disabled>
151
+ {placeholder}
152
+ </option>
153
+ )}
154
+ {locales.map((locale) => (
155
+ <option key={locale.code} value={locale.code} disabled={locale.code === currentLocale}>
156
+ {locale.label || locale.name}
157
+ </option>
158
+ ))}
159
+ </select>
160
+ <div className={languageSwitcherIcon}>
161
+ <Icon icon="caret" size="sm" />
162
+ </div>
163
+ </div>
164
+ );
165
+ }
166
+ );
167
+
168
+ LanguageSwitcher.displayName = 'LanguageSwitcher';
@@ -0,0 +1,4 @@
1
+ // export { LanguageSwitcher } from '.';
2
+ // export type { LanguageSwitcherProps } from '.';
3
+
4
+ // export { styles as LanguageSwitcherStyles } from './styles.css';
@@ -0,0 +1,137 @@
1
+ import { clsx } from 'clsx';
2
+ import { forwardRef } from 'react';
3
+ import { logoRecipe, type LogoVariants } from './Logo.css';
4
+ import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
5
+
6
+ export interface LogoProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<LogoVariants> {
7
+ css?: string;
8
+ as?: 'div' | 'a' | 'span';
9
+ href?: string;
10
+ }
11
+
12
+ export const Logo = forwardRef<HTMLDivElement, LogoProps>(
13
+ (
14
+ {
15
+ children,
16
+ size,
17
+ variant,
18
+ responsive,
19
+ as: Component = 'div',
20
+ href,
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
+ // If href is provided, use 'a' tag and set variant to 'link'
72
+ // TODO const FinalComponent = href ? 'a' : Component;
73
+ const finalVariant = href ? 'link' : variant;
74
+
75
+ return (
76
+ <div
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ ref={ref as any}
79
+ // TODO href={href}
80
+ className={clsx(
81
+ logoRecipe({ size, variant: finalVariant, responsive }),
82
+ sprinkles({
83
+ margin,
84
+ marginTop,
85
+ marginBottom,
86
+ marginLeft,
87
+ marginRight,
88
+ padding,
89
+ paddingTop,
90
+ paddingBottom,
91
+ paddingLeft,
92
+ paddingRight,
93
+ gap,
94
+ display,
95
+ flexDirection,
96
+ justifyContent,
97
+ flexWrap,
98
+ flex,
99
+ width,
100
+ height,
101
+ minWidth,
102
+ maxWidth,
103
+ minHeight,
104
+ position,
105
+ top,
106
+ bottom,
107
+ left,
108
+ right,
109
+ zIndex,
110
+ fontSize,
111
+ fontFamily,
112
+ lineHeight,
113
+ textAlign,
114
+ fontWeight,
115
+ color,
116
+ backgroundColor,
117
+ borderRadius,
118
+ borderWidth,
119
+ borderStyle,
120
+ borderColor,
121
+ boxShadow,
122
+ opacity,
123
+ overflow,
124
+ overflowX,
125
+ overflowY,
126
+ }),
127
+ css,
128
+ className
129
+ )}
130
+ {...htmlProps}>
131
+ {children}
132
+ </div>
133
+ );
134
+ }
135
+ );
136
+
137
+ Logo.displayName = 'Logo';
@@ -0,0 +1,4 @@
1
+ // export { Logo } from '.';
2
+ // export type { LogoProps } from '.';
3
+
4
+ // export { styles as LogoStyles } from './styles.css';
@@ -0,0 +1,28 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Logo } 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 Logo> = {
7
+ title: 'Latte Components / 1. Global / Logo',
8
+ component: Logo,
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
+ children: <img src="" alt="" />,
27
+ },
28
+ };
@@ -0,0 +1,130 @@
1
+ import { clsx } from 'clsx';
2
+ import { forwardRef } from 'react';
3
+
4
+ import { mainRecipe, type MainVariants } from './Main.css';
5
+ import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
6
+
7
+ export interface MainProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Sprinkles, NonNullable<MainVariants> {
8
+ css?: string;
9
+ as?: 'main' | 'div';
10
+ }
11
+
12
+ export const Main = forwardRef<HTMLElement, MainProps>(
13
+ (
14
+ {
15
+ children,
16
+ centered,
17
+ fullWidth,
18
+ noPadding,
19
+ as: Component = 'main',
20
+ css,
21
+ className,
22
+ // Extract sprinkles props
23
+ margin,
24
+ marginTop,
25
+ marginBottom,
26
+ marginLeft,
27
+ marginRight,
28
+ padding,
29
+ paddingTop,
30
+ paddingBottom,
31
+ paddingLeft,
32
+ paddingRight,
33
+ gap,
34
+ display,
35
+ flexDirection,
36
+ justifyContent,
37
+ flexWrap,
38
+ flex,
39
+ width,
40
+ height,
41
+ minWidth,
42
+ maxWidth,
43
+ minHeight,
44
+ position,
45
+ top,
46
+ bottom,
47
+ left,
48
+ right,
49
+ zIndex,
50
+ fontSize,
51
+ fontFamily,
52
+ lineHeight,
53
+ textAlign,
54
+ fontWeight,
55
+ color,
56
+ backgroundColor,
57
+ borderRadius,
58
+ borderWidth,
59
+ borderStyle,
60
+ borderColor,
61
+ boxShadow,
62
+ opacity,
63
+ overflow,
64
+ overflowX,
65
+ overflowY,
66
+ ...htmlProps
67
+ },
68
+ ref
69
+ ) => {
70
+ return (
71
+ <Component
72
+ ref={ref as any}
73
+ className={clsx(
74
+ mainRecipe({ centered, fullWidth, noPadding }),
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
+ Main.displayName = 'Main';
@@ -0,0 +1,4 @@
1
+ // export { Main } from '.';
2
+ // export type { MainProps } from '.';
3
+
4
+ // export { styles as MainStyles } from './styles.css';