@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.
@@ -2361,7 +2361,7 @@ function CelDateValueEditor({
2361
2361
 
2362
2362
  // src/data-table/data-table.tsx
2363
2363
  import { Icon as Icon9 } from "@upbound/monarch-core";
2364
- import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
2364
+ import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupButton, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
2365
2365
 
2366
2366
  // src/lib/data-table/contextual-filters.ts
2367
2367
  function valueToString(value) {
@@ -3028,7 +3028,7 @@ function DataTableEmptyView({
3028
3028
  ] }) : null;
3029
3029
  return /* @__PURE__ */ jsx6("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */ jsxs5(Empty, { className: cn("border border-dashed", config.className), children: [
3030
3030
  /* @__PURE__ */ jsxs5(EmptyHeader, { children: [
3031
- config.icon && /* @__PURE__ */ jsx6(EmptyMedia, { children: /* @__PURE__ */ jsx6(IconTile, { variant: "branded", children: /* @__PURE__ */ jsx6(Icon4, { name: config.icon }) }) }),
3031
+ config.icon && /* @__PURE__ */ jsx6(EmptyMedia, { children: /* @__PURE__ */ jsx6(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx6(Icon4, { name: config.icon }) }) }),
3032
3032
  config.header && /* @__PURE__ */ jsx6(EmptyTitle, { children: config.header }),
3033
3033
  config.subheader && /* @__PURE__ */ jsx6(EmptyDescription, { children: config.subheader })
3034
3034
  ] }),
@@ -4481,6 +4481,7 @@ function DataTable({
4481
4481
  var _a, _b, _c, _d, _e, _f, _g, _h;
4482
4482
  const isGrid = layout === "grid";
4483
4483
  const searchInputId = `table-search-${React9.useId()}`;
4484
+ const searchInputRef = React9.useRef(null);
4484
4485
  const tableBodyScrollRef = React9.useRef(null);
4485
4486
  const [innerGlobalFilter, setInnerGlobalFilter] = React9.useState("");
4486
4487
  const [innerColumnOrdering, setInnerColumnOrdering] = React9.useState([]);
@@ -4695,6 +4696,7 @@ function DataTable({
4695
4696
  }
4696
4697
  }, [columnOrdering, disableColumnReordering, flatColumns, setColumnOrdering]);
4697
4698
  const showViewHeader = !!title || !!Actions;
4699
+ const showClearSearchButton = globalFilter && !shouldDisable;
4698
4700
  const showColumnOptions = !disableColumnReordering || !disableColumnVisibility;
4699
4701
  const toolbarSearch = !disableSearch && /* @__PURE__ */ jsxs10(InputGroup2, { className: cn("w-70", search == null ? void 0 : search.className), children: [
4700
4702
  /* @__PURE__ */ jsx13(InputGroupAddon2, { align: "inline-start", children: /* @__PURE__ */ jsx13(Icon9, { name: "magnifying-glass" }) }),
@@ -4706,10 +4708,24 @@ function DataTable({
4706
4708
  "aria-label": "Search",
4707
4709
  placeholder: (_g = search == null ? void 0 : search.placeholder) != null ? _g : "Search\u2026",
4708
4710
  disabled: shouldDisable,
4711
+ ref: searchInputRef,
4709
4712
  value: globalFilter,
4710
4713
  onChange: (e) => setGlobalFilter(e.target.value)
4711
4714
  })
4712
- )
4715
+ ),
4716
+ !!showClearSearchButton && /* @__PURE__ */ jsx13(InputGroupAddon2, { align: "inline-end", children: /* @__PURE__ */ jsx13(
4717
+ InputGroupButton,
4718
+ {
4719
+ size: "icon-xs",
4720
+ "aria-label": "Clear search",
4721
+ onClick: () => {
4722
+ var _a2;
4723
+ setGlobalFilter("");
4724
+ (_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
4725
+ },
4726
+ children: /* @__PURE__ */ jsx13(Icon9, { name: "xmark" })
4727
+ }
4728
+ ) })
4713
4729
  ] });
4714
4730
  const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx13(
4715
4731
  ColumnOptions,