@homebound/beam 3.43.0 → 3.44.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
@@ -20539,7 +20539,7 @@ function FilterPanelOpen({
20539
20539
  }), children: [
20540
20540
  groupBy && /* @__PURE__ */ jsx148(SelectField, { label: "Group by", labelStyle: "inline", sizeToContent: true, options: groupBy.options, getOptionValue: (o) => o.id, getOptionLabel: (o) => o.name, value: groupBy.value, onSelect: (g) => g && groupBy.setValue(g) }),
20541
20541
  filterControls,
20542
- activeFilterCount > 0 && /* @__PURE__ */ jsx148(Button, { label: "Clear", variant: "tertiary", onClick: onClear, ...tid.clearBtn })
20542
+ activeFilterCount > 0 && /* @__PURE__ */ jsx148(Button, { label: "Clear", variant: "tertiary", onClick: () => maybeCall(onClear), ...tid.clearBtn })
20543
20543
  ] });
20544
20544
  }
20545
20545
  function FilterPanelClosed({
@@ -20564,7 +20564,7 @@ function FilterPanelClosed({
20564
20564
  } : {}
20565
20565
  }), children: [
20566
20566
  chips,
20567
- /* @__PURE__ */ jsx148(Button, { label: "Clear", variant: "tertiary", onClick: onClear, ...tid.clearBtn })
20567
+ /* @__PURE__ */ jsx148(Button, { label: "Clear", variant: "tertiary", onClick: () => maybeCall(onClear), ...tid.clearBtn })
20568
20568
  ] });
20569
20569
  }
20570
20570
  function buildFilterControls(filterImpls, filter, setFilter, testId) {
@@ -20608,7 +20608,9 @@ function GridTableLayoutActionsComponent(props) {
20608
20608
  api,
20609
20609
  withCardView,
20610
20610
  view,
20611
- setView
20611
+ setView,
20612
+ clearFilters,
20613
+ searchApi
20612
20614
  } = props;
20613
20615
  const testId = useTestIds(props, "gridTableLayoutActions");
20614
20616
  const {
@@ -20639,6 +20641,17 @@ function GridTableLayoutActionsComponent(props) {
20639
20641
  setSearchValue(v ?? "");
20640
20642
  handleSearchDebounced(v ?? "");
20641
20643
  }, placeholder: "Search", clearable: true, fullWidth: true, startAdornment: /* @__PURE__ */ jsx149(Icon, { icon: "search", color: "rgba(100, 100, 100, 1)" /* Gray700 */ }) });
20644
+ if (searchApi) {
20645
+ searchApi.current = {
20646
+ clear: () => {
20647
+ handleSearchDebounced.cancel();
20648
+ setSearchValue("");
20649
+ setQueryParams({
20650
+ search: void 0
20651
+ }, "replaceIn");
20652
+ }
20653
+ };
20654
+ }
20642
20655
  return /* @__PURE__ */ jsxs75("div", { className: "df fdc gap1 pb2", children: [
20643
20656
  /* @__PURE__ */ jsxs75("div", { ...trussProps73({
20644
20657
  display: "df",
@@ -20665,7 +20678,7 @@ function GridTableLayoutActionsComponent(props) {
20665
20678
  ] })
20666
20679
  ] }),
20667
20680
  sm && showSearch && /* @__PURE__ */ jsx149("div", { className: "pl3 pr3", children: searchTextField }),
20668
- hasFilters && /* @__PURE__ */ jsx149(FilterPanel, { isOpen: showFilters, groupBy, filterImpls, filter, setFilter, onClear: () => setFilter?.({}) })
20681
+ hasFilters && /* @__PURE__ */ jsx149(FilterPanel, { isOpen: showFilters, groupBy, filterImpls, filter, setFilter, onClear: clearFilters })
20669
20682
  ] });
20670
20683
  }
20671
20684
  var _GridTableLayoutActions = memo2(GridTableLayoutActionsComponent);
@@ -20829,8 +20842,13 @@ function GridTableLayoutComponent(props) {
20829
20842
  const filterSearchProps = useMemo40(() => layoutState?.search ? {
20830
20843
  onSearch: layoutState.setSearchString
20831
20844
  } : void 0, [layoutState?.search, layoutState?.setSearchString]);
20832
- const emptyState = useMemo40(() => composeEmptyState(tableProps, layoutState, layoutEmptyFallback), [layoutEmptyFallback, layoutState, tableProps]);
20833
- const tableActionsEl = /* @__PURE__ */ jsx152(_GridTableLayoutActions, { filterDefs: layoutState?.filterDefs, filter: layoutState?.filter, setFilter: layoutState?.setFilter, groupBy: layoutState?.groupBy, searchProps: filterSearchProps, hasHideableColumns, columns, api, withCardView, view, setView });
20845
+ const searchApiRef = useRef48();
20846
+ const clearFilters = useCallback27(() => {
20847
+ layoutState?.clearFilters();
20848
+ searchApiRef.current?.clear();
20849
+ }, [layoutState]);
20850
+ const emptyState = useMemo40(() => composeEmptyState(tableProps, layoutState, layoutEmptyFallback, clearFilters), [layoutEmptyFallback, layoutState, tableProps, clearFilters]);
20851
+ const tableActionsEl = /* @__PURE__ */ jsx152(_GridTableLayoutActions, { filterDefs: layoutState?.filterDefs, filter: layoutState?.filter, setFilter: layoutState?.setFilter, groupBy: layoutState?.groupBy, searchProps: filterSearchProps, hasHideableColumns, columns, api, withCardView, view, setView, clearFilters, searchApi: searchApiRef });
20834
20852
  const cardAs = withCardView && view === "card" ? "card" : void 0;
20835
20853
  const tableBody = /* @__PURE__ */ jsx152(Fragment35, { children: isGridTableProps(tableProps) ? /* @__PURE__ */ jsx152(GridTable, { ...tableProps, ...cardAs ? {
20836
20854
  as: cardAs
@@ -20920,7 +20938,7 @@ function useGridTableLayoutState({
20920
20938
  clearFilters
20921
20939
  };
20922
20940
  }
20923
- function composeEmptyState(tableProps, layoutState, layoutEmptyFallback) {
20941
+ function composeEmptyState(tableProps, layoutState, layoutEmptyFallback, clearFilters) {
20924
20942
  const tableEmptyState = "emptyState" in tableProps ? tableProps.emptyState : void 0;
20925
20943
  const tableEmptyFallback = "emptyFallback" in tableProps ? tableProps.emptyFallback : void 0;
20926
20944
  const filteringActive = layoutState?.filteringActive ?? false;
@@ -20928,7 +20946,7 @@ function composeEmptyState(tableProps, layoutState, layoutEmptyFallback) {
20928
20946
  return {
20929
20947
  title: tableEmptyState?.title ?? tableEmptyFallback ?? layoutEmptyFallback,
20930
20948
  description: tableEmptyState?.description ?? (filteringActive ? filterEmptyDescription : void 0),
20931
- actions: tableEmptyState?.actions ?? (filteringActive && layoutState ? /* @__PURE__ */ jsx152(Button, { label: "Clear Filters", variant: "tertiary", onClick: layoutState.clearFilters, "data-testid": "clearFilters" }) : void 0)
20949
+ actions: tableEmptyState?.actions ?? (filteringActive && layoutState ? /* @__PURE__ */ jsx152(Button, { label: "Clear Filters", variant: "tertiary", onClick: clearFilters, "data-testid": "clearFilters" }) : void 0)
20932
20950
  };
20933
20951
  }
20934
20952
  function useSetTableActionsHeight(tableWrapperRef, tableActionsRef, enabled) {