@tecsinapse/react-web-kit 3.4.7 → 3.4.8-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/molecules/Menubar/Menubar.js +30 -21
- package/dist/cjs/components/molecules/Menubar/SearchResultItem/utils.js +1 -0
- package/dist/cjs/components/molecules/Menubar/utils.js +3 -1
- package/dist/esm/components/molecules/Menubar/Menubar.js +30 -21
- package/dist/esm/components/molecules/Menubar/SearchResultItem/utils.js +1 -1
- package/dist/esm/components/molecules/Menubar/utils.js +3 -1
- package/dist/types/components/molecules/Menubar/SearchResultItem/utils.d.ts +1 -0
- package/package.json +3 -3
|
@@ -14,7 +14,7 @@ var useClickAwayListener = require('../../../hooks/useClickAwayListener.js');
|
|
|
14
14
|
const Menubar = ({
|
|
15
15
|
leftComponents,
|
|
16
16
|
rightComponents,
|
|
17
|
-
searchPlaceholder = "O
|
|
17
|
+
searchPlaceholder = "O que voc\xEA deseja buscar?",
|
|
18
18
|
options,
|
|
19
19
|
mostUsed,
|
|
20
20
|
mostUsedLabel = "Mais acessados",
|
|
@@ -69,29 +69,38 @@ const Menubar = ({
|
|
|
69
69
|
onChange: setInput
|
|
70
70
|
}
|
|
71
71
|
)
|
|
72
|
-
)), rightComponents), /* @__PURE__ */ React.createElement(
|
|
73
|
-
|
|
72
|
+
)), rightComponents), /* @__PURE__ */ React.createElement(
|
|
73
|
+
reactTransitionGroup.Transition,
|
|
74
74
|
{
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
in: open,
|
|
76
|
+
timeout: 250,
|
|
77
|
+
nodeRef: transitionMenuRef,
|
|
78
|
+
unmountOnExit: true
|
|
77
79
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
(state) => /* @__PURE__ */ React.createElement(
|
|
81
|
+
styled.StyledContainerOpenMenu,
|
|
80
82
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
style: animations.getContainerOpenMenuStyles(state),
|
|
84
|
+
ref: transitionMenuRef
|
|
85
|
+
},
|
|
86
|
+
!search ? /* @__PURE__ */ React.createElement(React.Fragment, null, mostUsed && /* @__PURE__ */ React.createElement(
|
|
87
|
+
MostUsed,
|
|
88
|
+
{
|
|
89
|
+
label: mostUsedLabel,
|
|
90
|
+
data: mostUsed,
|
|
91
|
+
toggle: toggleOpen
|
|
92
|
+
}
|
|
93
|
+
), /* @__PURE__ */ React.createElement(MenuBlock, { options, toggle: toggleOpen })) : /* @__PURE__ */ React.createElement(styled.StyledSearchResultsContainer, null, /* @__PURE__ */ React.createElement(styled.StyledSearchTextContainer, null, /* @__PURE__ */ React.createElement(reactCore.Text, { fontWeight: "bold" }, searchResultsLabel)), results.map((result) => /* @__PURE__ */ React.createElement(
|
|
94
|
+
SearchResultItem,
|
|
95
|
+
{
|
|
96
|
+
key: `${result.title}-${result.category}`,
|
|
97
|
+
data: result,
|
|
98
|
+
searchTerm: search,
|
|
99
|
+
toggle: toggleOpen
|
|
100
|
+
}
|
|
101
|
+
)))
|
|
102
|
+
)
|
|
103
|
+
));
|
|
95
104
|
};
|
|
96
105
|
|
|
97
106
|
module.exports = Menubar;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var utils = require('./SearchResultItem/utils.js');
|
|
4
|
+
|
|
3
5
|
const filterAndTransform = (options, search) => {
|
|
4
6
|
const normalized = [];
|
|
5
7
|
options.forEach((option) => {
|
|
6
8
|
option.items.forEach((item) => {
|
|
7
|
-
if (item.title.toLowerCase().
|
|
9
|
+
if (utils.normalize(item.title.toLowerCase()).includes(utils.normalize(search.toLowerCase()))) {
|
|
8
10
|
normalized.push({
|
|
9
11
|
title: item.title,
|
|
10
12
|
Component: item.Component,
|
|
@@ -12,7 +12,7 @@ import { useClickAwayListener } from '../../../hooks/useClickAwayListener.js';
|
|
|
12
12
|
const Menubar = ({
|
|
13
13
|
leftComponents,
|
|
14
14
|
rightComponents,
|
|
15
|
-
searchPlaceholder = "O
|
|
15
|
+
searchPlaceholder = "O que voc\xEA deseja buscar?",
|
|
16
16
|
options,
|
|
17
17
|
mostUsed,
|
|
18
18
|
mostUsedLabel = "Mais acessados",
|
|
@@ -67,29 +67,38 @@ const Menubar = ({
|
|
|
67
67
|
onChange: setInput
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
|
-
)), rightComponents), /* @__PURE__ */ React__default.createElement(
|
|
71
|
-
|
|
70
|
+
)), rightComponents), /* @__PURE__ */ React__default.createElement(
|
|
71
|
+
Transition,
|
|
72
72
|
{
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
in: open,
|
|
74
|
+
timeout: 250,
|
|
75
|
+
nodeRef: transitionMenuRef,
|
|
76
|
+
unmountOnExit: true
|
|
75
77
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
(state) => /* @__PURE__ */ React__default.createElement(
|
|
79
|
+
StyledContainerOpenMenu,
|
|
78
80
|
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
style: getContainerOpenMenuStyles(state),
|
|
82
|
+
ref: transitionMenuRef
|
|
83
|
+
},
|
|
84
|
+
!search ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, mostUsed && /* @__PURE__ */ React__default.createElement(
|
|
85
|
+
MostUsed,
|
|
86
|
+
{
|
|
87
|
+
label: mostUsedLabel,
|
|
88
|
+
data: mostUsed,
|
|
89
|
+
toggle: toggleOpen
|
|
90
|
+
}
|
|
91
|
+
), /* @__PURE__ */ React__default.createElement(MenuBlock, { options, toggle: toggleOpen })) : /* @__PURE__ */ React__default.createElement(StyledSearchResultsContainer, null, /* @__PURE__ */ React__default.createElement(StyledSearchTextContainer, null, /* @__PURE__ */ React__default.createElement(Text, { fontWeight: "bold" }, searchResultsLabel)), results.map((result) => /* @__PURE__ */ React__default.createElement(
|
|
92
|
+
SearchResultItem,
|
|
93
|
+
{
|
|
94
|
+
key: `${result.title}-${result.category}`,
|
|
95
|
+
data: result,
|
|
96
|
+
searchTerm: search,
|
|
97
|
+
toggle: toggleOpen
|
|
98
|
+
}
|
|
99
|
+
)))
|
|
100
|
+
)
|
|
101
|
+
));
|
|
93
102
|
};
|
|
94
103
|
|
|
95
104
|
export { Menubar as default };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { normalize } from './SearchResultItem/utils.js';
|
|
2
|
+
|
|
1
3
|
const filterAndTransform = (options, search) => {
|
|
2
4
|
const normalized = [];
|
|
3
5
|
options.forEach((option) => {
|
|
4
6
|
option.items.forEach((item) => {
|
|
5
|
-
if (item.title.toLowerCase().
|
|
7
|
+
if (normalize(item.title.toLowerCase()).includes(normalize(search.toLowerCase()))) {
|
|
6
8
|
normalized.push({
|
|
7
9
|
title: item.title,
|
|
8
10
|
Component: item.Component,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export declare const normalize: (str: string) => string;
|
|
2
3
|
export declare const stringMatcher: (searchTerm: string, textToReplace: string) => RegExpMatchArray[];
|
|
3
4
|
export declare const highlight: <T>(searchTerm: string, textToReplace: string, Component: React.ElementType, props: T) => React.ReactNode;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-web-kit",
|
|
3
3
|
"description": "React components library for web",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.8-beta.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@emotion/native": "~11.11.0",
|
|
22
22
|
"@emotion/react": "~11.11.0",
|
|
23
23
|
"@emotion/styled": "~11.11.0",
|
|
24
|
-
"@tecsinapse/react-core": "3.4.
|
|
24
|
+
"@tecsinapse/react-core": "3.4.4-beta.0",
|
|
25
25
|
"date-fns": "~2.30.0",
|
|
26
26
|
"react-native-vector-icons": "^9.2.0",
|
|
27
27
|
"react-transition-group": "~4.4.5"
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"react-dom": ">=18.0.0",
|
|
41
41
|
"react-native-web": ">=0.18.0 <1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "4aa98a3ca6323ecbf694403927a12e62867d6991"
|
|
44
44
|
}
|