@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.
Files changed (132) hide show
  1. package/README.md +161 -20
  2. package/bin/README.md +178 -0
  3. package/bin/click-ui.config.example.ts +70 -0
  4. package/bin/click-ui.js +97 -0
  5. package/bin/commands/build-default-theme.ts +48 -0
  6. package/bin/commands/generate.js +117 -0
  7. package/bin/commands/init.js +110 -0
  8. package/bin/utils/config-loader.ts +61 -0
  9. package/bin/utils/css-generator.js +32 -0
  10. package/dist/click-ui.bundled.es.js +40740 -48756
  11. package/dist/click-ui.bundled.umd.js +79 -53070
  12. package/dist/click-ui.es.js +40747 -47595
  13. package/dist/click-ui.umd.js +79 -51901
  14. package/dist/components/Accordion/Accordion.d.ts +3 -3
  15. package/dist/components/AutoComplete/AutoComplete.d.ts +0 -1
  16. package/dist/components/Avatar/Avatar.d.ts +1 -1
  17. package/dist/components/Badge/Badge.d.ts +1 -1
  18. package/dist/components/BigStat/BigStat.d.ts +1 -1
  19. package/dist/components/Button/Button.d.ts +1 -1
  20. package/dist/components/ButtonGroup/ButtonGroup.d.ts +1 -1
  21. package/dist/components/CardHorizontal/CardHorizontal.d.ts +5 -1
  22. package/dist/components/CardPrimary/CardPrimaryTopBadge.d.ts +14 -3
  23. package/dist/components/CardPromotion/CardPromotion.d.ts +1 -1
  24. package/dist/components/CardSecondary/CardSecondary.d.ts +1 -1
  25. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  26. package/dist/components/CodeBlock/CodeBlock.d.ts +1 -1
  27. package/dist/components/CodeBlock/useColorStyle.d.ts +1 -1
  28. package/dist/components/Collapsible/Collapsible.d.ts +3 -3
  29. package/dist/components/Container/Container.d.ts +5 -6
  30. package/dist/components/DatePicker/Common.d.ts +8 -3
  31. package/dist/components/Dialog/Dialog.d.ts +2 -2
  32. package/dist/components/EllipsisContent/EllipsisContent.d.ts +4 -6
  33. package/dist/components/FileTabs/FileTabs.d.ts +2 -2
  34. package/dist/components/Flyout/Flyout.d.ts +1 -1
  35. package/dist/components/GenericMenu.d.ts +22 -10
  36. package/dist/components/Grid/Cell.d.ts +2 -1
  37. package/dist/components/Grid/StyledCell.d.ts +5 -2
  38. package/dist/components/Grid/types.d.ts +1 -1
  39. package/dist/components/GridContainer/GridContainer.d.ts +4 -5
  40. package/dist/components/Icon/IconCommon.d.ts +4 -3
  41. package/dist/components/Icon/types.d.ts +3 -1
  42. package/dist/components/IconWrapper/IconWrapper.d.ts +2 -2
  43. package/dist/components/Input/InputWrapper.d.ts +25 -18
  44. package/dist/components/Link/Link.d.ts +4 -6
  45. package/dist/components/Link/linkStyles.d.ts +134 -0
  46. package/dist/components/Logos/AWSGlue.d.ts +4 -0
  47. package/dist/components/Logos/Logo.d.ts +1 -1
  48. package/dist/components/Logos/types.d.ts +1 -1
  49. package/dist/components/MultiAccordion/MultiAccordion.d.ts +1 -1
  50. package/dist/components/Panel/Panel.d.ts +1 -1
  51. package/dist/components/ProgressBar/ProgressBar.d.ts +1 -1
  52. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  53. package/dist/components/Select/common/SelectStyled.d.ts +24 -26
  54. package/dist/components/Separator/Separator.d.ts +4 -3
  55. package/dist/components/SidebarNavigationItem/SidebarNavigationItem.d.ts +5 -9
  56. package/dist/components/SidebarNavigationTitle/SidebarNavigationTitle.d.ts +5 -7
  57. package/dist/components/Spacer/Spacer.d.ts +2 -1
  58. package/dist/components/SplitButton/SplitButton.d.ts +1 -1
  59. package/dist/components/Tabs/Tabs.d.ts +26 -24
  60. package/dist/components/ThemeToggle/ThemeToggle.d.ts +4 -0
  61. package/dist/components/Typography/Text/Text.d.ts +4 -5
  62. package/dist/components/VerticalStepper/VerticalStepper.d.ts +2 -2
  63. package/dist/components/commonElement.d.ts +21 -17
  64. package/dist/components/commonTypes.d.ts +1 -1
  65. package/dist/components/icons/DataLakes.d.ts +4 -0
  66. package/dist/components/icons/HorizontalLoading.d.ts +3 -1
  67. package/dist/components/icons/Loading.d.ts +1 -1
  68. package/dist/components/icons/LoadingAnimated.d.ts +3 -1
  69. package/dist/components/index.d.ts +6 -3
  70. package/dist/components/types.d.ts +51 -83
  71. package/dist/config/tokens/types.d.ts +15296 -0
  72. package/dist/config/tokens/types.d.ts.map +1 -0
  73. package/dist/config/tokens/types.js +2 -0
  74. package/dist/config/tokens/types.js.map +1 -0
  75. package/dist/config/types.d.ts +55 -0
  76. package/dist/config/types.d.ts.map +1 -0
  77. package/dist/config/types.js +2 -0
  78. package/dist/config/types.js.map +1 -0
  79. package/dist/config/utils/css-builder.d.ts +38 -0
  80. package/dist/config/utils/css-builder.d.ts.map +1 -0
  81. package/dist/config/utils/css-builder.js +56 -0
  82. package/dist/config/utils/css-builder.js.map +1 -0
  83. package/dist/config/utils/css-generator.d.ts +25 -0
  84. package/dist/config/utils/css-generator.d.ts.map +1 -0
  85. package/dist/config/utils/css-generator.js +151 -0
  86. package/dist/config/utils/css-generator.js.map +1 -0
  87. package/dist/config/utils/find-config.d.ts +17 -0
  88. package/dist/config/utils/find-config.d.ts.map +1 -0
  89. package/dist/config/utils/find-config.js +28 -0
  90. package/dist/config/utils/find-config.js.map +1 -0
  91. package/dist/cui-components.css +1 -0
  92. package/dist/cui-default-theme.css +1809 -0
  93. package/dist/cui.css +3 -0
  94. package/dist/index.d.ts +77 -1
  95. package/dist/stories/ChartColorComponent.d.ts +1 -0
  96. package/dist/stories/chart-examples/ChartTooltip.d.ts +12 -0
  97. package/dist/stories/chart-examples/ColorSwatchesChart.d.ts +1 -0
  98. package/dist/stories/chart-examples/GroupedBarChart.d.ts +1 -0
  99. package/dist/stories/chart-examples/MultiLineChart.d.ts +1 -0
  100. package/dist/stories/chart-examples/StackedAreaChart.d.ts +1 -0
  101. package/dist/stories/chart-examples/StackedBarChartDemo.d.ts +1 -0
  102. package/dist/theme/ClickUIProvider/ClickUIProvider.d.ts +5 -0
  103. package/dist/theme/ClickUIProvider/ServerClickUIProvider.d.ts +23 -0
  104. package/dist/theme/ClickUIProvider/context.d.ts +24 -0
  105. package/dist/theme/ClickUIProvider/hooks.d.ts +4 -0
  106. package/dist/theme/ClickUIProvider/index.d.ts +6 -0
  107. package/dist/theme/ClickUIProvider/types.d.ts +39 -0
  108. package/dist/theme/config.d.ts +22 -0
  109. package/dist/theme/hooks/useSystemColorSchemePreference.d.ts +7 -0
  110. package/dist/theme/index.d.ts +6 -12
  111. package/dist/{styles → theme/tokens}/types.d.ts +13 -6
  112. package/dist/{styles → theme/tokens}/variables.dark.json.d.ts +118 -117
  113. package/dist/{styles → theme/tokens}/variables.json.d.ts +20 -13
  114. package/dist/{styles → theme/tokens}/variables.light.json.d.ts +146 -145
  115. package/dist/theme/types.d.ts +54 -0
  116. package/dist/theme/utils/css-builder.d.ts +37 -0
  117. package/dist/theme/utils/css-generator.d.ts +25 -0
  118. package/dist/theme/utils/find-config.d.ts +16 -0
  119. package/dist/theme/utils/theme-attribute.d.ts +13 -0
  120. package/dist/theme/utils.d.ts +29 -0
  121. package/dist/utils/capitalize.d.ts +12 -0
  122. package/dist/utils/polymorphic/index.d.ts +48 -0
  123. package/dist/utils/test-utils.d.ts +1 -3
  124. package/package.json +49 -24
  125. package/dist/click-ui.bundled.es.js.map +0 -1
  126. package/dist/click-ui.bundled.umd.js.map +0 -1
  127. package/dist/click-ui.es.js.map +0 -1
  128. package/dist/click-ui.umd.js.map +0 -1
  129. package/dist/components/ClickUIProvider/ClickUIProvider.d.ts +0 -15
  130. package/dist/components/Link/common.d.ts +0 -7
  131. package/dist/styles/variables.classic.json.d.ts +0 -993
  132. 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
+ }