@cynnie/ui-shadcn 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/dist/Checkbox-DswwIgpU.js +38 -0
- package/dist/Checkbox-DswwIgpU.js.map +1 -0
- package/dist/DialogTitle-CCJNart2.js +107 -0
- package/dist/DialogTitle-CCJNart2.js.map +1 -0
- package/dist/Input-BQYIq9cS.js +24 -0
- package/dist/Input-BQYIq9cS.js.map +1 -0
- package/dist/Loader-DZyMmrI8.js +19 -0
- package/dist/Loader-DZyMmrI8.js.map +1 -0
- package/dist/ProButton-BQWpTTCy.js +84 -0
- package/dist/ProButton-BQWpTTCy.js.map +1 -0
- package/dist/ProCheckboxGroup-DX6c9gx-.js +71 -0
- package/dist/ProCheckboxGroup-DX6c9gx-.js.map +1 -0
- package/dist/ProConfirmButton-zcvp7NcN.js +175 -0
- package/dist/ProConfirmButton-zcvp7NcN.js.map +1 -0
- package/dist/ProDescriptions-B1znLzkY.js +45 -0
- package/dist/ProDescriptions-B1znLzkY.js.map +1 -0
- package/dist/ProFormBuilder-CsNShZ0y.js +1138 -0
- package/dist/ProFormBuilder-CsNShZ0y.js.map +1 -0
- package/dist/ProInput-D20F1Xx-.js +91 -0
- package/dist/ProInput-D20F1Xx-.js.map +1 -0
- package/dist/ProModal-DsIFQ8y5.js +109 -0
- package/dist/ProModal-DsIFQ8y5.js.map +1 -0
- package/dist/ProRadioGroup-CTxqLQjw.js +138 -0
- package/dist/ProRadioGroup-CTxqLQjw.js.map +1 -0
- package/dist/ProSelect-DT0zjDjT.js +90 -0
- package/dist/ProSelect-DT0zjDjT.js.map +1 -0
- package/dist/ProTable-CP1Mc52q.js +349 -0
- package/dist/ProTable-CP1Mc52q.js.map +1 -0
- package/dist/SelectValue-CWl9zUW3.js +163 -0
- package/dist/SelectValue-CWl9zUW3.js.map +1 -0
- package/dist/button-BQVT6mY3.js +60 -0
- package/dist/button-BQVT6mY3.js.map +1 -0
- package/dist/components/ProButton/ProCountdownButton.vue.d.ts +28 -0
- package/dist/components/ProButton/index.js +2 -0
- package/dist/components/ProButton/index.vue.d.ts +31 -0
- package/dist/components/ProCheckboxGroup/index.js +2 -0
- package/dist/components/ProCheckboxGroup/index.vue.d.ts +18 -0
- package/dist/components/ProConfirmButton/index.js +2 -0
- package/dist/components/ProConfirmButton/index.vue.d.ts +43 -0
- package/dist/components/ProDescriptions/index.js +2 -0
- package/dist/components/ProDescriptions/index.vue.d.ts +40 -0
- package/dist/components/ProFormBuilder/index.js +2 -0
- package/dist/components/ProFormBuilder/index.vue.d.ts +43 -0
- package/dist/components/ProInput/index.js +2 -0
- package/dist/components/ProInput/index.vue.d.ts +27 -0
- package/dist/components/ProModal/index.js +2 -0
- package/dist/components/ProModal/index.vue.d.ts +45 -0
- package/dist/components/ProRadioGroup/index.js +2 -0
- package/dist/components/ProRadioGroup/index.vue.d.ts +20 -0
- package/dist/components/ProSelect/index.js +2 -0
- package/dist/components/ProSelect/index.vue.d.ts +28 -0
- package/dist/components/ProTable/ProTableForm.vue.d.ts +91 -0
- package/dist/components/ProTable/index.js +2 -0
- package/dist/components/ProTable/index.vue.d.ts +36 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/ui/alert/Alert.vue.d.ts +22 -0
- package/dist/components/ui/alert/index.d.ts +6 -0
- package/dist/components/ui/button/Button.vue.d.ts +27 -0
- package/dist/components/ui/button/index.d.ts +7 -0
- package/dist/components/ui/checkbox/Checkbox.vue.d.ts +11 -0
- package/dist/components/ui/checkbox/index.d.ts +1 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +18 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +36 -0
- package/dist/components/ui/dialog/DialogDescription.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +18 -0
- package/dist/components/ui/dialog/index.d.ts +8 -0
- package/dist/components/ui/index.d.ts +12 -0
- package/dist/components/ui/input/Input.vue.d.ts +13 -0
- package/dist/components/ui/input/index.d.ts +1 -0
- package/dist/components/ui/label/Label.vue.d.ts +24 -0
- package/dist/components/ui/label/index.d.ts +1 -0
- package/dist/components/ui/loader/Loader.vue.d.ts +6 -0
- package/dist/components/ui/loader/index.d.ts +1 -0
- package/dist/components/ui/popover/Popover.vue.d.ts +22 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +38 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +18 -0
- package/dist/components/ui/popover/index.d.ts +3 -0
- package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +22 -0
- package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +7 -0
- package/dist/components/ui/radio-group/index.d.ts +2 -0
- package/dist/components/ui/select/Select.vue.d.ts +19 -0
- package/dist/components/ui/select/SelectContent.vue.d.ts +32 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +21 -0
- package/dist/components/ui/select/SelectValue.vue.d.ts +21 -0
- package/dist/components/ui/select/index.d.ts +5 -0
- package/dist/components/ui/table/Table.vue.d.ts +21 -0
- package/dist/components/ui/table/TableBody.vue.d.ts +21 -0
- package/dist/components/ui/table/TableCell.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHead.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHeader.vue.d.ts +21 -0
- package/dist/components/ui/table/TableRow.vue.d.ts +21 -0
- package/dist/components/ui/table/index.d.ts +6 -0
- package/dist/components/ui/textarea/Textarea.vue.d.ts +13 -0
- package/dist/components/ui/textarea/index.d.ts +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/openDialog-CVp3qAfm.js +95 -0
- package/dist/openDialog-CVp3qAfm.js.map +1 -0
- package/dist/utils/openDialog.d.ts +25 -0
- package/dist/utils/openDialog.js +2 -0
- package/dist/utils/uiMessage.d.ts +8 -0
- package/dist/utils-Dg1mr-yh.js +8 -0
- package/dist/utils-Dg1mr-yh.js.map +1 -0
- package/package.json +108 -0
- package/src/style.css +14 -0
- package/src/tailwind.preset.css +139 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @cynnie/ui-shadcn
|
|
2
|
+
|
|
3
|
+
基于 [shadcn-vue](https://www.shadcn-vue.com/)(reka-ui + Tailwind CSS v4)的 SnowUI 二次封装组件库,API 与 `@cynnie/ui-antd` / `@cynnie/ui-element` 完全对齐:
|
|
4
|
+
|
|
5
|
+
- **ProTable** — 搜索表单 + 表格 + 分页一体化
|
|
6
|
+
- **ProFormBuilder** — JSON 配置化表单
|
|
7
|
+
- **ProButton / ProCountdownButton / ProConfirmButton** — 带防抖 / 倒计时 / 二次确认的按钮
|
|
8
|
+
- **ProInput** — 自动搜索防抖输入框
|
|
9
|
+
- **ProSelect / ProCheckboxGroup / ProRadioGroup** — 字典驱动的选择组件
|
|
10
|
+
- **ProModal** — 受控/命令式弹窗
|
|
11
|
+
- **ProDescriptions** — 描述列表
|
|
12
|
+
- **openDialog** — 命令式打开弹窗的工具函数
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pnpm add @cynnie/ui-shadcn
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
peer 依赖:`vue ^3.5`、`tailwindcss ^4.3`。
|
|
21
|
+
|
|
22
|
+
## 样式
|
|
23
|
+
|
|
24
|
+
组件样式由使用方的 Tailwind 编译,二选一:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// 开箱即用:引入完整样式入口(Tailwind v4 CSS-first)
|
|
28
|
+
import "@cynnie/ui-shadcn/style.css";
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```css
|
|
32
|
+
/* 或在你的 Tailwind 入口里只引入设计令牌 */
|
|
33
|
+
@import "@cynnie/ui-shadcn/tailwind.preset.css";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 使用
|
|
37
|
+
|
|
38
|
+
```vue
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import { ProTable } from "@cynnie/ui-shadcn";
|
|
41
|
+
// 或按需深路径引入:import ProTable from "@cynnie/ui-shadcn/components/ProTable";
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
同系列还有 [@cynnie/ui-antd](https://www.npmjs.com/package/@cynnie/ui-antd)(ant-design-vue 版)与 [@cynnie/ui-element](https://www.npmjs.com/package/@cynnie/ui-element)(element-plus 版),API 完全对齐,可按 UI 库切换。
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
MIT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { createBlock, createVNode, defineComponent, mergeProps, openBlock, unref, withCtx } from "vue";
|
|
3
|
+
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from "reka-ui";
|
|
4
|
+
import { CheckIcon } from "lucide-vue-next";
|
|
5
|
+
var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "Checkbox",
|
|
7
|
+
props: {
|
|
8
|
+
defaultValue: {},
|
|
9
|
+
modelValue: {},
|
|
10
|
+
disabled: { type: Boolean },
|
|
11
|
+
value: {},
|
|
12
|
+
id: {},
|
|
13
|
+
trueValue: {},
|
|
14
|
+
falseValue: {},
|
|
15
|
+
asChild: { type: Boolean },
|
|
16
|
+
as: {},
|
|
17
|
+
name: {},
|
|
18
|
+
required: { type: Boolean },
|
|
19
|
+
class: {}
|
|
20
|
+
},
|
|
21
|
+
emits: ["update:modelValue"],
|
|
22
|
+
setup(__props, { emit: __emit }) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const delegatedProps = useForwardPropsEmits(props, __emit);
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createBlock(unref(CheckboxRoot), mergeProps({ "data-slot": "checkbox" }, unref(delegatedProps), { class: unref(cn)("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer", props.class) }), {
|
|
27
|
+
default: withCtx(() => [createVNode(unref(CheckboxIndicator), { class: "flex items-center justify-center text-current transition-none" }, {
|
|
28
|
+
default: withCtx(() => [createVNode(unref(CheckIcon), { class: "size-3.5" })]),
|
|
29
|
+
_: 1
|
|
30
|
+
})]),
|
|
31
|
+
_: 1
|
|
32
|
+
}, 16, ["class"]);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export { Checkbox_default as t };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=Checkbox-DswwIgpU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox-DswwIgpU.js","names":[],"sources":["../src/components/ui/checkbox/Checkbox.vue","../src/components/ui/checkbox/Checkbox.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { CheckboxRootEmits, CheckboxRootProps } from \"reka-ui\";\nimport type { HTMLAttributes } from \"vue\";\nimport { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from \"reka-ui\";\nimport { CheckIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<CheckboxRootProps & { class?: HTMLAttributes[\"class\"] }>();\nconst emits = defineEmits<CheckboxRootEmits>();\n\nconst delegatedProps = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <CheckboxRoot\n data-slot=\"checkbox\"\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer',\n props.class,\n )\n \"\n >\n <CheckboxIndicator class=\"flex items-center justify-center text-current transition-none\">\n <CheckIcon class=\"size-3.5\" />\n </CheckboxIndicator>\n </CheckboxRoot>\n</template>\n","<script lang=\"ts\" setup>\nimport type { CheckboxRootEmits, CheckboxRootProps } from \"reka-ui\";\nimport type { HTMLAttributes } from \"vue\";\nimport { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from \"reka-ui\";\nimport { CheckIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<CheckboxRootProps & { class?: HTMLAttributes[\"class\"] }>();\nconst emits = defineEmits<CheckboxRootEmits>();\n\nconst delegatedProps = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <CheckboxRoot\n data-slot=\"checkbox\"\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer',\n props.class,\n )\n \"\n >\n <CheckboxIndicator class=\"flex items-center justify-center text-current transition-none\">\n <CheckIcon class=\"size-3.5\" />\n </CheckboxIndicator>\n </CheckboxRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;ECOA,MAAM,QAAQ;EAGd,MAAM,iBAAiB,qBAAqB,OAF9B,OAE2C;;uBAIvD,YAae,MAAA,aAAA,EAbf,WAae,EAZb,aAAU,YAAU,EACZ,MAAA,eAAc,EAAA,EACrB,OAAc,MAAA,GAAE,CAAA,8fAAghB,MAAM,MAAA,EAAA,CAAA,EAAA;2BASnhB,CAFpB,YAEoB,MAAA,kBAAA,EAAA,EAFD,OAAM,iEAA+D,EAAA;4BACxD,CAA9B,YAA8B,MAAA,UAAA,EAAA,EAAnB,OAAM,YAAU,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
3
|
+
import { DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, useForwardPropsEmits } from "reka-ui";
|
|
4
|
+
import { XIcon } from "lucide-vue-next";
|
|
5
|
+
var Dialog_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "Dialog",
|
|
7
|
+
props: {
|
|
8
|
+
open: { type: Boolean },
|
|
9
|
+
defaultOpen: { type: Boolean },
|
|
10
|
+
modal: { type: Boolean },
|
|
11
|
+
unmountOnHide: { type: Boolean }
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:open"],
|
|
14
|
+
setup(__props, { emit: __emit }) {
|
|
15
|
+
const forwarded = useForwardPropsEmits(__props, __emit);
|
|
16
|
+
return (_ctx, _cache) => {
|
|
17
|
+
return openBlock(), createBlock(unref(DialogRoot), mergeProps({ "data-slot": "dialog" }, unref(forwarded)), {
|
|
18
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
19
|
+
_: 3
|
|
20
|
+
}, 16);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var DialogContent_default = /* @__PURE__ */ defineComponent({
|
|
25
|
+
__name: "DialogContent",
|
|
26
|
+
props: {
|
|
27
|
+
forceMount: { type: Boolean },
|
|
28
|
+
disableOutsidePointerEvents: { type: Boolean },
|
|
29
|
+
asChild: { type: Boolean },
|
|
30
|
+
as: {},
|
|
31
|
+
class: {}
|
|
32
|
+
},
|
|
33
|
+
emits: [
|
|
34
|
+
"escapeKeyDown",
|
|
35
|
+
"pointerDownOutside",
|
|
36
|
+
"focusOutside",
|
|
37
|
+
"interactOutside",
|
|
38
|
+
"openAutoFocus",
|
|
39
|
+
"closeAutoFocus"
|
|
40
|
+
],
|
|
41
|
+
setup(__props, { emit: __emit }) {
|
|
42
|
+
const props = __props;
|
|
43
|
+
const delegatedProps = useForwardPropsEmits(props, __emit);
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
return openBlock(), createBlock(unref(DialogPortal), null, {
|
|
46
|
+
default: withCtx(() => [createVNode(unref(DialogOverlay), {
|
|
47
|
+
"data-slot": "dialog-overlay",
|
|
48
|
+
class: "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[1050] bg-black/50"
|
|
49
|
+
}), createVNode(unref(DialogContent), mergeProps({ "data-slot": "dialog-content" }, unref(delegatedProps), { class: unref(cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[1060] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", props.class) }), {
|
|
50
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default"), createVNode(unref(DialogClose), { class: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs p-1 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none cursor-pointer" }, {
|
|
51
|
+
default: withCtx(() => [createVNode(unref(XIcon), { class: "size-4" }), _cache[0] || (_cache[0] = createElementVNode("span", { class: "sr-only" }, "Close", -1))]),
|
|
52
|
+
_: 1,
|
|
53
|
+
__: [0]
|
|
54
|
+
})]),
|
|
55
|
+
_: 3
|
|
56
|
+
}, 16, ["class"])]),
|
|
57
|
+
_: 3
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
var DialogFooter_default = /* @__PURE__ */ defineComponent({
|
|
63
|
+
__name: "DialogFooter",
|
|
64
|
+
props: { class: {} },
|
|
65
|
+
setup(__props) {
|
|
66
|
+
const props = __props;
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return openBlock(), createElementBlock("div", {
|
|
69
|
+
"data-slot": "dialog-footer",
|
|
70
|
+
class: normalizeClass(unref(cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", props.class))
|
|
71
|
+
}, [renderSlot(_ctx.$slots, "default")], 2);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
var DialogHeader_default = /* @__PURE__ */ defineComponent({
|
|
76
|
+
__name: "DialogHeader",
|
|
77
|
+
props: { class: {} },
|
|
78
|
+
setup(__props) {
|
|
79
|
+
const props = __props;
|
|
80
|
+
return (_ctx, _cache) => {
|
|
81
|
+
return openBlock(), createElementBlock("div", {
|
|
82
|
+
"data-slot": "dialog-header",
|
|
83
|
+
class: normalizeClass(unref(cn)("flex flex-col gap-2 text-center sm:text-left", props.class))
|
|
84
|
+
}, [renderSlot(_ctx.$slots, "default")], 2);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var DialogTitle_default = /* @__PURE__ */ defineComponent({
|
|
89
|
+
__name: "DialogTitle",
|
|
90
|
+
props: {
|
|
91
|
+
asChild: { type: Boolean },
|
|
92
|
+
as: {},
|
|
93
|
+
class: {}
|
|
94
|
+
},
|
|
95
|
+
setup(__props) {
|
|
96
|
+
const props = __props;
|
|
97
|
+
return (_ctx, _cache) => {
|
|
98
|
+
return openBlock(), createBlock(unref(DialogTitle), mergeProps({ "data-slot": "dialog-title" }, props, { class: unref(cn)("text-lg leading-none font-semibold", props.class) }), {
|
|
99
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
100
|
+
_: 3
|
|
101
|
+
}, 16, ["class"]);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export { Dialog_default as a, DialogContent_default as i, DialogHeader_default as n, DialogFooter_default as r, DialogTitle_default as t };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=DialogTitle-CCJNart2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogTitle-CCJNart2.js","names":[],"sources":["../src/components/ui/dialog/Dialog.vue","../src/components/ui/dialog/Dialog.vue","../src/components/ui/dialog/DialogContent.vue","../src/components/ui/dialog/DialogContent.vue","../src/components/ui/dialog/DialogFooter.vue","../src/components/ui/dialog/DialogFooter.vue","../src/components/ui/dialog/DialogHeader.vue","../src/components/ui/dialog/DialogHeader.vue","../src/components/ui/dialog/DialogTitle.vue","../src/components/ui/dialog/DialogTitle.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { DialogRoot, type DialogRootEmits, type DialogRootProps, useForwardPropsEmits } from \"reka-ui\";\n\nconst props = defineProps<DialogRootProps>();\nconst emits = defineEmits<DialogRootEmits>();\n\nconst forwarded = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <DialogRoot data-slot=\"dialog\" v-bind=\"forwarded\">\n <slot />\n </DialogRoot>\n</template>\n","<script lang=\"ts\" setup>\nimport { DialogRoot, type DialogRootEmits, type DialogRootProps, useForwardPropsEmits } from \"reka-ui\";\n\nconst props = defineProps<DialogRootProps>();\nconst emits = defineEmits<DialogRootEmits>();\n\nconst forwarded = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <DialogRoot data-slot=\"dialog\" v-bind=\"forwarded\">\n <slot />\n </DialogRoot>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { DialogClose, DialogPortal, DialogOverlay, DialogContent, type DialogContentEmits, type DialogContentProps, useForwardPropsEmits } from \"reka-ui\";\nimport { XIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<DialogContentProps & { class?: HTMLAttributes[\"class\"] }>();\nconst emits = defineEmits<DialogContentEmits>();\n\nconst delegatedProps = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <DialogPortal>\n <DialogOverlay\n data-slot=\"dialog-overlay\"\n class=\"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[1050] bg-black/50\"\n />\n <DialogContent\n data-slot=\"dialog-content\"\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[1060] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',\n props.class,\n )\n \"\n >\n <slot />\n\n <DialogClose\n class=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs p-1 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none cursor-pointer\"\n >\n <XIcon class=\"size-4\" />\n <span class=\"sr-only\">Close</span>\n </DialogClose>\n </DialogContent>\n </DialogPortal>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { DialogClose, DialogPortal, DialogOverlay, DialogContent, type DialogContentEmits, type DialogContentProps, useForwardPropsEmits } from \"reka-ui\";\nimport { XIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<DialogContentProps & { class?: HTMLAttributes[\"class\"] }>();\nconst emits = defineEmits<DialogContentEmits>();\n\nconst delegatedProps = useForwardPropsEmits(props, emits);\n</script>\n\n<template>\n <DialogPortal>\n <DialogOverlay\n data-slot=\"dialog-overlay\"\n class=\"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[1050] bg-black/50\"\n />\n <DialogContent\n data-slot=\"dialog-content\"\n v-bind=\"delegatedProps\"\n :class=\"\n cn(\n 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[1060] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',\n props.class,\n )\n \"\n >\n <slot />\n\n <DialogClose\n class=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs p-1 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none cursor-pointer\"\n >\n <XIcon class=\"size-4\" />\n <span class=\"sr-only\">Close</span>\n </DialogClose>\n </DialogContent>\n </DialogPortal>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <div data-slot=\"dialog-footer\" :class=\"cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', props.class)\">\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <div data-slot=\"dialog-footer\" :class=\"cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', props.class)\">\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <div data-slot=\"dialog-header\" :class=\"cn('flex flex-col gap-2 text-center sm:text-left', props.class)\">\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <div data-slot=\"dialog-header\" :class=\"cn('flex flex-col gap-2 text-center sm:text-left', props.class)\">\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { DialogTitle, type DialogTitleProps } from \"reka-ui\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<DialogTitleProps & { class?: HTMLAttributes[\"class\"] }>();\n</script>\n\n<template>\n <DialogTitle\n data-slot=\"dialog-title\"\n v-bind=\"props\"\n :class=\"cn('text-lg leading-none font-semibold', props.class)\"\n >\n <slot />\n </DialogTitle>\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { DialogTitle, type DialogTitleProps } from \"reka-ui\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<DialogTitleProps & { class?: HTMLAttributes[\"class\"] }>();\n</script>\n\n<template>\n <DialogTitle\n data-slot=\"dialog-title\"\n v-bind=\"props\"\n :class=\"cn('text-lg leading-none font-semibold', props.class)\"\n >\n <slot />\n </DialogTitle>\n</template>\n"],"mappings":";;;;;;;;;;;;;;ECMA,MAAM,YAAY,qBAHJ,SACA,OAEsC;;uBAIlD,YAEa,MAAA,WAAA,EAFb,WAEa,EAFD,aAAU,UAAQ,EAAS,MAAA,UAAS,CAAA,EAAA;2BACtC,CAAR,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;EELZ,MAAM,QAAQ;EAGd,MAAM,iBAAiB,qBAAqB,OAF9B,OAE2C;;uBAIvD,YAwBe,MAAA,aAAA,EAAA,MAAA;2BApBX,CAHF,YAGE,MAAA,cAAA,EAAA;KAFA,aAAU;KACV,OAAM;QAER,YAkBgB,MAAA,cAAA,EAlBhB,WAkBgB,EAjBd,aAAU,kBAAgB,EAClB,MAAA,eAAc,EAAA,EACrB,OAAgB,MAAA,GAAE,CAAA,mXAAyY,MAAM,MAAA,EAAA,CAAA,EAAA;4BAO1Z,CAAR,WAAQ,KAAA,QAAA,UAAA,EAER,YAKc,MAAA,YAAA,EAAA,EAJZ,OAAM,sSAAoS,EAAA;6BAElR,CAAxB,YAAwB,MAAA,MAAA,EAAA,EAAjB,OAAM,UAAQ,CAAA,EAAA,OAAA,OAAA,OAAA,KACrB,mBAAkC,QAAA,EAA5B,OAAM,WAAS,EAAC,SAAK,GAAA,EAAA,CAAA;;;;;;;;;;;;;;;EE9BnC,MAAM,QAAQ;;uBAMZ,mBAEM,OAAA;IAFD,aAAU;IAAiB,OAAK,eAAE,MAAA,GAAE,CAAA,0DAA2D,MAAM,MAAK,CAAA;OAC7G,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA;;;;;;;;EEPZ,MAAM,QAAQ;;uBAMZ,mBAEM,OAAA;IAFD,aAAU;IAAiB,OAAK,eAAE,MAAA,GAAE,CAAA,gDAAiD,MAAM,MAAK,CAAA;OACnG,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA;;;;;;;;;;;;EENZ,MAAM,QAAQ;;uBAIZ,YAMc,MAAA,YAAA,EANd,WAMc,EALZ,aAAU,gBAAc,EAChB,OAAK,EACZ,OAAO,MAAA,GAAE,CAAA,sCAAuC,MAAM,MAAK,EAAA,CAAA,EAAA;2BAEpD,CAAR,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { createElementBlock, defineComponent, mergeModels, normalizeClass, openBlock, unref, useModel, vModelText, withDirectives } from "vue";
|
|
3
|
+
var Input_default = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "Input",
|
|
5
|
+
props: /* @__PURE__ */ mergeModels({ class: {} }, {
|
|
6
|
+
"modelValue": {},
|
|
7
|
+
"modelModifiers": {}
|
|
8
|
+
}),
|
|
9
|
+
emits: ["update:modelValue"],
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
const model = useModel(__props, "modelValue");
|
|
13
|
+
return (_ctx, _cache) => {
|
|
14
|
+
return withDirectives((openBlock(), createElementBlock("input", {
|
|
15
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
16
|
+
"data-slot": "input",
|
|
17
|
+
class: normalizeClass(unref(cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", props.class))
|
|
18
|
+
}, null, 2)), [[vModelText, model.value]]);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export { Input_default as t };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=Input-BQYIq9cS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input-BQYIq9cS.js","names":[],"sources":["../src/components/ui/input/Input.vue","../src/components/ui/input/Input.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n\nconst model = defineModel<any>();\n</script>\n\n<template>\n <input\n v-model=\"model\"\n data-slot=\"input\"\n :class=\"\n cn(\n 'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n props.class,\n )\n \"\n />\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n\nconst model = defineModel<any>();\n</script>\n\n<template>\n <input\n v-model=\"model\"\n data-slot=\"input\"\n :class=\"\n cn(\n 'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n props.class,\n )\n \"\n />\n</template>\n"],"mappings":";;;;;;;;;;ECIA,MAAM,QAAQ;EAId,MAAM,QAAQ,SAAgB,SAAA,aAAE;;uCAI9B,mBAWE,SAAA;uEAVc,QAAA;IACd,aAAU;IACT,OAAK,eAAS,MAAA,GAAE,CAAA,mcAAA,iFAAA,0GAAgqB,MAAM,MAAA,CAAA;+BAF9qB,MAAA,MAAK,CAAA,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { createBlock, defineComponent, normalizeClass, openBlock, unref } from "vue";
|
|
3
|
+
import { LoaderCircleIcon } from "lucide-vue-next";
|
|
4
|
+
var Loader_default = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "Loader",
|
|
6
|
+
props: { class: {} },
|
|
7
|
+
setup(__props) {
|
|
8
|
+
const props = __props;
|
|
9
|
+
return (_ctx, _cache) => {
|
|
10
|
+
return openBlock(), createBlock(unref(LoaderCircleIcon), {
|
|
11
|
+
"data-slot": "loader",
|
|
12
|
+
class: normalizeClass(unref(cn)("size-4 animate-spin text-muted-foreground", props.class))
|
|
13
|
+
}, null, 8, ["class"]);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { Loader_default as t };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=Loader-DZyMmrI8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Loader-DZyMmrI8.js","names":[],"sources":["../src/components/ui/loader/Loader.vue","../src/components/ui/loader/Loader.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { LoaderCircleIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <LoaderCircleIcon data-slot=\"loader\" :class=\"cn('size-4 animate-spin text-muted-foreground', props.class)\" />\n</template>\n","<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from \"vue\";\nimport { LoaderCircleIcon } from \"lucide-vue-next\";\nimport { cn } from \"../../../lib/utils\";\n\nconst props = defineProps<{\n class?: HTMLAttributes[\"class\"];\n}>();\n</script>\n\n<template>\n <LoaderCircleIcon data-slot=\"loader\" :class=\"cn('size-4 animate-spin text-muted-foreground', props.class)\" />\n</template>\n"],"mappings":";;;;;;;ECKA,MAAM,QAAQ;;uBAMZ,YAA6G,MAAA,iBAAA,EAAA;IAA3F,aAAU;IAAU,OAAK,eAAE,MAAA,GAAE,CAAA,6CAA8C,MAAM,MAAK,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { t as Button_default } from "./button-BQVT6mY3.js";
|
|
3
|
+
import { t as Loader_default } from "./Loader-DZyMmrI8.js";
|
|
4
|
+
import { computed, createBlock, createCommentVNode, defineComponent, mergeProps, onBeforeUnmount, openBlock, ref, renderSlot, unref, withCtx } from "vue";
|
|
5
|
+
var ProButton_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
name: "ProButton",
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
__name: "index",
|
|
9
|
+
props: {
|
|
10
|
+
type: { default: "default" },
|
|
11
|
+
danger: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
debounce: { default: 0 },
|
|
16
|
+
onClick: {}
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const variant = computed(() => {
|
|
21
|
+
if (props.danger) return "destructive";
|
|
22
|
+
switch (props.type) {
|
|
23
|
+
case "primary": return "default";
|
|
24
|
+
case "dashed": return "outline";
|
|
25
|
+
case "text": return "ghost";
|
|
26
|
+
case "link": return "link";
|
|
27
|
+
default: return "outline";
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const isLoading = ref(false);
|
|
31
|
+
let timer;
|
|
32
|
+
onBeforeUnmount(() => {
|
|
33
|
+
if (timer) clearTimeout(timer);
|
|
34
|
+
});
|
|
35
|
+
const isLoadingOrDebouncing = computed(() => {
|
|
36
|
+
if (isLoading.value) return true;
|
|
37
|
+
return props.debounce > 0 && timer !== void 0;
|
|
38
|
+
});
|
|
39
|
+
async function handleClick(...args) {
|
|
40
|
+
if (props.debounce > 0) {
|
|
41
|
+
if (timer) return;
|
|
42
|
+
timer = setTimeout(() => {
|
|
43
|
+
timer = void 0;
|
|
44
|
+
}, props.debounce);
|
|
45
|
+
}
|
|
46
|
+
if (!props.onClick) return;
|
|
47
|
+
const result = props.onClick(...args);
|
|
48
|
+
if (result instanceof Promise) {
|
|
49
|
+
isLoading.value = true;
|
|
50
|
+
try {
|
|
51
|
+
await result;
|
|
52
|
+
} finally {
|
|
53
|
+
isLoading.value = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return (_ctx, _cache) => {
|
|
58
|
+
return openBlock(), createBlock(unref(Button_default), mergeProps({
|
|
59
|
+
variant: variant.value,
|
|
60
|
+
disabled: isLoadingOrDebouncing.value || void 0,
|
|
61
|
+
class: unref(cn)(_ctx.$attrs.class),
|
|
62
|
+
style: _ctx.$attrs.style
|
|
63
|
+
}, {
|
|
64
|
+
..._ctx.$attrs,
|
|
65
|
+
class: void 0,
|
|
66
|
+
style: void 0
|
|
67
|
+
}, { onClick: handleClick }), {
|
|
68
|
+
default: withCtx(() => [isLoadingOrDebouncing.value ? (openBlock(), createBlock(unref(Loader_default), {
|
|
69
|
+
key: 0,
|
|
70
|
+
class: "text-current"
|
|
71
|
+
})) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default")]),
|
|
72
|
+
_: 3
|
|
73
|
+
}, 16, [
|
|
74
|
+
"variant",
|
|
75
|
+
"disabled",
|
|
76
|
+
"class",
|
|
77
|
+
"style"
|
|
78
|
+
]);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
export { ProButton_default as t };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=ProButton-BQWpTTCy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProButton-BQWpTTCy.js","names":["$attrs"],"sources":["../src/components/ProButton/index.vue","../src/components/ProButton/index.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref } from \"vue\";\nimport { Button, type ButtonVariants } from \"../ui/button\";\nimport { Loader } from \"../ui/loader\";\nimport { cn } from \"../../lib/utils\";\n\ndefineOptions({\n name: \"ProButton\",\n inheritAttrs: false,\n});\n\nconst props = withDefaults(\n defineProps<{\n /** 按钮风格,对齐 antd 的 type + danger 组合:primary / default / dashed / text / link */\n type?: \"primary\" | \"default\" | \"dashed\" | \"text\" | \"link\";\n /** 危险按钮(红色) */\n danger?: boolean;\n /** 点击后 delay 毫秒内再次点击不生效(防抖) */\n debounce?: number;\n /** 点击处理函数:返回 Promise 时按钮自动进入 loading 直到结束 */\n onClick?: (...args: any[]) => any;\n }>(),\n {\n type: \"default\",\n danger: false,\n debounce: 0,\n },\n);\n\n// antd 的 type/danger 映射到 shadcn 的 variant\nconst variant = computed<ButtonVariants[\"variant\"]>(() => {\n if (props.danger) return \"destructive\";\n switch (props.type) {\n case \"primary\":\n return \"default\";\n case \"dashed\":\n return \"outline\";\n case \"text\":\n return \"ghost\";\n case \"link\":\n return \"link\";\n default:\n return \"outline\";\n }\n});\n\nconst isLoading = ref(false);\nlet timer: ReturnType<typeof setTimeout> | undefined;\n\nonBeforeUnmount(() => {\n if (timer) clearTimeout(timer);\n});\n\nconst isLoadingOrDebouncing = computed(() => {\n if (isLoading.value) return true;\n // 防抖期间给视觉反馈,避免用户误以为没点上\n return props.debounce > 0 && timer !== undefined;\n});\n\nasync function handleClick(...args: any[]) {\n if (props.debounce > 0) {\n if (timer) return;\n timer = setTimeout(() => {\n timer = undefined;\n }, props.debounce);\n }\n\n if (!props.onClick) return;\n const result = props.onClick(...args);\n if (result instanceof Promise) {\n isLoading.value = true;\n try {\n await result;\n } finally {\n isLoading.value = false;\n }\n }\n}\n</script>\n\n<template>\n <Button\n :variant=\"variant\"\n :disabled=\"isLoadingOrDebouncing || undefined\"\n :class=\"cn($attrs.class)\"\n :style=\"$attrs.style as any\"\n v-bind=\"{ ...$attrs, class: undefined, style: undefined }\"\n @click=\"handleClick\"\n >\n <Loader v-if=\"isLoadingOrDebouncing\" class=\"text-current\" />\n <slot></slot>\n </Button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref } from \"vue\";\nimport { Button, type ButtonVariants } from \"../ui/button\";\nimport { Loader } from \"../ui/loader\";\nimport { cn } from \"../../lib/utils\";\n\ndefineOptions({\n name: \"ProButton\",\n inheritAttrs: false,\n});\n\nconst props = withDefaults(\n defineProps<{\n /** 按钮风格,对齐 antd 的 type + danger 组合:primary / default / dashed / text / link */\n type?: \"primary\" | \"default\" | \"dashed\" | \"text\" | \"link\";\n /** 危险按钮(红色) */\n danger?: boolean;\n /** 点击后 delay 毫秒内再次点击不生效(防抖) */\n debounce?: number;\n /** 点击处理函数:返回 Promise 时按钮自动进入 loading 直到结束 */\n onClick?: (...args: any[]) => any;\n }>(),\n {\n type: \"default\",\n danger: false,\n debounce: 0,\n },\n);\n\n// antd 的 type/danger 映射到 shadcn 的 variant\nconst variant = computed<ButtonVariants[\"variant\"]>(() => {\n if (props.danger) return \"destructive\";\n switch (props.type) {\n case \"primary\":\n return \"default\";\n case \"dashed\":\n return \"outline\";\n case \"text\":\n return \"ghost\";\n case \"link\":\n return \"link\";\n default:\n return \"outline\";\n }\n});\n\nconst isLoading = ref(false);\nlet timer: ReturnType<typeof setTimeout> | undefined;\n\nonBeforeUnmount(() => {\n if (timer) clearTimeout(timer);\n});\n\nconst isLoadingOrDebouncing = computed(() => {\n if (isLoading.value) return true;\n // 防抖期间给视觉反馈,避免用户误以为没点上\n return props.debounce > 0 && timer !== undefined;\n});\n\nasync function handleClick(...args: any[]) {\n if (props.debounce > 0) {\n if (timer) return;\n timer = setTimeout(() => {\n timer = undefined;\n }, props.debounce);\n }\n\n if (!props.onClick) return;\n const result = props.onClick(...args);\n if (result instanceof Promise) {\n isLoading.value = true;\n try {\n await result;\n } finally {\n isLoading.value = false;\n }\n }\n}\n</script>\n\n<template>\n <Button\n :variant=\"variant\"\n :disabled=\"isLoadingOrDebouncing || undefined\"\n :class=\"cn($attrs.class)\"\n :style=\"$attrs.style as any\"\n v-bind=\"{ ...$attrs, class: undefined, style: undefined }\"\n @click=\"handleClick\"\n >\n <Loader v-if=\"isLoadingOrDebouncing\" class=\"text-current\" />\n <slot></slot>\n </Button>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;ECWA,MAAM,QAAQ;EAmBd,MAAM,UAAU,eAA0C;AACxD,OAAI,MAAM,OAAQ,QAAO;AACzB,WAAQ,MAAM,MAAd;IACE,KAAK,UACH,QAAO;IACT,KAAK,SACH,QAAO;IACT,KAAK,OACH,QAAO;IACT,KAAK,OACH,QAAO;IACT,QACE,QAAO;;IAEX;EAEF,MAAM,YAAY,IAAI,MAAM;EAC5B,IAAI;AAEJ,wBAAsB;AACpB,OAAI,MAAO,cAAa,MAAM;IAC9B;EAEF,MAAM,wBAAwB,eAAe;AAC3C,OAAI,UAAU,MAAO,QAAO;AAE5B,UAAO,MAAM,WAAW,KAAK,UAAU,KAAA;IACvC;EAEF,eAAe,YAAY,GAAG,MAAa;AACzC,OAAI,MAAM,WAAW,GAAG;AACtB,QAAI,MAAO;AACX,YAAQ,iBAAiB;AACvB,aAAQ,KAAA;OACP,MAAM,SAAS;;AAGpB,OAAI,CAAC,MAAM,QAAS;GACpB,MAAM,SAAS,MAAM,QAAQ,GAAG,KAAK;AACrC,OAAI,kBAAkB,SAAS;AAC7B,cAAU,QAAQ;AAClB,QAAI;AACF,WAAM;cACE;AACR,eAAU,QAAQ;;;;;uBAOtB,YAUS,MAAA,eAAA,EAVT,WAUS;IATN,SAAS,QAAA;IACT,UAAU,sBAAA,SAAyB,KAAA;IACnC,OAAO,MAAA,GAAE,CAACA,KAAAA,OAAO,MAAK;IACtB,OAAOA,KAAAA,OAAO;;OACFA,KAAAA;IAAM,OAAS,KAAA;IAAS,OAAS,KAAA;IAAS,EAAA,EACtD,SAAO,aAAW,CAAA,EAAA;2BAEyC,CAA9C,sBAAA,SAAA,WAAA,EAAd,YAA4D,MAAA,eAAA,EAAA;;KAAvB,OAAM;wCAC3C,WAAa,KAAA,QAAA,UAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { t as Checkbox_default } from "./Checkbox-DswwIgpU.js";
|
|
3
|
+
import { Fragment, computed, createElementBlock, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, openBlock, renderList, toDisplayString, unref, useModel } from "vue";
|
|
4
|
+
import { useOptions } from "@cynnie/ui-core";
|
|
5
|
+
var ProCheckboxGroup_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
name: "ProCheckboxGroup",
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
__name: "index",
|
|
9
|
+
props: /* @__PURE__ */ mergeModels({
|
|
10
|
+
options: {},
|
|
11
|
+
labelField: {},
|
|
12
|
+
valueField: {},
|
|
13
|
+
deps: {}
|
|
14
|
+
}, {
|
|
15
|
+
"modelValue": {},
|
|
16
|
+
"modelModifiers": {}
|
|
17
|
+
}),
|
|
18
|
+
emits: ["update:modelValue"],
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const model = useModel(__props, "modelValue");
|
|
22
|
+
const { options: innerOptions } = useOptions({
|
|
23
|
+
options: computed(() => props.options),
|
|
24
|
+
deps: computed(() => props.deps)
|
|
25
|
+
});
|
|
26
|
+
function toOption(item) {
|
|
27
|
+
if (item && typeof item === "object" && "label" in item) return item;
|
|
28
|
+
return {
|
|
29
|
+
label: props.labelField ? item[props.labelField] : item,
|
|
30
|
+
value: props.valueField ? item[props.valueField] : item
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const normalizedOptions = computed(() => innerOptions.value.map(toOption));
|
|
34
|
+
function isChecked(value) {
|
|
35
|
+
return Array.isArray(model.value) && model.value.includes(value);
|
|
36
|
+
}
|
|
37
|
+
function toggle(value, checked) {
|
|
38
|
+
const list = Array.isArray(model.value) ? [...model.value] : [];
|
|
39
|
+
const index = list.indexOf(value);
|
|
40
|
+
if (checked === true && index === -1) list.push(value);
|
|
41
|
+
if (checked === false && index !== -1) list.splice(index, 1);
|
|
42
|
+
model.value = list;
|
|
43
|
+
}
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
46
|
+
..._ctx.$attrs,
|
|
47
|
+
class: void 0,
|
|
48
|
+
style: void 0
|
|
49
|
+
}, {
|
|
50
|
+
class: unref(cn)("flex flex-wrap items-center gap-x-6 gap-y-2", _ctx.$attrs.class),
|
|
51
|
+
style: _ctx.$attrs.style
|
|
52
|
+
}), [(openBlock(true), createElementBlock(Fragment, null, renderList(normalizedOptions.value, (opt) => {
|
|
53
|
+
return openBlock(), createElementBlock("label", {
|
|
54
|
+
key: opt.value,
|
|
55
|
+
class: "flex cursor-pointer items-center gap-2 text-sm font-normal has-[[data-state=checked]]:text-primary has-[[data-disabled]]:cursor-not-allowed has-[[data-disabled]]:opacity-50"
|
|
56
|
+
}, [createVNode(unref(Checkbox_default), {
|
|
57
|
+
"model-value": isChecked(opt.value),
|
|
58
|
+
disabled: opt.disabled,
|
|
59
|
+
"onUpdate:modelValue": (v) => toggle(opt.value, v)
|
|
60
|
+
}, null, 8, [
|
|
61
|
+
"model-value",
|
|
62
|
+
"disabled",
|
|
63
|
+
"onUpdate:modelValue"
|
|
64
|
+
]), createTextVNode(" " + toDisplayString(opt.label), 1)]);
|
|
65
|
+
}), 128))], 16);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
export { ProCheckboxGroup_default as t };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=ProCheckboxGroup-DX6c9gx-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProCheckboxGroup-DX6c9gx-.js","names":["$attrs"],"sources":["../src/components/ProCheckboxGroup/index.vue","../src/components/ProCheckboxGroup/index.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { useOptions } from \"@cynnie/ui-core\";\nimport { Checkbox } from \"../ui/checkbox\";\nimport { cn } from \"../../lib/utils\";\n\ndefineOptions({\n name: \"ProCheckboxGroup\",\n inheritAttrs: false,\n});\n\nconst props = defineProps<{\n /** 选项数据源:静态数组 / 字符串数组 / 返回数组的函数(远程字典) */\n options?: any;\n /** options 里 label / value 的字段名 */\n labelField?: string;\n valueField?: string;\n /** 远程字典的依赖值,变化时自动重新拉取 */\n deps?: any;\n}>();\n\nconst model = defineModel<any[]>();\n\nconst { options: innerOptions } = useOptions({\n options: computed(() => props.options),\n deps: computed(() => props.deps),\n});\n\nfunction toOption(item: any) {\n if (item && typeof item === \"object\" && \"label\" in item) return item;\n return {\n label: props.labelField ? item[props.labelField] : item,\n value: props.valueField ? item[props.valueField] : item,\n };\n}\n\nconst normalizedOptions = computed(() => innerOptions.value.map(toOption));\n\nfunction isChecked(value: any) {\n return Array.isArray(model.value) && model.value.includes(value);\n}\n\nfunction toggle(value: any, checked: boolean | \"indeterminate\") {\n const list = Array.isArray(model.value) ? [...model.value] : [];\n const index = list.indexOf(value);\n if (checked === true && index === -1) list.push(value);\n if (checked === false && index !== -1) list.splice(index, 1);\n model.value = list;\n}\n</script>\n\n<template>\n <div v-bind=\"{ ...$attrs, class: undefined, style: undefined }\" :class=\"cn('flex flex-wrap items-center gap-x-6 gap-y-2', ($attrs.class as any))\" :style=\"($attrs.style as any)\">\n <label\n v-for=\"opt in normalizedOptions\"\n :key=\"opt.value\"\n class=\"flex cursor-pointer items-center gap-2 text-sm font-normal has-[[data-state=checked]]:text-primary has-[[data-disabled]]:cursor-not-allowed has-[[data-disabled]]:opacity-50\"\n >\n <Checkbox :model-value=\"isChecked(opt.value)\" :disabled=\"opt.disabled\" @update:model-value=\"(v: any) => toggle(opt.value, v)\" />\n {{ opt.label }}\n </label>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { useOptions } from \"@cynnie/ui-core\";\nimport { Checkbox } from \"../ui/checkbox\";\nimport { cn } from \"../../lib/utils\";\n\ndefineOptions({\n name: \"ProCheckboxGroup\",\n inheritAttrs: false,\n});\n\nconst props = defineProps<{\n /** 选项数据源:静态数组 / 字符串数组 / 返回数组的函数(远程字典) */\n options?: any;\n /** options 里 label / value 的字段名 */\n labelField?: string;\n valueField?: string;\n /** 远程字典的依赖值,变化时自动重新拉取 */\n deps?: any;\n}>();\n\nconst model = defineModel<any[]>();\n\nconst { options: innerOptions } = useOptions({\n options: computed(() => props.options),\n deps: computed(() => props.deps),\n});\n\nfunction toOption(item: any) {\n if (item && typeof item === \"object\" && \"label\" in item) return item;\n return {\n label: props.labelField ? item[props.labelField] : item,\n value: props.valueField ? item[props.valueField] : item,\n };\n}\n\nconst normalizedOptions = computed(() => innerOptions.value.map(toOption));\n\nfunction isChecked(value: any) {\n return Array.isArray(model.value) && model.value.includes(value);\n}\n\nfunction toggle(value: any, checked: boolean | \"indeterminate\") {\n const list = Array.isArray(model.value) ? [...model.value] : [];\n const index = list.indexOf(value);\n if (checked === true && index === -1) list.push(value);\n if (checked === false && index !== -1) list.splice(index, 1);\n model.value = list;\n}\n</script>\n\n<template>\n <div v-bind=\"{ ...$attrs, class: undefined, style: undefined }\" :class=\"cn('flex flex-wrap items-center gap-x-6 gap-y-2', ($attrs.class as any))\" :style=\"($attrs.style as any)\">\n <label\n v-for=\"opt in normalizedOptions\"\n :key=\"opt.value\"\n class=\"flex cursor-pointer items-center gap-2 text-sm font-normal has-[[data-state=checked]]:text-primary has-[[data-disabled]]:cursor-not-allowed has-[[data-disabled]]:opacity-50\"\n >\n <Checkbox :model-value=\"isChecked(opt.value)\" :disabled=\"opt.disabled\" @update:model-value=\"(v: any) => toggle(opt.value, v)\" />\n {{ opt.label }}\n </label>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;ECWA,MAAM,QAAQ;EAUd,MAAM,QAAQ,SAAkB,SAAA,aAAE;EAElC,MAAM,EAAE,SAAS,iBAAiB,WAAW;GAC3C,SAAS,eAAe,MAAM,QAAQ;GACtC,MAAM,eAAe,MAAM,KAAK;GACjC,CAAC;EAEF,SAAS,SAAS,MAAW;AAC3B,OAAI,QAAQ,OAAO,SAAS,YAAY,WAAW,KAAM,QAAO;AAChE,UAAO;IACL,OAAO,MAAM,aAAa,KAAK,MAAM,cAAc;IACnD,OAAO,MAAM,aAAa,KAAK,MAAM,cAAc;IACpD;;EAGH,MAAM,oBAAoB,eAAe,aAAa,MAAM,IAAI,SAAS,CAAC;EAE1E,SAAS,UAAU,OAAY;AAC7B,UAAO,MAAM,QAAQ,MAAM,MAAM,IAAI,MAAM,MAAM,SAAS,MAAM;;EAGlE,SAAS,OAAO,OAAY,SAAoC;GAC9D,MAAM,OAAO,MAAM,QAAQ,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,MAAM,GAAG,EAAE;GAC/D,MAAM,QAAQ,KAAK,QAAQ,MAAM;AACjC,OAAI,YAAY,QAAQ,UAAU,GAAI,MAAK,KAAK,MAAM;AACtD,OAAI,YAAY,SAAS,UAAU,GAAI,MAAK,OAAO,OAAO,EAAE;AAC5D,SAAM,QAAQ;;;uBAKd,mBASM,OATN,WASM;IAAA,GATYA,KAAAA;IAAM,OAAS,KAAA;IAAS,OAAS,KAAA;IAAS,EAAA;IAAK,OAAO,MAAA,GAAE,CAAA,+CAAiDA,KAAAA,OAAO,MAAK;IAAY,OAAQA,KAAAA,OAAO;0BAChK,mBAOQ,UAAA,MAAA,WANQ,kBAAA,QAAP,QAAG;wBADZ,mBAOQ,SAAA;KALL,KAAK,IAAI;KACV,OAAM;QAEN,YAAgI,MAAA,iBAAA,EAAA;KAArH,eAAa,UAAU,IAAI,MAAK;KAAI,UAAU,IAAI;KAAW,wBAAqB,MAAW,OAAO,IAAI,OAAO,EAAC;;;;;wBAAK,MAChI,gBAAG,IAAI,MAAK,EAAA,EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Dg1mr-yh.js";
|
|
2
|
+
import { t as Button_default } from "./button-BQVT6mY3.js";
|
|
3
|
+
import { t as Loader_default } from "./Loader-DZyMmrI8.js";
|
|
4
|
+
import { createBlock, createCommentVNode, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, toDisplayString, unref, withCtx } from "vue";
|
|
5
|
+
import { PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, useForwardPropsEmits } from "reka-ui";
|
|
6
|
+
import { CircleAlertIcon } from "lucide-vue-next";
|
|
7
|
+
var Popover_default = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "Popover",
|
|
9
|
+
props: {
|
|
10
|
+
defaultOpen: { type: Boolean },
|
|
11
|
+
open: { type: Boolean },
|
|
12
|
+
modal: { type: Boolean }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:open"],
|
|
15
|
+
setup(__props, { emit: __emit }) {
|
|
16
|
+
const forwarded = useForwardPropsEmits(__props, __emit);
|
|
17
|
+
return (_ctx, _cache) => {
|
|
18
|
+
return openBlock(), createBlock(unref(PopoverRoot), mergeProps({ "data-slot": "popover" }, unref(forwarded)), {
|
|
19
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
20
|
+
_: 3
|
|
21
|
+
}, 16);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var PopoverContent_default = /* @__PURE__ */ defineComponent({
|
|
26
|
+
__name: "PopoverContent",
|
|
27
|
+
props: {
|
|
28
|
+
forceMount: { type: Boolean },
|
|
29
|
+
memoDependencies: {},
|
|
30
|
+
side: {},
|
|
31
|
+
sideOffset: { default: 4 },
|
|
32
|
+
sideFlip: { type: Boolean },
|
|
33
|
+
align: {},
|
|
34
|
+
alignOffset: {},
|
|
35
|
+
alignFlip: { type: Boolean },
|
|
36
|
+
avoidCollisions: { type: Boolean },
|
|
37
|
+
collisionBoundary: {},
|
|
38
|
+
collisionPadding: {},
|
|
39
|
+
arrowPadding: {},
|
|
40
|
+
hideShiftedArrow: { type: Boolean },
|
|
41
|
+
sticky: {},
|
|
42
|
+
hideWhenDetached: { type: Boolean },
|
|
43
|
+
positionStrategy: {},
|
|
44
|
+
updatePositionStrategy: {},
|
|
45
|
+
disableUpdateOnLayoutShift: { type: Boolean },
|
|
46
|
+
prioritizePosition: { type: Boolean },
|
|
47
|
+
reference: {},
|
|
48
|
+
dir: {},
|
|
49
|
+
asChild: { type: Boolean },
|
|
50
|
+
as: {},
|
|
51
|
+
disableOutsidePointerEvents: { type: Boolean },
|
|
52
|
+
class: {}
|
|
53
|
+
},
|
|
54
|
+
emits: [
|
|
55
|
+
"escapeKeyDown",
|
|
56
|
+
"pointerDownOutside",
|
|
57
|
+
"focusOutside",
|
|
58
|
+
"interactOutside",
|
|
59
|
+
"openAutoFocus",
|
|
60
|
+
"closeAutoFocus"
|
|
61
|
+
],
|
|
62
|
+
setup(__props, { emit: __emit }) {
|
|
63
|
+
const props = __props;
|
|
64
|
+
const delegatedProps = useForwardPropsEmits(props, __emit);
|
|
65
|
+
return (_ctx, _cache) => {
|
|
66
|
+
return openBlock(), createBlock(unref(PopoverPortal), null, {
|
|
67
|
+
default: withCtx(() => [createVNode(unref(PopoverContent), mergeProps({ "data-slot": "popover-content" }, unref(delegatedProps), { class: unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[1100] w-72 origin-(--reka-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", props.class) }), {
|
|
68
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
69
|
+
_: 3
|
|
70
|
+
}, 16, ["class"])]),
|
|
71
|
+
_: 3
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
var PopoverTrigger_default = /* @__PURE__ */ defineComponent({
|
|
77
|
+
__name: "PopoverTrigger",
|
|
78
|
+
props: {
|
|
79
|
+
asChild: { type: Boolean },
|
|
80
|
+
as: {}
|
|
81
|
+
},
|
|
82
|
+
setup(__props) {
|
|
83
|
+
const props = __props;
|
|
84
|
+
return (_ctx, _cache) => {
|
|
85
|
+
return openBlock(), createBlock(unref(PopoverTrigger), mergeProps({ "data-slot": "popover-trigger" }, props), {
|
|
86
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
87
|
+
_: 3
|
|
88
|
+
}, 16);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
var _hoisted_1 = { class: "flex items-start gap-2" };
|
|
93
|
+
var _hoisted_2 = { class: "text-sm" };
|
|
94
|
+
var _hoisted_3 = { class: "mt-4 flex justify-end gap-2" };
|
|
95
|
+
var ProConfirmButton_default = /* @__PURE__ */ defineComponent({
|
|
96
|
+
components: { CircleAlertIcon },
|
|
97
|
+
name: "ProConfirmButton",
|
|
98
|
+
inheritAttrs: false,
|
|
99
|
+
__name: "index",
|
|
100
|
+
props: {
|
|
101
|
+
title: { default: "确定执行此操作吗?" },
|
|
102
|
+
onConfirm: {},
|
|
103
|
+
type: { default: "default" },
|
|
104
|
+
danger: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: false
|
|
107
|
+
},
|
|
108
|
+
okText: { default: "确 定" },
|
|
109
|
+
cancelText: { default: "取 消" }
|
|
110
|
+
},
|
|
111
|
+
setup(__props) {
|
|
112
|
+
const props = __props;
|
|
113
|
+
const isLoading = ref(false);
|
|
114
|
+
const popOpen = ref(false);
|
|
115
|
+
const variant = props.danger ? "destructive" : props.type === "primary" ? "default" : "outline";
|
|
116
|
+
async function handleConfirm() {
|
|
117
|
+
if (!props.onConfirm) {
|
|
118
|
+
popOpen.value = false;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const result = props.onConfirm();
|
|
122
|
+
if (result instanceof Promise) {
|
|
123
|
+
isLoading.value = true;
|
|
124
|
+
try {
|
|
125
|
+
await result;
|
|
126
|
+
} finally {
|
|
127
|
+
isLoading.value = false;
|
|
128
|
+
popOpen.value = false;
|
|
129
|
+
}
|
|
130
|
+
} else popOpen.value = false;
|
|
131
|
+
}
|
|
132
|
+
return (_ctx, _cache) => {
|
|
133
|
+
return openBlock(), createBlock(unref(Popover_default), {
|
|
134
|
+
open: popOpen.value,
|
|
135
|
+
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => popOpen.value = $event)
|
|
136
|
+
}, {
|
|
137
|
+
default: withCtx(() => [createVNode(unref(PopoverTrigger_default), { "as-child": "" }, {
|
|
138
|
+
default: withCtx(() => [createVNode(unref(Button_default), mergeProps({ variant: unref(variant) }, {
|
|
139
|
+
..._ctx.$attrs,
|
|
140
|
+
class: void 0
|
|
141
|
+
}, { class: _ctx.$attrs.class }), {
|
|
142
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
143
|
+
_: 3
|
|
144
|
+
}, 16, ["variant", "class"])]),
|
|
145
|
+
_: 3
|
|
146
|
+
}), createVNode(unref(PopoverContent_default), { class: "w-auto max-w-[280px] p-4" }, {
|
|
147
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(CircleAlertIcon), { class: "mt-0.5 size-4 text-amber-500 shrink-0" }), createElementVNode("div", _hoisted_2, toDisplayString(_ctx.title), 1)]), createElementVNode("div", _hoisted_3, [createVNode(unref(Button_default), {
|
|
148
|
+
size: "sm",
|
|
149
|
+
variant: "outline",
|
|
150
|
+
onClick: _cache[0] || (_cache[0] = ($event) => popOpen.value = false)
|
|
151
|
+
}, {
|
|
152
|
+
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.cancelText), 1)]),
|
|
153
|
+
_: 1
|
|
154
|
+
}), createVNode(unref(Button_default), {
|
|
155
|
+
size: "sm",
|
|
156
|
+
variant: _ctx.danger ? "destructive" : "default",
|
|
157
|
+
disabled: isLoading.value || void 0,
|
|
158
|
+
onClick: handleConfirm
|
|
159
|
+
}, {
|
|
160
|
+
default: withCtx(() => [isLoading.value ? (openBlock(), createBlock(unref(Loader_default), {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: "text-current"
|
|
163
|
+
})) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(_ctx.okText), 1)]),
|
|
164
|
+
_: 1
|
|
165
|
+
}, 8, ["variant", "disabled"])])]),
|
|
166
|
+
_: 1
|
|
167
|
+
})]),
|
|
168
|
+
_: 3
|
|
169
|
+
}, 8, ["open"]);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
export { ProConfirmButton_default as t };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=ProConfirmButton-zcvp7NcN.js.map
|