diff --git a/.dockerignore b/.dockerignore
index 1f65925..5845c57 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,10 +1,6 @@
node_modules
-npm-debug.log*
-dist
-storybook-static
+**/node_modules
+**/dist
+apps/docs/storybook-static
.git
-.gitignore
-.dockerignore
-Dockerfile
-README.md
-*.log
+scripts/deploy.env
diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
new file mode 100644
index 0000000..468db42
--- /dev/null
+++ b/.gitea/workflows/ci.yml
@@ -0,0 +1,25 @@
+# Runs on every push and pull request. Gitea Actions uses GitHub Actions syntax.
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+jobs:
+ check:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 24
+ cache: npm
+ - run: npm ci
+ - run: npm run lint
+ - run: npm run typecheck
+ - run: npm test
+ # Package, landing page and Storybook.
+ - run: npm run build
+ # What `npm publish` would upload.
+ - run: npm pack -w @openkhalix/tansy-ui --dry-run
diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml
new file mode 100644
index 0000000..23dabb7
--- /dev/null
+++ b/.gitea/workflows/release.yml
@@ -0,0 +1,34 @@
+# Publishes @openkhalix/tansy-ui when a version tag (v0.4.0, v1.0.0 …) is pushed.
+#
+# Needs a repository secret NPM_TOKEN: an npm "Automation" (or granular
+# publish) token for an account that belongs to the openkhalix npm org.
+name: Release
+
+on:
+ push:
+ tags: ['v*']
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 24
+ cache: npm
+ registry-url: https://registry.npmjs.org
+ - run: npm ci
+ - name: Tag must match the package version
+ run: |
+ version=$(node -p "require('./packages/ui/package.json').version")
+ if [ "${GITHUB_REF_NAME}" != "v${version}" ]; then
+ echo "Tag ${GITHUB_REF_NAME} does not match package version v${version}" >&2
+ exit 1
+ fi
+ - run: npm run lint
+ - run: npm test
+ # prepublishOnly re-runs typecheck, tests and the library build.
+ - run: npm publish -w @openkhalix/tansy-ui --access public
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.gitignore b/.gitignore
index affcd43..4493f36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
node_modules
dist
dist-ssr
-dist-lib
storybook-static
*.local
.DS_Store
diff --git a/.oxlintrc.json b/.oxlintrc.json
index efce4b0..7cea03f 100644
--- a/.oxlintrc.json
+++ b/.oxlintrc.json
@@ -17,13 +17,13 @@
"overrides": [
{
"files": [
- "src/components/Card.tsx",
- "src/components/Dialog.tsx",
- "src/components/Drawer.tsx",
- "src/components/DropdownMenu.tsx",
- "src/components/Popover.tsx",
- "src/components/Table.tsx",
- "src/components/Tabs.tsx"
+ "packages/ui/src/components/Card.tsx",
+ "packages/ui/src/components/Dialog.tsx",
+ "packages/ui/src/components/Drawer.tsx",
+ "packages/ui/src/components/DropdownMenu.tsx",
+ "packages/ui/src/components/Popover.tsx",
+ "packages/ui/src/components/Table.tsx",
+ "packages/ui/src/components/Tabs.tsx"
],
"rules": {
"react/only-export-components": "off"
diff --git a/Dockerfile b/Dockerfile
index 30fedfd..6e48eee 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,25 +4,30 @@ FROM node:26-alpine AS build
WORKDIR /app
+# Workspace manifests first, so dependency installs cache between builds.
COPY package.json package-lock.json ./
+COPY packages/ui/package.json packages/ui/
+COPY packages/brand/package.json packages/brand/
+COPY apps/site/package.json apps/site/
+COPY apps/docs/package.json apps/docs/
RUN npm ci
COPY . .
RUN npm run lint \
- && npm run build \
- && npm run build-storybook
+ && npm test \
+ && npm run build
FROM nginx:1.29-alpine AS runtime
LABEL org.opencontainers.image.title="Tansy UI" \
org.opencontainers.image.description="Landing page and Storybook for the Tansy UI React component kit" \
org.opencontainers.image.source="local:ui-showcase" \
- org.opencontainers.image.licenses="UNLICENSED"
+ org.opencontainers.image.licenses="MIT"
COPY nginx.conf /etc/nginx/conf.d/default.conf
-COPY --from=build /app/dist /usr/share/nginx/html
-COPY --from=build /app/storybook-static /usr/share/nginx/html/docs
+COPY --from=build /app/apps/site/dist /usr/share/nginx/html
+COPY --from=build /app/apps/docs/storybook-static /usr/share/nginx/html/docs
EXPOSE 80
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7f2d37d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 OpenKhalix
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index fb483a7..631d4c6 100644
--- a/README.md
+++ b/README.md
@@ -1,186 +1,107 @@
-
+
Tansy UI
- A themeable React component kit, with every state documented in Storybook.
- By OpenKhalix.
+ A themeable, accessible React component kit by OpenKhalix.
+ Website ·
+ Storybook ·
+ Package README ·
+ Changelog
---
-Tansy UI is named after the tansy flower, also called *golden buttons*: many small, round heads that together read as one bloom. The kit works the same way. It is a set of small, owned parts (buttons, fields, selects, feedback and overlays) that combine into a consistent interface.
+Tansy UI is named after the tansy flower, also called *golden buttons*: many small, round heads that read
+as one bloom. It is published to npm as **`@openkhalix/tansy-ui`**:
-Every part ships with:
-
-- **Named variants.** A short list of deliberate choices, such as `variant="outline"`, instead of one-off styling.
-- **Its states.** Error, disabled, loading and required are part of the component, and each has its own story.
-- **Tokens, not hex codes.** Colours come from a 50–900 palette ramp, so switching the palette re-themes every part without a code change.
-
-> **Status:** pre-release (v0.3.0). Tansy UI builds as a library (`npm run build:lib`) but is not published to npm yet. It is developed in this repository, with a landing page and a Storybook workshop as its showcase.
-
-## Components
-
-Built on [Base UI](https://base-ui.com) for accessible behaviour, styled with Tailwind CSS v4.
-
-| Group | Components |
-|---|---|
-| Actions | `Button`, `IconButton`, `LinkButton`, `ToggleGroup`, `Toggle` |
-| Forms | `Field`, `Input`, `FeaturedInput`, `TextArea`, `FeaturedTextArea`, `NumberInput`, `Select`, `FeaturedSelect`, `Combobox`, `NativeSelect`, `Checkbox`, `CheckboxGroup`, `Radio`, `Switch`, `Slider` |
-| Overlays | `Dialog` (`Modal`), `AlertDialog`, `Drawer` (`Sheet`), `Popover`, `Tooltip`, `InfoTip`, `DropdownMenu` |
-| Navigation | `Tabs`, `Accordion`, `Breadcrumb`, `Pagination` |
-| Feedback | `Alert`, `Toast` (`Toaster`, `useToast`), `Spinner`, `Progress`, `Meter`, `Skeleton` |
-| Display | `Badge`, `CountBadge`, `Avatar`, `AvatarGroup`, `Kbd`, `Table` |
-| Layout | `Card`, `Separator` |
-
-Every component follows one API (see [`docs/CONVENTIONS.md`](docs/CONVENTIONS.md)):
-
-- `color` for meaning and `variant` for style;
-- `size` of `sm`, `md` or `lg`;
-- `startIcon` and `endIcon` as React nodes;
-- `label`, `description` and `error` on every field;
-- `value`, `defaultValue` and `onValueChange` for anything with a value.
-
-## Usage
-
-```css
-/* app.css */
-@import "tailwindcss";
-@import "tansy-ui/tokens.css";
-@source "../node_modules/tansy-ui/dist-lib";
+```bash
+npm install @openkhalix/tansy-ui
```
-```tsx
-import { Mail } from 'lucide-react'
-import { Button, FeaturedInput, Select, Switch } from 'tansy-ui'
+See the [package README](packages/ui/README.md) for setup and usage.
-export function InviteForm() {
- return (
-
- )
-}
-```
+## Repository layout
-**Dark mode:** add the `dark` class to ``.
+This is an npm workspaces monorepo, laid out the way MUI and shadcn/ui lay out theirs:
-## Theming
+| Path | Package | Published | What it is |
+|---|---|---|---|
+| [`packages/ui`](packages/ui) | `@openkhalix/tansy-ui` | yes | The components, their stories and tests, tokens, and the library build |
+| [`packages/brand`](packages/brand) | `@tansy/brand` | no | The Tansy mark and the component catalogue, shared by both apps |
+| [`apps/site`](apps/site) | `@tansy/site` | no | The landing page at ui.openkhalix.com |
+| [`apps/docs`](apps/docs) | `@tansy/docs` | no | Storybook at ui.openkhalix.com/docs |
+| [`docs`](docs) | | | [Conventions](docs/CONVENTIONS.md) and [roadmap](docs/ROADMAP.md) |
+| [`scripts`](scripts) | | | Deploy, story checks, package install tests, catalogue generator |
-Tansy UI ships seven palettes: Classic Blue (default), Emerald, Violet, Amber, Crimson, Slate and Teal. Each defines full `primary`, `secondary`, `gray` and `zink` ramps plus semantic colours in `src/theme/palettes.ts`.
+The apps depend on the package through its real `exports`. In this repo they resolve its `source` export
+condition, so editing a component hot-reloads the landing page and Storybook without a rebuild. Outside
+users get the built files in `dist/`.
-`applyPalette(element, name)` writes a palette as CSS custom properties on any element. Tailwind v4 reads those properties, so a palette applies to one subtree and several palettes can appear on the same page:
-
-```ts
-import { applyPalette } from './theme/applyPalette'
-
-applyPalette(document.getElementById('settings')!, 'emerald')
-```
-
-Storybook's **Palette** toolbar and the landing page playground both use this function.
-
-## Development
+## Develop
```bash
npm install
npm run dev # landing page at http://localhost:5173
-npm run storybook # component workshop at http://localhost:6006
+npm run storybook # Storybook at http://localhost:6006
npm run lint
+npm run typecheck
npm test # unit, keyboard and axe tests for every component
-npm run build # landing page -> dist/
-npm run build-storybook # workshop -> storybook-static/
-npm run build:lib # library -> dist-lib/ (ES modules, types, tokens.css)
+npm run build # package, then landing page, then Storybook
```
-To check every story in a real browser (runtime errors and axe, including colour contrast):
+### Checks before a release
```bash
-npm run build-storybook
-node scripts/check-stories.mjs --mode light
+npm run build:docs
+node scripts/check-stories.mjs --mode light # every story in Chrome: errors and axe
node scripts/check-stories.mjs --mode dark
-python3 scripts/contact-sheet.py /tmp/tansy-story-check/light # screenshots to review
+node scripts/check-stories.mjs --width 320 # nothing may scroll sideways on phones
+npm run test:package # packs the package and installs it into Vite + Tailwind,
+ # plain React and Next.js apps; each must build and render
```
-### Adding a component
+Adding a component: follow [`docs/CONVENTIONS.md`](docs/CONVENTIONS.md), export it from
+`packages/ui/src/index.ts`, then run `python3 scripts/gen_catalogue.py --patch` after `npm run build:docs`
+to refresh the landing page catalogue.
-Follow [`docs/CONVENTIONS.md`](docs/CONVENTIONS.md). In short:
+## Release
-1. Build it on Base UI where it has behaviour, in `src/components/`, with style maps in a sibling `*.tokens.ts`.
-2. Use only the tokens (`bg-surface`, `text-fg`, `primary-*`, `danger-*` …), and check it in dark mode.
-3. Add `Name.stories.tsx` with controls for every prop and a story for every state, and `Name.test.tsx` with keyboard and axe checks.
-4. Export it from `src/index.ts`.
-5. Run `npm test`, the story check in both modes, then `python3 scripts/gen_catalogue.py --patch` to refresh the landing page catalogue.
+1. Move the **Unreleased** notes in [`packages/ui/CHANGELOG.md`](packages/ui/CHANGELOG.md) under the new
+ version and set `version` in `packages/ui/package.json`.
+2. Run the checks above.
+3. Commit, tag and push: `git tag -a v0.4.0 -m "Tansy UI v0.4.0" && git push origin main --follow-tags`.
+4. The **Release** workflow (`.gitea/workflows/release.yml`) checks that the tag matches the package
+ version, re-runs the checks and publishes to npm. It needs an `NPM_TOKEN` repository secret for an
+ account in the `openkhalix` npm organisation.
-## Versioning
+To publish by hand instead: `npm login`, then `npm publish -w @openkhalix/tansy-ui` (the package's
+`prepublishOnly` runs the type-check, tests and build first).
-Tansy UI follows [Semantic Versioning](https://semver.org). While the version is `0.x`, a minor release may include breaking changes.
+## Deploy the website
-- `package.json` holds the version. The build injects it into the landing page and Storybook through `src/version.ts`, so it is never typed by hand.
-- Every release gets an entry in [`CHANGELOG.md`](CHANGELOG.md) and an annotated git tag such as `v0.2.0`.
-- Every deploy publishes `/version.json`, which records the version and commit that are live.
+The landing page is served at `/` and Storybook at `/docs/`.
-To cut a release:
+- **cPanel:** `python3 scripts/deploy.py` builds a committed tree, uploads it and removes files left over
+ from earlier builds. See [`scripts/README.md`](scripts/README.md).
+- **Container:** the `Dockerfile` runs the checks, builds both apps and serves them from nginx with a
+ `/healthz` endpoint:
-```bash
-# 1. Move the [Unreleased] notes in CHANGELOG.md under the new version, then:
-npm version minor -m "Release v%s" # or patch / major; bumps package.json, commits and tags
-git push origin main --follow-tags
-python3 scripts/deploy.py # builds that commit and deploys it
-```
-
-## Project structure
-
-```text
-src/
-├── brand/TansyMark.tsx # Palette-aware logo
-├── components/ # Components, their tokens, stories and tests
-├── data/catalogue.ts # Landing page catalogue (regenerated by scripts/gen_catalogue.py)
-├── docs/ # Storybook Introduction pages (MDX)
-├── lib/ # cn(), shared styles, useControllableState
-├── styles/tokens.css # Design tokens (shipped as tansy-ui/tokens.css)
-├── test/ # Vitest setup and the axe helper
-├── theme/ # Palettes and applyPalette()
-├── index.ts # Public API
-├── version.ts # VERSION, injected from package.json
-├── App.tsx # Landing page, built only from Tansy components
-└── index.css # Tailwind entry and landing styles
-.storybook/ # Storybook config, Tansy theme, light/dark and palette toolbars
-docs/ # CONVENTIONS.md, ROADMAP.md
-scripts/ # Deploy, catalogue, story check and contact sheets
-public/ # tansy-mark.svg and favicon.svg
-```
+ ```bash
+ docker build -t tansy-ui .
+ docker run --rm -p 8041:80 tansy-ui
+ ```
## Brand
The mark is a tansy flowerhead: six buttons in the palette's primary colour around a gold centre button.
+`packages/brand/src/TansyMark.tsx` re-themes with the active palette; `packages/brand/public/` holds the
+fixed-colour SVG and the favicon. Typefaces: Schibsted Grotesk, Instrument Sans and JetBrains Mono.
-- `src/brand/TansyMark.tsx` re-themes with the active palette. The gold centre stays fixed.
-- `public/tansy-mark.svg` is the fixed Classic Blue version, used by Storybook.
-- `public/favicon.svg` is the mark on a dark tile, so it stays visible in both light and dark browser tabs.
+## Licence
-Typefaces: Schibsted Grotesk for headings, Instrument Sans for text and JetBrains Mono for code.
-
-## Deployment
-
-The build serves the landing page at `/` and Storybook at `/docs/`.
-
-**Container.** The `Dockerfile` lints and builds both surfaces, then serves them from nginx with a `/healthz` endpoint:
-
-```bash
-docker build -t tansy-ui .
-docker run --rm -p 8041:80 tansy-ui
-curl http://127.0.0.1:8041/healthz
-```
-
-**cPanel.** `python3 scripts/deploy.py` builds, packages and uploads to a cPanel host, then removes files left over from earlier builds. See [`scripts/README.md`](scripts/README.md) for setup.
+[MIT](LICENSE) © OpenKhalix. Free to use, fork and ship in commercial products; keep the copyright
+notice in copies of the code. A visible credit ("UI by Tansy UI") is appreciated but not required.
+Contributions are welcome.
diff --git a/.storybook/ThemeSurface.tsx b/apps/docs/.storybook/ThemeSurface.tsx
similarity index 88%
rename from .storybook/ThemeSurface.tsx
rename to apps/docs/.storybook/ThemeSurface.tsx
index efecc28..0a2056d 100644
--- a/.storybook/ThemeSurface.tsx
+++ b/apps/docs/.storybook/ThemeSurface.tsx
@@ -1,6 +1,5 @@
import { useEffect, type ReactNode } from 'react'
-import { applyPalette } from '../src/theme/applyPalette'
-import type { PaletteName } from '../src/theme/palettes'
+import { applyPalette, type PaletteName } from '@openkhalix/tansy-ui'
/**
* Applies the toolbar's palette and light/dark mode to .
diff --git a/.storybook/main.ts b/apps/docs/.storybook/main.ts
similarity index 82%
rename from .storybook/main.ts
rename to apps/docs/.storybook/main.ts
index 2852edc..e666580 100644
--- a/.storybook/main.ts
+++ b/apps/docs/.storybook/main.ts
@@ -2,7 +2,7 @@ import type { StorybookConfig } from '@storybook/react-vite'
import remarkGfm from 'remark-gfm'
const config: StorybookConfig = {
- stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
+ stories: ['../src/**/*.mdx', '../../../packages/ui/src/**/*.stories.@(ts|tsx)'],
addons: [
{
name: '@storybook/addon-docs',
@@ -16,7 +16,7 @@ const config: StorybookConfig = {
options: {},
},
// Serves the Tansy mark and favicon to the manager and the Welcome page.
- staticDirs: ['../public'],
+ staticDirs: ['../../../packages/brand/public'],
docs: {
defaultName: 'Documentation',
},
diff --git a/.storybook/manager-head.html b/apps/docs/.storybook/manager-head.html
similarity index 100%
rename from .storybook/manager-head.html
rename to apps/docs/.storybook/manager-head.html
diff --git a/.storybook/manager.ts b/apps/docs/.storybook/manager.ts
similarity index 100%
rename from .storybook/manager.ts
rename to apps/docs/.storybook/manager.ts
diff --git a/.storybook/preview-head.html b/apps/docs/.storybook/preview-head.html
similarity index 100%
rename from .storybook/preview-head.html
rename to apps/docs/.storybook/preview-head.html
diff --git a/.storybook/preview.tsx b/apps/docs/.storybook/preview.tsx
similarity index 95%
rename from .storybook/preview.tsx
rename to apps/docs/.storybook/preview.tsx
index f62fde1..e1d223d 100644
--- a/.storybook/preview.tsx
+++ b/apps/docs/.storybook/preview.tsx
@@ -1,6 +1,6 @@
import type { Decorator, Preview } from '@storybook/react-vite'
-import '../src/index.css'
-import { palettes, DEFAULT_PALETTE, type PaletteName } from '../src/theme/palettes'
+import '../src/styles.css'
+import { palettes, DEFAULT_PALETTE, type PaletteName } from '@openkhalix/tansy-ui'
import { tansyTheme } from './tansyTheme'
import { ThemeSurface } from './ThemeSurface'
diff --git a/.storybook/tansyTheme.ts b/apps/docs/.storybook/tansyTheme.ts
similarity index 100%
rename from .storybook/tansyTheme.ts
rename to apps/docs/.storybook/tansyTheme.ts
diff --git a/apps/docs/package.json b/apps/docs/package.json
new file mode 100644
index 0000000..72c07cd
--- /dev/null
+++ b/apps/docs/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "@tansy/docs",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "scripts": {
+ "dev": "storybook dev -p 6006",
+ "build": "storybook build -o storybook-static"
+ },
+ "dependencies": {
+ "@openkhalix/tansy-ui": "*",
+ "@tansy/brand": "*",
+ "lucide-react": "^1.48.0",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8"
+ },
+ "devDependencies": {
+ "@storybook/addon-a11y": "^10.6.0",
+ "@storybook/addon-docs": "^10.6.0",
+ "@storybook/react-vite": "^10.6.0",
+ "@tailwindcss/vite": "^4.3.3",
+ "@types/react": "^19.2.18",
+ "@types/react-dom": "^19.2.7",
+ "@vitejs/plugin-react": "^6.1.1",
+ "remark-gfm": "^4.0.1",
+ "storybook": "^10.6.0",
+ "tailwindcss": "^4.3.3",
+ "typescript": "~6.0.2",
+ "vite": "^8.3.0"
+ }
+}
diff --git a/src/docs/Accessibility.mdx b/apps/docs/src/Accessibility.mdx
similarity index 100%
rename from src/docs/Accessibility.mdx
rename to apps/docs/src/Accessibility.mdx
diff --git a/src/docs/Changelog.mdx b/apps/docs/src/Changelog.mdx
similarity index 83%
rename from src/docs/Changelog.mdx
rename to apps/docs/src/Changelog.mdx
index bded824..54bbaee 100644
--- a/src/docs/Changelog.mdx
+++ b/apps/docs/src/Changelog.mdx
@@ -1,6 +1,6 @@
import { Meta, Markdown } from '@storybook/addon-docs/blocks'
import { DocHero } from './DocBlocks'
-import changelog from '../../CHANGELOG.md?raw'
+import changelog from '../../../packages/ui/CHANGELOG.md?raw'
diff --git a/src/docs/DocBlocks.tsx b/apps/docs/src/DocBlocks.tsx
similarity index 96%
rename from src/docs/DocBlocks.tsx
rename to apps/docs/src/DocBlocks.tsx
index 24812b8..09bf3c5 100644
--- a/src/docs/DocBlocks.tsx
+++ b/apps/docs/src/DocBlocks.tsx
@@ -1,6 +1,6 @@
import type { ReactNode } from 'react'
-import { TansyMark } from '../brand/TansyMark'
-import { VERSION } from '../version'
+import { VERSION } from '@openkhalix/tansy-ui'
+import { TansyMark } from '@tansy/brand'
/*
* Building blocks for the Storybook Introduction pages. They sit inside
diff --git a/src/docs/GettingStarted.mdx b/apps/docs/src/GettingStarted.mdx
similarity index 61%
rename from src/docs/GettingStarted.mdx
rename to apps/docs/src/GettingStarted.mdx
index 3a73749..620b4d0 100644
--- a/src/docs/GettingStarted.mdx
+++ b/apps/docs/src/GettingStarted.mdx
@@ -4,7 +4,7 @@ import { DocHero } from './DocBlocks'
- Add Tansy UI to a React 19 and Tailwind CSS v4 app, import the tokens once, and every component is ready to use.
+ Install one package, add one line of CSS, and every component is ready to use in any React 19 app, with or without Tailwind.
## Requirements
@@ -12,41 +12,36 @@ import { DocHero } from './DocBlocks'
| Dependency | Version | Why |
|---|---|---|
| React and React DOM | 19 | Peer dependency. Components take `ref` as a normal prop |
-| Tailwind CSS | 4 | Components are styled with Tailwind utilities generated from the Tansy tokens |
-| `@base-ui/react` | 1.8+ | Accessible behaviour: focus management, keyboard navigation, popups |
-| `lucide-react` | 0.460+ | The icons components draw themselves (chevrons, close, status icons) |
+| Tailwind CSS | 4, optional | With Tailwind, your build generates the utilities; without it, use the prebuilt `styles.css` |
+| `@base-ui/react` | 1.8+ | Accessible behaviour: focus management, keyboard navigation, popups. Installed with the package |
+| `lucide-react` | 1.x | The icons components draw themselves (chevrons, close, status icons). Installed with the package |
| `clsx` + `tailwind-merge` | 2 and 3 | `cn()` merges class names so your `className` always wins |
-## 1. Add the package
+## 1. Install
-Tansy UI isn't on npm yet. Build the library from this repository and install it from the folder:
+
-
+## 2. Add the styles
-You can also copy `src/components`, `src/lib` and `src/theme` into your app and own the code, as with shadcn/ui.
-
-## 2. Import the tokens
-
-The tokens define every colour utility the components use (`bg-surface`, `text-fg`, `bg-primary-500`, `border-danger-500` and so on). Import them after Tailwind, and tell Tailwind to scan the package for class names:
+**With Tailwind CSS v4** (recommended). Import the tokens after Tailwind, and let Tailwind scan the package for the classes it uses:
+**Without Tailwind.** Import the prebuilt stylesheet once. It includes the tokens, the utilities the components use, and a modern CSS reset the components rely on:
+
+
+
## 3. Render components
`. The surface, border and text tokens switch, and every component and popup follows:
@@ -80,7 +79,7 @@ Classic Blue is the default. Apply another palette to any element; everything in
diff --git a/src/docs/Roadmap.mdx b/apps/docs/src/Roadmap.mdx
similarity index 87%
rename from src/docs/Roadmap.mdx
rename to apps/docs/src/Roadmap.mdx
index 56950e8..1b0a001 100644
--- a/src/docs/Roadmap.mdx
+++ b/apps/docs/src/Roadmap.mdx
@@ -1,6 +1,6 @@
import { Meta, Markdown } from '@storybook/addon-docs/blocks'
import { DocHero } from './DocBlocks'
-import roadmap from '../../docs/ROADMAP.md?raw'
+import roadmap from '../../../docs/ROADMAP.md?raw'
diff --git a/src/docs/Theming.mdx b/apps/docs/src/Theming.mdx
similarity index 96%
rename from src/docs/Theming.mdx
rename to apps/docs/src/Theming.mdx
index 0699890..c8ee43d 100644
--- a/src/docs/Theming.mdx
+++ b/apps/docs/src/Theming.mdx
@@ -1,6 +1,6 @@
import { Meta, ColorPalette, ColorItem, Source } from '@storybook/addon-docs/blocks'
import { DocHero } from './DocBlocks'
-import { palettes } from '../theme/palettes'
+import { palettes } from '@openkhalix/tansy-ui'
@@ -20,7 +20,7 @@ export const ramp = (r) => Object.fromEntries(STEPS.map((s) => [s, r[s]]))
diff --git a/apps/docs/src/styles.css b/apps/docs/src/styles.css
new file mode 100644
index 0000000..9deebdc
--- /dev/null
+++ b/apps/docs/src/styles.css
@@ -0,0 +1,6 @@
+@import "tailwindcss";
+@import "../../../packages/ui/src/styles/tokens.css";
+
+/* Components and their stories live in the package. */
+@source "../../../packages/ui/src";
+@source not "../../../packages/ui/src/**/*.test.tsx";
diff --git a/apps/docs/tsconfig.json b/apps/docs/tsconfig.json
new file mode 100644
index 0000000..a570233
--- /dev/null
+++ b/apps/docs/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "target": "es2023",
+ "lib": ["ES2023", "DOM"],
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "customConditions": ["source"],
+ "types": ["vite/client"],
+ "jsx": "react-jsx",
+ "skipLibCheck": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "allowImportingTsExtensions": true,
+ "noEmit": true,
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true
+ },
+ "include": ["src", ".storybook"]
+}
diff --git a/apps/docs/vite.config.ts b/apps/docs/vite.config.ts
new file mode 100644
index 0000000..0a70575
--- /dev/null
+++ b/apps/docs/vite.config.ts
@@ -0,0 +1,13 @@
+import { readFileSync } from 'node:fs'
+import react from '@vitejs/plugin-react'
+import tailwindcss from '@tailwindcss/vite'
+import { defaultClientConditions, defineConfig } from 'vite'
+
+/** Storybook's Vite config: stories render the package from source. */
+const ui = JSON.parse(readFileSync(new URL('../../packages/ui/package.json', import.meta.url), 'utf8')) as { version: string }
+
+export default defineConfig({
+ plugins: [react(), tailwindcss()],
+ resolve: { conditions: ['source', ...defaultClientConditions] },
+ define: { __TANSY_VERSION__: JSON.stringify(ui.version) },
+})
diff --git a/index.html b/apps/site/index.html
similarity index 100%
rename from index.html
rename to apps/site/index.html
diff --git a/apps/site/package.json b/apps/site/package.json
new file mode 100644
index 0000000..d6e5581
--- /dev/null
+++ b/apps/site/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "@tansy/site",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite",
+ "build": "tsc -p tsconfig.json --noEmit && vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "@openkhalix/tansy-ui": "*",
+ "@tansy/brand": "*",
+ "lucide-react": "^1.48.0",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8"
+ },
+ "devDependencies": {
+ "@tailwindcss/vite": "^4.3.3",
+ "@types/react": "^19.2.18",
+ "@types/react-dom": "^19.2.7",
+ "@vitejs/plugin-react": "^6.1.1",
+ "tailwindcss": "^4.3.3",
+ "typescript": "~6.0.2",
+ "vite": "^8.3.0"
+ }
+}
diff --git a/src/App.tsx b/apps/site/src/App.tsx
similarity index 95%
rename from src/App.tsx
rename to apps/site/src/App.tsx
index 4b41818..cc19231 100644
--- a/src/App.tsx
+++ b/apps/site/src/App.tsx
@@ -1,20 +1,24 @@
import { useEffect, useState, type FormEvent, type ReactNode } from 'react'
import { ArrowRight, Mail, UserRound } from 'lucide-react'
-import { TansyMark } from './brand/TansyMark'
-import { Alert } from './components/Alert'
-import { Badge } from './components/Badge'
-import { Button, LinkButton } from './components/Button'
-import { Card } from './components/Card'
-import { Checkbox } from './components/Checkbox'
-import { FeaturedInput } from './components/FeaturedInput'
-import { FeaturedSelect } from './components/FeaturedSelect'
-import { Radio } from './components/Radio'
-import { Switch } from './components/Switch'
-import { Tooltip } from './components/Tooltip'
-import { documentation, featured, totalStories, type FeaturedName } from './data/catalogue'
-import { applyPalette } from './theme/applyPalette'
-import { VERSION } from './version'
-import { palettes, DEFAULT_PALETTE, type PaletteName } from './theme/palettes'
+import {
+ Alert,
+ Badge,
+ Button,
+ Card,
+ Checkbox,
+ FeaturedInput,
+ FeaturedSelect,
+ LinkButton,
+ Radio,
+ Switch,
+ Tooltip,
+ applyPalette,
+ palettes,
+ DEFAULT_PALETTE,
+ VERSION,
+ type PaletteName,
+} from '@openkhalix/tansy-ui'
+import { TansyMark, documentation, featured, totalStories, type FeaturedName } from '@tansy/brand'
const STORYBOOK = '/docs/'
@@ -43,8 +47,10 @@ const DOCS = {
roadmap: `${STORYBOOK}?path=/docs/introduction-roadmap--documentation`,
}
-const USAGE = `import { Button } from './Button'
-import { Switch } from './Switch'
+const USAGE = `import {
+ Button,
+ Switch,
+} from '@openkhalix/tansy-ui'
Send invite `
diff --git a/src/index.css b/apps/site/src/index.css
similarity index 98%
rename from src/index.css
rename to apps/site/src/index.css
index f2406af..7cd33ec 100644
--- a/src/index.css
+++ b/apps/site/src/index.css
@@ -1,6 +1,11 @@
@import "tailwindcss";
-@import "./styles/tokens.css";
+@import "../../../packages/ui/src/styles/tokens.css";
+
+/* The landing page renders package components: generate their utilities. */
+@source "../../../packages/ui/src";
+@source not "../../../packages/ui/src/**/*.stories.tsx";
+@source not "../../../packages/ui/src/**/*.test.tsx";
/* ------------------------------------------------------------------
Tansy UI landing page.
diff --git a/src/main.tsx b/apps/site/src/main.tsx
similarity index 100%
rename from src/main.tsx
rename to apps/site/src/main.tsx
diff --git a/apps/site/tsconfig.json b/apps/site/tsconfig.json
new file mode 100644
index 0000000..e90a2fe
--- /dev/null
+++ b/apps/site/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "target": "es2023",
+ "lib": ["ES2023", "DOM"],
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "customConditions": ["source"],
+ "types": ["vite/client"],
+ "jsx": "react-jsx",
+ "skipLibCheck": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "allowImportingTsExtensions": true,
+ "noEmit": true,
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true
+ },
+ "include": ["src"]
+}
diff --git a/apps/site/vite.config.ts b/apps/site/vite.config.ts
new file mode 100644
index 0000000..38065cd
--- /dev/null
+++ b/apps/site/vite.config.ts
@@ -0,0 +1,15 @@
+import { readFileSync } from 'node:fs'
+import react from '@vitejs/plugin-react'
+import tailwindcss from '@tailwindcss/vite'
+import { defaultClientConditions, defineConfig } from 'vite'
+
+const ui = JSON.parse(readFileSync(new URL('../../packages/ui/package.json', import.meta.url), 'utf8')) as { version: string }
+
+export default defineConfig({
+ plugins: [react(), tailwindcss()],
+ // Resolve @openkhalix/tansy-ui to its source (the "source" export condition),
+ // so edits to components hot-reload without rebuilding the package.
+ resolve: { conditions: ['source', ...defaultClientConditions] },
+ define: { __TANSY_VERSION__: JSON.stringify(ui.version) },
+ publicDir: '../../packages/brand/public',
+})
diff --git a/docs/CONVENTIONS.md b/docs/CONVENTIONS.md
index ff78c99..66549b1 100644
--- a/docs/CONVENTIONS.md
+++ b/docs/CONVENTIONS.md
@@ -1,8 +1,8 @@
# Component conventions
Every Tansy UI component follows these rules, so the kit reads as one API. The
-reference implementations are `src/components/Button.tsx`, `Input.tsx` and
-`Field.tsx`, with their stories and tests. When in doubt, copy them.
+reference implementations are `packages/ui/src/components/Button.tsx`,
+`Input.tsx` and `Field.tsx`, with their stories and tests. When in doubt, copy them.
## Foundation
@@ -16,7 +16,8 @@ reference implementations are `src/components/Button.tsx`, `Input.tsx` and
- **Styling:** Tailwind v4 utilities only. Shared class strings live in
`src/lib/styles.ts` (`focusRing`, `controlHeight`, `controlBox`, `popupSurface`,
`popupMotion`, `listItem`, `labelText`, `descriptionText`, `errorText`).
- Use them instead of repeating utilities.
+ Use them instead of repeating utilities. (Paths in this document are relative
+ to `packages/ui`.)
- **Class merging:** always `cn(...)` from `src/lib/cn.ts`, with the consumer's
`className` last so it wins.
- **Refs:** React 19 passes `ref` as a normal prop. Type props from
@@ -125,12 +126,13 @@ Every component has `Name.test.tsx` (Vitest, Testing Library, user-event):
- keyboard interaction for the component's pattern (Escape, arrows, Enter/Space),
- `await expectNoA11yViolations(container)` from `src/test/a11y.ts`.
-Run `npx vitest run src/components/Name.test.tsx`.
+Run `npx vitest run src/components/Name.test.tsx` inside `packages/ui`, or
+`npm test` from the root. Export every public component from `src/index.ts`.
## Checking in a real browser
```bash
-npm run build-storybook
+npm run build:docs
node scripts/check-stories.mjs --filter forms-input --mode light
node scripts/check-stories.mjs --filter forms-input --mode dark
python3 scripts/contact-sheet.py /tmp/tansy-story-check/light --prefix forms-input
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index e6437bc..cf86af6 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -3,13 +3,13 @@
Where Tansy UI stands against MUI and shadcn/ui, what's done, and what comes
before v1.
-Last reviewed: 2026-09-28, at v0.3.0.
+Last reviewed: 2026-09-29, at v0.4.0.
## Where things stand
| | Tansy UI (v0.3) | shadcn/ui | MUI (Material UI + Base UI) |
|---|---|---|---|
-| Distribution | Library build (ES modules, types, tokens.css); not yet on npm | CLI and registries. CLI v4 installs a whole design system in one payload | npm packages |
+| Distribution | npm package `@openkhalix/tansy-ui` (ES modules, types, Tailwind or prebuilt CSS) | CLI and registries. CLI v4 installs a whole design system in one payload | npm packages |
| Components | 38 | 50+, plus blocks and charts | Material UI's full set; Base UI v1 has 35 unstyled parts; MUI X adds Data Grid, Charts, Date Pickers, Tree View |
| Accessibility base | Base UI primitives | Radix and Base UI primitives | Base UI primitives |
| Theming | Seven runtime palettes, scoped to any element; semantic tokens | CSS variables | `createTheme`, CSS variables |
@@ -63,13 +63,25 @@ and a docs page.
## Phase 2: Distribution
-- [ ] Claim the npm scope and publish the library build.
+Done in v0.4.0:
+
+- [x] Monorepo: `packages/ui` (published), `apps/site`, `apps/docs`
+- [x] Package `@openkhalix/tansy-ui`: ES modules per component, types,
+ `"use client"` for Next.js, `tokens.css` for Tailwind apps and a
+ prebuilt `styles.css` for apps without Tailwind
+- [x] MIT licence
+- [x] Install tests: the packed tarball must build and render in Vite +
+ Tailwind, plain React and Next.js apps (`npm run test:package`)
+- [x] CI and tag-triggered publishing (Gitea Actions)
+
+Still to do:
+
+- [ ] Create the `openkhalix` npm organisation and publish the first release.
- [ ] Serve the same components as a shadcn-compatible registry, so
- `npx shadcn add ` copies a Tansy component into a project: the
- same code as a dependency or as source you own.
+ `npx shadcn add ` copies a Tansy component into a project.
- [ ] Ship the palettes as a registry base item (tokens, fonts and CSS
variables in one install).
-- [ ] Automate releases (Changesets) from `CHANGELOG.md`.
+- [ ] A public repository URL in `package.json` once the repo is public.
## Phase 3: Where Tansy can lead
diff --git a/package-lock.json b/package-lock.json
index 3ffa8e3..06913e5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,46 +1,67 @@
{
- "name": "tansy-ui",
- "version": "0.3.1",
+ "name": "tansy-ui-monorepo",
+ "version": "0.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "tansy-ui",
- "version": "0.3.1",
+ "name": "tansy-ui-monorepo",
+ "version": "0.0.0",
+ "license": "MIT",
+ "workspaces": [
+ "packages/*",
+ "apps/*"
+ ],
+ "devDependencies": {
+ "axe-core": "^4.13.0",
+ "oxlint": "^1.81.0",
+ "playwright": "^1.63.0",
+ "typescript": "~6.0.2"
+ }
+ },
+ "apps/docs": {
+ "name": "@tansy/docs",
+ "version": "0.0.0",
"dependencies": {
- "@base-ui/react": "^1.8.0",
- "clsx": "^2.1.1",
- "lucide-react": "^0.460.0",
- "tailwind-merge": "^3.7.0"
+ "@openkhalix/tansy-ui": "*",
+ "@tansy/brand": "*",
+ "lucide-react": "^1.48.0",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8"
},
"devDependencies": {
"@storybook/addon-a11y": "^10.6.0",
"@storybook/addon-docs": "^10.6.0",
"@storybook/react-vite": "^10.6.0",
"@tailwindcss/vite": "^4.3.3",
- "@testing-library/jest-dom": "^7.0.1",
- "@testing-library/react": "^16.3.3",
- "@testing-library/user-event": "^14.6.7",
- "@types/node": "^24.13.3",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.7",
"@vitejs/plugin-react": "^6.1.1",
- "axe-core": "^4.13.0",
- "jsdom": "^30.1.1",
- "oxlint": "^1.81.0",
- "playwright": "^1.63.0",
- "react": "^19.2.8",
- "react-dom": "^19.2.8",
"remark-gfm": "^4.0.1",
"storybook": "^10.6.0",
"tailwindcss": "^4.3.3",
"typescript": "~6.0.2",
- "vite": "^8.3.0",
- "vitest": "^5.0.2"
+ "vite": "^8.3.0"
+ }
+ },
+ "apps/site": {
+ "name": "@tansy/site",
+ "version": "0.0.0",
+ "dependencies": {
+ "@openkhalix/tansy-ui": "*",
+ "@tansy/brand": "*",
+ "lucide-react": "^1.48.0",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8"
},
- "peerDependencies": {
- "react": "^19.0.0",
- "react-dom": "^19.0.0"
+ "devDependencies": {
+ "@tailwindcss/vite": "^4.3.3",
+ "@types/react": "^19.2.18",
+ "@types/react-dom": "^19.2.7",
+ "@vitejs/plugin-react": "^6.1.1",
+ "tailwindcss": "^4.3.3",
+ "typescript": "~6.0.2",
+ "vite": "^8.3.0"
}
},
"node_modules/@adobe/css-tools": {
@@ -1197,6 +1218,10 @@
"@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4"
}
},
+ "node_modules/@openkhalix/tansy-ui": {
+ "resolved": "packages/ui",
+ "link": true
+ },
"node_modules/@oxc-parser/binding-android-arm-eabi": {
"version": "0.127.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.127.0.tgz",
@@ -2249,6 +2274,346 @@
"node": "^20.19.0 || >=22.12.0"
}
},
+ "node_modules/@parcel/watcher": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz",
+ "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "dependencies": {
+ "detect-libc": "^1.0.3",
+ "is-glob": "^4.0.3",
+ "micromatch": "^4.0.5",
+ "node-addon-api": "^7.0.0"
+ },
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ },
+ "optionalDependencies": {
+ "@parcel/watcher-android-arm64": "2.5.1",
+ "@parcel/watcher-darwin-arm64": "2.5.1",
+ "@parcel/watcher-darwin-x64": "2.5.1",
+ "@parcel/watcher-freebsd-x64": "2.5.1",
+ "@parcel/watcher-linux-arm-glibc": "2.5.1",
+ "@parcel/watcher-linux-arm-musl": "2.5.1",
+ "@parcel/watcher-linux-arm64-glibc": "2.5.1",
+ "@parcel/watcher-linux-arm64-musl": "2.5.1",
+ "@parcel/watcher-linux-x64-glibc": "2.5.1",
+ "@parcel/watcher-linux-x64-musl": "2.5.1",
+ "@parcel/watcher-win32-arm64": "2.5.1",
+ "@parcel/watcher-win32-ia32": "2.5.1",
+ "@parcel/watcher-win32-x64": "2.5.1"
+ }
+ },
+ "node_modules/@parcel/watcher-android-arm64": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz",
+ "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-darwin-arm64": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz",
+ "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-darwin-x64": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz",
+ "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-freebsd-x64": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz",
+ "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm-glibc": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz",
+ "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm-musl": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz",
+ "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm64-glibc": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz",
+ "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm64-musl": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz",
+ "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-x64-glibc": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz",
+ "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-x64-musl": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz",
+ "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-win32-arm64": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz",
+ "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-win32-ia32": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz",
+ "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-win32-x64": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz",
+ "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher/node_modules/detect-libc": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
+ "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "detect-libc": "bin/detect-libc.js"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
"node_modules/@rolldown/binding-android-arm-eabi": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.11.tgz",
@@ -2730,6 +3095,25 @@
}
}
},
+ "node_modules/@tailwindcss/cli": {
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/@tailwindcss/cli/-/cli-4.3.3.tgz",
+ "integrity": "sha512-ZvS/n1ZHOBKcVlhkt8l5NNr1EDXk1NboYO5CYDOs6NUmvT9z6bzkwsosaJftY57T/3gWNzWMJzIXLodZC8ssdw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@parcel/watcher": "2.5.1",
+ "@tailwindcss/node": "4.3.3",
+ "@tailwindcss/oxide": "4.3.3",
+ "enhanced-resolve": "^5.24.1",
+ "mri": "^1.2.0",
+ "picocolors": "^1.1.1",
+ "tailwindcss": "4.3.3"
+ },
+ "bin": {
+ "tailwindcss": "dist/index.mjs"
+ }
+ },
"node_modules/@tailwindcss/node": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.3.tgz",
@@ -3024,6 +3408,18 @@
"vite": "^5.2.0 || ^6 || ^7 || ^8"
}
},
+ "node_modules/@tansy/brand": {
+ "resolved": "packages/brand",
+ "link": true
+ },
+ "node_modules/@tansy/docs": {
+ "resolved": "apps/docs",
+ "link": true
+ },
+ "node_modules/@tansy/site": {
+ "resolved": "apps/site",
+ "link": true
+ },
"node_modules/@testing-library/dom": {
"version": "10.4.2",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz",
@@ -3574,6 +3970,19 @@
"node": "20 || >=22"
}
},
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/browserslist": {
"version": "4.29.1",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.1.tgz",
@@ -4105,6 +4514,19 @@
}
}
},
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
@@ -4233,6 +4655,29 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/is-inside-container": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
@@ -4252,6 +4697,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
"node_modules/is-plain-obj": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",
@@ -4680,12 +5135,12 @@
}
},
"node_modules/lucide-react": {
- "version": "0.460.0",
- "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.460.0.tgz",
- "integrity": "sha512-BVtq/DykVeIvRTJvRAgCsOwaGL8Un3Bxh8MbDxMhEWlZay3T4IpEKDEpwt5KZ0KJMHzgm6jrltxlT5eXOWXDHg==",
+ "version": "1.48.0",
+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.48.0.tgz",
+ "integrity": "sha512-R0CIKY/fXiC6y9xRBADgsK+VW2p/pcTJOMhLZf1T+uG+vJUvyUR02nGOgmIIC7MPkiNK4Ox8QDnbqF8rJYWPZQ==",
"license": "ISC",
"peerDependencies": {
- "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc"
+ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/lz-string": {
@@ -5541,6 +5996,33 @@
],
"license": "MIT"
},
+ "node_modules/micromatch": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "braces": "^3.0.3",
+ "picomatch": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/micromatch/node_modules/picomatch": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
"node_modules/min-indent": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
@@ -5587,6 +6069,16 @@
"node": ">=16 || 14 >=14.17"
}
},
+ "node_modules/mri": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
+ "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -5613,6 +6105,13 @@
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
+ "node_modules/node-addon-api": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
+ "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/node-releases": {
"version": "2.0.57",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.57.tgz",
@@ -6471,6 +6970,19 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
"node_modules/tough-cookie": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz",
@@ -7320,6 +7832,46 @@
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
+ },
+ "packages/brand": {
+ "name": "@tansy/brand",
+ "version": "0.0.0",
+ "peerDependencies": {
+ "react": "^19.0.0"
+ }
+ },
+ "packages/ui": {
+ "name": "@openkhalix/tansy-ui",
+ "version": "0.4.0",
+ "license": "MIT",
+ "dependencies": {
+ "@base-ui/react": "^1.8.0",
+ "clsx": "^2.1.1",
+ "lucide-react": "^1.48.0",
+ "tailwind-merge": "^3.7.0"
+ },
+ "devDependencies": {
+ "@tailwindcss/cli": "^4.3.3",
+ "@testing-library/jest-dom": "^7.0.1",
+ "@testing-library/react": "^16.3.3",
+ "@testing-library/user-event": "^14.6.7",
+ "@types/node": "^24.13.3",
+ "@types/react": "^19.2.18",
+ "@types/react-dom": "^19.2.7",
+ "@vitejs/plugin-react": "^6.1.1",
+ "axe-core": "^4.13.0",
+ "jsdom": "^30.1.1",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8",
+ "tailwindcss": "^4.3.3",
+ "typescript": "~6.0.2",
+ "vite": "^8.3.0",
+ "vitest": "^5.0.2"
+ },
+ "peerDependencies": {
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0"
+ }
}
}
}
diff --git a/package.json b/package.json
index 51e5ce9..f055a16 100644
--- a/package.json
+++ b/package.json
@@ -1,72 +1,31 @@
{
- "name": "tansy-ui",
+ "name": "tansy-ui-monorepo",
"private": true,
- "version": "0.3.1",
- "description": "A themeable, accessible React component kit built on Base UI and Tailwind CSS v4.",
+ "version": "0.0.0",
"type": "module",
- "sideEffects": [
- "*.css"
- ],
- "module": "./dist-lib/index.js",
- "types": "./dist-lib/index.d.ts",
- "exports": {
- ".": {
- "types": "./dist-lib/index.d.ts",
- "import": "./dist-lib/index.js"
- },
- "./tokens.css": "./dist-lib/tokens.css",
- "./package.json": "./package.json"
- },
- "files": [
- "dist-lib",
- "README.md",
- "CHANGELOG.md"
+ "description": "Tansy UI: the @openkhalix/tansy-ui package, its Storybook and its landing page.",
+ "license": "MIT",
+ "workspaces": [
+ "packages/*",
+ "apps/*"
],
"scripts": {
- "dev": "vite",
- "build": "tsc -b && vite build",
- "build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.lib.json && cp src/styles/tokens.css dist-lib/tokens.css",
- "lint": "oxlint src .storybook",
- "test": "vitest run",
- "test:watch": "vitest",
+ "dev": "npm run dev -w @tansy/site",
+ "storybook": "npm run dev -w @tansy/docs",
+ "build": "npm run build -w @openkhalix/tansy-ui && npm run build -w @tansy/site && npm run build -w @tansy/docs",
+ "build:lib": "npm run build -w @openkhalix/tansy-ui",
+ "build:site": "npm run build -w @tansy/site",
+ "build:docs": "npm run build -w @tansy/docs",
+ "test": "npm test -w @openkhalix/tansy-ui",
+ "typecheck": "npm run typecheck -w @openkhalix/tansy-ui && tsc -p apps/site/tsconfig.json --noEmit",
+ "lint": "oxlint packages apps",
"check:stories": "node scripts/check-stories.mjs",
- "preview": "vite preview",
- "storybook": "storybook dev -p 6006",
- "build-storybook": "storybook build"
- },
- "peerDependencies": {
- "react": "^19.0.0",
- "react-dom": "^19.0.0"
- },
- "dependencies": {
- "@base-ui/react": "^1.8.0",
- "clsx": "^2.1.1",
- "lucide-react": "^0.460.0",
- "tailwind-merge": "^3.7.0"
+ "test:package": "node scripts/test-package.mjs"
},
"devDependencies": {
- "@storybook/addon-a11y": "^10.6.0",
- "@storybook/addon-docs": "^10.6.0",
- "@storybook/react-vite": "^10.6.0",
- "@tailwindcss/vite": "^4.3.3",
- "@testing-library/jest-dom": "^7.0.1",
- "@testing-library/react": "^16.3.3",
- "@testing-library/user-event": "^14.6.7",
- "@types/node": "^24.13.3",
- "@types/react": "^19.2.18",
- "@types/react-dom": "^19.2.7",
- "@vitejs/plugin-react": "^6.1.1",
"axe-core": "^4.13.0",
- "jsdom": "^30.1.1",
"oxlint": "^1.81.0",
"playwright": "^1.63.0",
- "react": "^19.2.8",
- "react-dom": "^19.2.8",
- "remark-gfm": "^4.0.1",
- "storybook": "^10.6.0",
- "tailwindcss": "^4.3.3",
- "typescript": "~6.0.2",
- "vite": "^8.3.0",
- "vitest": "^5.0.2"
+ "typescript": "~6.0.2"
}
}
diff --git a/packages/brand/package.json b/packages/brand/package.json
new file mode 100644
index 0000000..0db5d91
--- /dev/null
+++ b/packages/brand/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@tansy/brand",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "description": "Tansy UI logo and catalogue data, shared by the landing page and Storybook. Not published.",
+ "exports": {
+ ".": "./src/index.ts",
+ "./public/*": "./public/*"
+ },
+ "peerDependencies": {
+ "react": "^19.0.0"
+ }
+}
diff --git a/public/favicon.svg b/packages/brand/public/favicon.svg
similarity index 100%
rename from public/favicon.svg
rename to packages/brand/public/favicon.svg
diff --git a/public/tansy-mark.svg b/packages/brand/public/tansy-mark.svg
similarity index 100%
rename from public/tansy-mark.svg
rename to packages/brand/public/tansy-mark.svg
diff --git a/src/brand/TansyMark.tsx b/packages/brand/src/TansyMark.tsx
similarity index 100%
rename from src/brand/TansyMark.tsx
rename to packages/brand/src/TansyMark.tsx
diff --git a/src/data/catalogue.ts b/packages/brand/src/catalogue.ts
similarity index 100%
rename from src/data/catalogue.ts
rename to packages/brand/src/catalogue.ts
diff --git a/packages/brand/src/index.ts b/packages/brand/src/index.ts
new file mode 100644
index 0000000..c14f217
--- /dev/null
+++ b/packages/brand/src/index.ts
@@ -0,0 +1,10 @@
+export { TansyMark, type TansyMarkProps } from './TansyMark'
+export {
+ documentation,
+ featured,
+ featuredNames,
+ storyCounts,
+ totalStories,
+ type CatalogueEntry,
+ type FeaturedName,
+} from './catalogue'
diff --git a/CHANGELOG.md b/packages/ui/CHANGELOG.md
similarity index 83%
rename from CHANGELOG.md
rename to packages/ui/CHANGELOG.md
index 43018b4..28bbca0 100644
--- a/CHANGELOG.md
+++ b/packages/ui/CHANGELOG.md
@@ -7,6 +7,36 @@ All notable changes to Tansy UI are recorded here. The format follows
## [Unreleased]
+## [0.4.0] - 2026-09-29
+
+Tansy UI is now a publishable npm package: **`@openkhalix/tansy-ui`**.
+
+### Added
+
+- **Package:** `npm install @openkhalix/tansy-ui`. One ES module per component
+ (tree-shakeable), TypeScript declarations, and MIT licence.
+- **Two ways to style:** `@openkhalix/tansy-ui/tokens.css` for Tailwind v4
+ apps, or the prebuilt `@openkhalix/tansy-ui/styles.css` for apps without
+ Tailwind (tokens, the utilities the components use, and a modern reset).
+- **Next.js:** component modules are marked `"use client"`, so they import
+ directly into Server Components; helpers stay server-safe.
+- **Install tests:** `npm run test:package` installs the packed tarball into
+ Vite + Tailwind (strict types), plain React and Next.js apps and checks each
+ builds and renders correctly.
+- **Release workflow:** tag `vX.Y.Z` to publish from CI.
+
+### Changed
+
+- **Monorepo:** the package lives in `packages/ui`, the landing page in
+ `apps/site` and Storybook in `apps/docs`.
+- `lucide-react` 1.x (0.460's types don't compile against current React 19
+ types when an app type-checks its dependencies).
+
+### Breaking
+
+- The package name is `@openkhalix/tansy-ui` (it was the unpublished
+ `tansy-ui`), and its build output moved from `dist-lib/` to `dist/`.
+
## [0.3.1] - 2026-09-28
Every component and the landing page now work from 320px phones to wide
diff --git a/packages/ui/LICENSE b/packages/ui/LICENSE
new file mode 100644
index 0000000..7f2d37d
--- /dev/null
+++ b/packages/ui/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 OpenKhalix
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/packages/ui/README.md b/packages/ui/README.md
new file mode 100644
index 0000000..4f73b07
--- /dev/null
+++ b/packages/ui/README.md
@@ -0,0 +1,115 @@
+# Tansy UI
+
+A themeable, accessible React component kit by [OpenKhalix](https://ui.openkhalix.com), built on
+[Base UI](https://base-ui.com) and Tailwind CSS v4.
+
+- **38 components:** forms with floating labels, selects and comboboxes, dialogs, drawers, menus, tabs,
+ toasts, tables and more.
+- **Accessible:** keyboard support and screen-reader wiring from Base UI, visible focus rings, and every
+ story checked with axe in light and dark mode.
+- **Themeable:** seven palettes switchable at runtime, class-based dark mode, and one semantic token set.
+- **One API:** `color`, `variant` and `size` on everything; `label`, `description` and `error` on every
+ field; controlled or uncontrolled values.
+
+**Docs and live examples:** https://ui.openkhalix.com/docs/
+
+## Install
+
+```bash
+npm install @openkhalix/tansy-ui
+```
+
+Needs React 19. `@base-ui/react`, `lucide-react`, `clsx` and `tailwind-merge` install with it.
+
+## Add the styles
+
+Pick one of the two setups.
+
+### With Tailwind CSS v4 (recommended)
+
+Import the tokens after Tailwind, and let Tailwind scan the package for the classes it uses:
+
+```css
+/* app.css */
+@import "tailwindcss";
+@import "@openkhalix/tansy-ui/tokens.css";
+@source "../node_modules/@openkhalix/tansy-ui/dist";
+```
+
+Your own Tailwind utilities can then use the same tokens (`bg-surface`, `text-fg`, `bg-primary-500`).
+
+### Without Tailwind
+
+Import the prebuilt stylesheet once, for example in your entry file:
+
+```ts
+import '@openkhalix/tansy-ui/styles.css'
+```
+
+It contains the tokens, only the utilities the components use, and a modern CSS reset (Tailwind's
+preflight), which the components rely on, much as MUI relies on `CssBaseline`. The reset normalises
+margins, borders and form controls across your app. If you already use Tailwind, use the setup above
+instead.
+
+## Use
+
+```tsx
+import { Mail } from 'lucide-react'
+import { Button, FeaturedInput, Select, Switch } from '@openkhalix/tansy-ui'
+
+export function InviteForm() {
+ return (
+
+ )
+}
+```
+
+### Next.js
+
+Components are marked `"use client"`, so you can import them straight into Server Components. Helpers such
+as `cn` and `applyPalette` stay server-safe.
+
+## Dark mode and palettes
+
+```ts
+import { applyPalette } from '@openkhalix/tansy-ui'
+
+document.documentElement.classList.toggle('dark', true) // dark mode
+applyPalette(document.documentElement, 'emerald') // classicBlue, emerald, violet, amber, crimson, slate, teal
+```
+
+Apply a palette to `` so popups, which render in a portal, pick it up too.
+
+## Components
+
+| Group | Components |
+|---|---|
+| Actions | `Button`, `IconButton`, `LinkButton`, `ToggleGroup`, `Toggle` |
+| Forms | `Field`, `Input`, `FeaturedInput`, `TextArea`, `FeaturedTextArea`, `NumberInput`, `Select`, `FeaturedSelect`, `Combobox`, `NativeSelect`, `Checkbox`, `CheckboxGroup`, `Radio`, `Switch`, `Slider` |
+| Overlays | `Dialog` (`Modal`), `AlertDialog`, `Drawer` (`Sheet`), `Popover`, `Tooltip`, `InfoTip`, `DropdownMenu` |
+| Navigation | `Tabs`, `Accordion`, `Breadcrumb`, `Pagination` |
+| Feedback | `Alert`, `Toast` (`Toaster`, `useToast`), `Spinner`, `Progress`, `Meter`, `Skeleton` |
+| Display | `Badge`, `CountBadge`, `Avatar`, `AvatarGroup`, `Kbd`, `Table` |
+| Layout | `Card`, `Separator` |
+
+Every component has a Storybook page with its props, controls and a story for each state:
+https://ui.openkhalix.com/docs/
+
+## Licence and credit
+
+MIT © OpenKhalix. Use it, fork it, and ship it in commercial products, free. The licence's only condition
+is that you keep the copyright notice in copies of the code.
+
+If Tansy UI helps you, a visible credit such as "UI by [Tansy UI](https://ui.openkhalix.com)" in your
+README or site footer is much appreciated. It isn't required.
diff --git a/packages/ui/package.json b/packages/ui/package.json
new file mode 100644
index 0000000..8ac9a0d
--- /dev/null
+++ b/packages/ui/package.json
@@ -0,0 +1,78 @@
+{
+ "name": "@openkhalix/tansy-ui",
+ "version": "0.4.0",
+ "description": "A themeable, accessible React component kit built on Base UI and Tailwind CSS v4.",
+ "license": "MIT",
+ "author": "OpenKhalix",
+ "homepage": "https://ui.openkhalix.com",
+ "keywords": [
+ "react",
+ "components",
+ "ui",
+ "design-system",
+ "tailwindcss",
+ "base-ui",
+ "accessible",
+ "dark-mode"
+ ],
+ "type": "module",
+ "sideEffects": [
+ "*.css"
+ ],
+ "module": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "exports": {
+ ".": {
+ "source": "./src/index.ts",
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js"
+ },
+ "./tokens.css": "./dist/tokens.css",
+ "./styles.css": "./dist/styles.css",
+ "./package.json": "./package.json"
+ },
+ "files": [
+ "dist",
+ "README.md",
+ "CHANGELOG.md",
+ "LICENSE"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "scripts": {
+ "build": "vite build --config vite.lib.config.ts && tsc -p tsconfig.lib.json && cp src/styles/tokens.css dist/tokens.css && tailwindcss -i src/styles/styles.css -o dist/styles.css --minify",
+ "typecheck": "tsc -p tsconfig.json --noEmit",
+ "test": "vitest run",
+ "test:watch": "vitest",
+ "prepublishOnly": "npm run typecheck && npm test && npm run build"
+ },
+ "peerDependencies": {
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0"
+ },
+ "dependencies": {
+ "@base-ui/react": "^1.8.0",
+ "clsx": "^2.1.1",
+ "lucide-react": "^1.48.0",
+ "tailwind-merge": "^3.7.0"
+ },
+ "devDependencies": {
+ "@testing-library/jest-dom": "^7.0.1",
+ "@testing-library/react": "^16.3.3",
+ "@testing-library/user-event": "^14.6.7",
+ "@types/node": "^24.13.3",
+ "@types/react": "^19.2.18",
+ "@types/react-dom": "^19.2.7",
+ "@vitejs/plugin-react": "^6.1.1",
+ "axe-core": "^4.13.0",
+ "jsdom": "^30.1.1",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8",
+ "tailwindcss": "^4.3.3",
+ "typescript": "~6.0.2",
+ "vite": "^8.3.0",
+ "vitest": "^5.0.2",
+ "@tailwindcss/cli": "^4.3.3"
+ }
+}
diff --git a/src/components/Accordion.stories.tsx b/packages/ui/src/components/Accordion.stories.tsx
similarity index 100%
rename from src/components/Accordion.stories.tsx
rename to packages/ui/src/components/Accordion.stories.tsx
diff --git a/src/components/Accordion.test.tsx b/packages/ui/src/components/Accordion.test.tsx
similarity index 100%
rename from src/components/Accordion.test.tsx
rename to packages/ui/src/components/Accordion.test.tsx
diff --git a/src/components/Accordion.tsx b/packages/ui/src/components/Accordion.tsx
similarity index 100%
rename from src/components/Accordion.tsx
rename to packages/ui/src/components/Accordion.tsx
diff --git a/src/components/Alert.stories.tsx b/packages/ui/src/components/Alert.stories.tsx
similarity index 100%
rename from src/components/Alert.stories.tsx
rename to packages/ui/src/components/Alert.stories.tsx
diff --git a/src/components/Alert.test.tsx b/packages/ui/src/components/Alert.test.tsx
similarity index 100%
rename from src/components/Alert.test.tsx
rename to packages/ui/src/components/Alert.test.tsx
diff --git a/src/components/Alert.tsx b/packages/ui/src/components/Alert.tsx
similarity index 100%
rename from src/components/Alert.tsx
rename to packages/ui/src/components/Alert.tsx
diff --git a/src/components/AlertDialog.stories.tsx b/packages/ui/src/components/AlertDialog.stories.tsx
similarity index 100%
rename from src/components/AlertDialog.stories.tsx
rename to packages/ui/src/components/AlertDialog.stories.tsx
diff --git a/src/components/AlertDialog.test.tsx b/packages/ui/src/components/AlertDialog.test.tsx
similarity index 100%
rename from src/components/AlertDialog.test.tsx
rename to packages/ui/src/components/AlertDialog.test.tsx
diff --git a/src/components/AlertDialog.tsx b/packages/ui/src/components/AlertDialog.tsx
similarity index 100%
rename from src/components/AlertDialog.tsx
rename to packages/ui/src/components/AlertDialog.tsx
diff --git a/src/components/Avatar.stories.tsx b/packages/ui/src/components/Avatar.stories.tsx
similarity index 100%
rename from src/components/Avatar.stories.tsx
rename to packages/ui/src/components/Avatar.stories.tsx
diff --git a/src/components/Avatar.test.tsx b/packages/ui/src/components/Avatar.test.tsx
similarity index 100%
rename from src/components/Avatar.test.tsx
rename to packages/ui/src/components/Avatar.test.tsx
diff --git a/src/components/Avatar.tsx b/packages/ui/src/components/Avatar.tsx
similarity index 100%
rename from src/components/Avatar.tsx
rename to packages/ui/src/components/Avatar.tsx
diff --git a/src/components/Badge.stories.tsx b/packages/ui/src/components/Badge.stories.tsx
similarity index 100%
rename from src/components/Badge.stories.tsx
rename to packages/ui/src/components/Badge.stories.tsx
diff --git a/src/components/Badge.test.tsx b/packages/ui/src/components/Badge.test.tsx
similarity index 100%
rename from src/components/Badge.test.tsx
rename to packages/ui/src/components/Badge.test.tsx
diff --git a/src/components/Badge.tsx b/packages/ui/src/components/Badge.tsx
similarity index 100%
rename from src/components/Badge.tsx
rename to packages/ui/src/components/Badge.tsx
diff --git a/src/components/Breadcrumb.stories.tsx b/packages/ui/src/components/Breadcrumb.stories.tsx
similarity index 100%
rename from src/components/Breadcrumb.stories.tsx
rename to packages/ui/src/components/Breadcrumb.stories.tsx
diff --git a/src/components/Breadcrumb.test.tsx b/packages/ui/src/components/Breadcrumb.test.tsx
similarity index 100%
rename from src/components/Breadcrumb.test.tsx
rename to packages/ui/src/components/Breadcrumb.test.tsx
diff --git a/src/components/Breadcrumb.tsx b/packages/ui/src/components/Breadcrumb.tsx
similarity index 100%
rename from src/components/Breadcrumb.tsx
rename to packages/ui/src/components/Breadcrumb.tsx
diff --git a/src/components/Button.stories.tsx b/packages/ui/src/components/Button.stories.tsx
similarity index 100%
rename from src/components/Button.stories.tsx
rename to packages/ui/src/components/Button.stories.tsx
diff --git a/src/components/Button.test.tsx b/packages/ui/src/components/Button.test.tsx
similarity index 100%
rename from src/components/Button.test.tsx
rename to packages/ui/src/components/Button.test.tsx
diff --git a/src/components/Button.tsx b/packages/ui/src/components/Button.tsx
similarity index 100%
rename from src/components/Button.tsx
rename to packages/ui/src/components/Button.tsx
diff --git a/src/components/Card.stories.tsx b/packages/ui/src/components/Card.stories.tsx
similarity index 100%
rename from src/components/Card.stories.tsx
rename to packages/ui/src/components/Card.stories.tsx
diff --git a/src/components/Card.test.tsx b/packages/ui/src/components/Card.test.tsx
similarity index 100%
rename from src/components/Card.test.tsx
rename to packages/ui/src/components/Card.test.tsx
diff --git a/src/components/Card.tsx b/packages/ui/src/components/Card.tsx
similarity index 100%
rename from src/components/Card.tsx
rename to packages/ui/src/components/Card.tsx
diff --git a/src/components/Checkbox.stories.tsx b/packages/ui/src/components/Checkbox.stories.tsx
similarity index 100%
rename from src/components/Checkbox.stories.tsx
rename to packages/ui/src/components/Checkbox.stories.tsx
diff --git a/src/components/Checkbox.test.tsx b/packages/ui/src/components/Checkbox.test.tsx
similarity index 100%
rename from src/components/Checkbox.test.tsx
rename to packages/ui/src/components/Checkbox.test.tsx
diff --git a/src/components/Checkbox.tsx b/packages/ui/src/components/Checkbox.tsx
similarity index 100%
rename from src/components/Checkbox.tsx
rename to packages/ui/src/components/Checkbox.tsx
diff --git a/src/components/CheckboxGroup.stories.tsx b/packages/ui/src/components/CheckboxGroup.stories.tsx
similarity index 100%
rename from src/components/CheckboxGroup.stories.tsx
rename to packages/ui/src/components/CheckboxGroup.stories.tsx
diff --git a/src/components/CheckboxGroup.test.tsx b/packages/ui/src/components/CheckboxGroup.test.tsx
similarity index 100%
rename from src/components/CheckboxGroup.test.tsx
rename to packages/ui/src/components/CheckboxGroup.test.tsx
diff --git a/src/components/CheckboxGroup.tsx b/packages/ui/src/components/CheckboxGroup.tsx
similarity index 100%
rename from src/components/CheckboxGroup.tsx
rename to packages/ui/src/components/CheckboxGroup.tsx
diff --git a/src/components/Combobox.stories.tsx b/packages/ui/src/components/Combobox.stories.tsx
similarity index 100%
rename from src/components/Combobox.stories.tsx
rename to packages/ui/src/components/Combobox.stories.tsx
diff --git a/src/components/Combobox.test.tsx b/packages/ui/src/components/Combobox.test.tsx
similarity index 100%
rename from src/components/Combobox.test.tsx
rename to packages/ui/src/components/Combobox.test.tsx
diff --git a/src/components/Combobox.tsx b/packages/ui/src/components/Combobox.tsx
similarity index 100%
rename from src/components/Combobox.tsx
rename to packages/ui/src/components/Combobox.tsx
diff --git a/src/components/Dialog.stories.tsx b/packages/ui/src/components/Dialog.stories.tsx
similarity index 100%
rename from src/components/Dialog.stories.tsx
rename to packages/ui/src/components/Dialog.stories.tsx
diff --git a/src/components/Dialog.test.tsx b/packages/ui/src/components/Dialog.test.tsx
similarity index 100%
rename from src/components/Dialog.test.tsx
rename to packages/ui/src/components/Dialog.test.tsx
diff --git a/src/components/Dialog.tsx b/packages/ui/src/components/Dialog.tsx
similarity index 100%
rename from src/components/Dialog.tsx
rename to packages/ui/src/components/Dialog.tsx
diff --git a/src/components/Drawer.stories.tsx b/packages/ui/src/components/Drawer.stories.tsx
similarity index 100%
rename from src/components/Drawer.stories.tsx
rename to packages/ui/src/components/Drawer.stories.tsx
diff --git a/src/components/Drawer.test.tsx b/packages/ui/src/components/Drawer.test.tsx
similarity index 100%
rename from src/components/Drawer.test.tsx
rename to packages/ui/src/components/Drawer.test.tsx
diff --git a/src/components/Drawer.tsx b/packages/ui/src/components/Drawer.tsx
similarity index 100%
rename from src/components/Drawer.tsx
rename to packages/ui/src/components/Drawer.tsx
diff --git a/src/components/DropdownMenu.stories.tsx b/packages/ui/src/components/DropdownMenu.stories.tsx
similarity index 100%
rename from src/components/DropdownMenu.stories.tsx
rename to packages/ui/src/components/DropdownMenu.stories.tsx
diff --git a/src/components/DropdownMenu.test.tsx b/packages/ui/src/components/DropdownMenu.test.tsx
similarity index 100%
rename from src/components/DropdownMenu.test.tsx
rename to packages/ui/src/components/DropdownMenu.test.tsx
diff --git a/src/components/DropdownMenu.tsx b/packages/ui/src/components/DropdownMenu.tsx
similarity index 100%
rename from src/components/DropdownMenu.tsx
rename to packages/ui/src/components/DropdownMenu.tsx
diff --git a/src/components/FeaturedInput.stories.tsx b/packages/ui/src/components/FeaturedInput.stories.tsx
similarity index 100%
rename from src/components/FeaturedInput.stories.tsx
rename to packages/ui/src/components/FeaturedInput.stories.tsx
diff --git a/src/components/FeaturedInput.test.tsx b/packages/ui/src/components/FeaturedInput.test.tsx
similarity index 100%
rename from src/components/FeaturedInput.test.tsx
rename to packages/ui/src/components/FeaturedInput.test.tsx
diff --git a/src/components/FeaturedInput.tsx b/packages/ui/src/components/FeaturedInput.tsx
similarity index 100%
rename from src/components/FeaturedInput.tsx
rename to packages/ui/src/components/FeaturedInput.tsx
diff --git a/src/components/FeaturedSelect.stories.tsx b/packages/ui/src/components/FeaturedSelect.stories.tsx
similarity index 100%
rename from src/components/FeaturedSelect.stories.tsx
rename to packages/ui/src/components/FeaturedSelect.stories.tsx
diff --git a/src/components/FeaturedSelect.test.tsx b/packages/ui/src/components/FeaturedSelect.test.tsx
similarity index 100%
rename from src/components/FeaturedSelect.test.tsx
rename to packages/ui/src/components/FeaturedSelect.test.tsx
diff --git a/src/components/FeaturedSelect.tsx b/packages/ui/src/components/FeaturedSelect.tsx
similarity index 100%
rename from src/components/FeaturedSelect.tsx
rename to packages/ui/src/components/FeaturedSelect.tsx
diff --git a/src/components/FeaturedTextArea.stories.tsx b/packages/ui/src/components/FeaturedTextArea.stories.tsx
similarity index 100%
rename from src/components/FeaturedTextArea.stories.tsx
rename to packages/ui/src/components/FeaturedTextArea.stories.tsx
diff --git a/src/components/FeaturedTextArea.test.tsx b/packages/ui/src/components/FeaturedTextArea.test.tsx
similarity index 100%
rename from src/components/FeaturedTextArea.test.tsx
rename to packages/ui/src/components/FeaturedTextArea.test.tsx
diff --git a/src/components/FeaturedTextArea.tsx b/packages/ui/src/components/FeaturedTextArea.tsx
similarity index 100%
rename from src/components/FeaturedTextArea.tsx
rename to packages/ui/src/components/FeaturedTextArea.tsx
diff --git a/src/components/Field.stories.tsx b/packages/ui/src/components/Field.stories.tsx
similarity index 100%
rename from src/components/Field.stories.tsx
rename to packages/ui/src/components/Field.stories.tsx
diff --git a/src/components/Field.tsx b/packages/ui/src/components/Field.tsx
similarity index 100%
rename from src/components/Field.tsx
rename to packages/ui/src/components/Field.tsx
diff --git a/src/components/Input.stories.tsx b/packages/ui/src/components/Input.stories.tsx
similarity index 100%
rename from src/components/Input.stories.tsx
rename to packages/ui/src/components/Input.stories.tsx
diff --git a/src/components/Input.test.tsx b/packages/ui/src/components/Input.test.tsx
similarity index 100%
rename from src/components/Input.test.tsx
rename to packages/ui/src/components/Input.test.tsx
diff --git a/src/components/Input.tsx b/packages/ui/src/components/Input.tsx
similarity index 100%
rename from src/components/Input.tsx
rename to packages/ui/src/components/Input.tsx
diff --git a/src/components/Kbd.stories.tsx b/packages/ui/src/components/Kbd.stories.tsx
similarity index 100%
rename from src/components/Kbd.stories.tsx
rename to packages/ui/src/components/Kbd.stories.tsx
diff --git a/src/components/Kbd.test.tsx b/packages/ui/src/components/Kbd.test.tsx
similarity index 100%
rename from src/components/Kbd.test.tsx
rename to packages/ui/src/components/Kbd.test.tsx
diff --git a/src/components/Kbd.tsx b/packages/ui/src/components/Kbd.tsx
similarity index 100%
rename from src/components/Kbd.tsx
rename to packages/ui/src/components/Kbd.tsx
diff --git a/src/components/NativeSelect.stories.tsx b/packages/ui/src/components/NativeSelect.stories.tsx
similarity index 100%
rename from src/components/NativeSelect.stories.tsx
rename to packages/ui/src/components/NativeSelect.stories.tsx
diff --git a/src/components/NativeSelect.test.tsx b/packages/ui/src/components/NativeSelect.test.tsx
similarity index 100%
rename from src/components/NativeSelect.test.tsx
rename to packages/ui/src/components/NativeSelect.test.tsx
diff --git a/src/components/NativeSelect.tsx b/packages/ui/src/components/NativeSelect.tsx
similarity index 100%
rename from src/components/NativeSelect.tsx
rename to packages/ui/src/components/NativeSelect.tsx
diff --git a/src/components/NumberInput.stories.tsx b/packages/ui/src/components/NumberInput.stories.tsx
similarity index 100%
rename from src/components/NumberInput.stories.tsx
rename to packages/ui/src/components/NumberInput.stories.tsx
diff --git a/src/components/NumberInput.test.tsx b/packages/ui/src/components/NumberInput.test.tsx
similarity index 100%
rename from src/components/NumberInput.test.tsx
rename to packages/ui/src/components/NumberInput.test.tsx
diff --git a/src/components/NumberInput.tsx b/packages/ui/src/components/NumberInput.tsx
similarity index 100%
rename from src/components/NumberInput.tsx
rename to packages/ui/src/components/NumberInput.tsx
diff --git a/src/components/Pagination.stories.tsx b/packages/ui/src/components/Pagination.stories.tsx
similarity index 100%
rename from src/components/Pagination.stories.tsx
rename to packages/ui/src/components/Pagination.stories.tsx
diff --git a/src/components/Pagination.test.tsx b/packages/ui/src/components/Pagination.test.tsx
similarity index 100%
rename from src/components/Pagination.test.tsx
rename to packages/ui/src/components/Pagination.test.tsx
diff --git a/src/components/Pagination.tsx b/packages/ui/src/components/Pagination.tsx
similarity index 100%
rename from src/components/Pagination.tsx
rename to packages/ui/src/components/Pagination.tsx
diff --git a/src/components/Popover.stories.tsx b/packages/ui/src/components/Popover.stories.tsx
similarity index 100%
rename from src/components/Popover.stories.tsx
rename to packages/ui/src/components/Popover.stories.tsx
diff --git a/src/components/Popover.test.tsx b/packages/ui/src/components/Popover.test.tsx
similarity index 100%
rename from src/components/Popover.test.tsx
rename to packages/ui/src/components/Popover.test.tsx
diff --git a/src/components/Popover.tsx b/packages/ui/src/components/Popover.tsx
similarity index 100%
rename from src/components/Popover.tsx
rename to packages/ui/src/components/Popover.tsx
diff --git a/src/components/Progress.stories.tsx b/packages/ui/src/components/Progress.stories.tsx
similarity index 100%
rename from src/components/Progress.stories.tsx
rename to packages/ui/src/components/Progress.stories.tsx
diff --git a/src/components/Progress.test.tsx b/packages/ui/src/components/Progress.test.tsx
similarity index 100%
rename from src/components/Progress.test.tsx
rename to packages/ui/src/components/Progress.test.tsx
diff --git a/src/components/Progress.tsx b/packages/ui/src/components/Progress.tsx
similarity index 100%
rename from src/components/Progress.tsx
rename to packages/ui/src/components/Progress.tsx
diff --git a/src/components/Radio.stories.tsx b/packages/ui/src/components/Radio.stories.tsx
similarity index 100%
rename from src/components/Radio.stories.tsx
rename to packages/ui/src/components/Radio.stories.tsx
diff --git a/src/components/Radio.test.tsx b/packages/ui/src/components/Radio.test.tsx
similarity index 100%
rename from src/components/Radio.test.tsx
rename to packages/ui/src/components/Radio.test.tsx
diff --git a/src/components/Radio.tsx b/packages/ui/src/components/Radio.tsx
similarity index 100%
rename from src/components/Radio.tsx
rename to packages/ui/src/components/Radio.tsx
diff --git a/src/components/Select.stories.tsx b/packages/ui/src/components/Select.stories.tsx
similarity index 100%
rename from src/components/Select.stories.tsx
rename to packages/ui/src/components/Select.stories.tsx
diff --git a/src/components/Select.test.tsx b/packages/ui/src/components/Select.test.tsx
similarity index 100%
rename from src/components/Select.test.tsx
rename to packages/ui/src/components/Select.test.tsx
diff --git a/src/components/Select.tsx b/packages/ui/src/components/Select.tsx
similarity index 100%
rename from src/components/Select.tsx
rename to packages/ui/src/components/Select.tsx
diff --git a/src/components/SelectParts.tsx b/packages/ui/src/components/SelectParts.tsx
similarity index 100%
rename from src/components/SelectParts.tsx
rename to packages/ui/src/components/SelectParts.tsx
diff --git a/src/components/Separator.stories.tsx b/packages/ui/src/components/Separator.stories.tsx
similarity index 100%
rename from src/components/Separator.stories.tsx
rename to packages/ui/src/components/Separator.stories.tsx
diff --git a/src/components/Separator.test.tsx b/packages/ui/src/components/Separator.test.tsx
similarity index 100%
rename from src/components/Separator.test.tsx
rename to packages/ui/src/components/Separator.test.tsx
diff --git a/src/components/Separator.tsx b/packages/ui/src/components/Separator.tsx
similarity index 100%
rename from src/components/Separator.tsx
rename to packages/ui/src/components/Separator.tsx
diff --git a/src/components/Skeleton.stories.tsx b/packages/ui/src/components/Skeleton.stories.tsx
similarity index 100%
rename from src/components/Skeleton.stories.tsx
rename to packages/ui/src/components/Skeleton.stories.tsx
diff --git a/src/components/Skeleton.test.tsx b/packages/ui/src/components/Skeleton.test.tsx
similarity index 100%
rename from src/components/Skeleton.test.tsx
rename to packages/ui/src/components/Skeleton.test.tsx
diff --git a/src/components/Skeleton.tsx b/packages/ui/src/components/Skeleton.tsx
similarity index 100%
rename from src/components/Skeleton.tsx
rename to packages/ui/src/components/Skeleton.tsx
diff --git a/src/components/Slider.stories.tsx b/packages/ui/src/components/Slider.stories.tsx
similarity index 100%
rename from src/components/Slider.stories.tsx
rename to packages/ui/src/components/Slider.stories.tsx
diff --git a/src/components/Slider.test.tsx b/packages/ui/src/components/Slider.test.tsx
similarity index 100%
rename from src/components/Slider.test.tsx
rename to packages/ui/src/components/Slider.test.tsx
diff --git a/src/components/Slider.tsx b/packages/ui/src/components/Slider.tsx
similarity index 100%
rename from src/components/Slider.tsx
rename to packages/ui/src/components/Slider.tsx
diff --git a/src/components/Spinner.stories.tsx b/packages/ui/src/components/Spinner.stories.tsx
similarity index 100%
rename from src/components/Spinner.stories.tsx
rename to packages/ui/src/components/Spinner.stories.tsx
diff --git a/src/components/Spinner.test.tsx b/packages/ui/src/components/Spinner.test.tsx
similarity index 100%
rename from src/components/Spinner.test.tsx
rename to packages/ui/src/components/Spinner.test.tsx
diff --git a/src/components/Spinner.tsx b/packages/ui/src/components/Spinner.tsx
similarity index 100%
rename from src/components/Spinner.tsx
rename to packages/ui/src/components/Spinner.tsx
diff --git a/src/components/Switch.stories.tsx b/packages/ui/src/components/Switch.stories.tsx
similarity index 100%
rename from src/components/Switch.stories.tsx
rename to packages/ui/src/components/Switch.stories.tsx
diff --git a/src/components/Switch.test.tsx b/packages/ui/src/components/Switch.test.tsx
similarity index 100%
rename from src/components/Switch.test.tsx
rename to packages/ui/src/components/Switch.test.tsx
diff --git a/src/components/Switch.tsx b/packages/ui/src/components/Switch.tsx
similarity index 100%
rename from src/components/Switch.tsx
rename to packages/ui/src/components/Switch.tsx
diff --git a/src/components/Table.stories.tsx b/packages/ui/src/components/Table.stories.tsx
similarity index 100%
rename from src/components/Table.stories.tsx
rename to packages/ui/src/components/Table.stories.tsx
diff --git a/src/components/Table.test.tsx b/packages/ui/src/components/Table.test.tsx
similarity index 100%
rename from src/components/Table.test.tsx
rename to packages/ui/src/components/Table.test.tsx
diff --git a/src/components/Table.tsx b/packages/ui/src/components/Table.tsx
similarity index 100%
rename from src/components/Table.tsx
rename to packages/ui/src/components/Table.tsx
diff --git a/src/components/Tabs.stories.tsx b/packages/ui/src/components/Tabs.stories.tsx
similarity index 100%
rename from src/components/Tabs.stories.tsx
rename to packages/ui/src/components/Tabs.stories.tsx
diff --git a/src/components/Tabs.test.tsx b/packages/ui/src/components/Tabs.test.tsx
similarity index 100%
rename from src/components/Tabs.test.tsx
rename to packages/ui/src/components/Tabs.test.tsx
diff --git a/src/components/Tabs.tsx b/packages/ui/src/components/Tabs.tsx
similarity index 100%
rename from src/components/Tabs.tsx
rename to packages/ui/src/components/Tabs.tsx
diff --git a/src/components/TextArea.stories.tsx b/packages/ui/src/components/TextArea.stories.tsx
similarity index 100%
rename from src/components/TextArea.stories.tsx
rename to packages/ui/src/components/TextArea.stories.tsx
diff --git a/src/components/TextArea.test.tsx b/packages/ui/src/components/TextArea.test.tsx
similarity index 100%
rename from src/components/TextArea.test.tsx
rename to packages/ui/src/components/TextArea.test.tsx
diff --git a/src/components/TextArea.tsx b/packages/ui/src/components/TextArea.tsx
similarity index 100%
rename from src/components/TextArea.tsx
rename to packages/ui/src/components/TextArea.tsx
diff --git a/src/components/Toast.stories.tsx b/packages/ui/src/components/Toast.stories.tsx
similarity index 100%
rename from src/components/Toast.stories.tsx
rename to packages/ui/src/components/Toast.stories.tsx
diff --git a/src/components/Toast.test.tsx b/packages/ui/src/components/Toast.test.tsx
similarity index 100%
rename from src/components/Toast.test.tsx
rename to packages/ui/src/components/Toast.test.tsx
diff --git a/src/components/Toast.tsx b/packages/ui/src/components/Toast.tsx
similarity index 100%
rename from src/components/Toast.tsx
rename to packages/ui/src/components/Toast.tsx
diff --git a/src/components/ToggleGroup.stories.tsx b/packages/ui/src/components/ToggleGroup.stories.tsx
similarity index 100%
rename from src/components/ToggleGroup.stories.tsx
rename to packages/ui/src/components/ToggleGroup.stories.tsx
diff --git a/src/components/ToggleGroup.test.tsx b/packages/ui/src/components/ToggleGroup.test.tsx
similarity index 100%
rename from src/components/ToggleGroup.test.tsx
rename to packages/ui/src/components/ToggleGroup.test.tsx
diff --git a/src/components/ToggleGroup.tsx b/packages/ui/src/components/ToggleGroup.tsx
similarity index 100%
rename from src/components/ToggleGroup.tsx
rename to packages/ui/src/components/ToggleGroup.tsx
diff --git a/src/components/Tooltip.stories.tsx b/packages/ui/src/components/Tooltip.stories.tsx
similarity index 100%
rename from src/components/Tooltip.stories.tsx
rename to packages/ui/src/components/Tooltip.stories.tsx
diff --git a/src/components/Tooltip.test.tsx b/packages/ui/src/components/Tooltip.test.tsx
similarity index 100%
rename from src/components/Tooltip.test.tsx
rename to packages/ui/src/components/Tooltip.test.tsx
diff --git a/src/components/Tooltip.tsx b/packages/ui/src/components/Tooltip.tsx
similarity index 100%
rename from src/components/Tooltip.tsx
rename to packages/ui/src/components/Tooltip.tsx
diff --git a/src/components/accordion.tokens.ts b/packages/ui/src/components/accordion.tokens.ts
similarity index 100%
rename from src/components/accordion.tokens.ts
rename to packages/ui/src/components/accordion.tokens.ts
diff --git a/src/components/alert.tokens.ts b/packages/ui/src/components/alert.tokens.ts
similarity index 100%
rename from src/components/alert.tokens.ts
rename to packages/ui/src/components/alert.tokens.ts
diff --git a/src/components/avatar.tokens.ts b/packages/ui/src/components/avatar.tokens.ts
similarity index 100%
rename from src/components/avatar.tokens.ts
rename to packages/ui/src/components/avatar.tokens.ts
diff --git a/src/components/badge.tokens.ts b/packages/ui/src/components/badge.tokens.ts
similarity index 100%
rename from src/components/badge.tokens.ts
rename to packages/ui/src/components/badge.tokens.ts
diff --git a/src/components/button.tokens.ts b/packages/ui/src/components/button.tokens.ts
similarity index 100%
rename from src/components/button.tokens.ts
rename to packages/ui/src/components/button.tokens.ts
diff --git a/src/components/card.tokens.ts b/packages/ui/src/components/card.tokens.ts
similarity index 100%
rename from src/components/card.tokens.ts
rename to packages/ui/src/components/card.tokens.ts
diff --git a/src/components/checkbox.tokens.ts b/packages/ui/src/components/checkbox.tokens.ts
similarity index 100%
rename from src/components/checkbox.tokens.ts
rename to packages/ui/src/components/checkbox.tokens.ts
diff --git a/src/components/dialog.tokens.ts b/packages/ui/src/components/dialog.tokens.ts
similarity index 100%
rename from src/components/dialog.tokens.ts
rename to packages/ui/src/components/dialog.tokens.ts
diff --git a/src/components/display.fixtures.ts b/packages/ui/src/components/display.fixtures.ts
similarity index 100%
rename from src/components/display.fixtures.ts
rename to packages/ui/src/components/display.fixtures.ts
diff --git a/src/components/dropdown-menu.tokens.ts b/packages/ui/src/components/dropdown-menu.tokens.ts
similarity index 100%
rename from src/components/dropdown-menu.tokens.ts
rename to packages/ui/src/components/dropdown-menu.tokens.ts
diff --git a/src/components/featuredinput.tokens.ts b/packages/ui/src/components/featuredinput.tokens.ts
similarity index 100%
rename from src/components/featuredinput.tokens.ts
rename to packages/ui/src/components/featuredinput.tokens.ts
diff --git a/src/components/kbd.tokens.ts b/packages/ui/src/components/kbd.tokens.ts
similarity index 100%
rename from src/components/kbd.tokens.ts
rename to packages/ui/src/components/kbd.tokens.ts
diff --git a/src/components/numberinput.tokens.ts b/packages/ui/src/components/numberinput.tokens.ts
similarity index 100%
rename from src/components/numberinput.tokens.ts
rename to packages/ui/src/components/numberinput.tokens.ts
diff --git a/src/components/pagination.tokens.ts b/packages/ui/src/components/pagination.tokens.ts
similarity index 100%
rename from src/components/pagination.tokens.ts
rename to packages/ui/src/components/pagination.tokens.ts
diff --git a/src/components/popover.tokens.ts b/packages/ui/src/components/popover.tokens.ts
similarity index 100%
rename from src/components/popover.tokens.ts
rename to packages/ui/src/components/popover.tokens.ts
diff --git a/src/components/progress.tokens.ts b/packages/ui/src/components/progress.tokens.ts
similarity index 100%
rename from src/components/progress.tokens.ts
rename to packages/ui/src/components/progress.tokens.ts
diff --git a/src/components/radio.tokens.ts b/packages/ui/src/components/radio.tokens.ts
similarity index 100%
rename from src/components/radio.tokens.ts
rename to packages/ui/src/components/radio.tokens.ts
diff --git a/src/components/select.fixtures.ts b/packages/ui/src/components/select.fixtures.ts
similarity index 100%
rename from src/components/select.fixtures.ts
rename to packages/ui/src/components/select.fixtures.ts
diff --git a/src/components/select.tokens.ts b/packages/ui/src/components/select.tokens.ts
similarity index 100%
rename from src/components/select.tokens.ts
rename to packages/ui/src/components/select.tokens.ts
diff --git a/src/components/skeleton.tokens.ts b/packages/ui/src/components/skeleton.tokens.ts
similarity index 100%
rename from src/components/skeleton.tokens.ts
rename to packages/ui/src/components/skeleton.tokens.ts
diff --git a/src/components/slider.tokens.ts b/packages/ui/src/components/slider.tokens.ts
similarity index 100%
rename from src/components/slider.tokens.ts
rename to packages/ui/src/components/slider.tokens.ts
diff --git a/src/components/spinner.tokens.ts b/packages/ui/src/components/spinner.tokens.ts
similarity index 100%
rename from src/components/spinner.tokens.ts
rename to packages/ui/src/components/spinner.tokens.ts
diff --git a/src/components/switch.tokens.ts b/packages/ui/src/components/switch.tokens.ts
similarity index 100%
rename from src/components/switch.tokens.ts
rename to packages/ui/src/components/switch.tokens.ts
diff --git a/src/components/table.tokens.ts b/packages/ui/src/components/table.tokens.ts
similarity index 100%
rename from src/components/table.tokens.ts
rename to packages/ui/src/components/table.tokens.ts
diff --git a/src/components/tabs.tokens.ts b/packages/ui/src/components/tabs.tokens.ts
similarity index 100%
rename from src/components/tabs.tokens.ts
rename to packages/ui/src/components/tabs.tokens.ts
diff --git a/src/components/textarea.tokens.ts b/packages/ui/src/components/textarea.tokens.ts
similarity index 100%
rename from src/components/textarea.tokens.ts
rename to packages/ui/src/components/textarea.tokens.ts
diff --git a/src/components/toast.tokens.ts b/packages/ui/src/components/toast.tokens.ts
similarity index 100%
rename from src/components/toast.tokens.ts
rename to packages/ui/src/components/toast.tokens.ts
diff --git a/src/components/toggle.tokens.ts b/packages/ui/src/components/toggle.tokens.ts
similarity index 100%
rename from src/components/toggle.tokens.ts
rename to packages/ui/src/components/toggle.tokens.ts
diff --git a/src/components/tooltip.tokens.ts b/packages/ui/src/components/tooltip.tokens.ts
similarity index 100%
rename from src/components/tooltip.tokens.ts
rename to packages/ui/src/components/tooltip.tokens.ts
diff --git a/src/components/useToast.ts b/packages/ui/src/components/useToast.ts
similarity index 100%
rename from src/components/useToast.ts
rename to packages/ui/src/components/useToast.ts
diff --git a/src/index.ts b/packages/ui/src/index.ts
similarity index 100%
rename from src/index.ts
rename to packages/ui/src/index.ts
diff --git a/src/lib/cn.ts b/packages/ui/src/lib/cn.ts
similarity index 100%
rename from src/lib/cn.ts
rename to packages/ui/src/lib/cn.ts
diff --git a/src/lib/styles.ts b/packages/ui/src/lib/styles.ts
similarity index 100%
rename from src/lib/styles.ts
rename to packages/ui/src/lib/styles.ts
diff --git a/src/lib/useControllableState.ts b/packages/ui/src/lib/useControllableState.ts
similarity index 100%
rename from src/lib/useControllableState.ts
rename to packages/ui/src/lib/useControllableState.ts
diff --git a/packages/ui/src/styles/styles.css b/packages/ui/src/styles/styles.css
new file mode 100644
index 0000000..1ccae4f
--- /dev/null
+++ b/packages/ui/src/styles/styles.css
@@ -0,0 +1,19 @@
+/*
+ * Prebuilt Tansy UI stylesheet, for apps that don't use Tailwind:
+ *
+ * import '@openkhalix/tansy-ui/styles.css'
+ *
+ * Compiled at build time into dist/styles.css: the design tokens, only the
+ * utilities the components use, and Tailwind's preflight, a modern CSS reset.
+ * The components rely on that reset (as MUI relies on CssBaseline), so it's
+ * included rather than optional. Apps that use Tailwind v4 already have it:
+ * they should import tokens.css instead.
+ */
+@import "tailwindcss";
+@import "./tokens.css";
+
+@source "../";
+@source not "../**/*.stories.tsx";
+@source not "../**/*.test.tsx";
+@source not "../**/*.fixtures.ts";
+@source not "../test";
diff --git a/src/styles/tokens.css b/packages/ui/src/styles/tokens.css
similarity index 100%
rename from src/styles/tokens.css
rename to packages/ui/src/styles/tokens.css
diff --git a/src/test/a11y.ts b/packages/ui/src/test/a11y.ts
similarity index 100%
rename from src/test/a11y.ts
rename to packages/ui/src/test/a11y.ts
diff --git a/src/test/setup.ts b/packages/ui/src/test/setup.ts
similarity index 100%
rename from src/test/setup.ts
rename to packages/ui/src/test/setup.ts
diff --git a/src/theme/applyPalette.ts b/packages/ui/src/theme/applyPalette.ts
similarity index 100%
rename from src/theme/applyPalette.ts
rename to packages/ui/src/theme/applyPalette.ts
diff --git a/src/theme/palettes.ts b/packages/ui/src/theme/palettes.ts
similarity index 100%
rename from src/theme/palettes.ts
rename to packages/ui/src/theme/palettes.ts
diff --git a/packages/ui/src/version.ts b/packages/ui/src/version.ts
new file mode 100644
index 0000000..11e78ea
--- /dev/null
+++ b/packages/ui/src/version.ts
@@ -0,0 +1,7 @@
+declare const __TANSY_VERSION__: string | undefined
+
+/**
+ * The package version. The library build injects it from package.json; apps
+ * in this repo that compile the source define it in their Vite config too.
+ */
+export const VERSION: string = typeof __TANSY_VERSION__ === 'string' ? __TANSY_VERSION__ : '0.0.0-dev'
diff --git a/tsconfig.app.json b/packages/ui/tsconfig.json
similarity index 83%
rename from tsconfig.app.json
rename to packages/ui/tsconfig.json
index 154719a..847c58d 100644
--- a/tsconfig.app.json
+++ b/packages/ui/tsconfig.json
@@ -1,6 +1,6 @@
{
"compilerOptions": {
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
"target": "es2023",
"lib": ["ES2023", "DOM"],
"module": "esnext",
@@ -10,9 +10,6 @@
/* Bundler mode */
"moduleResolution": "bundler",
- "paths": {
- "@/*": ["./src/*"]
- },
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
diff --git a/tsconfig.lib.json b/packages/ui/tsconfig.lib.json
similarity index 67%
rename from tsconfig.lib.json
rename to packages/ui/tsconfig.lib.json
index 9cb8439..9d16a14 100644
--- a/tsconfig.lib.json
+++ b/packages/ui/tsconfig.lib.json
@@ -1,15 +1,15 @@
{
- "extends": "./tsconfig.app.json",
+ "extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
"declarationMap": true,
"allowImportingTsExtensions": false,
- "outDir": "dist-lib",
+ "outDir": "dist",
"rootDir": "src",
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.lib.tsbuildinfo"
},
- "include": ["src/index.ts", "src/vite-env.d.ts"],
- "exclude": ["src/**/*.stories.tsx", "src/**/*.test.tsx", "src/test", "src/docs", "src/App.tsx", "src/main.tsx"]
+ "include": ["src/index.ts"],
+ "exclude": ["src/**/*.stories.tsx", "src/**/*.test.tsx", "src/test"]
}
diff --git a/vite.config.ts b/packages/ui/vite.config.ts
similarity index 62%
rename from vite.config.ts
rename to packages/ui/vite.config.ts
index 5cb4297..319b067 100644
--- a/vite.config.ts
+++ b/packages/ui/vite.config.ts
@@ -1,27 +1,20 @@
///
import { readFileSync } from 'node:fs'
-import { fileURLToPath, URL } from 'node:url'
import react from '@vitejs/plugin-react'
-import tailwindcss from '@tailwindcss/vite'
import { defineConfig } from 'vite'
+/** Test config. The library build lives in vite.lib.config.ts. */
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) as { version: string }
export default defineConfig({
- // package.json is the single source of the version; see src/version.ts.
define: {
__TANSY_VERSION__: JSON.stringify(pkg.version),
},
- plugins: [react(), tailwindcss()],
+ plugins: [react()],
test: {
environment: 'jsdom',
setupFiles: ['src/test/setup.ts'],
include: ['src/**/*.test.{ts,tsx}'],
css: false,
},
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url)),
- },
- },
})
diff --git a/vite.lib.config.ts b/packages/ui/vite.lib.config.ts
similarity index 61%
rename from vite.lib.config.ts
rename to packages/ui/vite.lib.config.ts
index 216e21a..ec59b41 100644
--- a/vite.lib.config.ts
+++ b/packages/ui/vite.lib.config.ts
@@ -4,11 +4,12 @@ import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
/**
- * Library build: `npm run build:lib` → dist-lib/.
+ * Library build: `npm run build` → dist/.
*
- * One ES module per source file (preserveModules) so apps only bundle the
+ * One ES module per source file (preserveModules), so apps only bundle the
* components they import. Dependencies stay external. Types come from
- * `tsc -p tsconfig.lib.json`, and tokens.css is copied alongside.
+ * `tsc -p tsconfig.lib.json`; tokens.css and styles.css are added by the
+ * build script.
*/
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) as {
version: string
@@ -17,13 +18,26 @@ const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url),
}
const external = [...Object.keys(pkg.dependencies), ...Object.keys(pkg.peerDependencies ?? {})]
+/**
+ * Component modules use hooks, so React Server Components must treat them as
+ * client code. Pure helpers (cn, applyPalette, style maps) stay unmarked so a
+ * server component can still call them.
+ */
+function isClientModule(fileName: string) {
+ return (
+ fileName.startsWith('components/') &&
+ !fileName.endsWith('.tokens.js') &&
+ !fileName.endsWith('.fixtures.js')
+ )
+}
+
export default defineConfig({
define: {
__TANSY_VERSION__: JSON.stringify(pkg.version),
},
plugins: [react()],
build: {
- outDir: 'dist-lib',
+ outDir: 'dist',
emptyOutDir: true,
sourcemap: true,
copyPublicDir: false,
@@ -37,6 +51,7 @@ export default defineConfig({
preserveModules: true,
preserveModulesRoot: 'src',
entryFileNames: '[name].js',
+ banner: (chunk) => (isClientModule(chunk.fileName) ? "'use client';" : ''),
},
},
},
diff --git a/scripts/README.md b/scripts/README.md
index 0331aef..803ecb2 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -30,8 +30,10 @@ environment instead, which is what CI should do.
## How it works
-1. `npm ci`, `npm run lint`, `npm run build`, `npm run build-storybook`
-2. Stage `dist/` at the root and `storybook-static/` under `docs/`, zip with
+1. `npm ci`, `npm run lint`, `npm test`, `npm run build` (package, landing
+ page, Storybook)
+2. Stage `apps/site/dist/` at the root and `apps/docs/storybook-static/` under
+ `docs/`, zip with
Python's `zipfile` (there is no `zip` binary on the build host), base64 it
3. Upload `scripts/cpanel-deploy.php` to the docroot over the cPanel UAPI
4. POST the base64 payload to it with a `Host` header for the subdomain,
diff --git a/scripts/check-stories.mjs b/scripts/check-stories.mjs
index 1915f51..2940414 100644
--- a/scripts/check-stories.mjs
+++ b/scripts/check-stories.mjs
@@ -2,13 +2,13 @@
/**
* Render every story in a real browser and report what's broken.
*
- * For each story in storybook-static/index.json it:
+ * For each story in apps/docs/storybook-static/index.json it:
* - loads the story in Chrome (light or dark mode),
* - records page errors and console errors,
* - runs axe, including colour contrast (jsdom tests can't check that),
* - saves a screenshot.
*
- * npm run build-storybook
+ * npm run build:docs
* node scripts/check-stories.mjs [--filter forms-] [--mode dark] [--palette emerald] [--width 375] [--out dir] [--no-shots]
*
* Exits non-zero when any story has an error or an axe violation.
@@ -25,7 +25,7 @@ const opt = (name, fallback) => {
const i = args.indexOf(`--${name}`)
return i === -1 ? fallback : args[i + 1]
}
-const DIR = resolve(opt('dir', 'storybook-static'))
+const DIR = resolve(opt('dir', 'apps/docs/storybook-static'))
const FILTER = opt('filter', '')
const MODE = opt('mode', 'light')
const PALETTE = opt('palette', '')
diff --git a/scripts/deploy.py b/scripts/deploy.py
index 174ee50..91a5b6b 100644
--- a/scripts/deploy.py
+++ b/scripts/deploy.py
@@ -37,6 +37,8 @@ REPO = Path(__file__).resolve().parent.parent
STAGE = Path("/tmp/tansy-stage")
ZIP = Path("/tmp/tansy-deploy.zip")
ENV_FILE = REPO / "scripts" / "deploy.env"
+SITE_DIST = REPO / "apps" / "site" / "dist"
+STORYBOOK = REPO / "apps" / "docs" / "storybook-static"
# The docroot must keep these regardless of what a build contains: cPanel
# writes them, and removing .htaccess would take the site offline.
@@ -157,10 +159,11 @@ def run(cmd: list[str], cwd: Path = REPO, timeout: int = 900) -> None:
def build() -> None:
run(["npm", "ci"])
run(["npm", "run", "lint"])
+ run(["npm", "test"])
+ # Builds the package, then the landing page and Storybook.
run(["npm", "run", "build"])
- run(["npm", "run", "build-storybook"])
- if not (REPO / "storybook-static" / "index.json").exists():
- die("storybook-static/index.json missing after build-storybook")
+ if not (STORYBOOK / "index.json").exists():
+ die(f"{STORYBOOK}/index.json missing after the Storybook build")
def git(*args: str) -> str:
@@ -177,7 +180,7 @@ def require_clean_tree() -> None:
def build_stamp() -> dict:
- version = json.loads((REPO / "package.json").read_text())["version"]
+ version = json.loads((REPO / "packages" / "ui" / "package.json").read_text())["version"]
return {
"version": version,
"commit": git("rev-parse", "--short", "HEAD"),
@@ -187,11 +190,11 @@ def build_stamp() -> dict:
def package() -> dict:
- dist = REPO / "dist"
- sb = REPO / "storybook-static"
+ dist = SITE_DIST
+ sb = STORYBOOK
for d in (dist, sb):
if not d.is_dir():
- die(f"{d} does not exist - run: npm run build && npm run build-storybook")
+ die(f"{d} does not exist - run: npm run build")
if STAGE.exists():
shutil.rmtree(STAGE)
@@ -366,14 +369,14 @@ def verify(panel: Panel) -> None:
idx = panel.get_from_origin("/index.html")
live_sha = _h.sha256(idx.encode()).hexdigest()
- local_sha = _h.sha256((REPO / "dist" / "index.html").read_bytes()).hexdigest()
+ local_sha = _h.sha256((SITE_DIST / "index.html").read_bytes()).hexdigest()
if live_sha != local_sha:
die(f"index.html mismatch\n live {live_sha[:32]}\n local {local_sha[:32]}")
log("index.html matches the local build")
sb = panel.get_from_origin("/docs/index.json")
sb_sha = _h.sha256(sb.encode()).hexdigest()
- sb_local = _h.sha256((REPO / "storybook-static" / "index.json").read_bytes()).hexdigest()
+ sb_local = _h.sha256((STORYBOOK / "index.json").read_bytes()).hexdigest()
if sb_sha != sb_local:
die("docs/index.json mismatch")
log("docs/index.json matches")
diff --git a/scripts/gen_catalogue.py b/scripts/gen_catalogue.py
index 884a30f..3a7f4ff 100644
--- a/scripts/gen_catalogue.py
+++ b/scripts/gen_catalogue.py
@@ -3,12 +3,12 @@
Generate the landing page's component catalogue from the built Storybook
index, so it cannot drift from the stories again.
-Run it after `npm run build-storybook` and before `npm run build` when you
+Run it after `npm run build:docs` and before `npm run build:site` when you
add or remove a component. It prints the entries to paste into
-src/data/catalogue.ts and writes /tmp/component_catalogue.json.
+packages/brand/src/catalogue.ts and writes /tmp/component_catalogue.json.
python3 scripts/gen_catalogue.py # print entries
- python3 scripts/gen_catalogue.py --patch # also rewrite src/data/catalogue.ts
+ python3 scripts/gen_catalogue.py --patch # also rewrite packages/brand/src/catalogue.ts
Components are read from story titles (`Group/Name`), so a new component
appears here without editing this script; only DETAIL is hand-written.
@@ -22,8 +22,8 @@ import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
-IDX = REPO / "storybook-static" / "index.json"
-CATALOGUE = REPO / "src" / "data" / "catalogue.ts"
+IDX = REPO / "apps" / "docs" / "storybook-static" / "index.json"
+CATALOGUE = REPO / "packages" / "brand" / "src" / "catalogue.ts"
OUT = Path("/tmp/component_catalogue.json")
# Group order on the landing page; matches the Storybook sidebar.
@@ -75,7 +75,7 @@ DETAIL = {
def collect():
if not IDX.is_file():
- sys.exit(f"{IDX} not found - run: npm run build-storybook")
+ sys.exit(f"{IDX} not found - run: npm run build:docs")
entries = json.loads(IDX.read_text())["entries"].values()
comps: dict[str, dict] = {}
@@ -150,7 +150,7 @@ def patch_catalogue(entries) -> None:
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument("--patch", action="store_true",
- help="rewrite the catalogue and story counts in src/data/catalogue.ts")
+ help="rewrite the catalogue and story counts in packages/brand/src/catalogue.ts")
args = ap.parse_args()
entries = collect()
@@ -167,7 +167,7 @@ def main() -> None:
if args.patch:
patch_catalogue(entries)
- print("now run: npm run build")
+ print("now run: npm run build:site")
if __name__ == "__main__":
diff --git a/scripts/test-package.mjs b/scripts/test-package.mjs
new file mode 100644
index 0000000..4b2badc
--- /dev/null
+++ b/scripts/test-package.mjs
@@ -0,0 +1,195 @@
+#!/usr/bin/env node
+/**
+ * Install the packed package into fresh apps, the way a user would, and prove
+ * it works. Run before publishing:
+ *
+ * npm run test:package # all scenarios
+ * npm run test:package -- vite # one scenario: vite | plain | next
+ *
+ * 1. vite Vite + Tailwind v4 + strict TypeScript (library types checked too).
+ * Must type-check, build and render without errors.
+ * 2. plain React without Tailwind, using only the prebuilt styles.css. The
+ * primary button must get its brand colour.
+ * 3. next Next.js App Router. A Server Component imports the components;
+ * `next build` must prerender it, which fails unless the component
+ * modules are marked "use client".
+ *
+ * Apps are created under $TMPDIR/tansy-package-test and installed from npm.
+ */
+import { execSync } from 'node:child_process'
+import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { createServer } from 'node:http'
+import { createRequire } from 'node:module'
+import { tmpdir } from 'node:os'
+import { dirname, extname, join, resolve } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
+const PKG_DIR = join(ROOT, 'packages/ui')
+const WORK = join(tmpdir(), 'tansy-package-test')
+const only = process.argv[2]
+const require = createRequire(import.meta.url)
+
+const sh = (cmd, cwd) => execSync(cmd, { cwd, stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8' })
+const write = (dir, files) => {
+ for (const [path, content] of Object.entries(files)) {
+ mkdirSync(dirname(join(dir, path)), { recursive: true })
+ writeFileSync(join(dir, path), content.trimStart())
+ }
+}
+const log = (msg) => console.log(`[test:package] ${msg}`)
+
+// --- pack ---------------------------------------------------------------------
+rmSync(WORK, { recursive: true, force: true })
+mkdirSync(WORK, { recursive: true })
+log('building and packing @openkhalix/tansy-ui')
+sh('npm run build', PKG_DIR)
+const tarball = join(WORK, sh(`npm pack --pack-destination ${WORK}`, PKG_DIR).trim().split('\n').pop())
+const { version } = JSON.parse(readFileSync(join(PKG_DIR, 'package.json'), 'utf8'))
+log(`packed ${tarball}`)
+
+const APP = `
+import { Mail } from 'lucide-react'
+import { Badge, Button, Dialog, FeaturedInput, Select, Tabs, VERSION } from '@openkhalix/tansy-ui'
+
+export function Demo() {
+ return (
+
+ tansy {VERSION}
+ } />
+
+
+ Save
+ OK}>It works.
+
+ )
+}
+`
+
+const VITE_BASE = {
+ 'index.html': `t
`,
+ 'src/Demo.tsx': APP,
+ 'tsconfig.json': JSON.stringify({
+ compilerOptions: {
+ target: 'es2022', module: 'esnext', moduleResolution: 'bundler', jsx: 'react-jsx',
+ strict: true, skipLibCheck: false, noEmit: true, types: ['vite/client'],
+ },
+ include: ['src'],
+ }),
+}
+
+const scenarios = {
+ vite: {
+ files: {
+ ...VITE_BASE,
+ 'package.json': JSON.stringify({ name: 'vite-tailwind', private: true, type: 'module', scripts: { build: 'tsc && vite build' } }),
+ 'vite.config.ts': `import react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\nimport { defineConfig } from 'vite'\nexport default defineConfig({ plugins: [react(), tailwindcss()] })\n`,
+ 'src/app.css': `@import "tailwindcss";\n@import "@openkhalix/tansy-ui/tokens.css";\n@source "../node_modules/@openkhalix/tansy-ui/dist";\n`,
+ 'src/main.tsx': `import { createRoot } from 'react-dom/client'\nimport { Demo } from './Demo'\nimport './app.css'\ncreateRoot(document.getElementById('root')!).render( )\n`,
+ },
+ deps: 'react@19 react-dom@19 lucide-react vite@8 @vitejs/plugin-react tailwindcss@4 @tailwindcss/vite@4 typescript @types/react @types/react-dom',
+ build: 'npm run build',
+ serve: 'dist',
+ },
+ plain: {
+ files: {
+ ...VITE_BASE,
+ 'package.json': JSON.stringify({ name: 'plain-react', private: true, type: 'module', scripts: { build: 'tsc && vite build' } }),
+ 'vite.config.ts': `import react from '@vitejs/plugin-react'\nimport { defineConfig } from 'vite'\nexport default defineConfig({ plugins: [react()] })\n`,
+ 'src/main.tsx': `import { createRoot } from 'react-dom/client'\nimport '@openkhalix/tansy-ui/styles.css'\nimport { Demo } from './Demo'\ncreateRoot(document.getElementById('root')!).render( )\n`,
+ },
+ deps: 'react@19 react-dom@19 lucide-react vite@8 @vitejs/plugin-react typescript @types/react @types/react-dom',
+ build: 'npm run build',
+ serve: 'dist',
+ },
+ next: {
+ files: {
+ 'package.json': JSON.stringify({ name: 'next-app', private: true, scripts: { build: 'next build' } }),
+ 'next.config.mjs': 'export default {}\n',
+ 'tsconfig.json': JSON.stringify({
+ compilerOptions: {
+ target: 'es2022', lib: ['dom', 'dom.iterable', 'esnext'], strict: true, noEmit: true, module: 'esnext',
+ moduleResolution: 'bundler', jsx: 'react-jsx', skipLibCheck: true, isolatedModules: true, incremental: true,
+ plugins: [{ name: 'next' }],
+ },
+ include: ['next-env.d.ts', '**/*.ts', '**/*.tsx', '.next/types/**/*.ts'],
+ }),
+ 'app/layout.tsx': `import '@openkhalix/tansy-ui/styles.css'\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return {children}\n}\n`,
+ // A Server Component: no "use client" here.
+ 'app/page.tsx': `import { Badge, Button, cn } from '@openkhalix/tansy-ui'\nexport default function Page() {\n return server rendered Save \n}\n`,
+ },
+ deps: 'next@16 react@19 react-dom@19 lucide-react typescript @types/react @types/react-dom @types/node',
+ build: 'npm run build',
+ },
+}
+
+// --- run ------------------------------------------------------------------------
+const results = []
+for (const [name, s] of Object.entries(scenarios)) {
+ if (only && only !== name) continue
+ const dir = join(WORK, name)
+ write(dir, s.files)
+ try {
+ log(`${name}: installing`)
+ sh(`npm install --no-audit --no-fund ${s.deps} ${tarball}`, dir)
+ log(`${name}: building`)
+ const out = sh(s.build, dir)
+ if (name === 'next' && !/[○●ƒ]\s+\//.test(out)) throw new Error('next build did not report the / route')
+ if (s.serve) await renderCheck(name, join(dir, s.serve))
+ results.push([name, 'pass'])
+ } catch (e) {
+ const detail = String(e.stdout || '') + String(e.stderr || '') || e.message
+ results.push([name, 'FAIL', detail.split('\n').filter(Boolean).slice(-15).join('\n')])
+ }
+}
+
+console.log(`\n@openkhalix/tansy-ui@${version} install tests`)
+for (const [name, status, detail] of results) {
+ console.log(` ${status === 'pass' ? '✓' : '✗'} ${name}`)
+ if (detail) console.log(detail.replace(/^/gm, ' '))
+}
+process.exit(results.some((r) => r[1] !== 'pass') ? 1 : 0)
+
+/** Serve a built app, open it in Chrome, and check it rendered and is styled. */
+async function renderCheck(name, dir) {
+ const types = { '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.svg': 'image/svg+xml' }
+ const server = createServer((req, res) => {
+ const path = new URL(req.url, 'http://x').pathname
+ try {
+ const body = readFileSync(join(dir, path === '/' ? 'index.html' : path))
+ res.writeHead(200, { 'content-type': types[extname(path)] ?? 'text/html' })
+ res.end(body)
+ } catch {
+ res.writeHead(404)
+ res.end()
+ }
+ })
+ await new Promise((ok) => server.listen(0, '127.0.0.1', ok))
+ const { chromium } = require('playwright')
+ const browser = await chromium.launch({ executablePath: process.env.CHROME_PATH ?? '/usr/bin/google-chrome' })
+ try {
+ const page = await browser.newPage()
+ const errors = []
+ page.on('pageerror', (e) => errors.push(e.message))
+ await page.goto(`http://127.0.0.1:${server.address().port}/`, { waitUntil: 'networkidle' })
+ await page.getByRole('dialog', { name: 'Installed from npm' }).waitFor({ timeout: 10000 })
+ const look = await page.evaluate(() => {
+ const button = getComputedStyle(document.getElementById('primary-button'))
+ const tab = getComputedStyle(document.querySelector('[role="tab"]'))
+ return { bg: button.backgroundColor, text: button.color, tabBorder: tab.borderTopWidth, tabBg: tab.backgroundColor }
+ })
+ await page.screenshot({ path: join(WORK, `${name}.png`) })
+ if (errors.length) throw new Error(`page errors: ${errors.join('; ')}`)
+ // Classic Blue primary-500 (#305ddd) with white text, and tabs without the
+ // browser's default button chrome: proves utilities and reset both applied.
+ const problems = []
+ if (look.bg !== 'rgb(48, 93, 221)') problems.push(`button background ${look.bg}`)
+ if (look.text !== 'rgb(255, 255, 255)') problems.push(`button text ${look.text}`)
+ if (look.tabBorder !== '0px') problems.push(`tab border ${look.tabBorder}`)
+ if (!/rgba\(0, 0, 0, 0\)|transparent/.test(look.tabBg)) problems.push(`tab background ${look.tabBg}`)
+ if (problems.length) throw new Error(`components look wrong: ${problems.join(', ')}`)
+ } finally {
+ await browser.close()
+ server.close()
+ }
+}
diff --git a/src/version.ts b/src/version.ts
deleted file mode 100644
index 1bfd009..0000000
--- a/src/version.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-declare const __TANSY_VERSION__: string
-
-/** The package version, injected from package.json at build time by vite.config.ts. */
-export const VERSION: string = __TANSY_VERSION__
diff --git a/tsconfig.json b/tsconfig.json
deleted file mode 100644
index 1ffef60..0000000
--- a/tsconfig.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "files": [],
- "references": [
- { "path": "./tsconfig.app.json" },
- { "path": "./tsconfig.node.json" }
- ]
-}
diff --git a/tsconfig.node.json b/tsconfig.node.json
deleted file mode 100644
index 8455dcb..0000000
--- a/tsconfig.node.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "compilerOptions": {
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
- "target": "es2023",
- "lib": ["ES2023"],
- "types": ["node"],
- "skipLibCheck": true,
-
- /* Bundler mode */
- "module": "nodenext",
- "allowImportingTsExtensions": true,
- "verbatimModuleSyntax": true,
- "moduleDetection": "force",
- "noEmit": true,
-
- /* Linting */
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "erasableSyntaxOnly": true,
- "noFallthroughCasesInSwitch": true
- },
- "include": ["vite.config.ts"]
-}