@economic/taco 2.70.2-search-race-condition.1 → 2.70.2

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/taco.cjs CHANGED
@@ -11468,7 +11468,7 @@ const Base$1 = React__namespace.forwardRef(function IconButtonBase(props, ref) {
11468
11468
  return null;
11469
11469
  }
11470
11470
  return createButtonWithTooltip(
11471
- { ...otherProps, children: /* @__PURE__ */ React__namespace.createElement(Icon$1, { name: icon, className: "m-0 p-0" }), "data-taco": "icon-button" },
11471
+ { "data-taco": "icon-button", ...otherProps, children: /* @__PURE__ */ React__namespace.createElement(Icon$1, { name: icon, className: "m-0 p-0" }) },
11472
11472
  className,
11473
11473
  ref
11474
11474
  );
@@ -16981,7 +16981,7 @@ const Navbar = React__namespace.memo(({ onMonthChange, value = /* @__PURE__ */ n
16981
16981
  "aria-label": actions.previousMonth,
16982
16982
  onClick: onPreviousClick,
16983
16983
  rounded: true,
16984
- "data-action": "prev-month"
16984
+ "data-taco": "calendar-prev-month-button"
16985
16985
  }
16986
16986
  )), /* @__PURE__ */ React__namespace.createElement(Tooltip$3, { title: actions.nextMonth }, /* @__PURE__ */ React__namespace.createElement(
16987
16987
  IconButton,
@@ -16991,7 +16991,7 @@ const Navbar = React__namespace.memo(({ onMonthChange, value = /* @__PURE__ */ n
16991
16991
  "aria-label": actions.nextMonth,
16992
16992
  onClick: onNextClick,
16993
16993
  rounded: true,
16994
- "data-action": "next-month"
16994
+ "data-taco": "calendar-next-month-button"
16995
16995
  }
16996
16996
  ))));
16997
16997
  });
@@ -17009,7 +17009,7 @@ const TodayButton = ({ handleChange }) => {
17009
17009
  {
17010
17010
  className: "cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
17011
17011
  onClick: handleCalendarClickToday,
17012
- "data-action": "today"
17012
+ "data-taco": "calendar-today-button"
17013
17013
  },
17014
17014
  texts.calendar.actions.today
17015
17015
  );
@@ -19048,6 +19048,7 @@ const Datepicker = React__namespace.forwardRef(function Datepicker2(props, ref)
19048
19048
  {
19049
19049
  type: "button",
19050
19050
  className: "hover:wcag-grey-200 flex w-full items-start px-4 py-1 text-xs",
19051
+ "data-taco": "datepicker-shortcut",
19051
19052
  onClick: (event) => {
19052
19053
  event.persist();
19053
19054
  shortcut2.onClick(event);
@@ -19060,6 +19061,7 @@ const Datepicker = React__namespace.forwardRef(function Datepicker2(props, ref)
19060
19061
  {
19061
19062
  type: "button",
19062
19063
  className: "mx-auto my-4 mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
19064
+ "data-taco": "datepicker-clear-button",
19063
19065
  onClick: (event) => {
19064
19066
  event.persist();
19065
19067
  handleReset(event);
@@ -19070,7 +19072,8 @@ const Datepicker = React__namespace.forwardRef(function Datepicker2(props, ref)
19070
19072
  ))
19071
19073
  )
19072
19074
  )),
19073
- tooltip: texts.datepicker.calendar
19075
+ tooltip: texts.datepicker.calendar,
19076
+ "data-taco": "toggle-calendar-button"
19074
19077
  }
19075
19078
  )
19076
19079
  }
@@ -28045,7 +28048,7 @@ List$1.Switch = Switch;
28045
28048
  List$1.Checkbox = Checkbox$1;
28046
28049
  List$1.Group = Group$5;
28047
28050
  function useTimer(duration = 0, callback) {
28048
- const timer = React__namespace.useRef();
28051
+ const timer = React__namespace.useRef(void 0);
28049
28052
  const [tracker, setTracker] = React__namespace.useState({
28050
28053
  remaining: duration,
28051
28054
  started: null
@@ -28089,7 +28092,7 @@ function useTimer(duration = 0, callback) {
28089
28092
  };
28090
28093
  }
28091
28094
  const useTypeahead = ({ data, currentIndex }) => {
28092
- const typeaheadQuery = React__namespace.useRef();
28095
+ const typeaheadQuery = React__namespace.useRef(void 0);
28093
28096
  const typeaheadQueryTimer = useTimer(1e3, () => {
28094
28097
  typeaheadQuery.current = void 0;
28095
28098
  });
@@ -36093,7 +36096,7 @@ function useTableRowHeight(isEnabled = false, defaultRowHeight = "medium") {
36093
36096
  };
36094
36097
  }
36095
36098
  function useTableRowSelection(isEnabled = false) {
36096
- const lastSelectedRowIndex = React.useRef();
36099
+ const lastSelectedRowIndex = React.useRef(void 0);
36097
36100
  const onKeyDown = React.useCallback(
36098
36101
  (event, table) => {
36099
36102
  var _a, _b, _c;
@@ -36161,9 +36164,9 @@ function useTableDataLoader(fetchPage, fetchAll, options = { pageSize: DEFAULT_P
36161
36164
  const _pendingPageRequests = React.useRef({});
36162
36165
  const _lastUsedSorting = React.useRef([]);
36163
36166
  const _lastUsedFilters = React.useRef([]);
36164
- const _lastUsedSearch = React.useRef();
36167
+ const _lastUsedSearch = React.useRef(void 0);
36165
36168
  const _lastUsedHiddenColumns = React.useRef([]);
36166
- const _lastUsedPageIndex = React.useRef();
36169
+ const _lastUsedPageIndex = React.useRef(void 0);
36167
36170
  const loadPage = async (pageIndex, sorting, filters, hiddenColumns) => {
36168
36171
  let reset = false;
36169
36172
  if (JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
@@ -36613,7 +36616,7 @@ function useTableShortcutsListener(table, tableRef, shortcuts, localShortcuts =
36613
36616
  }
36614
36617
  function useLazyDebouncedEffect(effect, deps, ms = 200) {
36615
36618
  const readyRef = React.useRef(false);
36616
- const timeoutRef = React.useRef();
36619
+ const timeoutRef = React.useRef(void 0);
36617
36620
  React.useEffect(() => {
36618
36621
  if (readyRef.current) {
36619
36622
  timeoutRef.current = setTimeout(effect, ms);
@@ -45044,7 +45047,7 @@ function Search$1(props) {
45044
45047
  const { scrollToIndex, table, tableRef } = props;
45045
45048
  const { texts } = useLocalization();
45046
45049
  const ref = React.useRef(null);
45047
- const lastResultQuery = React.useRef();
45050
+ const lastResultQuery = React.useRef(void 0);
45048
45051
  const tableMeta = table.options.meta;
45049
45052
  const query = table.getState().globalFilter;
45050
45053
  const scrollTo2 = (rowIndex) => scrollToIndex(rowIndex, { align: "center" });
@@ -45080,7 +45083,7 @@ function Search$1(props) {
45080
45083
  }
45081
45084
  };
45082
45085
  const [loading, setLoading] = React.useState(false);
45083
- const searchTimeoutRef = React.useRef();
45086
+ const searchTimeoutRef = React.useRef(void 0);
45084
45087
  const handleChange = (query2) => {
45085
45088
  table.setGlobalFilter(String(query2 ?? ""));
45086
45089
  if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
@@ -49740,7 +49743,7 @@ const Option = React.forwardRef(function Select2Option(props, ref) {
49740
49743
  value: props.value
49741
49744
  }
49742
49745
  ) : void 0;
49743
- return /* @__PURE__ */ React.createElement(Option$1, { ...otherProps, className, onClick: handleClick, onKeyDown: handleKeyDown, ref }, hasValue2 ? /* @__PURE__ */ React.createElement(Icon$1, { name: "tick", className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible" }) : null, typeof children === "string" ? isTag ? /* @__PURE__ */ React.createElement(Tag, { className: "pointer-events-none my-1", color: color2, icon: prefix2 }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, prefix2 ? typeof prefix2 === "string" ? /* @__PURE__ */ React.createElement(Icon$1, { name: prefix2, className: "!h-5 !w-5" }) : prefix2 : null, /* @__PURE__ */ React.createElement("span", { className: "flex w-full justify-between" }, /* @__PURE__ */ React.createElement("span", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", null, children), description ? /* @__PURE__ */ React.createElement("span", { className: "text-grey-700 -mt-1.5 mb-1.5 text-xs", "data-taco": "description" }, description) : null), /* @__PURE__ */ React.createElement("span", { className: "flex flex-col self-center" }, postfix ? typeof postfix === "string" ? /* @__PURE__ */ React.createElement(Icon$1, { name: postfix, className: "!h-5 !w-5" }) : postfix : null))) : /* @__PURE__ */ React.createElement("span", { className: "w-full" }, children), popover ? /* @__PURE__ */ React.createElement(
49746
+ return /* @__PURE__ */ React.createElement(Option$1, { ...otherProps, className, onClick: handleClick, onKeyDown: handleKeyDown, ref }, hasValue2 ? /* @__PURE__ */ React.createElement(Icon$1, { name: "tick", className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible" }) : /* @__PURE__ */ React.createElement("span", { className: "-mx-0.5 inline-flex h-4 w-4 flex-shrink-0", "aria-hidden": true }), typeof children === "string" ? isTag ? /* @__PURE__ */ React.createElement(Tag, { className: "pointer-events-none my-1", color: color2, icon: prefix2 }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, prefix2 ? typeof prefix2 === "string" ? /* @__PURE__ */ React.createElement(Icon$1, { name: prefix2, className: "!h-5 !w-5" }) : prefix2 : null, /* @__PURE__ */ React.createElement("span", { className: "flex w-full justify-between" }, /* @__PURE__ */ React.createElement("span", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", null, children), description ? /* @__PURE__ */ React.createElement("span", { className: "text-grey-700 -mt-1.5 mb-1.5 text-xs", "data-taco": "description" }, description) : null), /* @__PURE__ */ React.createElement("span", { className: "flex flex-col self-center" }, postfix ? typeof postfix === "string" ? /* @__PURE__ */ React.createElement(Icon$1, { name: postfix, className: "!h-5 !w-5" }) : postfix : null))) : /* @__PURE__ */ React.createElement("span", { className: "w-full" }, children), popover ? /* @__PURE__ */ React.createElement(
49744
49747
  IconButton,
49745
49748
  {
49746
49749
  icon: "ellipsis-vertical",
@@ -50355,20 +50358,18 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
50355
50358
  (_a = listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
50356
50359
  };
50357
50360
  const shouldFocusNextRef = React.useRef(void 0);
50358
- React.useEffect(() => {
50359
- const handleKeyDown2 = (event) => {
50360
- if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
50361
+ const handleHorizontalNavigation = (event) => {
50362
+ var _a, _b;
50363
+ if (isElementInsideTable3OrReport(internalRef.current)) {
50364
+ const isTriggeredFromPopover = (_b = (_a = event.currentTarget).contains) == null ? void 0 : _b.call(_a, event.target);
50365
+ if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && isTriggeredFromPopover) {
50366
+ event.preventDefault();
50367
+ event.stopPropagation();
50361
50368
  shouldFocusNextRef.current = event.key === "ArrowLeft" ? -1 : 1;
50362
50369
  setOpen(false);
50363
50370
  }
50364
- };
50365
- if (isElementInsideTable3OrReport(internalRef.current)) {
50366
- document.addEventListener("keydown", handleKeyDown2);
50367
50371
  }
50368
- return () => {
50369
- document.removeEventListener("keydown", handleKeyDown2);
50370
- };
50371
- }, []);
50372
+ };
50372
50373
  const handleListboxKeyDown = (event) => {
50373
50374
  if (isAriaDirectionKey(event)) {
50374
50375
  setShouldPauseHoverState(true);
@@ -50379,6 +50380,11 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
50379
50380
  setOpen(false);
50380
50381
  return;
50381
50382
  }
50383
+ if (!hasSearch && event.key === "Escape") {
50384
+ event.preventDefault();
50385
+ setOpen(false);
50386
+ return;
50387
+ }
50382
50388
  if (!hasSearch && /^[a-z0-9]$/i.test(event.key)) {
50383
50389
  setValueIfMatched(event.key);
50384
50390
  return;
@@ -50448,6 +50454,7 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
50448
50454
  asChild: true,
50449
50455
  align: "start",
50450
50456
  onCloseAutoFocus: handleCloseAutoFocus,
50457
+ onKeyDown: handleHorizontalNavigation,
50451
50458
  onPointerDownOutside: otherProps.onBlur,
50452
50459
  sideOffset: 4,
50453
50460
  tabIndex: -1
@@ -50572,7 +50579,7 @@ function Print(props) {
50572
50579
  const { table, tableId, tableRef } = props;
50573
50580
  const { texts } = useLocalization();
50574
50581
  const ref = React.useRef(null);
50575
- const lastScrollTopRef = React.useRef();
50582
+ const lastScrollTopRef = React.useRef(void 0);
50576
50583
  const toast = useToast();
50577
50584
  const tableMeta = table.options.meta;
50578
50585
  const { allRows, orientation, size: size2, splitGroups } = tableMeta.printing.settings;
@@ -57185,7 +57192,7 @@ const useRowSelect = (onSelectedRows) => {
57185
57192
  row.toggleRowSelected = () => toggleRowSelected(row.id, !row.isSelected);
57186
57193
  };
57187
57194
  hooks.prepareRow.push(prepareRow2);
57188
- const lastSelectedSortedIndex = React.useRef();
57195
+ const lastSelectedSortedIndex = React.useRef(void 0);
57189
57196
  hooks.visibleColumns.push((columns) => [
57190
57197
  {
57191
57198
  id: "selection",
@@ -94104,7 +94111,7 @@ function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_
94104
94111
  const _lastUsedSorting = React.useRef([]);
94105
94112
  const _lastUsedFilters = React.useRef([]);
94106
94113
  const _lastUsedHiddenColumns = React.useRef([]);
94107
- const _lastUsedSearch = React.useRef();
94114
+ const _lastUsedSearch = React.useRef(void 0);
94108
94115
  async function loadPage(pageIndex, sorting, filters, hiddenColumns, search) {
94109
94116
  const hasDataChanged = JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) || JSON.stringify(hiddenColumns) !== JSON.stringify(_lastUsedHiddenColumns.current) || search !== _lastUsedSearch.current;
94110
94117
  if (hasDataChanged) {