@economic/taco 2.65.0-test-arrow-navigation.0 → 2.66.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/taco.cjs CHANGED
@@ -16970,10 +16970,10 @@ const Navbar = React__namespace.memo(({ onMonthChange, value = /* @__PURE__ */ n
16970
16970
  onMonthChange(new Date(year.value, month.value));
16971
16971
  };
16972
16972
  const onNextClick = () => {
16973
- onMonthChange(new Date(value.getFullYear(), value.getMonth() + 1, value.getDay()));
16973
+ onMonthChange(new Date(value.getFullYear(), value.getMonth() + 1, value.getDate()));
16974
16974
  };
16975
16975
  const onPreviousClick = () => {
16976
- onMonthChange(new Date(value.getFullYear(), value.getMonth() - 1, value.getDay()));
16976
+ onMonthChange(new Date(value.getFullYear(), value.getMonth() - 1, value.getDate()));
16977
16977
  };
16978
16978
  return /* @__PURE__ */ React__namespace.createElement("div", { className: "mb-3 flex items-center justify-between" }, /* @__PURE__ */ React__namespace.createElement("form", { className: "inline-flex space-x-1" }, /* @__PURE__ */ React__namespace.createElement("select", { className: "h-8 px-2", name: "month", onChange: handleChange, value: value.getMonth() }, months.map((month, i2) => /* @__PURE__ */ React__namespace.createElement("option", { key: month, value: i2 }, month))), /* @__PURE__ */ React__namespace.createElement("select", { className: "h-8 px-2", name: "year", onChange: handleChange, value: value.getFullYear() }, years.map((year) => /* @__PURE__ */ React__namespace.createElement("option", { key: year, value: year }, String(year))))), /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement(Tooltip$3, { title: actions.previousMonth }, /* @__PURE__ */ React__namespace.createElement(
16979
16979
  IconButton,
@@ -25766,6 +25766,13 @@ const Dialog = React__namespace.forwardRef(function Dialog2(props, ref) {
25766
25766
  }),
25767
25767
  [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]
25768
25768
  );
25769
+ React__namespace.useEffect(() => {
25770
+ const onFocusOut = (event) => {
25771
+ event.stopImmediatePropagation();
25772
+ };
25773
+ document.addEventListener("focusout", onFocusOut);
25774
+ return () => document.removeEventListener("focusout", onFocusOut);
25775
+ }, []);
25769
25776
  return /* @__PURE__ */ React__namespace.createElement(DialogContext.Provider, { value: context }, /* @__PURE__ */ React__namespace.createElement($5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, { defaultOpen, open, onOpenChange: onChange }, trigger && /* @__PURE__ */ React__namespace.createElement(Trigger$4, null, trigger), children));
25770
25777
  });
25771
25778
  Dialog.Trigger = Trigger$4;
@@ -26783,7 +26790,17 @@ const DrawerContent = React.forwardRef(function Content2(props, externalRef) {
26783
26790
  style: styleProp
26784
26791
  },
26785
26792
  content
26786
- ) : /* @__PURE__ */ React.createElement(UntrappedFocusDrawerContent, { onEscape: handleEscapeKeyDown, className: contentClassName, style: styleProp, ref }, content);
26793
+ ) : /* @__PURE__ */ React.createElement(
26794
+ UntrappedFocusDrawerContent,
26795
+ {
26796
+ ...otherProps,
26797
+ onEscape: handleEscapeKeyDown,
26798
+ className: contentClassName,
26799
+ style: styleProp,
26800
+ ref
26801
+ },
26802
+ content
26803
+ );
26787
26804
  });
26788
26805
  const Content$5 = React.forwardRef(function Content3(props, externalRef) {
26789
26806
  const { children } = props;
@@ -34858,6 +34875,7 @@ class DateTimeDataType extends DataType {
34858
34875
  }
34859
34876
  const dataTypes = {
34860
34877
  auto: {
34878
+ align: "left",
34861
34879
  sortingFn: "auto",
34862
34880
  filterComparators: [
34863
34881
  TableFilterComparator.Contains,
@@ -34870,6 +34888,7 @@ const dataTypes = {
34870
34888
  },
34871
34889
  // base
34872
34890
  text: {
34891
+ align: "left",
34873
34892
  sortingFn: "alphanumeric",
34874
34893
  filterComparators: [
34875
34894
  TableFilterComparator.Contains,
@@ -34881,6 +34900,7 @@ const dataTypes = {
34881
34900
  ]
34882
34901
  },
34883
34902
  boolean: {
34903
+ align: "left",
34884
34904
  sortingFn: "basic",
34885
34905
  filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo]
34886
34906
  },
@@ -34908,6 +34928,7 @@ const dataTypes = {
34908
34928
  };
34909
34929
  function createDatetimeDataType(defaultOptions2) {
34910
34930
  return {
34931
+ align: "left",
34911
34932
  sortingFn: "datetime",
34912
34933
  filterComparators: [
34913
34934
  TableFilterComparator.IsEqualTo,
@@ -35871,7 +35892,7 @@ const useLocalStorage = (key, initialValue) => {
35871
35892
  };
35872
35893
  return [state, setState, clear];
35873
35894
  };
35874
- function useTablePrinting(isEnabled = false, tableId) {
35895
+ function useTablePrinting(isEnabled = false, tableId, onPrint) {
35875
35896
  const [isPrinting, setIsPrinting] = React.useState(false);
35876
35897
  const [settings, setSetting] = useTablePrintingSettings(tableId);
35877
35898
  return {
@@ -35879,7 +35900,8 @@ function useTablePrinting(isEnabled = false, tableId) {
35879
35900
  isPrinting,
35880
35901
  setIsPrinting,
35881
35902
  settings,
35882
- setSetting
35903
+ setSetting,
35904
+ onPrint
35883
35905
  };
35884
35906
  }
35885
35907
  const DEFAULT_PRINT_SETTINGS = {
@@ -36669,7 +36691,7 @@ function useTableManager(props, ref, meta, internalColumns) {
36669
36691
  const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);
36670
36692
  const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);
36671
36693
  const footer = useTableFooter(options.enableFooter);
36672
- const printing = useTablePrinting(options.enablePrinting, safeId);
36694
+ const printing = useTablePrinting(options.enablePrinting, safeId, props.onPrint);
36673
36695
  const rowActive = useTableRowActive$1(options.enableRowActive, props.defaultRowActiveIndex);
36674
36696
  const rowActions = useTableRowActions(options.enableRowActions, props.rowActions, props.rowActionsLength);
36675
36697
  const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
@@ -43557,7 +43579,7 @@ function Item(props) {
43557
43579
  }
43558
43580
  Item.displayName = "SortableListItem";
43559
43581
  const Column$3 = React.forwardRef(function Column2(props, ref) {
43560
- var _a, _b, _c;
43582
+ var _a, _b, _c, _d;
43561
43583
  const { column, draggable = false, ...dragAttributes } = props;
43562
43584
  const canHide = column.getCanHide();
43563
43585
  const className = clsx("group/column flex items-center gap-x-2 rounded py-1 px-2", {
@@ -43568,10 +43590,17 @@ const Column$3 = React.forwardRef(function Column2(props, ref) {
43568
43590
  const attributes = draggable ? dragAttributes : void 0;
43569
43591
  const isVisible2 = column.getIsVisible();
43570
43592
  const parentHeader = (_b = (_a = column.parent) == null ? void 0 : _a.columnDef) == null ? void 0 : _b.header;
43571
- return /* @__PURE__ */ React.createElement("div", { ...attributes, className, onClick: () => column.toggleVisibility(!isVisible2), ref }, draggable ? /* @__PURE__ */ React.createElement(Icon$1, { name: "drag", className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5" }) : null, /* @__PURE__ */ React.createElement("span", { className: "flex-grow truncate" }, (_c = column.columnDef.meta) == null ? void 0 : _c.header, parentHeader ? /* @__PURE__ */ React.createElement("span", { className: "italic" }, "(", parentHeader, ")") : null), canHide ? /* @__PURE__ */ React.createElement(Checkbox$2, { checked: isVisible2, onChange: () => column.toggleVisibility(!isVisible2) }) : null);
43593
+ return /* @__PURE__ */ React.createElement("div", { ...attributes, className, onClick: () => column.toggleVisibility(!isVisible2), ref }, draggable ? /* @__PURE__ */ React.createElement(Icon$1, { name: "drag", className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5" }) : null, /* @__PURE__ */ React.createElement("span", { className: "flex-grow truncate" }, (_c = column.columnDef.meta) == null ? void 0 : _c.header, parentHeader ? /* @__PURE__ */ React.createElement("span", { className: "italic" }, "(", parentHeader, ")") : null), canHide ? /* @__PURE__ */ React.createElement(
43594
+ Checkbox$2,
43595
+ {
43596
+ "aria-label": (_d = column.columnDef.meta) == null ? void 0 : _d.header,
43597
+ checked: isVisible2,
43598
+ onChange: () => column.toggleVisibility(!isVisible2)
43599
+ }
43600
+ ) : null);
43572
43601
  });
43573
43602
  function HideOrOrderPopover(props) {
43574
- const { table, trigger, ...popoverProps } = props;
43603
+ const { id: id2, table, trigger, ...popoverProps } = props;
43575
43604
  const { texts } = useLocalization();
43576
43605
  const [query, setQuery] = React.useState("");
43577
43606
  const allColumns = table.getAllLeafColumns();
@@ -43614,7 +43643,7 @@ function HideOrOrderPopover(props) {
43614
43643
  }
43615
43644
  }
43616
43645
  };
43617
- return /* @__PURE__ */ React.createElement(Popover, { ...popoverProps, anchor: trigger }, /* @__PURE__ */ React.createElement(Popover.Content, null, /* @__PURE__ */ React.createElement("div", { className: "flex min-w-[100px] max-w-sm flex-col gap-2" }, table.options.enableHiding ? /* @__PURE__ */ React.createElement(
43646
+ return /* @__PURE__ */ React.createElement(Popover, { ...popoverProps, anchor: trigger }, /* @__PURE__ */ React.createElement(Popover.Content, { id: id2 }, /* @__PURE__ */ React.createElement("div", { className: "flex min-w-[100px] max-w-sm flex-col gap-2" }, table.options.enableHiding ? /* @__PURE__ */ React.createElement(
43618
43647
  Input,
43619
43648
  {
43620
43649
  onChange: (event) => setQuery(event.target.value),
@@ -43636,7 +43665,7 @@ function HideOrOrderPopover(props) {
43636
43665
  }))) : /* @__PURE__ */ React.createElement("div", { className: listClassName }, columns.length ? columns.map((column) => /* @__PURE__ */ React.createElement(Column$3, { column, key: column.id })) : texts.table.columnSettings.noResults))));
43637
43666
  }
43638
43667
  function Settings(props) {
43639
- const { customSettings, table } = props;
43668
+ const { customSettings, id: id2, table } = props;
43640
43669
  const { texts } = useLocalization();
43641
43670
  const tableMeta = table.options.meta;
43642
43671
  const canHideOrOrder = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;
@@ -43649,7 +43678,16 @@ function Settings(props) {
43649
43678
  switch (popover) {
43650
43679
  case "columnSettings": {
43651
43680
  if (canHideOrOrder) {
43652
- popoverElement = (popoverProps) => /* @__PURE__ */ React.createElement(HideOrOrderPopover, { ...popoverProps, open: true, onChange: handleClosePopover, table });
43681
+ popoverElement = (popoverProps) => /* @__PURE__ */ React.createElement(
43682
+ HideOrOrderPopover,
43683
+ {
43684
+ ...popoverProps,
43685
+ id: `${id2}-columnSettings`,
43686
+ open: true,
43687
+ onChange: handleClosePopover,
43688
+ table
43689
+ }
43690
+ );
43653
43691
  }
43654
43692
  }
43655
43693
  }
@@ -43658,8 +43696,17 @@ function Settings(props) {
43658
43696
  IconButton,
43659
43697
  {
43660
43698
  "aria-label": texts.table.otherOptions.tooltip,
43699
+ id: id2,
43661
43700
  icon: "sliders",
43662
- menu: popoverElement ? void 0 : (menuProps) => /* @__PURE__ */ React.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React.createElement(Menu$1.Content, { align: "end" }, canHideOrOrder ? /* @__PURE__ */ React.createElement(Menu$1.Item, { icon: "columns", onClick: () => setPopover("columnSettings") }, texts.table.columnSettings.button) : null, canHideOrOrder && (canChangeRowHeight || canChangeFontSize || customSettings) ? /* @__PURE__ */ React.createElement(Menu$1.Separator, null) : null, canChangeRowHeight ? /* @__PURE__ */ React.createElement(
43701
+ menu: popoverElement ? void 0 : (menuProps) => /* @__PURE__ */ React.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React.createElement(Menu$1.Content, { align: "end" }, canHideOrOrder ? /* @__PURE__ */ React.createElement(
43702
+ Menu$1.Item,
43703
+ {
43704
+ "aria-controls": `${id2}-columnSettings`,
43705
+ icon: "columns",
43706
+ onClick: () => setPopover("columnSettings")
43707
+ },
43708
+ texts.table.columnSettings.button
43709
+ ) : null, canHideOrOrder && (canChangeRowHeight || canChangeFontSize || customSettings) ? /* @__PURE__ */ React.createElement(Menu$1.Separator, null) : null, canChangeRowHeight ? /* @__PURE__ */ React.createElement(
43663
43710
  Menu$1.Item,
43664
43711
  {
43665
43712
  icon: `height-${tableMeta.rowHeight.height}`,
@@ -45068,6 +45115,17 @@ function Print(props) {
45068
45115
  }, []);
45069
45116
  const print = async () => {
45070
45117
  const toastRef = toast.loading(texts.table.print.loading);
45118
+ if (tableMeta.printing.onPrint) {
45119
+ try {
45120
+ await tableMeta.printing.onPrint(getSettings(table), tableMeta.printing.settings);
45121
+ toastRef.close();
45122
+ } catch (error) {
45123
+ const errorMessage = `${texts.table.print.error}: ${error}`;
45124
+ console.error(errorMessage);
45125
+ toastRef.error(errorMessage);
45126
+ }
45127
+ return;
45128
+ }
45071
45129
  if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
45072
45130
  const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
45073
45131
  try {
@@ -45572,15 +45630,17 @@ function TableToolbar(props) {
45572
45630
  const canPrint = table.meta.printing.isEnabled;
45573
45631
  const canSettings = canChangeSettings(table.instance, table.props.customSettings);
45574
45632
  const canSearch = table.meta.search.isEnabled;
45633
+ const id2 = `${table.id}-toolbar`;
45575
45634
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
45576
45635
  "div",
45577
45636
  {
45578
45637
  ...attributes,
45638
+ id: id2,
45579
45639
  className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden",
45580
45640
  "data-taco": "table-toolbar"
45581
45641
  },
45582
45642
  table.props.toolbarLeft,
45583
- /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React.createElement(Settings, { customSettings: table.props.customSettings, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
45643
+ /* @__PURE__ */ React.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
45584
45644
  ), table.props.toolbarPanel ? /* @__PURE__ */ React.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
45585
45645
  }
45586
45646
  function canChangeSettings(table, customSettings) {
@@ -45621,6 +45681,7 @@ function TableGrid(props) {
45621
45681
  {
45622
45682
  ...attributes,
45623
45683
  id: table.id,
45684
+ "aria-owns": `${table.id}-toolbar`,
45624
45685
  "data-table-font-size": table.meta.fontSize.size,
45625
45686
  "data-table-grouped": !!((_a = table.state.grouping) == null ? void 0 : _a.length),
45626
45687
  "data-table-horizontally-scrolled": table.meta.columnFreezing.isHorizontallyScrolled ? true : void 0,