@tecsinapse/react-web-kit 3.4.6 → 3.4.8

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.
@@ -42,4 +42,5 @@ const highlight = (searchTerm, textToReplace, Component, props) => {
42
42
  };
43
43
 
44
44
  exports.highlight = highlight;
45
+ exports.normalize = normalize;
45
46
  exports.stringMatcher = stringMatcher;
@@ -37,7 +37,7 @@ const getContainerOpenMenuTransform = {
37
37
  },
38
38
  exited: {
39
39
  opacity: 0,
40
- transform: "scale(0.99, 0.99) translateY(-600px)"
40
+ transform: "scale(0.99, 0.99) translateY(-120%)"
41
41
  },
42
42
  exiting: {
43
43
  opacity: 0.95,
@@ -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().startsWith(search)) {
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,
@@ -39,4 +39,4 @@ const highlight = (searchTerm, textToReplace, Component, props) => {
39
39
  return textToReplace;
40
40
  };
41
41
 
42
- export { highlight, stringMatcher };
42
+ export { highlight, normalize, stringMatcher };
@@ -35,7 +35,7 @@ const getContainerOpenMenuTransform = {
35
35
  },
36
36
  exited: {
37
37
  opacity: 0,
38
- transform: "scale(0.99, 0.99) translateY(-600px)"
38
+ transform: "scale(0.99, 0.99) translateY(-120%)"
39
39
  },
40
40
  exiting: {
41
41
  opacity: 0.95,
@@ -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().startsWith(search)) {
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.6",
4
+ "version": "3.4.8",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
7
7
  "module": "dist/esm/index.js",
@@ -40,5 +40,5 @@
40
40
  "react-dom": ">=18.0.0",
41
41
  "react-native-web": ">=0.18.0 <1"
42
42
  },
43
- "gitHead": "cb0b51647a39310e5cffadd41b1258ddadb2af94"
43
+ "gitHead": "1a1832667a3459af70db9f31e70fb4bebb10a03f"
44
44
  }