@serkonda7/solid-components 0.0.7 → 0.1.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/README.md CHANGED
@@ -8,7 +8,7 @@ Reusable components for [SolidJS](https://www.solidjs.com/).
8
8
 
9
9
  ## 📦 Installation
10
10
  ```sh
11
- bun install @serkonda7/solid-components solid-js @tabler/icons-solidjs
11
+ bun install @serkonda7/solid-components solid-js
12
12
  ```
13
13
 
14
14
 
@@ -26,6 +26,7 @@ import '@serkonda7/solid-components/styles.css'
26
26
 
27
27
  These components are available:
28
28
  - `DataTable` - generic table with optional sorting, row selection, actions, loading, empty states, and column customizer.
29
+ - `FilterTable` - `DataTable` with filtering: quick search, a grouped filter form, and removable filter pills.
29
30
  - `Combobox` - searchable, accessible dropdown with keyboard navigation, option icons, a detail column, and an optional "Add …" entry.
30
31
 
31
32
  For the full API, examples, and agent notes, see [docs.md](docs.md).
@@ -33,6 +33,8 @@ export interface ComboboxProps {
33
33
  onAdd?: (query: string) => void;
34
34
  /** Text of the pinned add entry. Defaults to `Add`. */
35
35
  addLabel?: string;
36
+ /** Placeholder while closed and nothing is selected; `emptyLabel` takes precedence. */
37
+ placeholder?: string;
36
38
  /** Placeholder while open and nothing is selected. Defaults to `Search`. */
37
39
  searchLabel?: string;
38
40
  /** Shown when no option matches the search. Defaults to `No matching objects`. */
@@ -40,6 +40,8 @@ export interface DataTableProps<TRow> {
40
40
  columnCustomizerTitle?: string;
41
41
  columnCustomizerShowAllLabel?: string;
42
42
  columnCustomizerResetLabel?: string;
43
+ /** Content rendered at the start of the toolbar, before the column customizer. */
44
+ toolbar?: JSX.Element;
43
45
  loading?: boolean | Accessor<boolean>;
44
46
  empty?: boolean | Accessor<boolean>;
45
47
  loadingContent?: JSX.Element;
@@ -0,0 +1,53 @@
1
+ import type { Accessor, JSX } from 'solid-js';
2
+ import { type ComboboxOption } from './combobox';
3
+ import { type DataTableProps } from './data-table';
4
+ export type FilterTableFilterType = 'text' | 'select' | 'boolean';
5
+ /** A filter's value: text for `text`/`boolean` (`'true'`/`'false'`), a list for `select`. */
6
+ export type FilterTableValue = string | string[];
7
+ /**
8
+ * Applied filters by filter key, plus the quick search under `q`. Inactive
9
+ * filters are omitted, so the record maps directly onto URL query params.
10
+ */
11
+ export type FilterTableValues = Record<string, FilterTableValue>;
12
+ export interface FilterTableFilter<TRow> {
13
+ key: string;
14
+ label: string;
15
+ type: FilterTableFilterType;
16
+ /** Fieldset heading in the filter form; ungrouped filters come first. */
17
+ group?: string;
18
+ /** Value matched against; defaults to `row[key]`. May return an array for `select`. */
19
+ getValue?: (row: TRow) => unknown;
20
+ /** Replaces the built-in matching for this filter. */
21
+ match?: (row: TRow, value: FilterTableValue) => boolean;
22
+ /** Choices of a `select` filter; derived from the row values when omitted. */
23
+ options?: ComboboxOption[];
24
+ placeholder?: string;
25
+ }
26
+ export interface FilterTableProps<TRow> extends Omit<DataTableProps<TRow>, 'toolbar'> {
27
+ filters: FilterTableFilter<TRow>[];
28
+ /** Controlled applied filters; pair with `onFilterValuesChange`. */
29
+ filterValues?: FilterTableValues | Accessor<FilterTableValues>;
30
+ defaultFilterValues?: FilterTableValues;
31
+ onFilterValuesChange?: (values: FilterTableValues) => void;
32
+ /** Pass `rows` through unfiltered, e.g. when the server applies `filterValues`. */
33
+ manualFiltering?: boolean;
34
+ /** Shows the quick search input above the table. Defaults to `true`. */
35
+ quickSearch?: boolean;
36
+ /** Text matched by the quick search; defaults to the row's column values. */
37
+ getSearchText?: (row: TRow) => string;
38
+ quickSearchLabel?: string;
39
+ resultsLabel?: string;
40
+ filtersLabel?: string;
41
+ applyLabel?: string;
42
+ resetLabel?: string;
43
+ clearAllLabel?: string;
44
+ anyLabel?: string;
45
+ yesLabel?: string;
46
+ noLabel?: string;
47
+ }
48
+ /**
49
+ * `DataTable` with filtering: a Results tab with a quick search and
50
+ * removable pills for the applied filters, and a Filters tab with a grouped form
51
+ * that is applied on submit.
52
+ */
53
+ export declare function FilterTable<TRow>(props: FilterTableProps<TRow>): JSX.Element;
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@
6
6
  */
7
7
  export { Combobox, type ComboboxIcon, type ComboboxOption, type ComboboxProps, } from './combobox';
8
8
  export { DataTable, type DataTableColumn, type DataTableProps, type DataTableSort, type DataTableSortDirection, } from './data-table';
9
+ export { FilterTable, type FilterTableFilter, type FilterTableFilterType, type FilterTableProps, type FilterTableValue, type FilterTableValues, } from './filter-table';