@mendylanda/ui 0.1.8 → 0.1.9

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.
@@ -22,9 +22,11 @@ export interface FilterRootProps {
22
22
  children: ReactNode;
23
23
  }
24
24
  export declare function FilterRoot({ classNames, ...props }: FilterRootProps): import("react/jsx-runtime").JSX.Element;
25
- export declare function FilterBar(props: Omit<FilterRootProps, "children"> & {
25
+ export declare function FilterBar({ showClear, ...props }: Omit<FilterRootProps, "children"> & {
26
26
  searchLabel?: string;
27
27
  searchPlaceholder?: string;
28
+ /** Show Clear all after the applied chips. */
29
+ showClear?: boolean;
28
30
  }): import("react/jsx-runtime").JSX.Element;
29
31
  export declare function FilterSearch({ label, placeholder, }: {
30
32
  label?: string;
@@ -37,7 +39,10 @@ export declare function FilterMenu({ children, asChild, anchor, }: {
37
39
  /** Align a standalone trigger to an application-owned search field. */
38
40
  anchor?: React.RefObject<HTMLDivElement | null>;
39
41
  }): import("react/jsx-runtime").JSX.Element;
40
- export declare function FilterList(): import("react/jsx-runtime").JSX.Element;
42
+ /** Applied chips followed by Clear all. Opt out when placing FilterClear elsewhere. */
43
+ export declare function FilterList({ showClear }: {
44
+ showClear?: boolean;
45
+ }): import("react/jsx-runtime").JSX.Element;
41
46
  export declare function FilterField({ id }: {
42
47
  id: string;
43
48
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -60,8 +60,8 @@ function FilterRootContent({ filters, summary = defaultSummary, suggestions = "a
60
60
  }), [filters, summary, suggestions, closeMenuOnApply, groups, disabled, ambiguous, direction]);
61
61
  return (_jsx(FilterOptionCache.Provider, { value: cache, children: _jsx(Context.Provider, { value: context, children: _jsx("div", { "data-mendy-ui": "", "aria-busy": !hydrated || undefined, className: cn("mui-222f930b8752 mui-faa8a23c68f6 mui-71556df3b421 mui-074569488cca", classNames?.root, className), children: children }) }) }));
62
62
  }
63
- export function FilterBar(props) {
64
- return (_jsxs(FilterRoot, { ...props, children: [_jsx(FilterSearch, { label: props.searchLabel, placeholder: props.searchPlaceholder }), _jsx(FilterList, {}), _jsx(FilterClear, {}), _jsx(FilterFeedback, {})] }));
63
+ export function FilterBar({ showClear = true, ...props }) {
64
+ return (_jsxs(FilterRoot, { ...props, children: [_jsx(FilterSearch, { label: props.searchLabel, placeholder: props.searchPlaceholder }), _jsx(FilterList, { showClear: showClear }), _jsx(FilterFeedback, {})] }));
65
65
  }
66
66
  export function FilterSearch({ label = "Search", placeholder = "Search or filter", }) {
67
67
  const { filters, trigger, disabled, setAmbiguous, direction } = useRoot();
@@ -183,13 +183,14 @@ function FilterMenuContent({ anchor }) {
183
183
  });
184
184
  return (_jsx(FilterDraftCache.Provider, { value: drafts, children: _jsx(FilterMenuPanel, { sections: sections, selectedId: filters.openField, onSelect: filters.setOpenField, onClose: () => filters.setMenuOpen(false), anchor: anchor, trigger: trigger }) }));
185
185
  }
186
- export function FilterList() {
186
+ /** Applied chips followed by Clear all. Opt out when placing FilterClear elsewhere. */
187
+ export function FilterList({ showClear = true }) {
187
188
  const { filters, suggestions } = useRoot();
188
- return (_jsx(FilterChipList, { children: filters.entries.flatMap((entry) => !entry.field.hidden &&
189
- (entry.field.isActive(entry.value) ||
190
- showSuggestion(entry, suggestions, filters.active.length))
191
- ? [_jsx(FieldChip, { entry: entry }, entry.id)]
192
- : []) }));
189
+ return (_jsxs(FilterChipList, { children: [filters.entries.flatMap((entry) => !entry.field.hidden &&
190
+ (entry.field.isActive(entry.value) ||
191
+ showSuggestion(entry, suggestions, filters.active.length))
192
+ ? [_jsx(FieldChip, { entry: entry }, entry.id)]
193
+ : []), showClear && _jsx(FilterClear, {})] }));
193
194
  }
194
195
  function summarize(field, value, choices) {
195
196
  if (field.kind === "numberRange" && Array.isArray(value))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendylanda/ui",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Mendy Landa\u2019s reusable React components. Typed filters with dynamic options, URL persistence, and customizable UI.",
5
5
  "homepage": "https://ui.mendylanda.com",
6
6
  "license": "MIT",