@trypattern/sdk 0.0.0-stage → 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 +127 -2
- package/dist/access.d.ts +31 -0
- package/dist/access.js +72 -0
- package/dist/actions.d.ts +57 -0
- package/dist/actions.js +198 -0
- package/dist/api.d.ts +30 -0
- package/dist/api.js +60 -0
- package/dist/app.d.ts +115 -0
- package/dist/app.js +266 -0
- package/dist/appInfo.d.ts +35 -0
- package/dist/appInfo.js +67 -0
- package/dist/appTitle.d.ts +6 -0
- package/dist/appTitle.js +3 -0
- package/dist/appearance.d.ts +7 -0
- package/dist/appearance.js +2 -0
- package/dist/auth/sessionApi.d.ts +41 -0
- package/dist/auth/sessionApi.js +158 -0
- package/dist/auth/sessionStore.d.ts +20 -0
- package/dist/auth/sessionStore.js +40 -0
- package/dist/auth/user.d.ts +11 -0
- package/dist/auth/user.js +9 -0
- package/dist/builtins/Account.d.ts +25 -0
- package/dist/builtins/Account.js +15 -0
- package/dist/builtins/AppSettings.d.ts +12 -0
- package/dist/builtins/AppSettings.js +31 -0
- package/dist/builtins/Palette.d.ts +29 -0
- package/dist/builtins/Palette.js +63 -0
- package/dist/builtins/SignIn.d.ts +28 -0
- package/dist/builtins/SignIn.js +60 -0
- package/dist/builtins/Toasts.d.ts +32 -0
- package/dist/builtins/Toasts.js +25 -0
- package/dist/builtins/actions.d.ts +2 -0
- package/dist/builtins/actions.js +45 -0
- package/dist/cache.d.ts +24 -0
- package/dist/cache.js +112 -0
- package/dist/cli/app.d.ts +2 -0
- package/dist/cli/app.js +1406 -0
- package/dist/cli/publishing.d.ts +21 -0
- package/dist/cli/publishing.js +493 -0
- package/dist/cli/screenshot.d.ts +1 -0
- package/dist/cli/screenshot.js +96 -0
- package/dist/cli/tools.d.ts +12 -0
- package/dist/cli/tools.js +35 -0
- package/dist/clock.d.ts +6 -0
- package/dist/clock.js +31 -0
- package/dist/components/AppFrame.d.ts +14 -0
- package/dist/components/AppFrame.js +64 -0
- package/dist/components/AppearancePicker.d.ts +1 -0
- package/dist/components/AppearancePicker.js +12 -0
- package/dist/components/Avatar.d.ts +9 -0
- package/dist/components/Avatar.js +63 -0
- package/dist/components/Badge.d.ts +11 -0
- package/dist/components/Badge.js +87 -0
- package/dist/components/Button.d.ts +24 -0
- package/dist/components/Button.js +252 -0
- package/dist/components/Card.d.ts +12 -0
- package/dist/components/Card.js +38 -0
- package/dist/components/CommandMenu.d.ts +23 -0
- package/dist/components/CommandMenu.js +214 -0
- package/dist/components/CommandPalette.d.ts +1 -0
- package/dist/components/CommandPalette.js +7 -0
- package/dist/components/Content.d.ts +7 -0
- package/dist/components/Content.js +24 -0
- package/dist/components/ContextMenu.d.ts +8 -0
- package/dist/components/ContextMenu.js +23 -0
- package/dist/components/CopyButton.d.ts +11 -0
- package/dist/components/CopyButton.js +16 -0
- package/dist/components/Dialog.d.ts +11 -0
- package/dist/components/Dialog.js +81 -0
- package/dist/components/Divider.d.ts +7 -0
- package/dist/components/Divider.js +30 -0
- package/dist/components/EmptyState.d.ts +8 -0
- package/dist/components/EmptyState.js +24 -0
- package/dist/components/Form.d.ts +9 -0
- package/dist/components/Form.js +23 -0
- package/dist/components/Icon.d.ts +10 -0
- package/dist/components/Icon.js +22 -0
- package/dist/components/IconButton.d.ts +14 -0
- package/dist/components/IconButton.js +53 -0
- package/dist/components/Kbd.d.ts +6 -0
- package/dist/components/Kbd.js +67 -0
- package/dist/components/Link.d.ts +14 -0
- package/dist/components/Link.js +44 -0
- package/dist/components/ListRow.d.ts +12 -0
- package/dist/components/ListRow.js +62 -0
- package/dist/components/LoadingRows.d.ts +5 -0
- package/dist/components/LoadingRows.js +6 -0
- package/dist/components/Menu.d.ts +12 -0
- package/dist/components/Menu.js +33 -0
- package/dist/components/MenuItems.d.ts +21 -0
- package/dist/components/MenuItems.js +32 -0
- package/dist/components/Placement.d.ts +21 -0
- package/dist/components/Placement.js +1 -0
- package/dist/components/Popup.d.ts +8 -0
- package/dist/components/Popup.js +43 -0
- package/dist/components/PopupItem.d.ts +8 -0
- package/dist/components/PopupItem.js +51 -0
- package/dist/components/PropertyRow.d.ts +7 -0
- package/dist/components/PropertyRow.js +23 -0
- package/dist/components/RadioGroup.d.ts +18 -0
- package/dist/components/RadioGroup.js +85 -0
- package/dist/components/Row.d.ts +16 -0
- package/dist/components/Row.js +27 -0
- package/dist/components/Screen.d.ts +13 -0
- package/dist/components/Screen.js +56 -0
- package/dist/components/Scrim.d.ts +8 -0
- package/dist/components/Scrim.js +40 -0
- package/dist/components/ScrollArea.d.ts +15 -0
- package/dist/components/ScrollArea.js +13 -0
- package/dist/components/SegmentedControl.d.ts +17 -0
- package/dist/components/SegmentedControl.js +68 -0
- package/dist/components/Select.d.ts +17 -0
- package/dist/components/Select.js +107 -0
- package/dist/components/SettingsRow.d.ts +8 -0
- package/dist/components/SettingsRow.js +32 -0
- package/dist/components/Sidebar.d.ts +20 -0
- package/dist/components/Sidebar.js +137 -0
- package/dist/components/SignInScreen.d.ts +1 -0
- package/dist/components/SignInScreen.js +40 -0
- package/dist/components/Size.d.ts +1 -0
- package/dist/components/Size.js +1 -0
- package/dist/components/Skeleton.d.ts +8 -0
- package/dist/components/Skeleton.js +48 -0
- package/dist/components/Spinner.d.ts +6 -0
- package/dist/components/Spinner.js +54 -0
- package/dist/components/Stack.d.ts +14 -0
- package/dist/components/Stack.js +19 -0
- package/dist/components/Switch.d.ts +10 -0
- package/dist/components/Switch.js +72 -0
- package/dist/components/Text.d.ts +21 -0
- package/dist/components/Text.js +77 -0
- package/dist/components/TextField.d.ts +25 -0
- package/dist/components/TextField.js +68 -0
- package/dist/components/Toaster.d.ts +1 -0
- package/dist/components/Toaster.js +83 -0
- package/dist/components/Tooltip.d.ts +8 -0
- package/dist/components/Tooltip.js +43 -0
- package/dist/components/controlLook.d.ts +70 -0
- package/dist/components/controlLook.js +80 -0
- package/dist/components/frame.d.ts +4 -0
- package/dist/components/frame.js +2 -0
- package/dist/components/icons.d.ts +59 -0
- package/dist/components/icons.js +111 -0
- package/dist/components/interaction.d.ts +12 -0
- package/dist/components/interaction.js +22 -0
- package/dist/components/spacing.d.ts +118 -0
- package/dist/components/spacing.js +46 -0
- package/dist/components/tones.d.ts +28 -0
- package/dist/components/tones.js +12 -0
- package/dist/entityStore.d.ts +46 -0
- package/dist/entityStore.js +160 -0
- package/dist/flows/accessFlows.d.ts +9 -0
- package/dist/flows/accessFlows.js +167 -0
- package/dist/flows/browser.d.ts +34 -0
- package/dist/flows/browser.js +167 -0
- package/dist/flows/contactSheet.d.ts +1 -0
- package/dist/flows/contactSheet.js +63 -0
- package/dist/flows/flowBrowser.d.ts +25 -0
- package/dist/flows/flowBrowser.js +23 -0
- package/dist/flows/flowSetup.d.ts +3 -0
- package/dist/flows/flowSetup.js +35 -0
- package/dist/flows/flows.d.ts +47 -0
- package/dist/flows/flows.js +175 -0
- package/dist/flows/screenshotName.d.ts +1 -0
- package/dist/flows/screenshotName.js +6 -0
- package/dist/gate.d.ts +8 -0
- package/dist/gate.js +52 -0
- package/dist/hooks/appContext.d.ts +15 -0
- package/dist/hooks/appContext.js +5 -0
- package/dist/hooks/appHooks.d.ts +21 -0
- package/dist/hooks/appHooks.js +24 -0
- package/dist/hooks/useAnimatesOnChange.d.ts +1 -0
- package/dist/hooks/useAnimatesOnChange.js +14 -0
- package/dist/hooks/useStoreState.d.ts +6 -0
- package/dist/hooks/useStoreState.js +5 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +21 -0
- package/dist/memoryApi.d.ts +19 -0
- package/dist/memoryApi.js +42 -0
- package/dist/model.d.ts +94 -0
- package/dist/model.js +243 -0
- package/dist/page.d.ts +11 -0
- package/dist/page.js +9 -0
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +5 -0
- package/dist/publishWire.d.ts +271 -0
- package/dist/publishWire.js +168 -0
- package/dist/react.d.ts +49 -0
- package/dist/react.js +40 -0
- package/dist/registered.d.ts +60 -0
- package/dist/registered.js +19 -0
- package/dist/routes.d.ts +38 -0
- package/dist/routes.js +21 -0
- package/dist/rules/checkAllFiles.d.ts +1 -0
- package/dist/rules/checkAllFiles.js +749 -0
- package/dist/rules/checkApiRouting.d.ts +1 -0
- package/dist/rules/checkApiRouting.js +112 -0
- package/dist/rules/lintPlugin.d.ts +252 -0
- package/dist/rules/lintPlugin.js +1159 -0
- package/dist/rules/messages.d.ts +48 -0
- package/dist/rules/messages.js +48 -0
- package/dist/rules/themeTokens.d.ts +6 -0
- package/dist/rules/themeTokens.js +64 -0
- package/dist/schema.d.ts +4 -0
- package/dist/schema.js +2 -0
- package/dist/server/auth.d.ts +115 -0
- package/dist/server/auth.js +134 -0
- package/dist/server/authService.d.ts +9 -0
- package/dist/server/authService.js +50 -0
- package/dist/server/createServer.d.ts +402 -0
- package/dist/server/createServer.js +82 -0
- package/dist/server/env.d.ts +15 -0
- package/dist/server/env.js +1 -0
- package/dist/server/index.d.ts +13 -0
- package/dist/server/index.js +9 -0
- package/dist/server/services.d.ts +9 -0
- package/dist/server/services.js +47 -0
- package/dist/server/session.d.ts +29 -0
- package/dist/server/session.js +65 -0
- package/dist/server/sessions.d.ts +92 -0
- package/dist/server/sessions.js +47 -0
- package/dist/server/settings.d.ts +49 -0
- package/dist/server/settings.js +25 -0
- package/dist/server/signInWire.d.ts +53 -0
- package/dist/server/signInWire.js +23 -0
- package/dist/server/tables.d.ts +242 -0
- package/dist/server/tables.js +246 -0
- package/dist/server/users.d.ts +189 -0
- package/dist/server/users.js +49 -0
- package/dist/serviceClients.d.ts +5 -0
- package/dist/serviceClients.js +70 -0
- package/dist/services.d.ts +53 -0
- package/dist/services.js +30 -0
- package/dist/shortcuts.d.ts +3 -0
- package/dist/shortcuts.js +40 -0
- package/dist/start.d.ts +20 -0
- package/dist/start.js +145 -0
- package/dist/state.d.ts +14 -0
- package/dist/state.js +17 -0
- package/dist/store.d.ts +45 -0
- package/dist/store.js +208 -0
- package/dist/subscribers.d.ts +5 -0
- package/dist/subscribers.js +13 -0
- package/dist/table.d.ts +143 -0
- package/dist/table.js +91 -0
- package/dist/tables.d.ts +77 -0
- package/dist/tables.js +216 -0
- package/dist/theme/reset.css +84 -0
- package/dist/theme/scales.d.ts +76 -0
- package/dist/theme/scales.js +82 -0
- package/dist/theme/tokens.stylex.d.ts +218 -0
- package/dist/theme/tokens.stylex.js +233 -0
- package/dist/vite/commandBridge.d.ts +2 -0
- package/dist/vite/commandBridge.js +46 -0
- package/dist/vite/designManifest.d.ts +25 -0
- package/dist/vite/designManifest.js +191 -0
- package/dist/vite/localWorker.d.ts +4 -0
- package/dist/vite/localWorker.js +60 -0
- package/dist/vite/projectFile.d.ts +9 -0
- package/dist/vite/projectFile.js +17 -0
- package/dist/vite/rootAlias.d.ts +2 -0
- package/dist/vite/rootAlias.js +15 -0
- package/dist/vite/vite.d.ts +8 -0
- package/dist/vite/vite.js +95 -0
- package/dist/wire.d.ts +7 -0
- package/dist/wire.js +1 -0
- package/package.json +103 -3
- package/presets/lintPlugin.js +7 -0
- package/presets/oxlint.json +167 -0
- package/presets/register.d.ts +21 -0
- package/presets/server.d.ts +2 -0
- package/presets/tsconfig.app.json +29 -0
- package/presets/tsconfig.server.json +27 -0
package/dist/clock.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function realClock() {
|
|
2
|
+
const repeats = new Set();
|
|
3
|
+
return {
|
|
4
|
+
every(ms, run) {
|
|
5
|
+
const id = setInterval(run, ms);
|
|
6
|
+
repeats.add(run);
|
|
7
|
+
return () => {
|
|
8
|
+
clearInterval(id);
|
|
9
|
+
repeats.delete(run);
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
tick() {
|
|
13
|
+
for (const run of [...repeats])
|
|
14
|
+
run();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function manualClock() {
|
|
19
|
+
const repeats = new Set();
|
|
20
|
+
return {
|
|
21
|
+
every(_ms, run) {
|
|
22
|
+
const entry = () => run();
|
|
23
|
+
repeats.add(entry);
|
|
24
|
+
return () => repeats.delete(entry);
|
|
25
|
+
},
|
|
26
|
+
tick() {
|
|
27
|
+
for (const run of [...repeats])
|
|
28
|
+
run();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { MenuEntry } from './MenuItems.tsx';
|
|
3
|
+
import type { SidebarLink } from './Sidebar.tsx';
|
|
4
|
+
type AppFrameProps = {
|
|
5
|
+
links: readonly SidebarLink[];
|
|
6
|
+
workspaceMenu?: readonly MenuEntry[];
|
|
7
|
+
isSidebarToggled: boolean;
|
|
8
|
+
onToggleSidebar: () => void;
|
|
9
|
+
onCloseSidebar: () => void;
|
|
10
|
+
onSearch?: () => void;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare function AppFrame({ links, workspaceMenu, isSidebarToggled, onToggleSidebar, onCloseSidebar, onSearch, children }: AppFrameProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { breakpoints, colors, radii, shadows, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
import { useModel } from "../hooks/appContext.js";
|
|
5
|
+
import { FrameContext } from "./frame.js";
|
|
6
|
+
import { Scrim } from "./Scrim.js";
|
|
7
|
+
import { Sidebar } from "./Sidebar.js";
|
|
8
|
+
import { useAnimatesOnChange } from "../hooks/useAnimatesOnChange.js";
|
|
9
|
+
export function AppFrame({ links, workspaceMenu = [], isSidebarToggled, onToggleSidebar, onCloseSidebar, onSearch, children }) {
|
|
10
|
+
const appSettings = useModel('appSettings');
|
|
11
|
+
const account = useModel('account');
|
|
12
|
+
const menu = account.user === null
|
|
13
|
+
? workspaceMenu
|
|
14
|
+
: [
|
|
15
|
+
...workspaceMenu,
|
|
16
|
+
...(workspaceMenu.length > 0 ? ['separator'] : []),
|
|
17
|
+
{ id: 'signOut', label: 'Log out', onSelect: account.signOut }
|
|
18
|
+
];
|
|
19
|
+
const isSidebarAnimating = useAnimatesOnChange(isSidebarToggled, SIDEBAR_ANIMATION_MS);
|
|
20
|
+
return (_jsx(FrameContext, { value: { onToggleSidebar }, children: _jsxs("div", { ...stylex.props(styles.frame), children: [_jsx(Sidebar, { workspace: appSettings.title, workspaceMenu: menu, links: links, isToggled: isSidebarToggled, isAnimating: isSidebarAnimating, onFollowLink: onCloseSidebar, onSearch: onSearch === undefined
|
|
21
|
+
? undefined
|
|
22
|
+
: () => {
|
|
23
|
+
onCloseSidebar();
|
|
24
|
+
onSearch();
|
|
25
|
+
} }), _jsx(Scrim, { label: "Close sidebar", isOpen: isSidebarToggled, isAnimating: isSidebarAnimating, onClose: onCloseSidebar }), _jsx("main", { ...stylex.props(styles.panel, isSidebarToggled && styles.panelAlone), children: children })] }) }));
|
|
26
|
+
}
|
|
27
|
+
const SIDEBAR_ANIMATION_MS = 400;
|
|
28
|
+
const styles = stylex.create({
|
|
29
|
+
frame: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
height: '100%',
|
|
32
|
+
backgroundColor: colors.shell
|
|
33
|
+
},
|
|
34
|
+
panel: {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexGrow: 1,
|
|
37
|
+
flexDirection: 'column',
|
|
38
|
+
minWidth: 0,
|
|
39
|
+
marginBlock: {
|
|
40
|
+
default: space.xs,
|
|
41
|
+
[breakpoints.compact]: 0
|
|
42
|
+
},
|
|
43
|
+
marginInlineEnd: {
|
|
44
|
+
default: space.xs,
|
|
45
|
+
[breakpoints.compact]: 0
|
|
46
|
+
},
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
backgroundColor: colors.containerRecessed,
|
|
49
|
+
borderRadius: {
|
|
50
|
+
default: radii.xxxl,
|
|
51
|
+
[breakpoints.compact]: 0
|
|
52
|
+
},
|
|
53
|
+
boxShadow: {
|
|
54
|
+
default: shadows.default,
|
|
55
|
+
[breakpoints.compact]: null
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
panelAlone: {
|
|
59
|
+
marginInlineStart: {
|
|
60
|
+
default: space.xs,
|
|
61
|
+
[breakpoints.compact]: 0
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AppearancePicker(): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useModel } from "../hooks/appContext.js";
|
|
3
|
+
import { SegmentedControl } from "./SegmentedControl.js";
|
|
4
|
+
export function AppearancePicker() {
|
|
5
|
+
const account = useModel('account');
|
|
6
|
+
return (_jsx(SegmentedControl, { label: "Appearance", value: account.appearance, options: options, onChange: (appearance) => account.setAppearance({ appearance }) }));
|
|
7
|
+
}
|
|
8
|
+
const options = [
|
|
9
|
+
{ value: 'system', label: 'System' },
|
|
10
|
+
{ value: 'light', label: 'Light' },
|
|
11
|
+
{ value: 'dark', label: 'Dark' }
|
|
12
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Placement } from './Placement.ts';
|
|
2
|
+
type AvatarProps = {
|
|
3
|
+
name: string;
|
|
4
|
+
imageUrl?: string | null;
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
|
+
style?: Placement;
|
|
7
|
+
};
|
|
8
|
+
export declare function Avatar({ name, imageUrl, size, style }: AvatarProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar as BaseAvatar } from '@base-ui/react/avatar';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { borders, colors, fontSizes, fontWeights, lineHeights, radii } from "../theme/tokens.stylex.js";
|
|
5
|
+
export function Avatar({ name, imageUrl = null, size = 'md', style }) {
|
|
6
|
+
return (_jsxs(BaseAvatar.Root, { className: stylex.props(styles.avatar, sizes[size], style).className, children: [imageUrl === null ? null : (_jsx(BaseAvatar.Image, { src: imageUrl, alt: "", className: stylex.props(styles.image).className })), _jsx(BaseAvatar.Fallback, { className: stylex.props(styles.fallback).className, children: initialsOf(name) })] }));
|
|
7
|
+
}
|
|
8
|
+
function initialsOf(name) {
|
|
9
|
+
return name
|
|
10
|
+
.split(/\s+/)
|
|
11
|
+
.filter((word) => word !== '')
|
|
12
|
+
.slice(0, 2)
|
|
13
|
+
.map((word) => word.charAt(0).toUpperCase())
|
|
14
|
+
.join('');
|
|
15
|
+
}
|
|
16
|
+
const styles = stylex.create({
|
|
17
|
+
avatar: {
|
|
18
|
+
position: 'relative',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
fontWeight: fontWeights.semimedium,
|
|
23
|
+
outlineWidth: borders.hairline,
|
|
24
|
+
outlineStyle: 'solid',
|
|
25
|
+
outlineColor: colors.borderDefault,
|
|
26
|
+
outlineOffset: `calc(-1 * ${borders.hairline})`,
|
|
27
|
+
backgroundColor: colors.component,
|
|
28
|
+
borderRadius: radii.full
|
|
29
|
+
},
|
|
30
|
+
image: {
|
|
31
|
+
width: '100%',
|
|
32
|
+
height: '100%',
|
|
33
|
+
objectFit: 'cover'
|
|
34
|
+
},
|
|
35
|
+
fallback: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
width: '100%',
|
|
40
|
+
height: '100%',
|
|
41
|
+
color: colors.secondaryForeground
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const sizes = stylex.create({
|
|
45
|
+
sm: {
|
|
46
|
+
width: lineHeights.caption,
|
|
47
|
+
height: lineHeights.caption,
|
|
48
|
+
fontSize: fontSizes.captionXs,
|
|
49
|
+
lineHeight: lineHeights.captionXs
|
|
50
|
+
},
|
|
51
|
+
md: {
|
|
52
|
+
width: lineHeights.bodySm,
|
|
53
|
+
height: lineHeights.bodySm,
|
|
54
|
+
fontSize: fontSizes.captionXs,
|
|
55
|
+
lineHeight: lineHeights.captionXs
|
|
56
|
+
},
|
|
57
|
+
lg: {
|
|
58
|
+
width: lineHeights.body,
|
|
59
|
+
height: lineHeights.body,
|
|
60
|
+
fontSize: fontSizes.bodySm,
|
|
61
|
+
lineHeight: lineHeights.caption
|
|
62
|
+
}
|
|
63
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from './Placement.ts';
|
|
3
|
+
type BadgeProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
variant?: 'primary' | 'tertiary' | 'outline' | 'transparent';
|
|
6
|
+
tone?: 'neutral' | 'brand' | 'danger';
|
|
7
|
+
size?: 'sm' | 'md';
|
|
8
|
+
style?: Placement;
|
|
9
|
+
};
|
|
10
|
+
export declare function Badge({ children, variant, tone, size, style }: BadgeProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { borders, colors, controls, fontSizes, lineHeights, radii, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
export function Badge({ children, variant = 'tertiary', tone = 'neutral', size = 'md', style }) {
|
|
5
|
+
return (_jsx("span", { ...stylex.props(styles.badge, sizes[size], looks[`${variant}${toneKeys[tone]}`], style), children: children }));
|
|
6
|
+
}
|
|
7
|
+
const toneKeys = {
|
|
8
|
+
neutral: 'Neutral',
|
|
9
|
+
brand: 'Brand',
|
|
10
|
+
danger: 'Danger'
|
|
11
|
+
};
|
|
12
|
+
const styles = stylex.create({
|
|
13
|
+
badge: {
|
|
14
|
+
display: 'inline-flex',
|
|
15
|
+
flexShrink: 0,
|
|
16
|
+
gap: space.xs,
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
paddingInline: controls.paddingXs,
|
|
20
|
+
borderRadius: radii.sm
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const sizes = stylex.create({
|
|
24
|
+
sm: {
|
|
25
|
+
height: lineHeights.caption,
|
|
26
|
+
fontSize: fontSizes.captionBase,
|
|
27
|
+
lineHeight: lineHeights.caption
|
|
28
|
+
},
|
|
29
|
+
md: {
|
|
30
|
+
height: lineHeights.bodySm,
|
|
31
|
+
fontSize: fontSizes.captionLg,
|
|
32
|
+
lineHeight: lineHeights.caption
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const looks = stylex.create({
|
|
36
|
+
primaryNeutral: {
|
|
37
|
+
color: colors.onInvertedForeground,
|
|
38
|
+
backgroundColor: colors.invertedSolid
|
|
39
|
+
},
|
|
40
|
+
primaryBrand: {
|
|
41
|
+
color: colors.onBrandSolidForeground,
|
|
42
|
+
backgroundColor: colors.brandSolid
|
|
43
|
+
},
|
|
44
|
+
primaryDanger: {
|
|
45
|
+
color: colors.onDangerSolidForeground,
|
|
46
|
+
backgroundColor: colors.dangerSolid
|
|
47
|
+
},
|
|
48
|
+
tertiaryNeutral: {
|
|
49
|
+
color: colors.secondaryForeground,
|
|
50
|
+
backgroundColor: colors.component
|
|
51
|
+
},
|
|
52
|
+
tertiaryBrand: {
|
|
53
|
+
color: colors.onBrandSubtleForeground,
|
|
54
|
+
backgroundColor: colors.brandSubtle
|
|
55
|
+
},
|
|
56
|
+
tertiaryDanger: {
|
|
57
|
+
color: colors.dangerText,
|
|
58
|
+
backgroundColor: colors.dangerSubtleHover
|
|
59
|
+
},
|
|
60
|
+
outlineNeutral: {
|
|
61
|
+
color: colors.secondaryForeground,
|
|
62
|
+
backgroundColor: 'transparent',
|
|
63
|
+
boxShadow: `inset 0 0 0 ${borders.thin} ${colors.borderDefault}`
|
|
64
|
+
},
|
|
65
|
+
outlineBrand: {
|
|
66
|
+
color: colors.brandForeground,
|
|
67
|
+
backgroundColor: 'transparent',
|
|
68
|
+
boxShadow: `inset 0 0 0 ${borders.thin} ${colors.brandBorderDefault}`
|
|
69
|
+
},
|
|
70
|
+
outlineDanger: {
|
|
71
|
+
color: colors.dangerForeground,
|
|
72
|
+
backgroundColor: 'transparent',
|
|
73
|
+
boxShadow: `inset 0 0 0 ${borders.thin} ${colors.dangerBorderDefault}`
|
|
74
|
+
},
|
|
75
|
+
transparentNeutral: {
|
|
76
|
+
color: colors.secondaryForeground,
|
|
77
|
+
backgroundColor: 'transparent'
|
|
78
|
+
},
|
|
79
|
+
transparentBrand: {
|
|
80
|
+
color: colors.brandForeground,
|
|
81
|
+
backgroundColor: 'transparent'
|
|
82
|
+
},
|
|
83
|
+
transparentDanger: {
|
|
84
|
+
color: colors.dangerForeground,
|
|
85
|
+
backgroundColor: 'transparent'
|
|
86
|
+
}
|
|
87
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AppPath } from '../registered.ts';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { IconName } from './icons.ts';
|
|
4
|
+
import type { Placement } from './Placement.ts';
|
|
5
|
+
import type { Size } from './Size.ts';
|
|
6
|
+
type ButtonProps = {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'transparent';
|
|
9
|
+
tone?: 'neutral' | 'brand' | 'danger';
|
|
10
|
+
size?: Size;
|
|
11
|
+
to?: AppPath;
|
|
12
|
+
href?: string;
|
|
13
|
+
icon?: IconName;
|
|
14
|
+
trailingIcon?: IconName;
|
|
15
|
+
shortcut?: readonly string[];
|
|
16
|
+
type?: 'button' | 'submit';
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
isPending?: boolean;
|
|
19
|
+
isFullWidth?: boolean;
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
style?: Placement;
|
|
22
|
+
};
|
|
23
|
+
export declare function Button({ children, variant, tone, size, to, href, icon, trailingIcon, shortcut, type, disabled, isPending, isFullWidth, onClick, style }: ButtonProps): import("react").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button as BaseButton } from '@base-ui/react/button';
|
|
3
|
+
import { Link as RouterLink } from 'react-router';
|
|
4
|
+
import * as stylex from '@stylexjs/stylex';
|
|
5
|
+
import { colors, controls, fontWeights, motion, shadows } from "../theme/tokens.stylex.js";
|
|
6
|
+
import { controlSizes, focusRing } from "./controlLook.js";
|
|
7
|
+
import { Icon } from "./Icon.js";
|
|
8
|
+
import { interact, textOf } from "./interaction.js";
|
|
9
|
+
import { Kbd } from "./Kbd.js";
|
|
10
|
+
import { Spinner } from "./Spinner.js";
|
|
11
|
+
export function Button({ children, variant = 'primary', tone = 'neutral', size = 'md', to, href, icon, trailingIcon, shortcut, type = 'button', disabled = false, isPending = false, isFullWidth = false, onClick, style }) {
|
|
12
|
+
const isDisabled = disabled || isPending;
|
|
13
|
+
const report = () => {
|
|
14
|
+
interact({ primitive: 'Button', event: 'click', label: textOf(children) });
|
|
15
|
+
onClick?.();
|
|
16
|
+
};
|
|
17
|
+
const className = stylex.props(styles.button, controlSizes[size], icon !== undefined && leadingIconSizes[size], trailingIcon !== undefined && trailingIconSizes[size], looks[`${variant}${toneKeys[tone]}`], !isDisabled && hovers[`${variant}${toneKeys[tone]}`], isDisabled && styles.disabled, isDisabled && variant === 'transparent' && styles.disabledTransparent, isFullWidth && styles.fullWidth, focusRing.visible, style).className;
|
|
18
|
+
const content = (_jsxs("span", { ...stylex.props(styles.stack), children: [_jsxs("span", { ...stylex.props(styles.content, isPending && styles.hidden), children: [icon === undefined ? null : _jsx(Icon, { name: icon, size: size }), _jsx("span", { ...stylex.props(styles.label, shortcut !== undefined && styles.labelBeforeShortcut), children: children }), trailingIcon === undefined ? null : (_jsx(Icon, { name: trailingIcon, size: size })), shortcut === undefined ? null : _jsx(Kbd, { keys: shortcut })] }), isPending ? (_jsx("span", { "aria-hidden": "true", ...stylex.props(styles.pending), children: _jsx(Spinner, { size: size }) })) : null] }));
|
|
19
|
+
if (href !== undefined) {
|
|
20
|
+
return (_jsx("a", { href: href, target: "_blank", rel: "noreferrer", onClick: report, className: className, children: content }));
|
|
21
|
+
}
|
|
22
|
+
if (to !== undefined) {
|
|
23
|
+
return (_jsx(RouterLink, { to: to, onClick: report, className: className, children: content }));
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(BaseButton, { type: type, disabled: isDisabled, focusableWhenDisabled: true, "aria-busy": isPending || undefined, onClick: report, className: className, children: content }));
|
|
26
|
+
}
|
|
27
|
+
const toneKeys = {
|
|
28
|
+
neutral: 'Neutral',
|
|
29
|
+
brand: 'Brand',
|
|
30
|
+
danger: 'Danger'
|
|
31
|
+
};
|
|
32
|
+
const styles = stylex.create({
|
|
33
|
+
button: {
|
|
34
|
+
position: 'relative',
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexShrink: 0,
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
minWidth: 0,
|
|
40
|
+
fontWeight: fontWeights.medium,
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
textDecoration: 'none',
|
|
43
|
+
touchAction: 'manipulation',
|
|
44
|
+
outlineOffset: 0,
|
|
45
|
+
transitionTimingFunction: motion.easeOut,
|
|
46
|
+
transitionDuration: motion.fast,
|
|
47
|
+
transitionProperty: 'color, background-color, transform'
|
|
48
|
+
},
|
|
49
|
+
fullWidth: {
|
|
50
|
+
justifyContent: 'flex-start',
|
|
51
|
+
width: '100%'
|
|
52
|
+
},
|
|
53
|
+
stack: {
|
|
54
|
+
display: 'grid',
|
|
55
|
+
flexGrow: 1,
|
|
56
|
+
gridTemplateColumns: 'minmax(0, 1fr)',
|
|
57
|
+
gap: 'inherit',
|
|
58
|
+
justifyContent: 'inherit',
|
|
59
|
+
minWidth: 0,
|
|
60
|
+
overflow: 'clip'
|
|
61
|
+
},
|
|
62
|
+
content: {
|
|
63
|
+
display: 'flex',
|
|
64
|
+
gridRowStart: 1,
|
|
65
|
+
gridColumnStart: 1,
|
|
66
|
+
gap: 'inherit',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'inherit',
|
|
69
|
+
minWidth: 0,
|
|
70
|
+
transitionTimingFunction: motion.easeOut,
|
|
71
|
+
transitionDuration: motion.base,
|
|
72
|
+
transitionProperty: 'opacity, transform'
|
|
73
|
+
},
|
|
74
|
+
hidden: {
|
|
75
|
+
opacity: 0,
|
|
76
|
+
transform: 'translateY(24px)'
|
|
77
|
+
},
|
|
78
|
+
pending: {
|
|
79
|
+
display: 'flex',
|
|
80
|
+
gridRowStart: 1,
|
|
81
|
+
gridColumnStart: 1,
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
pointerEvents: 'none'
|
|
85
|
+
},
|
|
86
|
+
label: {
|
|
87
|
+
overflow: 'hidden',
|
|
88
|
+
textOverflow: 'ellipsis'
|
|
89
|
+
},
|
|
90
|
+
labelBeforeShortcut: {
|
|
91
|
+
flexGrow: 1,
|
|
92
|
+
textAlign: 'start'
|
|
93
|
+
},
|
|
94
|
+
disabled: {
|
|
95
|
+
color: colors.disabledForeground,
|
|
96
|
+
backgroundColor: colors.disabled,
|
|
97
|
+
boxShadow: 'none'
|
|
98
|
+
},
|
|
99
|
+
disabledTransparent: {
|
|
100
|
+
backgroundColor: 'transparent'
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const leadingIconSizes = stylex.create({
|
|
104
|
+
xs: { paddingInlineStart: `calc(${controls.paddingXs} - 2px)` },
|
|
105
|
+
sm: { paddingInlineStart: `calc(${controls.paddingSm} - 2px)` },
|
|
106
|
+
md: { paddingInlineStart: `calc(${controls.paddingMd} - 4px)` },
|
|
107
|
+
lg: { paddingInlineStart: `calc(${controls.paddingLg} - 2px)` },
|
|
108
|
+
xl: { paddingInlineStart: `calc(${controls.paddingXl} - 4px)` }
|
|
109
|
+
});
|
|
110
|
+
const trailingIconSizes = stylex.create({
|
|
111
|
+
xs: { paddingInlineEnd: `calc(${controls.paddingXs} - 2px)` },
|
|
112
|
+
sm: { paddingInlineEnd: `calc(${controls.paddingSm} - 2px)` },
|
|
113
|
+
md: { paddingInlineEnd: `calc(${controls.paddingMd} - 4px)` },
|
|
114
|
+
lg: { paddingInlineEnd: `calc(${controls.paddingLg} - 2px)` },
|
|
115
|
+
xl: { paddingInlineEnd: `calc(${controls.paddingXl} - 4px)` }
|
|
116
|
+
});
|
|
117
|
+
const looks = stylex.create({
|
|
118
|
+
primaryNeutral: {
|
|
119
|
+
color: colors.onInvertedForeground,
|
|
120
|
+
backgroundColor: colors.invertedSolid
|
|
121
|
+
},
|
|
122
|
+
primaryBrand: {
|
|
123
|
+
color: colors.onBrandSolidForeground,
|
|
124
|
+
backgroundColor: colors.brandSolid
|
|
125
|
+
},
|
|
126
|
+
primaryDanger: {
|
|
127
|
+
color: colors.onDangerSolidForeground,
|
|
128
|
+
backgroundColor: colors.dangerSolid
|
|
129
|
+
},
|
|
130
|
+
secondaryNeutral: {
|
|
131
|
+
color: colors.primaryForeground,
|
|
132
|
+
backgroundColor: colors.componentOnContainerStrong,
|
|
133
|
+
boxShadow: shadows.default
|
|
134
|
+
},
|
|
135
|
+
secondaryBrand: {
|
|
136
|
+
color: colors.brandForeground,
|
|
137
|
+
backgroundColor: colors.componentOnContainerStrong,
|
|
138
|
+
boxShadow: shadows.default
|
|
139
|
+
},
|
|
140
|
+
secondaryDanger: {
|
|
141
|
+
color: colors.dangerForeground,
|
|
142
|
+
backgroundColor: colors.componentOnContainerStrong,
|
|
143
|
+
boxShadow: shadows.default
|
|
144
|
+
},
|
|
145
|
+
tertiaryNeutral: {
|
|
146
|
+
color: colors.secondaryForeground,
|
|
147
|
+
backgroundColor: colors.component
|
|
148
|
+
},
|
|
149
|
+
tertiaryBrand: {
|
|
150
|
+
color: colors.onBrandSubtleForeground,
|
|
151
|
+
backgroundColor: colors.brandSubtle
|
|
152
|
+
},
|
|
153
|
+
tertiaryDanger: {
|
|
154
|
+
color: colors.dangerForeground,
|
|
155
|
+
backgroundColor: colors.dangerSubtle
|
|
156
|
+
},
|
|
157
|
+
transparentNeutral: {
|
|
158
|
+
color: colors.secondaryForeground,
|
|
159
|
+
backgroundColor: 'transparent'
|
|
160
|
+
},
|
|
161
|
+
transparentBrand: {
|
|
162
|
+
color: colors.brandForeground,
|
|
163
|
+
backgroundColor: 'transparent'
|
|
164
|
+
},
|
|
165
|
+
transparentDanger: {
|
|
166
|
+
color: colors.dangerForeground,
|
|
167
|
+
backgroundColor: 'transparent'
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
const hovers = stylex.create({
|
|
171
|
+
primaryNeutral: {
|
|
172
|
+
backgroundColor: {
|
|
173
|
+
default: colors.invertedSolid,
|
|
174
|
+
':hover': colors.invertedSolidHover,
|
|
175
|
+
':active': colors.invertedSolidActive
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
primaryBrand: {
|
|
179
|
+
backgroundColor: {
|
|
180
|
+
default: colors.brandSolid,
|
|
181
|
+
':hover': colors.brandSolidHover,
|
|
182
|
+
':active': colors.brandSolidActive
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
primaryDanger: {
|
|
186
|
+
backgroundColor: {
|
|
187
|
+
default: colors.dangerSolid,
|
|
188
|
+
':hover': colors.dangerSolidHover,
|
|
189
|
+
':active': colors.dangerSolidActive
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
secondaryNeutral: {
|
|
193
|
+
backgroundColor: {
|
|
194
|
+
default: colors.componentOnContainerStrong,
|
|
195
|
+
':hover': colors.componentOnContainerStrongHover
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
secondaryBrand: {
|
|
199
|
+
backgroundColor: {
|
|
200
|
+
default: colors.componentOnContainerStrong,
|
|
201
|
+
':hover': colors.componentOnContainerStrongHover
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
secondaryDanger: {
|
|
205
|
+
backgroundColor: {
|
|
206
|
+
default: colors.componentOnContainerStrong,
|
|
207
|
+
':hover': colors.componentOnContainerStrongHover
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
tertiaryNeutral: {
|
|
211
|
+
backgroundColor: {
|
|
212
|
+
default: colors.component,
|
|
213
|
+
':hover': colors.componentHover,
|
|
214
|
+
':active': colors.componentActive
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
tertiaryBrand: {
|
|
218
|
+
backgroundColor: {
|
|
219
|
+
default: colors.brandSubtle,
|
|
220
|
+
':hover': colors.brandSubtleHover
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
tertiaryDanger: {
|
|
224
|
+
backgroundColor: {
|
|
225
|
+
default: colors.dangerSubtle,
|
|
226
|
+
':hover': colors.dangerSubtleHover,
|
|
227
|
+
':active': colors.dangerSubtleActive
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
transparentNeutral: {
|
|
231
|
+
color: {
|
|
232
|
+
default: colors.secondaryForeground,
|
|
233
|
+
':hover': colors.primaryForeground
|
|
234
|
+
},
|
|
235
|
+
backgroundColor: {
|
|
236
|
+
default: 'transparent',
|
|
237
|
+
':hover': colors.transparentHover
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
transparentBrand: {
|
|
241
|
+
backgroundColor: {
|
|
242
|
+
default: 'transparent',
|
|
243
|
+
':hover': colors.transparentHover
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
transparentDanger: {
|
|
247
|
+
backgroundColor: {
|
|
248
|
+
default: 'transparent',
|
|
249
|
+
':hover': colors.dangerSubtleHover
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from './Placement.ts';
|
|
3
|
+
type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
4
|
+
type CardProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
surface?: 'subtle' | 'strong' | 'container';
|
|
7
|
+
padding?: CardPadding;
|
|
8
|
+
paddingBlock?: CardPadding;
|
|
9
|
+
style?: Placement;
|
|
10
|
+
};
|
|
11
|
+
export declare function Card({ children, surface, padding, paddingBlock, style }: CardProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { colors, radii, shadows, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
export function Card({ children, surface = 'subtle', padding = 'lg', paddingBlock, style }) {
|
|
5
|
+
return (_jsx("div", { ...stylex.props(styles.card, surfaces[surface], paddings[padding], paddingBlock !== undefined && paddingBlocks[paddingBlock], style), children: children }));
|
|
6
|
+
}
|
|
7
|
+
const styles = stylex.create({
|
|
8
|
+
card: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
overflow: 'hidden',
|
|
12
|
+
borderRadius: radii.xxl,
|
|
13
|
+
boxShadow: shadows.default
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const surfaces = stylex.create({
|
|
17
|
+
subtle: {
|
|
18
|
+
backgroundColor: colors.componentOnContainerSubtle
|
|
19
|
+
},
|
|
20
|
+
strong: {
|
|
21
|
+
backgroundColor: colors.componentOnContainerStrong
|
|
22
|
+
},
|
|
23
|
+
container: {
|
|
24
|
+
backgroundColor: colors.container
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const paddings = stylex.create({
|
|
28
|
+
none: { padding: 0 },
|
|
29
|
+
sm: { padding: space.sm },
|
|
30
|
+
md: { padding: space.md },
|
|
31
|
+
lg: { padding: space.lg }
|
|
32
|
+
});
|
|
33
|
+
const paddingBlocks = stylex.create({
|
|
34
|
+
none: { paddingBlock: 0 },
|
|
35
|
+
sm: { paddingBlock: space.sm },
|
|
36
|
+
md: { paddingBlock: space.md },
|
|
37
|
+
lg: { paddingBlock: space.lg }
|
|
38
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IconName } from './icons.ts';
|
|
2
|
+
export type CommandMenuItem = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly group: string;
|
|
6
|
+
readonly icon: IconName;
|
|
7
|
+
readonly keys: readonly string[];
|
|
8
|
+
readonly isDanger: boolean;
|
|
9
|
+
};
|
|
10
|
+
type CommandMenuProps = {
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
13
|
+
query: string;
|
|
14
|
+
onQueryChange: (query: string) => void;
|
|
15
|
+
results: readonly CommandMenuItem[];
|
|
16
|
+
highlighted: string | null;
|
|
17
|
+
onHighlight: (id: string) => void;
|
|
18
|
+
onMove: (by: 1 | -1) => void;
|
|
19
|
+
onRun: (id: string) => void;
|
|
20
|
+
onSubmit: () => void;
|
|
21
|
+
};
|
|
22
|
+
export declare function CommandMenu({ isOpen, onOpenChange, query, onQueryChange, results, highlighted, onHighlight, onMove, onRun, onSubmit }: CommandMenuProps): import("react").JSX.Element;
|
|
23
|
+
export {};
|