@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,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { colors, motion, radii, shadows, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
export function Popup({ isOpen, transitionStatus, kind, ...popupProps }) {
|
|
5
|
+
const isHidden = !isOpen || transitionStatus === 'starting';
|
|
6
|
+
return (_jsx("div", { ...popupProps, ...stylex.props(styles.popup, kinds[kind], isHidden && (kind === 'menu' ? styles.hiddenMenu : styles.hiddenSelect), !isOpen && styles.exiting) }));
|
|
7
|
+
}
|
|
8
|
+
const styles = stylex.create({
|
|
9
|
+
popup: {
|
|
10
|
+
padding: space.xs,
|
|
11
|
+
color: colors.primaryForeground,
|
|
12
|
+
outline: 'none',
|
|
13
|
+
backgroundColor: colors.componentOnSunken,
|
|
14
|
+
borderRadius: radii.xl,
|
|
15
|
+
boxShadow: shadows.extraLarge,
|
|
16
|
+
transformOrigin: 'var(--transform-origin)',
|
|
17
|
+
transitionTimingFunction: motion.easeInOut,
|
|
18
|
+
transitionDuration: motion.base,
|
|
19
|
+
transitionProperty: 'opacity, transform'
|
|
20
|
+
},
|
|
21
|
+
exiting: {
|
|
22
|
+
transitionTimingFunction: motion.easeOut,
|
|
23
|
+
transitionDuration: motion.exit
|
|
24
|
+
},
|
|
25
|
+
hiddenMenu: {
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
opacity: 0,
|
|
28
|
+
transform: 'scale(0.95)'
|
|
29
|
+
},
|
|
30
|
+
hiddenSelect: {
|
|
31
|
+
pointerEvents: 'none',
|
|
32
|
+
opacity: 0,
|
|
33
|
+
transform: 'scale(0.97)'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const kinds = stylex.create({
|
|
37
|
+
menu: {
|
|
38
|
+
minWidth: 224
|
|
39
|
+
},
|
|
40
|
+
select: {
|
|
41
|
+
minWidth: 'var(--anchor-width)'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
type PopupItemProps = Omit<ComponentPropsWithRef<'div'>, 'className' | 'style'> & {
|
|
3
|
+
isHighlighted: boolean;
|
|
4
|
+
isDanger?: boolean;
|
|
5
|
+
kind: 'menu' | 'select';
|
|
6
|
+
};
|
|
7
|
+
export declare function PopupItem({ isHighlighted, isDanger, kind, ...itemProps }: PopupItemProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { breakpoints, colors, controls, fontSizes, fontWeights, iconSizes, lineHeights, radii, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
export function PopupItem({ isHighlighted, isDanger = false, kind, ...itemProps }) {
|
|
5
|
+
return (_jsx("div", { ...itemProps, ...stylex.props(styles.item, kinds[kind], isHighlighted && styles.highlighted, isDanger && styles.danger, isDanger && isHighlighted && styles.dangerHighlighted) }));
|
|
6
|
+
}
|
|
7
|
+
const styles = stylex.create({
|
|
8
|
+
item: {
|
|
9
|
+
position: 'relative',
|
|
10
|
+
gap: space.sm,
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
minHeight: {
|
|
13
|
+
default: controls.heightMd,
|
|
14
|
+
[breakpoints.compact]: controls.heightXl
|
|
15
|
+
},
|
|
16
|
+
paddingInlineStart: controls.paddingSm,
|
|
17
|
+
fontSize: {
|
|
18
|
+
default: fontSizes.bodySm,
|
|
19
|
+
[breakpoints.compact]: fontSizes.bodyBase
|
|
20
|
+
},
|
|
21
|
+
fontWeight: fontWeights.semimedium,
|
|
22
|
+
lineHeight: {
|
|
23
|
+
default: lineHeights.bodySm,
|
|
24
|
+
[breakpoints.compact]: lineHeights.body
|
|
25
|
+
},
|
|
26
|
+
color: colors.primaryForeground,
|
|
27
|
+
outline: 'none',
|
|
28
|
+
borderRadius: radii.md
|
|
29
|
+
},
|
|
30
|
+
highlighted: {
|
|
31
|
+
backgroundColor: colors.transparentHover
|
|
32
|
+
},
|
|
33
|
+
danger: {
|
|
34
|
+
color: colors.onDangerSubtleForeground
|
|
35
|
+
},
|
|
36
|
+
dangerHighlighted: {
|
|
37
|
+
backgroundColor: colors.dangerSubtle
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const kinds = stylex.create({
|
|
41
|
+
menu: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
paddingInlineEnd: controls.paddingXs
|
|
44
|
+
},
|
|
45
|
+
select: {
|
|
46
|
+
display: 'grid',
|
|
47
|
+
gridTemplateColumns: `${iconSizes.md} 1fr`,
|
|
48
|
+
paddingBlock: space.xs,
|
|
49
|
+
paddingInlineEnd: space.lg
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { controls, space } from "../theme/tokens.stylex.js";
|
|
4
|
+
import { Text } from "./Text.js";
|
|
5
|
+
export function PropertyRow({ label, children }) {
|
|
6
|
+
return (_jsxs("div", { ...stylex.props(styles.row), children: [_jsx(Text, { tone: "secondary", children: label }), _jsx("div", { ...stylex.props(styles.value), children: children })] }));
|
|
7
|
+
}
|
|
8
|
+
const styles = stylex.create({
|
|
9
|
+
row: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
gap: space.lg,
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
minHeight: `calc(${controls.heightXl} + ${space.sm})`
|
|
15
|
+
},
|
|
16
|
+
value: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
gap: space.sm,
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'flex-end',
|
|
21
|
+
minWidth: 0
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from './Placement.ts';
|
|
3
|
+
import type { SpaceName } from './spacing.ts';
|
|
4
|
+
type RowProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
gap?: SpaceName;
|
|
7
|
+
align?: 'start' | 'center' | 'end' | 'baseline';
|
|
8
|
+
justify?: 'start' | 'center' | 'end' | 'between';
|
|
9
|
+
isWrapping?: boolean;
|
|
10
|
+
padding?: SpaceName;
|
|
11
|
+
paddingBlock?: SpaceName;
|
|
12
|
+
paddingInline?: SpaceName;
|
|
13
|
+
style?: Placement;
|
|
14
|
+
};
|
|
15
|
+
export declare function Row({ children, gap, align, justify, isWrapping, padding, paddingBlock, paddingInline, style }: RowProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { gaps, paddingBlocks, paddingInlines, paddings } from "./spacing.js";
|
|
4
|
+
export function Row({ children, gap = 'sm', align = 'center', justify = 'start', isWrapping = false, padding = 'none', paddingBlock, paddingInline, style }) {
|
|
5
|
+
return (_jsx("div", { ...stylex.props(styles.row, alignments[align], justifications[justify], isWrapping && styles.wrapping, gaps[gap], paddings[padding], paddingBlock !== undefined && paddingBlocks[paddingBlock], paddingInline !== undefined && paddingInlines[paddingInline], style), children: children }));
|
|
6
|
+
}
|
|
7
|
+
const styles = stylex.create({
|
|
8
|
+
row: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
minWidth: 0
|
|
11
|
+
},
|
|
12
|
+
wrapping: {
|
|
13
|
+
flexWrap: 'wrap'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const alignments = stylex.create({
|
|
17
|
+
start: { alignItems: 'flex-start' },
|
|
18
|
+
center: { alignItems: 'center' },
|
|
19
|
+
end: { alignItems: 'flex-end' },
|
|
20
|
+
baseline: { alignItems: 'baseline' }
|
|
21
|
+
});
|
|
22
|
+
const justifications = stylex.create({
|
|
23
|
+
start: { justifyContent: 'flex-start' },
|
|
24
|
+
center: { justifyContent: 'center' },
|
|
25
|
+
end: { justifyContent: 'flex-end' },
|
|
26
|
+
between: { justifyContent: 'space-between' }
|
|
27
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AppPath } from '../registered.ts';
|
|
3
|
+
type ScreenProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
parent?: {
|
|
6
|
+
label: string;
|
|
7
|
+
to: AppPath;
|
|
8
|
+
};
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare function Screen({ title, parent, actions, children }: ScreenProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -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 } 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).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 {};
|