@upbound/monarch-blocks 0.10.1 → 0.11.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.js CHANGED
@@ -3843,7 +3843,7 @@ import {
3843
3843
  useReactTable
3844
3844
  } from "@tanstack/react-table";
3845
3845
  import { Icon as Icon11 } from "@upbound/monarch-core";
3846
- import { InputGroup as InputGroup4, InputGroupAddon as InputGroupAddon4, InputGroupInput as InputGroupInput3 } from "@upbound/monarch-core";
3846
+ import { InputGroup as InputGroup4, InputGroupAddon as InputGroupAddon4, InputGroupButton as InputGroupButton2, InputGroupInput as InputGroupInput3 } from "@upbound/monarch-core";
3847
3847
 
3848
3848
  // src/lib/data-table/contextual-filters.ts
3849
3849
  function valueToString(value) {
@@ -4495,7 +4495,7 @@ function DataTableEmptyView({
4495
4495
  ] }) : null;
4496
4496
  return /* @__PURE__ */ jsx10("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */ jsxs8(Empty, { className: cn("border border-dashed", config.className), children: [
4497
4497
  /* @__PURE__ */ jsxs8(EmptyHeader, { children: [
4498
- config.icon && /* @__PURE__ */ jsx10(EmptyMedia, { children: /* @__PURE__ */ jsx10(IconTile, { variant: "branded", children: /* @__PURE__ */ jsx10(Icon6, { name: config.icon }) }) }),
4498
+ config.icon && /* @__PURE__ */ jsx10(EmptyMedia, { children: /* @__PURE__ */ jsx10(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx10(Icon6, { name: config.icon }) }) }),
4499
4499
  config.header && /* @__PURE__ */ jsx10(EmptyTitle, { children: config.header }),
4500
4500
  config.subheader && /* @__PURE__ */ jsx10(EmptyDescription, { children: config.subheader })
4501
4501
  ] }),
@@ -5970,6 +5970,7 @@ function DataTable({
5970
5970
  var _a, _b, _c, _d, _e, _f, _g, _h;
5971
5971
  const isGrid = layout === "grid";
5972
5972
  const searchInputId = `table-search-${React11.useId()}`;
5973
+ const searchInputRef = React11.useRef(null);
5973
5974
  const tableBodyScrollRef = React11.useRef(null);
5974
5975
  const [innerGlobalFilter, setInnerGlobalFilter] = React11.useState("");
5975
5976
  const [innerColumnOrdering, setInnerColumnOrdering] = React11.useState([]);
@@ -6184,6 +6185,7 @@ function DataTable({
6184
6185
  }
6185
6186
  }, [columnOrdering, disableColumnReordering, flatColumns, setColumnOrdering]);
6186
6187
  const showViewHeader = !!title || !!Actions;
6188
+ const showClearSearchButton = globalFilter && !shouldDisable;
6187
6189
  const showColumnOptions = !disableColumnReordering || !disableColumnVisibility;
6188
6190
  const toolbarSearch = !disableSearch && /* @__PURE__ */ jsxs13(InputGroup4, { className: cn("w-70", search == null ? void 0 : search.className), children: [
6189
6191
  /* @__PURE__ */ jsx17(InputGroupAddon4, { align: "inline-start", children: /* @__PURE__ */ jsx17(Icon11, { name: "magnifying-glass" }) }),
@@ -6195,10 +6197,24 @@ function DataTable({
6195
6197
  "aria-label": "Search",
6196
6198
  placeholder: (_g = search == null ? void 0 : search.placeholder) != null ? _g : "Search\u2026",
6197
6199
  disabled: shouldDisable,
6200
+ ref: searchInputRef,
6198
6201
  value: globalFilter,
6199
6202
  onChange: (e) => setGlobalFilter(e.target.value)
6200
6203
  })
6201
- )
6204
+ ),
6205
+ !!showClearSearchButton && /* @__PURE__ */ jsx17(InputGroupAddon4, { align: "inline-end", children: /* @__PURE__ */ jsx17(
6206
+ InputGroupButton2,
6207
+ {
6208
+ size: "icon-xs",
6209
+ "aria-label": "Clear search",
6210
+ onClick: () => {
6211
+ var _a2;
6212
+ setGlobalFilter("");
6213
+ (_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
6214
+ },
6215
+ children: /* @__PURE__ */ jsx17(Icon11, { name: "xmark" })
6216
+ }
6217
+ ) })
6202
6218
  ] });
6203
6219
  const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx17(
6204
6220
  ColumnOptions,