@canlooks/can-ui 0.0.90 → 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 (76) 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/tree/tree.style.d.ts +1 -0
  5. package/dist/cjs/components/tree/tree.style.js +7 -4
  6. package/dist/cjs/components/tree/treeDnd.js +10 -1
  7. package/dist/cjs/components/tree/treeNode.js +7 -2
  8. package/dist/cjs/components/treeSelect/treeSelect.js +1 -1
  9. package/dist/esm/components/calendar/calendar.style.js +124 -124
  10. package/dist/esm/components/clickAway/clickAway.d.ts +1 -1
  11. package/dist/esm/components/status/status.d.ts +6 -6
  12. package/dist/esm/components/tree/tree.style.d.ts +1 -0
  13. package/dist/esm/components/tree/tree.style.js +7 -4
  14. package/dist/esm/components/tree/treeDnd.js +11 -2
  15. package/dist/esm/components/tree/treeNode.js +7 -2
  16. package/dist/esm/components/treeSelect/treeSelect.js +1 -1
  17. package/documentation/dist/assets/index-DvrKS6Tv.js +7747 -0
  18. package/documentation/dist/atom-one-dark.min.css +1 -0
  19. package/documentation/dist/components/accordion.md +38 -0
  20. package/documentation/dist/components/actionSheet.md +49 -0
  21. package/documentation/dist/components/alert.md +38 -0
  22. package/documentation/dist/components/anchorList.md +36 -0
  23. package/documentation/dist/components/autocomplete.md +68 -0
  24. package/documentation/dist/components/avatar.md +79 -0
  25. package/documentation/dist/components/badge.md +33 -0
  26. package/documentation/dist/components/bottomNavigation.md +39 -0
  27. package/documentation/dist/components/breadcrumb.md +28 -0
  28. package/documentation/dist/components/bubbleConfirm.md +34 -0
  29. package/documentation/dist/components/button.md +62 -0
  30. package/documentation/dist/components/card.md +30 -0
  31. package/documentation/dist/components/cascade.md +48 -0
  32. package/documentation/dist/components/checkbox.md +36 -0
  33. package/documentation/dist/components/colorPicker.md +27 -0
  34. package/documentation/dist/components/contextMenu.md +27 -0
  35. package/documentation/dist/components/counter.md +29 -0
  36. package/documentation/dist/components/dataGrid.md +112 -0
  37. package/documentation/dist/components/dateTimePicker.md +35 -0
  38. package/documentation/dist/components/dateTimeRangePicker.md +36 -0
  39. package/documentation/dist/components/descriptions.md +35 -0
  40. package/documentation/dist/components/dialog.md +56 -0
  41. package/documentation/dist/components/divider.md +26 -0
  42. package/documentation/dist/components/drawer.md +40 -0
  43. package/documentation/dist/components/flex.md +20 -0
  44. package/documentation/dist/components/form.md +131 -0
  45. package/documentation/dist/components/formDialog.md +36 -0
  46. package/documentation/dist/components/grid.md +34 -0
  47. package/documentation/dist/components/highlight.md +26 -0
  48. package/documentation/dist/components/image.md +90 -0
  49. package/documentation/dist/components/input.md +39 -0
  50. package/documentation/dist/components/loading.md +46 -0
  51. package/documentation/dist/components/menu.md +85 -0
  52. package/documentation/dist/components/pagination.md +38 -0
  53. package/documentation/dist/components/pickerDialog.md +56 -0
  54. package/documentation/dist/components/placeholder.md +30 -0
  55. package/documentation/dist/components/progress.md +43 -0
  56. package/documentation/dist/components/radio.md +37 -0
  57. package/documentation/dist/components/rating.md +35 -0
  58. package/documentation/dist/components/resizable.md +41 -0
  59. package/documentation/dist/components/scrollbar.md +31 -0
  60. package/documentation/dist/components/segmented.md +57 -0
  61. package/documentation/dist/components/select.md +30 -0
  62. package/documentation/dist/components/skeleton.md +26 -0
  63. package/documentation/dist/components/slidableActions.md +53 -0
  64. package/documentation/dist/guide/appComponent.md +30 -0
  65. package/documentation/dist/guide/globalMethods.md +238 -0
  66. package/documentation/dist/guide/icon.md +57 -0
  67. package/documentation/dist/guide/introduction.md +2 -0
  68. package/documentation/dist/guide/overrideProps.md +0 -0
  69. package/documentation/dist/guide/startup.md +23 -0
  70. package/documentation/dist/guide/theme.md +249 -0
  71. package/documentation/dist/index.html +13 -0
  72. package/documentation/dist/logo.png +0 -0
  73. package/extensions/curd.cjs +5 -5
  74. package/extensions/documentViewer.cjs +5 -5
  75. package/extensions/textFormatter.cjs +5 -5
  76. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:#c678dd}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#98c379}.hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#d19a66}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#61aeee}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_{color:#e6c07b}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}
@@ -0,0 +1,38 @@
1
+ # Accordion 手风琴
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Accordion, Flex} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ return (
10
+ <Flex width="100%" direction="column" compact>
11
+ <Accordion title="标题1">
12
+ 内容1
13
+ </Accordion>
14
+ <Accordion title="标题2">
15
+ 内容2
16
+ </Accordion>
17
+ <Accordion title="标题3">
18
+ 内容3
19
+ </Accordion>
20
+ </>
21
+ )
22
+ }
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | 属性 | 类型 | 默认值 | 说明 |
28
+ |------------------|-----------------------------------------------------|------------|----------------------------------|
29
+ | size | 'small' \| 'medium' \| 'large' | Theme.size | 组件的尺寸,默认由[Theme](/guide/theme)传递 |
30
+ | title | ReactNode | - | 标题 |
31
+ | prefix | ReactNode | - | 标题的前缀 |
32
+ | suffix | ReactNode | - | 标题的后缀 |
33
+ | expandIcon | ReactNode \| ((expanded: boolean) => ReactNode) | - | 展开与折叠图标 |
34
+ | defaultExpanded | boolean | false | 默认展开状态 |
35
+ | expanded | boolean | - | 受控的展开状态 |
36
+ | onExpandedChange | (expanded: boolean) => void | - | 展开回调 |
37
+ | readOnly | boolean | false | |
38
+ | disabled | boolean | false | |
@@ -0,0 +1,49 @@
1
+ # ActionSheet 上拉菜单
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {ActionSheet} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ const [open, setOpen] = React.useState(false)
10
+
11
+ return (
12
+ <>
13
+ <Button onClick={() => setOpen(true)}>打开上拉菜单</Button>
14
+ <ActionSheet
15
+ open={open}
16
+ onClose={() => setOpen(false)}
17
+ title="标题"
18
+ actions={[
19
+ {label: '选项1', onClick: () => console.log('选项1')},
20
+ {label: '选项2', onClick: () => console.log('选项2')}
21
+ ]}
22
+ />
23
+ </>
24
+ )
25
+ }
26
+ ```
27
+
28
+ ## Props
29
+
30
+ | 属性 | 类型 | 默认值 | 说明 |
31
+ |----------------|-----------------------------------------|-------|---------------------|
32
+ | title | ReactNode | - | 标题 |
33
+ | actions | [MenuItemProps](/components/menuItem#MenuItemProps)[] | - | 菜单 |
34
+ | placement | 'top' \| 'bottom' | - | 弹出菜单的位置 |
35
+ | maskClosable | boolean | false | 是否可通过点击遮罩层关闭对话框 |
36
+ | escapeClosable | boolean | true | 是否可通过键盘的【ESC】键关闭对话框 |
37
+ | onAction | (action) => void | - | 点击选项 |
38
+ | onConfirm | (e) => void | - | 点击确定 |
39
+ | onCancel | (e) => void | - | 点击取消 |
40
+ | defaultOpen | boolean | false | 默认打开状态 |
41
+ | open | boolean | - | 受控的打开状态 |
42
+ | onClose | (reason) => void | - | 关闭回调 |
43
+ | showConfirm | boolean | false | 是否显示确定选项 |
44
+ | confirmText | ReactNode | '确定' | |
45
+ | confirmProps | [MenuItemProps](/components/menuItem#MenuItemProps) | - | |
46
+ | showCancel | boolean | true | 是否显示取消选项 |
47
+ | cancelText | ReactNode | '取消' | |
48
+ | cancelProps | [MenuItemProps](/components/menuItem#MenuItemProps) | - | |
49
+ | slideProps | TransitionBaseProps | - | 传递给<Slide/>动画组件的属性 |
@@ -0,0 +1,38 @@
1
+ # Alert 提示框
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Alert, Flex} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ return (
10
+ <Flex width="100%" direction="column" gap={12}>
11
+ <Alert status="info" title="这是一条信息提示" description="这里是消息的内容"/>
12
+ <Alert status="success" title="这是一条信息提示" description="这里是消息的内容"/>
13
+ <Alert status="warning" title="这是一条信息提示" description="这里是消息的内容" closable/>
14
+ <Alert status="error" title="这是一条信息提示" description="这里是消息的内容"/>
15
+ <Alert variant="filled" title="这是一条信息提示" description="这里是消息的内容"/>
16
+ <Alert variant="outlined" title="这是一条信息提示" description="这里是消息的内容"/>
17
+ <Alert loading title="这是一条信息提示" description="这里是消息的内容"/>
18
+ </Flex>
19
+ )
20
+ }
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | 属性 | 类型 | 默认值 | 说明 |
26
+ |-------------|-------------------------------------------------------------|------------|----------|
27
+ | variant | 'filled' \| 'outlined' \| 'standard' | 'standard' | 样式 |
28
+ | status | 'success' \| 'error' \| 'warning' \| 'info' | 'error' | 状态 |
29
+ | color | string | - | 颜色 |
30
+ | showIcon | boolean | true | 是否显示图标 |
31
+ | icon | ReactNode | - | 图标 |
32
+ | title | ReactNode | - | 标题 |
33
+ | description | ReactNode | - | 说明 |
34
+ | prefix | ReactNode | - | 前缀内容 |
35
+ | suffix | ReactNode | - | 后缀内容 |
36
+ | closable | boolean | false | 是否渲染关闭按钮 |
37
+ | onClose | (e) => void | - | 关闭回调 |
38
+ | loading | boolean | false | 加载状态 |
@@ -0,0 +1,36 @@
1
+ # AnchorList 锚点列表
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {AnchorList} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ return (
10
+ <AnchorList
11
+ style={{width: '100%'}}
12
+ anchors={[
13
+ {id: 'anchor1', label: '锚点1'},
14
+ {id: 'anchor2', label: '锚点2', active: true},
15
+ {id: 'anchor2-1', label: '锚点2-1', level: 1},
16
+ {id: 'anchor2-2', label: '锚点2-2', level: 1},
17
+ {id: 'anchor3', label: '锚点3'},
18
+ ]}
19
+ />
20
+ )
21
+ }
22
+ ```
23
+
24
+ **锚点中的`active`状态通常无需手动设置,若滚动元素中有对应id的元素,会根据滚动位置自动计算。**
25
+
26
+ ## Props
27
+
28
+ | 属性 | 类型 | 默认值 | 说明 |
29
+ |------------------|----------------------------------------------------------------------------------------|-----------|--------------|
30
+ | anchors | {<br/>id: string,<br/> label: string,<br/> level: number,<br/> active: boolean<br/>}[] | - | 锚点列表 |
31
+ | renderAnchorItem | (item: AnchorItem, active: boolean) => void | - | 渲染锚点的方法 |
32
+ | indent | number | 24 | 缩进 |
33
+ | scroller | Element | document | 滚动元素 |
34
+ | routeMode | 'history' \| 'location' | 'history' | 路由跳转模式 |
35
+ | offset | number | 0 | 目标元素距离顶部的偏移量 |
36
+ | scrollBehavior | 'auto' \| 'instant' \| 'smooth' | 'auto' | |
@@ -0,0 +1,68 @@
1
+ # Autocomplete 自动填充
2
+
3
+ ## 基础示例
4
+
5
+ ```tsx
6
+ import {Autocomplete} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ const options = [
10
+ {label: 'Apple', value: 'apple'},
11
+ {label: 'Banana', value: 'banana'},
12
+ {label: 'Cherry', value: 'cherry'}
13
+ ]
14
+
15
+ return (
16
+ <Autocomplete
17
+ style={{width: 300}}
18
+ options={options}
19
+ />
20
+ )
21
+ }
22
+ ```
23
+
24
+ ## 动态数据
25
+
26
+ ```tsx
27
+ import {Autocomplete} from '@canlooks/can-ui'
28
+
29
+ export default function Index() {
30
+ const [options, setOptions] = React.useState([])
31
+
32
+ const loadOptions = (inputValue: string) => {
33
+ return new Promise((resolve) => {
34
+ inputValue
35
+ ? setTimeout(() => {
36
+ resolve([
37
+ {label: 'Apple', value: 'apple'},
38
+ {label: 'Banana', value: 'banana'},
39
+ {label: 'Cherry', value: 'cherry'}
40
+ ])
41
+ }, 1000)
42
+ : resolve([])
43
+ })
44
+ }
45
+
46
+ return (
47
+ <Autocomplete
48
+ style={{width: 300}}
49
+ loadOptions={loadOptions}
50
+ />
51
+ )
52
+ }
53
+ ```
54
+
55
+ ## Props
56
+
57
+ `<Autocomplete/>`组件继承了`<Input/>`组件的所有属性外,还有如下属性:
58
+
59
+ | 属性 | 类型 | 默认值 | 说明 |
60
+ |-------------|-------------------------------------------------------|---------|------------------|
61
+ | options | [MenuItemProps](/components/menuItem#MenuItemProps)[] | - | 选项 |
62
+ | loadOptions | (inputValue) => options \| Promise\<options> | - | 动态加载的选项 |
63
+ | primaryKey | string \| number | 'value' | 指定选项中的主键名 |
64
+ | labelKey | string \| number | 'label' | 指定选项中用于当作label的键 |
65
+ | onSelect | (selectedValue, option) => void | - | 选中回调 |
66
+ | renderInput | (inputProps) => ReactElement | - | 自定义渲染输入框 |
67
+ | popperProps | [PopperProps](/components/popper) | - | 传递给`Popper`组件的属性 |
68
+ | popperRef | [PopperRef](/components/popper) | - | |
@@ -0,0 +1,79 @@
1
+ # Avatar 头像
2
+
3
+ ## Avatar
4
+
5
+ ```tsx
6
+ import {Avatar, Flex, Icon} from '@canlooks/can-ui'
7
+ import {faUser} from '@fortawesome/free-solid-svg-icons'
8
+
9
+ export default function Index() {
10
+ const src = 'https://avatars.githubusercontent.com/u/47269261?v=4'
11
+
12
+ return (
13
+ <Flex
14
+ width="100%"
15
+ gap={12}
16
+ alignItems="center"
17
+ justifyContent="center"
18
+ >
19
+ <Avatar size="small" src=""/>
20
+ <Avatar src={src}/>
21
+ <Avatar size="large" src={src}/>
22
+ <Avatar>
23
+ <Icon icon={faUser}/>
24
+ </Avatar>
25
+ <Avatar shape="square">
26
+ <Icon icon={faUser}/>
27
+ </Avatar>
28
+ <Avatar color="primary">
29
+ <Icon icon={faUser}/>
30
+ </Avatar>
31
+ </Flex>
32
+ )
33
+ }
34
+ ```
35
+
36
+ ### Avatar Props
37
+
38
+ | 属性 | 类型 | 默认值 | 说明 |
39
+ |----------|------------------------|------------|------------------------|
40
+ | color | Color | - | 颜色 |
41
+ | size | string \| number | 'medium' | 尺寸 |
42
+ | shape | 'circular' \| 'square' | 'circular' | 形状 |
43
+ | src | string | - | 若不指定`src`则渲染`children` |
44
+ | children | ReactNode | - | 若不指定`children`则使用`src` |
45
+ | imgProps | ImgHTMLAttributes | - | 传递给`<img/>`标签的属性 |
46
+
47
+ ## AvatarGroup
48
+
49
+ ```tsx
50
+ import {AvatarGroup, Flex} from '@canlooks/can-ui'
51
+ import {faUser} from '@fortawesome/free-solid-svg-icons'
52
+
53
+ export default function Index() {
54
+ const src = 'https://avatars.githubusercontent.com/u/47269261?v=4'
55
+
56
+ return (
57
+ <AvatarGroup
58
+ items={[
59
+ {src},
60
+ {children: <Icon icon={faUser}/>},
61
+ {src},
62
+ {children: <Icon icon={faUser}/>},
63
+ {src},
64
+ {children: <Icon icon={faUser}/>}
65
+ ]}
66
+ />
67
+ )
68
+ }
69
+ ```
70
+
71
+ ### AvatarGroup Props
72
+
73
+ | 属性 | 类型 | 默认值 | 说明 |
74
+ |---------------|------------------------|------|----------------------------|
75
+ | items | AvatarProps[] | - | |
76
+ | hoverable | boolean | true | 是否可以hover交互 |
77
+ | max | number | 5 | 最大显示数量 |
78
+ | total | number | - | 总数,若不指定则取items或children的长度 |
79
+ | renderSurplus | (surplus) => ReactNode | - | 超过最大限制时,渲染的额外内容 |
@@ -0,0 +1,33 @@
1
+ # Badge 角标
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Badge, Flex} from '@canlooks/can-ui'
7
+ import {faUser} from '@fortawesome/free-solid-svg-icons'
8
+
9
+ export default function Index() {
10
+ return (
11
+ <Flex alignItems="center" justifyContent="center" gap={24}>
12
+ <Badge count={100}>
13
+ <Avatar>
14
+ <Icon icon={faUser}/>
15
+ </Avatar>
16
+ </Badge>
17
+ </Flex>
18
+ )
19
+ }
20
+ ```
21
+
22
+ ## Props
23
+
24
+ | 属性 | 类型 | 默认值 | 说明 |
25
+ |-----------|---------------------|------------|---------------|
26
+ | count | number | - | 角标数值 |
27
+ | color | string | 'error' | 颜色 |
28
+ | placement | string | 'topRight' | 位置 |
29
+ | variant | 'dot' \| 'standard' | 'standard' | 角标样式 |
30
+ | max | number | 99 | 最大数值,超过会显示`+` |
31
+ | showZero | boolean | false | 数量为0时是否显示角标 |
32
+ | offsetX | number | 0 | 位置偏移量 |
33
+ | offsetY | number | 0 | 位置偏移量 |
@@ -0,0 +1,39 @@
1
+ # BottomNavigation 底部导航
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {BottomNavigation, Icon} from '@canlooks/can-ui'
7
+ import {faUser} from '@fortawesome/free-solid-svg-icons'
8
+
9
+ export default function Index() {
10
+ return (
11
+ <div style={{
12
+ width: '100%',
13
+ height: 56,
14
+ position: 'relative'
15
+ }}>
16
+ <BottomNavigation
17
+ items={[
18
+ {value: 'index', label: '首页'},
19
+ {value: 'about', label: '关于'},
20
+ {value: 'me', label: '我的', icon: <Icon icon={faUser}/>},
21
+ ]}
22
+ />
23
+ </div>
24
+ )
25
+ }
26
+ ```
27
+
28
+ ## Props
29
+
30
+ | 属性 | 类型 | 默认值 | 说明 |
31
+ |-------------------|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------|-----------------|
32
+ | items | {<br/>value: string,<br/>icon: ReactNode,<br/>label: ReactNode,<br/>showLabelInactive: boolean,<br/>active: boolean<br/>}[] | - | |
33
+ | showLabelInactive | boolean | items数量小于等于3时默认为`true`<br/>否则为`false` | 未激活状态下是否显示label |
34
+ | primaryKey | string \| number | 'value' | 选项的主键 |
35
+ | labelKey | string \| number | 'label' | 作为`label`的键 |
36
+ | defaultValue | string \| number | - | 默认值 |
37
+ | value | string \| number | - | 受控的值 |
38
+ | onChange | (value) => void | - | 值变化的回调 |
39
+
@@ -0,0 +1,28 @@
1
+ # Breadcrumb 面包屑
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Breadcrumb, Icon} from '@canlooks/can-ui'
7
+ import {faUser} from '@fortawesome/free-solid-svg-icons'
8
+
9
+ export default function Index() {
10
+ return (
11
+ <Breadcrumb
12
+ items={[
13
+ {label: 'Home'},
14
+ {label: 'Components'},
15
+ {label: 'Me', icon: <Icon icon={faUser}/>}
16
+ ]}
17
+ />
18
+ )
19
+ }
20
+ ```
21
+
22
+ ## Props
23
+
24
+ | 属性 | 类型 | 默认值 | 说明 |
25
+ |-----------|-------------------------------------|-------|-----|
26
+ | items | [ButtonProps](/components/button#Props)[] | - | |
27
+ | separator | ReactNode | '/' | 分隔符 |
28
+ | readOnly | boolean | false | |
@@ -0,0 +1,34 @@
1
+ # BubbleConfirm 气泡确认框
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {BubbleConfirm, Button} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ const onConfirm = async () => {
10
+ await new Promise(resolve => setTimeout(resolve, 1000))
11
+ }
12
+
13
+ return (
14
+ <BubbleConfirm
15
+ title="这里是标题"
16
+ content="这里是气泡确认框的内容"
17
+ onConfirm={onConfirm}
18
+ >
19
+ <Button>确认</Button>
20
+ </BubbleConfirm>
21
+ )
22
+ }
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | 属性 | 类型 | 默认值 | 说明 |
28
+ |-----------|-------------|-------|-----------------------------------|
29
+ | icon | ReactNode | - | |
30
+ | title | ReactNode | - | |
31
+ | footer | ReactNode | - | 自定以渲染footer,若不指定则使用默认的`取消`与`确定`按钮 |
32
+ | showArrow | boolean | true | 是否显示气泡的箭头 |
33
+ | loading | boolean | false | |
34
+ | onConfirm | (e) => void | - | 确认回调 |
@@ -0,0 +1,62 @@
1
+ # Button 按钮
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Button, Flex} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ const rowProps = {
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ gap: 12
13
+ }
14
+
15
+ return (
16
+ <Flex width="100%" direction="column" gap={12}>
17
+ <Flex {...rowProps}>
18
+ <Button>按钮</Button>
19
+ <Button variant="flatted">按钮</Button>
20
+ <Button variant="outlined">按钮</Button>
21
+ <Button variant="dashed">按钮</Button>
22
+ <Button variant="ghost">按钮</Button>
23
+ <Button variant="text">按钮</Button>
24
+ <Button variant="plain">按钮</Button>
25
+ </Flex>
26
+ <Flex {...rowProps}>
27
+ <Button color="success">按钮</Button>
28
+ <Button color="warning">按钮</Button>
29
+ <Button color="error">按钮</Button>
30
+ <Button color="info">按钮</Button>
31
+ <Button loading>按钮</Button>
32
+ </Flex>
33
+ <Flex {...rowProps}>
34
+ <Button size="small">按钮</Button>
35
+ <Button size="large">按钮</Button>
36
+ </Flex>
37
+ <Flex {...rowProps}>
38
+ <Button shape="circular">钮</Button>
39
+ <Button shape="rounded">按钮</Button>
40
+ </Flex>
41
+ </Flex>
42
+ )
43
+ }
44
+ ```
45
+
46
+ ## Props
47
+
48
+ `<Button/>`组件继承了`<button/>`元素的所有属性,除此之外还有以下属性:
49
+
50
+ | 属性 | 类型 | 默认值 | 说明 |
51
+ |-------------|-----------------------------------------------------------------------------------------------------------|--------------|---------------|
52
+ | color | string | - | |
53
+ | shape | 'square' \| 'circular' \| 'rounded' | 'square' | 形状 |
54
+ | size | 'small' \| 'medium' \| 'large' | 'medium' | 尺寸 |
55
+ | variant | 'flatted' \| 'filled' \| 'outlined' \| 'dashed' \| 'ghost' \| 'text' \| 'plain' | 'filled' | 样式 |
56
+ | orientation | 'horizontal' \| 'vertical' | 'horizontal' | 前后缀的排列方向 |
57
+ | prefix | ReactNode | - | |
58
+ | suffix | ReactNode | - | |
59
+ | loading | boolean | false | |
60
+ | readOnly | boolean | false | |
61
+ | icon | ReactNode | - | prefix属性的别名 |
62
+ | label | ReactNode | - | children属性的别名 |
@@ -0,0 +1,30 @@
1
+ # Card 卡片
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Card, Flex} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ return (
10
+ <Flex gap={12} wrap="wrap">
11
+ <Card>Card</Card>
12
+ <Card bordered>Card</Card>
13
+ <Card elevation={1}>Card</Card>
14
+ <Card elevation={2}>Card</Card>
15
+ <Card elevation={3}>Card</Card>
16
+ <Card elevation={4}>Card</Card>
17
+ <Card elevation={5}>Card</Card>
18
+ </Flex>
19
+ )
20
+ }
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | 属性 | 类型 | 默认值 | 说明 |
26
+ |--------------|---------|------------------------------------|----------------|
27
+ | flexable | boolean | false | 卡片内容是否使用flex布局 |
28
+ | bordered | boolean | false | 是否渲染边框 |
29
+ | elevation | number | 0 | 支持0-5 |
30
+ | borderRadius | number | [Theme.borderRadius](/guide/theme) | 圆角 |
@@ -0,0 +1,48 @@
1
+ # Cascade 级联选择器
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Cascade} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ const options = [
10
+ {
11
+ value: 'zhejiang',
12
+ label: 'Zhejiang',
13
+ children: [
14
+ {
15
+ value: 'hangzhou',
16
+ label: 'Hangzhou',
17
+ children: [
18
+ {
19
+ value: 'xihu',
20
+ label: 'West Lake',
21
+ },
22
+ ],
23
+ },
24
+ ],
25
+ },
26
+ {
27
+ value: 'jiangsu',
28
+ label: 'Jiangsu',
29
+ children: [
30
+ {
31
+ value: 'nanjing',
32
+ label: 'Nanjing',
33
+ children: [
34
+ {
35
+ value: 'zhonghuamen',
36
+ label: 'Zhong Hua Men',
37
+ },
38
+ ],
39
+ },
40
+ ],
41
+ },
42
+ ]
43
+
44
+ return (
45
+ <Cascade options={options} style={{width: 200}}/>
46
+ )
47
+ }
48
+ ```
@@ -0,0 +1,36 @@
1
+ # Checkbox 选择框
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {Checkbox} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ return (
10
+ <Checkbox label="选择"/>
11
+ )
12
+ }
13
+ ```
14
+
15
+ ### CheckboxGroup
16
+
17
+ ```tsx
18
+ import {CheckboxGroup} from '@canlooks/can-ui'
19
+
20
+ export default function Index() {
21
+ return (
22
+ <CheckboxGroup
23
+ items={[
24
+ {
25
+ label: '选项1',
26
+ value: 1
27
+ },
28
+ {
29
+ label: '选项2',
30
+ value: 2
31
+ }
32
+ ]}
33
+ />
34
+ )
35
+ }
36
+ ```
@@ -0,0 +1,27 @@
1
+ # ColorPicker 颜色选择
2
+
3
+ ## 示例
4
+
5
+ ```tsx
6
+ import {ColorPicker} from '@canlooks/can-ui'
7
+
8
+ export default function Index() {
9
+ return (
10
+ <ColorPicker/>
11
+ )
12
+ }
13
+ ```
14
+
15
+ ## Props
16
+
17
+ 颜色选择器的值使用`Color`对象,详情请查看[官方文档](https://github.com/Qix-/color)。
18
+
19
+ | 属性 | 类型 | 默认值 | 说明 |
20
+ |--------------|--------------------------------|----------|-------|
21
+ | size | 'small' \| 'medium' \| 'large' | 'medium' | |
22
+ | shape | 'square' \| 'circular' | 'square' | |
23
+ | label | ReactNode | '自定义' | |
24
+ | presets | Color[] | - | 预设的颜色 |
25
+ | defaultValue | Color | - | 默认的颜色 |
26
+ | value | Color | - | 受控的颜色 |
27
+ | onChange | (Color) => void | - | 变化回调 |