@phila/phila-ui-radio 0.0.2 → 0.0.4
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/Radio.vue.d.ts +3 -3
- package/dist/radio.js +46 -46
- package/dist/radio.umd.cjs +1 -1
- package/dist/types.d.ts +10 -9
- package/package.json +2 -2
package/dist/Radio.vue.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
6
6
|
errors(): never[];
|
|
7
7
|
label: string;
|
|
8
8
|
desc: string;
|
|
9
|
-
modelValue:
|
|
9
|
+
modelValue: string;
|
|
10
10
|
valueKey: string;
|
|
11
11
|
textKey: string;
|
|
12
12
|
numOfColumns: number;
|
|
@@ -24,7 +24,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
24
24
|
errors(): never[];
|
|
25
25
|
label: string;
|
|
26
26
|
desc: string;
|
|
27
|
-
modelValue:
|
|
27
|
+
modelValue: string;
|
|
28
28
|
valueKey: string;
|
|
29
29
|
textKey: string;
|
|
30
30
|
numOfColumns: number;
|
|
@@ -45,7 +45,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
45
45
|
valueKey: string;
|
|
46
46
|
label: string;
|
|
47
47
|
desc: string;
|
|
48
|
-
modelValue:
|
|
48
|
+
modelValue: string | number | boolean;
|
|
49
49
|
numOfColumns: string | number;
|
|
50
50
|
small: boolean;
|
|
51
51
|
}, {}>, {
|
package/dist/radio.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as B, getCurrentInstance as I, ref as O, watch as N, openBlock as o, createElementBlock as l, normalizeClass as S, unref as s, createElementVNode as a, Fragment as u, createTextVNode as w, toDisplayString as n, renderSlot as h, createCommentVNode as v, normalizeStyle as D, renderList as P, withDirectives as z, mergeProps as E, vModelRadio as K } from "vue";
|
|
2
|
+
import R from "@phila/phila-ui-core";
|
|
3
|
+
const T = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "input-error-msg"
|
|
6
|
-
},
|
|
6
|
+
}, U = /* @__PURE__ */ a("span", { class: "icon" }, [
|
|
7
7
|
/* @__PURE__ */ a("i", { class: "fas fa-exclamation-circle" })
|
|
8
|
-
], -1),
|
|
8
|
+
], -1), q = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "is-field-info"
|
|
11
|
-
},
|
|
11
|
+
}, A = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "is-field-info"
|
|
14
|
-
},
|
|
14
|
+
}, F = ["id"], H = ["id", "aria-checked", "name", "value"], L = ["for"], { formHelpers: g } = R, { randomID: M } = g, j = {
|
|
15
15
|
inheritAttrs: !1
|
|
16
|
-
},
|
|
17
|
-
...
|
|
16
|
+
}, Q = /* @__PURE__ */ B({
|
|
17
|
+
...j,
|
|
18
18
|
__name: "Radio",
|
|
19
19
|
props: {
|
|
20
|
-
id: { default:
|
|
20
|
+
id: { default: M() },
|
|
21
21
|
errors: { default() {
|
|
22
22
|
return [];
|
|
23
23
|
} },
|
|
@@ -32,71 +32,71 @@ const A = {
|
|
|
32
32
|
imaskProps: {},
|
|
33
33
|
label: { default: "" },
|
|
34
34
|
desc: { default: "" },
|
|
35
|
-
modelValue: {
|
|
35
|
+
modelValue: { type: [String, Number, Boolean], default: "" },
|
|
36
36
|
numOfColumns: { default: 1 },
|
|
37
37
|
small: { type: Boolean, default: !1 }
|
|
38
38
|
},
|
|
39
39
|
emits: ["update:modelValue", "change"],
|
|
40
|
-
setup(
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
() =>
|
|
40
|
+
setup($, { emit: V }) {
|
|
41
|
+
const r = $, p = V, y = I(), { error: c, classes: C, optionText: k, optionValue: m } = g.useInput.useInputComposable(y, r), i = O(r.modelValue);
|
|
42
|
+
N(
|
|
43
|
+
() => r.modelValue,
|
|
44
44
|
(e) => {
|
|
45
|
-
|
|
45
|
+
i.value = e;
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
return (e,
|
|
52
|
-
class:
|
|
48
|
+
const b = (e) => {
|
|
49
|
+
p("change", e), p("update:modelValue", i.value);
|
|
50
|
+
};
|
|
51
|
+
return (e, f) => (o(), l("div", {
|
|
52
|
+
class: S(["input-wrap input-radio", [s(C), r.small && "small-checkradio"]])
|
|
53
53
|
}, [
|
|
54
54
|
a("fieldset", null, [
|
|
55
55
|
a("legend", null, [
|
|
56
56
|
e.label ? (o(), l(u, { key: 0 }, [
|
|
57
|
-
|
|
58
|
-
], 64)) :
|
|
57
|
+
w(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
|
|
58
|
+
], 64)) : h(e.$slots, "label", { key: 1 })
|
|
59
59
|
]),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
a("span", null,
|
|
63
|
-
])) :
|
|
64
|
-
e.desc ? (o(), l("div",
|
|
65
|
-
e.$slots.desc ? (o(), l("div",
|
|
66
|
-
|
|
67
|
-
])) :
|
|
60
|
+
s(c) ? (o(), l("div", T, [
|
|
61
|
+
U,
|
|
62
|
+
a("span", null, n(s(c)), 1)
|
|
63
|
+
])) : v("", !0),
|
|
64
|
+
e.desc ? (o(), l("div", q, n(e.desc), 1)) : (o(), l(u, { key: 2 }, [
|
|
65
|
+
e.$slots.desc ? (o(), l("div", A, [
|
|
66
|
+
h(e.$slots, "desc")
|
|
67
|
+
])) : v("", !0)
|
|
68
68
|
], 64)),
|
|
69
69
|
a("div", {
|
|
70
70
|
id: `rd-group-${e.id}`,
|
|
71
|
-
style:
|
|
71
|
+
style: D(`columns: ${e.numOfColumns} auto`),
|
|
72
72
|
role: "radiogroup"
|
|
73
73
|
}, [
|
|
74
|
-
(o(!0), l(u, null,
|
|
75
|
-
key:
|
|
74
|
+
(o(!0), l(u, null, P(e.options, (d, t) => (o(), l("div", {
|
|
75
|
+
key: t,
|
|
76
76
|
class: "control"
|
|
77
77
|
}, [
|
|
78
|
-
|
|
79
|
-
id: `rd-${
|
|
80
|
-
"onUpdate:modelValue":
|
|
78
|
+
z(a("input", E({
|
|
79
|
+
id: `rd-${t}-${e.id}`,
|
|
80
|
+
"onUpdate:modelValue": f[0] || (f[0] = (_) => i.value = _),
|
|
81
81
|
type: "radio",
|
|
82
82
|
role: "radio",
|
|
83
|
-
"aria-checked": e.modelValue ===
|
|
84
|
-
name: `rd-${
|
|
83
|
+
"aria-checked": e.modelValue === s(m)(d, t),
|
|
84
|
+
name: `rd-${t}-${e.id}`,
|
|
85
85
|
class: "is-checkradio",
|
|
86
|
-
value:
|
|
86
|
+
value: s(m)(d, t),
|
|
87
87
|
ref_for: !0
|
|
88
|
-
}, e.$attrs, { onChange:
|
|
89
|
-
[
|
|
88
|
+
}, e.$attrs, { onChange: b }), null, 16, H), [
|
|
89
|
+
[K, i.value]
|
|
90
90
|
]),
|
|
91
91
|
a("label", {
|
|
92
|
-
for: `rd-${
|
|
93
|
-
},
|
|
92
|
+
for: `rd-${t}-${e.id}`
|
|
93
|
+
}, n(s(k)(d)), 9, L)
|
|
94
94
|
]))), 128))
|
|
95
|
-
], 12,
|
|
95
|
+
], 12, F)
|
|
96
96
|
])
|
|
97
97
|
], 2));
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
export {
|
|
101
|
-
|
|
101
|
+
Q as default
|
|
102
102
|
};
|
package/dist/radio.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("vue"),require("@phila/phila-ui-core")):typeof define=="function"&&define.amd?define(["vue","@phila/phila-ui-core"],l):(e=typeof globalThis<"u"?globalThis:e||self,e.Radio=l(e.Vue,e.PhilaUICore))})(this,function(e,l){"use strict";const
|
|
1
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("vue"),require("@phila/phila-ui-core")):typeof define=="function"&&define.amd?define(["vue","@phila/phila-ui-core"],l):(e=typeof globalThis<"u"?globalThis:e||self,e.Radio=l(e.Vue,e.PhilaUICore))})(this,function(e,l){"use strict";const m={key:0,class:"input-error-msg"},f=e.createElementVNode("span",{class:"icon"},[e.createElementVNode("i",{class:"fas fa-exclamation-circle"})],-1),u={key:1,class:"is-field-info"},h={key:0,class:"is-field-info"},k=["id"],V=["id","aria-checked","name","value"],B=["for"],{formHelpers:s}=l,{randomID:g}=s,y={inheritAttrs:!1};return e.defineComponent({...y,__name:"Radio",props:{id:{default:g()},errors:{default(){return[]}},optgroup:{type:Boolean},options:{default:()=>({"option-1":"Option 1","option-2":"Option 2","option-3":"Option 3"})},textKey:{default:""},valueKey:{default:""},imaskProps:{},label:{default:""},desc:{default:""},modelValue:{type:[String,Number,Boolean],default:""},numOfColumns:{default:1},small:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(E,{emit:$}){const n=E,i=$,N=e.getCurrentInstance(),{error:d,classes:C,optionText:S,optionValue:c}=s.useInput.useInputComposable(N,n),a=e.ref(n.modelValue);e.watch(()=>n.modelValue,o=>{a.value=o});const _=o=>{i("change",o),i("update:modelValue",a.value)};return(o,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrap input-radio",[e.unref(C),n.small&&"small-checkradio"]])},[e.createElementVNode("fieldset",null,[e.createElementVNode("legend",null,[o.label?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(o.label)+" "+e.toDisplayString(o.$attrs.required!==void 0?"*":""),1)],64)):e.renderSlot(o.$slots,"label",{key:1})]),e.unref(d)?(e.openBlock(),e.createElementBlock("div",m,[f,e.createElementVNode("span",null,e.toDisplayString(e.unref(d)),1)])):e.createCommentVNode("",!0),o.desc?(e.openBlock(),e.createElementBlock("div",u,e.toDisplayString(o.desc),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[o.$slots.desc?(e.openBlock(),e.createElementBlock("div",h,[e.renderSlot(o.$slots,"desc")])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",{id:`rd-group-${o.id}`,style:e.normalizeStyle(`columns: ${o.numOfColumns} auto`),role:"radiogroup"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,(r,t)=>(e.openBlock(),e.createElementBlock("div",{key:t,class:"control"},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:`rd-${t}-${o.id}`,"onUpdate:modelValue":p[0]||(p[0]=D=>a.value=D),type:"radio",role:"radio","aria-checked":o.modelValue===e.unref(c)(r,t),name:`rd-${t}-${o.id}`,class:"is-checkradio",value:e.unref(c)(r,t),ref_for:!0},o.$attrs,{onChange:_}),null,16,V),[[e.vModelRadio,a.value]]),e.createElementVNode("label",{for:`rd-${t}-${o.id}`},e.toDisplayString(e.unref(S)(r)),9,B)]))),128))],12,k)])],2))}})});
|
package/dist/types.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import Radio from 'Radio.vue';
|
|
2
|
-
declare module '
|
|
1
|
+
import Radio from './Radio.vue';
|
|
2
|
+
declare module 'vue' {
|
|
3
3
|
interface GlobalComponents {
|
|
4
4
|
Radio: typeof Radio;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
export interface RadioProps {
|
|
8
|
-
label
|
|
9
|
-
desc
|
|
10
|
-
modelValue:
|
|
11
|
-
valueKey
|
|
12
|
-
textKey
|
|
13
|
-
numOfColumns
|
|
14
|
-
small
|
|
8
|
+
label?: string;
|
|
9
|
+
desc?: string;
|
|
10
|
+
modelValue: string | number | boolean;
|
|
11
|
+
valueKey?: string;
|
|
12
|
+
textKey?: string;
|
|
13
|
+
numOfColumns?: string | number;
|
|
14
|
+
small?: boolean;
|
|
15
15
|
options: object | Array<string | number | object>;
|
|
16
16
|
}
|
|
17
|
+
export default Radio;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-radio",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"registry": "https://registry.npmjs.com/",
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "17ea0e29f4566d58fe5eccba43c916d4453129ad"
|
|
47
47
|
}
|