x-next 1.17.0 → 1.18.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/AI_USAGE/catalog.md +1 -1
- package/AI_USAGE/components/alert-api.md +1 -1
- package/AI_USAGE/components/alert.md +33 -1
- package/AI_USAGE/components/bar-chart-api.md +1 -1
- package/AI_USAGE/components/bar-chart.md +1 -1
- package/AI_USAGE/components/boxicons.md +1 -1
- package/AI_USAGE/components/button-api.md +13 -16
- package/AI_USAGE/components/button.md +242 -31
- package/AI_USAGE/components/charts.md +1 -1
- package/AI_USAGE/components/checkbox-api.md +1 -1
- package/AI_USAGE/components/checkbox.md +1 -1
- package/AI_USAGE/components/color-picker-api.md +1 -1
- package/AI_USAGE/components/color-picker.md +1 -1
- package/AI_USAGE/components/config-provider-api.md +1 -1
- package/AI_USAGE/components/config-provider.md +1 -1
- package/AI_USAGE/components/date-picker-api.md +1 -1
- package/AI_USAGE/components/date-picker.md +1 -1
- package/AI_USAGE/components/dialog-api.md +1 -1
- package/AI_USAGE/components/dialog.md +1 -1
- package/AI_USAGE/components/draggable-api.md +1 -1
- package/AI_USAGE/components/draggable.md +1 -1
- package/AI_USAGE/components/drawer-api.md +3 -3
- package/AI_USAGE/components/drawer.md +1 -1
- package/AI_USAGE/components/dropdown-api.md +3 -3
- package/AI_USAGE/components/dropdown.md +1 -1
- package/AI_USAGE/components/empty-api.md +1 -1
- package/AI_USAGE/components/empty.md +1 -1
- package/AI_USAGE/components/finicon.md +1 -1
- package/AI_USAGE/components/form-api.md +1 -1
- package/AI_USAGE/components/form.md +1 -1
- package/AI_USAGE/components/grid-api.md +1 -1
- package/AI_USAGE/components/grid.md +1 -1
- package/AI_USAGE/components/heatmap-api.md +1 -1
- package/AI_USAGE/components/heatmap.md +1 -1
- package/AI_USAGE/components/icon-api.md +1 -1
- package/AI_USAGE/components/icon.md +1 -1
- package/AI_USAGE/components/image-api.md +1 -1
- package/AI_USAGE/components/image.md +1 -1
- package/AI_USAGE/components/input-api.md +2 -2
- package/AI_USAGE/components/input-number-api.md +1 -1
- package/AI_USAGE/components/input-number.md +1 -1
- package/AI_USAGE/components/input-tag-api.md +1 -1
- package/AI_USAGE/components/input-tag.md +1 -1
- package/AI_USAGE/components/input.md +1 -1
- package/AI_USAGE/components/layout-api.md +1 -1
- package/AI_USAGE/components/layout.md +1 -1
- package/AI_USAGE/components/line-chart-api.md +1 -1
- package/AI_USAGE/components/line-chart.md +1 -1
- package/AI_USAGE/components/link-api.md +1 -1
- package/AI_USAGE/components/link.md +1 -1
- package/AI_USAGE/components/menu-api.md +1 -1
- package/AI_USAGE/components/menu.md +1 -1
- package/AI_USAGE/components/message-api.md +1 -1
- package/AI_USAGE/components/message-box-api.md +1 -1
- package/AI_USAGE/components/message-box.md +1 -1
- package/AI_USAGE/components/message.md +1 -1
- package/AI_USAGE/components/network-api.md +1 -1
- package/AI_USAGE/components/network.md +1 -1
- package/AI_USAGE/components/notification-api.md +1 -1
- package/AI_USAGE/components/notification.md +1 -1
- package/AI_USAGE/components/pagination-api.md +1 -1
- package/AI_USAGE/components/pagination.md +1 -1
- package/AI_USAGE/components/pie-chart-api.md +1 -1
- package/AI_USAGE/components/pie-chart.md +1 -1
- package/AI_USAGE/components/popconfirm-api.md +3 -3
- package/AI_USAGE/components/popconfirm.md +1 -1
- package/AI_USAGE/components/popover-api.md +1 -1
- package/AI_USAGE/components/popover.md +1 -1
- package/AI_USAGE/components/popup-api.md +1 -1
- package/AI_USAGE/components/popup.md +1 -1
- package/AI_USAGE/components/progress-api.md +1 -1
- package/AI_USAGE/components/progress.md +1 -1
- package/AI_USAGE/components/radio-api.md +1 -1
- package/AI_USAGE/components/radio.md +1 -1
- package/AI_USAGE/components/rate-api.md +1 -1
- package/AI_USAGE/components/rate.md +1 -1
- package/AI_USAGE/components/resize-box-api.md +1 -1
- package/AI_USAGE/components/resize-box.md +1 -1
- package/AI_USAGE/components/scrollbar-api.md +1 -1
- package/AI_USAGE/components/scrollbar.md +1 -1
- package/AI_USAGE/components/select-api.md +1 -1
- package/AI_USAGE/components/select.md +1 -1
- package/AI_USAGE/components/skeleton-api.md +1 -1
- package/AI_USAGE/components/skeleton.md +1 -1
- package/AI_USAGE/components/slider-api.md +1 -1
- package/AI_USAGE/components/slider.md +1 -1
- package/AI_USAGE/components/space-api.md +1 -1
- package/AI_USAGE/components/space.md +1 -1
- package/AI_USAGE/components/spin-api.md +1 -1
- package/AI_USAGE/components/spin.md +1 -1
- package/AI_USAGE/components/steps-api.md +1 -1
- package/AI_USAGE/components/steps.md +1 -1
- package/AI_USAGE/components/switch-api.md +1 -1
- package/AI_USAGE/components/switch.md +1 -1
- package/AI_USAGE/components/table-api.md +1 -1
- package/AI_USAGE/components/table.md +1 -1
- package/AI_USAGE/components/tabs-api.md +1 -1
- package/AI_USAGE/components/tabs.md +1 -1
- package/AI_USAGE/components/tag-api.md +1 -1
- package/AI_USAGE/components/tag.md +1 -1
- package/AI_USAGE/components/textarea-api.md +1 -1
- package/AI_USAGE/components/textarea.md +1 -1
- package/AI_USAGE/components/time-picker-api.md +1 -1
- package/AI_USAGE/components/time-picker.md +1 -1
- package/AI_USAGE/components/time-range-selector-api.md +1 -1
- package/AI_USAGE/components/time-range-selector.md +1 -1
- package/AI_USAGE/components/timeline-api.md +3 -3
- package/AI_USAGE/components/timeline.md +1 -1
- package/AI_USAGE/components/tooltip-api.md +1 -1
- package/AI_USAGE/components/tooltip.md +1 -1
- package/AI_USAGE/components/transfer-api.md +1 -1
- package/AI_USAGE/components/transfer.md +1 -1
- package/AI_USAGE/components/tree-select-api.md +1 -1
- package/AI_USAGE/components/tree-select.md +1 -1
- package/AI_USAGE/components/trend-chart-api.md +1 -1
- package/AI_USAGE/components/trend-chart.md +1 -1
- package/AI_USAGE/components/trigger-api.md +1 -1
- package/AI_USAGE/components/trigger.md +1 -1
- package/AI_USAGE/components/upload-api.md +1 -1
- package/AI_USAGE/components/upload.md +1 -1
- package/AI_USAGE/components/watermark-api.md +1 -1
- package/AI_USAGE/components/watermark.md +1 -1
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +1 -1
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +296 -56
- package/CHANGELOG.md +20 -0
- package/dist/_styles/palette-aliases.d.ts +1 -0
- package/dist/components/button/Button.d.ts +0 -9
- package/dist/components/button/appearance.d.ts +7 -0
- package/dist/components/button/index.d.ts +0 -16
- package/dist/components/button/props.d.ts +2 -6
- package/dist/components/color-picker/panel.d.ts +0 -9
- package/dist/components/date-picker/DatePicker.vue.d.ts +0 -15
- package/dist/components/date-picker/index.d.ts +0 -30
- package/dist/components/drawer/index.d.ts +0 -30
- package/dist/components/drawer/src/Drawer.vue.d.ts +0 -15
- package/dist/components/dropdown/DropdownButton.vue.d.ts +0 -15
- package/dist/components/dropdown/index.d.ts +0 -30
- package/dist/components/popconfirm/src/popup.vue.d.ts +0 -15
- package/dist/components/time-picker/TimePanel.vue.d.ts +0 -15
- package/dist/components/time-picker/TimePicker.vue.d.ts +0 -15
- package/dist/components/time-picker/index.d.ts +0 -30
- package/dist/es/_styles/palette-aliases.js +102 -17
- package/dist/es/_utils/palette.js +54 -54
- package/dist/es/components/button/Button.js +77 -49
- package/dist/es/components/button/appearance.js +7 -0
- package/dist/es/components/button/props.js +0 -4
- package/dist/es/directives/wave.js +14 -8
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/alert.css +1 -1
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/color-picker.css +1 -1
- package/dist/style/link.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { PALETTE_ALIASES as
|
|
2
|
-
const
|
|
3
|
-
if (typeof
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
const
|
|
7
|
-
if (!/^(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(
|
|
8
|
-
const
|
|
9
|
-
return
|
|
1
|
+
import { PALETTE_ALIASES as y, PALETTE_ALIASES_DARK as A, DEFAULT_PALETTE_SEEDS as d } from "../_styles/palette-aliases.js";
|
|
2
|
+
const _ = 2.05, g = 95.5, E = 22, S = [1, 0.8, 0.6, 0.4, 0.2], $ = [1 / 3, 2 / 3, 1], H = 90, L = 300, m = (s, i, c) => Math.min(c, Math.max(i, s)), p = (s) => {
|
|
3
|
+
if (typeof s != "string") return null;
|
|
4
|
+
const i = s.trim();
|
|
5
|
+
if (i.startsWith("#")) {
|
|
6
|
+
const e = i.slice(1);
|
|
7
|
+
if (!/^(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)) return null;
|
|
8
|
+
const u = e.length === 3 ? [...e].map((a) => a + a).join("") : e.length === 6 || e.length === 8 ? e.slice(0, 6) : null;
|
|
9
|
+
return u ? [0, 2, 4].map((a) => parseInt(u.slice(a, a + 2), 16)) : null;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
const l =
|
|
18
|
-
return l.some((
|
|
19
|
-
},
|
|
20
|
-
const
|
|
11
|
+
const c = i.match(/^rgba?\(([^)]+)\)$/i);
|
|
12
|
+
if (!c) return null;
|
|
13
|
+
const r = c[1].trim(), o = r.includes(",") ? r.split(",").map((e) => e.trim()) : r.split(/\s*\/\s*/)[0].split(/\s+/), t = r.includes(",") ? o[3] : r.includes("/") ? r.split("/")[1].trim() : void 0;
|
|
14
|
+
if (r.split("/").length > 2 || o.length < 3 || o.length > (r.includes(",") ? 4 : 3)) return null;
|
|
15
|
+
const n = /^[+-]?(?:\d+\.?\d*|\.\d+)%?$/;
|
|
16
|
+
if (o.slice(0, 3).some((e) => !n.test(e)) || t !== void 0 && !n.test(t)) return null;
|
|
17
|
+
const l = o.slice(0, 3).map((e) => e.endsWith("%") ? Math.round(parseFloat(e) / 100 * 255) : Number(e));
|
|
18
|
+
return l.some((e) => !Number.isFinite(e)) ? null : l.map((e) => m(Math.round(e), 0, 255));
|
|
19
|
+
}, P = ([s, i, c]) => {
|
|
20
|
+
const r = s / 255, o = i / 255, t = c / 255, n = Math.max(r, o, t), l = Math.min(r, o, t), e = n - l, u = (n + l) / 2;
|
|
21
21
|
let a = 0, h = 0;
|
|
22
|
-
return
|
|
23
|
-
}, I = ({ h:
|
|
24
|
-
const
|
|
25
|
-
let
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
throw new Error(`[x-next] generatePalette: 无法解析种子色 "${
|
|
31
|
-
const { h:
|
|
22
|
+
return e !== 0 && (h = u > 0.5 ? e / (2 - n - l) : e / (n + l), n === r ? a = (o - t) / e + (o < t ? 6 : 0) : n === o ? a = (t - r) / e + 2 : a = (r - o) / e + 4, a *= 60), { h: a, s: h * 100, l: u * 100 };
|
|
23
|
+
}, I = ({ h: s, s: i, l: c }) => {
|
|
24
|
+
const r = m(i, 0, 100) / 100, o = m(c, 0, 100) / 100, t = (s % 360 + 360) % 360, n = (1 - Math.abs(2 * o - 1)) * r, l = n * (1 - Math.abs(t / 60 % 2 - 1)), e = o - n / 2;
|
|
25
|
+
let u;
|
|
26
|
+
return t < 60 ? u = [n, l, 0] : t < 120 ? u = [l, n, 0] : t < 180 ? u = [0, n, l] : t < 240 ? u = [0, l, n] : t < 300 ? u = [l, 0, n] : u = [n, 0, l], u.map((a) => m(Math.round((a + e) * 255), 0, 255));
|
|
27
|
+
}, R = (s) => `#${s.map((i) => m(Math.round(i), 0, 255).toString(16).padStart(2, "0")).join("")}`, v = (s) => s <= H || s >= L ? 1 : -1, T = (s, i = {}) => {
|
|
28
|
+
const c = p(s);
|
|
29
|
+
if (!c)
|
|
30
|
+
throw new Error(`[x-next] generatePalette: 无法解析种子色 "${s}"`);
|
|
31
|
+
const { h: r, s: o, l: t } = P(c), n = v(r), { dark: l = !1 } = i, e = l ? Math.min(E, t) : Math.max(g, t), u = l ? Math.max(g, t) : Math.min(E, t), a = [];
|
|
32
32
|
for (let h = 0; h < 9; h += 1) {
|
|
33
33
|
let f;
|
|
34
|
-
h < 5 ? f =
|
|
35
|
-
const
|
|
36
|
-
a.push(
|
|
34
|
+
h < 5 ? f = t + (e - t) * S[h] : h === 5 ? f = t : f = t + (u - t) * $[h - 6];
|
|
35
|
+
const M = 5 - h, b = n * _ * M * (l ? -1 : 1);
|
|
36
|
+
a.push(R(I({ h: r + b, s: o, l: m(f, 0, 100) })));
|
|
37
37
|
}
|
|
38
38
|
return a;
|
|
39
|
-
}, G = (
|
|
40
|
-
const { name:
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
}, G = (s, i = {}) => {
|
|
40
|
+
const { name: c = "primary", target: r, dark: o } = i, t = T(s, { dark: o }), n = r ?? (typeof document < "u" ? document.documentElement : null);
|
|
41
|
+
if (n) {
|
|
42
|
+
n.style.setProperty(`--x-color-${c}`, t[5]), t.forEach((l, e) => {
|
|
43
|
+
n.style.setProperty(`--x-color-${c}-${e + 1}`, l);
|
|
44
44
|
});
|
|
45
|
-
for (const [l,
|
|
46
|
-
|
|
45
|
+
for (const [l, e] of Object.entries(x(c, o, t[5])))
|
|
46
|
+
n.style.setProperty(l, e);
|
|
47
47
|
}
|
|
48
|
-
return
|
|
49
|
-
},
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
Object.entries(i).map(([s, e]) => [s, (n == null ? void 0 : n[s]) ?? e])
|
|
48
|
+
return t;
|
|
49
|
+
}, x = (s, i, c) => {
|
|
50
|
+
const r = y[s] ?? {}, o = i ? A[s] : void 0, t = Object.fromEntries(
|
|
51
|
+
Object.entries(r).map(([n, l]) => [n, (o == null ? void 0 : o[n]) ?? l])
|
|
53
52
|
);
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
return i && c && d[s] && JSON.stringify(p(c)) !== JSON.stringify(p(d[s])) && (t[`--x-color-${s}-subtle`] = `color-mix(in srgb, var(--x-color-${s}-1) 72%, var(--x-color-${s}-8))`), t;
|
|
54
|
+
}, O = (s, i = !1) => {
|
|
55
|
+
const c = T(s, { dark: i });
|
|
56
56
|
return {
|
|
57
|
-
"--x-color-primary":
|
|
58
|
-
...Object.fromEntries(
|
|
59
|
-
...
|
|
57
|
+
"--x-color-primary": c[5],
|
|
58
|
+
...Object.fromEntries(c.map((r, o) => [`--x-color-primary-${o + 1}`, r])),
|
|
59
|
+
...x("primary", i, c[5])
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
export {
|
|
63
63
|
G as applyThemeColor,
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
T as generatePalette,
|
|
65
|
+
O as getThemeColorStyles,
|
|
66
66
|
I as hslToRgb,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
p as parseColor,
|
|
68
|
+
P as rgbToHsl,
|
|
69
|
+
R as toHex
|
|
70
70
|
};
|
|
@@ -1,84 +1,112 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { getClassNameMixin as
|
|
3
|
-
import { buttonProps as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { buttonGroupInjectionKey as
|
|
7
|
-
import { useSize as
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { defineComponent as M, getCurrentInstance as R, inject as U, reactive as Z, computed as c, onBeforeUnmount as q, withDirectives as H, createVNode as u, resolveDirective as J, isVNode as Q, Comment as W, Fragment as X, Text as Y } from "vue";
|
|
2
|
+
import { getClassNameMixin as _ } from "../../_utils/config.js";
|
|
3
|
+
import { buttonProps as G } from "./props.js";
|
|
4
|
+
import ee from "../../icons/animation/animation-loading.js";
|
|
5
|
+
import ie from "../../directives/wave.js";
|
|
6
|
+
import { buttonGroupInjectionKey as ae } from "./context.js";
|
|
7
|
+
import { useSize as te } from "../../_hooks/use-size.js";
|
|
8
|
+
import { resolveButtonAppearance as ne } from "./appearance.js";
|
|
9
|
+
const d = (e) => {
|
|
10
|
+
if (Array.isArray(e)) return e.some(d);
|
|
10
11
|
if (e == null || typeof e == "boolean") return !1;
|
|
11
12
|
if (typeof e == "string") return e.trim().length > 0;
|
|
12
|
-
if (
|
|
13
|
-
if (e.type ===
|
|
14
|
-
if (e.type ===
|
|
15
|
-
return
|
|
13
|
+
if (Q(e)) {
|
|
14
|
+
if (e.type === W) return !1;
|
|
15
|
+
if (e.type === X || e.type === Y)
|
|
16
|
+
return d(e.children);
|
|
16
17
|
}
|
|
17
18
|
return !0;
|
|
18
|
-
},
|
|
19
|
+
}, se = /* @__PURE__ */ M({
|
|
19
20
|
name: "Button",
|
|
20
|
-
props:
|
|
21
|
+
props: G,
|
|
21
22
|
// 显式导入插槽
|
|
22
23
|
slots: Object,
|
|
23
24
|
directives: {
|
|
24
|
-
wave:
|
|
25
|
+
wave: ie
|
|
25
26
|
},
|
|
26
27
|
emits: ["click"],
|
|
27
28
|
setup(e, {
|
|
28
|
-
slots:
|
|
29
|
-
emit:
|
|
29
|
+
slots: t,
|
|
30
|
+
emit: F
|
|
30
31
|
}) {
|
|
31
|
-
const
|
|
32
|
-
mergedSize:
|
|
33
|
-
} =
|
|
32
|
+
const b = R(), a = U(ae, void 0), {
|
|
33
|
+
mergedSize: L
|
|
34
|
+
} = te(void 0, {
|
|
34
35
|
defaultValue: "medium"
|
|
35
|
-
}),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}), i =
|
|
39
|
-
const
|
|
40
|
-
return Object.prototype.hasOwnProperty.call(
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
}), o = Z({
|
|
37
|
+
isDebounce: !1,
|
|
38
|
+
nativeActivation: !1
|
|
39
|
+
}), i = _("button"), N = (n) => n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`), f = (n) => {
|
|
40
|
+
const r = (b == null ? void 0 : b.vnode.props) ?? {};
|
|
41
|
+
return Object.prototype.hasOwnProperty.call(r, n) || Object.prototype.hasOwnProperty.call(r, N(n));
|
|
42
|
+
}, m = c(() => f("type") ? e.type : (a == null ? void 0 : a.type) ?? e.type), S = c(() => f("size") ? e.size : (a == null ? void 0 : a.size) ?? L.value), y = c(() => f("status") ? e.status : (a == null ? void 0 : a.status) ?? e.status), h = c(() => f("shape") ? e.shape : (a == null ? void 0 : a.shape) ?? e.shape), s = c(() => f("disabled") ? e.disabled : (a == null ? void 0 : a.disabled) ?? e.disabled), v = c(() => ne(m.value, y.value, e.plain)), V = c(() => [
|
|
43
|
+
i.block,
|
|
44
|
+
m.value && m.value !== "default" && i.modifier(m.value),
|
|
45
|
+
S.value && i.modifier(S.value),
|
|
46
|
+
// Keep legacy semantic classes, but use separate namespaces for style decisions.
|
|
47
|
+
y.value !== "primary" && i.modifier(y.value),
|
|
48
|
+
i.modifier(`appearance-${v.value.appearance}`),
|
|
49
|
+
i.modifier(`color-${v.value.color}`),
|
|
50
|
+
s.value && i.is("disabled"),
|
|
51
|
+
e.block && i.modifier("block"),
|
|
52
|
+
e.plain && i.modifier("plain"),
|
|
53
|
+
h.value && i.modifier(h.value),
|
|
54
|
+
e.border && ["default", "solid", "outline", "dashed"].includes(v.value.appearance) && i.modifier("has-border"),
|
|
55
|
+
!e.border && i.modifier("hide-border"),
|
|
56
|
+
l.value && i.modifier("loading"),
|
|
57
|
+
e.narrow && i.modifier("narrow")
|
|
58
|
+
]);
|
|
59
|
+
let k, p;
|
|
60
|
+
q(() => {
|
|
61
|
+
clearTimeout(k), clearTimeout(p);
|
|
62
|
+
});
|
|
63
|
+
const $ = () => {
|
|
64
|
+
e.debounce > 0 && !o.isDebounce && (o.isDebounce = !0, k = setTimeout(() => {
|
|
65
|
+
o.isDebounce = !1;
|
|
44
66
|
}, e.debounce));
|
|
45
|
-
}, l =
|
|
46
|
-
var
|
|
47
|
-
|
|
67
|
+
}, l = c(() => e.loading || o.isDebounce), K = c(() => s.value || l.value || v.value.appearance === "text"), C = (n) => {
|
|
68
|
+
var r;
|
|
69
|
+
if (n.detail > 0 && ((r = n.currentTarget) == null || r.blur()), s.value || l.value) {
|
|
70
|
+
n.preventDefault();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
e.htmlType !== "button" && (o.nativeActivation = !0, clearTimeout(p), p = setTimeout(() => {
|
|
74
|
+
o.nativeActivation = !1;
|
|
75
|
+
}, 0)), $(), F("click", n);
|
|
48
76
|
};
|
|
49
77
|
return () => {
|
|
50
|
-
var
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
class: [
|
|
78
|
+
var j, I, O, B;
|
|
79
|
+
const n = (j = t.default) == null ? void 0 : j.call(t), r = (I = t.prefix) == null ? void 0 : I.call(t), x = (O = t.icon) == null ? void 0 : O.call(t), z = (B = t.suffix) == null ? void 0 : B.call(t), g = d(n), w = d(r), T = d(x), D = d(z), P = !g && !w && T && !D, A = e.loadingFill || l.value && (h.value === "circle" || P), E = l.value && !A && (g || w || T || D);
|
|
80
|
+
return H(u("button", {
|
|
81
|
+
class: [V.value, !g && i.modifier("empty-content"), P && i.modifier("only-icon"), A && i.modifier("loading-fill")],
|
|
54
82
|
type: e.htmlType,
|
|
55
|
-
disabled:
|
|
83
|
+
disabled: s.value || l.value && !o.nativeActivation,
|
|
56
84
|
"aria-busy": l.value || void 0,
|
|
57
|
-
onClick:
|
|
58
|
-
}, [
|
|
85
|
+
onClick: C
|
|
86
|
+
}, [u("span", {
|
|
59
87
|
class: i.element("loading"),
|
|
60
88
|
"aria-hidden": "true",
|
|
61
89
|
style: {
|
|
62
90
|
display: "flex",
|
|
63
91
|
opacity: l.value ? 1 : 0,
|
|
64
|
-
width:
|
|
65
|
-
marginRight:
|
|
92
|
+
width: A ? void 0 : l.value ? "1em" : 0,
|
|
93
|
+
marginRight: E ? "4px" : "0",
|
|
66
94
|
overflow: "hidden"
|
|
67
95
|
}
|
|
68
|
-
}, [l.value &&
|
|
96
|
+
}, [l.value && u(ee, null, null)]), w && u("span", {
|
|
69
97
|
class: i.element("prefix")
|
|
70
|
-
}, [
|
|
98
|
+
}, [r]), T && u("span", {
|
|
71
99
|
class: i.element("prefix")
|
|
72
|
-
}, [
|
|
100
|
+
}, [x]), u("span", {
|
|
73
101
|
class: i.element("content")
|
|
74
|
-
}, [
|
|
102
|
+
}, [n]), D && u("span", {
|
|
75
103
|
class: i.element("suffix")
|
|
76
|
-
}, [
|
|
77
|
-
disabled:
|
|
104
|
+
}, [z])]), [[J("wave"), {
|
|
105
|
+
disabled: K.value
|
|
78
106
|
}]]);
|
|
79
107
|
};
|
|
80
108
|
}
|
|
81
109
|
});
|
|
82
110
|
export {
|
|
83
|
-
|
|
111
|
+
se as default
|
|
84
112
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function c(r, e, o) {
|
|
2
|
+
const a = r === "primary" && e === "default" ? "primary" : e, n = r === "primary" ? "solid" : r;
|
|
3
|
+
return o && ["default", "solid"].includes(n) ? { appearance: "subtle", color: a } : { appearance: n, color: a };
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
c as resolveButtonAppearance
|
|
7
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const i = "x-wave";
|
|
2
2
|
const n = (e, t) => {
|
|
3
3
|
const _ = t.value;
|
|
4
4
|
if (_ === !1 || _ && typeof _ == "object" && _.disabled) return !0;
|
|
@@ -10,8 +10,14 @@ const n = (e, t) => {
|
|
|
10
10
|
return t !== "transparent" && t !== "rgba(0, 0, 0, 0)" && t !== "rgba(255, 255, 255, 0)" && t !== "rgb(255, 255, 255)" && t !== "#fff" && t !== "#ffffff";
|
|
11
11
|
}, v = (e) => {
|
|
12
12
|
const t = getComputedStyle(e);
|
|
13
|
-
return [
|
|
14
|
-
|
|
13
|
+
return [
|
|
14
|
+
t.getPropertyValue("--x-button-wave-color").trim(),
|
|
15
|
+
t.borderTopColor,
|
|
16
|
+
t.borderColor,
|
|
17
|
+
t.backgroundColor,
|
|
18
|
+
t.color
|
|
19
|
+
].find(d) ?? "currentColor";
|
|
20
|
+
}, a = (e) => {
|
|
15
21
|
e.__wave_timer__ && (clearTimeout(e.__wave_timer__), delete e.__wave_timer__), e.__wave_element__ && (e.__wave_element__.remove(), delete e.__wave_element__);
|
|
16
22
|
}, s = (e, t) => {
|
|
17
23
|
e.__wave_disabled__ = n(e, t);
|
|
@@ -21,12 +27,12 @@ const n = (e, t) => {
|
|
|
21
27
|
const _ = (r) => {
|
|
22
28
|
if (e.__wave_disabled__)
|
|
23
29
|
return;
|
|
24
|
-
|
|
30
|
+
a(e);
|
|
25
31
|
const o = document.createElement("div");
|
|
26
|
-
o.className =
|
|
27
|
-
o.classList.add(`${
|
|
32
|
+
o.className = i, o.style.setProperty("--x-wave-color", v(e)), e.__wave_element__ = o, e.appendChild(o), requestAnimationFrame(() => {
|
|
33
|
+
o.classList.add(`${i}-active`);
|
|
28
34
|
}), e.__wave_timer__ = window.setTimeout(() => {
|
|
29
|
-
|
|
35
|
+
a(e);
|
|
30
36
|
}, 400);
|
|
31
37
|
};
|
|
32
38
|
e.__wave_handler__ = _, e.addEventListener("click", _);
|
|
@@ -35,7 +41,7 @@ const n = (e, t) => {
|
|
|
35
41
|
s(e, t), getComputedStyle(e).position === "static" && (e.__wave_restore_position__ = e.style.position, e.style.position = "relative");
|
|
36
42
|
},
|
|
37
43
|
unmounted(e) {
|
|
38
|
-
e.__wave_handler__ && (e.removeEventListener("click", e.__wave_handler__), delete e.__wave_handler__),
|
|
44
|
+
e.__wave_handler__ && (e.removeEventListener("click", e.__wave_handler__), delete e.__wave_handler__), a(e), e.__wave_restore_position__ !== void 0 && (e.style.position = e.__wave_restore_position__, delete e.__wave_restore_position__), delete e.__wave_disabled__;
|
|
39
45
|
}
|
|
40
46
|
};
|
|
41
47
|
export {
|