@tecsinapse/react-web-kit 1.6.0 → 1.6.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 +11 -0
- package/dist/components/molecules/Menubar/MenuBlock/MenuBlock.d.ts +4 -3
- package/dist/components/molecules/Menubar/MenuBlock/MenuBlock.js +14 -5
- package/dist/components/molecules/Menubar/MenuBlock/MenuBlock.js.map +1 -1
- package/dist/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.d.ts +1 -0
- package/dist/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.js +6 -3
- package/dist/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.js.map +1 -1
- package/dist/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.d.ts +1 -0
- package/dist/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.js +4 -2
- package/dist/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.js.map +1 -1
- package/dist/components/molecules/Menubar/Menubar.d.ts +3 -2
- package/dist/components/molecules/Menubar/Menubar.js +24 -32
- package/dist/components/molecules/Menubar/Menubar.js.map +1 -1
- package/dist/components/molecules/Menubar/MostUsed/MostUsed.d.ts +3 -2
- package/dist/components/molecules/Menubar/MostUsed/MostUsed.js +6 -3
- package/dist/components/molecules/Menubar/MostUsed/MostUsed.js.map +1 -1
- package/dist/components/molecules/Menubar/animations.d.ts +2 -2
- package/dist/components/molecules/Menubar/animations.js +14 -22
- package/dist/components/molecules/Menubar/animations.js.map +1 -1
- package/package.json +3 -3
- package/src/components/molecules/Menubar/MenuBlock/MenuBlock.tsx +38 -31
- package/src/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.tsx +4 -2
- package/src/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.tsx +3 -2
- package/src/components/molecules/Menubar/Menubar.stories.tsx +20 -13
- package/src/components/molecules/Menubar/Menubar.tsx +47 -57
- package/src/components/molecules/Menubar/MostUsed/MostUsed.tsx +4 -2
- package/src/components/molecules/Menubar/animations.ts +14 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.6.1](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-web-kit@1.6.0...@tecsinapse/react-web-kit@1.6.1) (2021-09-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **menubar:** fixing right components ([efc933d](https://github.com/tecsinapse/design-system/commit/efc933d5a716be0c8f07b4c06a86c52db2f85077))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [1.6.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-web-kit@1.5.0...@tecsinapse/react-web-kit@1.6.0) (2021-09-14)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OptionsType } from '../types';
|
|
3
3
|
interface MenuBlockProps {
|
|
4
|
-
|
|
4
|
+
toggle: () => void;
|
|
5
|
+
options: OptionsType[];
|
|
5
6
|
}
|
|
6
|
-
declare const
|
|
7
|
-
export default
|
|
7
|
+
declare const _default: React.NamedExoticComponent<MenuBlockProps>;
|
|
8
|
+
export default _default;
|
|
@@ -13,12 +13,19 @@ var _MenuItem = require("./MenuItem");
|
|
|
13
13
|
|
|
14
14
|
var _styled = require("./styled");
|
|
15
15
|
|
|
16
|
+
var _Masonry = require("../../Masonry");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
const MenuBlock = ({
|
|
19
|
-
|
|
21
|
+
options,
|
|
22
|
+
toggle
|
|
20
23
|
}) => {
|
|
21
|
-
return _react.default.createElement(
|
|
24
|
+
return _react.default.createElement(_Masonry.Masonry, {
|
|
25
|
+
columns: 4,
|
|
26
|
+
spacingTop: "kilo",
|
|
27
|
+
spacingLeft: "mega"
|
|
28
|
+
}, options.map(data => _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_styled.StyledContainerMenu, null, data.leftComponents && _react.default.createElement(_styled.StyledLeftComponent, null, data.leftComponents), _react.default.createElement(_reactCore.Text, {
|
|
22
29
|
fontWeight: "bold"
|
|
23
30
|
}, data.title)), _react.default.createElement(_styled.StyledContainerItems, null, data.items.map(({
|
|
24
31
|
title,
|
|
@@ -32,10 +39,12 @@ const MenuBlock = ({
|
|
|
32
39
|
title: title,
|
|
33
40
|
Component: Component,
|
|
34
41
|
rightComponents: rightComponents,
|
|
35
|
-
props: props
|
|
36
|
-
|
|
42
|
+
props: props,
|
|
43
|
+
toggle: toggle
|
|
44
|
+
}))))));
|
|
37
45
|
};
|
|
38
46
|
|
|
39
|
-
var _default = MenuBlock;
|
|
47
|
+
var _default = _react.default.memo(MenuBlock);
|
|
48
|
+
|
|
40
49
|
exports.default = _default;
|
|
41
50
|
//# sourceMappingURL=MenuBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/molecules/Menubar/MenuBlock/MenuBlock.tsx"],"names":["MenuBlock","data","leftComponents","title","items","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Menubar/MenuBlock/MenuBlock.tsx"],"names":["MenuBlock","options","toggle","map","data","leftComponents","title","items","Component","props","rightComponents","React","memo"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAMA;;;;AAOA,MAAMA,SAAmC,GAAG,CAAC;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAAD,KAAyB;AACnE,SACE,6BAAC,gBAAD;AAAS,IAAA,OAAO,EAAE,CAAlB;AAAqB,IAAA,UAAU,EAAC,MAAhC;AAAuC,IAAA,WAAW,EAAC;AAAnD,KACGD,OAAO,CAACE,GAAR,CAAYC,IAAI,IACf,4DACE,6BAAC,2BAAD,QACGA,IAAI,CAACC,cAAL,IACC,6BAAC,2BAAD,QAAsBD,IAAI,CAACC,cAA3B,CAFJ,EAIE,6BAAC,eAAD;AAAM,IAAA,UAAU,EAAC;AAAjB,KAAyBD,IAAI,CAACE,KAA9B,CAJF,CADF,EAOE,6BAAC,4BAAD,QACGF,IAAI,CAACG,KAAL,CAAWJ,GAAX,CACC,CAAC;AACCG,IAAAA,KADD;AAECE,IAAAA,SAFD;AAGCC,IAAAA,KAHD;AAICC,IAAAA,eAJD;AAKCH,IAAAA;AALD,GAAD,KAOE,6BAAC,kBAAD;AACE,IAAA,KAAK,EAAEA,KADT;AAEE,IAAA,GAAG,EAAED,KAFP;AAGE,IAAA,KAAK,EAAEA,KAHT;AAIE,IAAA,SAAS,EAAEE,SAJb;AAKE,IAAA,eAAe,EAAEE,eALnB;AAME,IAAA,KAAK,EAAED,KANT;AAOE,IAAA,MAAM,EAAEP;AAPV,IARH,CADH,CAPF,CADD,CADH,CADF;AAmCD,CApCD;;eAsCeS,eAAMC,IAAN,CAAWZ,SAAX,C","sourcesContent":["import React from 'react';\nimport { Text } from '@tecsinapse/react-core';\nimport { MenuItem } from './MenuItem';\nimport {\n StyledContainerItems,\n StyledContainerMenu,\n StyledLeftComponent,\n} from './styled';\nimport { ItemsOptions, OptionsType } from '../types';\nimport { Masonry } from '../../Masonry';\n\ninterface MenuBlockProps {\n toggle: () => void;\n options: OptionsType[];\n}\n\nconst MenuBlock: React.FC<MenuBlockProps> = ({ options, toggle }) => {\n return (\n <Masonry columns={4} spacingTop=\"kilo\" spacingLeft=\"mega\">\n {options.map(data => (\n <>\n <StyledContainerMenu>\n {data.leftComponents && (\n <StyledLeftComponent>{data.leftComponents}</StyledLeftComponent>\n )}\n <Text fontWeight=\"bold\">{data.title}</Text>\n </StyledContainerMenu>\n <StyledContainerItems>\n {data.items.map(\n ({\n title,\n Component,\n props,\n rightComponents,\n items,\n }: ItemsOptions) => (\n <MenuItem\n items={items}\n key={title}\n title={title}\n Component={Component}\n rightComponents={rightComponents}\n props={props}\n toggle={toggle}\n />\n )\n )}\n </StyledContainerItems>\n </>\n ))}\n </Masonry>\n );\n};\n\nexport default React.memo(MenuBlock);\n"],"file":"MenuBlock.js"}
|
|
@@ -24,7 +24,8 @@ const MenuItem = ({
|
|
|
24
24
|
Component = 'a',
|
|
25
25
|
props = {},
|
|
26
26
|
rightComponents,
|
|
27
|
-
items
|
|
27
|
+
items,
|
|
28
|
+
toggle
|
|
28
29
|
}) => {
|
|
29
30
|
const [open, setOpen] = _react.default.useState(false);
|
|
30
31
|
|
|
@@ -39,7 +40,8 @@ const MenuItem = ({
|
|
|
39
40
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_styled2.StyledContainerItemText, {
|
|
40
41
|
key: title
|
|
41
42
|
}, _react.default.createElement(Component, _extends({}, props, {
|
|
42
|
-
style: noTextDecoration
|
|
43
|
+
style: noTextDecoration,
|
|
44
|
+
onClick: toggle
|
|
43
45
|
}), _react.default.createElement(_reactCore.Text, {
|
|
44
46
|
colorVariant: open ? 'primary' : 'secondary',
|
|
45
47
|
colorTone: open ? 'medium' : 'dark'
|
|
@@ -51,7 +53,8 @@ const MenuItem = ({
|
|
|
51
53
|
fontColor: "orange"
|
|
52
54
|
}))), open && (items === null || items === void 0 ? void 0 : items.map(subItem => _react.default.createElement(_SubMenuBlock.SubMenuBlock, {
|
|
53
55
|
key: subItem.title,
|
|
54
|
-
data: subItem
|
|
56
|
+
data: subItem,
|
|
57
|
+
toggle: toggle
|
|
55
58
|
}))));
|
|
56
59
|
};
|
|
57
60
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.tsx"],"names":["MenuItem","title","Component","props","rightComponents","items","open","setOpen","React","useState","noTextDecoration","textDecoration","getIconName","handleMenuAction","map","subItem"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.tsx"],"names":["MenuItem","title","Component","props","rightComponents","items","toggle","open","setOpen","React","useState","noTextDecoration","textDecoration","getIconName","handleMenuAction","map","subItem"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAcA,MAAMA,QAAiC,GAAG,CAAC;AACzCC,EAAAA,KADyC;AAEzCC,EAAAA,SAAS,GAAG,GAF6B;AAGzCC,EAAAA,KAAK,GAAG,EAHiC;AAIzCC,EAAAA,eAJyC;AAKzCC,EAAAA,KALyC;AAMzCC,EAAAA;AANyC,CAAD,KAOpC;AACJ,QAAM,CAACC,IAAD,EAAOC,OAAP,IAAkBC,eAAMC,QAAN,CAAwB,KAAxB,CAAxB;;AAEA,QAAMC,gBAAgB,GAAG;AAAEC,IAAAA,cAAc,EAAE;AAAlB,GAAzB;;AAEA,QAAMC,WAAW,GAAG,MAClBN,IAAI,GAAG,8BAAH,GAAoC,gCAD1C;;AAGA,QAAMO,gBAAgB,GAAG,MAAMN,OAAO,CAAC,CAACD,IAAF,CAAtC;;AAEA,SACE,4DACE,6BAAC,gCAAD;AAAyB,IAAA,GAAG,EAAEN;AAA9B,KACE,6BAAC,SAAD,eAAeE,KAAf;AAAsB,IAAA,KAAK,EAAEQ,gBAA7B;AAA+C,IAAA,OAAO,EAAEL;AAAxD,MACE,6BAAC,eAAD;AACE,IAAA,YAAY,EAAEC,IAAI,GAAG,SAAH,GAAe,WADnC;AAEE,IAAA,SAAS,EAAEA,IAAI,GAAG,QAAH,GAAc;AAF/B,KAIE,6BAAC,kBAAD,QAAaN,KAAb,CAJF,CADF,CADF,EASGG,eAAe,IAAI,CAACC,KAApB,IACC,6BAAC,4BAAD,QAAuBD,eAAvB,CAVJ,EAYGC,KAAK,IACJ,6BAAC,wBAAD;AAAiB,IAAA,OAAO,EAAES;AAA1B,KACE,6BAAC,eAAD;AACE,IAAA,IAAI,EAAED,WAAW,EADnB;AAEE,IAAA,IAAI,EAAC,oBAFP;AAGE,IAAA,SAAS,EAAC;AAHZ,IADF,CAbJ,CADF,EAuBGN,IAAI,KACHF,KADG,aACHA,KADG,uBACHA,KAAK,CAAEU,GAAP,CAAWC,OAAO,IAChB,6BAAC,0BAAD;AAAc,IAAA,GAAG,EAAEA,OAAO,CAACf,KAA3B;AAAkC,IAAA,IAAI,EAAEe,OAAxC;AAAiD,IAAA,MAAM,EAAEV;AAAzD,IADF,CADG,CAvBP,CADF;AA8BD,CA/CD;;eAiDeN,Q","sourcesContent":["import React, { ElementType } from 'react';\nimport { Icon, Text } from '@tecsinapse/react-core';\nimport { SubMenuBlock } from './SubMenuBlock';\nimport { StyledRightComponent, StyledText } from '../styled';\nimport { StyledContainerItemText, StyledSubButton } from './styled';\nimport { ItemsOptions } from '../../types';\n\ninterface MenuItemProps {\n title: string;\n /** Wrapping component for element. This is used for navigation */\n Component: ElementType;\n /** Properties spread to wrapping Component */\n props: any;\n toggle: () => void;\n rightComponents?: React.ReactNode;\n items?: ItemsOptions[];\n}\n\nconst MenuItem: React.FC<MenuItemProps> = ({\n title,\n Component = 'a',\n props = {},\n rightComponents,\n items,\n toggle,\n}) => {\n const [open, setOpen] = React.useState<boolean>(false);\n\n const noTextDecoration = { textDecoration: 'none' };\n\n const getIconName = () =>\n open ? 'arrow-up-drop-circle-outline' : 'arrow-down-drop-circle-outline';\n\n const handleMenuAction = () => setOpen(!open);\n\n return (\n <>\n <StyledContainerItemText key={title}>\n <Component {...props} style={noTextDecoration} onClick={toggle}>\n <Text\n colorVariant={open ? 'primary' : 'secondary'}\n colorTone={open ? 'medium' : 'dark'}\n >\n <StyledText>{title}</StyledText>\n </Text>\n </Component>\n {rightComponents && !items && (\n <StyledRightComponent>{rightComponents}</StyledRightComponent>\n )}\n {items && (\n <StyledSubButton onClick={handleMenuAction}>\n <Icon\n name={getIconName()}\n type=\"material-community\"\n fontColor=\"orange\"\n />\n </StyledSubButton>\n )}\n </StyledContainerItemText>\n {open &&\n items?.map(subItem => (\n <SubMenuBlock key={subItem.title} data={subItem} toggle={toggle} />\n ))}\n </>\n );\n};\n\nexport default MenuItem;\n"],"file":"MenuItem.js"}
|
|
@@ -18,7 +18,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
18
18
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
19
|
|
|
20
20
|
const SubMenuBlock = ({
|
|
21
|
-
data
|
|
21
|
+
data,
|
|
22
|
+
toggle
|
|
22
23
|
}) => {
|
|
23
24
|
const {
|
|
24
25
|
Component,
|
|
@@ -30,7 +31,8 @@ const SubMenuBlock = ({
|
|
|
30
31
|
textDecoration: 'none'
|
|
31
32
|
};
|
|
32
33
|
return _react.default.createElement(_styled2.StyledContainerItem, null, _react.default.createElement(_styled2.DummyBorder, null), _react.default.createElement(Component, _extends({}, props, {
|
|
33
|
-
style: noTextDecoration
|
|
34
|
+
style: noTextDecoration,
|
|
35
|
+
onClick: toggle
|
|
34
36
|
}), _react.default.createElement(_reactCore.Text, {
|
|
35
37
|
colorVariant: "secondary",
|
|
36
38
|
colorTone: "medium",
|
package/dist/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.tsx"],"names":["SubMenuBlock","data","Component","props","rightComponents","title","noTextDecoration","textDecoration"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.tsx"],"names":["SubMenuBlock","data","toggle","Component","props","rightComponents","title","noTextDecoration","textDecoration"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;AAOA,MAAMA,YAAyC,GAAG,CAAC;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAAD,KAAsB;AACtE,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,KAAb;AAAoBC,IAAAA,eAApB;AAAqCC,IAAAA;AAArC,MAA+CL,IAArD;AAEA,QAAMM,gBAAgB,GAAG;AAAEC,IAAAA,cAAc,EAAE;AAAlB,GAAzB;AAEA,SACE,6BAAC,4BAAD,QACE,6BAAC,oBAAD,OADF,EAEE,6BAAC,SAAD,eAAeJ,KAAf;AAAsB,IAAA,KAAK,EAAEG,gBAA7B;AAA+C,IAAA,OAAO,EAAEL;AAAxD,MACE,6BAAC,eAAD;AAAM,IAAA,YAAY,EAAC,WAAnB;AAA+B,IAAA,SAAS,EAAC,QAAzC;AAAkD,IAAA,UAAU,EAAC;AAA7D,KACE,6BAAC,kBAAD,QAAaI,KAAb,CADF,CADF,CAFF,EAOGD,eAAe,IACd,6BAAC,4BAAD,QAAuBA,eAAvB,CARJ,CADF;AAaD,CAlBD;;eAoBeL,Y","sourcesContent":["import React from 'react';\nimport { Text } from '@tecsinapse/react-core';\nimport { StyledRightComponent, StyledText } from '../../styled';\nimport { ItemsOptions } from '../../../types';\nimport { DummyBorder, StyledContainerItem } from './styled';\n\ninterface SubMenuBlockProps {\n data: ItemsOptions;\n toggle: () => void;\n}\n\nconst SubMenuBlock: React.FC<SubMenuBlockProps> = ({ data, toggle }) => {\n const { Component, props, rightComponents, title } = data;\n\n const noTextDecoration = { textDecoration: 'none' };\n\n return (\n <StyledContainerItem>\n <DummyBorder />\n <Component {...props} style={noTextDecoration} onClick={toggle}>\n <Text colorVariant=\"secondary\" colorTone=\"medium\" typography=\"sub\">\n <StyledText>{title}</StyledText>\n </Text>\n </Component>\n {rightComponents && (\n <StyledRightComponent>{rightComponents}</StyledRightComponent>\n )}\n </StyledContainerItem>\n );\n};\n\nexport default SubMenuBlock;\n"],"file":"SubMenuBlock.js"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MostUsedType, OptionsType } from './types';
|
|
3
3
|
export interface MenubarProps {
|
|
4
|
+
options: OptionsType[];
|
|
4
5
|
leftComponents?: React.ReactNode;
|
|
5
6
|
rightComponents?: React.ReactNode;
|
|
6
|
-
inputPlaceholder?: string;
|
|
7
|
-
options: OptionsType[];
|
|
8
7
|
mostUsed?: MostUsedType[];
|
|
9
8
|
mostUsedLabel?: string;
|
|
9
|
+
searchable?: boolean;
|
|
10
|
+
searchPlaceholder?: string;
|
|
10
11
|
searchResultsLabel?: string;
|
|
11
12
|
}
|
|
12
13
|
declare const Menubar: React.FC<MenubarProps>;
|
|
@@ -11,12 +11,8 @@ var _reactCore = require("@tecsinapse/react-core");
|
|
|
11
11
|
|
|
12
12
|
var _reactTransitionGroup = require("react-transition-group");
|
|
13
13
|
|
|
14
|
-
var _react2 = require("@emotion/react");
|
|
15
|
-
|
|
16
14
|
var _styled = require("./styled");
|
|
17
15
|
|
|
18
|
-
var _Masonry = require("../Masonry");
|
|
19
|
-
|
|
20
16
|
var _MostUsed = require("./MostUsed");
|
|
21
17
|
|
|
22
18
|
var _MenuBlock = require("./MenuBlock");
|
|
@@ -32,11 +28,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
32
28
|
const Menubar = ({
|
|
33
29
|
leftComponents,
|
|
34
30
|
rightComponents,
|
|
35
|
-
|
|
31
|
+
searchPlaceholder = 'O quê você deseja buscar?',
|
|
36
32
|
options,
|
|
37
33
|
mostUsed,
|
|
38
34
|
mostUsedLabel = 'Mais acessados',
|
|
39
|
-
searchResultsLabel = 'Resultados da busca'
|
|
35
|
+
searchResultsLabel = 'Resultados da busca',
|
|
36
|
+
searchable = true
|
|
40
37
|
}) => {
|
|
41
38
|
const [search, setSearch] = _react.default.useState('');
|
|
42
39
|
|
|
@@ -44,11 +41,9 @@ const Menubar = ({
|
|
|
44
41
|
|
|
45
42
|
const [input, setInput] = (0, _reactCore.useDebouncedState)('', state => setSearch(state));
|
|
46
43
|
|
|
47
|
-
const [
|
|
48
|
-
|
|
49
|
-
const theme = (0, _react2.useTheme)();
|
|
44
|
+
const [open, setOpen] = _react.default.useState(false);
|
|
50
45
|
|
|
51
|
-
const
|
|
46
|
+
const toggleOpen = _react.default.useCallback(() => setOpen(state => !state), [setOpen]);
|
|
52
47
|
|
|
53
48
|
_react.default.useEffect(() => {
|
|
54
49
|
if (search === '') return;
|
|
@@ -58,8 +53,8 @@ const Menubar = ({
|
|
|
58
53
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_styled.StyledMenuBar, null, _react.default.createElement(_styled.StyledMenuButton, {
|
|
59
54
|
variant: "filled",
|
|
60
55
|
color: "primary",
|
|
61
|
-
onPress:
|
|
62
|
-
}, !
|
|
56
|
+
onPress: toggleOpen
|
|
57
|
+
}, !open ? _react.default.createElement(_reactCore.Icon, {
|
|
63
58
|
size: "deca",
|
|
64
59
|
name: "menu",
|
|
65
60
|
type: "material-community",
|
|
@@ -70,40 +65,37 @@ const Menubar = ({
|
|
|
70
65
|
type: "material-community",
|
|
71
66
|
fontColor: "light"
|
|
72
67
|
})), leftComponents, _react.default.createElement(_reactTransitionGroup.Transition, {
|
|
73
|
-
in:
|
|
68
|
+
in: open,
|
|
74
69
|
timeout: 250
|
|
75
|
-
}, state => _react.default.createElement(
|
|
76
|
-
style: (0, _animations.getInputContainerStyles)(state
|
|
77
|
-
},
|
|
78
|
-
placeholder:
|
|
70
|
+
}, state => _react.default.createElement(_styled.StyledInputContainer, {
|
|
71
|
+
style: (0, _animations.getInputContainerStyles)(state)
|
|
72
|
+
}, searchable && _react.default.createElement(_styled.StyledInput, {
|
|
73
|
+
placeholder: searchPlaceholder,
|
|
79
74
|
leftComponent: _react.default.createElement(_styled.StyledIconInput, null, _react.default.createElement(_reactCore.Icon, {
|
|
80
75
|
name: "magnify",
|
|
81
76
|
type: "material-community"
|
|
82
77
|
})),
|
|
83
78
|
value: input,
|
|
84
79
|
onChange: setInput
|
|
85
|
-
})), rightComponents)
|
|
86
|
-
in:
|
|
80
|
+
}))), rightComponents), _react.default.createElement(_reactTransitionGroup.Transition, {
|
|
81
|
+
in: open,
|
|
87
82
|
timeout: 250
|
|
88
|
-
}, state => _react.default.createElement(
|
|
89
|
-
style: (0, _animations.getContainerOpenMenuStyles)(state
|
|
90
|
-
},
|
|
83
|
+
}, state => _react.default.createElement(_styled.StyledContainerOpenMenu, {
|
|
84
|
+
style: (0, _animations.getContainerOpenMenuStyles)(state)
|
|
85
|
+
}, !search ? _react.default.createElement(_react.default.Fragment, null, mostUsed && _react.default.createElement(_MostUsed.MostUsed, {
|
|
91
86
|
label: mostUsedLabel,
|
|
92
|
-
data: mostUsed
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
data: option,
|
|
99
|
-
key: option.title
|
|
100
|
-
})))) : _react.default.createElement(_styled.StyledSearchResultsContainer, null, _react.default.createElement(_styled.StyledSearchTextContainer, null, _react.default.createElement(_reactCore.Text, {
|
|
87
|
+
data: mostUsed,
|
|
88
|
+
toggle: toggleOpen
|
|
89
|
+
}), _react.default.createElement(_MenuBlock.MenuBlock, {
|
|
90
|
+
options: options,
|
|
91
|
+
toggle: toggleOpen
|
|
92
|
+
})) : _react.default.createElement(_styled.StyledSearchResultsContainer, null, _react.default.createElement(_styled.StyledSearchTextContainer, null, _react.default.createElement(_reactCore.Text, {
|
|
101
93
|
fontWeight: "bold"
|
|
102
94
|
}, searchResultsLabel)), results.map(result => _react.default.createElement(_SearchResultItem.SearchResultItem, {
|
|
103
95
|
key: `${result.title}-${result.category}`,
|
|
104
96
|
data: result,
|
|
105
97
|
searchTerm: search
|
|
106
|
-
}))))))
|
|
98
|
+
}))))));
|
|
107
99
|
};
|
|
108
100
|
|
|
109
101
|
var _default = Menubar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Menubar/Menubar.tsx"],"names":["Menubar","leftComponents","rightComponents","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Menubar/Menubar.tsx"],"names":["Menubar","leftComponents","rightComponents","searchPlaceholder","options","mostUsed","mostUsedLabel","searchResultsLabel","searchable","search","setSearch","React","useState","results","setResults","input","setInput","state","open","setOpen","toggleOpen","useCallback","useEffect","map","result","title","category"],"mappings":"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","sourcesContent":["import React from 'react';\nimport { Icon, Text, useDebouncedState } from '@tecsinapse/react-core';\nimport { Transition } from 'react-transition-group';\nimport {\n StyledIconInput,\n StyledMenuBar,\n StyledMenuButton,\n StyledContainerOpenMenu,\n StyledInput,\n StyledInputContainer,\n StyledSearchResultsContainer,\n StyledSearchTextContainer,\n} from './styled';\nimport { MostUsedType, OptionsType } from './types';\nimport { MostUsed } from './MostUsed';\nimport { MenuBlock } from './MenuBlock';\nimport { SearchResultItem } from './SearchResultItem';\nimport { filterAndTransform } from './utils';\nimport {\n getContainerOpenMenuStyles,\n getInputContainerStyles,\n} from './animations';\n\nexport interface MenubarProps {\n options: OptionsType[];\n leftComponents?: React.ReactNode;\n rightComponents?: React.ReactNode;\n /** Limited to first 4 elements */\n mostUsed?: MostUsedType[];\n mostUsedLabel?: string;\n searchable?: boolean;\n searchPlaceholder?: string;\n searchResultsLabel?: string;\n}\n\nconst Menubar: React.FC<MenubarProps> = ({\n leftComponents,\n rightComponents,\n searchPlaceholder = 'O quê você deseja buscar?',\n options,\n mostUsed,\n mostUsedLabel = 'Mais acessados',\n searchResultsLabel = 'Resultados da busca',\n searchable = true,\n}) => {\n const [search, setSearch] = React.useState<string>('');\n const [results, setResults] = React.useState<MostUsedType[]>([]);\n const [input, setInput] = useDebouncedState('', state => setSearch(state));\n const [open, setOpen] = React.useState<boolean>(false);\n\n const toggleOpen = React.useCallback(() => setOpen(state => !state), [\n setOpen,\n ]);\n\n React.useEffect(() => {\n if (search === '') return;\n setResults(filterAndTransform(options, search));\n }, [search]);\n\n return (\n <>\n <StyledMenuBar>\n <StyledMenuButton variant=\"filled\" color=\"primary\" onPress={toggleOpen}>\n {!open ? (\n <Icon\n size=\"deca\"\n name=\"menu\"\n type=\"material-community\"\n fontColor=\"light\"\n />\n ) : (\n <Icon\n size=\"deca\"\n name=\"close\"\n type=\"material-community\"\n fontColor=\"light\"\n />\n )}\n </StyledMenuButton>\n {leftComponents}\n <Transition in={open} timeout={250}>\n {state => (\n <StyledInputContainer style={getInputContainerStyles(state)}>\n {searchable && (\n <StyledInput\n placeholder={searchPlaceholder}\n leftComponent={\n <StyledIconInput>\n <Icon name=\"magnify\" type=\"material-community\" />\n </StyledIconInput>\n }\n value={input}\n onChange={setInput}\n />\n )}\n </StyledInputContainer>\n )}\n </Transition>\n {rightComponents}\n </StyledMenuBar>\n <Transition in={open} timeout={250}>\n {state => (\n <StyledContainerOpenMenu style={getContainerOpenMenuStyles(state)}>\n {!search ? (\n <>\n {mostUsed && (\n <MostUsed\n label={mostUsedLabel}\n data={mostUsed}\n toggle={toggleOpen}\n />\n )}\n <MenuBlock options={options} toggle={toggleOpen} />\n </>\n ) : (\n <StyledSearchResultsContainer>\n <StyledSearchTextContainer>\n <Text fontWeight=\"bold\">{searchResultsLabel}</Text>\n </StyledSearchTextContainer>\n {results.map(result => (\n <SearchResultItem\n key={`${result.title}-${result.category}`}\n data={result}\n searchTerm={search}\n />\n ))}\n </StyledSearchResultsContainer>\n )}\n </StyledContainerOpenMenu>\n )}\n </Transition>\n </>\n );\n};\n\nexport default Menubar;\n"],"file":"Menubar.js"}
|
|
@@ -3,6 +3,7 @@ import { MostUsedType } from '../types';
|
|
|
3
3
|
interface MostUsedProps {
|
|
4
4
|
data: MostUsedType[];
|
|
5
5
|
label: string;
|
|
6
|
+
toggle: () => void;
|
|
6
7
|
}
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
8
|
+
declare const _default: React.NamedExoticComponent<MostUsedProps>;
|
|
9
|
+
export default _default;
|
|
@@ -17,7 +17,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
17
17
|
|
|
18
18
|
const MostUsed = ({
|
|
19
19
|
data,
|
|
20
|
-
label
|
|
20
|
+
label,
|
|
21
|
+
toggle
|
|
21
22
|
}) => {
|
|
22
23
|
const noTextDecoration = {
|
|
23
24
|
textDecoration: 'none'
|
|
@@ -31,7 +32,8 @@ const MostUsed = ({
|
|
|
31
32
|
props = {}
|
|
32
33
|
}) => _react.default.createElement(Component, _extends({}, props, {
|
|
33
34
|
style: noTextDecoration,
|
|
34
|
-
key: `${title}-${category}
|
|
35
|
+
key: `${title}-${category}`,
|
|
36
|
+
onClick: toggle
|
|
35
37
|
}), _react.default.createElement(_styled.StyledCard, {
|
|
36
38
|
elevated: true,
|
|
37
39
|
key: `${title}-${category}`
|
|
@@ -45,6 +47,7 @@ const MostUsed = ({
|
|
|
45
47
|
}, category))))));
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
var _default = MostUsed;
|
|
50
|
+
var _default = _react.default.memo(MostUsed);
|
|
51
|
+
|
|
49
52
|
exports.default = _default;
|
|
50
53
|
//# sourceMappingURL=MostUsed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/molecules/Menubar/MostUsed/MostUsed.tsx"],"names":["MostUsed","data","label","noTextDecoration","textDecoration","slice","map","title","category","Component","props"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Menubar/MostUsed/MostUsed.tsx"],"names":["MostUsed","data","label","toggle","noTextDecoration","textDecoration","slice","map","title","category","Component","props","React","memo"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AASA,MAAMA,QAAiC,GAAG,CAAC;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,KAAR;AAAeC,EAAAA;AAAf,CAAD,KAA6B;AACrE,QAAMC,gBAAgB,GAAG;AAAEC,IAAAA,cAAc,EAAE;AAAlB,GAAzB;AAEA,SACE,4DACE,6BAAC,eAAD;AAAM,IAAA,UAAU,EAAC;AAAjB,KAAyBH,KAAzB,CADF,EAEE,6BAAC,2BAAD,QACGD,IAAI,CACFK,KADF,CACQ,CADR,EACW,CADX,EAEEC,GAFF,CAGG,CAAC;AACCC,IAAAA,KADD;AAECC,IAAAA,QAFD;AAGCC,IAAAA,SAAS,GAAG,GAHb;AAICC,IAAAA,KAAK,GAAG;AAJT,GAAD,KAME,6BAAC,SAAD,eACMA,KADN;AAEE,IAAA,KAAK,EAAEP,gBAFT;AAGE,IAAA,GAAG,EAAG,GAAEI,KAAM,IAAGC,QAAS,EAH5B;AAIE,IAAA,OAAO,EAAEN;AAJX,MAME,6BAAC,kBAAD;AAAY,IAAA,QAAQ,MAApB;AAAqB,IAAA,GAAG,EAAG,GAAEK,KAAM,IAAGC,QAAS;AAA/C,KACE,6BAAC,eAAD;AAAM,IAAA,UAAU,EAAC,MAAjB;AAAwB,IAAA,YAAY,EAAC;AAArC,KACGD,KADH,CADF,EAIE,6BAAC,eAAD;AACE,IAAA,UAAU,EAAC,MADb;AAEE,IAAA,YAAY,EAAC,WAFf;AAGE,IAAA,UAAU,EAAC;AAHb,KAKGC,QALH,CAJF,CANF,CATL,CADH,CAFF,CADF;AAqCD,CAxCD;;eA0CeG,eAAMC,IAAN,CAAWb,QAAX,C","sourcesContent":["import React from 'react';\nimport { Text } from '@tecsinapse/react-core';\nimport { StyledCard, StyledCardContainer } from './styled';\nimport { MostUsedType } from '../types';\n\ninterface MostUsedProps {\n data: MostUsedType[];\n label: string;\n toggle: () => void;\n}\n\nconst MostUsed: React.FC<MostUsedProps> = ({ data, label, toggle }) => {\n const noTextDecoration = { textDecoration: 'none' };\n\n return (\n <>\n <Text fontWeight=\"bold\">{label}</Text>\n <StyledCardContainer>\n {data\n .slice(0, 4)\n .map(\n ({\n title,\n category,\n Component = 'a',\n props = {},\n }: MostUsedType) => (\n <Component\n {...props}\n style={noTextDecoration}\n key={`${title}-${category}`}\n onClick={toggle}\n >\n <StyledCard elevated key={`${title}-${category}`}>\n <Text fontWeight=\"bold\" colorVariant=\"primary\">\n {title}\n </Text>\n <Text\n fontWeight=\"bold\"\n colorVariant=\"secondary\"\n typography=\"label\"\n >\n {category}\n </Text>\n </StyledCard>\n </Component>\n )\n )}\n </StyledCardContainer>\n </>\n );\n};\n\nexport default React.memo(MostUsed);\n"],"file":"MostUsed.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { TransitionStatus } from 'react-transition-group';
|
|
3
|
-
export declare const getInputContainerStyles: (state: TransitionStatus
|
|
4
|
-
export declare const getContainerOpenMenuStyles: (state: TransitionStatus
|
|
3
|
+
export declare const getInputContainerStyles: (state: TransitionStatus) => CSSProperties;
|
|
4
|
+
export declare const getContainerOpenMenuStyles: (state: TransitionStatus) => CSSProperties;
|
|
@@ -4,24 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getContainerOpenMenuStyles = exports.getInputContainerStyles = void 0;
|
|
7
|
-
|
|
8
|
-
const getDefaultInputContainerStyles = theme => ({
|
|
9
|
-
display: 'flex',
|
|
10
|
-
flex: 1,
|
|
7
|
+
const getDefaultInputContainerStyles = {
|
|
11
8
|
transitionDuration: '250ms',
|
|
12
9
|
transitionProperty: 'opacity scale transform',
|
|
13
|
-
transitionTimingFunction: 'ease-in-out'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const getDefaultContainerOpenMenuStyles = theme => ({
|
|
10
|
+
transitionTimingFunction: 'ease-in-out'
|
|
11
|
+
};
|
|
12
|
+
const getDefaultContainerOpenMenuStyles = {
|
|
18
13
|
transitionDuration: '250ms',
|
|
19
14
|
transitionProperty: 'opacity scale transform',
|
|
20
|
-
transitionTimingFunction: 'ease-in-out'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const getInputContainerTransform = () => ({
|
|
15
|
+
transitionTimingFunction: 'ease-in-out'
|
|
16
|
+
};
|
|
17
|
+
const getInputContainerTransform = {
|
|
25
18
|
entered: {
|
|
26
19
|
transform: 'scale(1, 1) translateY(0px)'
|
|
27
20
|
},
|
|
@@ -37,9 +30,8 @@ const getInputContainerTransform = () => ({
|
|
|
37
30
|
opacity: 0.5,
|
|
38
31
|
transform: 'scale(0.99, 0.99) translateY(-5px)'
|
|
39
32
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const getContainerOpenMenuTransform = () => ({
|
|
33
|
+
};
|
|
34
|
+
const getContainerOpenMenuTransform = {
|
|
43
35
|
entered: {
|
|
44
36
|
transform: 'scale(1, 1) translateY(0px) '
|
|
45
37
|
},
|
|
@@ -55,16 +47,16 @@ const getContainerOpenMenuTransform = () => ({
|
|
|
55
47
|
opacity: 0.95,
|
|
56
48
|
transform: 'scale(0.99, 0.99) translateY(0px)'
|
|
57
49
|
}
|
|
58
|
-
}
|
|
50
|
+
};
|
|
59
51
|
|
|
60
|
-
const getInputContainerStyles =
|
|
61
|
-
...getInputContainerTransform
|
|
52
|
+
const getInputContainerStyles = state => ({ ...getDefaultInputContainerStyles,
|
|
53
|
+
...getInputContainerTransform[state]
|
|
62
54
|
});
|
|
63
55
|
|
|
64
56
|
exports.getInputContainerStyles = getInputContainerStyles;
|
|
65
57
|
|
|
66
|
-
const getContainerOpenMenuStyles =
|
|
67
|
-
...getContainerOpenMenuTransform
|
|
58
|
+
const getContainerOpenMenuStyles = state => ({ ...getDefaultContainerOpenMenuStyles,
|
|
59
|
+
...getContainerOpenMenuTransform[state]
|
|
68
60
|
});
|
|
69
61
|
|
|
70
62
|
exports.getContainerOpenMenuStyles = getContainerOpenMenuStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Menubar/animations.ts"],"names":["getDefaultInputContainerStyles","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Menubar/animations.ts"],"names":["getDefaultInputContainerStyles","transitionDuration","transitionProperty","transitionTimingFunction","getDefaultContainerOpenMenuStyles","getInputContainerTransform","entered","transform","entering","opacity","exited","exiting","getContainerOpenMenuTransform","getInputContainerStyles","state","getContainerOpenMenuStyles"],"mappings":";;;;;;AAGA,MAAMA,8BAA8B,GAAG;AACrCC,EAAAA,kBAAkB,EAAE,OADiB;AAErCC,EAAAA,kBAAkB,EAAE,yBAFiB;AAGrCC,EAAAA,wBAAwB,EAAE;AAHW,CAAvC;AAMA,MAAMC,iCAAiC,GAAG;AACxCH,EAAAA,kBAAkB,EAAE,OADoB;AAExCC,EAAAA,kBAAkB,EAAE,yBAFoB;AAGxCC,EAAAA,wBAAwB,EAAE;AAHc,CAA1C;AAMA,MAAME,0BAA0B,GAAG;AACjCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,SAAS,EAAE;AADJ,GADwB;AAIjCC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,OAAO,EAAE,GADD;AAERF,IAAAA,SAAS,EAAE;AAFH,GAJuB;AAQjCG,EAAAA,MAAM,EAAE;AACND,IAAAA,OAAO,EAAE,CADH;AAENF,IAAAA,SAAS,EAAE;AAFL,GARyB;AAYjCI,EAAAA,OAAO,EAAE;AACPF,IAAAA,OAAO,EAAE,GADF;AAEPF,IAAAA,SAAS,EAAE;AAFJ;AAZwB,CAAnC;AAkBA,MAAMK,6BAA6B,GAAG;AACpCN,EAAAA,OAAO,EAAE;AACPC,IAAAA,SAAS,EAAE;AADJ,GAD2B;AAIpCC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,OAAO,EAAE,IADD;AAERF,IAAAA,SAAS,EAAE;AAFH,GAJ0B;AAQpCG,EAAAA,MAAM,EAAE;AACND,IAAAA,OAAO,EAAE,CADH;AAENF,IAAAA,SAAS,EAAE;AAFL,GAR4B;AAYpCI,EAAAA,OAAO,EAAE;AACPF,IAAAA,OAAO,EAAE,IADF;AAEPF,IAAAA,SAAS,EAAE;AAFJ;AAZ2B,CAAtC;;AAkBO,MAAMM,uBAAuB,GAClCC,KADqC,KAElB,EACnB,GAAGd,8BADgB;AAEnB,KAAGK,0BAA0B,CAACS,KAAD;AAFV,CAFkB,CAAhC;;;;AAOA,MAAMC,0BAA0B,GACrCD,KADwC,KAErB,EACnB,GAAGV,iCADgB;AAEnB,KAAGQ,6BAA6B,CAACE,KAAD;AAFb,CAFqB,CAAnC","sourcesContent":["import { CSSProperties } from 'react';\nimport { TransitionStatus } from 'react-transition-group';\n\nconst getDefaultInputContainerStyles = {\n transitionDuration: '250ms',\n transitionProperty: 'opacity scale transform',\n transitionTimingFunction: 'ease-in-out',\n};\n\nconst getDefaultContainerOpenMenuStyles = {\n transitionDuration: '250ms',\n transitionProperty: 'opacity scale transform',\n transitionTimingFunction: 'ease-in-out',\n};\n\nconst getInputContainerTransform = {\n entered: {\n transform: 'scale(1, 1) translateY(0px)',\n },\n entering: {\n opacity: 0.5,\n transform: 'scale(0.99, 0.99) translateY(-5px)',\n },\n exited: {\n opacity: 0,\n transform: 'scale(0.99, 0.99) translateY(-50px)',\n },\n exiting: {\n opacity: 0.5,\n transform: 'scale(0.99, 0.99) translateY(-5px)',\n },\n};\n\nconst getContainerOpenMenuTransform = {\n entered: {\n transform: 'scale(1, 1) translateY(0px) ',\n },\n entering: {\n opacity: 0.95,\n transform: 'scale(0.99, 0.99) translateY(0px)',\n },\n exited: {\n opacity: 0,\n transform: 'scale(0.99, 0.99) translateY(-600px)',\n },\n exiting: {\n opacity: 0.95,\n transform: 'scale(0.99, 0.99) translateY(0px)',\n },\n};\n\nexport const getInputContainerStyles = (\n state: TransitionStatus\n): CSSProperties => ({\n ...getDefaultInputContainerStyles,\n ...getInputContainerTransform[state],\n});\n\nexport const getContainerOpenMenuStyles = (\n state: TransitionStatus\n): CSSProperties => ({\n ...getDefaultContainerOpenMenuStyles,\n ...getContainerOpenMenuTransform[state],\n});\n"],"file":"animations.js"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-web-kit",
|
|
3
3
|
"description": "TecSinapse React components",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@emotion/native": "^11.0.0",
|
|
15
15
|
"@emotion/react": "^11.4.1",
|
|
16
16
|
"@emotion/styled": "^11.3.0",
|
|
17
|
-
"@tecsinapse/react-core": "^1.6.
|
|
17
|
+
"@tecsinapse/react-core": "^1.6.1",
|
|
18
18
|
"react-native-vector-icons": "^8.1.0",
|
|
19
19
|
"react-transition-group": "^4.4.2"
|
|
20
20
|
},
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"react-dom": ">=16.8.0",
|
|
33
33
|
"react-native-web": "^0.17.1"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "2f0c4cdbd33faad24cc6d51cfbd01e976543e4ab"
|
|
36
36
|
}
|
|
@@ -7,42 +7,49 @@ import {
|
|
|
7
7
|
StyledLeftComponent,
|
|
8
8
|
} from './styled';
|
|
9
9
|
import { ItemsOptions, OptionsType } from '../types';
|
|
10
|
+
import { Masonry } from '../../Masonry';
|
|
10
11
|
|
|
11
12
|
interface MenuBlockProps {
|
|
12
|
-
|
|
13
|
+
toggle: () => void;
|
|
14
|
+
options: OptionsType[];
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
const MenuBlock: React.FC<MenuBlockProps> = ({
|
|
17
|
+
const MenuBlock: React.FC<MenuBlockProps> = ({ options, toggle }) => {
|
|
16
18
|
return (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
<Masonry columns={4} spacingTop="kilo" spacingLeft="mega">
|
|
20
|
+
{options.map(data => (
|
|
21
|
+
<>
|
|
22
|
+
<StyledContainerMenu>
|
|
23
|
+
{data.leftComponents && (
|
|
24
|
+
<StyledLeftComponent>{data.leftComponents}</StyledLeftComponent>
|
|
25
|
+
)}
|
|
26
|
+
<Text fontWeight="bold">{data.title}</Text>
|
|
27
|
+
</StyledContainerMenu>
|
|
28
|
+
<StyledContainerItems>
|
|
29
|
+
{data.items.map(
|
|
30
|
+
({
|
|
31
|
+
title,
|
|
32
|
+
Component,
|
|
33
|
+
props,
|
|
34
|
+
rightComponents,
|
|
35
|
+
items,
|
|
36
|
+
}: ItemsOptions) => (
|
|
37
|
+
<MenuItem
|
|
38
|
+
items={items}
|
|
39
|
+
key={title}
|
|
40
|
+
title={title}
|
|
41
|
+
Component={Component}
|
|
42
|
+
rightComponents={rightComponents}
|
|
43
|
+
props={props}
|
|
44
|
+
toggle={toggle}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
)}
|
|
48
|
+
</StyledContainerItems>
|
|
49
|
+
</>
|
|
50
|
+
))}
|
|
51
|
+
</Masonry>
|
|
45
52
|
);
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
export default MenuBlock;
|
|
55
|
+
export default React.memo(MenuBlock);
|
|
@@ -11,6 +11,7 @@ interface MenuItemProps {
|
|
|
11
11
|
Component: ElementType;
|
|
12
12
|
/** Properties spread to wrapping Component */
|
|
13
13
|
props: any;
|
|
14
|
+
toggle: () => void;
|
|
14
15
|
rightComponents?: React.ReactNode;
|
|
15
16
|
items?: ItemsOptions[];
|
|
16
17
|
}
|
|
@@ -21,6 +22,7 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
21
22
|
props = {},
|
|
22
23
|
rightComponents,
|
|
23
24
|
items,
|
|
25
|
+
toggle,
|
|
24
26
|
}) => {
|
|
25
27
|
const [open, setOpen] = React.useState<boolean>(false);
|
|
26
28
|
|
|
@@ -34,7 +36,7 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
34
36
|
return (
|
|
35
37
|
<>
|
|
36
38
|
<StyledContainerItemText key={title}>
|
|
37
|
-
<Component {...props} style={noTextDecoration}>
|
|
39
|
+
<Component {...props} style={noTextDecoration} onClick={toggle}>
|
|
38
40
|
<Text
|
|
39
41
|
colorVariant={open ? 'primary' : 'secondary'}
|
|
40
42
|
colorTone={open ? 'medium' : 'dark'}
|
|
@@ -57,7 +59,7 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
57
59
|
</StyledContainerItemText>
|
|
58
60
|
{open &&
|
|
59
61
|
items?.map(subItem => (
|
|
60
|
-
<SubMenuBlock key={subItem.title} data={subItem} />
|
|
62
|
+
<SubMenuBlock key={subItem.title} data={subItem} toggle={toggle} />
|
|
61
63
|
))}
|
|
62
64
|
</>
|
|
63
65
|
);
|
|
@@ -6,9 +6,10 @@ import { DummyBorder, StyledContainerItem } from './styled';
|
|
|
6
6
|
|
|
7
7
|
interface SubMenuBlockProps {
|
|
8
8
|
data: ItemsOptions;
|
|
9
|
+
toggle: () => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
const SubMenuBlock: React.FC<SubMenuBlockProps> = ({ data }) => {
|
|
12
|
+
const SubMenuBlock: React.FC<SubMenuBlockProps> = ({ data, toggle }) => {
|
|
12
13
|
const { Component, props, rightComponents, title } = data;
|
|
13
14
|
|
|
14
15
|
const noTextDecoration = { textDecoration: 'none' };
|
|
@@ -16,7 +17,7 @@ const SubMenuBlock: React.FC<SubMenuBlockProps> = ({ data }) => {
|
|
|
16
17
|
return (
|
|
17
18
|
<StyledContainerItem>
|
|
18
19
|
<DummyBorder />
|
|
19
|
-
<Component {...props} style={noTextDecoration}>
|
|
20
|
+
<Component {...props} style={noTextDecoration} onClick={toggle}>
|
|
20
21
|
<Text colorVariant="secondary" colorTone="medium" typography="sub">
|
|
21
22
|
<StyledText>{title}</StyledText>
|
|
22
23
|
</Text>
|
|
@@ -2,7 +2,7 @@ import React, { ElementType } from 'react';
|
|
|
2
2
|
import Menubar, { MenubarProps } from './Menubar';
|
|
3
3
|
import { Story } from '@storybook/react';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
|
-
import { Icon, Text } from '@tecsinapse/react-core';
|
|
5
|
+
import { Avatar, Icon, Text } from '@tecsinapse/react-core';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: 'Components/Menu Bar',
|
|
@@ -253,20 +253,27 @@ const StyledImage = styled('img')`
|
|
|
253
253
|
margin-right: 35px;
|
|
254
254
|
`;
|
|
255
255
|
|
|
256
|
-
// Import type manually
|
|
257
256
|
const Template: Story<MenubarProps> = args => {
|
|
258
257
|
return (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
258
|
+
<>
|
|
259
|
+
<Menubar
|
|
260
|
+
{...args}
|
|
261
|
+
options={EXAMPLE_MENU}
|
|
262
|
+
mostUsed={MOST_USED}
|
|
263
|
+
leftComponents={
|
|
264
|
+
<StyledImage
|
|
265
|
+
src="https://www.tecsinapse.com.br/wp-content/themes/tecsinapse/img/logo.svg"
|
|
266
|
+
alt="TecSinapse"
|
|
267
|
+
/>
|
|
268
|
+
}
|
|
269
|
+
rightComponents={
|
|
270
|
+
<div style={{ marginLeft: 24 }}>
|
|
271
|
+
<Avatar name="Design System" />
|
|
272
|
+
</div>
|
|
273
|
+
}
|
|
274
|
+
/>
|
|
275
|
+
Content
|
|
276
|
+
</>
|
|
270
277
|
);
|
|
271
278
|
};
|
|
272
279
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Icon,
|
|
4
|
-
Text,
|
|
5
|
-
ThemeProp,
|
|
6
|
-
useDebouncedState,
|
|
7
|
-
} from '@tecsinapse/react-core';
|
|
2
|
+
import { Icon, Text, useDebouncedState } from '@tecsinapse/react-core';
|
|
8
3
|
import { Transition } from 'react-transition-group';
|
|
9
|
-
import { useTheme } from '@emotion/react';
|
|
10
4
|
import {
|
|
11
5
|
StyledIconInput,
|
|
12
6
|
StyledMenuBar,
|
|
@@ -17,7 +11,6 @@ import {
|
|
|
17
11
|
StyledSearchResultsContainer,
|
|
18
12
|
StyledSearchTextContainer,
|
|
19
13
|
} from './styled';
|
|
20
|
-
import { Masonry } from '../Masonry';
|
|
21
14
|
import { MostUsedType, OptionsType } from './types';
|
|
22
15
|
import { MostUsed } from './MostUsed';
|
|
23
16
|
import { MenuBlock } from './MenuBlock';
|
|
@@ -29,32 +22,35 @@ import {
|
|
|
29
22
|
} from './animations';
|
|
30
23
|
|
|
31
24
|
export interface MenubarProps {
|
|
25
|
+
options: OptionsType[];
|
|
32
26
|
leftComponents?: React.ReactNode;
|
|
33
27
|
rightComponents?: React.ReactNode;
|
|
34
|
-
inputPlaceholder?: string;
|
|
35
|
-
options: OptionsType[];
|
|
36
28
|
/** Limited to first 4 elements */
|
|
37
29
|
mostUsed?: MostUsedType[];
|
|
38
30
|
mostUsedLabel?: string;
|
|
31
|
+
searchable?: boolean;
|
|
32
|
+
searchPlaceholder?: string;
|
|
39
33
|
searchResultsLabel?: string;
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
const Menubar: React.FC<MenubarProps> = ({
|
|
43
37
|
leftComponents,
|
|
44
38
|
rightComponents,
|
|
45
|
-
|
|
39
|
+
searchPlaceholder = 'O quê você deseja buscar?',
|
|
46
40
|
options,
|
|
47
41
|
mostUsed,
|
|
48
42
|
mostUsedLabel = 'Mais acessados',
|
|
49
43
|
searchResultsLabel = 'Resultados da busca',
|
|
44
|
+
searchable = true,
|
|
50
45
|
}) => {
|
|
51
46
|
const [search, setSearch] = React.useState<string>('');
|
|
52
47
|
const [results, setResults] = React.useState<MostUsedType[]>([]);
|
|
53
48
|
const [input, setInput] = useDebouncedState('', state => setSearch(state));
|
|
54
|
-
const [
|
|
55
|
-
const theme = useTheme() as ThemeProp;
|
|
49
|
+
const [open, setOpen] = React.useState<boolean>(false);
|
|
56
50
|
|
|
57
|
-
const
|
|
51
|
+
const toggleOpen = React.useCallback(() => setOpen(state => !state), [
|
|
52
|
+
setOpen,
|
|
53
|
+
]);
|
|
58
54
|
|
|
59
55
|
React.useEffect(() => {
|
|
60
56
|
if (search === '') return;
|
|
@@ -64,12 +60,8 @@ const Menubar: React.FC<MenubarProps> = ({
|
|
|
64
60
|
return (
|
|
65
61
|
<>
|
|
66
62
|
<StyledMenuBar>
|
|
67
|
-
<StyledMenuButton
|
|
68
|
-
|
|
69
|
-
color="primary"
|
|
70
|
-
onPress={toggleOpenClose}
|
|
71
|
-
>
|
|
72
|
-
{!isOpen ? (
|
|
63
|
+
<StyledMenuButton variant="filled" color="primary" onPress={toggleOpen}>
|
|
64
|
+
{!open ? (
|
|
73
65
|
<Icon
|
|
74
66
|
size="deca"
|
|
75
67
|
name="menu"
|
|
@@ -86,12 +78,12 @@ const Menubar: React.FC<MenubarProps> = ({
|
|
|
86
78
|
)}
|
|
87
79
|
</StyledMenuButton>
|
|
88
80
|
{leftComponents}
|
|
89
|
-
<Transition in={
|
|
81
|
+
<Transition in={open} timeout={250}>
|
|
90
82
|
{state => (
|
|
91
|
-
<
|
|
92
|
-
|
|
83
|
+
<StyledInputContainer style={getInputContainerStyles(state)}>
|
|
84
|
+
{searchable && (
|
|
93
85
|
<StyledInput
|
|
94
|
-
placeholder={
|
|
86
|
+
placeholder={searchPlaceholder}
|
|
95
87
|
leftComponent={
|
|
96
88
|
<StyledIconInput>
|
|
97
89
|
<Icon name="magnify" type="material-community" />
|
|
@@ -100,43 +92,41 @@ const Menubar: React.FC<MenubarProps> = ({
|
|
|
100
92
|
value={input}
|
|
101
93
|
onChange={setInput}
|
|
102
94
|
/>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</div>
|
|
95
|
+
)}
|
|
96
|
+
</StyledInputContainer>
|
|
106
97
|
)}
|
|
107
98
|
</Transition>
|
|
99
|
+
{rightComponents}
|
|
108
100
|
</StyledMenuBar>
|
|
109
|
-
<Transition in={
|
|
101
|
+
<Transition in={open} timeout={250}>
|
|
110
102
|
{state => (
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</StyledContainerOpenMenu>
|
|
139
|
-
</div>
|
|
103
|
+
<StyledContainerOpenMenu style={getContainerOpenMenuStyles(state)}>
|
|
104
|
+
{!search ? (
|
|
105
|
+
<>
|
|
106
|
+
{mostUsed && (
|
|
107
|
+
<MostUsed
|
|
108
|
+
label={mostUsedLabel}
|
|
109
|
+
data={mostUsed}
|
|
110
|
+
toggle={toggleOpen}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
<MenuBlock options={options} toggle={toggleOpen} />
|
|
114
|
+
</>
|
|
115
|
+
) : (
|
|
116
|
+
<StyledSearchResultsContainer>
|
|
117
|
+
<StyledSearchTextContainer>
|
|
118
|
+
<Text fontWeight="bold">{searchResultsLabel}</Text>
|
|
119
|
+
</StyledSearchTextContainer>
|
|
120
|
+
{results.map(result => (
|
|
121
|
+
<SearchResultItem
|
|
122
|
+
key={`${result.title}-${result.category}`}
|
|
123
|
+
data={result}
|
|
124
|
+
searchTerm={search}
|
|
125
|
+
/>
|
|
126
|
+
))}
|
|
127
|
+
</StyledSearchResultsContainer>
|
|
128
|
+
)}
|
|
129
|
+
</StyledContainerOpenMenu>
|
|
140
130
|
)}
|
|
141
131
|
</Transition>
|
|
142
132
|
</>
|
|
@@ -6,9 +6,10 @@ import { MostUsedType } from '../types';
|
|
|
6
6
|
interface MostUsedProps {
|
|
7
7
|
data: MostUsedType[];
|
|
8
8
|
label: string;
|
|
9
|
+
toggle: () => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
const MostUsed: React.FC<MostUsedProps> = ({ data, label }) => {
|
|
12
|
+
const MostUsed: React.FC<MostUsedProps> = ({ data, label, toggle }) => {
|
|
12
13
|
const noTextDecoration = { textDecoration: 'none' };
|
|
13
14
|
|
|
14
15
|
return (
|
|
@@ -28,6 +29,7 @@ const MostUsed: React.FC<MostUsedProps> = ({ data, label }) => {
|
|
|
28
29
|
{...props}
|
|
29
30
|
style={noTextDecoration}
|
|
30
31
|
key={`${title}-${category}`}
|
|
32
|
+
onClick={toggle}
|
|
31
33
|
>
|
|
32
34
|
<StyledCard elevated key={`${title}-${category}`}>
|
|
33
35
|
<Text fontWeight="bold" colorVariant="primary">
|
|
@@ -49,4 +51,4 @@ const MostUsed: React.FC<MostUsedProps> = ({ data, label }) => {
|
|
|
49
51
|
);
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
export default MostUsed;
|
|
54
|
+
export default React.memo(MostUsed);
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { TransitionStatus } from 'react-transition-group';
|
|
3
|
-
import { ThemeProp } from '@tecsinapse/react-core';
|
|
4
3
|
|
|
5
|
-
const getDefaultInputContainerStyles =
|
|
6
|
-
display: 'flex',
|
|
7
|
-
flex: 1,
|
|
4
|
+
const getDefaultInputContainerStyles = {
|
|
8
5
|
transitionDuration: '250ms',
|
|
9
6
|
transitionProperty: 'opacity scale transform',
|
|
10
7
|
transitionTimingFunction: 'ease-in-out',
|
|
11
|
-
|
|
12
|
-
});
|
|
8
|
+
};
|
|
13
9
|
|
|
14
|
-
const getDefaultContainerOpenMenuStyles =
|
|
10
|
+
const getDefaultContainerOpenMenuStyles = {
|
|
15
11
|
transitionDuration: '250ms',
|
|
16
12
|
transitionProperty: 'opacity scale transform',
|
|
17
13
|
transitionTimingFunction: 'ease-in-out',
|
|
18
|
-
|
|
19
|
-
});
|
|
14
|
+
};
|
|
20
15
|
|
|
21
|
-
const getInputContainerTransform =
|
|
16
|
+
const getInputContainerTransform = {
|
|
22
17
|
entered: {
|
|
23
18
|
transform: 'scale(1, 1) translateY(0px)',
|
|
24
19
|
},
|
|
@@ -34,9 +29,9 @@ const getInputContainerTransform = () => ({
|
|
|
34
29
|
opacity: 0.5,
|
|
35
30
|
transform: 'scale(0.99, 0.99) translateY(-5px)',
|
|
36
31
|
},
|
|
37
|
-
}
|
|
32
|
+
};
|
|
38
33
|
|
|
39
|
-
const getContainerOpenMenuTransform =
|
|
34
|
+
const getContainerOpenMenuTransform = {
|
|
40
35
|
entered: {
|
|
41
36
|
transform: 'scale(1, 1) translateY(0px) ',
|
|
42
37
|
},
|
|
@@ -52,20 +47,18 @@ const getContainerOpenMenuTransform = () => ({
|
|
|
52
47
|
opacity: 0.95,
|
|
53
48
|
transform: 'scale(0.99, 0.99) translateY(0px)',
|
|
54
49
|
},
|
|
55
|
-
}
|
|
50
|
+
};
|
|
56
51
|
|
|
57
52
|
export const getInputContainerStyles = (
|
|
58
|
-
state: TransitionStatus
|
|
59
|
-
theme: ThemeProp
|
|
53
|
+
state: TransitionStatus
|
|
60
54
|
): CSSProperties => ({
|
|
61
|
-
...getDefaultInputContainerStyles
|
|
62
|
-
...getInputContainerTransform
|
|
55
|
+
...getDefaultInputContainerStyles,
|
|
56
|
+
...getInputContainerTransform[state],
|
|
63
57
|
});
|
|
64
58
|
|
|
65
59
|
export const getContainerOpenMenuStyles = (
|
|
66
|
-
state: TransitionStatus
|
|
67
|
-
theme: ThemeProp
|
|
60
|
+
state: TransitionStatus
|
|
68
61
|
): CSSProperties => ({
|
|
69
|
-
...getDefaultContainerOpenMenuStyles
|
|
70
|
-
...getContainerOpenMenuTransform
|
|
62
|
+
...getDefaultContainerOpenMenuStyles,
|
|
63
|
+
...getContainerOpenMenuTransform[state],
|
|
71
64
|
});
|