@phila/phila-ui-radio 0.0.6 → 0.0.10

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/README.md CHANGED
@@ -1,16 +1,30 @@
1
- # Radio component
1
+ ## Usage
2
2
 
3
- ## Create a new local build
3
+ #### Import single component...
4
4
 
5
- In src/components/COMPONENT_NAME:
5
+ ```js
6
+ import { Radio } from '@phila/phila-ui';
6
7
 
7
- ```
8
- npm run build
9
- npm pack
8
+ //register it locally...
9
+ components: {
10
+ Radio,
11
+ }
12
+
13
+ //... or register it globally
14
+ Vue.component('radio', Radio);
10
15
  ```
11
16
 
12
- copy .tgz file to project and run:
17
+ #### or import the whole library,
13
18
 
19
+ ```js
20
+ import * as PhilaUI from "@phila/phila-ui";
21
+
22
+ //register it globally
23
+ Vue.use(PhilaUI);
14
24
  ```
15
- npm install COMPONENT_NAME*.tgz
16
- ```
25
+
26
+ #### then use it in the vue template
27
+
28
+ ```html
29
+ <radio></radio>
30
+ ```
package/dist/Radio.js CHANGED
@@ -1,23 +1,21 @@
1
- import { defineComponent as B, getCurrentInstance as O, ref as I, 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";
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 = /* @__PURE__ */ a("span", { class: "icon" }, [
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
- }, A = {
9
+ }, q = {
12
10
  key: 0,
13
11
  class: "is-field-info"
14
- }, F = ["id"], H = ["id", "aria-checked", "name", "value"], L = ["for"], { formHelpers: g } = R, { randomID: M } = g, j = {
12
+ }, A = ["id"], F = ["id", "aria-checked", "name", "value"], H = ["for"], { formHelpers: g } = R, { randomID: L } = g, M = {
15
13
  inheritAttrs: !1
16
- }, Q = /* @__PURE__ */ B({
17
- ...j,
14
+ }, J = /* @__PURE__ */ O({
15
+ ...M,
18
16
  __name: "Radio",
19
17
  props: {
20
- id: { default: M() },
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 = $, p = V, y = O(), { error: m, classes: b, optionText: C, optionValue: c } = g.useInput.useInputComposable(y, r), i = I(r.modelValue);
44
- N(
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
- p("change", e), p("update:modelValue", i.value);
49
+ m("change", e), m("update:modelValue", i.value);
52
50
  };
53
- return (e, f) => (o(), l("div", {
54
- class: S(["input-wrap input-radio", [s(b), r.small && "small-checkradio"]])
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 ? (o(), l(u, { key: 0 }, [
59
- w(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
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(m) ? (o(), l("div", T, [
63
- U,
64
- a("span", null, n(s(m)), 1)
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 ? (o(), l("div", q, n(e.desc), 1)) : (o(), l(u, { key: 2 }, [
67
- e.$slots.desc ? (o(), l("div", A, [
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: D(`columns: ${e.numOfColumns} auto`),
73
+ style: P(`columns: ${e.numOfColumns} auto`),
74
74
  role: "radiogroup"
75
75
  }, [
76
- (o(!0), l(u, null, P(e.options, (d, t) => (o(), l("div", {
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": f[0] || (f[0] = (_) => i.value = _),
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(c)(d, t),
85
+ "aria-checked": e.modelValue === s(f)(u, t),
86
86
  name: `rd-${t}-${e.id}`,
87
87
  class: "is-checkradio",
88
- value: s(c)(d, t),
88
+ value: s(f)(u, t),
89
89
  ref_for: !0
90
- }, e.$attrs, { onChange: k }), null, 16, H), [
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)(d)), 9, L)
95
+ }, n(s(C)(u)), 9, H)
96
96
  ]))), 128))
97
- ], 12, F)
97
+ ], 12, A)
98
98
  ])
99
99
  ], 2));
100
100
  }
101
101
  });
102
102
  export {
103
- Q as default
103
+ J as default
104
104
  };
@@ -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=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},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(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]=b=>a.value=b),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))}})});
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))}})});
@@ -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
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
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.6",
4
+ "version": "0.0.10",
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.21",
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.2.2",
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": "^1.8.22"
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": "62924e3ac0fd1187900911ff3346a09929ec5aa3"
46
+ "gitHead": "f00518592815b1bf558d88f77fc4b6b3a30296e5"
47
47
  }