@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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { use } from 'react';
|
|
4
|
+
import { borders, colors, controls, space } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { FrameContext } from "./frame.js";
|
|
6
|
+
import { Icon } from "./Icon.js";
|
|
7
|
+
import { IconButton } from "./IconButton.js";
|
|
8
|
+
import { Link } from "./Link.js";
|
|
9
|
+
import { ScrollArea } from "./ScrollArea.js";
|
|
10
|
+
import { Text } from "./Text.js";
|
|
11
|
+
export function Screen({ title, parent, actions, children }) {
|
|
12
|
+
const frame = use(FrameContext);
|
|
13
|
+
return (_jsxs("div", { ...stylex.props(styles.screen), children: [_jsxs("header", { ...stylex.props(styles.header), children: [_jsxs("div", { ...stylex.props(styles.leading), children: [frame === null ? null : (_jsx(IconButton, { icon: "panelLeft", label: "Toggle sidebar", onClick: frame.onToggleSidebar })), _jsxs("div", { ...stylex.props(styles.breadcrumb), children: [parent === undefined ? null : (_jsxs(_Fragment, { children: [_jsx(Link, { to: parent.to, tone: "secondary", children: parent.label }), _jsx(Icon, { name: "chevronRight", tone: "tertiary" })] })), _jsx(Text, { as: "h1", variant: "label", tone: "primary", isTruncated: true, children: title })] })] }), _jsx("div", { ...stylex.props(styles.actions), children: actions })] }), _jsx(ScrollArea, { style: styles.body, children: children })] }));
|
|
14
|
+
}
|
|
15
|
+
const styles = stylex.create({
|
|
16
|
+
screen: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
height: '100%'
|
|
20
|
+
},
|
|
21
|
+
header: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexShrink: 0,
|
|
24
|
+
gap: space.md,
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'space-between',
|
|
27
|
+
height: `calc(${controls.heightXl} + ${space.sm})`,
|
|
28
|
+
paddingInline: space.sm,
|
|
29
|
+
borderBottomColor: colors.borderDefault,
|
|
30
|
+
borderBottomStyle: 'solid',
|
|
31
|
+
borderBottomWidth: borders.hairline
|
|
32
|
+
},
|
|
33
|
+
leading: {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
gap: space.sm,
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
minWidth: 0
|
|
38
|
+
},
|
|
39
|
+
breadcrumb: {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
gap: space.xs,
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
minWidth: 0
|
|
44
|
+
},
|
|
45
|
+
actions: {
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
gap: space.sm,
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
paddingInlineEnd: space.xs
|
|
51
|
+
},
|
|
52
|
+
body: {
|
|
53
|
+
flexGrow: 1,
|
|
54
|
+
height: 'auto'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { breakpoints, colors, layers, motion } from "../theme/tokens.stylex.js";
|
|
5
|
+
export function Scrim({ label, isOpen, isAnimating, onClose }) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!isOpen)
|
|
8
|
+
return undefined;
|
|
9
|
+
const closeOnEscape = (event) => {
|
|
10
|
+
if (event.key === 'Escape')
|
|
11
|
+
onClose();
|
|
12
|
+
};
|
|
13
|
+
window.addEventListener('keydown', closeOnEscape);
|
|
14
|
+
return () => window.removeEventListener('keydown', closeOnEscape);
|
|
15
|
+
}, [isOpen, onClose]);
|
|
16
|
+
return (_jsx("button", { type: "button", "aria-label": label, tabIndex: -1, onClick: onClose, ...stylex.props(styles.scrim, isOpen && styles.visible, isAnimating && styles.animating) }));
|
|
17
|
+
}
|
|
18
|
+
const styles = stylex.create({
|
|
19
|
+
scrim: {
|
|
20
|
+
position: 'fixed',
|
|
21
|
+
inset: 0,
|
|
22
|
+
zIndex: layers.scrim,
|
|
23
|
+
display: {
|
|
24
|
+
default: 'none',
|
|
25
|
+
[breakpoints.compact]: 'block'
|
|
26
|
+
},
|
|
27
|
+
visibility: 'hidden',
|
|
28
|
+
backgroundColor: colors.overlay,
|
|
29
|
+
opacity: 0
|
|
30
|
+
},
|
|
31
|
+
animating: {
|
|
32
|
+
transitionTimingFunction: motion.slideEasing,
|
|
33
|
+
transitionDuration: motion.slide,
|
|
34
|
+
transitionProperty: 'opacity, visibility'
|
|
35
|
+
},
|
|
36
|
+
visible: {
|
|
37
|
+
visibility: 'visible',
|
|
38
|
+
opacity: 1
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StyleXStyles } from '@stylexjs/stylex';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { PlacementProperties } from './Placement.ts';
|
|
4
|
+
type ScrollAreaProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
style?: StyleXStyles<PlacementProperties & {
|
|
7
|
+
height?: number | string;
|
|
8
|
+
maxHeight?: number | string;
|
|
9
|
+
padding?: number | string;
|
|
10
|
+
paddingBlock?: number | string;
|
|
11
|
+
paddingInline?: number | string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
export declare function ScrollArea({ children, style }: ScrollAreaProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
export function ScrollArea({ children, style }) {
|
|
4
|
+
return _jsx("div", { ...stylex.props(styles.scroll, style), children: children });
|
|
5
|
+
}
|
|
6
|
+
const styles = stylex.create({
|
|
7
|
+
scroll: {
|
|
8
|
+
height: '100%',
|
|
9
|
+
minHeight: 0,
|
|
10
|
+
overflowY: 'auto',
|
|
11
|
+
overscrollBehavior: 'contain'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Placement } from './Placement.ts';
|
|
2
|
+
import type { Size } from './Size.ts';
|
|
3
|
+
export type SegmentedOption<Value extends string> = {
|
|
4
|
+
value: Value;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
type SegmentedControlProps<Value extends string> = {
|
|
8
|
+
label: string;
|
|
9
|
+
value: Value;
|
|
10
|
+
options: readonly SegmentedOption<Value>[];
|
|
11
|
+
size?: Size;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onChange: (value: Value) => void;
|
|
14
|
+
style?: Placement;
|
|
15
|
+
};
|
|
16
|
+
export declare function SegmentedControl<Value extends string>({ label, value, options, size, disabled, onChange, style }: SegmentedControlProps<Value>): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Radio } from '@base-ui/react/radio';
|
|
3
|
+
import { RadioGroup } from '@base-ui/react/radio-group';
|
|
4
|
+
import * as stylex from '@stylexjs/stylex';
|
|
5
|
+
import { borders, colors, fontWeights, motion, radii } from "../theme/tokens.stylex.js";
|
|
6
|
+
import { interact } from "./interaction.js";
|
|
7
|
+
import { controlSizes, focusRing } from "./controlLook.js";
|
|
8
|
+
export function SegmentedControl({ label, value, options, size = 'md', disabled = false, onChange, style }) {
|
|
9
|
+
const index = Math.max(0, options.findIndex((option) => option.value === value));
|
|
10
|
+
return (_jsxs(RadioGroup, { "aria-label": label, value: value, disabled: disabled, onValueChange: (next) => {
|
|
11
|
+
interact({ primitive: 'SegmentedControl', event: 'change', label });
|
|
12
|
+
onChange(next);
|
|
13
|
+
}, className: stylex.props(styles.group, style).className, children: [_jsx("span", { ...stylex.props(styles.indicator(index, options.length)) }), options.map((option) => (_jsx(Radio.Root, { value: option.value, className: (state) => stylex.props(styles.option, controlSizes[size], !disabled && styles.hoverable, state.checked && styles.optionChecked, disabled && styles.disabled, focusRing.visible).className, children: option.label }, option.value)))] }));
|
|
14
|
+
}
|
|
15
|
+
const styles = stylex.create({
|
|
16
|
+
group: {
|
|
17
|
+
position: 'relative',
|
|
18
|
+
display: 'grid',
|
|
19
|
+
gridAutoColumns: '1fr',
|
|
20
|
+
gridAutoFlow: 'column',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
fontWeight: fontWeights.medium,
|
|
23
|
+
backgroundColor: colors.component,
|
|
24
|
+
borderRadius: radii.md
|
|
25
|
+
},
|
|
26
|
+
indicator: (index, count) => ({
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
insetBlockStart: 0,
|
|
29
|
+
insetInlineStart: 0,
|
|
30
|
+
width: `calc(100% / ${count})`,
|
|
31
|
+
height: '100%',
|
|
32
|
+
pointerEvents: 'none',
|
|
33
|
+
backgroundColor: colors.componentOnContainerStrong,
|
|
34
|
+
borderColor: colors.indicatorBorder,
|
|
35
|
+
borderStyle: 'solid',
|
|
36
|
+
borderWidth: borders.thin,
|
|
37
|
+
borderRadius: radii.md,
|
|
38
|
+
transform: `translateX(${index * 100}%)`,
|
|
39
|
+
transitionTimingFunction: motion.easeOut,
|
|
40
|
+
transitionDuration: motion.base,
|
|
41
|
+
transitionProperty: 'transform'
|
|
42
|
+
}),
|
|
43
|
+
option: {
|
|
44
|
+
position: 'relative',
|
|
45
|
+
zIndex: 1,
|
|
46
|
+
display: 'inline-flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
color: colors.secondaryForeground,
|
|
50
|
+
whiteSpace: 'nowrap',
|
|
51
|
+
outlineOffset: 0,
|
|
52
|
+
transitionTimingFunction: motion.easeInOut,
|
|
53
|
+
transitionDuration: motion.base,
|
|
54
|
+
transitionProperty: 'color'
|
|
55
|
+
},
|
|
56
|
+
hoverable: {
|
|
57
|
+
color: {
|
|
58
|
+
default: colors.secondaryForeground,
|
|
59
|
+
':hover': colors.primaryForeground
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
optionChecked: {
|
|
63
|
+
color: colors.primaryForeground
|
|
64
|
+
},
|
|
65
|
+
disabled: {
|
|
66
|
+
color: colors.disabledForeground
|
|
67
|
+
}
|
|
68
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Placement } from './Placement.ts';
|
|
2
|
+
import type { Size } from './Size.ts';
|
|
3
|
+
export type SelectOption<Value extends string> = {
|
|
4
|
+
value: Value;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
type SelectProps<Value extends string> = {
|
|
8
|
+
label: string;
|
|
9
|
+
value: Value;
|
|
10
|
+
options: readonly SelectOption<Value>[];
|
|
11
|
+
size?: Size;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onChange: (value: Value) => void;
|
|
14
|
+
style?: Placement;
|
|
15
|
+
};
|
|
16
|
+
export declare function Select<Value extends string>({ label, value, options, size, disabled, onChange, style }: SelectProps<Value>): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { borders, colors, controls, iconSizes, layers, motion, radii, shadows, space } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { controlSizes } from "./controlLook.js";
|
|
6
|
+
import { Icon } from "./Icon.js";
|
|
7
|
+
import { interact } from "./interaction.js";
|
|
8
|
+
import { Popup } from "./Popup.js";
|
|
9
|
+
import { PopupItem } from "./PopupItem.js";
|
|
10
|
+
export function Select({ label, value, options, size = 'md', disabled = false, onChange, style }) {
|
|
11
|
+
return (_jsxs(BaseSelect.Root, { items: options, value: value, disabled: disabled, onValueChange: (next) => {
|
|
12
|
+
if (next === null)
|
|
13
|
+
return;
|
|
14
|
+
interact({ primitive: 'Select', event: 'change', label });
|
|
15
|
+
onChange(next);
|
|
16
|
+
}, children: [_jsxs(BaseSelect.Trigger, { "aria-label": label, className: (state) => stylex.props(styles.trigger, controlSizes[size], triggerPaddings[size], styles.triggerLook, !disabled && styles.hoverable, state.open && styles.triggerOpen, disabled && styles.disabled, style).className, children: [_jsx("span", { ...stylex.props(styles.values), children: options.map((option) => (_jsx("span", { "aria-hidden": option.value !== value, ...stylex.props(styles.value, option.value !== value && styles.valueHidden), children: option.label }, option.value))) }), _jsx(BaseSelect.Icon, { className: stylex.props(styles.chevron).className, children: _jsx(Icon, { name: "chevronUpDown", size: size }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { alignItemWithTrigger: false, side: "bottom", align: "start", sideOffset: 4, className: stylex.props(styles.positioner).className, children: _jsx(BaseSelect.Popup, { render: (props, state) => (_jsx(Popup, { ...props, kind: "select", isOpen: state.open, transitionStatus: state.transitionStatus })), children: options.map((option) => (_jsxs(BaseSelect.Item, { value: option.value, render: (props, state) => (_jsx(PopupItem, { ...props, kind: "select", isHighlighted: state.highlighted })), children: [_jsx("span", { ...stylex.props(styles.indicator), children: _jsx(BaseSelect.ItemIndicator, { className: stylex.props(styles.check).className, children: _jsx(Icon, { name: "check" }) }) }), _jsx(BaseSelect.ItemText, { children: option.label })] }, option.value))) }) }) })] }));
|
|
17
|
+
}
|
|
18
|
+
const focusRing = `inset 0 0 0 ${borders.hairline} ${colors.brandBorderFocus}, 0 0 0 ${borders.thin} ${colors.brandBorderFocus}, ${shadows.default}`;
|
|
19
|
+
const styles = stylex.create({
|
|
20
|
+
trigger: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexShrink: 0,
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'space-between',
|
|
25
|
+
whiteSpace: 'nowrap',
|
|
26
|
+
outline: 'none'
|
|
27
|
+
},
|
|
28
|
+
triggerLook: {
|
|
29
|
+
gap: space.sm,
|
|
30
|
+
color: colors.primaryForeground,
|
|
31
|
+
backgroundColor: colors.componentOnContainerStrong,
|
|
32
|
+
borderRadius: radii.lg,
|
|
33
|
+
boxShadow: {
|
|
34
|
+
default: shadows.default,
|
|
35
|
+
':focus-visible': focusRing
|
|
36
|
+
},
|
|
37
|
+
transitionTimingFunction: motion.easeOut,
|
|
38
|
+
transitionDuration: motion.instant,
|
|
39
|
+
transitionProperty: 'color, background-color, box-shadow'
|
|
40
|
+
},
|
|
41
|
+
hoverable: {
|
|
42
|
+
backgroundColor: {
|
|
43
|
+
default: colors.componentOnContainerStrong,
|
|
44
|
+
':focus-visible': colors.componentOnContainerSubtleHover,
|
|
45
|
+
':hover': colors.componentOnContainerStrongHover
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
triggerOpen: {
|
|
49
|
+
backgroundColor: colors.componentOnContainerSubtleHover,
|
|
50
|
+
boxShadow: focusRing
|
|
51
|
+
},
|
|
52
|
+
disabled: {
|
|
53
|
+
color: colors.disabledForeground,
|
|
54
|
+
backgroundColor: colors.disabled,
|
|
55
|
+
boxShadow: 'none'
|
|
56
|
+
},
|
|
57
|
+
values: {
|
|
58
|
+
display: 'grid',
|
|
59
|
+
textAlign: 'start'
|
|
60
|
+
},
|
|
61
|
+
value: {
|
|
62
|
+
gridRowStart: 1,
|
|
63
|
+
gridColumnStart: 1
|
|
64
|
+
},
|
|
65
|
+
valueHidden: {
|
|
66
|
+
visibility: 'hidden'
|
|
67
|
+
},
|
|
68
|
+
chevron: {
|
|
69
|
+
display: 'flex',
|
|
70
|
+
color: colors.tertiaryForeground
|
|
71
|
+
},
|
|
72
|
+
positioner: {
|
|
73
|
+
zIndex: layers.menu,
|
|
74
|
+
outline: 'none'
|
|
75
|
+
},
|
|
76
|
+
indicator: {
|
|
77
|
+
display: 'flex',
|
|
78
|
+
width: iconSizes.md,
|
|
79
|
+
height: iconSizes.md,
|
|
80
|
+
color: colors.secondaryForeground
|
|
81
|
+
},
|
|
82
|
+
check: {
|
|
83
|
+
display: 'flex'
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const triggerPaddings = stylex.create({
|
|
87
|
+
xs: {
|
|
88
|
+
paddingInlineStart: `calc(${controls.paddingXs} - 2px)`,
|
|
89
|
+
paddingInlineEnd: `calc(${controls.paddingXs} - 4px)`
|
|
90
|
+
},
|
|
91
|
+
sm: {
|
|
92
|
+
paddingInlineStart: `calc(${controls.paddingSm} - 2px)`,
|
|
93
|
+
paddingInlineEnd: `calc(${controls.paddingSm} - 4px)`
|
|
94
|
+
},
|
|
95
|
+
md: {
|
|
96
|
+
paddingInlineStart: `calc(${controls.paddingMd} - 2px)`,
|
|
97
|
+
paddingInlineEnd: `calc(${controls.paddingMd} - 4px)`
|
|
98
|
+
},
|
|
99
|
+
lg: {
|
|
100
|
+
paddingInlineStart: `calc(${controls.paddingLg} - 2px)`,
|
|
101
|
+
paddingInlineEnd: `calc(${controls.paddingLg} - 4px)`
|
|
102
|
+
},
|
|
103
|
+
xl: {
|
|
104
|
+
paddingInlineStart: `calc(${controls.paddingXl} - 2px)`,
|
|
105
|
+
paddingInlineEnd: `calc(${controls.paddingXl} - 4px)`
|
|
106
|
+
}
|
|
107
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type SettingsRowProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
control: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare function SettingsRow({ title, description, control }: SettingsRowProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { breakpoints, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
import { Text } from "./Text.js";
|
|
5
|
+
export function SettingsRow({ title, description, control }) {
|
|
6
|
+
return (_jsxs("div", { ...stylex.props(styles.row), children: [_jsxs("div", { ...stylex.props(styles.words), children: [_jsx(Text, { variant: "label", tone: "primary", children: title }), description === undefined ? null : (_jsx(Text, { tone: "secondary", children: description }))] }), control] }));
|
|
7
|
+
}
|
|
8
|
+
const styles = stylex.create({
|
|
9
|
+
row: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: {
|
|
12
|
+
default: 'row',
|
|
13
|
+
[breakpoints.compact]: 'column'
|
|
14
|
+
},
|
|
15
|
+
gap: {
|
|
16
|
+
default: space.xl,
|
|
17
|
+
[breakpoints.compact]: space.md
|
|
18
|
+
},
|
|
19
|
+
alignItems: {
|
|
20
|
+
default: 'center',
|
|
21
|
+
[breakpoints.compact]: 'flex-start'
|
|
22
|
+
},
|
|
23
|
+
justifyContent: 'space-between',
|
|
24
|
+
paddingBlock: space.lg
|
|
25
|
+
},
|
|
26
|
+
words: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
gap: space.xxs,
|
|
30
|
+
minWidth: 0
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AppPath } from '../registered.ts';
|
|
2
|
+
import type { IconName } from './icons.ts';
|
|
3
|
+
import type { MenuEntry } from './MenuItems.tsx';
|
|
4
|
+
export type SidebarLink = {
|
|
5
|
+
label: string;
|
|
6
|
+
to: AppPath;
|
|
7
|
+
icon: IconName;
|
|
8
|
+
count?: number | null;
|
|
9
|
+
};
|
|
10
|
+
type SidebarProps = {
|
|
11
|
+
workspace: string;
|
|
12
|
+
workspaceMenu: readonly MenuEntry[];
|
|
13
|
+
links: readonly SidebarLink[];
|
|
14
|
+
isToggled: boolean;
|
|
15
|
+
isAnimating: boolean;
|
|
16
|
+
onFollowLink: () => void;
|
|
17
|
+
onSearch: (() => void) | undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare function Sidebar({ workspace, workspaceMenu, links, isToggled, isAnimating, onFollowLink, onSearch }: SidebarProps): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { NavLink } from 'react-router';
|
|
4
|
+
import { breakpoints, colors, controls, iconSizes, layers, motion, radii, shadows, space, widths } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { Badge } from "./Badge.js";
|
|
6
|
+
import { focusRing } from "./controlLook.js";
|
|
7
|
+
import { Button } from "./Button.js";
|
|
8
|
+
import { Icon } from "./Icon.js";
|
|
9
|
+
import { interact } from "./interaction.js";
|
|
10
|
+
import { Menu } from "./Menu.js";
|
|
11
|
+
import { ScrollArea } from "./ScrollArea.js";
|
|
12
|
+
import { Text } from "./Text.js";
|
|
13
|
+
export function Sidebar({ workspace, workspaceMenu, links, isToggled, isAnimating, onFollowLink, onSearch }) {
|
|
14
|
+
const followLink = (link) => {
|
|
15
|
+
interact({ primitive: 'AppFrame', event: 'navigate', label: link.label });
|
|
16
|
+
onFollowLink();
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs("nav", { ...stylex.props(styles.sidebar, isToggled && styles.sidebarToggled, isAnimating && styles.sidebarAnimating), children: [_jsx("div", { ...stylex.props(styles.header), children: _jsx(Menu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { ...stylex.props(styles.logo), children: _jsx(Text, { variant: "caption", children: workspace.charAt(0) }) }), _jsx(Text, { variant: "label", isTruncated: true, children: workspace }), _jsx(Icon, { name: "chevronDown" })] }), items: workspaceMenu }) }), onSearch === undefined ? null : (_jsx(Button, { variant: "secondary", icon: "search", shortcut: ['mod', 'k'], isFullWidth: true, onClick: onSearch, children: "Search" })), _jsx("div", { ...stylex.props(styles.body), children: _jsx(ScrollArea, { children: _jsxs("div", { ...stylex.props(styles.group), children: [_jsx("span", { ...stylex.props(styles.groupLabel), children: _jsx(Text, { variant: "label", tone: "tertiary", children: "Workspace" }) }), links.map((item) => (_jsxs(NavLink, { onClick: () => followLink(item), to: item.to, end: item.to === '/', className: ({ isActive }) => stylex.props(styles.item, isActive && styles.itemCurrent, focusRing.visible, focusRing.inside).className ?? '', children: [_jsx(Icon, { name: item.icon }), _jsx(Text, { variant: "label", isTruncated: true, style: styles.itemLabel, children: item.label }), typeof item.count !== 'number' ? null : (_jsx(Badge, { variant: "transparent", children: item.count }))] }, item.to)))] }) }) })] }));
|
|
19
|
+
}
|
|
20
|
+
const styles = stylex.create({
|
|
21
|
+
sidebar: {
|
|
22
|
+
position: {
|
|
23
|
+
default: 'relative',
|
|
24
|
+
[breakpoints.compact]: 'fixed'
|
|
25
|
+
},
|
|
26
|
+
insetBlock: {
|
|
27
|
+
default: null,
|
|
28
|
+
[breakpoints.compact]: 0
|
|
29
|
+
},
|
|
30
|
+
insetInlineStart: {
|
|
31
|
+
default: null,
|
|
32
|
+
[breakpoints.compact]: 0
|
|
33
|
+
},
|
|
34
|
+
zIndex: {
|
|
35
|
+
default: null,
|
|
36
|
+
[breakpoints.compact]: layers.sidebar
|
|
37
|
+
},
|
|
38
|
+
display: 'flex',
|
|
39
|
+
visibility: {
|
|
40
|
+
default: null,
|
|
41
|
+
[breakpoints.compact]: 'hidden'
|
|
42
|
+
},
|
|
43
|
+
flexShrink: 0,
|
|
44
|
+
flexDirection: 'column',
|
|
45
|
+
gap: space.lg,
|
|
46
|
+
width: widths.sidebar,
|
|
47
|
+
height: '100%',
|
|
48
|
+
padding: space.lg,
|
|
49
|
+
backgroundColor: {
|
|
50
|
+
default: null,
|
|
51
|
+
[breakpoints.compact]: colors.shell
|
|
52
|
+
},
|
|
53
|
+
boxShadow: {
|
|
54
|
+
default: null,
|
|
55
|
+
[breakpoints.compact]: shadows.extraLarge
|
|
56
|
+
},
|
|
57
|
+
transform: {
|
|
58
|
+
default: null,
|
|
59
|
+
[breakpoints.compact]: 'translateX(-100%)'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
sidebarAnimating: {
|
|
63
|
+
transitionTimingFunction: motion.slideEasing,
|
|
64
|
+
transitionDuration: motion.slide,
|
|
65
|
+
transitionProperty: 'transform, visibility'
|
|
66
|
+
},
|
|
67
|
+
sidebarToggled: {
|
|
68
|
+
display: {
|
|
69
|
+
default: 'none',
|
|
70
|
+
[breakpoints.compact]: 'flex'
|
|
71
|
+
},
|
|
72
|
+
visibility: {
|
|
73
|
+
default: null,
|
|
74
|
+
[breakpoints.compact]: 'visible'
|
|
75
|
+
},
|
|
76
|
+
transform: {
|
|
77
|
+
default: null,
|
|
78
|
+
[breakpoints.compact]: 'translateX(0)'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
header: {
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
height: controls.heightLg
|
|
85
|
+
},
|
|
86
|
+
logo: {
|
|
87
|
+
display: 'grid',
|
|
88
|
+
flexShrink: 0,
|
|
89
|
+
placeItems: 'center',
|
|
90
|
+
width: iconSizes.xl,
|
|
91
|
+
height: iconSizes.xl,
|
|
92
|
+
color: colors.onInvertedForeground,
|
|
93
|
+
backgroundColor: colors.invertedSolid,
|
|
94
|
+
borderRadius: radii.md
|
|
95
|
+
},
|
|
96
|
+
body: {
|
|
97
|
+
flexGrow: 1,
|
|
98
|
+
minHeight: 0
|
|
99
|
+
},
|
|
100
|
+
group: {
|
|
101
|
+
display: 'flex',
|
|
102
|
+
flexDirection: 'column',
|
|
103
|
+
gap: space.xxs
|
|
104
|
+
},
|
|
105
|
+
groupLabel: {
|
|
106
|
+
display: 'block',
|
|
107
|
+
paddingBlock: controls.paddingXs,
|
|
108
|
+
paddingInline: controls.paddingSm
|
|
109
|
+
},
|
|
110
|
+
item: {
|
|
111
|
+
display: 'flex',
|
|
112
|
+
gap: space.sm,
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
height: {
|
|
115
|
+
default: controls.heightMd,
|
|
116
|
+
[breakpoints.compact]: controls.heightXl
|
|
117
|
+
},
|
|
118
|
+
paddingInline: controls.paddingSm,
|
|
119
|
+
color: {
|
|
120
|
+
default: colors.secondaryForeground,
|
|
121
|
+
':hover': colors.primaryForeground
|
|
122
|
+
},
|
|
123
|
+
textDecoration: 'none',
|
|
124
|
+
backgroundColor: {
|
|
125
|
+
default: 'transparent',
|
|
126
|
+
':hover': colors.transparentHover
|
|
127
|
+
},
|
|
128
|
+
borderRadius: radii.md
|
|
129
|
+
},
|
|
130
|
+
itemCurrent: {
|
|
131
|
+
color: colors.primaryForeground,
|
|
132
|
+
backgroundColor: colors.transparentHover
|
|
133
|
+
},
|
|
134
|
+
itemLabel: {
|
|
135
|
+
flexGrow: 1
|
|
136
|
+
}
|
|
137
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SignInScreen(): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { useModel } from "../hooks/appContext.js";
|
|
4
|
+
import { colors, controls, radii, space, widths } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { Button } from "./Button.js";
|
|
6
|
+
import { Form } from "./Form.js";
|
|
7
|
+
import { Text } from "./Text.js";
|
|
8
|
+
import { TextField } from "./TextField.js";
|
|
9
|
+
export function SignInScreen() {
|
|
10
|
+
const appSettings = useModel('appSettings');
|
|
11
|
+
const signIn = useModel('signIn');
|
|
12
|
+
const isBusy = signIn.signingIn !== null;
|
|
13
|
+
return (_jsx("main", { ...stylex.props(styles.page), children: _jsxs("div", { ...stylex.props(styles.column), children: [_jsx("span", { ...stylex.props(styles.mark), children: _jsx(Text, { variant: "title", children: appSettings.title.charAt(0) }) }), _jsxs(Text, { as: "h1", variant: "title", tone: "primary", align: "center", children: ["Sign in to ", appSettings.title] }), signIn.step === 'choose' ? (_jsxs(_Fragment, { children: [_jsx(Button, { size: "lg", disabled: isBusy, isPending: signIn.signingIn === 'google', onClick: signIn.continueWithGoogle, children: "Continue with Google" }), _jsxs(Form, { onSubmit: (values) => signIn.sendEmailCode({ email: values['email'] ?? '' }), children: [_jsx(TextField, { name: "email", type: "email", required: true, autoComplete: "email", placeholder: "you@example.com", label: "Email", isLabelHidden: true, size: "lg" }), _jsx(Button, { type: "submit", variant: "secondary", size: "lg", disabled: isBusy, isPending: signIn.signingIn === 'email', children: "Email me a code" })] }), import.meta.env.DEV ? (_jsxs(Button, { variant: "tertiary", size: "lg", disabled: isBusy, isPending: signIn.signingIn === 'dev', onClick: () => signIn.signInAsDevUser({ email: DEV_USER }), children: ["Dev: sign in as ", DEV_USER] })) : null] })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { as: "p", tone: "secondary", align: "center", children: ["We sent a 6-digit code to ", signIn.email, "."] }), _jsxs(Form, { onSubmit: (values) => signIn.verifyEmailCode({ code: values['code'] ?? '' }), children: [_jsx(TextField, { name: "code", required: true, autoFocus: true, inputMode: "numeric", autoComplete: "one-time-code", pattern: "[0-9]{6}", maxLength: 6, placeholder: "123456", label: "Code", isLabelHidden: true, size: "lg" }), _jsx(Button, { type: "submit", size: "lg", disabled: isBusy, isPending: signIn.signingIn === 'email', children: "Sign in" })] }), _jsx(Button, { variant: "transparent", size: "lg", disabled: isBusy, onClick: signIn.startOver, children: "Use a different email" })] })), signIn.notice === null ? null : (_jsx(Text, { as: "p", tone: "secondary", align: "center", children: signIn.notice })), _jsx(Text, { as: "p", variant: "caption", tone: "tertiary", align: "center", children: "Sign-in by Pattern" })] }) }));
|
|
14
|
+
}
|
|
15
|
+
const DEV_USER = 'ada@acme.test';
|
|
16
|
+
const styles = stylex.create({
|
|
17
|
+
page: {
|
|
18
|
+
display: 'grid',
|
|
19
|
+
placeItems: 'center',
|
|
20
|
+
height: '100%',
|
|
21
|
+
backgroundColor: colors.shell
|
|
22
|
+
},
|
|
23
|
+
column: {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
gap: space.md,
|
|
27
|
+
alignItems: 'stretch',
|
|
28
|
+
width: widths.contentXs
|
|
29
|
+
},
|
|
30
|
+
mark: {
|
|
31
|
+
display: 'grid',
|
|
32
|
+
placeItems: 'center',
|
|
33
|
+
alignSelf: 'center',
|
|
34
|
+
width: controls.heightLg,
|
|
35
|
+
height: controls.heightLg,
|
|
36
|
+
color: colors.onInvertedForeground,
|
|
37
|
+
backgroundColor: colors.invertedSolid,
|
|
38
|
+
borderRadius: radii.lg
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Placement } from './Placement.ts';
|
|
2
|
+
type SkeletonProps = {
|
|
3
|
+
variant?: 'text' | 'heading' | 'icon' | 'card';
|
|
4
|
+
width?: 'sm' | 'md' | 'lg' | 'full';
|
|
5
|
+
style?: Placement;
|
|
6
|
+
};
|
|
7
|
+
export declare function Skeleton({ variant, width, style }: SkeletonProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { breakpoints, colors, iconSizes, lineHeights, motion, radii, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
export function Skeleton({ variant = 'text', width = 'full', style }) {
|
|
5
|
+
return (_jsx("span", { ...stylex.props(styles.skeleton, variant !== 'icon' && widthsOf[width], variants[variant], style) }));
|
|
6
|
+
}
|
|
7
|
+
const pulse = stylex.keyframes({
|
|
8
|
+
'50%': { opacity: 0.5 }
|
|
9
|
+
});
|
|
10
|
+
const styles = stylex.create({
|
|
11
|
+
skeleton: {
|
|
12
|
+
display: 'block',
|
|
13
|
+
flexShrink: 0,
|
|
14
|
+
backgroundColor: colors.component,
|
|
15
|
+
animationName: {
|
|
16
|
+
default: pulse,
|
|
17
|
+
[breakpoints.reducedMotion]: 'none'
|
|
18
|
+
},
|
|
19
|
+
animationDuration: motion.pulse,
|
|
20
|
+
animationTimingFunction: motion.easeInOut,
|
|
21
|
+
animationIterationCount: 'infinite'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const variants = stylex.create({
|
|
25
|
+
text: {
|
|
26
|
+
height: lineHeights.caption,
|
|
27
|
+
borderRadius: radii.sm
|
|
28
|
+
},
|
|
29
|
+
heading: {
|
|
30
|
+
height: lineHeights.heading6,
|
|
31
|
+
borderRadius: radii.md
|
|
32
|
+
},
|
|
33
|
+
icon: {
|
|
34
|
+
width: iconSizes.xs,
|
|
35
|
+
height: iconSizes.xs,
|
|
36
|
+
borderRadius: radii.full
|
|
37
|
+
},
|
|
38
|
+
card: {
|
|
39
|
+
height: `calc(2 * ${space.xxxl})`,
|
|
40
|
+
borderRadius: radii.xxl
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const widthsOf = stylex.create({
|
|
44
|
+
sm: { width: '25%' },
|
|
45
|
+
md: { width: '40%' },
|
|
46
|
+
lg: { width: '60%' },
|
|
47
|
+
full: { width: '100%' }
|
|
48
|
+
});
|