@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.
Files changed (247) hide show
  1. package/README.md +127 -2
  2. package/dist/access.d.ts +31 -0
  3. package/dist/access.js +72 -0
  4. package/dist/actions.d.ts +57 -0
  5. package/dist/actions.js +198 -0
  6. package/dist/api.d.ts +20 -0
  7. package/dist/api.js +34 -0
  8. package/dist/app.d.ts +106 -0
  9. package/dist/app.js +224 -0
  10. package/dist/appearance.d.ts +7 -0
  11. package/dist/appearance.js +2 -0
  12. package/dist/auth/sessionApi.d.ts +41 -0
  13. package/dist/auth/sessionApi.js +158 -0
  14. package/dist/auth/sessionStore.d.ts +20 -0
  15. package/dist/auth/sessionStore.js +40 -0
  16. package/dist/auth/user.d.ts +11 -0
  17. package/dist/auth/user.js +9 -0
  18. package/dist/builtins/Account.d.ts +25 -0
  19. package/dist/builtins/Account.js +15 -0
  20. package/dist/builtins/Palette.d.ts +29 -0
  21. package/dist/builtins/Palette.js +63 -0
  22. package/dist/builtins/SignIn.d.ts +28 -0
  23. package/dist/builtins/SignIn.js +60 -0
  24. package/dist/builtins/Toasts.d.ts +32 -0
  25. package/dist/builtins/Toasts.js +24 -0
  26. package/dist/builtins/actions.d.ts +2 -0
  27. package/dist/builtins/actions.js +45 -0
  28. package/dist/cache.d.ts +24 -0
  29. package/dist/cache.js +112 -0
  30. package/dist/cli/app.d.ts +2 -0
  31. package/dist/cli/app.js +1329 -0
  32. package/dist/cli/screenshot.d.ts +1 -0
  33. package/dist/cli/screenshot.js +96 -0
  34. package/dist/cli/tools.d.ts +12 -0
  35. package/dist/cli/tools.js +35 -0
  36. package/dist/components/AppFrame.d.ts +14 -0
  37. package/dist/components/AppFrame.js +64 -0
  38. package/dist/components/AppearancePicker.d.ts +1 -0
  39. package/dist/components/AppearancePicker.js +12 -0
  40. package/dist/components/Avatar.d.ts +9 -0
  41. package/dist/components/Avatar.js +63 -0
  42. package/dist/components/Badge.d.ts +11 -0
  43. package/dist/components/Badge.js +87 -0
  44. package/dist/components/Button.d.ts +23 -0
  45. package/dist/components/Button.js +249 -0
  46. package/dist/components/Card.d.ts +12 -0
  47. package/dist/components/Card.js +38 -0
  48. package/dist/components/CommandMenu.d.ts +23 -0
  49. package/dist/components/CommandMenu.js +214 -0
  50. package/dist/components/CommandPalette.d.ts +1 -0
  51. package/dist/components/CommandPalette.js +7 -0
  52. package/dist/components/Content.d.ts +7 -0
  53. package/dist/components/Content.js +24 -0
  54. package/dist/components/ContextMenu.d.ts +8 -0
  55. package/dist/components/ContextMenu.js +23 -0
  56. package/dist/components/Dialog.d.ts +11 -0
  57. package/dist/components/Dialog.js +81 -0
  58. package/dist/components/Divider.d.ts +6 -0
  59. package/dist/components/Divider.js +15 -0
  60. package/dist/components/EmptyState.d.ts +8 -0
  61. package/dist/components/EmptyState.js +24 -0
  62. package/dist/components/Form.d.ts +9 -0
  63. package/dist/components/Form.js +23 -0
  64. package/dist/components/Icon.d.ts +10 -0
  65. package/dist/components/Icon.js +22 -0
  66. package/dist/components/IconButton.d.ts +14 -0
  67. package/dist/components/IconButton.js +53 -0
  68. package/dist/components/Kbd.d.ts +6 -0
  69. package/dist/components/Kbd.js +67 -0
  70. package/dist/components/Link.d.ts +9 -0
  71. package/dist/components/Link.js +35 -0
  72. package/dist/components/ListRow.d.ts +12 -0
  73. package/dist/components/ListRow.js +62 -0
  74. package/dist/components/LoadingRows.d.ts +5 -0
  75. package/dist/components/LoadingRows.js +6 -0
  76. package/dist/components/Menu.d.ts +12 -0
  77. package/dist/components/Menu.js +33 -0
  78. package/dist/components/MenuItems.d.ts +21 -0
  79. package/dist/components/MenuItems.js +32 -0
  80. package/dist/components/Placement.d.ts +21 -0
  81. package/dist/components/Placement.js +1 -0
  82. package/dist/components/Popup.d.ts +8 -0
  83. package/dist/components/Popup.js +43 -0
  84. package/dist/components/PopupItem.d.ts +8 -0
  85. package/dist/components/PopupItem.js +51 -0
  86. package/dist/components/PropertyRow.d.ts +7 -0
  87. package/dist/components/PropertyRow.js +23 -0
  88. package/dist/components/Row.d.ts +16 -0
  89. package/dist/components/Row.js +27 -0
  90. package/dist/components/Screen.d.ts +13 -0
  91. package/dist/components/Screen.js +56 -0
  92. package/dist/components/Scrim.d.ts +8 -0
  93. package/dist/components/Scrim.js +40 -0
  94. package/dist/components/ScrollArea.d.ts +15 -0
  95. package/dist/components/ScrollArea.js +13 -0
  96. package/dist/components/SegmentedControl.d.ts +17 -0
  97. package/dist/components/SegmentedControl.js +68 -0
  98. package/dist/components/Select.d.ts +17 -0
  99. package/dist/components/Select.js +107 -0
  100. package/dist/components/SettingsRow.d.ts +8 -0
  101. package/dist/components/SettingsRow.js +32 -0
  102. package/dist/components/Sidebar.d.ts +20 -0
  103. package/dist/components/Sidebar.js +138 -0
  104. package/dist/components/SignInScreen.d.ts +1 -0
  105. package/dist/components/SignInScreen.js +40 -0
  106. package/dist/components/Size.d.ts +1 -0
  107. package/dist/components/Size.js +1 -0
  108. package/dist/components/Skeleton.d.ts +8 -0
  109. package/dist/components/Skeleton.js +48 -0
  110. package/dist/components/Spinner.d.ts +6 -0
  111. package/dist/components/Spinner.js +54 -0
  112. package/dist/components/Stack.d.ts +14 -0
  113. package/dist/components/Stack.js +19 -0
  114. package/dist/components/Switch.d.ts +10 -0
  115. package/dist/components/Switch.js +71 -0
  116. package/dist/components/Text.d.ts +21 -0
  117. package/dist/components/Text.js +77 -0
  118. package/dist/components/TextField.d.ts +25 -0
  119. package/dist/components/TextField.js +68 -0
  120. package/dist/components/Toaster.d.ts +1 -0
  121. package/dist/components/Toaster.js +83 -0
  122. package/dist/components/Tooltip.d.ts +8 -0
  123. package/dist/components/Tooltip.js +43 -0
  124. package/dist/components/controlLook.d.ts +60 -0
  125. package/dist/components/controlLook.js +67 -0
  126. package/dist/components/frame.d.ts +4 -0
  127. package/dist/components/frame.js +2 -0
  128. package/dist/components/icons.d.ts +58 -0
  129. package/dist/components/icons.js +105 -0
  130. package/dist/components/interaction.d.ts +12 -0
  131. package/dist/components/interaction.js +22 -0
  132. package/dist/components/spacing.d.ts +118 -0
  133. package/dist/components/spacing.js +46 -0
  134. package/dist/components/tones.d.ts +28 -0
  135. package/dist/components/tones.js +12 -0
  136. package/dist/entityStore.d.ts +46 -0
  137. package/dist/entityStore.js +160 -0
  138. package/dist/flows/accessFlows.d.ts +9 -0
  139. package/dist/flows/accessFlows.js +151 -0
  140. package/dist/flows/browser.d.ts +32 -0
  141. package/dist/flows/browser.js +164 -0
  142. package/dist/flows/contactSheet.d.ts +1 -0
  143. package/dist/flows/contactSheet.js +63 -0
  144. package/dist/flows/flowBrowser.d.ts +23 -0
  145. package/dist/flows/flowBrowser.js +21 -0
  146. package/dist/flows/flowSetup.d.ts +3 -0
  147. package/dist/flows/flowSetup.js +35 -0
  148. package/dist/flows/flows.d.ts +41 -0
  149. package/dist/flows/flows.js +148 -0
  150. package/dist/flows/screenshotName.d.ts +1 -0
  151. package/dist/flows/screenshotName.js +6 -0
  152. package/dist/gate.d.ts +8 -0
  153. package/dist/gate.js +52 -0
  154. package/dist/hooks/appContext.d.ts +14 -0
  155. package/dist/hooks/appContext.js +5 -0
  156. package/dist/hooks/appHooks.d.ts +21 -0
  157. package/dist/hooks/appHooks.js +24 -0
  158. package/dist/hooks/useAnimatesOnChange.d.ts +1 -0
  159. package/dist/hooks/useAnimatesOnChange.js +14 -0
  160. package/dist/hooks/useStoreState.d.ts +6 -0
  161. package/dist/hooks/useStoreState.js +5 -0
  162. package/dist/index.d.ts +40 -0
  163. package/dist/index.js +19 -0
  164. package/dist/memoryApi.d.ts +19 -0
  165. package/dist/memoryApi.js +42 -0
  166. package/dist/model.d.ts +94 -0
  167. package/dist/model.js +243 -0
  168. package/dist/page.d.ts +11 -0
  169. package/dist/page.js +9 -0
  170. package/dist/platform.d.ts +1 -0
  171. package/dist/platform.js +5 -0
  172. package/dist/react.d.ts +46 -0
  173. package/dist/react.js +38 -0
  174. package/dist/registered.d.ts +54 -0
  175. package/dist/registered.js +17 -0
  176. package/dist/routes.d.ts +38 -0
  177. package/dist/routes.js +21 -0
  178. package/dist/rules/checkAllFiles.d.ts +1 -0
  179. package/dist/rules/checkAllFiles.js +741 -0
  180. package/dist/rules/checkApiRouting.d.ts +1 -0
  181. package/dist/rules/checkApiRouting.js +112 -0
  182. package/dist/rules/lintPlugin.d.ts +252 -0
  183. package/dist/rules/lintPlugin.js +1157 -0
  184. package/dist/rules/messages.d.ts +48 -0
  185. package/dist/rules/messages.js +48 -0
  186. package/dist/rules/themeTokens.d.ts +6 -0
  187. package/dist/rules/themeTokens.js +64 -0
  188. package/dist/schema.d.ts +2 -0
  189. package/dist/schema.js +1 -0
  190. package/dist/server/auth.d.ts +115 -0
  191. package/dist/server/auth.js +131 -0
  192. package/dist/server/authService.d.ts +9 -0
  193. package/dist/server/authService.js +50 -0
  194. package/dist/server/createServer.d.ts +357 -0
  195. package/dist/server/createServer.js +62 -0
  196. package/dist/server/env.d.ts +15 -0
  197. package/dist/server/env.js +1 -0
  198. package/dist/server/index.d.ts +8 -0
  199. package/dist/server/index.js +5 -0
  200. package/dist/server/session.d.ts +28 -0
  201. package/dist/server/session.js +54 -0
  202. package/dist/server/sessions.d.ts +92 -0
  203. package/dist/server/sessions.js +47 -0
  204. package/dist/server/signInWire.d.ts +52 -0
  205. package/dist/server/signInWire.js +22 -0
  206. package/dist/server/tables.d.ts +242 -0
  207. package/dist/server/tables.js +246 -0
  208. package/dist/server/users.d.ts +189 -0
  209. package/dist/server/users.js +49 -0
  210. package/dist/shortcuts.d.ts +3 -0
  211. package/dist/shortcuts.js +40 -0
  212. package/dist/start.d.ts +20 -0
  213. package/dist/start.js +121 -0
  214. package/dist/state.d.ts +14 -0
  215. package/dist/state.js +17 -0
  216. package/dist/store.d.ts +43 -0
  217. package/dist/store.js +198 -0
  218. package/dist/subscribers.d.ts +5 -0
  219. package/dist/subscribers.js +13 -0
  220. package/dist/table.d.ts +143 -0
  221. package/dist/table.js +91 -0
  222. package/dist/tables.d.ts +77 -0
  223. package/dist/tables.js +216 -0
  224. package/dist/theme/reset.css +84 -0
  225. package/dist/theme/scales.d.ts +76 -0
  226. package/dist/theme/scales.js +82 -0
  227. package/dist/theme/tokens.stylex.d.ts +218 -0
  228. package/dist/theme/tokens.stylex.js +233 -0
  229. package/dist/vite/commandBridge.d.ts +2 -0
  230. package/dist/vite/commandBridge.js +46 -0
  231. package/dist/vite/designManifest.d.ts +25 -0
  232. package/dist/vite/designManifest.js +191 -0
  233. package/dist/vite/localWorker.d.ts +4 -0
  234. package/dist/vite/localWorker.js +59 -0
  235. package/dist/vite/rootAlias.d.ts +2 -0
  236. package/dist/vite/rootAlias.js +15 -0
  237. package/dist/vite/vite.d.ts +7 -0
  238. package/dist/vite/vite.js +88 -0
  239. package/dist/wire.d.ts +7 -0
  240. package/dist/wire.js +1 -0
  241. package/package.json +99 -3
  242. package/presets/lintPlugin.js +7 -0
  243. package/presets/oxlint.json +167 -0
  244. package/presets/register.d.ts +19 -0
  245. package/presets/server.d.ts +2 -0
  246. package/presets/tsconfig.app.json +29 -0
  247. package/presets/tsconfig.server.json +27 -0
@@ -0,0 +1,138 @@
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 { Button } from "./Button.js";
7
+ import { Icon } from "./Icon.js";
8
+ import { interact } from "./interaction.js";
9
+ import { Menu } from "./Menu.js";
10
+ import { ScrollArea } from "./ScrollArea.js";
11
+ import { Text } from "./Text.js";
12
+ export function Sidebar({ workspace, workspaceMenu, links, isToggled, isAnimating, onFollowLink, onSearch }) {
13
+ const followLink = (link) => {
14
+ interact({ primitive: 'AppFrame', event: 'navigate', label: link.label });
15
+ onFollowLink();
16
+ };
17
+ 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)
18
+ .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
+ outlineOffset: 0,
125
+ backgroundColor: {
126
+ default: 'transparent',
127
+ ':hover': colors.transparentHover
128
+ },
129
+ borderRadius: radii.md
130
+ },
131
+ itemCurrent: {
132
+ color: colors.primaryForeground,
133
+ backgroundColor: colors.transparentHover
134
+ },
135
+ itemLabel: {
136
+ flexGrow: 1
137
+ }
138
+ });
@@ -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 { useApp, 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 { name } = useApp();
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: name.charAt(0) }) }), _jsxs(Text, { as: "h1", variant: "title", tone: "primary", align: "center", children: ["Sign in to ", name] }), 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
+ });
@@ -0,0 +1,6 @@
1
+ import type { Size } from './Size.ts';
2
+ type SpinnerProps = {
3
+ size?: Size;
4
+ };
5
+ export declare function Spinner({ size }: SpinnerProps): import("react").JSX.Element;
6
+ export {};
@@ -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,71 @@
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
+ export function Switch({ label, checked, disabled = false, onChange, style }) {
7
+ return (_jsx(BaseSwitch.Root, { "aria-label": label, checked: checked, disabled: disabled, onCheckedChange: (next) => {
8
+ interact({ primitive: 'Switch', event: 'change', label });
9
+ onChange(next);
10
+ }, className: (state) => stylex.props(styles.track, state.checked ? styles.on : styles.off, !disabled && (state.checked ? hovers.on : hovers.off), disabled && styles.disabled, style).className, children: _jsx(BaseSwitch.Thumb, { className: stylex.props(styles.thumb, disabled && styles.thumbDisabled).className }) }));
11
+ }
12
+ const styles = stylex.create({
13
+ track: {
14
+ position: 'relative',
15
+ display: 'inline-flex',
16
+ flexShrink: 0,
17
+ alignItems: 'center',
18
+ width: `calc(${lineHeights.caption} * 1.5)`,
19
+ height: lineHeights.caption,
20
+ padding: space.xxs,
21
+ outlineOffset: 0,
22
+ borderRadius: radii.full,
23
+ transitionTimingFunction: motion.easeInOut,
24
+ transitionDuration: motion.fast,
25
+ transitionProperty: 'background-color',
26
+ '::before': {
27
+ position: 'absolute',
28
+ inset: `calc(-2 * ${space.xxs})`,
29
+ content: '""',
30
+ borderRadius: radii.full
31
+ }
32
+ },
33
+ off: {
34
+ justifyContent: 'flex-start',
35
+ backgroundColor: colors.component
36
+ },
37
+ on: {
38
+ justifyContent: 'flex-end',
39
+ backgroundColor: colors.brandSolid
40
+ },
41
+ disabled: {
42
+ backgroundColor: colors.disabled
43
+ },
44
+ thumb: {
45
+ display: 'block',
46
+ flexShrink: 0,
47
+ width: `calc(${lineHeights.caption} - 2 * ${space.xxs})`,
48
+ height: `calc(${lineHeights.caption} - 2 * ${space.xxs})`,
49
+ backgroundColor: colors.onBrandSolidForeground,
50
+ borderRadius: radii.full
51
+ },
52
+ thumbDisabled: {
53
+ backgroundColor: colors.disabledForeground
54
+ }
55
+ });
56
+ const hovers = stylex.create({
57
+ off: {
58
+ backgroundColor: {
59
+ default: colors.component,
60
+ ':hover': colors.componentHover,
61
+ ':active': colors.componentActive
62
+ }
63
+ },
64
+ on: {
65
+ backgroundColor: {
66
+ default: colors.brandSolid,
67
+ ':hover': colors.brandSolidHover,
68
+ ':active': colors.brandSolidActive
69
+ }
70
+ }
71
+ });
@@ -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;