@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
@@ -0,0 +1,104 @@
1
+ import { clsx } from 'clsx';
2
+ import { useEffect, useState } from 'react';
3
+
4
+ import { getCookie, setCookie } from './cookie';
5
+ import { consentActions, consentContent, type ConsentCookieVariants, consentRecipe } from './styles.css';
6
+
7
+ import { Button } from '../Button';
8
+
9
+ // Declare window object including gtag to avoid TypeScript errors
10
+ declare const window: Window &
11
+ typeof globalThis & {
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ gtag: any;
14
+ };
15
+
16
+ export interface ConsentCookieProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, NonNullable<ConsentCookieVariants> {
17
+ cookieName?: string;
18
+ cookieExpirationDays?: number;
19
+ onAccept?: () => void;
20
+ onReject?: () => void;
21
+ translations?: {
22
+ actions: {
23
+ accept: string;
24
+ reject: string;
25
+ };
26
+ };
27
+ enableGoogleAnalytics?: boolean;
28
+ }
29
+
30
+ export const ConsentCookie = ({
31
+ variant,
32
+ onAccept,
33
+ onReject,
34
+ children,
35
+ className,
36
+ translations,
37
+ cookieName = 'consent',
38
+ cookieExpirationDays = 365,
39
+ enableGoogleAnalytics = true,
40
+ }: ConsentCookieProps) => {
41
+ const [showConsent, setShowConsent] = useState(false);
42
+
43
+ const handleAccept = () => {
44
+ setShowConsent(false);
45
+ setCookie(cookieName, 'true', cookieExpirationDays);
46
+
47
+ if (enableGoogleAnalytics && typeof window !== 'undefined' && typeof window.gtag !== 'undefined') {
48
+ window.gtag('consent', 'update', {
49
+ analytics_storage: 'granted',
50
+ });
51
+ }
52
+
53
+ onAccept?.();
54
+ };
55
+
56
+ const handleReject = () => {
57
+ setShowConsent(false);
58
+ setCookie(cookieName, 'false', cookieExpirationDays);
59
+
60
+ if (enableGoogleAnalytics && typeof window !== 'undefined' && typeof window.gtag !== 'undefined') {
61
+ window.gtag('consent', 'update', {
62
+ analytics_storage: 'denied',
63
+ });
64
+ }
65
+
66
+ onReject?.();
67
+ };
68
+
69
+ useEffect(() => {
70
+ const consentValue = getCookie(cookieName);
71
+ const shouldShowConsent = consentValue !== 'true' && consentValue !== 'false';
72
+ const areCookiesAccepted = consentValue === 'true';
73
+
74
+ if (shouldShowConsent) {
75
+ setShowConsent(true);
76
+ }
77
+
78
+ // Set initial Google Analytics consent
79
+ if (enableGoogleAnalytics && typeof window !== 'undefined' && typeof window.gtag !== 'undefined') {
80
+ const gAnalyticsConsent = areCookiesAccepted ? 'granted' : 'denied';
81
+ window.gtag('consent', 'update', {
82
+ analytics_storage: gAnalyticsConsent,
83
+ });
84
+ }
85
+ }, [cookieName, enableGoogleAnalytics]);
86
+
87
+ if (!showConsent) return null;
88
+
89
+ return (
90
+ <div className={clsx(consentRecipe({ variant }), className)} role="dialog" aria-modal="true" aria-labelledby="consent-title">
91
+ <div className={consentContent}>
92
+ {children}
93
+ <div className={consentActions}>
94
+ <Button size="sm" onClick={handleReject}>
95
+ {translations?.actions.reject || 'Reject'}
96
+ </Button>
97
+ <Button variant="primary" size="sm" onClick={handleAccept}>
98
+ {translations?.actions.accept || 'Accept'}
99
+ </Button>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ );
104
+ };
@@ -1,4 +1 @@
1
- // export { Footer } from '.';
2
- // export type { FooterProps } from '.';
3
-
4
- // export { styles as FooterStyles } from './styles.css';
1
+ export { Footer, type FooterProps } from './';
@@ -1,17 +1,9 @@
1
1
  import { clsx } from 'clsx';
2
- import { forwardRef } from 'react';
3
2
 
4
3
  import { footerRecipe } from './styles.css';
5
4
 
6
5
  export type FooterProps = React.HTMLAttributes<HTMLDivElement> & {
7
- css?: string;
8
6
  children: React.ReactNode;
9
7
  };
10
8
 
11
- export const Footer = forwardRef<HTMLDivElement, FooterProps>(({ children, css, className }, ref) => {
12
- return (
13
- <footer ref={ref} className={clsx(footerRecipe, css, className)}>
14
- {children}
15
- </footer>
16
- );
17
- });
9
+ export const Footer = ({ children, className }: FooterProps) => <footer className={clsx(footerRecipe, className)}>{children}</footer>;
@@ -0,0 +1,51 @@
1
+ const themeFooterBase = {
2
+ footer: {
3
+ fontSize: '0.8em',
4
+ height: {
5
+ mobile: '15px',
6
+ sm: '15px',
7
+ md: '30px',
8
+ lg: '30px',
9
+ xl: '50px',
10
+ '2xl': '50px',
11
+ },
12
+ gap: {
13
+ mobile: '15px',
14
+ sm: '15px',
15
+ md: '30px',
16
+ lg: '30px',
17
+ xl: '50px',
18
+ '2xl': '50px',
19
+ },
20
+ paddingTop: {
21
+ mobile: '15px',
22
+ sm: '15px',
23
+ md: '30px',
24
+ lg: '30px',
25
+ xl: '50px',
26
+ '2xl': '50px',
27
+ },
28
+ paddingBottom: {
29
+ mobile: '15px',
30
+ sm: '15px',
31
+ md: '30px',
32
+ lg: '30px',
33
+ xl: '50px',
34
+ '2xl': '50px',
35
+ },
36
+ },
37
+ };
38
+
39
+ export const themeFooterLight = {
40
+ footer: {
41
+ ...themeFooterBase.footer,
42
+ backgroundColor: '#FF7377',
43
+ },
44
+ };
45
+
46
+ export const themeFooterDark = {
47
+ footer: {
48
+ ...themeFooterBase.footer,
49
+ backgroundColor: '#FF7377',
50
+ },
51
+ };
@@ -4,7 +4,6 @@ import { formRecipe, type FormVariants } from './Form.css';
4
4
  import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
5
5
 
6
6
  export interface FormProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'color'>, Sprinkles, NonNullable<FormVariants> {
7
- css?: string;
8
7
  children: React.ReactNode;
9
8
  }
10
9
 
@@ -14,7 +13,6 @@ export const Form = forwardRef<HTMLFormElement, FormProps>(
14
13
  children,
15
14
  spacing,
16
15
  layout,
17
- css,
18
16
  className,
19
17
  // Extract sprinkles props
20
18
  margin,
@@ -114,7 +112,6 @@ export const Form = forwardRef<HTMLFormElement, FormProps>(
114
112
  overflowX,
115
113
  overflowY,
116
114
  }),
117
- css,
118
115
  className
119
116
  )}
120
117
  {...htmlProps}>
@@ -4,7 +4,6 @@ import { rowRecipe, type RowVariants } from './Row.css';
4
4
  import { sprinkles, type Sprinkles } from '../../../styles/sprinkles.css';
5
5
 
6
6
  export interface RowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<RowVariants> {
7
- css?: string;
8
7
  children: React.ReactNode;
9
8
  isActions?: boolean;
10
9
  isMessage?: boolean;
@@ -19,7 +18,6 @@ export const Row = forwardRef<HTMLDivElement, RowProps>(
19
18
  spacing,
20
19
  isActions = false,
21
20
  isMessage = false,
22
- css,
23
21
  className,
24
22
  // Extract sprinkles props
25
23
  margin,
@@ -124,7 +122,6 @@ export const Row = forwardRef<HTMLDivElement, RowProps>(
124
122
  overflowX,
125
123
  overflowY,
126
124
  }),
127
- css,
128
125
  className
129
126
  )}
130
127
  {...htmlProps}>
@@ -9,7 +9,6 @@ export interface InputProps
9
9
  extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'color' | 'size' | 'height' | 'width'>,
10
10
  Sprinkles,
11
11
  NonNullable<InputVariants> {
12
- css?: string;
13
12
  name: string;
14
13
  type?: InputType;
15
14
  hasError?: boolean;
@@ -23,7 +22,6 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
23
22
  hasError = false,
24
23
  size,
25
24
  variant,
26
- css,
27
25
  className,
28
26
  // Extract sprinkles props
29
27
  margin,
@@ -126,7 +124,6 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
126
124
  overflowX,
127
125
  overflowY,
128
126
  }),
129
- css,
130
127
  className
131
128
  )}
132
129
  data-error={hasError}
@@ -4,7 +4,6 @@ import { labelRecipe, type LabelVariants } from './Label.css';
4
4
  import { sprinkles, type Sprinkles } from '../../../../styles/sprinkles.css';
5
5
 
6
6
  export interface LabelProps extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'color'>, Sprinkles, NonNullable<LabelVariants> {
7
- css?: string;
8
7
  label: string;
9
8
  name: string;
10
9
  required?: boolean;
@@ -18,7 +17,6 @@ export const Label = forwardRef<HTMLLabelElement, LabelProps>(
18
17
  required = false,
19
18
  size,
20
19
  variant,
21
- css,
22
20
  className,
23
21
  // Extract sprinkles props
24
22
  margin,
@@ -119,7 +117,6 @@ export const Label = forwardRef<HTMLLabelElement, LabelProps>(
119
117
  overflowX,
120
118
  overflowY,
121
119
  }),
122
- css,
123
120
  className
124
121
  )}
125
122
  data-required={required}
@@ -6,7 +6,6 @@ import { sprinkles, type Sprinkles } from '../../../styles/sprinkles.css';
6
6
  export type InputType = 'text' | 'email' | 'search' | 'number' | 'hidden' | 'password' | 'textarea';
7
7
 
8
8
  export interface TextFieldProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'>, Sprinkles, NonNullable<TextFieldVariants> {
9
- css?: string;
10
9
  name: string;
11
10
  label?: string;
12
11
  value?: string;
@@ -33,7 +32,6 @@ export const TextField = forwardRef<HTMLDivElement, TextFieldProps>(
33
32
  type = 'text',
34
33
  onChange,
35
34
  size,
36
- css,
37
35
  className,
38
36
  // Extract sprinkles props
39
37
  margin,
@@ -141,7 +139,6 @@ export const TextField = forwardRef<HTMLDivElement, TextFieldProps>(
141
139
  overflowX,
142
140
  overflowY,
143
141
  }),
144
- css,
145
142
  className
146
143
  )}
147
144
  {...htmlProps}>
@@ -7,7 +7,6 @@ export interface TextareaProps
7
7
  extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'color' | 'size'>,
8
8
  Sprinkles,
9
9
  NonNullable<TextareaVariants> {
10
- css?: string;
11
10
  name: string;
12
11
  hasError?: boolean;
13
12
  }
@@ -20,7 +19,6 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
20
19
  size,
21
20
  variant,
22
21
  resize,
23
- css,
24
22
  className,
25
23
  // Extract sprinkles props
26
24
  margin,
@@ -122,7 +120,6 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
122
120
  overflowX,
123
121
  overflowY,
124
122
  }),
125
- css,
126
123
  className
127
124
  )}
128
125
  data-error={hasError}
@@ -1,4 +1,18 @@
1
- // export { Form } from '.';
2
- // export type { FormProps } from '.';
1
+ export { Form, type FormProps } from './Form';
2
+ export { type FormVariants } from './Form.css';
3
3
 
4
- // export { styles as FormStyles } from './styles.css';
4
+ export { Row, type RowProps } from '../Form/Row/Row';
5
+ export { type RowVariants } from '../Form/Row/Row.css';
6
+
7
+ export { TextField, type TextFieldProps, type InputType } from '../Form/TextField/TextField';
8
+ export { type TextFieldVariants } from '../Form/TextField/TextField.css';
9
+
10
+ // Form TextField Subcomponents
11
+ export { Label, type LabelProps } from '../Form/TextField/Label/Label';
12
+ export { type LabelVariants } from '../Form/TextField/Label/Label.css';
13
+
14
+ export { Input, type InputProps, type InputType as InputFieldType } from '../Form/TextField/Input/Input';
15
+ export { type InputVariants } from '../Form/TextField/Input/Input.css';
16
+
17
+ export { Textarea, type TextareaProps } from '../Form/TextField/Textarea/Textarea';
18
+ export { type TextareaVariants } from '../Form/TextField/Textarea/Textarea.css';
@@ -1,4 +1 @@
1
- // export { Header } from '.';
2
- // export type { HeaderProps } from '.';
3
-
4
- // export { styles as HeaderStyles } from './styles.css';
1
+ export { Header, type HeaderProps } from './';
@@ -1,10 +1,9 @@
1
1
  import { clsx } from 'clsx';
2
- import { forwardRef, useState } from 'react';
2
+ import { useState } from 'react';
3
3
 
4
4
  import { headerOverlayRecipe, headerPlaceholder, headerRecipe, headerToggleNav } from './styles.css';
5
5
 
6
6
  export type HeaderProps = React.HTMLAttributes<HTMLDivElement> & {
7
- css?: string;
8
7
  isFixed?: boolean;
9
8
  hideToggleNav?: boolean;
10
9
  children: React.ReactNode;
@@ -12,40 +11,25 @@ export type HeaderProps = React.HTMLAttributes<HTMLDivElement> & {
12
11
  childrenToggleNav?: React.ReactNode;
13
12
  };
14
13
 
15
- export const Header = forwardRef<HTMLDivElement, HeaderProps>(
16
- (
17
- {
18
- children,
19
- childrenOverlay,
20
- childrenToggleNav,
21
- isFixed = false,
22
- hideToggleNav = false,
14
+ export const Header = ({ children, childrenOverlay, childrenToggleNav, isFixed = false, hideToggleNav = false, className }: HeaderProps) => {
15
+ const [isNavOpen, setNavOpen] = useState(false);
16
+ const onToggleNav = () => setNavOpen(!isNavOpen);
23
17
 
24
- css,
25
- className,
26
- },
27
- ref
28
- ) => {
29
- const [isNavOpen, setNavOpen] = useState(false);
18
+ return (
19
+ <>
20
+ <header className={clsx(headerRecipe({ isFixed }), className)}>
21
+ {childrenOverlay && <div className={headerOverlayRecipe({ isOpen: isNavOpen })}>{childrenOverlay}</div>}
30
22
 
31
- const onToggleNav = () => setNavOpen(!isNavOpen);
23
+ {children}
32
24
 
33
- return (
34
- <>
35
- <header ref={ref} className={clsx(headerRecipe({ isFixed }), css, className)}>
36
- {childrenOverlay && <div className={headerOverlayRecipe({ isOpen: isNavOpen })}>{childrenOverlay}</div>}
25
+ {!hideToggleNav && (
26
+ <button onClick={onToggleNav} aria-label="Toggle navigation" className={headerToggleNav}>
27
+ {childrenToggleNav}
28
+ </button>
29
+ )}
30
+ </header>
37
31
 
38
- {children}
39
-
40
- {!hideToggleNav && (
41
- <button onClick={onToggleNav} aria-label="Toggle navigation" className={headerToggleNav}>
42
- {childrenToggleNav}
43
- </button>
44
- )}
45
- </header>
46
-
47
- {isFixed && <div className={headerPlaceholder} />}
48
- </>
49
- );
50
- }
51
- );
32
+ {isFixed && <div className={headerPlaceholder} />}
33
+ </>
34
+ );
35
+ };
@@ -61,11 +61,11 @@ export const headerToggleNav = style([
61
61
 
62
62
  export const headerOverlayRecipe = recipe({
63
63
  base: {
64
- position: 'fixed',
65
64
  inset: 0,
65
+ zIndex: 25,
66
+ position: 'fixed',
66
67
  backgroundColor: 'rgba(0,0,0,0.6)',
67
68
  transition: 'opacity 0.3s ease-in-out, visibility 0.3s ease-in-out',
68
- zIndex: 25,
69
69
  },
70
70
 
71
71
  variants: {
@@ -0,0 +1,51 @@
1
+ const themeHeaderBase = {
2
+ header: {
3
+ fontSize: '1.2em',
4
+ height: {
5
+ mobile: '15px',
6
+ sm: '15px',
7
+ md: '30px',
8
+ lg: '30px',
9
+ xl: '50px',
10
+ '2xl': '50px',
11
+ },
12
+ gap: {
13
+ mobile: '15px',
14
+ sm: '15px',
15
+ md: '30px',
16
+ lg: '30px',
17
+ xl: '50px',
18
+ '2xl': '50px',
19
+ },
20
+ paddingTop: {
21
+ mobile: '15px',
22
+ sm: '15px',
23
+ md: '30px',
24
+ lg: '30px',
25
+ xl: '50px',
26
+ '2xl': '50px',
27
+ },
28
+ paddingBottom: {
29
+ mobile: '15px',
30
+ sm: '15px',
31
+ md: '30px',
32
+ lg: '30px',
33
+ xl: '50px',
34
+ '2xl': '50px',
35
+ },
36
+ },
37
+ };
38
+
39
+ export const themeHeaderLight = {
40
+ header: {
41
+ ...themeHeaderBase.header,
42
+ backgroundColor: '#FF7377',
43
+ },
44
+ };
45
+
46
+ export const themeHeaderDark = {
47
+ header: {
48
+ ...themeHeaderBase.header,
49
+ backgroundColor: '#FF7377',
50
+ },
51
+ };
@@ -0,0 +1 @@
1
+ export { Heading, type HeadingProps } from './';
@@ -1,22 +1,16 @@
1
1
  import { clsx } from 'clsx';
2
- import { forwardRef } from 'react';
3
2
 
4
3
  import { headingRecipe, HeadingVariants } from './styles.css';
5
4
  import { AllowedHeading } from './types';
6
5
 
7
6
  export type HeadingProps = React.HTMLAttributes<HTMLHeadingElement> &
8
7
  HeadingVariants & {
9
- css?: string;
10
8
  as: AllowedHeading;
11
9
  children: React.ReactNode;
12
10
  };
13
11
 
14
- export const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(({ as, size, weight, align, css, className, children }, ref) => {
12
+ export const Heading = ({ as, size, weight, align, className, children }: HeadingProps) => {
15
13
  const Component = as as AllowedHeading;
16
14
 
17
- return (
18
- <Component ref={ref} className={clsx(headingRecipe({ size, weight, align }), css, className)}>
19
- {children}
20
- </Component>
21
- );
22
- });
15
+ return <Component className={clsx(headingRecipe({ size, weight, align }), className)}>{children}</Component>;
16
+ };
@@ -1,4 +1 @@
1
- // export { Icon } from '.';
2
- // export type { IconProps } from '.';
3
-
4
- // export { styles as IconStyles } from './styles.css';
1
+ export { Icon, type IconProps } from './';
@@ -1,24 +1,23 @@
1
- import { CSSProperties } from 'react';
1
+ import clsx from 'clsx';
2
2
 
3
3
  import path from './path';
4
4
 
5
5
  import { iconRecipe } from './style.css';
6
6
  import { themeContract } from '../../theme/contract.css';
7
7
 
8
- export type IconProps = {
8
+ export type IconProps = React.HTMLAttributes<HTMLDivElement> & {
9
9
  icon?: string;
10
10
  size?: number;
11
11
  color?: string;
12
12
  viewBox?: string;
13
13
  iconPath?: string;
14
- styles?: CSSProperties;
15
14
  };
16
15
 
17
- export const Icon = ({ icon = '', size = 24, styles = {}, iconPath = '', color = themeContract.icon.color, viewBox = '0 0 24 24' }: IconProps) => {
16
+ export const Icon = ({ icon = '', className, size = 24, iconPath = '', viewBox = '0 0 24 24', color = themeContract.icon.color }: IconProps) => {
18
17
  const d = iconPath || path[icon as keyof typeof path];
19
18
 
20
19
  return (
21
- <svg className={iconRecipe} viewBox={viewBox} width={`${size}px`} height={`${size}px`} style={styles}>
20
+ <svg className={clsx(iconRecipe, className)} viewBox={viewBox} width={`${size}px`} height={`${size}px`}>
22
21
  <path className={iconPath} d={d} fill={color} />
23
22
  </svg>
24
23
  );
@@ -0,0 +1,17 @@
1
+ const themeIconBase = {
2
+ icon: {},
3
+ };
4
+
5
+ export const themeIconLight = {
6
+ icon: {
7
+ ...themeIconBase.icon,
8
+ color: '#FF7377',
9
+ },
10
+ };
11
+
12
+ export const themeIconDark = {
13
+ icon: {
14
+ ...themeIconBase.icon,
15
+ color: '#FF7377',
16
+ },
17
+ };
@@ -1,4 +1,2 @@
1
- // export { KeyNumber } from '.';
2
- // export type { KeyNumberProps } from '.';
3
-
4
- // export { styles as KeyNumberStyles } from './styles.css';
1
+ export { KeyNumber, type KeyNumberProps } from './';
2
+ export { type KeyNumberVariants } from './styles.css';
@@ -3,6 +3,7 @@
3
3
  import { clsx } from 'clsx';
4
4
  import { forwardRef } from 'react';
5
5
  import CountUp from 'react-countup';
6
+
6
7
  import { useInView } from 'react-intersection-observer';
7
8
 
8
9
  import { keyNumberRecipe, keyNumberValueRecipe, KeyNumberValueVariants, type KeyNumberVariants } from './styles.css';
@@ -10,7 +11,6 @@ import { keyNumberRecipe, keyNumberValueRecipe, KeyNumberValueVariants, type Key
10
11
  export type KeyNumberProps = React.HTMLAttributes<HTMLDivElement> &
11
12
  KeyNumberVariants &
12
13
  KeyNumberValueVariants & {
13
- css?: string;
14
14
  value: number;
15
15
  suffix?: string;
16
16
  prefix?: string;
@@ -21,7 +21,7 @@ export type KeyNumberProps = React.HTMLAttributes<HTMLDivElement> &
21
21
  };
22
22
 
23
23
  export const KeyNumber = forwardRef<HTMLDivElement, KeyNumberProps>(
24
- ({ value, suffix = '', prefix = '', duration = 2, threshold = 0.3, separator = ',', decimals = 0, size, align, vAlign, css, className }, ref) => {
24
+ ({ value, suffix = '', prefix = '', duration = 2, threshold = 0.3, separator = ',', decimals = 0, size, align, vAlign, className }, ref) => {
25
25
  const [inViewRef, inView] = useInView({
26
26
  threshold,
27
27
  triggerOnce: true,
@@ -39,7 +39,7 @@ export const KeyNumber = forwardRef<HTMLDivElement, KeyNumberProps>(
39
39
  }
40
40
  }
41
41
  }}
42
- className={clsx(keyNumberRecipe({ align, vAlign }), css, className)}>
42
+ className={clsx(keyNumberRecipe({ align, vAlign }), className)}>
43
43
  {prefix}&nbsp;
44
44
  <CountUp end={inView ? value : 0} duration={duration} separator={separator} decimals={decimals} className={keyNumberValueRecipe({ size })} />
45
45
  &nbsp;{suffix}
@@ -0,0 +1,22 @@
1
+ const themeKeyNumberBase = {
2
+ keyNumber: {
3
+ fontSize: {
4
+ large: '2.5em',
5
+ xlarge: '4em',
6
+ },
7
+ paddingTop: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
8
+ paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
9
+ },
10
+ };
11
+
12
+ export const themeKeyNumberLight = {
13
+ keyNumber: {
14
+ ...themeKeyNumberBase.keyNumber,
15
+ },
16
+ };
17
+
18
+ export const themeKeyNumberDark = {
19
+ keyNumber: {
20
+ ...themeKeyNumberBase.keyNumber,
21
+ },
22
+ };
@@ -1,4 +1,2 @@
1
- // export { LanguageSwitcher } from '.';
2
- // export type { LanguageSwitcherProps } from '.';
3
-
4
- // export { styles as LanguageSwitcherStyles } from './styles.css';
1
+ export { LanguageSwitcher, type LanguageSwitcherProps, type Locale } from './';
2
+ export { type LanguageSwitcherVariants } from './styles.css';