@purr-react-styled-components/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<({ gap, width, height, borderRadius, color, isStandalone, active, className, onClick, htmlAttributes, }: IHamburgerMenuProps) => React.JSX.Element>;
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,15 @@
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { IExtendable } from '@purr-core/utils.definitions';
3
+
4
+ export 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
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),g=require("clsx"),y=require("react"),_=require("@purr-core/hooks.sync-state-with-props"),s=require("styled-components"),$=require("@purr-react-styled-components/utils.helpers"),u={Container:s.button.withConfig({displayName:"_style__Container",componentId:"sc-10gsfr3-0"})(["",""],$.getInvisibleButton),Bar:s.span.withConfig({displayName:"_style__Bar",componentId:"sc-10gsfr3-1"})(["display:block;width:","px;height:","px;background-color:",";margin:","px 0px;transition:0.4s;border-radius:","px;&:nth-child(1){","}&:nth-child(2){","}&:nth-child(3){","}"],({$width:e})=>e,({$height:e,$gap:r})=>(e-4*r)/3,({$color:e})=>e,({$gap:e})=>e,({$borderRadius:e})=>e,({$isActivated:e,$height:r,$gap:t})=>e&&s.css(["transform:translate(0,","px) rotate(-45deg);"],(r-t)/3),({$isActivated:e})=>e&&s.css(["opacity:0;"]),({$isActivated:e,$height:r,$gap:t})=>e&&s.css(["transform:translate(0,-","px) rotate(45deg);"],(r-t)/3))},l=y.memo(({gap:e=5,width:r=32,height:t=32,borderRadius:c=4,color:m="#ffffff",isStandalone:h=!0,active:d=!1,className:b,onClick:i,htmlAttributes:p})=>{const{currentValue:a,setCurrentValue:f}=_(d,h),x=()=>{f(!a),i==null||i(!a)},o={$isActivated:a,$gap:e,$width:r,$height:t,$borderRadius:c,$color:m,className:g("hamburger-menu__bar",a&&"hamburger-menu__bar--active")};return n.jsxs(u.Container,{...p,className:g("hamburger-menu",`hamburger-menu--gap-${e}`,`hamburger-menu--width-${r}`,`hamburger-menu--height-${t}`,`hamburger-menu--border-radius-${c}`,`hamburger-menu--color-${m}`,a&&"hamburger-menu--active",b),onClick:x,children:[n.jsx(u.Bar,{...o}),n.jsx(u.Bar,{...o}),n.jsx(u.Bar,{...o})]})});l.displayName="HamburgerMenu";exports.HamburgerMenu=l;
@@ -0,0 +1,2 @@
1
+ export * from './_components';
2
+ export * from './_types';
package/dist/index.js ADDED
@@ -0,0 +1,72 @@
1
+ import { jsxs as $, jsx as s } from "react/jsx-runtime";
2
+ import h from "clsx";
3
+ import { memo as y } from "react";
4
+ import _ from "@purr-core/hooks.sync-state-with-props";
5
+ import g, { css as i } from "styled-components";
6
+ import { getInvisibleButton as v } from "@purr-react-styled-components/utils.helpers";
7
+ const n = {
8
+ Container: g.button.withConfig({
9
+ displayName: "_style__Container",
10
+ componentId: "sc-10gsfr3-0"
11
+ })(["", ""], v),
12
+ Bar: g.span.withConfig({
13
+ displayName: "_style__Bar",
14
+ componentId: "sc-10gsfr3-1"
15
+ })(["display:block;width:", "px;height:", "px;background-color:", ";margin:", "px 0px;transition:0.4s;border-radius:", "px;&:nth-child(1){", "}&:nth-child(2){", "}&:nth-child(3){", "}"], ({
16
+ $width: r
17
+ }) => r, ({
18
+ $height: r,
19
+ $gap: e
20
+ }) => (r - 4 * e) / 3, ({
21
+ $color: r
22
+ }) => r, ({
23
+ $gap: r
24
+ }) => r, ({
25
+ $borderRadius: r
26
+ }) => r, ({
27
+ $isActivated: r,
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 = "#ffffff",
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
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@purr-react-styled-components/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
+ "styled-components": "*",
27
+ "clsx": "*",
28
+ "@purr-core/utils.definitions": "0.0.4",
29
+ "@purr-core/hooks.sync-state-with-props": "0.0.2",
30
+ "@purr-react-styled-components/utils.helpers": "0.0.1"
31
+ },
32
+ "author": "@DinhThienPhuc",
33
+ "license": "ISC",
34
+ "description": "",
35
+ "sideEffects": false,
36
+ "scripts": {
37
+ "dev": "vite build --watch",
38
+ "build": "tsc && vite build",
39
+ "lint": "eslint . --ext ts,tsx --max-warnings 0"
40
+ }
41
+ }