@maltjoy/core-vue 1.0.0-alpha.1.1 → 1.0.0-alpha.2
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 +1 -1
- package/dist/components/main.d.ts +3 -2
- package/dist/joy-vue.js +29 -24
- package/dist/joy-vue.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Vue version of [@maltjoy/core](https://www.npmjs.com/package/@maltjoy/core) pack
|
|
|
4
4
|
|
|
5
5
|
In order to inherit from all [@maltjoy/themes](https://www.npmjs.com/package/@maltjoy/themes) custom properties, you will need to import as well the default theme:
|
|
6
6
|
|
|
7
|
-
> If you already use @maltjoy/core in your project, it already
|
|
7
|
+
> If you already use @maltjoy/core in your project, it already includes the theme.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
npm install @maltjoy/themes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
|
-
|
|
2
|
+
import { JoyButton, JoySpinner, JoyInput, JoyLabel, JoyWrapper } from './';
|
|
3
|
+
declare const JoyVuePlugin: {
|
|
3
4
|
install: (app: App) => void;
|
|
4
5
|
};
|
|
5
|
-
export
|
|
6
|
+
export { JoyVuePlugin, JoyButton, JoySpinner, JoyInput, JoyLabel, JoyWrapper, };
|
package/dist/joy-vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as _, openBlock as a, createElementBlock as r, normalizeClass as y, useAttrs as $, computed as v, createBlock as I, resolveDynamicComponent as L, unref as l, withCtx as J, createCommentVNode as
|
|
1
|
+
import { defineComponent as _, openBlock as a, createElementBlock as r, normalizeClass as y, useAttrs as $, computed as v, createBlock as I, resolveDynamicComponent as L, unref as l, withCtx as J, createCommentVNode as d, createElementVNode as g, renderSlot as S, mergeProps as x, toDisplayString as N, ref as m, useSlots as E, onBeforeMount as q } from "vue";
|
|
2
2
|
const T = ["teal", "white"], A = /* @__PURE__ */ _({
|
|
3
3
|
__name: "JoySpinner",
|
|
4
4
|
props: {
|
|
@@ -23,7 +23,7 @@ const b = (e, n) => {
|
|
|
23
23
|
}, z = /* @__PURE__ */ b(A, [["__scopeId", "data-v-e97b61a5"]]), O = ["primary", "secondary"], F = ["xlarge", "large", "medium", "small", "xsmall", "xxsmall"], R = ["main", "admin", "white", "ghost"], W = [
|
|
24
24
|
...O,
|
|
25
25
|
...R
|
|
26
|
-
],
|
|
26
|
+
], P = [...F], Z = ["xxsmall", "xsmall", "small"], D = ["name", "size"], M = { class: "joy-button--slot" }, U = /* @__PURE__ */ _({
|
|
27
27
|
__name: "JoyButton",
|
|
28
28
|
props: {
|
|
29
29
|
/**
|
|
@@ -54,7 +54,7 @@ const b = (e, n) => {
|
|
|
54
54
|
type: String,
|
|
55
55
|
default: "medium",
|
|
56
56
|
validator(e) {
|
|
57
|
-
return
|
|
57
|
+
return P.includes(e);
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
/** Override the icon size. Default to xsmall */
|
|
@@ -62,7 +62,7 @@ const b = (e, n) => {
|
|
|
62
62
|
type: String,
|
|
63
63
|
default: "xsmall",
|
|
64
64
|
validator(e) {
|
|
65
|
-
return
|
|
65
|
+
return Z.includes(e);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
},
|
|
@@ -86,13 +86,13 @@ const b = (e, n) => {
|
|
|
86
86
|
name: e.icon,
|
|
87
87
|
size: e.iconSize,
|
|
88
88
|
lazy: !1
|
|
89
|
-
}, null, 8,
|
|
89
|
+
}, null, 8, D)) : d("", !0),
|
|
90
90
|
e.loading ? (a(), I(z, {
|
|
91
91
|
key: 1,
|
|
92
92
|
color: l(p)
|
|
93
|
-
}, null, 8, ["color"])) :
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
}, null, 8, ["color"])) : d("", !0),
|
|
94
|
+
g("span", M, [
|
|
95
|
+
S(s.$slots, "default", {}, void 0, !0)
|
|
96
96
|
])
|
|
97
97
|
]),
|
|
98
98
|
_: 3
|
|
@@ -128,9 +128,9 @@ const G = /* @__PURE__ */ b(U, [["__scopeId", "data-v-107b2043"]]), H = ["small"
|
|
|
128
128
|
return (t, p) => (a(), r("label", x({
|
|
129
129
|
class: ["joy-label", `joy-label--${e.size}`]
|
|
130
130
|
}, t.$attrs), [
|
|
131
|
-
|
|
132
|
-
n.required ? (a(), r("span", K, "*")) :
|
|
133
|
-
n.optionalLabel ? (a(), r("span", Q, " - " + N(n.optionalLabel), 1)) :
|
|
131
|
+
S(t.$slots, "default", {}, void 0, !0),
|
|
132
|
+
n.required ? (a(), r("span", K, "*")) : d("", !0),
|
|
133
|
+
n.optionalLabel ? (a(), r("span", Q, " - " + N(n.optionalLabel), 1)) : d("", !0)
|
|
134
134
|
], 16));
|
|
135
135
|
}
|
|
136
136
|
});
|
|
@@ -203,7 +203,7 @@ const h = /* @__PURE__ */ b(X, [["__scopeId", "data-v-21392cc3"]]), Y = ["id", "
|
|
|
203
203
|
ref: s,
|
|
204
204
|
class: y([`joy-input--${t.size}`])
|
|
205
205
|
}, [
|
|
206
|
-
|
|
206
|
+
g("div", {
|
|
207
207
|
class: y([
|
|
208
208
|
"joy-input",
|
|
209
209
|
{
|
|
@@ -222,11 +222,11 @@ const h = /* @__PURE__ */ b(X, [["__scopeId", "data-v-21392cc3"]]), Y = ["id", "
|
|
|
222
222
|
size: e.labelSize
|
|
223
223
|
}, {
|
|
224
224
|
default: J(() => [
|
|
225
|
-
|
|
225
|
+
S(u.$slots, "default", {}, void 0, !0)
|
|
226
226
|
]),
|
|
227
227
|
_: 3
|
|
228
|
-
}, 8, ["for", "required", "optional-label", "size"])) :
|
|
229
|
-
|
|
228
|
+
}, 8, ["for", "required", "optional-label", "size"])) : d("", !0),
|
|
229
|
+
g("div", {
|
|
230
230
|
class: y([
|
|
231
231
|
"joy-input--wrapper",
|
|
232
232
|
{
|
|
@@ -237,7 +237,7 @@ const h = /* @__PURE__ */ b(X, [["__scopeId", "data-v-21392cc3"]]), Y = ["id", "
|
|
|
237
237
|
}
|
|
238
238
|
])
|
|
239
239
|
}, [
|
|
240
|
-
|
|
240
|
+
g("input", x(u.$attrs, {
|
|
241
241
|
id: t.name,
|
|
242
242
|
ref_key: "input",
|
|
243
243
|
ref: p,
|
|
@@ -250,11 +250,11 @@ const h = /* @__PURE__ */ b(X, [["__scopeId", "data-v-21392cc3"]]), Y = ["id", "
|
|
|
250
250
|
type: B.value,
|
|
251
251
|
value: e.modelValue,
|
|
252
252
|
onFocus: o[0] || (o[0] = //@ts-ignore
|
|
253
|
-
(...
|
|
253
|
+
(...c) => i.onFocus && i.onFocus(...c)),
|
|
254
254
|
onBlur: o[1] || (o[1] = //@ts-ignore
|
|
255
|
-
(...
|
|
255
|
+
(...c) => i.onBlur && i.onBlur(...c)),
|
|
256
256
|
onInput: o[2] || (o[2] = //@ts-ignore
|
|
257
|
-
(...
|
|
257
|
+
(...c) => i.onInput && i.onInput(...c))
|
|
258
258
|
}), null, 16, Y),
|
|
259
259
|
l(k) ? (a(), r("joy-icon", {
|
|
260
260
|
key: 0,
|
|
@@ -262,13 +262,13 @@ const h = /* @__PURE__ */ b(X, [["__scopeId", "data-v-21392cc3"]]), Y = ["id", "
|
|
|
262
262
|
name: "cross",
|
|
263
263
|
class: "joy-input--clear",
|
|
264
264
|
onClick: o[3] || (o[3] = //@ts-ignore
|
|
265
|
-
(...
|
|
266
|
-
})) :
|
|
265
|
+
(...c) => i.clearValue && i.clearValue(...c))
|
|
266
|
+
})) : d("", !0),
|
|
267
267
|
t.unit ? (a(), r("div", {
|
|
268
268
|
key: 1,
|
|
269
269
|
"data-unit": t.unit,
|
|
270
270
|
class: "joy-input--unit"
|
|
271
|
-
}, null, 8, ee)) :
|
|
271
|
+
}, null, 8, ee)) : d("", !0)
|
|
272
272
|
], 2)
|
|
273
273
|
], 2)
|
|
274
274
|
], 2));
|
|
@@ -304,7 +304,7 @@ const ne = /* @__PURE__ */ b(te, [["__scopeId", "data-v-2249f4f9"]]), oe = /* @_
|
|
|
304
304
|
`joy-wrapper--wrap-${e.wrap}`
|
|
305
305
|
])
|
|
306
306
|
}, [
|
|
307
|
-
|
|
307
|
+
S(n.$slots, "default")
|
|
308
308
|
], 2));
|
|
309
309
|
}
|
|
310
310
|
});
|
|
@@ -314,5 +314,10 @@ const le = {
|
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
316
|
export {
|
|
317
|
-
|
|
317
|
+
G as JoyButton,
|
|
318
|
+
ne as JoyInput,
|
|
319
|
+
h as JoyLabel,
|
|
320
|
+
z as JoySpinner,
|
|
321
|
+
le as JoyVuePlugin,
|
|
322
|
+
oe as JoyWrapper
|
|
318
323
|
};
|
package/dist/joy-vue.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e
|
|
1
|
+
(function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["@maltjoy/core-vue"]={},a.Vue))})(this,function(a,e){"use strict";const j=["teal","white"],k=e.defineComponent({__name:"JoySpinner",props:{color:{type:String,validator(t){return j.includes(t)}}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["joy-spinner",`joy-spinner_${t.color}`])},null,2))}}),M="",p=(t,o)=>{const n=t.__vccOpts||t;for(const[d,i]of o)n[d]=i;return n},y=p(k,[["__scopeId","data-v-e97b61a5"]]),C=["primary","secondary"],J=["xlarge","large","medium","small","xsmall","xxsmall"],I=["main","admin","white","ghost"],V=[...C,...I],w=[...J],$=["xxsmall","xsmall","small"],z=["name","size"],E={class:"joy-button--slot"},N=e.defineComponent({__name:"JoyButton",props:{circle:{type:Boolean,default:!1},icon:String,loading:{type:Boolean,default:!1},variant:{type:String,default:"primary",validator(t){return V.includes(t)}},size:{type:String,default:"medium",validator(t){return w.includes(t)}},iconSize:{type:String,default:"xsmall",validator(t){return $.includes(t)}}},setup(t){const o=t,n=e.useAttrs(),d=e.computed(()=>["white","ghost","secondary"].includes(o.variant)?"teal":"white");return(i,u)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(n).href?"a":"button"),{disabled:t.loading||e.unref(n).disabled,class:e.normalizeClass(["joy-button",`joy-button_${t.variant}`,`joy-button_${t.size}`,{"joy-button_circle":o.circle,"joy-button_loading":o.loading}])},{default:e.withCtx(()=>[t.icon?(e.openBlock(),e.createElementBlock("joy-icon",{key:0,name:t.icon,size:t.iconSize,lazy:!1},null,8,z)):e.createCommentVNode("",!0),t.loading?(e.openBlock(),e.createBlock(y,{key:1,color:e.unref(d)},null,8,["color"])):e.createCommentVNode("",!0),e.createElementVNode("span",E,[e.renderSlot(i.$slots,"default",{},void 0,!0)])]),_:3},8,["disabled","class"]))}}),Z="",_=p(N,[["__scopeId","data-v-107b2043"]]),h=["small","medium","large"],x={key:0,class:"joy-label-required"},L={key:1,class:"joy-label-optional"},T=e.defineComponent({__name:"JoyLabel",props:{size:{type:String,default:"medium",validator(t){return h.includes(t)}},required:{type:Boolean,default:!1},optionalLabel:{type:String}},setup(t){const o=t;return(n,d)=>(e.openBlock(),e.createElementBlock("label",e.mergeProps({class:["joy-label",`joy-label--${t.size}`]},n.$attrs),[e.renderSlot(n.$slots,"default",{},void 0,!0),o.required?(e.openBlock(),e.createElementBlock("span",x,"*")):e.createCommentVNode("",!0),o.optionalLabel?(e.openBlock(),e.createElementBlock("span",L," - "+e.toDisplayString(o.optionalLabel),1)):e.createCommentVNode("",!0)],16))}}),D="",m=p(T,[["__scopeId","data-v-21392cc3"]]),q=["id","type","value"],A=["data-unit"],O=e.defineComponent({__name:"JoyInput",props:{clearable:{type:Boolean,default:!1},icon:String,invalid:{type:Boolean,default:!1},labelSize:String,modelValue:{type:String,default:""},name:{type:String,required:!0},optionalLabel:String,required:{type:Boolean,default:!1},requiredMark:{type:Boolean,default:!1},size:{type:String,default:"medium"},type:String,unit:String},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,d=e.ref(),i=e.ref(),u=e.useAttrs(),b=e.useSlots(),f=e.ref(!1),F=e.computed(()=>n.clearable&&n.modelValue.length>0&&!n.unit),R=e.computed(()=>b.default&&b.default()),W=e.computed(()=>{var s,l;return!!((s=i.value)!=null&&s.closest("joy-wrapper"))||!!((l=i.value)!=null&&l.closest(".joy-wrapper"))}),B=e.ref(n.type);e.onBeforeMount(()=>{B.value=n.unit?"number":n.unit||"text"});const r={onFocus:()=>{f.value=!0},onBlur:()=>{f.value=!1},onInput:s=>{let l=s.target.value;o("update:modelValue",l)},clearValue:()=>{o("update:modelValue","")}};return(s,l)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"root",ref:i,class:e.normalizeClass([`joy-input--${n.size}`])},[e.createElementVNode("div",{class:e.normalizeClass(["joy-input",{"joy-input--focusing":f.value,"joy-input--disabled":e.unref(u).disabled,"joy-input--invalid":n.invalid,"joy-input--valid":!n.invalid&&!e.unref(u).disabled}])},[e.unref(R)?(e.openBlock(),e.createBlock(m,{key:0,for:n.name,required:n.required&&n.requiredMark,"optional-label":t.optionalLabel,size:t.labelSize},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default",{},void 0,!0)]),_:3},8,["for","required","optional-label","size"])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["joy-input--wrapper",{"joy-input--wrapper-has-icon":!!n.icon,"joy-input--wrapper---clearable":n.clearable,"joy-input--wrapper-unit":!!n.unit,"joy-input--wrapper-margin":!e.unref(W)}])},[e.createElementVNode("input",e.mergeProps(s.$attrs,{id:n.name,ref_key:"input",ref:d,class:[{"joy-input--field-disabled":e.unref(u).disabled,"joy-input--field-invalid":n.invalid}],type:B.value,value:t.modelValue,onFocus:l[0]||(l[0]=(...c)=>r.onFocus&&r.onFocus(...c)),onBlur:l[1]||(l[1]=(...c)=>r.onBlur&&r.onBlur(...c)),onInput:l[2]||(l[2]=(...c)=>r.onInput&&r.onInput(...c))}),null,16,q),e.unref(F)?(e.openBlock(),e.createElementBlock("joy-icon",{key:0,size:"xxsmall",name:"cross",class:"joy-input--clear",onClick:l[3]||(l[3]=(...c)=>r.clearValue&&r.clearValue(...c))})):e.createCommentVNode("",!0),n.unit?(e.openBlock(),e.createElementBlock("div",{key:1,"data-unit":n.unit,class:"joy-input--unit"},null,8,A)):e.createCommentVNode("",!0)],2)],2)],2))}}),U="",S=p(O,[["__scopeId","data-v-2249f4f9"]]),g=e.defineComponent({__name:"JoyWrapper",props:{justify:{type:String,default:"flex-start"},align:{type:String,default:"center"},direction:{type:String,default:"row"},wrap:{type:String,default:"wrap"}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["joy-wrapper",`joy-wrapper--justify-${t.justify}`,`joy-wrapper--align-${t.align}`,`joy-wrapper--direction-${t.direction}`,`joy-wrapper--wrap-${t.wrap}`])},[e.renderSlot(o.$slots,"default")],2))}}),G="",P={install:t=>{t.component("JoyButton",_),t.component("JoyInput",S),t.component("JoyLabel",m),t.component("JoySpinner",y),t.component("JoyWrapper",g)}};a.JoyButton=_,a.JoyInput=S,a.JoyLabel=m,a.JoySpinner=y,a.JoyVuePlugin=P,a.JoyWrapper=g,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|