@undevy-org/tablewright 0.3.0 → 0.5.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.
@@ -1,4 +1,12 @@
1
1
  import type { ActiveFilter, ActiveFilterValue, ColumnFilterConfig, FilterStatsSlice } from "./filter-types.js";
2
+ import { type ColumnFilterPopoverLabels } from "./ColumnFilterPopover.js";
3
+ import { type CompoundFilterPopoverLabels } from "./CompoundFilterPopover.js";
4
+ import type { FilterPopoverFooterLabels } from "./FilterPopoverFooter.js";
5
+ export interface AppliedStateChipsLabels {
6
+ clearAll: string;
7
+ columns: string;
8
+ hiddenCount: (n: number) => string;
9
+ }
2
10
  interface AppliedStateChipsProps {
3
11
  filters: ActiveFilter[];
4
12
  configs: Record<string, ColumnFilterConfig>;
@@ -23,6 +31,10 @@ interface AppliedStateChipsProps {
23
31
  columnFilterStats?: Record<string, FilterStatsSlice>;
24
32
  requestOpenFilterId?: string | null;
25
33
  onRequestOpenHandled?: () => void;
34
+ labels?: Partial<AppliedStateChipsLabels>;
35
+ columnFilterLabels?: Partial<ColumnFilterPopoverLabels>;
36
+ compoundFilterLabels?: Partial<CompoundFilterPopoverLabels>;
37
+ filterPopoverFooterLabels?: Partial<FilterPopoverFooterLabels>;
26
38
  }
27
- export declare function AppliedStateChips({ filters, configs, newestColumnId, onRemoveFilter, onChangeFilter, currentSort, columnLabels, onRemoveSort, hiddenColumnsCount, onResetColumns, onOpenColumnsMenu, customFilterChip, onRemoveCustomFilter, onClearAll, columnFilterStats, requestOpenFilterId, onRequestOpenHandled, }: AppliedStateChipsProps): import("react").JSX.Element | null;
39
+ export declare function AppliedStateChips({ filters, configs, newestColumnId, onRemoveFilter, onChangeFilter, currentSort, columnLabels, onRemoveSort, hiddenColumnsCount, onResetColumns, onOpenColumnsMenu, customFilterChip, onRemoveCustomFilter, onClearAll, columnFilterStats, requestOpenFilterId, onRequestOpenHandled, labels: labelOverrides, columnFilterLabels, compoundFilterLabels, filterPopoverFooterLabels, }: AppliedStateChipsProps): import("react").JSX.Element | null;
28
40
  export {};
@@ -1,4 +1,23 @@
1
+ import { type FilterPopoverFooterLabels } from "./FilterPopoverFooter.js";
1
2
  import type { ActiveFilter, ColumnFilterConfig, ActiveFilterValue, FilterStatsSlice } from "./filter-types.js";
3
+ export interface ColumnFilterPopoverLabels {
4
+ searchPlaceholder: string;
5
+ addValuePlaceholder: string;
6
+ noData: string;
7
+ statsAllPrefix: string;
8
+ statsFilteredPrefix: string;
9
+ statsTextAllPrefix: string;
10
+ statsTextFilteredPrefix: string;
11
+ chipFrom: string;
12
+ chipTo: string;
13
+ chipMin: string;
14
+ chipMax: string;
15
+ contains: string;
16
+ orBadge: string;
17
+ numberInputPlaceholder: string;
18
+ valuesCount: (n: number) => string;
19
+ selectedCount: (n: number) => string;
20
+ }
2
21
  interface ColumnFilterPopoverProps {
3
22
  config: ColumnFilterConfig;
4
23
  filter: ActiveFilter;
@@ -9,6 +28,8 @@ interface ColumnFilterPopoverProps {
9
28
  stats?: FilterStatsSlice;
10
29
  requestOpen?: boolean;
11
30
  onRequestOpenHandled?: () => void;
31
+ labels?: Partial<ColumnFilterPopoverLabels>;
32
+ footerLabels?: Partial<FilterPopoverFooterLabels>;
12
33
  }
13
- export declare function ColumnFilterPopover({ config, filter, onChange, onRemove, initialOpen, chipClassName, stats, requestOpen, onRequestOpenHandled, }: ColumnFilterPopoverProps): import("react").JSX.Element;
34
+ export declare function ColumnFilterPopover({ config, filter, onChange, onRemove, initialOpen, chipClassName, stats, requestOpen, onRequestOpenHandled, labels: labelOverrides, footerLabels, }: ColumnFilterPopoverProps): import("react").JSX.Element;
14
35
  export {};
@@ -1,4 +1,20 @@
1
+ import { type FilterPopoverFooterLabels } from "./FilterPopoverFooter.js";
1
2
  import type { ActiveFilter, ActiveFilterValue, ColumnFilterConfig, FilterStatsSlice } from "./filter-types.js";
3
+ export interface CompoundFilterPopoverLabels {
4
+ searchPlaceholder: string;
5
+ addPlaceholder: string;
6
+ contains: string;
7
+ orBadge: string;
8
+ chipMin: string;
9
+ chipMax: string;
10
+ statsAllPrefix: string;
11
+ statsFilteredPrefix: string;
12
+ numberInputPlaceholder: string;
13
+ resetSectionTitle: (subLabel: string) => string;
14
+ filtersCount: (n: number) => string;
15
+ subValuesCount: (n: number) => string;
16
+ subSelectedCount: (n: number) => string;
17
+ }
2
18
  interface CompoundFilterPopoverProps {
3
19
  config: ColumnFilterConfig;
4
20
  filter: ActiveFilter;
@@ -9,6 +25,8 @@ interface CompoundFilterPopoverProps {
9
25
  columnFilterStats?: Record<string, FilterStatsSlice>;
10
26
  requestOpen?: boolean;
11
27
  onRequestOpenHandled?: () => void;
28
+ labels?: Partial<CompoundFilterPopoverLabels>;
29
+ footerLabels?: Partial<FilterPopoverFooterLabels>;
12
30
  }
13
- export declare function CompoundFilterPopover({ config, filter, onChange, onRemove, initialOpen, chipClassName, columnFilterStats, requestOpen, onRequestOpenHandled, }: CompoundFilterPopoverProps): import("react").JSX.Element;
31
+ export declare function CompoundFilterPopover({ config, filter, onChange, onRemove, initialOpen, chipClassName, columnFilterStats, requestOpen, onRequestOpenHandled, labels: labelOverrides, footerLabels, }: CompoundFilterPopoverProps): import("react").JSX.Element;
14
32
  export {};
@@ -1,5 +1,20 @@
1
1
  import type { ActiveFilter, ColumnFilterConfig } from "./filter-types.js";
2
2
  import { type ManagedFilterChange } from "./managed-filters.js";
3
+ export interface FilterFormPanelLabels {
4
+ closeFiltersAriaLabel: string;
5
+ closeFiltersTitle: string;
6
+ apply: string;
7
+ clear: string;
8
+ anyPlaceholder: string;
9
+ rangeFromPlaceholder: string;
10
+ rangeToPlaceholder: string;
11
+ fieldRangeFromAriaLabel: (fieldLabel: string) => string;
12
+ fieldRangeToAriaLabel: (fieldLabel: string) => string;
13
+ compoundSubRangeFromAriaLabel: (subLabel: string) => string;
14
+ compoundSubRangeToAriaLabel: (subLabel: string) => string;
15
+ compoundSubRangeFromPlaceholder: (subLabel: string) => string;
16
+ compoundSubRangeToPlaceholder: (subLabel: string) => string;
17
+ }
3
18
  export interface FilterFormPanelProps {
4
19
  /** All known filter configs (same shape used by GroupedFilterAdd). */
5
20
  filterConfigs: Record<string, ColumnFilterConfig>;
@@ -30,5 +45,6 @@ export interface FilterFormPanelProps {
30
45
  * is done by leaving the id out of `fields`; this is only for sub-fields.
31
46
  */
32
47
  hiddenSubFilterKeys?: readonly string[];
48
+ labels?: Partial<FilterFormPanelLabels>;
33
49
  }
34
- export declare function FilterFormPanel({ filterConfigs, fields, filters, onApply, onClear, title, className, id, onClose, hiddenSubFilterKeys, }: FilterFormPanelProps): import("react").JSX.Element;
50
+ export declare function FilterFormPanel({ filterConfigs, fields, filters, onApply, onClear, title, className, id, onClose, hiddenSubFilterKeys, labels: labelOverrides, }: FilterFormPanelProps): import("react").JSX.Element;
@@ -1,9 +1,16 @@
1
+ export interface FilterPopoverFooterLabels {
2
+ apply: string;
3
+ clear: string;
4
+ }
1
5
  interface FilterPopoverFooterProps {
2
6
  onApply: () => void;
3
7
  onClear?: () => void;
8
+ labels?: Partial<FilterPopoverFooterLabels>;
9
+ /** @deprecated Use `labels.apply` */
4
10
  applyLabel?: string;
11
+ /** @deprecated Use `labels.clear` */
5
12
  clearLabel?: string;
6
13
  className?: string;
7
14
  }
8
- export declare function FilterPopoverFooter({ onApply, onClear, applyLabel, clearLabel, className, }: FilterPopoverFooterProps): import("react").JSX.Element;
15
+ export declare function FilterPopoverFooter({ onApply, onClear, labels: labelOverrides, applyLabel, clearLabel, className, }: FilterPopoverFooterProps): import("react").JSX.Element;
9
16
  export {};
@@ -33,7 +33,6 @@ export declare function useOrchestrationActions<TRow extends object, TViewKey ex
33
33
  handleRemoveSort: () => void;
34
34
  handleRemoveCustomFilter: () => void;
35
35
  handleClearAll: () => void;
36
- handleRefresh: () => void;
37
36
  handleToggleRowSelection: (id: string) => void;
38
37
  handleToggleHeaderCheck: () => void;
39
38
  handleExpandRow: (row: TRow, e: React.MouseEvent) => void;
@@ -14,8 +14,6 @@ export interface TableOrchestrationState<TViewKey extends string = string> {
14
14
  page: number;
15
15
  rowsPerPage: number;
16
16
  density: "normal" | "dense";
17
- /** @deprecated Demo-only: it only spins for a fixed time (700 ms by default) and refetches nothing. Keep refresh state in your data layer (e.g. your query's `isFetching`). Will be removed in a future minor release. */
18
- isRefreshing: boolean;
19
17
  selectedIds: Set<string>;
20
18
  activeView: TViewKey;
21
19
  columnsMenuOpen: boolean;
@@ -44,8 +42,6 @@ export interface TableOrchestrationActions<TViewKey extends string = string> {
44
42
  setPage: (p: number) => void;
45
43
  setRowsPerPage: (n: number) => void;
46
44
  setDensity: (v: "normal" | "dense") => void;
47
- /** @deprecated Demo-only: it only spins for a fixed time (700 ms by default) and refetches nothing. Keep refresh state in your data layer (e.g. your query's `isFetching`). Will be removed in a future minor release. */
48
- startRefresh: (durationMs?: number) => void;
49
45
  setSelectedIds: (next: Set<string> | ((prev: Set<string>) => Set<string>)) => void;
50
46
  toggleRowSelection: (id: string) => void;
51
47
  toggleHeaderCheck: (pageIds: string[], allOnPageSelected: boolean) => void;
@@ -53,8 +53,6 @@ export interface TableOrchestrationReturn<TRow extends object, TViewKey extends
53
53
  rowsPerPage: number;
54
54
  density: "normal" | "dense";
55
55
  setDensity: (v: "normal" | "dense") => void;
56
- /** @deprecated Demo-only: it only spins for a fixed time (700 ms by default) and refetches nothing. Keep refresh state in your data layer (e.g. your query's `isFetching`). Will be removed in a future minor release. */
57
- isRefreshing: boolean;
58
56
  selectedIds: Set<string>;
59
57
  setSelectedIds: React.Dispatch<React.SetStateAction<Set<string>>>;
60
58
  activeView: TViewKey;
@@ -102,8 +100,6 @@ export interface TableOrchestrationReturn<TRow extends object, TViewKey extends
102
100
  handleRemoveSort: () => void;
103
101
  handleRemoveCustomFilter: () => void;
104
102
  handleClearAll: () => void;
105
- /** @deprecated Demo-only: it only spins for a fixed time (700 ms by default) and refetches nothing. Keep refresh state in your data layer (e.g. your query's `isFetching`). Will be removed in a future minor release. */
106
- handleRefresh: () => void;
107
103
  handleToggleRowSelection: (id: string) => void;
108
104
  handleToggleHeaderCheck: () => void;
109
105
  handleExpandRow: (row: TRow, e: React.MouseEvent) => void;
@@ -37,6 +37,7 @@ export type { FilterChipProps } from "./components/data-table/FilterChip.js";
37
37
  export { ViewChip } from "./components/data-table/ViewChip.js";
38
38
  export type { ViewChipProps } from "./components/data-table/ViewChip.js";
39
39
  export { FilterPopoverFooter } from "./components/data-table/FilterPopoverFooter.js";
40
+ export type { FilterPopoverFooterLabels } from "./components/data-table/FilterPopoverFooter.js";
40
41
  export * as FilterToolbar from "./components/data-table/FilterToolbar.js";
41
42
  export { RowActionsMenu } from "./components/data-table/RowActionsMenu.js";
42
43
  export { RowControlCell } from "./components/data-table/RowControlCell.js";
@@ -81,10 +82,13 @@ export type { TwoPanelMenuItem, TwoPanelMenuGroup } from "./components/data-tabl
81
82
  export { FlatColumnToggle } from "./components/data-table/FlatColumnToggle.js";
82
83
  export { GroupedColumnToggle } from "./components/data-table/GroupedColumnToggle.js";
83
84
  export { ColumnFilterPopover } from "./components/data-table/ColumnFilterPopover.js";
85
+ export type { ColumnFilterPopoverLabels } from "./components/data-table/ColumnFilterPopover.js";
84
86
  export { CompoundFilterPopover } from "./components/data-table/CompoundFilterPopover.js";
87
+ export type { CompoundFilterPopoverLabels } from "./components/data-table/CompoundFilterPopover.js";
85
88
  export { AppliedStateChips } from "./components/data-table/AppliedStateChips.js";
89
+ export type { AppliedStateChipsLabels } from "./components/data-table/AppliedStateChips.js";
86
90
  export { FilterFormPanel } from "./components/data-table/FilterFormPanel.js";
87
- export type { FilterFormPanelProps } from "./components/data-table/FilterFormPanel.js";
91
+ export type { FilterFormPanelProps, FilterFormPanelLabels } from "./components/data-table/FilterFormPanel.js";
88
92
  export { FilterFormToggle, useFilterFormOpen } from "./components/data-table/FilterFormToggle.js";
89
93
  export type { FilterFormToggleProps } from "./components/data-table/FilterFormToggle.js";
90
94
  export { applyManagedChanges, clearManagedFilters, hasActiveManagedFilters, } from "./components/data-table/managed-filters.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@undevy-org/tablewright",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "React data-table and application-shell components: filters, drawers, row controls, sortable and resizable columns, built on Radix UI and TanStack Table.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -78,6 +78,8 @@
78
78
  "@storybook/addon-themes": "^10.5.8",
79
79
  "@storybook/react-vite": "^10.5.8",
80
80
  "@tanstack/react-table": "^8.21.3",
81
+ "@testing-library/dom": "^10.4.2",
82
+ "@testing-library/react": "^16.3.3",
81
83
  "@types/node": "^24.10.1",
82
84
  "@types/react": "^19.2.7",
83
85
  "@types/react-dom": "^19.2.3",
@@ -88,6 +90,7 @@
88
90
  "eslint-plugin-react-refresh": "^0.4.24",
89
91
  "eslint-plugin-storybook": "^10.5.8",
90
92
  "globals": "^16.5.0",
93
+ "happy-dom": "^20.14.5",
91
94
  "postcss": "^8.5.8",
92
95
  "react": "^19.2.0",
93
96
  "react-dom": "^19.2.0",
@@ -95,7 +98,8 @@
95
98
  "tailwindcss": "^3.4.18",
96
99
  "typescript": "~5.9.3",
97
100
  "typescript-eslint": "^8.48.0",
98
- "vite": "^7.3.1"
101
+ "vite": "^7.3.1",
102
+ "vitest": "^5.0.3"
99
103
  },
100
104
  "scripts": {
101
105
  "build": "node scripts/build.mjs",
@@ -105,6 +109,7 @@
105
109
  "check:render": "node scripts/render-check/run.mjs",
106
110
  "lint": "eslint src .storybook --max-warnings=0",
107
111
  "typecheck": "tsc --project tsconfig.json --noEmit",
112
+ "test": "vitest run",
108
113
  "storybook": "storybook dev -p 6006",
109
114
  "build-storybook": "storybook build",
110
115
  "changeset": "changeset",