@bookers/ui 0.2.0 → 0.4.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
@@ -38,6 +38,27 @@ npm run test:ui # Vitest UI + coverage
38
38
  npm run build # tsc + Vite library build
39
39
  ```
40
40
 
41
+ ### MCP server
42
+
43
+ While `npm run dev` is running, the local MCP server is available at `http://localhost:6006/mcp`. Add it to your project's `.mcp.json` to give Claude Code context about unreleased components:
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "bookers-ui": {
49
+ "type": "http",
50
+ "url": "http://localhost:6006/mcp"
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ For released components, the remote server at `https://bookers-ui.vercel.app/mcp` is always available without any local setup.
57
+
58
+ ## Changelog
59
+
60
+ See [`CHANGELOG.md`](./CHANGELOG.md) for breaking changes and notable updates (including **`DataTable`** API migration).
61
+
41
62
  ## Stack
42
63
 
43
64
  - React 18/19 (peer dep)
package/dist/index.d.ts CHANGED
@@ -2,24 +2,40 @@ import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
2
  import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
3
3
  import { ClassProp } from 'class-variance-authority/types';
4
4
  import { ClassValue } from 'clsx';
5
+ import { Column } from '@tanstack/react-table';
6
+ import { ColumnDef } from '@tanstack/react-table';
7
+ import { ColumnFiltersState } from '@tanstack/react-table';
8
+ import { ColumnOrderState } from '@tanstack/react-table';
9
+ import { ColumnPinningState } from '@tanstack/react-table';
10
+ import { ColumnSizingState } from '@tanstack/react-table';
5
11
  import { CommandGroup } from 'cmdk';
6
12
  import { CommandItem } from 'cmdk';
7
13
  import { CommandSeparator } from 'cmdk';
8
14
  import { DayPickerProps } from 'react-day-picker';
9
15
  import * as DialogPrimitive from '@radix-ui/react-dialog';
10
16
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
17
+ import { ExpandedState } from '@tanstack/react-table';
18
+ import { FilterFn } from '@tanstack/react-table';
19
+ import { GroupingState } from '@tanstack/react-table';
11
20
  import { JSX } from 'react/jsx-runtime';
21
+ import { OnChangeFn } from '@tanstack/react-table';
22
+ import { PaginationState } from '@tanstack/react-table';
12
23
  import { PopoverContentProps } from '@radix-ui/react-popover';
13
24
  import * as PopoverPrimitive from '@radix-ui/react-popover';
14
25
  import { PopoverProps as PopoverProps_2 } from '@radix-ui/react-popover';
15
26
  import * as React_2 from 'react';
27
+ import { Row } from '@tanstack/react-table';
28
+ import { RowData } from '@tanstack/react-table';
29
+ import { RowSelectionState } from '@tanstack/react-table';
16
30
  import * as SelectPrimitive from '@radix-ui/react-select';
31
+ import { SortingState } from '@tanstack/react-table';
17
32
  import { Table as Table_2 } from '@tanstack/react-table';
18
33
  import * as TabsPrimitive from '@radix-ui/react-tabs';
19
34
  import { toast } from 'sonner';
20
35
  import { ToasterProps } from 'sonner';
21
36
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
22
37
  import { VariantProps } from 'class-variance-authority';
38
+ import { VisibilityState } from '@tanstack/react-table';
23
39
 
24
40
  export declare const Accordion: React_2.ForwardRefExoticComponent<AccordionProps & React_2.RefAttributes<HTMLDivElement>>;
25
41
 
@@ -32,7 +48,7 @@ export declare const accordionContentVariants: (props?: ({
32
48
  size?: "sm" | "md" | "lg" | null | undefined;
33
49
  } & ClassProp) | undefined) => string;
34
50
 
35
- export declare const AccordionItem: React_2.ForwardRefExoticComponent<AccordionItemProps & React_2.RefAttributes<HTMLDivElement>>;
51
+ export declare const AccordionItem: React_2.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
36
52
 
37
53
  export declare interface AccordionItemDef {
38
54
  value: string;
@@ -41,8 +57,7 @@ export declare interface AccordionItemDef {
41
57
  disabled?: boolean;
42
58
  }
43
59
 
44
- export declare interface AccordionItemProps extends React_2.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> {
45
- }
60
+ export declare type AccordionItemProps = React_2.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>;
46
61
 
47
62
  export declare interface AccordionProps {
48
63
  items: AccordionItemDef[];
@@ -115,6 +130,8 @@ export declare const badgeVariants: (props?: ({
115
130
  variant?: "default" | "success" | "warning" | "destructive" | "secondary" | "outline" | null | undefined;
116
131
  } & ClassProp) | undefined) => string;
117
132
 
133
+ export declare const bookersStringFilter: FilterFn<RowData>;
134
+
118
135
  export declare const Button: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
119
136
 
120
137
  export declare interface ButtonProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -152,6 +169,16 @@ export declare const checkboxVariants: (props?: ({
152
169
  */
153
170
  export declare function cn(...inputs: ClassValue[]): string;
154
171
 
172
+ export { ColumnDef }
173
+
174
+ export { ColumnFiltersState }
175
+
176
+ export { ColumnOrderState }
177
+
178
+ export { ColumnPinningState }
179
+
180
+ export { ColumnSizingState }
181
+
155
182
  export declare const ComboBox: React_2.ForwardRefExoticComponent<ComboBoxProps & React_2.RefAttributes<HTMLButtonElement>>;
156
183
 
157
184
  export declare const ComboBoxContent: React_2.ForwardRefExoticComponent<ComboBoxContentProps & React_2.RefAttributes<HTMLDivElement>>;
@@ -206,10 +233,15 @@ export declare interface ComboBoxProps {
206
233
 
207
234
  export declare const ComboBoxRoot: React_2.FC<PopoverProps_2>;
208
235
 
209
- export declare const ComboBoxSeparator: React_2.ForwardRefExoticComponent<ComboBoxSeparatorProps & React_2.RefAttributes<HTMLDivElement>>;
236
+ export declare const ComboBoxSeparator: React_2.ForwardRefExoticComponent<Omit<Pick<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
237
+ ref?: React_2.Ref<HTMLDivElement>;
238
+ } & {
239
+ asChild?: boolean;
240
+ }, "key" | keyof React_2.HTMLAttributes<HTMLDivElement> | "asChild"> & {
241
+ alwaysRender?: boolean;
242
+ } & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
210
243
 
211
- export declare interface ComboBoxSeparatorProps extends React_2.ComponentPropsWithoutRef<typeof CommandSeparator> {
212
- }
244
+ export declare type ComboBoxSeparatorProps = React_2.ComponentPropsWithoutRef<typeof CommandSeparator>;
213
245
 
214
246
  export declare const ComboBoxTrigger: React_2.ForwardRefExoticComponent<ComboBoxTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
215
247
 
@@ -223,15 +255,150 @@ export declare const ComboBoxTriggerVariants: (props?: ({
223
255
  isError?: boolean | null | undefined;
224
256
  } & ClassProp) | undefined) => string;
225
257
 
258
+ /** Stable id for the optional built-in expand column (`showExpandColumn`). */
259
+ export declare const DATA_TABLE_EXPAND_COLUMN_ID: "bookers-expand";
260
+
226
261
  export declare const DataTable: <TData>(props: DataTableProps<TData> & {
227
262
  ref?: React_2.ForwardedRef<HTMLDivElement>;
228
263
  }) => React_2.ReactElement;
229
264
 
230
- export declare interface DataTableProps<TData> extends React_2.HTMLAttributes<HTMLDivElement> {
231
- table: Table_2<TData>;
265
+ export declare const DataTableColumnHeader: <TData extends RowData, TValue = unknown>(props: DataTableColumnHeaderProps<TData, TValue> & {
266
+ ref?: React_2.ForwardedRef<HTMLDivElement>;
267
+ }) => React_2.ReactElement;
268
+
269
+ /** Pass on `ColumnDef.meta` when using `DataTableColumnHeader` so `DataTable` does not add a second sort affordance (chevrons). */
270
+ export declare const dataTableColumnHeaderMeta: {
271
+ readonly bookersColumnHeaderActions: true;
272
+ };
273
+
274
+ export declare interface DataTableColumnHeaderProps<TData extends RowData, TValue = unknown> extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "title"> {
275
+ column: Column<TData, TValue>;
276
+ title?: React_2.ReactNode;
277
+ children?: React_2.ReactNode;
278
+ }
279
+
280
+ export declare interface DataTableProps<TData extends RowData> extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "children"> {
281
+ data: TData[];
282
+ columns: ColumnDef<TData>[];
283
+ getRowId?: (row: TData, index: number) => string;
284
+ enableSorting?: boolean;
285
+ defaultSorting?: SortingState;
286
+ sorting?: SortingState;
287
+ onSortingChange?: OnChangeFn<SortingState>;
288
+ enableRowSelection?: boolean;
289
+ defaultRowSelection?: RowSelectionState;
290
+ rowSelection?: RowSelectionState;
291
+ onRowSelectionChange?: OnChangeFn<RowSelectionState>;
292
+ enableColumnResizing?: boolean;
293
+ columnResizeMode?: "onChange" | "onEnd";
294
+ defaultColumnSizing?: ColumnSizingState;
295
+ columnSizing?: ColumnSizingState;
296
+ onColumnSizingChange?: OnChangeFn<ColumnSizingState>;
297
+ enableColumnReorder?: boolean;
298
+ defaultColumnOrder?: ColumnOrderState;
299
+ columnOrder?: ColumnOrderState;
300
+ onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
301
+ enableColumnPinning?: boolean;
302
+ defaultColumnPinning?: ColumnPinningState;
303
+ columnPinning?: ColumnPinningState;
304
+ onColumnPinningChange?: OnChangeFn<ColumnPinningState>;
305
+ enableGlobalFilter?: boolean;
306
+ /** When true (default), renders the search field above the table when `enableGlobalFilter` is on. */
307
+ showGlobalFilter?: boolean;
308
+ globalFilterPlaceholder?: string;
309
+ defaultGlobalFilter?: string;
310
+ globalFilter?: string;
311
+ onGlobalFilterChange?: OnChangeFn<string>;
312
+ enableColumnFilters?: boolean;
313
+ /** When true (default), renders a filter input row under the header when `enableColumnFilters` is on. */
314
+ showFilterRow?: boolean;
315
+ defaultColumnFilters?: ColumnFiltersState;
316
+ columnFilters?: ColumnFiltersState;
317
+ onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>;
318
+ /**
319
+ * When `enableColumnFilters` is on: if true (default), each column filter uses an integrated control (filter icon
320
+ * in the field) plus a value. If false, uses a single text field with `includesString` (legacy).
321
+ */
322
+ enableAdvancedColumnFilters?: boolean;
323
+ /**
324
+ * When `enableColumnFilters` is on: if true (default), shows a clear control on each active column filter.
325
+ */
326
+ showColumnFilterClear?: boolean;
327
+ enableExpanding?: boolean;
328
+ defaultExpanded?: ExpandedState;
329
+ expanded?: ExpandedState;
330
+ onExpandedChange?: OnChangeFn<ExpandedState>;
331
+ getRowCanExpand?: (row: Row<TData>) => boolean;
332
+ renderExpandedRow?: (row: Row<TData>) => React_2.ReactNode;
333
+ /**
334
+ * When `enableExpanding` and `renderExpandedRow` are set (and grouping is off), prepends a narrow column with a chevron that toggles the detail row. Omit a manual expand column from `columns`.
335
+ */
336
+ showExpandColumn?: boolean;
337
+ /** Merged onto the full-width detail `<td>` (below the expanded row). */
338
+ expandedRowClassName?: string;
339
+ enableGrouping?: boolean;
340
+ defaultGrouping?: GroupingState;
341
+ grouping?: GroupingState;
342
+ onGroupingChange?: OnChangeFn<GroupingState>;
343
+ showGroupingDropZone?: boolean;
344
+ groupingDropZoneLabel?: string;
345
+ groupingDropZoneHint?: string;
232
346
  isLoading?: boolean;
233
347
  loadingRows?: number;
234
348
  emptyState?: React_2.ReactNode;
349
+ enableColumnVisibility?: boolean;
350
+ defaultColumnVisibility?: VisibilityState;
351
+ columnVisibility?: VisibilityState;
352
+ onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
353
+ /**
354
+ * Virtualize body rows for large lists. Ignored when `enableGrouping` is on, when master–detail
355
+ * (`renderExpandedRow`) is used, when there are no rows, or while `isLoading`.
356
+ */
357
+ enableVirtualization?: boolean;
358
+ /**
359
+ * Max height of the table scroll region (`overflow: auto`). Keeps the header sticky while the body scrolls.
360
+ * Also used when `enableVirtualization` is on. String is a CSS length (e.g. `"min(35rem, 70vh)"`); number is pixels.
361
+ */
362
+ virtualScrollContainerHeight?: string | number;
363
+ /** Estimated main data row height in px (used until measured). */
364
+ virtualRowEstimateSize?: number;
365
+ /** Extra rows to render above/below the viewport. */
366
+ virtualOverscan?: number;
367
+ /**
368
+ * When true, renders `<tfoot>` from TanStack `columnDef.footer` (totals, counts, etc.).
369
+ * At least one column must define `footer`; otherwise nothing is rendered.
370
+ */
371
+ enableFooter?: boolean;
372
+ /**
373
+ * When true, a horizontal drag handle appears below the scroll region (pointer or Arrow Up/Down) to change height.
374
+ * Uses `virtualScrollContainerHeight` as the initial `height` and clamps between `scrollContainerResizeMinHeight` and `scrollContainerResizeMaxHeight`.
375
+ */
376
+ enableScrollContainerResize?: boolean;
377
+ /** Upper bound when `enableScrollContainerResize` is on (CSS length or px number). Default `min(90vh, 80rem)`. */
378
+ scrollContainerResizeMaxHeight?: string | number;
379
+ /** Lower bound when `enableScrollContainerResize` is on (CSS length or px number). Default `8rem`. */
380
+ scrollContainerResizeMinHeight?: string | number;
381
+ /**
382
+ * Client-side pagination (TanStack `getPaginationRowModel`). Ignored when `enableGrouping` is on
383
+ * (grouping and pagination are not combined).
384
+ */
385
+ enablePagination?: boolean;
386
+ /**
387
+ * Server-side pagination: pass one page of `data` and set `rowCount` (or `pageCount`). Does not use
388
+ * `getPaginationRowModel()` to slice rows.
389
+ */
390
+ manualPagination?: boolean;
391
+ /** Total rows on the server when `manualPagination` is true (for page count and “Showing … of …”). */
392
+ rowCount?: number;
393
+ /** Total pages when `manualPagination` is true; optional if `rowCount` / `pageSize` can derive it. */
394
+ pageCount?: number;
395
+ defaultPagination?: Partial<PaginationState>;
396
+ pagination?: PaginationState;
397
+ onPaginationChange?: OnChangeFn<PaginationState>;
398
+ /** Page size options for the footer control. Current `pageSize` is included if missing from the list. */
399
+ pageSizeOptions?: number[];
400
+ /** Passed to the `Pagination` range (siblings around current page). */
401
+ paginationSiblingCount?: number;
235
402
  }
236
403
 
237
404
  export declare const DatePicker: React_2.ForwardRefExoticComponent<DatePickerProps & React_2.RefAttributes<HTMLButtonElement>>;
@@ -371,6 +538,8 @@ export declare const DropdownMenuSubTrigger: React_2.ForwardRefExoticComponent<O
371
538
 
372
539
  export declare const DropdownMenuTrigger: React_2.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
373
540
 
541
+ export { ExpandedState }
542
+
374
543
  export declare const Field: React_2.ForwardRefExoticComponent<FieldProps & React_2.RefAttributes<HTMLDivElement>>;
375
544
 
376
545
  export declare const FieldMessage: React_2.ForwardRefExoticComponent<FieldMessageProps & React_2.RefAttributes<HTMLParagraphElement>>;
@@ -379,15 +548,15 @@ export declare interface FieldMessageProps extends React_2.HTMLAttributes<HTMLPa
379
548
  isError?: boolean;
380
549
  }
381
550
 
382
- export declare interface FieldProps extends React_2.HTMLAttributes<HTMLDivElement> {
383
- }
551
+ export declare type FieldProps = React_2.HTMLAttributes<HTMLDivElement>;
552
+
553
+ export { GroupingState }
384
554
 
385
555
  export declare const Input: React_2.ForwardRefExoticComponent<InputProps & React_2.RefAttributes<HTMLInputElement>>;
386
556
 
387
557
  export declare const InputAddon: React_2.ForwardRefExoticComponent<InputAddonProps & React_2.RefAttributes<HTMLDivElement>>;
388
558
 
389
- export declare interface InputAddonProps extends React_2.HTMLAttributes<HTMLDivElement> {
390
- }
559
+ export declare type InputAddonProps = React_2.HTMLAttributes<HTMLDivElement>;
391
560
 
392
561
  export declare const InputGroup: React_2.ForwardRefExoticComponent<InputGroupProps & React_2.RefAttributes<HTMLDivElement>>;
393
562
 
@@ -450,6 +619,8 @@ export declare interface PaginationProps extends React_2.ComponentPropsWithoutRe
450
619
 
451
620
  export declare const PaginationRoot: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React_2.RefAttributes<HTMLElement>>;
452
621
 
622
+ export { PaginationState }
623
+
453
624
  export declare const Popover: {
454
625
  ({ content, children, side, align, sideOffset, contentClassName, ...props }: PopoverProps): JSX.Element;
455
626
  displayName: string;
@@ -507,6 +678,8 @@ export declare const radioVariants: (props?: ({
507
678
  size?: "sm" | "md" | "lg" | null | undefined;
508
679
  } & ClassProp) | undefined) => string;
509
680
 
681
+ export { RowSelectionState }
682
+
510
683
  export declare const Select: React_2.ForwardRefExoticComponent<SelectProps & React_2.RefAttributes<HTMLButtonElement>>;
511
684
 
512
685
  export declare const SelectContent: React_2.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
@@ -556,7 +729,20 @@ export declare interface SeparatorProps extends React_2.HTMLAttributes<HTMLDivEl
556
729
 
557
730
  export declare const Skeleton: React_2.ForwardRefExoticComponent<SkeletonProps & React_2.RefAttributes<HTMLDivElement>>;
558
731
 
559
- export declare interface SkeletonProps extends React_2.HTMLAttributes<HTMLDivElement> {
732
+ export declare type SkeletonProps = React_2.HTMLAttributes<HTMLDivElement>;
733
+
734
+ export { SortingState }
735
+
736
+ export declare const STRING_COLUMN_FILTER_OPTIONS: {
737
+ value: StringColumnFilterOperator;
738
+ label: string;
739
+ }[];
740
+
741
+ export declare type StringColumnFilterOperator = "contains" | "equals" | "startsWith" | "endsWith" | "notContains" | "empty" | "notEmpty";
742
+
743
+ export declare interface StringColumnFilterState {
744
+ op: StringColumnFilterOperator;
745
+ value: string;
560
746
  }
561
747
 
562
748
  export declare const Switch: React_2.ForwardRefExoticComponent<SwitchProps & React_2.RefAttributes<HTMLInputElement>>;
@@ -624,7 +810,7 @@ export declare const textareaVariants: (props?: ({
624
810
  export { toast }
625
811
 
626
812
  export declare const Toaster: {
627
- ({ ...props }: ToasterProps): JSX.Element;
813
+ ({ toastOptions, ...props }: ToasterProps): JSX.Element;
628
814
  displayName: string;
629
815
  };
630
816
 
@@ -651,4 +837,8 @@ export declare const TooltipRoot: React_2.FC<TooltipPrimitive.TooltipProps>;
651
837
 
652
838
  export declare const TooltipTrigger: React_2.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
653
839
 
840
+ export declare function useDataTableTable<TData extends RowData>(): Table_2<TData> | null;
841
+
842
+ export { VisibilityState }
843
+
654
844
  export { }