@tecsinapse/react-web-kit 1.5.0 → 1.6.3

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.
Files changed (131) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/components/atoms/Accordion/Accordion.d.ts +9 -0
  3. package/dist/components/atoms/Accordion/Accordion.js +85 -0
  4. package/dist/components/atoms/Accordion/Accordion.js.map +1 -0
  5. package/dist/components/atoms/Accordion/animations.d.ts +41 -0
  6. package/dist/components/atoms/Accordion/animations.js +65 -0
  7. package/dist/components/atoms/Accordion/animations.js.map +1 -0
  8. package/dist/components/atoms/Accordion/index.d.ts +1 -0
  9. package/dist/components/atoms/Accordion/index.js +24 -0
  10. package/dist/components/atoms/Accordion/index.js.map +1 -0
  11. package/dist/components/atoms/Accordion/styled.d.ts +8 -0
  12. package/dist/components/atoms/Accordion/styled.js +53 -0
  13. package/dist/components/atoms/Accordion/styled.js.map +1 -0
  14. package/dist/components/atoms/Badge/index.js +2 -2
  15. package/dist/components/atoms/Button/index.js +2 -2
  16. package/dist/components/atoms/Button/styled.js +5 -3
  17. package/dist/components/atoms/Button/styled.js.map +1 -1
  18. package/dist/components/atoms/Input/index.js +2 -2
  19. package/dist/components/atoms/Modal/Modal.d.ts +8 -0
  20. package/dist/components/atoms/Modal/Modal.js +43 -0
  21. package/dist/components/atoms/Modal/Modal.js.map +1 -0
  22. package/dist/components/atoms/Modal/animations.d.ts +23 -0
  23. package/dist/components/atoms/Modal/animations.js +32 -0
  24. package/dist/components/atoms/Modal/animations.js.map +1 -0
  25. package/dist/components/atoms/Modal/index.d.ts +1 -0
  26. package/dist/components/atoms/Modal/index.js +24 -0
  27. package/dist/components/atoms/Modal/index.js.map +1 -0
  28. package/dist/components/atoms/Modal/styled.d.ts +2 -0
  29. package/dist/components/atoms/Modal/styled.js +39 -0
  30. package/dist/components/atoms/Modal/styled.js.map +1 -0
  31. package/dist/components/atoms/Overlay/Overlay.d.ts +10 -0
  32. package/dist/components/atoms/Overlay/Overlay.js +40 -0
  33. package/dist/components/atoms/Overlay/Overlay.js.map +1 -0
  34. package/dist/components/atoms/Overlay/animations.d.ts +18 -0
  35. package/dist/components/atoms/Overlay/animations.js +27 -0
  36. package/dist/components/atoms/Overlay/animations.js.map +1 -0
  37. package/dist/components/atoms/Overlay/index.d.ts +1 -0
  38. package/dist/components/atoms/Overlay/index.js +16 -0
  39. package/dist/components/atoms/Overlay/index.js.map +1 -0
  40. package/dist/components/atoms/Overlay/styled.d.ts +2 -0
  41. package/dist/components/atoms/Overlay/styled.js +36 -0
  42. package/dist/components/atoms/Overlay/styled.js.map +1 -0
  43. package/dist/components/atoms/Skeleton/index.js +2 -2
  44. package/dist/components/atoms/Table/Toolbar/index.js +2 -2
  45. package/dist/components/atoms/Tag/index.js +2 -2
  46. package/dist/components/molecules/Breadcrumbs/BreadcrumbItem/index.js +2 -2
  47. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +3 -3
  48. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +3 -3
  49. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js.map +1 -1
  50. package/dist/components/molecules/Breadcrumbs/index.d.ts +1 -1
  51. package/dist/components/molecules/Breadcrumbs/index.js +8 -2
  52. package/dist/components/molecules/Breadcrumbs/index.js.map +1 -1
  53. package/dist/components/molecules/Drawer/Drawer.js +8 -11
  54. package/dist/components/molecules/Drawer/Drawer.js.map +1 -1
  55. package/dist/components/molecules/Drawer/animations.d.ts +0 -18
  56. package/dist/components/molecules/Drawer/animations.js +1 -21
  57. package/dist/components/molecules/Drawer/animations.js.map +1 -1
  58. package/dist/components/molecules/Drawer/index.js +2 -2
  59. package/dist/components/molecules/Drawer/styled.d.ts +0 -1
  60. package/dist/components/molecules/Drawer/styled.js +2 -21
  61. package/dist/components/molecules/Drawer/styled.js.map +1 -1
  62. package/dist/components/molecules/InputPassword/InputPassword.js +2 -2
  63. package/dist/components/molecules/InputPassword/index.js +2 -2
  64. package/dist/components/molecules/Menubar/MenuBlock/MenuBlock.d.ts +4 -3
  65. package/dist/components/molecules/Menubar/MenuBlock/MenuBlock.js +14 -5
  66. package/dist/components/molecules/Menubar/MenuBlock/MenuBlock.js.map +1 -1
  67. package/dist/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.d.ts +1 -0
  68. package/dist/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.js +6 -3
  69. package/dist/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.js.map +1 -1
  70. package/dist/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.d.ts +1 -0
  71. package/dist/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.js +4 -2
  72. package/dist/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.js.map +1 -1
  73. package/dist/components/molecules/Menubar/Menubar.d.ts +3 -2
  74. package/dist/components/molecules/Menubar/Menubar.js +26 -33
  75. package/dist/components/molecules/Menubar/Menubar.js.map +1 -1
  76. package/dist/components/molecules/Menubar/MostUsed/MostUsed.d.ts +3 -2
  77. package/dist/components/molecules/Menubar/MostUsed/MostUsed.js +6 -3
  78. package/dist/components/molecules/Menubar/MostUsed/MostUsed.js.map +1 -1
  79. package/dist/components/molecules/Menubar/SearchResultItem/SearchResultItem.d.ts +1 -0
  80. package/dist/components/molecules/Menubar/SearchResultItem/SearchResultItem.js +4 -2
  81. package/dist/components/molecules/Menubar/SearchResultItem/SearchResultItem.js.map +1 -1
  82. package/dist/components/molecules/Menubar/animations.d.ts +2 -2
  83. package/dist/components/molecules/Menubar/animations.js +14 -22
  84. package/dist/components/molecules/Menubar/animations.js.map +1 -1
  85. package/dist/components/molecules/Menubar/index.d.ts +1 -0
  86. package/dist/components/molecules/Menubar/index.js +26 -3
  87. package/dist/components/molecules/Menubar/index.js.map +1 -1
  88. package/dist/components/molecules/Menubar/styled.js +5 -2
  89. package/dist/components/molecules/Menubar/styled.js.map +1 -1
  90. package/dist/components/molecules/Menubar/types.js +4 -0
  91. package/dist/components/molecules/Select/index.js +2 -2
  92. package/dist/components/molecules/Snackbar/index.js +2 -2
  93. package/dist/components/molecules/Snackbar/styled.js +2 -2
  94. package/dist/components/organisms/DataGrid/index.js +2 -2
  95. package/dist/components/organisms/DataGrid/types.js +4 -0
  96. package/dist/index.d.ts +6 -3
  97. package/dist/index.js +99 -14
  98. package/dist/index.js.map +1 -1
  99. package/package.json +5 -5
  100. package/src/components/atoms/Accordion/Accordion.stories.tsx +35 -0
  101. package/src/components/atoms/Accordion/Accordion.tsx +99 -0
  102. package/src/components/atoms/Accordion/animations.ts +51 -0
  103. package/src/components/atoms/Accordion/index.ts +1 -0
  104. package/src/components/atoms/Accordion/styled.ts +35 -0
  105. package/src/components/atoms/Button/styled.ts +3 -1
  106. package/src/components/atoms/Modal/Modal.stories.tsx +55 -0
  107. package/src/components/atoms/Modal/Modal.tsx +34 -0
  108. package/src/components/atoms/Modal/animations.ts +12 -0
  109. package/src/components/atoms/Modal/index.ts +1 -0
  110. package/src/components/atoms/Modal/styled.ts +17 -0
  111. package/src/components/atoms/Overlay/Overlay.tsx +40 -0
  112. package/src/components/atoms/Overlay/animations.ts +11 -0
  113. package/src/components/atoms/Overlay/index.ts +1 -0
  114. package/src/components/atoms/Overlay/styled.ts +20 -0
  115. package/src/components/molecules/Breadcrumbs/Breadcrumbs.tsx +5 -5
  116. package/src/components/molecules/Breadcrumbs/index.ts +5 -1
  117. package/src/components/molecules/Drawer/Drawer.stories.tsx +10 -20
  118. package/src/components/molecules/Drawer/Drawer.tsx +3 -15
  119. package/src/components/molecules/Drawer/animations.ts +0 -11
  120. package/src/components/molecules/Drawer/styled.ts +1 -14
  121. package/src/components/molecules/Menubar/MenuBlock/MenuBlock.tsx +38 -31
  122. package/src/components/molecules/Menubar/MenuBlock/MenuItem/MenuItem.tsx +4 -2
  123. package/src/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/SubMenuBlock.tsx +3 -2
  124. package/src/components/molecules/Menubar/Menubar.stories.tsx +19 -13
  125. package/src/components/molecules/Menubar/Menubar.tsx +48 -57
  126. package/src/components/molecules/Menubar/MostUsed/MostUsed.tsx +4 -2
  127. package/src/components/molecules/Menubar/SearchResultItem/SearchResultItem.tsx +7 -2
  128. package/src/components/molecules/Menubar/animations.ts +14 -21
  129. package/src/components/molecules/Menubar/index.ts +5 -0
  130. package/src/components/molecules/Menubar/styled.ts +3 -2
  131. package/src/index.ts +16 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/Drawer/Drawer.tsx"],"names":["Drawer","open","anchorPosition","onClose","children","getStyles","state","stylesLeftRight","transitionLeftRight","stylesTopBottom","transitionTopBottom","includes","defaultStyleOverlay","transitionStylesOverlay","undefined"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAeA,MAAMA,MAAuB,GAAG,CAAC;AAC/BC,EAAAA,IAD+B;AAE/BC,EAAAA,cAAc,GAAG,OAFc;AAG/BC,EAAAA,OAH+B;AAI/BC,EAAAA;AAJ+B,CAAD,KAK1B;AACJ,QAAMC,SAAS,GAAG,CAACH,cAAD,EAAyBI,KAAzB,KAAwC;AACxD,UAAMC,eAAe,GAAG,wCAAuBL,cAAvB,CAAxB;AACA,UAAMM,mBAAmB,GAAG,2CAA0BN,cAA1B,CAA5B;AACA,UAAMO,eAAe,GAAG,wCAAuBP,cAAvB,CAAxB;AACA,UAAMQ,mBAAmB,GAAG,2CAA0BR,cAA1B,CAA5B;;AAEA,QAAI,CAAC,MAAD,EAAS,OAAT,EAAkBS,QAAlB,CAA2BT,cAA3B,CAAJ,EAAgD;AAC9C,aAAO,EACL,GAAGK,eADE;AAEL,WAAGC,mBAAmB,CAACF,KAAD;AAFjB,OAAP;AAID,KALD,MAKO;AACL,aAAO,EACL,GAAGG,eADE;AAEL,WAAGC,mBAAmB,CAACJ,KAAD;AAFjB,OAAP;AAID;AACF,GAjBD;;AAmBA,SACE,4DACE,6BAAC,gCAAD;AAAY,IAAA,EAAE,EAAEL,IAAhB;AAAsB,IAAA,OAAO,EAAE;AAA/B,KACGK,KAAK,IACJ;AACE,IAAA,KAAK,EAAE,EACL,GAAGM,+BADE;AAEL,SAAGC,oCAAwBP,KAAxB;AAFE;AADT,KAME,6BAAC,qBAAD;AAAe,IAAA,OAAO,EAAEL,IAAI,GAAGE,OAAH,GAAaW,SAAzC;AAAoD,IAAA,IAAI,EAAEb;AAA1D,IANF,CAFJ,CADF,EAaE,6BAAC,gCAAD;AAAY,IAAA,EAAE,EAAEA,IAAhB;AAAsB,IAAA,OAAO,EAAE;AAA/B,KACGK,KAAK,IACJ,6BAAC,6BAAD;AACE,IAAA,KAAK,EAAED,SAAS,CAACH,cAAD,EAAiBI,KAAjB,CADlB;AAEE,IAAA,cAAc,EAAEJ,cAFlB;AAGE,IAAA,OAAO,EAAEC,OAHX;AAIE,IAAA,IAAI,EAAEF;AAJR,KAMGG,QANH,CAFJ,CAbF,CADF;AA4BD,CArDD;;eAuDeJ,M","sourcesContent":["import React, { FC } from 'react';\nimport { StyledContainerDrawer, StyledOverlay } from './styled';\nimport { Transition } from 'react-transition-group';\nimport {\n transitionStylesTopBottom,\n defaultStylesTopBottom,\n defaultStylesLeftRight,\n transitionStylesOverlay,\n transitionStylesLeftRight,\n defaultStyleOverlay,\n} from './animations';\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n anchorPosition: 'left' | 'right' | 'top' | 'bottom';\n}\n\nconst Drawer: FC<DrawerProps> = ({\n open,\n anchorPosition = 'right',\n onClose,\n children,\n}) => {\n const getStyles = (anchorPosition: string, state: any) => {\n const stylesLeftRight = defaultStylesLeftRight(anchorPosition);\n const transitionLeftRight = transitionStylesLeftRight(anchorPosition);\n const stylesTopBottom = defaultStylesTopBottom(anchorPosition);\n const transitionTopBottom = transitionStylesTopBottom(anchorPosition);\n\n if (['left', 'right'].includes(anchorPosition)) {\n return {\n ...stylesLeftRight,\n ...transitionLeftRight[state],\n };\n } else {\n return {\n ...stylesTopBottom,\n ...transitionTopBottom[state],\n };\n }\n };\n\n return (\n <>\n <Transition in={open} timeout={300}>\n {state => (\n <div\n style={{\n ...defaultStyleOverlay,\n ...transitionStylesOverlay[state],\n }}\n >\n <StyledOverlay onClick={open ? onClose : undefined} show={open} />\n </div>\n )}\n </Transition>\n <Transition in={open} timeout={300}>\n {state => (\n <StyledContainerDrawer\n style={getStyles(anchorPosition, state)}\n anchorPosition={anchorPosition}\n onClose={onClose}\n open={open}\n >\n {children}\n </StyledContainerDrawer>\n )}\n </Transition>\n </>\n );\n};\n\nexport default Drawer;\n"],"file":"Drawer.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/Drawer/Drawer.tsx"],"names":["Drawer","open","anchorPosition","onClose","children","getStyles","state","stylesLeftRight","transitionLeftRight","stylesTopBottom","transitionTopBottom","includes"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;AAaA,MAAMA,MAAuB,GAAG,CAAC;AAC/BC,EAAAA,IAD+B;AAE/BC,EAAAA,cAAc,GAAG,OAFc;AAG/BC,EAAAA,OAH+B;AAI/BC,EAAAA;AAJ+B,CAAD,KAK1B;AACJ,QAAMC,SAAS,GAAG,CAACH,cAAD,EAAyBI,KAAzB,KAAwC;AACxD,UAAMC,eAAe,GAAG,wCAAuBL,cAAvB,CAAxB;AACA,UAAMM,mBAAmB,GAAG,2CAA0BN,cAA1B,CAA5B;AACA,UAAMO,eAAe,GAAG,wCAAuBP,cAAvB,CAAxB;AACA,UAAMQ,mBAAmB,GAAG,2CAA0BR,cAA1B,CAA5B;;AAEA,QAAI,CAAC,MAAD,EAAS,OAAT,EAAkBS,QAAlB,CAA2BT,cAA3B,CAAJ,EAAgD;AAC9C,aAAO,EACL,GAAGK,eADE;AAEL,WAAGC,mBAAmB,CAACF,KAAD;AAFjB,OAAP;AAID,KALD,MAKO;AACL,aAAO,EACL,GAAGG,eADE;AAEL,WAAGC,mBAAmB,CAACJ,KAAD;AAFjB,OAAP;AAID;AACF,GAjBD;;AAmBA,SACE,4DACE,6BAAC,gBAAD;AAAS,IAAA,OAAO,EAAE,GAAlB;AAAuB,IAAA,IAAI,EAAEL,IAA7B;AAAmC,IAAA,OAAO,EAAEE,OAA5C;AAAqD,IAAA,MAAM,EAAC;AAA5D,IADF,EAEE,6BAAC,gCAAD;AAAY,IAAA,EAAE,EAAEF,IAAhB;AAAsB,IAAA,OAAO,EAAE;AAA/B,KACGK,KAAK,IACJ,6BAAC,6BAAD;AACE,IAAA,KAAK,EAAED,SAAS,CAACH,cAAD,EAAiBI,KAAjB,CADlB;AAEE,IAAA,cAAc,EAAEJ,cAFlB;AAGE,IAAA,OAAO,EAAEC,OAHX;AAIE,IAAA,IAAI,EAAEF;AAJR,KAMGG,QANH,CAFJ,CAFF,CADF;AAiBD,CA1CD;;eA4CeJ,M","sourcesContent":["import React, { FC } from 'react';\nimport { StyledContainerDrawer } from './styled';\nimport { Transition } from 'react-transition-group';\nimport { Overlay } from '../../atoms/Overlay';\nimport {\n transitionStylesTopBottom,\n defaultStylesTopBottom,\n defaultStylesLeftRight,\n transitionStylesLeftRight,\n} from './animations';\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n anchorPosition: 'left' | 'right' | 'top' | 'bottom';\n}\n\nconst Drawer: FC<DrawerProps> = ({\n open,\n anchorPosition = 'right',\n onClose,\n children,\n}) => {\n const getStyles = (anchorPosition: string, state: any) => {\n const stylesLeftRight = defaultStylesLeftRight(anchorPosition);\n const transitionLeftRight = transitionStylesLeftRight(anchorPosition);\n const stylesTopBottom = defaultStylesTopBottom(anchorPosition);\n const transitionTopBottom = transitionStylesTopBottom(anchorPosition);\n\n if (['left', 'right'].includes(anchorPosition)) {\n return {\n ...stylesLeftRight,\n ...transitionLeftRight[state],\n };\n } else {\n return {\n ...stylesTopBottom,\n ...transitionTopBottom[state],\n };\n }\n };\n\n return (\n <>\n <Overlay timeout={300} open={open} onClose={onClose} zIndex=\"drawer\" />\n <Transition in={open} timeout={300}>\n {state => (\n <StyledContainerDrawer\n style={getStyles(anchorPosition, state)}\n anchorPosition={anchorPosition}\n onClose={onClose}\n open={open}\n >\n {children}\n </StyledContainerDrawer>\n )}\n </Transition>\n </>\n );\n};\n\nexport default Drawer;\n"],"file":"Drawer.js"}
@@ -1,21 +1,3 @@
1
- export declare const defaultStyleOverlay: {
2
- transition: string;
3
- opacity: number;
4
- };
5
- export declare const transitionStylesOverlay: {
6
- entering: {
7
- opacity: number;
8
- };
9
- entered: {
10
- opacity: number;
11
- };
12
- exiting: {
13
- opacity: number;
14
- };
15
- exited: {
16
- opacity: number;
17
- };
18
- };
19
1
  export declare const transformLeftRigthClose: (anchorPosition: string) => "translateX(100%)" | "translateX(-100%)";
20
2
  export declare const transformLeftRigthOpen = "translateX(0)";
21
3
  export declare const transformTopBottomClose: (anchorPosition: string) => "translateY(-100%)" | "translateY(100%)";
@@ -3,27 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.transitionStylesTopBottom = exports.defaultStylesTopBottom = exports.transitionStylesLeftRight = exports.defaultStylesLeftRight = exports.transformTopBottomOpen = exports.transformTopBottomClose = exports.transformLeftRigthOpen = exports.transformLeftRigthClose = exports.transitionStylesOverlay = exports.defaultStyleOverlay = void 0;
7
- const defaultStyleOverlay = {
8
- transition: `opacity 700ms ease-in-out`,
9
- opacity: 0
10
- };
11
- exports.defaultStyleOverlay = defaultStyleOverlay;
12
- const transitionStylesOverlay = {
13
- entering: {
14
- opacity: 1
15
- },
16
- entered: {
17
- opacity: 1
18
- },
19
- exiting: {
20
- opacity: 0
21
- },
22
- exited: {
23
- opacity: 0
24
- }
25
- };
26
- exports.transitionStylesOverlay = transitionStylesOverlay;
6
+ exports.transitionStylesTopBottom = exports.defaultStylesTopBottom = exports.transitionStylesLeftRight = exports.defaultStylesLeftRight = exports.transformTopBottomOpen = exports.transformTopBottomClose = exports.transformLeftRigthOpen = exports.transformLeftRigthClose = void 0;
27
7
 
28
8
  const transformLeftRigthClose = anchorPosition => anchorPosition === 'right' ? 'translateX(100%)' : 'translateX(-100%)';
29
9
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/Drawer/animations.ts"],"names":["defaultStyleOverlay","transition","opacity","transitionStylesOverlay","entering","entered","exiting","exited","transformLeftRigthClose","anchorPosition","transformLeftRigthOpen","transformTopBottomClose","transformTopBottomOpen","defaultStylesLeftRight","transform","overflow","transitionStylesLeftRight","defaultStylesTopBottom","transitionStylesTopBottom"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAG;AACjCC,EAAAA,UAAU,EAAG,2BADoB;AAEjCC,EAAAA,OAAO,EAAE;AAFwB,CAA5B;;AAIA,MAAMC,uBAAuB,GAAG;AACrCC,EAAAA,QAAQ,EAAE;AAAEF,IAAAA,OAAO,EAAE;AAAX,GAD2B;AAErCG,EAAAA,OAAO,EAAE;AAAEH,IAAAA,OAAO,EAAE;AAAX,GAF4B;AAGrCI,EAAAA,OAAO,EAAE;AAAEJ,IAAAA,OAAO,EAAE;AAAX,GAH4B;AAIrCK,EAAAA,MAAM,EAAE;AAAEL,IAAAA,OAAO,EAAE;AAAX;AAJ6B,CAAhC;;;AAOA,MAAMM,uBAAuB,GAAIC,cAAD,IACrCA,cAAc,KAAK,OAAnB,GAA6B,kBAA7B,GAAkD,mBAD7C;;;AAGA,MAAMC,sBAAsB,GAAG,eAA/B;;;AAEA,MAAMC,uBAAuB,GAAIF,cAAD,IACrCA,cAAc,KAAK,KAAnB,GAA2B,mBAA3B,GAAiD,kBAD5C;;;AAGA,MAAMG,sBAAsB,GAAG,gBAA/B;;;AAEA,MAAMC,sBAAsB,GAAIJ,cAAD,IAA4B;AAChE,SAAO;AACLR,IAAAA,UAAU,EAAE,6BADP;AAELa,IAAAA,SAAS,EAAE,MAAMN,uBAAuB,CAACC,cAAD,CAFnC;AAGLM,IAAAA,QAAQ,EAAE;AAHL,GAAP;AAKD,CANM;;;;AAQA,MAAMC,yBAAyB,GAAIP,cAAD,IAA4B;AACnE,SAAO;AACLL,IAAAA,QAAQ,EAAE;AAAEU,MAAAA,SAAS,EAAEN,uBAAuB,CAACC,cAAD;AAApC,KADL;AAELJ,IAAAA,OAAO,EAAE;AACPS,MAAAA,SAAS,EAAEJ;AADJ,KAFJ;AAKLJ,IAAAA,OAAO,EAAE;AACPQ,MAAAA,SAAS,EAAEJ;AADJ,KALJ;AAQLH,IAAAA,MAAM,EAAE;AAAEO,MAAAA,SAAS,EAAEN,uBAAuB,CAACC,cAAD;AAApC;AARH,GAAP;AAUD,CAXM;;;;AAaA,MAAMQ,sBAAsB,GAAIR,cAAD,IAA4B;AAChE,SAAO;AACLR,IAAAA,UAAU,EAAE,6BADP;AAELa,IAAAA,SAAS,EAAEH,uBAAuB,CAACF,cAAD,CAF7B;AAGLM,IAAAA,QAAQ,EAAE;AAHL,GAAP;AAKD,CANM;;;;AAOA,MAAMG,yBAAyB,GAAIT,cAAD,IAA4B;AACnE,SAAO;AACLL,IAAAA,QAAQ,EAAE;AAAEU,MAAAA,SAAS,EAAEH,uBAAuB,CAACF,cAAD;AAApC,KADL;AAELJ,IAAAA,OAAO,EAAE;AACPS,MAAAA,SAAS,EAAEF;AADJ,KAFJ;AAKLN,IAAAA,OAAO,EAAE;AACPQ,MAAAA,SAAS,EAAEF;AADJ,KALJ;AAQLL,IAAAA,MAAM,EAAE;AAAEO,MAAAA,SAAS,EAAEH,uBAAuB,CAACF,cAAD;AAApC;AARH,GAAP;AAUD,CAXM","sourcesContent":["export const defaultStyleOverlay = {\n transition: `opacity 700ms ease-in-out`,\n opacity: 0,\n};\nexport const transitionStylesOverlay = {\n entering: { opacity: 1 },\n entered: { opacity: 1 },\n exiting: { opacity: 0 },\n exited: { opacity: 0 },\n};\n\nexport const transformLeftRigthClose = (anchorPosition: string) =>\n anchorPosition === 'right' ? 'translateX(100%)' : 'translateX(-100%)';\n\nexport const transformLeftRigthOpen = 'translateX(0)';\n\nexport const transformTopBottomClose = (anchorPosition: string) =>\n anchorPosition === 'top' ? 'translateY(-100%)' : 'translateY(100%)';\n\nexport const transformTopBottomOpen = 'translateY(0%)';\n\nexport const defaultStylesLeftRight = (anchorPosition: string) => {\n return {\n transition: 'transform 300ms ease-in-out',\n transform: () => transformLeftRigthClose(anchorPosition),\n overflow: 'hidden',\n };\n};\n\nexport const transitionStylesLeftRight = (anchorPosition: string) => {\n return {\n entering: { transform: transformLeftRigthClose(anchorPosition) },\n entered: {\n transform: transformLeftRigthOpen,\n },\n exiting: {\n transform: transformLeftRigthOpen,\n },\n exited: { transform: transformLeftRigthClose(anchorPosition) },\n };\n};\n\nexport const defaultStylesTopBottom = (anchorPosition: string) => {\n return {\n transition: 'transform 300ms ease-in-out',\n transform: transformTopBottomClose(anchorPosition),\n overflow: 'hidden',\n };\n};\nexport const transitionStylesTopBottom = (anchorPosition: string) => {\n return {\n entering: { transform: transformTopBottomClose(anchorPosition) },\n entered: {\n transform: transformTopBottomOpen,\n },\n exiting: {\n transform: transformTopBottomOpen,\n },\n exited: { transform: transformTopBottomClose(anchorPosition) },\n };\n};\n"],"file":"animations.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/Drawer/animations.ts"],"names":["transformLeftRigthClose","anchorPosition","transformLeftRigthOpen","transformTopBottomClose","transformTopBottomOpen","defaultStylesLeftRight","transition","transform","overflow","transitionStylesLeftRight","entering","entered","exiting","exited","defaultStylesTopBottom","transitionStylesTopBottom"],"mappings":";;;;;;;AAAO,MAAMA,uBAAuB,GAAIC,cAAD,IACrCA,cAAc,KAAK,OAAnB,GAA6B,kBAA7B,GAAkD,mBAD7C;;;AAGA,MAAMC,sBAAsB,GAAG,eAA/B;;;AAEA,MAAMC,uBAAuB,GAAIF,cAAD,IACrCA,cAAc,KAAK,KAAnB,GAA2B,mBAA3B,GAAiD,kBAD5C;;;AAGA,MAAMG,sBAAsB,GAAG,gBAA/B;;;AAEA,MAAMC,sBAAsB,GAAIJ,cAAD,IAA4B;AAChE,SAAO;AACLK,IAAAA,UAAU,EAAE,6BADP;AAELC,IAAAA,SAAS,EAAE,MAAMP,uBAAuB,CAACC,cAAD,CAFnC;AAGLO,IAAAA,QAAQ,EAAE;AAHL,GAAP;AAKD,CANM;;;;AAQA,MAAMC,yBAAyB,GAAIR,cAAD,IAA4B;AACnE,SAAO;AACLS,IAAAA,QAAQ,EAAE;AAAEH,MAAAA,SAAS,EAAEP,uBAAuB,CAACC,cAAD;AAApC,KADL;AAELU,IAAAA,OAAO,EAAE;AACPJ,MAAAA,SAAS,EAAEL;AADJ,KAFJ;AAKLU,IAAAA,OAAO,EAAE;AACPL,MAAAA,SAAS,EAAEL;AADJ,KALJ;AAQLW,IAAAA,MAAM,EAAE;AAAEN,MAAAA,SAAS,EAAEP,uBAAuB,CAACC,cAAD;AAApC;AARH,GAAP;AAUD,CAXM;;;;AAaA,MAAMa,sBAAsB,GAAIb,cAAD,IAA4B;AAChE,SAAO;AACLK,IAAAA,UAAU,EAAE,6BADP;AAELC,IAAAA,SAAS,EAAEJ,uBAAuB,CAACF,cAAD,CAF7B;AAGLO,IAAAA,QAAQ,EAAE;AAHL,GAAP;AAKD,CANM;;;;AAOA,MAAMO,yBAAyB,GAAId,cAAD,IAA4B;AACnE,SAAO;AACLS,IAAAA,QAAQ,EAAE;AAAEH,MAAAA,SAAS,EAAEJ,uBAAuB,CAACF,cAAD;AAApC,KADL;AAELU,IAAAA,OAAO,EAAE;AACPJ,MAAAA,SAAS,EAAEH;AADJ,KAFJ;AAKLQ,IAAAA,OAAO,EAAE;AACPL,MAAAA,SAAS,EAAEH;AADJ,KALJ;AAQLS,IAAAA,MAAM,EAAE;AAAEN,MAAAA,SAAS,EAAEJ,uBAAuB,CAACF,cAAD;AAApC;AARH,GAAP;AAUD,CAXM","sourcesContent":["export const transformLeftRigthClose = (anchorPosition: string) =>\n anchorPosition === 'right' ? 'translateX(100%)' : 'translateX(-100%)';\n\nexport const transformLeftRigthOpen = 'translateX(0)';\n\nexport const transformTopBottomClose = (anchorPosition: string) =>\n anchorPosition === 'top' ? 'translateY(-100%)' : 'translateY(100%)';\n\nexport const transformTopBottomOpen = 'translateY(0%)';\n\nexport const defaultStylesLeftRight = (anchorPosition: string) => {\n return {\n transition: 'transform 300ms ease-in-out',\n transform: () => transformLeftRigthClose(anchorPosition),\n overflow: 'hidden',\n };\n};\n\nexport const transitionStylesLeftRight = (anchorPosition: string) => {\n return {\n entering: { transform: transformLeftRigthClose(anchorPosition) },\n entered: {\n transform: transformLeftRigthOpen,\n },\n exiting: {\n transform: transformLeftRigthOpen,\n },\n exited: { transform: transformLeftRigthClose(anchorPosition) },\n };\n};\n\nexport const defaultStylesTopBottom = (anchorPosition: string) => {\n return {\n transition: 'transform 300ms ease-in-out',\n transform: transformTopBottomClose(anchorPosition),\n overflow: 'hidden',\n };\n};\nexport const transitionStylesTopBottom = (anchorPosition: string) => {\n return {\n entering: { transform: transformTopBottomClose(anchorPosition) },\n entered: {\n transform: transformTopBottomOpen,\n },\n exiting: {\n transform: transformTopBottomOpen,\n },\n exited: { transform: transformTopBottomClose(anchorPosition) },\n };\n};\n"],"file":"animations.js"}
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "DrawerProps", {
18
18
 
19
19
  var _Drawer = _interopRequireWildcard(require("./Drawer"));
20
20
 
21
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
21
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
22
 
23
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
24
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledOverlay: import("@emotion/styled").StyledComponent<any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
3
2
  export declare const StyledContainerDrawer: import("@emotion/styled").StyledComponent<any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -3,33 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledContainerDrawer = exports.StyledOverlay = void 0;
6
+ exports.StyledContainerDrawer = void 0;
7
7
 
8
8
  var _styled = _interopRequireDefault(require("@emotion/styled"));
9
9
 
10
- var _reactCore = require("@tecsinapse/react-core");
11
-
12
10
  var _react = require("@emotion/react");
13
11
 
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
13
 
16
- const StyledOverlay = (0, _styled.default)('div')`
17
- background: ${({
18
- theme
19
- }) => (0, _reactCore.hex2rgba)(theme.miscellaneous.overlay, 0.5)};
20
- width: 100vw;
21
- height: 100vh;
22
- z-index: ${({
23
- theme,
24
- show
25
- }) => show ? theme.zIndex.drawer : theme.zIndex.default};
26
- cursor: ${({
27
- show
28
- }) => show ? 'pointer' : 'default'};
29
- position: absolute;
30
- `;
31
- exports.StyledOverlay = StyledOverlay;
32
-
33
14
  const anchorLeft = ({
34
15
  theme,
35
16
  anchorPosition
@@ -90,7 +71,7 @@ const baseStyles = ({
90
71
  position: fixed;
91
72
  overflow: hidden;
92
73
  background-color: ${theme.miscellaneous.bodyColor};
93
- z-index: ${theme.zIndex.drawer + 1};
74
+ z-index: ${theme.zIndex.drawer};
94
75
  `;
95
76
  };
96
77
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/Drawer/styled.ts"],"names":["StyledOverlay","theme","miscellaneous","overlay","show","zIndex","drawer","default","anchorLeft","anchorPosition","borderRadius","centi","anchorRight","anchorTop","anchorBottom","baseStyles","includes","bodyColor","StyledContainerDrawer","props"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;AAEO,MAAMA,aAAa,GAAG,qBAAO,KAAP,CAE3B;AACF,gBAAgB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KACZ,yBAASA,KAAK,CAACC,aAAN,CAAoBC,OAA7B,EAAsC,GAAtC,CAA2C;AAC/C;AACA;AACA,aAAa,CAAC;AAAEF,EAAAA,KAAF;AAASG,EAAAA;AAAT,CAAD,KACTA,IAAI,GAAGH,KAAK,CAACI,MAAN,CAAaC,MAAhB,GAAyBL,KAAK,CAACI,MAAN,CAAaE,OAAQ;AACtD,YAAY,CAAC;AAAEH,EAAAA;AAAF,CAAD,KAAeA,IAAI,GAAG,SAAH,GAAe,SAAW;AACzD;AACA,CAXO;;;AAaP,MAAMI,UAAU,GAAG,CAAC;AAAEP,EAAAA,KAAF;AAASQ,EAAAA;AAAT,CAAD,KAAyD;AAC1E,SACEA,cAAc,KAAK,MAAnB,IACA,eAAI;AACR;AACA;AACA,iCAAiCR,KAAK,CAACS,YAAN,CAAmBC,KAAM;AAC1D,oCAAoCV,KAAK,CAACS,YAAN,CAAmBC,KAAM;AAC7D,KAPE;AASD,CAVD;;AAWA,MAAMC,WAAW,GAAG,CAAC;AAAEX,EAAAA,KAAF;AAASQ,EAAAA;AAAT,CAAD,KAAyD;AAC3E,SACEA,cAAc,KAAK,OAAnB,IACA,eAAI;AACR;AACA;AACA,gCAAgCR,KAAK,CAACS,YAAN,CAAmBC,KAAM;AACzD,mCAAmCV,KAAK,CAACS,YAAN,CAAmBC,KAAM;AAC5D,KAPE;AASD,CAVD;;AAYA,MAAME,SAAS,GAAG,CAAC;AAAEZ,EAAAA,KAAF;AAASQ,EAAAA;AAAT,CAAD,KAAyD;AACzE,SACEA,cAAc,KAAK,KAAnB,IACA,eAAI;AACR;AACA;AACA;AACA,oCAAoCR,KAAK,CAACS,YAAN,CAAmBC,KAAM;AAC7D,mCAAmCV,KAAK,CAACS,YAAN,CAAmBC,KAAM;AAC5D,KARE;AAUD,CAXD;;AAaA,MAAMG,YAAY,GAAG,CAAC;AAAEb,EAAAA,KAAF;AAASQ,EAAAA;AAAT,CAAD,KAAyD;AAC5E,SACEA,cAAc,KAAK,QAAnB,IACA,eAAI;AACR;AACA;AACA;AACA,iCAAiCR,KAAK,CAACS,YAAN,CAAmBC,KAAM;AAC1D,gCAAgCV,KAAK,CAACS,YAAN,CAAmBC,KAAM;AACzD,KARE;AAUD,CAXD;;AAaA,MAAMI,UAAU,GAAG,CAAC;AAAEd,EAAAA,KAAF;AAASQ,EAAAA;AAAT,CAAD,KAAyD;AAC1E,SAAO,eAAI;AACb,cAAc,CAAC,MAAD,EAAS,OAAT,EAAkBO,QAAlB,CAA2BP,cAA3B,KAA8C,OAAQ;AACpE,aAAa,CAAC,KAAD,EAAQ,QAAR,EAAkBO,QAAlB,CAA2BP,cAA3B,KAA8C,OAAQ;AACnE;AACA;AACA,wBAAwBR,KAAK,CAACC,aAAN,CAAoBe,SAAU;AACtD,eAAehB,KAAK,CAACI,MAAN,CAAaC,MAAb,GAAsB,CAAE;AACvC,GAPE;AAQD,CATD;;AAWO,MAAMY,qBAAqB,GAAG,qBAAO,KAAP,EAGnCC,KAAK,IAAI,eAAI;AACf,MAAMJ,UAAU,CAACI,KAAD,CAAQ;AACxB,MAAML,YAAY,CAACK,KAAD,CAAQ;AAC1B,MAAMN,SAAS,CAACM,KAAD,CAAQ;AACvB,MAAMX,UAAU,CAACW,KAAD,CAAQ;AACxB,MAAMP,WAAW,CAACO,KAAD,CAAQ;AACzB,GATqC,CAA9B","sourcesContent":["import styled from '@emotion/styled';\nimport { hex2rgba, StyleProps } from '@tecsinapse/react-core';\nimport { DrawerProps } from './Drawer';\nimport { css } from '@emotion/react';\n\nexport const StyledOverlay = styled('div')<\n Partial<StyleProps> & { show: boolean }\n>`\n background: ${({ theme }: StyleProps) =>\n hex2rgba(theme.miscellaneous.overlay, 0.5)};\n width: 100vw;\n height: 100vh;\n z-index: ${({ theme, show }: StyleProps & { show: boolean }) =>\n show ? theme.zIndex.drawer : theme.zIndex.default};\n cursor: ${({ show }) => (show ? 'pointer' : 'default')};\n position: absolute;\n`;\n\nconst anchorLeft = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'left' &&\n css`\n left: 0;\n top: 0;\n border-top-right-radius: ${theme.borderRadius.centi};\n border-bottom-right-radius: ${theme.borderRadius.centi};\n `\n );\n};\nconst anchorRight = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'right' &&\n css`\n right: 0;\n top: 0;\n border-top-left-radius: ${theme.borderRadius.centi};\n border-bottom-left-radius: ${theme.borderRadius.centi};\n `\n );\n};\n\nconst anchorTop = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'top' &&\n css`\n left: 0;\n right: 0;\n top: 0;\n border-bottom-right-radius: ${theme.borderRadius.centi};\n border-bottom-left-radius: ${theme.borderRadius.centi};\n `\n );\n};\n\nconst anchorBottom = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'bottom' &&\n css`\n left: 0;\n right: 0;\n bottom: 0;\n border-top-right-radius: ${theme.borderRadius.centi};\n border-top-left-radius: ${theme.borderRadius.centi};\n `\n );\n};\n\nconst baseStyles = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return css`\n height: ${['left', 'right'].includes(anchorPosition) && '100vh'};\n width: ${['top', 'bottom'].includes(anchorPosition) && '100wh'};\n position: fixed;\n overflow: hidden;\n background-color: ${theme.miscellaneous.bodyColor};\n z-index: ${theme.zIndex.drawer + 1};\n `;\n};\n\nexport const StyledContainerDrawer = styled('div')<\n DrawerProps & Partial<StyleProps>\n>(\n props => css`\n ${baseStyles(props)}\n ${anchorBottom(props)}\n ${anchorTop(props)}\n ${anchorLeft(props)}\n ${anchorRight(props)}\n `\n);\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/Drawer/styled.ts"],"names":["anchorLeft","theme","anchorPosition","borderRadius","centi","anchorRight","anchorTop","anchorBottom","baseStyles","includes","miscellaneous","bodyColor","zIndex","drawer","StyledContainerDrawer","props"],"mappings":";;;;;;;AAAA;;AAGA;;;;AAEA,MAAMA,UAAU,GAAG,CAAC;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KAAyD;AAC1E,SACEA,cAAc,KAAK,MAAnB,IACA,eAAI;AACR;AACA;AACA,iCAAiCD,KAAK,CAACE,YAAN,CAAmBC,KAAM;AAC1D,oCAAoCH,KAAK,CAACE,YAAN,CAAmBC,KAAM;AAC7D,KAPE;AASD,CAVD;;AAWA,MAAMC,WAAW,GAAG,CAAC;AAAEJ,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KAAyD;AAC3E,SACEA,cAAc,KAAK,OAAnB,IACA,eAAI;AACR;AACA;AACA,gCAAgCD,KAAK,CAACE,YAAN,CAAmBC,KAAM;AACzD,mCAAmCH,KAAK,CAACE,YAAN,CAAmBC,KAAM;AAC5D,KAPE;AASD,CAVD;;AAYA,MAAME,SAAS,GAAG,CAAC;AAAEL,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KAAyD;AACzE,SACEA,cAAc,KAAK,KAAnB,IACA,eAAI;AACR;AACA;AACA;AACA,oCAAoCD,KAAK,CAACE,YAAN,CAAmBC,KAAM;AAC7D,mCAAmCH,KAAK,CAACE,YAAN,CAAmBC,KAAM;AAC5D,KARE;AAUD,CAXD;;AAaA,MAAMG,YAAY,GAAG,CAAC;AAAEN,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KAAyD;AAC5E,SACEA,cAAc,KAAK,QAAnB,IACA,eAAI;AACR;AACA;AACA;AACA,iCAAiCD,KAAK,CAACE,YAAN,CAAmBC,KAAM;AAC1D,gCAAgCH,KAAK,CAACE,YAAN,CAAmBC,KAAM;AACzD,KARE;AAUD,CAXD;;AAaA,MAAMI,UAAU,GAAG,CAAC;AAAEP,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KAAyD;AAC1E,SAAO,eAAI;AACb,cAAc,CAAC,MAAD,EAAS,OAAT,EAAkBO,QAAlB,CAA2BP,cAA3B,KAA8C,OAAQ;AACpE,aAAa,CAAC,KAAD,EAAQ,QAAR,EAAkBO,QAAlB,CAA2BP,cAA3B,KAA8C,OAAQ;AACnE;AACA;AACA,wBAAwBD,KAAK,CAACS,aAAN,CAAoBC,SAAU;AACtD,eAAeV,KAAK,CAACW,MAAN,CAAaC,MAAO;AACnC,GAPE;AAQD,CATD;;AAWO,MAAMC,qBAAqB,GAAG,qBAAO,KAAP,EAGnCC,KAAK,IAAI,eAAI;AACf,MAAMP,UAAU,CAACO,KAAD,CAAQ;AACxB,MAAMR,YAAY,CAACQ,KAAD,CAAQ;AAC1B,MAAMT,SAAS,CAACS,KAAD,CAAQ;AACvB,MAAMf,UAAU,CAACe,KAAD,CAAQ;AACxB,MAAMV,WAAW,CAACU,KAAD,CAAQ;AACzB,GATqC,CAA9B","sourcesContent":["import styled from '@emotion/styled';\nimport { hex2rgba, StyleProps } from '@tecsinapse/react-core';\nimport { DrawerProps } from './Drawer';\nimport { css } from '@emotion/react';\n\nconst anchorLeft = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'left' &&\n css`\n left: 0;\n top: 0;\n border-top-right-radius: ${theme.borderRadius.centi};\n border-bottom-right-radius: ${theme.borderRadius.centi};\n `\n );\n};\nconst anchorRight = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'right' &&\n css`\n right: 0;\n top: 0;\n border-top-left-radius: ${theme.borderRadius.centi};\n border-bottom-left-radius: ${theme.borderRadius.centi};\n `\n );\n};\n\nconst anchorTop = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'top' &&\n css`\n left: 0;\n right: 0;\n top: 0;\n border-bottom-right-radius: ${theme.borderRadius.centi};\n border-bottom-left-radius: ${theme.borderRadius.centi};\n `\n );\n};\n\nconst anchorBottom = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return (\n anchorPosition === 'bottom' &&\n css`\n left: 0;\n right: 0;\n bottom: 0;\n border-top-right-radius: ${theme.borderRadius.centi};\n border-top-left-radius: ${theme.borderRadius.centi};\n `\n );\n};\n\nconst baseStyles = ({ theme, anchorPosition }: StyleProps & DrawerProps) => {\n return css`\n height: ${['left', 'right'].includes(anchorPosition) && '100vh'};\n width: ${['top', 'bottom'].includes(anchorPosition) && '100wh'};\n position: fixed;\n overflow: hidden;\n background-color: ${theme.miscellaneous.bodyColor};\n z-index: ${theme.zIndex.drawer};\n `;\n};\n\nexport const StyledContainerDrawer = styled('div')<\n DrawerProps & Partial<StyleProps>\n>(\n props => css`\n ${baseStyles(props)}\n ${anchorBottom(props)}\n ${anchorTop(props)}\n ${anchorLeft(props)}\n ${anchorRight(props)}\n `\n);\n"],"file":"styled.js"}
@@ -11,9 +11,9 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _Input = require("../../atoms/Input");
13
13
 
14
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
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
 
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "InputPasswordWebProps", {
18
18
 
19
19
  var _InputPassword = _interopRequireWildcard(require("./InputPassword"));
20
20
 
21
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
21
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
22
 
23
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
24
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { OptionsType } from '../types';
3
3
  interface MenuBlockProps {
4
- data: OptionsType;
4
+ toggle: () => void;
5
+ options: OptionsType[];
5
6
  }
6
- declare const MenuBlock: React.FC<MenuBlockProps>;
7
- export default MenuBlock;
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
- data
21
+ options,
22
+ toggle
20
23
  }) => {
21
- return _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, {
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","map","Component","props","rightComponents"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAWA,MAAMA,SAAmC,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAc;AACxD,SACE,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,CAAWC,GAAX,CACC,CAAC;AACCF,IAAAA,KADD;AAECG,IAAAA,SAFD;AAGCC,IAAAA,KAHD;AAICC,IAAAA,eAJD;AAKCJ,IAAAA;AALD,GAAD,KAOE,6BAAC,kBAAD;AACE,IAAA,KAAK,EAAEA,KADT;AAEE,IAAA,GAAG,EAAED,KAFP;AAGE,IAAA,KAAK,EAAEA,KAHT;AAIE,IAAA,SAAS,EAAEG,SAJb;AAKE,IAAA,eAAe,EAAEE,eALnB;AAME,IAAA,KAAK,EAAED;AANT,IARH,CADH,CAPF,CADF;AA8BD,CA/BD;;eAiCeP,S","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';\n\ninterface MenuBlockProps {\n data: OptionsType;\n}\n\nconst MenuBlock: React.FC<MenuBlockProps> = ({ data }) => {\n return (\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 />\n )\n )}\n </StyledContainerItems>\n </>\n );\n};\n\nexport default MenuBlock;\n"],"file":"MenuBlock.js"}
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"}
@@ -4,6 +4,7 @@ interface MenuItemProps {
4
4
  title: string;
5
5
  Component: ElementType;
6
6
  props: any;
7
+ toggle: () => void;
7
8
  rightComponents?: React.ReactNode;
8
9
  items?: ItemsOptions[];
9
10
  }
@@ -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;;;;;;AAaA,MAAMA,QAAiC,GAAG,CAAC;AACzCC,EAAAA,KADyC;AAEzCC,EAAAA,SAAS,GAAG,GAF6B;AAGzCC,EAAAA,KAAK,GAAG,EAHiC;AAIzCC,EAAAA,eAJyC;AAKzCC,EAAAA;AALyC,CAAD,KAMpC;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,EAAEL;AAA9B,KACE,6BAAC,SAAD,eAAeE,KAAf;AAAsB,IAAA,KAAK,EAAEO;AAA7B,MACE,6BAAC,eAAD;AACE,IAAA,YAAY,EAAEJ,IAAI,GAAG,SAAH,GAAe,WADnC;AAEE,IAAA,SAAS,EAAEA,IAAI,GAAG,QAAH,GAAc;AAF/B,KAIE,6BAAC,kBAAD,QAAaL,KAAb,CAJF,CADF,CADF,EASGG,eAAe,IAAI,CAACC,KAApB,IACC,6BAAC,4BAAD,QAAuBD,eAAvB,CAVJ,EAYGC,KAAK,IACJ,6BAAC,wBAAD;AAAiB,IAAA,OAAO,EAAEQ;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,KACHD,KADG,aACHA,KADG,uBACHA,KAAK,CAAES,GAAP,CAAWC,OAAO,IAChB,6BAAC,0BAAD;AAAc,IAAA,GAAG,EAAEA,OAAO,CAACd,KAA3B;AAAkC,IAAA,IAAI,EAAEc;AAAxC,IADF,CADG,CAvBP,CADF;AA8BD,CA9CD;;eAgDef,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 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}) => {\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}>\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} />\n ))}\n </>\n );\n};\n\nexport default MenuItem;\n"],"file":"MenuItem.js"}
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"}
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { ItemsOptions } from '../../../types';
3
3
  interface SubMenuBlockProps {
4
4
  data: ItemsOptions;
5
+ toggle: () => void;
5
6
  }
6
7
  declare const SubMenuBlock: React.FC<SubMenuBlockProps>;
7
8
  export default SubMenuBlock;
@@ -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",
@@ -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;;;;;;AAMA,MAAMA,YAAyC,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAc;AAC9D,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,KAAb;AAAoBC,IAAAA,eAApB;AAAqCC,IAAAA;AAArC,MAA+CJ,IAArD;AAEA,QAAMK,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;AAA7B,MACE,6BAAC,eAAD;AAAM,IAAA,YAAY,EAAC,WAAnB;AAA+B,IAAA,SAAS,EAAC,QAAzC;AAAkD,IAAA,UAAU,EAAC;AAA7D,KACE,6BAAC,kBAAD,QAAaD,KAAb,CADF,CADF,CAFF,EAOGD,eAAe,IACd,6BAAC,4BAAD,QAAuBA,eAAvB,CARJ,CADF;AAaD,CAlBD;;eAoBeJ,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}\n\nconst SubMenuBlock: React.FC<SubMenuBlockProps> = ({ data }) => {\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}>\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
+ {"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
- inputPlaceholder = 'O quê você deseja buscar?',
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 [isOpen, setOpen] = _react.default.useState(false);
48
-
49
- const theme = (0, _react2.useTheme)();
44
+ const [open, setOpen] = _react.default.useState(false);
50
45
 
51
- const toggleOpenClose = () => setOpen(!isOpen);
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: toggleOpenClose
62
- }, !isOpen ? _react.default.createElement(_reactCore.Icon, {
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,38 @@ const Menubar = ({
70
65
  type: "material-community",
71
66
  fontColor: "light"
72
67
  })), leftComponents, _react.default.createElement(_reactTransitionGroup.Transition, {
73
- in: isOpen,
68
+ in: open,
74
69
  timeout: 250
75
- }, state => _react.default.createElement("div", {
76
- style: (0, _animations.getInputContainerStyles)(state, theme)
77
- }, _react.default.createElement(_styled.StyledInputContainer, null, _react.default.createElement(_styled.StyledInput, {
78
- placeholder: inputPlaceholder,
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))), _react.default.createElement(_reactTransitionGroup.Transition, {
86
- in: isOpen,
80
+ }))), rightComponents), _react.default.createElement(_reactTransitionGroup.Transition, {
81
+ in: open,
87
82
  timeout: 250
88
- }, state => _react.default.createElement("div", {
89
- style: (0, _animations.getContainerOpenMenuStyles)(state, theme)
90
- }, _react.default.createElement(_styled.StyledContainerOpenMenu, null, !search ? _react.default.createElement("div", null, mostUsed && _react.default.createElement(_MostUsed.MostUsed, {
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
- }), _react.default.createElement(_Masonry.Masonry, {
94
- columns: 4,
95
- spacingTop: "kilo",
96
- spacingLeft: "mega"
97
- }, options.map(option => _react.default.createElement(_MenuBlock.MenuBlock, {
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
- searchTerm: search
106
- })))))));
97
+ searchTerm: search,
98
+ toggle: toggleOpen
99
+ }))))));
107
100
  };
108
101
 
109
102
  var _default = Menubar;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/Menubar/Menubar.tsx"],"names":["Menubar","leftComponents","rightComponents","inputPlaceholder","options","mostUsed","mostUsedLabel","searchResultsLabel","search","setSearch","React","useState","results","setResults","input","setInput","state","isOpen","setOpen","theme","toggleOpenClose","useEffect","map","option","title","result","category"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;AACA;;AACA;;AAUA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;AAgBA,MAAMA,OAA+B,GAAG,CAAC;AACvCC,EAAAA,cADuC;AAEvCC,EAAAA,eAFuC;AAGvCC,EAAAA,gBAAgB,GAAG,2BAHoB;AAIvCC,EAAAA,OAJuC;AAKvCC,EAAAA,QALuC;AAMvCC,EAAAA,aAAa,GAAG,gBANuB;AAOvCC,EAAAA,kBAAkB,GAAG;AAPkB,CAAD,KAQlC;AACJ,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBC,eAAMC,QAAN,CAAuB,EAAvB,CAA5B;;AACA,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBH,eAAMC,QAAN,CAA+B,EAA/B,CAA9B;;AACA,QAAM,CAACG,KAAD,EAAQC,QAAR,IAAoB,kCAAkB,EAAlB,EAAsBC,KAAK,IAAIP,SAAS,CAACO,KAAD,CAAxC,CAA1B;;AACA,QAAM,CAACC,MAAD,EAASC,OAAT,IAAoBR,eAAMC,QAAN,CAAwB,KAAxB,CAA1B;;AACA,QAAMQ,KAAK,GAAG,uBAAd;;AAEA,QAAMC,eAAe,GAAG,MAAMF,OAAO,CAAC,CAACD,MAAF,CAArC;;AAEAP,iBAAMW,SAAN,CAAgB,MAAM;AACpB,QAAIb,MAAM,KAAK,EAAf,EAAmB;AACnBK,IAAAA,UAAU,CAAC,+BAAmBT,OAAnB,EAA4BI,MAA5B,CAAD,CAAV;AACD,GAHD,EAGG,CAACA,MAAD,CAHH;;AAKA,SACE,4DACE,6BAAC,qBAAD,QACE,6BAAC,wBAAD;AACE,IAAA,OAAO,EAAC,QADV;AAEE,IAAA,KAAK,EAAC,SAFR;AAGE,IAAA,OAAO,EAAEY;AAHX,KAKG,CAACH,MAAD,GACC,6BAAC,eAAD;AACE,IAAA,IAAI,EAAC,MADP;AAEE,IAAA,IAAI,EAAC,MAFP;AAGE,IAAA,IAAI,EAAC,oBAHP;AAIE,IAAA,SAAS,EAAC;AAJZ,IADD,GAQC,6BAAC,eAAD;AACE,IAAA,IAAI,EAAC,MADP;AAEE,IAAA,IAAI,EAAC,OAFP;AAGE,IAAA,IAAI,EAAC,oBAHP;AAIE,IAAA,SAAS,EAAC;AAJZ,IAbJ,CADF,EAsBGhB,cAtBH,EAuBE,6BAAC,gCAAD;AAAY,IAAA,EAAE,EAAEgB,MAAhB;AAAwB,IAAA,OAAO,EAAE;AAAjC,KACGD,KAAK,IACJ;AAAK,IAAA,KAAK,EAAE,yCAAwBA,KAAxB,EAA+BG,KAA/B;AAAZ,KACE,6BAAC,4BAAD,QACE,6BAAC,mBAAD;AACE,IAAA,WAAW,EAAEhB,gBADf;AAEE,IAAA,aAAa,EACX,6BAAC,uBAAD,QACE,6BAAC,eAAD;AAAM,MAAA,IAAI,EAAC,SAAX;AAAqB,MAAA,IAAI,EAAC;AAA1B,MADF,CAHJ;AAOE,IAAA,KAAK,EAAEW,KAPT;AAQE,IAAA,QAAQ,EAAEC;AARZ,IADF,CADF,EAaGb,eAbH,CAFJ,CAvBF,CADF,EA4CE,6BAAC,gCAAD;AAAY,IAAA,EAAE,EAAEe,MAAhB;AAAwB,IAAA,OAAO,EAAE;AAAjC,KACGD,KAAK,IACJ;AAAK,IAAA,KAAK,EAAE,4CAA2BA,KAA3B,EAAkCG,KAAlC;AAAZ,KACE,6BAAC,+BAAD,QACG,CAACX,MAAD,GACC,0CACGH,QAAQ,IACP,6BAAC,kBAAD;AAAU,IAAA,KAAK,EAAEC,aAAjB;AAAgC,IAAA,IAAI,EAAED;AAAtC,IAFJ,EAIE,6BAAC,gBAAD;AAAS,IAAA,OAAO,EAAE,CAAlB;AAAqB,IAAA,UAAU,EAAC,MAAhC;AAAuC,IAAA,WAAW,EAAC;AAAnD,KACGD,OAAO,CAACkB,GAAR,CAAYC,MAAM,IACjB,6BAAC,oBAAD;AAAW,IAAA,IAAI,EAAEA,MAAjB;AAAyB,IAAA,GAAG,EAAEA,MAAM,CAACC;AAArC,IADD,CADH,CAJF,CADD,GAYC,6BAAC,oCAAD,QACE,6BAAC,iCAAD,QACE,6BAAC,eAAD;AAAM,IAAA,UAAU,EAAC;AAAjB,KAAyBjB,kBAAzB,CADF,CADF,EAIGK,OAAO,CAACU,GAAR,CAAYG,MAAM,IACjB,6BAAC,kCAAD;AACE,IAAA,GAAG,EAAG,GAAEA,MAAM,CAACD,KAAM,IAAGC,MAAM,CAACC,QAAS,EAD1C;AAEE,IAAA,IAAI,EAAED,MAFR;AAGE,IAAA,UAAU,EAAEjB;AAHd,IADD,CAJH,CAbJ,CADF,CAFJ,CA5CF,CADF;AAgFD,CAtGD;;eAwGeR,O","sourcesContent":["import React from 'react';\nimport {\n Icon,\n Text,\n ThemeProp,\n useDebouncedState,\n} from '@tecsinapse/react-core';\nimport { Transition } from 'react-transition-group';\nimport { useTheme } from '@emotion/react';\nimport {\n StyledIconInput,\n StyledMenuBar,\n StyledMenuButton,\n StyledContainerOpenMenu,\n StyledInput,\n StyledInputContainer,\n StyledSearchResultsContainer,\n StyledSearchTextContainer,\n} from './styled';\nimport { Masonry } from '../Masonry';\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 leftComponents?: React.ReactNode;\n rightComponents?: React.ReactNode;\n inputPlaceholder?: string;\n options: OptionsType[];\n /** Limited to first 4 elements */\n mostUsed?: MostUsedType[];\n mostUsedLabel?: string;\n searchResultsLabel?: string;\n}\n\nconst Menubar: React.FC<MenubarProps> = ({\n leftComponents,\n rightComponents,\n inputPlaceholder = 'O quê você deseja buscar?',\n options,\n mostUsed,\n mostUsedLabel = 'Mais acessados',\n searchResultsLabel = 'Resultados da busca',\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 [isOpen, setOpen] = React.useState<boolean>(false);\n const theme = useTheme() as ThemeProp;\n\n const toggleOpenClose = () => setOpen(!isOpen);\n\n React.useEffect(() => {\n if (search === '') return;\n setResults(filterAndTransform(options, search));\n }, [search]);\n\n return (\n <>\n <StyledMenuBar>\n <StyledMenuButton\n variant=\"filled\"\n color=\"primary\"\n onPress={toggleOpenClose}\n >\n {!isOpen ? (\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={isOpen} timeout={250}>\n {state => (\n <div style={getInputContainerStyles(state, theme)}>\n <StyledInputContainer>\n <StyledInput\n placeholder={inputPlaceholder}\n leftComponent={\n <StyledIconInput>\n <Icon name=\"magnify\" type=\"material-community\" />\n </StyledIconInput>\n }\n value={input}\n onChange={setInput}\n />\n </StyledInputContainer>\n {rightComponents}\n </div>\n )}\n </Transition>\n </StyledMenuBar>\n <Transition in={isOpen} timeout={250}>\n {state => (\n <div style={getContainerOpenMenuStyles(state, theme)}>\n <StyledContainerOpenMenu>\n {!search ? (\n <div>\n {mostUsed && (\n <MostUsed label={mostUsedLabel} data={mostUsed} />\n )}\n <Masonry columns={4} spacingTop=\"kilo\" spacingLeft=\"mega\">\n {options.map(option => (\n <MenuBlock data={option} key={option.title} />\n ))}\n </Masonry>\n </div>\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 </div>\n )}\n </Transition>\n </>\n );\n};\n\nexport default Menubar;\n"],"file":"Menubar.js"}
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":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;;;AAiBA,MAAMA,OAA+B,GAAG,CAAC;AACvCC,EAAAA,cADuC;AAEvCC,EAAAA,eAFuC;AAGvCC,EAAAA,iBAAiB,GAAG,2BAHmB;AAIvCC,EAAAA,OAJuC;AAKvCC,EAAAA,QALuC;AAMvCC,EAAAA,aAAa,GAAG,gBANuB;AAOvCC,EAAAA,kBAAkB,GAAG,qBAPkB;AAQvCC,EAAAA,UAAU,GAAG;AAR0B,CAAD,KASlC;AACJ,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBC,eAAMC,QAAN,CAAuB,EAAvB,CAA5B;;AACA,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBH,eAAMC,QAAN,CAA+B,EAA/B,CAA9B;;AACA,QAAM,CAACG,KAAD,EAAQC,QAAR,IAAoB,kCAAkB,EAAlB,EAAsBC,KAAK,IAAIP,SAAS,CAACO,KAAD,CAAxC,CAA1B;;AACA,QAAM,CAACC,IAAD,EAAOC,OAAP,IAAkBR,eAAMC,QAAN,CAAwB,KAAxB,CAAxB;;AAEA,QAAMQ,UAAU,GAAGT,eAAMU,WAAN,CAAkB,MAAMF,OAAO,CAACF,KAAK,IAAI,CAACA,KAAX,CAA/B,EAAkD,CACnEE,OADmE,CAAlD,CAAnB;;AAIAR,iBAAMW,SAAN,CAAgB,MAAM;AACpB,QAAIb,MAAM,KAAK,EAAf,EAAmB;AACnBK,IAAAA,UAAU,CAAC,+BAAmBV,OAAnB,EAA4BK,MAA5B,CAAD,CAAV;AACD,GAHD,EAGG,CAACA,MAAD,CAHH;;AAKA,SACE,4DACE,6BAAC,qBAAD,QACE,6BAAC,wBAAD;AAAkB,IAAA,OAAO,EAAC,QAA1B;AAAmC,IAAA,KAAK,EAAC,SAAzC;AAAmD,IAAA,OAAO,EAAEW;AAA5D,KACG,CAACF,IAAD,GACC,6BAAC,eAAD;AACE,IAAA,IAAI,EAAC,MADP;AAEE,IAAA,IAAI,EAAC,MAFP;AAGE,IAAA,IAAI,EAAC,oBAHP;AAIE,IAAA,SAAS,EAAC;AAJZ,IADD,GAQC,6BAAC,eAAD;AACE,IAAA,IAAI,EAAC,MADP;AAEE,IAAA,IAAI,EAAC,OAFP;AAGE,IAAA,IAAI,EAAC,oBAHP;AAIE,IAAA,SAAS,EAAC;AAJZ,IATJ,CADF,EAkBGjB,cAlBH,EAmBE,6BAAC,gCAAD;AAAY,IAAA,EAAE,EAAEiB,IAAhB;AAAsB,IAAA,OAAO,EAAE;AAA/B,KACGD,KAAK,IACJ,6BAAC,4BAAD;AAAsB,IAAA,KAAK,EAAE,yCAAwBA,KAAxB;AAA7B,KACGT,UAAU,IACT,6BAAC,mBAAD;AACE,IAAA,WAAW,EAAEL,iBADf;AAEE,IAAA,aAAa,EACX,6BAAC,uBAAD,QACE,6BAAC,eAAD;AAAM,MAAA,IAAI,EAAC,SAAX;AAAqB,MAAA,IAAI,EAAC;AAA1B,MADF,CAHJ;AAOE,IAAA,KAAK,EAAEY,KAPT;AAQE,IAAA,QAAQ,EAAEC;AARZ,IAFJ,CAFJ,CAnBF,EAqCGd,eArCH,CADF,EAwCE,6BAAC,gCAAD;AAAY,IAAA,EAAE,EAAEgB,IAAhB;AAAsB,IAAA,OAAO,EAAE;AAA/B,KACGD,KAAK,IACJ,6BAAC,+BAAD;AAAyB,IAAA,KAAK,EAAE,4CAA2BA,KAA3B;AAAhC,KACG,CAACR,MAAD,GACC,4DACGJ,QAAQ,IACP,6BAAC,kBAAD;AACE,IAAA,KAAK,EAAEC,aADT;AAEE,IAAA,IAAI,EAAED,QAFR;AAGE,IAAA,MAAM,EAAEe;AAHV,IAFJ,EAQE,6BAAC,oBAAD;AAAW,IAAA,OAAO,EAAEhB,OAApB;AAA6B,IAAA,MAAM,EAAEgB;AAArC,IARF,CADD,GAYC,6BAAC,oCAAD,QACE,6BAAC,iCAAD,QACE,6BAAC,eAAD;AAAM,IAAA,UAAU,EAAC;AAAjB,KAAyBb,kBAAzB,CADF,CADF,EAIGM,OAAO,CAACU,GAAR,CAAYC,MAAM,IACjB,6BAAC,kCAAD;AACE,IAAA,GAAG,EAAG,GAAEA,MAAM,CAACC,KAAM,IAAGD,MAAM,CAACE,QAAS,EAD1C;AAEE,IAAA,IAAI,EAAEF,MAFR;AAGE,IAAA,UAAU,EAAEf,MAHd;AAIE,IAAA,MAAM,EAAEW;AAJV,IADD,CAJH,CAbJ,CAFJ,CAxCF,CADF;AA2ED,CAnGD;;eAqGepB,O","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 toggle={toggleOpen}\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 MostUsed: React.FC<MostUsedProps>;
8
- export default MostUsed;
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