lingee-ui 0.0.6 → 0.0.7

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 (100) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/dist/button/index.css +1 -1
  3. package/dist/button/index.d.mts +1 -1
  4. package/dist/button/index.d.ts +1 -1
  5. package/dist/button/index.js +1 -1
  6. package/dist/button/index.mjs +1 -1
  7. package/dist/chunk-7F53VFM6.mjs +1 -0
  8. package/dist/chunk-FQRDHJQZ.mjs +1 -0
  9. package/dist/chunk-JKY43GCS.mjs +1 -0
  10. package/dist/chunk-KQ733636.mjs +1 -0
  11. package/dist/chunk-KT3HSLBA.js +1 -0
  12. package/dist/chunk-P56ABRDC.js +1 -0
  13. package/dist/chunk-PQVYDWUK.js +1 -0
  14. package/dist/chunk-RM4W5RV7.mjs +1 -0
  15. package/dist/{chunk-MUKM5CN4.js → chunk-SXHF5CXB.js} +1 -1
  16. package/dist/chunk-T5QR25R6.js +1 -0
  17. package/dist/{index-B4ySDWo5.d.mts → index-BVXwKHfX.d.mts} +2 -2
  18. package/dist/{index-B4ySDWo5.d.ts → index-BVXwKHfX.d.ts} +2 -2
  19. package/dist/index.css +1 -1
  20. package/dist/index.d.mts +434 -111
  21. package/dist/index.d.ts +434 -111
  22. package/dist/index.js +2 -2
  23. package/dist/index.mjs +2 -2
  24. package/dist/input/index.css +1 -1
  25. package/dist/input/index.d.mts +9 -3
  26. package/dist/input/index.d.ts +9 -3
  27. package/dist/input/index.js +1 -1
  28. package/dist/input/index.mjs +1 -1
  29. package/dist/popover/index.d.mts +6 -6
  30. package/dist/popover/index.d.ts +6 -6
  31. package/dist/switch/index.d.mts +2 -2
  32. package/dist/switch/index.d.ts +2 -2
  33. package/dist/tabs/index.css +1 -1
  34. package/dist/tabs/index.d.mts +10 -6
  35. package/dist/tabs/index.d.ts +10 -6
  36. package/dist/tabs/index.js +1 -1
  37. package/dist/tabs/index.mjs +1 -1
  38. package/dist/textarea/index.d.mts +2 -2
  39. package/dist/textarea/index.d.ts +2 -2
  40. package/dist/toast/index.css +1 -1
  41. package/dist/toast/index.js +1 -1
  42. package/dist/toast/index.mjs +1 -1
  43. package/dist/tokens.css +1 -1
  44. package/dist/tooltip/index.css +1 -1
  45. package/dist/tooltip/index.d.mts +6 -1
  46. package/dist/tooltip/index.d.ts +6 -1
  47. package/dist/tooltip/index.js +1 -1
  48. package/dist/tooltip/index.mjs +1 -1
  49. package/package.json +8 -3
  50. package/skill/AGENTS-SNIPPET.md +253 -0
  51. package/skill/SKILL.md +205 -0
  52. package/skill/VERSION.json +7 -0
  53. package/skill/references/components/alert.md +30 -0
  54. package/skill/references/components/avatar.md +45 -0
  55. package/skill/references/components/button.md +40 -0
  56. package/skill/references/components/checkbox.md +39 -0
  57. package/skill/references/components/color-picker.md +40 -0
  58. package/skill/references/components/date-picker.md +46 -0
  59. package/skill/references/components/dialog.md +68 -0
  60. package/skill/references/components/divider.md +30 -0
  61. package/skill/references/components/drawer.md +42 -0
  62. package/skill/references/components/dropdown.md +93 -0
  63. package/skill/references/components/empty.md +28 -0
  64. package/skill/references/components/flex.md +44 -0
  65. package/skill/references/components/form.md +57 -0
  66. package/skill/references/components/image.md +37 -0
  67. package/skill/references/components/input.md +33 -0
  68. package/skill/references/components/pagination.md +42 -0
  69. package/skill/references/components/popover.md +45 -0
  70. package/skill/references/components/progress.md +36 -0
  71. package/skill/references/components/radio.md +43 -0
  72. package/skill/references/components/range-picker.md +49 -0
  73. package/skill/references/components/scroll-area.md +50 -0
  74. package/skill/references/components/select.md +52 -0
  75. package/skill/references/components/sidebar.md +187 -0
  76. package/skill/references/components/skeleton.md +39 -0
  77. package/skill/references/components/slider.md +42 -0
  78. package/skill/references/components/spin.md +25 -0
  79. package/skill/references/components/steps.md +34 -0
  80. package/skill/references/components/switch.md +26 -0
  81. package/skill/references/components/table.md +44 -0
  82. package/skill/references/components/tabs.md +49 -0
  83. package/skill/references/components/tag.md +59 -0
  84. package/skill/references/components/textarea.md +30 -0
  85. package/skill/references/components/time-picker.md +49 -0
  86. package/skill/references/components/toast.md +47 -0
  87. package/skill/references/components/tooltip.md +33 -0
  88. package/skill/references/components/upload.md +38 -0
  89. package/skill/references/icons.md +1117 -0
  90. package/skill/references/setup.md +132 -0
  91. package/skill/references/tokens.md +201 -0
  92. package/dist/chunk-22G7TVQU.mjs +0 -1
  93. package/dist/chunk-3VTWGWRW.mjs +0 -1
  94. package/dist/chunk-BURKV6KR.js +0 -1
  95. package/dist/chunk-EWZCOQ5H.js +0 -1
  96. package/dist/chunk-I5FIN7UX.mjs +0 -1
  97. package/dist/chunk-LGFBC4UA.mjs +0 -1
  98. package/dist/chunk-U5VI5OCN.mjs +0 -1
  99. package/dist/chunk-WJXAQ3RX.js +0 -1
  100. package/dist/chunk-ZXRCMMQM.js +0 -1
@@ -0,0 +1,39 @@
1
+ # Checkbox 多选框
2
+
3
+ 在一组选项中进行多项选择。
4
+
5
+ - 导入:`import { Checkbox, CheckboxGroup } from "lingee-ui";`
6
+ - 可用类型:`CheckboxProps`, `CheckboxGroupProps`, `CheckboxSize`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Checkbox } from "lingee-ui";
12
+
13
+ export default function BasicDemo() {
14
+ return <Checkbox defaultChecked>I agree to the terms of service</Checkbox>;
15
+ }
16
+ ```
17
+
18
+ ## API
19
+
20
+ ### Checkbox
21
+
22
+ | 属性 | 说明 | 类型 | 默认值 |
23
+ |------|------|------|--------|
24
+ | `checked` | 选中状态(受控) | `boolean` | - |
25
+ | `defaultChecked` | 默认选中状态(非受控) | `boolean` | `false` |
26
+ | `indeterminate` | 半选状态 | `boolean` | `false` |
27
+ | `onChange` | 选中变更回调 | `(checked: boolean) => void` | - |
28
+ | `disabled` | 禁用 | `boolean` | `false` |
29
+ | `children` | label 内容 | `ReactNode` | - |
30
+
31
+ ### CheckboxGroup
32
+
33
+ | 属性 | 说明 | 类型 | 默认值 |
34
+ |------|------|------|--------|
35
+ | `value` | 当前选中值(受控) | `string[]` | - |
36
+ | `defaultValue` | 默认选中值(非受控) | `string[]` | `[]` |
37
+ | `onChange` | 选中值变更回调 | `(value: string[]) => void` | - |
38
+ | `disabled` | 禁用整组 | `boolean` | `false` |
39
+ | `orientation` | 排列方向 | `"horizontal" \| "vertical"` | `"vertical"` |
@@ -0,0 +1,40 @@
1
+ # ColorPicker 颜色选择器
2
+
3
+ 用于选择颜色值的交互组件。
4
+
5
+ - 导入:`import { ColorPicker } from "lingee-ui";`
6
+ - 可用类型:`ColorPickerProps`, `ColorPickerSize`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { useState } from "react";
12
+ import { ColorPicker } from "lingee-ui";
13
+
14
+ export default function BasicDemo() {
15
+ const [color, setColor] = useState("#495dff");
16
+
17
+ return (
18
+ <div style={{ width: 260 }}>
19
+ <ColorPicker value={color} onChange={setColor} />
20
+ <p style={{ marginTop: 12, fontSize: 14, color: "#666" }}>
21
+ Current color: {color}
22
+ </p>
23
+ </div>
24
+ );
25
+ }
26
+ ```
27
+
28
+ ## API
29
+
30
+ | 属性 | 说明 | 类型 | 默认值 |
31
+ |------|------|------|--------|
32
+ | `value` | 当前颜色值(受控) | `string` | - |
33
+ | `defaultValue` | 默认颜色值(非受控) | `string` | - |
34
+ | `onChange` | 颜色变化回调 | `(color: string) => void` | - |
35
+ | `disabled` | 是否禁用 | `boolean` | `false` |
36
+ | `disabledAlpha` | 是否禁用透明度 | `boolean` | `false` |
37
+ | `size` | 尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
38
+ | `error` | 是否显示错误状态 | `boolean` | `false` |
39
+ | `placement` | 面板弹出方向 | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` |
40
+ | `panelExtra` | 面板额外内容(如预设色板) | `ReactNode` | - |
@@ -0,0 +1,46 @@
1
+ # DatePicker 日期选择器
2
+
3
+ 用于选择日期的输入组件。
4
+
5
+ - 导入:`import { DatePicker } from "lingee-ui";`
6
+ - 可用类型:`DatePickerProps`, `DatePickerSize`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { useState } from "react";
12
+ import { DatePicker } from "lingee-ui";
13
+
14
+ export default function BasicDemo() {
15
+ const [value, setValue] = useState<Date | null>(null);
16
+
17
+ return (
18
+ <div style={{ width: 292 }}>
19
+ {/* 不传 placeholder,展示组件跟随 Provider 语言的默认占位符 */}
20
+ <DatePicker value={value} onChange={(v) => setValue(v)} />
21
+ <p style={{ marginTop: 12, fontSize: 14, color: "#666" }}>
22
+ {value ? value.toLocaleDateString() : "—"}
23
+ </p>
24
+ </div>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## API
30
+
31
+ | 属性 | 说明 | 类型 | 默认值 |
32
+ |------|------|------|--------|
33
+ | `value` | 当前日期(受控) | `Date \| null` | - |
34
+ | `defaultValue` | 默认日期(非受控) | `Date` | - |
35
+ | `onChange` | 日期变化回调 | `(date: Date \| null) => void` | - |
36
+ | `placeholder` | 占位文本 | `string` | `"年/月/日"` |
37
+ | `disabled` | 是否禁用 | `boolean` | `false` |
38
+ | `format` | 日期格式 | `string` | `"yyyy/MM/dd"` |
39
+ | `size` | 尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
40
+ | `error` | 是否显示错误状态 | `boolean` | `false` |
41
+ | `errorMessage` | 错误提示信息 | `string` | - |
42
+ | `disabledDate` | 禁用日期判断函数 | `(date: Date) => boolean` | - |
43
+ | `minDate` | 最小可选日期 | `Date` | - |
44
+ | `maxDate` | 最大可选日期 | `Date` | - |
45
+ | `allowClear` | 是否允许清除 | `boolean` | `true` |
46
+ | `showToday` | 是否显示今天按钮 | `boolean` | `true` |
@@ -0,0 +1,68 @@
1
+ # Dialog 弹出窗
2
+
3
+ 模态对话框,用于需要用户确认或填写信息的场景。支持声明式和命令式两种调用方式。
4
+
5
+ - 导入:`import { Dialog } from "lingee-ui";`
6
+ - 可用类型:`DialogProps`, `DialogConfirmOptions`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { useState } from "react";
12
+ import { Dialog, Button } from "lingee-ui";
13
+
14
+ export default function BasicDemo() {
15
+ const [open, setOpen] = useState(false);
16
+
17
+ return (
18
+ <>
19
+ <Button variant="primary" onClick={() => setOpen(true)}>
20
+ Open dialog
21
+ </Button>
22
+ <Dialog
23
+ open={open}
24
+ onOpenChange={setOpen}
25
+ title="Dialog title"
26
+ okText="OK"
27
+ cancelText="Cancel"
28
+ onOk={() => setOpen(false)}
29
+ onCancel={() => setOpen(false)}
30
+ >
31
+ <p style={{ padding: "0 20px", color: "rgba(0,0,0,0.64)" }}>
32
+ This is the dialog content area. You can put anything here.
33
+ </p>
34
+ </Dialog>
35
+ </>
36
+ );
37
+ }
38
+ ```
39
+
40
+ ## API
41
+
42
+ ### Dialog
43
+
44
+ | 属性 | 说明 | 类型 | 默认值 |
45
+ |------|------|------|--------|
46
+ | `open` | 是否打开 | `boolean` | - |
47
+ | `onOpenChange` | 打开状态变化回调 | `(open: boolean) => void` | - |
48
+ | `title` | 标题 | `ReactNode` | - |
49
+ | `description` | 描述文本 | `ReactNode` | - |
50
+ | `width` | 宽度 | `number` | `460` |
51
+ | `closable` | 是否显示关闭按钮 | `boolean` | `true` |
52
+ | `okText` | 确认按钮文本 | `string` | - |
53
+ | `cancelText` | 取消按钮文本 | `string` | - |
54
+ | `onOk` | 确认回调 | `() => void` | - |
55
+ | `onCancel` | 取消回调 | `() => void` | - |
56
+ | `children` | 内容区域 | `ReactNode` | - |
57
+
58
+ ### Dialog.confirm(options)
59
+
60
+ | 属性 | 说明 | 类型 | 默认值 |
61
+ |------|------|------|--------|
62
+ | `title` | 标题 | `ReactNode` | - |
63
+ | `description` | 描述内容 | `ReactNode` | - |
64
+ | `content` | 自定义内容 | `ReactNode` | - |
65
+ | `okText` | 确认按钮文本 | `string` | `"确定"` |
66
+ | `cancelText` | 取消按钮文本 | `string` | `"取消"` |
67
+ | `okDanger` | 确认按钮是否为危险样式 | `boolean` | `false` |
68
+ | `icon` | 自定义图标 | `ReactNode` | - |
@@ -0,0 +1,30 @@
1
+ # Divider 分割线
2
+
3
+ 用于分隔内容区块,使页面结构更清晰。
4
+
5
+ - 导入:`import { Divider } from "lingee-ui";`
6
+ - 可用类型:`DividerProps`, `DividerVariant`, `DividerOrientation`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Divider } from "lingee-ui";
12
+
13
+ export default function BasicDemo() {
14
+ return (
15
+ <div>
16
+ <p>Content above</p>
17
+ <Divider />
18
+ <p>Content below</p>
19
+ </div>
20
+ );
21
+ }
22
+ ```
23
+
24
+ ## API
25
+
26
+ | 属性 | 说明 | 类型 | 默认值 |
27
+ |------|------|------|--------|
28
+ | `orientation` | 分割线方向 | `"horizontal" \| "vertical"` | `"horizontal"` |
29
+ | `variant` | 颜色变体 | `"default" \| "muted" \| "emphasis"` | `"default"` |
30
+ | `spacing` | 外间距(px) | `number` | - |
@@ -0,0 +1,42 @@
1
+ # Drawer 抽屉
2
+
3
+ 从屏幕边缘滑出的浮层面板,用于承载表单或详情内容。
4
+
5
+ - 导入:`import { Drawer } from "lingee-ui";`
6
+ - 可用类型:`DrawerProps`, `DrawerPlacement`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { useState } from "react";
12
+ import { Drawer, Button } from "lingee-ui";
13
+
14
+ export default function BasicDemo() {
15
+ const [open, setOpen] = useState(false);
16
+
17
+ return (
18
+ <>
19
+ <Button onClick={() => setOpen(true)}>Open drawer</Button>
20
+ <Drawer open={open} onOpenChange={setOpen} title="Basic drawer">
21
+ <p>This is the drawer content area.</p>
22
+ <p>Click the mask or the close button to dismiss it.</p>
23
+ </Drawer>
24
+ </>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## API
30
+
31
+ | 属性 | 说明 | 类型 | 默认值 |
32
+ |------|------|------|--------|
33
+ | `open` | 是否打开 | `boolean` | - |
34
+ | `onOpenChange` | 打开状态变化回调 | `(open: boolean) => void` | - |
35
+ | `title` | 标题 | `ReactNode` | - |
36
+ | `placement` | 弹出方向 | `"left" \| "right" \| "top" \| "bottom"` | `"right"` |
37
+ | `size` | 宽度/高度(取决于方向) | `number` | `378` |
38
+ | `closable` | 是否显示关闭按钮 | `boolean` | `true` |
39
+ | `mask` | 是否显示遮罩 | `boolean` | `true` |
40
+ | `modal` | 是否为模态模式 | `boolean` | `false` |
41
+ | `footer` | 底部操作区 | `ReactNode` | - |
42
+ | `children` | 内容区域 | `ReactNode` | - |
@@ -0,0 +1,93 @@
1
+ # Dropdown 下拉菜单
2
+
3
+ 向下弹出的操作菜单列表,支持图标、分组、危险操作、子菜单等。
4
+
5
+ - 导入:`import { Dropdown, DropdownTrigger, DropdownContent, DropdownItem, DropdownCheckboxItem, DropdownRadioGroup, DropdownRadioItem, DropdownLabel, DropdownSeparator, DropdownGroup, DropdownSub, DropdownSubTrigger, DropdownSubContent, DropdownButton } from "lingee-ui";`
6
+ - 可用类型:`DropdownProps`, `DropdownTriggerProps`, `DropdownContentProps`, `DropdownItemProps`, `DropdownCheckboxItemProps`, `DropdownRadioGroupProps`, `DropdownRadioItemProps`, `DropdownLabelProps`, `DropdownSeparatorProps`, `DropdownGroupProps`, `DropdownSubProps`, `DropdownSubTriggerProps`, `DropdownSubContentProps`, `DropdownItemData`, `DropdownMenuItemData`, `DropdownSeparatorData`, `DropdownLabelData`, `DropdownButtonProps`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Dropdown, Button } from "lingee-ui";
12
+
13
+ export default function BasicDemo() {
14
+ return (
15
+ <Dropdown
16
+ items={[
17
+ { key: "edit", label: "Edit" },
18
+ { key: "copy", label: "Copy" },
19
+ { key: "share", label: "Share" },
20
+ ]}
21
+ >
22
+ <Button>Actions</Button>
23
+ </Dropdown>
24
+ );
25
+ }
26
+ ```
27
+
28
+ ## API
29
+
30
+ ### Dropdown
31
+
32
+ | 属性 | 说明 | 类型 | 默认值 |
33
+ |------|------|------|--------|
34
+ | `items` | 菜单项数据(快捷模式) | `DropdownItemData[]` | - |
35
+ | `open` | 受控打开状态 | `boolean` | - |
36
+ | `defaultOpen` | 非受控默认打开状态 | `boolean` | `false` |
37
+ | `onOpenChange` | 打开状态变化回调 | `(open: boolean) => void` | - |
38
+ | `modal` | 是否为模态弹出 | `boolean` | `true` |
39
+ | `disabled` | 是否禁用 | `boolean` | `false` |
40
+ | `selectedKeys` | 选中项 key 数组(显示勾选) | `string[]` | - |
41
+ | `children` | 触发器元素 | `ReactNode` | - |
42
+
43
+ ### DropdownContent
44
+
45
+ | 属性 | 说明 | 类型 | 默认值 |
46
+ |------|------|------|--------|
47
+ | `side` | 弹出方向 | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` |
48
+ | `align` | 对齐方式 | `"start" \| "center" \| "end"` | `"start"` |
49
+ | `sideOffset` | 侧向偏移 | `number` | `4` |
50
+ | `header` | 固定头部内容 | `ReactNode` | - |
51
+ | `footer` | 固定底部内容 | `ReactNode` | - |
52
+
53
+ ### DropdownItem
54
+
55
+ | 属性 | 说明 | 类型 | 默认值 |
56
+ |------|------|------|--------|
57
+ | `onSelect` | 选中回调 | `(event: Event) => void` | - |
58
+ | `disabled` | 是否禁用 | `boolean` | `false` |
59
+ | `danger` | 是否为危险操作(红色) | `boolean` | `false` |
60
+ | `icon` | 前缀图标 | `ReactNode` | - |
61
+ | `description` | 副标题描述(显示在主文本下方) | `ReactNode` | - |
62
+ | `selected` | 是否选中(显示勾选) | `boolean` | `false` |
63
+ | `children` | 菜单项内容 | `ReactNode` | - |
64
+
65
+ ## DropdownButton 触发器按钮
66
+
67
+ 统一的下拉触发器按钮组件,提供两种视觉态:
68
+ - **Default**:透明背景 + 深色文字,hover 时浅灰底
69
+ - **Selected**:蓝色浅底 + 蓝色文字,支持 hover 显示清除图标
70
+ - **Glassy**:半透明白底 + 描边,适用于有色背景
71
+
72
+ 适用于所有 Dropdown / Popover 的触发按钮,替代各处手写的 trigger button,确保高度、间距、hover 背景色统一。
73
+
74
+ <DemoBox source={dropdownButtonSource}>
75
+ <DropdownButtonDemo />
76
+ </DemoBox>
77
+
78
+ ### DropdownButton
79
+
80
+ | 属性 | 说明 | 类型 | 默认值 |
81
+ |------|------|------|--------|
82
+ | `children` | 按钮文本 | `ReactNode` | - |
83
+ | `variant` | 按钮变体 | `"default" \| "glassy"` | `"default"` |
84
+ | `size` | 尺寸 | `"sm" \| "lg"` | `"sm"` |
85
+ | `icon` | 前置图标 | `ReactNode` | - |
86
+ | `selected` | 是否已有选中内容(蓝色态) | `boolean` | `false` |
87
+ | `open` | 是否展开态(箭头旋转 180°) | `boolean` | `false` |
88
+ | `clearable` | hover 时是否显示清除图标 | `boolean` | `false` |
89
+ | `hideArrow` | 隐藏箭头(用于纯 toggle 按钮) | `boolean` | `false` |
90
+ | `disabled` | 是否禁用 | `boolean` | `false` |
91
+ | `onClear` | 清除回调 | `(e: MouseEvent) => void` | - |
92
+ | `onClick` | 点击回调 | `(e: MouseEvent) => void` | - |
93
+ | `className` | 额外类名 | `string` | - |
@@ -0,0 +1,28 @@
1
+ # Empty 空状态
2
+
3
+ 当目标区域无数据时展示的空状态占位图,引导用户进行下一步操作。
4
+
5
+ - 导入:`import { Empty } from "lingee-ui";`
6
+ - 可用类型:`EmptyProps`, `EmptySize`, `EmptyIconComponent`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Empty } from "lingee-ui";
12
+ import { Search } from "lingee-icon";
13
+
14
+ export default function BasicDemo() {
15
+ return <Empty icon={Search} description="No data" />;
16
+ }
17
+ ```
18
+
19
+ ## API
20
+
21
+ | 属性 | 说明 | 类型 | 默认值 |
22
+ |------|------|------|--------|
23
+ | `icon` | 图标:传 lingee-icon 组件自动注入渐变,传 ReactNode 完全自定义,不传使用默认图标 | `ComponentType<SvgIconProps> \| ReactNode` | 默认 DocumentLibrary |
24
+ | `description` | 描述文字 | `ReactNode` | - |
25
+ | `size` | 尺寸:`lg` 页面级 / `md` 局部(默认)/ `sm` 迷你 | `"sm" \| "md" \| "lg"` | `"md"` |
26
+ | `children` | 自定义底部内容(如操作按钮) | `ReactNode` | - |
27
+ | `className` | 自定义类名 | `string` | - |
28
+ | `style` | 自定义内联样式 | `CSSProperties` | - |
@@ -0,0 +1,44 @@
1
+ # Flex 弹性布局
2
+
3
+ 弹性布局容器,用于快速搭建横向/纵向排列,避免为简单布局单独写样式文件。
4
+
5
+ - 导入:`import { Flex } from "lingee-ui";`
6
+ - 可用类型:`FlexProps`, `FlexOrientation`, `FlexGapSize`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Flex, Button } from "lingee-ui";
12
+
13
+ export default function BasicDemo() {
14
+ return (
15
+ <Flex gap="small" align="center">
16
+ <Button variant="primary">OK</Button>
17
+ <Button>Cancel</Button>
18
+ </Flex>
19
+ );
20
+ }
21
+ ```
22
+
23
+ ## API
24
+
25
+ | 属性 | 说明 | 类型 | 默认值 |
26
+ |------|------|------|--------|
27
+ | `vertical` | 主轴方向是否垂直(等价 `flex-direction: column`) | `boolean` | `false` |
28
+ | `orientation` | 主轴方向,与 `vertical` 同时存在时 `vertical` 优先 | `"horizontal" \| "vertical"` | `"horizontal"` |
29
+ | `wrap` | 是否换行,布尔值为 `wrap` / `nowrap` 简写 | `boolean \| CSSProperties["flexWrap"]` | `"nowrap"` |
30
+ | `justify` | 主轴对齐方式 | `CSSProperties["justifyContent"]` | - |
31
+ | `align` | 交叉轴对齐方式 | `CSSProperties["alignItems"]` | - |
32
+ | `flex` | `flex` CSS 简写 | `CSSProperties["flex"]` | - |
33
+ | `gap` | 间隙,预设值映射设计间距 Token,也可传自定义数值/字符串 | `"small" \| "medium" \| "large" \| string \| number` | - |
34
+ | `component` | 自定义渲染的元素类型 | `React.ElementType` | `"div"` |
35
+
36
+ 其余原生 `HTMLAttributes` 均可透传。
37
+
38
+ ### gap 预设
39
+
40
+ | 值 | 对应 Token |
41
+ |----|-----------|
42
+ | `small` | `--lg-spacing-x-small` |
43
+ | `medium` | `--lg-spacing-medium` |
44
+ | `large` | `--lg-spacing-large` |
@@ -0,0 +1,57 @@
1
+ # Form 表单
2
+
3
+ 数据录入和校验组件,支持垂直、水平、行内布局。
4
+
5
+ - 导入:`import { Form } from "lingee-ui";`
6
+ - 可用类型:`FormProps`, `FormItemProps`, `FormInstance`, `FormLayout`, `Rule`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Form, Input, Button } from "lingee-ui";
12
+
13
+ export default function BasicDemo() {
14
+ return (
15
+ <Form layout="vertical" onFinish={(values) => console.log(values)}>
16
+ <Form.Item label="Username" name="username" required>
17
+ <Input placeholder="Enter your username" />
18
+ </Form.Item>
19
+ <Form.Item label="Password" name="password" required>
20
+ <Input type="password" placeholder="Enter your password" />
21
+ </Form.Item>
22
+ <Form.Item>
23
+ <Button variant="primary" htmlType="submit">
24
+ Submit
25
+ </Button>
26
+ </Form.Item>
27
+ </Form>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ## API
33
+
34
+ ### Form
35
+
36
+ | 属性 | 说明 | 类型 | 默认值 |
37
+ |------|------|------|--------|
38
+ | `layout` | 表单布局 | `"vertical" \| "horizontal" \| "inline"` | `"vertical"` |
39
+ | `labelWidth` | 标签宽度(水平布局时) | `number` | - |
40
+ | `initialValues` | 表单初始值 | `Record<string, any>` | - |
41
+ | `form` | Form 实例(useForm 创建) | `FormInstance` | - |
42
+ | `onFinish` | 提交且校验通过回调 | `(values) => void` | - |
43
+ | `onFinishFailed` | 校验失败回调 | `() => void` | - |
44
+
45
+ ### Form.Item
46
+
47
+ | 属性 | 说明 | 类型 | 默认值 |
48
+ |------|------|------|--------|
49
+ | `label` | 标签文本 | `ReactNode` | - |
50
+ | `name` | 字段名 | `string` | - |
51
+ | `required` | 是否必填 | `boolean` | `false` |
52
+ | `rules` | 校验规则 | `Rule[]` | - |
53
+ | `valuePropName` | 值属性名 | `string` | `"value"` |
54
+
55
+ ### Form.useForm
56
+
57
+ 返回 `[form]` 实例,提供 `resetFields()`、`setFieldsValue()`、`getFieldsValue()` 等方法。
@@ -0,0 +1,37 @@
1
+ # Image 图片预览
2
+
3
+ 图片展示组件,支持点击放大预览、旋转、缩放等操作。
4
+
5
+ - 导入:`import { Image } from "lingee-ui";`
6
+ - 可用类型:`ImageProps`, `PreviewType`, `ImagePreviewGroupProps`, `PreviewGroupType`, `CoverConfig`, `TransformType`, `TransformAction`, `ImgInfo`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Image } from "lingee-ui";
12
+
13
+ export default function BasicDemo() {
14
+ return (
15
+ <Image
16
+ src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
17
+ alt="Sample image"
18
+ width={200}
19
+ height={200}
20
+ style={{ objectFit: "cover", borderRadius: 8 }}
21
+ />
22
+ );
23
+ }
24
+ ```
25
+
26
+ ## API
27
+
28
+ | 属性 | 说明 | 类型 | 默认值 |
29
+ |------|------|------|--------|
30
+ | `src` | 图片地址 | `string` | - |
31
+ | `alt` | 替代文本 | `string` | - |
32
+ | `width` | 宽度 | `number \| string` | - |
33
+ | `height` | 高度 | `number \| string` | - |
34
+ | `preview` | 预览配置,`false` 禁用预览 | `boolean \| { src?, cover?, open?, onOpenChange? }` | `true` |
35
+ | `fallback` | 加载失败兜底图地址 | `string` | - |
36
+ | `placeholder` | 加载占位 | `boolean \| ReactNode \| { progress }` | - |
37
+ | `style` | 自定义样式 | `CSSProperties` | - |
@@ -0,0 +1,33 @@
1
+ # Input 输入框
2
+
3
+ 用于接收用户的文本输入。
4
+
5
+ - 导入:`import { Input } from "lingee-ui";`
6
+ - 可用类型:`InputProps`, `InputSize`, `InputShape`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { Input } from "lingee-ui";
12
+
13
+ export default function BasicDemo() {
14
+ return <Input placeholder="Enter text" />;
15
+ }
16
+ ```
17
+
18
+ ## API
19
+
20
+ | 属性 | 说明 | 类型 | 默认值 |
21
+ |------|------|------|--------|
22
+ | `size` | 输入框尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
23
+ | `shape` | 输入框形状 | `"default" \| "round"` | `"default"` |
24
+ | `prefix` | 前缀内容 | `ReactNode` | - |
25
+ | `suffix` | 后缀内容 | `ReactNode` | - |
26
+ | `allowClear` | 是否显示清空按钮 | `boolean` | `false` |
27
+ | `error` | 错误状态 | `boolean` | `false` |
28
+ | `disabled` | 禁用状态 | `boolean` | `false` |
29
+ | `collapsed` | 折叠为正方形,仅展示单个插槽;受控,展开时机由 `onClick` 自行处理 | `boolean` | `false` |
30
+ | `onPressEnter` | 按下 Enter 键回调 | `(e: KeyboardEvent) => void` | - |
31
+ | `placeholder` | 占位提示文字 | `string` | - |
32
+ | `value` | 输入值(受控) | `string` | - |
33
+ | `onChange` | 值变更回调 | `(e: ChangeEvent) => void` | - |
@@ -0,0 +1,42 @@
1
+ # Pagination 分页
2
+
3
+ 当数据量较大时,使用分页拆分数据,方便用户快速定位。
4
+
5
+ - 导入:`import { Pagination } from "lingee-ui";`
6
+ - 可用类型:`PaginationProps`, `PaginationVariant`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { useState } from "react";
12
+ import { Pagination } from "lingee-ui";
13
+
14
+ export default function BasicDemo() {
15
+ const [current, setCurrent] = useState(1);
16
+
17
+ return (
18
+ <Pagination
19
+ total={100}
20
+ current={current}
21
+ pageSize={10}
22
+ showTotal
23
+ onChange={(page) => setCurrent(page)}
24
+ />
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## API
30
+
31
+ | 属性 | 说明 | 类型 | 默认值 |
32
+ |------|------|------|--------|
33
+ | `total` | 数据总条数 | `number` | `0` |
34
+ | `current` | 当前页码(受控) | `number` | - |
35
+ | `defaultCurrent` | 默认页码 | `number` | `1` |
36
+ | `pageSize` | 每页条数 | `number` | `20` |
37
+ | `onChange` | 页码变化回调 | `(page: number, pageSize: number) => void` | - |
38
+ | `showTotal` | 是否显示总条数 | `boolean` | `false` |
39
+ | `showSizeChanger` | 是否显示每页条数切换 | `boolean` | `false` |
40
+ | `showQuickJumper` | 是否显示快速跳转 | `boolean` | `false` |
41
+ | `variant` | 样式变体 | `"simple" \| "bordered" \| "borderless"` | `"bordered"` |
42
+ | `disabled` | 是否禁用 | `boolean` | `false` |
@@ -0,0 +1,45 @@
1
+ # Popover 气泡弹出层
2
+
3
+ 点击/悬停在元素上时弹出气泡式浮层,用于承载更多内容。
4
+
5
+ - 导入:`import { Popover, PopoverTrigger, PopoverAnchor, PopoverContent, PopoverArrow, PopoverClose } from "lingee-ui";`
6
+ - 按需导入:`import { Popover } from "lingee-ui/popover";`
7
+ - 可用类型:`PopoverProps`, `PopoverTriggerProps`, `PopoverAnchorProps`, `PopoverContentProps`, `PopoverArrowProps`, `PopoverCloseProps`, `PopoverPlacement`
8
+
9
+ ## 最小示例
10
+
11
+ ```tsx
12
+ import { Popover, PopoverTrigger, PopoverContent, Button } from "lingee-ui";
13
+
14
+ export default function BasicDemo() {
15
+ return (
16
+ <Popover>
17
+ <PopoverTrigger>
18
+ <Button>Click me</Button>
19
+ </PopoverTrigger>
20
+ <PopoverContent>
21
+ <p style={{ margin: 0 }}>This is the content of the popover.</p>
22
+ </PopoverContent>
23
+ </Popover>
24
+ );
25
+ }
26
+ ```
27
+
28
+ ## API
29
+
30
+ ### Popover
31
+
32
+ | 属性 | 说明 | 类型 | 默认值 |
33
+ |------|------|------|--------|
34
+ | `open` | 受控打开状态 | `boolean` | - |
35
+ | `onOpenChange` | 打开状态变化回调 | `(open: boolean) => void` | - |
36
+ | `modal` | 是否为模态模式 | `boolean` | `false` |
37
+ | `children` | 子元素(Trigger + Content) | `ReactNode` | - |
38
+
39
+ ### PopoverContent
40
+
41
+ | 属性 | 说明 | 类型 | 默认值 |
42
+ |------|------|------|--------|
43
+ | `side` | 弹出方向 | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` |
44
+ | `align` | 对齐方式 | `"start" \| "center" \| "end"` | `"center"` |
45
+ | `sideOffset` | 弹出层与触发器的间距 | `number` | `4` |