@latte-macchiat-io/latte-vanilla-components 0.0.342 → 0.0.344
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 +4 -6
- package/src/components/Actions/index.tsx +2 -2
- package/src/components/Button/index.tsx +3 -3
- package/src/components/Carousel/index.tsx +3 -3
- package/src/components/Columns/index.tsx +2 -2
- package/src/components/ConsentCookie/index.tsx +2 -2
- package/src/components/Footer/index.tsx +2 -2
- package/src/components/Form/Row/index.tsx +2 -2
- package/src/components/Form/TextField/Input/index.tsx +2 -2
- package/src/components/Form/TextField/Label/index.tsx +2 -2
- package/src/components/Form/TextField/Textarea/index.tsx +2 -2
- package/src/components/Form/TextField/index.tsx +2 -2
- package/src/components/Form/index.tsx +2 -2
- package/src/components/Header/HeaderToggleNav/index.tsx +5 -5
- package/src/components/Header/index.tsx +2 -2
- package/src/components/Heading/index.tsx +2 -2
- package/src/components/Icon/index.tsx +2 -2
- package/src/components/KeyNumber/index.tsx +2 -2
- package/src/components/LanguageSwitcher/index.tsx +2 -2
- package/src/components/Logo/index.tsx +2 -2
- package/src/components/Main/index.tsx +2 -2
- package/src/components/Modal/index.tsx +2 -2
- package/src/components/Nav/index.tsx +2 -2
- package/src/components/NavLegal/index.tsx +2 -2
- package/src/components/NavSocial/index.tsx +2 -2
- package/src/components/Paragraph/index.tsx +2 -2
- package/src/components/Section/index.tsx +2 -2
- package/src/components/Video/index.tsx +2 -2
- package/src/utils/styleOverride.ts +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latte-macchiat-io/latte-vanilla-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.344",
|
|
4
4
|
"description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./src/index.ts",
|
|
11
11
|
"./*.css.ts": "./src/*.css.ts",
|
|
12
|
+
"./utils/*": "./src/utils/*",
|
|
12
13
|
"./src/*": "./src/*"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
@@ -21,9 +22,11 @@
|
|
|
21
22
|
],
|
|
22
23
|
"peerDependencies": {
|
|
23
24
|
"@vanilla-extract/css": "^1.17.4",
|
|
25
|
+
"@vanilla-extract/css-utils": "^0.1.6",
|
|
24
26
|
"@vanilla-extract/recipes": "^0.5.7",
|
|
25
27
|
"@vanilla-extract/sprinkles": "^1.6.5",
|
|
26
28
|
"framer-motion": "^12.4.7",
|
|
29
|
+
"html-react-parser": "^5.2.6",
|
|
27
30
|
"react": "^19",
|
|
28
31
|
"react-countup": "^6.5.3",
|
|
29
32
|
"react-dom": "^19",
|
|
@@ -44,7 +47,6 @@
|
|
|
44
47
|
"@vanilla-extract/recipes": "^0.5.7",
|
|
45
48
|
"@vanilla-extract/sprinkles": "^1.6.5",
|
|
46
49
|
"@vanilla-extract/vite-plugin": "^5.1.1",
|
|
47
|
-
"clsx": "^2.1.1",
|
|
48
50
|
"eslint": "^9.15.0",
|
|
49
51
|
"eslint-config-prettier": "^10.0.1",
|
|
50
52
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
@@ -65,10 +67,6 @@
|
|
|
65
67
|
"plugin:storybook/recommended"
|
|
66
68
|
]
|
|
67
69
|
},
|
|
68
|
-
"dependencies": {
|
|
69
|
-
"@vanilla-extract/css-utils": "^0.1.6",
|
|
70
|
-
"html-react-parser": "^5.2.6"
|
|
71
|
-
},
|
|
72
70
|
"scripts": {
|
|
73
71
|
"build": "echo \"Source-only distribution - no build needed\"",
|
|
74
72
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { actionsRecipe, type ActionsVariants } from './styles.css';
|
|
4
4
|
|
|
@@ -8,5 +8,5 @@ export type ActionsProps = React.HTMLAttributes<HTMLDivElement> &
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const Actions = ({ align, direction, className, children }: ActionsProps) => (
|
|
11
|
-
<div className={
|
|
11
|
+
<div className={cn(actionsRecipe({ align, direction }), className)}>{children}</div>
|
|
12
12
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { buttonRecipe, type ButtonVariants } from './styles.css';
|
|
4
4
|
import { AllowedButton } from './types';
|
|
@@ -30,14 +30,14 @@ export const Button = ({
|
|
|
30
30
|
}: ButtonProps) => {
|
|
31
31
|
if (as === 'a') {
|
|
32
32
|
return (
|
|
33
|
-
<a href={href} className={
|
|
33
|
+
<a href={href} className={cn(buttonRecipe({ variant, style, size, fullWidth }), className)}>
|
|
34
34
|
{children}
|
|
35
35
|
</a>
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
|
-
<button onClick={onClick} disabled={isDisabled || isPending} className={
|
|
40
|
+
<button onClick={onClick} disabled={isDisabled || isPending} className={cn(buttonRecipe({ variant, style, size, fullWidth }), className)}>
|
|
41
41
|
{isPending ? translation.isPendingLabel : children}
|
|
42
42
|
</button>
|
|
43
43
|
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
3
|
import { ReactNode, useEffect, useRef, useState } from 'react';
|
|
5
4
|
|
|
6
5
|
import {
|
|
@@ -20,6 +19,7 @@ import {
|
|
|
20
19
|
|
|
21
20
|
import { breakpoints } from '../../styles/mediaqueries';
|
|
22
21
|
import { getResponsiveValue, parseResponsiveNumber } from '../../utils/getResponsiveValue';
|
|
22
|
+
import { cn } from '../../utils/styleOverride';
|
|
23
23
|
import { useWindowSize } from '../../utils/useWindowSize';
|
|
24
24
|
|
|
25
25
|
import { Icon } from '../Icon';
|
|
@@ -172,7 +172,7 @@ export const Carousel = ({
|
|
|
172
172
|
const maxIndex = Math.max(0, data.length - visibleItems);
|
|
173
173
|
|
|
174
174
|
return (
|
|
175
|
-
<div className={
|
|
175
|
+
<div className={cn(carouselRecipe({ isFullWidth }), className)}>
|
|
176
176
|
<div ref={carouselRef} className={carouselContent({ overflow })}>
|
|
177
177
|
<div
|
|
178
178
|
ref={slideRef}
|
|
@@ -208,7 +208,7 @@ export const Carousel = ({
|
|
|
208
208
|
type="button"
|
|
209
209
|
aria-label={`Go to slide ${index + 1}`}
|
|
210
210
|
onClick={() => handleBulletClick(index)}
|
|
211
|
-
className={
|
|
211
|
+
className={cn(carouselBullet, index === currentIndex && carouselBulletActive)}
|
|
212
212
|
/>
|
|
213
213
|
))}
|
|
214
214
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { columnsRecipe, ColumnsVariants } from './styles.css';
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ export const Columns = ({ align, vAlign, columns, children, className }: Columns
|
|
|
12
12
|
const columnsValue = columns.map((c) => `${c}fr`).join(' ');
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<div className={
|
|
15
|
+
<div className={cn(columnsRecipe({ align, vAlign }), className)} style={{ ['--columns' as never]: columnsValue }}>
|
|
16
16
|
{children}
|
|
17
17
|
</div>
|
|
18
18
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from '../../utils/styleOverride';
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { getCookie, setCookie } from './cookie';
|
|
@@ -89,7 +89,7 @@ export const ConsentCookie = ({
|
|
|
89
89
|
if (!showConsent) return null;
|
|
90
90
|
|
|
91
91
|
return (
|
|
92
|
-
<div className={
|
|
92
|
+
<div className={cn(consentRecipe({ variant }), className)} role="dialog" aria-modal="true" aria-labelledby="consent-title">
|
|
93
93
|
<div className={consentContent}>
|
|
94
94
|
{children}
|
|
95
95
|
<div className={consentActions}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { footerRecipe } from './styles.css';
|
|
4
4
|
|
|
@@ -6,4 +6,4 @@ export type FooterProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const Footer = ({ children, className }: FooterProps) => <footer className={
|
|
9
|
+
export const Footer = ({ children, className }: FooterProps) => <footer className={cn(footerRecipe, className)}>{children}</footer>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { rowRecipe, type RowVariants } from './styles.css';
|
|
@@ -7,7 +7,7 @@ export type RowProps = React.HTMLAttributes<HTMLDivElement> & RowVariants;
|
|
|
7
7
|
|
|
8
8
|
export const Row = forwardRef<HTMLDivElement, RowProps>(({ children, align, className }, ref) => {
|
|
9
9
|
return (
|
|
10
|
-
<div ref={ref} className={
|
|
10
|
+
<div ref={ref} className={cn(rowRecipe({ align }), className)}>
|
|
11
11
|
{children}
|
|
12
12
|
</div>
|
|
13
13
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../../utils/styleOverride';
|
|
2
2
|
import { inputRecipe } from './styles.css';
|
|
3
3
|
|
|
4
4
|
import { InputType } from './types';
|
|
@@ -8,5 +8,5 @@ export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const Input = ({ name, type = 'text', value, required, placeholder, className }: InputProps) => (
|
|
11
|
-
<input id={name} name={name} type={type} value={value} required={required} placeholder={placeholder} className={
|
|
11
|
+
<input id={name} name={name} type={type} value={value} required={required} placeholder={placeholder} className={cn(inputRecipe(), className)} />
|
|
12
12
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { labelRecipe, type LabelVariants } from './styles.css';
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ export type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> &
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const Label = ({ label, name, required, className }: LabelProps) => (
|
|
13
|
-
<label htmlFor={name} className={
|
|
13
|
+
<label htmlFor={name} className={cn(labelRecipe(), className)}>
|
|
14
14
|
{label} {required && '*'}
|
|
15
15
|
</label>
|
|
16
16
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { textareaRecipe } from './styles.css';
|
|
4
4
|
|
|
@@ -7,5 +7,5 @@ export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export const Textarea = ({ name, rows, className }: TextareaProps) => (
|
|
10
|
-
<textarea id={name} rows={rows} name={name} className={
|
|
10
|
+
<textarea id={name} rows={rows} name={name} className={cn(textareaRecipe(), className)} />
|
|
11
11
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from '../../utils/styleOverride';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
|
|
6
6
|
import { Input } from './Input';
|
|
@@ -31,7 +31,7 @@ export const TextField = (props: TextFieldProps) => {
|
|
|
31
31
|
const isTextarea = type === 'textarea';
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<div className={
|
|
34
|
+
<div className={cn(textFieldRecipe(), className)}>
|
|
35
35
|
{label && <label htmlFor={name}>{label}</label>}
|
|
36
36
|
|
|
37
37
|
{isTextarea ? (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
import { formRecipe } from './styles.css';
|
|
3
3
|
|
|
4
4
|
export type FormProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
@@ -8,5 +8,5 @@ export type FormProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
8
8
|
|
|
9
9
|
export const Form = ({ as = 'form', children, className }: FormProps) => {
|
|
10
10
|
const Component = as;
|
|
11
|
-
return <Component className={
|
|
11
|
+
return <Component className={cn(formRecipe(), className)}>{children}</Component>;
|
|
12
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import { bar, toggleNavButton, toggleNavButtonMenu } from './styles.css';
|
|
@@ -11,12 +11,12 @@ export type HeaderToggleNavProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
11
11
|
|
|
12
12
|
export const HeaderToggleNav = ({ isOpen, onClick, children, className }: HeaderToggleNavProps) => {
|
|
13
13
|
return (
|
|
14
|
-
<button onClick={onClick} aria-label="Toggle navigation" className={
|
|
14
|
+
<button onClick={onClick} aria-label="Toggle navigation" className={cn(toggleNavButton(), className)}>
|
|
15
15
|
{children || (
|
|
16
16
|
<span className={toggleNavButtonMenu()}>
|
|
17
|
-
<span className={
|
|
18
|
-
<span className={
|
|
19
|
-
<span className={
|
|
17
|
+
<span className={cn(bar, isOpen && 'open')} />
|
|
18
|
+
<span className={cn(bar, isOpen && 'open')} />
|
|
19
|
+
<span className={cn(bar, isOpen && 'open')} />
|
|
20
20
|
</span>
|
|
21
21
|
)}
|
|
22
22
|
</button>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { cn } from '../../utils/styleOverride';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { HeaderToggleNav } from './HeaderToggleNav';
|
|
@@ -30,7 +30,7 @@ export const Header = ({ children, childrenOverlay, childrenToggleNav, isFixed =
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<>
|
|
33
|
-
<header className={
|
|
33
|
+
<header className={cn(headerRecipe({ isFixed }), className)}>
|
|
34
34
|
{childrenOverlay && <div className={headerOverlayRecipe({ isOpen: isNavOpen })}>{childrenOverlay}</div>}
|
|
35
35
|
|
|
36
36
|
{children}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
import parse from 'html-react-parser';
|
|
3
3
|
|
|
4
4
|
import { headingRecipe, HeadingVariants } from './styles.css';
|
|
@@ -24,7 +24,7 @@ export const Heading = ({ as, size, className, children }: HeadingProps) => {
|
|
|
24
24
|
const resolvedSize = size ?? levelToSize[as];
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<Component className={
|
|
27
|
+
<Component className={cn(headingRecipe({ size: resolvedSize, as }), className)}>
|
|
28
28
|
{parse(typeof children === 'string' ? children : '')}
|
|
29
29
|
</Component>
|
|
30
30
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import path from './path';
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ export const Icon = ({ icon = '', className, size = 24, iconPath = '', viewBox =
|
|
|
17
17
|
const d = iconPath || path[icon as keyof typeof path];
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<svg className={
|
|
20
|
+
<svg className={cn(iconRecipe, className)} viewBox={viewBox} width={`${size}px`} height={`${size}px`}>
|
|
21
21
|
<path className={iconPath} d={d} fill={color} />
|
|
22
22
|
</svg>
|
|
23
23
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from '../../utils/styleOverride';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import CountUp from 'react-countup';
|
|
6
6
|
|
|
@@ -39,7 +39,7 @@ export const KeyNumber = forwardRef<HTMLDivElement, KeyNumberProps>(
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}}
|
|
42
|
-
className={
|
|
42
|
+
className={cn(keyNumberRecipe({ align, vAlign }), className)}>
|
|
43
43
|
{prefix}
|
|
44
44
|
<CountUp end={inView ? value : 0} duration={duration} separator={separator} decimals={decimals} className={keyNumberValueRecipe({ size })} />
|
|
45
45
|
{suffix}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
import { languageSwitcherIcon, languageSwitcherRecipe, languageSwitcherSelect, type LanguageSwitcherVariants } from './styles.css';
|
|
3
3
|
|
|
4
4
|
import { Icon } from '../Icon';
|
|
@@ -31,7 +31,7 @@ export const LanguageSwitcher = ({
|
|
|
31
31
|
const handleSelectChange = (event: React.ChangeEvent<HTMLSelectElement>) => onChange(event.target.value);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<div className={
|
|
34
|
+
<div className={cn(languageSwitcherRecipe({ variant, size }), className)}>
|
|
35
35
|
<select className={languageSwitcherSelect} value={currentLocale} onChange={handleSelectChange} disabled={disabled} aria-label="Switch language">
|
|
36
36
|
{placeholder && (
|
|
37
37
|
<option value="" disabled>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import { logo } from './styles.css';
|
|
@@ -7,4 +7,4 @@ export type LogoProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export const Logo = ({ children, className }: LogoProps) => <div className={
|
|
10
|
+
export const Logo = ({ children, className }: LogoProps) => <div className={cn(logo, className)}>{children}</div>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { main } from './styles.css';
|
|
4
4
|
|
|
@@ -6,4 +6,4 @@ export type MainProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const Main = ({ className, children }: MainProps) => <main className={
|
|
9
|
+
export const Main = ({ className, children }: MainProps) => <main className={cn(main, className)}>{children}</main>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from '../../utils/styleOverride';
|
|
4
4
|
import { ReactNode, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { modal, modalContentCloseButton, modalContentRecipe, type ModalVariants } from './styles.css';
|
|
@@ -39,7 +39,7 @@ export const Modal = ({ triggerLabel, className, children, align, withCloseButto
|
|
|
39
39
|
|
|
40
40
|
{isOpen && (
|
|
41
41
|
<div className={modal} role="dialog" aria-modal="true">
|
|
42
|
-
<div className={
|
|
42
|
+
<div className={cn(modalContentRecipe({ align }), className)}>
|
|
43
43
|
{withCloseButton && (
|
|
44
44
|
<button type="button" className={modalContentCloseButton} onClick={closeModal} aria-label="Close modal">
|
|
45
45
|
<Icon icon="close" color={themeContract.modal.closeButtonColor} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { navRecipe, NavVariants } from './styles.css';
|
|
4
4
|
|
|
@@ -7,4 +7,4 @@ export type NavProps = React.HTMLAttributes<HTMLDivElement> &
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export const Nav = ({ children, className, direction }: NavProps) => <div className={
|
|
10
|
+
export const Nav = ({ children, className, direction }: NavProps) => <div className={cn(navRecipe({ direction }), className)}>{children}</div>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { navLegalRecipe } from './styles.css';
|
|
4
4
|
|
|
@@ -6,4 +6,4 @@ export type NavLegalProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const NavLegal = ({ className, children }: NavLegalProps) => <div className={
|
|
9
|
+
export const NavLegal = ({ className, children }: NavLegalProps) => <div className={cn(navLegalRecipe(), className)}>{children}</div>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { navSocialLink, navSocialRecipe } from './styles.css';
|
|
4
4
|
import { Social } from './types';
|
|
@@ -11,7 +11,7 @@ export type NavSocialProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export const NavSocial = ({ size = 24, navSocial, className }: NavSocialProps) => (
|
|
14
|
-
<div className={
|
|
14
|
+
<div className={cn(navSocialRecipe(), className)}>
|
|
15
15
|
{navSocial?.map(({ name, link }, index) => {
|
|
16
16
|
const capitalized = name[0].toUpperCase() + name.slice(1);
|
|
17
17
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
import parse from 'html-react-parser';
|
|
3
3
|
|
|
4
4
|
import { paragraphRecipe, type ParagraphVariants } from './styles.css';
|
|
@@ -9,5 +9,5 @@ export type ParagraphProps = React.HTMLAttributes<HTMLDivElement> &
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const Paragraph = ({ align, className, children }: ParagraphProps) => (
|
|
12
|
-
<p className={
|
|
12
|
+
<p className={cn(paragraphRecipe({ align }), className)}>{parse(typeof children === 'string' ? children : '')}</p>
|
|
13
13
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from '../../utils/styleOverride';
|
|
2
2
|
|
|
3
3
|
import { sectionContent, sectionRecipe, type SectionVariants } from './styles.css';
|
|
4
4
|
|
|
@@ -21,7 +21,7 @@ export const Section = ({
|
|
|
21
21
|
}: SectionProps) => (
|
|
22
22
|
<section
|
|
23
23
|
style={style}
|
|
24
|
-
className={
|
|
24
|
+
className={cn(sectionRecipe({ align, isDark, variant, isFullHeight, withPaddingTop, withPaddingBottom, isHeaderFixed }), className)}>
|
|
25
25
|
<div className={sectionContent}>{children}</div>
|
|
26
26
|
</section>
|
|
27
27
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from '../../utils/styleOverride';
|
|
4
4
|
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import {
|
|
@@ -82,7 +82,7 @@ export const Video = ({
|
|
|
82
82
|
}, [isMuted]);
|
|
83
83
|
|
|
84
84
|
return (
|
|
85
|
-
<div className={
|
|
85
|
+
<div className={cn(videoRecipe({ size }), className)}>
|
|
86
86
|
<video ref={videoRef} className={videoElement} playsInline muted={isMuted} autoPlay={isAutoPlay} onEnded={handleVideoEnded}>
|
|
87
87
|
<source src={video} type="video/mp4" />
|
|
88
88
|
</video>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { style, StyleRule } from '@vanilla-extract/css';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a style override with higher specificity to ensure consumer styles
|
|
5
|
+
* always win over library component styles, regardless of CSS load order.
|
|
6
|
+
*
|
|
7
|
+
* Uses the [class] attribute selector to increase specificity from (0,1,0) to (0,2,0).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { styleOverride } from '@latte-macchiat-io/latte-vanilla-components/utils/styleOverride';
|
|
12
|
+
*
|
|
13
|
+
* const customButton = styleOverride({
|
|
14
|
+
* textTransform: 'uppercase',
|
|
15
|
+
* letterSpacing: '0.1em',
|
|
16
|
+
* backgroundColor: 'red',
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* <Button className={customButton}>My Button</Button>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function styleOverride(styleRule: StyleRule) {
|
|
23
|
+
return style({
|
|
24
|
+
selectors: {
|
|
25
|
+
'&[class]': styleRule,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Alternative utility that merges class names properly.
|
|
32
|
+
* This is a lightweight replacement for clsx with better type safety.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* import { cn } from '@latte-macchiat-io/latte-vanilla-components/utils/styleOverride';
|
|
37
|
+
*
|
|
38
|
+
* <Button className={cn(baseStyle, customStyle)} />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function cn(...classes: (string | undefined | null | false)[]) {
|
|
42
|
+
return classes.filter(Boolean).join(' ');
|
|
43
|
+
}
|