@sakaniui/react 0.11.2 → 0.13.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/AGENTS.md +20 -3
- package/CHANGELOG.md +106 -0
- package/dist/{TopBar-O_56x94F.js → TopBar-BcXAB1mf.js} +540 -514
- package/dist/TopBar-DeBSl4rq.cjs +1 -0
- package/dist/blocks.cjs +2 -2
- package/dist/blocks.mjs +2053 -2053
- package/dist/building-warehouse-BUtjAEPH.cjs +1 -0
- package/dist/{file-text-DSD625_l.js → building-warehouse-_n8EvYUt.js} +33 -39
- package/dist/components/ChainOfThought/ChainOfThought.d.ts +72 -0
- package/dist/components/ChainOfThought/SourceLogo.d.ts +13 -0
- package/dist/components/ChainOfThought/index.d.ts +6 -0
- package/dist/components/ChainOfThought/logoData.d.ts +93 -0
- package/dist/components/ChainOfThought/logoIcons.d.ts +11 -0
- package/dist/components/CommandMenu/CommandMenu.d.ts +175 -0
- package/dist/components/CommandMenu/index.d.ts +2 -0
- package/dist/emoji-index.json +1 -1
- package/dist/{help-circle-B0koiJUs.js → help-circle-qEEVeIea.js} +15 -9
- package/dist/help-circle-rtL4juBJ.cjs +1 -0
- package/dist/icon-index.json +1 -1
- package/dist/icons.cjs +1 -1
- package/dist/icons.mjs +3932 -3938
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2944 -1529
- package/dist/lib/SakaniLogo.d.ts +2 -0
- package/dist/{logout-BW8ksDGk.js → logout-BLSXL3qV.js} +10 -4
- package/dist/logout-pQUABnfO.cjs +1 -0
- package/dist/manifest.json +1046 -98
- package/dist/style.css +1 -1
- package/dist/tokens.css +2 -0
- package/package.json +2 -1
- package/dist/TopBar-7GwvQXGS.cjs +0 -1
- package/dist/file-text-DEGE-_aO.cjs +0 -1
- package/dist/help-circle-0qi1skw5.cjs +0 -1
- package/dist/logout-DkdFsC2P.cjs +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconComponent } from '../../icons/types';
|
|
3
|
+
export type CommandMenuItemType = 'page' | 'action' | 'file' | 'person' | 'ai';
|
|
4
|
+
export interface CommandMenuItem {
|
|
5
|
+
/** Unique within the menu. */
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
/** A second line under the label (a path, a role, a hint). */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** What kind of result it is. Sets the default icon and the scope it belongs to ("pages", "people", "files", "actions"). */
|
|
11
|
+
type?: CommandMenuItemType;
|
|
12
|
+
/** Overrides the scope this item belongs to (the `value` of a scope). */
|
|
13
|
+
scope?: string;
|
|
14
|
+
/** The icon in the leading tile. Defaults by `type`. */
|
|
15
|
+
icon?: IconComponent;
|
|
16
|
+
/** For a person: shows an Avatar (and a status dot) instead of an icon. */
|
|
17
|
+
avatar?: {
|
|
18
|
+
src?: string;
|
|
19
|
+
initials?: string;
|
|
20
|
+
alt?: string;
|
|
21
|
+
status?: 'online' | 'away';
|
|
22
|
+
};
|
|
23
|
+
/** Small text on the right, e.g. "Page" or "Edited 2h ago". */
|
|
24
|
+
meta?: string;
|
|
25
|
+
/** Shortcut keys on the right, e.g. ['⌘', 'N']. */
|
|
26
|
+
shortcut?: string[];
|
|
27
|
+
/** Extra words the built-in filter matches. */
|
|
28
|
+
keywords?: string[];
|
|
29
|
+
/** Matched by filter tokens: a token whose `value` (or label) is in `tags` keeps the item. */
|
|
30
|
+
tags?: string[];
|
|
31
|
+
/** Called when the item is chosen, in addition to the menu's `onSelect`. */
|
|
32
|
+
onSelect?: () => void;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface CommandMenuGroup {
|
|
36
|
+
id: string;
|
|
37
|
+
/** The small heading above the items. */
|
|
38
|
+
label?: string;
|
|
39
|
+
/** A link on the right of the heading, e.g. "See all". */
|
|
40
|
+
action?: {
|
|
41
|
+
label: string;
|
|
42
|
+
onClick: () => void;
|
|
43
|
+
};
|
|
44
|
+
items: CommandMenuItem[];
|
|
45
|
+
}
|
|
46
|
+
export interface CommandMenuScope {
|
|
47
|
+
/** "all" is the unfiltered scope. */
|
|
48
|
+
value: string;
|
|
49
|
+
label: string;
|
|
50
|
+
/** The count shown on the tab. Computed from the items when you leave it out (and `filter` is on); `null` shows no count. */
|
|
51
|
+
count?: number | null;
|
|
52
|
+
}
|
|
53
|
+
export interface CommandMenuFilter {
|
|
54
|
+
id: string;
|
|
55
|
+
/** Shown in the token, e.g. "People" or "team: Design". */
|
|
56
|
+
label: string;
|
|
57
|
+
/** What `tags` are matched against. Defaults to the label. */
|
|
58
|
+
value?: string;
|
|
59
|
+
icon?: IconComponent;
|
|
60
|
+
}
|
|
61
|
+
export interface CommandMenuSuggestion {
|
|
62
|
+
label: string;
|
|
63
|
+
icon?: IconComponent;
|
|
64
|
+
/** Where the icon sits: before the label (default) or after it (e.g. the × on "Remove the Files filter"). */
|
|
65
|
+
iconPosition?: 'start' | 'end';
|
|
66
|
+
/** A word inside `label` to set in the strong weight ("invoice" in "Did you mean invoice?"). */
|
|
67
|
+
emphasis?: string;
|
|
68
|
+
onSelect: () => void;
|
|
69
|
+
}
|
|
70
|
+
export interface CommandMenuProps {
|
|
71
|
+
/** Controlled open state. */
|
|
72
|
+
open?: boolean;
|
|
73
|
+
/** Initial open state when uncontrolled. */
|
|
74
|
+
defaultOpen?: boolean;
|
|
75
|
+
onOpenChange?: (open: boolean) => void;
|
|
76
|
+
/** The key that opens it with ⌘ / Ctrl. `false` turns the shortcut off. Defaults to "k". */
|
|
77
|
+
hotkey?: string | false;
|
|
78
|
+
/** "default" has scopes and a workspace footer; "simple" is just the field, the rows and the key hints. */
|
|
79
|
+
variant?: 'default' | 'simple';
|
|
80
|
+
/** The field's text (controlled). */
|
|
81
|
+
query?: string;
|
|
82
|
+
defaultQuery?: string;
|
|
83
|
+
onQueryChange?: (query: string) => void;
|
|
84
|
+
placeholder?: string;
|
|
85
|
+
/** Results, in groups. */
|
|
86
|
+
groups: CommandMenuGroup[];
|
|
87
|
+
/** Filter the groups by the query, scope and tokens here. Pass a function to match your own way, or `false` to show `groups` as given. Defaults to true. */
|
|
88
|
+
filter?: boolean | ((item: CommandMenuItem, query: string) => boolean);
|
|
89
|
+
/** Wrap the matched letters of each label in the strong weight. Defaults to true. */
|
|
90
|
+
highlightMatches?: boolean;
|
|
91
|
+
/** "loading" shows skeleton rows, "error" the error message. */
|
|
92
|
+
state?: 'ready' | 'loading' | 'error';
|
|
93
|
+
/** Called when an item is chosen (click or ↵). */
|
|
94
|
+
onSelect?: (item: CommandMenuItem) => void;
|
|
95
|
+
/** Close the menu when an item is chosen. Defaults to true. */
|
|
96
|
+
closeOnSelect?: boolean;
|
|
97
|
+
/** Scope tabs under the field (not shown in the simple variant). */
|
|
98
|
+
scopes?: CommandMenuScope[];
|
|
99
|
+
scope?: string;
|
|
100
|
+
defaultScope?: string;
|
|
101
|
+
onScopeChange?: (scope: string) => void;
|
|
102
|
+
/** Filter tokens shown in the field. */
|
|
103
|
+
filters?: CommandMenuFilter[];
|
|
104
|
+
onFiltersChange?: (filters: CommandMenuFilter[]) => void;
|
|
105
|
+
/** Typing `key:value` and a space turns it into a token for these keys, e.g. ["team", "status"]. */
|
|
106
|
+
filterKeys?: string[];
|
|
107
|
+
/** Adds ⌘↵ and the "Ask AI" hint; called with the current query. */
|
|
108
|
+
onAskAI?: (query: string) => void;
|
|
109
|
+
/** Shown above the results (an answer card, a Chain of Thought). */
|
|
110
|
+
answer?: React.ReactNode;
|
|
111
|
+
/** Shows a preview pane beside the list for the active item. Return null for no pane. */
|
|
112
|
+
renderPreview?: (item: CommandMenuItem) => React.ReactNode;
|
|
113
|
+
/** Buttons or links pinned to the bottom of the detail pane. They stay put while the content above changes from row to row
|
|
114
|
+
* (only `renderPreview`'s content cross-fades); pass a function to read the previewed row. Hidden when a row has no preview. */
|
|
115
|
+
previewActions?: React.ReactNode | ((item: CommandMenuItem) => React.ReactNode);
|
|
116
|
+
/** Shown in the detail pane when the active row has nothing to preview (`renderPreview` returned nothing). */
|
|
117
|
+
previewEmpty?: React.ReactNode;
|
|
118
|
+
/** The "No results" message. */
|
|
119
|
+
emptyTitle?: React.ReactNode;
|
|
120
|
+
emptyDescription?: React.ReactNode;
|
|
121
|
+
/** Quick fixes under the empty message, e.g. "Did you mean invoice?". */
|
|
122
|
+
suggestions?: CommandMenuSuggestion[];
|
|
123
|
+
/** Shown under the empty or error message, and navigable like any group (e.g. "Try instead"). */
|
|
124
|
+
fallbackGroups?: CommandMenuGroup[];
|
|
125
|
+
errorTitle?: React.ReactNode;
|
|
126
|
+
errorDescription?: React.ReactNode;
|
|
127
|
+
onRetry?: () => void;
|
|
128
|
+
/** A second, quieter action beside "Try again" in the error state ("Report"). */
|
|
129
|
+
onReport?: () => void;
|
|
130
|
+
retryLabel?: React.ReactNode;
|
|
131
|
+
reportLabel?: React.ReactNode;
|
|
132
|
+
/** The workspace switcher in the footer (default variant). */
|
|
133
|
+
workspace?: React.ReactNode;
|
|
134
|
+
/** Hide the footer of key hints. */
|
|
135
|
+
hideFooter?: boolean;
|
|
136
|
+
/** Accessible name of the dialog. Defaults to "Command menu". */
|
|
137
|
+
'aria-label'?: string;
|
|
138
|
+
className?: string;
|
|
139
|
+
}
|
|
140
|
+
export interface CommandMenuTriggerProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
141
|
+
/** The text in the pill. Defaults to "Search or jump to…". */
|
|
142
|
+
placeholder?: string;
|
|
143
|
+
/** The key caps on the right. Defaults to ["⌘", "K"]. */
|
|
144
|
+
shortcut?: string[];
|
|
145
|
+
}
|
|
146
|
+
/** The ⌘K pill for a top bar or sidebar. Give it `onClick` to open your CommandMenu. */
|
|
147
|
+
export declare const CommandMenuTrigger: React.ForwardRefExoticComponent<CommandMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
148
|
+
export interface CommandMenuAnswerProps {
|
|
149
|
+
/** Defaults to "SakaniUI AI". */
|
|
150
|
+
title?: string;
|
|
151
|
+
/** e.g. "Thought for 2.4s". With `stream` it appears once the text has been written. */
|
|
152
|
+
status?: string;
|
|
153
|
+
/** The answer text. */
|
|
154
|
+
children: React.ReactNode;
|
|
155
|
+
/** Writes the answer in word by word, the way a chat reply arrives, and brings in the sources and the follow-up once it is
|
|
156
|
+
* written. Needs `children` to be a plain string; reduced motion shows it at once. */
|
|
157
|
+
stream?: boolean;
|
|
158
|
+
/** Called once when the text has been written (or at once when it is not streamed). */
|
|
159
|
+
onStreamEnd?: () => void;
|
|
160
|
+
/** Sources as chips under the answer. */
|
|
161
|
+
sources?: {
|
|
162
|
+
label: string;
|
|
163
|
+
icon?: IconComponent;
|
|
164
|
+
}[];
|
|
165
|
+
/** Adds an "Ask a follow-up" button. */
|
|
166
|
+
onFollowUp?: () => void;
|
|
167
|
+
/** Adds an "Open in chat" hint with ⌘↵. */
|
|
168
|
+
onOpenInChat?: () => void;
|
|
169
|
+
onCopy?: () => void;
|
|
170
|
+
className?: string;
|
|
171
|
+
}
|
|
172
|
+
/** An answer card for the Ask AI state: the answer, its sources and a follow-up. Pass it as the menu's `answer`. */
|
|
173
|
+
export declare const CommandMenuAnswer: React.FC<CommandMenuAnswerProps>;
|
|
174
|
+
export declare const CommandMenu: React.FC<CommandMenuProps>;
|
|
175
|
+
export default CommandMenu;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CommandMenu, CommandMenuTrigger, CommandMenuAnswer, default } from './CommandMenu';
|
|
2
|
+
export type { CommandMenuProps, CommandMenuItem, CommandMenuItemType, CommandMenuGroup, CommandMenuScope, CommandMenuFilter, CommandMenuSuggestion, CommandMenuTriggerProps, CommandMenuAnswerProps, } from './CommandMenu';
|