@latte-macchiat-io/latte-vanilla-components 0.0.212 → 0.0.214

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.212",
3
+ "version": "0.0.214",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,17 +1,17 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { useState } from 'react';
3
3
 
4
- import { headerOverlayRecipe, headerPlaceholder, headerRecipe, headerToggleNav } from './styles.css';
4
+ import { headerOverlayRecipe, headerPlaceholder, headerRecipe, headerToggleNav, HeaderToggleNavVariants } from './styles.css';
5
5
 
6
- export type HeaderProps = React.HTMLAttributes<HTMLDivElement> & {
7
- isFixed?: boolean;
8
- hideToggleNav?: boolean;
9
- children: React.ReactNode;
10
- childrenOverlay?: React.ReactNode;
11
- childrenToggleNav?: React.ReactNode;
12
- };
6
+ export type HeaderProps = React.HTMLAttributes<HTMLDivElement> &
7
+ HeaderToggleNavVariants & {
8
+ isFixed?: boolean;
9
+ children: React.ReactNode;
10
+ childrenOverlay?: React.ReactNode;
11
+ childrenToggleNav?: React.ReactNode;
12
+ };
13
13
 
14
- export const Header = ({ children, childrenOverlay, childrenToggleNav, isFixed = false, hideToggleNav = false, className }: HeaderProps) => {
14
+ export const Header = ({ children, childrenOverlay, childrenToggleNav, isFixed = false, toggleNavVisibility, className }: HeaderProps) => {
15
15
  const [isNavOpen, setNavOpen] = useState(false);
16
16
  const onToggleNav = () => setNavOpen(!isNavOpen);
17
17
 
@@ -22,8 +22,8 @@ export const Header = ({ children, childrenOverlay, childrenToggleNav, isFixed =
22
22
 
23
23
  {children}
24
24
 
25
- {!hideToggleNav && (
26
- <button onClick={onToggleNav} aria-label="Toggle navigation" className={headerToggleNav}>
25
+ {toggleNavVisibility !== 'hide' && (
26
+ <button onClick={onToggleNav} aria-label="Toggle navigation" className={headerToggleNav({ toggleNavVisibility })}>
27
27
  {childrenToggleNav}
28
28
  </button>
29
29
  )}
@@ -1,6 +1,6 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { recipe } from '@vanilla-extract/recipes';
3
- import { themeContract } from '../..';
3
+ import { queries, themeContract } from '../..';
4
4
  import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const headerRecipe = recipe({
@@ -52,13 +52,6 @@ export const headerPlaceholder = style([
52
52
  },
53
53
  ]);
54
54
 
55
- export const headerToggleNav = style([
56
- {
57
- border: 0,
58
- zIndex: 30,
59
- },
60
- ]);
61
-
62
55
  export const headerOverlayRecipe = recipe({
63
56
  base: {
64
57
  inset: 0,
@@ -86,4 +79,30 @@ export const headerOverlayRecipe = recipe({
86
79
  },
87
80
  });
88
81
 
82
+ export const headerToggleNav = recipe({
83
+ base: {
84
+ border: 0,
85
+ zIndex: 30,
86
+ },
87
+
88
+ variants: {
89
+ toggleNavVisibility: {
90
+ show: { display: 'block' },
91
+ hide: { display: 'none' },
92
+ mobileOnly: {
93
+ display: 'block',
94
+ '@media': {
95
+ [queries.md]: {
96
+ display: 'none',
97
+ },
98
+ },
99
+ },
100
+ },
101
+ },
102
+ defaultVariants: {
103
+ toggleNavVisibility: 'mobileOnly',
104
+ },
105
+ });
106
+
107
+ export type HeaderToggleNavVariants = Parameters<typeof headerToggleNav>[0];
89
108
  export type HeaderOverlayVariants = Parameters<typeof headerOverlayRecipe>[0];