@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.cjs CHANGED
@@ -21002,7 +21002,7 @@ function FilterPanelOpen({
21002
21002
  }), children: [
21003
21003
  groupBy && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(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) }),
21004
21004
  filterControls,
21005
- activeFilterCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Button, { label: "Clear", variant: "tertiary", onClick: onClear, ...tid.clearBtn })
21005
+ activeFilterCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Button, { label: "Clear", variant: "tertiary", onClick: () => maybeCall(onClear), ...tid.clearBtn })
21006
21006
  ] });
21007
21007
  }
21008
21008
  function FilterPanelClosed({
@@ -21027,7 +21027,7 @@ function FilterPanelClosed({
21027
21027
  } : {}
21028
21028
  }), children: [
21029
21029
  chips,
21030
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Button, { label: "Clear", variant: "tertiary", onClick: onClear, ...tid.clearBtn })
21030
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Button, { label: "Clear", variant: "tertiary", onClick: () => maybeCall(onClear), ...tid.clearBtn })
21031
21031
  ] });
21032
21032
  }
21033
21033
  function buildFilterControls(filterImpls, filter, setFilter, testId) {
@@ -21071,7 +21071,9 @@ function GridTableLayoutActionsComponent(props) {
21071
21071
  api,
21072
21072
  withCardView,
21073
21073
  view,
21074
- setView
21074
+ setView,
21075
+ clearFilters,
21076
+ searchApi
21075
21077
  } = props;
21076
21078
  const testId = useTestIds(props, "gridTableLayoutActions");
21077
21079
  const {
@@ -21102,6 +21104,17 @@ function GridTableLayoutActionsComponent(props) {
21102
21104
  setSearchValue(v ?? "");
21103
21105
  handleSearchDebounced(v ?? "");
21104
21106
  }, placeholder: "Search", clearable: true, fullWidth: true, startAdornment: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Icon, { icon: "search", color: "rgba(100, 100, 100, 1)" /* Gray700 */ }) });
21107
+ if (searchApi) {
21108
+ searchApi.current = {
21109
+ clear: () => {
21110
+ handleSearchDebounced.cancel();
21111
+ setSearchValue("");
21112
+ setQueryParams({
21113
+ search: void 0
21114
+ }, "replaceIn");
21115
+ }
21116
+ };
21117
+ }
21105
21118
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "df fdc gap1 pb2", children: [
21106
21119
  /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { ...(0, import_runtime79.trussProps)({
21107
21120
  display: "df",
@@ -21128,7 +21141,7 @@ function GridTableLayoutActionsComponent(props) {
21128
21141
  ] })
21129
21142
  ] }),
21130
21143
  sm && showSearch && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "pl3 pr3", children: searchTextField }),
21131
- hasFilters && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(FilterPanel, { isOpen: showFilters, groupBy, filterImpls, filter, setFilter, onClear: () => setFilter?.({}) })
21144
+ hasFilters && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(FilterPanel, { isOpen: showFilters, groupBy, filterImpls, filter, setFilter, onClear: clearFilters })
21132
21145
  ] });
21133
21146
  }
21134
21147
  var _GridTableLayoutActions = (0, import_react107.memo)(GridTableLayoutActionsComponent);
@@ -21292,8 +21305,13 @@ function GridTableLayoutComponent(props) {
21292
21305
  const filterSearchProps = (0, import_react110.useMemo)(() => layoutState?.search ? {
21293
21306
  onSearch: layoutState.setSearchString
21294
21307
  } : void 0, [layoutState?.search, layoutState?.setSearchString]);
21295
- const emptyState = (0, import_react110.useMemo)(() => composeEmptyState(tableProps, layoutState, layoutEmptyFallback), [layoutEmptyFallback, layoutState, tableProps]);
21296
- const tableActionsEl = /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(_GridTableLayoutActions, { filterDefs: layoutState?.filterDefs, filter: layoutState?.filter, setFilter: layoutState?.setFilter, groupBy: layoutState?.groupBy, searchProps: filterSearchProps, hasHideableColumns, columns, api, withCardView, view, setView });
21308
+ const searchApiRef = (0, import_react110.useRef)();
21309
+ const clearFilters = (0, import_react110.useCallback)(() => {
21310
+ layoutState?.clearFilters();
21311
+ searchApiRef.current?.clear();
21312
+ }, [layoutState]);
21313
+ const emptyState = (0, import_react110.useMemo)(() => composeEmptyState(tableProps, layoutState, layoutEmptyFallback, clearFilters), [layoutEmptyFallback, layoutState, tableProps, clearFilters]);
21314
+ const tableActionsEl = /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(_GridTableLayoutActions, { filterDefs: layoutState?.filterDefs, filter: layoutState?.filter, setFilter: layoutState?.setFilter, groupBy: layoutState?.groupBy, searchProps: filterSearchProps, hasHideableColumns, columns, api, withCardView, view, setView, clearFilters, searchApi: searchApiRef });
21297
21315
  const cardAs = withCardView && view === "card" ? "card" : void 0;
21298
21316
  const tableBody = /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_jsx_runtime152.Fragment, { children: isGridTableProps(tableProps) ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(GridTable, { ...tableProps, ...cardAs ? {
21299
21317
  as: cardAs
@@ -21383,7 +21401,7 @@ function useGridTableLayoutState({
21383
21401
  clearFilters
21384
21402
  };
21385
21403
  }
21386
- function composeEmptyState(tableProps, layoutState, layoutEmptyFallback) {
21404
+ function composeEmptyState(tableProps, layoutState, layoutEmptyFallback, clearFilters) {
21387
21405
  const tableEmptyState = "emptyState" in tableProps ? tableProps.emptyState : void 0;
21388
21406
  const tableEmptyFallback = "emptyFallback" in tableProps ? tableProps.emptyFallback : void 0;
21389
21407
  const filteringActive = layoutState?.filteringActive ?? false;
@@ -21391,7 +21409,7 @@ function composeEmptyState(tableProps, layoutState, layoutEmptyFallback) {
21391
21409
  return {
21392
21410
  title: tableEmptyState?.title ?? tableEmptyFallback ?? layoutEmptyFallback,
21393
21411
  description: tableEmptyState?.description ?? (filteringActive ? filterEmptyDescription : void 0),
21394
- actions: tableEmptyState?.actions ?? (filteringActive && layoutState ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Button, { label: "Clear Filters", variant: "tertiary", onClick: layoutState.clearFilters, "data-testid": "clearFilters" }) : void 0)
21412
+ actions: tableEmptyState?.actions ?? (filteringActive && layoutState ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Button, { label: "Clear Filters", variant: "tertiary", onClick: clearFilters, "data-testid": "clearFilters" }) : void 0)
21395
21413
  };
21396
21414
  }
21397
21415
  function useSetTableActionsHeight(tableWrapperRef, tableActionsRef, enabled) {