@teamix-evo/ui 0.1.1 → 0.2.0
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/README.md +1 -1
- package/package.json +8 -4
- package/src/components/accordion/accordion.meta.md +10 -5
- package/src/components/accordion/accordion.stories.tsx +11 -6
- package/src/components/affix/affix.meta.md +19 -10
- package/src/components/affix/affix.stories.tsx +4 -2
- package/src/components/alert/alert.meta.md +19 -14
- package/src/components/alert/alert.stories.tsx +1 -1
- package/src/components/alert/alert.tsx +5 -5
- package/src/components/alert-dialog/alert-dialog.meta.md +23 -10
- package/src/components/alert-dialog/alert-dialog.stories.tsx +1 -1
- package/src/components/alert-dialog/alert-dialog.tsx +1 -1
- package/src/components/anchor/anchor.meta.md +20 -11
- package/src/components/anchor/anchor.stories.tsx +1 -1
- package/src/components/app/app.meta.md +19 -10
- package/src/components/app/app.stories.tsx +4 -2
- package/src/components/aspect-ratio/aspect-ratio.meta.md +10 -5
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +1 -1
- package/src/components/auto-complete/auto-complete.meta.md +25 -16
- package/src/components/auto-complete/auto-complete.stories.tsx +4 -2
- package/src/components/avatar/avatar.meta.md +23 -11
- package/src/components/avatar/avatar.stories.tsx +1 -1
- package/src/components/badge/badge.meta.md +26 -21
- package/src/components/badge/badge.tsx +7 -13
- package/src/components/breadcrumb/breadcrumb.meta.md +21 -10
- package/src/components/breadcrumb/breadcrumb.stories.tsx +8 -0
- package/src/components/button/button.meta.md +22 -17
- package/src/components/button/button.stories.tsx +1 -1
- package/src/components/button/demo/as-child.tsx +24 -0
- package/src/components/button/demo/basic.tsx +8 -0
- package/src/components/button/demo/block.tsx +16 -0
- package/src/components/button/demo/loading.tsx +19 -0
- package/src/components/button/demo/shapes.tsx +18 -0
- package/src/components/button/demo/sizes.tsx +19 -0
- package/src/components/button/demo/variants.tsx +19 -0
- package/src/components/button/demo/with-icon.tsx +20 -0
- package/src/components/button-group/button-group.meta.md +18 -9
- package/src/components/button-group/button-group.stories.tsx +5 -2
- package/src/components/calendar/calendar.meta.md +14 -9
- package/src/components/calendar/calendar.stories.tsx +1 -1
- package/src/components/calendar/calendar.tsx +1 -1
- package/src/components/card/card.meta.md +36 -11
- package/src/components/card/card.stories.tsx +8 -0
- package/src/components/carousel/carousel.meta.md +16 -11
- package/src/components/carousel/carousel.stories.tsx +10 -5
- package/src/components/cascader/cascader.meta.md +28 -19
- package/src/components/cascader/cascader.stories.tsx +9 -8
- package/src/components/cascader/cascader.tsx +2 -2
- package/src/components/checkbox/checkbox.meta.md +26 -8
- package/src/components/checkbox/checkbox.stories.tsx +1 -1
- package/src/components/collapsible/collapsible.meta.md +11 -4
- package/src/components/collapsible/collapsible.stories.tsx +8 -0
- package/src/components/color-picker/color-picker.meta.md +27 -18
- package/src/components/color-picker/color-picker.stories.tsx +1 -1
- package/src/components/color-picker/color-picker.tsx +1 -0
- package/src/components/combobox/combobox.meta.md +29 -20
- package/src/components/combobox/combobox.stories.tsx +1 -1
- package/src/components/combobox/combobox.tsx +3 -3
- package/src/components/command/command.meta.md +32 -12
- package/src/components/command/command.stories.tsx +1 -1
- package/src/components/command/command.tsx +1 -1
- package/src/components/context-menu/context-menu.meta.md +34 -11
- package/src/components/context-menu/context-menu.stories.tsx +8 -0
- package/src/components/context-menu/context-menu.tsx +2 -2
- package/src/components/data-table/data-table.meta.md +24 -19
- package/src/components/data-table/data-table.stories.tsx +12 -5
- package/src/components/date-picker/date-picker.meta.md +40 -20
- package/src/components/date-picker/date-picker.stories.tsx +1 -1
- package/src/components/descriptions/descriptions.meta.md +23 -14
- package/src/components/descriptions/descriptions.stories.tsx +1 -1
- package/src/components/dialog/dialog.meta.md +25 -12
- package/src/components/dialog/dialog.stories.tsx +1 -1
- package/src/components/dialog/dialog.tsx +1 -1
- package/src/components/drawer/drawer.meta.md +19 -8
- package/src/components/drawer/drawer.stories.tsx +1 -1
- package/src/components/drawer/drawer.tsx +1 -0
- package/src/components/dropdown-menu/dropdown-menu.meta.md +42 -14
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +8 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +2 -2
- package/src/components/empty/empty.meta.md +20 -11
- package/src/components/empty/empty.stories.tsx +1 -1
- package/src/components/field/field.meta.md +27 -10
- package/src/components/field/field.stories.tsx +6 -3
- package/src/components/flex/flex.meta.md +23 -14
- package/src/components/flex/flex.stories.tsx +46 -14
- package/src/components/float-button/float-button.meta.md +35 -11
- package/src/components/float-button/float-button.stories.tsx +4 -2
- package/src/components/float-button/float-button.tsx +1 -1
- package/src/components/form/form.meta.md +57 -14
- package/src/components/form/form.stories.tsx +1 -1
- package/src/components/grid/grid.meta.md +31 -6
- package/src/components/grid/grid.stories.tsx +4 -2
- package/src/components/hover-card/hover-card.meta.md +21 -9
- package/src/components/hover-card/hover-card.stories.tsx +6 -2
- package/src/components/image/image.meta.md +24 -15
- package/src/components/image/image.stories.tsx +1 -1
- package/src/components/image/image.tsx +4 -4
- package/src/components/input/demo/addon.tsx +15 -0
- package/src/components/input/demo/basic.tsx +12 -0
- package/src/components/input/demo/clearable.tsx +21 -0
- package/src/components/input/demo/show-count.tsx +18 -0
- package/src/components/input/demo/sizes.tsx +15 -0
- package/src/components/input/demo/with-prefix-suffix.tsx +19 -0
- package/src/components/input/input.meta.md +21 -16
- package/src/components/input/input.stories.tsx +1 -1
- package/src/components/input/input.tsx +51 -47
- package/src/components/input-group/input-group.meta.md +26 -8
- package/src/components/input-group/input-group.stories.tsx +1 -1
- package/src/components/input-group/input-group.tsx +4 -3
- package/src/components/input-number/input-number.meta.md +26 -17
- package/src/components/input-number/input-number.stories.tsx +14 -3
- package/src/components/input-number/input-number.tsx +20 -6
- package/src/components/input-otp/input-otp.meta.md +22 -9
- package/src/components/input-otp/input-otp.stories.tsx +1 -1
- package/src/components/item/item.meta.md +32 -9
- package/src/components/item/item.stories.tsx +5 -2
- package/src/components/kbd/kbd.meta.md +29 -8
- package/src/components/kbd/kbd.stories.tsx +1 -1
- package/src/components/kbd/kbd.tsx +2 -1
- package/src/components/label/label.meta.md +14 -9
- package/src/components/masonry/masonry.meta.md +18 -9
- package/src/components/masonry/masonry.stories.tsx +4 -2
- package/src/components/masonry/masonry.tsx +1 -0
- package/src/components/mentions/mentions.meta.md +28 -19
- package/src/components/mentions/mentions.stories.tsx +1 -1
- package/src/components/mentions/mentions.tsx +2 -1
- package/src/components/menubar/menubar.meta.md +36 -14
- package/src/components/menubar/menubar.stories.tsx +8 -0
- package/src/components/menubar/menubar.tsx +2 -2
- package/src/components/native-select/native-select.meta.md +17 -8
- package/src/components/native-select/native-select.stories.tsx +6 -3
- package/src/components/navigation-menu/navigation-menu.meta.md +25 -11
- package/src/components/navigation-menu/navigation-menu.stories.tsx +11 -11
- package/src/components/navigation-menu/navigation-menu.tsx +3 -2
- package/src/components/notification/notification.meta.md +14 -5
- package/src/components/notification/notification.stories.tsx +5 -3
- package/src/components/notification/notification.tsx +3 -3
- package/src/components/pagination/pagination.meta.md +59 -28
- package/src/components/pagination/pagination.stories.tsx +9 -3
- package/src/components/popconfirm/popconfirm.meta.md +30 -21
- package/src/components/popconfirm/popconfirm.stories.tsx +1 -2
- package/src/components/popconfirm/popconfirm.tsx +1 -1
- package/src/components/popover/popover.meta.md +13 -8
- package/src/components/popover/popover.stories.tsx +1 -1
- package/src/components/progress/progress.meta.md +28 -13
- package/src/components/progress/progress.stories.tsx +1 -1
- package/src/components/progress/progress.tsx +6 -6
- package/src/components/radio-group/radio-group.meta.md +17 -12
- package/src/components/radio-group/radio-group.stories.tsx +1 -1
- package/src/components/rate/rate.meta.md +25 -16
- package/src/components/rate/rate.stories.tsx +11 -3
- package/src/components/rate/rate.tsx +2 -2
- package/src/components/resizable/resizable.meta.md +19 -8
- package/src/components/resizable/resizable.stories.tsx +1 -1
- package/src/components/result/result.meta.md +21 -12
- package/src/components/result/result.stories.tsx +2 -6
- package/src/components/result/result.tsx +3 -3
- package/src/components/scroll-area/scroll-area.meta.md +10 -5
- package/src/components/scroll-area/scroll-area.stories.tsx +8 -0
- package/src/components/scroll-area/scroll-area.tsx +3 -3
- package/src/components/segmented/segmented.meta.md +19 -14
- package/src/components/segmented/segmented.stories.tsx +35 -6
- package/src/components/select/select.meta.md +22 -9
- package/src/components/select/select.stories.tsx +1 -1
- package/src/components/select/select.tsx +2 -2
- package/src/components/separator/separator.meta.md +16 -11
- package/src/components/separator/separator.stories.tsx +1 -1
- package/src/components/sheet/sheet.meta.md +22 -11
- package/src/components/sheet/sheet.stories.tsx +1 -1
- package/src/components/sidebar/sidebar.meta.md +47 -18
- package/src/components/sidebar/sidebar.stories.tsx +10 -5
- package/src/components/skeleton/skeleton.meta.md +33 -10
- package/src/components/skeleton/skeleton.stories.tsx +1 -1
- package/src/components/slider/slider.meta.md +12 -7
- package/src/components/slider/slider.stories.tsx +1 -1
- package/src/components/sonner/sonner.meta.md +8 -3
- package/src/components/sonner/sonner.stories.tsx +13 -8
- package/src/components/space/space.meta.md +22 -13
- package/src/components/space/space.stories.tsx +20 -6
- package/src/components/spinner/spinner.meta.md +23 -10
- package/src/components/spinner/spinner.stories.tsx +1 -1
- package/src/components/statistic/statistic.meta.md +37 -16
- package/src/components/statistic/statistic.stories.tsx +2 -6
- package/src/components/statistic/statistic.tsx +1 -1
- package/src/components/steps/steps.meta.md +21 -12
- package/src/components/steps/steps.stories.tsx +7 -2
- package/src/components/switch/switch.meta.md +16 -11
- package/src/components/switch/switch.stories.tsx +1 -1
- package/src/components/switch/switch.tsx +58 -36
- package/src/components/table/table.meta.md +24 -9
- package/src/components/table/table.stories.tsx +9 -4
- package/src/components/tabs/tabs.meta.md +14 -9
- package/src/components/tabs/tabs.stories.tsx +8 -0
- package/src/components/tag/tag.meta.md +39 -10
- package/src/components/tag/tag.stories.tsx +7 -2
- package/src/components/tag/tag.tsx +3 -3
- package/src/components/textarea/textarea.meta.md +17 -12
- package/src/components/textarea/textarea.stories.tsx +1 -1
- package/src/components/textarea/textarea.tsx +1 -1
- package/src/components/time-picker/time-picker.meta.md +38 -15
- package/src/components/time-picker/time-picker.stories.tsx +44 -6
- package/src/components/time-picker/time-picker.tsx +74 -10
- package/src/components/timeline/timeline.meta.md +20 -11
- package/src/components/timeline/timeline.stories.tsx +14 -4
- package/src/components/timeline/timeline.tsx +3 -2
- package/src/components/toggle/toggle.meta.md +14 -9
- package/src/components/toggle/toggle.stories.tsx +1 -1
- package/src/components/toggle-group/toggle-group.meta.md +16 -11
- package/src/components/toggle-group/toggle-group.stories.tsx +1 -1
- package/src/components/tooltip/tooltip.meta.md +18 -13
- package/src/components/tooltip/tooltip.stories.tsx +1 -1
- package/src/components/tour/tour.meta.md +25 -16
- package/src/components/tour/tour.stories.tsx +1 -1
- package/src/components/tour/tour.tsx +1 -1
- package/src/components/transfer/transfer.meta.md +29 -20
- package/src/components/transfer/transfer.stories.tsx +2 -6
- package/src/components/tree/tree.meta.md +36 -23
- package/src/components/tree/tree.stories.tsx +30 -11
- package/src/components/tree-select/tree-select.meta.md +37 -22
- package/src/components/tree-select/tree-select.stories.tsx +1 -1
- package/src/components/tree-select/tree-select.tsx +1 -1
- package/src/components/typography/typography.meta.md +41 -16
- package/src/components/typography/typography.stories.tsx +4 -8
- package/src/components/typography/typography.tsx +5 -3
- package/src/components/upload/upload.meta.md +31 -22
- package/src/components/upload/upload.stories.tsx +8 -14
- package/src/components/watermark/watermark.meta.md +26 -17
- package/src/components/watermark/watermark.stories.tsx +4 -2
- package/src/components/watermark/watermark.tsx +1 -0
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Source-injected UI components for Teamix Evo. Based on shadcn/ui, extended with
|
|
|
9
9
|
- **Source injection**: components ship as `.tsx` files, not as a runtime library. `npx teamix-evo ui add button` copies `button.tsx` into the user project under `aliases.components`.
|
|
10
10
|
- **First consumer of `@teamix-evo/design`**: the dev server imports OpenTrek tokens directly from the design package (`dev/index.css`), so components are previewed against the SAME tokens that ship to consumers — no mock values, single source of truth.
|
|
11
11
|
- **No variant**: brand differences are absorbed by `@teamix-evo/design` tokens (CSS variables). One UI package serves all design variants.
|
|
12
|
-
- **className contract**: components write `className="bg-primary"` (Tailwind v4 utility), which resolves to `var(--color-primary)`
|
|
12
|
+
- **className contract**: components write `className="bg-primary"` (Tailwind v4 utility), which resolves to `var(--color-primary)` from the project's `tokens.theme.css`. Semantic token names (`primary`, `destructive`, `muted`, ...) align with shadcn — see `@teamix-evo/design` for the token layer.
|
|
13
13
|
- **Imports**: source files use placeholder paths like `@/utils/cn`. The CLI rewrites these to user-configured aliases (e.g. `@/lib/utils`) at install time.
|
|
14
14
|
- **`updateStrategy: frozen`** is the default — once installed, the CLI never overwrites the file. Upgrades go through an AI + skill flow (v0.3, see PLAN §10.9).
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamix-evo/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Source-injected UI components for Teamix Evo (shadcn-based, antd capabilities)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -72,9 +72,13 @@
|
|
|
72
72
|
"vite": "^5.4.0",
|
|
73
73
|
"vite-tsconfig-paths": "^6.1.1",
|
|
74
74
|
"zod": "^3",
|
|
75
|
-
"@teamix-evo/eslint-config": "0.
|
|
76
|
-
"@teamix-evo/
|
|
77
|
-
"@teamix-evo/
|
|
75
|
+
"@teamix-evo/eslint-config": "0.2.0",
|
|
76
|
+
"@teamix-evo/design": "^0.3.0",
|
|
77
|
+
"@teamix-evo/registry": "0.3.0"
|
|
78
|
+
},
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public",
|
|
81
|
+
"registry": "https://registry.npmjs.org/"
|
|
78
82
|
},
|
|
79
83
|
"scripts": {
|
|
80
84
|
"validate": "tsx scripts/validate-entries.ts",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: accordion
|
|
3
3
|
name: Accordion
|
|
4
|
+
displayName: 折叠面板
|
|
4
5
|
type: component
|
|
5
6
|
category: navigation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Accordion
|
|
11
|
+
# Accordion 折叠面板
|
|
11
12
|
|
|
12
13
|
折叠面板 — Radix Accordion + antd Collapse 的 `accordion` 模式(`type="single"` 即单展开)。
|
|
13
14
|
**与 Collapsible 区别**:Accordion 是**多 item 列表**,可单展开 / 多展开;Collapsible 是单个区域的展开收起。
|
|
@@ -29,7 +30,9 @@ package: "@teamix-evo/ui"
|
|
|
29
30
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
30
31
|
|
|
31
32
|
<!-- auto:props:begin -->
|
|
33
|
+
|
|
32
34
|
_(组件无 `<Name>Props` interface — props 详见 [`accordion.tsx`](./accordion.tsx))_
|
|
35
|
+
|
|
33
36
|
<!-- auto:props:end -->
|
|
34
37
|
|
|
35
38
|
## 依赖
|
|
@@ -37,13 +40,14 @@ _(组件无 `<Name>Props` interface — props 详见 [`accordion.tsx`](./accordi
|
|
|
37
40
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
38
41
|
|
|
39
42
|
<!-- auto:deps:begin -->
|
|
43
|
+
|
|
40
44
|
### 同库依赖
|
|
41
45
|
|
|
42
46
|
> `teamix-evo ui add accordion` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
43
47
|
|
|
44
|
-
| Entry | 类型 | 描述
|
|
45
|
-
|
|
|
46
|
-
| `cn`
|
|
48
|
+
| Entry | 类型 | 描述 |
|
|
49
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
50
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
47
51
|
|
|
48
52
|
### npm 依赖
|
|
49
53
|
|
|
@@ -52,6 +56,7 @@ _(组件无 `<Name>Props` interface — props 详见 [`accordion.tsx`](./accordi
|
|
|
52
56
|
```bash
|
|
53
57
|
pnpm add @radix-ui/react-accordion@^1.2.0 lucide-react@^0.460.0
|
|
54
58
|
```
|
|
59
|
+
|
|
55
60
|
<!-- auto:deps:end -->
|
|
56
61
|
|
|
57
62
|
> 子组件:`Accordion`(Root,需 `type="single"` 或 `"multiple"`)/ `AccordionItem` / `AccordionTrigger` / `AccordionContent`。
|
|
@@ -10,6 +10,14 @@ const meta: Meta<typeof Accordion> = {
|
|
|
10
10
|
title: '导航 · Navigation/Accordion',
|
|
11
11
|
component: Accordion,
|
|
12
12
|
tags: ['autodocs'],
|
|
13
|
+
parameters: {
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component:
|
|
17
|
+
'折叠面板 — Radix Accordion + antd Collapse accordion 模式。支持单展开(collapsible) / 多展开,每项自带 ChevronDown 箭头翻转动画。',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
13
21
|
};
|
|
14
22
|
|
|
15
23
|
export default meta;
|
|
@@ -21,7 +29,8 @@ export const Single: Story = {
|
|
|
21
29
|
<AccordionItem value="item-1">
|
|
22
30
|
<AccordionTrigger>什么是 Teamix Evo?</AccordionTrigger>
|
|
23
31
|
<AccordionContent>
|
|
24
|
-
面向产品研发场景的 AI Coding
|
|
32
|
+
面向产品研发场景的 AI Coding
|
|
33
|
+
套件,提供设计体系、技能、组件、文档等可装配资产。
|
|
25
34
|
</AccordionContent>
|
|
26
35
|
</AccordionItem>
|
|
27
36
|
<AccordionItem value="item-2">
|
|
@@ -45,11 +54,7 @@ export const Single: Story = {
|
|
|
45
54
|
export const Multiple: Story = {
|
|
46
55
|
parameters: { controls: { disable: true } },
|
|
47
56
|
render: () => (
|
|
48
|
-
<Accordion
|
|
49
|
-
type="multiple"
|
|
50
|
-
defaultValue={['a', 'b']}
|
|
51
|
-
className="w-96"
|
|
52
|
-
>
|
|
57
|
+
<Accordion type="multiple" defaultValue={['a', 'b']} className="w-96">
|
|
53
58
|
<AccordionItem value="a">
|
|
54
59
|
<AccordionTrigger>分组 A</AccordionTrigger>
|
|
55
60
|
<AccordionContent>分组 A 的内容</AccordionContent>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: affix
|
|
3
3
|
name: Affix
|
|
4
|
+
displayName: 固钉
|
|
4
5
|
type: component
|
|
5
6
|
category: navigation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Affix
|
|
11
|
+
# Affix 固钉
|
|
11
12
|
|
|
12
13
|
滚动吸顶 / 吸底 — antd 独有补足。**等价 antd `Affix`**。当容器滚出指定偏移时,把 children 切换为 `position: fixed`,保留原占位避免页面跳动。监听 `scroll` 事件 + `getBoundingClientRect()`,无第三方依赖。
|
|
13
14
|
|
|
@@ -24,26 +25,34 @@ package: "@teamix-evo/ui"
|
|
|
24
25
|
- 弹窗内的吸附 → Drawer / Sheet 已有内置
|
|
25
26
|
- 一页超过 1 个 Affix:容易形成"漂浮屏",有损可读性
|
|
26
27
|
|
|
28
|
+
## Props
|
|
29
|
+
|
|
27
30
|
<!-- auto:props:begin -->
|
|
28
|
-
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
31
|
+
|
|
32
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
33
|
+
| --------------- | ---------------------------- | ------ | ---- | -------------------------------------------------------------- |
|
|
34
|
+
| `offsetTop` | `number` | `0` | – | 滚动到此偏移量(相对视口顶部)时开始吸顶,单位 px。 |
|
|
35
|
+
| `offsetBottom` | `number` | – | – | 滚动到此偏移量(相对视口底部)时开始吸底 — 与 `offsetTop` 互斥。 |
|
|
36
|
+
| `onAffixChange` | `(affixed: boolean) => void` | – | – | 吸附状态变化回调(antd `onChange` 并集)。 |
|
|
37
|
+
|
|
33
38
|
<!-- auto:props:end -->
|
|
34
39
|
|
|
40
|
+
## 依赖
|
|
41
|
+
|
|
35
42
|
<!-- auto:deps:begin -->
|
|
43
|
+
|
|
36
44
|
### 同库依赖
|
|
37
45
|
|
|
38
46
|
> `teamix-evo ui add affix` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
39
47
|
|
|
40
|
-
| Entry | 类型 | 描述
|
|
41
|
-
|
|
|
42
|
-
| `cn`
|
|
48
|
+
| Entry | 类型 | 描述 |
|
|
49
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
50
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
43
51
|
|
|
44
52
|
### npm 依赖
|
|
45
53
|
|
|
46
54
|
_无 — 本组件不依赖任何 npm 包。_
|
|
55
|
+
|
|
47
56
|
<!-- auto:deps:end -->
|
|
48
57
|
|
|
49
58
|
## AI 生成纪律
|
|
@@ -10,7 +10,7 @@ const meta: Meta<typeof Affix> = {
|
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component:
|
|
13
|
-
'滚动吸顶 / 吸底 — 当容器滚出指定偏移时把 children 切换为 position: fixed,保留原占位。基于 scroll 事件 + getBoundingClientRect。等价 antd `Affix
|
|
13
|
+
'滚动吸顶 / 吸底 — 当容器滚出指定偏移时把 children 切换为 position: fixed,保留原占位。基于 scroll 事件 + getBoundingClientRect。等价 antd `Affix`。',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -45,7 +45,9 @@ export const Bottom: Story = {
|
|
|
45
45
|
parameters: { controls: { disable: true } },
|
|
46
46
|
render: () => (
|
|
47
47
|
<div className="space-y-3">
|
|
48
|
-
<div className="h-[600px] rounded-md border bg-muted/30 p-4"
|
|
48
|
+
<div className="h-[600px] rounded-md border bg-muted/30 p-4">
|
|
49
|
+
向下滚动
|
|
50
|
+
</div>
|
|
49
51
|
<Affix offsetBottom={24}>
|
|
50
52
|
<div className="rounded-md border bg-card p-3 shadow-sm">
|
|
51
53
|
<Button block>立即提交(吸底)</Button>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: alert
|
|
3
3
|
name: Alert
|
|
4
|
+
displayName: 警告提示
|
|
4
5
|
type: component
|
|
5
6
|
category: feedback
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Alert
|
|
11
|
+
# Alert 警告提示
|
|
11
12
|
|
|
12
13
|
静态提示条 — shadcn 简约视觉 + antd 的 `type / showIcon / closable / banner` 并集。
|
|
13
14
|
**inline 形态**,与对话框 / Toast 不同,常驻在页面上方或表单上方。
|
|
@@ -29,15 +30,17 @@ package: "@teamix-evo/ui"
|
|
|
29
30
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
30
31
|
|
|
31
32
|
<!-- auto:props:begin -->
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
33
|
+
|
|
34
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
35
|
+
| ------------- | --------------------------------------------- | -------- | ---- | ------------------------------------------------------------ |
|
|
36
|
+
| `type` | `'info' \| 'success' \| 'warning' \| 'error'` | `"info"` | – | 类型(antd `type` 并集)— 控制语义色与默认图标。 |
|
|
37
|
+
| `showIcon` | `boolean` | `true` | – | 是否显示图标(antd `showIcon` 并集)。 |
|
|
38
|
+
| `closable` | `boolean` | `false` | – | 是否可关闭,显示右侧 X 按钮(antd `closable` 并集)。 |
|
|
39
|
+
| `onClose` | `() => void` | – | – | 关闭按钮点击回调。 |
|
|
40
|
+
| `banner` | `boolean` | `false` | – | Banner 模式 — 去除横向圆角,沿屏幕宽度铺满,常用于全局公告条。 |
|
|
41
|
+
| `title` | `React.ReactNode` | – | – | 标题(粗体行)。 |
|
|
42
|
+
| `description` | `React.ReactNode` | – | – | 描述(标题下方主体内容)。 |
|
|
43
|
+
|
|
41
44
|
<!-- auto:props:end -->
|
|
42
45
|
|
|
43
46
|
## 依赖
|
|
@@ -45,13 +48,14 @@ package: "@teamix-evo/ui"
|
|
|
45
48
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
46
49
|
|
|
47
50
|
<!-- auto:deps:begin -->
|
|
51
|
+
|
|
48
52
|
### 同库依赖
|
|
49
53
|
|
|
50
54
|
> `teamix-evo ui add alert` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
51
55
|
|
|
52
|
-
| Entry | 类型 | 描述
|
|
53
|
-
|
|
|
54
|
-
| `cn`
|
|
56
|
+
| Entry | 类型 | 描述 |
|
|
57
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
58
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
55
59
|
|
|
56
60
|
### npm 依赖
|
|
57
61
|
|
|
@@ -60,6 +64,7 @@ package: "@teamix-evo/ui"
|
|
|
60
64
|
```bash
|
|
61
65
|
pnpm add class-variance-authority@^0.7.0 lucide-react@^0.460.0
|
|
62
66
|
```
|
|
67
|
+
|
|
63
68
|
<!-- auto:deps:end -->
|
|
64
69
|
|
|
65
70
|
## AI 生成纪律
|
|
@@ -9,7 +9,7 @@ const meta: Meta<typeof Alert> = {
|
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'警告提示 — 在不打断用户操作的前提下展示重要信息。四种语义状态(
|
|
12
|
+
'警告提示 — 在不打断用户操作的前提下展示重要信息。四种语义状态(info / success / warning / error)对齐 design 语义色,支持 showIcon 状态图标、closable 一键关闭、banner 顶部业务通告模式。能力对齐 antd Alert。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -15,16 +15,16 @@ const alertVariants = cva(
|
|
|
15
15
|
{
|
|
16
16
|
variants: {
|
|
17
17
|
type: {
|
|
18
|
-
info: 'border-
|
|
18
|
+
info: 'border-info-border bg-info-subtle text-info [&>svg]:text-info',
|
|
19
19
|
success:
|
|
20
|
-
'border-
|
|
20
|
+
'border-success-border bg-success-subtle text-success [&>svg]:text-success',
|
|
21
21
|
warning:
|
|
22
|
-
'border-
|
|
22
|
+
'border-warning-border bg-warning-subtle text-warning [&>svg]:text-warning',
|
|
23
23
|
error:
|
|
24
|
-
'border-destructive
|
|
24
|
+
'border-destructive bg-destructive/10 text-destructive [&>svg]:text-destructive',
|
|
25
25
|
},
|
|
26
26
|
banner: {
|
|
27
|
-
true: 'rounded-none border-
|
|
27
|
+
true: 'rounded-none border-0',
|
|
28
28
|
false: '',
|
|
29
29
|
},
|
|
30
30
|
},
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: alert-dialog
|
|
3
3
|
name: AlertDialog
|
|
4
|
+
displayName: 确认对话框
|
|
4
5
|
type: component
|
|
5
6
|
category: feedback
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# AlertDialog
|
|
11
|
+
# AlertDialog 确认对话框
|
|
11
12
|
|
|
12
13
|
阻断式确认对话框 — Radix AlertDialog + antd `Modal.confirm` 并集。
|
|
13
14
|
**与 Dialog 关键差异**:
|
|
15
|
+
|
|
14
16
|
- 不可点击外部 / ESC 关闭(强制选择 Action / Cancel)
|
|
15
17
|
- 自带 Action / Cancel 子组件,默认走 Button 视觉
|
|
16
18
|
- 无右上角关闭按钮(避免误关)
|
|
@@ -34,7 +36,9 @@ package: "@teamix-evo/ui"
|
|
|
34
36
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。下表是 `AlertDialogContent` 的 props;`AlertDialog`(Root)透传 Radix `open / defaultOpen / onOpenChange`。
|
|
35
37
|
|
|
36
38
|
<!-- auto:props:begin -->
|
|
39
|
+
|
|
37
40
|
_(no props)_
|
|
41
|
+
|
|
38
42
|
<!-- auto:props:end -->
|
|
39
43
|
|
|
40
44
|
## 依赖
|
|
@@ -42,13 +46,14 @@ _(no props)_
|
|
|
42
46
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
43
47
|
|
|
44
48
|
<!-- auto:deps:begin -->
|
|
49
|
+
|
|
45
50
|
### 同库依赖
|
|
46
51
|
|
|
47
52
|
> `teamix-evo ui add alert-dialog` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
48
53
|
|
|
49
|
-
| Entry
|
|
50
|
-
|
|
|
51
|
-
| `cn`
|
|
54
|
+
| Entry | 类型 | 描述 |
|
|
55
|
+
| -------- | --------- | --------------------------------------------------------------------------------------- |
|
|
56
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
52
57
|
| `button` | component | 通用按钮 — shadcn 实现 + antd 功能扩展(loading / icon / shape / block / dashed variant) |
|
|
53
58
|
|
|
54
59
|
### npm 依赖
|
|
@@ -58,6 +63,7 @@ _(no props)_
|
|
|
58
63
|
```bash
|
|
59
64
|
pnpm add @radix-ui/react-alert-dialog@^1.1.0
|
|
60
65
|
```
|
|
66
|
+
|
|
61
67
|
<!-- auto:deps:end -->
|
|
62
68
|
|
|
63
69
|
> 子组件:`AlertDialog`(Root)/ `AlertDialogTrigger` / `AlertDialogContent` / `AlertDialogHeader` / `AlertDialogFooter` / `AlertDialogTitle` / `AlertDialogDescription` / `AlertDialogAction` / `AlertDialogCancel`。
|
|
@@ -74,9 +80,15 @@ pnpm add @radix-ui/react-alert-dialog@^1.1.0
|
|
|
74
80
|
|
|
75
81
|
```tsx
|
|
76
82
|
import {
|
|
77
|
-
AlertDialog,
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
AlertDialog,
|
|
84
|
+
AlertDialogTrigger,
|
|
85
|
+
AlertDialogContent,
|
|
86
|
+
AlertDialogHeader,
|
|
87
|
+
AlertDialogTitle,
|
|
88
|
+
AlertDialogDescription,
|
|
89
|
+
AlertDialogFooter,
|
|
90
|
+
AlertDialogAction,
|
|
91
|
+
AlertDialogCancel,
|
|
80
92
|
} from '@/components/ui/alert-dialog';
|
|
81
93
|
import { Button } from '@/components/ui/button';
|
|
82
94
|
import { buttonVariants } from '@/components/ui/button';
|
|
@@ -89,7 +101,8 @@ import { buttonVariants } from '@/components/ui/button';
|
|
|
89
101
|
<AlertDialogHeader>
|
|
90
102
|
<AlertDialogTitle>确认删除项目?</AlertDialogTitle>
|
|
91
103
|
<AlertDialogDescription>
|
|
92
|
-
将永久删除 <b>"运营后台"</b> 项目及其下 142
|
|
104
|
+
将永久删除 <b>"运营后台"</b> 项目及其下 142 个资源。
|
|
105
|
+
<br />
|
|
93
106
|
此操作不可撤销。
|
|
94
107
|
</AlertDialogDescription>
|
|
95
108
|
</AlertDialogHeader>
|
|
@@ -103,5 +116,5 @@ import { buttonVariants } from '@/components/ui/button';
|
|
|
103
116
|
</AlertDialogAction>
|
|
104
117
|
</AlertDialogFooter>
|
|
105
118
|
</AlertDialogContent>
|
|
106
|
-
</AlertDialog
|
|
119
|
+
</AlertDialog>;
|
|
107
120
|
```
|
|
@@ -20,7 +20,7 @@ const meta: Meta<typeof AlertDialogContent> = {
|
|
|
20
20
|
docs: {
|
|
21
21
|
description: {
|
|
22
22
|
component:
|
|
23
|
-
'
|
|
23
|
+
'确认对话框 — 用于高风险操作(删除、不可恢复变更)的二次确认。基于 Radix AlertDialog,自动陷阱焦点 + ESC 关闭;Cancel + Action 双按钮范式对齐 antd Modal.confirm。',
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
},
|
|
@@ -35,7 +35,7 @@ const AlertDialogContent = React.forwardRef<
|
|
|
35
35
|
<AlertDialogPrimitive.Content
|
|
36
36
|
ref={ref}
|
|
37
37
|
className={cn(
|
|
38
|
-
'fixed left-
|
|
38
|
+
'fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg',
|
|
39
39
|
className,
|
|
40
40
|
)}
|
|
41
41
|
{...props}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: anchor
|
|
3
3
|
name: Anchor
|
|
4
|
+
displayName: 锚点
|
|
4
5
|
type: component
|
|
5
6
|
category: navigation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Anchor
|
|
11
|
+
# Anchor 锚点
|
|
11
12
|
|
|
12
13
|
锚点导航 — antd 独有补足。**等价 antd `Anchor`**。长文档 / 详情页侧边的目录,点击锚点滚动到对应 `id` 节点,滚动时自动高亮当前可见的锚点(IntersectionObserver)。支持嵌套两层缩进。
|
|
13
14
|
|
|
@@ -23,27 +24,35 @@ package: "@teamix-evo/ui"
|
|
|
23
24
|
- 主导航(顶部 / 侧栏菜单)→ `NavigationMenu` / `Sidebar`
|
|
24
25
|
- 步骤导航(顺序操作)→ `Steps`
|
|
25
26
|
|
|
27
|
+
## Props
|
|
28
|
+
|
|
26
29
|
<!-- auto:props:begin -->
|
|
27
|
-
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
30
|
+
|
|
31
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
32
|
+
| ---------------- | ----------------------- | ---------- | ---- | ----------------------------------------------------------------------- |
|
|
33
|
+
| `items` | `AnchorItem[]` | – | ✓ | 锚点项树(antd `items` 并集)。 |
|
|
34
|
+
| `offsetTop` | `number` | `0` | – | 当目标元素距视口顶部小于此值时高亮(IntersectionObserver `rootMargin`)。 |
|
|
35
|
+
| `scrollBehavior` | `'smooth' \| 'auto'` | `"smooth"` | – | 点击锚点平滑滚动行为。 |
|
|
36
|
+
| `onChange` | `(key: string) => void` | – | – | 当前高亮变化回调。 |
|
|
37
|
+
|
|
33
38
|
<!-- auto:props:end -->
|
|
34
39
|
|
|
40
|
+
## 依赖
|
|
41
|
+
|
|
35
42
|
<!-- auto:deps:begin -->
|
|
43
|
+
|
|
36
44
|
### 同库依赖
|
|
37
45
|
|
|
38
46
|
> `teamix-evo ui add anchor` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
39
47
|
|
|
40
|
-
| Entry | 类型 | 描述
|
|
41
|
-
|
|
|
42
|
-
| `cn`
|
|
48
|
+
| Entry | 类型 | 描述 |
|
|
49
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
50
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
43
51
|
|
|
44
52
|
### npm 依赖
|
|
45
53
|
|
|
46
54
|
_无 — 本组件不依赖任何 npm 包。_
|
|
55
|
+
|
|
47
56
|
<!-- auto:deps:end -->
|
|
48
57
|
|
|
49
58
|
## AI 生成纪律
|
|
@@ -9,7 +9,7 @@ const meta: Meta<typeof Anchor> = {
|
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'锚点导航 — 长文档 / 详情页侧边目录,点击滚动到 id 节点,滚动时 IntersectionObserver 自动高亮。等价 antd `Anchor
|
|
12
|
+
'锚点导航 — 长文档 / 详情页侧边目录,点击滚动到 id 节点,滚动时 IntersectionObserver 自动高亮。等价 antd `Anchor`。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -4,10 +4,11 @@ name: App
|
|
|
4
4
|
type: component
|
|
5
5
|
category: shell
|
|
6
6
|
since: 0.1.0
|
|
7
|
-
package:
|
|
7
|
+
package: '@teamix-evo/ui'
|
|
8
|
+
displayName: 应用容器
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# App
|
|
11
|
+
# App 应用容器
|
|
11
12
|
|
|
12
13
|
应用根容器 — antd 独有补足。**对标 antd `App`** 的核心职责:挂全局 Toaster + 设置 dir / lang + 承载根级 className。**与 antd 区别**:不接管主题(本库主题靠 design tokens / CSS vars,**不引入 runtime ConfigProvider**),也不收敛 `useApp()` hook(toast / notification 直接 import 即可)。
|
|
13
14
|
|
|
@@ -23,27 +24,35 @@ package: "@teamix-evo/ui"
|
|
|
23
24
|
- 需要 runtime 切换主题色 → 改 CSS variables(design tokens),**不要**通过 ConfigProvider
|
|
24
25
|
- 单独需要 Toaster → 直接挂 `<Toaster />`
|
|
25
26
|
|
|
27
|
+
## Props
|
|
28
|
+
|
|
26
29
|
<!-- auto:props:begin -->
|
|
27
|
-
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
30
|
+
|
|
31
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
32
|
+
| -------------- | ---------------- | ------- | ---- | ---------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `withToaster` | `boolean` | `true` | – | 是否挂载 `<Toaster />`(antd `App` 内部托管 message / notification 静态实例) — 全应用根挂一次。 |
|
|
34
|
+
| `toasterProps` | `ToasterProps` | – | – | 传递给 Toaster 的配置(位置 / 主题 / 自动关闭等) — 仅 `withToaster=true` 时生效。 |
|
|
35
|
+
| `dir` | `'ltr' \| 'rtl'` | `"ltr"` | – | 文字方向 — 设到根容器的 `dir` 属性,Radix 等组件会自动适配。 |
|
|
36
|
+
|
|
32
37
|
<!-- auto:props:end -->
|
|
33
38
|
|
|
39
|
+
## 依赖
|
|
40
|
+
|
|
34
41
|
<!-- auto:deps:begin -->
|
|
42
|
+
|
|
35
43
|
### 同库依赖
|
|
36
44
|
|
|
37
45
|
> `teamix-evo ui add app` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
38
46
|
|
|
39
|
-
| Entry
|
|
40
|
-
|
|
|
41
|
-
| `cn`
|
|
47
|
+
| Entry | 类型 | 描述 |
|
|
48
|
+
| -------- | --------- | ------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
42
50
|
| `sonner` | component | Toast 通知 — sonner 包装,等价 antd message + notification 并集(toast() 函数式 API + Toaster 容器) |
|
|
43
51
|
|
|
44
52
|
### npm 依赖
|
|
45
53
|
|
|
46
54
|
_无 — 本组件不依赖任何 npm 包。_
|
|
55
|
+
|
|
47
56
|
<!-- auto:deps:end -->
|
|
48
57
|
|
|
49
58
|
## AI 生成纪律
|
|
@@ -12,7 +12,7 @@ const meta: Meta<typeof App> = {
|
|
|
12
12
|
docs: {
|
|
13
13
|
description: {
|
|
14
14
|
component:
|
|
15
|
-
'应用根容器 — 挂全局 Toaster + 设置 dir / lang + 承载根级 className。对标 antd `App
|
|
15
|
+
'应用根容器 — 挂全局 Toaster + 设置 dir / lang + 承载根级 className。对标 antd `App`,但不接管主题(主题靠 design tokens / CSS vars),也不收敛 useApp() hook。',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
},
|
|
@@ -30,7 +30,9 @@ export const Playground: Story = {
|
|
|
30
30
|
render: (args) => (
|
|
31
31
|
<App {...args} className="rounded-md border p-6">
|
|
32
32
|
<div className="flex flex-col gap-3">
|
|
33
|
-
<span className="text-sm text-muted-foreground">
|
|
33
|
+
<span className="text-sm text-muted-foreground">
|
|
34
|
+
App 内挂载了 Toaster,可直接触发:
|
|
35
|
+
</span>
|
|
34
36
|
<div className="flex gap-2">
|
|
35
37
|
<Button onClick={() => toast.success('已保存')}>触发 toast</Button>
|
|
36
38
|
<Button
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: aspect-ratio
|
|
3
3
|
name: AspectRatio
|
|
4
|
+
displayName: 宽高比
|
|
4
5
|
type: component
|
|
5
6
|
category: foundation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# AspectRatio
|
|
11
|
+
# AspectRatio 宽高比
|
|
11
12
|
|
|
12
13
|
容器保持宽高比 — 基于 `@radix-ui/react-aspect-ratio`,内部用 padding-bottom 技巧实现,**无 layout shift**。
|
|
13
14
|
shadcn-only,antd 无对标。
|
|
@@ -28,9 +29,11 @@ shadcn-only,antd 无对标。
|
|
|
28
29
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
29
30
|
|
|
30
31
|
<!-- auto:props:begin -->
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
|
32
|
+
|
|
33
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
34
|
+
| ------- | -------- | ------ | ---- | -------------------------------------------------------------------- |
|
|
35
|
+
| `ratio` | `number` | `1` | – | 宽高比 = 宽 / 高(必传)。常见值:`16 / 9` / `4 / 3` / `1` / `9 / 16`。 |
|
|
36
|
+
|
|
34
37
|
<!-- auto:props:end -->
|
|
35
38
|
|
|
36
39
|
## 依赖
|
|
@@ -38,6 +41,7 @@ shadcn-only,antd 无对标。
|
|
|
38
41
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
39
42
|
|
|
40
43
|
<!-- auto:deps:begin -->
|
|
44
|
+
|
|
41
45
|
### 同库依赖
|
|
42
46
|
|
|
43
47
|
_无 — 本组件不依赖其他 ui entry。_
|
|
@@ -49,6 +53,7 @@ _无 — 本组件不依赖其他 ui entry。_
|
|
|
49
53
|
```bash
|
|
50
54
|
pnpm add @radix-ui/react-aspect-ratio@^1.1.0
|
|
51
55
|
```
|
|
56
|
+
|
|
52
57
|
<!-- auto:deps:end -->
|
|
53
58
|
|
|
54
59
|
> 透传所有 `<div>` 原生属性。`ratio: number` 是最关键的 prop(必传),如 `16 / 9` / `4 / 3` / `1`。
|
|
@@ -9,7 +9,7 @@ const meta: Meta<typeof AspectRatio> = {
|
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'宽高比容器 — 强制子元素按指定比例渲染,常用于图片 / 视频 / iframe 等响应式封面容器。基于 Radix AspectRatio,通过 `ratio` prop
|
|
12
|
+
'宽高比容器 — 强制子元素按指定比例渲染,常用于图片 / 视频 / iframe 等响应式封面容器。基于 Radix AspectRatio,通过 `ratio` prop 传入任意宽高比。shadcn 专有,填补了 antd 未提供的纯布局能力。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|