@serkonda7/solid-components 0.0.8 → 0.2.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 +11 -0
- package/dist/combobox.d.ts +2 -0
- package/dist/data-table.d.ts +8 -0
- package/dist/filter-table.d.ts +70 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +675 -140
- package/dist/search-bar.d.ts +25 -0
- package/dist/styles.css +440 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +2 -0
- package/package.json +24 -14
package/README.md
CHANGED
|
@@ -24,9 +24,20 @@ import '@serkonda7/solid-components/styles.css'
|
|
|
24
24
|
/>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
If your app imports `@tabler/icons-solidjs` itself, add the bundled Vite plugin
|
|
28
|
+
before `solid()`. Without it, dev mode loads all ~6000 icon modules:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { tablerIcons } from '@serkonda7/solid-components/vite'
|
|
32
|
+
|
|
33
|
+
export default defineConfig({ plugins: [tablerIcons(), solid()] })
|
|
34
|
+
```
|
|
35
|
+
|
|
27
36
|
These components are available:
|
|
28
37
|
- `DataTable` - generic table with optional sorting, row selection, actions, loading, empty states, and column customizer.
|
|
38
|
+
- `FilterTable` - `DataTable` with filtering: quick search, a grouped filter form, and removable filter pills.
|
|
29
39
|
- `Combobox` - searchable, accessible dropdown with keyboard navigation, option icons, a detail column, and an optional "Add …" entry.
|
|
40
|
+
- `SearchBar` - search input with clear button and a global Ctrl/Cmd+K focus shortcut.
|
|
30
41
|
|
|
31
42
|
For the full API, examples, and agent notes, see [docs.md](docs.md).
|
|
32
43
|
|
package/dist/combobox.d.ts
CHANGED
|
@@ -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`. */
|
package/dist/data-table.d.ts
CHANGED
|
@@ -35,11 +35,19 @@ export interface DataTableProps<TRow> {
|
|
|
35
35
|
visibleColumns?: string[] | Accessor<string[]>;
|
|
36
36
|
defaultVisibleColumns?: string[];
|
|
37
37
|
onVisibleColumnsChange?: (visibleKeys: string[]) => void;
|
|
38
|
+
/** Controlled column order as column keys; pair with `onColumnOrderChange`. */
|
|
39
|
+
columnOrder?: string[] | Accessor<string[]>;
|
|
40
|
+
defaultColumnOrder?: string[];
|
|
41
|
+
onColumnOrderChange?: (orderedKeys: string[]) => void;
|
|
38
42
|
showColumnCustomizer?: boolean | Accessor<boolean>;
|
|
39
43
|
columnCustomizerLabel?: string;
|
|
40
44
|
columnCustomizerTitle?: string;
|
|
41
45
|
columnCustomizerShowAllLabel?: string;
|
|
42
46
|
columnCustomizerResetLabel?: string;
|
|
47
|
+
columnCustomizerMoveUpLabel?: string;
|
|
48
|
+
columnCustomizerMoveDownLabel?: string;
|
|
49
|
+
/** Content rendered at the start of the toolbar, before the column customizer. */
|
|
50
|
+
toolbar?: JSX.Element;
|
|
43
51
|
loading?: boolean | Accessor<boolean>;
|
|
44
52
|
empty?: boolean | Accessor<boolean>;
|
|
45
53
|
loadingContent?: JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
/** A named set of filter values the user saved for reuse. */
|
|
13
|
+
export interface FilterTableSavedFilter {
|
|
14
|
+
name: string;
|
|
15
|
+
values: FilterTableValues;
|
|
16
|
+
}
|
|
17
|
+
export interface FilterTableFilter<TRow> {
|
|
18
|
+
key: string;
|
|
19
|
+
label: string;
|
|
20
|
+
type: FilterTableFilterType;
|
|
21
|
+
/** Fieldset heading in the filter form; ungrouped filters come first. */
|
|
22
|
+
group?: string;
|
|
23
|
+
/** Value matched against; defaults to `row[key]`. May return an array for `select`. */
|
|
24
|
+
getValue?: (row: TRow) => unknown;
|
|
25
|
+
/** Replaces the built-in matching for this filter. */
|
|
26
|
+
match?: (row: TRow, value: FilterTableValue) => boolean;
|
|
27
|
+
/** Choices of a `select` filter; derived from the row values when omitted. */
|
|
28
|
+
options?: ComboboxOption[];
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface FilterTableProps<TRow> extends Omit<DataTableProps<TRow>, 'toolbar'> {
|
|
32
|
+
filters: FilterTableFilter<TRow>[];
|
|
33
|
+
/** Controlled applied filters; pair with `onFilterValuesChange`. */
|
|
34
|
+
filterValues?: FilterTableValues | Accessor<FilterTableValues>;
|
|
35
|
+
defaultFilterValues?: FilterTableValues;
|
|
36
|
+
onFilterValuesChange?: (values: FilterTableValues) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Saved filters, listed in a picker beside the quick search. Passing this
|
|
39
|
+
* (even `[]`) enables saving: a "Save" pill names the applied filters and
|
|
40
|
+
* emits the new list through `onSavedFiltersChange`; persisting it is up to you.
|
|
41
|
+
*/
|
|
42
|
+
savedFilters?: FilterTableSavedFilter[] | Accessor<FilterTableSavedFilter[]>;
|
|
43
|
+
onSavedFiltersChange?: (savedFilters: FilterTableSavedFilter[]) => void;
|
|
44
|
+
/** Pass `rows` through unfiltered, e.g. when the server applies `filterValues`. */
|
|
45
|
+
manualFiltering?: boolean;
|
|
46
|
+
/** Shows the quick search input above the table. Defaults to `true`. */
|
|
47
|
+
quickSearch?: boolean;
|
|
48
|
+
/** Text matched by the quick search; defaults to the row's column values. */
|
|
49
|
+
getSearchText?: (row: TRow) => string;
|
|
50
|
+
quickSearchLabel?: string;
|
|
51
|
+
resultsLabel?: string;
|
|
52
|
+
filtersLabel?: string;
|
|
53
|
+
applyLabel?: string;
|
|
54
|
+
resetLabel?: string;
|
|
55
|
+
clearAllLabel?: string;
|
|
56
|
+
anyLabel?: string;
|
|
57
|
+
yesLabel?: string;
|
|
58
|
+
noLabel?: string;
|
|
59
|
+
savedFiltersLabel?: string;
|
|
60
|
+
saveLabel?: string;
|
|
61
|
+
saveNameLabel?: string;
|
|
62
|
+
cancelLabel?: string;
|
|
63
|
+
deleteSavedFilterLabel?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* `DataTable` with filtering: a Results tab with a quick search and
|
|
67
|
+
* removable pills for the applied filters, and a Filters tab with a grouped form
|
|
68
|
+
* that is applied on submit.
|
|
69
|
+
*/
|
|
70
|
+
export declare function FilterTable<TRow>(props: FilterTableProps<TRow>): JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,5 @@
|
|
|
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 FilterTableSavedFilter, type FilterTableValue, type FilterTableValues, } from './filter-table';
|
|
10
|
+
export { SearchBar, type SearchBarProps, } from './search-bar';
|