jclib-ui 1.1.7 → 1.1.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.
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, createContext, useContext, useState, useCallback, useRef, useMemo, useLayoutEffect, useImperativeHandle } from "react";
2
- import { isMobile, isDarkMode, random, formatData, formatDataHora, formatValor, isDesktop, getDateTimeStr, getHash, validarCNPJ, validarCPF } from "jcinfo-utils";
2
+ import { isMobile, isDarkMode, random, formatData, formatDataHora, formatValor, isDesktop, getDateTimeStr, getHash, validarCNPJ, validarCPF, retirarAcentuacao } from "jcinfo-utils";
3
3
  import { useDragControls, motion } from "framer-motion";
4
4
  import styled from "styled-components";
5
5
  import { Dropdown, DropdownMenu, DropdownItem, DropdownToggle, Spinner, Button, InputGroup, Input as Input$1 } from "reactstrap";
@@ -13650,15 +13650,18 @@ const MenuOptionLink = styled(Link)`
13650
13650
  const Line = styled.hr`
13651
13651
  margin: 4px 12px;
13652
13652
  `;
13653
+ function normalizeText(text2) {
13654
+ return retirarAcentuacao(text2 ?? "").toLowerCase();
13655
+ }
13653
13656
  function highlight(text2, filter) {
13654
13657
  if (!filter || typeof text2 !== "string") {
13655
13658
  return text2;
13656
13659
  }
13657
- const lowerText = text2.toLowerCase();
13658
- const lowerFilter = filter.toLowerCase();
13660
+ const normText = normalizeText(text2);
13661
+ const normFilter = normalizeText(filter);
13659
13662
  const parts = [];
13660
13663
  let start = 0;
13661
- let pos = lowerText.indexOf(lowerFilter);
13664
+ let pos = normText.indexOf(normFilter);
13662
13665
  while (pos >= 0) {
13663
13666
  if (pos > start) {
13664
13667
  parts.push(text2.substring(start, pos));
@@ -13667,7 +13670,7 @@ function highlight(text2, filter) {
13667
13670
  /* @__PURE__ */ jsxRuntimeExports.jsx("mark", { className: "menu-highlight", children: text2.substring(pos, pos + filter.length) }, pos)
13668
13671
  );
13669
13672
  start = pos + filter.length;
13670
- pos = lowerText.indexOf(lowerFilter, start);
13673
+ pos = normText.indexOf(normFilter, start);
13671
13674
  }
13672
13675
  if (parts.length === 0) {
13673
13676
  return text2;
@@ -13830,6 +13833,7 @@ function Navbar({
13830
13833
  }
13831
13834
  function configurarOpcoes(menus2) {
13832
13835
  let opts = [];
13836
+ const termo = normalizeText(filter);
13833
13837
  menus2.forEach((gr) => {
13834
13838
  let grupo = {
13835
13839
  caption: gr.caption,
@@ -13841,10 +13845,7 @@ function Navbar({
13841
13845
  };
13842
13846
  if (gr.menus && gr.menus.length > 0) {
13843
13847
  gr.menus.filter(
13844
- (e) => {
13845
- var _a;
13846
- return (e == null ? void 0 : e.isLine) || !(e == null ? void 0 : e.isLine) && (e.caption.toLowerCase().includes(filter.toLowerCase()) || ((_a = e.shortcut) == null ? void 0 : _a.toLowerCase().includes(filter.toLowerCase())));
13847
- }
13848
+ (e) => (e == null ? void 0 : e.isLine) || !(e == null ? void 0 : e.isLine) && (normalizeText(e.caption).includes(termo) || normalizeText(e.shortcut).includes(termo))
13848
13849
  ).forEach((sub) => {
13849
13850
  if (validatePermis(sub == null ? void 0 : sub.permis, sub == null ? void 0 : sub.acesso)) {
13850
13851
  grupo.menus.push({ ...sub, prefix: grupo == null ? void 0 : grupo.prefix });