@clickhouse/click-ui 0.2.0-rc.5 → 0.2.0-rc.7

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 (77) hide show
  1. package/README.md +67 -0
  2. package/dist/cjs/click-ui.css +3861 -0
  3. package/dist/cjs/components/Button/Button.css +261 -0
  4. package/dist/cjs/components/Button/Button.module.css.cjs +38 -0
  5. package/dist/cjs/components/Button/Button.module.css.cjs.map +1 -0
  6. package/dist/cjs/components/Button/index.cjs +42 -126
  7. package/dist/cjs/components/Button/index.cjs.map +1 -1
  8. package/dist/cjs/components/ButtonGroup/index.cjs +1 -1
  9. package/dist/cjs/components/ButtonGroup/index.cjs.map +1 -1
  10. package/dist/cjs/components/DatePicker/Common.cjs +21 -25
  11. package/dist/cjs/components/DatePicker/Common.cjs.map +1 -1
  12. package/dist/cjs/components/DatePicker/DateTimeRangePicker.cjs +23 -15
  13. package/dist/cjs/components/DatePicker/DateTimeRangePicker.cjs.map +1 -1
  14. package/dist/cjs/components/DatePicker/index.cjs +6 -2
  15. package/dist/cjs/components/DatePicker/index.cjs.map +1 -1
  16. package/dist/cjs/components/DatePicker/utils.cjs.map +1 -1
  17. package/dist/cjs/components/GenericMenu/index.cjs +1 -1
  18. package/dist/cjs/components/GenericMenu/index.cjs.map +1 -1
  19. package/dist/cjs/lib/cva.cjs +15 -0
  20. package/dist/cjs/lib/cva.cjs.map +1 -0
  21. package/dist/cjs/providers/ThemeProvider.cjs +4 -0
  22. package/dist/cjs/providers/ThemeProvider.cjs.map +1 -1
  23. package/dist/cjs/theme/styles/tokens-dark.css +1806 -0
  24. package/dist/cjs/theme/styles/tokens-light.css +1795 -0
  25. package/dist/cjs/theme/theme.config.json.cjs +12 -0
  26. package/dist/cjs/theme/theme.config.json.cjs.map +1 -0
  27. package/dist/cjs/theme/tokens/variables.dark.cjs +2 -4
  28. package/dist/cjs/theme/tokens/variables.dark.cjs.map +1 -1
  29. package/dist/cjs/theme/tokens/variables.light.cjs +1 -6
  30. package/dist/cjs/theme/tokens/variables.light.cjs.map +1 -1
  31. package/dist/cjs/utils/localStorage.cjs +3 -1
  32. package/dist/cjs/utils/localStorage.cjs.map +1 -1
  33. package/dist/esm/click-ui.css +3861 -0
  34. package/dist/esm/components/Button/Button.css +261 -0
  35. package/dist/esm/components/Button/Button.module.css.js +25 -0
  36. package/dist/esm/components/Button/Button.module.css.js.map +1 -0
  37. package/dist/esm/components/Button/index.js +42 -126
  38. package/dist/esm/components/Button/index.js.map +1 -1
  39. package/dist/esm/components/ButtonGroup/index.js +1 -1
  40. package/dist/esm/components/ButtonGroup/index.js.map +1 -1
  41. package/dist/esm/components/DatePicker/Common.js +21 -25
  42. package/dist/esm/components/DatePicker/Common.js.map +1 -1
  43. package/dist/esm/components/DatePicker/DateTimeRangePicker.js +23 -15
  44. package/dist/esm/components/DatePicker/DateTimeRangePicker.js.map +1 -1
  45. package/dist/esm/components/DatePicker/index.js +6 -2
  46. package/dist/esm/components/DatePicker/index.js.map +1 -1
  47. package/dist/esm/components/DatePicker/utils.js.map +1 -1
  48. package/dist/esm/components/GenericMenu/index.js +1 -1
  49. package/dist/esm/components/GenericMenu/index.js.map +1 -1
  50. package/dist/esm/lib/cva.js +7 -0
  51. package/dist/esm/lib/cva.js.map +1 -0
  52. package/dist/esm/providers/ThemeProvider.js +4 -0
  53. package/dist/esm/providers/ThemeProvider.js.map +1 -1
  54. package/dist/esm/theme/styles/tokens-dark.css +1806 -0
  55. package/dist/esm/theme/styles/tokens-light.css +1795 -0
  56. package/dist/esm/theme/theme.config.json.js +7 -0
  57. package/dist/esm/theme/theme.config.json.js.map +1 -0
  58. package/dist/esm/theme/tokens/variables.dark.js +2 -4
  59. package/dist/esm/theme/tokens/variables.dark.js.map +1 -1
  60. package/dist/esm/theme/tokens/variables.light.js +1 -6
  61. package/dist/esm/theme/tokens/variables.light.js.map +1 -1
  62. package/dist/esm/utils/localStorage.js +3 -1
  63. package/dist/esm/utils/localStorage.js.map +1 -1
  64. package/dist/types/components/Button/Button.d.ts +25 -2
  65. package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
  66. package/dist/types/components/DatePicker/DatePicker.types.d.ts +1 -0
  67. package/dist/types/components/DatePicker/DateTimeRangePicker.d.ts +5 -2
  68. package/dist/types/components/DatePicker/index.d.ts +1 -1
  69. package/dist/types/components/DatePicker/utils.d.ts +1 -0
  70. package/dist/types/lib/cva.d.ts +3 -0
  71. package/dist/types/theme/theme.config.json.d.ts +6 -0
  72. package/dist/types/theme/theme.core.d.ts +0 -7
  73. package/dist/types/theme/tokens/variables.dark.d.ts +0 -2
  74. package/dist/types/theme/tokens/variables.light.d.ts +0 -5
  75. package/dist/types/utils/dom.d.ts +1 -1
  76. package/dist/types/utils/localStorage.d.ts +1 -1
  77. package/package.json +25 -8
@@ -1,4 +1,6 @@
1
- const CUI_THEME_STORAGE_KEY = "cui-theme";
1
+ import config from '../theme/theme.config.json.js';
2
+
3
+ const CUI_THEME_STORAGE_KEY = config.storageKey;
2
4
 
3
5
  export { CUI_THEME_STORAGE_KEY };
4
6
  //# sourceMappingURL=localStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"localStorage.js","sources":["../../../src/utils/localStorage.ts"],"sourcesContent":["export const CUI_THEME_STORAGE_KEY = 'cui-theme';\n"],"names":["CUI_THEME_STORAGE_KEY"],"mappings":"AAAO,MAAMA,qBAAAA,GAAwB;;;;"}
1
+ {"version":3,"file":"localStorage.js","sources":["../../../src/utils/localStorage.ts"],"sourcesContent":["// WARN: The storage key is shared with .scripts/js/generate-token\n// which is a nodejs script. At the moment opted for json instead\n// of adding support for `js` files, but json means importing the\n// whole file (the file shouldn't grow, so should be alright?)\nimport config from '@/theme/theme.config.json' with { type: 'json' };\n\nexport const CUI_THEME_STORAGE_KEY = config.storageKey;\n"],"names":["CUI_THEME_STORAGE_KEY","config","storageKey"],"mappings":";;AAMO,MAAMA,wBAAwBC,MAAAA,CAAOC;;;;"}
@@ -1,2 +1,25 @@
1
- import { ButtonProps } from './Button.types';
2
- export declare const Button: ({ type, iconLeft, iconRight, align, children, fillWidth, label, loading, disabled, ...delegated }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { IconName } from '../Icon';
2
+ export type ButtonType = 'primary' | 'secondary' | 'empty' | 'danger';
3
+ type Alignment = 'center' | 'left';
4
+ export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
5
+ /** The visual style variant of the button */
6
+ type?: ButtonType;
7
+ /** Whether the button is disabled */
8
+ disabled?: boolean;
9
+ /** The text label to display in the button */
10
+ label?: string;
11
+ /** Icon to display on the left side of the label */
12
+ iconLeft?: IconName;
13
+ /** Icon to display on the right side of the label */
14
+ iconRight?: IconName;
15
+ /** Alignment of the button content */
16
+ align?: Alignment;
17
+ /** Whether the button should fill the full width of its container */
18
+ fillWidth?: boolean;
19
+ /** Whether to show a loading state */
20
+ loading?: boolean;
21
+ /** Whether the button should be focused on mount */
22
+ autoFocus?: boolean;
23
+ }
24
+ export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
25
+ export {};
@@ -1,2 +1,2 @@
1
1
  import { DatePickerProps } from './DatePicker.types';
2
- export declare const DatePicker: ({ date, disabled, futureDatesDisabled, onSelectDate, placeholder, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DatePicker: ({ allowOnlyDatesList, date, disabled, futureDatesDisabled, onSelectDate, placeholder, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  export interface DatePickerProps {
2
+ allowOnlyDatesList?: Array<Date>;
2
3
  date?: Date;
3
4
  disabled?: boolean;
4
5
  futureDatesDisabled?: boolean;
@@ -1,8 +1,11 @@
1
1
  import { DateRangeListItem } from './utils';
2
2
  type OpenDirection = 'left' | 'right';
3
+ export type Tab = 'startDate' | 'endDate';
3
4
  export interface DateTimeRangePickerProps {
4
- endDate?: Date;
5
+ closeOnDateRangeSelected?: boolean;
6
+ defaultActiveTab?: Tab;
5
7
  disabled?: boolean;
8
+ endDate?: Date;
6
9
  futureDatesDisabled?: boolean;
7
10
  futureStartDatesDisabled?: boolean;
8
11
  onSelectDateRange: (selectedStartDate: Date, selectedEndDate: Date) => void;
@@ -13,5 +16,5 @@ export interface DateTimeRangePickerProps {
13
16
  shouldShowSeconds?: boolean;
14
17
  startDate?: Date;
15
18
  }
16
- export declare const DateTimeRangePicker: ({ endDate, startDate, disabled, futureDatesDisabled, futureStartDatesDisabled, maxRangeLength, onSelectDateRange, openDirection, placeholder, predefinedTimesList, shouldShowSeconds, }: DateTimeRangePickerProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const DateTimeRangePicker: ({ closeOnDateRangeSelected, defaultActiveTab, disabled, endDate, futureDatesDisabled, futureStartDatesDisabled, maxRangeLength, onSelectDateRange, openDirection, placeholder, predefinedTimesList, shouldShowSeconds, startDate, }: DateTimeRangePickerProps) => import("react/jsx-runtime").JSX.Element;
17
20
  export {};
@@ -3,4 +3,4 @@ export { DateRangePicker } from './DateRangePicker';
3
3
  export { DateTimeRangePicker } from './DateTimeRangePicker';
4
4
  export type { DatePickerProps } from './DatePicker.types';
5
5
  export type { DateRangePickerProps } from './DateRangePicker';
6
- export type { DateTimeRangePickerProps } from './DateTimeRangePicker';
6
+ export type { DateTimeRangePickerProps, Tab } from './DateTimeRangePicker';
@@ -20,5 +20,6 @@ export declare const timeFormatter: Intl.DateTimeFormat;
20
20
  export declare const headerDateFormatter: Intl.DateTimeFormat;
21
21
  export declare const getPredefinedMonthsForDateRangePicker: (numberOfMonths: number) => DateRange[];
22
22
  export declare const getPredefinedTimePeriodsForDateTimePicker: () => DateRangeListItem[];
23
+ export declare const getNextNDatesForDatePickerAllowOnlyList: (numberOfDays: number) => Date[];
23
24
  export declare const datesAreWithinMaxRange: (startDate: Date, endDate: Date, maxRangeLength: number) => boolean;
24
25
  export declare const isDateRangeTheWholeMonth: ({ startDate, endDate }: DateRange) => boolean;
@@ -0,0 +1,3 @@
1
+ import { ClassValue } from 'clsx';
2
+ export { cva, type VariantProps } from 'class-variance-authority';
3
+ export declare const cn: (...inputs: ClassValue[]) => string;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "storageKey": "cui-theme"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -1907,7 +1907,6 @@ export declare const themes: {
1907
1907
  };
1908
1908
  stroke: {
1909
1909
  default: string;
1910
- focus: string;
1911
1910
  };
1912
1911
  };
1913
1912
  format: {
@@ -1938,7 +1937,6 @@ export declare const themes: {
1938
1937
  };
1939
1938
  stroke: {
1940
1939
  default: string;
1941
- focus: string;
1942
1940
  };
1943
1941
  };
1944
1942
  };
@@ -5709,7 +5707,6 @@ export declare const themes: {
5709
5707
  };
5710
5708
  stroke: {
5711
5709
  default: string;
5712
- focus: string;
5713
5710
  };
5714
5711
  };
5715
5712
  format: {
@@ -5737,10 +5734,6 @@ export declare const themes: {
5737
5734
  active: string;
5738
5735
  disabled: string;
5739
5736
  };
5740
- stroke: {
5741
- default: string;
5742
- focus: string;
5743
- };
5744
5737
  };
5745
5738
  };
5746
5739
  };
@@ -1904,7 +1904,6 @@ declare const theme: {
1904
1904
  };
1905
1905
  stroke: {
1906
1906
  default: string;
1907
- focus: string;
1908
1907
  };
1909
1908
  };
1910
1909
  format: {
@@ -1935,7 +1934,6 @@ declare const theme: {
1935
1934
  };
1936
1935
  stroke: {
1937
1936
  default: string;
1938
- focus: string;
1939
1937
  };
1940
1938
  };
1941
1939
  };
@@ -1889,7 +1889,6 @@ declare const theme: {
1889
1889
  };
1890
1890
  stroke: {
1891
1891
  default: string;
1892
- focus: string;
1893
1892
  };
1894
1893
  };
1895
1894
  format: {
@@ -1917,10 +1916,6 @@ declare const theme: {
1917
1916
  active: string;
1918
1917
  disabled: string;
1919
1918
  };
1920
- stroke: {
1921
- default: string;
1922
- focus: string;
1923
- };
1924
1919
  };
1925
1920
  };
1926
1921
  };
@@ -1,5 +1,5 @@
1
1
  import { ThemeName } from '../theme/theme.types';
2
- export declare const THEME_ATTRIBUTE = "data-cui-theme";
2
+ export declare const THEME_ATTRIBUTE: string;
3
3
  export declare const getRootElement: () => HTMLElement | undefined;
4
4
  export declare const setRootThemeAttribute: (theme: ThemeName) => void;
5
5
  export declare const removeRootThemeAttribute: () => void;
@@ -1 +1 @@
1
- export declare const CUI_THEME_STORAGE_KEY = "cui-theme";
1
+ export declare const CUI_THEME_STORAGE_KEY: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.2.0-rc.5",
3
+ "version": "v0.2.0-rc.7",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -10,7 +10,9 @@
10
10
  "main": "./dist/cjs/index.cjs",
11
11
  "module": "./dist/esm/index.js",
12
12
  "types": "./dist/types/index.d.ts",
13
- "sideEffects": false,
13
+ "sideEffects": [
14
+ "**/*.css"
15
+ ],
14
16
  "exports": {
15
17
  ".": {
16
18
  "types": "./dist/types/index.d.ts",
@@ -375,8 +377,12 @@
375
377
  "format:fix": ".scripts/bash/format --write",
376
378
  "generate:exports": ".scripts/js/generate-exports",
377
379
  "generate:tokens": "node ./.scripts/js/generate-tokens.js && yarn format:fix src/theme/tokens/**/*.ts",
378
- "lint": "eslint src --report-unused-disable-directives",
379
- "lint:fix": "eslint src --report-unused-disable-directives --fix",
380
+ "lint": "yarn lint:code && yarn lint:css",
381
+ "lint:fix": "yarn lint:code:fix && yarn lint:css:fix",
382
+ "lint:code": "eslint src --report-unused-disable-directives",
383
+ "lint:code:fix": "eslint src --report-unused-disable-directives --fix",
384
+ "lint:css": "stylelint \"src/**/*.css\"",
385
+ "lint:css:fix": "stylelint \"src/**/*.css\" --fix",
380
386
  "prepare": "husky",
381
387
  "prettify": "yarn format:fix",
382
388
  "preview": "vite preview",
@@ -385,10 +391,10 @@
385
391
  "storybook:serve": "yarn dlx http-server .storybook/out",
386
392
  "test": "vitest",
387
393
  "test:chromatic": "yarn dlx chromatic",
388
- "test:visual": "playwright test",
389
- "test:visual:report": "playwright show-report",
390
- "test:visual:ui": "playwright test --ui",
391
- "test:visual:update": "playwright test --update-snapshots",
394
+ "test:visual": ".scripts/bash/playwright-docker",
395
+ "test:visual:report": ".scripts/bash/playwright-docker report",
396
+ "test:visual:ui": ".scripts/bash/playwright-docker ui",
397
+ "test:visual:update": ".scripts/bash/playwright-docker update",
392
398
  "test:watch": "DEBUG_PRINT_LIMIT=100000 vitest --watch",
393
399
  "typecheck": "tsc --noEmit"
394
400
  },
@@ -410,6 +416,8 @@
410
416
  "@radix-ui/react-tabs": "1.1.1",
411
417
  "@radix-ui/react-toast": "1.2.2",
412
418
  "@radix-ui/react-tooltip": "1.1.2",
419
+ "class-variance-authority": "^0.7.1",
420
+ "clsx": "^2.1.1",
413
421
  "dayjs": "^1.11.19",
414
422
  "lodash-es": "^4.17.23",
415
423
  "react-sortablejs": "^6.1.4",
@@ -433,6 +441,7 @@
433
441
  "@testing-library/user-event": "^14.5.2",
434
442
  "@tokens-studio/sd-transforms": "^1.2.0",
435
443
  "@types/eslint-plugin-react-refresh": "^0.4.0",
444
+ "@types/fs-extra": "^11.0.4",
436
445
  "@types/lodash-es": "^4.17.12",
437
446
  "@types/node": "^24.10.1",
438
447
  "@types/react": "18.3.1",
@@ -451,9 +460,13 @@
451
460
  "eslint-plugin-react-hooks": "^5",
452
461
  "eslint-plugin-react-refresh": "0.4.7",
453
462
  "eslint-plugin-storybook": "^10.1.10",
463
+ "fs-extra": "^11.3.4",
464
+ "glob": "^13.0.6",
454
465
  "globals": "^16.5.0",
455
466
  "husky": "^9.1.7",
456
467
  "jsdom": "^24.0.0",
468
+ "postcss": "^8.5.8",
469
+ "postcss-modules": "^6.0.1",
457
470
  "prettier": "3.7.4",
458
471
  "prop-types": "^15.8.1",
459
472
  "react": "18.3.1",
@@ -463,6 +476,10 @@
463
476
  "storybook": "^10.1.10",
464
477
  "storybook-addon-pseudo-states": "^10.1.10",
465
478
  "style-dictionary": "^5.0.0",
479
+ "stylelint": "^17.5.0",
480
+ "stylelint-config-standard": "^40.0.0",
481
+ "stylelint-no-unsupported-browser-features": "^8.1.1",
482
+ "stylelint-order": "^8.1.1",
466
483
  "stylis": "^4.3.0",
467
484
  "ts-node": "^10.9.1",
468
485
  "typescript": "^5.5.3",