@purr-react-styled-components/components.hamburger-menu 0.0.7 → 0.0.9
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 +27 -1
- package/dist/{_types.d.ts → index.d.cts} +6 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +27 -72
- package/package.json +6 -4
- package/dist/_components.d.ts +0 -4
- package/dist/_style.d.ts +0 -11
package/dist/index.cjs
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';var p=require('clsx'),n=require('react'),v=require('@purr-core/hooks.sync-state-with-props'),b=require('styled-components'),utils_helpers=require('@purr-react-styled-components/utils.helpers');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var p__default=/*#__PURE__*/_interopDefault(p);var n__default=/*#__PURE__*/_interopDefault(n);var v__default=/*#__PURE__*/_interopDefault(v);var b__default=/*#__PURE__*/_interopDefault(b);var a={Container:b__default.default.button`
|
|
2
|
+
${utils_helpers.getInvisibleButton}
|
|
3
|
+
`,Bar:b__default.default.span`
|
|
4
|
+
display: block;
|
|
5
|
+
width: ${({$width:r})=>r}px;
|
|
6
|
+
height: ${({$height:r,$gap:e})=>(r-4*e)/3}px;
|
|
7
|
+
background-color: ${({$color:r})=>r};
|
|
8
|
+
margin: ${({$gap:r})=>r}px 0px;
|
|
9
|
+
transition: 0.4s;
|
|
10
|
+
border-radius: ${({$borderRadius:r})=>r}px;
|
|
11
|
+
|
|
12
|
+
&:nth-child(1) {
|
|
13
|
+
${({$isActivated:r,$height:e,$gap:t})=>r&&b.css`
|
|
14
|
+
transform: translate(0, ${(e-t)/3}px) rotate(-45deg);
|
|
15
|
+
`}
|
|
16
|
+
}
|
|
17
|
+
&:nth-child(2) {
|
|
18
|
+
${({$isActivated:r})=>r&&b.css`
|
|
19
|
+
opacity: 0;
|
|
20
|
+
`}
|
|
21
|
+
}
|
|
22
|
+
&:nth-child(3) {
|
|
23
|
+
${({$isActivated:r,$height:e,$gap:t})=>r&&b.css`
|
|
24
|
+
transform: translate(0, -${(e-t)/3}px) rotate(45deg);
|
|
25
|
+
`}
|
|
26
|
+
}
|
|
27
|
+
`};var B=n.memo(({gap:r=5,width:e=32,height:t=32,borderRadius:i=4,color:s="#000000",isStandalone:$=true,active:l=false,className:g,onClick:h,htmlAttributes:d})=>{let{currentValue:o,setCurrentValue:c}=v__default.default(l,$),f=()=>{c(!o),h?.(!o);},m={$isActivated:o,$gap:r,$width:e,$height:t,$borderRadius:i,$color:s,className:p__default.default("hamburger-menu__bar",o&&"hamburger-menu__bar--active")};return n__default.default.createElement(a.Container,{...d,className:p__default.default("hamburger-menu",`hamburger-menu--gap-${r}`,`hamburger-menu--width-${e}`,`hamburger-menu--height-${t}`,`hamburger-menu--border-radius-${i}`,`hamburger-menu--color-${s}`,o&&"hamburger-menu--active",g),onClick:f},n__default.default.createElement(a.Bar,{...m}),n__default.default.createElement(a.Bar,{...m}),n__default.default.createElement(a.Bar,{...m}))});B.displayName="HamburgerMenu";exports.HamburgerMenu=B;
|
|
@@ -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
|
gap?: number;
|
|
6
6
|
width?: number;
|
|
7
7
|
height?: number;
|
|
@@ -13,3 +13,7 @@ export interface IHamburgerMenuProps {
|
|
|
13
13
|
isStandalone?: boolean;
|
|
14
14
|
htmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
declare const HamburgerMenu: React.MemoExoticComponent<({ gap, width, height, borderRadius, color, isStandalone, active, className, onClick, htmlAttributes, }: IHamburgerMenuProps) => React.JSX.Element>;
|
|
18
|
+
|
|
19
|
+
export { HamburgerMenu, type IHamburgerMenuProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React, { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
+
|
|
4
|
+
interface IHamburgerMenuProps {
|
|
5
|
+
gap?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
borderRadius?: number;
|
|
9
|
+
onClick?: (active: boolean) => void;
|
|
10
|
+
color?: string;
|
|
11
|
+
active?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
isStandalone?: boolean;
|
|
14
|
+
htmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const HamburgerMenu: React.MemoExoticComponent<({ gap, width, height, borderRadius, color, isStandalone, active, className, onClick, htmlAttributes, }: IHamburgerMenuProps) => React.JSX.Element>;
|
|
18
|
+
|
|
19
|
+
export { HamburgerMenu, type IHamburgerMenuProps };
|
package/dist/index.js
CHANGED
|
@@ -1,72 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
$height: e,
|
|
29
|
-
$gap: t
|
|
30
|
-
}) => r && i(["transform:translate(0,", "px) rotate(-45deg);"], (e - t) / 3), ({
|
|
31
|
-
$isActivated: r
|
|
32
|
-
}) => r && i(["opacity:0;"]), ({
|
|
33
|
-
$isActivated: r,
|
|
34
|
-
$height: e,
|
|
35
|
-
$gap: t
|
|
36
|
-
}) => r && i(["transform:translate(0,-", "px) rotate(45deg);"], (e - t) / 3))
|
|
37
|
-
}, B = y(({
|
|
38
|
-
gap: r = 5,
|
|
39
|
-
width: e = 32,
|
|
40
|
-
height: t = 32,
|
|
41
|
-
borderRadius: u = 4,
|
|
42
|
-
color: c = "#000000",
|
|
43
|
-
isStandalone: p = !0,
|
|
44
|
-
active: d = !1,
|
|
45
|
-
className: l,
|
|
46
|
-
onClick: m,
|
|
47
|
-
htmlAttributes: b
|
|
48
|
-
}) => {
|
|
49
|
-
const {
|
|
50
|
-
currentValue: a,
|
|
51
|
-
setCurrentValue: f
|
|
52
|
-
} = _(d, p), x = () => {
|
|
53
|
-
f(!a), m == null || m(!a);
|
|
54
|
-
}, o = {
|
|
55
|
-
$isActivated: a,
|
|
56
|
-
$gap: r,
|
|
57
|
-
$width: e,
|
|
58
|
-
$height: t,
|
|
59
|
-
$borderRadius: u,
|
|
60
|
-
$color: c,
|
|
61
|
-
className: h("hamburger-menu__bar", a && "hamburger-menu__bar--active")
|
|
62
|
-
};
|
|
63
|
-
return /* @__PURE__ */ $(n.Container, { ...b, className: h("hamburger-menu", `hamburger-menu--gap-${r}`, `hamburger-menu--width-${e}`, `hamburger-menu--height-${t}`, `hamburger-menu--border-radius-${u}`, `hamburger-menu--color-${c}`, a && "hamburger-menu--active", l), onClick: x, children: [
|
|
64
|
-
/* @__PURE__ */ s(n.Bar, { ...o }),
|
|
65
|
-
/* @__PURE__ */ s(n.Bar, { ...o }),
|
|
66
|
-
/* @__PURE__ */ s(n.Bar, { ...o })
|
|
67
|
-
] });
|
|
68
|
-
});
|
|
69
|
-
B.displayName = "HamburgerMenu";
|
|
70
|
-
export {
|
|
71
|
-
B as HamburgerMenu
|
|
72
|
-
};
|
|
1
|
+
import p from'clsx';import n,{memo}from'react';import v from'@purr-core/hooks.sync-state-with-props';import b,{css}from'styled-components';import {getInvisibleButton}from'@purr-react-styled-components/utils.helpers';var a={Container:b.button`
|
|
2
|
+
${getInvisibleButton}
|
|
3
|
+
`,Bar:b.span`
|
|
4
|
+
display: block;
|
|
5
|
+
width: ${({$width:r})=>r}px;
|
|
6
|
+
height: ${({$height:r,$gap:e})=>(r-4*e)/3}px;
|
|
7
|
+
background-color: ${({$color:r})=>r};
|
|
8
|
+
margin: ${({$gap:r})=>r}px 0px;
|
|
9
|
+
transition: 0.4s;
|
|
10
|
+
border-radius: ${({$borderRadius:r})=>r}px;
|
|
11
|
+
|
|
12
|
+
&:nth-child(1) {
|
|
13
|
+
${({$isActivated:r,$height:e,$gap:t})=>r&&css`
|
|
14
|
+
transform: translate(0, ${(e-t)/3}px) rotate(-45deg);
|
|
15
|
+
`}
|
|
16
|
+
}
|
|
17
|
+
&:nth-child(2) {
|
|
18
|
+
${({$isActivated:r})=>r&&css`
|
|
19
|
+
opacity: 0;
|
|
20
|
+
`}
|
|
21
|
+
}
|
|
22
|
+
&:nth-child(3) {
|
|
23
|
+
${({$isActivated:r,$height:e,$gap:t})=>r&&css`
|
|
24
|
+
transform: translate(0, -${(e-t)/3}px) rotate(45deg);
|
|
25
|
+
`}
|
|
26
|
+
}
|
|
27
|
+
`};var B=memo(({gap:r=5,width:e=32,height:t=32,borderRadius:i=4,color:s="#000000",isStandalone:$=true,active:l=false,className:g,onClick:h,htmlAttributes:d})=>{let{currentValue:o,setCurrentValue:c}=v(l,$),f=()=>{c(!o),h?.(!o);},m={$isActivated:o,$gap:r,$width:e,$height:t,$borderRadius:i,$color:s,className:p("hamburger-menu__bar",o&&"hamburger-menu__bar--active")};return n.createElement(a.Container,{...d,className:p("hamburger-menu",`hamburger-menu--gap-${r}`,`hamburger-menu--width-${e}`,`hamburger-menu--height-${t}`,`hamburger-menu--border-radius-${i}`,`hamburger-menu--color-${s}`,o&&"hamburger-menu--active",g),onClick:f},n.createElement(a.Bar,{...m}),n.createElement(a.Bar,{...m}),n.createElement(a.Bar,{...m}))});B.displayName="HamburgerMenu";export{B as HamburgerMenu};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-styled-components/components.hamburger-menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"react-dom": "*",
|
|
27
27
|
"styled-components": "*",
|
|
28
28
|
"clsx": "*",
|
|
29
|
-
"@purr-core/utils.definitions": "0.0.
|
|
30
|
-
"@purr-react-styled-components/utils.helpers": "0.0.
|
|
31
|
-
"@purr-core/hooks.sync-state-with-props": "0.0.
|
|
29
|
+
"@purr-core/utils.definitions": "0.0.12",
|
|
30
|
+
"@purr-react-styled-components/utils.helpers": "0.0.8",
|
|
31
|
+
"@purr-core/hooks.sync-state-with-props": "0.0.9"
|
|
32
32
|
},
|
|
33
33
|
"author": "@DinhThienPhuc",
|
|
34
34
|
"license": "ISC",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "vite build --watch",
|
|
39
39
|
"build": "tsc && vite build",
|
|
40
|
+
"build:vite": "tsc && vite build",
|
|
41
|
+
"build:tsup": "tsup",
|
|
40
42
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
41
43
|
}
|
|
42
44
|
}
|
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<({ gap, width, height, borderRadius, color, isStandalone, active, className, onClick, htmlAttributes, }: IHamburgerMenuProps) => React.JSX.Element>;
|
package/dist/_style.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const Styled: {
|
|
2
|
-
Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
3
|
-
Bar: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
4
|
-
$isActivated: boolean;
|
|
5
|
-
$gap: number;
|
|
6
|
-
$width: number;
|
|
7
|
-
$height: number;
|
|
8
|
-
$borderRadius: number;
|
|
9
|
-
$color: string;
|
|
10
|
-
}>> & string;
|
|
11
|
-
};
|