@clickhouse/click-ui 0.0.235 → 0.0.237-sc-deprecation.1
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 +161 -20
- package/bin/README.md +178 -0
- package/bin/click-ui.config.example.ts +70 -0
- package/bin/click-ui.js +97 -0
- package/bin/commands/build-default-theme.ts +48 -0
- package/bin/commands/generate.js +117 -0
- package/bin/commands/init.js +110 -0
- package/bin/utils/config-loader.ts +61 -0
- package/bin/utils/css-generator.js +32 -0
- package/dist/click-ui.bundled.es.js +40740 -48756
- package/dist/click-ui.bundled.umd.js +79 -53070
- package/dist/click-ui.es.js +40747 -47595
- package/dist/click-ui.umd.js +79 -51901
- package/dist/components/Accordion/Accordion.d.ts +3 -3
- package/dist/components/AutoComplete/AutoComplete.d.ts +0 -1
- 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 +5 -1
- package/dist/components/CardPrimary/CardPrimaryTopBadge.d.ts +14 -3
- 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/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 +5 -6
- package/dist/components/DatePicker/Common.d.ts +8 -3
- package/dist/components/Dialog/Dialog.d.ts +2 -2
- package/dist/components/EllipsisContent/EllipsisContent.d.ts +4 -6
- package/dist/components/FileTabs/FileTabs.d.ts +2 -2
- package/dist/components/Flyout/Flyout.d.ts +1 -1
- package/dist/components/GenericMenu.d.ts +22 -10
- package/dist/components/Grid/Cell.d.ts +2 -1
- package/dist/components/Grid/StyledCell.d.ts +5 -2
- package/dist/components/Grid/types.d.ts +1 -1
- package/dist/components/GridContainer/GridContainer.d.ts +4 -5
- package/dist/components/Icon/IconCommon.d.ts +4 -3
- package/dist/components/Icon/types.d.ts +3 -1
- package/dist/components/IconWrapper/IconWrapper.d.ts +2 -2
- package/dist/components/Input/InputWrapper.d.ts +25 -18
- package/dist/components/Link/Link.d.ts +4 -6
- package/dist/components/Link/linkStyles.d.ts +134 -0
- package/dist/components/Logos/AWSGlue.d.ts +4 -0
- package/dist/components/Logos/Logo.d.ts +1 -1
- package/dist/components/Logos/types.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 +24 -26
- package/dist/components/Separator/Separator.d.ts +4 -3
- package/dist/components/SidebarNavigationItem/SidebarNavigationItem.d.ts +5 -9
- package/dist/components/SidebarNavigationTitle/SidebarNavigationTitle.d.ts +5 -7
- package/dist/components/Spacer/Spacer.d.ts +2 -1
- package/dist/components/SplitButton/SplitButton.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +26 -24
- package/dist/components/ThemeToggle/ThemeToggle.d.ts +4 -0
- package/dist/components/Typography/Text/Text.d.ts +4 -5
- package/dist/components/VerticalStepper/VerticalStepper.d.ts +2 -2
- package/dist/components/commonElement.d.ts +21 -17
- package/dist/components/commonTypes.d.ts +1 -1
- package/dist/components/icons/DataLakes.d.ts +4 -0
- package/dist/components/icons/HorizontalLoading.d.ts +3 -1
- package/dist/components/icons/Loading.d.ts +1 -1
- package/dist/components/icons/LoadingAnimated.d.ts +3 -1
- package/dist/components/index.d.ts +6 -3
- package/dist/components/types.d.ts +51 -83
- package/dist/config/tokens/types.d.ts +15296 -0
- package/dist/config/tokens/types.d.ts.map +1 -0
- package/dist/config/tokens/types.js +2 -0
- package/dist/config/tokens/types.js.map +1 -0
- package/dist/config/types.d.ts +55 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/utils/css-builder.d.ts +38 -0
- package/dist/config/utils/css-builder.d.ts.map +1 -0
- package/dist/config/utils/css-builder.js +56 -0
- package/dist/config/utils/css-builder.js.map +1 -0
- package/dist/config/utils/css-generator.d.ts +25 -0
- package/dist/config/utils/css-generator.d.ts.map +1 -0
- package/dist/config/utils/css-generator.js +151 -0
- package/dist/config/utils/css-generator.js.map +1 -0
- package/dist/config/utils/find-config.d.ts +17 -0
- package/dist/config/utils/find-config.d.ts.map +1 -0
- package/dist/config/utils/find-config.js +28 -0
- package/dist/config/utils/find-config.js.map +1 -0
- package/dist/cui-components.css +1 -0
- package/dist/cui-default-theme.css +1809 -0
- package/dist/cui.css +3 -0
- package/dist/index.d.ts +77 -1
- package/dist/stories/ChartColorComponent.d.ts +1 -0
- package/dist/stories/chart-examples/ChartTooltip.d.ts +12 -0
- package/dist/stories/chart-examples/ColorSwatchesChart.d.ts +1 -0
- package/dist/stories/chart-examples/GroupedBarChart.d.ts +1 -0
- package/dist/stories/chart-examples/MultiLineChart.d.ts +1 -0
- package/dist/stories/chart-examples/StackedAreaChart.d.ts +1 -0
- package/dist/stories/chart-examples/StackedBarChartDemo.d.ts +1 -0
- package/dist/theme/ClickUIProvider/ClickUIProvider.d.ts +5 -0
- package/dist/theme/ClickUIProvider/ServerClickUIProvider.d.ts +23 -0
- package/dist/theme/ClickUIProvider/context.d.ts +24 -0
- package/dist/theme/ClickUIProvider/hooks.d.ts +4 -0
- package/dist/theme/ClickUIProvider/index.d.ts +6 -0
- package/dist/theme/ClickUIProvider/types.d.ts +39 -0
- package/dist/theme/config.d.ts +22 -0
- package/dist/theme/hooks/useSystemColorSchemePreference.d.ts +7 -0
- package/dist/theme/index.d.ts +6 -12
- package/dist/{styles → theme/tokens}/types.d.ts +13 -6
- package/dist/{styles → theme/tokens}/variables.dark.json.d.ts +118 -117
- package/dist/{styles → theme/tokens}/variables.json.d.ts +20 -13
- package/dist/{styles → theme/tokens}/variables.light.json.d.ts +146 -145
- package/dist/theme/types.d.ts +54 -0
- package/dist/theme/utils/css-builder.d.ts +37 -0
- package/dist/theme/utils/css-generator.d.ts +25 -0
- package/dist/theme/utils/find-config.d.ts +16 -0
- package/dist/theme/utils/theme-attribute.d.ts +13 -0
- package/dist/theme/utils.d.ts +29 -0
- package/dist/utils/capitalize.d.ts +12 -0
- package/dist/utils/polymorphic/index.d.ts +48 -0
- package/dist/utils/test-utils.d.ts +1 -3
- package/package.json +49 -24
- package/dist/click-ui.bundled.es.js.map +0 -1
- package/dist/click-ui.bundled.umd.js.map +0 -1
- package/dist/click-ui.es.js.map +0 -1
- package/dist/click-ui.umd.js.map +0 -1
- package/dist/components/ClickUIProvider/ClickUIProvider.d.ts +0 -15
- package/dist/components/Link/common.d.ts +0 -7
- package/dist/styles/variables.classic.json.d.ts +0 -993
- package/dist/theme/theme.d.ts +0 -7
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
|
|
6
|
+
const CONFIG_BODY = ` // Optional: Customize the storage key for theme persistence
|
|
7
|
+
// storageKey: 'click-ui-theme',
|
|
8
|
+
|
|
9
|
+
// Optional: Customize light mode theme
|
|
10
|
+
// theme: {
|
|
11
|
+
// global: {
|
|
12
|
+
// color: {
|
|
13
|
+
// brand: '#FFCC00',
|
|
14
|
+
// background: {
|
|
15
|
+
// default: '#FFFFFF'
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
18
|
+
// },
|
|
19
|
+
// button: {
|
|
20
|
+
// space: {
|
|
21
|
+
// x: '1rem',
|
|
22
|
+
// y: '0.5rem'
|
|
23
|
+
// },
|
|
24
|
+
// radii: {
|
|
25
|
+
// all: '0.375rem'
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
28
|
+
// },
|
|
29
|
+
|
|
30
|
+
// Optional: Dark mode overrides
|
|
31
|
+
// If not defined, theme values are used for dark mode too
|
|
32
|
+
// dark: {
|
|
33
|
+
// global: {
|
|
34
|
+
// color: {
|
|
35
|
+
// background: {
|
|
36
|
+
// default: '#0D1117'
|
|
37
|
+
// },
|
|
38
|
+
// text: {
|
|
39
|
+
// default: '#F0F6FC'
|
|
40
|
+
// }
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
43
|
+
// },
|
|
44
|
+
|
|
45
|
+
// Optional: Tooltip configuration
|
|
46
|
+
// tooltipConfig: {
|
|
47
|
+
// delayDuration: 100,
|
|
48
|
+
// skipDelayDuration: 300,
|
|
49
|
+
// disableHoverableContent: false,
|
|
50
|
+
// },
|
|
51
|
+
|
|
52
|
+
// Optional: Toast configuration
|
|
53
|
+
// toastConfig: {
|
|
54
|
+
// duration: 4000,
|
|
55
|
+
// swipeDirection: 'right',
|
|
56
|
+
// swipeThreshold: 50,
|
|
57
|
+
// },`;
|
|
58
|
+
|
|
59
|
+
const CONFIG_TEMPLATES = {
|
|
60
|
+
ts: `import type { ThemeConfig } from '@clickhouse/click-ui/theme';
|
|
61
|
+
|
|
62
|
+
const config: ThemeConfig = {
|
|
63
|
+
${CONFIG_BODY}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default config;
|
|
67
|
+
`,
|
|
68
|
+
js: `/** @type {import('@clickhouse/click-ui/theme').ThemeConfig} */
|
|
69
|
+
const config = {
|
|
70
|
+
${CONFIG_BODY}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default config;
|
|
74
|
+
`
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const initCommand = options => {
|
|
78
|
+
const format = options.format === "js" ? "js" : "ts";
|
|
79
|
+
const filename = `click-ui.config.${format}`;
|
|
80
|
+
const targetPath = path.join(process.cwd(), filename);
|
|
81
|
+
const configExt = format === "ts" ? "ts" : "js";
|
|
82
|
+
|
|
83
|
+
// Check if config already exists
|
|
84
|
+
if (fs.existsSync(targetPath) && !options.force) {
|
|
85
|
+
console.error(`❌ ${filename} already exists. Use --force to overwrite.`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Write config file
|
|
90
|
+
try {
|
|
91
|
+
fs.writeFileSync(targetPath, CONFIG_TEMPLATES[format], "utf-8");
|
|
92
|
+
console.log(`✅ Created ${filename}\n`);
|
|
93
|
+
console.log("📝 Next steps:\n");
|
|
94
|
+
console.log(` 1. Customize your theme in ${filename}\n`);
|
|
95
|
+
console.log(" 2. Generate your custom theme CSS:\n");
|
|
96
|
+
console.log(" npx click-ui generate\n");
|
|
97
|
+
console.log(" 3. Import the generated CSS in your app:\n");
|
|
98
|
+
console.log(" import '@clickhouse/click-ui/style.css';");
|
|
99
|
+
console.log(" import './public/cui-custom-theme.css'; // Your custom theme\n");
|
|
100
|
+
console.log(" 4. Use ClickUIProvider in your app:\n");
|
|
101
|
+
console.log(" import { ClickUIProvider } from '@clickhouse/click-ui';\n");
|
|
102
|
+
console.log(" <ClickUIProvider>");
|
|
103
|
+
console.log(" {/* Your app */}");
|
|
104
|
+
console.log(" </ClickUIProvider>\n");
|
|
105
|
+
console.log(" 🎨 Your custom theme will be applied!");
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error(`❌ Failed to create config file: ${error.message}`);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { pathToFileURL } from 'url';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Load Click UI configuration file
|
|
5
|
+
* Handles TypeScript, JavaScript, ESM, and CommonJS formats
|
|
6
|
+
*
|
|
7
|
+
* @param configFile - Full path to config file
|
|
8
|
+
* @returns Loaded configuration object
|
|
9
|
+
* @throws Error if config cannot be loaded or TypeScript file without tsx
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const config = await loadConfig('/path/to/click-ui.config.js');
|
|
14
|
+
* console.log('Theme:', config.theme);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export async function loadConfig(configFile: string): Promise<any> {
|
|
18
|
+
try {
|
|
19
|
+
// For ES modules (.js, .mjs, .ts)
|
|
20
|
+
if (configFile.endsWith('.js') || configFile.endsWith('.mjs') || configFile.endsWith('.ts')) {
|
|
21
|
+
// TypeScript files require tsx or ts-node
|
|
22
|
+
if (configFile.endsWith('.ts')) {
|
|
23
|
+
console.log('⚠️ TypeScript config files require tsx or ts-node to be installed');
|
|
24
|
+
console.log(' Run: npx tsx node_modules/@clickhouse/click-ui/bin/commands/generate.js');
|
|
25
|
+
console.log(' Or convert your config to .js format');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Convert to file URL for proper ESM import
|
|
30
|
+
const fileUrl = pathToFileURL(configFile).href;
|
|
31
|
+
const module = await import(fileUrl);
|
|
32
|
+
return module.default || module;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// For CommonJS (.cjs)
|
|
36
|
+
if (configFile.endsWith('.cjs')) {
|
|
37
|
+
return require(configFile);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
throw new Error(`Unsupported config file extension: ${configFile}`);
|
|
41
|
+
} catch (error: any) {
|
|
42
|
+
throw new Error(`Failed to load config from ${configFile}: ${error.message}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Validate that config has required theme properties
|
|
48
|
+
*
|
|
49
|
+
* @param config - Configuration object to validate
|
|
50
|
+
* @returns true if config has theme or dark properties
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* if (!validateConfig(config)) {
|
|
55
|
+
* console.error('Config missing theme configuration');
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export function validateConfig(config: any): boolean {
|
|
60
|
+
return !!(config && (config.theme || config.dark));
|
|
61
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CSS Generation for CLI
|
|
5
|
+
* Used by CLI generate and build-default-theme commands
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { generateLightDarkVariables, generateThemeOverrides } from '../../src/theme/utils/css-generator.js';
|
|
9
|
+
import { buildCSSOutput } from '../../src/theme/utils/css-builder.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generate CSS from theme config
|
|
13
|
+
* Used by CLI generate command
|
|
14
|
+
*/
|
|
15
|
+
export function generateThemeCSS(config) {
|
|
16
|
+
if (!config || (!config.theme && !config.dark)) {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Get light and dark themes
|
|
21
|
+
const lightTheme = config.theme || {};
|
|
22
|
+
const darkTheme = { ...config.theme, ...config.dark };
|
|
23
|
+
|
|
24
|
+
// Generate variables using light-dark() for colors
|
|
25
|
+
const lightDarkVars = generateLightDarkVariables(lightTheme, darkTheme);
|
|
26
|
+
const themeOverrides = generateThemeOverrides(lightTheme, darkTheme);
|
|
27
|
+
|
|
28
|
+
// Build CSS using shared builder
|
|
29
|
+
return buildCSSOutput(lightDarkVars, themeOverrides, {
|
|
30
|
+
headerComment: '/* Click UI Custom Theme */\n/* Generated by click-ui generate command */\n/* Uses light-dark() CSS function for automatic theme switching */\n'
|
|
31
|
+
});
|
|
32
|
+
}
|