@phila/phila-ui-radio 0.0.4 → 0.0.6

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.
@@ -1,4 +1,4 @@
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";
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";
2
2
  import R from "@phila/phila-ui-core";
3
3
  const T = {
4
4
  key: 0,
@@ -22,11 +22,13 @@ const T = {
22
22
  return [];
23
23
  } },
24
24
  optgroup: { type: Boolean },
25
+ disableableOptions: { type: Boolean },
25
26
  options: { default: () => ({
26
27
  "option-1": "Option 1",
27
28
  "option-2": "Option 2",
28
29
  "option-3": "Option 3"
29
30
  }) },
31
+ name: {},
30
32
  textKey: { default: "" },
31
33
  valueKey: { default: "" },
32
34
  imaskProps: {},
@@ -38,18 +40,18 @@ const T = {
38
40
  },
39
41
  emits: ["update:modelValue", "change"],
40
42
  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);
43
+ const r = $, p = V, y = O(), { error: m, classes: b, optionText: C, optionValue: c } = g.useInput.useInputComposable(y, r), i = I(r.modelValue);
42
44
  N(
43
45
  () => r.modelValue,
44
46
  (e) => {
45
47
  i.value = e;
46
48
  }
47
49
  );
48
- const b = (e) => {
50
+ const k = (e) => {
49
51
  p("change", e), p("update:modelValue", i.value);
50
52
  };
51
53
  return (e, f) => (o(), l("div", {
52
- class: S(["input-wrap input-radio", [s(C), r.small && "small-checkradio"]])
54
+ class: S(["input-wrap input-radio", [s(b), r.small && "small-checkradio"]])
53
55
  }, [
54
56
  a("fieldset", null, [
55
57
  a("legend", null, [
@@ -57,9 +59,9 @@ const T = {
57
59
  w(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
58
60
  ], 64)) : h(e.$slots, "label", { key: 1 })
59
61
  ]),
60
- s(c) ? (o(), l("div", T, [
62
+ s(m) ? (o(), l("div", T, [
61
63
  U,
62
- a("span", null, n(s(c)), 1)
64
+ a("span", null, n(s(m)), 1)
63
65
  ])) : v("", !0),
64
66
  e.desc ? (o(), l("div", q, n(e.desc), 1)) : (o(), l(u, { key: 2 }, [
65
67
  e.$slots.desc ? (o(), l("div", A, [
@@ -80,17 +82,17 @@ const T = {
80
82
  "onUpdate:modelValue": f[0] || (f[0] = (_) => i.value = _),
81
83
  type: "radio",
82
84
  role: "radio",
83
- "aria-checked": e.modelValue === s(m)(d, t),
85
+ "aria-checked": e.modelValue === s(c)(d, t),
84
86
  name: `rd-${t}-${e.id}`,
85
87
  class: "is-checkradio",
86
- value: s(m)(d, t),
88
+ value: s(c)(d, t),
87
89
  ref_for: !0
88
- }, e.$attrs, { onChange: b }), null, 16, H), [
90
+ }, e.$attrs, { onChange: k }), null, 16, H), [
89
91
  [K, i.value]
90
92
  ]),
91
93
  a("label", {
92
94
  for: `rd-${t}-${e.id}`
93
- }, n(s(k)(d)), 9, L)
95
+ }, n(s(C)(d)), 9, L)
94
96
  ]))), 128))
95
97
  ], 12, F)
96
98
  ])
@@ -0,0 +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,7 +1,7 @@
1
- import { InputProps } from "@phila/phila-ui-core";
2
- import { RadioProps } from "./types";
3
- import PhilaUICore from "@phila/phila-ui-core";
4
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
1
+ import { InputProps } from '@phila/phila-ui-core';
2
+ import { RadioProps } from './types';
3
+
4
+ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
5
5
  id: any;
6
6
  errors(): never[];
7
7
  label: string;
@@ -16,10 +16,10 @@ 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
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
20
  "update:modelValue": (...args: any[]) => void;
21
21
  change: (...args: any[]) => void;
22
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
22
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
23
23
  id: any;
24
24
  errors(): never[];
25
25
  label: string;
@@ -39,8 +39,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
39
39
  onChange?: ((...args: any[]) => any) | undefined;
40
40
  }, {
41
41
  id: string;
42
- errors: PhilaUICore.InputErrors;
43
- options: (PhilaUICore.HTMLInputValue[] | PhilaUICore.InputOptions | PhilaUICore.InputOptions[] | PhilaUICore.InputOptionsGroup | undefined) & (object | (string | number | object)[]);
42
+ errors: import('@phila/phila-ui-core').InputErrors;
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)[]);
44
44
  textKey: string;
45
45
  valueKey: string;
46
46
  label: string;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import Radio from './Radio.vue';
1
+ import { default as Radio } from './Radio.vue';
2
+
2
3
  declare module 'vue' {
3
4
  interface GlobalComponents {
4
5
  Radio: typeof Radio;
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "@phila/phila-ui-radio",
3
3
  "private": false,
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
- "main": "./dist/radio.umd.cjs",
10
- "module": "./dist/radio.js",
9
+ "main": "./dist/Radio.umd.cjs",
10
+ "module": "./dist/Radio.js",
11
11
  "types": "./dist/types.d.ts",
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": {
15
15
  "types": "./dist/types.d.ts",
16
- "default": "./dist/radio.js"
16
+ "default": "./dist/Radio.js"
17
17
  },
18
- "require": "./dist/radio.umd.cjs"
18
+ "require": "./dist/Radio.umd.cjs"
19
19
  }
20
20
  },
21
21
  "scripts": {
22
22
  "dev": "vite",
23
23
  "prepublish": "npm i && npm run build",
24
- "build": "vite build && vue-tsc --declaration --emitDeclarationOnly --outdir ./dist",
24
+ "build": "vue-tsc && vite build",
25
25
  "preview": "vite preview"
26
26
  },
27
27
  "dependencies": {
28
- "@phila/phila-ui-core": "1.0.12",
28
+ "@phila/phila-ui-core": "^1.0.21",
29
29
  "bulma": "^0.9.4",
30
30
  "vue": "^3.3.8"
31
31
  },
@@ -43,5 +43,5 @@
43
43
  "registry": "https://registry.npmjs.com/",
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "17ea0e29f4566d58fe5eccba43c916d4453129ad"
46
+ "gitHead": "62924e3ac0fd1187900911ff3346a09929ec5aa3"
47
47
  }
@@ -1 +0,0 @@
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))}})});