Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9a842bf
chore: 🤖 Create directory structure, copy files from deprecated version
punkbit Apr 8, 2026
79f4fc2
chore: 🤖 Copy utility files
punkbit Apr 8, 2026
0c6982f
chore: 🤖 Copy hook files
punkbit Apr 8, 2026
c3a4cf4
chore: 🤖 Create index files
punkbit Apr 8, 2026
4688dcb
chore: 🤖 Update package configuration, e.g. legacy config, package.js…
punkbit Apr 8, 2026
7ccd4b3
chore: 🤖 update lockfile
punkbit Apr 8, 2026
a99ac3d
docs: 📝 tokens legacy support
punkbit Apr 8, 2026
6c040a7
chore: 🤖 add changeset
punkbit Apr 8, 2026
96b4c26
chore: 🤖 prevent script injection via unsanitized props
punkbit Apr 8, 2026
37d56f7
chore: 🤖 updated theme and hooks exports to re-export from legacy, re…
punkbit Apr 8, 2026
6abbd86
chore: 🤖 format
punkbit Apr 8, 2026
c800d08
fix: 🐛 typecheck now passes successfully, and InitCUIThemeScript.tsx …
punkbit Apr 8, 2026
ade0688
chore: 🤖 styled-components peer dependency is now marked as = true
punkbit Apr 8, 2026
c71c8e5
chore: 🤖 removed attribute from the useEffect dependency array
punkbit Apr 8, 2026
4614fa6
fix: 🐛 package.json extra comma
punkbit Apr 8, 2026
3f28bb1
docs: 📝 ESM only
punkbit Apr 8, 2026
410f362
chore: 🤖 update lock file
punkbit Apr 8, 2026
b587e5f
fix: 🐛 type conflict caused by packages/click-ui/tsconfig.json
punkbit Apr 8, 2026
b731c87
chore: 🤖 update lock file
punkbit Apr 8, 2026
e16d895
fix: 🐛 typo
punkbit Apr 8, 2026
a17d2d9
fix: 🐛 escape the value
punkbit Apr 8, 2026
00c8fe5
chore: 🤖 throw descriptive error if useCUITheme not wrapped in ThemeP…
punkbit Apr 8, 2026
c84c508
chore: 🤖 update changeset
punkbit Apr 8, 2026
557cd85
chore: 🤖 format
punkbit Apr 8, 2026
3d03eb6
chore: 🤖 disable changset checkup
punkbit Apr 8, 2026
97535a2
fix: 🐛 Added a path mapping in packages/click-ui/tsconfig.json to res…
punkbit Apr 8, 2026
1c6004d
fix: 🐛 typo
punkbit Apr 8, 2026
66c8791
refactor: 💡 split design-tokens deprecated theme utils carefully
punkbit Apr 8, 2026
0a644e4
fix: 🐛 use ThemeName
punkbit Apr 8, 2026
19212d8
chore: 🤖 preventing the effect from re-firing when theme changes exte…
punkbit Apr 8, 2026
e257528
chore: 🤖 react and react-dom are now marked as optional:
punkbit Apr 8, 2026
ab6f1e0
refactor: 💡 removed the local getDOMElement function and now both set…
punkbit Apr 8, 2026
bdb52a2
chore: 🤖 remove duplicate
punkbit Apr 8, 2026
13f9706
chore: 🤖 Added @deprecated JSDoc comments to all legacy re-exports
punkbit Apr 8, 2026
4dc9534
chore: 🤖 build ESM and CJS (use tsup)
punkbit Apr 8, 2026
18a7a53
refactor: 💡 remove glob, prefer simplified pathname
punkbit Apr 8, 2026
8043092
refactor: 💡 resolves types in both ESM (.d.ts) and CJS (.d.cts) modes
punkbit Apr 8, 2026
c83e4ac
refactor: 💡 Changed defaultTheme = "light" to defaultTheme = THEMES.L…
punkbit Apr 8, 2026
d77b381
chore: 🤖 delete legacy tsconfig
punkbit Apr 8, 2026
613edac
chore: 🤖 add note
punkbit Apr 8, 2026
8efaec6
chore: 🤖 getRootElement() (and the internal getDOMElement) are safe t…
punkbit Apr 8, 2026
19cde04
chore: 🤖 Changed platform: browser to platform: neutral since the pac…
punkbit Apr 8, 2026
0e58db9
chore: 🤖 added safety comment
punkbit Apr 8, 2026
f8f713d
chore: 🤖 added "use client"
punkbit Apr 8, 2026
c2761d2
fix: 🐛 react not defined
punkbit Apr 8, 2026
13f2c04
chore: 🤖 remove legacy generate:tokens and related files (freeze lega…
punkbit Apr 8, 2026
e0889b6
chore: 🤖 remove legacy generate:tokens dependencies
punkbit Apr 8, 2026
eecfbd6
chore: 🤖 update lockfile
punkbit Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/add-design-tokens-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
"@clickhouse/click-ui": patch
---

Redirect theme and hook exports to @clickhouse/design-tokens/legacy

`@clickhouse/click-ui` now re-exports theme utilities and hooks from `@clickhouse/design-tokens/legacy/*` subpaths instead of providing them directly. This establishes a runtime dependency on `@clickhouse/design-tokens`.

**Affected imports (now re-exported from legacy paths):**

These continue to work via re-export

```typescript
import { useCUITheme } from '@clickhouse/click-ui';
import { InitCUIThemeScript } from '@clickhouse/click-ui';
import { THEMES } from '@clickhouse/click-ui';
```

Alternatively, consumer apps can import directly from legacy exports path:

```typescript
import { useCUITheme } from '@clickhouse/design-tokens/legacy/hooks';
```

**Removed legacy token generator:**

The old Style Dictionary-based token generator (`yarn generate:tokens`) has been removed along with its dependencies (`@tokens-studio/sd-transforms`, `style-dictionary`) and the `tokens/` source directory. The legacy TypeScript theme objects remain available in `@clickhouse/design-tokens/legacy` as frozen snapshots, but the modern CSS-based token system in `packages/design-tokens` is now the only maintained system.
20 changes: 20 additions & 0 deletions .changeset/design-tokens-legacy-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@clickhouse/design-tokens": minor
---

Add legacy backward compatibility exports for styled-components theme

Provides deprecated TypeScript theme exports for gradual migration from `@clickhouse/click-ui`.

**Usage:**

```typescript
// Before (deprecated in @clickhouse/click-ui)
import { useCUITheme } from '@clickhouse/click-ui';

// After (explicit legacy path)
import { useCUITheme } from '@clickhouse/design-tokens/legacy/hooks';
import { THEMES, InitCUIThemeScript } from '@clickhouse/design-tokens/legacy';
```

See [LEGACY.md](./packages/design-tokens/LEGACY.md) for migration guide.
16 changes: 9 additions & 7 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ else
exit 1
fi

if yarn workspace @clickhouse/click-ui changeset:verify; then
echo "✅ Changeset file's included!"
else
echo "⚠️ WARNING: You must include a changeset!"
echo "💡 Use the command yarn workspace @clickhouse/click-ui changeset:add"
exit 1
fi
# TODO: Once chore(monorepo): 🤖 setup changeset handling from root https://github.com/ClickHouse/click-ui/pull/951 is merged
# uncomment the changeset:verify check!
# if yarn workspace @clickhouse/click-ui changeset:verify; then
# echo "✅ Changeset file's included!"
# else
# echo "⚠️ WARNING: You must include a changeset!"
# echo "💡 Use the command yarn workspace @clickhouse/click-ui changeset:add"
# exit 1
# fi

echo "👍 Health check completed."
echo
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"prepare": "husky"
},
"devDependencies": {
"glob": "^13.0.6",
"husky": "^9.1.7"
},
"resolutions": {
Expand Down
36 changes: 0 additions & 36 deletions packages/click-ui/.changeset/add-design-tokens-package.md

This file was deleted.

71 changes: 0 additions & 71 deletions packages/click-ui/.scripts/js/generate-tokens.js

This file was deleted.

19 changes: 4 additions & 15 deletions packages/click-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,12 @@ yarn circular-dependency:check

If circular dependencies are found it'll exit with a report showing the affeced files which require your attention.

### Generating design tokens
### Design Tokens

Tokens are provided by a style directionary sourced from [tokens-studio](https://tokens.studio/).
Design tokens are provided by the `@clickhouse/design-tokens` package. See the [design-tokens documentation](../design-tokens/) for details on the token system and CSS variable usage.

It's expected to have theme tokens provided externally, e.g. Figma tokens-studio output is stored in the repository and a PR's opened. The assets are stored in the directory [./tokens/themes].

Once [./tokens/themes] files are updated or provided from exernal source, e.g. Figma, we must regenerate the tokens for consumption in the project.

Run the command to generate tokens in the path `./src/theme/tokens/`:

```sh
yarn generate:tokens
```

Once done, you must commit the changes.

Learn more about tokens-studio [here](https://documentation.tokens.studio/).
> [!NOTE]
> The legacy styled-components theme system has been moved to `@clickhouse/design-tokens/legacy` and is deprecated. Migrate to CSS variables for new projects.

### Local development

Expand Down
4 changes: 1 addition & 3 deletions packages/click-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@
"format": ".scripts/bash/format",
"format:fix": ".scripts/bash/format --write",
"generate:exports": ".scripts/js/generate-exports",
"generate:tokens": "node ./.scripts/js/generate-tokens.js && yarn format:fix src/theme/tokens/**/*.ts",
"lint": "eslint src --report-unused-disable-directives",
"lint:fix": "eslint src --report-unused-disable-directives --fix",
"prettify": "yarn format:fix",
Expand All @@ -392,6 +391,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@clickhouse/design-tokens": "workspace:^",
"@h6s/calendar": "2.0.1",
"@radix-ui/react-accordion": "1.2.12",
"@radix-ui/react-avatar": "1.1.1",
Expand Down Expand Up @@ -430,7 +430,6 @@
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@tokens-studio/sd-transforms": "^1.2.0",
"@types/eslint-plugin-react-refresh": "^0.4.0",
"@types/lodash-es": "^4.17.12",
"@types/node": "^24.10.1",
Expand Down Expand Up @@ -460,7 +459,6 @@
"skott": "^0.35.4",
"storybook": "^10.1.10",
"storybook-addon-pseudo-states": "^10.1.10",
"style-dictionary": "^5.0.0",
"stylis": "^4.3.0",
"ts-node": "^10.9.1",
"typescript": "^5.5.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SVGAttributes } from 'react';
import { useTheme } from 'styled-components';
import { getFallbackThemeName } from '@/theme/theme.utils';
import { getFallbackThemeName } from '@clickhouse/design-tokens/legacy/theme';
import { SvgImageElement } from '@/components/Icon/SvgImageElement';
import { FlagName, FlagProps } from './types';
import {
Expand All @@ -13,10 +13,10 @@

const resolveFlagName = createAssetResolver<FlagName>();

export { resolveFlagName };

Check warning on line 16 in packages/click-ui/src/components/Assets/Flags/system/Flag.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components

export interface FlagPropsWithAliases extends Omit<FlagProps, 'name'> {
name: FlagName | AssetAlias | AssetDeprecatedName;

Check warning on line 19 in packages/click-ui/src/components/Assets/Flags/system/Flag.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

`AssetDeprecatedName` is deprecated. Use the kebab-case name instead (e.g., 'activity' instead of 'Activity')
}

const Flag = ({ name, theme, size, ...props }: FlagPropsWithAliases) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SVGAttributes } from 'react';
import type { AssetSize } from '@/types';
import type { ThemeName } from '@/theme/theme.types';
import type { ThemeName } from '@clickhouse/design-tokens/legacy/theme';

export type FlagName =
| 'australia'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SVGAttributes } from 'react';
import { useTheme } from 'styled-components';
import { getFallbackThemeName } from '@/theme/theme.utils';
import { getFallbackThemeName } from '@clickhouse/design-tokens/legacy/theme';
import { SvgImageElement } from '@/components/Icon/SvgImageElement';
import { IconName, IconProps } from './types';
import {
Expand All @@ -13,10 +13,10 @@

const resolveIconName = createAssetResolver<IconName>();

export { resolveIconName };

Check warning on line 16 in packages/click-ui/src/components/Assets/Icons/system/Icon.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components

export interface IconPropsWithAliases extends Omit<IconProps, 'name'> {
name: IconName | AssetAlias | AssetDeprecatedName;

Check warning on line 19 in packages/click-ui/src/components/Assets/Icons/system/Icon.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

`AssetDeprecatedName` is deprecated. Use the kebab-case name instead (e.g., 'activity' instead of 'Activity')
}

const Icon = ({ name, theme, size, ...props }: IconPropsWithAliases) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SVGAttributes } from 'react';
import type { AssetSize } from '@/types';
import type { ThemeName } from '@/theme/theme.types';
import type { ThemeName } from '@clickhouse/design-tokens/legacy/theme';

export type IconName =
| 'activity'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SVGAttributes } from 'react';
import { useTheme } from 'styled-components';
import { getFallbackThemeName } from '@/theme/theme.utils';
import { getFallbackThemeName } from '@clickhouse/design-tokens/legacy/theme';
import { SvgImageElement } from '@/components/Icon/SvgImageElement';
import { LogoName, LogoProps } from './types';
import {
Expand All @@ -13,10 +13,10 @@

const resolveLogoName = createAssetResolver<LogoName>();

export { resolveLogoName };

Check warning on line 16 in packages/click-ui/src/components/Assets/Logos/system/Logo.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components

export interface LogoPropsWithAliases extends Omit<LogoProps, 'name'> {
name: LogoName | AssetAlias | AssetDeprecatedName;

Check warning on line 19 in packages/click-ui/src/components/Assets/Logos/system/Logo.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

`AssetDeprecatedName` is deprecated. Use the kebab-case name instead (e.g., 'activity' instead of 'Activity')
}

const Logo = ({ name, theme, size, ...props }: LogoPropsWithAliases) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SVGAttributes } from 'react';
import type { AssetSize } from '@/types';
import type { ThemeName } from '@/theme/theme.types';
import type { ThemeName } from '@clickhouse/design-tokens/legacy/theme';

export type LogoName =
| 'airbyte'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SVGAttributes } from 'react';
import { useTheme } from 'styled-components';
import { getFallbackThemeName } from '@/theme/theme.utils';
import { getFallbackThemeName } from '@clickhouse/design-tokens/legacy/theme';
import { SvgImageElement } from '@/components/Icon/SvgImageElement';
import { PaymentName, PaymentProps } from './types';
import {
Expand All @@ -13,10 +13,10 @@

const resolvePaymentName = createAssetResolver<PaymentName>();

export { resolvePaymentName };

Check warning on line 16 in packages/click-ui/src/components/Assets/Payments/system/Payment.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components

export interface PaymentPropsWithAliases extends Omit<PaymentProps, 'name'> {
name: PaymentName | AssetAlias | AssetDeprecatedName;

Check warning on line 19 in packages/click-ui/src/components/Assets/Payments/system/Payment.tsx

View workflow job for this annotation

GitHub Actions / code-quality-checks

`AssetDeprecatedName` is deprecated. Use the kebab-case name instead (e.g., 'activity' instead of 'Activity')
}

const Payment = ({ name, theme, size, ...props }: PaymentPropsWithAliases) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SVGAttributes } from 'react';
import type { AssetSize } from '@/types';
import type { ThemeName } from '@/theme/theme.types';
import type { ThemeName } from '@clickhouse/design-tokens/legacy/theme';

export type PaymentName = 'amex' | 'mastercard' | 'paypal' | 'visa';

Expand Down
2 changes: 1 addition & 1 deletion packages/click-ui/src/components/Assets/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SVGAttributes } from 'react';
import type { AssetSize } from '@/types';
import type { ThemeName } from '@/theme/theme.types';
import type { ThemeName } from '@clickhouse/design-tokens/legacy/theme';

export type SVGAssetProps = SVGAttributes<SVGElement> & {
theme?: ThemeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
GenericPopoverMenuPanel,
GenericMenuItem,
} from './GenericMenu';
import { themes } from '@/theme/theme.core';
import { themes } from '@clickhouse/design-tokens/legacy/theme';

const renderWithTheme = (component: React.ReactNode) => {
return render(<ThemeProvider theme={themes.dark}>{component}</ThemeProvider>);
Expand Down
2 changes: 1 addition & 1 deletion packages/click-ui/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { styled } from 'styled-components';
import { FormRoot } from '@/components/FormContainer';
import { GenericLabel } from '@/components/GenericLabel';
import { SwitchProps } from './Switch.types';
import type { Theme } from '@/theme/theme.types';
import type { Theme } from '@clickhouse/design-tokens/legacy/theme';

interface ThumbProps {
$checked: boolean;
Expand Down
19 changes: 5 additions & 14 deletions packages/click-ui/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
export { useToast } from './useToast';
export { useInitialTheme } from './useInitialTheme';
export type { UseThemeParams } from './useInitialTheme';

/**
* @deprecated This hook is deprecated and will be removed in a future version.
* Use CSS variables for theming instead (e.g., `var(--click-global-color-text-default)`).
* For theme name, use the `useInitialTheme` hook or access the theme context directly.
*/
export { useCUITheme } from './useCUITheme';

/**
* @deprecated This type is deprecated and will be removed in a future version.
*/
export type { CUIThemeType } from './useCUITheme';
export { useInitialTheme, useCUITheme } from '@clickhouse/design-tokens/legacy/hooks';
export type {
UseThemeParams,
CUIThemeType,
} from '@clickhouse/design-tokens/legacy/hooks';
16 changes: 0 additions & 16 deletions packages/click-ui/src/hooks/useCUITheme.ts

This file was deleted.

Loading
Loading