Skip to content

Commit e72e377

Browse files
atrakhConvex, Inc.
authored and
Convex, Inc.
committed
Move ui package to @convex-dev/design-system (#36398)
GitOrigin-RevId: dce92a2e95b61c5ca474fae13e8e2b7f804b50b1
1 parent 0793534 commit e72e377

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+415
-262
lines changed

npm-packages/ui/.eslintrc.cjs renamed to npm-packages/@convex-dev/design-system/.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require("path");
22

33
module.exports = {
44
root: true,
5-
extends: [path.resolve(__dirname, "../dashboard-common/.eslintrc.cjs")],
5+
extends: [path.resolve(__dirname, "../../dashboard-common/.eslintrc.cjs")],
66
parserOptions: {
77
project: true,
88
tsconfigRootDir: __dirname,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Convex Design System
2+
3+
The Convex Design System is a collection of components that are used to build
4+
Convex UIs (dashboard, Chef, etc).
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"name": "@convex-dev/design-system",
3+
"version": "0.1.2",
4+
"type": "module",
5+
"sideEffects": false,
6+
"files": [
7+
"dist",
8+
"package.json"
9+
],
10+
"scripts": {
11+
"build": "tsc && tsc-alias && mkdir -p dist/styles && cp src/styles/shared.css dist/styles/shared.css",
12+
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx --ignore-pattern '*.stories.tsx'",
13+
"lint:fix": "eslint --fix ./src --ext .js,.jsx,.ts,.tsx --ignore-pattern '*.stories.tsx'"
14+
},
15+
"peerDependencies": {
16+
"@radix-ui/react-icons": "~1.3.0",
17+
"react": "^18.0.0",
18+
"tailwindcss": "^3.0.0",
19+
"tailwind-scrollbar": "^3.0.0",
20+
"@tailwindcss/forms": "^0.5.6"
21+
},
22+
"dependencies": {
23+
"clsx": "2.1.1",
24+
"@headlessui/react": "1.7.19",
25+
"@radix-ui/react-tooltip": "~1.1.0",
26+
"classnames": "^2.3.2",
27+
"fuzzy": "~0.1.3",
28+
"lodash": "~4.17.21",
29+
"react-dom": "^18.0.0",
30+
"react-popper": "^2.3.0",
31+
"react-use": "~17.6.0",
32+
"tailwind-merge": "^1.14.0",
33+
"tailwind-variants": "~0.2.0"
34+
},
35+
"devDependencies": {
36+
"@jest/types": "^29.6.0",
37+
"@storybook/react": "^7.6.16",
38+
"@tailwindcss/forms": "^0.5.6",
39+
"@testing-library/dom": "~10.4.0",
40+
"@testing-library/jest-dom": "~6.6.0",
41+
"@testing-library/react": "~16.2.0",
42+
"@testing-library/user-event": "~14.6.0",
43+
"@types/jest": "^27.0.0",
44+
"@types/lodash": "~4.17.0",
45+
"@types/node": "^18.17.0",
46+
"@types/react": "^18.0.0",
47+
"@types/react-dom": "^18.0.0",
48+
"@types/testing-library__jest-dom": "~5.14.5",
49+
"@typescript-eslint/eslint-plugin": "^6.7.4",
50+
"@typescript-eslint/parser": "^6.7.4",
51+
"eslint": "^8.29.0",
52+
"eslint-config-airbnb": "^19.0.4",
53+
"eslint-config-airbnb-typescript": "^17.0.0",
54+
"eslint-config-next": "~13.4.16",
55+
"eslint-config-prettier": "^9.1.0",
56+
"eslint-plugin-import": "^2.30.0",
57+
"eslint-plugin-jsx-a11y": "^6.6.0",
58+
"eslint-plugin-prettier": "^4.1.0",
59+
"eslint-plugin-react": "^7.37.2",
60+
"eslint-plugin-react-hooks": "^4.6.2",
61+
"eslint-plugin-tailwindcss": "~3.12.1",
62+
"jest": "^29.6.0",
63+
"jest-environment-jsdom": "^29.5.0",
64+
"postcss": "^8.4.19",
65+
"prettier": "3.5.2",
66+
"prettier-plugin-tailwindcss": "~0.3.0",
67+
"tailwindcss": "^3.2.4",
68+
"tailwind-scrollbar": "3.0.3",
69+
"typescript": "~5.0.3",
70+
"tsc-alias": "~1.8.15"
71+
},
72+
"exports": {
73+
"./Button": {
74+
"import": "./dist/Button.jsx",
75+
"types": "./dist/Button.d.ts"
76+
},
77+
"./Callout": {
78+
"import": "./dist/Callout.jsx",
79+
"types": "./dist/Callout.d.ts"
80+
},
81+
"./Checkbox": {
82+
"import": "./dist/Checkbox.jsx",
83+
"types": "./dist/Checkbox.d.ts"
84+
},
85+
"./ConfirmationDialog": {
86+
"import": "./dist/ConfirmationDialog.jsx",
87+
"types": "./dist/ConfirmationDialog.d.ts"
88+
},
89+
"./ClosePanelButton": {
90+
"import": "./dist/ClosePanelButton.jsx",
91+
"types": "./dist/ClosePanelButton.d.ts"
92+
},
93+
"./Combobox": {
94+
"import": "./dist/Combobox.jsx",
95+
"types": "./dist/Combobox.d.ts"
96+
},
97+
"./KeyboardShortcut": {
98+
"import": "./dist/KeyboardShortcut.jsx",
99+
"types": "./dist/KeyboardShortcut.d.ts"
100+
},
101+
"./Loading": {
102+
"import": "./dist/Loading.jsx",
103+
"types": "./dist/Loading.d.ts"
104+
},
105+
"./Menu": {
106+
"import": "./dist/Menu.jsx",
107+
"types": "./dist/Menu.d.ts"
108+
},
109+
"./Modal": {
110+
"import": "./dist/Modal.jsx",
111+
"types": "./dist/Modal.d.ts"
112+
},
113+
"./MultiSelectCombobox": {
114+
"import": "./dist/MultiSelectCombobox.jsx",
115+
"types": "./dist/MultiSelectCombobox.d.ts"
116+
},
117+
"./Popover": {
118+
"import": "./dist/Popover.jsx",
119+
"types": "./dist/Popover.d.ts"
120+
},
121+
"./ProgressBar": {
122+
"import": "./dist/ProgressBar.jsx",
123+
"types": "./dist/ProgressBar.d.ts"
124+
},
125+
"./Sheet": {
126+
"import": "./dist/Sheet.jsx",
127+
"types": "./dist/Sheet.d.ts"
128+
},
129+
"./Spinner": {
130+
"import": "./dist/Spinner.jsx",
131+
"types": "./dist/Spinner.d.ts"
132+
},
133+
"./Tab": {
134+
"import": "./dist/Tab.jsx",
135+
"types": "./dist/Tab.d.ts"
136+
},
137+
"./TextInput": {
138+
"import": "./dist/TextInput.jsx",
139+
"types": "./dist/TextInput.d.ts"
140+
},
141+
"./Tooltip": {
142+
"import": "./dist/Tooltip.jsx",
143+
"types": "./dist/Tooltip.d.ts"
144+
},
145+
"./UIContext": {
146+
"import": "./dist/UIContext.jsx",
147+
"types": "./dist/UIContext.d.ts"
148+
},
149+
"./styles/shared.css": {
150+
"import": "./dist/styles/shared.css",
151+
"types": "./dist/styles/shared.css"
152+
},
153+
"./tailwind.config": {
154+
"import": "./dist/tailwind.config.js",
155+
"types": "./dist/tailwind.config.d.ts",
156+
"default": "./dist/tailwind.config.js"
157+
}
158+
}
159+
}

npm-packages/ui/src/ConfirmationDialog.tsx renamed to npm-packages/@convex-dev/design-system/src/ConfirmationDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function ConfirmationDialog({
5656
<>
5757
<div className="mt-4 text-sm">
5858
Type{" "}
59-
<code className="bg-background-tertiary text-content-primary rounded p-1 text-sm">
59+
<code className="rounded bg-background-tertiary p-1 text-sm text-content-primary">
6060
{validationText}
6161
</code>{" "}
6262
in the box below to confirm.

npm-packages/ui/src/Menu.tsx renamed to npm-packages/@convex-dev/design-system/src/Menu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function Menu({
5050
ref={setPopperElement}
5151
style={styles.popper}
5252
{...attributes.popper}
53-
className="bg-background-secondary z-50 flex max-h-[20rem] flex-col gap-1 overflow-auto whitespace-nowrap rounded-lg border py-2 text-sm shadow-md"
53+
className="z-50 flex max-h-[20rem] flex-col gap-1 overflow-auto whitespace-nowrap rounded-lg border bg-background-secondary py-2 text-sm shadow-md"
5454
>
5555
{children}
5656
</HeadlessMenu.Items>
@@ -105,7 +105,7 @@ export function MenuItem({
105105
{shortcut && (
106106
<KeyboardShortcut
107107
value={shortcut}
108-
className="text-content-tertiary ml-auto pl-6"
108+
className="ml-auto pl-6 text-content-tertiary"
109109
/>
110110
)}
111111
</Button>
@@ -148,7 +148,7 @@ export function MenuLink({
148148
{shortcut && (
149149
<KeyboardShortcut
150150
value={shortcut}
151-
className="text-content-tertiary ml-auto pl-6"
151+
className="ml-auto pl-6 text-content-tertiary"
152152
/>
153153
)}
154154
</a>

npm-packages/ui/src/tailwind.config.ts renamed to npm-packages/@convex-dev/design-system/src/tailwind.config.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import tailwindScrollbar from "tailwind-scrollbar";
22
import tailwindForms from "@tailwindcss/forms";
3+
import { Config } from "tailwindcss";
34

45
export const numberedColors = {
56
red: {
@@ -157,12 +158,11 @@ export const utilColors = {
157158
},
158159
};
159160

160-
// eslint-disable-next-line import/no-default-export
161-
export default {
161+
const config: Config = {
162162
darkMode: "class",
163163
content: [
164-
"../ui/src/**/*.{js,ts,jsx,tsx}",
165-
"../ui/src/*.{js,ts,jsx,tsx}",
164+
"../@convex-dev/design-system/src/**/*.{js,ts,jsx,tsx}",
165+
"../@convex-dev/design-system/src/*.{js,ts,jsx,tsx}",
166166
"../dashboard/src/**/*.{js,ts,jsx,tsx}",
167167
"../dashboard-common/src/**/*.{js,ts,jsx,tsx}",
168168
"../dashboard-self-hosted/src/**/*.{js,ts,jsx,tsx}",
@@ -188,16 +188,16 @@ export default {
188188
},
189189
blinkFill: {
190190
"0%": {
191-
fillOpacity: 1,
192-
opacity: 1,
191+
fillOpacity: "1",
192+
opacity: "1",
193193
},
194194
"50%": {
195-
fillOpacity: 0.75,
196-
opacity: 0.75,
195+
fillOpacity: "0.75",
196+
opacity: "0.75",
197197
},
198198
"100%": {
199-
fillOpacity: 1,
200-
opacity: 1,
199+
fillOpacity: "1",
200+
opacity: "1",
201201
},
202202
},
203203
shimmer: {
@@ -207,13 +207,13 @@ export default {
207207
},
208208
blink: {
209209
"0%": {
210-
opacity: 1,
210+
opacity: "1",
211211
},
212212
"50%": {
213-
opacity: 0.5,
213+
opacity: "0.5",
214214
},
215215
"100%": {
216-
opacity: 1,
216+
opacity: "1",
217217
},
218218
},
219219
vhs: {
@@ -251,10 +251,10 @@ export default {
251251
},
252252
fadeIn: {
253253
"0%": {
254-
opacity: 0,
254+
opacity: "0",
255255
},
256256
"100%": {
257-
opacity: 1,
257+
opacity: "1",
258258
},
259259
},
260260
indeterminateProgressBar: {
@@ -295,3 +295,6 @@ export default {
295295
tailwindForms({ strategy: "class" }),
296296
],
297297
};
298+
299+
// eslint-disable-next-line import/no-default-export
300+
export default config;

npm-packages/ui/tsconfig.json renamed to npm-packages/@convex-dev/design-system/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
"downlevelIteration": true,
1515
"jsx": "preserve",
1616
"baseUrl": "./src",
17+
"declaration": true,
18+
"declarationMap": true,
1719
"rootDir": "./src",
1820
"isolatedModules": true,
19-
"noEmit": true,
2021
"outDir": "./dist",
2122
"paths": {
2223
"@ui/*": ["*"]
2324
}
2425
},
2526
"include": ["src/**/*", "src/*"],
26-
"exclude": ["node_modules"]
27+
"exclude": ["node_modules", "src/**/*.stories.tsx"]
2728
}

0 commit comments

Comments
 (0)