@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,54 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { breakpoints, iconSizes, motion, radii } from "../theme/tokens.stylex.js";
|
|
4
|
+
export function Spinner({ size = 'md' }) {
|
|
5
|
+
return (_jsx("span", { "aria-hidden": "true", ...stylex.props(styles.spinner, sizes[size]), children: _jsx("span", { ...stylex.props(styles.inner), children: BARS.map((bar) => (_jsx("span", { ...stylex.props(styles.bar(bar)) }, bar))) }) }));
|
|
6
|
+
}
|
|
7
|
+
const BARS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
8
|
+
const fade = stylex.keyframes({
|
|
9
|
+
'0%': { opacity: 1 },
|
|
10
|
+
'100%': { opacity: 0.15 }
|
|
11
|
+
});
|
|
12
|
+
const styles = stylex.create({
|
|
13
|
+
spinner: {
|
|
14
|
+
display: 'block',
|
|
15
|
+
flexShrink: 0
|
|
16
|
+
},
|
|
17
|
+
inner: {
|
|
18
|
+
position: 'relative',
|
|
19
|
+
insetBlockStart: '50%',
|
|
20
|
+
insetInlineStart: '50%',
|
|
21
|
+
display: 'block',
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: '100%'
|
|
24
|
+
},
|
|
25
|
+
bar: (bar) => ({
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
insetBlockStart: '-3.9%',
|
|
28
|
+
insetInlineStart: '-10%',
|
|
29
|
+
width: '24%',
|
|
30
|
+
height: '8%',
|
|
31
|
+
backgroundColor: 'currentColor',
|
|
32
|
+
borderRadius: radii.full,
|
|
33
|
+
opacity: {
|
|
34
|
+
default: null,
|
|
35
|
+
[breakpoints.reducedMotion]: 0.5
|
|
36
|
+
},
|
|
37
|
+
transform: `rotate(${bar * 30 + 0.0001}deg) translate(146%)`,
|
|
38
|
+
animationName: {
|
|
39
|
+
default: fade,
|
|
40
|
+
[breakpoints.reducedMotion]: 'none'
|
|
41
|
+
},
|
|
42
|
+
animationDuration: motion.spin,
|
|
43
|
+
animationTimingFunction: 'linear',
|
|
44
|
+
animationDelay: `calc(${motion.spin} * ${(bar - 12) / 12})`,
|
|
45
|
+
animationIterationCount: 'infinite'
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
const sizes = stylex.create({
|
|
49
|
+
xs: { width: iconSizes.xs, height: iconSizes.xs },
|
|
50
|
+
sm: { width: iconSizes.sm, height: iconSizes.sm },
|
|
51
|
+
md: { width: iconSizes.md, height: iconSizes.md },
|
|
52
|
+
lg: { width: iconSizes.lg, height: iconSizes.lg },
|
|
53
|
+
xl: { width: iconSizes.xl, height: iconSizes.xl }
|
|
54
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from './Placement.ts';
|
|
3
|
+
import type { SpaceName } from './spacing.ts';
|
|
4
|
+
type StackProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
gap?: SpaceName;
|
|
7
|
+
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
8
|
+
padding?: SpaceName;
|
|
9
|
+
paddingBlock?: SpaceName;
|
|
10
|
+
paddingInline?: SpaceName;
|
|
11
|
+
style?: Placement;
|
|
12
|
+
};
|
|
13
|
+
export declare function Stack({ children, gap, align, padding, paddingBlock, paddingInline, style }: StackProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 Stack({ children, gap = 'none', align = 'stretch', padding = 'none', paddingBlock, paddingInline, style }) {
|
|
5
|
+
return (_jsx("div", { ...stylex.props(styles.stack, alignments[align], gaps[gap], paddings[padding], paddingBlock !== undefined && paddingBlocks[paddingBlock], paddingInline !== undefined && paddingInlines[paddingInline], style), children: children }));
|
|
6
|
+
}
|
|
7
|
+
const styles = stylex.create({
|
|
8
|
+
stack: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
minWidth: 0
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const alignments = stylex.create({
|
|
15
|
+
start: { alignItems: 'flex-start' },
|
|
16
|
+
center: { alignItems: 'center' },
|
|
17
|
+
end: { alignItems: 'flex-end' },
|
|
18
|
+
stretch: { alignItems: 'stretch' }
|
|
19
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Placement } from './Placement.ts';
|
|
2
|
+
type SwitchProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onChange: (checked: boolean) => void;
|
|
7
|
+
style?: Placement;
|
|
8
|
+
};
|
|
9
|
+
export declare function Switch({ label, checked, disabled, onChange, style }: SwitchProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { colors, lineHeights, motion, radii, space } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { interact } from "./interaction.js";
|
|
6
|
+
import { focusRing } from "./controlLook.js";
|
|
7
|
+
export function Switch({ label, checked, disabled = false, onChange, style }) {
|
|
8
|
+
return (_jsx(BaseSwitch.Root, { "aria-label": label, checked: checked, disabled: disabled, onCheckedChange: (next) => {
|
|
9
|
+
interact({ primitive: 'Switch', event: 'change', label });
|
|
10
|
+
onChange(next);
|
|
11
|
+
}, className: (state) => stylex.props(styles.track, state.checked ? styles.on : styles.off, !disabled && (state.checked ? hovers.on : hovers.off), disabled && styles.disabled, focusRing.visible, style).className, children: _jsx(BaseSwitch.Thumb, { className: stylex.props(styles.thumb, disabled && styles.thumbDisabled).className }) }));
|
|
12
|
+
}
|
|
13
|
+
const styles = stylex.create({
|
|
14
|
+
track: {
|
|
15
|
+
position: 'relative',
|
|
16
|
+
display: 'inline-flex',
|
|
17
|
+
flexShrink: 0,
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
width: `calc(${lineHeights.caption} * 1.5)`,
|
|
20
|
+
height: lineHeights.caption,
|
|
21
|
+
padding: space.xxs,
|
|
22
|
+
outlineOffset: 0,
|
|
23
|
+
borderRadius: radii.full,
|
|
24
|
+
transitionTimingFunction: motion.easeInOut,
|
|
25
|
+
transitionDuration: motion.fast,
|
|
26
|
+
transitionProperty: 'background-color',
|
|
27
|
+
'::before': {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
inset: `calc(-2 * ${space.xxs})`,
|
|
30
|
+
content: '""',
|
|
31
|
+
borderRadius: radii.full
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
off: {
|
|
35
|
+
justifyContent: 'flex-start',
|
|
36
|
+
backgroundColor: colors.component
|
|
37
|
+
},
|
|
38
|
+
on: {
|
|
39
|
+
justifyContent: 'flex-end',
|
|
40
|
+
backgroundColor: colors.brandSolid
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
backgroundColor: colors.disabled
|
|
44
|
+
},
|
|
45
|
+
thumb: {
|
|
46
|
+
display: 'block',
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
width: `calc(${lineHeights.caption} - 2 * ${space.xxs})`,
|
|
49
|
+
height: `calc(${lineHeights.caption} - 2 * ${space.xxs})`,
|
|
50
|
+
backgroundColor: colors.onBrandSolidForeground,
|
|
51
|
+
borderRadius: radii.full
|
|
52
|
+
},
|
|
53
|
+
thumbDisabled: {
|
|
54
|
+
backgroundColor: colors.disabledForeground
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const hovers = stylex.create({
|
|
58
|
+
off: {
|
|
59
|
+
backgroundColor: {
|
|
60
|
+
default: colors.component,
|
|
61
|
+
':hover': colors.componentHover,
|
|
62
|
+
':active': colors.componentActive
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
on: {
|
|
66
|
+
backgroundColor: {
|
|
67
|
+
default: colors.brandSolid,
|
|
68
|
+
':hover': colors.brandSolidHover,
|
|
69
|
+
':active': colors.brandSolidActive
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from './Placement.ts';
|
|
3
|
+
import type { Tone } from './tones.ts';
|
|
4
|
+
type TextProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
variant?: 'heading' | 'subheading' | 'title' | 'label' | 'body' | 'caption' | 'code';
|
|
7
|
+
tone?: Tone;
|
|
8
|
+
align?: 'start' | 'center' | 'end';
|
|
9
|
+
as?: 'span' | 'p' | 'h1' | 'h2' | 'h3';
|
|
10
|
+
isTruncated?: boolean;
|
|
11
|
+
isSelectable?: boolean;
|
|
12
|
+
style?: Placement;
|
|
13
|
+
};
|
|
14
|
+
export declare function Text({ children, variant, tone, align, as, isTruncated, isSelectable, style }: TextProps): import("react").DetailedReactHTMLElement<Readonly<{
|
|
15
|
+
className?: string;
|
|
16
|
+
'data-style-src'?: string;
|
|
17
|
+
style?: Readonly<{
|
|
18
|
+
[$$Key$$: string]: string | number;
|
|
19
|
+
}>;
|
|
20
|
+
}>, HTMLElement>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
import { breakpoints, fontSizes, fontWeights, fonts, lineHeights } from "../theme/tokens.stylex.js";
|
|
4
|
+
import { tones } from "./tones.js";
|
|
5
|
+
export function Text({ children, variant = 'body', tone = 'inherit', align, as = 'span', isTruncated = false, isSelectable = false, style }) {
|
|
6
|
+
return createElement(as, stylex.props(as !== 'span' && styles.block, variants[variant], tones[tone], align !== undefined && alignments[align], isTruncated && styles.truncated, isSelectable && styles.selectable, style), children);
|
|
7
|
+
}
|
|
8
|
+
const styles = stylex.create({
|
|
9
|
+
block: {
|
|
10
|
+
display: 'block'
|
|
11
|
+
},
|
|
12
|
+
truncated: {
|
|
13
|
+
display: 'block',
|
|
14
|
+
minWidth: 0,
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
textOverflow: 'ellipsis',
|
|
17
|
+
whiteSpace: 'nowrap'
|
|
18
|
+
},
|
|
19
|
+
selectable: {
|
|
20
|
+
userSelect: 'text'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const variants = stylex.create({
|
|
24
|
+
heading: {
|
|
25
|
+
fontSize: fontSizes.heading5,
|
|
26
|
+
fontWeight: fontWeights.semibold,
|
|
27
|
+
lineHeight: lineHeights.heading5
|
|
28
|
+
},
|
|
29
|
+
subheading: {
|
|
30
|
+
fontSize: fontSizes.heading6,
|
|
31
|
+
fontWeight: fontWeights.semibold,
|
|
32
|
+
lineHeight: lineHeights.heading6
|
|
33
|
+
},
|
|
34
|
+
title: {
|
|
35
|
+
fontSize: fontSizes.bodyBase,
|
|
36
|
+
fontWeight: fontWeights.semibold,
|
|
37
|
+
lineHeight: lineHeights.body
|
|
38
|
+
},
|
|
39
|
+
label: {
|
|
40
|
+
fontSize: {
|
|
41
|
+
default: fontSizes.bodySm,
|
|
42
|
+
[breakpoints.compact]: fontSizes.bodyBase
|
|
43
|
+
},
|
|
44
|
+
fontWeight: fontWeights.medium,
|
|
45
|
+
lineHeight: {
|
|
46
|
+
default: lineHeights.bodySm,
|
|
47
|
+
[breakpoints.compact]: lineHeights.body
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
body: {
|
|
51
|
+
fontSize: {
|
|
52
|
+
default: fontSizes.bodySm,
|
|
53
|
+
[breakpoints.compact]: fontSizes.bodyBase
|
|
54
|
+
},
|
|
55
|
+
fontWeight: fontWeights.normal,
|
|
56
|
+
lineHeight: {
|
|
57
|
+
default: lineHeights.bodySm,
|
|
58
|
+
[breakpoints.compact]: lineHeights.body
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
caption: {
|
|
62
|
+
fontSize: fontSizes.captionLg,
|
|
63
|
+
fontWeight: fontWeights.normal,
|
|
64
|
+
lineHeight: lineHeights.caption
|
|
65
|
+
},
|
|
66
|
+
code: {
|
|
67
|
+
fontFamily: fonts.mono,
|
|
68
|
+
fontSize: fontSizes.bodySm,
|
|
69
|
+
fontWeight: fontWeights.normal,
|
|
70
|
+
lineHeight: lineHeights.bodySm
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const alignments = stylex.create({
|
|
74
|
+
start: { textAlign: 'start' },
|
|
75
|
+
center: { textAlign: 'center' },
|
|
76
|
+
end: { textAlign: 'end' }
|
|
77
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Placement } from './Placement.ts';
|
|
2
|
+
import type { Size } from './Size.ts';
|
|
3
|
+
type TextFieldProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
isLabelHidden?: boolean;
|
|
6
|
+
description?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
type?: 'text' | 'email' | 'password' | 'search' | 'tel' | 'url';
|
|
12
|
+
name?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
autoComplete?: string;
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
inputMode?: 'text' | 'email' | 'numeric' | 'decimal' | 'tel' | 'url' | 'search';
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
pattern?: string;
|
|
21
|
+
size?: Size;
|
|
22
|
+
style?: Placement;
|
|
23
|
+
};
|
|
24
|
+
export declare function TextField({ label, isLabelHidden, description, error, onChange, size, style, ...input }: TextFieldProps): import("react").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Field } from '@base-ui/react/field';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { useRef } from 'react';
|
|
5
|
+
import { borders, colors, fontSizes, fontWeights, lineHeights, motion, shadows, space } from "../theme/tokens.stylex.js";
|
|
6
|
+
import { controlSizes } from "./controlLook.js";
|
|
7
|
+
import { interact } from "./interaction.js";
|
|
8
|
+
export function TextField({ label, isLabelHidden = false, description, error, onChange, size = 'md', style, ...input }) {
|
|
9
|
+
const isInvalid = error !== undefined;
|
|
10
|
+
const valueOnFocus = useRef('');
|
|
11
|
+
return (_jsxs(Field.Root, { invalid: isInvalid, disabled: input.disabled ?? false, className: stylex.props(styles.field, style).className, children: [isLabelHidden ? null : (_jsx(Field.Label, { className: stylex.props(styles.label).className, children: label })), _jsx(Field.Control, { ...input, "aria-label": isLabelHidden ? label : undefined, onChange: (event) => onChange?.(event.currentTarget.value), onFocus: (event) => {
|
|
12
|
+
valueOnFocus.current = event.currentTarget.value;
|
|
13
|
+
}, onBlur: (event) => {
|
|
14
|
+
if (event.currentTarget.value !== valueOnFocus.current) {
|
|
15
|
+
interact({ primitive: 'TextField', event: 'change', label });
|
|
16
|
+
}
|
|
17
|
+
}, className: stylex.props(styles.input, controlSizes[size], isInvalid && styles.invalid).className }), description === undefined ? null : (_jsx(Field.Description, { className: stylex.props(styles.note).className, children: description })), error === undefined ? null : (_jsx(Field.Error, { match: true, className: stylex.props(styles.error).className, children: error }))] }));
|
|
18
|
+
}
|
|
19
|
+
const focusRing = `inset 0 0 0 ${borders.hairline} ${colors.brandBorderFocus}, 0 0 0 ${borders.thin} ${colors.brandBorderFocus}, ${shadows.default}`;
|
|
20
|
+
const invalidRing = `inset 0 0 0 ${borders.hairline} ${colors.dangerBorderDefault}, 0 0 0 ${borders.thin} ${colors.dangerBorderDefault}, ${shadows.default}`;
|
|
21
|
+
const styles = stylex.create({
|
|
22
|
+
field: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
gap: space.xs,
|
|
26
|
+
minWidth: 0
|
|
27
|
+
},
|
|
28
|
+
label: {
|
|
29
|
+
fontWeight: fontWeights.medium,
|
|
30
|
+
color: colors.primaryForeground
|
|
31
|
+
},
|
|
32
|
+
input: {
|
|
33
|
+
minWidth: 0,
|
|
34
|
+
fontFamily: 'inherit',
|
|
35
|
+
fontWeight: fontWeights.normal,
|
|
36
|
+
fontFeatureSettings: 'inherit',
|
|
37
|
+
color: colors.primaryForeground,
|
|
38
|
+
outline: 'none',
|
|
39
|
+
backgroundColor: colors.componentOnContainerStrong,
|
|
40
|
+
borderWidth: 0,
|
|
41
|
+
boxShadow: {
|
|
42
|
+
default: shadows.default,
|
|
43
|
+
':focus-visible': focusRing
|
|
44
|
+
},
|
|
45
|
+
transitionTimingFunction: motion.easeOut,
|
|
46
|
+
transitionDuration: motion.instant,
|
|
47
|
+
transitionProperty: 'box-shadow',
|
|
48
|
+
'::placeholder': {
|
|
49
|
+
color: colors.tertiaryForeground
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
invalid: {
|
|
53
|
+
boxShadow: {
|
|
54
|
+
default: invalidRing,
|
|
55
|
+
':focus-visible': invalidRing
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
note: {
|
|
59
|
+
fontSize: fontSizes.captionLg,
|
|
60
|
+
lineHeight: lineHeights.caption,
|
|
61
|
+
color: colors.secondaryForeground
|
|
62
|
+
},
|
|
63
|
+
error: {
|
|
64
|
+
fontSize: fontSizes.captionLg,
|
|
65
|
+
lineHeight: lineHeights.caption,
|
|
66
|
+
color: colors.dangerText
|
|
67
|
+
}
|
|
68
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Toaster(): import("react").JSX.Element;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import { breakpoints, colors, controls, layers, lineHeights, motion, radii, shadows, space, widths } from "../theme/tokens.stylex.js";
|
|
4
|
+
import { useApp } from "../hooks/appContext.js";
|
|
5
|
+
import { useStoreState } from "../hooks/useStoreState.js";
|
|
6
|
+
import { Icon } from "./Icon.js";
|
|
7
|
+
import { IconButton } from "./IconButton.js";
|
|
8
|
+
import { Text } from "./Text.js";
|
|
9
|
+
export function Toaster() {
|
|
10
|
+
const store = useApp().stores.toasts;
|
|
11
|
+
const { items } = useStoreState(store);
|
|
12
|
+
return (_jsx("section", { "aria-label": "Notifications", ...stylex.props(styles.toaster), children: items.map((toast) => (_jsxs("div", { role: toast.tone === 'error' ? 'alert' : 'status', ...stylex.props(styles.toast), children: [toast.tone === 'neutral' ? null : (_jsx("span", { ...stylex.props(styles.firstLine), children: _jsx(Icon, { name: icons[toast.tone], size: "xl", tone: toast.tone === 'error' ? 'danger' : 'positive' }) })), _jsxs("div", { ...stylex.props(styles.words), children: [_jsx(Text, { variant: "label", children: toast.title }), toast.description === null ? null : (_jsx(Text, { variant: "caption", tone: "secondary", children: toast.description }))] }), _jsx(IconButton, { icon: "close", label: "Dismiss", size: "sm", onClick: () => store.dismiss(toast.id), style: styles.dismiss })] }, toast.id))) }));
|
|
13
|
+
}
|
|
14
|
+
const icons = { success: 'checkCircle', error: 'alertCircle' };
|
|
15
|
+
const enter = stylex.keyframes({
|
|
16
|
+
from: { opacity: 0, transform: `translateY(${space.lg})` }
|
|
17
|
+
});
|
|
18
|
+
const styles = stylex.create({
|
|
19
|
+
toaster: {
|
|
20
|
+
position: 'fixed',
|
|
21
|
+
insetBlockEnd: {
|
|
22
|
+
default: space.xl,
|
|
23
|
+
[breakpoints.compact]: space.lg
|
|
24
|
+
},
|
|
25
|
+
insetInlineStart: {
|
|
26
|
+
default: null,
|
|
27
|
+
[breakpoints.compact]: space.lg
|
|
28
|
+
},
|
|
29
|
+
insetInlineEnd: {
|
|
30
|
+
default: space.xl,
|
|
31
|
+
[breakpoints.compact]: space.lg
|
|
32
|
+
},
|
|
33
|
+
zIndex: layers.toast,
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
gap: space.sm,
|
|
37
|
+
width: {
|
|
38
|
+
default: widths.toast,
|
|
39
|
+
[breakpoints.compact]: 'auto'
|
|
40
|
+
},
|
|
41
|
+
pointerEvents: 'none'
|
|
42
|
+
},
|
|
43
|
+
toast: {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
gap: controls.gapMd,
|
|
46
|
+
alignItems: 'flex-start',
|
|
47
|
+
padding: space.lg,
|
|
48
|
+
color: colors.primaryForeground,
|
|
49
|
+
pointerEvents: 'auto',
|
|
50
|
+
backgroundColor: colors.page,
|
|
51
|
+
borderRadius: radii.xl,
|
|
52
|
+
boxShadow: shadows.border,
|
|
53
|
+
animationName: {
|
|
54
|
+
default: enter,
|
|
55
|
+
[breakpoints.reducedMotion]: 'none'
|
|
56
|
+
},
|
|
57
|
+
animationDuration: motion.slide,
|
|
58
|
+
animationTimingFunction: motion.easeOut
|
|
59
|
+
},
|
|
60
|
+
words: {
|
|
61
|
+
display: 'flex',
|
|
62
|
+
flexGrow: 1,
|
|
63
|
+
flexDirection: 'column',
|
|
64
|
+
gap: space.xxs,
|
|
65
|
+
minWidth: 0
|
|
66
|
+
},
|
|
67
|
+
firstLine: {
|
|
68
|
+
display: 'flex',
|
|
69
|
+
flexShrink: 0,
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
height: {
|
|
72
|
+
default: lineHeights.bodySm,
|
|
73
|
+
[breakpoints.compact]: lineHeights.body
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
dismiss: {
|
|
77
|
+
marginBlock: {
|
|
78
|
+
default: `calc((${lineHeights.bodySm} - ${controls.heightSm}) / 2)`,
|
|
79
|
+
[breakpoints.compact]: `calc((${lineHeights.body} - ${controls.heightSm}) / 2)`
|
|
80
|
+
},
|
|
81
|
+
marginInlineEnd: `calc(-1 * ${space.sm})`
|
|
82
|
+
}
|
|
83
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
type TooltipProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
shortcut?: readonly string[] | undefined;
|
|
5
|
+
children: ReactElement;
|
|
6
|
+
};
|
|
7
|
+
export declare function Tooltip({ label, shortcut, children }: TooltipProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { colors, controls, fontSizes, fontWeights, layers, lineHeights, motion, radii, shadows, space } from "../theme/tokens.stylex.js";
|
|
5
|
+
import { Kbd } from "./Kbd.js";
|
|
6
|
+
export function Tooltip({ label, shortcut, children }) {
|
|
7
|
+
return (_jsxs(BaseTooltip.Root, { children: [_jsx(BaseTooltip.Trigger, { render: children }), _jsx(BaseTooltip.Portal, { children: _jsx(BaseTooltip.Positioner, { side: "bottom", sideOffset: 6, className: stylex.props(styles.positioner).className, children: _jsxs(BaseTooltip.Popup, { className: (state) => stylex.props(styles.popup, (!state.open || state.transitionStatus === 'starting') &&
|
|
8
|
+
styles.hidden, !state.open && styles.exiting).className, children: [label, shortcut === undefined ? null : (_jsx(Kbd, { keys: shortcut, surface: "standout" }))] }) }) })] }));
|
|
9
|
+
}
|
|
10
|
+
const styles = stylex.create({
|
|
11
|
+
positioner: {
|
|
12
|
+
zIndex: layers.tooltip
|
|
13
|
+
},
|
|
14
|
+
popup: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
gap: space.sm,
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
width: 'fit-content',
|
|
19
|
+
paddingBlock: controls.paddingXs,
|
|
20
|
+
paddingInline: controls.paddingMd,
|
|
21
|
+
fontSize: fontSizes.captionLg,
|
|
22
|
+
fontWeight: fontWeights.medium,
|
|
23
|
+
lineHeight: lineHeights.caption,
|
|
24
|
+
color: colors.onStandoutPrimaryForeground,
|
|
25
|
+
textWrap: 'balance',
|
|
26
|
+
backgroundColor: colors.standout,
|
|
27
|
+
borderRadius: radii.lg,
|
|
28
|
+
boxShadow: shadows.default,
|
|
29
|
+
transformOrigin: 'var(--transform-origin)',
|
|
30
|
+
transitionTimingFunction: motion.easeInOut,
|
|
31
|
+
transitionDuration: motion.base,
|
|
32
|
+
transitionProperty: 'opacity, transform'
|
|
33
|
+
},
|
|
34
|
+
exiting: {
|
|
35
|
+
transitionTimingFunction: motion.easeOut,
|
|
36
|
+
transitionDuration: motion.exit
|
|
37
|
+
},
|
|
38
|
+
hidden: {
|
|
39
|
+
pointerEvents: 'none',
|
|
40
|
+
opacity: 0,
|
|
41
|
+
transform: 'scale(0.95)'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
export declare const controlSizes: Readonly<{
|
|
3
|
+
readonly xs: Readonly<{
|
|
4
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
5
|
+
readonly height: stylex.StyleXClassNameFor<"height", string>;
|
|
6
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
7
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
8
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
9
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
10
|
+
}>;
|
|
11
|
+
readonly sm: Readonly<{
|
|
12
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
13
|
+
readonly height: stylex.StyleXClassNameFor<"height", string>;
|
|
14
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
15
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
16
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
17
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
18
|
+
}>;
|
|
19
|
+
readonly md: Readonly<{
|
|
20
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
21
|
+
readonly height: stylex.StyleXClassNameFor<"height", string>;
|
|
22
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
23
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
24
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
25
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
26
|
+
}>;
|
|
27
|
+
readonly lg: Readonly<{
|
|
28
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
29
|
+
readonly height: stylex.StyleXClassNameFor<"height", string>;
|
|
30
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
31
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
32
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
33
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
34
|
+
}>;
|
|
35
|
+
readonly xl: Readonly<{
|
|
36
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
37
|
+
readonly height: stylex.StyleXClassNameFor<"height", string>;
|
|
38
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
39
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
40
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
41
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
42
|
+
}>;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const transparentLook: Readonly<{
|
|
45
|
+
readonly rest: Readonly<{
|
|
46
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
47
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "transparent">;
|
|
48
|
+
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
|
|
49
|
+
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
50
|
+
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "color, background-color">;
|
|
51
|
+
}>;
|
|
52
|
+
readonly hoverable: Readonly<{
|
|
53
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
54
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
55
|
+
}>;
|
|
56
|
+
readonly open: Readonly<{
|
|
57
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
58
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
59
|
+
}>;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const focusRing: Readonly<{
|
|
62
|
+
readonly visible: Readonly<{
|
|
63
|
+
readonly outlineWidth: stylex.StyleXClassNameFor<"outlineWidth", `calc(${stylex.StyleXVar<string>} + ${stylex.StyleXVar<string>})`>;
|
|
64
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none" | "solid">;
|
|
65
|
+
readonly outlineColor: stylex.StyleXClassNameFor<"outlineColor", string>;
|
|
66
|
+
}>;
|
|
67
|
+
readonly inside: Readonly<{
|
|
68
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", `calc(-1 * (${stylex.StyleXVar<string>} + ${stylex.StyleXVar<string>}))`>;
|
|
69
|
+
}>;
|
|
70
|
+
}>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import { borders, colors, controls, fontSizes, lineHeights, motion, radii } from "../theme/tokens.stylex.js";
|
|
3
|
+
export const controlSizes = stylex.create({
|
|
4
|
+
xs: {
|
|
5
|
+
gap: controls.gapXs,
|
|
6
|
+
height: controls.heightXs,
|
|
7
|
+
paddingInline: controls.paddingXs,
|
|
8
|
+
fontSize: fontSizes.captionLg,
|
|
9
|
+
lineHeight: lineHeights.caption,
|
|
10
|
+
borderRadius: radii.sm
|
|
11
|
+
},
|
|
12
|
+
sm: {
|
|
13
|
+
gap: controls.gapSm,
|
|
14
|
+
height: controls.heightSm,
|
|
15
|
+
paddingInline: controls.paddingSm,
|
|
16
|
+
fontSize: fontSizes.bodySm,
|
|
17
|
+
lineHeight: lineHeights.bodySm,
|
|
18
|
+
borderRadius: radii.md
|
|
19
|
+
},
|
|
20
|
+
md: {
|
|
21
|
+
gap: controls.gapMd,
|
|
22
|
+
height: controls.heightMd,
|
|
23
|
+
paddingInline: controls.paddingMd,
|
|
24
|
+
fontSize: fontSizes.bodySm,
|
|
25
|
+
lineHeight: lineHeights.bodySm,
|
|
26
|
+
borderRadius: radii.md
|
|
27
|
+
},
|
|
28
|
+
lg: {
|
|
29
|
+
gap: controls.gapLg,
|
|
30
|
+
height: controls.heightLg,
|
|
31
|
+
paddingInline: controls.paddingLg,
|
|
32
|
+
fontSize: fontSizes.bodySm,
|
|
33
|
+
lineHeight: lineHeights.bodySm,
|
|
34
|
+
borderRadius: radii.lg
|
|
35
|
+
},
|
|
36
|
+
xl: {
|
|
37
|
+
gap: controls.gapXl,
|
|
38
|
+
height: controls.heightXl,
|
|
39
|
+
paddingInline: controls.paddingXl,
|
|
40
|
+
fontSize: fontSizes.bodySm,
|
|
41
|
+
lineHeight: lineHeights.bodySm,
|
|
42
|
+
borderRadius: radii.lg
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export const transparentLook = stylex.create({
|
|
46
|
+
rest: {
|
|
47
|
+
color: colors.secondaryForeground,
|
|
48
|
+
backgroundColor: 'transparent',
|
|
49
|
+
transitionTimingFunction: motion.easeOut,
|
|
50
|
+
transitionDuration: motion.fast,
|
|
51
|
+
transitionProperty: 'color, background-color'
|
|
52
|
+
},
|
|
53
|
+
hoverable: {
|
|
54
|
+
color: {
|
|
55
|
+
default: colors.secondaryForeground,
|
|
56
|
+
':hover': colors.primaryForeground
|
|
57
|
+
},
|
|
58
|
+
backgroundColor: {
|
|
59
|
+
default: 'transparent',
|
|
60
|
+
':hover': colors.transparentHover
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
open: {
|
|
64
|
+
color: colors.primaryForeground,
|
|
65
|
+
backgroundColor: colors.transparentHover
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export const focusRing = stylex.create({
|
|
69
|
+
visible: {
|
|
70
|
+
outlineWidth: `calc(${borders.thin} + ${borders.hairline})`,
|
|
71
|
+
outlineStyle: {
|
|
72
|
+
default: 'none',
|
|
73
|
+
':focus-visible': 'solid'
|
|
74
|
+
},
|
|
75
|
+
outlineColor: colors.brandBorderFocus
|
|
76
|
+
},
|
|
77
|
+
inside: {
|
|
78
|
+
outlineOffset: `calc(-1 * (${borders.thin} + ${borders.hairline}))`
|
|
79
|
+
}
|
|
80
|
+
});
|