@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.
Files changed (219) hide show
  1. package/package.json +9 -22
  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/stories.tsx +41 -0
  21. package/src/components/Form/TextField/Input/Input.tsx +139 -0
  22. package/src/components/Form/TextField/Input/export.tsx +6 -0
  23. package/src/components/Form/TextField/Label/Label.tsx +133 -0
  24. package/src/components/Form/TextField/Label/export.tsx +4 -0
  25. package/src/components/Form/TextField/TextField.tsx +200 -0
  26. package/src/components/Form/TextField/Textarea/Textarea.tsx +135 -0
  27. package/src/components/Form/TextField/Textarea/export.tsx +6 -0
  28. package/src/components/Form/TextField/Textarea/stories.tsx +44 -0
  29. package/src/components/Form/TextField/export.tsx +4 -0
  30. package/src/components/Form/export.tsx +4 -0
  31. package/src/components/Header/Header.tsx +158 -0
  32. package/src/components/Header/HeaderOverlay/index.tsx +32 -0
  33. package/src/components/Header/ToggleNav/index.tsx +32 -0
  34. package/src/components/Header/export.tsx +4 -0
  35. package/src/components/Header/stories.tsx +26 -0
  36. package/src/components/Icon/Icon.tsx +159 -0
  37. package/src/components/Icon/export.tsx +4 -0
  38. package/src/components/KeyNumber/KeyNumber.tsx +166 -0
  39. package/src/components/KeyNumber/export.tsx +4 -0
  40. package/src/components/LanguageSwitcher/LanguageSwitcher.tsx +168 -0
  41. package/src/components/LanguageSwitcher/export.tsx +4 -0
  42. package/src/components/Logo/Logo.tsx +137 -0
  43. package/src/components/Logo/export.tsx +4 -0
  44. package/src/components/Logo/stories.tsx +28 -0
  45. package/src/components/Main/Main.tsx +130 -0
  46. package/src/components/Main/export.tsx +4 -0
  47. package/src/components/Modal/Modal.tsx +194 -0
  48. package/src/components/Modal/export.tsx +4 -0
  49. package/src/components/Modal/types.tsx +5 -0
  50. package/src/components/Nav/Nav.tsx +129 -0
  51. package/src/components/Nav/export.tsx +4 -0
  52. package/src/components/Nav/stories.tsx +28 -0
  53. package/src/components/NavLegal/NavLegal.tsx +133 -0
  54. package/src/components/NavLegal/export.tsx +4 -0
  55. package/src/components/NavLegal/stories.tsx +28 -0
  56. package/src/components/NavSocial/NavSocial.tsx +169 -0
  57. package/src/components/NavSocial/export.tsx +5 -0
  58. package/src/components/{Columns/stories.ts → NavSocial/stories.tsx} +12 -14
  59. package/src/components/Section/Section.tsx +130 -0
  60. package/src/components/Section/export.tsx +6 -0
  61. package/src/components/ToRemove/ToRemove.tsx +3 -0
  62. package/src/components/Video/Video.tsx +243 -0
  63. package/src/components/Video/export.tsx +2 -0
  64. package/src/components/VideoFullWidth/VideoFullWidth.tsx +152 -0
  65. package/src/components/VideoFullWidth/export.tsx +2 -0
  66. package/dist/components/Actions/Actions.css.ts +0 -113
  67. package/dist/components/Button/Button.css.ts +0 -119
  68. package/dist/components/Carousel/Carousel.css.ts +0 -179
  69. package/dist/components/Columns/Columns.css.ts +0 -185
  70. package/dist/components/ConsentCookie/ConsentCookie.css.ts +0 -167
  71. package/dist/components/Footer/Footer.css.ts +0 -108
  72. package/dist/components/Form/Form.css.ts +0 -64
  73. package/dist/components/Form/Row/Row.css.ts +0 -70
  74. package/dist/components/Form/TextField/Input/Input.css.ts +0 -106
  75. package/dist/components/Form/TextField/Label/Label.css.ts +0 -58
  76. package/dist/components/Form/TextField/TextField.css.ts +0 -139
  77. package/dist/components/Form/TextField/Textarea/Textarea.css.ts +0 -121
  78. package/dist/components/Header/Header.css.ts +0 -111
  79. package/dist/components/Header/HeaderOverlay/styles.css.ts +0 -33
  80. package/dist/components/Header/ToggleNav/styles.css.ts +0 -40
  81. package/dist/components/Icon/Icon.css.ts +0 -102
  82. package/dist/components/KeyNumber/KeyNumber.css.ts +0 -158
  83. package/dist/components/LanguageSwitcher/LanguageSwitcher.css.ts +0 -120
  84. package/dist/components/Logo/Logo.css.ts +0 -98
  85. package/dist/components/Main/Main.css.ts +0 -62
  86. package/dist/components/Modal/Modal.css.ts +0 -203
  87. package/dist/components/Nav/Nav.css.ts +0 -123
  88. package/dist/components/NavLegal/NavLegal.css.ts +0 -121
  89. package/dist/components/NavSocial/NavSocial.css.ts +0 -121
  90. package/dist/components/Section/Section.css.ts +0 -101
  91. package/dist/components/Video/Video.css.ts +0 -210
  92. package/dist/components/VideoFullWidth/VideoFullWidth.css.ts +0 -50
  93. package/dist/css/index.cjs +0 -1
  94. package/dist/css/index.js +0 -34
  95. package/dist/index.cjs.js +0 -2
  96. package/dist/index.es.js +0 -3863
  97. package/dist/styles/sprinkles.css.ts +0 -84
  98. package/dist/theme/contract.css.ts +0 -83
  99. package/dist/theme.css-CNjMk-g_.cjs +0 -1
  100. package/dist/theme.css-Dj6kL9o0.js +0 -3020
  101. package/dist/types/components/Actions/Actions.css.d.ts +0 -74
  102. package/dist/types/components/Actions/Actions.d.ts +0 -7
  103. package/dist/types/components/Actions/stories.d.ts +0 -0
  104. package/dist/types/components/Button/Button.css.d.ts +0 -65
  105. package/dist/types/components/Button/Button.d.ts +0 -8
  106. package/dist/types/components/Button/export.d.ts +0 -0
  107. package/dist/types/components/Button/stories.d.ts +0 -0
  108. package/dist/types/components/Carousel/Carousel.css.d.ts +0 -33
  109. package/dist/types/components/Carousel/Carousel.d.ts +0 -15
  110. package/dist/types/components/Carousel/export.d.ts +0 -0
  111. package/dist/types/components/Columns/Columns.css.d.ts +0 -104
  112. package/dist/types/components/Columns/Columns.d.ts +0 -8
  113. package/dist/types/components/Columns/export.d.ts +0 -0
  114. package/dist/types/components/Columns/stories.d.ts +0 -0
  115. package/dist/types/components/ConsentCookie/ConsentCookie.css.d.ts +0 -15
  116. package/dist/types/components/ConsentCookie/ConsentCookie.d.ts +0 -17
  117. package/dist/types/components/ConsentCookie/export.d.ts +0 -0
  118. package/dist/types/components/ConsentCookie/stories.d.ts +0 -0
  119. package/dist/types/components/Footer/Footer.css.d.ts +0 -50
  120. package/dist/types/components/Footer/Footer.d.ts +0 -7
  121. package/dist/types/components/Footer/export.d.ts +0 -0
  122. package/dist/types/components/Footer/stories.d.ts +0 -6
  123. package/dist/types/components/Form/Form.css.d.ts +0 -46
  124. package/dist/types/components/Form/Form.d.ts +0 -7
  125. package/dist/types/components/Form/Row/Row.css.d.ts +0 -51
  126. package/dist/types/components/Form/Row/Row.d.ts +0 -9
  127. package/dist/types/components/Form/Row/index.d.ts +0 -0
  128. package/dist/types/components/Form/Row/stories.d.ts +0 -0
  129. package/dist/types/components/Form/TextField/Input/Input.css.d.ts +0 -32
  130. package/dist/types/components/Form/TextField/Input/Input.d.ts +0 -10
  131. package/dist/types/components/Form/TextField/Input/export.d.ts +0 -0
  132. package/dist/types/components/Form/TextField/Label/Label.css.d.ts +0 -23
  133. package/dist/types/components/Form/TextField/Label/Label.d.ts +0 -9
  134. package/dist/types/components/Form/TextField/Label/export.d.ts +0 -0
  135. package/dist/types/components/Form/TextField/TextField.css.d.ts +0 -19
  136. package/dist/types/components/Form/TextField/TextField.d.ts +0 -21
  137. package/dist/types/components/Form/TextField/Textarea/Textarea.css.d.ts +0 -56
  138. package/dist/types/components/Form/TextField/Textarea/Textarea.d.ts +0 -8
  139. package/dist/types/components/Form/TextField/Textarea/export.d.ts +0 -0
  140. package/dist/types/components/Form/TextField/Textarea/stories.d.ts +0 -0
  141. package/dist/types/components/Form/TextField/export.d.ts +0 -0
  142. package/dist/types/components/Form/export.d.ts +0 -0
  143. package/dist/types/components/Header/Header.css.d.ts +0 -36
  144. package/dist/types/components/Header/Header.d.ts +0 -11
  145. package/dist/types/components/Header/HeaderOverlay/index.d.ts +0 -7
  146. package/dist/types/components/Header/HeaderOverlay/styles.css.d.ts +0 -5
  147. package/dist/types/components/Header/ToggleNav/index.d.ts +0 -9
  148. package/dist/types/components/Header/ToggleNav/styles.css.d.ts +0 -5
  149. package/dist/types/components/Header/export.d.ts +0 -0
  150. package/dist/types/components/Header/stories.d.ts +0 -6
  151. package/dist/types/components/Icon/Icon.css.d.ts +0 -45
  152. package/dist/types/components/Icon/Icon.d.ts +0 -12
  153. package/dist/types/components/Icon/export.d.ts +0 -0
  154. package/dist/types/components/Icon/path.d.ts +0 -19
  155. package/dist/types/components/Icon/stories.d.ts +0 -0
  156. package/dist/types/components/KeyNumber/KeyNumber.css.d.ts +0 -40
  157. package/dist/types/components/KeyNumber/KeyNumber.d.ts +0 -15
  158. package/dist/types/components/KeyNumber/export.d.ts +0 -0
  159. package/dist/types/components/LanguageSwitcher/LanguageSwitcher.css.d.ts +0 -18
  160. package/dist/types/components/LanguageSwitcher/LanguageSwitcher.d.ts +0 -16
  161. package/dist/types/components/LanguageSwitcher/export.d.ts +0 -0
  162. package/dist/types/components/Logo/Logo.css.d.ts +0 -54
  163. package/dist/types/components/Logo/Logo.d.ts +0 -8
  164. package/dist/types/components/Logo/export.d.ts +0 -0
  165. package/dist/types/components/Logo/stories.d.ts +0 -6
  166. package/dist/types/components/Main/Main.css.d.ts +0 -32
  167. package/dist/types/components/Main/Main.d.ts +0 -7
  168. package/dist/types/components/Main/export.d.ts +0 -0
  169. package/dist/types/components/Main/stories.d.ts +0 -0
  170. package/dist/types/components/Modal/Modal.css.d.ts +0 -82
  171. package/dist/types/components/Modal/Modal.d.ts +0 -15
  172. package/dist/types/components/Modal/export.d.ts +0 -0
  173. package/dist/types/components/Modal/types.d.ts +0 -5
  174. package/dist/types/components/Nav/Nav.css.d.ts +0 -52
  175. package/dist/types/components/Nav/Nav.d.ts +0 -7
  176. package/dist/types/components/Nav/export.d.ts +0 -0
  177. package/dist/types/components/Nav/stories.d.ts +0 -6
  178. package/dist/types/components/NavLegal/NavLegal.css.d.ts +0 -57
  179. package/dist/types/components/NavLegal/NavLegal.d.ts +0 -7
  180. package/dist/types/components/NavLegal/export.d.ts +0 -0
  181. package/dist/types/components/NavLegal/stories.d.ts +0 -6
  182. package/dist/types/components/NavSocial/NavSocial.css.d.ts +0 -30
  183. package/dist/types/components/NavSocial/NavSocial.d.ts +0 -15
  184. package/dist/types/components/NavSocial/export.d.ts +0 -0
  185. package/dist/types/components/NavSocial/stories.d.ts +0 -0
  186. package/dist/types/components/Section/Section.css.d.ts +0 -60
  187. package/dist/types/components/Section/Section.d.ts +0 -7
  188. package/dist/types/components/Section/export.d.ts +0 -0
  189. package/dist/types/components/Section/stories.d.ts +0 -0
  190. package/dist/types/components/ToRemove/ToRemove.d.ts +0 -1
  191. package/dist/types/components/Video/Video.css.d.ts +0 -43
  192. package/dist/types/components/Video/Video.d.ts +0 -17
  193. package/dist/types/components/Video/export.d.ts +0 -0
  194. package/dist/types/components/VideoFullWidth/VideoFullWidth.css.d.ts +0 -18
  195. package/dist/types/components/VideoFullWidth/VideoFullWidth.d.ts +0 -14
  196. package/dist/types/components/VideoFullWidth/export.d.ts +0 -0
  197. package/dist/types/css/index.d.ts +0 -28
  198. package/dist/types/index.d.ts +0 -58
  199. package/dist/types/styles/mediaqueries.d.ts +0 -16
  200. package/dist/types/styles/sprinkles.css.d.ts +0 -3423
  201. package/dist/types/theme/baseThemeValues.d.ts +0 -158
  202. package/dist/types/theme/contract.css.d.ts +0 -79
  203. package/dist/types/theme/index.d.ts +0 -3
  204. package/dist/types/theme/utils.d.ts +0 -86
  205. package/dist/types/utils/cookie.d.ts +0 -2
  206. package/dist/types/utils/deep-merge-objects.d.ts +0 -2
  207. package/dist/types/utils/theme.css.d.ts +0 -173
  208. package/dist/types/utils/use-breakpoint-key.d.ts +0 -1
  209. package/dist/types/utils/use-window-size.d.ts +0 -5
  210. package/dist/utils/theme.css.ts +0 -129
  211. package/src/components/Button/stories.ts +0 -127
  212. package/src/components/Section/stories.ts +0 -64
  213. package/src/css/index.ts +0 -33
  214. package/src/themes/dark.ts +0 -3
  215. package/src/themes/index.ts +0 -5
  216. package/src/themes/light.ts +0 -3
  217. /package/{dist/types/components/Actions/export.d.ts → src/components/Form/Row/index.tsx} +0 -0
  218. /package/{dist/types/components/NavLegal/types.d.ts → src/components/NavLegal/types.tsx} +0 -0
  219. /package/{dist/types/components/NavSocial/types.d.ts → src/components/NavSocial/types.tsx} +0 -0
@@ -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';
@@ -0,0 +1,194 @@
1
+ import { clsx } from 'clsx';
2
+ import { forwardRef, useEffect, useState } from 'react';
3
+ import { modalCloseButton, modalContentRecipe, type ModalContentVariants, modalRecipe, type ModalVariants } from './Modal.css';
4
+ import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
5
+ import { Icon } from '../Icon/Icon';
6
+
7
+ export interface ModalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<ModalVariants> {
8
+ css?: string;
9
+ isOpen: boolean;
10
+ onClose?: () => void;
11
+ showCloseButton?: boolean;
12
+ closeOnBackdropClick?: boolean;
13
+ closeOnEscape?: boolean;
14
+ contentProps?: ModalContentVariants & {
15
+ css?: string;
16
+ className?: string;
17
+ };
18
+ }
19
+
20
+ export const Modal = forwardRef<HTMLDivElement, ModalProps>(
21
+ (
22
+ {
23
+ children,
24
+ isOpen,
25
+ onClose,
26
+ showCloseButton = true,
27
+ closeOnBackdropClick = true,
28
+ closeOnEscape = true,
29
+ contentProps = {},
30
+ size,
31
+ centered,
32
+ css,
33
+ className,
34
+ // Extract sprinkles props
35
+ margin,
36
+ marginTop,
37
+ marginBottom,
38
+ marginLeft,
39
+ marginRight,
40
+ padding,
41
+ paddingTop,
42
+ paddingBottom,
43
+ paddingLeft,
44
+ paddingRight,
45
+ gap,
46
+ display,
47
+ flexDirection,
48
+ justifyContent,
49
+ flexWrap,
50
+ flex,
51
+ width,
52
+ height,
53
+ minWidth,
54
+ maxWidth,
55
+ minHeight,
56
+ position,
57
+ top,
58
+ bottom,
59
+ left,
60
+ right,
61
+ zIndex,
62
+ fontSize,
63
+ fontFamily,
64
+ lineHeight,
65
+ textAlign,
66
+ fontWeight,
67
+ color,
68
+ backgroundColor,
69
+ borderRadius,
70
+ borderWidth,
71
+ borderStyle,
72
+ borderColor,
73
+ boxShadow,
74
+ opacity,
75
+ overflow,
76
+ overflowX,
77
+ overflowY,
78
+ ...htmlProps
79
+ },
80
+ ref
81
+ ) => {
82
+ const [shouldRender, setShouldRender] = useState(isOpen);
83
+
84
+ useEffect(() => {
85
+ if (isOpen) {
86
+ setShouldRender(true);
87
+ document.body.style.overflow = 'hidden';
88
+ } else {
89
+ const timer = setTimeout(() => setShouldRender(false), 300);
90
+ document.body.style.overflow = '';
91
+ return () => clearTimeout(timer);
92
+ }
93
+ }, [isOpen]);
94
+
95
+ useEffect(() => {
96
+ const handleEscape = (event: KeyboardEvent) => {
97
+ if (closeOnEscape && event.key === 'Escape' && onClose) {
98
+ onClose();
99
+ }
100
+ };
101
+
102
+ if (isOpen) {
103
+ document.addEventListener('keydown', handleEscape);
104
+ return () => document.removeEventListener('keydown', handleEscape);
105
+ }
106
+ }, [isOpen, closeOnEscape, onClose]);
107
+
108
+ const handleBackdropClick = (event: React.MouseEvent) => {
109
+ if (closeOnBackdropClick && event.target === event.currentTarget && onClose) {
110
+ onClose();
111
+ }
112
+ };
113
+
114
+ if (!shouldRender) return null;
115
+
116
+ return (
117
+ <div
118
+ ref={ref}
119
+ className={clsx(
120
+ modalRecipe({ size, centered }),
121
+ sprinkles({
122
+ margin,
123
+ marginTop,
124
+ marginBottom,
125
+ marginLeft,
126
+ marginRight,
127
+ padding,
128
+ paddingTop,
129
+ paddingBottom,
130
+ paddingLeft,
131
+ paddingRight,
132
+ gap,
133
+ display,
134
+ flexDirection,
135
+ justifyContent,
136
+ flexWrap,
137
+ flex,
138
+ width,
139
+ height,
140
+ minWidth,
141
+ maxWidth,
142
+ minHeight,
143
+ position,
144
+ top,
145
+ bottom,
146
+ left,
147
+ right,
148
+ zIndex,
149
+ fontSize,
150
+ fontFamily,
151
+ lineHeight,
152
+ textAlign,
153
+ fontWeight,
154
+ color,
155
+ backgroundColor,
156
+ borderRadius,
157
+ borderWidth,
158
+ borderStyle,
159
+ borderColor,
160
+ boxShadow,
161
+ opacity,
162
+ overflow,
163
+ overflowX,
164
+ overflowY,
165
+ }),
166
+ css,
167
+ className
168
+ )}
169
+ onClick={handleBackdropClick}
170
+ role="dialog"
171
+ aria-modal="true"
172
+ {...htmlProps}>
173
+ <div
174
+ className={clsx(
175
+ modalContentRecipe({
176
+ size: contentProps.size || size,
177
+ align: contentProps.align,
178
+ }),
179
+ contentProps.css,
180
+ contentProps.className
181
+ )}>
182
+ {showCloseButton && onClose && (
183
+ <button type="button" className={modalCloseButton} onClick={onClose} aria-label="Close modal">
184
+ <Icon icon="close" size="sm" />
185
+ </button>
186
+ )}
187
+ {children}
188
+ </div>
189
+ </div>
190
+ );
191
+ }
192
+ );
193
+
194
+ Modal.displayName = 'Modal';
@@ -0,0 +1,4 @@
1
+ // export { Modal } from '.';
2
+ // export type { ModalProps } from '.';
3
+
4
+ // export { styles as ModalStyles } from './styles.css';
@@ -0,0 +1,5 @@
1
+ export enum Align {
2
+ Center,
3
+ Left,
4
+ Right,
5
+ }
@@ -0,0 +1,129 @@
1
+ import { clsx } from 'clsx';
2
+ import { forwardRef } from 'react';
3
+ import { navRecipe, type NavVariants } from './Nav.css';
4
+ import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
5
+
6
+ export interface NavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Sprinkles, NonNullable<NavVariants> {
7
+ css?: string;
8
+ as?: 'nav' | 'div' | 'ul';
9
+ }
10
+
11
+ export const Nav = forwardRef<HTMLElement, NavProps>(
12
+ (
13
+ {
14
+ children,
15
+ orientation,
16
+ variant,
17
+ justify,
18
+ as: Component = 'nav',
19
+ css,
20
+ className,
21
+ // Extract sprinkles props
22
+ margin,
23
+ marginTop,
24
+ marginBottom,
25
+ marginLeft,
26
+ marginRight,
27
+ padding,
28
+ paddingTop,
29
+ paddingBottom,
30
+ paddingLeft,
31
+ paddingRight,
32
+ gap,
33
+ display,
34
+ flexDirection,
35
+ justifyContent,
36
+ flexWrap,
37
+ flex,
38
+ width,
39
+ height,
40
+ minWidth,
41
+ maxWidth,
42
+ minHeight,
43
+ position,
44
+ top,
45
+ bottom,
46
+ left,
47
+ right,
48
+ zIndex,
49
+ fontSize,
50
+ fontFamily,
51
+ lineHeight,
52
+ textAlign,
53
+ fontWeight,
54
+ color,
55
+ backgroundColor,
56
+ borderRadius,
57
+ borderWidth,
58
+ borderStyle,
59
+ borderColor,
60
+ boxShadow,
61
+ opacity,
62
+ overflow,
63
+ overflowX,
64
+ overflowY,
65
+ ...htmlProps
66
+ },
67
+ ref
68
+ ) => {
69
+ return (
70
+ <Component
71
+ ref={ref as any}
72
+ className={clsx(
73
+ navRecipe({ orientation, variant, justify }),
74
+ sprinkles({
75
+ margin,
76
+ marginTop,
77
+ marginBottom,
78
+ marginLeft,
79
+ marginRight,
80
+ padding,
81
+ paddingTop,
82
+ paddingBottom,
83
+ paddingLeft,
84
+ paddingRight,
85
+ gap,
86
+ display,
87
+ flexDirection,
88
+ justifyContent,
89
+ flexWrap,
90
+ flex,
91
+ width,
92
+ height,
93
+ minWidth,
94
+ maxWidth,
95
+ minHeight,
96
+ position,
97
+ top,
98
+ bottom,
99
+ left,
100
+ right,
101
+ zIndex,
102
+ fontSize,
103
+ fontFamily,
104
+ lineHeight,
105
+ textAlign,
106
+ fontWeight,
107
+ color,
108
+ backgroundColor,
109
+ borderRadius,
110
+ borderWidth,
111
+ borderStyle,
112
+ borderColor,
113
+ boxShadow,
114
+ opacity,
115
+ overflow,
116
+ overflowX,
117
+ overflowY,
118
+ }),
119
+ css,
120
+ className
121
+ )}
122
+ {...htmlProps}>
123
+ {children}
124
+ </Component>
125
+ );
126
+ }
127
+ );
128
+
129
+ Nav.displayName = 'Nav';
@@ -0,0 +1,4 @@
1
+ // export { Nav } from '.';
2
+ // export type { NavProps } from '.';
3
+
4
+ // export { styles as NavStyles } from './styles.css';
@@ -0,0 +1,28 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Nav } 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 Nav> = {
7
+ title: 'Latte Components / 6. Nav / Main',
8
+ component: Nav,
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: '',
27
+ },
28
+ };