base-cmdk 0.1.0 → 0.1.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/README.md +19 -5
- package/dist/index.d.ts +284 -61
- package/dist/index.js +914 -15
- package/package.json +11 -5
- package/dist/collection.d.ts +0 -11
- package/dist/collection.js +0 -100
- package/dist/command-score.d.ts +0 -1
- package/dist/command-score.js +0 -123
- package/dist/context.d.ts +0 -19
- package/dist/context.js +0 -48
- package/dist/order.d.ts +0 -6
- package/dist/order.js +0 -66
- package/dist/parts.d.ts +0 -86
- package/dist/parts.js +0 -257
- package/dist/root.d.ts +0 -17
- package/dist/root.js +0 -354
- package/dist/types.d.ts +0 -160
- package/dist/types.js +0 -1
package/dist/types.d.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
import type { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
3
|
-
type Children = {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
};
|
|
6
|
-
type DivProps = React.ComponentPropsWithoutRef<"div">;
|
|
7
|
-
export type LoadingProps = Children & DivProps & {
|
|
8
|
-
/** Estimated progress of loading asynchronous options. */
|
|
9
|
-
progress?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Accessible label for this loading progressbar. Not shown visibly.
|
|
12
|
-
*/
|
|
13
|
-
label?: string;
|
|
14
|
-
};
|
|
15
|
-
export type EmptyProps = DivProps;
|
|
16
|
-
export type SeparatorProps = DivProps & {
|
|
17
|
-
/** Whether this separator should always be rendered. Useful if you disable automatic filtering. */
|
|
18
|
-
alwaysRender?: boolean;
|
|
19
|
-
};
|
|
20
|
-
export type DialogProps = Omit<BaseDialog.Root.Props, "children"> & CommandProps & {
|
|
21
|
-
/** Provide a className to the Dialog overlay. */
|
|
22
|
-
overlayClassName?: string;
|
|
23
|
-
/** Provide a className to the Dialog content. */
|
|
24
|
-
contentClassName?: string;
|
|
25
|
-
/** Provide a custom element the Dialog should portal into. */
|
|
26
|
-
container?: HTMLElement | null;
|
|
27
|
-
};
|
|
28
|
-
export type ListProps = Children & DivProps & {
|
|
29
|
-
/**
|
|
30
|
-
* Accessible label for this List of suggestions. Not shown visibly.
|
|
31
|
-
*/
|
|
32
|
-
label?: string;
|
|
33
|
-
};
|
|
34
|
-
export type ItemProps = Children & Omit<DivProps, "disabled" | "onSelect" | "value"> & {
|
|
35
|
-
/** Whether this item is currently disabled. */
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
/** Event handler for when this item is selected, either via click or keyboard selection. */
|
|
38
|
-
onSelect?: (value: string) => void;
|
|
39
|
-
/**
|
|
40
|
-
* A unique value for this item.
|
|
41
|
-
* If no value is provided, it will be inferred from `children` or the rendered `textContent`. If your `textContent` changes between renders, you _must_ provide a stable, unique `value`.
|
|
42
|
-
*/
|
|
43
|
-
value?: string;
|
|
44
|
-
/** Optional keywords to match against when filtering. */
|
|
45
|
-
keywords?: string[];
|
|
46
|
-
/** Whether this item is forcibly rendered regardless of filtering. */
|
|
47
|
-
forceMount?: boolean;
|
|
48
|
-
};
|
|
49
|
-
export type GroupProps = Children & Omit<DivProps, "heading" | "value"> & {
|
|
50
|
-
/** Optional heading to render for this group. */
|
|
51
|
-
heading?: React.ReactNode;
|
|
52
|
-
/** If no heading is provided, you must provide a value that is unique for this group. */
|
|
53
|
-
value?: string;
|
|
54
|
-
/** Whether this group is forcibly rendered regardless of filtering. */
|
|
55
|
-
forceMount?: boolean;
|
|
56
|
-
};
|
|
57
|
-
export type InputProps = Omit<React.ComponentPropsWithoutRef<"input">, "value" | "onChange" | "type"> & {
|
|
58
|
-
/**
|
|
59
|
-
* Optional controlled state for the value of the search input.
|
|
60
|
-
*/
|
|
61
|
-
value?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Event handler called when the search value changes.
|
|
64
|
-
*/
|
|
65
|
-
onValueChange?: (search: string) => void;
|
|
66
|
-
};
|
|
67
|
-
export type CommandFilter = (value: string, search: string, keywords?: string[]) => number;
|
|
68
|
-
export type CommandProps = Children & DivProps & {
|
|
69
|
-
/**
|
|
70
|
-
* Accessible label for this command menu. Not shown visibly.
|
|
71
|
-
*/
|
|
72
|
-
label?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Optionally set to `false` to turn off the automatic filtering and sorting.
|
|
75
|
-
* If `false`, you must conditionally render valid items based on the search query yourself.
|
|
76
|
-
*/
|
|
77
|
-
shouldFilter?: boolean;
|
|
78
|
-
/** Initial input query for SSR when the input is rendered by another component. */
|
|
79
|
-
defaultSearch?: string;
|
|
80
|
-
/**
|
|
81
|
-
* Custom filter function for whether each command menu item should matches the given search query.
|
|
82
|
-
* It should return a number between 0 and 1, with 1 being the best match and 0 being hidden entirely.
|
|
83
|
-
* By default, uses the `command-score` library.
|
|
84
|
-
*/
|
|
85
|
-
filter?: CommandFilter;
|
|
86
|
-
/**
|
|
87
|
-
* Optional default item value when it is initially rendered.
|
|
88
|
-
*/
|
|
89
|
-
defaultValue?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Optional controlled state of the selected command menu item.
|
|
92
|
-
*/
|
|
93
|
-
value?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Event handler called when the selected item of the menu changes.
|
|
96
|
-
*/
|
|
97
|
-
onValueChange?: (value: string) => void;
|
|
98
|
-
/**
|
|
99
|
-
* Optionally set to `true` to turn on looping around when using the arrow keys.
|
|
100
|
-
*/
|
|
101
|
-
loop?: boolean;
|
|
102
|
-
/** Cycle between groups with Tab and Shift+Tab in single-input palettes. */
|
|
103
|
-
tabToGroup?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Optionally set to `true` to disable selection via pointer events.
|
|
106
|
-
*/
|
|
107
|
-
disablePointerSelection?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Set to `false` to disable ctrl+n/j/p/k shortcuts. Defaults to `true`.
|
|
110
|
-
*/
|
|
111
|
-
vimBindings?: boolean;
|
|
112
|
-
};
|
|
113
|
-
export type ItemData = {
|
|
114
|
-
value: string;
|
|
115
|
-
keywords: string[];
|
|
116
|
-
groupId?: string;
|
|
117
|
-
parent: Element | null;
|
|
118
|
-
forced: boolean;
|
|
119
|
-
disabled: boolean;
|
|
120
|
-
hidden: boolean;
|
|
121
|
-
};
|
|
122
|
-
export type Context = {
|
|
123
|
-
updateItem: (id: string, item: ItemData) => void;
|
|
124
|
-
removeItem: (id: string) => void;
|
|
125
|
-
markDirty: () => void;
|
|
126
|
-
updateGroup: (id: string, forced: boolean, hidden: boolean, parentId?: string) => void;
|
|
127
|
-
removeGroup: (id: string) => void;
|
|
128
|
-
disablePointerSelection?: boolean;
|
|
129
|
-
initialScore: (value: string, keywords?: string[]) => number;
|
|
130
|
-
setInputId: (id?: string) => void;
|
|
131
|
-
setListId: (id?: string) => void;
|
|
132
|
-
labelledBy?: string;
|
|
133
|
-
listId: string;
|
|
134
|
-
labelId: string;
|
|
135
|
-
inputId: string;
|
|
136
|
-
listInnerRef: React.RefObject<HTMLDivElement | null>;
|
|
137
|
-
};
|
|
138
|
-
export type State = {
|
|
139
|
-
readonly search: string;
|
|
140
|
-
readonly value: string;
|
|
141
|
-
readonly selectedItemId?: string;
|
|
142
|
-
readonly ready: boolean;
|
|
143
|
-
readonly filtered: {
|
|
144
|
-
readonly ranked: boolean;
|
|
145
|
-
readonly count: number;
|
|
146
|
-
readonly items: ReadonlyMap<string, number>;
|
|
147
|
-
readonly groups: ReadonlySet<string>;
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
export type Store = {
|
|
151
|
-
initialSnapshot: State;
|
|
152
|
-
subscribe: (callback: () => void) => () => void;
|
|
153
|
-
snapshot: () => State;
|
|
154
|
-
setState: (key: "value" | "search", value: string, skipScroll?: boolean) => void;
|
|
155
|
-
};
|
|
156
|
-
export type Group = {
|
|
157
|
-
id: string;
|
|
158
|
-
forceMount?: boolean;
|
|
159
|
-
};
|
|
160
|
-
export {};
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|