@kiva/kv-components 10.2.1 → 10.3.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/vue/KvSwitch.js +19 -15
- package/dist/vue/KvSwitch.vue.d.ts +13 -0
- package/dist/vue/KvSwitch2.js +42 -26
- package/package.json +2 -2
package/dist/vue/KvSwitch.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { openBlock as
|
|
1
|
+
import n from "./KvSwitch2.js";
|
|
2
|
+
import { openBlock as a, createElementBlock as c, normalizeStyle as d, normalizeClass as i, createElementVNode as t, mergeProps as w, toHandlers as f, withModifiers as u, renderSlot as h } from "vue";
|
|
3
3
|
import m from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const b = ["for"], v = ["id", "checked", "disabled"],
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
class:
|
|
4
|
+
const b = ["for"], v = ["id", "checked", "disabled"], g = { class: "tw-flex-1 peer-focus-visible:tw-ring-2 peer-focus-visible:tw-ring-action" };
|
|
5
|
+
function _(r, o, l, e, p, k) {
|
|
6
|
+
return a(), c("div", {
|
|
7
|
+
class: i(e.classes),
|
|
8
8
|
style: d(e.styles)
|
|
9
9
|
}, [
|
|
10
|
-
|
|
11
|
-
class:
|
|
10
|
+
t("label", {
|
|
11
|
+
class: i(["tw-inline-flex tw-gap-2 tw-items-center tw-relative hover:tw-cursor-pointer", { "tw-opacity-low": l.disabled }]),
|
|
12
12
|
for: e.uuid
|
|
13
13
|
}, [
|
|
14
|
-
|
|
14
|
+
t("input", w({ id: e.uuid }, e.inputAttrs, {
|
|
15
15
|
ref: "switchRef",
|
|
16
16
|
class: "tw-sr-only tw-peer",
|
|
17
17
|
type: "checkbox",
|
|
@@ -19,17 +19,21 @@ function g(o, t, l, e, k, x) {
|
|
|
19
19
|
checked: l.modelValue,
|
|
20
20
|
disabled: l.disabled
|
|
21
21
|
}, f(e.inputListeners, !0), {
|
|
22
|
-
onChange:
|
|
22
|
+
onChange: o[0] || (o[0] = u((...s) => e.onChange && e.onChange(...s), ["prevent"]))
|
|
23
23
|
}), null, 16, v),
|
|
24
|
-
t
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
t("div", {
|
|
25
|
+
class: i(["tw-rounded-full tw-relative tw-overflow-hidden peer-focus-visible:tw-ring-2 peer-focus-visible:tw-ring-action tw-bg-tertiary peer-checked:tw-bg-action tw-transition-all tw-ease-in-out", e.trackSizeClasses])
|
|
26
|
+
}, null, 2),
|
|
27
|
+
t("div", {
|
|
28
|
+
class: i(["tw-flex-shrink-0 tw-absolute tw-m-0.5 tw-top-0 tw-rounded-full tw-bg-white tw-transform tw-transition-all tw-ease-in-out", e.knobSizeClasses])
|
|
29
|
+
}, null, 2),
|
|
30
|
+
t("div", g, [
|
|
31
|
+
h(r.$slots, "default")
|
|
28
32
|
])
|
|
29
33
|
], 10, b)
|
|
30
34
|
], 6);
|
|
31
35
|
}
|
|
32
|
-
const S = /* @__PURE__ */ m(
|
|
36
|
+
const S = /* @__PURE__ */ m(n, [["render", _]]);
|
|
33
37
|
export {
|
|
34
38
|
S as default
|
|
35
39
|
};
|
|
@@ -7,6 +7,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
7
7
|
type: BooleanConstructor;
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
|
+
size: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
validator(value: string): boolean;
|
|
14
|
+
};
|
|
10
15
|
}>, {
|
|
11
16
|
uuid: import('vue').Ref<string, string>;
|
|
12
17
|
onChange: (event: any) => void;
|
|
@@ -16,6 +21,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
16
21
|
styles: any[];
|
|
17
22
|
inputAttrs: any;
|
|
18
23
|
inputListeners: any;
|
|
24
|
+
trackSizeClasses: import('vue').ComputedRef<"tw-w-6 tw-h-3.5" | "tw-w-7 tw-h-4">;
|
|
25
|
+
knobSizeClasses: import('vue').ComputedRef<"tw-w-2.5 tw-h-2.5 peer-checked:tw-translate-x-2.5" | "tw-w-3 tw-h-3 peer-checked:tw-translate-x-3">;
|
|
19
26
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, string[], string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
20
27
|
modelValue: {
|
|
21
28
|
type: BooleanConstructor;
|
|
@@ -25,10 +32,16 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
25
32
|
type: BooleanConstructor;
|
|
26
33
|
default: boolean;
|
|
27
34
|
};
|
|
35
|
+
size: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
validator(value: string): boolean;
|
|
39
|
+
};
|
|
28
40
|
}>> & Readonly<{
|
|
29
41
|
[x: `on${Capitalize<string>}`]: (...args: any[]) => any;
|
|
30
42
|
}>, {
|
|
31
43
|
disabled: boolean;
|
|
44
|
+
size: string;
|
|
32
45
|
modelValue: boolean;
|
|
33
46
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
34
47
|
export default _default;
|
package/dist/vue/KvSwitch2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as o, onMounted as
|
|
2
|
-
import { nanoid as
|
|
1
|
+
import { ref as a, computed as o, onMounted as z } from "vue";
|
|
2
|
+
import { nanoid as u } from "nanoid";
|
|
3
3
|
import { useAttrs as V } from "../utils/attrs.js";
|
|
4
|
-
const
|
|
4
|
+
const n = [
|
|
5
5
|
"update:modelValue"
|
|
6
6
|
], A = {
|
|
7
7
|
inheritAttrs: !1,
|
|
@@ -24,33 +24,49 @@ const u = [
|
|
|
24
24
|
disabled: {
|
|
25
25
|
type: Boolean,
|
|
26
26
|
default: !1
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Size of the switch.
|
|
30
|
+
* `default` renders a 56x32px track (`tw-w-7 tw-h-4`) with a 24px
|
|
31
|
+
* knob (`tw-w-3 tw-h-3`) travelling 24px when checked.
|
|
32
|
+
* `small` renders a 48x28px track (`tw-w-6 tw-h-3.5`) with a 20px
|
|
33
|
+
* knob (`tw-w-2.5 tw-h-2.5`) travelling 20px when checked.
|
|
34
|
+
*/
|
|
35
|
+
size: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "default",
|
|
38
|
+
validator(e) {
|
|
39
|
+
return ["default", "small"].includes(e);
|
|
40
|
+
}
|
|
27
41
|
}
|
|
28
42
|
},
|
|
29
|
-
emits:
|
|
30
|
-
setup(
|
|
31
|
-
const { emit:
|
|
32
|
-
classes:
|
|
33
|
-
styles:
|
|
34
|
-
inputAttrs:
|
|
35
|
-
inputListeners:
|
|
36
|
-
} = V(
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
43
|
+
emits: n,
|
|
44
|
+
setup(e, t) {
|
|
45
|
+
const { emit: r } = t, s = a(`kvs-${u(10)}`), l = a(null), {
|
|
46
|
+
classes: d,
|
|
47
|
+
styles: c,
|
|
48
|
+
inputAttrs: i,
|
|
49
|
+
inputListeners: m
|
|
50
|
+
} = V(t, n), p = o(() => e.size === "small" ? "tw-w-6 tw-h-3.5" : "tw-w-7 tw-h-4"), f = o(() => e.size === "small" ? "tw-w-2.5 tw-h-2.5 peer-checked:tw-translate-x-2.5" : "tw-w-3 tw-h-3 peer-checked:tw-translate-x-3"), w = (v) => {
|
|
51
|
+
r("update:modelValue", v.target.checked);
|
|
52
|
+
}, h = () => {
|
|
53
|
+
l.value.focus();
|
|
54
|
+
}, k = () => {
|
|
55
|
+
l.value.blur();
|
|
42
56
|
};
|
|
43
|
-
return
|
|
44
|
-
|
|
57
|
+
return z(() => {
|
|
58
|
+
s.value = `kvs-${u(10)}`;
|
|
45
59
|
}), {
|
|
46
|
-
uuid:
|
|
47
|
-
onChange:
|
|
48
|
-
focus:
|
|
49
|
-
blur:
|
|
50
|
-
classes:
|
|
51
|
-
styles:
|
|
52
|
-
inputAttrs:
|
|
53
|
-
inputListeners:
|
|
60
|
+
uuid: s,
|
|
61
|
+
onChange: w,
|
|
62
|
+
focus: h,
|
|
63
|
+
blur: k,
|
|
64
|
+
classes: d,
|
|
65
|
+
styles: c,
|
|
66
|
+
inputAttrs: i,
|
|
67
|
+
inputListeners: m,
|
|
68
|
+
trackSizeClasses: p,
|
|
69
|
+
knobSizeClasses: f
|
|
54
70
|
};
|
|
55
71
|
}
|
|
56
72
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"fuse.js": "^7.1.0"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "85947c6f6991c7ef893d142a4aac78afe3017d06"
|
|
116
116
|
}
|