@clickhouse/click-ui 0.0.237-sc-deprecation.1 → 0.0.238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -161
- package/dist/click-ui.bundled.es.js +49537 -41533
- package/dist/click-ui.bundled.es.js.map +1 -0
- package/dist/click-ui.bundled.umd.js +53057 -78
- package/dist/click-ui.bundled.umd.js.map +1 -0
- package/dist/click-ui.es.js +48004 -41168
- package/dist/click-ui.es.js.map +1 -0
- package/dist/click-ui.umd.js +51888 -78
- package/dist/click-ui.umd.js.map +1 -0
- package/dist/components/Accordion/Accordion.d.ts +3 -3
- package/dist/components/Alert/Alert.d.ts +9 -3
- package/dist/components/AutoComplete/AutoComplete.d.ts +1 -0
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/BigStat/BigStat.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/dist/components/CardHorizontal/CardHorizontal.d.ts +1 -1
- package/dist/components/CardPrimary/CardPrimaryTopBadge.d.ts +3 -14
- package/dist/components/CardPromotion/CardPromotion.d.ts +1 -1
- package/dist/components/CardSecondary/CardSecondary.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/ClickUIProvider/ClickUIProvider.d.ts +15 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock/useColorStyle.d.ts +1 -1
- package/dist/components/Collapsible/Collapsible.d.ts +3 -3
- package/dist/components/Container/Container.d.ts +6 -5
- package/dist/components/DatePicker/Common.d.ts +3 -8
- package/dist/components/Dialog/Dialog.d.ts +2 -2
- package/dist/components/EllipsisContent/EllipsisContent.d.ts +6 -4
- package/dist/components/FileTabs/FileTabs.d.ts +2 -2
- package/dist/components/Flyout/Flyout.d.ts +1 -1
- package/dist/components/GenericMenu.d.ts +10 -22
- package/dist/components/Grid/Cell.d.ts +1 -2
- package/dist/components/Grid/StyledCell.d.ts +2 -5
- package/dist/components/Grid/types.d.ts +1 -1
- package/dist/components/GridContainer/GridContainer.d.ts +5 -4
- package/dist/components/Icon/IconCommon.d.ts +3 -3
- package/dist/components/Icon/types.d.ts +0 -2
- package/dist/components/IconWrapper/IconWrapper.d.ts +2 -2
- package/dist/components/Input/InputWrapper.d.ts +18 -25
- package/dist/components/Link/Link.d.ts +6 -4
- package/dist/components/Link/common.d.ts +7 -0
- package/dist/components/Logos/Logo.d.ts +1 -1
- package/dist/components/MultiAccordion/MultiAccordion.d.ts +1 -1
- package/dist/components/Panel/Panel.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/Select/common/SelectStyled.d.ts +26 -24
- package/dist/components/Separator/Separator.d.ts +3 -4
- package/dist/components/SidebarNavigationItem/SidebarNavigationItem.d.ts +9 -5
- package/dist/components/SidebarNavigationTitle/SidebarNavigationTitle.d.ts +7 -5
- package/dist/components/Spacer/Spacer.d.ts +1 -2
- package/dist/components/SplitButton/SplitButton.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +24 -26
- package/dist/components/Typography/Text/Text.d.ts +5 -4
- package/dist/components/VerticalStepper/VerticalStepper.d.ts +2 -2
- package/dist/components/commonElement.d.ts +17 -21
- package/dist/components/commonTypes.d.ts +1 -1
- package/dist/components/icons/HorizontalLoading.d.ts +1 -3
- package/dist/components/icons/Loading.d.ts +1 -1
- package/dist/components/icons/LoadingAnimated.d.ts +1 -3
- package/dist/components/index.d.ts +3 -6
- package/dist/components/types.d.ts +83 -51
- package/dist/index.d.ts +1 -77
- package/dist/styles/variables.classic.json.d.ts +993 -0
- package/dist/{theme/tokens → styles}/variables.dark.json.d.ts +117 -117
- package/dist/{theme/tokens → styles}/variables.light.json.d.ts +142 -142
- package/dist/theme/index.d.ts +12 -6
- package/dist/theme/theme.d.ts +7 -0
- package/dist/utils/test-utils.d.ts +3 -1
- package/package.json +14 -40
- package/bin/README.md +0 -178
- package/bin/click-ui.config.example.ts +0 -70
- package/bin/click-ui.js +0 -97
- package/bin/commands/build-default-theme.ts +0 -48
- package/bin/commands/generate.js +0 -117
- package/bin/commands/init.js +0 -110
- package/bin/utils/config-loader.ts +0 -61
- package/bin/utils/css-generator.js +0 -32
- package/dist/components/Link/linkStyles.d.ts +0 -134
- package/dist/components/ThemeToggle/ThemeToggle.d.ts +0 -4
- package/dist/config/tokens/types.d.ts +0 -15296
- package/dist/config/tokens/types.d.ts.map +0 -1
- package/dist/config/tokens/types.js +0 -2
- package/dist/config/tokens/types.js.map +0 -1
- package/dist/config/types.d.ts +0 -55
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js +0 -2
- package/dist/config/types.js.map +0 -1
- package/dist/config/utils/css-builder.d.ts +0 -38
- package/dist/config/utils/css-builder.d.ts.map +0 -1
- package/dist/config/utils/css-builder.js +0 -56
- package/dist/config/utils/css-builder.js.map +0 -1
- package/dist/config/utils/css-generator.d.ts +0 -25
- package/dist/config/utils/css-generator.d.ts.map +0 -1
- package/dist/config/utils/css-generator.js +0 -151
- package/dist/config/utils/css-generator.js.map +0 -1
- package/dist/config/utils/find-config.d.ts +0 -17
- package/dist/config/utils/find-config.d.ts.map +0 -1
- package/dist/config/utils/find-config.js +0 -28
- package/dist/config/utils/find-config.js.map +0 -1
- package/dist/cui-components.css +0 -1
- package/dist/cui-default-theme.css +0 -1809
- package/dist/cui.css +0 -3
- package/dist/stories/ChartColorComponent.d.ts +0 -1
- package/dist/stories/chart-examples/ChartTooltip.d.ts +0 -12
- package/dist/stories/chart-examples/ColorSwatchesChart.d.ts +0 -1
- package/dist/stories/chart-examples/GroupedBarChart.d.ts +0 -1
- package/dist/stories/chart-examples/MultiLineChart.d.ts +0 -1
- package/dist/stories/chart-examples/StackedAreaChart.d.ts +0 -1
- package/dist/stories/chart-examples/StackedBarChartDemo.d.ts +0 -1
- package/dist/theme/ClickUIProvider/ClickUIProvider.d.ts +0 -5
- package/dist/theme/ClickUIProvider/ServerClickUIProvider.d.ts +0 -23
- package/dist/theme/ClickUIProvider/context.d.ts +0 -24
- package/dist/theme/ClickUIProvider/hooks.d.ts +0 -4
- package/dist/theme/ClickUIProvider/index.d.ts +0 -6
- package/dist/theme/ClickUIProvider/types.d.ts +0 -39
- package/dist/theme/config.d.ts +0 -22
- package/dist/theme/hooks/useSystemColorSchemePreference.d.ts +0 -7
- package/dist/theme/types.d.ts +0 -54
- package/dist/theme/utils/css-builder.d.ts +0 -37
- package/dist/theme/utils/css-generator.d.ts +0 -25
- package/dist/theme/utils/find-config.d.ts +0 -16
- package/dist/theme/utils/theme-attribute.d.ts +0 -13
- package/dist/theme/utils.d.ts +0 -29
- package/dist/utils/capitalize.d.ts +0 -12
- package/dist/utils/polymorphic/index.d.ts +0 -48
- /package/dist/{theme/tokens → styles}/types.d.ts +0 -0
- /package/dist/{theme/tokens → styles}/variables.json.d.ts +0 -0
package/README.md
CHANGED
|
@@ -6,175 +6,34 @@ The home of the ClickHouse design system and component library. Click UI is in v
|
|
|
6
6
|
|
|
7
7
|
Click UI has been tested in NextJS, Gatsby, and Vite. If you run into problems using it in your app, please create an issue and our team will try to answer.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
2. **Import the required styles**
|
|
17
|
-
|
|
18
|
-
Add these imports at the top of your main application file (before other styles):
|
|
19
|
-
|
|
20
|
-
**Option A: Simple (Recommended for most projects)**
|
|
21
|
-
```typescript
|
|
22
|
-
// All-in-one: Includes both component styles and default theme
|
|
23
|
-
import '@clickhouse/click-ui/cui.css';
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Option B: Granular (For custom theming)**
|
|
27
|
-
```typescript
|
|
28
|
-
// Component styles only
|
|
29
|
-
import '@clickhouse/click-ui/cui-components.css';
|
|
30
|
-
|
|
31
|
-
// Default theme (light + dark with automatic switching)
|
|
32
|
-
import '@clickhouse/click-ui/cui-default-theme.css';
|
|
33
|
-
|
|
34
|
-
// OR import your custom theme instead:
|
|
35
|
-
// import './my-custom-theme.css';
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Where to import:**
|
|
39
|
-
- **Next.js App Router**: Add to your root `layout.tsx`
|
|
40
|
-
- **Next.js Pages Router**: Add to `pages/_app.tsx`
|
|
41
|
-
- **Gatsby**: Add to `gatsby-browser.js`
|
|
42
|
-
- **Vite/React**: Add to `main.tsx` or `App.tsx`
|
|
43
|
-
|
|
44
|
-
3. **Wrap your app with ClickUIProvider**
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import '@clickhouse/click-ui/cui.css';
|
|
48
|
-
import { ClickUIProvider, Text, Title } from '@clickhouse/click-ui'
|
|
49
|
-
|
|
50
|
-
function App() {
|
|
51
|
-
return (
|
|
52
|
-
<ClickUIProvider>
|
|
53
|
-
<Title type='h1'>Click UI Example</Title>
|
|
54
|
-
<Text>Welcome to Click UI!</Text>
|
|
55
|
-
</ClickUIProvider>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default App
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Customizing Your Theme
|
|
63
|
-
|
|
64
|
-
Click UI supports extensive theming through a CLI-based approach:
|
|
65
|
-
|
|
66
|
-
#### Step 1: Create a config file
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
npx click-ui init
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
This creates a `click-ui.config.ts` file in your project root.
|
|
73
|
-
|
|
74
|
-
#### Step 2: Customize your theme
|
|
9
|
+
1. Navigate to your app's route and run
|
|
10
|
+
`npm i @clickhouse/click-ui`
|
|
11
|
+
or
|
|
12
|
+
`yarn add @clickhouse/click-ui`
|
|
13
|
+
2. Make sure to wrap your application in the Click UI `ClickUIProvider`, without doing this, you may run into issues with styled-components. Once thats done, you'll be able to import the individual components that you want to use on each page. Here's an example an `App.tsx` in NextJS.
|
|
75
14
|
|
|
76
15
|
```typescript
|
|
77
|
-
|
|
78
|
-
export default {
|
|
79
|
-
// Light mode theme tokens
|
|
80
|
-
theme: {
|
|
81
|
-
button: {
|
|
82
|
-
color: {
|
|
83
|
-
primary: {
|
|
84
|
-
'background-default': '#FF6B00',
|
|
85
|
-
'background-hover': '#FF8533',
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
// Dark mode overrides
|
|
92
|
-
dark: {
|
|
93
|
-
button: {
|
|
94
|
-
color: {
|
|
95
|
-
primary: {
|
|
96
|
-
'background-default': '#FF8533',
|
|
97
|
-
'background-hover': '#FFA366',
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
// Runtime configuration (optional)
|
|
104
|
-
storageKey: 'my-app-theme',
|
|
105
|
-
tooltipConfig: { delayDuration: 200 }
|
|
106
|
-
}
|
|
107
|
-
```
|
|
16
|
+
import { ClickUIProvider, Text, ThemeName, Title, Switch } from '@clickhouse/click-ui'
|
|
108
17
|
|
|
109
|
-
|
|
18
|
+
function App() {
|
|
19
|
+
const [theme, setTheme] = useState<ThemeName>('dark')
|
|
110
20
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
21
|
+
const toggleTheme = () => {
|
|
22
|
+
theme === 'dark' ? setTheme('light') : setTheme('dark')
|
|
23
|
+
}
|
|
114
24
|
|
|
115
|
-
|
|
25
|
+
return (
|
|
26
|
+
<ClickUIProvider theme={theme} config={{tooltip:{ delayDuration: 0 }}}>
|
|
27
|
+
<Switch checked={theme === 'dark'} onClick={() => toggleTheme() } />
|
|
116
28
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
import './public/cui-custom-theme.css'; // Your custom theme
|
|
122
|
-
import { ClickUIProvider } from '@clickhouse/click-ui'
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**Resources:**
|
|
126
|
-
- **[CLI Theme Generation](CLI_THEME_GENERATION.md)** - Complete CLI documentation
|
|
127
|
-
- **[Theme System](src/theme/index.md)** - Runtime theming, hooks, and theme switching
|
|
128
|
-
- **[Build-Time Configuration](BUILD_TIME_CONFIG_CLICK_UI.md)** - Theme config API reference
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## How It Works
|
|
133
|
-
|
|
134
|
-
Click UI uses a **pre-built CSS approach** for optimal performance:
|
|
135
|
-
|
|
136
|
-
1. **CSS Files Generated at Build Time**
|
|
137
|
-
- Default theme included in the library (~10 KB)
|
|
138
|
-
- Custom themes generated via CLI
|
|
139
|
-
- Uses CSS `light-dark()` function for automatic theme switching
|
|
140
|
-
|
|
141
|
-
2. **Minimal Runtime JavaScript**
|
|
142
|
-
- Provider only sets `data-theme` attribute (~600 bytes)
|
|
143
|
-
- Zero runtime CSS generation
|
|
144
|
-
- Instant theme switching via CSS attributes
|
|
145
|
-
|
|
146
|
-
3. **Perfect Tree-Shaking**
|
|
147
|
-
- Import only the components you use
|
|
148
|
-
- Unused CSS automatically eliminated by your bundler
|
|
149
|
-
- Optimal bundle size
|
|
150
|
-
|
|
151
|
-
### Theme Switching
|
|
152
|
-
|
|
153
|
-
Themes are controlled via HTML attributes and CSS custom properties:
|
|
154
|
-
|
|
155
|
-
```html
|
|
156
|
-
<!-- Light mode -->
|
|
157
|
-
<html data-theme="light">
|
|
158
|
-
|
|
159
|
-
<!-- Dark mode -->
|
|
160
|
-
<html data-theme="dark">
|
|
161
|
-
|
|
162
|
-
<!-- System preference mode (automatic) -->
|
|
163
|
-
<html data-theme="system">
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
All theme tokens are available as CSS variables with the `--click` prefix:
|
|
167
|
-
|
|
168
|
-
```css
|
|
169
|
-
.my-component {
|
|
170
|
-
background: var(--click-global-color-background-default);
|
|
171
|
-
color: var(--click-global-color-text-default);
|
|
29
|
+
<Title type='h1'>Click UI Example</Title>
|
|
30
|
+
<Text>Welcome to Click UI. Get started here.</Text>
|
|
31
|
+
</ClickUIProvider>
|
|
32
|
+
)
|
|
172
33
|
}
|
|
173
|
-
```
|
|
174
34
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
---
|
|
35
|
+
export default App
|
|
36
|
+
```
|
|
178
37
|
|
|
179
38
|
## To develop this library locally 🚀
|
|
180
39
|
|