@bbki.ng/ui 0.1.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/.storybook/main.ts +21 -0
- package/.storybook/preview-head.html +10 -0
- package/.storybook/preview.tsx +30 -0
- package/CHANGELOG.md +8 -0
- package/README.md +124 -0
- package/package.json +57 -0
- package/scripts/build-tokens.ts +170 -0
- package/src/atoms/blink-dot/BlinkDot.stories.tsx +44 -0
- package/src/atoms/blink-dot/BlinkDot.tsx +45 -0
- package/src/atoms/blink-dot/index.ts +2 -0
- package/src/atoms/button/Button.stories.tsx +84 -0
- package/src/atoms/button/Button.tsx +59 -0
- package/src/atoms/button/Button.types.ts +20 -0
- package/src/atoms/button/Button.variants.ts +58 -0
- package/src/atoms/button/index.ts +3 -0
- package/src/atoms/link/Link.stories.tsx +121 -0
- package/src/atoms/link/Link.tsx +69 -0
- package/src/atoms/link/Link.types.ts +26 -0
- package/src/atoms/link/Link.variants.ts +55 -0
- package/src/atoms/link/index.ts +3 -0
- package/src/atoms/logo/Logo.stories.tsx +37 -0
- package/src/atoms/logo/Logo.tsx +49 -0
- package/src/atoms/logo/Logo.types.ts +4 -0
- package/src/atoms/logo/index.ts +2 -0
- package/src/index.ts +54 -0
- package/src/layout/container/Container.stories.tsx +73 -0
- package/src/layout/container/Container.tsx +57 -0
- package/src/layout/container/index.ts +2 -0
- package/src/layout/grid/Grid.stories.tsx +106 -0
- package/src/layout/grid/Grid.tsx +86 -0
- package/src/layout/grid/index.ts +2 -0
- package/src/layout/index.ts +4 -0
- package/src/molecules/article/Article.stories.tsx +45 -0
- package/src/molecules/article/Article.tsx +25 -0
- package/src/molecules/article/Article.types.ts +11 -0
- package/src/molecules/article/index.ts +2 -0
- package/src/molecules/breadcrumb/Breadcrumb.stories.tsx +60 -0
- package/src/molecules/breadcrumb/Breadcrumb.tsx +43 -0
- package/src/molecules/breadcrumb/Breadcrumb.types.ts +19 -0
- package/src/molecules/breadcrumb/index.ts +2 -0
- package/src/molecules/list/List.stories.tsx +84 -0
- package/src/molecules/list/List.tsx +79 -0
- package/src/molecules/list/List.types.ts +23 -0
- package/src/molecules/list/index.ts +2 -0
- package/src/molecules/nav/Nav.stories.tsx +45 -0
- package/src/molecules/nav/Nav.tsx +29 -0
- package/src/molecules/nav/Nav.types.ts +10 -0
- package/src/molecules/nav/index.ts +2 -0
- package/src/molecules/panel/Panel.stories.tsx +42 -0
- package/src/molecules/panel/Panel.tsx +27 -0
- package/src/molecules/panel/Panel.types.ts +6 -0
- package/src/molecules/panel/index.ts +2 -0
- package/src/molecules/table/Table.stories.tsx +54 -0
- package/src/molecules/table/Table.tsx +31 -0
- package/src/molecules/table/Table.types.ts +20 -0
- package/src/molecules/table/index.ts +2 -0
- package/src/organisms/canvas/Canvas.tsx +79 -0
- package/src/organisms/canvas/Canvas.types.ts +25 -0
- package/src/organisms/canvas/index.ts +3 -0
- package/src/organisms/canvas/useRenderer.ts +44 -0
- package/src/organisms/drop-image/DropImage.stories.tsx +36 -0
- package/src/organisms/drop-image/DropImage.tsx +193 -0
- package/src/organisms/drop-image/DropImage.types.ts +26 -0
- package/src/organisms/drop-image/index.ts +3 -0
- package/src/organisms/drop-image/useDropImage.ts +124 -0
- package/src/organisms/drop-image/utils.ts +1 -0
- package/src/organisms/drop-zone/DropZone.tsx +58 -0
- package/src/organisms/drop-zone/DropZone.types.ts +9 -0
- package/src/organisms/drop-zone/index.ts +2 -0
- package/src/organisms/loading-spiral/LoadingSpiral.stories.tsx +30 -0
- package/src/organisms/loading-spiral/LoadingSpiral.tsx +44 -0
- package/src/organisms/loading-spiral/LoadingSpiral.types.ts +4 -0
- package/src/organisms/loading-spiral/constants.ts +62 -0
- package/src/organisms/loading-spiral/createOptions.ts +31 -0
- package/src/organisms/loading-spiral/createSettings.ts +26 -0
- package/src/organisms/loading-spiral/index.ts +2 -0
- package/src/organisms/loading-spiral/useCanvasRef.ts +23 -0
- package/src/organisms/loading-spiral/utils.ts +5 -0
- package/src/organisms/page/Page.stories.tsx +65 -0
- package/src/organisms/page/Page.tsx +71 -0
- package/src/organisms/page/Page.types.ts +23 -0
- package/src/organisms/page/index.ts +8 -0
- package/src/styles.css +151 -0
- package/src/theme/ThemeContext.tsx +20 -0
- package/src/theme/ThemeProvider.tsx +93 -0
- package/src/theme/index.ts +3 -0
- package/src/tokens/css/dark.css +111 -0
- package/src/tokens/css/light.css +111 -0
- package/src/tokens/index.ts +127 -0
- package/tokens/base/colors.json +54 -0
- package/tokens/base/shadows.json +34 -0
- package/tokens/base/spacing.json +21 -0
- package/tokens/base/typography.json +35 -0
- package/tokens/semantic/dark.json +50 -0
- package/tokens/semantic/light.json +54 -0
- package/tsconfig.json +22 -0
- package/vite.config.ts +44 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"shadow": {
|
|
3
|
+
"none": { "value": "none", "type": "boxShadow" },
|
|
4
|
+
"sm": { "value": "0 1px 2px 0 rgb(0 0 0 / 0.05)", "type": "boxShadow" },
|
|
5
|
+
"md": {
|
|
6
|
+
"value": "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
7
|
+
"type": "boxShadow"
|
|
8
|
+
},
|
|
9
|
+
"lg": {
|
|
10
|
+
"value": "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
11
|
+
"type": "boxShadow"
|
|
12
|
+
},
|
|
13
|
+
"xl": {
|
|
14
|
+
"value": "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
15
|
+
"type": "boxShadow"
|
|
16
|
+
},
|
|
17
|
+
"button": {
|
|
18
|
+
"value": "0px 15px 15px rgba(0, 0, 0, 0.1), 0px 5px 5px -2px rgba(0, 0, 0, 0.04)",
|
|
19
|
+
"type": "boxShadow"
|
|
20
|
+
},
|
|
21
|
+
"buttonHover": {
|
|
22
|
+
"value": "0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 5px 5px -2px rgba(0, 0, 0, 0.04)",
|
|
23
|
+
"type": "boxShadow"
|
|
24
|
+
},
|
|
25
|
+
"input": {
|
|
26
|
+
"value": "inset 0px 10px 25px -15px rgba(0, 0, 0, 0.25), inset 0px 5px 10px -5px rgba(17, 24, 39, 0.2)",
|
|
27
|
+
"type": "boxShadow"
|
|
28
|
+
},
|
|
29
|
+
"panel": {
|
|
30
|
+
"value": "0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)",
|
|
31
|
+
"type": "boxShadow"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"spacing": {
|
|
3
|
+
"0": { "value": "0", "type": "spacing" },
|
|
4
|
+
"1": { "value": "0.125rem", "type": "spacing" },
|
|
5
|
+
"2": { "value": "0.25rem", "type": "spacing" },
|
|
6
|
+
"3": { "value": "0.375rem", "type": "spacing" },
|
|
7
|
+
"4": { "value": "0.5rem", "type": "spacing" },
|
|
8
|
+
"5": { "value": "0.625rem", "type": "spacing" },
|
|
9
|
+
"6": { "value": "0.75rem", "type": "spacing" },
|
|
10
|
+
"8": { "value": "1rem", "type": "spacing" },
|
|
11
|
+
"10": { "value": "1.25rem", "type": "spacing" },
|
|
12
|
+
"12": { "value": "1.5rem", "type": "spacing" },
|
|
13
|
+
"16": { "value": "2rem", "type": "spacing" },
|
|
14
|
+
"20": { "value": "2.5rem", "type": "spacing" },
|
|
15
|
+
"24": { "value": "3rem", "type": "spacing" },
|
|
16
|
+
"32": { "value": "4rem", "type": "spacing" },
|
|
17
|
+
"40": { "value": "5rem", "type": "spacing" },
|
|
18
|
+
"48": { "value": "6rem", "type": "spacing" },
|
|
19
|
+
"64": { "value": "8rem", "type": "spacing" }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"font": {
|
|
3
|
+
"sans": {
|
|
4
|
+
"value": "'PT Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
|
5
|
+
"type": "fontFamilies"
|
|
6
|
+
},
|
|
7
|
+
"mono": {
|
|
8
|
+
"value": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
|
|
9
|
+
"type": "fontFamilies"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"fontSize": {
|
|
13
|
+
"xs": { "value": "0.75rem", "type": "fontSizes" },
|
|
14
|
+
"sm": { "value": "0.875rem", "type": "fontSizes" },
|
|
15
|
+
"base": { "value": "1rem", "type": "fontSizes" },
|
|
16
|
+
"lg": { "value": "1.125rem", "type": "fontSizes" },
|
|
17
|
+
"xl": { "value": "1.25rem", "type": "fontSizes" },
|
|
18
|
+
"2xl": { "value": "1.5rem", "type": "fontSizes" },
|
|
19
|
+
"3xl": { "value": "1.875rem", "type": "fontSizes" },
|
|
20
|
+
"4xl": { "value": "2.25rem", "type": "fontSizes" }
|
|
21
|
+
},
|
|
22
|
+
"lineHeight": {
|
|
23
|
+
"none": { "value": "1", "type": "lineHeights" },
|
|
24
|
+
"tight": { "value": "1.25", "type": "lineHeights" },
|
|
25
|
+
"snug": { "value": "1.375", "type": "lineHeights" },
|
|
26
|
+
"normal": { "value": "1.5", "type": "lineHeights" },
|
|
27
|
+
"relaxed": { "value": "1.625", "type": "lineHeights" }
|
|
28
|
+
},
|
|
29
|
+
"fontWeight": {
|
|
30
|
+
"normal": { "value": "400", "type": "fontWeights" },
|
|
31
|
+
"medium": { "value": "500", "type": "fontWeights" },
|
|
32
|
+
"semibold": { "value": "600", "type": "fontWeights" },
|
|
33
|
+
"bold": { "value": "700", "type": "fontWeights" }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"color": {
|
|
3
|
+
"background": { "value": "{color.gray.950}", "type": "color" },
|
|
4
|
+
"foreground": { "value": "{color.gray.50}", "type": "color" },
|
|
5
|
+
"muted": { "value": "{color.gray.800}", "type": "color" },
|
|
6
|
+
"mutedForeground": { "value": "{color.gray.400}", "type": "color" },
|
|
7
|
+
"border": { "value": "{color.gray.800}", "type": "color" },
|
|
8
|
+
"primary": { "value": "{color.blue.500}", "type": "color" },
|
|
9
|
+
"primaryForeground": { "value": "{color.white}", "type": "color" },
|
|
10
|
+
"secondary": { "value": "{color.gray.800}", "type": "color" },
|
|
11
|
+
"secondaryForeground": { "value": "{color.gray.50}", "type": "color" },
|
|
12
|
+
"accent": { "value": "{color.pink.150}", "type": "color" },
|
|
13
|
+
"accentForeground": { "value": "{color.gray.950}", "type": "color" },
|
|
14
|
+
"destructive": { "value": "{color.red.500}", "type": "color" },
|
|
15
|
+
"logo": { "value": "{color.gray.400}", "type": "color" },
|
|
16
|
+
"destructiveForeground": { "value": "{color.white}", "type": "color" },
|
|
17
|
+
"special": { "value": "{color.xwy.50}", "type": "color" },
|
|
18
|
+
"specialForeground": { "value": "{color.xwy.150}", "type": "color" },
|
|
19
|
+
"content": {
|
|
20
|
+
"primary": { "value": "{color.gray.50}", "type": "color", "description": "主要内容文字颜色" },
|
|
21
|
+
"secondary": {
|
|
22
|
+
"value": "{color.gray.400}",
|
|
23
|
+
"type": "color",
|
|
24
|
+
"description": "次要/辅助文字颜色"
|
|
25
|
+
},
|
|
26
|
+
"disabled": {
|
|
27
|
+
"value": "{color.gray.500}",
|
|
28
|
+
"type": "color",
|
|
29
|
+
"description": "禁用状态文字颜色"
|
|
30
|
+
},
|
|
31
|
+
"action": {
|
|
32
|
+
"value": "{color.black}",
|
|
33
|
+
"type": "color",
|
|
34
|
+
"description": "可操作/链接文字颜色"
|
|
35
|
+
},
|
|
36
|
+
"special": {
|
|
37
|
+
"value": "{color.xwy.150}",
|
|
38
|
+
"type": "color",
|
|
39
|
+
"description": "特殊内容文字颜色"
|
|
40
|
+
},
|
|
41
|
+
"danger": { "value": "{color.red.400}", "type": "color", "description": "危险/警告文字颜色" }
|
|
42
|
+
},
|
|
43
|
+
"status": {
|
|
44
|
+
"error": { "value": "{color.red.500}", "type": "color", "description": "错误状态指示颜色" },
|
|
45
|
+
"warning": { "value": "{color.red.400}", "type": "color", "description": "警告状态指示颜色" },
|
|
46
|
+
"success": { "value": "#4ade80", "type": "color", "description": "成功状态指示颜色" },
|
|
47
|
+
"info": { "value": "{color.blue.500}", "type": "color", "description": "信息提示指示颜色" }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"color": {
|
|
3
|
+
"background": { "value": "{color.white}", "type": "color" },
|
|
4
|
+
"foreground": { "value": "{color.gray.900}", "type": "color" },
|
|
5
|
+
"muted": { "value": "{color.gray.100}", "type": "color" },
|
|
6
|
+
"mutedForeground": { "value": "{color.gray.500}", "type": "color" },
|
|
7
|
+
"border": { "value": "{color.gray.200}", "type": "color" },
|
|
8
|
+
"primary": { "value": "{color.blue.600}", "type": "color" },
|
|
9
|
+
"primaryForeground": { "value": "{color.white}", "type": "color" },
|
|
10
|
+
"secondary": { "value": "{color.gray.100}", "type": "color" },
|
|
11
|
+
"secondaryForeground": { "value": "{color.gray.900}", "type": "color" },
|
|
12
|
+
"accent": { "value": "{color.pink.100}", "type": "color" },
|
|
13
|
+
"accentForeground": { "value": "{color.gray.900}", "type": "color" },
|
|
14
|
+
"destructive": { "value": "{color.red.600}", "type": "color" },
|
|
15
|
+
"destructiveForeground": { "value": "{color.white}", "type": "color" },
|
|
16
|
+
"special": { "value": "{color.xwy.50}", "type": "color" },
|
|
17
|
+
"logo": { "value": "{color.gray.150}", "type": "color" },
|
|
18
|
+
"specialForeground": { "value": "{color.gray.900}", "type": "color" },
|
|
19
|
+
"content": {
|
|
20
|
+
"primary": {
|
|
21
|
+
"value": "{color.gray.900}",
|
|
22
|
+
"type": "color",
|
|
23
|
+
"description": "主要内容文字颜色"
|
|
24
|
+
},
|
|
25
|
+
"special": {
|
|
26
|
+
"value": "{color.xwy.150}",
|
|
27
|
+
"type": "color",
|
|
28
|
+
"description": "特殊内容文字颜色(例如包含“小乌鸦”的内容)"
|
|
29
|
+
},
|
|
30
|
+
"secondary": {
|
|
31
|
+
"value": "{color.gray.600}",
|
|
32
|
+
"type": "color",
|
|
33
|
+
"description": "次要/辅助文字颜色"
|
|
34
|
+
},
|
|
35
|
+
"disabled": {
|
|
36
|
+
"value": "{color.gray.400}",
|
|
37
|
+
"type": "color",
|
|
38
|
+
"description": "禁用状态文字颜色"
|
|
39
|
+
},
|
|
40
|
+
"action": {
|
|
41
|
+
"value": "{color.black}",
|
|
42
|
+
"type": "color",
|
|
43
|
+
"description": "可操作/链接文字颜色"
|
|
44
|
+
},
|
|
45
|
+
"danger": { "value": "{color.red.500}", "type": "color", "description": "危险/警告文字颜色" }
|
|
46
|
+
},
|
|
47
|
+
"status": {
|
|
48
|
+
"error": { "value": "{color.red.600}", "type": "color", "description": "错误状态指示颜色" },
|
|
49
|
+
"warning": { "value": "{color.red.500}", "type": "color", "description": "警告状态指示颜色" },
|
|
50
|
+
"success": { "value": "#22c55e", "type": "color", "description": "成功状态指示颜色" },
|
|
51
|
+
"info": { "value": "{color.blue.600}", "type": "color", "description": "信息提示指示颜色" }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
5
|
+
"jsx": "react-jsx",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noUnusedLocals": true,
|
|
11
|
+
"noUnusedParameters": true,
|
|
12
|
+
"noFallthroughCasesInSwitch": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"baseUrl": "."
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*", "tokens/**/*", "scripts/**/*"],
|
|
21
|
+
"exclude": ["node_modules", "dist"]
|
|
22
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import dts from 'vite-plugin-dts';
|
|
4
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [
|
|
9
|
+
react(),
|
|
10
|
+
tailwindcss() as any,
|
|
11
|
+
dts({
|
|
12
|
+
entryRoot: path.resolve(__dirname, 'src'),
|
|
13
|
+
outDir: path.resolve(__dirname, 'dist/types'),
|
|
14
|
+
exclude: ['**/*.test.tsx', '**/*.stories.tsx', '**/tokens/css/**'],
|
|
15
|
+
insertTypesEntry: true,
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
build: {
|
|
19
|
+
lib: {
|
|
20
|
+
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
21
|
+
name: 'BBUI',
|
|
22
|
+
formats: ['es'],
|
|
23
|
+
fileName: (format, entryName) => `${entryName}.mjs`,
|
|
24
|
+
},
|
|
25
|
+
rollupOptions: {
|
|
26
|
+
external: ['react', 'react-dom', 'react-router-dom', 'react/jsx-runtime'],
|
|
27
|
+
output: {
|
|
28
|
+
preserveModules: true,
|
|
29
|
+
preserveModulesRoot: 'src',
|
|
30
|
+
globals: {
|
|
31
|
+
react: 'React',
|
|
32
|
+
'react-dom': 'ReactDOM',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
sourcemap: true,
|
|
37
|
+
cssCodeSplit: true,
|
|
38
|
+
},
|
|
39
|
+
resolve: {
|
|
40
|
+
alias: {
|
|
41
|
+
'@': path.resolve(__dirname, 'src'),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|