wshisbadboy-ui-lib 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/dist/my-ui-lib.es.js +590 -0
- package/dist/my-ui-lib.umd.js +1 -0
- package/dist/wshisbadboy-ui-lib.css +1 -0
- package/package.json +48 -0
- package/src/components/Alert/Alert.vue +169 -0
- package/src/components/Alert/index.js +7 -0
- package/src/components/Button/Button.vue +183 -0
- package/src/components/Button/index.js +7 -0
- package/src/components/Collapse/Collapse.vue +62 -0
- package/src/components/Collapse/CollapseItem.vue +176 -0
- package/src/components/Collapse/index.js +12 -0
- package/src/components/Message/Message.vue +159 -0
- package/src/components/Message/MessageList.vue +62 -0
- package/src/components/Message/index.js +16 -0
- package/src/components/Message/message.js +35 -0
- package/src/index.js +17 -0
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
import { useSlots as I, computed as B, openBlock as t, createElementBlock as s, normalizeClass as M, createCommentVNode as r, renderSlot as p, createTextVNode as S, toDisplayString as _, ref as k, watch as T, provide as O, inject as z, onMounted as V, onBeforeUnmount as L, createElementVNode as i, normalizeStyle as N, nextTick as j, createBlock as A, Transition as D, withCtx as F, resolveDynamicComponent as q, Fragment as E, renderList as H, createApp as R } from "vue";
|
|
2
|
+
const U = ["disabled", "type"], G = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "my-btn__loader"
|
|
5
|
+
}, J = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "my-btn__icon"
|
|
8
|
+
}, K = {
|
|
9
|
+
key: 2,
|
|
10
|
+
class: "my-btn__text"
|
|
11
|
+
}, P = {
|
|
12
|
+
name: "MyButton"
|
|
13
|
+
}, Q = /* @__PURE__ */ Object.assign(P, {
|
|
14
|
+
props: {
|
|
15
|
+
variant: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "primary",
|
|
18
|
+
validator: (e) => ["primary", "secondary", "outline", "text"].includes(e)
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "medium",
|
|
23
|
+
validator: (e) => ["small", "medium", "large"].includes(e)
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !1
|
|
28
|
+
},
|
|
29
|
+
loading: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
},
|
|
33
|
+
nativeType: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "button"
|
|
36
|
+
},
|
|
37
|
+
icon: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: ["click"],
|
|
43
|
+
setup(e, { emit: l }) {
|
|
44
|
+
const a = l, u = I(), o = B(() => !!u.default), n = B(() => !o.value);
|
|
45
|
+
function d(c) {
|
|
46
|
+
a("click", c);
|
|
47
|
+
}
|
|
48
|
+
return (c, g) => (t(), s("button", {
|
|
49
|
+
class: M([
|
|
50
|
+
"my-btn",
|
|
51
|
+
`my-btn--${e.variant}`,
|
|
52
|
+
`my-btn--${e.size}`,
|
|
53
|
+
{
|
|
54
|
+
"my-btn--loading": e.loading,
|
|
55
|
+
"my-btn--icon-only": n.value
|
|
56
|
+
}
|
|
57
|
+
]),
|
|
58
|
+
disabled: e.disabled || e.loading,
|
|
59
|
+
type: e.nativeType,
|
|
60
|
+
onClick: d
|
|
61
|
+
}, [
|
|
62
|
+
e.loading ? (t(), s("span", G)) : r("", !0),
|
|
63
|
+
e.icon && !e.loading ? (t(), s("span", J, [
|
|
64
|
+
p(c.$slots, "icon", {}, () => [
|
|
65
|
+
S(_(e.icon), 1)
|
|
66
|
+
])
|
|
67
|
+
])) : r("", !0),
|
|
68
|
+
o.value && !n.value ? (t(), s("span", K, [
|
|
69
|
+
p(c.$slots, "default")
|
|
70
|
+
])) : r("", !0)
|
|
71
|
+
], 10, U));
|
|
72
|
+
}
|
|
73
|
+
}), W = { class: "my-collapse" }, X = {
|
|
74
|
+
name: "MyCollapse"
|
|
75
|
+
}, $ = /* @__PURE__ */ Object.assign(X, {
|
|
76
|
+
props: {
|
|
77
|
+
modelValue: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default: () => []
|
|
80
|
+
},
|
|
81
|
+
accordion: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: !1
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
emits: ["update:modelValue"],
|
|
87
|
+
setup(e, { emit: l }) {
|
|
88
|
+
const a = e, u = l, o = k([...a.modelValue]);
|
|
89
|
+
return T(
|
|
90
|
+
() => a.modelValue,
|
|
91
|
+
(n) => {
|
|
92
|
+
o.value = [...n];
|
|
93
|
+
}
|
|
94
|
+
), O("collapse", {
|
|
95
|
+
activeNames: o,
|
|
96
|
+
accordion: a.accordion,
|
|
97
|
+
onItemToggle(n) {
|
|
98
|
+
const d = o.value.indexOf(n);
|
|
99
|
+
d > -1 ? o.value.splice(d, 1) : a.accordion ? o.value = [n] : o.value.push(n), u("update:modelValue", [...o.value]);
|
|
100
|
+
}
|
|
101
|
+
}), (n, d) => (t(), s("div", W, [
|
|
102
|
+
p(n.$slots, "default")
|
|
103
|
+
]));
|
|
104
|
+
}
|
|
105
|
+
}), Y = ["disabled"], Z = { class: "my-collapse-item__title" }, ee = {
|
|
106
|
+
name: "MyCollapseItem"
|
|
107
|
+
}, C = /* @__PURE__ */ Object.assign(ee, {
|
|
108
|
+
props: {
|
|
109
|
+
title: { type: String, default: "" },
|
|
110
|
+
name: { type: [String, Number], required: !0 },
|
|
111
|
+
disabled: { type: Boolean, default: !1 }
|
|
112
|
+
},
|
|
113
|
+
setup(e) {
|
|
114
|
+
const l = z("collapse", null), a = e, u = k(null), o = k("0");
|
|
115
|
+
let n = null;
|
|
116
|
+
const d = B(() => l ? l.activeNames.value.includes(a.name) : !1);
|
|
117
|
+
function c() {
|
|
118
|
+
return u.value ? u.value.scrollHeight : 0;
|
|
119
|
+
}
|
|
120
|
+
function g() {
|
|
121
|
+
a.disabled || !l || l.onItemToggle(a.name);
|
|
122
|
+
}
|
|
123
|
+
async function y() {
|
|
124
|
+
var w;
|
|
125
|
+
o.value = "auto", await j();
|
|
126
|
+
const f = c();
|
|
127
|
+
o.value = "0", (w = u.value) == null || w.scrollHeight, requestAnimationFrame(() => {
|
|
128
|
+
o.value = f + "px";
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function m() {
|
|
132
|
+
const f = c();
|
|
133
|
+
o.value = f + "px", requestAnimationFrame(() => {
|
|
134
|
+
requestAnimationFrame(() => {
|
|
135
|
+
o.value = "0";
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return T(d, (f) => {
|
|
140
|
+
f ? y() : m();
|
|
141
|
+
}), V(() => {
|
|
142
|
+
d.value && (o.value = "auto"), u.value && (n = new ResizeObserver(() => {
|
|
143
|
+
if (d.value && o.value !== "auto") {
|
|
144
|
+
const f = c();
|
|
145
|
+
f > 0 && (o.value = f + "px");
|
|
146
|
+
}
|
|
147
|
+
}), n.observe(u.value));
|
|
148
|
+
}), L(() => {
|
|
149
|
+
n && n.disconnect();
|
|
150
|
+
}), (f, w) => (t(), s("div", {
|
|
151
|
+
class: M(["my-collapse-item", { "is-active": d.value, "is-disabled": e.disabled }])
|
|
152
|
+
}, [
|
|
153
|
+
i("button", {
|
|
154
|
+
class: "my-collapse-item__header",
|
|
155
|
+
disabled: e.disabled,
|
|
156
|
+
onClick: g
|
|
157
|
+
}, [
|
|
158
|
+
i("span", Z, [
|
|
159
|
+
p(f.$slots, "title", {}, () => [
|
|
160
|
+
S(_(e.title), 1)
|
|
161
|
+
])
|
|
162
|
+
]),
|
|
163
|
+
w[0] || (w[0] = i("span", { class: "my-collapse-item__arrow" }, [
|
|
164
|
+
i("svg", {
|
|
165
|
+
viewBox: "0 0 24 24",
|
|
166
|
+
width: "16",
|
|
167
|
+
height: "16",
|
|
168
|
+
fill: "none",
|
|
169
|
+
stroke: "currentColor",
|
|
170
|
+
"stroke-width": "2"
|
|
171
|
+
}, [
|
|
172
|
+
i("path", { d: "M6 9l6 6 6-6" })
|
|
173
|
+
])
|
|
174
|
+
], -1))
|
|
175
|
+
], 8, Y),
|
|
176
|
+
i("div", {
|
|
177
|
+
class: "my-collapse-item__wrap",
|
|
178
|
+
style: N({ height: o.value })
|
|
179
|
+
}, [
|
|
180
|
+
i("div", {
|
|
181
|
+
class: "my-collapse-item__content",
|
|
182
|
+
ref_key: "contentRef",
|
|
183
|
+
ref: u
|
|
184
|
+
}, [
|
|
185
|
+
p(f.$slots, "default")
|
|
186
|
+
], 512)
|
|
187
|
+
], 4)
|
|
188
|
+
], 2));
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
$.install = (e) => {
|
|
192
|
+
e.component($.name, $);
|
|
193
|
+
};
|
|
194
|
+
C.install = (e) => {
|
|
195
|
+
e.component(C.name, C);
|
|
196
|
+
};
|
|
197
|
+
const te = {
|
|
198
|
+
key: 0,
|
|
199
|
+
class: "my-alert__icon"
|
|
200
|
+
}, se = {
|
|
201
|
+
width: "16",
|
|
202
|
+
height: "16",
|
|
203
|
+
viewBox: "0 0 24 24",
|
|
204
|
+
fill: "none",
|
|
205
|
+
stroke: "currentColor",
|
|
206
|
+
"stroke-width": "2"
|
|
207
|
+
}, ne = {
|
|
208
|
+
key: 0,
|
|
209
|
+
d: "M22 11.08V12a10 10 0 11-5.93-9.14"
|
|
210
|
+
}, le = {
|
|
211
|
+
key: 1,
|
|
212
|
+
points: "22 4 12 14.01 9 11.01"
|
|
213
|
+
}, oe = {
|
|
214
|
+
key: 2,
|
|
215
|
+
d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"
|
|
216
|
+
}, ie = {
|
|
217
|
+
key: 3,
|
|
218
|
+
x1: "12",
|
|
219
|
+
y1: "9",
|
|
220
|
+
x2: "12",
|
|
221
|
+
y2: "13"
|
|
222
|
+
}, ae = {
|
|
223
|
+
key: 4,
|
|
224
|
+
x1: "12",
|
|
225
|
+
y1: "17",
|
|
226
|
+
x2: "12.01",
|
|
227
|
+
y2: "17"
|
|
228
|
+
}, re = {
|
|
229
|
+
key: 5,
|
|
230
|
+
cx: "12",
|
|
231
|
+
cy: "12",
|
|
232
|
+
r: "10"
|
|
233
|
+
}, ce = {
|
|
234
|
+
key: 6,
|
|
235
|
+
x1: "15",
|
|
236
|
+
y1: "9",
|
|
237
|
+
x2: "9",
|
|
238
|
+
y2: "15"
|
|
239
|
+
}, ue = {
|
|
240
|
+
key: 7,
|
|
241
|
+
x1: "9",
|
|
242
|
+
y1: "9",
|
|
243
|
+
x2: "15",
|
|
244
|
+
y2: "15"
|
|
245
|
+
}, de = {
|
|
246
|
+
key: 8,
|
|
247
|
+
cx: "12",
|
|
248
|
+
cy: "12",
|
|
249
|
+
r: "10"
|
|
250
|
+
}, ye = {
|
|
251
|
+
key: 9,
|
|
252
|
+
x1: "12",
|
|
253
|
+
y1: "16",
|
|
254
|
+
x2: "12",
|
|
255
|
+
y2: "12"
|
|
256
|
+
}, me = {
|
|
257
|
+
key: 10,
|
|
258
|
+
x1: "12",
|
|
259
|
+
y1: "8",
|
|
260
|
+
x2: "12.01",
|
|
261
|
+
y2: "8"
|
|
262
|
+
}, fe = { class: "my-alert__body" }, ge = {
|
|
263
|
+
key: 0,
|
|
264
|
+
class: "my-alert__title"
|
|
265
|
+
}, he = {
|
|
266
|
+
key: 1,
|
|
267
|
+
class: "my-alert__desc"
|
|
268
|
+
}, ve = {
|
|
269
|
+
name: "MyAlert"
|
|
270
|
+
}, pe = /* @__PURE__ */ Object.assign(ve, {
|
|
271
|
+
props: {
|
|
272
|
+
type: {
|
|
273
|
+
type: String,
|
|
274
|
+
default: "info",
|
|
275
|
+
validator: (e) => ["info", "success", "warning", "error"].includes(e)
|
|
276
|
+
},
|
|
277
|
+
title: { type: String, default: "" },
|
|
278
|
+
description: { type: String, default: "" },
|
|
279
|
+
closable: { type: Boolean, default: !0 },
|
|
280
|
+
showIcon: { type: Boolean, default: !0 }
|
|
281
|
+
},
|
|
282
|
+
emits: ["close"],
|
|
283
|
+
setup(e, { emit: l }) {
|
|
284
|
+
const a = l, u = k(!0);
|
|
285
|
+
function o() {
|
|
286
|
+
u.value = !1, a("close");
|
|
287
|
+
}
|
|
288
|
+
return (n, d) => u.value ? (t(), s("div", {
|
|
289
|
+
key: 0,
|
|
290
|
+
class: M(["my-alert", `my-alert--${e.type}`]),
|
|
291
|
+
role: "alert"
|
|
292
|
+
}, [
|
|
293
|
+
e.showIcon ? (t(), s("span", te, [
|
|
294
|
+
p(n.$slots, "icon", {}, () => [
|
|
295
|
+
(t(), s("svg", se, [
|
|
296
|
+
e.type === "success" ? (t(), s("path", ne)) : r("", !0),
|
|
297
|
+
e.type === "success" ? (t(), s("polyline", le)) : r("", !0),
|
|
298
|
+
e.type === "warning" ? (t(), s("path", oe)) : r("", !0),
|
|
299
|
+
e.type === "warning" ? (t(), s("line", ie)) : r("", !0),
|
|
300
|
+
e.type === "warning" ? (t(), s("line", ae)) : r("", !0),
|
|
301
|
+
e.type === "error" ? (t(), s("circle", re)) : r("", !0),
|
|
302
|
+
e.type === "error" ? (t(), s("line", ce)) : r("", !0),
|
|
303
|
+
e.type === "error" ? (t(), s("line", ue)) : r("", !0),
|
|
304
|
+
e.type === "info" ? (t(), s("circle", de)) : r("", !0),
|
|
305
|
+
e.type === "info" ? (t(), s("line", ye)) : r("", !0),
|
|
306
|
+
e.type === "info" ? (t(), s("line", me)) : r("", !0)
|
|
307
|
+
]))
|
|
308
|
+
])
|
|
309
|
+
])) : r("", !0),
|
|
310
|
+
i("div", fe, [
|
|
311
|
+
e.title || n.$slots.title ? (t(), s("span", ge, [
|
|
312
|
+
p(n.$slots, "title", {}, () => [
|
|
313
|
+
S(_(e.title), 1)
|
|
314
|
+
])
|
|
315
|
+
])) : r("", !0),
|
|
316
|
+
n.$slots.default || e.description ? (t(), s("p", he, [
|
|
317
|
+
p(n.$slots, "default", {}, () => [
|
|
318
|
+
S(_(e.description), 1)
|
|
319
|
+
])
|
|
320
|
+
])) : r("", !0)
|
|
321
|
+
]),
|
|
322
|
+
e.closable ? (t(), s("button", {
|
|
323
|
+
key: 1,
|
|
324
|
+
class: "my-alert__close",
|
|
325
|
+
onClick: o,
|
|
326
|
+
"aria-label": "关闭"
|
|
327
|
+
}, [...d[0] || (d[0] = [
|
|
328
|
+
i("svg", {
|
|
329
|
+
width: "14",
|
|
330
|
+
height: "14",
|
|
331
|
+
viewBox: "0 0 24 24",
|
|
332
|
+
fill: "none",
|
|
333
|
+
stroke: "currentColor",
|
|
334
|
+
"stroke-width": "2"
|
|
335
|
+
}, [
|
|
336
|
+
i("line", {
|
|
337
|
+
x1: "18",
|
|
338
|
+
y1: "6",
|
|
339
|
+
x2: "6",
|
|
340
|
+
y2: "18"
|
|
341
|
+
}),
|
|
342
|
+
i("line", {
|
|
343
|
+
x1: "6",
|
|
344
|
+
y1: "6",
|
|
345
|
+
x2: "18",
|
|
346
|
+
y2: "18"
|
|
347
|
+
})
|
|
348
|
+
], -1)
|
|
349
|
+
])])) : r("", !0)
|
|
350
|
+
], 2)) : r("", !0);
|
|
351
|
+
}
|
|
352
|
+
}), xe = { class: "my-message__icon" }, ke = {
|
|
353
|
+
key: 0,
|
|
354
|
+
width: "16",
|
|
355
|
+
height: "16",
|
|
356
|
+
viewBox: "0 0 24 24",
|
|
357
|
+
fill: "none",
|
|
358
|
+
stroke: "currentColor",
|
|
359
|
+
"stroke-width": "2"
|
|
360
|
+
}, we = {
|
|
361
|
+
key: 1,
|
|
362
|
+
width: "16",
|
|
363
|
+
height: "16",
|
|
364
|
+
viewBox: "0 0 24 24",
|
|
365
|
+
fill: "none",
|
|
366
|
+
stroke: "currentColor",
|
|
367
|
+
"stroke-width": "2"
|
|
368
|
+
}, _e = {
|
|
369
|
+
key: 2,
|
|
370
|
+
width: "16",
|
|
371
|
+
height: "16",
|
|
372
|
+
viewBox: "0 0 24 24",
|
|
373
|
+
fill: "none",
|
|
374
|
+
stroke: "currentColor",
|
|
375
|
+
"stroke-width": "2"
|
|
376
|
+
}, be = {
|
|
377
|
+
key: 3,
|
|
378
|
+
width: "16",
|
|
379
|
+
height: "16",
|
|
380
|
+
viewBox: "0 0 24 24",
|
|
381
|
+
fill: "none",
|
|
382
|
+
stroke: "currentColor",
|
|
383
|
+
"stroke-width": "2"
|
|
384
|
+
}, $e = {
|
|
385
|
+
key: 0,
|
|
386
|
+
class: "my-message__text"
|
|
387
|
+
}, Ce = {
|
|
388
|
+
name: "MyMessage"
|
|
389
|
+
}, h = /* @__PURE__ */ Object.assign(Ce, {
|
|
390
|
+
props: {
|
|
391
|
+
type: {
|
|
392
|
+
type: String,
|
|
393
|
+
default: "info"
|
|
394
|
+
},
|
|
395
|
+
message: { type: [String, Function], default: "" },
|
|
396
|
+
duration: { type: Number, default: 3e3 },
|
|
397
|
+
showClose: { type: Boolean, default: !1 }
|
|
398
|
+
},
|
|
399
|
+
emits: ["destroy"],
|
|
400
|
+
setup(e, { emit: l }) {
|
|
401
|
+
const a = e, u = l, o = k(!0);
|
|
402
|
+
let n = null;
|
|
403
|
+
const d = B(() => typeof a.message == "string");
|
|
404
|
+
function c() {
|
|
405
|
+
o.value = !1, n && clearTimeout(n), u("destroy");
|
|
406
|
+
}
|
|
407
|
+
function g() {
|
|
408
|
+
a.duration > 0 && (n = setTimeout(() => {
|
|
409
|
+
o.value = !1;
|
|
410
|
+
}, a.duration));
|
|
411
|
+
}
|
|
412
|
+
return V(() => {
|
|
413
|
+
g();
|
|
414
|
+
}), (y, m) => (t(), A(D, {
|
|
415
|
+
name: "my-message-fade",
|
|
416
|
+
onAfterLeave: m[0] || (m[0] = (f) => y.$emit("destroy"))
|
|
417
|
+
}, {
|
|
418
|
+
default: F(() => [
|
|
419
|
+
o.value ? (t(), s("div", {
|
|
420
|
+
key: 0,
|
|
421
|
+
class: M(["my-message", `my-message--${e.type}`]),
|
|
422
|
+
role: "alert"
|
|
423
|
+
}, [
|
|
424
|
+
i("span", xe, [
|
|
425
|
+
e.type === "success" ? (t(), s("svg", ke, [...m[1] || (m[1] = [
|
|
426
|
+
i("path", { d: "M22 11.08V12a10 10 0 11-5.93-9.14" }, null, -1),
|
|
427
|
+
i("polyline", { points: "22 4 12 14.01 9 11.01" }, null, -1)
|
|
428
|
+
])])) : e.type === "warning" ? (t(), s("svg", we, [...m[2] || (m[2] = [
|
|
429
|
+
i("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }, null, -1),
|
|
430
|
+
i("line", {
|
|
431
|
+
x1: "12",
|
|
432
|
+
y1: "9",
|
|
433
|
+
x2: "12",
|
|
434
|
+
y2: "13"
|
|
435
|
+
}, null, -1),
|
|
436
|
+
i("line", {
|
|
437
|
+
x1: "12",
|
|
438
|
+
y1: "17",
|
|
439
|
+
x2: "12.01",
|
|
440
|
+
y2: "17"
|
|
441
|
+
}, null, -1)
|
|
442
|
+
])])) : e.type === "error" ? (t(), s("svg", _e, [...m[3] || (m[3] = [
|
|
443
|
+
i("circle", {
|
|
444
|
+
cx: "12",
|
|
445
|
+
cy: "12",
|
|
446
|
+
r: "10"
|
|
447
|
+
}, null, -1),
|
|
448
|
+
i("line", {
|
|
449
|
+
x1: "15",
|
|
450
|
+
y1: "9",
|
|
451
|
+
x2: "9",
|
|
452
|
+
y2: "15"
|
|
453
|
+
}, null, -1),
|
|
454
|
+
i("line", {
|
|
455
|
+
x1: "9",
|
|
456
|
+
y1: "9",
|
|
457
|
+
x2: "15",
|
|
458
|
+
y2: "15"
|
|
459
|
+
}, null, -1)
|
|
460
|
+
])])) : (t(), s("svg", be, [...m[4] || (m[4] = [
|
|
461
|
+
i("circle", {
|
|
462
|
+
cx: "12",
|
|
463
|
+
cy: "12",
|
|
464
|
+
r: "10"
|
|
465
|
+
}, null, -1),
|
|
466
|
+
i("line", {
|
|
467
|
+
x1: "12",
|
|
468
|
+
y1: "16",
|
|
469
|
+
x2: "12",
|
|
470
|
+
y2: "12"
|
|
471
|
+
}, null, -1),
|
|
472
|
+
i("line", {
|
|
473
|
+
x1: "12",
|
|
474
|
+
y1: "8",
|
|
475
|
+
x2: "12.01",
|
|
476
|
+
y2: "8"
|
|
477
|
+
}, null, -1)
|
|
478
|
+
])]))
|
|
479
|
+
]),
|
|
480
|
+
d.value ? (t(), s("span", $e, _(e.message), 1)) : (t(), A(q(e.message), {
|
|
481
|
+
key: 1,
|
|
482
|
+
class: "my-message__text"
|
|
483
|
+
})),
|
|
484
|
+
e.showClose ? (t(), s("button", {
|
|
485
|
+
key: 2,
|
|
486
|
+
class: "my-message__close",
|
|
487
|
+
onClick: c,
|
|
488
|
+
"aria-label": "关闭"
|
|
489
|
+
}, [...m[5] || (m[5] = [
|
|
490
|
+
i("svg", {
|
|
491
|
+
width: "12",
|
|
492
|
+
height: "12",
|
|
493
|
+
viewBox: "0 0 24 24",
|
|
494
|
+
fill: "none",
|
|
495
|
+
stroke: "currentColor",
|
|
496
|
+
"stroke-width": "2"
|
|
497
|
+
}, [
|
|
498
|
+
i("line", {
|
|
499
|
+
x1: "18",
|
|
500
|
+
y1: "6",
|
|
501
|
+
x2: "6",
|
|
502
|
+
y2: "18"
|
|
503
|
+
}),
|
|
504
|
+
i("line", {
|
|
505
|
+
x1: "6",
|
|
506
|
+
y1: "6",
|
|
507
|
+
x2: "18",
|
|
508
|
+
y2: "18"
|
|
509
|
+
})
|
|
510
|
+
], -1)
|
|
511
|
+
])])) : r("", !0)
|
|
512
|
+
], 2)) : r("", !0)
|
|
513
|
+
]),
|
|
514
|
+
_: 1
|
|
515
|
+
}));
|
|
516
|
+
}
|
|
517
|
+
}), Be = { class: "my-message-container" }, Se = {
|
|
518
|
+
__name: "MessageList",
|
|
519
|
+
setup(e, { expose: l }) {
|
|
520
|
+
const a = k([]);
|
|
521
|
+
let u = 0;
|
|
522
|
+
function o(c) {
|
|
523
|
+
const g = ++u, y = {
|
|
524
|
+
id: g,
|
|
525
|
+
type: c.type || "info",
|
|
526
|
+
message: c.message || "",
|
|
527
|
+
duration: c.duration ?? 3e3,
|
|
528
|
+
showClose: c.showClose ?? !1
|
|
529
|
+
};
|
|
530
|
+
return a.value.push(y), y.duration > 0 && setTimeout(() => n(g), y.duration + 300), g;
|
|
531
|
+
}
|
|
532
|
+
function n(c) {
|
|
533
|
+
const g = a.value.findIndex((y) => y.id === c);
|
|
534
|
+
g > -1 && a.value.splice(g, 1);
|
|
535
|
+
}
|
|
536
|
+
function d() {
|
|
537
|
+
a.value = [];
|
|
538
|
+
}
|
|
539
|
+
return l({ add: o, remove: n, clear: d }), (c, g) => (t(), s("div", Be, [
|
|
540
|
+
(t(!0), s(E, null, H(a.value, (y, m) => (t(), A(h, {
|
|
541
|
+
key: y.id,
|
|
542
|
+
type: y.type,
|
|
543
|
+
message: y.message,
|
|
544
|
+
duration: y.duration,
|
|
545
|
+
"show-close": y.showClose,
|
|
546
|
+
onDestroy: (f) => n(y.id)
|
|
547
|
+
}, null, 8, ["type", "message", "duration", "show-close", "onDestroy"]))), 128))
|
|
548
|
+
]));
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
let x = null;
|
|
552
|
+
function Me() {
|
|
553
|
+
if (x) return x;
|
|
554
|
+
const e = document.createElement("div");
|
|
555
|
+
return document.body.appendChild(e), x = R(Se).mount(e), x;
|
|
556
|
+
}
|
|
557
|
+
function b(e) {
|
|
558
|
+
const l = typeof e == "string" ? { message: e, type: "info" } : e;
|
|
559
|
+
return Me().add(l);
|
|
560
|
+
}
|
|
561
|
+
const v = (e) => b(e);
|
|
562
|
+
v.info = (e, l) => b({ message: e, type: "info", duration: l });
|
|
563
|
+
v.success = (e, l) => b({ message: e, type: "success", duration: l });
|
|
564
|
+
v.warning = (e, l) => b({ message: e, type: "warning", duration: l });
|
|
565
|
+
v.error = (e, l) => b({ message: e, type: "error", duration: l });
|
|
566
|
+
v.closeAll = () => {
|
|
567
|
+
x && x.clear();
|
|
568
|
+
};
|
|
569
|
+
h.install = (e) => {
|
|
570
|
+
e.component(h.name, h);
|
|
571
|
+
};
|
|
572
|
+
h.success = v.success;
|
|
573
|
+
h.error = v.error;
|
|
574
|
+
h.warning = v.warning;
|
|
575
|
+
h.info = v.info;
|
|
576
|
+
h.closeAll = v.closeAll;
|
|
577
|
+
const Ae = [Q, $, C, pe, h], Te = (e) => {
|
|
578
|
+
Ae.forEach((l) => {
|
|
579
|
+
e.component(l.name, l);
|
|
580
|
+
});
|
|
581
|
+
}, Ie = { install: Te };
|
|
582
|
+
export {
|
|
583
|
+
pe as Alert,
|
|
584
|
+
Q as Button,
|
|
585
|
+
$ as Collapse,
|
|
586
|
+
C as CollapseItem,
|
|
587
|
+
h as Message,
|
|
588
|
+
Ie as default,
|
|
589
|
+
Te as install
|
|
590
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.MyUiLib={},m.Vue))})(this,(function(m,e){"use strict";const N=["disabled","type"],w={key:0,class:"my-btn__loader"},C={key:1,class:"my-btn__icon"},b={key:2,class:"my-btn__text"},E=Object.assign({name:"MyButton"},{props:{variant:{type:String,default:"primary",validator:t=>["primary","secondary","outline","text"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},nativeType:{type:String,default:"button"},icon:{type:String,default:""}},emits:["click"],setup(t,{emit:n}){const a=n,c=e.useSlots(),l=e.computed(()=>!!c.default),o=e.computed(()=>!l.value);function i(s){a("click",s)}return(s,f)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["my-btn",`my-btn--${t.variant}`,`my-btn--${t.size}`,{"my-btn--loading":t.loading,"my-btn--icon-only":o.value}]),disabled:t.disabled||t.loading,type:t.nativeType,onClick:i},[t.loading?(e.openBlock(),e.createElementBlock("span",w)):e.createCommentVNode("",!0),t.icon&&!t.loading?(e.openBlock(),e.createElementBlock("span",C,[e.renderSlot(s.$slots,"icon",{},()=>[e.createTextVNode(e.toDisplayString(t.icon),1)])])):e.createCommentVNode("",!0),l.value&&!o.value?(e.openBlock(),e.createElementBlock("span",b,[e.renderSlot(s.$slots,"default")])):e.createCommentVNode("",!0)],10,N))}}),$={class:"my-collapse"},h=Object.assign({name:"MyCollapse"},{props:{modelValue:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,c=n,l=e.ref([...a.modelValue]);return e.watch(()=>a.modelValue,o=>{l.value=[...o]}),e.provide("collapse",{activeNames:l,accordion:a.accordion,onItemToggle(o){const i=l.value.indexOf(o);i>-1?l.value.splice(i,1):a.accordion?l.value=[o]:l.value.push(o),c("update:modelValue",[...l.value])}}),(o,i)=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(o.$slots,"default")]))}}),S=["disabled"],M={class:"my-collapse-item__title"},u=Object.assign({name:"MyCollapseItem"},{props:{title:{type:String,default:""},name:{type:[String,Number],required:!0},disabled:{type:Boolean,default:!1}},setup(t){const n=e.inject("collapse",null),a=t,c=e.ref(null),l=e.ref("0");let o=null;const i=e.computed(()=>n?n.activeNames.value.includes(a.name):!1);function s(){return c.value?c.value.scrollHeight:0}function f(){a.disabled||!n||n.onItemToggle(a.name)}async function r(){var _;l.value="auto",await e.nextTick();const y=s();l.value="0",(_=c.value)==null||_.scrollHeight,requestAnimationFrame(()=>{l.value=y+"px"})}function d(){const y=s();l.value=y+"px",requestAnimationFrame(()=>{requestAnimationFrame(()=>{l.value="0"})})}return e.watch(i,y=>{y?r():d()}),e.onMounted(()=>{i.value&&(l.value="auto"),c.value&&(o=new ResizeObserver(()=>{if(i.value&&l.value!=="auto"){const y=s();y>0&&(l.value=y+"px")}}),o.observe(c.value))}),e.onBeforeUnmount(()=>{o&&o.disconnect()}),(y,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["my-collapse-item",{"is-active":i.value,"is-disabled":t.disabled}])},[e.createElementVNode("button",{class:"my-collapse-item__header",disabled:t.disabled,onClick:f},[e.createElementVNode("span",M,[e.renderSlot(y.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])]),_[0]||(_[0]=e.createElementVNode("span",{class:"my-collapse-item__arrow"},[e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M6 9l6 6 6-6"})])],-1))],8,S),e.createElementVNode("div",{class:"my-collapse-item__wrap",style:e.normalizeStyle({height:l.value})},[e.createElementVNode("div",{class:"my-collapse-item__content",ref_key:"contentRef",ref:c},[e.renderSlot(y.$slots,"default")],512)],4)],2))}});h.install=t=>{t.component(h.name,h)},u.install=t=>{t.component(u.name,u)};const T={key:0,class:"my-alert__icon"},A={width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},z={key:0,d:"M22 11.08V12a10 10 0 11-5.93-9.14"},O={key:1,points:"22 4 12 14.01 9 11.01"},D={key:2,d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"},I={key:3,x1:"12",y1:"9",x2:"12",y2:"13"},j={key:4,x1:"12",y1:"17",x2:"12.01",y2:"17"},L={key:5,cx:"12",cy:"12",r:"10"},q={key:6,x1:"15",y1:"9",x2:"9",y2:"15"},F={key:7,x1:"9",y1:"9",x2:"15",y2:"15"},H={key:8,cx:"12",cy:"12",r:"10"},R={key:9,x1:"12",y1:"16",x2:"12",y2:"12"},U={key:10,x1:"12",y1:"8",x2:"12.01",y2:"8"},P={class:"my-alert__body"},G={key:0,class:"my-alert__title"},J={key:1,class:"my-alert__desc"},V=Object.assign({name:"MyAlert"},{props:{type:{type:String,default:"info",validator:t=>["info","success","warning","error"].includes(t)},title:{type:String,default:""},description:{type:String,default:""},closable:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0}},emits:["close"],setup(t,{emit:n}){const a=n,c=e.ref(!0);function l(){c.value=!1,a("close")}return(o,i)=>c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["my-alert",`my-alert--${t.type}`]),role:"alert"},[t.showIcon?(e.openBlock(),e.createElementBlock("span",T,[e.renderSlot(o.$slots,"icon",{},()=>[(e.openBlock(),e.createElementBlock("svg",A,[t.type==="success"?(e.openBlock(),e.createElementBlock("path",z)):e.createCommentVNode("",!0),t.type==="success"?(e.openBlock(),e.createElementBlock("polyline",O)):e.createCommentVNode("",!0),t.type==="warning"?(e.openBlock(),e.createElementBlock("path",D)):e.createCommentVNode("",!0),t.type==="warning"?(e.openBlock(),e.createElementBlock("line",I)):e.createCommentVNode("",!0),t.type==="warning"?(e.openBlock(),e.createElementBlock("line",j)):e.createCommentVNode("",!0),t.type==="error"?(e.openBlock(),e.createElementBlock("circle",L)):e.createCommentVNode("",!0),t.type==="error"?(e.openBlock(),e.createElementBlock("line",q)):e.createCommentVNode("",!0),t.type==="error"?(e.openBlock(),e.createElementBlock("line",F)):e.createCommentVNode("",!0),t.type==="info"?(e.openBlock(),e.createElementBlock("circle",H)):e.createCommentVNode("",!0),t.type==="info"?(e.openBlock(),e.createElementBlock("line",R)):e.createCommentVNode("",!0),t.type==="info"?(e.openBlock(),e.createElementBlock("line",U)):e.createCommentVNode("",!0)]))])])):e.createCommentVNode("",!0),e.createElementVNode("div",P,[t.title||o.$slots.title?(e.openBlock(),e.createElementBlock("span",G,[e.renderSlot(o.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])):e.createCommentVNode("",!0),o.$slots.default||t.description?(e.openBlock(),e.createElementBlock("p",J,[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)])])):e.createCommentVNode("",!0)]),t.closable?(e.openBlock(),e.createElementBlock("button",{key:1,class:"my-alert__close",onClick:l,"aria-label":"关闭"},[...i[0]||(i[0]=[e.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)}}),K={class:"my-message__icon"},Q={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},W={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},X={key:2,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Y={key:3,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Z={key:0,class:"my-message__text"},k=Object.assign({name:"MyMessage"},{props:{type:{type:String,default:"info"},message:{type:[String,Function],default:""},duration:{type:Number,default:3e3},showClose:{type:Boolean,default:!1}},emits:["destroy"],setup(t,{emit:n}){const a=t,c=n,l=e.ref(!0);let o=null;const i=e.computed(()=>typeof a.message=="string");function s(){l.value=!1,o&&clearTimeout(o),c("destroy")}function f(){a.duration>0&&(o=setTimeout(()=>{l.value=!1},a.duration))}return e.onMounted(()=>{f()}),(r,d)=>(e.openBlock(),e.createBlock(e.Transition,{name:"my-message-fade",onAfterLeave:d[0]||(d[0]=y=>r.$emit("destroy"))},{default:e.withCtx(()=>[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["my-message",`my-message--${t.type}`]),role:"alert"},[e.createElementVNode("span",K,[t.type==="success"?(e.openBlock(),e.createElementBlock("svg",Q,[...d[1]||(d[1]=[e.createElementVNode("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"},null,-1),e.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"},null,-1)])])):t.type==="warning"?(e.openBlock(),e.createElementBlock("svg",W,[...d[2]||(d[2]=[e.createElementVNode("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"},null,-1),e.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"},null,-1),e.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"},null,-1)])])):t.type==="error"?(e.openBlock(),e.createElementBlock("svg",X,[...d[3]||(d[3]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),e.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"},null,-1),e.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"},null,-1)])])):(e.openBlock(),e.createElementBlock("svg",Y,[...d[4]||(d[4]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),e.createElementVNode("line",{x1:"12",y1:"16",x2:"12",y2:"12"},null,-1),e.createElementVNode("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"},null,-1)])]))]),i.value?(e.openBlock(),e.createElementBlock("span",Z,e.toDisplayString(t.message),1)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.message),{key:1,class:"my-message__text"})),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:2,class:"my-message__close",onClick:s,"aria-label":"关闭"},[...d[5]||(d[5]=[e.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:1}))}}),v={class:"my-message-container"},ee={__name:"MessageList",setup(t,{expose:n}){const a=e.ref([]);let c=0;function l(s){const f=++c,r={id:f,type:s.type||"info",message:s.message||"",duration:s.duration??3e3,showClose:s.showClose??!1};return a.value.push(r),r.duration>0&&setTimeout(()=>o(f),r.duration+300),f}function o(s){const f=a.value.findIndex(r=>r.id===s);f>-1&&a.value.splice(f,1)}function i(){a.value=[]}return n({add:l,remove:o,clear:i}),(s,f)=>(e.openBlock(),e.createElementBlock("div",v,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(r,d)=>(e.openBlock(),e.createBlock(k,{key:r.id,type:r.type,message:r.message,duration:r.duration,"show-close":r.showClose,onDestroy:y=>o(r.id)},null,8,["type","message","duration","show-close","onDestroy"]))),128))]))}};let g=null;function te(){if(g)return g;const t=document.createElement("div");return document.body.appendChild(t),g=e.createApp(ee).mount(t),g}function B(t){const n=typeof t=="string"?{message:t,type:"info"}:t;return te().add(n)}const p=t=>B(t);p.info=(t,n)=>B({message:t,type:"info",duration:n}),p.success=(t,n)=>B({message:t,type:"success",duration:n}),p.warning=(t,n)=>B({message:t,type:"warning",duration:n}),p.error=(t,n)=>B({message:t,type:"error",duration:n}),p.closeAll=()=>{g&&g.clear()},k.install=t=>{t.component(k.name,k)},k.success=p.success,k.error=p.error,k.warning=p.warning,k.info=p.info,k.closeAll=p.closeAll;const oe=[E,h,u,V,k],x=t=>{oe.forEach(n=>{t.component(n.name,n)})},ne={install:x};m.Alert=V,m.Button=E,m.Collapse=h,m.CollapseItem=u,m.Message=k,m.default=ne,m.install=x,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.my-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;font-family:inherit;font-weight:500;border:1px solid transparent;border-radius:6px;cursor:pointer;transition:background-color .15s,border-color .15s,opacity .15s;line-height:1;white-space:nowrap;-webkit-user-select:none;user-select:none}.my-btn--small{padding:6px 12px;font-size:13px;min-height:30px}.my-btn--medium{padding:8px 18px;font-size:14px;min-height:36px}.my-btn--large{padding:10px 24px;font-size:16px;min-height:42px}.my-btn--small.my-btn--icon-only{padding:6px;width:30px}.my-btn--medium.my-btn--icon-only{padding:8px;width:36px}.my-btn--large.my-btn--icon-only{padding:10px;width:42px}.my-btn--primary{background-color:var(--my-primary);color:#fff;border-color:var(--my-primary)}.my-btn--primary:hover:not(:disabled){background-color:var(--my-primary-hover);border-color:var(--my-primary-hover)}.my-btn--primary:active:not(:disabled){background-color:var(--my-primary-active)}.my-btn--secondary{background-color:var(--my-btn-secondary-bg);color:var(--my-text);border-color:var(--my-btn-secondary-border)}.my-btn--secondary:hover:not(:disabled){background-color:var(--my-btn-secondary-hover)}.my-btn--secondary:active:not(:disabled){background-color:var(--my-btn-secondary-active)}.my-btn--outline{background-color:transparent;color:var(--my-primary);border-color:var(--my-primary)}.my-btn--outline:hover:not(:disabled){background-color:var(--my-primary-light)}.my-btn--outline:active:not(:disabled){background-color:var(--my-primary-lighter)}.my-btn--text{background-color:transparent;color:var(--my-primary);border-color:transparent}.my-btn--text:hover:not(:disabled){background-color:var(--my-btn-text-hover)}.my-btn--text:active:not(:disabled){background-color:var(--my-btn-text-active)}.my-btn:disabled{opacity:.5;cursor:not-allowed}.my-btn__loader{width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:my-btn-spin .6s linear infinite;flex-shrink:0}@keyframes my-btn-spin{to{transform:rotate(360deg)}}.my-btn__icon{display:inline-flex;align-items:center;flex-shrink:0}.my-btn__text{display:inline-flex;align-items:center}.my-collapse{border:1px solid var(--my-border);border-radius:6px;overflow:hidden}.my-collapse-item{border-bottom:1px solid var(--my-border)}.my-collapse-item:last-child{border-bottom:none}.my-collapse-item__header{display:flex;align-items:center;justify-content:space-between;width:100%;padding:12px 16px;border:none;background:var(--my-bg);font-size:14px;font-weight:500;color:var(--my-text);cursor:pointer;transition:background-color .15s;line-height:1.4;text-align:left;font-family:inherit}.my-collapse-item__header:hover:not(:disabled){background-color:var(--my-bg-soft)}.my-collapse-item__header:disabled{cursor:not-allowed;opacity:.5}.my-collapse-item__title{flex:1}.my-collapse-item__arrow{display:inline-flex;flex-shrink:0;margin-left:8px;color:var(--my-text-muted);transition:transform .3s}.my-collapse-item.is-active .my-collapse-item__arrow{transform:rotate(180deg)}.my-collapse-item__wrap{overflow:hidden;transition:height .3s ease;background:var(--my-bg);will-change:height}.my-collapse-item__content{padding:0 16px 16px;font-size:14px;color:var(--my-text-soft);line-height:1.6}.my-alert{display:flex;align-items:flex-start;gap:10px;padding:12px 16px;border-radius:8px;font-size:14px;line-height:1.6;position:relative;border:1px solid transparent}.my-alert--info{background-color:#eff6ff;border-color:#93c5fd;color:#1e40af}.my-alert--info .my-alert__desc{color:#3b5998}.my-alert--success{background-color:#f0fdf4;border-color:#86efac;color:#166534}.my-alert--success .my-alert__desc{color:#3a7d44}.my-alert--warning{background-color:#fffbeb;border-color:#fcd34d;color:#92400e}.my-alert--warning .my-alert__desc{color:#a16207}.my-alert--error{background-color:#fef2f2;border-color:#fca5a5;color:#991b1b}.my-alert--error .my-alert__desc{color:#b91c1c}.my-alert__icon{display:inline-flex;align-items:center;flex-shrink:0;padding-top:1px}.my-alert__body{flex:1;min-width:0}.my-alert__title{display:block;font-weight:600;margin-bottom:2px}.my-alert__desc{margin:0;font-size:13px}.my-alert__close{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:20px;height:20px;border:none;background:transparent;color:inherit;opacity:.6;cursor:pointer;border-radius:4px;transition:opacity .15s,background-color .15s;padding:0;margin-top:1px}.my-alert__close:hover{opacity:1;background-color:#0000000f}.my-message{display:inline-flex;align-items:center;gap:8px;padding:10px 16px;border-radius:8px;font-size:14px;line-height:1.5;box-shadow:0 4px 12px #0000001a;pointer-events:auto;background:#fff;border:1px solid var(--my-border, #e5e7eb);color:var(--my-text, #1f2937);min-width:200px;max-width:420px;margin-bottom:8px}.my-message--info{border-left:3px solid #3b82f6}.my-message--success{border-left:3px solid #22c55e}.my-message--warning{border-left:3px solid #f59e0b}.my-message--error{border-left:3px solid #ef4444}.my-message__icon{display:inline-flex;flex-shrink:0;color:var(--my-text-muted, #9ca3af)}.my-message--info .my-message__icon{color:#3b82f6}.my-message--success .my-message__icon{color:#22c55e}.my-message--warning .my-message__icon{color:#f59e0b}.my-message--error .my-message__icon{color:#ef4444}.my-message__text{flex:1;word-break:break-word}.my-message__close{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:18px;height:18px;border:none;background:transparent;color:inherit;opacity:.5;cursor:pointer;border-radius:4px;padding:0}.my-message__close:hover{opacity:1;background-color:#0000000f}.my-message-fade-enter-active{transition:all .25s ease}.my-message-fade-leave-active{transition:all .2s ease}.my-message-fade-enter-from{opacity:0;transform:translateY(-12px)}.my-message-fade-leave-to{opacity:0;transform:translateY(-8px)}.my-message-container{position:fixed;top:20px;left:50%;transform:translate(-50%);z-index:9999;display:flex;flex-direction:column;align-items:center;pointer-events:none}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wshisbadboy-ui-lib",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A lightweight Vue 3 component library with Button, Alert, Message, and Collapse components.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "wshisbadboy",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/wshisbadboy/UI-vitepress"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"vue",
|
|
14
|
+
"vue3",
|
|
15
|
+
"component",
|
|
16
|
+
"ui-library",
|
|
17
|
+
"button",
|
|
18
|
+
"alert",
|
|
19
|
+
"message",
|
|
20
|
+
"collapse"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite",
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"build:lib": "vite build --config vite.config.lib.js",
|
|
26
|
+
"prepublishOnly": "npm run build:lib"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"src"
|
|
31
|
+
],
|
|
32
|
+
"main": "./dist/my-ui-lib.umd.js",
|
|
33
|
+
"module": "./dist/my-ui-lib.es.js",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"import": "./dist/my-ui-lib.es.js",
|
|
37
|
+
"require": "./dist/my-ui-lib.umd.js"
|
|
38
|
+
},
|
|
39
|
+
"./dist/*": "./dist/*"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"vue": "^3.5.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
46
|
+
"vite": "^6.3.5"
|
|
47
|
+
}
|
|
48
|
+
}
|