datum-ui
++ Datum Cloud Design System +
+ + View Documentation + +diff --git a/.changeset/config.json b/.changeset/config.json index a91a85d..5eb625e 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,12 +1,11 @@ { - "$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json", + "$schema": "https://unpkg.com/@changesets/config@3/schema.json", "changelog": "@changesets/cli/changelog", "commit": false, "fixed": [], "linked": [], "access": "public", + "baseBranch": "main", "updateInternalDependencies": "patch", - "ignore": [ - "@repo/docs" - ] -} \ No newline at end of file + "ignore": ["storybook", "docs"] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8944503 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - run: pnpm lint + + typecheck: + name: Typecheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - run: pnpm turbo typecheck + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - run: pnpm test + + build: + name: Build + runs-on: ubuntu-latest + needs: [lint, typecheck, test] + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - run: pnpm build diff --git a/.github/workflows/publish-datum-ui.yml b/.github/workflows/publish-datum-ui.yml index a1946b1..1928135 100644 --- a/.github/workflows/publish-datum-ui.yml +++ b/.github/workflows/publish-datum-ui.yml @@ -13,8 +13,8 @@ jobs: publish-datum-ui: uses: datum-cloud/actions/.github/workflows/publish-npm-package.yaml@main permissions: - contents: write # needed to push the version bump commit and tag - id-token: write # needed for npm trusted publishing (OIDC) + contents: write + id-token: write with: package-name: "@datum-cloud/datum-ui" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c8bbb4..3333c7a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,38 +5,34 @@ on: branches: - main -concurrency: ${{ github.workflow }}-${{ github.ref }} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: release: name: Release runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - - name: Checkout Repo - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Setup Node.js 24.x - uses: actions/setup-node@v4 + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 with: node-version: 24 cache: pnpm - - name: Install Dependencies - run: | - corepack enable - pnpm install --frozen-lockfile + - run: pnpm install --frozen-lockfile - name: Create Release Pull Request or Publish to npm id: changesets uses: changesets/action@v1 with: - # This expects you to have a script called release which does a build for your packages and calls changeset publish publish: pnpm release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Send a Slack notification if a publish happens - if: steps.changesets.outputs.published == 'true' - # You can do something when a publish happens. - run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!" diff --git a/.gitignore b/.gitignore index 69b9263..56175bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,13 @@ -.DS_Store -node_modules -.turbo -*.log -.next -dist -dist-ssr -*.local -.env -.cache -server/dist -public/dist +node_modules/ +dist/ storybook-static/ +.next/ +.turbo/ +coverage/ +*.tsbuildinfo +.env* +.source/ + +.claude/ +CLAUDE.MD +/docs/ \ No newline at end of file diff --git a/.npmrc b/.npmrc index 15e41aa..3e775ef 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1 @@ -auto-install-peers = true -public-hoist-pattern[]=*storybook* -engine-strict = true +auto-install-peers=true diff --git a/.nvmrc b/.nvmrc index 18c92ea..92f279e 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v24 \ No newline at end of file +v22 \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 61a83af..1d3f801 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,60 @@ { + // TypeScript — use workspace version (not VS Code's bundled one) + "typescript.tsdk": "node_modules/typescript/lib", + "typescript.enablePromptUseWorkspaceTsdk": true, + + // ESLint — flat config support + "eslint.useFlatConfig": true, "eslint.workingDirectories": [ - { - "mode": "auto" - } + { "pattern": "apps/*" }, + { "pattern": "packages/*" } ], - "typescript.tsdk": "node_modules/typescript/lib", - "css.lint.unknownAtRules": "ignore", - "scss.lint.unknownAtRules": "ignore", - "less.lint.unknownAtRules": "ignore" + + // Formatting — let ESLint handle it, disable built-in formatters + "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + + // Tailwind CSS v4 + "tailwindCSS.experimental.classRegex": [ + ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], + ["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] + ], + "tailwindCSS.includeLanguages": { + "typescript": "javascript", + "typescriptreact": "javascript" + }, + + // File associations + "files.associations": { + "*.css": "tailwindcss" + }, + + // Search and file exclusions + "search.exclude": { + "**/node_modules": true, + "**/dist": true, + "**/.next": true, + "**/.turbo": true, + "**/storybook-static": true, + "**/coverage": true, + "**/.source": true + }, + "files.exclude": { + "**/.turbo": true + }, + + // Editor defaults for the project + "editor.tabSize": 2, + "editor.insertSpaces": true, + + // File nesting for cleaner explorer + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "package.json": "pnpm-lock.yaml, pnpm-workspace.yaml, .nvmrc, turbo.json, .gitignore, .npmrc", + "tsconfig.json": "tsconfig.*.json", + "eslint.config.*": ".eslintignore" + } } diff --git a/README.md b/README.md index a97345a..57b3e8c 100644 --- a/README.md +++ b/README.md @@ -1,208 +1,100 @@ -# Turborepo Design System Starter +
+
-This is a community-maintained example. If you experience a problem, please submit a pull request with a fix. GitHub Issues will be closed.
+
+ Datum Cloud Design System & Component Library +
+ -- 🏎 [Turborepo](https://turborepo.dev) — High-performance build system for Monorepos -- 🚀 [React](https://reactjs.org/) — JavaScript library for user interfaces -- 🛠 [Tsup](https://github.com/egoist/tsup) — TypeScript bundler powered by esbuild -- 📖 [Storybook](https://storybook.js.org/) — UI component environment powered by Vite +--- -As well as a few others tools preconfigured: +## About -- [TypeScript](https://www.typescriptlang.org/) for static type checking -- [ESLint](https://eslint.org/) for code linting -- [Prettier](https://prettier.io) for code formatting -- [Changesets](https://github.com/changesets/changesets) for managing versioning and changelogs -- [GitHub Actions](https://github.com/changesets/action) for fully automated package publishing +Datum UI is Datum Cloud's design system and React component library. It provides themed, composable components built on [shadcn/ui](https://ui.shadcn.com) and [Radix UI](https://www.radix-ui.com) with a Figma-driven design token pipeline. -## Using this example +### Key Features -Run the following command: +- **50+ Components** — Buttons, forms, data tables, dialogs, navigation, and more +- **Compound Form System** — Built on Conform.js and Zod with validation, field arrays, and multi-step support +- **Design Token Pipeline** — Figma tokens → purpose tokens → theme classes +- **Dark Mode** — Built-in theme provider with system preference detection +- **TypeScript** — Fully typed with exported types for all components -```sh -npx create-turbo@latest -e design-system -``` - -### Useful Commands - -- `pnpm build` - Build all packages, including the Storybook site -- `pnpm dev` - Run all packages locally and preview with Storybook -- `pnpm lint` - Lint all packages -- `pnpm changeset` - Generate a changeset -- `pnpm clean` - Clean up all `node_modules` and `dist` folders (runs each package's clean script) - -## Turborepo - -[Turborepo](https://turborepo.dev) is a high-performance build system for JavaScript and TypeScript codebases. It was designed after the workflows used by massive software engineering organizations to ship code at scale. Turborepo abstracts the complex configuration needed for monorepos and provides fast, incremental builds with zero-configuration remote caching. - -Using Turborepo simplifies managing your design system monorepo, as you can have a single lint, build, test, and release process for all packages. [Learn more](https://vercel.com/blog/monorepos-are-changing-how-teams-build-software) about how monorepos improve your development workflow. - -## Apps & Packages - -This Turborepo includes the following packages and applications: - -- `apps/docs`: Component documentation site with Storybook -- `packages/ui`: Core React components -- `packages/typescript-config`: Shared `tsconfig.json`s used throughout the Turborepo -- `packages/eslint-config`: ESLint preset - -Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). Workspaces enables us to "hoist" dependencies that are shared between packages to the root `package.json`. This means smaller `node_modules` folders and a better local dev experience. To install a dependency for the entire monorepo, use the `-w` workspaces flag with `pnpm add`. - -This example sets up your `.gitignore` to exclude all generated files, other folders like `node_modules` used to store your dependencies. - -### Compilation +### Built With -To make the ui library code work across all browsers, we need to compile the raw TypeScript and React code to plain JavaScript. We can accomplish this with `tsup`, which uses `esbuild` to greatly improve performance. +- **React 19** — Latest React with server component support +- **Tailwind CSS v4** — Utility-first CSS framework +- **Radix UI** — Accessible, unstyled primitives +- **shadcn/ui** — Component foundation layer +- **Conform.js + Zod** — Form state management and schema validation -Running `pnpm build` from the root of the Turborepo will run the `build` command defined in each package's `package.json` file. Turborepo runs each `build` in parallel and caches & hashes the output to speed up future builds. +--- -For `@acme/ui`, the `build` command is equivalent to the following: +## Monorepo Structure -```bash -tsup src/*.tsx --format esm,cjs --dts --external react ``` - -`tsup` compiles all of the components in the design system individually, into both ES Modules and CommonJS formats as well as their TypeScript types. The `package.json` for `@acme/ui` then instructs the consumer to select the correct format: - -```json:ui/package.json -{ - "name": "@acme/ui", - "version": "0.0.0", - "sideEffects": false, - "exports":{ - "./button": { - "types": "./src/button.tsx", - "import": "./dist/button.mjs", - "require": "./dist/button.js" - } - } -} +packages/ + datum-ui/ # Component library (@datum-cloud/datum-ui) + shadcn/ # shadcn/ui primitives (@repo/shadcn) + config/ # Shared config (TypeScript, Tailwind) +apps/ + docs/ # Fumadocs documentation site + storybook/ # Storybook component explorer ``` -Run `pnpm build` to confirm compilation is working correctly. You should see a folder `ui/dist` which contains the compiled output. - -```bash -ui -└── dist - ├── button.d.ts <-- Types - ├── button.js <-- CommonJS version - ├── button.mjs <-- ES Modules version - └── button.d.mts <-- ES Modules version with Types -``` +--- -## Components +## Quick Start -Each file inside of `ui/src` is a component inside our design system. For example: - -```tsx:ui/src/Button.tsx -import * as React from 'react'; - -export interface ButtonProps { - children: React.ReactNode; -} - -export function Button(props: ButtonProps) { - return ; -} +```bash +# Install dependencies +pnpm install -Button.displayName = 'Button'; -``` +# Start Storybook +pnpm --filter storybook dev -When adding a new file, ensure that its specifier is defined in `package.json` file: - -```json:ui/package.json -{ - "name": "@acme/ui", - "version": "0.0.0", - "sideEffects": false, - "exports":{ - "./button": { - "types": "./src/button.tsx", - "import": "./dist/button.mjs", - "require": "./dist/button.js" - } - // Add new component exports here - } -} +# Start documentation site +pnpm --filter docs dev ``` -## Storybook - -Storybook provides us with an interactive UI playground for our components. This allows us to preview our components in the browser and instantly see changes when developing locally. This example preconfigures Storybook to: - -- Use Vite to bundle stories instantly (in milliseconds) -- Automatically find any stories inside the `stories/` folder -- Support using module path aliases like `@acme/ui` for imports -- Write MDX for component documentation pages - -For example, here's the included Story for our `Button` component: +> **Note:** Apps auto-build `@datum-cloud/datum-ui` before starting via a `predev` script. -```js:apps/docs/stories/button.stories.mdx -import { Button } from '@acme/ui/button'; -import { Meta, Story, Preview, Props } from '@storybook/addon-docs/blocks'; +--- - +## Usage -# Button +Install the package: -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisl eget consectetur tempor, nisl nunc egestas nisi, euismod aliquam nisl nunc euismod. - -## Props - -+ Datum Cloud Design System +
+ + View Documentation + ++ This is the main content area of the card. +
+This is the main content area of the card.
++ A simple card with only content, no header or footer. +
+A simple card with only content, no header or footer.
++ Review and update project settings below. Changes will be applied immediately after saving. +
+Review and update project settings below.
++ Detailed information revealed on demand. +
++ Platform engineer. Joined March 2024. +
+Region: us-east-1
+Replicas: 3 / 3 healthy
+Last deployed: 2 hours ago
+