@phila/phila-ui-checkbox 0.0.5 → 0.0.8

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,42 +1,12 @@
1
1
  import { InputProps } from "@phila/phila-ui-core";
2
2
  import { CheckboxProps } from "./types";
3
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & CheckboxProps>, {
4
- id: any;
5
- errors(): never[];
6
- label: string;
7
- desc: string;
8
- modelValue: () => never[];
9
- valueKey: string;
10
- textKey: string;
11
- numOfColumns: number;
12
- small: boolean;
13
- options: () => {
14
- "option-1": string;
15
- "option-2": string;
16
- "option-3": string;
17
- };
18
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<InputProps & CheckboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
4
  "update:modelValue": (...args: any[]) => void;
20
5
  change: (...args: any[]) => void;
21
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & CheckboxProps>, {
22
- id: any;
23
- errors(): never[];
24
- label: string;
25
- desc: string;
26
- modelValue: () => never[];
27
- valueKey: string;
28
- textKey: string;
29
- numOfColumns: number;
30
- small: boolean;
31
- options: () => {
32
- "option-1": string;
33
- "option-2": string;
34
- "option-3": string;
35
- };
36
- }>>> & {
6
+ }, string, import("vue").PublicProps, Readonly<InputProps & CheckboxProps> & Readonly<{
37
7
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
38
8
  onChange?: ((...args: any[]) => any) | undefined;
39
- }, {
9
+ }>, {
40
10
  id: string;
41
11
  errors: import("@phila/phila-ui-core").InputErrors;
42
12
  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,32 +14,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
44
14
  valueKey: string;
45
15
  label: string;
46
16
  desc: string;
47
- modelValue: (string | number | boolean)[];
17
+ modelValue: Array<string | number | boolean>;
48
18
  numOfColumns: string | number;
49
19
  small: boolean;
50
- }, {}>, {
51
- label?(_: {}): any;
52
- desc?(_: {}): any;
20
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
21
+ label?: ((props: {}) => any) | undefined;
22
+ desc?: ((props: {}) => any) | undefined;
53
23
  }>;
54
24
  export default _default;
55
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
56
- type __VLS_TypePropsToRuntimeProps<T> = {
57
- [K in keyof T]-?: {} extends Pick<T, K> ? {
58
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
59
- } : {
60
- type: import('vue').PropType<T[K]>;
61
- required: true;
62
- };
63
- };
64
- type __VLS_WithDefaults<P, D> = {
65
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
66
- default: D[K];
67
- }> : P[K];
68
- };
69
- type __VLS_Prettify<T> = {
70
- [K in keyof T]: T[K];
71
- } & {};
72
- type __VLS_WithTemplateSlots<T, S> = T & {
25
+ type __VLS_WithSlots<T, S> = T & {
73
26
  new (): {
74
27
  $slots: S;
75
28
  };
package/dist/checkbox.js CHANGED
@@ -1,23 +1,21 @@
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";
1
+ import { defineComponent as B, getCurrentInstance as I, ref as w, watch as D, createElementBlock as o, openBlock as l, normalizeClass as N, unref as a, createElementVNode as s, createCommentVNode as h, renderSlot as b, Fragment as c, createTextVNode as P, toDisplayString as n, normalizeStyle as S, renderList as _, 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,
5
5
  class: "input-error-msg"
6
- }, q = /* @__PURE__ */ s("span", { class: "icon" }, [
7
- /* @__PURE__ */ s("i", { class: "fas fa-exclamation-circle" })
8
- ], -1), A = {
6
+ }, q = {
9
7
  key: 1,
10
8
  class: "is-field-info"
11
- }, F = {
9
+ }, A = {
12
10
  key: 0,
13
11
  class: "is-field-info"
14
- }, H = ["id"], L = ["id", "name", "aria-checked", "value"], M = ["for"], { formHelpers: v } = T, { randomID: j } = v, G = {
12
+ }, F = ["id"], H = ["id", "name", "aria-checked", "value"], L = ["for"], { formHelpers: v } = T, { randomID: M } = v, j = {
15
13
  inheritAttrs: !1
16
- }, R = /* @__PURE__ */ O({
17
- ...G,
14
+ }, Q = /* @__PURE__ */ B({
15
+ ...j,
18
16
  __name: "Checkbox",
19
17
  props: {
20
- id: { default: j() },
18
+ id: { default: M() },
21
19
  errors: { default() {
22
20
  return [];
23
21
  } },
@@ -40,66 +38,68 @@ const U = {
40
38
  },
41
39
  emits: ["update:modelValue", "change"],
42
40
  setup(k, { emit: $ }) {
43
- const i = k, c = $, V = B(), { error: p, classes: g, optionText: y, optionValue: m } = v.useInput.useInputComposable(V, i), r = I(i.modelValue);
44
- w(
41
+ const i = k, p = $, V = I(), { error: m, classes: g, optionText: y, optionValue: f } = v.useInput.useInputComposable(V, i), r = w(i.modelValue);
42
+ D(
45
43
  () => i.modelValue,
46
44
  (e) => {
47
45
  r.value = e;
48
46
  }
49
47
  );
50
48
  const C = (e) => {
51
- c("change", e), c("update:modelValue", r.value);
49
+ p("change", e), p("update:modelValue", r.value);
52
50
  };
53
- return (e, f) => (o(), l("div", {
54
- class: D(["input-wrap input-checkbox", [a(g), i.small && "small-checkradio"]])
51
+ return (e, d) => (l(), o("div", {
52
+ class: N(["input-wrap input-checkbox", [a(g), i.small && "small-checkradio"]])
55
53
  }, [
56
54
  s("fieldset", null, [
57
55
  s("legend", null, [
58
- e.label ? (o(), l(u, { key: 0 }, [
59
- N(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
60
- ], 64)) : h(e.$slots, "label", { key: 1 })
56
+ e.label ? (l(), o(c, { key: 0 }, [
57
+ P(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
58
+ ], 64)) : b(e.$slots, "label", { key: 1 })
61
59
  ]),
62
- a(p) ? (o(), l("div", U, [
63
- q,
64
- s("span", null, n(a(p)), 1)
65
- ])) : b("", !0),
66
- e.desc ? (o(), l("div", A, n(e.desc), 1)) : (o(), l(u, { key: 2 }, [
67
- e.$slots.desc ? (o(), l("div", F, [
68
- h(e.$slots, "desc")
69
- ])) : b("", !0)
60
+ a(m) ? (l(), o("div", U, [
61
+ d[1] || (d[1] = s("span", { class: "icon" }, [
62
+ s("i", { class: "fas fa-exclamation-circle" })
63
+ ], -1)),
64
+ s("span", null, n(a(m)), 1)
65
+ ])) : h("", !0),
66
+ e.desc ? (l(), o("div", q, n(e.desc), 1)) : (l(), o(c, { key: 2 }, [
67
+ e.$slots.desc ? (l(), o("div", A, [
68
+ b(e.$slots, "desc")
69
+ ])) : h("", !0)
70
70
  ], 64)),
71
71
  s("div", {
72
72
  id: `cb-group-${e.id}`,
73
- style: P(`columns: ${e.numOfColumns} auto`)
73
+ style: S(`columns: ${e.numOfColumns} auto`)
74
74
  }, [
75
- (o(!0), l(u, null, S(e.options, (d, t) => (o(), l("div", {
75
+ (l(!0), o(c, null, _(e.options, (u, t) => (l(), o("div", {
76
76
  key: `k-${t}`,
77
77
  class: "control"
78
78
  }, [
79
79
  z(s("input", E({
80
80
  id: `cb-${t}-${e.id}`,
81
- "onUpdate:modelValue": f[0] || (f[0] = (_) => r.value = _),
81
+ "onUpdate:modelValue": d[0] || (d[0] = (O) => r.value = O),
82
82
  name: `cb-${t}-${e.id}`,
83
83
  type: "checkbox",
84
- "aria-checked": e.modelValue.includes(a(m)(d, t)),
84
+ "aria-checked": e.modelValue.includes(a(f)(u, t)),
85
85
  class: "is-checkradio",
86
86
  role: "checkbox",
87
87
  ref_for: !0
88
88
  }, e.$attrs, {
89
- value: a(m)(d, t),
89
+ value: a(f)(u, t),
90
90
  onChange: C
91
- }), null, 16, L), [
91
+ }), null, 16, H), [
92
92
  [K, r.value]
93
93
  ]),
94
94
  s("label", {
95
95
  for: `cb-${t}-${e.id}`
96
- }, n(a(y)(d)), 9, M)
96
+ }, n(a(y)(u)), 9, L)
97
97
  ]))), 128))
98
- ], 12, H)
98
+ ], 12, F)
99
99
  ])
100
100
  ], 2));
101
101
  }
102
102
  });
103
103
  export {
104
- R as default
104
+ Q as default
105
105
  };
@@ -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 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))}})});
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={key:1,class:"is-field-info"},u={key:0,class:"is-field-info"},k=["id"],h=["id","name","aria-checked","value"],V=["for"],{formHelpers:i}=l,{randomID:B}=i,b={inheritAttrs:!1};return e.defineComponent({...b,__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(y,{emit:E}){const n=y,c=E,g=e.getCurrentInstance(),{error:d,classes:$,optionText:C,optionValue:p}=i.useInput.useInputComposable(g,n),a=e.ref(n.modelValue);e.watch(()=>n.modelValue,o=>{a.value=o});const N=o=>{c("change",o),c("update:modelValue",a.value)};return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrap input-checkbox",[e.unref($),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,[s[1]||(s[1]=e.createElementVNode("span",{class:"icon"},[e.createElementVNode("i",{class:"fas fa-exclamation-circle"})],-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(d)),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:`cb-group-${o.id}`,style:e.normalizeStyle(`columns: ${o.numOfColumns} auto`)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,(r,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":s[0]||(s[0]=S=>a.value=S),name:`cb-${t}-${o.id}`,type:"checkbox","aria-checked":o.modelValue.includes(e.unref(p)(r,t)),class:"is-checkradio",role:"checkbox",ref_for:!0},o.$attrs,{value:e.unref(p)(r,t),onChange:N}),null,16,h),[[e.vModelCheckbox,a.value]]),e.createElementVNode("label",{for:`cb-${t}-${o.id}`},e.toDisplayString(e.unref(C)(r)),9,V)]))),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.5",
4
+ "version": "0.0.8",
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": "09f2b67c1d3db773c813231e21b62b37e34aefbd"
47
47
  }