@mcistudio/unoui-vue 1.0.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 +95 -0
- package/dist/alert/Alert.vue.d.ts +67 -0
- package/dist/alert/index.d.ts +40 -0
- package/dist/alert/index.js +2 -0
- package/dist/attrs.d.ts +11 -0
- package/dist/attrs.js +16 -0
- package/dist/attrs.js.map +1 -0
- package/dist/badge/Badge.vue.d.ts +57 -0
- package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
- package/dist/badge/index.d.ts +42 -0
- package/dist/badge/index.js +2 -0
- package/dist/build.d.ts +2 -0
- package/dist/button/Button.vue.d.ts +46 -0
- package/dist/button/ButtonGroup.vue.d.ts +13 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +2 -0
- package/dist/checkbox/Checkbox.vue.d.ts +47 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
- package/dist/checkbox/index.d.ts +30 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
- package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
- package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
- package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
- package/dist/chunks/Table-DhXmuKQd.js +330 -0
- package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/chunks/alert-CczW_DKs.js +190 -0
- package/dist/chunks/alert-CczW_DKs.js.map +1 -0
- package/dist/chunks/badge-BHOZeImh.js +287 -0
- package/dist/chunks/badge-BHOZeImh.js.map +1 -0
- package/dist/chunks/button-pDObrN_X.js +168 -0
- package/dist/chunks/button-pDObrN_X.js.map +1 -0
- package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
- package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
- package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
- package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
- package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
- package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
- package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
- package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
- package/dist/chunks/dropdown-0l967g7D.js +329 -0
- package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
- package/dist/chunks/form-Qeqkd-HH.js +642 -0
- package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
- package/dist/chunks/input-BDOXVCrK.js +1281 -0
- package/dist/chunks/input-BDOXVCrK.js.map +1 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
- package/dist/chunks/message-xPfuG0EX.js +107 -0
- package/dist/chunks/message-xPfuG0EX.js.map +1 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
- package/dist/chunks/modal-D6l1iIvE.js +81 -0
- package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
- package/dist/chunks/pagination-Bc583AQX.js +265 -0
- package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
- package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
- package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
- package/dist/chunks/radio-DnYm59xH.js +477 -0
- package/dist/chunks/radio-DnYm59xH.js.map +1 -0
- package/dist/chunks/rate-0sme__Kb.js +309 -0
- package/dist/chunks/rate-0sme__Kb.js.map +1 -0
- package/dist/chunks/select-ChTfQM5u.js +417 -0
- package/dist/chunks/select-ChTfQM5u.js.map +1 -0
- package/dist/chunks/slider-C-W5GzTP.js +724 -0
- package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
- package/dist/chunks/splitter-CgfiXY65.js +524 -0
- package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
- package/dist/chunks/switch-BULGbODP.js +327 -0
- package/dist/chunks/switch-BULGbODP.js.map +1 -0
- package/dist/chunks/tab-Dxfg1_To.js +663 -0
- package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
- package/dist/chunks/tag-BYmNsrZC.js +167 -0
- package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
- package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
- package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
- package/dist/chunks/tooltip-DMhiAqto.js +242 -0
- package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
- package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
- package/dist/colorpicker/color.d.ts +56 -0
- package/dist/colorpicker/color.js +99 -0
- package/dist/colorpicker/color.js.map +1 -0
- package/dist/colorpicker/index.d.ts +12 -0
- package/dist/colorpicker/index.js +2 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.js +260 -0
- package/dist/config.js.map +1 -0
- package/dist/datepicker/DatePicker.vue.d.ts +82 -0
- package/dist/datepicker/RangePicker.vue.d.ts +87 -0
- package/dist/datepicker/index.d.ts +59 -0
- package/dist/datepicker/index.js +2 -0
- package/dist/drawer/Drawer.vue.d.ts +86 -0
- package/dist/drawer/index.d.ts +23 -0
- package/dist/drawer/index.js +2 -0
- package/dist/dropdown/Dropdown.vue.d.ts +118 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/form/Form.vue.d.ts +170 -0
- package/dist/form/FormItem.vue.d.ts +83 -0
- package/dist/form/index.d.ts +176 -0
- package/dist/form/index.js +2 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/input/Autocomplete.vue.d.ts +121 -0
- package/dist/input/Input.vue.d.ts +142 -0
- package/dist/input/InputI18n.vue.d.ts +80 -0
- package/dist/input/InputTag.vue.d.ts +114 -0
- package/dist/input/index.d.ts +41 -0
- package/dist/input/index.js +2 -0
- package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
- package/dist/inputOtp/index.d.ts +21 -0
- package/dist/inputOtp/index.js +2 -0
- package/dist/message/MessageContainer.vue.d.ts +11 -0
- package/dist/message/index.d.ts +20 -0
- package/dist/message/index.js +2 -0
- package/dist/message/types.d.ts +25 -0
- package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
- package/dist/millercolumns/index.d.ts +39 -0
- package/dist/millercolumns/index.js +2 -0
- package/dist/modal/Modal.vue.d.ts +54 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/pagination/Pagination.vue.d.ts +70 -0
- package/dist/pagination/index.d.ts +12 -0
- package/dist/pagination/index.js +2 -0
- package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
- package/dist/popconfirm/index.d.ts +36 -0
- package/dist/popconfirm/index.js +2 -0
- package/dist/progress/Progress.vue.d.ts +64 -0
- package/dist/progress/index.d.ts +26 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/QRCode.vue.d.ts +87 -0
- package/dist/qrcode/index.d.ts +43 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/qrcode/qr.d.ts +51 -0
- package/dist/qrcode/qrcodegen.d.ts +94 -0
- package/dist/radio/Radio.vue.d.ts +52 -0
- package/dist/radio/RadioGroup.vue.d.ts +44 -0
- package/dist/radio/index.d.ts +55 -0
- package/dist/radio/index.js +2 -0
- package/dist/rate/Rate.vue.d.ts +100 -0
- package/dist/rate/index.d.ts +38 -0
- package/dist/rate/index.js +2 -0
- package/dist/select/Select.vue.d.ts +129 -0
- package/dist/select/index.d.ts +33 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/Skeleton.vue.d.ts +31 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/Slider.vue.d.ts +81 -0
- package/dist/slider/index.d.ts +61 -0
- package/dist/slider/index.js +2 -0
- package/dist/splitter/Splitter.vue.d.ts +63 -0
- package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
- package/dist/splitter/index.d.ts +39 -0
- package/dist/splitter/index.js +2 -0
- package/dist/style.css +2 -0
- package/dist/switch/Switch.vue.d.ts +97 -0
- package/dist/switch/index.d.ts +31 -0
- package/dist/switch/index.js +2 -0
- package/dist/tab/TabPane.vue.d.ts +32 -0
- package/dist/tab/Tabs.vue.d.ts +87 -0
- package/dist/tab/index.d.ts +78 -0
- package/dist/tab/index.js +2 -0
- package/dist/table/Table.vue.d.ts +96 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.js +2 -0
- package/dist/table/types.d.ts +35 -0
- package/dist/table/types.js +0 -0
- package/dist/tag/Tag.vue.d.ts +46 -0
- package/dist/tag/index.d.ts +11 -0
- package/dist/tag/index.js +2 -0
- package/dist/timepicker/TimePicker.vue.d.ts +92 -0
- package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
- package/dist/timepicker/index.d.ts +39 -0
- package/dist/timepicker/index.js +2 -0
- package/dist/tooltip/Tooltip.vue.d.ts +79 -0
- package/dist/tooltip/index.d.ts +14 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/uno.d.ts +32 -0
- package/dist/uno.js +83 -0
- package/dist/uno.js.map +1 -0
- package/dist/utils/DnD.d.ts +38 -0
- package/package.json +115 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
2
|
+
import { cva as t } from "class-variance-authority";
|
|
3
|
+
import { createCommentVNode as n, createElementBlock as r, defineComponent as i, normalizeClass as a, normalizeStyle as o, openBlock as s, renderSlot as c, unref as l } from "vue";
|
|
4
|
+
//#region src/button/Button.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var u = [
|
|
6
|
+
"data-color",
|
|
7
|
+
"data-variant",
|
|
8
|
+
"type",
|
|
9
|
+
"disabled"
|
|
10
|
+
], d = /* @__PURE__ */ i({
|
|
11
|
+
__name: "Button",
|
|
12
|
+
props: {
|
|
13
|
+
color: { default: "brand" },
|
|
14
|
+
variant: { default: "default" },
|
|
15
|
+
icon: {},
|
|
16
|
+
iconSize: { default: "14" },
|
|
17
|
+
size: { default: "md" },
|
|
18
|
+
radius: { default: "md" },
|
|
19
|
+
loading: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !1
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !1
|
|
26
|
+
},
|
|
27
|
+
type: { default: "button" }
|
|
28
|
+
},
|
|
29
|
+
setup(e) {
|
|
30
|
+
return (t, i) => (s(), r("button", {
|
|
31
|
+
"data-ui-button": "true",
|
|
32
|
+
"data-color": e.color,
|
|
33
|
+
"data-variant": e.variant,
|
|
34
|
+
type: e.type,
|
|
35
|
+
class: a(l(w)({
|
|
36
|
+
color: e.color,
|
|
37
|
+
variant: e.variant,
|
|
38
|
+
size: e.size,
|
|
39
|
+
radius: e.radius,
|
|
40
|
+
disabled: e.disabled
|
|
41
|
+
})),
|
|
42
|
+
disabled: e.disabled
|
|
43
|
+
}, [e.loading ? (s(), r("span", {
|
|
44
|
+
key: 0,
|
|
45
|
+
class: "i-lucide:loader-2 animate-spin",
|
|
46
|
+
style: o(`font-size: ${e.iconSize}px`)
|
|
47
|
+
}, null, 4)) : e.icon ? (s(), r("span", {
|
|
48
|
+
key: 1,
|
|
49
|
+
class: a(e.icon),
|
|
50
|
+
style: o(`font-size: ${e.iconSize}px`)
|
|
51
|
+
}, null, 6)) : n("", !0), c(t.$slots, "default")], 10, u));
|
|
52
|
+
}
|
|
53
|
+
}), f = {}, p = { class: "inline-flex items-center isolate" };
|
|
54
|
+
function m(e, t) {
|
|
55
|
+
return s(), r("div", p, [c(e.$slots, "default", {}, void 0, !0)]);
|
|
56
|
+
}
|
|
57
|
+
var h = /*#__PURE__*/ e(f, [["render", m], ["__scopeId", "data-v-d7310e6e"]]), g = [
|
|
58
|
+
"brand",
|
|
59
|
+
"red",
|
|
60
|
+
"gray",
|
|
61
|
+
"green",
|
|
62
|
+
"yellow",
|
|
63
|
+
"orange"
|
|
64
|
+
], _ = [
|
|
65
|
+
"default",
|
|
66
|
+
"outline",
|
|
67
|
+
"dashed",
|
|
68
|
+
"link",
|
|
69
|
+
"mono"
|
|
70
|
+
], v = (e) => Object.fromEntries(e.map((e) => [e, ""])), y = {
|
|
71
|
+
brand: "active:after:shadow-[0_0_0_0_brand-500]",
|
|
72
|
+
red: "active:after:shadow-[0_0_0_0_red-500]",
|
|
73
|
+
gray: "active:after:shadow-[0_0_0_0_gray-500]",
|
|
74
|
+
green: "active:after:shadow-[0_0_0_0_green-500]",
|
|
75
|
+
yellow: "active:after:shadow-[0_0_0_0_yellow-500]",
|
|
76
|
+
orange: "active:after:shadow-[0_0_0_0_orange-500]"
|
|
77
|
+
}, b = "after:content-empty after:absolute after:inset-0 after:opacity-80 after:transition-all after:duration-800 after:shadow-[0_0_0_7px_transparent] after:ease-out active:after:opacity-0 active:after:duration-0", x = {
|
|
78
|
+
brand: {
|
|
79
|
+
solid: "border-brand-500 bg-brand-500 text-brand-50 hover:border-brand-400 hover:bg-brand-400",
|
|
80
|
+
outline: "border-brand-500 text-brand-500 hover:border-brand-400 hover:bg-brand-400/15 hover:text-brand-400",
|
|
81
|
+
mono: "hover:border-brand-400 hover:bg-brand-400/15 hover:text-brand-400",
|
|
82
|
+
dashed: "border-brand-500 text-brand-500 hover:border-brand-400 hover:bg-brand-400/15 hover:text-brand-400",
|
|
83
|
+
link: "text-brand-500 hover:text-brand-600"
|
|
84
|
+
},
|
|
85
|
+
red: {
|
|
86
|
+
solid: "border-red-500 bg-red-500 text-red-50 hover:border-red-400 hover:bg-red-400",
|
|
87
|
+
outline: "border-red-500 text-red-500 hover:border-red-400 hover:bg-red-400/15 hover:text-red-400",
|
|
88
|
+
mono: "hover:border-red-400 hover:bg-red-400/15 hover:text-red-400",
|
|
89
|
+
dashed: "border-red-500 text-red-500 hover:border-red-400 hover:bg-red-400/15 hover:text-red-400",
|
|
90
|
+
link: "text-red-500 hover:text-red-600"
|
|
91
|
+
},
|
|
92
|
+
gray: {
|
|
93
|
+
solid: "border-gray-500 bg-gray-500 text-gray-50 hover:border-gray-400 hover:bg-gray-400",
|
|
94
|
+
outline: "border-gray-400 text-gray-500 hover:border-gray-400 hover:bg-gray-400/15 hover:text-gray-400",
|
|
95
|
+
mono: "hover:border-gray-400 hover:bg-gray-400/15 hover:text-gray-400",
|
|
96
|
+
dashed: "border-gray-400 text-gray-500 hover:border-gray-400 hover:bg-gray-400/15 hover:text-gray-400",
|
|
97
|
+
link: "text-gray-500 hover:text-gray-600"
|
|
98
|
+
},
|
|
99
|
+
green: {
|
|
100
|
+
solid: "border-green-500 bg-green-500 text-green-50 hover:border-green-400 hover:bg-green-400",
|
|
101
|
+
outline: "border-green-500 text-green-500 hover:border-green-400 hover:bg-green-400/15 hover:text-green-400",
|
|
102
|
+
mono: "hover:border-green-400 hover:bg-green-400/15 hover:text-green-400",
|
|
103
|
+
dashed: "border-green-500 text-green-500 hover:border-green-400 hover:bg-green-400/15 hover:text-green-400",
|
|
104
|
+
link: "text-green-500 hover:text-green-600"
|
|
105
|
+
},
|
|
106
|
+
yellow: {
|
|
107
|
+
solid: "border-amber-500 bg-amber-500 text-amber-50 hover:border-amber-400 hover:bg-amber-400",
|
|
108
|
+
outline: "border-amber-500 text-amber-500 hover:border-amber-400 hover:bg-amber-400/15 hover:text-amber-400",
|
|
109
|
+
mono: "hover:border-amber-400 hover:bg-amber-400/15 hover:text-amber-400",
|
|
110
|
+
dashed: "border-amber-500 text-amber-500 hover:border-amber-400 hover:bg-amber-400/15 hover:text-amber-400",
|
|
111
|
+
link: "text-amber-500 hover:text-amber-600"
|
|
112
|
+
},
|
|
113
|
+
orange: {
|
|
114
|
+
solid: "border-orange-500 bg-orange-500 text-orange-50 hover:border-orange-400 hover:bg-orange-400",
|
|
115
|
+
outline: "border-orange-500 text-orange-500 hover:border-orange-400 hover:bg-orange-400/15 hover:text-orange-400",
|
|
116
|
+
mono: "hover:border-orange-400 hover:bg-orange-400/15 hover:text-orange-400",
|
|
117
|
+
dashed: "border-orange-500 text-orange-500 hover:border-orange-400 hover:bg-orange-400/15 hover:text-orange-400",
|
|
118
|
+
link: "text-orange-500 hover:text-orange-600"
|
|
119
|
+
}
|
|
120
|
+
}, S = {
|
|
121
|
+
default: "solid",
|
|
122
|
+
outline: "outline",
|
|
123
|
+
dashed: "dashed",
|
|
124
|
+
link: "link",
|
|
125
|
+
mono: "mono"
|
|
126
|
+
}, C = g.flatMap((e) => _.map((t) => ({
|
|
127
|
+
color: e,
|
|
128
|
+
variant: t,
|
|
129
|
+
class: `${x[e][S[t]]} ${t === "link" ? "" : `${b} ${y[e]}`}`
|
|
130
|
+
}))), w = t("relative flex shrink-0 items-center justify-center whitespace-nowrap font-normal transition-all duration-150", {
|
|
131
|
+
variants: {
|
|
132
|
+
color: v(g),
|
|
133
|
+
variant: {
|
|
134
|
+
default: "border",
|
|
135
|
+
outline: "border bg-transparent",
|
|
136
|
+
dashed: "border border-dashed bg-transparent",
|
|
137
|
+
link: "bg-transparent hover:bg-transparent hover:underline underline-offset-4 underline-dashed px-2!",
|
|
138
|
+
mono: "border border-zinc-400 bg-primary text-zinc-500 dark:border-zinc-500 dark:text-zinc-400"
|
|
139
|
+
},
|
|
140
|
+
size: {
|
|
141
|
+
sm: "[&_svg]:size-4 text-sm/5 px-4 py-1 gap-1",
|
|
142
|
+
md: "[&_svg]:size-5 text-base/4 px-6 py-2 gap-1.5",
|
|
143
|
+
lg: "[&_svg]:size-6 text-lg/5 px-8 py-2 gap-2",
|
|
144
|
+
icon: "[&_svg]:size-4 px-1 py-1",
|
|
145
|
+
"icon-md": "[&_svg]:size-5 px-2 py-2",
|
|
146
|
+
"icon-lg": "[&_svg]:size-6 px-2.5 py-2.5"
|
|
147
|
+
},
|
|
148
|
+
radius: {
|
|
149
|
+
none: "rounded-none after:rounded-none",
|
|
150
|
+
sm: "rounded-sm after:rounded-sm",
|
|
151
|
+
md: "rounded-md after:rounded-md",
|
|
152
|
+
lg: "rounded-lg after:rounded-lg",
|
|
153
|
+
full: "rounded-full after:rounded-full"
|
|
154
|
+
},
|
|
155
|
+
disabled: { true: "opacity-50 cursor-not-allowed pointer-events-none" }
|
|
156
|
+
},
|
|
157
|
+
compoundVariants: C,
|
|
158
|
+
defaultVariants: {
|
|
159
|
+
color: "brand",
|
|
160
|
+
variant: "default",
|
|
161
|
+
size: "sm",
|
|
162
|
+
radius: "md"
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
//#endregion
|
|
166
|
+
export { h as n, d as r, w as t };
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=button-pDObrN_X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-pDObrN_X.js","names":[],"sources":["../../src/button/Button.vue","../../src/button/Button.vue","../../src/button/ButtonGroup.vue","../../src/button/index.ts"],"sourcesContent":["<template>\n <button data-ui-button=\"true\" :data-color=\"color\" :data-variant=\"variant\" :type=\"type\" :class=\"button({ color, variant, size, radius, disabled })\" :disabled=\"disabled\">\n <span v-if=\"loading\" class=\"i-lucide:loader-2 animate-spin\" :style=\"`font-size: ${iconSize}px`\"></span>\n <span v-else-if=\"icon\" :class=\"icon\" :style=\"`font-size: ${iconSize}px`\"></span>\n <slot></slot>\n </button>\n</template>\n\n<script setup lang=\"ts\">\nimport { button, type ButtonProps } from '.'\n\n/**\n * Button 是管理端轻量按钮组件,统一颜色、尺寸、圆角、图标和加载态样式。\n */\nwithDefaults(\n defineProps<{\n /** color 是按钮色彩语义,可选,默认 brand。 */\n color?: ButtonProps['color']\n /** variant 是按钮视觉变体,可选,默认 default。 */\n variant?: ButtonProps['variant']\n /** icon 是 UnoCSS/Iconify 图标类名,可选。 */\n icon?: string\n /** iconSize 是图标字号像素值字符串,可选,默认 14。 */\n iconSize?: string\n /** size 是按钮尺寸,可选,默认 md。 */\n size?: ButtonProps['size']\n /** radius 是按钮圆角尺寸,可选,默认 md。 */\n radius?: ButtonProps['radius']\n /** loading 表示是否展示加载图标,可选,默认 false。 */\n loading?: boolean\n /** disabled 表示是否禁用点击和指针事件,可选,默认 false。 */\n disabled?: boolean\n /** type 是原生 button 类型,可选,默认 button,避免表单内误触发提交。 */\n type?: 'button' | 'submit' | 'reset'\n }>(),\n {\n color: 'brand',\n variant: 'default',\n iconSize: '14',\n size: 'md',\n radius: 'md',\n loading: false,\n disabled: false,\n type: 'button'\n }\n)\n</script>\n","<template>\n <button data-ui-button=\"true\" :data-color=\"color\" :data-variant=\"variant\" :type=\"type\" :class=\"button({ color, variant, size, radius, disabled })\" :disabled=\"disabled\">\n <span v-if=\"loading\" class=\"i-lucide:loader-2 animate-spin\" :style=\"`font-size: ${iconSize}px`\"></span>\n <span v-else-if=\"icon\" :class=\"icon\" :style=\"`font-size: ${iconSize}px`\"></span>\n <slot></slot>\n </button>\n</template>\n\n<script setup lang=\"ts\">\nimport { button, type ButtonProps } from '.'\n\n/**\n * Button 是管理端轻量按钮组件,统一颜色、尺寸、圆角、图标和加载态样式。\n */\nwithDefaults(\n defineProps<{\n /** color 是按钮色彩语义,可选,默认 brand。 */\n color?: ButtonProps['color']\n /** variant 是按钮视觉变体,可选,默认 default。 */\n variant?: ButtonProps['variant']\n /** icon 是 UnoCSS/Iconify 图标类名,可选。 */\n icon?: string\n /** iconSize 是图标字号像素值字符串,可选,默认 14。 */\n iconSize?: string\n /** size 是按钮尺寸,可选,默认 md。 */\n size?: ButtonProps['size']\n /** radius 是按钮圆角尺寸,可选,默认 md。 */\n radius?: ButtonProps['radius']\n /** loading 表示是否展示加载图标,可选,默认 false。 */\n loading?: boolean\n /** disabled 表示是否禁用点击和指针事件,可选,默认 false。 */\n disabled?: boolean\n /** type 是原生 button 类型,可选,默认 button,避免表单内误触发提交。 */\n type?: 'button' | 'submit' | 'reset'\n }>(),\n {\n color: 'brand',\n variant: 'default',\n iconSize: '14',\n size: 'md',\n radius: 'md',\n loading: false,\n disabled: false,\n type: 'button'\n }\n)\n</script>\n","<template>\n <div class=\"inline-flex items-center isolate\">\n <slot />\n </div>\n</template>\n\n<style scoped>\n:deep(button),\n:deep(.button) {\n border-radius: 0 !important;\n}\n\n/* 按钮组内部取消中间圆角,仅首尾按钮保留外侧圆角。 */\n:deep(> *:first-child),\n:deep(> *:first-child button) {\n border-top-left-radius: 0.375rem !important;\n border-bottom-left-radius: 0.375rem !important;\n}\n\n:deep(> *:last-child),\n:deep(> *:last-child button) {\n border-top-right-radius: 0.375rem !important;\n border-bottom-right-radius: 0.375rem !important;\n}\n\n/* 相邻按钮边框重叠,避免按钮组中间出现双边框。 */\n:deep(> *:not(:first-child)) {\n margin-left: -1px;\n}\n\n/* 按钮组内的 default 表示已选中,hover 时保持选中态本色。 */\n:deep([data-ui-button='true'][data-variant='default'][data-color='brand']:hover) {\n --at-apply: '!border-brand-500 !bg-brand-500';\n}\n\n:deep([data-ui-button='true'][data-variant='default'][data-color='red']:hover) {\n --at-apply: '!border-red-500 !bg-red-500';\n}\n\n:deep([data-ui-button='true'][data-variant='default'][data-color='gray']:hover) {\n --at-apply: '!border-gray-500 !bg-gray-500';\n}\n\n:deep([data-ui-button='true'][data-variant='default'][data-color='green']:hover) {\n --at-apply: '!border-green-500 !bg-green-500';\n}\n\n:deep([data-ui-button='true'][data-variant='default'][data-color='yellow']:hover) {\n --at-apply: '!border-amber-500 !bg-amber-500';\n}\n\n:deep([data-ui-button='true'][data-variant='default'][data-color='orange']:hover) {\n --at-apply: '!border-orange-500 !bg-orange-500';\n}\n</style>\n","import { cva } from 'class-variance-authority'\nimport type { VariantProps } from 'class-variance-authority'\nexport { default as Button } from './Button.vue'\nexport { default as ButtonGroup } from './ButtonGroup.vue'\n\nconst buttonColorOptions = ['brand', 'red', 'gray', 'green', 'yellow', 'orange'] as const\nconst buttonVariantOptions = ['default', 'outline', 'dashed', 'link', 'mono'] as const\ntype ButtonColor = (typeof buttonColorOptions)[number]\ntype ButtonVariant = (typeof buttonVariantOptions)[number]\ntype ButtonColorStyleKey = 'solid' | 'outline' | 'mono' | 'dashed' | 'link'\n\nconst emptyVariantRecord = <T extends readonly string[]>(options: T) => Object.fromEntries(options.map((option) => [option, ''])) as Record<T[number], ''>\n\nconst buttonActiveClasses: Record<ButtonColor, string> = {\n brand: 'active:after:shadow-[0_0_0_0_brand-500]',\n red: 'active:after:shadow-[0_0_0_0_red-500]',\n gray: 'active:after:shadow-[0_0_0_0_gray-500]',\n green: 'active:after:shadow-[0_0_0_0_green-500]',\n yellow: 'active:after:shadow-[0_0_0_0_yellow-500]',\n orange: 'active:after:shadow-[0_0_0_0_orange-500]'\n}\nconst buttonRippleClasses = 'after:content-empty after:absolute after:inset-0 after:opacity-80 after:transition-all after:duration-800 after:shadow-[0_0_0_7px_transparent] after:ease-out active:after:opacity-0 active:after:duration-0'\n\n// 颜色态保留完整 UnoCSS 类字面量,确保构建扫描可以生成对应样式。\nconst buttonColorClasses: Record<ButtonColor, Record<ButtonColorStyleKey, string>> = {\n brand: {\n solid: 'border-brand-500 bg-brand-500 text-brand-50 hover:border-brand-400 hover:bg-brand-400',\n outline: 'border-brand-500 text-brand-500 hover:border-brand-400 hover:bg-brand-400/15 hover:text-brand-400',\n mono: 'hover:border-brand-400 hover:bg-brand-400/15 hover:text-brand-400',\n dashed: 'border-brand-500 text-brand-500 hover:border-brand-400 hover:bg-brand-400/15 hover:text-brand-400',\n link: 'text-brand-500 hover:text-brand-600'\n },\n red: {\n solid: 'border-red-500 bg-red-500 text-red-50 hover:border-red-400 hover:bg-red-400',\n outline: 'border-red-500 text-red-500 hover:border-red-400 hover:bg-red-400/15 hover:text-red-400',\n mono: 'hover:border-red-400 hover:bg-red-400/15 hover:text-red-400',\n dashed: 'border-red-500 text-red-500 hover:border-red-400 hover:bg-red-400/15 hover:text-red-400',\n link: 'text-red-500 hover:text-red-600'\n },\n gray: {\n solid: 'border-gray-500 bg-gray-500 text-gray-50 hover:border-gray-400 hover:bg-gray-400',\n outline: 'border-gray-400 text-gray-500 hover:border-gray-400 hover:bg-gray-400/15 hover:text-gray-400',\n mono: 'hover:border-gray-400 hover:bg-gray-400/15 hover:text-gray-400',\n dashed: 'border-gray-400 text-gray-500 hover:border-gray-400 hover:bg-gray-400/15 hover:text-gray-400',\n link: 'text-gray-500 hover:text-gray-600'\n },\n green: {\n solid: 'border-green-500 bg-green-500 text-green-50 hover:border-green-400 hover:bg-green-400',\n outline: 'border-green-500 text-green-500 hover:border-green-400 hover:bg-green-400/15 hover:text-green-400',\n mono: 'hover:border-green-400 hover:bg-green-400/15 hover:text-green-400',\n dashed: 'border-green-500 text-green-500 hover:border-green-400 hover:bg-green-400/15 hover:text-green-400',\n link: 'text-green-500 hover:text-green-600'\n },\n yellow: {\n solid: 'border-amber-500 bg-amber-500 text-amber-50 hover:border-amber-400 hover:bg-amber-400',\n outline: 'border-amber-500 text-amber-500 hover:border-amber-400 hover:bg-amber-400/15 hover:text-amber-400',\n mono: 'hover:border-amber-400 hover:bg-amber-400/15 hover:text-amber-400',\n dashed: 'border-amber-500 text-amber-500 hover:border-amber-400 hover:bg-amber-400/15 hover:text-amber-400',\n link: 'text-amber-500 hover:text-amber-600'\n },\n orange: {\n solid: 'border-orange-500 bg-orange-500 text-orange-50 hover:border-orange-400 hover:bg-orange-400',\n outline: 'border-orange-500 text-orange-500 hover:border-orange-400 hover:bg-orange-400/15 hover:text-orange-400',\n mono: 'hover:border-orange-400 hover:bg-orange-400/15 hover:text-orange-400',\n dashed: 'border-orange-500 text-orange-500 hover:border-orange-400 hover:bg-orange-400/15 hover:text-orange-400',\n link: 'text-orange-500 hover:text-orange-600'\n }\n} as const\n\nconst buttonVariantColorStyleKeys: Record<ButtonVariant, ButtonColorStyleKey> = {\n default: 'solid',\n outline: 'outline',\n dashed: 'dashed',\n link: 'link',\n mono: 'mono'\n}\n\nconst buttonCompoundVariants = buttonColorOptions.flatMap((color) =>\n buttonVariantOptions.map((variant) => ({\n color,\n variant,\n class: `${buttonColorClasses[color][buttonVariantColorStyleKeys[variant]]} ${variant === 'link' ? '' : `${buttonRippleClasses} ${buttonActiveClasses[color]}`}`\n }))\n)\n\n/** button 定义管理端 Button 组件的样式变体组合。 */\nexport const button = cva('relative flex shrink-0 items-center justify-center whitespace-nowrap font-normal transition-all duration-150', {\n variants: {\n color: emptyVariantRecord(buttonColorOptions),\n variant: {\n default: 'border',\n outline: 'border bg-transparent',\n dashed: 'border border-dashed bg-transparent',\n link: 'bg-transparent hover:bg-transparent hover:underline underline-offset-4 underline-dashed px-2!',\n mono: 'border border-zinc-400 bg-primary text-zinc-500 dark:border-zinc-500 dark:text-zinc-400'\n },\n size: {\n sm: '[&_svg]:size-4 text-sm/5 px-4 py-1 gap-1',\n md: '[&_svg]:size-5 text-base/4 px-6 py-2 gap-1.5',\n lg: '[&_svg]:size-6 text-lg/5 px-8 py-2 gap-2',\n icon: '[&_svg]:size-4 px-1 py-1',\n 'icon-md': '[&_svg]:size-5 px-2 py-2',\n 'icon-lg': '[&_svg]:size-6 px-2.5 py-2.5'\n },\n radius: {\n none: 'rounded-none after:rounded-none',\n sm: 'rounded-sm after:rounded-sm',\n md: 'rounded-md after:rounded-md',\n lg: 'rounded-lg after:rounded-lg',\n full: 'rounded-full after:rounded-full'\n },\n disabled: {\n true: 'opacity-50 cursor-not-allowed pointer-events-none'\n }\n },\n compoundVariants: buttonCompoundVariants,\n defaultVariants: {\n color: 'brand',\n variant: 'default',\n size: 'sm',\n radius: 'md'\n }\n})\n\n/** ButtonProps 是 button 变体推导出的组件属性类型。 */\nexport type ButtonProps = VariantProps<typeof button>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBACE,EAIS,UAAA;GAJD,kBAAe;GAAQ,cAAY,EAAA;GAAQ,gBAAc,EAAA;GAAU,MAAM,EAAA;GAAO,OAAK,EAAE,EAAA,CAAA,CAAM,CAAA;IAAA,OAAG,EAAA;IAAK,SA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EACR,MAAM;CACR;AACF,GAEM,IAA0E;CAC9E,SAAS;CACT,SAAS;CACT,QAAQ;CACR,MAAM;CACN,MAAM;AACR,GAEM,IAAyB,EAAmB,SAAS,MACzD,EAAqB,KAAK,OAAa;CACrC;CACA;CACA,OAAO,GAAG,EAAmB,EAAM,CAAC,EAA4B,IAAU,GAAG,MAAY,SAAS,KAAK,GAAG,EAAoB,GAAG,EAAoB;AACvJ,EAAE,CACJ,GAGa,IAAS,EAAI,gHAAgH;CACxI,UAAU;EACR,OAAO,EAAmB,CAAkB;EAC5C,SAAS;GACP,SAAS;GACT,SAAS;GACT,QAAQ;GACR,MAAM;GACN,MAAM;EACR;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,MAAM;GACN,WAAW;GACX,WAAW;EACb;EACA,QAAQ;GACN,MAAM;GACN,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,MAAM;EACR;EACA,UAAU,EACR,MAAM,oDACR;CACF;CACA,kBAAkB;CAClB,iBAAiB;EACf,OAAO;EACP,SAAS;EACT,MAAM;EACN,QAAQ;CACV;AACF,CAAC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { getUiAttrClass as e, getUiAttrStyle as t, getUiExposeAttrs as n } from "../attrs.js";
|
|
2
|
+
import { cva as r } from "class-variance-authority";
|
|
3
|
+
import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, inject as l, mergeProps as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onMounted as m, openBlock as h, provide as g, ref as _, renderSlot as v, toRef as y, unref as b, useAttrs as x, watch as S } from "vue";
|
|
4
|
+
import { clsx as C } from "clsx";
|
|
5
|
+
//#region src/checkbox/Checkbox.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var w = [
|
|
7
|
+
"name",
|
|
8
|
+
"value",
|
|
9
|
+
"checked",
|
|
10
|
+
"aria-checked",
|
|
11
|
+
"disabled"
|
|
12
|
+
], T = {
|
|
13
|
+
key: 0,
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
viewBox: "0 0 16 16",
|
|
16
|
+
fill: "none",
|
|
17
|
+
class: "h-[82%] w-[82%]"
|
|
18
|
+
}, E = {
|
|
19
|
+
key: 1,
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
viewBox: "0 0 16 16",
|
|
22
|
+
fill: "none",
|
|
23
|
+
class: "h-[82%] w-[82%]"
|
|
24
|
+
}, D = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "select-none"
|
|
27
|
+
}, O = /* @__PURE__ */ c({
|
|
28
|
+
inheritAttrs: !1,
|
|
29
|
+
__name: "Checkbox",
|
|
30
|
+
props: {
|
|
31
|
+
checked: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: void 0
|
|
34
|
+
},
|
|
35
|
+
indeterminate: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !1
|
|
38
|
+
},
|
|
39
|
+
value: {},
|
|
40
|
+
disabled: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !1
|
|
43
|
+
},
|
|
44
|
+
size: {},
|
|
45
|
+
name: {}
|
|
46
|
+
},
|
|
47
|
+
emits: [
|
|
48
|
+
"change",
|
|
49
|
+
"input",
|
|
50
|
+
"focus",
|
|
51
|
+
"blur"
|
|
52
|
+
],
|
|
53
|
+
setup(r, { emit: c }) {
|
|
54
|
+
let g = r, y = c, O = x(), k = l(j, null), A = _(null), N = _(!!g.checked), P = i(() => /(?:^|\s)!?(?:size|h|w)-/.test(e(O))), F = i(() => g.disabled || !!k?.disabled.value), I = i(() => g.size ?? k?.size.value ?? "md"), L = i(() => g.name ?? k?.name.value), R = i(() => k && g.value !== void 0 ? k.modelValue.value.includes(g.value) : N.value), z = i(() => g.indeterminate), B = i(() => R.value || z.value), V = i(() => z.value ? "mixed" : !!R.value), H = i(() => C(e(O), M({
|
|
55
|
+
size: P.value ? null : I.value,
|
|
56
|
+
checked: B.value,
|
|
57
|
+
disabled: F.value
|
|
58
|
+
})));
|
|
59
|
+
S(() => g.checked, (e) => {
|
|
60
|
+
k || (N.value = !!e);
|
|
61
|
+
});
|
|
62
|
+
function U() {
|
|
63
|
+
A.value && (A.value.checked = !!R.value, A.value.indeterminate = z.value);
|
|
64
|
+
}
|
|
65
|
+
m(U), S([R, z], () => d(U));
|
|
66
|
+
function W(e) {
|
|
67
|
+
let t = e.target;
|
|
68
|
+
t && (t.checked = !!R.value, t.indeterminate = z.value);
|
|
69
|
+
}
|
|
70
|
+
function G(e) {
|
|
71
|
+
if (F.value) {
|
|
72
|
+
W(e);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
y("input", e);
|
|
76
|
+
}
|
|
77
|
+
function K(e) {
|
|
78
|
+
if (F.value) {
|
|
79
|
+
W(e);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
let t = e.target.checked;
|
|
83
|
+
N.value = t, y("change", t, e), k && g.value !== void 0 && k.updateValue(g.value, t, e), d(U);
|
|
84
|
+
}
|
|
85
|
+
return (e, i) => (h(), o("label", {
|
|
86
|
+
class: f([
|
|
87
|
+
"inline-flex w-fit items-center align-middle",
|
|
88
|
+
F.value ? "cursor-not-allowed text-tertiary opacity-70" : "cursor-pointer text-secondary",
|
|
89
|
+
e.$slots.default ? "gap-2" : ""
|
|
90
|
+
]),
|
|
91
|
+
style: p(b(t)(b(O)))
|
|
92
|
+
}, [s("span", { class: f(H.value) }, [s("input", u({
|
|
93
|
+
ref_key: "inputRef",
|
|
94
|
+
ref: A
|
|
95
|
+
}, b(n)(b(O)), {
|
|
96
|
+
"data-map-ui-checkbox": "true",
|
|
97
|
+
type: "checkbox",
|
|
98
|
+
name: L.value,
|
|
99
|
+
value: r.value,
|
|
100
|
+
checked: R.value,
|
|
101
|
+
"aria-checked": V.value,
|
|
102
|
+
disabled: F.value,
|
|
103
|
+
class: "absolute inset-0 m-0 h-full w-full cursor-inherit opacity-0",
|
|
104
|
+
onChange: K,
|
|
105
|
+
onInput: G,
|
|
106
|
+
onFocus: i[0] ||= (e) => y("focus", e),
|
|
107
|
+
onBlur: i[1] ||= (e) => y("blur", e)
|
|
108
|
+
}), null, 16, w), z.value ? (h(), o("svg", T, [...i[2] ||= [s("path", {
|
|
109
|
+
d: "M4 8H12",
|
|
110
|
+
stroke: "white",
|
|
111
|
+
"stroke-width": "2.4",
|
|
112
|
+
"stroke-linecap": "round"
|
|
113
|
+
}, null, -1)]])) : R.value ? (h(), o("svg", E, [...i[3] ||= [s("path", {
|
|
114
|
+
d: "M3.5 8.25L6.5 11L12.5 5",
|
|
115
|
+
stroke: "white",
|
|
116
|
+
"stroke-width": "2.2",
|
|
117
|
+
"stroke-linecap": "round",
|
|
118
|
+
"stroke-linejoin": "round"
|
|
119
|
+
}, null, -1)]])) : a("", !0)], 2), e.$slots.default ? (h(), o("span", D, [v(e.$slots, "default")])) : a("", !0)], 6));
|
|
120
|
+
}
|
|
121
|
+
}), k = ["data-direction", "aria-disabled"], A = /* @__PURE__ */ c({
|
|
122
|
+
inheritAttrs: !1,
|
|
123
|
+
__name: "CheckboxGroup",
|
|
124
|
+
props: {
|
|
125
|
+
modelValue: { default: () => [] },
|
|
126
|
+
disabled: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: !1
|
|
129
|
+
},
|
|
130
|
+
size: { default: "md" },
|
|
131
|
+
name: { default: void 0 },
|
|
132
|
+
direction: { default: "horizontal" }
|
|
133
|
+
},
|
|
134
|
+
emits: ["update:modelValue", "change"],
|
|
135
|
+
setup(r, { emit: a }) {
|
|
136
|
+
let s = r, c = a, l = x(), d = i(() => C(e(l), N({
|
|
137
|
+
direction: s.direction,
|
|
138
|
+
size: s.size,
|
|
139
|
+
disabled: s.disabled
|
|
140
|
+
})));
|
|
141
|
+
function f(e, t, n) {
|
|
142
|
+
let r = s.modelValue ?? [], i = t ? r.includes(e) ? r : [...r, e] : r.filter((t) => t !== e);
|
|
143
|
+
c("update:modelValue", i), c("change", i, n);
|
|
144
|
+
}
|
|
145
|
+
return g(j, {
|
|
146
|
+
modelValue: y(s, "modelValue"),
|
|
147
|
+
disabled: y(s, "disabled"),
|
|
148
|
+
size: y(s, "size"),
|
|
149
|
+
name: y(s, "name"),
|
|
150
|
+
updateValue: f
|
|
151
|
+
}), (e, i) => (h(), o("div", u(b(n)(b(l)), {
|
|
152
|
+
role: "group",
|
|
153
|
+
"data-ui-checkbox-group": "true",
|
|
154
|
+
"data-direction": r.direction,
|
|
155
|
+
"aria-disabled": r.disabled || void 0,
|
|
156
|
+
class: d.value,
|
|
157
|
+
style: b(t)(b(l))
|
|
158
|
+
}), [v(e.$slots, "default")], 16, k));
|
|
159
|
+
}
|
|
160
|
+
}), j = Symbol("ui-checkbox-group-context"), M = r("relative inline-flex shrink-0 items-center justify-center overflow-hidden border align-middle transition-colors duration-150", {
|
|
161
|
+
variants: {
|
|
162
|
+
size: {
|
|
163
|
+
sm: "size-4 rounded-sm",
|
|
164
|
+
md: "size-5 rounded",
|
|
165
|
+
lg: "size-6 rounded"
|
|
166
|
+
},
|
|
167
|
+
checked: {
|
|
168
|
+
true: "",
|
|
169
|
+
false: ""
|
|
170
|
+
},
|
|
171
|
+
disabled: {
|
|
172
|
+
true: "cursor-not-allowed",
|
|
173
|
+
false: "cursor-pointer"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
compoundVariants: [
|
|
177
|
+
{
|
|
178
|
+
checked: !0,
|
|
179
|
+
disabled: !1,
|
|
180
|
+
class: "border-brand-500 bg-brand-500 dark:border-brand-400 dark:bg-brand-500"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
checked: !0,
|
|
184
|
+
disabled: !0,
|
|
185
|
+
class: "border-zinc-400 bg-zinc-400 dark:border-zinc-600 dark:bg-zinc-800"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
checked: !1,
|
|
189
|
+
disabled: !1,
|
|
190
|
+
class: "border-medium bg-primary hover:border-brand-400 dark:border-zinc-500 dark:bg-zinc-950 dark:hover:border-brand-400"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
checked: !1,
|
|
194
|
+
disabled: !0,
|
|
195
|
+
class: "border-zinc-300 bg-zinc-100 dark:border-zinc-600 dark:bg-zinc-800"
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
defaultVariants: {
|
|
199
|
+
size: "md",
|
|
200
|
+
checked: !1,
|
|
201
|
+
disabled: !1
|
|
202
|
+
}
|
|
203
|
+
}), N = r("ui-checkbox-group inline-flex w-fit align-middle", {
|
|
204
|
+
variants: {
|
|
205
|
+
direction: {
|
|
206
|
+
horizontal: "flex-row flex-wrap items-center",
|
|
207
|
+
vertical: "flex-col items-start"
|
|
208
|
+
},
|
|
209
|
+
size: {
|
|
210
|
+
sm: "",
|
|
211
|
+
md: "",
|
|
212
|
+
lg: ""
|
|
213
|
+
},
|
|
214
|
+
disabled: {
|
|
215
|
+
true: "",
|
|
216
|
+
false: ""
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
compoundVariants: [
|
|
220
|
+
{
|
|
221
|
+
direction: "horizontal",
|
|
222
|
+
size: "sm",
|
|
223
|
+
class: "gap-x-4 gap-y-2"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
direction: "horizontal",
|
|
227
|
+
size: "md",
|
|
228
|
+
class: "gap-x-5 gap-y-2"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
direction: "horizontal",
|
|
232
|
+
size: "lg",
|
|
233
|
+
class: "gap-x-6 gap-y-2.5"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
direction: "vertical",
|
|
237
|
+
size: "sm",
|
|
238
|
+
class: "gap-1.5"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
direction: "vertical",
|
|
242
|
+
size: "md",
|
|
243
|
+
class: "gap-2"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
direction: "vertical",
|
|
247
|
+
size: "lg",
|
|
248
|
+
class: "gap-2.5"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
defaultVariants: {
|
|
252
|
+
direction: "horizontal",
|
|
253
|
+
size: "md",
|
|
254
|
+
disabled: !1
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
//#endregion
|
|
258
|
+
export { O as a, A as i, N as n, j as r, M as t };
|
|
259
|
+
|
|
260
|
+
//# sourceMappingURL=checkbox-9_0oR4kg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-9_0oR4kg.js","names":["$slots"],"sources":["../../src/checkbox/Checkbox.vue","../../src/checkbox/Checkbox.vue","../../src/checkbox/CheckboxGroup.vue","../../src/checkbox/CheckboxGroup.vue","../../src/checkbox/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, inject, nextTick, onMounted, ref, useAttrs, watch } from 'vue'\n\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { checkbox, checkboxGroupContextKey, type CheckboxSize, type CheckboxValue } from '.'\n\ndefineOptions({\n inheritAttrs: false\n})\n\n/**\n * Checkbox 是编辑器 UI 使用的原生复选框封装。\n *\n * 组件保留 input 原生事件;组内受控值由 CheckboxGroup 统一管理。\n */\nconst props = withDefaults(\n defineProps<{\n /** checked 是非受控单个 Checkbox 的默认选中态;组内选中态由 CheckboxGroup 控制。 */\n checked?: boolean\n /** indeterminate 表示部分选中状态,只控制视觉和原生 input 中间态。 */\n indeterminate?: boolean\n /** value 是当前 Checkbox 代表的值,组内选中时会同步到 CheckboxGroup modelValue。 */\n value?: CheckboxValue\n /** disabled 表示是否禁用交互,可选,默认 false。 */\n disabled?: boolean\n /** size 表示复选框尺寸;未传时继承 CheckboxGroup,组外默认 md。 */\n size?: CheckboxSize\n /** name 是原生 checkbox name;未传时继承 CheckboxGroup。 */\n name?: string\n }>(),\n {\n checked: undefined,\n indeterminate: false,\n disabled: false\n }\n)\n\nconst emit = defineEmits<{\n (e: 'change', checked: boolean, event: Event): void\n (e: 'input', event: Event): void\n (e: 'focus', event: FocusEvent): void\n (e: 'blur', event: FocusEvent): void\n}>()\n\nconst attrs = useAttrs()\nconst groupContext = inject(checkboxGroupContextKey, null)\nconst inputRef = ref<HTMLInputElement | null>(null)\nconst internalChecked = ref(!!props.checked)\nconst hasSizeClass = computed(() => /(?:^|\\s)!?(?:size|h|w)-/.test(getUiAttrClass(attrs)))\nconst resolvedDisabled = computed(() => props.disabled || !!groupContext?.disabled.value)\nconst resolvedSize = computed(() => props.size ?? groupContext?.size.value ?? 'md')\nconst resolvedName = computed(() => props.name ?? groupContext?.name.value)\nconst isChecked = computed(() => (groupContext && props.value !== undefined ? groupContext.modelValue.value.includes(props.value) : internalChecked.value))\nconst isIndeterminate = computed(() => props.indeterminate)\nconst isActive = computed(() => isChecked.value || isIndeterminate.value)\nconst ariaChecked = computed(() => (isIndeterminate.value ? 'mixed' : Boolean(isChecked.value)))\nconst checkboxClass = computed(() =>\n clsx(\n getUiAttrClass(attrs),\n checkbox({\n size: hasSizeClass.value ? null : resolvedSize.value,\n checked: isActive.value,\n disabled: resolvedDisabled.value\n })\n )\n)\n\nwatch(\n () => props.checked,\n (checked) => {\n if (!groupContext) {\n internalChecked.value = !!checked\n }\n }\n)\n\nfunction syncNativeInputState() {\n if (!inputRef.value) return\n inputRef.value.checked = Boolean(isChecked.value)\n inputRef.value.indeterminate = isIndeterminate.value\n}\n\nonMounted(syncNativeInputState)\nwatch([isChecked, isIndeterminate], () => nextTick(syncNativeInputState))\n\nfunction syncInputChecked(event: Event) {\n const target = event.target as HTMLInputElement | null\n if (target) {\n target.checked = Boolean(isChecked.value)\n target.indeterminate = isIndeterminate.value\n }\n}\n\nfunction handleInput(event: Event) {\n if (resolvedDisabled.value) {\n syncInputChecked(event)\n return\n }\n emit('input', event)\n}\n\n/**\n * 同步原生 change 事件到 CheckboxGroup 和外部监听器。\n *\n * @param event 原生 change 事件,target 必须是复选框 input。\n * @returns 无返回值。\n */\nfunction handleChange(event: Event) {\n if (resolvedDisabled.value) {\n syncInputChecked(event)\n return\n }\n const checked = (event.target as HTMLInputElement).checked\n internalChecked.value = checked\n emit('change', checked, event)\n if (groupContext && props.value !== undefined) {\n groupContext.updateValue(props.value, checked, event)\n }\n void nextTick(syncNativeInputState)\n}\n</script>\n\n<template>\n <label :class=\"['inline-flex w-fit items-center align-middle', resolvedDisabled ? 'cursor-not-allowed text-tertiary opacity-70' : 'cursor-pointer text-secondary', $slots.default ? 'gap-2' : '']\" :style=\"getUiAttrStyle(attrs)\">\n <span :class=\"checkboxClass\">\n <input\n ref=\"inputRef\"\n v-bind=\"getUiExposeAttrs(attrs)\"\n data-map-ui-checkbox=\"true\"\n type=\"checkbox\"\n :name=\"resolvedName\"\n :value=\"value\"\n :checked=\"isChecked\"\n :aria-checked=\"ariaChecked\"\n :disabled=\"resolvedDisabled\"\n class=\"absolute inset-0 m-0 h-full w-full cursor-inherit opacity-0\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @focus=\"emit('focus', $event)\"\n @blur=\"emit('blur', $event)\"\n />\n <svg v-if=\"isIndeterminate\" aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"h-[82%] w-[82%]\">\n <path d=\"M4 8H12\" stroke=\"white\" stroke-width=\"2.4\" stroke-linecap=\"round\" />\n </svg>\n <svg v-else-if=\"isChecked\" aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"h-[82%] w-[82%]\">\n <path d=\"M3.5 8.25L6.5 11L12.5 5\" stroke=\"white\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </span>\n <span v-if=\"$slots.default\" class=\"select-none\">\n <slot></slot>\n </span>\n </label>\n</template>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, inject, nextTick, onMounted, ref, useAttrs, watch } from 'vue'\n\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { checkbox, checkboxGroupContextKey, type CheckboxSize, type CheckboxValue } from '.'\n\ndefineOptions({\n inheritAttrs: false\n})\n\n/**\n * Checkbox 是编辑器 UI 使用的原生复选框封装。\n *\n * 组件保留 input 原生事件;组内受控值由 CheckboxGroup 统一管理。\n */\nconst props = withDefaults(\n defineProps<{\n /** checked 是非受控单个 Checkbox 的默认选中态;组内选中态由 CheckboxGroup 控制。 */\n checked?: boolean\n /** indeterminate 表示部分选中状态,只控制视觉和原生 input 中间态。 */\n indeterminate?: boolean\n /** value 是当前 Checkbox 代表的值,组内选中时会同步到 CheckboxGroup modelValue。 */\n value?: CheckboxValue\n /** disabled 表示是否禁用交互,可选,默认 false。 */\n disabled?: boolean\n /** size 表示复选框尺寸;未传时继承 CheckboxGroup,组外默认 md。 */\n size?: CheckboxSize\n /** name 是原生 checkbox name;未传时继承 CheckboxGroup。 */\n name?: string\n }>(),\n {\n checked: undefined,\n indeterminate: false,\n disabled: false\n }\n)\n\nconst emit = defineEmits<{\n (e: 'change', checked: boolean, event: Event): void\n (e: 'input', event: Event): void\n (e: 'focus', event: FocusEvent): void\n (e: 'blur', event: FocusEvent): void\n}>()\n\nconst attrs = useAttrs()\nconst groupContext = inject(checkboxGroupContextKey, null)\nconst inputRef = ref<HTMLInputElement | null>(null)\nconst internalChecked = ref(!!props.checked)\nconst hasSizeClass = computed(() => /(?:^|\\s)!?(?:size|h|w)-/.test(getUiAttrClass(attrs)))\nconst resolvedDisabled = computed(() => props.disabled || !!groupContext?.disabled.value)\nconst resolvedSize = computed(() => props.size ?? groupContext?.size.value ?? 'md')\nconst resolvedName = computed(() => props.name ?? groupContext?.name.value)\nconst isChecked = computed(() => (groupContext && props.value !== undefined ? groupContext.modelValue.value.includes(props.value) : internalChecked.value))\nconst isIndeterminate = computed(() => props.indeterminate)\nconst isActive = computed(() => isChecked.value || isIndeterminate.value)\nconst ariaChecked = computed(() => (isIndeterminate.value ? 'mixed' : Boolean(isChecked.value)))\nconst checkboxClass = computed(() =>\n clsx(\n getUiAttrClass(attrs),\n checkbox({\n size: hasSizeClass.value ? null : resolvedSize.value,\n checked: isActive.value,\n disabled: resolvedDisabled.value\n })\n )\n)\n\nwatch(\n () => props.checked,\n (checked) => {\n if (!groupContext) {\n internalChecked.value = !!checked\n }\n }\n)\n\nfunction syncNativeInputState() {\n if (!inputRef.value) return\n inputRef.value.checked = Boolean(isChecked.value)\n inputRef.value.indeterminate = isIndeterminate.value\n}\n\nonMounted(syncNativeInputState)\nwatch([isChecked, isIndeterminate], () => nextTick(syncNativeInputState))\n\nfunction syncInputChecked(event: Event) {\n const target = event.target as HTMLInputElement | null\n if (target) {\n target.checked = Boolean(isChecked.value)\n target.indeterminate = isIndeterminate.value\n }\n}\n\nfunction handleInput(event: Event) {\n if (resolvedDisabled.value) {\n syncInputChecked(event)\n return\n }\n emit('input', event)\n}\n\n/**\n * 同步原生 change 事件到 CheckboxGroup 和外部监听器。\n *\n * @param event 原生 change 事件,target 必须是复选框 input。\n * @returns 无返回值。\n */\nfunction handleChange(event: Event) {\n if (resolvedDisabled.value) {\n syncInputChecked(event)\n return\n }\n const checked = (event.target as HTMLInputElement).checked\n internalChecked.value = checked\n emit('change', checked, event)\n if (groupContext && props.value !== undefined) {\n groupContext.updateValue(props.value, checked, event)\n }\n void nextTick(syncNativeInputState)\n}\n</script>\n\n<template>\n <label :class=\"['inline-flex w-fit items-center align-middle', resolvedDisabled ? 'cursor-not-allowed text-tertiary opacity-70' : 'cursor-pointer text-secondary', $slots.default ? 'gap-2' : '']\" :style=\"getUiAttrStyle(attrs)\">\n <span :class=\"checkboxClass\">\n <input\n ref=\"inputRef\"\n v-bind=\"getUiExposeAttrs(attrs)\"\n data-map-ui-checkbox=\"true\"\n type=\"checkbox\"\n :name=\"resolvedName\"\n :value=\"value\"\n :checked=\"isChecked\"\n :aria-checked=\"ariaChecked\"\n :disabled=\"resolvedDisabled\"\n class=\"absolute inset-0 m-0 h-full w-full cursor-inherit opacity-0\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @focus=\"emit('focus', $event)\"\n @blur=\"emit('blur', $event)\"\n />\n <svg v-if=\"isIndeterminate\" aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"h-[82%] w-[82%]\">\n <path d=\"M4 8H12\" stroke=\"white\" stroke-width=\"2.4\" stroke-linecap=\"round\" />\n </svg>\n <svg v-else-if=\"isChecked\" aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"h-[82%] w-[82%]\">\n <path d=\"M3.5 8.25L6.5 11L12.5 5\" stroke=\"white\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </span>\n <span v-if=\"$slots.default\" class=\"select-none\">\n <slot></slot>\n </span>\n </label>\n</template>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, provide, toRef, useAttrs } from 'vue'\n\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { checkboxGroup, checkboxGroupContextKey, type CheckboxGroupDirection, type CheckboxSize, type CheckboxValue } from '.'\n\ndefineOptions({\n inheritAttrs: false\n})\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是组内当前选中值数组。 */\n modelValue?: CheckboxValue[]\n /** disabled 会禁用组内所有 Checkbox。 */\n disabled?: boolean\n /** size 统一设置组内 Checkbox 尺寸,可被子项显式 size 覆盖。 */\n size?: CheckboxSize\n /** name 统一设置组内原生 checkbox name。 */\n name?: string\n /** direction 控制组内排列方向。 */\n direction?: CheckboxGroupDirection\n }>(),\n {\n modelValue: () => [],\n disabled: false,\n size: 'md',\n name: undefined,\n direction: 'horizontal'\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: CheckboxValue[]): void\n (e: 'change', value: CheckboxValue[], event: Event): void\n}>()\n\nconst attrs = useAttrs()\nconst groupClass = computed(() =>\n clsx(\n getUiAttrClass(attrs),\n checkboxGroup({\n direction: props.direction,\n size: props.size,\n disabled: props.disabled\n })\n )\n)\n\nfunction updateValue(value: CheckboxValue, checked: boolean, event: Event) {\n const currentValue = props.modelValue ?? []\n const nextValue = checked\n ? currentValue.includes(value)\n ? currentValue\n : [...currentValue, value]\n : currentValue.filter((item) => item !== value)\n emit('update:modelValue', nextValue)\n emit('change', nextValue, event)\n}\n\nprovide(checkboxGroupContextKey, {\n modelValue: toRef(props, 'modelValue'),\n disabled: toRef(props, 'disabled'),\n size: toRef(props, 'size'),\n name: toRef(props, 'name'),\n updateValue\n})\n</script>\n\n<template>\n <div\n v-bind=\"getUiExposeAttrs(attrs)\"\n role=\"group\"\n data-ui-checkbox-group=\"true\"\n :data-direction=\"direction\"\n :aria-disabled=\"disabled || undefined\"\n :class=\"groupClass\"\n :style=\"getUiAttrStyle(attrs)\"\n >\n <slot></slot>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, provide, toRef, useAttrs } from 'vue'\n\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\nimport { checkboxGroup, checkboxGroupContextKey, type CheckboxGroupDirection, type CheckboxSize, type CheckboxValue } from '.'\n\ndefineOptions({\n inheritAttrs: false\n})\n\nconst props = withDefaults(\n defineProps<{\n /** modelValue 是组内当前选中值数组。 */\n modelValue?: CheckboxValue[]\n /** disabled 会禁用组内所有 Checkbox。 */\n disabled?: boolean\n /** size 统一设置组内 Checkbox 尺寸,可被子项显式 size 覆盖。 */\n size?: CheckboxSize\n /** name 统一设置组内原生 checkbox name。 */\n name?: string\n /** direction 控制组内排列方向。 */\n direction?: CheckboxGroupDirection\n }>(),\n {\n modelValue: () => [],\n disabled: false,\n size: 'md',\n name: undefined,\n direction: 'horizontal'\n }\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: CheckboxValue[]): void\n (e: 'change', value: CheckboxValue[], event: Event): void\n}>()\n\nconst attrs = useAttrs()\nconst groupClass = computed(() =>\n clsx(\n getUiAttrClass(attrs),\n checkboxGroup({\n direction: props.direction,\n size: props.size,\n disabled: props.disabled\n })\n )\n)\n\nfunction updateValue(value: CheckboxValue, checked: boolean, event: Event) {\n const currentValue = props.modelValue ?? []\n const nextValue = checked\n ? currentValue.includes(value)\n ? currentValue\n : [...currentValue, value]\n : currentValue.filter((item) => item !== value)\n emit('update:modelValue', nextValue)\n emit('change', nextValue, event)\n}\n\nprovide(checkboxGroupContextKey, {\n modelValue: toRef(props, 'modelValue'),\n disabled: toRef(props, 'disabled'),\n size: toRef(props, 'size'),\n name: toRef(props, 'name'),\n updateValue\n})\n</script>\n\n<template>\n <div\n v-bind=\"getUiExposeAttrs(attrs)\"\n role=\"group\"\n data-ui-checkbox-group=\"true\"\n :data-direction=\"direction\"\n :aria-disabled=\"disabled || undefined\"\n :class=\"groupClass\"\n :style=\"getUiAttrStyle(attrs)\"\n >\n <slot></slot>\n </div>\n</template>\n","import { cva } from 'class-variance-authority'\nimport type { VariantProps } from 'class-variance-authority'\nimport type { InjectionKey, Ref } from 'vue'\n\nexport { default as Checkbox } from './Checkbox.vue'\nexport { default as CheckboxGroup } from './CheckboxGroup.vue'\n\nexport type CheckboxValue = string | number\nexport type CheckboxSize = 'sm' | 'md' | 'lg'\nexport type CheckboxGroupDirection = 'horizontal' | 'vertical'\n\nexport interface CheckboxGroupContext {\n modelValue: Readonly<Ref<CheckboxValue[]>>\n disabled: Readonly<Ref<boolean>>\n size: Readonly<Ref<CheckboxSize>>\n name: Readonly<Ref<string | undefined>>\n updateValue: (value: CheckboxValue, checked: boolean, event: Event) => void\n}\n\nexport const checkboxGroupContextKey: InjectionKey<CheckboxGroupContext> = Symbol('ui-checkbox-group-context')\n\n/** checkbox 定义管理端 Checkbox 组件的样式变体组合。 */\nexport const checkbox = cva('relative inline-flex shrink-0 items-center justify-center overflow-hidden border align-middle transition-colors duration-150', {\n variants: {\n size: {\n sm: 'size-4 rounded-sm',\n md: 'size-5 rounded',\n lg: 'size-6 rounded'\n },\n checked: {\n true: '',\n false: ''\n },\n disabled: {\n true: 'cursor-not-allowed',\n false: 'cursor-pointer'\n }\n },\n compoundVariants: [\n {\n checked: true,\n disabled: false,\n class: 'border-brand-500 bg-brand-500 dark:border-brand-400 dark:bg-brand-500'\n },\n {\n checked: true,\n disabled: true,\n class: 'border-zinc-400 bg-zinc-400 dark:border-zinc-600 dark:bg-zinc-800'\n },\n {\n checked: false,\n disabled: false,\n class: 'border-medium bg-primary hover:border-brand-400 dark:border-zinc-500 dark:bg-zinc-950 dark:hover:border-brand-400'\n },\n {\n checked: false,\n disabled: true,\n class: 'border-zinc-300 bg-zinc-100 dark:border-zinc-600 dark:bg-zinc-800'\n }\n ],\n defaultVariants: {\n size: 'md',\n checked: false,\n disabled: false\n }\n})\n\n/** checkboxGroup 定义 CheckboxGroup 根节点布局。 */\nexport const checkboxGroup = cva('ui-checkbox-group inline-flex w-fit align-middle', {\n variants: {\n direction: {\n horizontal: 'flex-row flex-wrap items-center',\n vertical: 'flex-col items-start'\n },\n size: {\n sm: '',\n md: '',\n lg: ''\n },\n disabled: {\n true: '',\n false: ''\n }\n },\n compoundVariants: [\n { direction: 'horizontal', size: 'sm', class: 'gap-x-4 gap-y-2' },\n { direction: 'horizontal', size: 'md', class: 'gap-x-5 gap-y-2' },\n { direction: 'horizontal', size: 'lg', class: 'gap-x-6 gap-y-2.5' },\n { direction: 'vertical', size: 'sm', class: 'gap-1.5' },\n { direction: 'vertical', size: 'md', class: 'gap-2' },\n { direction: 'vertical', size: 'lg', class: 'gap-2.5' }\n ],\n defaultVariants: {\n direction: 'horizontal',\n size: 'md',\n disabled: false\n }\n})\n\n/** CheckboxProps 是 checkbox 变体推导出的组件属性类型。 */\nexport type CheckboxProps = VariantProps<typeof checkbox>\nexport type CheckboxGroupProps = VariantProps<typeof checkboxGroup>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,IAAM,IAAQ,GAsBR,IAAO,GAOP,IAAQ,EA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