@cregis/ui 0.1.8 → 0.1.10
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 +146 -3
- package/dist/es/cregis-ui.js +1 -1
- package/dist/types/index.d.ts +53 -159
- package/dist/umd/cregis-ui.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,148 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cregis/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于 **Vue 3**、**TypeScript** 与 **Vite** 构建的 UI 组件库,提供可在业务项目中按需引入的表单与布局类组件。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 技术栈
|
|
6
|
+
|
|
7
|
+
- [Vue 3](https://vuejs.org/)(Composition API)
|
|
8
|
+
- [TypeScript](https://www.typescriptlang.org/)
|
|
9
|
+
- [Vite](https://vitejs.dev/)(ES / UMD 双产物构建)
|
|
10
|
+
|
|
11
|
+
## 环境要求
|
|
12
|
+
|
|
13
|
+
- Node.js(建议使用当前 LTS)
|
|
14
|
+
- 与库版本兼容的 **Vue 3.5+**
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @cregis/ui vue @cregis/icon
|
|
20
|
+
# 或
|
|
21
|
+
pnpm add @cregis/ui vue @cregis/icon
|
|
22
|
+
# 或
|
|
23
|
+
yarn add @cregis/ui vue @cregis/icon
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`vue` 与 `@cregis/icon` 为 **peerDependencies**,请确保在业务项目中显式安装并与文档中的版本范围一致。
|
|
27
|
+
|
|
28
|
+
## 引入样式
|
|
29
|
+
|
|
30
|
+
在应用入口(如 `main.ts`)中引入一次全量样式:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import '@cregis/ui/dist/index.css'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 白天与黑夜模式
|
|
37
|
+
|
|
38
|
+
组件的视觉令牌(颜色、背景、边框等)由 **CSS 变量** 定义:默认在 `:root` 下为**白天模式**;在祖先节点上存在 **`.dark` 类名** 时,变量会切换为**黑夜模式**(见源码中 `src/styles/color.css`、`src/styles/vars.css`)。
|
|
39
|
+
|
|
40
|
+
### 在业务项目中切换主题
|
|
41
|
+
|
|
42
|
+
推荐挂在 **根元素** `<html>` 上,保证整页组件主题一致:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// 进入黑夜模式
|
|
46
|
+
document.documentElement.classList.add('dark')
|
|
47
|
+
|
|
48
|
+
// 恢复白天模式
|
|
49
|
+
document.documentElement.classList.remove('dark')
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
在 Vue 中也可配合响应式状态,在用户操作或持久化设置(如 `localStorage`)变化时调用上述逻辑。示例(与仓库内 `App.vue` 演示一致):
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
function setTheme(mode: 'light' | 'dark') {
|
|
56
|
+
if (mode === 'dark') {
|
|
57
|
+
document.documentElement.classList.add('dark')
|
|
58
|
+
} else {
|
|
59
|
+
document.documentElement.classList.remove('dark')
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
库**不会**自动监听系统 `prefers-color-scheme`。若需跟随系统深浅色,请在应用内自行 `matchMedia('(prefers-color-scheme: dark)')` 订阅并调用 `setTheme`。
|
|
65
|
+
|
|
66
|
+
## 使用方式
|
|
67
|
+
|
|
68
|
+
### 按组件引入(推荐,利于 Tree-Shaking)
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import { Button, Input } from '@cregis/ui'
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<Button type="primary">确定</Button>
|
|
77
|
+
<Input v-model="value" placeholder="请输入" />
|
|
78
|
+
</template>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 单组件注册到应用
|
|
82
|
+
|
|
83
|
+
各组件实例上带有 `install` 方法,可按需注册:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import type { App } from 'vue'
|
|
87
|
+
import { Button } from '@cregis/ui'
|
|
88
|
+
|
|
89
|
+
export function setupComponents(app: App) {
|
|
90
|
+
app.use(Button)
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
之后在任意 SFC 中可直接使用对应标签名(如 `<Button />`)。
|
|
95
|
+
|
|
96
|
+
### UMD / 浏览器全局变量
|
|
97
|
+
|
|
98
|
+
UMD 构建会将 `vue` 映射为全局 `Vue`,将 `@cregis/icon` 映射为全局 `CregisIcon`。在通过 `<script>` 引入 Vue、图标库及本库 UMD 文件后,请同时保证样式文件已加载。
|
|
99
|
+
|
|
100
|
+
## 组件一览
|
|
101
|
+
|
|
102
|
+
| 组件 | 说明 |
|
|
103
|
+
| -------- | -------- |
|
|
104
|
+
| `Button` | 按钮 |
|
|
105
|
+
| `Input` | 输入框 |
|
|
106
|
+
| `Checkbox` | 复选框 |
|
|
107
|
+
| `Radio` | 单选 |
|
|
108
|
+
| `Divider` | 分割线 |
|
|
109
|
+
| `Tabs` / `TabPane` | 标签页 |
|
|
110
|
+
|
|
111
|
+
类型定义随构建输出至 `dist/types`,支持在 TS 项目中直接获得类型提示。
|
|
112
|
+
|
|
113
|
+
## 本地开发
|
|
114
|
+
|
|
115
|
+
克隆仓库并安装依赖后:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm install
|
|
119
|
+
npm run dev
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
默认使用 Vite 开发服务器(具体端口与行为见 `vite.config.ts`),用于调试文档站或示例应用。
|
|
123
|
+
|
|
124
|
+
## 构建发布产物
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npm run build
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
该命令会:
|
|
131
|
+
|
|
132
|
+
1. 并行构建 **ES 模块** 与 **UMD**(分别见 `vite.es.config.ts`、`vite.umd.config.ts`)
|
|
133
|
+
2. 将样式整理为 `dist/index.css`
|
|
134
|
+
|
|
135
|
+
产物字段与 `package.json` 中的 `main` / `module` / `types` / `exports` 一致,便于在 CommonJS 与 ESM 项目中引用。
|
|
136
|
+
|
|
137
|
+
## 仓库脚本说明
|
|
138
|
+
|
|
139
|
+
| 脚本 | 作用 |
|
|
140
|
+
| --------------- | ----------------------- |
|
|
141
|
+
| `npm run dev` | 本地开发 |
|
|
142
|
+
| `npm run build` | 完整构建(ES + UMD + 样式) |
|
|
143
|
+
| `npm run build-only` | 仅构建 JS 双格式 |
|
|
144
|
+
| `npm run preview` | 预览构建结果 |
|
|
145
|
+
|
|
146
|
+
## 版本
|
|
147
|
+
|
|
148
|
+
当前包版本见仓库根目录 `package.json` 中的 `version` 字段。
|
package/dist/es/cregis-ui.js
CHANGED
|
@@ -386,7 +386,7 @@ const ne = {
|
|
|
386
386
|
props: {
|
|
387
387
|
direction: { default: "horizontal" },
|
|
388
388
|
borderStyle: { default: "solid" },
|
|
389
|
-
lineThickness: { default: "
|
|
389
|
+
lineThickness: { default: "0.5px" },
|
|
390
390
|
color: { default: "var(--line-module)" },
|
|
391
391
|
margin: { default: "8px" },
|
|
392
392
|
length: {}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,162 +7,11 @@ import { InjectionKey } from 'vue';
|
|
|
7
7
|
import { PublicProps } from 'vue';
|
|
8
8
|
import { Ref } from 'vue';
|
|
9
9
|
|
|
10
|
-
declare const
|
|
11
|
-
focus: () => Promise<void>;
|
|
12
|
-
updateTextWidth: () => void;
|
|
13
|
-
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
14
|
-
"update:modelValue": (value: string | number) => any;
|
|
15
|
-
input: (value: string | number) => any;
|
|
16
|
-
change: (value: string | number) => any;
|
|
17
|
-
focus: (value: FocusEvent) => any;
|
|
18
|
-
blur: (value: FocusEvent) => any;
|
|
19
|
-
clear: () => any;
|
|
20
|
-
}, string, PublicProps, Readonly<InputProps> & Readonly<{
|
|
21
|
-
"onUpdate:modelValue"?: (value: string | number) => any;
|
|
22
|
-
onInput?: (value: string | number) => any;
|
|
23
|
-
onChange?: (value: string | number) => any;
|
|
24
|
-
onFocus?: (value: FocusEvent) => any;
|
|
25
|
-
onBlur?: (value: FocusEvent) => any;
|
|
26
|
-
onClear?: () => any;
|
|
27
|
-
}>, {
|
|
28
|
-
type: "text" | "number" | "textarea";
|
|
29
|
-
size: "small" | "medium" | "large";
|
|
30
|
-
width: string;
|
|
31
|
-
placeholder: string;
|
|
32
|
-
rows: number;
|
|
33
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
34
|
-
inputRef: HTMLTextAreaElement;
|
|
35
|
-
}, any>;
|
|
36
|
-
|
|
37
|
-
declare const __VLS_component_2: DefineComponent<ButtonProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ButtonProps> & Readonly<{}>, {
|
|
10
|
+
export declare const Button: DefineComponent<ButtonProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ButtonProps> & Readonly<{}>, {
|
|
38
11
|
type: ButtonType;
|
|
39
12
|
size: ButtonSize;
|
|
40
13
|
iconType: IconButtonType;
|
|
41
|
-
}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
42
|
-
buttonRef: HTMLButtonElement;
|
|
43
|
-
}, any>;
|
|
44
|
-
|
|
45
|
-
declare const __VLS_component_3: DefineComponent<CheckboxProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
46
|
-
"update:modelValue": (value: number | boolean) => any;
|
|
47
|
-
change: (value: number | boolean) => any;
|
|
48
|
-
}, string, PublicProps, Readonly<CheckboxProps> & Readonly<{
|
|
49
|
-
"onUpdate:modelValue"?: (value: number | boolean) => any;
|
|
50
|
-
onChange?: (value: number | boolean) => any;
|
|
51
|
-
}>, {
|
|
52
|
-
disabled: boolean;
|
|
53
|
-
modelValue: boolean | number;
|
|
54
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
55
|
-
|
|
56
|
-
declare const __VLS_component_4: DefineComponent<RadioProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
57
|
-
"update:modelValue": (value: RadioValue) => any;
|
|
58
|
-
change: (value: RadioValue) => any;
|
|
59
|
-
}, string, PublicProps, Readonly<RadioProps> & Readonly<{
|
|
60
|
-
"onUpdate:modelValue"?: (value: RadioValue) => any;
|
|
61
|
-
onChange?: (value: RadioValue) => any;
|
|
62
|
-
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
63
|
-
|
|
64
|
-
declare const __VLS_component_5: DefineComponent<TabsProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
65
|
-
"update:modelValue": (name: string | number) => any;
|
|
66
|
-
}, string, PublicProps, Readonly<TabsProps> & Readonly<{
|
|
67
|
-
"onUpdate:modelValue"?: (name: string | number) => any;
|
|
68
|
-
}>, {
|
|
69
|
-
type: "default" | "card";
|
|
70
|
-
size: TabSize;
|
|
71
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
72
|
-
|
|
73
|
-
declare function __VLS_template(): {
|
|
74
|
-
attrs: Partial<{}>;
|
|
75
|
-
slots: {
|
|
76
|
-
prefix?(_: {}): any;
|
|
77
|
-
suffix?(_: {}): any;
|
|
78
|
-
};
|
|
79
|
-
refs: {
|
|
80
|
-
inputRef: HTMLTextAreaElement;
|
|
81
|
-
};
|
|
82
|
-
rootEl: any;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
declare function __VLS_template_2(): {
|
|
86
|
-
attrs: Partial<{}>;
|
|
87
|
-
slots: {
|
|
88
|
-
icon?(_: {}): any;
|
|
89
|
-
default?(_: {}): any;
|
|
90
|
-
default?(_: {}): any;
|
|
91
|
-
};
|
|
92
|
-
refs: {
|
|
93
|
-
buttonRef: HTMLButtonElement;
|
|
94
|
-
};
|
|
95
|
-
rootEl: any;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
declare function __VLS_template_3(): {
|
|
99
|
-
attrs: Partial<{}>;
|
|
100
|
-
slots: {
|
|
101
|
-
default?(_: {}): any;
|
|
102
|
-
};
|
|
103
|
-
refs: {};
|
|
104
|
-
rootEl: HTMLDivElement;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
declare function __VLS_template_4(): {
|
|
108
|
-
attrs: Partial<{}>;
|
|
109
|
-
slots: {
|
|
110
|
-
default?(_: {}): any;
|
|
111
|
-
};
|
|
112
|
-
refs: {};
|
|
113
|
-
rootEl: HTMLDivElement;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
declare function __VLS_template_5(): {
|
|
117
|
-
attrs: Partial<{}>;
|
|
118
|
-
slots: {
|
|
119
|
-
default?(_: {}): any;
|
|
120
|
-
};
|
|
121
|
-
refs: {};
|
|
122
|
-
rootEl: HTMLDivElement;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
126
|
-
|
|
127
|
-
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
128
|
-
|
|
129
|
-
declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
|
|
130
|
-
|
|
131
|
-
declare type __VLS_TemplateResult_4 = ReturnType<typeof __VLS_template_4>;
|
|
132
|
-
|
|
133
|
-
declare type __VLS_TemplateResult_5 = ReturnType<typeof __VLS_template_5>;
|
|
134
|
-
|
|
135
|
-
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
136
|
-
new (): {
|
|
137
|
-
$slots: S;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
142
|
-
new (): {
|
|
143
|
-
$slots: S;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
declare type __VLS_WithTemplateSlots_3<T, S> = T & {
|
|
148
|
-
new (): {
|
|
149
|
-
$slots: S;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
declare type __VLS_WithTemplateSlots_4<T, S> = T & {
|
|
154
|
-
new (): {
|
|
155
|
-
$slots: S;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
declare type __VLS_WithTemplateSlots_5<T, S> = T & {
|
|
160
|
-
new (): {
|
|
161
|
-
$slots: S;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export declare const Button: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
14
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
166
15
|
|
|
167
16
|
export declare interface ButtonProps {
|
|
168
17
|
type?: ButtonType;
|
|
@@ -185,7 +34,16 @@ export declare type ButtonSize = 'extraSmall' | 'small' | 'medium' | 'large';
|
|
|
185
34
|
|
|
186
35
|
export declare type ButtonType = 'primary' | 'secondary' | 'danger' | 'foreground' | 'sameWhite';
|
|
187
36
|
|
|
188
|
-
export declare const Checkbox:
|
|
37
|
+
export declare const Checkbox: DefineComponent<CheckboxProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
38
|
+
"update:modelValue": (value: number | boolean) => any;
|
|
39
|
+
change: (value: number | boolean) => any;
|
|
40
|
+
}, string, PublicProps, Readonly<CheckboxProps> & Readonly<{
|
|
41
|
+
"onUpdate:modelValue"?: (value: number | boolean) => any;
|
|
42
|
+
onChange?: (value: number | boolean) => any;
|
|
43
|
+
}>, {
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
modelValue: boolean | number;
|
|
46
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
189
47
|
|
|
190
48
|
export declare interface CheckboxEmits {
|
|
191
49
|
(e: 'update:modelValue', value: boolean | number): void;
|
|
@@ -201,12 +59,12 @@ export declare interface CheckboxProps {
|
|
|
201
59
|
}
|
|
202
60
|
|
|
203
61
|
export declare const Divider: DefineComponent<DividerProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<DividerProps> & Readonly<{}>, {
|
|
204
|
-
color: string;
|
|
205
62
|
direction: "horizontal" | "vertical";
|
|
206
63
|
borderStyle: "solid" | "dashed" | "dotted";
|
|
207
64
|
lineThickness: string;
|
|
65
|
+
color: string;
|
|
208
66
|
margin: string | [string, string];
|
|
209
|
-
}, {}, {}, {}, string, ComponentProvideOptions, true, {},
|
|
67
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
210
68
|
|
|
211
69
|
export declare interface DividerProps {
|
|
212
70
|
direction?: 'horizontal' | 'vertical';
|
|
@@ -219,7 +77,30 @@ export declare interface DividerProps {
|
|
|
219
77
|
|
|
220
78
|
export declare type IconButtonType = 'rectangle' | 'square' | 'circle' | 'professional';
|
|
221
79
|
|
|
222
|
-
export declare const Input:
|
|
80
|
+
export declare const Input: DefineComponent<InputProps, {
|
|
81
|
+
focus: () => Promise<void>;
|
|
82
|
+
updateTextWidth: () => void;
|
|
83
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
84
|
+
"update:modelValue": (value: string | number) => any;
|
|
85
|
+
input: (value: string | number) => any;
|
|
86
|
+
change: (value: string | number) => any;
|
|
87
|
+
focus: (value: FocusEvent) => any;
|
|
88
|
+
blur: (value: FocusEvent) => any;
|
|
89
|
+
clear: () => any;
|
|
90
|
+
}, string, PublicProps, Readonly<InputProps> & Readonly<{
|
|
91
|
+
"onUpdate:modelValue"?: (value: string | number) => any;
|
|
92
|
+
onInput?: (value: string | number) => any;
|
|
93
|
+
onChange?: (value: string | number) => any;
|
|
94
|
+
onFocus?: (value: FocusEvent) => any;
|
|
95
|
+
onBlur?: (value: FocusEvent) => any;
|
|
96
|
+
onClear?: () => any;
|
|
97
|
+
}>, {
|
|
98
|
+
type: "text" | "number" | "textarea";
|
|
99
|
+
size: "small" | "medium" | "large";
|
|
100
|
+
width: string;
|
|
101
|
+
placeholder: string;
|
|
102
|
+
rows: number;
|
|
103
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
223
104
|
|
|
224
105
|
export declare interface InputEmits {
|
|
225
106
|
(e: 'update:modelValue', value: StringOrNumber): void;
|
|
@@ -243,7 +124,13 @@ export declare interface InputProps {
|
|
|
243
124
|
rows?: number;
|
|
244
125
|
}
|
|
245
126
|
|
|
246
|
-
export declare const Radio:
|
|
127
|
+
export declare const Radio: DefineComponent<RadioProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
128
|
+
"update:modelValue": (value: RadioValue) => any;
|
|
129
|
+
change: (value: RadioValue) => any;
|
|
130
|
+
}, string, PublicProps, Readonly<RadioProps> & Readonly<{
|
|
131
|
+
"onUpdate:modelValue"?: (value: RadioValue) => any;
|
|
132
|
+
onChange?: (value: RadioValue) => any;
|
|
133
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
247
134
|
|
|
248
135
|
export declare interface RadioEmits {
|
|
249
136
|
(e: 'update:modelValue', value: RadioValue): void;
|
|
@@ -268,7 +155,14 @@ export declare interface TabPaneProps {
|
|
|
268
155
|
name: string | number;
|
|
269
156
|
}
|
|
270
157
|
|
|
271
|
-
export declare const Tabs:
|
|
158
|
+
export declare const Tabs: DefineComponent<TabsProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
159
|
+
"update:modelValue": (name: string | number) => any;
|
|
160
|
+
}, string, PublicProps, Readonly<TabsProps> & Readonly<{
|
|
161
|
+
"onUpdate:modelValue"?: (name: string | number) => any;
|
|
162
|
+
}>, {
|
|
163
|
+
type: "default" | "card";
|
|
164
|
+
size: TabSize;
|
|
165
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
272
166
|
|
|
273
167
|
export declare const TABS_KEY: InjectionKey<TabsContext>;
|
|
274
168
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@cregis/icon")):typeof define=="function"&&define.amd?define(["exports","vue","@cregis/icon"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.CregisUI={},d.Vue,d.CregisIcon))})(this,(function(d,e,k){"use strict";const w={key:0,class:"cregis-button__icon-wrapper"},V=["disabled"],S=["disabled"],T=["disabled"],f=e.defineComponent({name:"Button",inheritAttrs:!1,__name:"Button",props:{type:{default:"primary"},size:{default:"medium"},plain:{type:Boolean},text:{type:Boolean},disabled:{type:Boolean},loading:{type:Boolean},block:{type:Boolean},link:{type:Boolean},icon:{},iconType:{default:"rectangle"},iconText:{},affix:{type:Boolean},isActive:{type:Boolean}},setup(t){const l=t,a=e.computed(()=>l.size==="large"?"20px":l.size==="medium"?"16px":"12px"),r=e.computed(()=>l.size==="large"||l.size==="medium"?"16px":"12px"),i=e.computed(()=>{if(l.plain||l.text)switch(l.type){case"primary":return"var(--material-vibrant-brand-primary)";case"secondary":return"var(--material-foreground-base-secondary)";case"danger":return"var(--material-vibrant-error-primary)";case"foreground":return"var(--material-foreground-base-primary)";case"sameWhite":return"var(--material-same-black)"}else return l.type==="secondary"?"var(--material-foreground-base-secondary)":l.type==="foreground"?"var(--text-face-primary)":l.type==="sameWhite"?"var(--text-same-black)":"var(--material-same-white)"});return(n,s)=>t.icon||n.$slots.icon?(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("button",e.mergeProps(n.$attrs,{class:["cregis-button__icon",{[`cregis-button__icon--${t.iconType}`]:t.iconType,[`cregis-button__icon--${t.size}`]:t.size,"is-disabled":t.disabled,"is-active":t.isActive}],disabled:t.disabled||t.loading}),[t.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{key:0,size:a.value},null,8,["size"])):e.renderSlot(n.$slots,"icon",{key:1})],16,V),t.iconText?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["cregis-button__icon-text",{"is-disabled":t.disabled}])},e.toDisplayString(t.iconText),3)):e.createCommentVNode("",!0)])):t.link?(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1},n.$attrs,{class:["cregis-button__link",{[`cregis-button__link--${t.type}`]:t.type,[`cregis-button__link--${t.size}`]:t.size,"is-disabled":t.disabled,"is-active":t.isActive}],disabled:t.disabled||t.loading}),[e.renderSlot(n.$slots,"default")],16,S)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:2,ref:"buttonRef"},n.$attrs,{class:["cregis-button",{[`cregis-button--${t.type}`]:t.type,[`cregis-button--${t.size}`]:t.size,"is-plain":t.plain,"is-text":t.text,"is-disabled":t.disabled,"is-loading":t.loading,"is-block":t.block,"is-affix":t.affix,"is-active":t.isActive}],disabled:t.disabled||t.loading}),[t.loading?(e.openBlock(),e.createBlock(e.unref(k.EdsLoad),{key:0,class:"loading",size:r.value,color:i.value},null,8,["size","color"])):e.renderSlot(n.$slots,"default",{key:1})],16,T))}}),E={key:0,class:"cregis-input__prefix"},N=["type","placeholder","disabled"],R={key:2,class:"cregis-input__suffix"},I=["disabled","placeholder","rows"],A={key:0,class:"cregis-textarea__buttons"},D=e.defineComponent({name:"Input",inheritAttrs:!1,__name:"Input",props:{type:{default:"text"},modelValue:{},size:{default:"medium"},width:{default:"300px"},placeholder:{default:"please input"},disabled:{type:Boolean},clearable:{type:Boolean},inputStyle:{},unit:{},rows:{default:3}},emits:["update:modelValue","input","change","focus","blur","clear"],setup(t,{expose:l,emit:a}){const r=t,i=a,n=e.ref(r.modelValue);e.watch(()=>r.modelValue,o=>{n.value=o});const s=e.ref(),c=e.ref(0),b=e.ref(!1);let y=null;const J=async()=>{await e.nextTick(),s.value?.focus()},h=async()=>{i("update:modelValue",n.value),i("input",n.value),await e.nextTick(),z()},p=()=>{i("change",n.value)},B=o=>{b.value=!0,i("focus",o)},C=o=>{b.value=!1,i("blur",o)},$=e.computed(()=>r.clearable&&!r.disabled&&!!n.value&&b.value),x=()=>{n.value="",i("update:modelValue",""),i("clear"),i("input",""),i("change","")},z=()=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(()=>{if(!s.value||s.value.tagName!=="INPUT")return;const o=s.value,u=o.value,m=document.createElement("span");m.style.position="absolute",m.style.visibility="hidden",m.style.whiteSpace="pre",m.style.font=window.getComputedStyle(o).font,m.style.letterSpacing=window.getComputedStyle(o).letterSpacing,m.textContent=u||" ",document.body.appendChild(m),c.value=m.getBoundingClientRect().width,document.body.removeChild(m)})},Q=e.computed(()=>{const o={};return c.value>0&&(o.position="absolute",o.left=`${c.value+16}px`),o}),X=async()=>{try{n.value=await navigator.clipboard.readText()}catch(o){console.error("paste error:",o)}};return l({focus:J,updateTextWidth:z}),(o,u)=>t.type!=="textarea"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["cregis-input",{[`cregis-input--${t.size}`]:t.size,"is-disabled":t.disabled,"is-prefix":o.$slots.prefix,"is-suffix":o.$slots.suffix}]),style:e.normalizeStyle([{width:t.width},t.inputStyle])},[e.createElementVNode("div",{class:e.normalizeClass(["cregis-input__wrapper",{"is-focus":b.value}])},[o.$slots.prefix?(e.openBlock(),e.createElementBlock("span",E,[e.renderSlot(o.$slots,"prefix")])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({class:"cregis-input__inner","onUpdate:modelValue":u[0]||(u[0]=m=>n.value=m),ref_key:"inputRef",ref:s,type:t.type,placeholder:t.placeholder},o.$attrs,{disabled:t.disabled,onInput:h,onChange:p,onFocus:B,onBlur:C}),null,16,N),[[e.vModelDynamic,n.value]]),t.unit&&n.value?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle(Q.value),class:"cregis-input__unit"},e.toDisplayString(t.unit),5)):e.createCommentVNode("",!0),o.$slots.suffix||$.value?(e.openBlock(),e.createElementBlock("span",R,[e.renderSlot(o.$slots,"suffix"),$.value?(e.openBlock(),e.createBlock(f,{key:0,icon:e.unref(k.EdsCloseCircleFill),"icon-type":"square",onClick:x,onMousedown:u[1]||(u[1]=e.withModifiers(()=>{},["prevent"]))},null,8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2)],6)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["cregis-textarea",{"is-disabled":t.disabled}]),style:e.normalizeStyle([{width:t.width},t.inputStyle])},[e.withDirectives(e.createElementVNode("textarea",e.mergeProps({class:"cregis-textarea__wrapper"},o.$attrs,{ref_key:"inputRef",ref:s,disabled:t.disabled,placeholder:t.placeholder,rows:t.rows,"onUpdate:modelValue":u[2]||(u[2]=m=>n.value=m),onInput:h,onChange:p,onFocus:B,onBlur:C}),null,16,I),[[e.vModelText,n.value]]),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(f,{class:"cregis-textarea__button",link:"",size:"small",onClick:X},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode(" Paste ",-1)])]),_:1}),e.createVNode(f,{class:"cregis-textarea__button",link:"",size:"small",disabled:!n.value,onClick:x},{default:e.withCtx(()=>[...u[4]||(u[4]=[e.createTextVNode(" Clear ",-1)])]),_:1},8,["disabled"])]))],6))}}),P=["width","height"],L={stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},F={transform:"translate(-394.000000, -457.000000)"},M={transform:"translate(394.000000, 457.000000)"},W=["width","height"],U=e.defineComponent({__name:"checked-basis",props:{size:{default:"16px"}},setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("svg",{width:t.size,height:t.size,viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[e.createElementVNode("g",L,[e.createElementVNode("g",F,[e.createElementVNode("g",M,[e.createElementVNode("rect",{x:"0",y:"0",width:t.size,height:t.size},null,8,W),a[0]||(a[0]=e.createElementVNode("path",{d:"M6.67713976,13.5709642 C7.12567714,13.5709642 7.468039,13.3943662 7.70422535,13.0411701 L13.7562297,3.77789816 C13.8407367,3.65005417 13.9024919,3.52546046 13.9414951,3.40411701 C13.9804984,3.28277356 14,3.16468039 14,3.04983749 C14,2.74647887 13.8976165,2.49566631 13.6928494,2.29739978 C13.4880823,2.09913326 13.2307692,2 12.9209101,2 C12.7063922,2 12.5265439,2.04225352 12.3813651,2.12676056 C12.2361863,2.21126761 12.0975081,2.35536295 11.9653304,2.55904659 L6.65113759,10.9512459 L3.95016251,7.60346696 C3.71830986,7.32177681 3.43011918,7.18093174 3.08559047,7.18093174 C2.77139762,7.18093174 2.51191766,7.28169014 2.3071506,7.48320693 C2.10238353,7.68472373 2,7.93824485 2,8.24377031 C2,8.38028169 2.02329361,8.51083424 2.06988082,8.63542795 C2.11646804,8.76002167 2.19826652,8.88949079 2.31527627,9.02383532 L5.67280607,13.0899242 C5.94149512,13.4106176 6.27627302,13.5709642 6.67713976,13.5709642 Z",fill:"currentColor","fill-rule":"nonzero"},null,-1))])])])],8,P))}}),q={key:0,class:"cregis-checkbox--indeterminate"},j=e.defineComponent({name:"Checkbox",__name:"Checkbox",props:{modelValue:{type:[Boolean,Number],default:!1},label:{},disabled:{type:Boolean,default:!1},circle:{type:Boolean},indeterminate:{type:Boolean}},emits:["update:modelValue","change"],setup(t,{emit:l}){const a=t,r=l,i=e.computed(()=>a.modelValue),n=()=>{a.disabled||r("update:modelValue",!i.value)};return e.watch(()=>i.value,()=>{r("change",i.value)}),(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:"cregis-checkbox__wrapper",onClick:n},[e.createElementVNode("div",{class:e.normalizeClass(["cregis-checkbox",{"is-disabled":t.disabled,"is-checked":i.value,"is-circle":t.circle,"is-indeterminate":t.indeterminate}])},[t.indeterminate?(e.openBlock(),e.createElementBlock("div",q)):(e.openBlock(),e.createBlock(U,{key:1,size:"10px"}))],2),s.$slots.default||t.label?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["cregis-checkbox__label",{"is-disabled":t.disabled}])},[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],2)):e.createCommentVNode("",!0)]))}}),K=e.defineComponent({name:"Radio",__name:"Radio",props:{modelValue:{type:[Boolean,String,Number]},value:{type:[Boolean,String,Number]},label:{},disabled:{type:Boolean}},emits:["update:modelValue","change"],setup(t,{emit:l}){const a=t,r=l,i=e.computed(()=>a.modelValue===a.value),n=()=>{a.disabled||(r("update:modelValue",a.value),r("change",a.value))};return(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:"cregis-radio__wrapper",onClick:n},[e.createElementVNode("div",{class:e.normalizeClass(["cregis-radio",{"is-disabled":t.disabled,"is-checked":i.value}])},[...c[0]||(c[0]=[e.createElementVNode("div",{class:"cregis-radio__inner"},null,-1)])],2),s.$slots.default||t.label?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["cregis-radio__label",{"is-disabled":t.disabled}])},[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],2)):e.createCommentVNode("",!0)]))}}),O=e.defineComponent({name:"Divider",__name:"Divider",props:{direction:{default:"horizontal"},borderStyle:{default:"solid"},lineThickness:{default:"1px"},color:{default:"var(--line-module)"},margin:{default:"8px"},length:{}},setup(t){const l=t,a=e.computed(()=>{if(Array.isArray(l.margin)){const[i,n]=l.margin;return l.direction==="horizontal"?`${i} 0 ${n} 0`:`0 ${n} 0 ${i}`}else return l.direction==="horizontal"?`${l.margin} 0`:`0 ${l.margin}`}),r=e.computed(()=>l.direction==="horizontal"?{width:l.length||"100%",borderTopWidth:l.lineThickness,borderTopStyle:l.borderStyle,borderTopColor:l.color,margin:a.value}:{height:l.length||"1rem",borderLeftWidth:l.lineThickness,borderLeftStyle:l.borderStyle,borderLeftColor:l.color,margin:a.value});return(i,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["cregis-divider",{[`cregis-divider--${t.direction}`]:t.direction}]),style:e.normalizeStyle(r.value)},null,6))}}),g=Symbol("TABS_KEY"),Y=["onClick"],Z={style:{display:"none"}},G=e.defineComponent({name:"Tabs",__name:"Tabs",props:{modelValue:{},type:{default:"default"},size:{default:"medium"}},emits:["update:modelValue"],setup(t){const l=t,a=e.reactive([]),r=s=>{a.some(c=>c.name===s.name)||a.push(s)},i=s=>{const c=a.findIndex(b=>b.name===s);c!==-1&&a.splice(c,1)},n=e.computed(()=>l.type==="card"?l.size==="large"?{borderRadius:"13px"}:l.size==="medium"?{borderRadius:"11px"}:{borderRadius:"9px"}:{borderRadius:0});return e.provide(g,{activeName:e.toRef(l,"modelValue"),registerTab:r,unregisterTab:i}),(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["cregis-tabs",{[`cregis-tabs--${t.type}`]:t.type,[`cregis-tabs--${t.size}`]:t.size}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,b=>(e.openBlock(),e.createElementBlock("div",{key:b.name,class:e.normalizeClass(["cregis-tabs__item",{"is-active":t.modelValue===b.name}]),style:e.normalizeStyle(n.value),onClick:y=>s.$emit("update:modelValue",b.name)},[e.createElementVNode("span",null,e.toDisplayString(b.label),1)],14,Y))),128)),e.createElementVNode("div",Z,[e.renderSlot(s.$slots,"default")])],2))}}),H=e.defineComponent({name:"TabPane",__name:"TabPane",props:{label:{},name:{}},setup(t){const l=t,a=e.inject(g);if(!a)throw new Error("TabPane must be used within Tabs");return e.onMounted(()=>{a.registerTab({label:l.label,name:l.name})}),e.watch(()=>l.label,r=>{a.unregisterTab(l.name),a.registerTab({label:r,name:l.name})}),e.onUnmounted(()=>{a.unregisterTab(l.name)}),()=>{}}});d.Button=f,d.Checkbox=j,d.Divider=O,d.Input=D,d.Radio=K,d.TABS_KEY=g,d.TabPane=H,d.Tabs=G,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@cregis/icon")):typeof define=="function"&&define.amd?define(["exports","vue","@cregis/icon"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.CregisUI={},d.Vue,d.CregisIcon))})(this,(function(d,e,k){"use strict";const w={key:0,class:"cregis-button__icon-wrapper"},V=["disabled"],S=["disabled"],T=["disabled"],f=e.defineComponent({name:"Button",inheritAttrs:!1,__name:"Button",props:{type:{default:"primary"},size:{default:"medium"},plain:{type:Boolean},text:{type:Boolean},disabled:{type:Boolean},loading:{type:Boolean},block:{type:Boolean},link:{type:Boolean},icon:{},iconType:{default:"rectangle"},iconText:{},affix:{type:Boolean},isActive:{type:Boolean}},setup(t){const l=t,a=e.computed(()=>l.size==="large"?"20px":l.size==="medium"?"16px":"12px"),r=e.computed(()=>l.size==="large"||l.size==="medium"?"16px":"12px"),i=e.computed(()=>{if(l.plain||l.text)switch(l.type){case"primary":return"var(--material-vibrant-brand-primary)";case"secondary":return"var(--material-foreground-base-secondary)";case"danger":return"var(--material-vibrant-error-primary)";case"foreground":return"var(--material-foreground-base-primary)";case"sameWhite":return"var(--material-same-black)"}else return l.type==="secondary"?"var(--material-foreground-base-secondary)":l.type==="foreground"?"var(--text-face-primary)":l.type==="sameWhite"?"var(--text-same-black)":"var(--material-same-white)"});return(n,s)=>t.icon||n.$slots.icon?(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("button",e.mergeProps(n.$attrs,{class:["cregis-button__icon",{[`cregis-button__icon--${t.iconType}`]:t.iconType,[`cregis-button__icon--${t.size}`]:t.size,"is-disabled":t.disabled,"is-active":t.isActive}],disabled:t.disabled||t.loading}),[t.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{key:0,size:a.value},null,8,["size"])):e.renderSlot(n.$slots,"icon",{key:1})],16,V),t.iconText?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["cregis-button__icon-text",{"is-disabled":t.disabled}])},e.toDisplayString(t.iconText),3)):e.createCommentVNode("",!0)])):t.link?(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1},n.$attrs,{class:["cregis-button__link",{[`cregis-button__link--${t.type}`]:t.type,[`cregis-button__link--${t.size}`]:t.size,"is-disabled":t.disabled,"is-active":t.isActive}],disabled:t.disabled||t.loading}),[e.renderSlot(n.$slots,"default")],16,S)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:2,ref:"buttonRef"},n.$attrs,{class:["cregis-button",{[`cregis-button--${t.type}`]:t.type,[`cregis-button--${t.size}`]:t.size,"is-plain":t.plain,"is-text":t.text,"is-disabled":t.disabled,"is-loading":t.loading,"is-block":t.block,"is-affix":t.affix,"is-active":t.isActive}],disabled:t.disabled||t.loading}),[t.loading?(e.openBlock(),e.createBlock(e.unref(k.EdsLoad),{key:0,class:"loading",size:r.value,color:i.value},null,8,["size","color"])):e.renderSlot(n.$slots,"default",{key:1})],16,T))}}),E={key:0,class:"cregis-input__prefix"},N=["type","placeholder","disabled"],R={key:2,class:"cregis-input__suffix"},I=["disabled","placeholder","rows"],A={key:0,class:"cregis-textarea__buttons"},D=e.defineComponent({name:"Input",inheritAttrs:!1,__name:"Input",props:{type:{default:"text"},modelValue:{},size:{default:"medium"},width:{default:"300px"},placeholder:{default:"please input"},disabled:{type:Boolean},clearable:{type:Boolean},inputStyle:{},unit:{},rows:{default:3}},emits:["update:modelValue","input","change","focus","blur","clear"],setup(t,{expose:l,emit:a}){const r=t,i=a,n=e.ref(r.modelValue);e.watch(()=>r.modelValue,o=>{n.value=o});const s=e.ref(),c=e.ref(0),b=e.ref(!1);let y=null;const J=async()=>{await e.nextTick(),s.value?.focus()},h=async()=>{i("update:modelValue",n.value),i("input",n.value),await e.nextTick(),z()},p=()=>{i("change",n.value)},B=o=>{b.value=!0,i("focus",o)},C=o=>{b.value=!1,i("blur",o)},$=e.computed(()=>r.clearable&&!r.disabled&&!!n.value&&b.value),x=()=>{n.value="",i("update:modelValue",""),i("clear"),i("input",""),i("change","")},z=()=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(()=>{if(!s.value||s.value.tagName!=="INPUT")return;const o=s.value,u=o.value,m=document.createElement("span");m.style.position="absolute",m.style.visibility="hidden",m.style.whiteSpace="pre",m.style.font=window.getComputedStyle(o).font,m.style.letterSpacing=window.getComputedStyle(o).letterSpacing,m.textContent=u||" ",document.body.appendChild(m),c.value=m.getBoundingClientRect().width,document.body.removeChild(m)})},Q=e.computed(()=>{const o={};return c.value>0&&(o.position="absolute",o.left=`${c.value+16}px`),o}),X=async()=>{try{n.value=await navigator.clipboard.readText()}catch(o){console.error("paste error:",o)}};return l({focus:J,updateTextWidth:z}),(o,u)=>t.type!=="textarea"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["cregis-input",{[`cregis-input--${t.size}`]:t.size,"is-disabled":t.disabled,"is-prefix":o.$slots.prefix,"is-suffix":o.$slots.suffix}]),style:e.normalizeStyle([{width:t.width},t.inputStyle])},[e.createElementVNode("div",{class:e.normalizeClass(["cregis-input__wrapper",{"is-focus":b.value}])},[o.$slots.prefix?(e.openBlock(),e.createElementBlock("span",E,[e.renderSlot(o.$slots,"prefix")])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({class:"cregis-input__inner","onUpdate:modelValue":u[0]||(u[0]=m=>n.value=m),ref_key:"inputRef",ref:s,type:t.type,placeholder:t.placeholder},o.$attrs,{disabled:t.disabled,onInput:h,onChange:p,onFocus:B,onBlur:C}),null,16,N),[[e.vModelDynamic,n.value]]),t.unit&&n.value?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle(Q.value),class:"cregis-input__unit"},e.toDisplayString(t.unit),5)):e.createCommentVNode("",!0),o.$slots.suffix||$.value?(e.openBlock(),e.createElementBlock("span",R,[e.renderSlot(o.$slots,"suffix"),$.value?(e.openBlock(),e.createBlock(f,{key:0,icon:e.unref(k.EdsCloseCircleFill),"icon-type":"square",onClick:x,onMousedown:u[1]||(u[1]=e.withModifiers(()=>{},["prevent"]))},null,8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2)],6)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["cregis-textarea",{"is-disabled":t.disabled}]),style:e.normalizeStyle([{width:t.width},t.inputStyle])},[e.withDirectives(e.createElementVNode("textarea",e.mergeProps({class:"cregis-textarea__wrapper"},o.$attrs,{ref_key:"inputRef",ref:s,disabled:t.disabled,placeholder:t.placeholder,rows:t.rows,"onUpdate:modelValue":u[2]||(u[2]=m=>n.value=m),onInput:h,onChange:p,onFocus:B,onBlur:C}),null,16,I),[[e.vModelText,n.value]]),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(f,{class:"cregis-textarea__button",link:"",size:"small",onClick:X},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode(" Paste ",-1)])]),_:1}),e.createVNode(f,{class:"cregis-textarea__button",link:"",size:"small",disabled:!n.value,onClick:x},{default:e.withCtx(()=>[...u[4]||(u[4]=[e.createTextVNode(" Clear ",-1)])]),_:1},8,["disabled"])]))],6))}}),P=["width","height"],L={stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},F={transform:"translate(-394.000000, -457.000000)"},M={transform:"translate(394.000000, 457.000000)"},W=["width","height"],U=e.defineComponent({__name:"checked-basis",props:{size:{default:"16px"}},setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("svg",{width:t.size,height:t.size,viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[e.createElementVNode("g",L,[e.createElementVNode("g",F,[e.createElementVNode("g",M,[e.createElementVNode("rect",{x:"0",y:"0",width:t.size,height:t.size},null,8,W),a[0]||(a[0]=e.createElementVNode("path",{d:"M6.67713976,13.5709642 C7.12567714,13.5709642 7.468039,13.3943662 7.70422535,13.0411701 L13.7562297,3.77789816 C13.8407367,3.65005417 13.9024919,3.52546046 13.9414951,3.40411701 C13.9804984,3.28277356 14,3.16468039 14,3.04983749 C14,2.74647887 13.8976165,2.49566631 13.6928494,2.29739978 C13.4880823,2.09913326 13.2307692,2 12.9209101,2 C12.7063922,2 12.5265439,2.04225352 12.3813651,2.12676056 C12.2361863,2.21126761 12.0975081,2.35536295 11.9653304,2.55904659 L6.65113759,10.9512459 L3.95016251,7.60346696 C3.71830986,7.32177681 3.43011918,7.18093174 3.08559047,7.18093174 C2.77139762,7.18093174 2.51191766,7.28169014 2.3071506,7.48320693 C2.10238353,7.68472373 2,7.93824485 2,8.24377031 C2,8.38028169 2.02329361,8.51083424 2.06988082,8.63542795 C2.11646804,8.76002167 2.19826652,8.88949079 2.31527627,9.02383532 L5.67280607,13.0899242 C5.94149512,13.4106176 6.27627302,13.5709642 6.67713976,13.5709642 Z",fill:"currentColor","fill-rule":"nonzero"},null,-1))])])])],8,P))}}),q={key:0,class:"cregis-checkbox--indeterminate"},j=e.defineComponent({name:"Checkbox",__name:"Checkbox",props:{modelValue:{type:[Boolean,Number],default:!1},label:{},disabled:{type:Boolean,default:!1},circle:{type:Boolean},indeterminate:{type:Boolean}},emits:["update:modelValue","change"],setup(t,{emit:l}){const a=t,r=l,i=e.computed(()=>a.modelValue),n=()=>{a.disabled||r("update:modelValue",!i.value)};return e.watch(()=>i.value,()=>{r("change",i.value)}),(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:"cregis-checkbox__wrapper",onClick:n},[e.createElementVNode("div",{class:e.normalizeClass(["cregis-checkbox",{"is-disabled":t.disabled,"is-checked":i.value,"is-circle":t.circle,"is-indeterminate":t.indeterminate}])},[t.indeterminate?(e.openBlock(),e.createElementBlock("div",q)):(e.openBlock(),e.createBlock(U,{key:1,size:"10px"}))],2),s.$slots.default||t.label?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["cregis-checkbox__label",{"is-disabled":t.disabled}])},[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],2)):e.createCommentVNode("",!0)]))}}),K=e.defineComponent({name:"Radio",__name:"Radio",props:{modelValue:{type:[Boolean,String,Number]},value:{type:[Boolean,String,Number]},label:{},disabled:{type:Boolean}},emits:["update:modelValue","change"],setup(t,{emit:l}){const a=t,r=l,i=e.computed(()=>a.modelValue===a.value),n=()=>{a.disabled||(r("update:modelValue",a.value),r("change",a.value))};return(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:"cregis-radio__wrapper",onClick:n},[e.createElementVNode("div",{class:e.normalizeClass(["cregis-radio",{"is-disabled":t.disabled,"is-checked":i.value}])},[...c[0]||(c[0]=[e.createElementVNode("div",{class:"cregis-radio__inner"},null,-1)])],2),s.$slots.default||t.label?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["cregis-radio__label",{"is-disabled":t.disabled}])},[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],2)):e.createCommentVNode("",!0)]))}}),O=e.defineComponent({name:"Divider",__name:"Divider",props:{direction:{default:"horizontal"},borderStyle:{default:"solid"},lineThickness:{default:"0.5px"},color:{default:"var(--line-module)"},margin:{default:"8px"},length:{}},setup(t){const l=t,a=e.computed(()=>{if(Array.isArray(l.margin)){const[i,n]=l.margin;return l.direction==="horizontal"?`${i} 0 ${n} 0`:`0 ${n} 0 ${i}`}else return l.direction==="horizontal"?`${l.margin} 0`:`0 ${l.margin}`}),r=e.computed(()=>l.direction==="horizontal"?{width:l.length||"100%",borderTopWidth:l.lineThickness,borderTopStyle:l.borderStyle,borderTopColor:l.color,margin:a.value}:{height:l.length||"1rem",borderLeftWidth:l.lineThickness,borderLeftStyle:l.borderStyle,borderLeftColor:l.color,margin:a.value});return(i,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["cregis-divider",{[`cregis-divider--${t.direction}`]:t.direction}]),style:e.normalizeStyle(r.value)},null,6))}}),g=Symbol("TABS_KEY"),Y=["onClick"],Z={style:{display:"none"}},G=e.defineComponent({name:"Tabs",__name:"Tabs",props:{modelValue:{},type:{default:"default"},size:{default:"medium"}},emits:["update:modelValue"],setup(t){const l=t,a=e.reactive([]),r=s=>{a.some(c=>c.name===s.name)||a.push(s)},i=s=>{const c=a.findIndex(b=>b.name===s);c!==-1&&a.splice(c,1)},n=e.computed(()=>l.type==="card"?l.size==="large"?{borderRadius:"13px"}:l.size==="medium"?{borderRadius:"11px"}:{borderRadius:"9px"}:{borderRadius:0});return e.provide(g,{activeName:e.toRef(l,"modelValue"),registerTab:r,unregisterTab:i}),(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["cregis-tabs",{[`cregis-tabs--${t.type}`]:t.type,[`cregis-tabs--${t.size}`]:t.size}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,b=>(e.openBlock(),e.createElementBlock("div",{key:b.name,class:e.normalizeClass(["cregis-tabs__item",{"is-active":t.modelValue===b.name}]),style:e.normalizeStyle(n.value),onClick:y=>s.$emit("update:modelValue",b.name)},[e.createElementVNode("span",null,e.toDisplayString(b.label),1)],14,Y))),128)),e.createElementVNode("div",Z,[e.renderSlot(s.$slots,"default")])],2))}}),H=e.defineComponent({name:"TabPane",__name:"TabPane",props:{label:{},name:{}},setup(t){const l=t,a=e.inject(g);if(!a)throw new Error("TabPane must be used within Tabs");return e.onMounted(()=>{a.registerTab({label:l.label,name:l.name})}),e.watch(()=>l.label,r=>{a.unregisterTab(l.name),a.registerTab({label:r,name:l.name})}),e.onUnmounted(()=>{a.unregisterTab(l.name)}),()=>{}}});d.Button=f,d.Checkbox=j,d.Divider=O,d.Input=D,d.Radio=K,d.TABS_KEY=g,d.TabPane=H,d.Tabs=G,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|