@phila/phila-ui-checkbox 0.0.4 → 0.0.5

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,6 +1,5 @@
1
1
  import { InputProps } from "@phila/phila-ui-core";
2
2
  import { CheckboxProps } from "./types";
3
- import PhilaUICore from "@phila/phila-ui-core";
4
3
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & CheckboxProps>, {
5
4
  id: any;
6
5
  errors(): never[];
@@ -39,8 +38,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
39
38
  onChange?: ((...args: any[]) => any) | undefined;
40
39
  }, {
41
40
  id: string;
42
- errors: PhilaUICore.InputErrors;
43
- options: (PhilaUICore.HTMLInputValue[] | PhilaUICore.InputOptions | PhilaUICore.InputOptions[] | PhilaUICore.InputOptionsGroup | undefined) & (PhilaUICore.InputOptions | PhilaUICore.InputOptions[]);
41
+ errors: import("@phila/phila-ui-core").InputErrors;
42
+ 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) & (import("@phila/phila-ui-core").InputOptions | import("@phila/phila-ui-core").InputOptions[]);
44
43
  textKey: string;
45
44
  valueKey: string;
46
45
  label: string;
package/dist/checkbox.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as I, getCurrentInstance as O, ref as B, watch as w, openBlock as o, createElementBlock as l, normalizeClass as D, unref as a, createElementVNode as s, Fragment as u, createTextVNode as N, toDisplayString as n, renderSlot as h, createCommentVNode as v, normalizeStyle as P, renderList as S, withDirectives as z, mergeProps as E, vModelCheckbox as K } from "vue";
1
+ import { defineComponent as O, getCurrentInstance as B, ref as I, watch as w, openBlock as o, createElementBlock as l, normalizeClass as D, unref as a, createElementVNode as s, Fragment as u, createTextVNode as N, toDisplayString as n, renderSlot as h, createCommentVNode as b, normalizeStyle as P, renderList as S, withDirectives as z, mergeProps as E, vModelCheckbox as K } from "vue";
2
2
  import T from "@phila/phila-ui-core";
3
3
  const U = {
4
4
  key: 0,
@@ -11,9 +11,9 @@ const U = {
11
11
  }, F = {
12
12
  key: 0,
13
13
  class: "is-field-info"
14
- }, H = ["id"], L = ["id", "name", "aria-checked", "value"], M = ["for"], { formHelpers: b } = T, { randomID: j } = b, G = {
14
+ }, H = ["id"], L = ["id", "name", "aria-checked", "value"], M = ["for"], { formHelpers: v } = T, { randomID: j } = v, G = {
15
15
  inheritAttrs: !1
16
- }, R = /* @__PURE__ */ I({
16
+ }, R = /* @__PURE__ */ O({
17
17
  ...G,
18
18
  __name: "Checkbox",
19
19
  props: {
@@ -22,11 +22,13 @@ const U = {
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,14 +40,14 @@ const U = {
38
40
  },
39
41
  emits: ["update:modelValue", "change"],
40
42
  setup(k, { emit: $ }) {
41
- const i = k, c = $, V = O(), { error: m, classes: g, optionText: C, optionValue: p } = b.useInput.useInputComposable(V, i), r = B(i.modelValue);
43
+ const i = k, c = $, V = B(), { error: p, classes: g, optionText: y, optionValue: m } = v.useInput.useInputComposable(V, i), r = I(i.modelValue);
42
44
  w(
43
45
  () => i.modelValue,
44
46
  (e) => {
45
47
  r.value = e;
46
48
  }
47
49
  );
48
- const y = (e) => {
50
+ const C = (e) => {
49
51
  c("change", e), c("update:modelValue", r.value);
50
52
  };
51
53
  return (e, f) => (o(), l("div", {
@@ -57,14 +59,14 @@ const U = {
57
59
  N(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
58
60
  ], 64)) : h(e.$slots, "label", { key: 1 })
59
61
  ]),
60
- a(m) ? (o(), l("div", U, [
62
+ a(p) ? (o(), l("div", U, [
61
63
  q,
62
- s("span", null, n(a(m)), 1)
63
- ])) : v("", !0),
64
+ s("span", null, n(a(p)), 1)
65
+ ])) : b("", !0),
64
66
  e.desc ? (o(), l("div", A, n(e.desc), 1)) : (o(), l(u, { key: 2 }, [
65
67
  e.$slots.desc ? (o(), l("div", F, [
66
68
  h(e.$slots, "desc")
67
- ])) : v("", !0)
69
+ ])) : b("", !0)
68
70
  ], 64)),
69
71
  s("div", {
70
72
  id: `cb-group-${e.id}`,
@@ -79,19 +81,19 @@ const U = {
79
81
  "onUpdate:modelValue": f[0] || (f[0] = (_) => r.value = _),
80
82
  name: `cb-${t}-${e.id}`,
81
83
  type: "checkbox",
82
- "aria-checked": e.modelValue.includes(a(p)(d, t)),
84
+ "aria-checked": e.modelValue.includes(a(m)(d, t)),
83
85
  class: "is-checkradio",
84
86
  role: "checkbox",
85
87
  ref_for: !0
86
88
  }, e.$attrs, {
87
- value: a(p)(d, t),
88
- onChange: y
89
+ value: a(m)(d, t),
90
+ onChange: C
89
91
  }), null, 16, L), [
90
92
  [K, r.value]
91
93
  ]),
92
94
  s("label", {
93
95
  for: `cb-${t}-${e.id}`
94
- }, n(a(C)(d)), 9, M)
96
+ }, n(a(y)(d)), 9, M)
95
97
  ]))), 128))
96
98
  ], 12, H)
97
99
  ])
@@ -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.Checkbox=l(e.Vue,e.PhilaUICore))})(this,function(e,l){"use strict";const p={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","name","aria-checked","value"],B=["for"],{formHelpers:r}=l,{randomID:y}=r,E={inheritAttrs:!1};return e.defineComponent({...E,__name:"Checkbox",props:{id:{default:y()},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:{default:()=>[]},numOfColumns:{default:1},small:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(b,{emit:g}){const n=b,i=g,$=e.getCurrentInstance(),{error:c,classes:C,optionText:N,optionValue:d}=r.useInput.useInputComposable($,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,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrap input-checkbox",[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(c)?(e.openBlock(),e.createElementBlock("div",p,[f,e.createElementVNode("span",null,e.toDisplayString(e.unref(c)),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:`cb-group-${o.id}`,style:e.normalizeStyle(`columns: ${o.numOfColumns} auto`)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,(s,t)=>(e.openBlock(),e.createElementBlock("div",{key:`k-${t}`,class:"control"},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:`cb-${t}-${o.id}`,"onUpdate:modelValue":m[0]||(m[0]=S=>a.value=S),name:`cb-${t}-${o.id}`,type:"checkbox","aria-checked":o.modelValue.includes(e.unref(d)(s,t)),class:"is-checkradio",role:"checkbox",ref_for:!0},o.$attrs,{value:e.unref(d)(s,t),onChange:_}),null,16,V),[[e.vModelCheckbox,a.value]]),e.createElementVNode("label",{for:`cb-${t}-${o.id}`},e.toDisplayString(e.unref(N)(s)),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.Checkbox=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","name","aria-checked","value"],B=["for"],{formHelpers:r}=l,{randomID:b}=r,y={inheritAttrs:!1};return e.defineComponent({...y,__name:"Checkbox",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:{default:()=>[]},numOfColumns:{default:1},small:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(E,{emit:g}){const n=E,i=g,$=e.getCurrentInstance(),{error:c,classes:C,optionText:N,optionValue:d}=r.useInput.useInputComposable($,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-checkbox",[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(c)?(e.openBlock(),e.createElementBlock("div",m,[f,e.createElementVNode("span",null,e.toDisplayString(e.unref(c)),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:`cb-group-${o.id}`,style:e.normalizeStyle(`columns: ${o.numOfColumns} auto`)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,(s,t)=>(e.openBlock(),e.createElementBlock("div",{key:`k-${t}`,class:"control"},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:`cb-${t}-${o.id}`,"onUpdate:modelValue":p[0]||(p[0]=S=>a.value=S),name:`cb-${t}-${o.id}`,type:"checkbox","aria-checked":o.modelValue.includes(e.unref(d)(s,t)),class:"is-checkradio",role:"checkbox",ref_for:!0},o.$attrs,{value:e.unref(d)(s,t),onChange:_}),null,16,V),[[e.vModelCheckbox,a.value]]),e.createElementVNode("label",{for:`cb-${t}-${o.id}`},e.toDisplayString(e.unref(N)(s)),9,B)]))),128))],12,k)])],2))}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@phila/phila-ui-checkbox",
3
3
  "private": false,
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
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.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
  }