@mercurjs/dashboard-shared 2.1.2-canary.4 → 2.1.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/index.d.ts CHANGED
@@ -621,7 +621,7 @@ interface DataTableProps$1<TData> {
621
621
  };
622
622
  filterBarContent?: React__default.ReactNode;
623
623
  }
624
- declare const DataTable: <TData>({ data, columns, filters, commands, action, actions, actionMenu, getRowId, rowCount, enablePagination, enableSearch, autoFocusSearch, enableFilterMenu, rowHref, heading, headingLevel, subHeading, prefix, pageSize, emptyState, rowSelection, isLoading, layout, enableColumnVisibility, initialColumnVisibility, onColumnVisibilityChange, columnOrder, onColumnOrderChange, filterBarContent, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
624
+ declare const DataTable: <TData>({ data, columns, filters, commands, action, actions, actionMenu, getRowId, rowCount, enablePagination, enableSearch, autoFocusSearch: _autoFocusSearch, enableFilterMenu, rowHref, heading, headingLevel, subHeading, prefix, pageSize, emptyState, rowSelection, isLoading, layout, enableColumnVisibility, initialColumnVisibility, onColumnVisibilityChange, columnOrder, onColumnOrderChange, filterBarContent, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
625
625
 
626
626
  type FilterGroupProps = {
627
627
  filters: {
package/dist/index.js CHANGED
@@ -2598,7 +2598,7 @@ var FileUpload = ({
2598
2598
  "!border-ui-border-interactive": isDragOver
2599
2599
  }
2600
2600
  ),
2601
- children: uploadedImage ? /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10("img", { src: uploadedImage, className: "w-32 h-32 rounded-md" }) }) : /* @__PURE__ */ jsxs9(Fragment, { children: [
2601
+ children: uploadedImage ? /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10("img", { src: uploadedImage, alt: "", className: "w-32 h-32 rounded-md" }) }) : /* @__PURE__ */ jsxs9(Fragment, { children: [
2602
2602
  /* @__PURE__ */ jsxs9("div", { className: "text-ui-fg-subtle group-disabled:text-ui-fg-disabled flex items-center gap-x-2", children: [
2603
2603
  /* @__PURE__ */ jsx10(ArrowDownTray2, {}),
2604
2604
  /* @__PURE__ */ jsx10(Text5, { children: label })
@@ -3131,7 +3131,10 @@ var Copied = ({ style, value }) => {
3131
3131
  if (copied) {
3132
3132
  return /* @__PURE__ */ jsx15("span", { style: { ...style, ...styl }, children: /* @__PURE__ */ jsx15(Check, { className: "text-ui-contrast-fg-primary" }) });
3133
3133
  }
3134
- return /* @__PURE__ */ jsx15("span", { style: { ...style, ...styl }, onClick: handler, children: /* @__PURE__ */ jsx15(SquareTwoStack, { className: "text-ui-contrast-fg-secondary" }) });
3134
+ return (
3135
+ // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
3136
+ /* @__PURE__ */ jsx15("span", { style: { ...style, ...styl }, onClick: handler, children: /* @__PURE__ */ jsx15(SquareTwoStack, { className: "text-ui-contrast-fg-secondary" }) })
3137
+ );
3135
3138
  };
3136
3139
 
3137
3140
  // src/components/common/link-button/link-button.tsx
@@ -4265,7 +4268,7 @@ var animateLayoutChanges = ({
4265
4268
  isSorting,
4266
4269
  wasDragging
4267
4270
  }) => {
4268
- return isSorting || wasDragging ? false : true;
4271
+ return !(isSorting || wasDragging);
4269
4272
  };
4270
4273
  function SortableTreeItem({
4271
4274
  id,
@@ -4454,7 +4457,7 @@ function SortableTree({
4454
4457
  function handleCollapse(id) {
4455
4458
  setCollapsedState((state) => ({
4456
4459
  ...state,
4457
- [id]: state[id] ? false : true
4460
+ [id]: !state[id]
4458
4461
  }));
4459
4462
  }
4460
4463
  function getMovementAnnouncement(eventName, activeId2, overId2) {
@@ -5575,7 +5578,7 @@ var useDataGridClipboardEvents = ({
5575
5578
  if (typeof value === "object" && value !== null) {
5576
5579
  return JSON.stringify(value);
5577
5580
  }
5578
- return `${value}` ?? "";
5581
+ return value == null ? "" : `${value}`;
5579
5582
  }).join(" ");
5580
5583
  e.clipboardData?.setData("text/plain", text);
5581
5584
  },
@@ -5843,7 +5846,7 @@ function convertToggleableNumber(value) {
5843
5846
  try {
5844
5847
  obj = JSON.parse(obj);
5845
5848
  } catch (error) {
5846
- throw new Error(`String "${value}" cannot be converted to object.`);
5849
+ throw new Error(`String "${value}" cannot be converted to object.`, { cause: error });
5847
5850
  }
5848
5851
  }
5849
5852
  return obj;
@@ -8073,7 +8076,6 @@ var DataGridKeyboardShortcutModal = ({
8073
8076
  {
8074
8077
  type: "search",
8075
8078
  value: searchValue,
8076
- autoFocus: true,
8077
8079
  onChange: (e) => onSearchValueChange(e.target.value)
8078
8080
  }
8079
8081
  ) })
@@ -8247,10 +8249,13 @@ var DataGridRoot = ({
8247
8249
  }, 100);
8248
8250
  return () => {
8249
8251
  clearTimeout(timeoutId);
8250
- const scrollElement = containerRef.current;
8251
- scrollElement?.removeEventListener("scroll", handleScroll);
8252
+ container.removeEventListener("scroll", handleScroll);
8252
8253
  };
8253
- }, [isLazyMode, hasData]);
8254
+ }, [
8255
+ isLazyMode,
8256
+ hasData,
8257
+ handleScroll
8258
+ ]);
8254
8259
  const columnVirtualizer = useVirtualizer({
8255
8260
  count: visibleColumns.length,
8256
8261
  estimateSize: (index) => visibleColumns[index].getSize(),
@@ -8553,7 +8558,6 @@ var DataGridRoot = ({
8553
8558
  "div",
8554
8559
  {
8555
8560
  ref: containerRef,
8556
- autoFocus: true,
8557
8561
  tabIndex: 0,
8558
8562
  className: "relative h-full select-none overflow-auto outline-none",
8559
8563
  onFocus: handleRestoreGridFocus,
@@ -9496,7 +9500,7 @@ var DataTable = ({
9496
9500
  rowCount = 0,
9497
9501
  enablePagination = true,
9498
9502
  enableSearch = true,
9499
- autoFocusSearch = false,
9503
+ autoFocusSearch: _autoFocusSearch = false,
9500
9504
  enableFilterMenu,
9501
9505
  rowHref,
9502
9506
  heading,
@@ -9530,7 +9534,7 @@ var DataTable = ({
9530
9534
  if (hasChanged) {
9531
9535
  setColumnVisibility(initialColumnVisibility);
9532
9536
  }
9533
- }, [initialColumnVisibility]);
9537
+ }, [initialColumnVisibility, columnVisibility]);
9534
9538
  const handleColumnVisibilityChange = React6.useCallback(
9535
9539
  (visibility) => {
9536
9540
  setColumnVisibility(visibility);
@@ -9699,8 +9703,7 @@ var DataTable = ({
9699
9703
  enableSearch && /* @__PURE__ */ jsx47("div", { className: "w-full md:w-auto", children: /* @__PURE__ */ jsx47(
9700
9704
  UiDataTable.Search,
9701
9705
  {
9702
- placeholder: t2("filters.searchLabel"),
9703
- autoFocus: autoFocusSearch
9706
+ placeholder: t2("filters.searchLabel")
9704
9707
  }
9705
9708
  ) }),
9706
9709
  actionMenu && /* @__PURE__ */ jsx47(ActionMenu, { variant: "primary", ...actionMenu }),
@@ -11551,7 +11554,11 @@ var useSelectedParams = ({
11551
11554
  const updateSingleValue = () => {
11552
11555
  newValue.set(identifier, value);
11553
11556
  };
11554
- multiple ? updateMultipleValues() : updateSingleValue();
11557
+ if (multiple) {
11558
+ updateMultipleValues();
11559
+ } else {
11560
+ updateSingleValue();
11561
+ }
11555
11562
  newValue.delete(offsetKey);
11556
11563
  return newValue;
11557
11564
  });
@@ -11570,7 +11577,11 @@ var useSelectedParams = ({
11570
11577
  };
11571
11578
  setSearchParams((prev) => {
11572
11579
  if (value) {
11573
- multiple ? deleteMultipleValues(prev) : deleteSingleValue(prev);
11580
+ if (multiple) {
11581
+ deleteMultipleValues(prev);
11582
+ } else {
11583
+ deleteSingleValue(prev);
11584
+ }
11574
11585
  if (!prev.get(identifier)) {
11575
11586
  prev.delete(identifier);
11576
11587
  }
@@ -12071,7 +12082,6 @@ var NumberFilter = ({
12071
12082
  onValueChange: (val) => setOperator(val),
12072
12083
  className: "flex flex-col items-start",
12073
12084
  orientation: "vertical",
12074
- autoFocus: true,
12075
12085
  children: operators.map((o) => /* @__PURE__ */ jsxs46(
12076
12086
  RadixRadioGroup.Item,
12077
12087
  {
@@ -12567,17 +12577,21 @@ var DataTableFilter2 = ({
12567
12577
  }
12568
12578
  },
12569
12579
  children: availableFilters.map((filter) => {
12570
- return /* @__PURE__ */ jsx71(
12571
- "div",
12572
- {
12573
- className: "bg-ui-bg-base hover:bg-ui-bg-base-hover focus-visible:bg-ui-bg-base-pressed text-ui-fg-base data-[disabled]:text-ui-fg-disabled txt-compact-small relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 outline-none transition-colors data-[disabled]:pointer-events-none",
12574
- role: "menuitem",
12575
- onClick: () => {
12576
- addFilter(filter);
12580
+ return (
12581
+ // oxlint-disable-next-line jsx-a11y/click-events-have-key-events
12582
+ /* @__PURE__ */ jsx71(
12583
+ "div",
12584
+ {
12585
+ tabIndex: 0,
12586
+ className: "bg-ui-bg-base hover:bg-ui-bg-base-hover focus-visible:bg-ui-bg-base-pressed text-ui-fg-base data-[disabled]:text-ui-fg-disabled txt-compact-small relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 outline-none transition-colors data-[disabled]:pointer-events-none",
12587
+ role: "menuitem",
12588
+ onClick: () => {
12589
+ addFilter(filter);
12590
+ },
12591
+ children: filter.label
12577
12592
  },
12578
- children: filter.label
12579
- },
12580
- filter.key
12593
+ filter.key
12594
+ )
12581
12595
  );
12582
12596
  })
12583
12597
  }
@@ -12775,7 +12789,7 @@ import { jsx as jsx73 } from "react/jsx-runtime";
12775
12789
  var DataTableSearch = ({
12776
12790
  placeholder,
12777
12791
  prefix,
12778
- autofocus
12792
+ autofocus: _autofocus
12779
12793
  }) => {
12780
12794
  const { t: t2 } = useTranslation30();
12781
12795
  const placeholderText = placeholder || t2("general.search");
@@ -12808,7 +12822,6 @@ var DataTableSearch = ({
12808
12822
  name: "q",
12809
12823
  type: "search",
12810
12824
  size: "small",
12811
- autoFocus: autofocus,
12812
12825
  defaultValue: query?.[0] || void 0,
12813
12826
  onChange: debouncedOnChange,
12814
12827
  placeholder: placeholderText
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/dashboard-shared",
3
- "version": "2.1.2-canary.4",
3
+ "version": "2.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",