@canlooks/can-ui 0.0.91 → 0.0.92

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 (68) hide show
  1. package/dist/cjs/components/calendar/calendar.style.js +124 -124
  2. package/dist/cjs/components/clickAway/clickAway.d.ts +1 -1
  3. package/dist/cjs/components/status/status.d.ts +6 -6
  4. package/dist/cjs/components/treeSelect/treeSelect.js +1 -1
  5. package/dist/esm/components/calendar/calendar.style.js +124 -124
  6. package/dist/esm/components/clickAway/clickAway.d.ts +1 -1
  7. package/dist/esm/components/status/status.d.ts +6 -6
  8. package/dist/esm/components/treeSelect/treeSelect.js +1 -1
  9. package/documentation/dist/assets/index-DvrKS6Tv.js +7747 -0
  10. package/documentation/dist/atom-one-dark.min.css +1 -0
  11. package/documentation/dist/components/accordion.md +38 -0
  12. package/documentation/dist/components/actionSheet.md +49 -0
  13. package/documentation/dist/components/alert.md +38 -0
  14. package/documentation/dist/components/anchorList.md +36 -0
  15. package/documentation/dist/components/autocomplete.md +68 -0
  16. package/documentation/dist/components/avatar.md +79 -0
  17. package/documentation/dist/components/badge.md +33 -0
  18. package/documentation/dist/components/bottomNavigation.md +39 -0
  19. package/documentation/dist/components/breadcrumb.md +28 -0
  20. package/documentation/dist/components/bubbleConfirm.md +34 -0
  21. package/documentation/dist/components/button.md +62 -0
  22. package/documentation/dist/components/card.md +30 -0
  23. package/documentation/dist/components/cascade.md +48 -0
  24. package/documentation/dist/components/checkbox.md +36 -0
  25. package/documentation/dist/components/colorPicker.md +27 -0
  26. package/documentation/dist/components/contextMenu.md +27 -0
  27. package/documentation/dist/components/counter.md +29 -0
  28. package/documentation/dist/components/dataGrid.md +112 -0
  29. package/documentation/dist/components/dateTimePicker.md +35 -0
  30. package/documentation/dist/components/dateTimeRangePicker.md +36 -0
  31. package/documentation/dist/components/descriptions.md +35 -0
  32. package/documentation/dist/components/dialog.md +56 -0
  33. package/documentation/dist/components/divider.md +26 -0
  34. package/documentation/dist/components/drawer.md +40 -0
  35. package/documentation/dist/components/flex.md +20 -0
  36. package/documentation/dist/components/form.md +131 -0
  37. package/documentation/dist/components/formDialog.md +36 -0
  38. package/documentation/dist/components/grid.md +34 -0
  39. package/documentation/dist/components/highlight.md +26 -0
  40. package/documentation/dist/components/image.md +90 -0
  41. package/documentation/dist/components/input.md +39 -0
  42. package/documentation/dist/components/loading.md +46 -0
  43. package/documentation/dist/components/menu.md +85 -0
  44. package/documentation/dist/components/pagination.md +38 -0
  45. package/documentation/dist/components/pickerDialog.md +56 -0
  46. package/documentation/dist/components/placeholder.md +30 -0
  47. package/documentation/dist/components/progress.md +43 -0
  48. package/documentation/dist/components/radio.md +37 -0
  49. package/documentation/dist/components/rating.md +35 -0
  50. package/documentation/dist/components/resizable.md +41 -0
  51. package/documentation/dist/components/scrollbar.md +31 -0
  52. package/documentation/dist/components/segmented.md +57 -0
  53. package/documentation/dist/components/select.md +30 -0
  54. package/documentation/dist/components/skeleton.md +26 -0
  55. package/documentation/dist/components/slidableActions.md +53 -0
  56. package/documentation/dist/guide/appComponent.md +30 -0
  57. package/documentation/dist/guide/globalMethods.md +238 -0
  58. package/documentation/dist/guide/icon.md +57 -0
  59. package/documentation/dist/guide/introduction.md +2 -0
  60. package/documentation/dist/guide/overrideProps.md +0 -0
  61. package/documentation/dist/guide/startup.md +23 -0
  62. package/documentation/dist/guide/theme.md +249 -0
  63. package/documentation/dist/index.html +13 -0
  64. package/documentation/dist/logo.png +0 -0
  65. package/extensions/curd.cjs +5 -5
  66. package/extensions/documentViewer.cjs +5 -5
  67. package/extensions/textFormatter.cjs +5 -5
  68. package/package.json +1 -1
@@ -0,0 +1,249 @@
1
+ # 自定义主题
2
+
3
+ ## <ThemeProvider\/>
4
+
5
+ 如果你使用了[<App\/>](appComponent)(入口组件),则入口组件也包含了themeProvider的功能:
6
+
7
+ ```tsx no-preview
8
+ import {App, ThemeDefinition} from '@canlooks/can-ui'
9
+
10
+ export default function Index() {
11
+ const theme: ThemeDefinition = {
12
+ colors: {
13
+ primary: '#1E71EC'
14
+ }
15
+ }
16
+
17
+ return (
18
+ <App theme={theme}>
19
+ {/* ... */}
20
+ </App>
21
+ )
22
+ }
23
+ ```
24
+
25
+ ## ThemeDefinition
26
+
27
+ | 属性 | 类型 |
28
+ |--------------|----------------------------|
29
+ | mode | 'light' \| 'dark' |
30
+ | fontSize | number |
31
+ | fontFamily | string |
32
+ | size | string |
33
+ | borderRadius | number |
34
+ | spacing | number[] |
35
+ | gap | number[] |
36
+ | gray | (amount: number) => string |
37
+ | divider | string |
38
+ | colors | Object |
39
+ | text | Object |
40
+ | background | Object |
41
+ | easing | Object |
42
+ | breakpoints | Object |
43
+ | boxShadow | string[] |
44
+ | zoom | number |
45
+
46
+ ## 默认主题定义
47
+
48
+ ### light
49
+
50
+ ```tsx no-preview
51
+ const defaultLightTheme: ThemeDefinition = {
52
+ mode: 'light',
53
+ fontSize: 14,
54
+ fontFamily: defaultFontFamily,
55
+ size: 'medium',
56
+ borderRadius: 6,
57
+ spacing: defaultSpacing,
58
+ gap: defaultSpacing[6],
59
+ gray,
60
+ /* divider: gray(.1), */
61
+ divider: '#e6e6e6',
62
+ colors: {
63
+ primary: '#1E71EC',
64
+ secondary: '#925CC1',
65
+ success: '#13C13C',
66
+ warning: '#ED9121',
67
+ error: '#DD3F3F',
68
+ info: '#52AEDF',
69
+ },
70
+ text: {
71
+ /* primary: gray(.9), */
72
+ primary: '#191919',
73
+ /* secondary: gray(.6), */
74
+ secondary: '#666666',
75
+ /* disabled: gray(.4), */
76
+ disabled: '#999999',
77
+ /* placeholder: gray(.3), */
78
+ placeholder: '#b3b3b3',
79
+ /* inverse: gray(0) */
80
+ inverse: '#ffffff'
81
+ },
82
+ background: {
83
+ content: '#ffffff',
84
+ /* body: gray(.04), */
85
+ body: '#f5f5f5',
86
+ fixed: 'rgba(0, 0, 0, .02)'
87
+ },
88
+ boxShadow: [
89
+ /* 通常用于弹框,气泡等 */
90
+ '3px 6px 18px rgba(0, 0, 0, .2)',
91
+ /* 通常用于抽屉等 */
92
+ '0 0 24px rgba(0, 0, 0, .2)',
93
+ '1px 2px 3px rgba(0, 0, 0, .2)',
94
+ '2px 4px 6px rgba(0, 0, 0, .2)',
95
+ '3px 6px 9px rgba(0, 0, 0, .2)',
96
+ '3px 6px 18px rgba(0, 0, 0, .2)',
97
+ '4px 8px 24px rgba(0, 0, 0, .2)'
98
+ ],
99
+ easing: {
100
+ linear: 'linear',
101
+ ease: 'ease',
102
+ easeIn: 'cubic-bezier(.3, 0, .6, 0)',
103
+ easeOut: 'cubic-bezier(.4, 1, .7, 1)',
104
+ easeInOut: 'cubic-bezier(.65, 0, .35, 1)',
105
+ bounce: 'cubic-bezier(.5, 2, .5, .7)',
106
+ swing: 'cubic-bezier(.5, 3, .5, .1)'
107
+ },
108
+ breakpoints: defaultBreakpoints,
109
+ zoom: 1
110
+ }
111
+ ```
112
+
113
+ ### dark
114
+
115
+ `dark`模式定义对象除以下属性外,其余属性继承于`light`模式
116
+
117
+ ```tsx no-preview
118
+ const defaultDarkTheme: ThemeDefinition = {
119
+ mode: 'dark',
120
+ background: {
121
+ content: '#333333',
122
+ body: '#252525',
123
+ fixed: 'rgba(255, 255, 255, .06)'
124
+ },
125
+ gray: rGray,
126
+ divider: '#5c5c5c',
127
+ colors: {
128
+ primary: '#3780EE',
129
+ secondary: '#9A68C6',
130
+ success: '#14CD40',
131
+ warning: '#EE9830',
132
+ error: '#E04D4D',
133
+ info: '#5AB2E0'
134
+ },
135
+ text: {
136
+ primary: '#e6e6e6',
137
+ secondary: '#b3b3b3',
138
+ disabled: '#808080',
139
+ placeholder: '#737373',
140
+ inverse: '#000000'
141
+ }
142
+ }
143
+ ```
144
+
145
+ ## 使用主题
146
+
147
+ ### useTheme()
148
+
149
+ CanUI提供`useTheme()`hook,获取当前主题对象,
150
+
151
+ **注意:使用时的`colors`对象与定义时不同**
152
+
153
+ ### Theme.Colors
154
+
155
+ 使用时,`colors`对象中的每个属性均支持数字`0-10`的索引,也支持`light`、`main`、`dark`3种预设:
156
+
157
+ ```tsx
158
+ import {Flex, useTheme} from '@canlooks/can-ui'
159
+
160
+ const height = 40
161
+ const color = '#fff'
162
+
163
+ export default function Index() {
164
+ const {colors: {primary}} = useTheme()
165
+
166
+ return (
167
+ <Flex width="100%" direction="column" gap={12}>
168
+ <Flex gap={12}>
169
+ <Flex flex={1} style={{background: primary.light, height}}>light</Flex>
170
+ <Flex flex={1} style={{background: primary.main, height, color}}>main</Flex>
171
+ <Flex flex={1} style={{background: primary.dark, height, color}}>dark</Flex>
172
+ </Flex>
173
+ <Flex>
174
+ <Flex flex={1} style={{background: primary[0], height}}>[0]</Flex>
175
+ <Flex flex={1} style={{background: primary[1], height}}>[1]</Flex>
176
+ <Flex flex={1} style={{background: primary[2], height}}>[2]</Flex>
177
+ <Flex flex={1} style={{background: primary[3], height}}>[3]</Flex>
178
+ <Flex flex={1} style={{background: primary[4], height}}>[4]</Flex>
179
+ <Flex flex={1} style={{background: primary[5], height, color}}>[5]</Flex>
180
+ <Flex flex={1} style={{background: primary[6], height, color}}>[6]</Flex>
181
+ <Flex flex={1} style={{background: primary[7], height, color}}>[7]</Flex>
182
+ <Flex flex={1} style={{background: primary[8], height, color}}>[8]</Flex>
183
+ <Flex flex={1} style={{background: primary[9], height, color}}>[9]</Flex>
184
+ <Flex flex={1} style={{background: primary[10], height, color}}>[10]</Flex>
185
+ </Flex>
186
+ </Flex>
187
+ )
188
+ }
189
+ ```
190
+
191
+ ## 动态更改主题
192
+
193
+ ### 使用useState()
194
+
195
+ 将[ThemeDefinition](#ThemeDefinition)使用`useState`控制即可
196
+
197
+ ```tsx
198
+ import {Button, Card, ThemeDefinition, ThemeProvider} from '@canlooks/can-ui'
199
+
200
+ const lightTheme = {
201
+ mode: 'light',
202
+ colors: {
203
+ primary: '#1E71EC'
204
+ }
205
+ }
206
+
207
+ const darkTheme = {
208
+ mode: 'dark',
209
+ colors: {
210
+ primary: '#9A68C6'
211
+ }
212
+ }
213
+
214
+ export default function Index() {
215
+ const [theme, setTheme] = React.useState<ThemeDefinition>(lightTheme)
216
+
217
+ const toggleHandler = () => {
218
+ setTheme(theme.mode === 'light' ? darkTheme : lightTheme)
219
+ }
220
+
221
+ return (
222
+ <ThemeProvider theme={theme}>
223
+ <Card elevation={5}>
224
+ <Button onClick={toggleHandler}>Toggle</Button>
225
+ </Card>
226
+ </ThemeProvider>
227
+ )
228
+ }
229
+ ```
230
+
231
+ ### 使用theme.update()
232
+
233
+ `theme`对象内置`update()`方法
234
+
235
+ ```tsx no-preview
236
+ export default function Index() {
237
+ const {update} = useTheme()
238
+
239
+ const changeTheme = () => {
240
+ update({
241
+ colors: {
242
+ primary: '#9A68C6'
243
+ }
244
+ })
245
+ }
246
+
247
+ // ...
248
+ }
249
+ ```
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <link rel="shortcut icon" href="/logo.png">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <title>Canlooks UI</title>
8
+ <script type="module" crossorigin src="/assets/index-DvrKS6Tv.js"></script>
9
+ </head>
10
+ <body>
11
+ <div id="app"></div>
12
+ </body>
13
+ </html>
Binary file
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- // @ts-nocheck
5
- tslib_1.__exportStar(require("../dist/cjs/extensions/curd"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // @ts-nocheck
5
+ tslib_1.__exportStar(require("../dist/cjs/extensions/curd"), exports);
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- // @ts-nocheck
5
- tslib_1.__exportStar(require("../dist/cjs/extensions/documentViewer"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // @ts-nocheck
5
+ tslib_1.__exportStar(require("../dist/cjs/extensions/documentViewer"), exports);
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- // @ts-nocheck
5
- tslib_1.__exportStar(require("../dist/cjs/extensions/textFormatter"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // @ts-nocheck
5
+ tslib_1.__exportStar(require("../dist/cjs/extensions/textFormatter"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",