@bluemarble/bm-components 1.19.0 → 1.20.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/index.d.mts CHANGED
@@ -227,6 +227,7 @@ interface SortedByProps$1 {
227
227
  }
228
228
  interface SearchOptions$1 {
229
229
  caseSensitive?: boolean;
230
+ ignoreAccentMark?: boolean;
230
231
  exact?: boolean;
231
232
  value: string;
232
233
  ignoredKeys?: string[];
package/dist/index.d.ts CHANGED
@@ -227,6 +227,7 @@ interface SortedByProps$1 {
227
227
  }
228
228
  interface SearchOptions$1 {
229
229
  caseSensitive?: boolean;
230
+ ignoreAccentMark?: boolean;
230
231
  exact?: boolean;
231
232
  value: string;
232
233
  ignoredKeys?: string[];
package/dist/index.js CHANGED
@@ -5173,17 +5173,25 @@ function searchKeysForValue(row, accKey, compare) {
5173
5173
  }
5174
5174
  return match;
5175
5175
  }
5176
+ var normalize = (str) => str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
5176
5177
  function createSearch(options) {
5177
5178
  const searchValue = options.caseSensitive ? options.value : String(options.value).toLowerCase();
5179
+ function getValue2(value) {
5180
+ if (options.caseSensitive)
5181
+ return String(value);
5182
+ return String(value).toLowerCase();
5183
+ }
5178
5184
  function compare(key, objValue) {
5179
5185
  if (options.ignoredKeys) {
5180
5186
  const isIgnoredKey = options.ignoredKeys.includes(key);
5181
5187
  if (isIgnoredKey)
5182
5188
  return false;
5183
5189
  }
5184
- const value = options.caseSensitive ? String(objValue) : String(objValue).toLowerCase();
5190
+ const value = getValue2(objValue);
5185
5191
  if (options.exact)
5186
5192
  return value === searchValue;
5193
+ if (options.ignoreAccentMark)
5194
+ return normalize(value).includes(normalize(searchValue));
5187
5195
  return value.includes(searchValue);
5188
5196
  }
5189
5197
  return (row) => {