@xsolla/xui-table 0.151.0-pr273.1778117489
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 +493 -0
- package/native/index.d.mts +122 -0
- package/native/index.d.ts +122 -0
- package/native/index.js +738 -0
- package/native/index.js.map +1 -0
- package/native/index.mjs +716 -0
- package/native/index.mjs.map +1 -0
- package/package.json +58 -0
- package/web/index.d.mts +122 -0
- package/web/index.d.ts +122 -0
- package/web/index.js +785 -0
- package/web/index.js.map +1 -0
- package/web/index.mjs +756 -0
- package/web/index.mjs.map +1 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ReactNode } from 'react';
|
|
3
|
+
import { BoxProps } from '@xsolla/xui-primitives-core';
|
|
4
|
+
import { ThemeOverrideProps } from '@xsolla/xui-core';
|
|
5
|
+
|
|
6
|
+
type TableCellAlign = "left" | "right" | "center";
|
|
7
|
+
type TableCellPosition = "default" | "left" | "right";
|
|
8
|
+
/**
|
|
9
|
+
* Structural primitives only:
|
|
10
|
+
*
|
|
11
|
+
* <Table>
|
|
12
|
+
* <Table.Caption /> ← optional <caption>-equivalent for a11y
|
|
13
|
+
* <Table.Header> ← <thead>-equivalent (sticky)
|
|
14
|
+
* <Table.Row>
|
|
15
|
+
* <Table.Head /> ← <th>-equivalent (sortable)
|
|
16
|
+
* </Table.Row>
|
|
17
|
+
* </Table.Header>
|
|
18
|
+
* <Table.Body> ← <tbody>-equivalent
|
|
19
|
+
* <Table.Row>
|
|
20
|
+
* <Table.Cell />
|
|
21
|
+
* </Table.Row>
|
|
22
|
+
* </Table.Body>
|
|
23
|
+
* <Table.Footer /> ← slot for pagination etc.
|
|
24
|
+
* </Table>
|
|
25
|
+
*
|
|
26
|
+
* Filter panels, item counters, title blocks, bulk-selection bars, and
|
|
27
|
+
* pagination components are NOT part of the surface — compose them on the
|
|
28
|
+
* consumer side around <Table>.
|
|
29
|
+
*
|
|
30
|
+
* Density is single-source from Figma (`theme.sizing.table`); no `size`
|
|
31
|
+
* prop. If Figma ever ships md/sm variants, this will become a function
|
|
32
|
+
* with a size argument again.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* `<Table>` is intentionally opaque: no `style`, no Box-level props. The
|
|
36
|
+
* surface is `children` only (plus theme overrides). To wrap the table in
|
|
37
|
+
* a horizontal-scroll viewport, compose two outer Boxes around it — see
|
|
38
|
+
* the `HorizontalScroll` story or the README "Horizontal scroll" section.
|
|
39
|
+
*/
|
|
40
|
+
interface TableProps extends ThemeOverrideProps {
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
interface TableCaptionProps extends BoxProps, ThemeOverrideProps {
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
interface TableHeaderProps extends BoxProps, ThemeOverrideProps {
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
}
|
|
49
|
+
interface TableBodyProps extends BoxProps, ThemeOverrideProps {
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Reserve space for at least this many row slots. Useful for paginated
|
|
53
|
+
* tables where partial last pages or empty filter results would
|
|
54
|
+
* otherwise make the card height jump between states.
|
|
55
|
+
*
|
|
56
|
+
* When the body contains only `<Table.Row>` children and there are
|
|
57
|
+
* fewer of them than `minRows`, invisible placeholder slots are
|
|
58
|
+
* appended to fill the difference, and the last real row keeps its
|
|
59
|
+
* divider visible (mirroring a fully filled page).
|
|
60
|
+
*
|
|
61
|
+
* If the body contains non-row children (e.g. a custom empty-state
|
|
62
|
+
* block), no placeholders are appended — the body just reserves the
|
|
63
|
+
* full height via `min-height` so the consumer can stretch their
|
|
64
|
+
* empty-state to fill it.
|
|
65
|
+
*/
|
|
66
|
+
minRows?: number;
|
|
67
|
+
}
|
|
68
|
+
interface TableFooterProps extends BoxProps {
|
|
69
|
+
children?: ReactNode;
|
|
70
|
+
}
|
|
71
|
+
interface TableRowProps extends BoxProps, ThemeOverrideProps {
|
|
72
|
+
children?: ReactNode;
|
|
73
|
+
/** Highlight the row on hover. Defaults to true (body rows only). */
|
|
74
|
+
hoverable?: boolean;
|
|
75
|
+
/** Marks the row as selected. */
|
|
76
|
+
selected?: boolean;
|
|
77
|
+
/** Hide the bottom divider for this row. */
|
|
78
|
+
hideDivider?: boolean;
|
|
79
|
+
/** Click handler. When provided, the row becomes interactive. */
|
|
80
|
+
onPress?: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* Optional focus events. The Row uses these internally to track
|
|
83
|
+
* focus-within so that descendant `revealOnHover` cells can show
|
|
84
|
+
* themselves when keyboard-focused; consumer handlers (if provided) are
|
|
85
|
+
* still invoked.
|
|
86
|
+
*/
|
|
87
|
+
onFocus?: (e: React.FocusEvent<HTMLElement>) => void;
|
|
88
|
+
onBlur?: (e: React.FocusEvent<HTMLElement>) => void;
|
|
89
|
+
}
|
|
90
|
+
interface TableCellProps extends Omit<BoxProps, "position">, ThemeOverrideProps {
|
|
91
|
+
children?: ReactNode;
|
|
92
|
+
/** Cell text alignment. Defaults to "left". */
|
|
93
|
+
align?: TableCellAlign;
|
|
94
|
+
/** Position within the row — controls padding (left = leading, right = trailing). */
|
|
95
|
+
position?: TableCellPosition;
|
|
96
|
+
/** Allow the cell to flex to fill space. */
|
|
97
|
+
grow?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Hide the cell until the parent row is hovered or focused (via `:focus-within`).
|
|
100
|
+
* Typically used for `position="right"` action cells per Figma spec.
|
|
101
|
+
* Falls back to always-visible on touch devices.
|
|
102
|
+
*/
|
|
103
|
+
revealOnHover?: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface TableHeadProps extends TableCellProps {
|
|
106
|
+
/** Sort direction. */
|
|
107
|
+
sort?: "ascending" | "descending" | "none";
|
|
108
|
+
/** Click to toggle sort. */
|
|
109
|
+
onSortToggle?: () => void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare const Table: React__default.ForwardRefExoticComponent<TableProps & React__default.RefAttributes<any>> & {
|
|
113
|
+
Caption: React__default.ForwardRefExoticComponent<TableCaptionProps & React__default.RefAttributes<any>>;
|
|
114
|
+
Header: React__default.ForwardRefExoticComponent<TableHeaderProps & React__default.RefAttributes<any>>;
|
|
115
|
+
Body: React__default.ForwardRefExoticComponent<TableBodyProps & React__default.RefAttributes<any>>;
|
|
116
|
+
Footer: React__default.ForwardRefExoticComponent<TableFooterProps & React__default.RefAttributes<any>>;
|
|
117
|
+
Row: React__default.ForwardRefExoticComponent<TableRowProps & React__default.RefAttributes<any>>;
|
|
118
|
+
Head: React__default.ForwardRefExoticComponent<TableHeadProps & React__default.RefAttributes<any>>;
|
|
119
|
+
Cell: React__default.ForwardRefExoticComponent<TableCellProps & React__default.RefAttributes<any>>;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { Table, type TableBodyProps, type TableCaptionProps, type TableCellAlign, type TableCellPosition, type TableCellProps, type TableFooterProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps };
|