@purr-react-tailwindcss/components.hamburger-menu 0.0.6 → 0.0.8
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/dist/index.cjs +1 -1
- package/dist/{_types.d.ts → index.d.cts} +6 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +1 -90
- package/package.json +5 -3
- package/dist/_components.d.ts +0 -4
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';var e=require('clsx'),a=require('react'),c=require('@purr-core/hooks.sync-state-with-props');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var e__default=/*#__PURE__*/_interopDefault(e);var a__default=/*#__PURE__*/_interopDefault(a);var c__default=/*#__PURE__*/_interopDefault(c);var g=a.memo(({isStandalone:t=true,active:n=false,onClick:o,htmlAttributes:m,firstBarHTMLAttributes:s,secondBarHTMLAttributes:u,thirdBarHTMLAttributes:l})=>{let{currentValue:r,setCurrentValue:b}=c__default.default(n,t),i=()=>{b(!r),o?.(!r);};return a__default.default.createElement("button",{className:e__default.default("bg-transparent","outline-none","border-none","hamburger-menu",r&&"hamburger-menu--active"),onClick:i,...m},a__default.default.createElement("span",{className:e__default.default("block","w-8","h-1","bg-white","my-1","transition-all","rounded",r&&"translate-y-2 -rotate-45 transform","hamburger-menu__bar"),...s}),a__default.default.createElement("span",{className:e__default.default("block","w-8","h-1","bg-white","my-1","transition-all","rounded",r&&"opacity-0","hamburger-menu__bar"),...u}),a__default.default.createElement("span",{className:e__default.default("block","w-8","h-1","bg-white","my-1","transition-all","rounded",r&&"-translate-y-2 rotate-45 transform","hamburger-menu__bar"),...l}))});g.displayName="HamburgerMenu";exports.HamburgerMenu=g;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes } from 'react';
|
|
1
|
+
import React, { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface IHamburgerMenuProps {
|
|
5
5
|
onClick?: (active: boolean) => void;
|
|
6
6
|
active?: boolean;
|
|
7
7
|
isStandalone?: boolean;
|
|
@@ -10,3 +10,7 @@ export interface IHamburgerMenuProps {
|
|
|
10
10
|
secondBarHTMLAttributes?: ButtonHTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
11
11
|
thirdBarHTMLAttributes?: ButtonHTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
declare const HamburgerMenu: React.MemoExoticComponent<({ isStandalone, active, onClick, htmlAttributes, firstBarHTMLAttributes, secondBarHTMLAttributes, thirdBarHTMLAttributes, }: IHamburgerMenuProps) => React.JSX.Element>;
|
|
15
|
+
|
|
16
|
+
export { HamburgerMenu, type IHamburgerMenuProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React, { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
interface IHamburgerMenuProps {
|
|
5
|
+
onClick?: (active: boolean) => void;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
isStandalone?: boolean;
|
|
8
|
+
htmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
9
|
+
firstBarHTMLAttributes?: ButtonHTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
10
|
+
secondBarHTMLAttributes?: ButtonHTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
11
|
+
thirdBarHTMLAttributes?: ButtonHTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare const HamburgerMenu: React.MemoExoticComponent<({ isStandalone, active, onClick, htmlAttributes, firstBarHTMLAttributes, secondBarHTMLAttributes, thirdBarHTMLAttributes, }: IHamburgerMenuProps) => React.JSX.Element>;
|
|
15
|
+
|
|
16
|
+
export { HamburgerMenu, type IHamburgerMenuProps };
|
package/dist/index.js
CHANGED
|
@@ -1,90 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import r from "clsx";
|
|
3
|
-
import { memo as h } from "react";
|
|
4
|
-
import g from "@purr-core/hooks.sync-state-with-props";
|
|
5
|
-
const p = h(
|
|
6
|
-
({
|
|
7
|
-
isStandalone: n = !0,
|
|
8
|
-
active: s = !1,
|
|
9
|
-
onClick: a,
|
|
10
|
-
htmlAttributes: m,
|
|
11
|
-
firstBarHTMLAttributes: o,
|
|
12
|
-
secondBarHTMLAttributes: u,
|
|
13
|
-
thirdBarHTMLAttributes: l
|
|
14
|
-
}) => {
|
|
15
|
-
const { currentValue: e, setCurrentValue: b } = g(s, n), i = () => {
|
|
16
|
-
b(!e), a == null || a(!e);
|
|
17
|
-
};
|
|
18
|
-
return /* @__PURE__ */ c(
|
|
19
|
-
"button",
|
|
20
|
-
{
|
|
21
|
-
className: r(
|
|
22
|
-
"bg-transparent",
|
|
23
|
-
"outline-none",
|
|
24
|
-
"border-none",
|
|
25
|
-
"hamburger-menu",
|
|
26
|
-
e && "hamburger-menu--active"
|
|
27
|
-
),
|
|
28
|
-
onClick: i,
|
|
29
|
-
...m,
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ t(
|
|
32
|
-
"span",
|
|
33
|
-
{
|
|
34
|
-
className: r(
|
|
35
|
-
"block",
|
|
36
|
-
"w-8",
|
|
37
|
-
"h-1",
|
|
38
|
-
"bg-white",
|
|
39
|
-
"my-1",
|
|
40
|
-
"transition-all",
|
|
41
|
-
"rounded",
|
|
42
|
-
e && "translate-y-2 -rotate-45 transform",
|
|
43
|
-
"hamburger-menu__bar"
|
|
44
|
-
),
|
|
45
|
-
...o
|
|
46
|
-
}
|
|
47
|
-
),
|
|
48
|
-
/* @__PURE__ */ t(
|
|
49
|
-
"span",
|
|
50
|
-
{
|
|
51
|
-
className: r(
|
|
52
|
-
"block",
|
|
53
|
-
"w-8",
|
|
54
|
-
"h-1",
|
|
55
|
-
"bg-white",
|
|
56
|
-
"my-1",
|
|
57
|
-
"transition-all",
|
|
58
|
-
"rounded",
|
|
59
|
-
e && "opacity-0",
|
|
60
|
-
"hamburger-menu__bar"
|
|
61
|
-
),
|
|
62
|
-
...u
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
/* @__PURE__ */ t(
|
|
66
|
-
"span",
|
|
67
|
-
{
|
|
68
|
-
className: r(
|
|
69
|
-
"block",
|
|
70
|
-
"w-8",
|
|
71
|
-
"h-1",
|
|
72
|
-
"bg-white",
|
|
73
|
-
"my-1",
|
|
74
|
-
"transition-all",
|
|
75
|
-
"rounded",
|
|
76
|
-
e && "-translate-y-2 rotate-45 transform",
|
|
77
|
-
"hamburger-menu__bar"
|
|
78
|
-
),
|
|
79
|
-
...l
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
p.displayName = "HamburgerMenu";
|
|
88
|
-
export {
|
|
89
|
-
p as HamburgerMenu
|
|
90
|
-
};
|
|
1
|
+
import e from'clsx';import a,{memo}from'react';import c from'@purr-core/hooks.sync-state-with-props';var g=memo(({isStandalone:t=true,active:n=false,onClick:o,htmlAttributes:m,firstBarHTMLAttributes:s,secondBarHTMLAttributes:u,thirdBarHTMLAttributes:l})=>{let{currentValue:r,setCurrentValue:b}=c(n,t),i=()=>{b(!r),o?.(!r);};return a.createElement("button",{className:e("bg-transparent","outline-none","border-none","hamburger-menu",r&&"hamburger-menu--active"),onClick:i,...m},a.createElement("span",{className:e("block","w-8","h-1","bg-white","my-1","transition-all","rounded",r&&"translate-y-2 -rotate-45 transform","hamburger-menu__bar"),...s}),a.createElement("span",{className:e("block","w-8","h-1","bg-white","my-1","transition-all","rounded",r&&"opacity-0","hamburger-menu__bar"),...u}),a.createElement("span",{className:e("block","w-8","h-1","bg-white","my-1","transition-all","rounded",r&&"-translate-y-2 rotate-45 transform","hamburger-menu__bar"),...l}))});g.displayName="HamburgerMenu";export{g as HamburgerMenu};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-tailwindcss/components.hamburger-menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"typescript": "*",
|
|
25
25
|
"react": "*",
|
|
26
26
|
"clsx": "*",
|
|
27
|
-
"@purr-core/utils.definitions": "0.0.
|
|
28
|
-
"@purr-core/hooks.sync-state-with-props": "0.0.
|
|
27
|
+
"@purr-core/utils.definitions": "0.0.12",
|
|
28
|
+
"@purr-core/hooks.sync-state-with-props": "0.0.9"
|
|
29
29
|
},
|
|
30
30
|
"author": "@DinhThienPhuc",
|
|
31
31
|
"license": "ISC",
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"dev": "vite build --watch",
|
|
36
36
|
"build": "tsc && vite build",
|
|
37
|
+
"build:vite": "tsc && vite build",
|
|
38
|
+
"build:tsup": "tsup",
|
|
37
39
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
38
40
|
}
|
|
39
41
|
}
|
package/dist/_components.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { IHamburgerMenuProps } from './_types';
|
|
3
|
-
|
|
4
|
-
export declare const HamburgerMenu: React.MemoExoticComponent<({ isStandalone, active, onClick, htmlAttributes, firstBarHTMLAttributes, secondBarHTMLAttributes, thirdBarHTMLAttributes, }: IHamburgerMenuProps) => React.JSX.Element>;
|