@trypattern/sdk 0.0.0-stage → 0.1.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/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 +20 -0
- package/dist/api.js +34 -0
- package/dist/app.d.ts +106 -0
- package/dist/app.js +224 -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/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 +24 -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 +1329 -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/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 +23 -0
- package/dist/components/Button.js +249 -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/Dialog.d.ts +11 -0
- package/dist/components/Dialog.js +81 -0
- package/dist/components/Divider.d.ts +6 -0
- package/dist/components/Divider.js +15 -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 +9 -0
- package/dist/components/Link.js +35 -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/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 +138 -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 +71 -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 +60 -0
- package/dist/components/controlLook.js +67 -0
- package/dist/components/frame.d.ts +4 -0
- package/dist/components/frame.js +2 -0
- package/dist/components/icons.d.ts +58 -0
- package/dist/components/icons.js +105 -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 +151 -0
- package/dist/flows/browser.d.ts +32 -0
- package/dist/flows/browser.js +164 -0
- package/dist/flows/contactSheet.d.ts +1 -0
- package/dist/flows/contactSheet.js +63 -0
- package/dist/flows/flowBrowser.d.ts +23 -0
- package/dist/flows/flowBrowser.js +21 -0
- package/dist/flows/flowSetup.d.ts +3 -0
- package/dist/flows/flowSetup.js +35 -0
- package/dist/flows/flows.d.ts +41 -0
- package/dist/flows/flows.js +148 -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 +14 -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 +40 -0
- package/dist/index.js +19 -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/react.d.ts +46 -0
- package/dist/react.js +38 -0
- package/dist/registered.d.ts +54 -0
- package/dist/registered.js +17 -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 +741 -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 +1157 -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 +2 -0
- package/dist/schema.js +1 -0
- package/dist/server/auth.d.ts +115 -0
- package/dist/server/auth.js +131 -0
- package/dist/server/authService.d.ts +9 -0
- package/dist/server/authService.js +50 -0
- package/dist/server/createServer.d.ts +357 -0
- package/dist/server/createServer.js +62 -0
- package/dist/server/env.d.ts +15 -0
- package/dist/server/env.js +1 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +5 -0
- package/dist/server/session.d.ts +28 -0
- package/dist/server/session.js +54 -0
- package/dist/server/sessions.d.ts +92 -0
- package/dist/server/sessions.js +47 -0
- package/dist/server/signInWire.d.ts +52 -0
- package/dist/server/signInWire.js +22 -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/shortcuts.d.ts +3 -0
- package/dist/shortcuts.js +40 -0
- package/dist/start.d.ts +20 -0
- package/dist/start.js +121 -0
- package/dist/state.d.ts +14 -0
- package/dist/state.js +17 -0
- package/dist/store.d.ts +43 -0
- package/dist/store.js +198 -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 +59 -0
- package/dist/vite/rootAlias.d.ts +2 -0
- package/dist/vite/rootAlias.js +15 -0
- package/dist/vite/vite.d.ts +7 -0
- package/dist/vite/vite.js +88 -0
- package/dist/wire.d.ts +7 -0
- package/dist/wire.js +1 -0
- package/package.json +99 -3
- package/presets/lintPlugin.js +7 -0
- package/presets/oxlint.json +167 -0
- package/presets/register.d.ts +19 -0
- package/presets/server.d.ts +2 -0
- package/presets/tsconfig.app.json +29 -0
- package/presets/tsconfig.server.json +27 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { colors, layers, motion, radii, shadows } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { interact } from "./interaction.js";
|
|
6
|
+
export function Dialog({ label, isOpen, onOpenChange, placement = 'center', size = 'md', children }) {
|
|
7
|
+
return (_jsx(BaseDialog.Root, { open: isOpen, onOpenChange: (next) => {
|
|
8
|
+
interact({
|
|
9
|
+
primitive: 'Dialog',
|
|
10
|
+
event: next ? 'open' : 'close',
|
|
11
|
+
label
|
|
12
|
+
});
|
|
13
|
+
onOpenChange(next);
|
|
14
|
+
}, children: _jsxs(BaseDialog.Portal, { children: [placement === 'center' ? (_jsx(BaseDialog.Backdrop, { className: (state) => stylex.props(styles.backdrop, (!state.open || state.transitionStatus === 'starting') &&
|
|
15
|
+
styles.backdropHidden).className })) : null, _jsx(BaseDialog.Popup, { "aria-label": label, className: (state) => stylex.props(styles.popup, placements[placement], widths[size], (!state.open || state.transitionStatus === 'starting') &&
|
|
16
|
+
hiddenPlacements[placement], !state.open && styles.exiting).className, children: _jsx("div", { ...stylex.props(styles.frame), children: children }) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
const styles = stylex.create({
|
|
19
|
+
backdrop: {
|
|
20
|
+
position: 'fixed',
|
|
21
|
+
inset: 0,
|
|
22
|
+
zIndex: layers.dialog,
|
|
23
|
+
backgroundColor: colors.overlay,
|
|
24
|
+
transitionTimingFunction: motion.easeInOut,
|
|
25
|
+
transitionDuration: motion.base,
|
|
26
|
+
transitionProperty: 'opacity'
|
|
27
|
+
},
|
|
28
|
+
backdropHidden: {
|
|
29
|
+
opacity: 0
|
|
30
|
+
},
|
|
31
|
+
popup: {
|
|
32
|
+
position: 'fixed',
|
|
33
|
+
left: '50%',
|
|
34
|
+
zIndex: layers.dialog,
|
|
35
|
+
width: '100%',
|
|
36
|
+
outline: 'none',
|
|
37
|
+
transitionTimingFunction: motion.easeInOut,
|
|
38
|
+
transitionDuration: motion.base,
|
|
39
|
+
transitionProperty: 'opacity, transform'
|
|
40
|
+
},
|
|
41
|
+
exiting: {
|
|
42
|
+
transitionTimingFunction: motion.easeOut,
|
|
43
|
+
transitionDuration: motion.exit
|
|
44
|
+
},
|
|
45
|
+
frame: {
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column',
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
color: colors.primaryForeground,
|
|
50
|
+
backgroundColor: colors.componentOnSunken,
|
|
51
|
+
borderRadius: radii.xxxl,
|
|
52
|
+
boxShadow: shadows.extraLarge
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const placements = stylex.create({
|
|
56
|
+
top: {
|
|
57
|
+
top: '20vh',
|
|
58
|
+
transform: 'translateX(-50%)'
|
|
59
|
+
},
|
|
60
|
+
center: {
|
|
61
|
+
top: '50%',
|
|
62
|
+
transform: 'translate(-50%, -50%)'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const hiddenPlacements = stylex.create({
|
|
66
|
+
top: {
|
|
67
|
+
pointerEvents: 'none',
|
|
68
|
+
opacity: 0,
|
|
69
|
+
transform: 'translateX(-50%) scale(0.95)'
|
|
70
|
+
},
|
|
71
|
+
center: {
|
|
72
|
+
pointerEvents: 'none',
|
|
73
|
+
opacity: 0,
|
|
74
|
+
transform: 'translate(-50%, -50%) scale(0.95)'
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const widths = stylex.create({
|
|
78
|
+
sm: { maxWidth: 'min(400px, calc(100% - 2rem))' },
|
|
79
|
+
md: { maxWidth: 'min(560px, calc(100% - 2rem))' },
|
|
80
|
+
lg: { maxWidth: 'min(720px, calc(100% - 2rem))' }
|
|
81
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Separator } from '@base-ui/react/separator';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { borders, colors } from "../theme/tokens.stylex.js";
|
|
5
|
+
export function Divider({ style }) {
|
|
6
|
+
return _jsx(Separator, { className: stylex.props(styles.divider, style).className });
|
|
7
|
+
}
|
|
8
|
+
const styles = stylex.create({
|
|
9
|
+
divider: {
|
|
10
|
+
flexShrink: 0,
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: borders.hairline,
|
|
13
|
+
backgroundColor: colors.divider
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { space } from "../theme/tokens.stylex.js";
|
|
4
|
+
import { Text } from "./Text.js";
|
|
5
|
+
export function EmptyState({ title, description, action }) {
|
|
6
|
+
return (_jsxs("div", { ...stylex.props(styles.empty), children: [_jsxs("div", { ...stylex.props(styles.words), children: [_jsx(Text, { variant: "label", tone: "primary", align: "center", children: title }), description === undefined ? null : (_jsx(Text, { tone: "secondary", align: "center", children: description }))] }), action] }));
|
|
7
|
+
}
|
|
8
|
+
const styles = stylex.create({
|
|
9
|
+
empty: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
gap: space.md,
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
minHeight: '100%',
|
|
16
|
+
padding: space.xxxl
|
|
17
|
+
},
|
|
18
|
+
words: {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
gap: space.xxs,
|
|
22
|
+
alignItems: 'center'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SpaceName } from './spacing.ts';
|
|
3
|
+
type FormProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
gap?: SpaceName;
|
|
6
|
+
onSubmit: (values: Record<string, string>) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function Form({ children, gap, onSubmit }: FormProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { interact } from "./interaction.js";
|
|
4
|
+
import { gaps } from "./spacing.js";
|
|
5
|
+
export function Form({ children, gap = 'sm', onSubmit }) {
|
|
6
|
+
const submit = (event) => {
|
|
7
|
+
event.preventDefault();
|
|
8
|
+
const values = Object.fromEntries([...new FormData(event.currentTarget)].flatMap(([name, value]) => typeof value === 'string' ? [[name, value.trim()]] : []));
|
|
9
|
+
interact({
|
|
10
|
+
primitive: 'Form',
|
|
11
|
+
event: 'submit',
|
|
12
|
+
label: Object.keys(values).join(', ')
|
|
13
|
+
});
|
|
14
|
+
onSubmit(values);
|
|
15
|
+
};
|
|
16
|
+
return (_jsx("form", { onSubmit: submit, ...stylex.props(styles.form, gaps[gap]), children: children }));
|
|
17
|
+
}
|
|
18
|
+
const styles = stylex.create({
|
|
19
|
+
form: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IconName } from './icons.ts';
|
|
2
|
+
import type { Size } from './Size.ts';
|
|
3
|
+
import type { Tone } from './tones.ts';
|
|
4
|
+
type IconProps = {
|
|
5
|
+
name: IconName;
|
|
6
|
+
size?: Size;
|
|
7
|
+
tone?: Tone;
|
|
8
|
+
};
|
|
9
|
+
export declare function Icon({ name, size, tone }: IconProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { iconSizes } from "../theme/tokens.stylex.js";
|
|
4
|
+
import { shapeOf } from "./icons.js";
|
|
5
|
+
import { tones } from "./tones.js";
|
|
6
|
+
export function Icon({ name, size = 'md', tone = 'inherit' }) {
|
|
7
|
+
const shape = shapeOf(name);
|
|
8
|
+
return (_jsx("svg", { viewBox: "0 0 24 24", fill: shape.isFilled ? 'currentColor' : 'none', fillRule: shape.rule, stroke: shape.isFilled ? 'none' : 'currentColor', strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...stylex.props(styles.icon, sizes[size], tones[tone]), children: shape.paths.map((path) => (_jsx("path", { d: path }, path))) }));
|
|
9
|
+
}
|
|
10
|
+
const styles = stylex.create({
|
|
11
|
+
icon: {
|
|
12
|
+
display: 'block',
|
|
13
|
+
flexShrink: 0
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const sizes = stylex.create({
|
|
17
|
+
xs: { width: iconSizes.xs, height: iconSizes.xs },
|
|
18
|
+
sm: { width: iconSizes.sm, height: iconSizes.sm },
|
|
19
|
+
md: { width: iconSizes.md, height: iconSizes.md },
|
|
20
|
+
lg: { width: iconSizes.lg, height: iconSizes.lg },
|
|
21
|
+
xl: { width: iconSizes.xl, height: iconSizes.xl }
|
|
22
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IconName } from './icons.ts';
|
|
2
|
+
import type { Placement } from './Placement.ts';
|
|
3
|
+
import type { Size } from './Size.ts';
|
|
4
|
+
type IconButtonProps = {
|
|
5
|
+
icon: IconName;
|
|
6
|
+
label: string;
|
|
7
|
+
size?: Size;
|
|
8
|
+
shortcut?: readonly string[];
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
style?: Placement;
|
|
12
|
+
};
|
|
13
|
+
export declare function IconButton({ icon, label, size, shortcut, disabled, onClick, style }: IconButtonProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button as BaseButton } from '@base-ui/react/button';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { colors, controls, radii } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { transparentLook } from "./controlLook.js";
|
|
6
|
+
import { Icon } from "./Icon.js";
|
|
7
|
+
import { interact } from "./interaction.js";
|
|
8
|
+
import { Tooltip } from "./Tooltip.js";
|
|
9
|
+
export function IconButton({ icon, label, size = 'md', shortcut, disabled = false, onClick, style }) {
|
|
10
|
+
return (_jsx(Tooltip, { label: label, shortcut: shortcut, children: _jsx(BaseButton, { "aria-label": label, disabled: disabled, focusableWhenDisabled: true, onClick: () => {
|
|
11
|
+
interact({ primitive: 'IconButton', event: 'click', label });
|
|
12
|
+
onClick();
|
|
13
|
+
}, className: stylex.props(styles.button, sizes[size], transparentLook.rest, !disabled && transparentLook.hoverable, disabled && styles.disabled, style).className, children: _jsx(Icon, { name: icon, size: size }) }) }));
|
|
14
|
+
}
|
|
15
|
+
const styles = stylex.create({
|
|
16
|
+
button: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexShrink: 0,
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
outlineOffset: 0
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
color: colors.disabledForeground
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const sizes = stylex.create({
|
|
28
|
+
xs: {
|
|
29
|
+
width: controls.heightXs,
|
|
30
|
+
height: controls.heightXs,
|
|
31
|
+
borderRadius: radii.sm
|
|
32
|
+
},
|
|
33
|
+
sm: {
|
|
34
|
+
width: controls.heightSm,
|
|
35
|
+
height: controls.heightSm,
|
|
36
|
+
borderRadius: radii.md
|
|
37
|
+
},
|
|
38
|
+
md: {
|
|
39
|
+
width: controls.heightMd,
|
|
40
|
+
height: controls.heightMd,
|
|
41
|
+
borderRadius: radii.md
|
|
42
|
+
},
|
|
43
|
+
lg: {
|
|
44
|
+
width: controls.heightLg,
|
|
45
|
+
height: controls.heightLg,
|
|
46
|
+
borderRadius: radii.lg
|
|
47
|
+
},
|
|
48
|
+
xl: {
|
|
49
|
+
width: controls.heightXl,
|
|
50
|
+
height: controls.heightXl,
|
|
51
|
+
borderRadius: radii.lg
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { isApplePlatform } from "../platform.js";
|
|
4
|
+
import { borders, breakpoints, colors, controls, fontFeatures, fontSizes, fontWeights, lineHeights, radii, space } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { Icon } from "./Icon.js";
|
|
6
|
+
export function Kbd({ keys, surface = 'default' }) {
|
|
7
|
+
return (_jsx("span", { "aria-hidden": "true", ...stylex.props(styles.keys), children: keys.map((key, index) => {
|
|
8
|
+
const icon = keyIcons[key];
|
|
9
|
+
const symbol = symbolFor(key);
|
|
10
|
+
return (_jsx("kbd", { ...stylex.props(styles.key, surface === 'standout' && styles.standout, icon === undefined && symbol.length > 1 && styles.word), children: icon === undefined ? symbol : _jsx(Icon, { name: icon, size: "xs" }) }, `${index}-${key}`));
|
|
11
|
+
}) }));
|
|
12
|
+
}
|
|
13
|
+
const keyIcons = {
|
|
14
|
+
enter: 'enter',
|
|
15
|
+
arrowup: 'arrowUp',
|
|
16
|
+
arrowdown: 'arrowDown'
|
|
17
|
+
};
|
|
18
|
+
const keyWords = {
|
|
19
|
+
escape: 'esc',
|
|
20
|
+
tab: 'tab'
|
|
21
|
+
};
|
|
22
|
+
function symbolFor(key) {
|
|
23
|
+
if (key === 'mod')
|
|
24
|
+
return isApplePlatform() ? '⌘' : 'ctrl';
|
|
25
|
+
return keyWords[key] ?? key;
|
|
26
|
+
}
|
|
27
|
+
const styles = stylex.create({
|
|
28
|
+
keys: {
|
|
29
|
+
display: {
|
|
30
|
+
default: 'flex',
|
|
31
|
+
[breakpoints.coarsePointer]: 'none'
|
|
32
|
+
},
|
|
33
|
+
flexShrink: 0,
|
|
34
|
+
gap: space.xxs,
|
|
35
|
+
alignItems: 'center'
|
|
36
|
+
},
|
|
37
|
+
key: {
|
|
38
|
+
display: 'inline-flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
minWidth: lineHeights.caption,
|
|
42
|
+
height: lineHeights.caption,
|
|
43
|
+
fontFamily: 'inherit',
|
|
44
|
+
fontSize: fontSizes.captionBase,
|
|
45
|
+
fontWeight: fontWeights.medium,
|
|
46
|
+
fontFeatureSettings: fontFeatures.kbd,
|
|
47
|
+
lineHeight: lineHeights.caption,
|
|
48
|
+
color: colors.secondaryForeground,
|
|
49
|
+
textTransform: 'uppercase',
|
|
50
|
+
pointerEvents: 'none',
|
|
51
|
+
backgroundColor: colors.component,
|
|
52
|
+
borderColor: colors.borderDefault,
|
|
53
|
+
borderStyle: 'solid',
|
|
54
|
+
borderWidth: borders.hairline,
|
|
55
|
+
borderRadius: radii.sm
|
|
56
|
+
},
|
|
57
|
+
standout: {
|
|
58
|
+
color: colors.onStandoutSecondaryForeground,
|
|
59
|
+
backgroundColor: colors.borderOnStandout,
|
|
60
|
+
borderColor: colors.borderOnStandout
|
|
61
|
+
},
|
|
62
|
+
word: {
|
|
63
|
+
paddingBlockEnd: space.xxs,
|
|
64
|
+
paddingInline: controls.paddingXs,
|
|
65
|
+
textTransform: 'lowercase'
|
|
66
|
+
}
|
|
67
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AppPath } from '../registered.ts';
|
|
3
|
+
type LinkProps = {
|
|
4
|
+
to: AppPath;
|
|
5
|
+
tone?: 'brand' | 'secondary';
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare function Link({ to, tone, children }: LinkProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { Link as RouterLink } from 'react-router';
|
|
4
|
+
import { colors, motion, radii } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { interact, textOf } from "./interaction.js";
|
|
6
|
+
export function Link({ to, tone = 'brand', children }) {
|
|
7
|
+
return (_jsx(RouterLink, { to: to, onClick: () => interact({
|
|
8
|
+
primitive: 'Link',
|
|
9
|
+
event: 'navigate',
|
|
10
|
+
label: textOf(children) || to
|
|
11
|
+
}), ...stylex.props(styles.link, looks[tone]), children: children }));
|
|
12
|
+
}
|
|
13
|
+
const styles = stylex.create({
|
|
14
|
+
link: {
|
|
15
|
+
textDecoration: 'none',
|
|
16
|
+
borderRadius: radii.xs,
|
|
17
|
+
transitionTimingFunction: motion.easeOut,
|
|
18
|
+
transitionDuration: motion.fast,
|
|
19
|
+
transitionProperty: 'color'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const looks = stylex.create({
|
|
23
|
+
brand: {
|
|
24
|
+
color: {
|
|
25
|
+
default: colors.brandForeground,
|
|
26
|
+
':hover': colors.brandSolidHover
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
secondary: {
|
|
30
|
+
color: {
|
|
31
|
+
default: colors.secondaryForeground,
|
|
32
|
+
':hover': colors.primaryForeground
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AppPath } from '../registered.ts';
|
|
3
|
+
type ListRowProps = {
|
|
4
|
+
to?: AppPath;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
isMuted?: boolean;
|
|
7
|
+
leading?: ReactNode;
|
|
8
|
+
trailing?: ReactNode;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare function ListRow({ to, onClick, isMuted, leading, trailing, children }: ListRowProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button as BaseButton } from '@base-ui/react/button';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { Link as RouterLink } from 'react-router';
|
|
5
|
+
import { colors, controls, radii, space } from "../theme/tokens.stylex.js";
|
|
6
|
+
import { interact, textOf } from "./interaction.js";
|
|
7
|
+
export function ListRow({ to, onClick, isMuted = false, leading, trailing, children }) {
|
|
8
|
+
const content = (_jsxs(_Fragment, { children: [leading, _jsx("span", { ...stylex.props(styles.main), children: children }), trailing === undefined ? null : (_jsx("span", { ...stylex.props(styles.trailing), children: trailing }))] }));
|
|
9
|
+
const look = stylex.props(styles.row, (to !== undefined || onClick !== undefined) && styles.interactive, isMuted && styles.muted);
|
|
10
|
+
const report = () => {
|
|
11
|
+
interact({
|
|
12
|
+
primitive: 'ListRow',
|
|
13
|
+
event: to === undefined ? 'click' : 'navigate',
|
|
14
|
+
label: textOf(children) || (to ?? '')
|
|
15
|
+
});
|
|
16
|
+
onClick?.();
|
|
17
|
+
};
|
|
18
|
+
if (to !== undefined) {
|
|
19
|
+
return (_jsx(RouterLink, { to: to, onClick: report, ...look, children: content }));
|
|
20
|
+
}
|
|
21
|
+
if (onClick !== undefined) {
|
|
22
|
+
return (_jsx(BaseButton, { onClick: report, className: look.className, children: content }));
|
|
23
|
+
}
|
|
24
|
+
return _jsx("div", { ...look, children: content });
|
|
25
|
+
}
|
|
26
|
+
const styles = stylex.create({
|
|
27
|
+
row: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
gap: space.md,
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
width: '100%',
|
|
32
|
+
height: controls.heightXl,
|
|
33
|
+
paddingInline: space.md,
|
|
34
|
+
color: colors.primaryForeground,
|
|
35
|
+
textAlign: 'start',
|
|
36
|
+
textDecoration: 'none',
|
|
37
|
+
outlineOffset: -2,
|
|
38
|
+
borderRadius: radii.md
|
|
39
|
+
},
|
|
40
|
+
interactive: {
|
|
41
|
+
backgroundColor: {
|
|
42
|
+
default: 'transparent',
|
|
43
|
+
':hover': colors.transparentHover
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
muted: {
|
|
47
|
+
color: colors.tertiaryForeground
|
|
48
|
+
},
|
|
49
|
+
main: {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flexGrow: 1,
|
|
52
|
+
gap: space.sm,
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
minWidth: 0
|
|
55
|
+
},
|
|
56
|
+
trailing: {
|
|
57
|
+
display: 'flex',
|
|
58
|
+
flexShrink: 0,
|
|
59
|
+
gap: space.sm,
|
|
60
|
+
alignItems: 'center'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ListRow } from "./ListRow.js";
|
|
3
|
+
import { Skeleton } from "./Skeleton.js";
|
|
4
|
+
export function LoadingRows({ count }) {
|
|
5
|
+
return Array.from({ length: count }, (_, row) => (_jsx(ListRow, { leading: _jsx(Skeleton, { variant: "icon" }), children: _jsx(Skeleton, { width: "md" }) }, row)));
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { MenuEntry } from './MenuItems.tsx';
|
|
3
|
+
import type { Placement } from './Placement.ts';
|
|
4
|
+
import type { Size } from './Size.ts';
|
|
5
|
+
type MenuProps = {
|
|
6
|
+
trigger: ReactNode;
|
|
7
|
+
items: readonly MenuEntry[];
|
|
8
|
+
size?: Size;
|
|
9
|
+
style?: Placement;
|
|
10
|
+
};
|
|
11
|
+
export declare function Menu({ trigger, items, size, style }: MenuProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { colors, controls, layers, space } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { controlSizes, transparentLook } from "./controlLook.js";
|
|
6
|
+
import { MenuItems } from "./MenuItems.js";
|
|
7
|
+
import { Popup } from "./Popup.js";
|
|
8
|
+
export function Menu({ trigger, items, size = 'md', style }) {
|
|
9
|
+
return (_jsxs(BaseMenu.Root, { children: [_jsx(BaseMenu.Trigger, { className: (state) => stylex.props(styles.trigger, controlSizes[size], triggerPaddings[size], transparentLook.rest, transparentLook.hoverable, state.open && transparentLook.open, styles.triggerText, style).className, children: trigger }), _jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { side: "bottom", align: "start", sideOffset: 4, className: stylex.props(styles.positioner).className, children: _jsx(BaseMenu.Popup, { render: (props, state) => (_jsx(Popup, { ...props, kind: "menu", isOpen: state.open, transitionStatus: state.transitionStatus })), children: _jsx(MenuItems, { items: items, primitive: "Menu" }) }) }) })] }));
|
|
10
|
+
}
|
|
11
|
+
const styles = stylex.create({
|
|
12
|
+
trigger: {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
minWidth: 0,
|
|
16
|
+
outlineOffset: 0
|
|
17
|
+
},
|
|
18
|
+
triggerText: {
|
|
19
|
+
gap: space.sm,
|
|
20
|
+
color: colors.primaryForeground
|
|
21
|
+
},
|
|
22
|
+
positioner: {
|
|
23
|
+
zIndex: layers.menu,
|
|
24
|
+
outline: 'none'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const triggerPaddings = stylex.create({
|
|
28
|
+
xs: { paddingInline: `calc(${controls.paddingXs} - 2px)` },
|
|
29
|
+
sm: { paddingInline: `calc(${controls.paddingSm} - 2px)` },
|
|
30
|
+
md: { paddingInline: `calc(${controls.paddingMd} - 2px)` },
|
|
31
|
+
lg: { paddingInline: `calc(${controls.paddingLg} - 2px)` },
|
|
32
|
+
xl: { paddingInline: `calc(${controls.paddingXl} - 2px)` }
|
|
33
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppPath } from '../registered.ts';
|
|
2
|
+
import type { IconName } from './icons.ts';
|
|
3
|
+
type MenuAction = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: IconName;
|
|
7
|
+
isDanger?: boolean;
|
|
8
|
+
} & ({
|
|
9
|
+
onSelect: () => void;
|
|
10
|
+
to?: never;
|
|
11
|
+
} | {
|
|
12
|
+
to: AppPath;
|
|
13
|
+
onSelect?: never;
|
|
14
|
+
});
|
|
15
|
+
export type MenuEntry = MenuAction | 'separator';
|
|
16
|
+
type MenuItemsProps = {
|
|
17
|
+
items: readonly MenuEntry[];
|
|
18
|
+
primitive: 'Menu' | 'ContextMenu';
|
|
19
|
+
};
|
|
20
|
+
export declare function MenuItems({ items, primitive }: MenuItemsProps): import("react").JSX.Element[];
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
3
|
+
import { useNavigate } from 'react-router';
|
|
4
|
+
import * as stylex from '@stylexjs/stylex';
|
|
5
|
+
import { colors, space } from "../theme/tokens.stylex.js";
|
|
6
|
+
import { Divider } from "./Divider.js";
|
|
7
|
+
import { Icon } from "./Icon.js";
|
|
8
|
+
import { interact } from "./interaction.js";
|
|
9
|
+
import { PopupItem } from "./PopupItem.js";
|
|
10
|
+
export function MenuItems({ items, primitive }) {
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
return items.map((entry, index) => entry === 'separator' ? (_jsx(Divider, { style: styles.separator }, `separator-${index}`)) : (_jsxs(BaseMenu.Item, { onClick: () => {
|
|
13
|
+
interact({ primitive, event: 'select', label: entry.label });
|
|
14
|
+
if (entry.onSelect !== undefined)
|
|
15
|
+
entry.onSelect();
|
|
16
|
+
else
|
|
17
|
+
void navigate(entry.to);
|
|
18
|
+
}, render: (props, state) => (_jsx(PopupItem, { ...props, kind: "menu", isHighlighted: state.highlighted, isDanger: entry.isDanger ?? false })), children: [entry.icon === undefined ? null : (_jsx("span", { ...stylex.props(styles.icon, entry.isDanger && styles.dangerIcon), children: _jsx(Icon, { name: entry.icon }) })), entry.label] }, entry.id)));
|
|
19
|
+
}
|
|
20
|
+
const styles = stylex.create({
|
|
21
|
+
separator: {
|
|
22
|
+
marginBlock: space.xs,
|
|
23
|
+
marginInline: `calc(-1 * ${space.xs})`
|
|
24
|
+
},
|
|
25
|
+
icon: {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
color: colors.secondaryForeground
|
|
28
|
+
},
|
|
29
|
+
dangerIcon: {
|
|
30
|
+
color: 'inherit'
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StyleXStyles } from '@stylexjs/stylex';
|
|
2
|
+
export type PlacementProperties = {
|
|
3
|
+
display?: 'none' | null;
|
|
4
|
+
alignSelf?: string;
|
|
5
|
+
justifySelf?: string;
|
|
6
|
+
gridArea?: string;
|
|
7
|
+
gridColumn?: string;
|
|
8
|
+
gridRow?: string;
|
|
9
|
+
flexGrow?: number;
|
|
10
|
+
flexShrink?: number;
|
|
11
|
+
flexBasis?: number | string;
|
|
12
|
+
minWidth?: number | string;
|
|
13
|
+
maxWidth?: number | string;
|
|
14
|
+
marginBlock?: number | string;
|
|
15
|
+
marginBlockStart?: number | string;
|
|
16
|
+
marginBlockEnd?: number | string;
|
|
17
|
+
marginInline?: number | string;
|
|
18
|
+
marginInlineStart?: number | string;
|
|
19
|
+
marginInlineEnd?: number | string;
|
|
20
|
+
};
|
|
21
|
+
export type Placement = StyleXStyles<PlacementProperties>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
type PopupProps = Omit<ComponentPropsWithRef<'div'>, 'className' | 'style'> & {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
transitionStatus: 'starting' | 'ending' | 'idle' | undefined;
|
|
5
|
+
kind: 'menu' | 'select';
|
|
6
|
+
};
|
|
7
|
+
export declare function Popup({ isOpen, transitionStatus, kind, ...popupProps }: PopupProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|