mood-ui 0.5.0 → 0.5.1
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/mood-ui.cjs +2 -2
- package/dist/mood-ui.cjs.map +1 -1
- package/dist/mood-ui.css +1 -1
- package/dist/mood-ui.mjs +99 -42
- package/dist/mood-ui.mjs.map +1 -1
- package/package.json +1 -1
package/dist/mood-ui.mjs
CHANGED
|
@@ -9098,7 +9098,7 @@ var Rr = [
|
|
|
9098
9098
|
"tabindex",
|
|
9099
9099
|
"onClick",
|
|
9100
9100
|
"onKeydown"
|
|
9101
|
-
], Wo = { key: 1 }, Go = /* @__PURE__ */ f({
|
|
9101
|
+
], Wo = { key: 1 }, Go = /* @__PURE__ */ dn(/* @__PURE__ */ f({
|
|
9102
9102
|
__name: "Segmented",
|
|
9103
9103
|
props: {
|
|
9104
9104
|
items: {},
|
|
@@ -9118,60 +9118,107 @@ var Rr = [
|
|
|
9118
9118
|
},
|
|
9119
9119
|
emits: ["update:modelValue", "change"],
|
|
9120
9120
|
setup(t, { emit: n }) {
|
|
9121
|
-
let r = t,
|
|
9122
|
-
function
|
|
9121
|
+
let r = t, l = n, u = Pt(() => r.size), d = Nt(() => r.radius), f = Mt(() => r.color), p = O(null), m = O(null), h = O([]);
|
|
9122
|
+
function g(e, t) {
|
|
9123
|
+
h.value[t] = e;
|
|
9124
|
+
}
|
|
9125
|
+
let y = O({
|
|
9126
|
+
transform: "translate3d(0,0,0)",
|
|
9127
|
+
width: "0px",
|
|
9128
|
+
height: "0px",
|
|
9129
|
+
opacity: "0"
|
|
9130
|
+
}), C = !1;
|
|
9131
|
+
function w(e = !0) {
|
|
9132
|
+
let t = r.items.findIndex((e) => e.value === r.modelValue), n = h.value[t];
|
|
9133
|
+
if (!n) return;
|
|
9134
|
+
let i = n.offsetWidth, a = n.offsetHeight;
|
|
9135
|
+
if (i === 0 && a === 0) return;
|
|
9136
|
+
let o = m.value;
|
|
9137
|
+
!e && o && (o.classList.add("segmented-indicator--no-anim"), requestAnimationFrame(() => {
|
|
9138
|
+
requestAnimationFrame(() => o.classList.remove("segmented-indicator--no-anim"));
|
|
9139
|
+
})), y.value = {
|
|
9140
|
+
transform: `translate3d(${n.offsetLeft}px, ${n.offsetTop}px, 0)`,
|
|
9141
|
+
width: `${i}px`,
|
|
9142
|
+
height: `${a}px`,
|
|
9143
|
+
top: "0",
|
|
9144
|
+
opacity: "1"
|
|
9145
|
+
}, C = !0;
|
|
9146
|
+
}
|
|
9147
|
+
let E = null;
|
|
9148
|
+
S(() => {
|
|
9149
|
+
requestAnimationFrame(() => {
|
|
9150
|
+
requestAnimationFrame(() => w(!1));
|
|
9151
|
+
}), typeof ResizeObserver < "u" && p.value && (E = new ResizeObserver(() => w(C)), E.observe(p.value)), typeof window < "u" && window.addEventListener("resize", D);
|
|
9152
|
+
}), x(() => {
|
|
9153
|
+
E?.disconnect(), E = null, typeof window < "u" && window.removeEventListener("resize", D);
|
|
9154
|
+
});
|
|
9155
|
+
function D() {
|
|
9156
|
+
w(!1);
|
|
9157
|
+
}
|
|
9158
|
+
U(() => [
|
|
9159
|
+
r.modelValue,
|
|
9160
|
+
u.value,
|
|
9161
|
+
d.value,
|
|
9162
|
+
f.value,
|
|
9163
|
+
r.fullWidth,
|
|
9164
|
+
r.items.length
|
|
9165
|
+
], () => _(() => w(C)));
|
|
9166
|
+
function A(e) {
|
|
9123
9167
|
return r.modelValue === e.value;
|
|
9124
9168
|
}
|
|
9125
|
-
function
|
|
9126
|
-
e.disabled || r.disabled ||
|
|
9169
|
+
function j(e) {
|
|
9170
|
+
e.disabled || r.disabled || A(e) || (l("update:modelValue", e.value), l("change", e.value));
|
|
9127
9171
|
}
|
|
9128
|
-
function
|
|
9129
|
-
r.disabled || (e.key === "ArrowRight" || e.key === "ArrowDown" ? (e.preventDefault(),
|
|
9172
|
+
function N(e, t) {
|
|
9173
|
+
r.disabled || (e.key === "ArrowRight" || e.key === "ArrowDown" ? (e.preventDefault(), F(t, 1)) : e.key === "ArrowLeft" || e.key === "ArrowUp" ? (e.preventDefault(), F(t, -1)) : (e.key === " " || e.key === "Enter") && (e.preventDefault(), j(t)));
|
|
9130
9174
|
}
|
|
9131
|
-
function
|
|
9175
|
+
function F(e, t) {
|
|
9132
9176
|
let n = r.items.filter((e) => !e.disabled);
|
|
9133
9177
|
if (n.length === 0) return;
|
|
9134
9178
|
let i = n[(n.findIndex((t) => t.value === e.value) + t + n.length) % n.length];
|
|
9135
|
-
i &&
|
|
9179
|
+
i && (j(i), _(() => {
|
|
9180
|
+
let e = r.items.findIndex((e) => e.value === i.value);
|
|
9181
|
+
h.value[e]?.focus();
|
|
9182
|
+
}));
|
|
9136
9183
|
}
|
|
9137
|
-
let
|
|
9138
|
-
switch (
|
|
9184
|
+
let I = i(() => {
|
|
9185
|
+
switch (u.value) {
|
|
9139
9186
|
case "small": return "h-7 px-2.5 text-xs";
|
|
9140
9187
|
case "large": return "h-10 px-4 text-base";
|
|
9141
9188
|
default: return "h-8 px-3 text-sm";
|
|
9142
9189
|
}
|
|
9143
|
-
}),
|
|
9144
|
-
switch (
|
|
9190
|
+
}), L = i(() => {
|
|
9191
|
+
switch (u.value) {
|
|
9145
9192
|
case "small": return "w-3.5 h-3.5";
|
|
9146
9193
|
case "large": return "w-5 h-5";
|
|
9147
9194
|
default: return "w-4 h-4";
|
|
9148
9195
|
}
|
|
9149
|
-
}),
|
|
9150
|
-
switch (
|
|
9196
|
+
}), R = i(() => {
|
|
9197
|
+
switch (d.value) {
|
|
9151
9198
|
case "none": return "rounded-none";
|
|
9152
9199
|
case "small": return "rounded";
|
|
9153
9200
|
case "large": return "rounded-xl";
|
|
9154
9201
|
case "full": return "rounded-full";
|
|
9155
9202
|
default: return "rounded-lg";
|
|
9156
9203
|
}
|
|
9157
|
-
}),
|
|
9158
|
-
switch (
|
|
9204
|
+
}), z = i(() => {
|
|
9205
|
+
switch (d.value) {
|
|
9159
9206
|
case "none": return "rounded-none";
|
|
9160
9207
|
case "small": return "rounded-[3px]";
|
|
9161
9208
|
case "large": return "rounded-lg";
|
|
9162
9209
|
case "full": return "rounded-full";
|
|
9163
9210
|
default: return "rounded-md";
|
|
9164
9211
|
}
|
|
9165
|
-
}),
|
|
9166
|
-
switch (
|
|
9167
|
-
case "primary": return "
|
|
9168
|
-
case "danger": return "
|
|
9169
|
-
case "success": return "
|
|
9170
|
-
case "warning": return "
|
|
9171
|
-
default: return "
|
|
9212
|
+
}), B = i(() => {
|
|
9213
|
+
switch (f.value) {
|
|
9214
|
+
case "primary": return "text-primary font-medium";
|
|
9215
|
+
case "danger": return "text-destructive font-medium";
|
|
9216
|
+
case "success": return "text-success font-medium";
|
|
9217
|
+
case "warning": return "text-warning font-medium";
|
|
9218
|
+
default: return "text-foreground font-medium";
|
|
9172
9219
|
}
|
|
9173
|
-
}),
|
|
9174
|
-
switch (
|
|
9220
|
+
}), V = i(() => {
|
|
9221
|
+
switch (f.value) {
|
|
9175
9222
|
case "primary": return "focus-visible:ring-primary";
|
|
9176
9223
|
case "danger": return "focus-visible:ring-destructive";
|
|
9177
9224
|
case "success": return "focus-visible:ring-success";
|
|
@@ -9180,44 +9227,54 @@ var Rr = [
|
|
|
9180
9227
|
}
|
|
9181
9228
|
});
|
|
9182
9229
|
return (n, r) => (T(), s("div", {
|
|
9230
|
+
ref_key: "trackEl",
|
|
9231
|
+
ref: p,
|
|
9183
9232
|
role: "radiogroup",
|
|
9184
9233
|
"aria-label": t.ariaLabel,
|
|
9185
9234
|
"aria-disabled": t.disabled || void 0,
|
|
9186
9235
|
class: v([
|
|
9187
9236
|
"relative inline-flex items-center p-1 bg-muted gap-0.5",
|
|
9188
|
-
|
|
9237
|
+
R.value,
|
|
9189
9238
|
t.fullWidth ? "w-full" : "",
|
|
9190
9239
|
t.disabled ? "opacity-60 pointer-events-none" : ""
|
|
9191
9240
|
])
|
|
9192
|
-
}, [(
|
|
9241
|
+
}, [c("span", {
|
|
9242
|
+
ref_key: "indicatorEl",
|
|
9243
|
+
ref: m,
|
|
9244
|
+
class: v(["segmented-indicator absolute pointer-events-none", [z.value, "bg-card shadow-sm"]]),
|
|
9245
|
+
style: b(y.value),
|
|
9246
|
+
"aria-hidden": "true"
|
|
9247
|
+
}, null, 6), (T(!0), s(e, null, k(t.items, (e, n) => (T(), s("button", {
|
|
9193
9248
|
key: e.value,
|
|
9249
|
+
ref_for: !0,
|
|
9250
|
+
ref: (e) => g(e, n),
|
|
9194
9251
|
type: "button",
|
|
9195
9252
|
role: "radio",
|
|
9196
|
-
"aria-checked":
|
|
9253
|
+
"aria-checked": A(e) ? "true" : "false",
|
|
9197
9254
|
"aria-label": e.ariaLabel ?? e.label,
|
|
9198
9255
|
"aria-disabled": e.disabled || void 0,
|
|
9199
9256
|
disabled: e.disabled || t.disabled,
|
|
9200
|
-
tabindex:
|
|
9257
|
+
tabindex: A(e) ? 0 : -1,
|
|
9201
9258
|
class: v([
|
|
9202
|
-
"relative inline-flex items-center justify-center gap-1.5 font-medium select-none whitespace-nowrap",
|
|
9259
|
+
"relative z-10 inline-flex items-center justify-center gap-1.5 font-medium select-none whitespace-nowrap",
|
|
9203
9260
|
"transition-colors duration-150 ease-out",
|
|
9204
9261
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-muted",
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9262
|
+
V.value,
|
|
9263
|
+
I.value,
|
|
9264
|
+
z.value,
|
|
9208
9265
|
t.fullWidth ? "flex-1" : "",
|
|
9209
9266
|
e.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
9210
|
-
|
|
9267
|
+
A(e) ? B.value : "text-muted-foreground hover:text-foreground"
|
|
9211
9268
|
]),
|
|
9212
|
-
onClick: (t) =>
|
|
9213
|
-
onKeydown: (t) =>
|
|
9269
|
+
onClick: (t) => j(e),
|
|
9270
|
+
onKeydown: (t) => N(t, e)
|
|
9214
9271
|
}, [e.icon ? (T(), a(M(e.icon), {
|
|
9215
9272
|
key: 0,
|
|
9216
|
-
class: v(
|
|
9273
|
+
class: v(L.value),
|
|
9217
9274
|
"aria-hidden": "true"
|
|
9218
9275
|
}, null, 8, ["class"])) : o("", !0), e.label ? (T(), s("span", Wo, P(e.label), 1)) : o("", !0)], 42, Uo))), 128))], 10, Ho));
|
|
9219
9276
|
}
|
|
9220
|
-
}), Ko = [
|
|
9277
|
+
}), [["__scopeId", "data-v-e2a0f99a"]]), Ko = [
|
|
9221
9278
|
"role",
|
|
9222
9279
|
"aria-label",
|
|
9223
9280
|
"aria-valuenow",
|
|
@@ -12627,7 +12684,7 @@ var Rr = [
|
|
|
12627
12684
|
]))), 128))])])], 12, Rc)) : o("", !0)]);
|
|
12628
12685
|
};
|
|
12629
12686
|
}
|
|
12630
|
-
}), [["__scopeId", "data-v-
|
|
12687
|
+
}), [["__scopeId", "data-v-301ec066"]]), Hc = ["aria-labelledby"], Uc = ["id"], Wc = {
|
|
12631
12688
|
key: 1,
|
|
12632
12689
|
"aria-hidden": "true",
|
|
12633
12690
|
class: "mx-2 my-1 h-px bg-border"
|
|
@@ -15546,7 +15603,7 @@ var mu = (e) => ({
|
|
|
15546
15603
|
}, 8, ["state", "style"])
|
|
15547
15604
|
], 34));
|
|
15548
15605
|
}
|
|
15549
|
-
}), [["__scopeId", "data-v-
|
|
15606
|
+
}), [["__scopeId", "data-v-9efb8568"]]);
|
|
15550
15607
|
//#endregion
|
|
15551
15608
|
//#region src/composables/useAutoScroll.ts
|
|
15552
15609
|
function Bu({ scrollRef: e, enabled: t, zone: n = 40, maxSpeed: r = 12 }) {
|
|
@@ -21350,7 +21407,7 @@ var Ef = ["aria-label"], Df = {
|
|
|
21350
21407
|
c("div", Lp, P(Et.value), 1)
|
|
21351
21408
|
], 38));
|
|
21352
21409
|
}
|
|
21353
|
-
}), [["__scopeId", "data-v-
|
|
21410
|
+
}), [["__scopeId", "data-v-a5b3a28f"]]), Vp = /* @__PURE__ */ f({
|
|
21354
21411
|
name: "TableColumn",
|
|
21355
21412
|
__isTableColumn: !0,
|
|
21356
21413
|
__name: "TableColumn",
|