@phila/phila-ui-checkbox 0.0.4 → 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,76 +1,28 @@
1
1
  import { InputProps } from "@phila/phila-ui-core";
2
2
  import { CheckboxProps } from "./types";
3
- import PhilaUICore from "@phila/phila-ui-core";
4
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & CheckboxProps>, {
5
- id: any;
6
- errors(): never[];
7
- label: string;
8
- desc: string;
9
- modelValue: () => never[];
10
- valueKey: string;
11
- textKey: string;
12
- numOfColumns: number;
13
- small: boolean;
14
- options: () => {
15
- "option-1": string;
16
- "option-2": string;
17
- "option-3": string;
18
- };
19
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<InputProps & CheckboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
4
  "update:modelValue": (...args: any[]) => void;
21
5
  change: (...args: any[]) => void;
22
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & CheckboxProps>, {
23
- id: any;
24
- errors(): never[];
25
- label: string;
26
- desc: string;
27
- modelValue: () => never[];
28
- valueKey: string;
29
- textKey: string;
30
- numOfColumns: number;
31
- small: boolean;
32
- options: () => {
33
- "option-1": string;
34
- "option-2": string;
35
- "option-3": string;
36
- };
37
- }>>> & {
6
+ }, string, import("vue").PublicProps, Readonly<InputProps & CheckboxProps> & Readonly<{
38
7
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
39
8
  onChange?: ((...args: any[]) => any) | undefined;
40
- }, {
9
+ }>, {
41
10
  id: string;
42
- errors: PhilaUICore.InputErrors;
43
- options: (PhilaUICore.HTMLInputValue[] | PhilaUICore.InputOptions | PhilaUICore.InputOptions[] | PhilaUICore.InputOptionsGroup | undefined) & (PhilaUICore.InputOptions | PhilaUICore.InputOptions[]);
11
+ errors: import("@phila/phila-ui-core").InputErrors;
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
13
  textKey: string;
45
14
  valueKey: string;
46
15
  label: string;
47
16
  desc: string;
48
- modelValue: (string | number | boolean)[];
17
+ modelValue: Array<string | number | boolean>;
49
18
  numOfColumns: string | number;
50
19
  small: boolean;
51
- }, {}>, {
52
- label?(_: {}): any;
53
- desc?(_: {}): any;
20
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
21
+ label?: ((props: {}) => any) | undefined;
22
+ desc?: ((props: {}) => any) | undefined;
54
23
  }>;
55
24
  export default _default;
56
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
57
- type __VLS_TypePropsToRuntimeProps<T> = {
58
- [K in keyof T]-?: {} extends Pick<T, K> ? {
59
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
60
- } : {
61
- type: import('vue').PropType<T[K]>;
62
- required: true;
63
- };
64
- };
65
- type __VLS_WithDefaults<P, D> = {
66
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
67
- default: D[K];
68
- }> : P[K];
69
- };
70
- type __VLS_Prettify<T> = {
71
- [K in keyof T]: T[K];
72
- } & {};
73
- type __VLS_WithTemplateSlots<T, S> = T & {
25
+ type __VLS_WithSlots<T, S> = T & {
74
26
  new (): {
75
27
  $slots: S;
76
28
  };
package/dist/checkbox.js CHANGED
@@ -1,32 +1,32 @@
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 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: b } = T, { randomID: j } = b, 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__ */ I({
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
  } },
24
22
  optgroup: { type: Boolean },
23
+ disableableOptions: { type: Boolean },
25
24
  options: { default: () => ({
26
25
  "option-1": "Option 1",
27
26
  "option-2": "Option 2",
28
27
  "option-3": "Option 3"
29
28
  }) },
29
+ name: {},
30
30
  textKey: { default: "" },
31
31
  valueKey: { default: "" },
32
32
  imaskProps: {},
@@ -38,66 +38,68 @@ const U = {
38
38
  },
39
39
  emits: ["update:modelValue", "change"],
40
40
  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);
42
- 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(
43
43
  () => i.modelValue,
44
44
  (e) => {
45
45
  r.value = e;
46
46
  }
47
47
  );
48
- const y = (e) => {
49
- c("change", e), c("update:modelValue", r.value);
48
+ const C = (e) => {
49
+ p("change", e), p("update:modelValue", r.value);
50
50
  };
51
- return (e, f) => (o(), l("div", {
52
- 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"]])
53
53
  }, [
54
54
  s("fieldset", null, [
55
55
  s("legend", null, [
56
- e.label ? (o(), l(u, { key: 0 }, [
57
- N(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
58
- ], 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 })
59
59
  ]),
60
- a(m) ? (o(), l("div", U, [
61
- q,
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)),
62
64
  s("span", null, n(a(m)), 1)
63
- ])) : v("", !0),
64
- e.desc ? (o(), l("div", A, n(e.desc), 1)) : (o(), l(u, { key: 2 }, [
65
- e.$slots.desc ? (o(), l("div", F, [
66
- h(e.$slots, "desc")
67
- ])) : v("", !0)
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)
68
70
  ], 64)),
69
71
  s("div", {
70
72
  id: `cb-group-${e.id}`,
71
- style: P(`columns: ${e.numOfColumns} auto`)
73
+ style: S(`columns: ${e.numOfColumns} auto`)
72
74
  }, [
73
- (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", {
74
76
  key: `k-${t}`,
75
77
  class: "control"
76
78
  }, [
77
79
  z(s("input", E({
78
80
  id: `cb-${t}-${e.id}`,
79
- "onUpdate:modelValue": f[0] || (f[0] = (_) => r.value = _),
81
+ "onUpdate:modelValue": d[0] || (d[0] = (O) => r.value = O),
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(f)(u, 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
- }), null, 16, L), [
89
+ value: a(f)(u, t),
90
+ onChange: C
91
+ }), null, 16, H), [
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)(u)), 9, L)
95
97
  ]))), 128))
96
- ], 12, H)
98
+ ], 12, F)
97
99
  ])
98
100
  ], 2));
99
101
  }
100
102
  });
101
103
  export {
102
- R as default
104
+ Q as default
103
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 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={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.4",
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.12",
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": "17ea0e29f4566d58fe5eccba43c916d4453129ad"
46
+ "gitHead": "09f2b67c1d3db773c813231e21b62b37e34aefbd"
47
47
  }