ai-form-designer
Version:
vue3+adv的设计器,可视化开发页面表单
761 lines (760 loc) • 30 kB
JavaScript
import { c as M } from "./_commonjsHelpers-BVfed4GL.js";
import { r as ge, _ as be, c as me, a as Pe, b as Re, e as ke, p as We } from "./index-CFbzusj4.js";
import { r as je } from "./_vue_commonjs-external-NwvjgbHK.js";
import { f as Ne, a as Le, _ as qe } from "./index-B5s4z2wp.js";
import { b as Qe } from "./index-BAsJ4AfL.js";
var Ve = {}, _e = {}, U = {};
Object.defineProperty(U, "__esModule", { value: !0 });
U.createHoverColor = Xe;
U.createPressedColor = Ye;
const Se = ge;
function Xe(n) {
return (0, Se.composite)(n, [255, 255, 255, 0.16]);
}
function Ye(n) {
return (0, Se.composite)(n, [0, 0, 0, 0.12]);
}
var Z = {};
Object.defineProperty(Z, "__esModule", { value: !0 });
Z.buttonGroupInjectionKey = void 0;
const Ae = be;
Z.buttonGroupInjectionKey = (0, Ae.createInjectionKey)("n-button-group");
var Te = {}, xe = {}, X = {}, fe = {};
Object.defineProperty(fe, "__esModule", { value: !0 });
fe.default = {
paddingTiny: "0 6px",
paddingSmall: "0 10px",
paddingMedium: "0 14px",
paddingLarge: "0 18px",
paddingRoundTiny: "0 10px",
paddingRoundSmall: "0 14px",
paddingRoundMedium: "0 18px",
paddingRoundLarge: "0 22px",
iconMarginTiny: "6px",
iconMarginSmall: "6px",
iconMarginMedium: "6px",
iconMarginLarge: "6px",
iconSizeTiny: "14px",
iconSizeSmall: "18px",
iconSizeMedium: "18px",
iconSizeLarge: "20px",
rippleDuration: ".6s"
};
var Je = M && M.__importDefault || function(n) {
return n && n.__esModule ? n : { default: n };
};
Object.defineProperty(X, "__esModule", { value: !0 });
X.self = He;
const Ue = me, Ze = Je(fe);
function He(n) {
const { heightTiny: h, heightSmall: P, heightMedium: E, heightLarge: a, borderRadius: p, fontSizeTiny: O, fontSizeSmall: oe, fontSizeMedium: r, fontSizeLarge: g, opacityDisabled: re, textColor2: m, textColor3: te, primaryColorHover: x, primaryColorPressed: T, borderColor: o, primaryColor: C, baseColor: s, infoColor: f, infoColorHover: y, infoColorPressed: k, successColor: _, successColorHover: S, successColorPressed: W, warningColor: w, warningColorHover: D, warningColorPressed: j, errorColor: z, errorColorHover: H, errorColorPressed: K, fontWeight: ne, buttonColor2: Y, buttonColor2Hover: Q, buttonColor2Pressed: N, fontWeightStrong: I } = n;
return Object.assign(Object.assign({}, Ze.default), {
heightTiny: h,
heightSmall: P,
heightMedium: E,
heightLarge: a,
borderRadiusTiny: p,
borderRadiusSmall: p,
borderRadiusMedium: p,
borderRadiusLarge: p,
fontSizeTiny: O,
fontSizeSmall: oe,
fontSizeMedium: r,
fontSizeLarge: g,
opacityDisabled: re,
// secondary
colorOpacitySecondary: "0.16",
colorOpacitySecondaryHover: "0.22",
colorOpacitySecondaryPressed: "0.28",
colorSecondary: Y,
colorSecondaryHover: Q,
colorSecondaryPressed: N,
// tertiary
colorTertiary: Y,
colorTertiaryHover: Q,
colorTertiaryPressed: N,
// quaternary
colorQuaternary: "#0000",
colorQuaternaryHover: Q,
colorQuaternaryPressed: N,
// default type
color: "#0000",
colorHover: "#0000",
colorPressed: "#0000",
colorFocus: "#0000",
colorDisabled: "#0000",
textColor: m,
textColorTertiary: te,
textColorHover: x,
textColorPressed: T,
textColorFocus: x,
textColorDisabled: m,
textColorText: m,
textColorTextHover: x,
textColorTextPressed: T,
textColorTextFocus: x,
textColorTextDisabled: m,
textColorGhost: m,
textColorGhostHover: x,
textColorGhostPressed: T,
textColorGhostFocus: x,
textColorGhostDisabled: m,
border: `1px solid ${o}`,
borderHover: `1px solid ${x}`,
borderPressed: `1px solid ${T}`,
borderFocus: `1px solid ${x}`,
borderDisabled: `1px solid ${o}`,
rippleColor: C,
// primary
colorPrimary: C,
colorHoverPrimary: x,
colorPressedPrimary: T,
colorFocusPrimary: x,
colorDisabledPrimary: C,
textColorPrimary: s,
textColorHoverPrimary: s,
textColorPressedPrimary: s,
textColorFocusPrimary: s,
textColorDisabledPrimary: s,
textColorTextPrimary: C,
textColorTextHoverPrimary: x,
textColorTextPressedPrimary: T,
textColorTextFocusPrimary: x,
textColorTextDisabledPrimary: m,
textColorGhostPrimary: C,
textColorGhostHoverPrimary: x,
textColorGhostPressedPrimary: T,
textColorGhostFocusPrimary: x,
textColorGhostDisabledPrimary: C,
borderPrimary: `1px solid ${C}`,
borderHoverPrimary: `1px solid ${x}`,
borderPressedPrimary: `1px solid ${T}`,
borderFocusPrimary: `1px solid ${x}`,
borderDisabledPrimary: `1px solid ${C}`,
rippleColorPrimary: C,
// info
colorInfo: f,
colorHoverInfo: y,
colorPressedInfo: k,
colorFocusInfo: y,
colorDisabledInfo: f,
textColorInfo: s,
textColorHoverInfo: s,
textColorPressedInfo: s,
textColorFocusInfo: s,
textColorDisabledInfo: s,
textColorTextInfo: f,
textColorTextHoverInfo: y,
textColorTextPressedInfo: k,
textColorTextFocusInfo: y,
textColorTextDisabledInfo: m,
textColorGhostInfo: f,
textColorGhostHoverInfo: y,
textColorGhostPressedInfo: k,
textColorGhostFocusInfo: y,
textColorGhostDisabledInfo: f,
borderInfo: `1px solid ${f}`,
borderHoverInfo: `1px solid ${y}`,
borderPressedInfo: `1px solid ${k}`,
borderFocusInfo: `1px solid ${y}`,
borderDisabledInfo: `1px solid ${f}`,
rippleColorInfo: f,
// success
colorSuccess: _,
colorHoverSuccess: S,
colorPressedSuccess: W,
colorFocusSuccess: S,
colorDisabledSuccess: _,
textColorSuccess: s,
textColorHoverSuccess: s,
textColorPressedSuccess: s,
textColorFocusSuccess: s,
textColorDisabledSuccess: s,
textColorTextSuccess: _,
textColorTextHoverSuccess: S,
textColorTextPressedSuccess: W,
textColorTextFocusSuccess: S,
textColorTextDisabledSuccess: m,
textColorGhostSuccess: _,
textColorGhostHoverSuccess: S,
textColorGhostPressedSuccess: W,
textColorGhostFocusSuccess: S,
textColorGhostDisabledSuccess: _,
borderSuccess: `1px solid ${_}`,
borderHoverSuccess: `1px solid ${S}`,
borderPressedSuccess: `1px solid ${W}`,
borderFocusSuccess: `1px solid ${S}`,
borderDisabledSuccess: `1px solid ${_}`,
rippleColorSuccess: _,
// warning
colorWarning: w,
colorHoverWarning: D,
colorPressedWarning: j,
colorFocusWarning: D,
colorDisabledWarning: w,
textColorWarning: s,
textColorHoverWarning: s,
textColorPressedWarning: s,
textColorFocusWarning: s,
textColorDisabledWarning: s,
textColorTextWarning: w,
textColorTextHoverWarning: D,
textColorTextPressedWarning: j,
textColorTextFocusWarning: D,
textColorTextDisabledWarning: m,
textColorGhostWarning: w,
textColorGhostHoverWarning: D,
textColorGhostPressedWarning: j,
textColorGhostFocusWarning: D,
textColorGhostDisabledWarning: w,
borderWarning: `1px solid ${w}`,
borderHoverWarning: `1px solid ${D}`,
borderPressedWarning: `1px solid ${j}`,
borderFocusWarning: `1px solid ${D}`,
borderDisabledWarning: `1px solid ${w}`,
rippleColorWarning: w,
// error
colorError: z,
colorHoverError: H,
colorPressedError: K,
colorFocusError: H,
colorDisabledError: z,
textColorError: s,
textColorHoverError: s,
textColorPressedError: s,
textColorFocusError: s,
textColorDisabledError: s,
textColorTextError: z,
textColorTextHoverError: H,
textColorTextPressedError: K,
textColorTextFocusError: H,
textColorTextDisabledError: m,
textColorGhostError: z,
textColorGhostHoverError: H,
textColorGhostPressedError: K,
textColorGhostFocusError: H,
textColorGhostDisabledError: z,
borderError: `1px solid ${z}`,
borderHoverError: `1px solid ${H}`,
borderPressedError: `1px solid ${K}`,
borderFocusError: `1px solid ${H}`,
borderDisabledError: `1px solid ${z}`,
rippleColorError: z,
waveOpacity: "0.6",
fontWeight: ne,
fontWeightStrong: I
});
}
const eo = {
name: "Button",
common: Ue.commonLight,
self: He
};
X.default = eo;
Object.defineProperty(xe, "__esModule", { value: !0 });
const oo = me, ro = X, to = {
name: "Button",
common: oo.commonDark,
self(n) {
const h = (0, ro.self)(n);
return h.waveOpacity = "0.8", h.colorOpacitySecondary = "0.16", h.colorOpacitySecondaryHover = "0.2", h.colorOpacitySecondaryPressed = "0.12", h;
}
};
xe.default = to;
var ee = {}, ye = {};
Object.defineProperty(ye, "__esModule", {
value: !0
});
const q = Pe;
ye.default = (0, q.cB)("button", [(0, q.cM)("rtl", `
direction: rtl;
`, [(0, q.cE)("icon", {
margin: "var(--n-icon-margin)",
marginRight: 0
}), (0, q.cE)("content", [(0, q.c)("~", [(0, q.cE)("icon", {
margin: "var(--n-icon-margin)",
marginLeft: 0
})])])])]);
var no = M && M.__importDefault || function(n) {
return n && n.__esModule ? n : { default: n };
};
Object.defineProperty(ee, "__esModule", { value: !0 });
ee.buttonRtl = void 0;
const lo = no(ye);
ee.buttonRtl = {
name: "Button",
style: lo.default
};
(function(n) {
var h = M && M.__importDefault || function(p) {
return p && p.__esModule ? p : { default: p };
};
Object.defineProperty(n, "__esModule", { value: !0 }), n.buttonRtl = n.buttonLight = n.buttonDark = void 0;
var P = xe;
Object.defineProperty(n, "buttonDark", { enumerable: !0, get: function() {
return h(P).default;
} });
var E = X;
Object.defineProperty(n, "buttonLight", { enumerable: !0, get: function() {
return h(E).default;
} });
var a = ee;
Object.defineProperty(n, "buttonRtl", { enumerable: !0, get: function() {
return a.buttonRtl;
} });
})(Te);
var ve = {};
Object.defineProperty(ve, "__esModule", {
value: !0
});
const so = Ne, io = Le, ao = be, t = Pe;
ve.default = (0, t.c)([(0, t.cB)("button", `
margin: 0;
font-weight: var(--n-font-weight);
line-height: 1;
font-family: inherit;
padding: var(--n-padding);
height: var(--n-height);
font-size: var(--n-font-size);
border-radius: var(--n-border-radius);
color: var(--n-text-color);
background-color: var(--n-color);
width: var(--n-width);
white-space: nowrap;
outline: none;
position: relative;
z-index: auto;
border: none;
display: inline-flex;
flex-wrap: nowrap;
flex-shrink: 0;
align-items: center;
justify-content: center;
user-select: none;
-webkit-user-select: none;
text-align: center;
cursor: pointer;
text-decoration: none;
transition:
color .3s var(--n-bezier),
background-color .3s var(--n-bezier),
opacity .3s var(--n-bezier),
border-color .3s var(--n-bezier);
`, [(0, t.cM)("color", [(0, t.cE)("border", {
borderColor: "var(--n-border-color)"
}), (0, t.cM)("disabled", [(0, t.cE)("border", {
borderColor: "var(--n-border-color-disabled)"
})]), (0, t.cNotM)("disabled", [(0, t.c)("&:focus", [(0, t.cE)("state-border", {
borderColor: "var(--n-border-color-focus)"
})]), (0, t.c)("&:hover", [(0, t.cE)("state-border", {
borderColor: "var(--n-border-color-hover)"
})]), (0, t.c)("&:active", [(0, t.cE)("state-border", {
borderColor: "var(--n-border-color-pressed)"
})]), (0, t.cM)("pressed", [(0, t.cE)("state-border", {
borderColor: "var(--n-border-color-pressed)"
})])])]), (0, t.cM)("disabled", {
backgroundColor: "var(--n-color-disabled)",
color: "var(--n-text-color-disabled)"
}, [(0, t.cE)("border", {
border: "var(--n-border-disabled)"
})]), (0, t.cNotM)("disabled", [(0, t.c)("&:focus", {
backgroundColor: "var(--n-color-focus)",
color: "var(--n-text-color-focus)"
}, [(0, t.cE)("state-border", {
border: "var(--n-border-focus)"
})]), (0, t.c)("&:hover", {
backgroundColor: "var(--n-color-hover)",
color: "var(--n-text-color-hover)"
}, [(0, t.cE)("state-border", {
border: "var(--n-border-hover)"
})]), (0, t.c)("&:active", {
backgroundColor: "var(--n-color-pressed)",
color: "var(--n-text-color-pressed)"
}, [(0, t.cE)("state-border", {
border: "var(--n-border-pressed)"
})]), (0, t.cM)("pressed", {
backgroundColor: "var(--n-color-pressed)",
color: "var(--n-text-color-pressed)"
}, [(0, t.cE)("state-border", {
border: "var(--n-border-pressed)"
})])]), (0, t.cM)("loading", "cursor: wait;"), (0, t.cB)("base-wave", `
pointer-events: none;
top: 0;
right: 0;
bottom: 0;
left: 0;
animation-iteration-count: 1;
animation-duration: var(--n-ripple-duration);
animation-timing-function: var(--n-bezier-ease-out), var(--n-bezier-ease-out);
`, [(0, t.cM)("active", {
zIndex: 1,
animationName: "button-wave-spread, button-wave-opacity"
})]), ao.isBrowser && "MozBoxSizing" in document.createElement("div").style ? (0, t.c)("&::moz-focus-inner", {
border: 0
}) : null, (0, t.cE)("border, state-border", `
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
border-radius: inherit;
transition: border-color .3s var(--n-bezier);
pointer-events: none;
`), (0, t.cE)("border", {
border: "var(--n-border)"
}), (0, t.cE)("state-border", {
border: "var(--n-border)",
borderColor: "#0000",
zIndex: 1
}), (0, t.cE)("icon", `
margin: var(--n-icon-margin);
margin-left: 0;
height: var(--n-icon-size);
width: var(--n-icon-size);
max-width: var(--n-icon-size);
font-size: var(--n-icon-size);
position: relative;
flex-shrink: 0;
`, [(0, t.cB)("icon-slot", `
height: var(--n-icon-size);
width: var(--n-icon-size);
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
`, [(0, io.iconSwitchTransition)({
top: "50%",
originalTransform: "translateY(-50%)"
})]), (0, so.fadeInWidthExpandTransition)()]), (0, t.cE)("content", `
display: flex;
align-items: center;
flex-wrap: nowrap;
min-width: 0;
`, [(0, t.c)("~", [(0, t.cE)("icon", {
margin: "var(--n-icon-margin)",
marginRight: 0
})])]), (0, t.cM)("block", `
display: flex;
width: 100%;
`), (0, t.cM)("dashed", [(0, t.cE)("border, state-border", {
borderStyle: "dashed !important"
})]), (0, t.cM)("disabled", {
cursor: "not-allowed",
opacity: "var(--n-opacity-disabled)"
})]), (0, t.c)("@keyframes button-wave-spread", {
from: {
boxShadow: "0 0 0.5px 0 var(--n-ripple-color)"
},
to: {
// don't use exact 5px since chrome will display the animation with glitches
boxShadow: "0 0 0.5px 4.5px var(--n-ripple-color)"
}
}), (0, t.c)("@keyframes button-wave-opacity", {
from: {
opacity: "var(--n-wave-opacity)"
},
to: {
opacity: 0
}
})]);
(function(n) {
var h = M && M.__importDefault || function(o) {
return o && o.__esModule ? o : { default: o };
};
Object.defineProperty(n, "__esModule", { value: !0 }), n.XButton = n.buttonProps = void 0;
const P = ge, E = ke, a = je, p = qe, O = Re, oe = We, r = be, g = U, re = Qe, m = Z, te = Te, x = h(ve);
n.buttonProps = Object.assign(Object.assign({}, O.useTheme.props), { color: String, textColor: String, text: Boolean, block: Boolean, loading: Boolean, disabled: Boolean, circle: Boolean, size: String, ghost: Boolean, round: Boolean, secondary: Boolean, tertiary: Boolean, quaternary: Boolean, strong: Boolean, focusable: {
type: Boolean,
default: !0
}, keyboard: {
type: Boolean,
default: !0
}, tag: {
type: String,
default: "button"
}, type: {
type: String,
default: "default"
}, dashed: Boolean, renderIcon: Function, iconPlacement: {
type: String,
default: "left"
}, attrType: {
type: String,
default: "button"
}, bordered: {
type: Boolean,
default: !0
}, onClick: [Function, Array], nativeFocusBehavior: {
type: Boolean,
default: !re.isSafari
} });
const T = (0, a.defineComponent)({
name: "Button",
props: n.buttonProps,
slots: Object,
setup(o) {
process.env.NODE_ENV !== "production" && (0, a.watchEffect)(() => {
const { dashed: l, ghost: b, text: $, secondary: e, tertiary: V, quaternary: L } = o;
(l || b || $) && (e || V || L) && (0, r.warnOnce)("button", "`dashed`, `ghost` and `text` props can't be used along with `secondary`, `tertiary` and `quaternary` props.");
});
const C = (0, a.ref)(null), s = (0, a.ref)(null), f = (0, a.ref)(!1), y = (0, E.useMemo)(() => !o.quaternary && !o.tertiary && !o.secondary && !o.text && (!o.color || o.ghost || o.dashed) && o.bordered), k = (0, a.inject)(m.buttonGroupInjectionKey, {}), { mergedSizeRef: _ } = (0, O.useFormItem)({}, {
defaultSize: "medium",
mergedSize: (l) => {
const { size: b } = o;
if (b)
return b;
const { size: $ } = k;
if ($)
return $;
const { mergedSize: e } = l || {};
return e ? e.value : "medium";
}
}), S = (0, a.computed)(() => o.focusable && !o.disabled), W = (l) => {
var b;
S.value || l.preventDefault(), !o.nativeFocusBehavior && (l.preventDefault(), !o.disabled && S.value && ((b = C.value) === null || b === void 0 || b.focus({ preventScroll: !0 })));
}, w = (l) => {
var b;
if (!o.disabled && !o.loading) {
const { onClick: $ } = o;
$ && (0, r.call)($, l), o.text || (b = s.value) === null || b === void 0 || b.play();
}
}, D = (l) => {
switch (l.key) {
case "Enter":
if (!o.keyboard)
return;
f.value = !1;
}
}, j = (l) => {
switch (l.key) {
case "Enter":
if (!o.keyboard || o.loading) {
l.preventDefault();
return;
}
f.value = !0;
}
}, z = () => {
f.value = !1;
}, { inlineThemeDisabled: H, mergedClsPrefixRef: K, mergedRtlRef: ne } = (0, O.useConfig)(o), Y = (0, O.useTheme)("Button", "-button", x.default, te.buttonLight, o, K), Q = (0, oe.useRtl)("Button", ne, K), N = (0, a.computed)(() => {
const l = Y.value, { common: { cubicBezierEaseInOut: b, cubicBezierEaseOut: $ }, self: e } = l, { rippleDuration: V, opacityDisabled: L, fontWeight: le, fontWeightStrong: se } = e, B = _.value, { dashed: ie, type: G, ghost: ae, text: F, color: c, round: he, circle: ce, textColor: R, secondary: $e, tertiary: pe, quaternary: Ee, strong: we } = o, De = {
"--n-font-weight": we ? se : le
};
let d = {
"--n-color": "initial",
"--n-color-hover": "initial",
"--n-color-pressed": "initial",
"--n-color-focus": "initial",
"--n-color-disabled": "initial",
"--n-ripple-color": "initial",
"--n-text-color": "initial",
"--n-text-color-hover": "initial",
"--n-text-color-pressed": "initial",
"--n-text-color-focus": "initial",
"--n-text-color-disabled": "initial"
};
const A = G === "tertiary", Ce = G === "default", i = A ? "default" : G;
if (F) {
const u = R || c;
d = {
"--n-color": "#0000",
"--n-color-hover": "#0000",
"--n-color-pressed": "#0000",
"--n-color-focus": "#0000",
"--n-color-disabled": "#0000",
"--n-ripple-color": "#0000",
"--n-text-color": u || e[(0, r.createKey)("textColorText", i)],
"--n-text-color-hover": u ? (0, g.createHoverColor)(u) : e[(0, r.createKey)("textColorTextHover", i)],
"--n-text-color-pressed": u ? (0, g.createPressedColor)(u) : e[(0, r.createKey)("textColorTextPressed", i)],
"--n-text-color-focus": u ? (0, g.createHoverColor)(u) : e[(0, r.createKey)("textColorTextHover", i)],
"--n-text-color-disabled": u || e[(0, r.createKey)("textColorTextDisabled", i)]
};
} else if (ae || ie) {
const u = R || c;
d = {
"--n-color": "#0000",
"--n-color-hover": "#0000",
"--n-color-pressed": "#0000",
"--n-color-focus": "#0000",
"--n-color-disabled": "#0000",
"--n-ripple-color": c || e[(0, r.createKey)("rippleColor", i)],
"--n-text-color": u || e[(0, r.createKey)("textColorGhost", i)],
"--n-text-color-hover": u ? (0, g.createHoverColor)(u) : e[(0, r.createKey)("textColorGhostHover", i)],
"--n-text-color-pressed": u ? (0, g.createPressedColor)(u) : e[(0, r.createKey)("textColorGhostPressed", i)],
"--n-text-color-focus": u ? (0, g.createHoverColor)(u) : e[(0, r.createKey)("textColorGhostHover", i)],
"--n-text-color-disabled": u || e[(0, r.createKey)("textColorGhostDisabled", i)]
};
} else if ($e) {
const u = Ce ? e.textColor : A ? e.textColorTertiary : e[(0, r.createKey)("color", i)], v = c || u, J = G !== "default" && G !== "tertiary";
d = {
"--n-color": J ? (0, P.changeColor)(v, {
alpha: Number(e.colorOpacitySecondary)
}) : e.colorSecondary,
"--n-color-hover": J ? (0, P.changeColor)(v, {
alpha: Number(e.colorOpacitySecondaryHover)
}) : e.colorSecondaryHover,
"--n-color-pressed": J ? (0, P.changeColor)(v, {
alpha: Number(e.colorOpacitySecondaryPressed)
}) : e.colorSecondaryPressed,
"--n-color-focus": J ? (0, P.changeColor)(v, {
alpha: Number(e.colorOpacitySecondaryHover)
}) : e.colorSecondaryHover,
"--n-color-disabled": e.colorSecondary,
"--n-ripple-color": "#0000",
"--n-text-color": v,
"--n-text-color-hover": v,
"--n-text-color-pressed": v,
"--n-text-color-focus": v,
"--n-text-color-disabled": v
};
} else if (pe || Ee) {
const u = Ce ? e.textColor : A ? e.textColorTertiary : e[(0, r.createKey)("color", i)], v = c || u;
pe ? (d["--n-color"] = e.colorTertiary, d["--n-color-hover"] = e.colorTertiaryHover, d["--n-color-pressed"] = e.colorTertiaryPressed, d["--n-color-focus"] = e.colorSecondaryHover, d["--n-color-disabled"] = e.colorTertiary) : (d["--n-color"] = e.colorQuaternary, d["--n-color-hover"] = e.colorQuaternaryHover, d["--n-color-pressed"] = e.colorQuaternaryPressed, d["--n-color-focus"] = e.colorQuaternaryHover, d["--n-color-disabled"] = e.colorQuaternary), d["--n-ripple-color"] = "#0000", d["--n-text-color"] = v, d["--n-text-color-hover"] = v, d["--n-text-color-pressed"] = v, d["--n-text-color-focus"] = v, d["--n-text-color-disabled"] = v;
} else
d = {
"--n-color": c || e[(0, r.createKey)("color", i)],
"--n-color-hover": c ? (0, g.createHoverColor)(c) : e[(0, r.createKey)("colorHover", i)],
"--n-color-pressed": c ? (0, g.createPressedColor)(c) : e[(0, r.createKey)("colorPressed", i)],
"--n-color-focus": c ? (0, g.createHoverColor)(c) : e[(0, r.createKey)("colorFocus", i)],
"--n-color-disabled": c || e[(0, r.createKey)("colorDisabled", i)],
"--n-ripple-color": c || e[(0, r.createKey)("rippleColor", i)],
"--n-text-color": R || (c ? e.textColorPrimary : A ? e.textColorTertiary : e[(0, r.createKey)("textColor", i)]),
"--n-text-color-hover": R || (c ? e.textColorHoverPrimary : e[(0, r.createKey)("textColorHover", i)]),
"--n-text-color-pressed": R || (c ? e.textColorPressedPrimary : e[(0, r.createKey)("textColorPressed", i)]),
"--n-text-color-focus": R || (c ? e.textColorFocusPrimary : e[(0, r.createKey)("textColorFocus", i)]),
"--n-text-color-disabled": R || (c ? e.textColorDisabledPrimary : e[(0, r.createKey)("textColorDisabled", i)])
};
let de = {
"--n-border": "initial",
"--n-border-hover": "initial",
"--n-border-pressed": "initial",
"--n-border-focus": "initial",
"--n-border-disabled": "initial"
};
F ? de = {
"--n-border": "none",
"--n-border-hover": "none",
"--n-border-pressed": "none",
"--n-border-focus": "none",
"--n-border-disabled": "none"
} : de = {
"--n-border": e[(0, r.createKey)("border", i)],
"--n-border-hover": e[(0, r.createKey)("borderHover", i)],
"--n-border-pressed": e[(0, r.createKey)("borderPressed", i)],
"--n-border-focus": e[(0, r.createKey)("borderFocus", i)],
"--n-border-disabled": e[(0, r.createKey)("borderDisabled", i)]
};
const { [(0, r.createKey)("height", B)]: ue, [(0, r.createKey)("fontSize", B)]: ze, [(0, r.createKey)("padding", B)]: Be, [(0, r.createKey)("paddingRound", B)]: Me, [(0, r.createKey)("iconSize", B)]: Ke, [(0, r.createKey)("borderRadius", B)]: Ie, [(0, r.createKey)("iconMargin", B)]: Fe, waveOpacity: Oe } = e, Ge = {
"--n-width": ce && !F ? ue : "initial",
"--n-height": F ? "initial" : ue,
"--n-font-size": ze,
"--n-padding": ce || F ? "initial" : he ? Me : Be,
"--n-icon-size": Ke,
"--n-icon-margin": Fe,
"--n-border-radius": F ? "initial" : ce || he ? ue : Ie
};
return Object.assign(Object.assign(Object.assign(Object.assign({ "--n-bezier": b, "--n-bezier-ease-out": $, "--n-ripple-duration": V, "--n-opacity-disabled": L, "--n-wave-opacity": Oe }, De), d), de), Ge);
}), I = H ? (0, O.useThemeClass)("button", (0, a.computed)(() => {
let l = "";
const { dashed: b, type: $, ghost: e, text: V, color: L, round: le, circle: se, textColor: B, secondary: ie, tertiary: G, quaternary: ae, strong: F } = o;
b && (l += "a"), e && (l += "b"), V && (l += "c"), le && (l += "d"), se && (l += "e"), ie && (l += "f"), G && (l += "g"), ae && (l += "h"), F && (l += "i"), L && (l += `j${(0, r.color2Class)(L)}`), B && (l += `k${(0, r.color2Class)(B)}`);
const { value: c } = _;
return l += `l${c[0]}`, l += `m${$[0]}`, l;
}), N, o) : void 0;
return {
selfElRef: C,
waveElRef: s,
mergedClsPrefix: K,
mergedFocusable: S,
mergedSize: _,
showBorder: y,
enterPressed: f,
rtlEnabled: Q,
handleMousedown: W,
handleKeydown: j,
handleBlur: z,
handleKeyup: D,
handleClick: w,
customColorCssVars: (0, a.computed)(() => {
const { color: l } = o;
if (!l)
return null;
const b = (0, g.createHoverColor)(l);
return {
"--n-border-color": l,
"--n-border-color-hover": b,
"--n-border-color-pressed": (0, g.createPressedColor)(l),
"--n-border-color-focus": b,
"--n-border-color-disabled": l
};
}),
cssVars: H ? void 0 : N,
themeClass: I == null ? void 0 : I.themeClass,
onRender: I == null ? void 0 : I.onRender
};
},
render() {
const { mergedClsPrefix: o, tag: C, onRender: s } = this;
s == null || s();
const f = (0, r.resolveWrappedSlot)(this.$slots.default, (y) => y && (0, a.h)("span", { class: `${o}-button__content` }, y));
return (0, a.h)(
C,
{ ref: "selfElRef", class: [
this.themeClass,
`${o}-button`,
`${o}-button--${this.type}-type`,
`${o}-button--${this.mergedSize}-type`,
this.rtlEnabled && `${o}-button--rtl`,
this.disabled && `${o}-button--disabled`,
this.block && `${o}-button--block`,
this.enterPressed && `${o}-button--pressed`,
!this.text && this.dashed && `${o}-button--dashed`,
this.color && `${o}-button--color`,
this.secondary && `${o}-button--secondary`,
this.loading && `${o}-button--loading`,
this.ghost && `${o}-button--ghost`
// required for button group border collapse
], tabindex: this.mergedFocusable ? 0 : -1, type: this.attrType, style: this.cssVars, disabled: this.disabled, onClick: this.handleClick, onBlur: this.handleBlur, onMousedown: this.handleMousedown, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown },
this.iconPlacement === "right" && f,
(0, a.h)(p.NFadeInExpandTransition, { width: !0 }, {
default: () => (0, r.resolveWrappedSlot)(this.$slots.icon, (y) => (this.loading || this.renderIcon || y) && (0, a.h)(
"span",
{ class: `${o}-button__icon`, style: {
margin: (0, r.isSlotEmpty)(this.$slots.default) ? "0" : ""
} },
(0, a.h)(p.NIconSwitchTransition, null, {
default: () => this.loading ? (0, a.h)(p.NBaseLoading, { clsPrefix: o, key: "loading", class: `${o}-icon-slot`, strokeWidth: 20 }) : (0, a.h)("div", { key: "icon", class: `${o}-icon-slot`, role: "none" }, this.renderIcon ? this.renderIcon() : y)
})
))
}),
this.iconPlacement === "left" && f,
this.text ? null : (0, a.h)(p.NBaseWave, { ref: "waveElRef", clsPrefix: o }),
this.showBorder ? (0, a.h)("div", { "aria-hidden": !0, class: `${o}-button__border`, style: this.customColorCssVars }) : null,
this.showBorder ? (0, a.h)("div", { "aria-hidden": !0, class: `${o}-button__state-border`, style: this.customColorCssVars }) : null
);
}
});
n.default = T, n.XButton = T;
})(_e);
(function(n) {
var h = M && M.__importDefault || function(E) {
return E && E.__esModule ? E : { default: E };
};
Object.defineProperty(n, "__esModule", { value: !0 }), n.NxButton = n.NButton = n.buttonProps = void 0;
var P = _e;
Object.defineProperty(n, "buttonProps", { enumerable: !0, get: function() {
return P.buttonProps;
} }), Object.defineProperty(n, "NButton", { enumerable: !0, get: function() {
return h(P).default;
} }), Object.defineProperty(n, "NxButton", { enumerable: !0, get: function() {
return P.XButton;
} });
})(Ve);
export {
Ve as b,
ee as r,
Te as s
};