@visulima/tui-kit 1.0.0 → 1.0.1
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/CHANGELOG.md +7 -0
- package/dist/accordion.d.ts +25 -32
- package/dist/alert.d.ts +9 -13
- package/dist/animate-presence.d.ts +9 -11
- package/dist/approval-prompt.d.ts +28 -38
- package/dist/area-chart.d.ts +29 -39
- package/dist/badge.d.ts +8 -11
- package/dist/bar-chart.d.ts +29 -38
- package/dist/big-text.d.ts +42 -52
- package/dist/blink-dot.d.ts +16 -21
- package/dist/breadcrumb.d.ts +11 -15
- package/dist/button.d.ts +18 -25
- package/dist/calendar.d.ts +31 -43
- package/dist/card.d.ts +22 -32
- package/dist/checkbox-group.d.ts +21 -30
- package/dist/checkbox.d.ts +19 -27
- package/dist/code.d.ts +24 -31
- package/dist/collapsible.d.ts +21 -30
- package/dist/color-picker.d.ts +29 -41
- package/dist/command-block.d.ts +19 -27
- package/dist/command-palette.d.ts +36 -45
- package/dist/confirm-dialog.d.ts +35 -47
- package/dist/confirm-input.d.ts +17 -23
- package/dist/console-overlay.d.ts +28 -35
- package/dist/content-switcher.d.ts +22 -30
- package/dist/controlled-scroll-view.d.ts +1 -1
- package/dist/data-grid.d.ts +18 -24
- package/dist/date-picker.d.ts +27 -38
- package/dist/definition-list.d.ts +16 -22
- package/dist/dialog.d.ts +58 -74
- package/dist/diff-view.d.ts +41 -54
- package/dist/digits.d.ts +13 -17
- package/dist/directory-tree.d.ts +20 -27
- package/dist/divider.d.ts +20 -28
- package/dist/drawer.d.ts +24 -32
- package/dist/file-change.d.ts +18 -24
- package/dist/file-picker-entry.d.ts +1 -1
- package/dist/form.d.ts +34 -41
- package/dist/gauge.d.ts +40 -51
- package/dist/gradient.d.ts +21 -25
- package/dist/grid.d.ts +19 -25
- package/dist/heading.d.ts +12 -17
- package/dist/heatmap.d.ts +27 -37
- package/dist/help.d.ts +27 -34
- package/dist/histogram.d.ts +27 -37
- package/dist/image.d.ts +11 -14
- package/dist/index.d.ts +6 -6
- package/dist/json.d.ts +23 -30
- package/dist/kbd.d.ts +14 -18
- package/dist/line-chart.d.ts +40 -49
- package/dist/link.d.ts +24 -28
- package/dist/loading-indicator.d.ts +11 -15
- package/dist/log.d.ts +14 -19
- package/dist/markdown.d.ts +22 -27
- package/dist/masked-input.d.ts +23 -31
- package/dist/menu.d.ts +32 -40
- package/dist/message-bubble.d.ts +16 -23
- package/dist/model-badge.d.ts +16 -22
- package/dist/model-selector.d.ts +19 -26
- package/dist/multi-progress.d.ts +22 -29
- package/dist/multi-select.d.ts +25 -35
- package/dist/notification-badge.d.ts +21 -28
- package/dist/number-input.d.ts +38 -52
- package/dist/operation-tree.d.ts +22 -25
- package/dist/option-list.d.ts +17 -23
- package/dist/ordered-list.d.ts +9 -11
- package/dist/packem_shared/{controlled-scroll-view.d-vF4wevEJ.d.ts → controlled-scroll-view.d-D3kZZzjI.d.ts} +8 -19
- package/dist/packem_shared/file-picker.d-CH7pccC7.d.ts +92 -0
- package/dist/packem_shared/{scroll-bar-box.d-DSBbBsRc.d.ts → scroll-bar-box.d-CpTYEcTZ.d.ts} +1 -18
- package/dist/packem_shared/{scroll-list.d-BP0UZSY4.d.ts → scroll-list.d-CPCF0RwC.d.ts} +1 -1
- package/dist/packem_shared/scroll-view.d-GZcgAHl4.d.ts +98 -0
- package/dist/packem_shared/{use-tree-view.d-dXTKoDPM.d.ts → use-tree-view.d-DeMQ6G2r.d.ts} +115 -151
- package/dist/paginator.d.ts +28 -38
- package/dist/paragraph.d.ts +15 -21
- package/dist/path-input.d.ts +29 -40
- package/dist/pie-chart.d.ts +21 -27
- package/dist/placeholder.d.ts +26 -34
- package/dist/popover.d.ts +20 -27
- package/dist/progress-bar.d.ts +25 -33
- package/dist/progress-circle.d.ts +27 -36
- package/dist/qr-code.d.ts +21 -27
- package/dist/radio-group.d.ts +30 -41
- package/dist/scatter-plot.d.ts +5 -16
- package/dist/scroll-bar-box.d.ts +1 -1
- package/dist/scroll-list.d.ts +2 -2
- package/dist/scroll-view.d.ts +1 -1
- package/dist/search-input.d.ts +23 -32
- package/dist/select-input-indicator.d.ts +15 -19
- package/dist/select-input-item.d.ts +18 -24
- package/dist/select-input.d.ts +49 -62
- package/dist/shimmer-text.d.ts +24 -30
- package/dist/sidebar.d.ts +21 -28
- package/dist/slider.d.ts +50 -66
- package/dist/sparkline.d.ts +19 -25
- package/dist/spinner.d.ts +7 -9
- package/dist/status-line.d.ts +14 -20
- package/dist/status-message.d.ts +7 -10
- package/dist/stepper.d.ts +18 -24
- package/dist/stopwatch.d.ts +24 -31
- package/dist/streaming-text.d.ts +20 -27
- package/dist/switch.d.ts +23 -32
- package/dist/tab.d.ts +8 -10
- package/dist/table.d.ts +40 -41
- package/dist/tabs.d.ts +50 -61
- package/dist/tag-input.d.ts +30 -42
- package/dist/tag.d.ts +14 -19
- package/dist/text-input.d.ts +21 -29
- package/dist/textarea.d.ts +32 -43
- package/dist/thinking-block.d.ts +25 -34
- package/dist/time-picker.d.ts +27 -37
- package/dist/timer.d.ts +28 -37
- package/dist/toast.d.ts +20 -28
- package/dist/token-usage.d.ts +23 -30
- package/dist/tool-call.d.ts +14 -19
- package/dist/tooltip.d.ts +19 -25
- package/dist/transition.d.ts +40 -48
- package/dist/tree-select.d.ts +25 -35
- package/dist/tree-view-entry.d.ts +1 -1
- package/dist/unordered-list.d.ts +12 -15
- package/dist/use-linked-scroll.d.ts +27 -27
- package/package.json +2 -2
- package/dist/packem_shared/file-picker.d-Cie6aAMD.d.ts +0 -104
- package/dist/packem_shared/scroll-view.d-BqKpI-F-.d.ts +0 -119
|
@@ -14,25 +14,18 @@ declare const theme: {
|
|
|
14
14
|
container: () => Props$1;
|
|
15
15
|
expandIndicator: (_props: StyleFunctionProps) => Props$2;
|
|
16
16
|
focusIndicator: () => Props$2;
|
|
17
|
-
indent: ({
|
|
18
|
-
|
|
19
|
-
}: StyleFunctionProps) => Props$1;
|
|
20
|
-
label: ({
|
|
21
|
-
isFocused,
|
|
22
|
-
isSelected
|
|
23
|
-
}: StyleFunctionProps) => Props$2;
|
|
17
|
+
indent: ({ depth }: StyleFunctionProps) => Props$1;
|
|
18
|
+
label: ({ isFocused, isSelected }: StyleFunctionProps) => Props$2;
|
|
24
19
|
loadingIndicator: () => Props$2;
|
|
25
|
-
node: ({
|
|
26
|
-
isFocused
|
|
27
|
-
}: StyleFunctionProps) => Props$1;
|
|
20
|
+
node: ({ isFocused }: StyleFunctionProps) => Props$1;
|
|
28
21
|
selectedIndicator: () => Props$2;
|
|
29
22
|
};
|
|
30
23
|
};
|
|
31
24
|
type Theme = typeof theme;
|
|
32
25
|
/**
|
|
33
|
-
* A single node in the tree. Generic over the user's data shape.
|
|
34
|
-
* The `id` field MUST be unique across the entire tree.
|
|
35
|
-
*/
|
|
26
|
+
* A single node in the tree. Generic over the user's data shape.
|
|
27
|
+
* The `id` field MUST be unique across the entire tree.
|
|
28
|
+
*/
|
|
36
29
|
type TreeNode<T = Record<string, unknown>> = {
|
|
37
30
|
/** Child nodes. Undefined or empty array means leaf node. */
|
|
38
31
|
readonly children?: TreeNode<T>[];
|
|
@@ -41,22 +34,22 @@ type TreeNode<T = Record<string, unknown>> = {
|
|
|
41
34
|
/** Unique identifier for this node. Used as the key for all lookups. */
|
|
42
35
|
readonly id: string;
|
|
43
36
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
* Explicitly marks this node as a parent that can have children loaded
|
|
38
|
+
* asynchronously via `loadChildren`. When true, the node shows an expand
|
|
39
|
+
* indicator even if `children` is empty or undefined, and expanding it
|
|
40
|
+
* triggers the `loadChildren` callback.
|
|
41
|
+
*/
|
|
49
42
|
readonly isParent?: boolean;
|
|
50
43
|
/** Display label. Used by the default renderer. */
|
|
51
44
|
readonly label: string;
|
|
52
45
|
};
|
|
53
46
|
/**
|
|
54
|
-
* For async/lazy loading: a function that resolves children on demand.
|
|
55
|
-
*/
|
|
47
|
+
* For async/lazy loading: a function that resolves children on demand.
|
|
48
|
+
*/
|
|
56
49
|
type AsyncChildrenFunction<T = Record<string, unknown>> = (node: TreeNode<T>) => Promise<TreeNode<T>[]>;
|
|
57
50
|
/**
|
|
58
|
-
* State passed to custom renderers and theme functions.
|
|
59
|
-
*/
|
|
51
|
+
* State passed to custom renderers and theme functions.
|
|
52
|
+
*/
|
|
60
53
|
type TreeNodeState = {
|
|
61
54
|
/** Depth of this node in the tree (root = 0). */
|
|
62
55
|
readonly depth: number;
|
|
@@ -72,8 +65,8 @@ type TreeNodeState = {
|
|
|
72
65
|
readonly isSelected: boolean;
|
|
73
66
|
};
|
|
74
67
|
/**
|
|
75
|
-
* Props received by a custom node renderer.
|
|
76
|
-
*/
|
|
68
|
+
* Props received by a custom node renderer.
|
|
69
|
+
*/
|
|
77
70
|
type TreeNodeRendererProps<T = Record<string, unknown>> = {
|
|
78
71
|
/** The tree node data. */
|
|
79
72
|
readonly node: TreeNode<T>;
|
|
@@ -81,12 +74,12 @@ type TreeNodeRendererProps<T = Record<string, unknown>> = {
|
|
|
81
74
|
readonly state: TreeNodeState;
|
|
82
75
|
};
|
|
83
76
|
/**
|
|
84
|
-
* Selection mode for the tree view.
|
|
85
|
-
*/
|
|
77
|
+
* Selection mode for the tree view.
|
|
78
|
+
*/
|
|
86
79
|
type SelectionMode = "multiple" | "none" | "single";
|
|
87
80
|
/**
|
|
88
|
-
* A flattened representation of a tree node with navigation links.
|
|
89
|
-
*/
|
|
81
|
+
* A flattened representation of a tree node with navigation links.
|
|
82
|
+
*/
|
|
90
83
|
type FlatNode<T = Record<string, unknown>> = {
|
|
91
84
|
/** Ordered list of direct children IDs. */
|
|
92
85
|
readonly childrenIds: ReadonlyArray<string>;
|
|
@@ -110,9 +103,9 @@ type FlatNode<T = Record<string, unknown>> = {
|
|
|
110
103
|
readonly siblingIndex: number;
|
|
111
104
|
};
|
|
112
105
|
/**
|
|
113
|
-
* A flattened map of all tree nodes built via DFS traversal.
|
|
114
|
-
* Stores parent/child/sibling links for O(1) navigation.
|
|
115
|
-
*/
|
|
106
|
+
* A flattened map of all tree nodes built via DFS traversal.
|
|
107
|
+
* Stores parent/child/sibling links for O(1) navigation.
|
|
108
|
+
*/
|
|
116
109
|
declare class TreeNodeMap<T = Record<string, unknown>> {
|
|
117
110
|
/** All node IDs in DFS order. */
|
|
118
111
|
readonly orderedIds: string[];
|
|
@@ -122,140 +115,126 @@ declare class TreeNodeMap<T = Record<string, unknown>> {
|
|
|
122
115
|
private readonly map;
|
|
123
116
|
constructor(data: TreeNode<T>[]);
|
|
124
117
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
* Iterate over all entries.
|
|
119
|
+
*/
|
|
127
120
|
entries(): IterableIterator<[string, FlatNode<T>]>;
|
|
128
121
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
* Get a flat node by ID.
|
|
123
|
+
*/
|
|
131
124
|
get(id: string): FlatNode<T> | undefined;
|
|
132
125
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
* Total number of nodes in the tree.
|
|
127
|
+
*/
|
|
135
128
|
get size(): number;
|
|
136
129
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
* Given a set of expanded node IDs, return the ordered list of
|
|
131
|
+
* VISIBLE node IDs (i.e., a node is visible if all its ancestors
|
|
132
|
+
* are expanded).
|
|
133
|
+
*
|
|
134
|
+
* Uses iterative DFS, skipping collapsed subtrees.
|
|
135
|
+
*/
|
|
143
136
|
getVisibleIds(expandedIds: ReadonlySet<string>): string[];
|
|
144
137
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
138
|
+
* Check if a node is a descendant of another node.
|
|
139
|
+
*/
|
|
147
140
|
isDescendantOf(nodeId: string, ancestorId: string): boolean;
|
|
148
141
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
142
|
+
* Insert dynamically-loaded children under a parent node.
|
|
143
|
+
* Returns a new TreeNodeMap (immutable operation).
|
|
144
|
+
*
|
|
145
|
+
* Rebuilds the full tree from the current map state (not the original
|
|
146
|
+
* input data), so successive calls for different parents are safe.
|
|
147
|
+
*/
|
|
155
148
|
withChildren(parentId: string, children: TreeNode<T>[]): TreeNodeMap<T>;
|
|
156
149
|
private buildFromData;
|
|
157
150
|
}
|
|
158
151
|
type Props<T = Record<string, unknown>> = {
|
|
159
152
|
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
* Accessible label for the tree container.
|
|
154
|
+
* Useful when multiple tree views are on screen.
|
|
155
|
+
* @default "Tree view"
|
|
156
|
+
*/
|
|
164
157
|
readonly ariaLabel?: string;
|
|
165
158
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
159
|
+
* The tree data. Array of root-level nodes.
|
|
160
|
+
*
|
|
161
|
+
* **Important:** Must be referentially stable across renders (e.g. stored
|
|
162
|
+
* in state or wrapped in `useMemo`). Passing a new array reference on
|
|
163
|
+
* every render will reset focus, expansion, and selection state.
|
|
164
|
+
*/
|
|
172
165
|
readonly data: TreeNode<T>[];
|
|
173
166
|
/**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
* Set of node IDs that are expanded by default.
|
|
168
|
+
* If not provided, all nodes start collapsed.
|
|
169
|
+
*/
|
|
177
170
|
readonly defaultExpanded?: ReadonlySet<string> | "all";
|
|
178
171
|
/**
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
* Set of node IDs that are selected by default.
|
|
173
|
+
*/
|
|
181
174
|
readonly defaultSelected?: ReadonlySet<string>;
|
|
182
175
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
* When disabled, user input is ignored.
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
186
179
|
readonly isDisabled?: boolean;
|
|
187
180
|
/**
|
|
188
|
-
|
|
189
|
-
|
|
181
|
+
* Async function to load children on demand.
|
|
182
|
+
*/
|
|
190
183
|
readonly loadChildren?: AsyncChildrenFunction<T>;
|
|
191
184
|
/** Called when expanded set changes. */
|
|
192
185
|
readonly onExpandChange?: (expandedIds: ReadonlySet<string>) => void;
|
|
193
186
|
/** Called when the focused node changes. */
|
|
194
187
|
readonly onFocusChange?: (nodeId: string) => void;
|
|
195
188
|
/**
|
|
196
|
-
|
|
197
|
-
|
|
189
|
+
* Called when `loadChildren` rejects. Receives the node ID and error.
|
|
190
|
+
*/
|
|
198
191
|
readonly onLoadError?: (nodeId: string, error: Error) => void;
|
|
199
192
|
/** Called when selection changes. */
|
|
200
193
|
readonly onSelectChange?: (selectedIds: ReadonlySet<string>) => void;
|
|
201
194
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
195
|
+
* Custom node renderer. Receives node + state, returns Ink JSX.
|
|
196
|
+
*/
|
|
204
197
|
readonly renderNode?: (props: TreeNodeRendererProps<T>) => ReactNode;
|
|
205
198
|
/**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
199
|
+
* Selection mode.
|
|
200
|
+
* - "none": No selection behavior (default).
|
|
201
|
+
* - "single": One node can be selected at a time.
|
|
202
|
+
* - "multiple": Multiple nodes can be selected (checkboxes shown).
|
|
203
|
+
* @default "none"
|
|
204
|
+
*/
|
|
212
205
|
readonly selectionMode?: SelectionMode;
|
|
213
206
|
/**
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
207
|
+
* Number of visible nodes in the viewport (for virtualization).
|
|
208
|
+
* @default Infinity (no virtualization)
|
|
209
|
+
*/
|
|
217
210
|
readonly visibleNodeCount?: number;
|
|
218
211
|
};
|
|
219
212
|
/**
|
|
220
|
-
* Renders an interactive tree view with keyboard navigation.
|
|
221
|
-
*
|
|
222
|
-
* ```tsx
|
|
223
|
-
* <TreeView
|
|
224
|
-
* data={[
|
|
225
|
-
* { id: "1", label: "Root", children: [
|
|
226
|
-
* { id: "1.1", label: "Child" },
|
|
227
|
-
* ]},
|
|
228
|
-
* ]}
|
|
229
|
-
* defaultExpanded="all"
|
|
230
|
-
* />
|
|
231
|
-
* ```
|
|
232
|
-
*/
|
|
233
|
-
declare function TreeView<T = Record<string, unknown>>({
|
|
234
|
-
ariaLabel,
|
|
235
|
-
data,
|
|
236
|
-
defaultExpanded,
|
|
237
|
-
defaultSelected,
|
|
238
|
-
isDisabled,
|
|
239
|
-
loadChildren,
|
|
240
|
-
onExpandChange,
|
|
241
|
-
onFocusChange,
|
|
242
|
-
onLoadError,
|
|
243
|
-
onSelectChange,
|
|
244
|
-
renderNode,
|
|
245
|
-
selectionMode,
|
|
246
|
-
visibleNodeCount
|
|
247
|
-
}: Props<T>): ReactElement;
|
|
213
|
+
* Renders an interactive tree view with keyboard navigation.
|
|
214
|
+
*
|
|
215
|
+
* ```tsx
|
|
216
|
+
* <TreeView
|
|
217
|
+
* data={[
|
|
218
|
+
* { id: "1", label: "Root", children: [
|
|
219
|
+
* { id: "1.1", label: "Child" },
|
|
220
|
+
* ]},
|
|
221
|
+
* ]}
|
|
222
|
+
* defaultExpanded="all"
|
|
223
|
+
* />
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
declare function TreeView<T = Record<string, unknown>>({ ariaLabel, data, defaultExpanded, defaultSelected, isDisabled, loadChildren, onExpandChange, onFocusChange, onLoadError, onSelectChange, renderNode, selectionMode, visibleNodeCount }: Props<T>): ReactElement;
|
|
248
227
|
type UseTreeViewStateProps<T = Record<string, unknown>> = {
|
|
249
228
|
/** The tree data. Array of root-level nodes. */
|
|
250
229
|
readonly data: TreeNode<T>[];
|
|
251
230
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
231
|
+
* Set of node IDs that are expanded by default.
|
|
232
|
+
* If not provided, all nodes start collapsed.
|
|
233
|
+
*/
|
|
255
234
|
readonly defaultExpanded?: ReadonlySet<string> | "all";
|
|
256
235
|
/**
|
|
257
|
-
|
|
258
|
-
|
|
236
|
+
* Set of node IDs that are selected by default.
|
|
237
|
+
*/
|
|
259
238
|
readonly defaultSelected?: ReadonlySet<string>;
|
|
260
239
|
/** Called when expanded set changes. */
|
|
261
240
|
readonly onExpandChange?: (expandedIds: ReadonlySet<string>) => void;
|
|
@@ -264,14 +243,14 @@ type UseTreeViewStateProps<T = Record<string, unknown>> = {
|
|
|
264
243
|
/** Called when selection changes. */
|
|
265
244
|
readonly onSelectChange?: (selectedIds: ReadonlySet<string>) => void;
|
|
266
245
|
/**
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
246
|
+
* Selection mode.
|
|
247
|
+
* @default "none"
|
|
248
|
+
*/
|
|
270
249
|
readonly selectionMode?: SelectionMode;
|
|
271
250
|
/**
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
251
|
+
* Number of visible nodes in the viewport (for virtualization).
|
|
252
|
+
* @default Infinity
|
|
253
|
+
*/
|
|
275
254
|
readonly visibleNodeCount?: number;
|
|
276
255
|
};
|
|
277
256
|
type TreeViewState<T = Record<string, unknown>> = {
|
|
@@ -307,44 +286,29 @@ type TreeViewState<T = Record<string, unknown>> = {
|
|
|
307
286
|
readonly viewportToIndex: number;
|
|
308
287
|
readonly visibleCount: number;
|
|
309
288
|
};
|
|
310
|
-
declare function useTreeViewState<T = Record<string, unknown>>({
|
|
311
|
-
data,
|
|
312
|
-
defaultExpanded,
|
|
313
|
-
defaultSelected,
|
|
314
|
-
onExpandChange,
|
|
315
|
-
onFocusChange,
|
|
316
|
-
onSelectChange,
|
|
317
|
-
selectionMode,
|
|
318
|
-
visibleNodeCount
|
|
319
|
-
}: UseTreeViewStateProps<T>): TreeViewState<T>;
|
|
289
|
+
declare function useTreeViewState<T = Record<string, unknown>>({ data, defaultExpanded, defaultSelected, onExpandChange, onFocusChange, onSelectChange, selectionMode, visibleNodeCount }: UseTreeViewStateProps<T>): TreeViewState<T>;
|
|
320
290
|
type UseTreeViewProps<T = Record<string, unknown>> = {
|
|
321
291
|
/**
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
292
|
+
* When disabled, user input is ignored.
|
|
293
|
+
* @default false
|
|
294
|
+
*/
|
|
325
295
|
readonly isDisabled?: boolean;
|
|
326
296
|
/**
|
|
327
|
-
|
|
328
|
-
|
|
297
|
+
* Async function to load children on demand.
|
|
298
|
+
*/
|
|
329
299
|
readonly loadChildren?: AsyncChildrenFunction<T>;
|
|
330
300
|
/**
|
|
331
|
-
|
|
332
|
-
|
|
301
|
+
* Called when `loadChildren` rejects.
|
|
302
|
+
*/
|
|
333
303
|
readonly onLoadError?: (nodeId: string, error: Error) => void;
|
|
334
304
|
/**
|
|
335
|
-
|
|
336
|
-
|
|
305
|
+
* Selection mode.
|
|
306
|
+
*/
|
|
337
307
|
readonly selectionMode: SelectionMode;
|
|
338
308
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
309
|
+
* The tree view state from `useTreeViewState`.
|
|
310
|
+
*/
|
|
341
311
|
readonly state: TreeViewState<T>;
|
|
342
312
|
};
|
|
343
|
-
declare function useTreeView<T>({
|
|
344
|
-
isDisabled,
|
|
345
|
-
loadChildren,
|
|
346
|
-
onLoadError,
|
|
347
|
-
selectionMode,
|
|
348
|
-
state
|
|
349
|
-
}: UseTreeViewProps<T>): void;
|
|
313
|
+
declare function useTreeView<T>({ isDisabled, loadChildren, onLoadError, selectionMode, state }: UseTreeViewProps<T>): void;
|
|
350
314
|
export { AsyncChildrenFunction as A, FlatNode as F, Props as P, SelectionMode as S, TreeNode as T, UseTreeViewProps as U, TreeNodeMap as a, TreeNodeRendererProps as b, TreeNodeState as c, TreeView as d, TreeViewState as e, Theme as f, UseTreeViewStateProps as g, useTreeViewState as h, theme as t, useTreeView as u };
|
package/dist/paginator.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* Metadata about the current page state, passed to the render-prop children.
|
|
4
|
-
*/
|
|
3
|
+
* Metadata about the current page state, passed to the render-prop children.
|
|
4
|
+
*/
|
|
5
5
|
type PageMeta = {
|
|
6
6
|
readonly currentPage: number;
|
|
7
7
|
readonly endIndex: number;
|
|
@@ -12,58 +12,48 @@ type PageMeta = {
|
|
|
12
12
|
};
|
|
13
13
|
type Props<T> = {
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
* Render-prop that receives the current page items and page metadata.
|
|
16
|
+
*/
|
|
17
17
|
readonly children: (pageItems: ReadonlyArray<T>, meta: PageMeta) => ReactNode;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
* Uncontrolled initial page (0-indexed).
|
|
20
|
+
* @default 0
|
|
21
|
+
*/
|
|
22
22
|
readonly defaultPage?: number;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
* Color for the active page indicator.
|
|
25
|
+
* @default "cyan"
|
|
26
|
+
*/
|
|
27
27
|
readonly indicatorColor?: string;
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
* Whether keyboard navigation is active.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
32
|
readonly isFocused?: boolean;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
* The full list of items to paginate.
|
|
35
|
+
*/
|
|
36
36
|
readonly items: ReadonlyArray<T>;
|
|
37
37
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
* Called when the page changes.
|
|
39
|
+
*/
|
|
40
40
|
readonly onChange?: (page: number) => void;
|
|
41
41
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
* Controlled current page (0-indexed). When provided, the component is controlled.
|
|
43
|
+
*/
|
|
44
44
|
readonly page?: number;
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
* Number of items per page.
|
|
47
|
+
*/
|
|
48
48
|
readonly pageSize: number;
|
|
49
49
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
* Indicator style.
|
|
51
|
+
* - `"dots"`: `● ○ ○ ○`
|
|
52
|
+
* - `"numeric"`: `‹ 1 / 4 ›`
|
|
53
|
+
* - `"fraction"`: `1/4`
|
|
54
|
+
* @default "dots"
|
|
55
|
+
*/
|
|
56
56
|
readonly style?: "dots" | "fraction" | "numeric";
|
|
57
57
|
};
|
|
58
|
-
declare const Paginator: <T>({
|
|
59
|
-
children,
|
|
60
|
-
defaultPage,
|
|
61
|
-
indicatorColor,
|
|
62
|
-
isFocused,
|
|
63
|
-
items,
|
|
64
|
-
onChange,
|
|
65
|
-
page: controlledPage,
|
|
66
|
-
pageSize,
|
|
67
|
-
style
|
|
68
|
-
}: Props<T>) => ReactElement;
|
|
58
|
+
declare const Paginator: <T>({ children, defaultPage, indicatorColor, isFocused, items, onChange, page: controlledPage, pageSize, style }: Props<T>) => ReactElement;
|
|
69
59
|
export { PageMeta, Paginator, type Props as PaginatorProps, Props, Paginator as default };
|
package/dist/paragraph.d.ts
CHANGED
|
@@ -3,36 +3,30 @@ import { ReactNode, ReactElement } from 'react';
|
|
|
3
3
|
import { LiteralUnion } from 'type-fest';
|
|
4
4
|
type Props = {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Paragraph body.
|
|
7
|
+
*/
|
|
8
8
|
readonly children: ReactNode;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* Foreground color.
|
|
11
|
+
*/
|
|
12
12
|
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* Render the paragraph with dim color.
|
|
15
|
+
*/
|
|
16
16
|
readonly dimColor?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
* Blank lines to add after the paragraph.
|
|
19
|
+
* @default 1
|
|
20
|
+
*/
|
|
21
21
|
readonly marginBottom?: number;
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
* Blank lines to add before the paragraph.
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
26
|
readonly marginTop?: number;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
|
-
* Wraps body text with a trailing blank line. Useful for README-style layouts.
|
|
30
|
-
*/
|
|
31
|
-
declare function Paragraph({
|
|
32
|
-
children,
|
|
33
|
-
color,
|
|
34
|
-
dimColor,
|
|
35
|
-
marginBottom,
|
|
36
|
-
marginTop
|
|
37
|
-
}: Props): ReactElement;
|
|
29
|
+
* Wraps body text with a trailing blank line. Useful for README-style layouts.
|
|
30
|
+
*/
|
|
31
|
+
declare function Paragraph({ children, color, dimColor, marginBottom, marginTop }: Props): ReactElement;
|
|
38
32
|
export { Paragraph, type Props as ParagraphProps, Props, Paragraph as default };
|
package/dist/path-input.d.ts
CHANGED
|
@@ -3,65 +3,54 @@ import { ReactElement } from 'react';
|
|
|
3
3
|
import { LiteralUnion } from 'type-fest';
|
|
4
4
|
type Props = {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
* Accent color for the focused border and caret.
|
|
7
|
+
* @default "blue"
|
|
8
|
+
*/
|
|
9
9
|
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
* Auto-focus on mount.
|
|
12
|
+
*/
|
|
13
13
|
readonly autoFocus?: boolean;
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
* Initial path when uncontrolled.
|
|
16
|
+
*/
|
|
17
17
|
readonly defaultValue?: string;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
* Override how completions are produced (e.g. to sandbox or mock the
|
|
20
|
+
* filesystem). Defaults to reading the real filesystem.
|
|
21
|
+
*/
|
|
22
22
|
readonly getCompletions?: (input: string) => ReadonlyArray<string>;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
* Disable input and dim the display.
|
|
25
|
+
*/
|
|
26
26
|
readonly isDisabled?: boolean;
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* Fires whenever the path text changes.
|
|
29
|
+
*/
|
|
30
30
|
readonly onChange?: (path: string) => void;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Fires on Enter with the current path.
|
|
33
|
+
*/
|
|
34
34
|
readonly onSubmit?: (path: string) => void;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
* Placeholder shown when empty.
|
|
37
|
+
* @default "Enter a path…"
|
|
38
|
+
*/
|
|
39
39
|
readonly placeholder?: string;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
* Show the first few completion candidates beneath the field.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
44
|
readonly showSuggestions?: boolean;
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
* Controlled path. When provided, `defaultValue` is ignored.
|
|
47
|
+
*/
|
|
48
48
|
readonly value?: string;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
|
-
* A text input specialised for filesystem paths. Tab completes against the
|
|
52
|
-
* directory being typed (cycling through matches on repeated presses), and a
|
|
53
|
-
* short list of candidates is shown below the field.
|
|
54
|
-
*/
|
|
55
|
-
declare function PathInput({
|
|
56
|
-
accentColor,
|
|
57
|
-
autoFocus,
|
|
58
|
-
defaultValue,
|
|
59
|
-
getCompletions,
|
|
60
|
-
isDisabled,
|
|
61
|
-
onChange,
|
|
62
|
-
onSubmit,
|
|
63
|
-
placeholder,
|
|
64
|
-
showSuggestions,
|
|
65
|
-
value: controlledValue
|
|
66
|
-
}: Props): ReactElement;
|
|
51
|
+
* A text input specialised for filesystem paths. Tab completes against the
|
|
52
|
+
* directory being typed (cycling through matches on repeated presses), and a
|
|
53
|
+
* short list of candidates is shown below the field.
|
|
54
|
+
*/
|
|
55
|
+
declare function PathInput({ accentColor, autoFocus, defaultValue, getCompletions, isDisabled, onChange, onSubmit, placeholder, showSuggestions, value: controlledValue }: Props): ReactElement;
|
|
67
56
|
export { PathInput, type Props as PathInputProps, Props, PathInput as default };
|