@phila/phila-ui-radio 0.0.6 → 0.0.9
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.js +30 -30
- package/dist/Radio.umd.cjs +1 -1
- package/dist/Radio.vue.d.ts +5 -5
- package/package.json +5 -5
package/dist/Radio.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as O, getCurrentInstance as I, ref as N, watch as S, createElementBlock as o, openBlock as l, normalizeClass as w, unref as s, createElementVNode as a, createCommentVNode as v, renderSlot as h, Fragment as p, createTextVNode as D, toDisplayString as n, normalizeStyle as P, renderList as _, withDirectives as z, mergeProps as E, vModelRadio as K } from "vue";
|
|
2
2
|
import R from "@phila/phila-ui-core";
|
|
3
3
|
const T = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "input-error-msg"
|
|
6
|
-
}, U =
|
|
7
|
-
/* @__PURE__ */ a("i", { class: "fas fa-exclamation-circle" })
|
|
8
|
-
], -1), q = {
|
|
6
|
+
}, U = {
|
|
9
7
|
key: 1,
|
|
10
8
|
class: "is-field-info"
|
|
11
|
-
},
|
|
9
|
+
}, q = {
|
|
12
10
|
key: 0,
|
|
13
11
|
class: "is-field-info"
|
|
14
|
-
},
|
|
12
|
+
}, A = ["id"], F = ["id", "aria-checked", "name", "value"], H = ["for"], { formHelpers: g } = R, { randomID: L } = g, M = {
|
|
15
13
|
inheritAttrs: !1
|
|
16
|
-
},
|
|
17
|
-
...
|
|
14
|
+
}, J = /* @__PURE__ */ O({
|
|
15
|
+
...M,
|
|
18
16
|
__name: "Radio",
|
|
19
17
|
props: {
|
|
20
|
-
id: { default:
|
|
18
|
+
id: { default: L() },
|
|
21
19
|
errors: { default() {
|
|
22
20
|
return [];
|
|
23
21
|
} },
|
|
@@ -40,65 +38,67 @@ const T = {
|
|
|
40
38
|
},
|
|
41
39
|
emits: ["update:modelValue", "change"],
|
|
42
40
|
setup($, { emit: V }) {
|
|
43
|
-
const r = $,
|
|
44
|
-
|
|
41
|
+
const r = $, m = V, y = I(), { error: c, classes: b, optionText: C, optionValue: f } = g.useInput.useInputComposable(y, r), i = N(r.modelValue);
|
|
42
|
+
S(
|
|
45
43
|
() => r.modelValue,
|
|
46
44
|
(e) => {
|
|
47
45
|
i.value = e;
|
|
48
46
|
}
|
|
49
47
|
);
|
|
50
48
|
const k = (e) => {
|
|
51
|
-
|
|
49
|
+
m("change", e), m("update:modelValue", i.value);
|
|
52
50
|
};
|
|
53
|
-
return (e,
|
|
54
|
-
class:
|
|
51
|
+
return (e, d) => (l(), o("div", {
|
|
52
|
+
class: w(["input-wrap input-radio", [s(b), r.small && "small-checkradio"]])
|
|
55
53
|
}, [
|
|
56
54
|
a("fieldset", null, [
|
|
57
55
|
a("legend", null, [
|
|
58
|
-
e.label ? (
|
|
59
|
-
|
|
56
|
+
e.label ? (l(), o(p, { key: 0 }, [
|
|
57
|
+
D(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
|
|
60
58
|
], 64)) : h(e.$slots, "label", { key: 1 })
|
|
61
59
|
]),
|
|
62
|
-
s(
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
s(c) ? (l(), o("div", T, [
|
|
61
|
+
d[1] || (d[1] = a("span", { class: "icon" }, [
|
|
62
|
+
a("i", { class: "fas fa-exclamation-circle" })
|
|
63
|
+
], -1)),
|
|
64
|
+
a("span", null, n(s(c)), 1)
|
|
65
65
|
])) : v("", !0),
|
|
66
|
-
e.desc ? (
|
|
67
|
-
e.$slots.desc ? (
|
|
66
|
+
e.desc ? (l(), o("div", U, n(e.desc), 1)) : (l(), o(p, { key: 2 }, [
|
|
67
|
+
e.$slots.desc ? (l(), o("div", q, [
|
|
68
68
|
h(e.$slots, "desc")
|
|
69
69
|
])) : v("", !0)
|
|
70
70
|
], 64)),
|
|
71
71
|
a("div", {
|
|
72
72
|
id: `rd-group-${e.id}`,
|
|
73
|
-
style:
|
|
73
|
+
style: P(`columns: ${e.numOfColumns} auto`),
|
|
74
74
|
role: "radiogroup"
|
|
75
75
|
}, [
|
|
76
|
-
(
|
|
76
|
+
(l(!0), o(p, null, _(e.options, (u, t) => (l(), o("div", {
|
|
77
77
|
key: t,
|
|
78
78
|
class: "control"
|
|
79
79
|
}, [
|
|
80
80
|
z(a("input", E({
|
|
81
81
|
id: `rd-${t}-${e.id}`,
|
|
82
|
-
"onUpdate:modelValue":
|
|
82
|
+
"onUpdate:modelValue": d[0] || (d[0] = (B) => i.value = B),
|
|
83
83
|
type: "radio",
|
|
84
84
|
role: "radio",
|
|
85
|
-
"aria-checked": e.modelValue === s(
|
|
85
|
+
"aria-checked": e.modelValue === s(f)(u, t),
|
|
86
86
|
name: `rd-${t}-${e.id}`,
|
|
87
87
|
class: "is-checkradio",
|
|
88
|
-
value: s(
|
|
88
|
+
value: s(f)(u, t),
|
|
89
89
|
ref_for: !0
|
|
90
|
-
}, e.$attrs, { onChange: k }), null, 16,
|
|
90
|
+
}, e.$attrs, { onChange: k }), null, 16, F), [
|
|
91
91
|
[K, i.value]
|
|
92
92
|
]),
|
|
93
93
|
a("label", {
|
|
94
94
|
for: `rd-${t}-${e.id}`
|
|
95
|
-
}, n(s(C)(
|
|
95
|
+
}, n(s(C)(u)), 9, H)
|
|
96
96
|
]))), 128))
|
|
97
|
-
], 12,
|
|
97
|
+
], 12, A)
|
|
98
98
|
])
|
|
99
99
|
], 2));
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
export {
|
|
103
|
-
|
|
103
|
+
J as default
|
|
104
104
|
};
|
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 m={key:0,class:"input-error-msg"},f=
|
|
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={key:1,class:"is-field-info"},u={key:0,class:"is-field-info"},k=["id"],h=["id","aria-checked","name","value"],V=["for"],{formHelpers:i}=l,{randomID:B}=i,g={inheritAttrs:!1};return e.defineComponent({...g,__name:"Radio",props:{id:{default:B()},errors:{default(){return[]}},optgroup:{type:Boolean},disableableOptions:{type:Boolean},options:{default:()=>({"option-1":"Option 1","option-2":"Option 2","option-3":"Option 3"})},name:{},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(y,{emit:E}){const n=y,d=E,$=e.getCurrentInstance(),{error:c,classes:N,optionText:C,optionValue:p}=i.useInput.useInputComposable($,n),a=e.ref(n.modelValue);e.watch(()=>n.modelValue,o=>{a.value=o});const S=o=>{d("change",o),d("update:modelValue",a.value)};return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrap input-radio",[e.unref(N),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(c)?(e.openBlock(),e.createElementBlock("div",m,[r[1]||(r[1]=e.createElementVNode("span",{class:"icon"},[e.createElementVNode("i",{class:"fas fa-exclamation-circle"})],-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(c)),1)])):e.createCommentVNode("",!0),o.desc?(e.openBlock(),e.createElementBlock("div",f,e.toDisplayString(o.desc),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[o.$slots.desc?(e.openBlock(),e.createElementBlock("div",u,[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,(s,t)=>(e.openBlock(),e.createElementBlock("div",{key:t,class:"control"},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:`rd-${t}-${o.id}`,"onUpdate:modelValue":r[0]||(r[0]=b=>a.value=b),type:"radio",role:"radio","aria-checked":o.modelValue===e.unref(p)(s,t),name:`rd-${t}-${o.id}`,class:"is-checkradio",value:e.unref(p)(s,t),ref_for:!0},o.$attrs,{onChange:S}),null,16,h),[[e.vModelRadio,a.value]]),e.createElementVNode("label",{for:`rd-${t}-${o.id}`},e.toDisplayString(e.unref(C)(s)),9,V)]))),128))],12,k)])],2))}})});
|
package/dist/Radio.vue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputProps } from '@phila/phila-ui-core';
|
|
2
2
|
import { RadioProps } from './types';
|
|
3
3
|
|
|
4
|
-
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
|
|
5
5
|
id: any;
|
|
6
6
|
errors(): never[];
|
|
7
7
|
label: string;
|
|
@@ -16,7 +16,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
16
16
|
"option-2": string;
|
|
17
17
|
"option-3": string;
|
|
18
18
|
};
|
|
19
|
-
}
|
|
19
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
20
20
|
"update:modelValue": (...args: any[]) => void;
|
|
21
21
|
change: (...args: any[]) => void;
|
|
22
22
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
|
|
@@ -34,10 +34,10 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
34
34
|
"option-2": string;
|
|
35
35
|
"option-3": string;
|
|
36
36
|
};
|
|
37
|
-
}>>> & {
|
|
37
|
+
}>>> & Readonly<{
|
|
38
38
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
39
39
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
40
|
-
}
|
|
40
|
+
}>, {
|
|
41
41
|
id: string;
|
|
42
42
|
errors: import('@phila/phila-ui-core').InputErrors;
|
|
43
43
|
options: (import('@phila/phila-ui-core').HTMLInputValue[] | import('@phila/phila-ui-core').InputOptions | import('@phila/phila-ui-core').InputOptions[] | import('@phila/phila-ui-core').InputOptionsGroup | import('@phila/phila-ui-core').InputOptionObject[] | undefined) & (object | (string | number | object)[]);
|
|
@@ -48,7 +48,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
48
48
|
modelValue: string | number | boolean;
|
|
49
49
|
numOfColumns: string | number;
|
|
50
50
|
small: boolean;
|
|
51
|
-
}, {}>, {
|
|
51
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, {
|
|
52
52
|
label?(_: {}): any;
|
|
53
53
|
desc?(_: {}): any;
|
|
54
54
|
}>;
|
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.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"preview": "vite preview"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@phila/phila-ui-core": "^1.0.
|
|
28
|
+
"@phila/phila-ui-core": "^1.0.24",
|
|
29
29
|
"bulma": "^0.9.4",
|
|
30
30
|
"vue": "^3.3.8"
|
|
31
31
|
},
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"@types/node": "^20.10.3",
|
|
34
34
|
"@vitejs/plugin-vue": "^4.5.0",
|
|
35
35
|
"sass": "^1.69.5",
|
|
36
|
-
"typescript": "^5.
|
|
36
|
+
"typescript": "^5.8.2",
|
|
37
37
|
"vite": "^5.0.0",
|
|
38
38
|
"vite-plugin-dts": "^3.6.4",
|
|
39
39
|
"vite-plugin-lib-inject-css": "^1.3.0",
|
|
40
|
-
"vue-tsc": "^
|
|
40
|
+
"vue-tsc": "^2.2.8"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"registry": "https://registry.npmjs.com/",
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "09f2b67c1d3db773c813231e21b62b37e34aefbd"
|
|
47
47
|
}
|