@hsu-react/ui 0.0.2 → 0.0.3

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 (73) hide show
  1. package/README.md +2 -0
  2. package/es/components/ChainGraph/_components/SearchSelect/index.js +13 -10
  3. package/es/components/ChainGraph/_components/SearchSelect/index.module.less +8 -2
  4. package/es/components/DatePicker/index.module.less +1 -0
  5. package/es/components/FormItem/FormInput/FormPasswordStrength/index.js +2 -2
  6. package/es/components/FormItem/FormInput/FormPasswordStrength/index.module.less +12 -0
  7. package/es/components/Input/Range/index.module.less +4 -4
  8. package/es/components/Input/index.module.less +3 -0
  9. package/es/components/Select/_utils/getElementPosition.d.ts +6 -2
  10. package/es/components/Select/_utils/getElementPosition.js +8 -6
  11. package/es/components/Select/index.module.less +3 -0
  12. package/es/components/Slider/index.module.less +1 -0
  13. package/es/components/Switch/index.js +12 -8
  14. package/es/components/Switch/index.module.less +7 -0
  15. package/lib/components/ChainGraph/_components/SearchSelect/index.js +10 -7
  16. package/lib/components/ChainGraph/_components/SearchSelect/index.module.less +8 -2
  17. package/lib/components/DatePicker/index.module.less +1 -0
  18. package/lib/components/FormItem/FormInput/FormPasswordStrength/index.js +2 -1
  19. package/lib/components/FormItem/FormInput/FormPasswordStrength/index.module.less +12 -0
  20. package/lib/components/Input/Range/index.module.less +4 -4
  21. package/lib/components/Input/index.module.less +3 -0
  22. package/lib/components/Select/_utils/getElementPosition.d.ts +6 -2
  23. package/lib/components/Select/_utils/getElementPosition.js +8 -6
  24. package/lib/components/Select/index.module.less +3 -0
  25. package/lib/components/Slider/index.module.less +1 -0
  26. package/lib/components/Switch/index.js +8 -4
  27. package/lib/components/Switch/index.module.less +7 -0
  28. package/package.json +1 -1
  29. package/src/components/Button/index.md +18 -1
  30. package/src/components/ChainGraph/_components/SearchSelect/index.module.less +8 -2
  31. package/src/components/ChainGraph/_components/SearchSelect/index.tsx +18 -16
  32. package/src/components/ChainGraph/index.md +2 -1
  33. package/src/components/Chart/index.md +290 -17
  34. package/src/components/Chat/index.md +44 -1
  35. package/src/components/Checkbox/index.md +33 -1
  36. package/src/components/CodeMirror/index.md +1 -1
  37. package/src/components/Copy/index.md +1 -1
  38. package/src/components/DatePicker/index.md +41 -2
  39. package/src/components/DatePicker/index.module.less +1 -0
  40. package/src/components/Descriptions/index.md +1 -1
  41. package/src/components/Editor/index.md +1 -1
  42. package/src/components/FileCol/index.md +1 -1
  43. package/src/components/FilePreview/index.md +1 -1
  44. package/src/components/FlexFill/index.md +1 -1
  45. package/src/components/Form/index.md +88 -1
  46. package/src/components/FormItem/FormInput/FormPasswordStrength/index.module.less +12 -0
  47. package/src/components/FormItem/FormInput/FormPasswordStrength/index.tsx +2 -2
  48. package/src/components/FormItem/index.md +147 -92
  49. package/src/components/Icon/index.md +3 -1
  50. package/src/components/Input/Range/index.module.less +4 -4
  51. package/src/components/Input/index.md +115 -2
  52. package/src/components/Input/index.module.less +3 -0
  53. package/src/components/Markdown/index.md +3 -1
  54. package/src/components/Modal/index.md +1 -1
  55. package/src/components/Operate/index.md +1 -1
  56. package/src/components/Panel/index.md +68 -21
  57. package/src/components/Search/index.md +184 -9
  58. package/src/components/SecondConf/index.md +1 -1
  59. package/src/components/Select/_utils/getElementPosition.ts +8 -6
  60. package/src/components/Select/index.md +1 -1
  61. package/src/components/Select/index.module.less +3 -0
  62. package/src/components/Slider/index.md +1 -2
  63. package/src/components/Slider/index.module.less +1 -0
  64. package/src/components/Spreadsheet/index.md +1 -1
  65. package/src/components/Switch/index.md +1 -1
  66. package/src/components/Switch/index.module.less +7 -0
  67. package/src/components/Switch/index.tsx +14 -11
  68. package/src/components/TabBar/index.md +28 -11
  69. package/src/components/Table/index.md +1 -1
  70. package/src/components/Tags/index.md +1 -1
  71. package/src/components/TextEllipsis/index.md +1 -1
  72. package/src/components/Tree/index.md +1 -1
  73. package/src/components/Upload/index.md +1 -1
@@ -1,6 +1,7 @@
1
1
  import { SwitchProps as AntSwitchProps, Switch as AntSwitch } from "antd";
2
2
  import React from "react";
3
3
  import { SelectOption } from "../Select";
4
+ import styles from "./index.module.less";
4
5
 
5
6
  export interface SwitchProps extends AntSwitchProps {
6
7
  options?: SelectOption[];
@@ -19,17 +20,19 @@ const Switch: React.FC<SwitchProps> = (props) => {
19
20
  } = props;
20
21
 
21
22
  return (
22
- <AntSwitch
23
- {...rest}
24
- checkedChildren={
25
- checkedChildren ||
26
- options?.find((item) => item.value === trueValue)?.label
27
- }
28
- unCheckedChildren={
29
- unCheckedChildren ||
30
- options?.find((item) => item.value === falseValue)?.label
31
- }
32
- />
23
+ <span className={styles.SwitchWrapper}>
24
+ <AntSwitch
25
+ {...rest}
26
+ checkedChildren={
27
+ checkedChildren ||
28
+ options?.find((item) => item.value === trueValue)?.label
29
+ }
30
+ unCheckedChildren={
31
+ unCheckedChildren ||
32
+ options?.find((item) => item.value === falseValue)?.label
33
+ }
34
+ />
35
+ </span>
33
36
  );
34
37
  };
35
38
 
@@ -16,7 +16,7 @@ title: TabBar 标签栏
16
16
  import { TabBar } from "@hsu-react/ui";
17
17
  ```
18
18
 
19
- ## 基础用法
19
+ ## 默认样式
20
20
 
21
21
  通过 `tabGroup` 配置页签,`onTabChange` 监听切换。
22
22
 
@@ -24,6 +24,27 @@ import { TabBar } from "@hsu-react/ui";
24
24
  import React, { useState } from "react";
25
25
  import { TabBar } from "@hsu-react/ui";
26
26
 
27
+ export default () => {
28
+ const [tab, setTab] = useState<string | number>("1");
29
+
30
+ const tabGroup = [
31
+ { title: "全部", key: "1" },
32
+ { title: "进行中", key: "2" },
33
+ { title: "已完成", key: "3" },
34
+ ];
35
+
36
+ return <TabBar tabGroup={tabGroup} tab={tab} onTabChange={setTab} />;
37
+ };
38
+ ```
39
+
40
+ ## 描边样式
41
+
42
+ `variant="outline"` 渲染为描边胶囊样式。
43
+
44
+ ```tsx
45
+ import React, { useState } from "react";
46
+ import { TabBar } from "@hsu-react/ui";
47
+
27
48
  export default () => {
28
49
  const [tab, setTab] = useState<string | number>("1");
29
50
 
@@ -34,16 +55,12 @@ export default () => {
34
55
  ];
35
56
 
36
57
  return (
37
- <div>
38
- <TabBar tabGroup={tabGroup} tab={tab} onTabChange={setTab} />
39
- <TabBar
40
- variant="outline"
41
- tabGroup={tabGroup}
42
- defaultTab="1"
43
- className="demo-tabbar-outline"
44
- />
45
- <p style={{ marginTop: 12 }}>当前选中:{tab}</p>
46
- </div>
58
+ <TabBar
59
+ variant="outline"
60
+ tabGroup={tabGroup}
61
+ tab={tab}
62
+ onTabChange={setTab}
63
+ />
47
64
  );
48
65
  };
49
66
  ```
@@ -16,7 +16,7 @@ title: Table 表格
16
16
  import { Table } from "@hsu-react/ui";
17
17
  ```
18
18
 
19
- ## 基础用法
19
+ ## 表格
20
20
 
21
21
  ```tsx
22
22
  import React from "react";
@@ -16,7 +16,7 @@ title: Tags 标签
16
16
  import { Tags } from "@hsu-react/ui";
17
17
  ```
18
18
 
19
- ## 基础用法
19
+ ## 标签
20
20
 
21
21
  ```tsx
22
22
  import React from "react";
@@ -16,7 +16,7 @@ title: TextEllipsis 文本省略
16
16
  import { TextEllipsis } from "@hsu-react/ui";
17
17
  ```
18
18
 
19
- ## 基础用法
19
+ ## 文本省略
20
20
 
21
21
  ```tsx
22
22
  import React from "react";
@@ -16,7 +16,7 @@ title: Tree 树形控件
16
16
  import { Tree } from "@hsu-react/ui";
17
17
  ```
18
18
 
19
- ## 基础用法
19
+ ## 树形控件
20
20
 
21
21
  通过 `treeData` 传入树数据,开启 `search` 即可在标题栏内搜索过滤节点。
22
22
 
@@ -16,7 +16,7 @@ title: Upload 上传
16
16
  import { Upload } from "@hsu-react/ui";
17
17
  ```
18
18
 
19
- ## 基础用法
19
+ ## 上传
20
20
 
21
21
  > 演示用的 `action` 为占位地址,真实使用时需替换为可用的上传接口(普通上传用 `action`,分片上传用 `chunkAction` / `mergeChunkAction`)。
22
22