@charpente-ui/vue 1.0.0-beta.2 → 1.0.0-beta.4

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
@@ -26,10 +26,12 @@ import { CButton } from '@charpente-ui/vue';
26
26
 
27
27
  ## Components
28
28
 
29
- | Name | Tag | Status |
30
- |----------|-------------|--------|
31
- | Button | `CButton` | Ready |
32
- | Input | `CInput` | Ready |
33
- | Label | `CLabel` | Ready |
34
- | Textarea | `CTextarea` | Ready |
35
- | Checkbox | `CCheckbox` | Ready |
29
+ | Name | Status | Tag |
30
+ |----------|--------|-------------|
31
+ | Button | Ready | `CButton` |
32
+ | Input | Ready | `CInput` |
33
+ | Label | Ready | `CLabel` |
34
+ | Textarea | Ready | `CTextarea` |
35
+ | Checkbox | Ready | `CCheckbox` |
36
+ | Radio | Ready | `CRadio` |
37
+ | Select | Ready | `CSelect` |
package/dist/charpente.js CHANGED
@@ -1,50 +1,39 @@
1
- import { defineComponent as n, openBlock as u, createBlock as A, resolveDynamicComponent as B, normalizeProps as b, guardReactiveProps as y, withCtx as g, renderSlot as v, useAttrs as i, useId as c, computed as I, createElementBlock as m, mergeProps as p, unref as _, useModel as $, withDirectives as C, vModelDynamic as M, vModelText as w } from "vue";
2
- const z = /* @__PURE__ */ n({
1
+ import { defineComponent as n, openBlock as u, createBlock as V, resolveDynamicComponent as h, normalizeProps as B, guardReactiveProps as C, withCtx as M, renderSlot as f, useModel as m, useAttrs as c, computed as p, useId as v, withDirectives as _, createElementBlock as d, mergeProps as i, vModelCheckbox as b, mergeModels as $, vModelDynamic as x, vModelRadio as A, vModelSelect as k, vModelText as I } from "vue";
2
+ const T = /* @__PURE__ */ n({
3
3
  inheritAttrs: !1,
4
4
  __name: "BaseButton",
5
5
  props: {
6
6
  as: { default: "button" }
7
7
  },
8
- setup(a) {
9
- return (t, e) => (u(), A(B(a.as), b(y(t.$attrs)), {
10
- default: g(() => [
11
- v(t.$slots, "default")
8
+ setup(t) {
9
+ return (e, o) => (u(), V(h(t.as), B(C(e.$attrs)), {
10
+ default: M(() => [
11
+ f(e.$slots, "default")
12
12
  ]),
13
13
  _: 3
14
14
  }, 16));
15
15
  }
16
- }), D = ["id", "checked"], E = /* @__PURE__ */ n({
16
+ }), y = ["id", "value"], w = /* @__PURE__ */ n({
17
17
  inheritAttrs: !1,
18
18
  __name: "BaseCheckbox",
19
- props: {
20
- modelValue: { type: [Boolean, Array], default: !1 },
19
+ props: /* @__PURE__ */ $({
21
20
  value: {}
22
- },
21
+ }, {
22
+ modelValue: { type: [Boolean, Array] },
23
+ modelModifiers: {}
24
+ }),
23
25
  emits: ["update:modelValue"],
24
- setup(a, { emit: t }) {
25
- const e = a, l = i().id || c(), o = I(() => Array.isArray(e.modelValue) ? e.modelValue.includes(e.value) : e.modelValue), r = t, k = (f) => {
26
- const h = f.target.checked;
27
- if (Array.isArray(e.modelValue)) {
28
- const d = [...e.modelValue];
29
- if (h)
30
- d.push(e.value);
31
- else {
32
- const V = d.indexOf(e.value);
33
- V > -1 && d.splice(V, 1);
34
- }
35
- r("update:modelValue", d);
36
- } else
37
- r("update:modelValue", h);
38
- };
39
- return (f, x) => (u(), m("input", p({
40
- id: _(l),
41
- type: "checkbox"
42
- }, f.$attrs, {
43
- checked: o.value,
44
- onChange: k
45
- }), null, 16, D));
26
+ setup(t) {
27
+ const e = m(t, "modelValue"), o = c(), s = p(() => o.id || v());
28
+ return (l, a) => _((u(), d("input", i({ type: "checkbox" }, l.$attrs, {
29
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => e.value = r),
30
+ id: s.value,
31
+ value: t.value
32
+ }), null, 16, y)), [
33
+ [b, e.value]
34
+ ]);
46
35
  }
47
- }), P = ["id"], O = /* @__PURE__ */ n({
36
+ }), U = ["id"], L = /* @__PURE__ */ n({
48
37
  inheritAttrs: !1,
49
38
  __name: "BaseInput",
50
39
  props: {
@@ -52,25 +41,69 @@ const z = /* @__PURE__ */ n({
52
41
  modelModifiers: {}
53
42
  },
54
43
  emits: ["update:modelValue"],
55
- setup(a) {
56
- const t = $(a, "modelValue"), s = i().id || c();
57
- return (l, o) => C((u(), m("input", p({
58
- id: _(s),
59
- "onUpdate:modelValue": o[0] || (o[0] = (r) => t.value = r)
60
- }, l.$attrs), null, 16, P)), [
61
- [M, t.value]
44
+ setup(t) {
45
+ const e = m(t, "modelValue"), o = c(), s = p(() => o.id || v());
46
+ return (l, a) => _((u(), d("input", i(l.$attrs, {
47
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => e.value = r),
48
+ id: s.value
49
+ }), null, 16, U)), [
50
+ [x, e.value]
62
51
  ]);
63
52
  }
64
- }), T = ["id"], R = /* @__PURE__ */ n({
53
+ }), R = ["for"], z = /* @__PURE__ */ n({
65
54
  inheritAttrs: !1,
66
55
  __name: "BaseLabel",
67
- setup(a) {
68
- const e = i().id || c();
69
- return (s, l) => (u(), m("label", p({ id: _(e) }, s.$attrs), [
70
- v(s.$slots, "default")
71
- ], 16, T));
56
+ props: {
57
+ for: {}
58
+ },
59
+ setup(t) {
60
+ const e = t;
61
+ return (o, s) => (u(), d("label", i(o.$attrs, {
62
+ for: e.for
63
+ }), [
64
+ f(o.$slots, "default")
65
+ ], 16, R));
66
+ }
67
+ }), S = ["id", "value"], E = /* @__PURE__ */ n({
68
+ inheritAttrs: !1,
69
+ __name: "BaseRadio",
70
+ props: /* @__PURE__ */ $({
71
+ value: {}
72
+ }, {
73
+ modelValue: {},
74
+ modelModifiers: {}
75
+ }),
76
+ emits: ["update:modelValue"],
77
+ setup(t) {
78
+ const e = m(t, "modelValue"), o = c(), s = p(() => o.id || v());
79
+ return (l, a) => _((u(), d("input", i({ type: "radio" }, l.$attrs, {
80
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => e.value = r),
81
+ id: s.value,
82
+ value: t.value
83
+ }), null, 16, S)), [
84
+ [A, e.value]
85
+ ]);
86
+ }
87
+ }), g = ["id"], j = /* @__PURE__ */ n({
88
+ inheritAttrs: !1,
89
+ __name: "BaseSelect",
90
+ props: {
91
+ modelValue: {},
92
+ modelModifiers: {}
93
+ },
94
+ emits: ["update:modelValue"],
95
+ setup(t) {
96
+ const e = m(t, "modelValue"), o = c(), s = p(() => o.id || v());
97
+ return (l, a) => _((u(), d("select", i(l.$attrs, {
98
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => e.value = r),
99
+ id: s.value
100
+ }), [
101
+ f(l.$slots, "default")
102
+ ], 16, g)), [
103
+ [k, e.value]
104
+ ]);
72
105
  }
73
- }), L = ["id"], S = /* @__PURE__ */ n({
106
+ }), D = ["id"], q = /* @__PURE__ */ n({
74
107
  inheritAttrs: !1,
75
108
  __name: "BaseTextarea",
76
109
  props: {
@@ -78,20 +111,22 @@ const z = /* @__PURE__ */ n({
78
111
  modelModifiers: {}
79
112
  },
80
113
  emits: ["update:modelValue"],
81
- setup(a) {
82
- const t = $(a, "modelValue"), s = i().id || c();
83
- return (l, o) => C((u(), m("textarea", p({
84
- id: _(s),
85
- "onUpdate:modelValue": o[0] || (o[0] = (r) => t.value = r)
86
- }, l.$attrs), null, 16, L)), [
87
- [w, t.value]
114
+ setup(t) {
115
+ const e = m(t, "modelValue"), o = c(), s = p(() => o.id || v());
116
+ return (l, a) => _((u(), d("textarea", i({
117
+ id: s.value,
118
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => e.value = r)
119
+ }, l.$attrs), null, 16, D)), [
120
+ [I, e.value]
88
121
  ]);
89
122
  }
90
123
  });
91
124
  export {
92
- z as CButton,
93
- E as CCheckbox,
94
- O as CInput,
95
- R as CLabel,
96
- S as CTextarea
125
+ T as CButton,
126
+ w as CCheckbox,
127
+ L as CInput,
128
+ z as CLabel,
129
+ E as CRadio,
130
+ j as CSelect,
131
+ q as CTextarea
97
132
  };
@@ -1 +1 @@
1
- (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.Charpente={},n.Vue))})(this,(function(n,e){"use strict";const u=e.defineComponent({inheritAttrs:!1,__name:"BaseButton",props:{as:{default:"button"}},setup(s){return(o,t)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.as),e.normalizeProps(e.guardReactiveProps(o.$attrs)),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},16))}}),f=["id","checked"],h=e.defineComponent({inheritAttrs:!1,__name:"BaseCheckbox",props:{modelValue:{type:[Boolean,Array],default:!1},value:{}},emits:["update:modelValue"],setup(s,{emit:o}){const t=s,l=e.useAttrs().id||e.useId(),r=e.computed(()=>Array.isArray(t.modelValue)?t.modelValue.includes(t.value):t.modelValue),d=o,$=c=>{const m=c.target.checked;if(Array.isArray(t.modelValue)){const i=[...t.modelValue];if(m)i.push(t.value);else{const p=i.indexOf(t.value);p>-1&&i.splice(p,1)}d("update:modelValue",i)}else d("update:modelValue",m)};return(c,y)=>(e.openBlock(),e.createElementBlock("input",e.mergeProps({id:e.unref(l),type:"checkbox"},c.$attrs,{checked:r.value,onChange:$}),null,16,f))}}),_=["id"],k=e.defineComponent({inheritAttrs:!1,__name:"BaseInput",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(s){const o=e.useModel(s,"modelValue"),a=e.useAttrs().id||e.useId();return(l,r)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",e.mergeProps({id:e.unref(a),"onUpdate:modelValue":r[0]||(r[0]=d=>o.value=d)},l.$attrs),null,16,_)),[[e.vModelDynamic,o.value]])}}),V=["id"],B=e.defineComponent({inheritAttrs:!1,__name:"BaseLabel",setup(s){const t=e.useAttrs().id||e.useId();return(a,l)=>(e.openBlock(),e.createElementBlock("label",e.mergeProps({id:e.unref(t)},a.$attrs),[e.renderSlot(a.$slots,"default")],16,V))}}),C=["id"],A=e.defineComponent({inheritAttrs:!1,__name:"BaseTextarea",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(s){const o=e.useModel(s,"modelValue"),a=e.useAttrs().id||e.useId();return(l,r)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",e.mergeProps({id:e.unref(a),"onUpdate:modelValue":r[0]||(r[0]=d=>o.value=d)},l.$attrs),null,16,C)),[[e.vModelText,o.value]])}});n.CButton=u,n.CCheckbox=h,n.CInput=k,n.CLabel=B,n.CTextarea=A,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.Charpente={},n.Vue))})(this,(function(n,e){"use strict";const i=e.defineComponent({inheritAttrs:!1,__name:"BaseButton",props:{as:{default:"button"}},setup(o){return(t,s)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.as),e.normalizeProps(e.guardReactiveProps(t.$attrs)),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16))}}),m=["id","value"],c=e.defineComponent({inheritAttrs:!1,__name:"BaseCheckbox",props:e.mergeModels({value:{}},{modelValue:{type:[Boolean,Array]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=e.useModel(o,"modelValue"),s=e.useAttrs(),r=e.computed(()=>s.id||e.useId());return(a,l)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",e.mergeProps({type:"checkbox"},a.$attrs,{"onUpdate:modelValue":l[0]||(l[0]=d=>t.value=d),id:r.value,value:o.value}),null,16,m)),[[e.vModelCheckbox,t.value]])}}),p=["id"],u=e.defineComponent({inheritAttrs:!1,__name:"BaseInput",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const t=e.useModel(o,"modelValue"),s=e.useAttrs(),r=e.computed(()=>s.id||e.useId());return(a,l)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",e.mergeProps(a.$attrs,{"onUpdate:modelValue":l[0]||(l[0]=d=>t.value=d),id:r.value}),null,16,p)),[[e.vModelDynamic,t.value]])}}),f=["for"],_=e.defineComponent({inheritAttrs:!1,__name:"BaseLabel",props:{for:{}},setup(o){const t=o;return(s,r)=>(e.openBlock(),e.createElementBlock("label",e.mergeProps(s.$attrs,{for:t.for}),[e.renderSlot(s.$slots,"default")],16,f))}}),h=["id","value"],B=e.defineComponent({inheritAttrs:!1,__name:"BaseRadio",props:e.mergeModels({value:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=e.useModel(o,"modelValue"),s=e.useAttrs(),r=e.computed(()=>s.id||e.useId());return(a,l)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",e.mergeProps({type:"radio"},a.$attrs,{"onUpdate:modelValue":l[0]||(l[0]=d=>t.value=d),id:r.value,value:o.value}),null,16,h)),[[e.vModelRadio,t.value]])}}),V=["id"],$=e.defineComponent({inheritAttrs:!1,__name:"BaseSelect",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const t=e.useModel(o,"modelValue"),s=e.useAttrs(),r=e.computed(()=>s.id||e.useId());return(a,l)=>e.withDirectives((e.openBlock(),e.createElementBlock("select",e.mergeProps(a.$attrs,{"onUpdate:modelValue":l[0]||(l[0]=d=>t.value=d),id:r.value}),[e.renderSlot(a.$slots,"default")],16,V)),[[e.vModelSelect,t.value]])}}),C=["id"],k=e.defineComponent({inheritAttrs:!1,__name:"BaseTextarea",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const t=e.useModel(o,"modelValue"),s=e.useAttrs(),r=e.computed(()=>s.id||e.useId());return(a,l)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",e.mergeProps({id:r.value,"onUpdate:modelValue":l[0]||(l[0]=d=>t.value=d)},a.$attrs),null,16,C)),[[e.vModelText,t.value]])}});n.CButton=i,n.CCheckbox=c,n.CInput=u,n.CLabel=_,n.CRadio=B,n.CSelect=$,n.CTextarea=k,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
@@ -1,12 +1,12 @@
1
1
  type __VLS_Props = {
2
- modelValue?: boolean | any[];
3
2
  value?: any;
4
3
  };
5
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
4
+ type __VLS_PublicProps = {
5
+ modelValue?: boolean | any[];
6
+ } & __VLS_Props;
7
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
8
  "update:modelValue": (value: boolean | any[]) => any;
7
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
8
10
  "onUpdate:modelValue"?: ((value: boolean | any[]) => any) | undefined;
9
- }>, {
10
- modelValue: boolean | any[];
11
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
12
  export default _default;
@@ -1,3 +1,6 @@
1
+ type __VLS_Props = {
2
+ for?: string;
3
+ };
1
4
  declare function __VLS_template(): {
2
5
  attrs: Partial<{}>;
3
6
  slots: {
@@ -7,7 +10,7 @@ declare function __VLS_template(): {
7
10
  rootEl: any;
8
11
  };
9
12
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
- declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
13
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
14
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
12
15
  export default _default;
13
16
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -0,0 +1,12 @@
1
+ type __VLS_Props = {
2
+ value: any;
3
+ };
4
+ type __VLS_PublicProps = {
5
+ modelValue?: any;
6
+ } & __VLS_Props;
7
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
+ "update:modelValue": (value: any) => any;
9
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
10
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
+ export default _default;
@@ -0,0 +1,24 @@
1
+ type __VLS_PublicProps = {
2
+ modelValue?: any;
3
+ };
4
+ declare function __VLS_template(): {
5
+ attrs: Partial<{}>;
6
+ slots: {
7
+ default?(_: {}): any;
8
+ };
9
+ refs: {};
10
+ rootEl: any;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
+ "update:modelValue": (value: any) => any;
15
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
19
+ export default _default;
20
+ type __VLS_WithTemplateSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
package/dist/index.d.ts CHANGED
@@ -2,4 +2,6 @@ export { default as CButton } from './components/BaseButton';
2
2
  export { default as CCheckbox } from './components/BaseCheckbox';
3
3
  export { default as CInput } from './components/BaseInput';
4
4
  export { default as CLabel } from './components/BaseLabel';
5
+ export { default as CRadio } from './components/BaseRadio';
6
+ export { default as CSelect } from './components/BaseSelect';
5
7
  export { default as CTextarea } from './components/BaseTextarea';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charpente-ui/vue",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "Charpente UI is a headless CSS Vue component library.",
5
5
  "type": "module",
6
6
  "scripts": {