@purr-react-tailwindcss/components.hamburger-menu 0.0.1

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