@platned/ui 0.6.1 → 0.7.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,9 +1,54 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, HTMLAttributes } from 'react';
3
+ import { RowData } from '@tanstack/react-table';
3
4
 
4
5
  type NavItemSize = 'sm' | 'md';
5
6
  type NavItemVariant = 'card' | 'plain';
6
7
 
8
+ /** How a column appears in card mode. */
9
+ type ColumnMobileRole = 'title' | 'status' | 'actions' | 'field' | 'hidden';
10
+
11
+ type DataTableColumnAlign = 'start' | 'center' | 'end';
12
+ /**
13
+ * Per-column layout options, carried on TanStack's `meta`. Declared by augmenting TanStack's
14
+ * own `ColumnMeta`, so `meta` on your `ColumnDef` is typed with no extra import:
15
+ *
16
+ * const columns: ColumnDef<Supplier>[] = [
17
+ * { accessorKey: 'name', header: 'Supplier', meta: { width: '280px', grow: true, mobile: 'title' } },
18
+ * ];
19
+ */
20
+ declare module '@tanstack/react-table' {
21
+ interface ColumnMeta<TData extends RowData, TValue> {
22
+ /**
23
+ * CSS width for the column's `<col>`, e.g. `"320px"` or `"10rem"`. A column is never
24
+ * narrower than its header text. With `grow`, this is the floor instead.
25
+ */
26
+ width?: string;
27
+ /** Absorbs the table's remaining width, with `width` as its floor. Usually one column. */
28
+ grow?: boolean;
29
+ /** Horizontal alignment of the header and cells. Default `start`. */
30
+ align?: DataTableColumnAlign;
31
+ /**
32
+ * The cell renders its own controls (a button, a toggle, a menu). Presses inside it stop
33
+ * before reaching the row's `onRowClick`, and the cell stops clipping its overflow, so
34
+ * focus rings are not cut off.
35
+ */
36
+ interactive?: boolean;
37
+ /** Keep the header for screen readers but hide it visually, e.g. an actions column. */
38
+ hideHeader?: boolean;
39
+ /** The column's part in card mode. See `ColumnMobileRole`. Default `field`. */
40
+ mobile?: ColumnMobileRole;
41
+ /** Pin the first (`start`) or last (`end`) visible column while the table scrolls sideways. */
42
+ sticky?: 'start' | 'end';
43
+ /** The column's name where its header cannot be shown as text: menus, card labels. */
44
+ label?: string;
45
+ /** Extra classes on the header cell. An escape hatch; prefer `align`. */
46
+ headerClassName?: string;
47
+ /** Extra classes on each body cell. An escape hatch; prefer `align`. */
48
+ cellClassName?: string;
49
+ }
50
+ }
51
+
7
52
  interface NavTabItem {
8
53
  to: string;
9
54
  label: string;
@@ -24,6 +69,11 @@ interface NavTabsProps {
24
69
  declare function NavTabs({ items, className }: NavTabsProps): react.JSX.Element;
25
70
 
26
71
  interface SidebarNavItem {
72
+ /**
73
+ * The destination. May carry a hash (`/docs/floating#tooltip`) to link to a section of a
74
+ * page: that row is current only when the hash matches too, and the page's own plain row
75
+ * steps aside while it is. New in 0.7.0.
76
+ */
27
77
  to: string;
28
78
  label: string;
29
79
  /** Optional — a collapsed row without one falls back to a monogram of its label. */
@@ -32,6 +82,12 @@ interface SidebarNavItem {
32
82
  indicator?: boolean;
33
83
  /** Match the path exactly rather than as a prefix. Needed for an index route. */
34
84
  end?: boolean;
85
+ /**
86
+ * A destination that exists but cannot be opened right now (no permission, coming soon).
87
+ * The row is dimmed, announced with `aria-disabled`, out of the tab order, and refuses the
88
+ * press. New in 0.7.0.
89
+ */
90
+ disabled?: boolean;
35
91
  }
36
92
  interface SidebarNavGroup {
37
93
  /**
package/dist/sidebar.d.ts CHANGED
@@ -1,9 +1,54 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, HTMLAttributes } from 'react';
3
+ import { RowData } from '@tanstack/react-table';
3
4
 
4
5
  type NavItemSize = 'sm' | 'md';
5
6
  type NavItemVariant = 'card' | 'plain';
6
7
 
8
+ /** How a column appears in card mode. */
9
+ type ColumnMobileRole = 'title' | 'status' | 'actions' | 'field' | 'hidden';
10
+
11
+ type DataTableColumnAlign = 'start' | 'center' | 'end';
12
+ /**
13
+ * Per-column layout options, carried on TanStack's `meta`. Declared by augmenting TanStack's
14
+ * own `ColumnMeta`, so `meta` on your `ColumnDef` is typed with no extra import:
15
+ *
16
+ * const columns: ColumnDef<Supplier>[] = [
17
+ * { accessorKey: 'name', header: 'Supplier', meta: { width: '280px', grow: true, mobile: 'title' } },
18
+ * ];
19
+ */
20
+ declare module '@tanstack/react-table' {
21
+ interface ColumnMeta<TData extends RowData, TValue> {
22
+ /**
23
+ * CSS width for the column's `<col>`, e.g. `"320px"` or `"10rem"`. A column is never
24
+ * narrower than its header text. With `grow`, this is the floor instead.
25
+ */
26
+ width?: string;
27
+ /** Absorbs the table's remaining width, with `width` as its floor. Usually one column. */
28
+ grow?: boolean;
29
+ /** Horizontal alignment of the header and cells. Default `start`. */
30
+ align?: DataTableColumnAlign;
31
+ /**
32
+ * The cell renders its own controls (a button, a toggle, a menu). Presses inside it stop
33
+ * before reaching the row's `onRowClick`, and the cell stops clipping its overflow, so
34
+ * focus rings are not cut off.
35
+ */
36
+ interactive?: boolean;
37
+ /** Keep the header for screen readers but hide it visually, e.g. an actions column. */
38
+ hideHeader?: boolean;
39
+ /** The column's part in card mode. See `ColumnMobileRole`. Default `field`. */
40
+ mobile?: ColumnMobileRole;
41
+ /** Pin the first (`start`) or last (`end`) visible column while the table scrolls sideways. */
42
+ sticky?: 'start' | 'end';
43
+ /** The column's name where its header cannot be shown as text: menus, card labels. */
44
+ label?: string;
45
+ /** Extra classes on the header cell. An escape hatch; prefer `align`. */
46
+ headerClassName?: string;
47
+ /** Extra classes on each body cell. An escape hatch; prefer `align`. */
48
+ cellClassName?: string;
49
+ }
50
+ }
51
+
7
52
  interface NavTabItem {
8
53
  to: string;
9
54
  label: string;
@@ -24,6 +69,11 @@ interface NavTabsProps {
24
69
  declare function NavTabs({ items, className }: NavTabsProps): react.JSX.Element;
25
70
 
26
71
  interface SidebarNavItem {
72
+ /**
73
+ * The destination. May carry a hash (`/docs/floating#tooltip`) to link to a section of a
74
+ * page: that row is current only when the hash matches too, and the page's own plain row
75
+ * steps aside while it is. New in 0.7.0.
76
+ */
27
77
  to: string;
28
78
  label: string;
29
79
  /** Optional — a collapsed row without one falls back to a monogram of its label. */
@@ -32,6 +82,12 @@ interface SidebarNavItem {
32
82
  indicator?: boolean;
33
83
  /** Match the path exactly rather than as a prefix. Needed for an index route. */
34
84
  end?: boolean;
85
+ /**
86
+ * A destination that exists but cannot be opened right now (no permission, coming soon).
87
+ * The row is dimmed, announced with `aria-disabled`, out of the tab order, and refuses the
88
+ * press. New in 0.7.0.
89
+ */
90
+ disabled?: boolean;
35
91
  }
36
92
  interface SidebarNavGroup {
37
93
  /**