@godxjp/ui 14.0.1 → 15.0.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
@@ -67,7 +67,7 @@ Components emit `data-slot` / `data-*`; the look lives in `styles/*-layout.css`.
67
67
 
68
68
  | Group | Import | Examples |
69
69
  | ------------------ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
70
- | **Layout** | `@godxjp/ui/layout` | `Flex`, `PageContainer`, `ResponsiveGrid`, `AppShell`, `Sidebar`, `Separator`, `AspectRatio`, `Resizable` |
70
+ | **Layout** | `@godxjp/ui/layout` | `Flex`, `PageContainer`, `ResponsiveGrid`, `AppShell`, `Sidebar`, `Separator`, `AspectRatio`, `Resizable` |
71
71
  | **General** | `@godxjp/ui/general` | `Button` |
72
72
  | **Data Entry** | `@godxjp/ui/data-entry` | `Input`, `Select`, `FormField`, `Field`, `DatePicker`, `TimePicker`, `Combobox`, `Switch`, `Toggle`, `Upload`, `Cascader`, `TreeSelect`, `ColorPicker`, `Slider`, `PasswordInput`, `PasswordStrength`, `InputOTP`, `Rating`, `TagInput` |
73
73
  | **Data Display** | `@godxjp/ui/data-display` | `Table`, `DataTable`, `Card`, `StatCard`, `Badge`, `Avatar`, `Descriptions`, `Timeline`, `EmptyState`, `Progress`, `Accordion`, `HoverCard`, `Carousel`, `Popover`, `Collapsible` |
@@ -92,26 +92,29 @@ The v11 line dropped the deprecated compatibility aliases entirely — they are
92
92
  at runtime, and their leftover `*Prop` types and README references have now been removed too (issue
93
93
  #99). Replace these at the call site:
94
94
 
95
- | Removed / renamed (≤ v8) | Replacement (v11) |
96
- | -------------------------------- | -------------------------------------------------- |
97
- | `Stack` | `Flex direction="col"` (the default direction) |
98
- | `Inline` | `Flex direction="row"` |
99
- | `Autocomplete` | `Select` with `showSearch` + `options` |
100
- | `CountrySelect` | `AppSettingPicker kind="country"` |
101
- | `LocalePicker` | `AppSettingPicker kind="language"` |
102
- | `CountryOptionLabel` | `Intl.DisplayNames` (ISO 3166-1 α-2) — no component |
103
- | `SwitchField` | `Field` + `Switch` |
104
- | `CardStat` | `StatCard` |
105
- | `KeyValueGrid` | `Descriptions` |
106
- | `ProgressMeter` | `Progress` |
107
- | `FilterBar` | `Toolbar` |
108
- | `ChoiceField` | `Field` |
109
- | `SkeletonCard` | `SkeletonStat` |
110
- | `StatusBadge` | `Badge` (`status` / `tone`) |
111
- | `DialogConfirm` / `Dialog mode="confirm"` | `AlertDialog` |
112
-
113
- For the full feature data grid (sort / search / column visibility / paging) see
114
- `@godxjp/ui/data-grid` (`DataGrid`); the lean server-driven list stays `DataTable`.
95
+ | Removed / renamed (≤ v8) | Replacement (v11) |
96
+ | ----------------------------------------- | --------------------------------------------------- |
97
+ | `Stack` | `Flex direction="col"` (the default direction) |
98
+ | `Inline` | `Flex direction="row"` |
99
+ | `Autocomplete` | `Select` with `showSearch` + `options` |
100
+ | `CountrySelect` | `AppSettingPicker kind="country"` |
101
+ | `LocalePicker` | `AppSettingPicker kind="language"` |
102
+ | `CountryOptionLabel` | `Intl.DisplayNames` (ISO 3166-1 α-2) — no component |
103
+ | `SwitchField` | `Field` + `Switch` |
104
+ | `CardStat` | `StatCard` |
105
+ | `KeyValueGrid` | `Descriptions` |
106
+ | `ProgressMeter` | `Progress` |
107
+ | `FilterBar` | `Toolbar` |
108
+ | `ChoiceField` | `Field` |
109
+ | `SkeletonCard` | `SkeletonStat` |
110
+ | `StatusBadge` | `Badge` (`status` / `tone`) |
111
+ | `DialogConfirm` / `Dialog mode="confirm"` | `AlertDialog` |
112
+
113
+ The full data-grid feature set (sort / search / column visibility / paging) is now
114
+ built into the one `DataTable` (`@godxjp/ui/data-display`) TanStack-powered, with
115
+ the lean `data` + `columns` API for the common case and the compound parts
116
+ (`DataTable.Search` / `.ViewOptions` / `.Pagination` …) for the rich chrome. The
117
+ separate `@godxjp/ui/data-grid` (`DataGrid`) subpath has been merged in and removed.
115
118
 
116
119
  ---
117
120
 
@@ -154,12 +157,12 @@ One token `--phi-unit` drives page/section/card spacing; micro control gaps use
154
157
  4px grid. Density (`compact` | `default` | `comfortable`) retunes `--phi-unit` with
155
158
  control + table heights together.
156
159
 
157
- | App API | φ level |
158
- | -------------------------------- | ------------------- |
159
- | `<Flex direction="col" gap="md">`| φ⁰ (default) |
160
- | `<Flex direction="col" gap="lg">`| φ¹ |
161
- | `<Flex direction="col" gap="xl">`| φ² |
162
- | Card shell / footer | base × φ / base ÷ φ |
160
+ | App API | φ level |
161
+ | --------------------------------- | ------------------- |
162
+ | `<Flex direction="col" gap="md">` | φ⁰ (default) |
163
+ | `<Flex direction="col" gap="lg">` | φ¹ |
164
+ | `<Flex direction="col" gap="xl">` | φ² |
165
+ | Card shell / footer | base × φ / base ÷ φ |
163
166
 
164
167
  ---
165
168
 
@@ -18,8 +18,6 @@ export { Transfer } from "../data-entry/transfer";
18
18
  export { Pagination, Steps, Tabs, TabsContent, TabsList, TabsTrigger } from "../navigation";
19
19
  export { Toolbar, ToolbarGroup } from "../navigation/filter-bar";
20
20
  export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, AlertDialog, } from "../feedback/dialog";
21
- export { DataTable } from "../data-display/data-table";
22
- export type { ColumnDef, Density } from "../data-display/data-table";
23
21
  export { Toaster } from "../feedback/sonner";
24
22
  export { toast } from "../feedback/use-toast";
25
23
  export { useDebouncedValue, useTimeoutFlag } from "../../lib/hooks";
@@ -36,7 +36,6 @@ import {
36
36
  DialogDescription,
37
37
  AlertDialog
38
38
  } from "../feedback/dialog";
39
- import { DataTable } from "../data-display/data-table";
40
39
  import { Toaster } from "../feedback/sonner";
41
40
  import { toast } from "../feedback/use-toast";
42
41
  import { useDebouncedValue, useTimeoutFlag } from "../../lib/hooks";
@@ -51,7 +50,6 @@ export {
51
50
  AlertTitle,
52
51
  Badge,
53
52
  Cascader,
54
- DataTable,
55
53
  Descriptions,
56
54
  Dialog,
57
55
  DialogContent,
@@ -1,7 +1,19 @@
1
1
  import * as React from "react";
2
+ import { flexRender, type OnChangeFn, type PaginationState, type RowData, type VisibilityState } from "@tanstack/react-table";
2
3
  import type { ColumnDefProp, DensityProp, SortStateProp } from "../../props/vocabulary";
3
4
  export type Density = DensityProp;
5
+ /**
6
+ * Lean column definition — the simple, common-case column API. `render` shapes
7
+ * a cell; `sortable` opts the column into the sort cycle; `align` / `width` /
8
+ * `pin` / `hiddenOnMobile` tune layout; `enableHiding` (default true) lists the
9
+ * column in DataTable.ViewOptions. Adapted to a TanStack column internally.
10
+ */
4
11
  export type ColumnDef<T> = ColumnDefProp<T>;
12
+ declare module "@tanstack/react-table" {
13
+ interface ColumnMeta<TData extends RowData, TValue> {
14
+ lean?: ColumnDef<TData>;
15
+ }
16
+ }
5
17
  interface DataTableProps<T> {
6
18
  data: T[];
7
19
  columns: ColumnDef<T>[];
@@ -13,8 +25,29 @@ interface DataTableProps<T> {
13
25
  onRowClick?: (row: T) => void;
14
26
  density?: Density;
15
27
  onDensityChange?: (d: Density) => void;
28
+ /** Active sort state (lean surface). Pair with onSortChange for server sort. */
16
29
  sort?: SortStateProp;
17
30
  onSortChange?: (sort: SortStateProp | undefined) => void;
31
+ /** Global search term, surfaced by DataTable.Search. */
32
+ globalFilter?: string;
33
+ onGlobalFilterChange?: (next: string) => void;
34
+ /** Numbered-pagination state, surfaced by DataTable.Pagination. */
35
+ pagination?: PaginationState;
36
+ onPaginationChange?: OnChangeFn<PaginationState>;
37
+ /** Total server row count (manual pagination) — drives the page count. */
38
+ rowCount?: number;
39
+ /** Column show/hide state, surfaced by DataTable.ViewOptions. */
40
+ columnVisibility?: VisibilityState;
41
+ onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
42
+ /**
43
+ * Manual (server) flags. Default `false` so the simple `data`+`columns` case
44
+ * sorts / filters / paginates in-browser with no extra wiring. Set the
45
+ * relevant flag `true` and drive the matching state from your query for
46
+ * server-side sort / filter / pagination.
47
+ */
48
+ manualSorting?: boolean;
49
+ manualFiltering?: boolean;
50
+ manualPagination?: boolean;
18
51
  /** Show a loading row instead of data. */
19
52
  loading?: boolean;
20
53
  /** Custom empty content when `data` is empty; defaults to a built-in EmptyState. */
@@ -34,32 +67,52 @@ interface DataTableProps<T> {
34
67
  className?: string;
35
68
  children?: React.ReactNode;
36
69
  }
37
- export declare function DataTable<T>({ data, columns, getRowId, selectable, selected: controlledSelected, onSelectChange, onRowClick, density: controlledDensity, onDensityChange, sort, onSortChange, loading, empty, striped, hoverable, stickyHeader, rowClassName, className, children, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
70
+ export declare function DataTable<T>({ data, columns, getRowId, selectable, selected: controlledSelected, onSelectChange, onRowClick, density: controlledDensity, onDensityChange, sort, onSortChange, globalFilter: controlledGlobalFilter, onGlobalFilterChange, pagination: controlledPagination, onPaginationChange, rowCount, columnVisibility: controlledVisibility, onColumnVisibilityChange, manualSorting, manualFiltering, manualPagination, loading, empty, striped, hoverable, stickyHeader, rowClassName, className, children, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
38
71
  export declare namespace DataTable {
39
72
  var Toolbar: ({ children, className, }: {
40
73
  children?: React.ReactNode;
41
74
  className?: string;
42
75
  }) => import("react/jsx-runtime").JSX.Element;
76
+ var Search: ({ placeholder, className, }: {
77
+ placeholder?: string;
78
+ className?: string;
79
+ }) => import("react/jsx-runtime").JSX.Element;
80
+ var ViewOptions: ({ className }: {
81
+ className?: string;
82
+ }) => import("react/jsx-runtime").JSX.Element | null;
43
83
  var SelectAll: () => import("react/jsx-runtime").JSX.Element | null;
44
84
  var BulkActions: ({ count, children, className, }: BulkActionsProps) => import("react/jsx-runtime").JSX.Element | null;
45
85
  var DensityToggle: () => import("react/jsx-runtime").JSX.Element;
46
86
  var Content: () => import("react/jsx-runtime").JSX.Element;
47
- var Pagination: ({ cursor, hasMore, onChange, className, }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
87
+ var Pagination: (props: PaginationProps) => import("react/jsx-runtime").JSX.Element;
48
88
  var RowActions: ({ ariaLabel, children }: RowActionsProps) => import("react/jsx-runtime").JSX.Element;
49
89
  }
50
90
  interface BulkActionsProps {
51
91
  count?: number;
52
- children?: React.ReactNode;
92
+ /**
93
+ * Render-prop form receives the selected count; plain ReactNode children read
94
+ * the count from selection state and render the built-in "N selected" status.
95
+ */
96
+ children?: React.ReactNode | ((count: number) => React.ReactNode);
53
97
  className?: string;
54
98
  }
55
- interface PaginationProps {
99
+ interface CursorPaginationProps {
56
100
  cursor?: string;
57
101
  hasMore: boolean;
58
102
  onChange: (cursor: string | undefined) => void;
59
103
  className?: string;
104
+ pageSizeOptions?: never;
105
+ }
106
+ interface NumberedPaginationProps {
107
+ pageSizeOptions?: number[];
108
+ className?: string;
109
+ cursor?: never;
110
+ hasMore?: never;
111
+ onChange?: never;
60
112
  }
113
+ type PaginationProps = CursorPaginationProps | NumberedPaginationProps;
61
114
  interface RowActionsProps {
62
115
  ariaLabel?: string;
63
116
  children: React.ReactNode;
64
117
  }
65
- export {};
118
+ export { flexRender };