@yunlefun/vue 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -37
- package/components/YlfAccordion.vue +165 -0
- package/components/YlfAvatar.vue +70 -0
- package/components/YlfBadge.vue +142 -0
- package/components/YlfBottomMenu.vue +23 -6
- package/components/YlfBottomMenuItem.vue +41 -21
- package/components/YlfButton.vue +290 -7
- package/components/YlfCard.vue +74 -3
- package/components/YlfCheckbox.vue +84 -0
- package/components/YlfDialog.vue +174 -0
- package/components/YlfDropdownMenu.vue +98 -0
- package/components/YlfLogo.vue +83 -7
- package/components/YlfPopover.vue +64 -0
- package/components/YlfProgress.vue +65 -0
- package/components/YlfRadioGroup.vue +120 -0
- package/components/YlfSelect.vue +195 -0
- package/components/YlfSeparator.vue +68 -0
- package/components/YlfSlider.vue +89 -0
- package/components/YlfSwitch.vue +111 -0
- package/components/YlfTabs.vue +117 -0
- package/components/YlfTooltip.vue +67 -0
- package/components/accordion/demo.vue +11 -0
- package/components/accordion/index.md +19 -0
- package/components/avatar/demo.vue +9 -0
- package/components/avatar/index.md +15 -0
- package/components/badge/demo.vue +84 -0
- package/components/badge/index.md +41 -0
- package/components/bottom-menu/demo.vue +19 -10
- package/components/bottom-menu/index.md +25 -0
- package/components/button/demo.vue +101 -3
- package/components/button/index.md +41 -0
- package/components/card/demo.vue +76 -3
- package/components/card/index.md +19 -0
- package/components/checkbox/demo.vue +28 -0
- package/components/checkbox/index.md +14 -0
- package/components/common/demo.vue +7 -1
- package/components/common/index.md +10 -0
- package/components/dialog/demo.vue +33 -0
- package/components/dialog/index.md +30 -0
- package/components/dropdown-menu/demo.vue +27 -0
- package/components/dropdown-menu/index.md +27 -0
- package/components/popover/demo.vue +18 -0
- package/components/popover/index.md +21 -0
- package/components/progress/demo.vue +24 -0
- package/components/progress/index.md +17 -0
- package/components/radio/demo.vue +20 -0
- package/components/radio/index.md +23 -0
- package/components/select/demo.vue +20 -0
- package/components/select/index.md +41 -0
- package/components/separator/demo.vue +52 -0
- package/components/separator/index.md +19 -0
- package/components/slider/demo.vue +23 -0
- package/components/slider/index.md +16 -0
- package/components/switch/demo.vue +33 -0
- package/components/switch/index.md +18 -0
- package/components/tabs/demo.vue +30 -0
- package/components/tabs/index.md +18 -0
- package/components/theme.ts +5 -0
- package/components/tooltip/demo.vue +19 -0
- package/components/tooltip/index.md +21 -0
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/package.json +32 -3
|
@@ -1,5 +1,103 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const loading = ref(false)
|
|
5
|
+
function fakeLoad() {
|
|
6
|
+
loading.value = true
|
|
7
|
+
setTimeout(() => (loading.value = false), 1600)
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
1
11
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
12
|
+
<div class="flex flex-col gap-5">
|
|
13
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
14
|
+
<YlfButton variant="primary">
|
|
15
|
+
晴空蓝 Primary
|
|
16
|
+
</YlfButton>
|
|
17
|
+
<YlfButton variant="accent">
|
|
18
|
+
默认强调
|
|
19
|
+
</YlfButton>
|
|
20
|
+
<YlfButton variant="accent" tone="sun">
|
|
21
|
+
发现精选
|
|
22
|
+
</YlfButton>
|
|
23
|
+
<YlfButton variant="secondary">
|
|
24
|
+
Secondary
|
|
25
|
+
</YlfButton>
|
|
26
|
+
<YlfButton variant="soft">
|
|
27
|
+
Soft
|
|
28
|
+
</YlfButton>
|
|
29
|
+
<YlfButton variant="ghost">
|
|
30
|
+
Ghost
|
|
31
|
+
</YlfButton>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
35
|
+
<YlfButton variant="accent" tone="cyan">
|
|
36
|
+
打开工具
|
|
37
|
+
</YlfButton>
|
|
38
|
+
<YlfButton variant="accent" tone="coral">
|
|
39
|
+
参与活动
|
|
40
|
+
</YlfButton>
|
|
41
|
+
<YlfButton variant="accent" tone="pink">
|
|
42
|
+
开始创作
|
|
43
|
+
</YlfButton>
|
|
44
|
+
<YlfButton variant="accent" tone="green">
|
|
45
|
+
完成设置
|
|
46
|
+
</YlfButton>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
50
|
+
<YlfButton variant="accent" tone="pink" appearance="soft">
|
|
51
|
+
收藏灵感
|
|
52
|
+
</YlfButton>
|
|
53
|
+
<YlfButton variant="accent" tone="cyan" appearance="outline">
|
|
54
|
+
看看工具
|
|
55
|
+
</YlfButton>
|
|
56
|
+
<YlfButton variant="success" appearance="soft">
|
|
57
|
+
保存成功
|
|
58
|
+
</YlfButton>
|
|
59
|
+
<YlfButton variant="danger" appearance="outline">
|
|
60
|
+
移除内容
|
|
61
|
+
</YlfButton>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
65
|
+
<YlfButton variant="success">
|
|
66
|
+
成功
|
|
67
|
+
</YlfButton>
|
|
68
|
+
<YlfButton variant="warning">
|
|
69
|
+
提醒
|
|
70
|
+
</YlfButton>
|
|
71
|
+
<YlfButton variant="danger">
|
|
72
|
+
危险
|
|
73
|
+
</YlfButton>
|
|
74
|
+
<YlfButton variant="secondary" disabled>
|
|
75
|
+
禁用
|
|
76
|
+
</YlfButton>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
80
|
+
<YlfButton size="sm">
|
|
81
|
+
Small
|
|
82
|
+
</YlfButton>
|
|
83
|
+
<YlfButton size="md">
|
|
84
|
+
Medium
|
|
85
|
+
</YlfButton>
|
|
86
|
+
<YlfButton size="lg">
|
|
87
|
+
Large
|
|
88
|
+
</YlfButton>
|
|
89
|
+
<YlfButton :round="false">
|
|
90
|
+
标准圆角
|
|
91
|
+
</YlfButton>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
95
|
+
<YlfButton :loading="loading" @click="fakeLoad">
|
|
96
|
+
<template #icon>
|
|
97
|
+
<div i-ri-magic-line />
|
|
98
|
+
</template>
|
|
99
|
+
{{ loading ? '召唤中…' : '点我加载' }}
|
|
100
|
+
</YlfButton>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
5
103
|
</template>
|
|
@@ -2,3 +2,44 @@
|
|
|
2
2
|
title: Button
|
|
3
3
|
title_zh: 按钮
|
|
4
4
|
---
|
|
5
|
+
|
|
6
|
+
主操作默认使用晴空蓝实色;品牌展示可选择 `accent` 纯色变体,配合 `tone` 指定强调色。描边、柔色和透明按钮用于次级操作,成功、提醒与危险变体表达对应的状态语义。
|
|
7
|
+
|
|
8
|
+
状态按钮与徽标使用同一套多巴胺色板:成功为鲜绿、提醒为明黄、危险为珊瑚橙,文字使用配套的同色相深色 token。
|
|
9
|
+
|
|
10
|
+
## Registry
|
|
11
|
+
|
|
12
|
+
Button 可以通过 URL 将组件源码和共享品牌 token 复制进业务项目;命令、边界和发布验收见 [Registry 分发](/guide/registry)。稳定基础组件仍优先通过 `@yunlefun/vue` 使用。
|
|
13
|
+
|
|
14
|
+
## 强调程度
|
|
15
|
+
|
|
16
|
+
同一个色彩角色可以选择 `appearance="solid"`(实色重点)、`soft`(柔色分类)或 `outline`(描边次级)。该属性只作用于 `accent` 与状态变体,旧 `aurora` 别名也支持它;其余变体沿用自身外观。`variant="soft"` 仍表示品牌蓝柔色按钮,彩色柔色按钮请使用 `variant="accent" appearance="soft"`。
|
|
17
|
+
|
|
18
|
+
## Props
|
|
19
|
+
|
|
20
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
21
|
+
| ------------ | ----------------------------- | --------------------------------------------------------------------------------- | ---------- |
|
|
22
|
+
| `variant` | 风格 | `primary \| accent \| secondary \| soft \| ghost \| success \| warning \| danger` | `primary` |
|
|
23
|
+
| `tone` | 强调色,仅作用于 `accent` | `blue \| sun \| cyan \| coral \| pink \| green` | `blue` |
|
|
24
|
+
| `appearance` | `accent` 与状态变体的强调程度 | `solid \| soft \| outline` | `solid` |
|
|
25
|
+
| `size` | 尺寸 | `sm \| md \| lg` | `md` |
|
|
26
|
+
| `round` | 胶囊圆角(云是软的) | `boolean` | `true` |
|
|
27
|
+
| `block` | 占满整行宽度 | `boolean` | `false` |
|
|
28
|
+
| `loading` | 加载态 | `boolean` | `false` |
|
|
29
|
+
| `disabled` | 禁用 | `boolean` | `false` |
|
|
30
|
+
| `tag` | 渲染标签,如 `'a'` | `string` | `'button'` |
|
|
31
|
+
|
|
32
|
+
`accent` 的 `tone` 可选 `blue | sun | cyan | coral | pink | green`,默认为 `blue`(晴空蓝)。其他变体保持自己的品牌或状态语义,不受 `tone` 影响。旧 `aurora` 值仍可接收,效果映射到 `accent`。
|
|
33
|
+
|
|
34
|
+
## Slots
|
|
35
|
+
|
|
36
|
+
| 名称 | 说明 |
|
|
37
|
+
| --------- | -------- |
|
|
38
|
+
| `default` | 按钮文字 |
|
|
39
|
+
| `icon` | 左侧图标 |
|
|
40
|
+
|
|
41
|
+
## Events
|
|
42
|
+
|
|
43
|
+
| 名称 | 说明 |
|
|
44
|
+
| ------- | --------------------------------------------- |
|
|
45
|
+
| `click` | 点击时触发(`disabled` / `loading` 下不触发) |
|
package/components/card/demo.vue
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<div class="ylf-card-demo grid gap-4 sm:grid-cols-2">
|
|
3
|
+
<YlfCard variant="soft" :hoverable="false">
|
|
4
|
+
<div class="ic ic-sun">
|
|
5
|
+
<div i-ri-sparkling-2-line />
|
|
6
|
+
</div>
|
|
7
|
+
<h3>柔影卡片</h3>
|
|
8
|
+
<p>默认表面,色彩浸染的柔和投影,承载主要内容。</p>
|
|
9
|
+
</YlfCard>
|
|
10
|
+
|
|
11
|
+
<YlfCard variant="glass" :hoverable="false">
|
|
12
|
+
<div class="ic ic-brand">
|
|
13
|
+
<div i-ri-cloud-line />
|
|
14
|
+
</div>
|
|
15
|
+
<h3>云玻璃卡片</h3>
|
|
16
|
+
<p>背景模糊通透,适合浮层、导航与覆盖在彩云之上的内容。</p>
|
|
17
|
+
</YlfCard>
|
|
18
|
+
|
|
19
|
+
<YlfCard variant="accent" tone="coral" :hoverable="false">
|
|
20
|
+
<div class="ic ic-coral">
|
|
21
|
+
<div i-ri-add-circle-line />
|
|
22
|
+
</div>
|
|
23
|
+
<h3>纯色强调卡片</h3>
|
|
24
|
+
<p>珊瑚橙标记精选内容,正文表面保持清晰安静。</p>
|
|
25
|
+
</YlfCard>
|
|
26
|
+
|
|
27
|
+
<YlfCard variant="tinted" tone="pink" :hoverable="false">
|
|
28
|
+
<YlfBadge variant="accent" tone="pink" appearance="soft">
|
|
29
|
+
创作
|
|
30
|
+
</YlfBadge>
|
|
31
|
+
<h3 class="mt-3!">
|
|
32
|
+
给灵感一点颜色
|
|
33
|
+
</h3>
|
|
34
|
+
<p>柔色铺开在表面,实色留给重点。用同一组 token 组织内容层级。</p>
|
|
35
|
+
</YlfCard>
|
|
36
|
+
</div>
|
|
5
37
|
</template>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
.ylf-card-demo h3 {
|
|
41
|
+
margin: 0 0 6px;
|
|
42
|
+
font-size: 17px;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ylf-card-demo p {
|
|
47
|
+
margin: 0;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
line-height: 1.6;
|
|
50
|
+
color: var(--ylf-c-text-2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ylf-card-demo .ic {
|
|
54
|
+
width: 44px;
|
|
55
|
+
height: 44px;
|
|
56
|
+
margin-bottom: 14px;
|
|
57
|
+
border-radius: 13px;
|
|
58
|
+
display: grid;
|
|
59
|
+
place-items: center;
|
|
60
|
+
color: #fff;
|
|
61
|
+
font-size: 22px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ylf-card-demo .ic-sun {
|
|
65
|
+
background: var(--ylf-accent-sun);
|
|
66
|
+
color: var(--ylf-accent-sun-on);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ylf-card-demo .ic-brand {
|
|
70
|
+
background: var(--ylf-c-brand);
|
|
71
|
+
color: var(--ylf-c-text-on-accent);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ylf-card-demo .ic-coral {
|
|
75
|
+
background: var(--ylf-accent-coral);
|
|
76
|
+
color: var(--ylf-accent-coral-on);
|
|
77
|
+
}
|
|
78
|
+
</style>
|
package/components/card/index.md
CHANGED
|
@@ -2,3 +2,22 @@
|
|
|
2
2
|
title: Card
|
|
3
3
|
title_zh: 卡片
|
|
4
4
|
---
|
|
5
|
+
|
|
6
|
+
以中性表面承载内容,可选云玻璃、顶部纯色强调或 `tinted` 柔色表面。静态内容显式关闭 `hoverable`,避免上浮暗示可点击。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ----------- | ------------------------------ | ----------------------------------------------- | -------- |
|
|
12
|
+
| `variant` | 表面风格 | `soft \| glass \| accent \| tinted` | `soft` |
|
|
13
|
+
| `tone` | 强调色,用于 `accent / tinted` | `blue \| sun \| cyan \| coral \| pink \| green` | `blue` |
|
|
14
|
+
| `hoverable` | 悬停时轻轻抬升 | `boolean` | `true` |
|
|
15
|
+
| `padding` | 内边距(任意 CSS 值) | `string` | `'22px'` |
|
|
16
|
+
|
|
17
|
+
## Slots
|
|
18
|
+
|
|
19
|
+
| 名称 | 说明 |
|
|
20
|
+
| --------- | -------- |
|
|
21
|
+
| `default` | 卡片内容 |
|
|
22
|
+
|
|
23
|
+
`tone` 接受 `blue | sun | cyan | coral | pink | green`,默认 `blue`(晴空蓝),在 `accent` 和 `tinted` 下生效。旧 `gradient` 值映射到 `accent` 的纯色顶边,不再绘制渐变边框。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const a = ref(true)
|
|
5
|
+
const b = ref(false)
|
|
6
|
+
const c = ref<boolean | 'indeterminate'>('indeterminate')
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="flex flex-col gap-4">
|
|
11
|
+
<div class="flex items-center gap-2">
|
|
12
|
+
<YlfCheckbox v-model="a" />
|
|
13
|
+
<span class="text-sm">已勾选</span>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="flex items-center gap-2">
|
|
16
|
+
<YlfCheckbox v-model="b" />
|
|
17
|
+
<span class="text-sm">未勾选</span>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="flex items-center gap-2">
|
|
20
|
+
<YlfCheckbox v-model="c" />
|
|
21
|
+
<span class="text-sm">半选 indeterminate</span>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="flex items-center gap-2 op-60">
|
|
24
|
+
<YlfCheckbox :model-value="true" disabled />
|
|
25
|
+
<span class="text-sm">禁用</span>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Checkbox
|
|
3
|
+
title_zh: 复选框
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
复选框:行为与可访问性基于 [reka-ui](https://reka-ui.com)(`role="checkbox"`、键盘、`indeterminate` 三态),外观使用共享主题 token。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ---------- | ---------- | ---------------------------- | ------- |
|
|
12
|
+
| `v-model` | 勾选状态 | `boolean \| 'indeterminate'` | `false` |
|
|
13
|
+
| `value` | 表单提交值 | `string` | — |
|
|
14
|
+
| `disabled` | 禁用 | `boolean` | `false` |
|
|
@@ -2,3 +2,13 @@
|
|
|
2
2
|
title: Common
|
|
3
3
|
title_zh: 常见组件
|
|
4
4
|
---
|
|
5
|
+
|
|
6
|
+
## 品牌标志
|
|
7
|
+
|
|
8
|
+
`YlfLogo` 使用云乐坊主站的正式标志,默认晴空蓝,随明暗主题切换。云朵作为品牌装饰,与正式标志区分。使用方式见[品牌与界面](/guide/patterns)。
|
|
9
|
+
|
|
10
|
+
| 属性 | 可选值 | 默认值 |
|
|
11
|
+
| ---------- | ------------------------- | ---------- |
|
|
12
|
+
| `size` | `sm` / `md` / `lg` | `md` |
|
|
13
|
+
| `layout` | `vertical` / `horizontal` | `vertical` |
|
|
14
|
+
| `wordmark` | `boolean` | `true` |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const open = ref(false)
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<YlfDialog
|
|
9
|
+
v-model:open="open"
|
|
10
|
+
title="云端之上"
|
|
11
|
+
description="这是一个基于 reka-ui 的对话框:自带遮罩、焦点陷阱、ESC / 点击外部关闭、滚动锁与 aria 关联。"
|
|
12
|
+
>
|
|
13
|
+
<template #trigger>
|
|
14
|
+
<YlfButton variant="primary">
|
|
15
|
+
打开对话框
|
|
16
|
+
</YlfButton>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<div class="flex flex-col gap-4">
|
|
20
|
+
<p class="text-sm">
|
|
21
|
+
行为由 reka-ui 提供,皮肤是云乐坊 token —— 试试按 <kbd>Esc</kbd> 或点击遮罩关闭。
|
|
22
|
+
</p>
|
|
23
|
+
<div class="flex justify-end gap-2">
|
|
24
|
+
<YlfButton variant="secondary" size="sm" @click="open = false">
|
|
25
|
+
取消
|
|
26
|
+
</YlfButton>
|
|
27
|
+
<YlfButton variant="primary" size="sm" @click="open = false">
|
|
28
|
+
确定
|
|
29
|
+
</YlfButton>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</YlfDialog>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dialog
|
|
3
|
+
title_zh: 对话框
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
对话框:行为与可访问性全部基于 [reka-ui](https://reka-ui.com)(遮罩、焦点陷阱、`Esc` / 点击外部关闭、滚动锁、`aria-labelledby` / `aria-describedby`),外观使用共享主题 token。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ----------------- | -------------------------------- | --------- | ---------- |
|
|
12
|
+
| `v-model:open` | 显隐状态 | `boolean` | `false` |
|
|
13
|
+
| `title` | 可见标题 | `string` | — |
|
|
14
|
+
| `description` | 描述 | `string` | — |
|
|
15
|
+
| `accessibleTitle` | 无可见标题时供辅助技术读取的标题 | `string` | `'对话框'` |
|
|
16
|
+
|
|
17
|
+
建议始终提供 `title`。只有视觉设计明确隐藏标题时,才改用描述场景的 `accessible-title`。
|
|
18
|
+
|
|
19
|
+
## Registry
|
|
20
|
+
|
|
21
|
+
Dialog 可通过 [Registry 分发](/guide/registry)复制源码;安装时会自动带入 `reka-ui`、Sass 与共享 token。
|
|
22
|
+
|
|
23
|
+
## Slots
|
|
24
|
+
|
|
25
|
+
| 名称 | 说明 |
|
|
26
|
+
| ------------- | ------------------------------------------ |
|
|
27
|
+
| `trigger` | 触发器(`as-child`,把行为透传给你的按钮) |
|
|
28
|
+
| `title` | 自定义标题 |
|
|
29
|
+
| `description` | 自定义描述 |
|
|
30
|
+
| `default` | 正文内容 |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const last = ref('')
|
|
5
|
+
const items = [
|
|
6
|
+
{ label: '个人资料', value: 'profile' },
|
|
7
|
+
{ label: '云币钱包', value: 'wallet' },
|
|
8
|
+
{ label: '偏好设置', value: 'settings' },
|
|
9
|
+
{ separator: true },
|
|
10
|
+
{ label: '退出登录', value: 'logout' },
|
|
11
|
+
]
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="flex flex-col gap-3">
|
|
16
|
+
<YlfDropdownMenu :items="items" @select="last = $event">
|
|
17
|
+
<template #trigger>
|
|
18
|
+
<YlfButton variant="secondary">
|
|
19
|
+
菜单 ▾
|
|
20
|
+
</YlfButton>
|
|
21
|
+
</template>
|
|
22
|
+
</YlfDropdownMenu>
|
|
23
|
+
<p class="text-sm op-70">
|
|
24
|
+
最近选择:{{ last || '(无)' }}
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dropdown Menu
|
|
3
|
+
title_zh: 下拉菜单
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
下拉菜单:定位、键盘导航(方向键 / Home / End / 首字母)、焦点管理基于 [reka-ui](https://reka-ui.com),外观走 token。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ------- | ------ | ------------ | ------ |
|
|
12
|
+
| `items` | 菜单项 | `MenuItem[]` | — |
|
|
13
|
+
|
|
14
|
+
### MenuItem
|
|
15
|
+
|
|
16
|
+
| 字段 | 说明 | 类型 |
|
|
17
|
+
| ----------- | ------------ | ---------- |
|
|
18
|
+
| `label` | 文案 | `string` |
|
|
19
|
+
| `value` | 选中值 | `string` |
|
|
20
|
+
| `disabled` | 禁用 | `boolean?` |
|
|
21
|
+
| `separator` | 渲染为分隔线 | `boolean?` |
|
|
22
|
+
|
|
23
|
+
## Events
|
|
24
|
+
|
|
25
|
+
| 名称 | 说明 |
|
|
26
|
+
| -------- | ---------------------------- |
|
|
27
|
+
| `select` | 选中某项时触发,回传 `value` |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<YlfPopover side="bottom" align="start">
|
|
3
|
+
<template #trigger>
|
|
4
|
+
<YlfButton variant="primary">
|
|
5
|
+
打开浮层
|
|
6
|
+
</YlfButton>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<div class="flex flex-col gap-2">
|
|
10
|
+
<p class="m-0 text-sm font-600">
|
|
11
|
+
云乐坊浮层
|
|
12
|
+
</p>
|
|
13
|
+
<p class="m-0 text-sm op-70">
|
|
14
|
+
定位、点击外部关闭、焦点管理都来自 reka-ui,皮肤是云乐坊 token。
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
</YlfPopover>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Popover
|
|
3
|
+
title_zh: 浮层
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
浮层:定位、点击外部关闭、焦点管理基于 [reka-ui](https://reka-ui.com),外观走 token。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| -------------- | -------- | -------------------------------- | -------- |
|
|
12
|
+
| `v-model:open` | 显隐状态 | `boolean` | `false` |
|
|
13
|
+
| `side` | 方向 | `top \| right \| bottom \| left` | `bottom` |
|
|
14
|
+
| `align` | 对齐 | `start \| center \| end` | `center` |
|
|
15
|
+
|
|
16
|
+
## Slots
|
|
17
|
+
|
|
18
|
+
| 名称 | 说明 |
|
|
19
|
+
| --------- | ---------------------- |
|
|
20
|
+
| `trigger` | 触发元素(`as-child`) |
|
|
21
|
+
| `default` | 浮层内容 |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const value = ref(40)
|
|
5
|
+
function step(d: number) {
|
|
6
|
+
value.value = Math.max(0, Math.min(100, value.value + d))
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex flex-col gap-5">
|
|
12
|
+
<YlfProgress :value="value" aria-label="主色进度" />
|
|
13
|
+
<YlfProgress :value="value" variant="accent" tone="green" aria-label="完成进度" />
|
|
14
|
+
<div class="flex items-center gap-3">
|
|
15
|
+
<YlfButton size="sm" variant="secondary" @click="step(-10)">
|
|
16
|
+
−10
|
|
17
|
+
</YlfButton>
|
|
18
|
+
<YlfButton size="sm" variant="primary" @click="step(10)">
|
|
19
|
+
+10
|
|
20
|
+
</YlfButton>
|
|
21
|
+
<span class="text-sm op-70">{{ value }}%</span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Progress
|
|
3
|
+
title_zh: 进度条
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
进度条:基于 [reka-ui](https://reka-ui.com)(`role="progressbar"` + aria 值),外观走 token,可选高饱和纯色填充。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| --------- | ------------------------- | ----------------------------------------------- | ------- |
|
|
12
|
+
| `value` | 当前进度 | `number` | `0` |
|
|
13
|
+
| `max` | 最大值 | `number` | `100` |
|
|
14
|
+
| `variant` | 填充 | `brand \| accent` | `brand` |
|
|
15
|
+
| `tone` | 强调色,仅作用于 `accent` | `blue \| sun \| cyan \| coral \| pink \| green` | `blue` |
|
|
16
|
+
|
|
17
|
+
`tone` 接受 `blue | sun | cyan | coral | pink | green`,默认 `blue`(晴空蓝),只在 `accent` 下生效。旧 `aurora` 值映射到 `accent`。同一流程中的同类状态使用同一种颜色。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const picked = ref('iris')
|
|
5
|
+
const options = [
|
|
6
|
+
{ label: '晴空蓝', value: 'sky' },
|
|
7
|
+
{ label: '鸢尾紫', value: 'iris' },
|
|
8
|
+
{ label: '兰紫粉', value: 'pink' },
|
|
9
|
+
{ label: '禁用项', value: 'disabled', disabled: true },
|
|
10
|
+
]
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div class="flex flex-col gap-4">
|
|
15
|
+
<YlfRadioGroup v-model="picked" :options="options" orientation="horizontal" />
|
|
16
|
+
<p class="text-sm op-70">
|
|
17
|
+
当前:{{ picked }}
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Radio
|
|
3
|
+
title_zh: 单选框
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
单选框组:行为与可访问性基于 [reka-ui](https://reka-ui.com)(`role="radiogroup"`、方向键 roving focus),外观使用共享主题 token。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ------------- | -------- | ------------------------ | ---------- |
|
|
12
|
+
| `v-model` | 选中值 | `string` | — |
|
|
13
|
+
| `options` | 选项列表 | `RadioOption[]` | — |
|
|
14
|
+
| `orientation` | 排列方向 | `vertical \| horizontal` | `vertical` |
|
|
15
|
+
| `disabled` | 整组禁用 | `boolean` | `false` |
|
|
16
|
+
|
|
17
|
+
### RadioOption
|
|
18
|
+
|
|
19
|
+
| 字段 | 说明 | 类型 |
|
|
20
|
+
| ---------- | -------- | ---------- |
|
|
21
|
+
| `label` | 文案 | `string` |
|
|
22
|
+
| `value` | 值 | `string` |
|
|
23
|
+
| `disabled` | 禁用该项 | `boolean?` |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const picked = ref('')
|
|
5
|
+
const options = [
|
|
6
|
+
{ label: '晴空蓝', value: 'blue', color: 'var(--ylf-accent-blue)' },
|
|
7
|
+
{ label: '明黄', value: 'sun', color: 'var(--ylf-accent-sun)' },
|
|
8
|
+
{ label: '桃粉', value: 'pink', color: 'var(--ylf-accent-pink)' },
|
|
9
|
+
{ label: '暂不可选', value: 'x', disabled: true },
|
|
10
|
+
]
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div class="flex flex-col gap-3">
|
|
15
|
+
<YlfSelect v-model="picked" :options="options" placeholder="选择一种颜色" />
|
|
16
|
+
<p class="text-sm op-70">
|
|
17
|
+
当前:{{ picked || '(未选)' }}
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Select
|
|
3
|
+
title_zh: 选择器
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
选择器:定位、键盘导航、首字母检索、滚动基于 [reka-ui](https://reka-ui.com),外观走 token。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ------------- | ------------------------------------------ | ---------------- | -------- |
|
|
12
|
+
| `v-model` | 选中值 | `string` | — |
|
|
13
|
+
| `options` | 选项 `{ label, value, disabled?, color? }` | `SelectOption[]` | — |
|
|
14
|
+
| `placeholder` | 占位文案 | `string` | `请选择` |
|
|
15
|
+
| `disabled` | 禁用 | `boolean` | `false` |
|
|
16
|
+
|
|
17
|
+
`id`、`class`、`style`、`aria-label` 和 `aria-labelledby` 等属性会传给触发按钮。使用可见标签时,通过 `<label for="…">` 与组件的 `id` 关联;没有标签时可传入 `aria-label`,否则使用占位文案。`v-model` 和选项值支持字符串联合类型。
|
|
18
|
+
|
|
19
|
+
下拉面板默认挂载到页面根部。局部明暗主题可通过 Reka UI 的 `ConfigProvider` 将 `teleport-to` 指向主题容器中的元素,确保面板继承同一套 token;容器应允许浮层溢出。首页的颜色与强调样式选择器使用的就是本组件。
|
|
20
|
+
|
|
21
|
+
## 色点预览
|
|
22
|
+
|
|
23
|
+
选项的 `color` 是可选 CSS 色值,支持 `var(--ylf-*)`。设置后,下拉列表和当前选中值会显示同色圆点;不设置时保持普通文本选择器。色点仅作视觉辅助,颜色名称和选中勾选仍保留。
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { ref } from 'vue'
|
|
28
|
+
|
|
29
|
+
const tone = ref('blue')
|
|
30
|
+
const options = [
|
|
31
|
+
{ value: 'blue', label: '晴空蓝', color: 'var(--ylf-accent-blue)' },
|
|
32
|
+
{ value: 'sun', label: '明黄', color: 'var(--ylf-accent-sun)' },
|
|
33
|
+
]
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<YlfSelect v-model="tone" :options="options" aria-label="强调色" />
|
|
38
|
+
</template>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
使用 token 时,色点会随所在主题更新;页面和浮层需处于同一主题范围。
|