@nimbus-ds/menubutton 1.0.0-rc.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ MenuButton component is meant to be used inside Menus and navigation, and allows the user to navigate between different sections of an application.
4
+
5
+ ## 2023-02-10 `1.0.0`
6
+
7
+ ### 📚 3rd party library updates
8
+
9
+ - Added `@nimbus-ds/icon@2.0.0`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
10
+ - Added `@nimbus-ds/box@2.4.0`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
11
+ - Added `@nimbus-ds/text@5.0.0`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
12
+ - Added `@nimbus-ds/tokens@6.0.1`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
13
+ - Added `@tiendanube/icons@0.3.2`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
14
+
15
+ ### 🎉 New features
16
+
17
+ - Added `MenuButton` component. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
18
+ - Added `label`, `onClick`, `startIcon`, `active` and `children` properties to the `MenuButton` component API. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
19
+ - Added story documentation in Storybook. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # `@nimbus-ds/menubutton`
2
+
3
+ [![@nimbus-ds/menubutton](https://img.shields.io/npm/v/@nimbus-ds/menubutton?label=%40nimbus-ds%2Fmenubutton)](https://www.npmjs.com/package/@nimbus-ds/menubutton)
4
+
5
+ MenuButton component is meant to be used inside Menus and navigation, and allows the user to navigate between different sections of an application.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ $ yarn add @nimbus-ds/menubutton
11
+ # or
12
+ $ npm install @nimbus-ds/menubutton
13
+ ```
@@ -0,0 +1,13 @@
1
+ import React, { ButtonHTMLAttributes, ReactNode } from "react";
2
+ import { Icon } from "@tiendanube/icons";
3
+ export interface MenuButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
+ label: string;
5
+ onClick?: () => void;
6
+ startIcon?: Icon;
7
+ active?: boolean;
8
+ children?: ReactNode;
9
+ }
10
+ export const MenuButton: React.FC<MenuButtonProps>;
11
+ export default MenuButton;
12
+
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAIA,gCACE,SAAQ,qBAAqB,iBAAiB,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,IAAQ,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;ACHD,OAAA,MAAM,YAAY,MAAM,EAAE,CAAC,eAAe,CAoDzC,CAAC;ACxDF,eAAe,UAAU,CAAC","sources":["packages/react/MenuButton/src/packages/react/MenuButton/src/menuButton.types.ts","packages/react/MenuButton/src/packages/react/MenuButton/src/MenuButton.tsx","packages/react/MenuButton/src/packages/react/MenuButton/src/index.ts","packages/react/MenuButton/src/index.ts"],"sourcesContent":[null,null,null,"import { MenuButton } from \"./MenuButton\";\n\nexport { MenuButton } from \"./MenuButton\";\nexport type { MenuButtonProps } from \"./menuButton.types\";\nexport default MenuButton;\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js ADDED
@@ -0,0 +1,73 @@
1
+ var $kFxFh$react = require("react");
2
+ var $kFxFh$nimbusdstext = require("@nimbus-ds/text");
3
+ var $kFxFh$nimbusdsicon = require("@nimbus-ds/icon");
4
+ var $kFxFh$nimbusdsbox = require("@nimbus-ds/box");
5
+
6
+ function $parcel$defineInteropFlag(a) {
7
+ Object.defineProperty(a, '__esModule', {value: true, configurable: true});
8
+ }
9
+ function $parcel$export(e, n, v, s) {
10
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
11
+ }
12
+ function $parcel$interopDefault(a) {
13
+ return a && a.__esModule ? a.default : a;
14
+ }
15
+
16
+ $parcel$defineInteropFlag(module.exports);
17
+
18
+ $parcel$export(module.exports, "default", () => $c1118e38a3916ade$export$2e2bcd8739ae039);
19
+ $parcel$export(module.exports, "MenuButton", () => $7f667c33a97c600f$export$266a769812832828);
20
+
21
+
22
+
23
+
24
+ const $7f667c33a97c600f$export$266a769812832828 = ({ className: _className , style: _style , label: label , onClick: onClick , startIcon: IconSrc , children: children , active: active = false , ...rest })=>{
25
+ const activeColor = active ? "primary.interactive" : "primary.textHigh";
26
+ const disabledColor = rest.disabled ? "neutral.textDisabled" : activeColor;
27
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($kFxFh$react))).createElement((0, $kFxFh$nimbusdsbox.Box), {
28
+ ...rest,
29
+ as: "button",
30
+ type: "button",
31
+ onClick: onClick,
32
+ alignItems: "center",
33
+ backgroundColor: {
34
+ xs: active ? "primary.surface" : "transparent",
35
+ hover: "primary.surface",
36
+ active: "primary.surfaceHighlight",
37
+ disabled: "neutral.surfaceDisabled"
38
+ },
39
+ boxShadow: {
40
+ focus: "focusRing"
41
+ },
42
+ borderRadius: ".5rem",
43
+ borderWidth: "0",
44
+ cursor: {
45
+ xs: "pointer",
46
+ disabled: "not-allowed"
47
+ },
48
+ display: "flex",
49
+ gap: "2",
50
+ padding: "2",
51
+ width: "100%",
52
+ transitionProperty: "all",
53
+ transitionDuration: "base",
54
+ transitionTimingFunction: "ease-in-out"
55
+ }, IconSrc && /*#__PURE__*/ (0, ($parcel$interopDefault($kFxFh$react))).createElement((0, $kFxFh$nimbusdsicon.Icon), {
56
+ color: disabledColor,
57
+ source: /*#__PURE__*/ (0, ($parcel$interopDefault($kFxFh$react))).createElement(IconSrc, null)
58
+ }), /*#__PURE__*/ (0, ($parcel$interopDefault($kFxFh$react))).createElement((0, $kFxFh$nimbusdsbox.Box), {
59
+ display: "inline-flex",
60
+ flex: "1"
61
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($kFxFh$react))).createElement((0, $kFxFh$nimbusdstext.Text), {
62
+ fontSize: "base",
63
+ color: disabledColor
64
+ }, label)), children);
65
+ };
66
+ $7f667c33a97c600f$export$266a769812832828.displayName = "MenuButton";
67
+
68
+
69
+
70
+ var $c1118e38a3916ade$export$2e2bcd8739ae039 = (0, $7f667c33a97c600f$export$266a769812832828);
71
+
72
+
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;ACAA;;;;AAQA,MAAM,4CAAwC,CAAC,EAC7C,WAAW,WAAU,EACrB,OAAO,OAAM,SACb,MAAK,WACL,QAAO,EACP,WAAW,QAAO,YAClB,SAAQ,UACR,SAAS,KAAK,GACd,GAAG,MACa,GATlB;IAUE,MAAM,cAAc,SAAS,wBAAwB,kBAAkB;IACvE,MAAM,gBAAgB,KAAK,QAAQ,GAAG,yBAAyB,WAAW;IAE1E,qBACE,CAAA,GAAA,sCAAA,EAAA,aAAA,CAAC,CAAA,GAAA,sBAAG,AAAH,GAAG;QAAA,GACE,IAAI;QACR,IAAG;QACH,MAAK;QACL,SAAS;QACT,YAAW;QACX,iBAAiB;YACf,IAAI,SAAS,oBAAoB,aAAa;YAC9C,OAAO;YACP,QAAQ;YACR,UAAU;QACX;QACD,WAAW;YACT,OAAO;QACR;QACD,cAAa;QACb,aAAY;QACZ,QAAQ;YACN,IAAI;YACJ,UAAU;QACX;QACD,SAAQ;QACR,KAAI;QACJ,SAAQ;QACR,OAAM;QACN,oBAAmB;QACnB,oBAAmB;QACnB,0BAAyB;IAPxB,GASA,yBAAW,CAAA,GAAA,sCAAA,AAAA,EAAA,aAAA,CAAC,CAAA,GAAA,wBAAA,GAAI;QAAC,OAAO;QAAe,sBAAQ,CAAA,GAAA,sCAAA,EAAA,aAAA,CAAC,SAAO,IAAA;IAAG,kBAC3D,CAAA,GAAA,sCAAA,EAAA,aAAA,CAAC,CAAA,GAAA,sBAAG,AAAH,GAAG;QAAC,SAAQ;QAAc,MAAK;IAAhC,iBACE,CAAA,GAAA,sCAAA,EAAA,aAAA,CAAC,CAAA,GAAA,wBAAI,AAAJ,GAAI;QAAC,UAAS;QAAO,OAAO;IAAa,GACvC,SAGJ;AAGP;AAEA,0CAAW,WAAW,GAAG;;AD9DzB;;IAIA,2CAAe,CAAA,GAAA,yCAAA","sources":["packages/react/MenuButton/src/index.ts","packages/react/MenuButton/src/MenuButton.tsx"],"sourcesContent":["import { MenuButton } from \"./MenuButton\";\n\nexport { MenuButton } from \"./MenuButton\";\nexport type { MenuButtonProps } from \"./menuButton.types\";\nexport default MenuButton;\n","import React from \"react\";\n\nimport { Text } from \"@nimbus-ds/text\";\nimport { Icon } from \"@nimbus-ds/icon\";\nimport { Box } from \"@nimbus-ds/box\";\n\nimport { MenuButtonProps } from \"./menuButton.types\";\n\nconst MenuButton: React.FC<MenuButtonProps> = ({\n className: _className,\n style: _style,\n label,\n onClick,\n startIcon: IconSrc,\n children,\n active = false,\n ...rest\n}: MenuButtonProps) => {\n const activeColor = active ? \"primary.interactive\" : \"primary.textHigh\";\n const disabledColor = rest.disabled ? \"neutral.textDisabled\" : activeColor;\n\n return (\n <Box\n {...rest}\n as=\"button\"\n type=\"button\"\n onClick={onClick}\n alignItems=\"center\"\n backgroundColor={{\n xs: active ? \"primary.surface\" : \"transparent\",\n hover: \"primary.surface\",\n active: \"primary.surfaceHighlight\",\n disabled: \"neutral.surfaceDisabled\"\n }}\n boxShadow={{\n focus: \"focusRing\"\n }}\n borderRadius=\".5rem\"\n borderWidth=\"0\"\n cursor={{\n xs: \"pointer\",\n disabled: \"not-allowed\"\n }}\n display=\"flex\"\n gap=\"2\"\n padding=\"2\"\n width=\"100%\"\n transitionProperty=\"all\"\n transitionDuration=\"base\"\n transitionTimingFunction=\"ease-in-out\"\n >\n {IconSrc && <Icon color={disabledColor} source={<IconSrc />} />}\n <Box display=\"inline-flex\" flex=\"1\">\n <Text fontSize=\"base\" color={disabledColor}>\n {label}\n </Text>\n </Box>\n {children}\n </Box>\n );\n};\n\nMenuButton.displayName = \"MenuButton\";\n\nexport { MenuButton };\n"],"names":[],"version":3,"file":"index.js.map"}
@@ -0,0 +1,60 @@
1
+ import $hq6vK$react from "react";
2
+ import {Text as $hq6vK$Text} from "@nimbus-ds/text";
3
+ import {Icon as $hq6vK$Icon} from "@nimbus-ds/icon";
4
+ import {Box as $hq6vK$Box} from "@nimbus-ds/box";
5
+
6
+
7
+
8
+
9
+
10
+ const $a1957ce755237e22$export$266a769812832828 = ({ className: _className , style: _style , label: label , onClick: onClick , startIcon: IconSrc , children: children , active: active = false , ...rest })=>{
11
+ const activeColor = active ? "primary.interactive" : "primary.textHigh";
12
+ const disabledColor = rest.disabled ? "neutral.textDisabled" : activeColor;
13
+ return /*#__PURE__*/ (0, $hq6vK$react).createElement((0, $hq6vK$Box), {
14
+ ...rest,
15
+ as: "button",
16
+ type: "button",
17
+ onClick: onClick,
18
+ alignItems: "center",
19
+ backgroundColor: {
20
+ xs: active ? "primary.surface" : "transparent",
21
+ hover: "primary.surface",
22
+ active: "primary.surfaceHighlight",
23
+ disabled: "neutral.surfaceDisabled"
24
+ },
25
+ boxShadow: {
26
+ focus: "focusRing"
27
+ },
28
+ borderRadius: ".5rem",
29
+ borderWidth: "0",
30
+ cursor: {
31
+ xs: "pointer",
32
+ disabled: "not-allowed"
33
+ },
34
+ display: "flex",
35
+ gap: "2",
36
+ padding: "2",
37
+ width: "100%",
38
+ transitionProperty: "all",
39
+ transitionDuration: "base",
40
+ transitionTimingFunction: "ease-in-out"
41
+ }, IconSrc && /*#__PURE__*/ (0, $hq6vK$react).createElement((0, $hq6vK$Icon), {
42
+ color: disabledColor,
43
+ source: /*#__PURE__*/ (0, $hq6vK$react).createElement(IconSrc, null)
44
+ }), /*#__PURE__*/ (0, $hq6vK$react).createElement((0, $hq6vK$Box), {
45
+ display: "inline-flex",
46
+ flex: "1"
47
+ }, /*#__PURE__*/ (0, $hq6vK$react).createElement((0, $hq6vK$Text), {
48
+ fontSize: "base",
49
+ color: disabledColor
50
+ }, label)), children);
51
+ };
52
+ $a1957ce755237e22$export$266a769812832828.displayName = "MenuButton";
53
+
54
+
55
+
56
+ var $25a6c93e757f45de$export$2e2bcd8739ae039 = (0, $a1957ce755237e22$export$266a769812832828);
57
+
58
+
59
+ export {$25a6c93e757f45de$export$2e2bcd8739ae039 as default, $a1957ce755237e22$export$266a769812832828 as MenuButton};
60
+ //# sourceMappingURL=index.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;ACAA;;;;AAQA,MAAM,4CAAwC,CAAC,EAC7C,WAAW,WAAU,EACrB,OAAO,OAAM,SACb,MAAK,WACL,QAAO,EACP,WAAW,QAAO,YAClB,SAAQ,UACR,SAAS,KAAK,GACd,GAAG,MACa,GATlB;IAUE,MAAM,cAAc,SAAS,wBAAwB,kBAAkB;IACvE,MAAM,gBAAgB,KAAK,QAAQ,GAAG,yBAAyB,WAAW;IAE1E,qBACE,CAAA,GAAA,YAAA,EAAA,aAAA,CAAC,CAAA,GAAA,UAAG,AAAH,GAAG;QAAA,GACE,IAAI;QACR,IAAG;QACH,MAAK;QACL,SAAS;QACT,YAAW;QACX,iBAAiB;YACf,IAAI,SAAS,oBAAoB,aAAa;YAC9C,OAAO;YACP,QAAQ;YACR,UAAU;QACX;QACD,WAAW;YACT,OAAO;QACR;QACD,cAAa;QACb,aAAY;QACZ,QAAQ;YACN,IAAI;YACJ,UAAU;QACX;QACD,SAAQ;QACR,KAAI;QACJ,SAAQ;QACR,OAAM;QACN,oBAAmB;QACnB,oBAAmB;QACnB,0BAAyB;IAPxB,GASA,yBAAW,CAAA,GAAA,YAAA,AAAA,EAAA,aAAA,CAAC,CAAA,GAAA,WAAA,GAAI;QAAC,OAAO;QAAe,sBAAQ,CAAA,GAAA,YAAA,EAAA,aAAA,CAAC,SAAO,IAAA;IAAG,kBAC3D,CAAA,GAAA,YAAA,EAAA,aAAA,CAAC,CAAA,GAAA,UAAG,AAAH,GAAG;QAAC,SAAQ;QAAc,MAAK;IAAhC,iBACE,CAAA,GAAA,YAAA,EAAA,aAAA,CAAC,CAAA,GAAA,WAAI,AAAJ,GAAI;QAAC,UAAS;QAAO,OAAO;IAAa,GACvC,SAGJ;AAGP;AAEA,0CAAW,WAAW,GAAG;;AD9DzB;;IAIA,2CAAe,CAAA,GAAA,yCAAA","sources":["packages/react/MenuButton/src/index.ts","packages/react/MenuButton/src/MenuButton.tsx"],"sourcesContent":["import { MenuButton } from \"./MenuButton\";\n\nexport { MenuButton } from \"./MenuButton\";\nexport type { MenuButtonProps } from \"./menuButton.types\";\nexport default MenuButton;\n","import React from \"react\";\n\nimport { Text } from \"@nimbus-ds/text\";\nimport { Icon } from \"@nimbus-ds/icon\";\nimport { Box } from \"@nimbus-ds/box\";\n\nimport { MenuButtonProps } from \"./menuButton.types\";\n\nconst MenuButton: React.FC<MenuButtonProps> = ({\n className: _className,\n style: _style,\n label,\n onClick,\n startIcon: IconSrc,\n children,\n active = false,\n ...rest\n}: MenuButtonProps) => {\n const activeColor = active ? \"primary.interactive\" : \"primary.textHigh\";\n const disabledColor = rest.disabled ? \"neutral.textDisabled\" : activeColor;\n\n return (\n <Box\n {...rest}\n as=\"button\"\n type=\"button\"\n onClick={onClick}\n alignItems=\"center\"\n backgroundColor={{\n xs: active ? \"primary.surface\" : \"transparent\",\n hover: \"primary.surface\",\n active: \"primary.surfaceHighlight\",\n disabled: \"neutral.surfaceDisabled\"\n }}\n boxShadow={{\n focus: \"focusRing\"\n }}\n borderRadius=\".5rem\"\n borderWidth=\"0\"\n cursor={{\n xs: \"pointer\",\n disabled: \"not-allowed\"\n }}\n display=\"flex\"\n gap=\"2\"\n padding=\"2\"\n width=\"100%\"\n transitionProperty=\"all\"\n transitionDuration=\"base\"\n transitionTimingFunction=\"ease-in-out\"\n >\n {IconSrc && <Icon color={disabledColor} source={<IconSrc />} />}\n <Box display=\"inline-flex\" flex=\"1\">\n <Text fontSize=\"base\" color={disabledColor}>\n {label}\n </Text>\n </Box>\n {children}\n </Box>\n );\n};\n\nMenuButton.displayName = \"MenuButton\";\n\nexport { MenuButton };\n"],"names":[],"version":3,"file":"index.module.js.map"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@nimbus-ds/menubutton",
3
+ "version": "1.0.0-rc.1",
4
+ "license": "MIT",
5
+ "source": "src/index.ts",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.module.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "sideEffects": false,
14
+ "scripts": {
15
+ "clean": "rm -rf dist",
16
+ "version": "yarn version"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "^16.8 || ^17.0 || ^18.0",
20
+ "react-dom": "^16.8 || ^17.0 || ^18.0"
21
+ },
22
+ "homepage": "https://nimbus.nuvemshop.com.br/documentation",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/TiendaNube/nimbus-patterns.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/TiendaNube/nimbus-patterns/issues"
29
+ },
30
+ "dependencies": {
31
+ "@nimbus-ds/box": "^2.4.0",
32
+ "@nimbus-ds/icon": "^2.0.0",
33
+ "@nimbus-ds/text": "^5.0.0",
34
+ "@nimbus-ds/tokens": "^6.0.1",
35
+ "@tiendanube/icons": "^0.3.2"
36
+ },
37
+ "devDependencies": {
38
+ "@nimbus-ds/badge": "^3.0.0",
39
+ "@nimbus-ds/tag": "^2.0.0"
40
+ },
41
+ "stableVersion": "0.0.0"
42
+ }