@tmlmobilidade/ui 20250131.1854.44 → 20250205.56.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/index.js CHANGED
@@ -779,7 +779,7 @@ function getValueAtPath(obj, path) {
779
779
  }
780
780
 
781
781
  /* * */
782
- function Component$3({ className, icon, children, onClick, target, type = 'button', variant = 'primary', disabled, textTransform = 'none', ...props }) {
782
+ function Component$3({ className, icon, href, children, onClick, target, type = 'button', variant = 'primary', disabled, textTransform = 'none', ...props }) {
783
783
  //
784
784
  const btnClass = cn(className, styles$l.button, !disabled && {
785
785
  [styles$l.danger]: variant === 'danger',
@@ -791,7 +791,7 @@ function Component$3({ className, icon, children, onClick, target, type = 'butto
791
791
  [styles$l.warning]: variant === 'warning',
792
792
  [styles$l.active]: variant === 'active',
793
793
  }, disabled && styles$l.disabled);
794
- return (jsxRuntimeExports.jsx(core.Button, { className: btnClass, leftSection: icon && icon, onClick: onClick, type: type, variant: variant, disabled: disabled, classNames: { label: styles$l.buttonLabel, ...props.classNames }, ...props, style: { textTransform: textTransform }, children: children }));
794
+ return (jsxRuntimeExports.jsx(core.Button, { className: btnClass, leftSection: icon && icon, onClick: onClick, type: type, component: href ? 'a' : 'button', href: href, variant: variant, disabled: disabled, classNames: { label: styles$l.buttonLabel, ...props.classNames }, ...props, style: { textTransform: textTransform }, children: children }));
795
795
  //
796
796
  }
797
797
 
@@ -858,7 +858,7 @@ function Component({ classNames, ...props }) {
858
858
  return jsxRuntimeExports.jsx(core.Textarea, { classNames: classNames, ...props });
859
859
  }
860
860
 
861
- var styles$i = {"wrapper":"styles-module_wrapper__7zsRX","input":"styles-module_input__kZP4l","placeholder":"styles-module_placeholder__uazW4","pillInputWrapper":"styles-module_pillInputWrapper__rtJzo","pillInputField":"styles-module_pillInputField__LYXhi","icon":"styles-module_icon__jXQ8R","pillClearButton":"styles-module_pillClearButton__RYrwJ","pill":"styles-module_pill__eWbVa","label":"styles-module_label__tB0Ce","description":"styles-module_description__KHjxV","error":"styles-module_error__fOsRf","dropdownWrapper":"styles-module_dropdownWrapper__guQYa"};
861
+ var styles$i = {"wrapper":"styles-module_wrapper__7zsRX","input":"styles-module_input__kZP4l","placeholder":"styles-module_placeholder__uazW4","pillInputWrapper":"styles-module_pillInputWrapper__rtJzo","icon":"styles-module_icon__jXQ8R","pillClearButton":"styles-module_pillClearButton__RYrwJ","pill":"styles-module_pill__eWbVa","label":"styles-module_label__tB0Ce","description":"styles-module_description__KHjxV","error":"styles-module_error__fOsRf","dropdownWrapper":"styles-module_dropdownWrapper__guQYa"};
862
862
 
863
863
  function parseComboboxItem(item) {
864
864
  if (typeof item === 'string') {
@@ -1359,14 +1359,14 @@ function accessorSearch(record, accessor, query) {
1359
1359
  .includes(query);
1360
1360
  }
1361
1361
  function plainSearch(record, query) {
1362
- return Object.values(String(record)).some(value => value
1362
+ return Object.values(String(record)).some((value) => value
1363
1363
  ?.toString()
1364
1364
  .toLowerCase()
1365
1365
  .normalize('NFD')
1366
1366
  .replace(/[\u0300-\u036f]/g, '')
1367
1367
  .includes(query));
1368
1368
  }
1369
- function useSearchQuery(data, { accessors, debounce = 200 } = {}) {
1369
+ function useSearchQuery(data, { accessors, customSearch, debounce = 200, } = {}) {
1370
1370
  const [searchQuery, setSearchQuery] = React.useState(undefined);
1371
1371
  const [debouncedSearchQuery] = hooks.useDebouncedValue(searchQuery, debounce);
1372
1372
  const filteredData = React.useMemo(() => {
@@ -1377,9 +1377,16 @@ function useSearchQuery(data, { accessors, debounce = 200 } = {}) {
1377
1377
  .normalize('NFD')
1378
1378
  .replace(/[\u0300-\u036f]/g, '');
1379
1379
  filteredData = filteredData.filter((record) => {
1380
- if (accessors)
1381
- return accessors.some((accessor) => accessorSearch(record, accessor, query));
1382
- return plainSearch(record, query);
1380
+ if (!accessors) {
1381
+ return plainSearch(record, query);
1382
+ }
1383
+ const accessorMatch = accessors
1384
+ ? accessors.some((accessor) => accessorSearch(record, accessor, query))
1385
+ : false;
1386
+ const customMatch = customSearch
1387
+ ? customSearch(record, query)
1388
+ : false;
1389
+ return accessorMatch || customMatch;
1383
1390
  });
1384
1391
  }
1385
1392
  return filteredData;
@@ -1510,7 +1517,7 @@ function DataTableRow({ columns, record, onRowClick, onRowDoubleClick, onRowCont
1510
1517
  : String(getValueAtPath(record, column.accessor)) }, colIndex))) }));
1511
1518
  }
1512
1519
 
1513
- var styles$1 = {"root":"styles-module_root__2WSxN","title":"styles-module_title__qCJZG","item":"styles-module_item__yl--3","itemsWrapper":"styles-module_itemsWrapper__8xwKJ"};
1520
+ var styles$1 = {"root":"styles-module_root__2WSxN","title":"styles-module_title__qCJZG"};
1514
1521
 
1515
1522
  function DataTableTitle({ search, title }) {
1516
1523
  //
@@ -1528,7 +1535,7 @@ function DataTableTitle({ search, title }) {
1528
1535
  return (jsxRuntimeExports.jsxs("div", { className: styles$1.root, children: [jsxRuntimeExports.jsx("div", { className: styles$1.title, children: title && title }), search && !search.hidden && (jsxRuntimeExports.jsx("div", { className: styles$1.filters, children: jsxRuntimeExports.jsx(Component$2, { onChange: handleSearchChange, placeholder: search.placeholder, value: searchQuery }) }))] }));
1529
1536
  }
1530
1537
 
1531
- var styles = {"root":"styles-module_root__AStX6","tableWrapper":"styles-module_tableWrapper__ByR84","table":"styles-module_table__IKm6A","body":"styles-module_body__Ou1Rp"};
1538
+ var styles = {"root":"styles-module_root__AStX6","tableWrapper":"styles-module_tableWrapper__ByR84","table":"styles-module_table__IKm6A"};
1532
1539
 
1533
1540
  function DataTable({ records, ...props }) {
1534
1541
  return (jsxRuntimeExports.jsx(DataTableProvider, { initialRecords: records, searchAccessors: props.search?.accessors ?? [], children: jsxRuntimeExports.jsx(DataTableContent, { ...props }) }));