@tu-design/vue 0.4.2 → 0.5.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/dist/index.d.mts +390 -296
- package/dist/index.mjs +408 -85
- package/dist/registry/vue/alert-dialog.json +1 -1
- package/dist/registry/vue/alert.json +2 -2
- package/dist/registry/vue/avatar-group.json +1 -1
- package/dist/registry/vue/avatar.json +1 -1
- package/dist/registry/vue/badge.json +2 -2
- package/dist/registry/vue/button.json +2 -2
- package/dist/registry/vue/calendar.json +1 -1
- package/dist/registry/vue/card.json +2 -1
- package/dist/registry/vue/cascader.json +1 -1
- package/dist/registry/vue/checkbox.json +1 -1
- package/dist/registry/vue/context-menu.json +1 -1
- package/dist/registry/vue/currency-input.json +1 -1
- package/dist/registry/vue/date-picker.json +1 -1
- package/dist/registry/vue/date-range-picker.json +1 -1
- package/dist/registry/vue/date-shared.json +1 -1
- package/dist/registry/vue/dialog.json +1 -1
- package/dist/registry/vue/drawer.json +1 -1
- package/dist/registry/vue/dropdown-menu.json +1 -1
- package/dist/registry/vue/empty.json +1 -1
- package/dist/registry/vue/form-render.json +1 -1
- package/dist/registry/vue/form.json +1 -1
- package/dist/registry/vue/input.json +1 -1
- package/dist/registry/vue/label.json +1 -1
- package/dist/registry/vue/month-picker.json +1 -1
- package/dist/registry/vue/number-input.json +1 -1
- package/dist/registry/vue/overlay-shared.json +1 -1
- package/dist/registry/vue/password-input.json +1 -1
- package/dist/registry/vue/pin-input.json +1 -1
- package/dist/registry/vue/popconfirm.json +1 -1
- package/dist/registry/vue/popover.json +1 -1
- package/dist/registry/vue/progress.json +1 -1
- package/dist/registry/vue/radio-group.json +1 -1
- package/dist/registry/vue/registry.json +57 -50
- package/dist/registry/vue/select.json +1 -1
- package/dist/registry/vue/separator.json +1 -1
- package/dist/registry/vue/skeleton.json +1 -1
- package/dist/registry/vue/slider.json +1 -1
- package/dist/registry/vue/slot.json +1 -1
- package/dist/registry/vue/spin.json +1 -1
- package/dist/registry/vue/switch.json +1 -1
- package/dist/registry/vue/table-render.json +1 -1
- package/dist/registry/vue/tabs.json +9 -3
- package/dist/registry/vue/textarea.json +1 -1
- package/dist/registry/vue/timeline.json +23 -0
- package/dist/registry/vue/toast.json +2 -2
- package/dist/registry/vue/tokens.json +2 -2
- package/dist/registry/vue/tooltip.json +1 -1
- package/dist/registry/vue/tree-select.json +1 -1
- package/dist/registry/vue/tree-shared.json +1 -1
- package/dist/registry/vue/utils.json +1 -1
- package/dist/registry/vue/week-picker.json +1 -1
- package/dist/registry/vue/year-picker.json +1 -1
- package/dist/style.css +10 -0
- package/package.json +3 -2
|
@@ -4,350 +4,357 @@
|
|
|
4
4
|
"items": [
|
|
5
5
|
{
|
|
6
6
|
"name": "alert",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.5.0",
|
|
8
8
|
"title": "Alert",
|
|
9
9
|
"type": "registry:ui",
|
|
10
10
|
"description": "语义化警示条,支持五种变体、内置图标与可关闭交互。"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"name": "alert-dialog",
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.5.0",
|
|
15
15
|
"title": "AlertDialog",
|
|
16
16
|
"type": "registry:ui",
|
|
17
17
|
"description": "确认弹窗单组件:v-model:open 控制显隐,title/description 传文案,@confirm/@cancel 处理确认与取消;确认处理器返回 Promise 时按钮进入 loading 并锁定 ESC/遮罩关闭,resolve 自动关闭、reject 保持打开;内容节点为 role=alertdialog。"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"name": "avatar",
|
|
21
|
-
"version": "0.
|
|
21
|
+
"version": "0.5.0",
|
|
22
22
|
"title": "Avatar",
|
|
23
23
|
"type": "registry:ui",
|
|
24
24
|
"description": "头像,支持尺寸/形状、加载占位与失败回退(Ark UI)。"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "avatar-group",
|
|
28
|
-
"version": "0.
|
|
28
|
+
"version": "0.5.0",
|
|
29
29
|
"title": "AvatarGroup",
|
|
30
30
|
"type": "registry:ui",
|
|
31
31
|
"description": "头像组,数量折叠、悬停展开与垂直排列。"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "badge",
|
|
35
|
-
"version": "0.
|
|
35
|
+
"version": "0.5.0",
|
|
36
36
|
"title": "Badge",
|
|
37
37
|
"type": "registry:ui",
|
|
38
38
|
"description": "轻量状态徽标,支持四种变体。"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"name": "button",
|
|
42
|
-
"version": "0.
|
|
42
|
+
"version": "0.5.0",
|
|
43
43
|
"title": "Button",
|
|
44
44
|
"type": "registry:ui",
|
|
45
45
|
"description": "带变体与尺寸的按钮,支持 as 标签切换与 asChild 组合。"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"name": "calendar",
|
|
49
|
-
"version": "0.
|
|
49
|
+
"version": "0.5.0",
|
|
50
50
|
"title": "Calendar",
|
|
51
51
|
"type": "registry:ui",
|
|
52
52
|
"description": "日历(TCalendar):紧凑日历卡。Picker 弹层内为 embedded 内嵌形态(TDatePicker/TDateRangePicker 自动挂靠,纯卡片内核);独立使用即 standalone 独立形态(自带日历状态与 v-model,恒开展示)。"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"name": "card",
|
|
56
|
-
"version": "0.
|
|
56
|
+
"version": "0.5.0",
|
|
57
57
|
"title": "Card",
|
|
58
58
|
"type": "registry:ui",
|
|
59
59
|
"description": "卡片容器:单组件 API,title/description 头部 + 命名插槽(cover/action/footer/header),支持尺寸、视觉变体、分段分隔与可关闭。"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"name": "cascader",
|
|
63
|
-
"version": "0.
|
|
63
|
+
"version": "0.5.0",
|
|
64
64
|
"title": "Cascader",
|
|
65
65
|
"type": "registry:ui",
|
|
66
66
|
"description": "级联选择:一站式 props 驱动,多列联动、勾选级联、路径回显与多标签。"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"name": "checkbox",
|
|
70
|
-
"version": "0.
|
|
70
|
+
"version": "0.5.0",
|
|
71
71
|
"title": "Checkbox",
|
|
72
72
|
"type": "registry:ui",
|
|
73
73
|
"description": "复选框:基于 Ark UI Checkbox 原语,支持标签插槽、受控/非受控与禁用。"
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
"name": "context-menu",
|
|
77
|
-
"version": "0.
|
|
77
|
+
"version": "0.5.0",
|
|
78
78
|
"title": "ContextMenu",
|
|
79
79
|
"type": "registry:ui",
|
|
80
80
|
"description": "右键菜单:单组件模式,items 描述菜单项(与 dropdown-menu 同构,含分组/标题/分隔线,支持嵌套),默认插槽为触发元素(ContextTrigger as-child,右键唤出并定位到指针处),内置键盘导航与选中回调。"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"name": "currency-input",
|
|
84
|
-
"version": "0.
|
|
84
|
+
"version": "0.5.0",
|
|
85
85
|
"title": "CurrencyInput",
|
|
86
86
|
"type": "registry:ui",
|
|
87
87
|
"description": "金额输入框:内置万/元/角/分单位后缀,labelUnit 输入单位与 valueUnit 存储单位自动换算(整数分最小精度),值以 number|null 受控。"
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
"name": "date-picker",
|
|
91
|
-
"version": "0.
|
|
91
|
+
"version": "0.5.0",
|
|
92
92
|
"title": "DatePicker",
|
|
93
93
|
"type": "registry:ui",
|
|
94
94
|
"description": "日期选择器:输入框 + 日历弹层(月/年视图切换),支持手动键入/清空/min-max 边界/不可选谓词,值以 \"yyyy-MM-dd\" 字符串受控。"
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
"name": "date-range-picker",
|
|
98
|
-
"version": "0.
|
|
98
|
+
"version": "0.5.0",
|
|
99
99
|
"title": "DateRangePicker",
|
|
100
100
|
"type": "registry:ui",
|
|
101
101
|
"description": "日期范围选择器:双月日历弹层(月/年视图切换),点选起点与终点,值以 [\"yyyy-MM-dd\", \"yyyy-MM-dd\"] 有序元组受控,空值归一 null。"
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
"name": "date-shared",
|
|
105
|
-
"version": "0.
|
|
105
|
+
"version": "0.5.0",
|
|
106
106
|
"title": "DateShared",
|
|
107
107
|
"type": "registry:ui",
|
|
108
108
|
"description": "日期家族共享模块:ISO 值域解析(日期/月/年/区间)、日历样式常量与单值选择器外壳(PickerShell/usePickerBridge)。"
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
"name": "dialog",
|
|
112
|
-
"version": "0.
|
|
112
|
+
"version": "0.5.0",
|
|
113
113
|
"title": "Dialog",
|
|
114
114
|
"type": "registry:ui",
|
|
115
115
|
"description": "模态对话框单组件:#trigger 放触发元素,title/description 传文案,#footer 注入 close 关闭;基于 Ark UI Dialog 原语,含焦点圈定、Escape/遮罩关闭与进出场动画,支持 v-model:open。"
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
"name": "drawer",
|
|
119
|
-
"version": "0.
|
|
119
|
+
"version": "0.5.0",
|
|
120
120
|
"title": "Drawer",
|
|
121
121
|
"type": "registry:ui",
|
|
122
122
|
"description": "抽屉单组件:从四方向滑出的侧边/顶底面板,#trigger 放触发元素,title/description 传文案,#footer 注入 close 关闭;基于 Ark UI Drawer 原语,进出场动画随 placement 方向自适应,含焦点圈定、Escape/遮罩关闭,支持 v-model:open。"
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "dropdown-menu",
|
|
126
|
-
"version": "0.
|
|
126
|
+
"version": "0.5.0",
|
|
127
127
|
"title": "DropdownMenu",
|
|
128
128
|
"type": "registry:ui",
|
|
129
129
|
"description": "下拉菜单:单组件模式,items 描述菜单项(含分组/标题/分隔线,支持嵌套),内置键盘导航与选中回调,默认插槽为触发元素(asChild 透传)。"
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
"name": "empty",
|
|
133
|
-
"version": "0.
|
|
133
|
+
"version": "0.5.0",
|
|
134
134
|
"title": "Empty",
|
|
135
135
|
"type": "registry:ui",
|
|
136
136
|
"description": "空状态占位,含默认插画与描述文案。"
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"name": "form",
|
|
140
|
-
"version": "0.
|
|
140
|
+
"version": "0.5.0",
|
|
141
141
|
"title": "Form",
|
|
142
142
|
"type": "registry:ui",
|
|
143
143
|
"description": "表单状态与校验:基于 TanStack Form,配合 Valibot(Standard Schema)声明式校验,aria 自动接线。"
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
"name": "form-render",
|
|
147
|
-
"version": "0.
|
|
147
|
+
"version": "0.5.0",
|
|
148
148
|
"title": "FormRender",
|
|
149
149
|
"type": "registry:ui",
|
|
150
150
|
"description": "配置驱动表单渲染器:defineForm 聚合 TanStack Form 实例与字段配置,柯里化 widget DSL 声明控件,Tailwind 栅格自适应布局,复用 Form 家族 aria 接线。"
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
"name": "input",
|
|
154
|
-
"version": "0.
|
|
154
|
+
"version": "0.5.0",
|
|
155
155
|
"title": "Input",
|
|
156
156
|
"type": "registry:ui",
|
|
157
157
|
"description": "文本输入框,支持 v-model、attrs 透传与 invalid 校验态。"
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
"name": "label",
|
|
161
|
-
"version": "0.
|
|
161
|
+
"version": "0.5.0",
|
|
162
162
|
"title": "Label",
|
|
163
163
|
"type": "registry:ui",
|
|
164
164
|
"description": "表单标签。"
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
"name": "month-picker",
|
|
168
|
-
"version": "0.
|
|
168
|
+
"version": "0.5.0",
|
|
169
169
|
"title": "MonthPicker",
|
|
170
170
|
"type": "registry:ui",
|
|
171
171
|
"description": "月份选择器:输入框 + 锁定月视图的日历弹层,值以 \"yyyy-MM\" 字符串受控,min/max 为月粒度闭区间(内部换算到当月末日)。"
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
174
|
"name": "number-input",
|
|
175
|
-
"version": "0.
|
|
175
|
+
"version": "0.5.0",
|
|
176
176
|
"title": "NumberInput",
|
|
177
177
|
"type": "registry:ui",
|
|
178
178
|
"description": "数字输入框:内置加减步进按钮与数值边界,值以 number|null 受控(空值归一 null),支持 Intl 数字格式化。"
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
181
|
"name": "overlay-shared",
|
|
182
|
-
"version": "0.
|
|
182
|
+
"version": "0.5.0",
|
|
183
183
|
"title": "OverlayShared",
|
|
184
184
|
"type": "registry:ui",
|
|
185
185
|
"description": "弹层家族共享逻辑:受控开合桥接(useControlledBoolean)与确认 pending 语义(useConfirmPending)。"
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
"name": "password-input",
|
|
189
|
-
"version": "0.
|
|
189
|
+
"version": "0.5.0",
|
|
190
190
|
"title": "PasswordInput",
|
|
191
191
|
"type": "registry:ui",
|
|
192
192
|
"description": "密码输入框:内置明文/掩码切换按钮(Eye/EyeOff,带 aria 语义),值与可见性均支持 v-model 受控。"
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
195
|
"name": "pin-input",
|
|
196
|
-
"version": "0.
|
|
196
|
+
"version": "0.5.0",
|
|
197
197
|
"title": "PinInput",
|
|
198
198
|
"type": "registry:ui",
|
|
199
199
|
"description": "多格验证码输入:length 指定格数,支持 otp/mask/字符类型、焦点自动跳格与填满回调,可选分隔符插槽。"
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
"name": "popconfirm",
|
|
203
|
-
"version": "0.
|
|
203
|
+
"version": "0.5.0",
|
|
204
204
|
"title": "Popconfirm",
|
|
205
205
|
"type": "registry:ui",
|
|
206
206
|
"description": "气泡确认:Popover 薄壳变体单组件,默认插槽为触发元素本体(asChild),title/description 传文案,@confirm/@cancel 处理确认与取消;确认处理器返回 Promise 时确认钮 loading 并锁定关闭通道,resolve 自动关闭、reject 保持打开。"
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
"name": "popover",
|
|
210
|
-
"version": "0.
|
|
210
|
+
"version": "0.5.0",
|
|
211
211
|
"title": "Popover",
|
|
212
212
|
"type": "registry:ui",
|
|
213
213
|
"description": "气泡弹层:基于 Ark UI Popover 原语的单组件,默认插槽为触发元素本体(asChild 语义),面板内容放 #content 插槽,受控/非受控开关。"
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
"name": "progress",
|
|
217
|
-
"version": "0.
|
|
217
|
+
"version": "0.5.0",
|
|
218
218
|
"title": "Progress",
|
|
219
219
|
"type": "registry:ui",
|
|
220
220
|
"description": "进度条:基于 Ark UI Progress 原语,支持语义色、标签与百分比显示、不确定态。"
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
223
|
"name": "radio-group",
|
|
224
|
-
"version": "0.
|
|
224
|
+
"version": "0.5.0",
|
|
225
225
|
"title": "RadioGroup",
|
|
226
226
|
"type": "registry:ui",
|
|
227
227
|
"description": "单选组:基于 Ark UI Radio Group 原语,键盘导航与受控/非受控双模式。"
|
|
228
228
|
},
|
|
229
229
|
{
|
|
230
230
|
"name": "select",
|
|
231
|
-
"version": "0.
|
|
231
|
+
"version": "0.5.0",
|
|
232
232
|
"title": "Select",
|
|
233
233
|
"type": "registry:ui",
|
|
234
234
|
"description": "下拉选择框:单组件 API,传入 items 数据驱动渲染,内置触发器回显、键盘导航与勾选指示,支持 #item 插槽自定义选项。"
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
237
|
"name": "separator",
|
|
238
|
-
"version": "0.
|
|
238
|
+
"version": "0.5.0",
|
|
239
239
|
"title": "Separator",
|
|
240
240
|
"type": "registry:ui",
|
|
241
241
|
"description": "分隔线,支持水平与垂直方向。"
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
244
|
"name": "skeleton",
|
|
245
|
-
"version": "0.
|
|
245
|
+
"version": "0.5.0",
|
|
246
246
|
"title": "Skeleton",
|
|
247
247
|
"type": "registry:ui",
|
|
248
248
|
"description": "加载占位骨架屏。"
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
251
|
"name": "slider",
|
|
252
|
-
"version": "0.
|
|
252
|
+
"version": "0.5.0",
|
|
253
253
|
"title": "Slider",
|
|
254
254
|
"type": "registry:ui",
|
|
255
255
|
"description": "滑块:基于 Ark UI Slider 原语,支持单值/区间、步进与键盘微调。"
|
|
256
256
|
},
|
|
257
257
|
{
|
|
258
258
|
"name": "slot",
|
|
259
|
-
"version": "0.
|
|
259
|
+
"version": "0.5.0",
|
|
260
260
|
"title": "Slot",
|
|
261
261
|
"type": "registry:ui",
|
|
262
262
|
"description": "asChild 组合原语:将组件的 class 与 attrs 合并到子元素上,而不渲染额外 DOM。"
|
|
263
263
|
},
|
|
264
264
|
{
|
|
265
265
|
"name": "spin",
|
|
266
|
-
"version": "0.
|
|
266
|
+
"version": "0.5.0",
|
|
267
267
|
"title": "Spin",
|
|
268
268
|
"type": "registry:ui",
|
|
269
269
|
"description": "加载中旋转指示器,支持独立 spinner 与包裹内容(半透明遮罩)两种形态。"
|
|
270
270
|
},
|
|
271
271
|
{
|
|
272
272
|
"name": "switch",
|
|
273
|
-
"version": "0.
|
|
273
|
+
"version": "0.5.0",
|
|
274
274
|
"title": "Switch",
|
|
275
275
|
"type": "registry:ui",
|
|
276
276
|
"description": "开关:基于 Ark UI Switch 原语,支持标签插槽、受控/非受控与禁用。"
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
279
|
"name": "table-render",
|
|
280
|
-
"version": "0.
|
|
280
|
+
"version": "0.5.0",
|
|
281
281
|
"title": "TableRender",
|
|
282
282
|
"type": "registry:ui",
|
|
283
283
|
"description": "配置驱动表格渲染器:defineTable 聚合 TanStack Table 实例与列配置,静态/服务端双模式(onLoad 回写分页排序),搜索表单联动(search 接 FormRender),左右固定列 sticky 横向滚动,表体虚拟滚动(virtual + height,TanStack Virtual 动态测量行高),树形数据(tree:子行展开/收起、depth 缩进、caret 位于首列),列显隐(columnSettings 面板 + visibleKeys 受控),错误态占位与重试(#error 插槽 + load-error),ellipsis 支持 tooltip 形态,v-model 受控(pageIndex/pageSize/sort/selectedKeys),Ark Pagination 分页条 + 原生 select 每页条数,排序表头 aria-sort、加载骨架与空态插槽,语义化 table + Tailwind tokens。"
|
|
284
284
|
},
|
|
285
285
|
{
|
|
286
286
|
"name": "tabs",
|
|
287
|
-
"version": "0.
|
|
287
|
+
"version": "0.5.0",
|
|
288
288
|
"title": "Tabs",
|
|
289
289
|
"type": "registry:ui",
|
|
290
290
|
"description": "选项卡:基于 Ark UI Tabs 原语,键盘导航与受控/非受控双模式。"
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
293
|
"name": "textarea",
|
|
294
|
-
"version": "0.
|
|
294
|
+
"version": "0.5.0",
|
|
295
295
|
"title": "Textarea",
|
|
296
296
|
"type": "registry:ui",
|
|
297
297
|
"description": "多行文本输入:纯样式封装,支持 invalid 校验态。"
|
|
298
298
|
},
|
|
299
|
+
{
|
|
300
|
+
"name": "timeline",
|
|
301
|
+
"version": "0.5.0",
|
|
302
|
+
"title": "Timeline",
|
|
303
|
+
"type": "registry:ui",
|
|
304
|
+
"description": "时间轴:数据驱动 items 渲染竖向事件流,支持单列/左右交替、五种语义节点色与空心节点、#item 作用域插槽自定义内容。"
|
|
305
|
+
},
|
|
299
306
|
{
|
|
300
307
|
"name": "toast",
|
|
301
|
-
"version": "0.
|
|
308
|
+
"version": "0.5.0",
|
|
302
309
|
"title": "Toast",
|
|
303
310
|
"type": "registry:ui",
|
|
304
311
|
"description": "全局轻提示:ToastProvider 在应用根部挂载一次,useToast() 提供命令式 API(success/error/info/warning/loading/promise/dismiss);基于 Ark UI Toast 原语,语义 type 映射主题 token 配色。"
|
|
305
312
|
},
|
|
306
313
|
{
|
|
307
314
|
"name": "tokens",
|
|
308
|
-
"version": "0.
|
|
315
|
+
"version": "0.5.0",
|
|
309
316
|
"title": "Tokens",
|
|
310
317
|
"type": "registry:style",
|
|
311
318
|
"description": "Tailwind CSS v4 语义 tokens(shadcn 官方 v4 集合)。"
|
|
312
319
|
},
|
|
313
320
|
{
|
|
314
321
|
"name": "tooltip",
|
|
315
|
-
"version": "0.
|
|
322
|
+
"version": "0.5.0",
|
|
316
323
|
"title": "Tooltip",
|
|
317
324
|
"type": "registry:ui",
|
|
318
325
|
"description": "文字提示气泡:悬停触发,基于 Ark UI Tooltip 原语,支持 asChild 与延迟配置。"
|
|
319
326
|
},
|
|
320
327
|
{
|
|
321
328
|
"name": "tree-select",
|
|
322
|
-
"version": "0.
|
|
329
|
+
"version": "0.5.0",
|
|
323
330
|
"title": "TreeSelect",
|
|
324
331
|
"type": "registry:ui",
|
|
325
332
|
"description": "树形下拉选择:一站式 props 驱动,支持单/多选、勾选级联、过滤与多标签折叠。"
|
|
326
333
|
},
|
|
327
334
|
{
|
|
328
335
|
"name": "tree-shared",
|
|
329
|
-
"version": "0.
|
|
336
|
+
"version": "0.5.0",
|
|
330
337
|
"title": "TreeShared",
|
|
331
338
|
"type": "registry:ui",
|
|
332
339
|
"description": "树形数据层与共享类型(移植自 treemate v0.3.11,MIT)。"
|
|
333
340
|
},
|
|
334
341
|
{
|
|
335
342
|
"name": "utils",
|
|
336
|
-
"version": "0.
|
|
343
|
+
"version": "0.5.0",
|
|
337
344
|
"title": "Utils",
|
|
338
345
|
"type": "registry:lib",
|
|
339
346
|
"description": "cn 类名合并工具(clsx + tailwind-merge)。"
|
|
340
347
|
},
|
|
341
348
|
{
|
|
342
349
|
"name": "week-picker",
|
|
343
|
-
"version": "0.
|
|
350
|
+
"version": "0.5.0",
|
|
344
351
|
"title": "WeekPicker",
|
|
345
352
|
"type": "registry:ui",
|
|
346
353
|
"description": "周选择器:输入框 + 日历弹层,点任意可选日归一到所在周并整周高亮,值以 \"yyyy-MM-dd\"(所在周起始日)字符串受控;周起点跟随 locale(zh-CN 周一起始),输入框回显 \"start ~ end\"。"
|
|
347
354
|
},
|
|
348
355
|
{
|
|
349
356
|
"name": "year-picker",
|
|
350
|
-
"version": "0.
|
|
357
|
+
"version": "0.5.0",
|
|
351
358
|
"title": "YearPicker",
|
|
352
359
|
"type": "registry:ui",
|
|
353
360
|
"description": "年份选择器:输入框 + 锁定年视图的日历弹层(decade 网格),值以 \"yyyy\" 字符串受控,min/max 为年粒度闭区间。"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "select",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "下拉选择框:单组件 API,传入 items 数据驱动渲染,内置触发器回显、键盘导航与勾选指示,支持 #item 插槽自定义选项。",
|
|
7
7
|
"registryDependencies": ["utils", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "table-render",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "配置驱动表格渲染器:defineTable 聚合 TanStack Table 实例与列配置,静态/服务端双模式(onLoad 回写分页排序),搜索表单联动(search 接 FormRender),左右固定列 sticky 横向滚动,表体虚拟滚动(virtual + height,TanStack Virtual 动态测量行高),树形数据(tree:子行展开/收起、depth 缩进、caret 位于首列),列显隐(columnSettings 面板 + visibleKeys 受控),错误态占位与重试(#error 插槽 + load-error),ellipsis 支持 tooltip 形态,v-model 受控(pageIndex/pageSize/sort/selectedKeys),Ark Pagination 分页条 + 原生 select 每页条数,排序表头 aria-sort、加载骨架与空态插槽,语义化 table + Tailwind tokens。",
|
|
7
7
|
"registryDependencies": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "tabs",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "选项卡:基于 Ark UI Tabs 原语,键盘导航与受控/非受控双模式。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -10,13 +10,19 @@
|
|
|
10
10
|
"path": "tabs/Tabs.vue",
|
|
11
11
|
"type": "registry:component",
|
|
12
12
|
"target": "components/ui/tabs/Tabs.vue",
|
|
13
|
-
"content": "<script setup lang=\"ts\">\nimport { Tabs as ArkTabs } from \"@ark-ui/vue/tabs\";\nimport { computed, ref, watch } from \"vue\";\nimport { cn } from \"@/lib/utils\";\
|
|
13
|
+
"content": "<script setup lang=\"ts\">\nimport { Tabs as ArkTabs } from \"@ark-ui/vue/tabs\";\nimport { computed, ref, useSlots, watch } from \"vue\";\nimport { cn } from \"@/lib/utils\";\nimport type { TabItem } from \"./types\";\n\ninterface Props {\n /** 标签页配置列表(必填) */\n items: TabItem[];\n /** 当前激活的 tab 值(配合 v-model:value);不传时为非受控 */\n value?: string;\n defaultValue?: string;\n /** 切换模式:automatic 聚焦即切换 / manual 需点击或 Enter */\n activationMode?: \"automatic\" | \"manual\";\n /** 组件级默认:面板首次激活才挂载(item.lazyMount 优先) */\n lazyMount?: boolean;\n /** 组件级默认:面板切走即卸载(item.unmountOnExit 优先) */\n unmountOnExit?: boolean;\n /** 方向:horizontal 用 ←/→ 导航,vertical 用 ↑/↓ 导航(透传 Ark,原生默认 horizontal) */\n orientation?: \"horizontal\" | \"vertical\";\n /** 焦点是否首尾循环(透传 Ark,原生默认 true) */\n loopFocus?: boolean;\n /** 点击已选中项是否可取消选中(透传 Ark,原生默认关闭;启用后取消选中时 update:value 载荷为 null) */\n deselectable?: boolean;\n /** 切换前守卫:返回 false 或 resolve false 阻止切换;仅拦截用户交互切换(受控外部赋值与自动选邻居不经过守卫) */\n beforeLeave?: (next: string | null, prev: string | null) => boolean | Promise<boolean>;\n /** 款式:segment 分段块(默认,现有外观)/ line 下划线 */\n type?: \"segment\" | \"line\";\n /** 标签栏位置:bottom/right 通过布局反转实现;与 orientation 同传时 placement 优先(勿向根元素传布局类) */\n placement?: \"top\" | \"left\" | \"right\" | \"bottom\";\n /** 面板激活时淡入过渡;对 unmountOnExit 卸载型面板无过渡 */\n animated?: boolean;\n}\n\nconst props = defineProps<Props>();\n\nconst slots = useSlots();\n\n/** 有效方向:placement 优先(right→vertical、bottom→horizontal),未传回落 orientation */\nconst effOrientation = computed<\"horizontal\" | \"vertical\">(() => {\n if (props.placement === \"right\") return \"vertical\";\n if (props.placement === \"bottom\") return \"horizontal\";\n return props.orientation ?? \"horizontal\";\n});\n\nconst isVertical = computed(() => effOrientation.value === \"vertical\");\n\nconst isLine = computed(() => props.type === \"line\");\n\nconst hasBarExtras = computed(() => !!(slots.prefix || slots.suffix));\n\n// —— 款式/布局 ——\n// placement 布局接管:仅非默认位置时加类,默认零回归;用户布局类经 fallthrough 合并不经 twMerge,文档已声明勿传\nconst placementClass = computed(() => {\n if (props.placement === \"bottom\") return \"flex flex-col-reverse\";\n if (props.placement === \"right\") return \"flex flex-row-reverse\";\n return undefined;\n});\n\nconst isBottom = computed(() => props.placement === \"bottom\");\n\n// line 款式:List 需 relative 作为 Indicator 定位锚点;vertical 用右侧竖线(border-r)\nconst listClass = computed(() =>\n cn(\n \"text-muted-foreground inline-flex w-fit items-center justify-center rounded-lg\",\n isLine.value ? \"relative bg-transparent\" : \"bg-muted p-[3px]\",\n isVertical.value\n ? [\"h-fit flex-col items-stretch\", isLine.value && \"border-r border-border\"]\n : [\"h-9\", isLine.value && \"border-b border-border\"],\n ),\n);\n\nconst triggerClass = (item: TabItem) =>\n cn(\n \"inline-flex h-[calc(100%-1px)] items-center gap-1.5 px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-ring/50 focus-visible:outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50\",\n isLine.value\n ? \"text-muted-foreground data-[selected]:text-foreground\"\n : \"border border-transparent data-[selected]:bg-background data-[selected]:text-foreground data-[selected]:shadow-sm\",\n isVertical.value ? \"w-full justify-start\" : \"flex-1 justify-center\",\n item.class,\n );\n\n// Indicator:zag 内联 position:absolute 与起始轴(horizontal→left、vertical→top 变量);粗细与正交轴由类补,长度用变量自适应选中项\nconst indicatorClass = computed(() =>\n cn(\n \"bg-primary pointer-events-none absolute\",\n isVertical.value ? \"h-[var(--height)] w-[2px]\" : \"h-[2px] w-[var(--width)]\",\n isVertical.value\n ? isBottom.value\n ? \"left-0\"\n : \"right-0\"\n : isBottom.value\n ? \"top-0\"\n : \"-bottom-px\",\n ),\n);\n\nconst animatedClass = computed(() =>\n props.animated ? \"data-[selected]:animate-[tu-tabs-fade-in_0.25s_ease]\" : undefined,\n);\n\nconst emit = defineEmits<{\n \"update:value\": [value: string];\n /** item 关闭按钮点击时触发;移除 items 由使用方处理 */\n close: [value: string];\n}>();\n\n// —— 受控桥接(DatePicker 同款):Root 恒走受控,非受控语义由内部 ref 实现 ——\n// internalValue 放宽到 null:承接 deselectable 取消选中与「全部关闭」的无选中态\nconst internalValue = ref<string | null | undefined>(props.defaultValue);\nconst currentValue = computed(() => props.value ?? internalValue.value);\n\n// —— 切换守卫(before-leave):许可器模型 ——\n// 受控桥接下绑定值是权威,zag 机器值被拉回绑定值:拒绝分支不触碰任何状态,UI 天然保持旧态\nconst guardPending = ref(false);\n\nfunction commitValue(next: string | null) {\n internalValue.value = next;\n // 运行时 deselectable 取消选中会发 null;载荷类型保持 string 以兼容既有监听器(文档已注明)\n emit(\"update:value\", next as string);\n}\n\nasync function handleValueUpdate(next: string | null) {\n const guard = props.beforeLeave;\n if (!guard) return commitValue(next);\n if (guardPending.value) return; // 上一守卫未决期间忽略并发切换\n const prev = currentValue.value ?? null;\n let result: boolean | Promise<boolean>;\n try {\n result = guard(next, prev);\n } catch {\n return; // 守卫异常按拒绝处理\n }\n if (result instanceof Promise) {\n guardPending.value = true;\n try {\n if (await result) commitValue(next);\n } catch {\n // 守卫异常按拒绝处理\n } finally {\n guardPending.value = false;\n }\n return;\n }\n if (result) commitValue(next);\n}\n\n// —— items 变更侦测:computed Set 同时覆盖数组替换与 reactive 原地变异 ——\nconst valueSet = computed(() => new Set(props.items.map((i) => i.value)));\n\n// 非受控下激活项被移除时,自动选中其前一个仍存在的项(浏览器惯例),其次后一项,全删光则无选中;\n// 该补偿不经过 before-leave 守卫\nlet prevValues: string[] = props.items.map((i) => i.value);\nwatch(\n valueSet,\n (set) => {\n const values = props.items.map((i) => i.value);\n const v = currentValue.value;\n if (props.value !== undefined || v == null || set.has(v)) {\n prevValues = values;\n return;\n }\n const oldIdx = prevValues.indexOf(v);\n const before = prevValues\n .slice(0, oldIdx)\n .reverse()\n .find((x) => set.has(x));\n const fallback = before ?? values[0] ?? null;\n internalValue.value = fallback;\n prevValues = values;\n },\n { immediate: true },\n);\n\n// —— 面板级挂载策略:复刻 ark usePresence 的 unmounted 公式,逐面板生效 ——\n// unmounted = (!active && !everActivated && lazyMount) || (unmountOnExit && !active && everActivated)\n// 说明:本版本 @ark-ui/vue 的 lazyMount/unmountOnExit 仅支持 Root 级全局策略,\n// 为实现 item 级覆盖,这里不经 Root 下发,由本组件自行计算每个面板的挂载与否。\nconst activatedValues = ref(new Set<string>());\nwatch(\n currentValue,\n (v) => {\n if (v == null || activatedValues.value.has(v)) return;\n activatedValues.value = new Set(activatedValues.value).add(v);\n },\n { immediate: true },\n);\n\nfunction isPanelUnmounted(item: TabItem): boolean {\n const active = currentValue.value === item.value;\n const everActivated = activatedValues.value.has(item.value);\n const lazyMount = item.lazyMount ?? props.lazyMount;\n const unmountOnExit = item.unmountOnExit ?? props.unmountOnExit;\n return (\n (!active && !everActivated && !!lazyMount) || (!!unmountOnExit && !active && everActivated)\n );\n}\n</script>\n\n<template>\n <ArkTabs.Root\n :model-value=\"currentValue ?? undefined\"\n :activation-mode=\"props.activationMode\"\n :orientation=\"effOrientation\"\n :loop-focus=\"props.loopFocus\"\n :deselectable=\"props.deselectable\"\n :class=\"placementClass\"\n @update:model-value=\"handleValueUpdate\"\n >\n <!-- 标签栏容器:有 prefix/suffix 时为 flex 布局;否则 display:contents 布局零回归 -->\n <div :class=\"hasBarExtras ? 'flex items-center' : 'contents'\">\n <slot name=\"prefix\" />\n <ArkTabs.List :class=\"listClass\">\n <ArkTabs.Trigger\n v-for=\"item in props.items\"\n :key=\"item.value\"\n :value=\"item.value\"\n :disabled=\"item.disabled\"\n :class=\"triggerClass(item)\"\n >\n <slot name=\"trigger\" :item=\"item\">{{ item.label }}</slot>\n <!-- 关闭按钮:button 嵌套非法,用 span + role;mousedown.prevent 阻断焦点转移到 trigger(automatic 模式会经 onFocus 选中) -->\n <span\n v-if=\"item.closable\"\n role=\"button\"\n tabindex=\"-1\"\n :aria-label=\"`关闭 ${item.label}`\"\n class=\"text-muted-foreground -mr-0.5 flex size-3.5 items-center justify-center rounded-sm text-xs opacity-60 transition-opacity hover:opacity-100\"\n @mousedown.prevent\n @click.stop=\"emit('close', item.value)\"\n @keydown.enter.stop.prevent=\"emit('close', item.value)\"\n @keydown.space.stop.prevent=\"emit('close', item.value)\"\n >×</span\n >\n </ArkTabs.Trigger>\n <!-- 下划线指示条:zag 自动计算选中项位置与过渡动画;jsdom 无布局时恒 hidden -->\n <ArkTabs.Indicator v-if=\"isLine\" :class=\"indicatorClass\" />\n </ArkTabs.List>\n <slot name=\"suffix\" />\n </div>\n\n <!-- 面板:hidden/挂载由本组件按 item 配置逐面板控制,不走 Root 的全局渲染策略 -->\n <ArkTabs.Context v-slot=\"api\">\n <template v-for=\"item in props.items\" :key=\"item.value\">\n <div\n v-if=\"!isPanelUnmounted(item)\"\n v-bind=\"api.getContentProps({ value: item.value })\"\n :class=\"cn('flex-1 outline-none', animatedClass)\"\n >\n <slot name=\"panel\" :item=\"item\" />\n </div>\n </template>\n </ArkTabs.Context>\n </ArkTabs.Root>\n</template>\n\n<style>\n/* 非 scoped:scoped 块的 @keyframes 名会被 SFC 编译器改写,与 tailwind 任意值动画类脱钩 */\n@keyframes tu-tabs-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n</style>\n"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"path": "tabs/index.ts",
|
|
17
17
|
"type": "registry:lib",
|
|
18
18
|
"target": "components/ui/tabs/index.ts",
|
|
19
|
-
"content": "export { default as Tabs } from \"./Tabs.vue\";\n"
|
|
19
|
+
"content": "export { default as Tabs } from \"./Tabs.vue\";\nexport type { TabItem } from \"./types\";\n"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "tabs/types.ts",
|
|
23
|
+
"type": "registry:lib",
|
|
24
|
+
"target": "components/ui/tabs/types.ts",
|
|
25
|
+
"content": "/** 单个标签页配置项 */\nexport interface TabItem {\n /** 唯一标识,同时作为触发按钮与面板的 value */\n value: string;\n /** 触发按钮文案 */\n label: string;\n /** 是否禁用该标签(禁用项不参与键盘导航) */\n disabled?: boolean;\n /** 面板级覆盖:首次激活才挂载(缺省回落组件级 lazyMount) */\n lazyMount?: boolean;\n /** 面板级覆盖:切走即卸载(缺省回落组件级 unmountOnExit) */\n unmountOnExit?: boolean;\n /** 追加到触发按钮的样式类 */\n class?: string;\n /** 显示关闭按钮;点击仅发出 close 事件,移除 items 由使用方处理 */\n closable?: boolean;\n}\n"
|
|
20
26
|
}
|
|
21
27
|
]
|
|
22
28
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "timeline",
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"type": "registry:ui",
|
|
6
|
+
"description": "时间轴:数据驱动 items 渲染竖向事件流,支持单列/左右交替、五种语义节点色与空心节点、#item 作用域插槽自定义内容。",
|
|
7
|
+
"registryDependencies": ["utils"],
|
|
8
|
+
"dependencies": ["class-variance-authority@^0.7.1"],
|
|
9
|
+
"files": [
|
|
10
|
+
{
|
|
11
|
+
"path": "timeline/Timeline.vue",
|
|
12
|
+
"type": "registry:component",
|
|
13
|
+
"target": "components/ui/timeline/Timeline.vue",
|
|
14
|
+
"content": "<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { cn } from \"@/lib/utils\";\nimport {\n timelineDotVariants,\n timelineItemVariants,\n timelineVariants,\n type TimelineItemData,\n type TimelineItemVariants,\n type TimelineVariants,\n} from \"./index\";\n\ninterface Props {\n /** 数据源:按数组顺序自上而下渲染 */\n items: TimelineItemData[];\n /** 布局模式:right 单列(节点靠左)/ alternate 沿中轴左右交替 */\n mode?: TimelineVariants[\"mode\"];\n /** 尺寸:联动节点大小、连线位置与字号间距 */\n size?: TimelineItemVariants[\"size\"];\n /** 追加/覆盖样式(经 cn 合并) */\n class?: string;\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n mode: \"right\",\n size: \"default\",\n});\n\nconst rootClass = computed(() => cn(timelineVariants({ mode: props.mode }), props.class));\n\nconst itemClass = computed(() => timelineItemVariants({ mode: props.mode, size: props.size }));\n\nconst titleClass = computed(() =>\n props.size === \"sm\"\n ? \"text-xs leading-4 font-medium text-foreground\"\n : \"text-sm font-medium leading-5 text-foreground\",\n);\n\nconst descriptionClass = computed(() =>\n props.size === \"sm\"\n ? \"mt-1 text-xs leading-relaxed text-muted-foreground\"\n : \"mt-1 text-sm leading-relaxed text-muted-foreground\",\n);\n\n/** 连线类:首末项按 index 裁切(不用 first:/last: 伪类——line 恒为 li 首个子元素,伪类会全量误命中) */\nfunction lineClass(index: number): string {\n const isFirst = index === 0;\n const isLast = index === props.items.length - 1;\n return cn(\n \"absolute w-0.5 -translate-x-1/2 bg-border\",\n props.mode === \"alternate\" ? \"left-1/2\" : props.size === \"sm\" ? \"left-[5px]\" : \"left-[6px]\",\n isFirst ? \"top-[10px]\" : \"top-0\",\n isLast ? \"bottom-[calc(100%-10px)]\" : \"bottom-0\",\n );\n}\n\n/** 节点类:颜色/空心取自单项数据,位置与尺寸取自组件变体 */\nfunction dotClass(item: TimelineItemData): string {\n return cn(\n timelineDotVariants({\n mode: props.mode,\n size: props.size,\n color: item.dotColor,\n hollow: item.hollow,\n }),\n );\n}\n\n/** 内容区类:right 占第 2 列;alternate 按奇偶交替占第 1/3 列并切换对齐 */\nfunction contentClass(index: number): string {\n const base = \"min-w-0 flex flex-col\";\n if (props.mode === \"alternate\") {\n return cn(\n base,\n index % 2 === 0\n ? \"col-start-1 row-start-1 pr-4 text-right\"\n : \"col-start-3 row-start-1 pl-4 text-left\",\n );\n }\n return cn(base, props.size === \"sm\" ? \"pl-2.5\" : \"pl-3\");\n}\n\n/** 时间戳类:bottom 时 DOM 仍在前部,仅切 order-last 移到内容下方(不分支 DOM) */\nfunction timestampClass(item: TimelineItemData): string {\n return item.timestampPlacement === \"bottom\"\n ? \"mb-1 mt-1.5 order-last text-xs leading-4 text-muted-foreground tabular-nums\"\n : \"mb-1 text-xs leading-4 text-muted-foreground tabular-nums\";\n}\n</script>\n\n<template>\n <ol data-slot=\"timeline\" :class=\"rootClass\">\n <li v-for=\"(item, index) in items\" :key=\"index\" data-slot=\"timeline-item\" :class=\"itemClass\">\n <span data-slot=\"timeline-line\" aria-hidden=\"true\" :class=\"lineClass(index)\" />\n <span data-slot=\"timeline-dot\" :class=\"dotClass(item)\" />\n <div data-slot=\"timeline-content\" :class=\"contentClass(index)\">\n <!-- #item 整项内容覆盖(dot 与 line 不受影响),默认渲染 timestamp/title/content -->\n <slot name=\"item\" :item=\"item\" :index=\"index\">\n <span\n v-if=\"item.timestamp\"\n data-slot=\"timeline-timestamp\"\n :class=\"timestampClass(item)\"\n >{{ item.timestamp }}</span\n >\n <p v-if=\"item.title\" data-slot=\"timeline-title\" :class=\"titleClass\">{{ item.title }}</p>\n <p v-if=\"item.content\" data-slot=\"timeline-description\" :class=\"descriptionClass\">\n {{ item.content }}\n </p>\n </slot>\n </div>\n </li>\n </ol>\n</template>\n"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "timeline/index.ts",
|
|
18
|
+
"type": "registry:lib",
|
|
19
|
+
"target": "components/ui/timeline/index.ts",
|
|
20
|
+
"content": "import { cva, type VariantProps } from \"class-variance-authority\";\n\nexport { default as Timeline } from \"./Timeline.vue\";\n\n/** 时间轴单项数据 */\nexport interface TimelineItemData {\n /** 事件标题 */\n title?: string;\n /** 事件描述文本 */\n content?: string;\n /** 时间戳文案(纯展示,不解析日期) */\n timestamp?: string;\n /** 时间戳位置:内容上方(默认)或内容下方 */\n timestampPlacement?: \"top\" | \"bottom\";\n /** 节点颜色(语义 token) */\n dotColor?: \"primary\" | \"success\" | \"warning\" | \"destructive\" | \"muted\";\n /** 空心节点(描边 + 背景填充,颜色跟随 dotColor) */\n hollow?: boolean;\n}\n\n/** 容器变体:alternate 模式加 isolate 隔离堆叠上下文,避免连线/节点受外部 z-index 干扰 */\nexport const timelineVariants = cva(\"relative m-0 list-none p-0\", {\n variants: {\n mode: {\n right: \"\",\n alternate: \"isolate\",\n },\n },\n defaultVariants: {\n mode: \"right\",\n },\n});\n\nexport type TimelineVariants = VariantProps<typeof timelineVariants>;\n\n/** 项变体:li 的 last:pb-0 相对 ol 语义正确;首末项连线裁切在模板内按 index 计算,不用伪类 */\nexport const timelineItemVariants = cva(\"relative grid items-start last:pb-0\", {\n variants: {\n mode: {\n right: \"\",\n alternate: \"\",\n },\n size: {\n default: \"pb-8\",\n sm: \"pb-6\",\n },\n },\n compoundVariants: [\n { mode: \"right\", size: \"default\", class: \"grid-cols-[12px_minmax(0,1fr)]\" },\n { mode: \"right\", size: \"sm\", class: \"grid-cols-[10px_minmax(0,1fr)]\" },\n {\n mode: \"alternate\",\n size: \"default\",\n class: \"grid-cols-[minmax(0,1fr)_12px_minmax(0,1fr)]\",\n },\n { mode: \"alternate\", size: \"sm\", class: \"grid-cols-[minmax(0,1fr)_10px_minmax(0,1fr)]\" },\n ],\n defaultVariants: {\n mode: \"right\",\n size: \"default\",\n },\n});\n\nexport type TimelineItemVariants = VariantProps<typeof timelineItemVariants>;\n\n/** 节点变体:hollow × color 经 compoundVariants 配对出边框色,实心直接配底色 */\nexport const timelineDotVariants = cva(\"relative z-10 mt-1 block shrink-0 rounded-full\", {\n variants: {\n mode: {\n right: \"col-start-1\",\n alternate: \"col-start-2 row-start-1\",\n },\n size: {\n default: \"size-3\",\n sm: \"size-2.5 mt-[5px]\",\n },\n color: {\n primary: \"\",\n success: \"\",\n warning: \"\",\n destructive: \"\",\n muted: \"\",\n },\n hollow: {\n true: \"border-2 bg-background\",\n false: \"\",\n },\n },\n compoundVariants: [\n { hollow: false, color: \"primary\", class: \"bg-primary\" },\n { hollow: false, color: \"success\", class: \"bg-success\" },\n { hollow: false, color: \"warning\", class: \"bg-warning\" },\n { hollow: false, color: \"destructive\", class: \"bg-destructive\" },\n { hollow: false, color: \"muted\", class: \"bg-muted-foreground\" },\n { hollow: true, color: \"primary\", class: \"border-primary\" },\n { hollow: true, color: \"success\", class: \"border-success\" },\n { hollow: true, color: \"warning\", class: \"border-warning\" },\n { hollow: true, color: \"destructive\", class: \"border-destructive\" },\n { hollow: true, color: \"muted\", class: \"border-muted-foreground\" },\n ],\n defaultVariants: {\n mode: \"right\",\n size: \"default\",\n color: \"primary\",\n hollow: false,\n },\n});\n\nexport type TimelineDotVariants = VariantProps<typeof timelineDotVariants>;\n"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|