@clickhouse/click-ui 0.0.0
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/.eslintrc.cjs +32 -0
- package/.github/workflows/deployment.yml +34 -0
- package/.storybook/main.ts +18 -0
- package/.storybook/preview-head.html +4 -0
- package/.storybook/preview.tsx +67 -0
- package/README.md +11 -0
- package/app/.babelrc +27 -0
- package/app/.eslintrc.json +6 -0
- package/app/.storybook/main.ts +17 -0
- package/app/.storybook/preview.tsx +26 -0
- package/app/README.md +38 -0
- package/app/next.config.js +6 -0
- package/app/package-lock.json +28711 -0
- package/app/package.json +44 -0
- package/app/public/favicon.ico +0 -0
- package/app/public/next.svg +1 -0
- package/app/public/vercel.svg +1 -0
- package/app/src/assets/RightArrow/right-arrow.tsx +17 -0
- package/app/src/assets/S3Logo/s3-logo.tsx +31 -0
- package/app/src/assets/amazon_s3.svg +9 -0
- package/app/src/assets/arrow.svg +3 -0
- package/app/src/globals.d.ts +4 -0
- package/app/src/pages/_app.tsx +8 -0
- package/app/src/pages/_document.tsx +17 -0
- package/app/src/pages/api/hello.ts +13 -0
- package/app/src/pages/index.tsx +141 -0
- package/app/src/pages/label.tsx +27 -0
- package/app/src/stories/assets/code-brackets.svg +1 -0
- package/app/src/stories/assets/colors.svg +1 -0
- package/app/src/stories/assets/comments.svg +1 -0
- package/app/src/stories/assets/direction.svg +1 -0
- package/app/src/stories/assets/flow.svg +1 -0
- package/app/src/stories/assets/plugin.svg +1 -0
- package/app/src/stories/assets/repo.svg +1 -0
- package/app/src/stories/assets/stackalt.svg +1 -0
- package/app/src/styles/Home.module.css +235 -0
- package/app/src/styles/globals.css +111 -0
- package/app/src/styles/types.ts +1031 -0
- package/app/src/styles/variables.classic.css +16 -0
- package/app/src/styles/variables.classic.json +31 -0
- package/app/src/styles/variables.css +763 -0
- package/app/src/styles/variables.dark.css +135 -0
- package/app/src/styles/variables.dark.json +339 -0
- package/app/src/styles/variables.json +1029 -0
- package/app/src/styles/variables.light.css +203 -0
- package/app/src/styles/variables.light.json +478 -0
- package/app/tokens/themes/$metadata.json +9 -0
- package/app/tokens/themes/$themes.json +1 -0
- package/app/tokens/themes/classic.json +58 -0
- package/app/tokens/themes/component.json +868 -0
- package/app/tokens/themes/dark.json +937 -0
- package/app/tokens/themes/light.json +1380 -0
- package/app/tokens/themes/primitives.json +859 -0
- package/app/tsconfig.json +23 -0
- package/build-tokens.js +131 -0
- package/index.html +17 -0
- package/jest.config.ts +11 -0
- package/package.json +77 -0
- package/public/vite.svg +1 -0
- package/src/App.css +1 -0
- package/src/App.module.css +235 -0
- package/src/App.tsx +154 -0
- package/src/assets/RightArrow/RightArrow.tsx +17 -0
- package/src/assets/S3Logo/S3Logo.tsx +31 -0
- package/src/assets/react.svg +1 -0
- package/src/components/Accordion/Accordion.stories.tsx +78 -0
- package/src/components/Accordion/Accordion.test.tsx +46 -0
- package/src/components/Accordion/Accordion.tsx +118 -0
- package/src/components/Badge/Badge.stories.ts +14 -0
- package/src/components/Badge/Badge.test.tsx +11 -0
- package/src/components/Badge/Badge.tsx +24 -0
- package/src/components/BigStat/BigStat.stories.ts +15 -0
- package/src/components/BigStat/BigStat.tsx +37 -0
- package/src/components/Button/Button.stories.ts +82 -0
- package/src/components/Button/Button.test.tsx +32 -0
- package/src/components/Button/Button.tsx +97 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.ts +14 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +78 -0
- package/src/components/Card/Card.stories.ts +19 -0
- package/src/components/Card/Card.tsx +107 -0
- package/src/components/FormField/FormField.stories.ts +14 -0
- package/src/components/FormField/FormField.tsx +22 -0
- package/src/components/Icon/Icon.stories.ts +46 -0
- package/src/components/Icon/Icon.tsx +90 -0
- package/src/components/Icon/types.ts +18 -0
- package/src/components/IconButton/IconButton.stories.ts +16 -0
- package/src/components/IconButton/IconButton.tsx +94 -0
- package/src/components/SidebarNavigationItem/SidebarNavigationItem.stories.tsx +28 -0
- package/src/components/SidebarNavigationItem/SidebarNavigationItem.tsx +112 -0
- package/src/components/Switch/Switch.stories.ts +14 -0
- package/src/components/Switch/Switch.tsx +106 -0
- package/src/components/Tabs/Tabs.stories.tsx +71 -0
- package/src/components/Tabs/Tabs.test.tsx +86 -0
- package/src/components/Tabs/Tabs.tsx +82 -0
- package/src/components/icons/ChatIcon.tsx +22 -0
- package/src/components/icons/ChevronDown.tsx +6 -0
- package/src/components/icons/ChevronRight.tsx +20 -0
- package/src/components/icons/DatabaseIcon.tsx +33 -0
- package/src/components/icons/FilterIcon.tsx +24 -0
- package/src/components/icons/Flags/EuropeanUnion.tsx +174 -0
- package/src/components/icons/Flags/Germany.tsx +25 -0
- package/src/components/icons/Flags/India.tsx +48 -0
- package/src/components/icons/Flags/Ireland.tsx +32 -0
- package/src/components/icons/Flags/Netherlands.tsx +29 -0
- package/src/components/icons/Flags/Singapore.tsx +43 -0
- package/src/components/icons/Flags/UnitedKingdom.tsx +32 -0
- package/src/components/icons/Flags/UnitedStates.tsx +26 -0
- package/src/components/icons/Flags/index.tsx +46 -0
- package/src/components/icons/HistoryIcon.tsx +28 -0
- package/src/components/icons/Icons.mdx +36 -0
- package/src/components/icons/InsertRowIcon.tsx +36 -0
- package/src/components/icons/SortAltIcon.tsx +24 -0
- package/src/components/icons/UserIcon.tsx +17 -0
- package/src/components/icons/UsersIcon.tsx +43 -0
- package/src/components/index.ts +14 -0
- package/src/components/types.ts +1 -0
- package/src/index.css +9 -0
- package/src/index.ts +2 -0
- package/src/main.tsx +11 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/styles/Home.module.css +235 -0
- package/src/styles/globals.css +111 -0
- package/src/styles/types.ts +1669 -0
- package/src/styles/variables.classic.css +16 -0
- package/src/styles/variables.classic.json +31 -0
- package/src/styles/variables.css +763 -0
- package/src/styles/variables.dark.css +135 -0
- package/src/styles/variables.dark.json +576 -0
- package/src/styles/variables.json +1667 -0
- package/src/styles/variables.light.css +203 -0
- package/src/styles/variables.light.json +789 -0
- package/src/theme/index.ts +22 -0
- package/src/theme/theme.tsx +28 -0
- package/src/vite-env.d.ts +1 -0
- package/tokens/themes/$metadata.json +9 -0
- package/tokens/themes/$themes.json +1 -0
- package/tokens/themes/classic.json +58 -0
- package/tokens/themes/component.json +1567 -0
- package/tokens/themes/dark.json +1450 -0
- package/tokens/themes/light.json +2059 -0
- package/tokens/themes/primitives.json +863 -0
- package/tsconfig.json +27 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +38 -0
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2020: true,
|
|
5
|
+
},
|
|
6
|
+
extends: [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended",
|
|
9
|
+
"plugin:react-hooks/recommended",
|
|
10
|
+
"plugin:storybook/recommended",
|
|
11
|
+
],
|
|
12
|
+
parser: "@typescript-eslint/parser",
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: "latest",
|
|
15
|
+
sourceType: "module",
|
|
16
|
+
},
|
|
17
|
+
plugins: ["react-refresh", "prefer-arrow-functions"],
|
|
18
|
+
rules: {
|
|
19
|
+
"react-refresh/only-export-components": "warn",
|
|
20
|
+
"no-multiple-empty-lines": "error",
|
|
21
|
+
quotes: ["error", "double"],
|
|
22
|
+
"prefer-arrow-functions/prefer-arrow-functions": [
|
|
23
|
+
"warn",
|
|
24
|
+
{
|
|
25
|
+
classPropertiesAllowed: false,
|
|
26
|
+
disallowPrototype: false,
|
|
27
|
+
returnStyle: "unchanged",
|
|
28
|
+
singleReturnOnly: false,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Workflow name
|
|
2
|
+
name: "deployment"
|
|
3
|
+
|
|
4
|
+
# Event for the workflow
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
# List of jobs
|
|
10
|
+
jobs:
|
|
11
|
+
unit-tests:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- name: Install dependencies
|
|
16
|
+
run: npm install
|
|
17
|
+
- name: unit tests
|
|
18
|
+
run: npm run test
|
|
19
|
+
|
|
20
|
+
chromatic-deployment:
|
|
21
|
+
# Operating System
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
# Job steps
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v1
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm install
|
|
28
|
+
# 👇 Adds Chromatic as a step in the workflow
|
|
29
|
+
- name: Publish to Chromatic
|
|
30
|
+
uses: chromaui/action@v1
|
|
31
|
+
# Chromatic GitHub Action options
|
|
32
|
+
with:
|
|
33
|
+
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
|
|
34
|
+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
+
const config: StorybookConfig = {
|
|
3
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
4
|
+
addons: [
|
|
5
|
+
"@storybook/addon-links",
|
|
6
|
+
"@storybook/addon-essentials",
|
|
7
|
+
"@storybook/addon-interactions",
|
|
8
|
+
"storybook-addon-pseudo-states",
|
|
9
|
+
],
|
|
10
|
+
framework: {
|
|
11
|
+
name: "@storybook/react-vite",
|
|
12
|
+
options: {},
|
|
13
|
+
},
|
|
14
|
+
docs: {
|
|
15
|
+
autodocs: "tag",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default config;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Preview } from "@storybook/react";
|
|
3
|
+
import "../src/styles/variables.css";
|
|
4
|
+
import { Decorator } from "@storybook/react";
|
|
5
|
+
import { ThemeProvider } from "../src/theme";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
|
|
8
|
+
const ThemeBlock = styled.div<{ left?: boolean; bfill?: boolean }>(
|
|
9
|
+
({ left, bfill: fill, theme }) => `
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: ${left || fill ? 0 : "50vw"};
|
|
13
|
+
border-right: ${left ? "1px solid #202020" : "none"};
|
|
14
|
+
right: ${left ? "50vw" : 0};
|
|
15
|
+
width: ${fill ? "100vw" : "50vw"};
|
|
16
|
+
height: 100vh;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
overflow: auto;
|
|
19
|
+
padding: 1rem;
|
|
20
|
+
background: ${theme.click.global.color.background.default};
|
|
21
|
+
`
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const globalTypes = {
|
|
25
|
+
theme: {
|
|
26
|
+
name: "Theme",
|
|
27
|
+
description: "Global theme for components",
|
|
28
|
+
defaultValue: "dark",
|
|
29
|
+
toolbar: {
|
|
30
|
+
// The icon for the toolbar item
|
|
31
|
+
icon: "circlehollow",
|
|
32
|
+
// Array of options
|
|
33
|
+
items: [
|
|
34
|
+
{ value: "light", icon: "circlehollow", title: "light" },
|
|
35
|
+
{ value: "dark", icon: "circle", title: "dark" },
|
|
36
|
+
],
|
|
37
|
+
// Property that specifies if the name of the item will be displayed
|
|
38
|
+
showName: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const withTheme: Decorator = (StoryFn, context) => {
|
|
43
|
+
const parameters = context.parameters;
|
|
44
|
+
const theme = parameters?.theme || context.globals.theme;
|
|
45
|
+
return (
|
|
46
|
+
<ThemeProvider theme={theme}>
|
|
47
|
+
<ThemeBlock bfill>
|
|
48
|
+
<StoryFn />
|
|
49
|
+
</ThemeBlock>
|
|
50
|
+
</ThemeProvider>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const preview: Preview = {
|
|
55
|
+
parameters: {
|
|
56
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
57
|
+
controls: {
|
|
58
|
+
matchers: {
|
|
59
|
+
color: /(background|color)$/i,
|
|
60
|
+
date: /Date$/,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const decorators = [withTheme];
|
|
67
|
+
export default preview;
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Click UI
|
|
2
|
+
The home of the ClickHouse design system and component library. Click UI is in very early development and subject to change, we do not recommend using it for production purposes.
|
|
3
|
+
|
|
4
|
+
## Get started 🚀
|
|
5
|
+
1. Clone this repo, cd into the `click-ui` directory
|
|
6
|
+
2. To install dependencies, run `yarn`
|
|
7
|
+
3. To build the latest styles, run `yarn generate-tokens`
|
|
8
|
+
4. To run ClickUI locally, run `yarn dev` and navigate to https://localhost:5173
|
|
9
|
+
5. To run Storybook locally, run `yarn storybook` and navigate to https://localhost:6006
|
|
10
|
+
|
|
11
|
+
Enjoy!
|
package/app/.babelrc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"presets": ["next/babel"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
"@babel/plugin-transform-typescript",
|
|
5
|
+
[
|
|
6
|
+
"babel-plugin-styled-components",
|
|
7
|
+
{
|
|
8
|
+
"fileName": false
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
],
|
|
12
|
+
"env": {
|
|
13
|
+
"development": {
|
|
14
|
+
"plugins": [["babel-plugin-styled-components", { "displayName": true }]]
|
|
15
|
+
},
|
|
16
|
+
"test": {
|
|
17
|
+
"plugins": [
|
|
18
|
+
[
|
|
19
|
+
"babel-plugin-transform-import-ignore",
|
|
20
|
+
{
|
|
21
|
+
"patterns": [".css"]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/nextjs";
|
|
2
|
+
const config: StorybookConfig = {
|
|
3
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
4
|
+
addons: [
|
|
5
|
+
"@storybook/addon-links",
|
|
6
|
+
"@storybook/addon-essentials",
|
|
7
|
+
"@storybook/addon-interactions",
|
|
8
|
+
],
|
|
9
|
+
framework: {
|
|
10
|
+
name: "@storybook/nextjs",
|
|
11
|
+
options: {},
|
|
12
|
+
},
|
|
13
|
+
docs: {
|
|
14
|
+
autodocs: "tag",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default config;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Preview } from "@storybook/react";
|
|
3
|
+
import "../src/styles/variables.css";
|
|
4
|
+
import { Decorator } from "@storybook/react";
|
|
5
|
+
import { ThemeProvider } from "../../src/theme";
|
|
6
|
+
|
|
7
|
+
const withTheme: Decorator = StoryFn => (
|
|
8
|
+
<ThemeProvider theme="dark">
|
|
9
|
+
<StoryFn />
|
|
10
|
+
</ThemeProvider>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const preview: Preview = {
|
|
14
|
+
parameters: {
|
|
15
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
16
|
+
controls: {
|
|
17
|
+
matchers: {
|
|
18
|
+
color: /(background|color)$/i,
|
|
19
|
+
date: /Date$/,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const decorators = [withTheme];
|
|
26
|
+
export default preview;
|
package/app/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
# or
|
|
12
|
+
pnpm dev
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
16
|
+
|
|
17
|
+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
|
|
18
|
+
|
|
19
|
+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
|
|
20
|
+
|
|
21
|
+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
|
22
|
+
|
|
23
|
+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
|
24
|
+
|
|
25
|
+
## Learn More
|
|
26
|
+
|
|
27
|
+
To learn more about Next.js, take a look at the following resources:
|
|
28
|
+
|
|
29
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
30
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
31
|
+
|
|
32
|
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
33
|
+
|
|
34
|
+
## Deploy on Vercel
|
|
35
|
+
|
|
36
|
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
37
|
+
|
|
38
|
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|