@maltjoy/core-vue 1.0.0-alpha.2 → 1.0.0-alpha.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.
Files changed (44) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/components/JoyButton/JoyButton.types.d.ts +1 -1
  3. package/dist/components/JoyButton/JoyButton.vue.d.ts +18 -28
  4. package/dist/components/JoyButton/tests/JoyButton.spec.d.ts +1 -0
  5. package/dist/components/JoyCheckbox/JoyCheckbox.vue.d.ts +85 -0
  6. package/dist/components/JoyCheckbox/tests/JoyCheckbox.spec.d.ts +1 -0
  7. package/dist/components/JoyFormError/JoyFormError.vue.d.ts +23 -0
  8. package/dist/components/JoyFormError/tests/JoyFormError.spec.d.ts +1 -0
  9. package/dist/components/JoyHighlight/JoyHighlight.types.d.ts +3 -0
  10. package/dist/components/JoyHighlight/JoyHighlight.vue.d.ts +48 -0
  11. package/dist/components/JoyHighlight/tests/JoyHighlight.spec.d.ts +1 -0
  12. package/dist/components/JoyInput/JoyInput.vue.d.ts +56 -90
  13. package/dist/components/JoyLabel/JoyLabel.vue.d.ts +24 -10
  14. package/dist/components/JoyLabel/tests/JoyLabel.spec.d.ts +1 -0
  15. package/dist/components/JoyLink/JoyLink.types.d.ts +2 -0
  16. package/dist/components/JoyLink/JoyLink.vue.d.ts +35 -0
  17. package/dist/components/JoyRadio/JoyRadio.vue.d.ts +80 -0
  18. package/dist/components/JoyRadio/tests/JoyRadio.spec.d.ts +1 -0
  19. package/dist/components/JoyRadioGroup/JoyRadioGroup.vue.d.ts +50 -0
  20. package/dist/components/JoySelect/JoySelect.vue.d.ts +89 -0
  21. package/dist/components/JoySelect/tests/JoySelect.spec.d.ts +1 -0
  22. package/dist/components/JoySpinner/JoySpinner.vue.d.ts +6 -6
  23. package/dist/components/JoyTemplate/JoyTemplate.vue.d.ts +35 -0
  24. package/dist/components/JoyToggle/JoyToggle.vue.d.ts +71 -0
  25. package/dist/components/JoyToggle/tests/JoyToggle.spec.d.ts +1 -0
  26. package/dist/components/JoyWrapper/JoyWrapper.vue.d.ts +18 -11
  27. package/dist/components/index.d.ts +15 -6
  28. package/dist/components/main.d.ts +2 -3
  29. package/dist/composables/index.d.ts +1 -0
  30. package/dist/composables/props.d.ts +56 -0
  31. package/dist/helpers/index.d.ts +2 -0
  32. package/dist/joy-vue.js +646 -130
  33. package/dist/joy-vue.umd.cjs +1 -1
  34. package/dist/main.d.ts +1 -0
  35. package/dist/style.css +1 -1
  36. package/dist/tests/composables/prop.spec.d.ts +1 -0
  37. package/dist/tests/composables/test-components/CheckboxFormProps.vue.d.ts +62 -0
  38. package/dist/tests/composables/test-components/GenericFormProps.vue.d.ts +44 -0
  39. package/dist/tests/composables/test-components/GenericFormPropsWithLabel.vue.d.ts +55 -0
  40. package/dist/tests/helpers.spec.d.ts +1 -0
  41. package/dist/types/index.d.ts +1 -0
  42. package/joy-components.d.ts +15 -5
  43. package/package.json +50 -50
  44. package/dist/vite-env.d.ts +0 -1
package/dist/joy-vue.js CHANGED
@@ -1,29 +1,26 @@
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
- const T = ["teal", "white"], A = /* @__PURE__ */ _({
1
+ import { defineComponent as y, openBlock as s, createElementBlock as u, normalizeClass as d, useAttrs as z, computed as J, createBlock as w, resolveDynamicComponent as T, unref as f, withCtx as V, createCommentVNode as j, createElementVNode as n, renderSlot as r, ref as h, createTextVNode as R, toDisplayString as L, pushScopeId as O, popScopeId as N, mergeProps as C, useSlots as E, onBeforeMount as M, onMounted as A, watch as D } from "vue";
2
+ const G = ["teal", "white"], W = /* @__PURE__ */ y({
3
3
  __name: "JoySpinner",
4
4
  props: {
5
5
  color: {
6
6
  type: String,
7
7
  validator(e) {
8
- return T.includes(e);
8
+ return G.includes(e);
9
9
  }
10
10
  }
11
11
  },
12
12
  setup(e) {
13
- return (n, t) => (a(), r("div", {
14
- class: y(["joy-spinner", `joy-spinner_${e.color}`])
13
+ return (a, t) => (s(), u("div", {
14
+ class: d(["joy-spinner", `joy-spinner_${e.color}`])
15
15
  }, null, 2));
16
16
  }
17
17
  });
18
- const b = (e, n) => {
18
+ const _ = (e, a) => {
19
19
  const t = e.__vccOpts || e;
20
- for (const [p, s] of n)
21
- t[p] = s;
20
+ for (const [l, i] of a)
21
+ t[l] = i;
22
22
  return t;
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
- ...O,
25
- ...R
26
- ], P = [...F], Z = ["xxsmall", "xsmall", "small"], D = ["name", "size"], M = { class: "joy-button--slot" }, U = /* @__PURE__ */ _({
23
+ }, P = /* @__PURE__ */ _(W, [["__scopeId", "data-v-b633f633"]]), Z = ["primary", "secondary"], U = ["xlarge", "large", "medium", "small", "xsmall", "xxsmall"], K = ["neutral", "success", "info", "warning", "error"], X = ["main", "admin", "white", "ghost"], Q = [...Z, ...X], Y = [...U], x = ["xxsmall", "xsmall", "small"], ee = ["name", "size"], te = { class: "joy-button--slot" }, oe = /* @__PURE__ */ y({
27
24
  __name: "JoyButton",
28
25
  props: {
29
26
  /**
@@ -46,7 +43,7 @@ const b = (e, n) => {
46
43
  type: String,
47
44
  default: "primary",
48
45
  validator(e) {
49
- return W.includes(e);
46
+ return Q.includes(e);
50
47
  }
51
48
  },
52
49
  /** Button or Link size */
@@ -54,7 +51,7 @@ const b = (e, n) => {
54
51
  type: String,
55
52
  default: "medium",
56
53
  validator(e) {
57
- return P.includes(e);
54
+ return Y.includes(e);
58
55
  }
59
56
  },
60
57
  /** Override the icon size. Default to xsmall */
@@ -62,59 +59,246 @@ const b = (e, n) => {
62
59
  type: String,
63
60
  default: "xsmall",
64
61
  validator(e) {
65
- return Z.includes(e);
62
+ return x.includes(e);
66
63
  }
67
64
  }
68
65
  },
69
66
  setup(e) {
70
- const n = e, t = $(), p = v(() => ["white", "ghost", "secondary"].includes(n.variant) ? "teal" : "white");
71
- return (s, f) => (a(), I(L(l(t).href ? "a" : "button"), {
72
- disabled: e.loading || l(t).disabled,
73
- class: y([
67
+ const a = e, t = z(), l = J(() => ["white", "ghost", "secondary"].includes(a.variant) ? "teal" : "white");
68
+ return (i, c) => (s(), w(T(f(t).href ? "a" : "button"), {
69
+ disabled: e.loading || f(t).disabled,
70
+ class: d([
74
71
  "joy-button",
75
72
  `joy-button_${e.variant}`,
76
73
  `joy-button_${e.size}`,
77
74
  {
78
- "joy-button_circle": n.circle,
79
- "joy-button_loading": n.loading
75
+ "joy-button_circle": e.circle,
76
+ "joy-button_loading": e.loading
80
77
  }
81
78
  ])
82
79
  }, {
83
- default: J(() => [
84
- e.icon ? (a(), r("joy-icon", {
80
+ default: V(() => [
81
+ e.icon ? (s(), u("joy-icon", {
85
82
  key: 0,
86
83
  name: e.icon,
87
84
  size: e.iconSize,
88
85
  lazy: !1
89
- }, null, 8, D)) : d("", !0),
90
- e.loading ? (a(), I(z, {
86
+ }, null, 8, ee)) : j("", !0),
87
+ e.loading ? (s(), w(P, {
91
88
  key: 1,
92
- color: l(p)
93
- }, null, 8, ["color"])) : d("", !0),
94
- g("span", M, [
95
- S(s.$slots, "default", {}, void 0, !0)
89
+ color: f(l)
90
+ }, null, 8, ["color"])) : j("", !0),
91
+ n("span", te, [
92
+ r(i.$slots, "default", {}, void 0, !0)
96
93
  ])
97
94
  ]),
98
95
  _: 3
99
96
  }, 8, ["disabled", "class"]));
100
97
  }
101
98
  });
102
- const G = /* @__PURE__ */ b(U, [["__scopeId", "data-v-107b2043"]]), H = ["small", "medium", "large"], K = {
99
+ const ae = /* @__PURE__ */ _(oe, [["__scopeId", "data-v-08c3c0a6"]]), B = {
100
+ disabled: {
101
+ type: Boolean,
102
+ default: !1
103
+ },
104
+ id: {
105
+ type: String
106
+ },
107
+ invalid: {
108
+ type: Boolean,
109
+ default: !1
110
+ },
111
+ name: {
112
+ type: String
113
+ },
114
+ required: {
115
+ type: Boolean,
116
+ default: !1
117
+ }
118
+ }, F = {
119
+ modelValue: {
120
+ type: Boolean,
121
+ default: !1
122
+ },
123
+ value: {
124
+ type: String,
125
+ default: "on"
126
+ },
127
+ ...B
128
+ }, H = {
129
+ label: String,
130
+ labelSize: {
131
+ type: String,
132
+ default: "medium"
133
+ }
134
+ }, le = ["aria-checked", "aria-hidden"], ne = ["name", "disabled", "checked", "required", "aria-checked", "value", "indeterminate"], ie = { class: "joy-checkbox__content-wrapper" }, se = { class: "joy-checkbox__content" }, re = /* @__PURE__ */ y({
135
+ __name: "JoyCheckbox",
136
+ props: {
137
+ /** Can't be used in addition of v-model. See usage : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes */
138
+ indeterminate: {
139
+ type: Boolean,
140
+ default: !1
141
+ },
142
+ ...F
143
+ },
144
+ emits: ["update:modelValue"],
145
+ setup(e, { expose: a, emit: t }) {
146
+ const l = e, i = h(), c = h(l.indeterminate), S = {
147
+ onChange: (o) => {
148
+ const p = o.target.checked;
149
+ c.value = !1, t("update:modelValue", p);
150
+ }
151
+ };
152
+ return a({
153
+ isIndeterminate: c
154
+ }), (o, p) => (s(), u("div", {
155
+ "aria-checked": o.modelValue,
156
+ "aria-hidden": o.disabled
157
+ }, [
158
+ n("label", {
159
+ class: d([
160
+ "joy-checkbox",
161
+ {
162
+ "joy-checkbox__checked": o.modelValue,
163
+ "joy-checkbox__indeterminate": c.value
164
+ }
165
+ ])
166
+ }, [
167
+ n("input", {
168
+ ref_key: "input",
169
+ ref: i,
170
+ type: "checkbox",
171
+ class: "joy-checkbox__input",
172
+ role: "checkbox",
173
+ name: o.name,
174
+ disabled: o.disabled,
175
+ checked: o.modelValue,
176
+ required: o.required,
177
+ "aria-checked": o.modelValue,
178
+ value: o.value,
179
+ indeterminate: c.value,
180
+ onChange: p[0] || (p[0] = //@ts-ignore
181
+ (...b) => S.onChange && S.onChange(...b))
182
+ }, null, 40, ne),
183
+ n("div", ie, [
184
+ r(o.$slots, "default", {}, void 0, !0),
185
+ n("div", se, [
186
+ r(o.$slots, "checkbox-content", {}, void 0, !0)
187
+ ])
188
+ ])
189
+ ], 2)
190
+ ], 8, le));
191
+ }
192
+ });
193
+ const de = /* @__PURE__ */ _(re, [["__scopeId", "data-v-61d9cccf"]]), ue = (e) => (O("data-v-eba58103"), e = e(), N(), e), ce = ["aria-hidden"], pe = /* @__PURE__ */ ue(() => /* @__PURE__ */ n("joy-icon", {
194
+ "custom-class": "joy-icon-error",
195
+ name: "warning-triangle"
196
+ }, null, -1)), ye = /* @__PURE__ */ y({
197
+ __name: "JoyFormError",
198
+ props: {
199
+ visible: {
200
+ type: Boolean,
201
+ default: !0
202
+ },
203
+ noHtmlErrorText: String
204
+ },
205
+ setup(e) {
206
+ return (a, t) => (s(), u("div", {
207
+ "aria-hidden": e.visible,
208
+ class: d(["joy-form-error", { "joy-has-error": e.visible }]),
209
+ role: "alert"
210
+ }, [
211
+ pe,
212
+ n("div", null, [
213
+ r(a.$slots, "default", {}, () => [
214
+ R(L(e.noHtmlErrorText), 1)
215
+ ], !0)
216
+ ])
217
+ ], 10, ce));
218
+ }
219
+ });
220
+ const _e = /* @__PURE__ */ _(ye, [["__scopeId", "data-v-eba58103"]]);
221
+ function me(e) {
222
+ let a;
223
+ switch (e) {
224
+ case "error":
225
+ a = "warning-triangle";
226
+ break;
227
+ case "success":
228
+ a = "check";
229
+ break;
230
+ default:
231
+ a = "info-circle";
232
+ }
233
+ return a;
234
+ }
235
+ const ve = [...K], fe = ["name"], ge = { class: "joy-highlight--text" }, he = /* @__PURE__ */ y({
236
+ __name: "JoyHighlight",
237
+ props: {
238
+ accent: {
239
+ type: Boolean,
240
+ default: !1
241
+ },
242
+ displayIcon: {
243
+ type: Boolean,
244
+ default: !1
245
+ },
246
+ icon: String,
247
+ level: {
248
+ type: String,
249
+ default: "neutral",
250
+ validator(e) {
251
+ return ve.includes(e);
252
+ }
253
+ }
254
+ },
255
+ setup(e, { expose: a }) {
256
+ const t = e, l = J(() => t.icon ? t.icon : me(t.level));
257
+ return a({
258
+ getRelevantIcon: l
259
+ }), (i, c) => (s(), u("div", {
260
+ class: d([
261
+ "joy-highlight",
262
+ `joy-highlight_${e.level}`,
263
+ {
264
+ "joy-highlight__accent": e.accent,
265
+ "joy-highlight__titled": i.$slots["highlight-title"]
266
+ }
267
+ ])
268
+ }, [
269
+ e.displayIcon ? (s(), u("joy-icon", {
270
+ key: 0,
271
+ name: f(l)
272
+ }, null, 8, fe)) : j("", !0),
273
+ n("div", ge, [
274
+ n("strong", null, [
275
+ r(i.$slots, "highlight-title", {}, void 0, !0)
276
+ ]),
277
+ r(i.$slots, "default", {}, void 0, !0)
278
+ ])
279
+ ], 2));
280
+ }
281
+ });
282
+ const be = /* @__PURE__ */ _(he, [["__scopeId", "data-v-15d3fa11"]]), je = ["small", "medium", "large"], Se = {
103
283
  key: 0,
104
284
  class: "joy-label-required"
105
- }, Q = {
285
+ }, $e = {
106
286
  key: 1,
107
287
  class: "joy-label-optional"
108
- }, X = /* @__PURE__ */ _({
288
+ }, ke = /* @__PURE__ */ y({
109
289
  __name: "JoyLabel",
110
290
  props: {
111
291
  size: {
112
292
  type: String,
113
293
  default: "medium",
114
294
  validator(e) {
115
- return H.includes(e);
295
+ return je.includes(e);
116
296
  }
117
297
  },
298
+ tagName: {
299
+ type: String,
300
+ default: "label"
301
+ },
118
302
  required: {
119
303
  type: Boolean,
120
304
  default: !1
@@ -124,45 +308,33 @@ const G = /* @__PURE__ */ b(U, [["__scopeId", "data-v-107b2043"]]), H = ["small"
124
308
  }
125
309
  },
126
310
  setup(e) {
127
- const n = e;
128
- return (t, p) => (a(), r("label", x({
311
+ return (a, t) => (s(), w(T(e.tagName), C({
129
312
  class: ["joy-label", `joy-label--${e.size}`]
130
- }, t.$attrs), [
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
- ], 16));
313
+ }, a.$attrs), {
314
+ default: V(() => [
315
+ r(a.$slots, "default", {}, void 0, !0),
316
+ e.required ? (s(), u("span", Se, "*")) : j("", !0),
317
+ e.optionalLabel ? (s(), u("span", $e, "- " + L(e.optionalLabel), 1)) : j("", !0)
318
+ ]),
319
+ _: 3
320
+ }, 16, ["class"]));
135
321
  }
136
322
  });
137
- const h = /* @__PURE__ */ b(X, [["__scopeId", "data-v-21392cc3"]]), Y = ["id", "type", "value"], ee = ["data-unit"], te = /* @__PURE__ */ _({
323
+ const q = /* @__PURE__ */ _(ke, [["__scopeId", "data-v-e3232407"]]), Je = ["id", "type", "value"], Ie = ["data-unit"], we = /* @__PURE__ */ y({
138
324
  __name: "JoyInput",
139
325
  props: {
326
+ ...B,
327
+ ...H,
140
328
  clearable: {
141
329
  type: Boolean,
142
330
  default: !1
143
331
  },
144
332
  icon: String,
145
- invalid: {
146
- type: Boolean,
147
- default: !1
148
- },
149
- labelSize: String,
150
333
  modelValue: {
151
334
  type: String,
152
335
  default: ""
153
336
  },
154
- /**
155
- * For accessibility purpose, the name is required. it will be mapped to the input ID, and the label "for" attribute as well.
156
- */
157
- name: {
158
- type: String,
159
- required: !0
160
- },
161
337
  optionalLabel: String,
162
- required: {
163
- type: Boolean,
164
- default: !1
165
- },
166
338
  requiredMark: {
167
339
  type: Boolean,
168
340
  default: !1
@@ -175,106 +347,335 @@ const h = /* @__PURE__ */ b(X, [["__scopeId", "data-v-21392cc3"]]), Y = ["id", "
175
347
  unit: String
176
348
  },
177
349
  emits: ["update:modelValue"],
178
- setup(e, { emit: n }) {
179
- const t = e, p = m(), s = m(), f = $(), w = E(), j = m(!1), k = v(() => t.clearable && t.modelValue.length > 0 && !t.unit), V = v(() => w.default && w.default()), C = v(() => {
180
- var u, o;
181
- return !!((u = s.value) != null && u.closest("joy-wrapper")) || !!((o = s.value) != null && o.closest(".joy-wrapper"));
182
- }), B = m(t.type);
183
- q(() => {
184
- B.value = t.unit ? "number" : t.unit || "text";
350
+ setup(e, { emit: a }) {
351
+ const t = e, l = h(), i = h(), c = z(), S = E(), o = h(!1), p = J(() => t.clearable && t.modelValue.length > 0 && !t.unit), b = J(() => S.default && S.default()), I = J(() => {
352
+ var m, v;
353
+ return !!((m = i.value) != null && m.closest("joy-wrapper")) || !!((v = i.value) != null && v.closest(".joy-wrapper"));
354
+ }), g = h(t.type);
355
+ M(() => {
356
+ g.value = t.unit ? "number" : t.unit || "text";
185
357
  });
186
- const i = {
358
+ const $ = {
187
359
  onFocus: () => {
188
- j.value = !0;
360
+ o.value = !0;
189
361
  },
190
362
  onBlur: () => {
191
- j.value = !1;
363
+ o.value = !1;
192
364
  },
193
- onInput: (u) => {
194
- let o = u.target.value;
195
- n("update:modelValue", o);
365
+ onInput: (m) => {
366
+ let v = m.target.value;
367
+ a("update:modelValue", v);
196
368
  },
197
369
  clearValue: () => {
198
- n("update:modelValue", "");
370
+ a("update:modelValue", "");
199
371
  }
200
372
  };
201
- return (u, o) => (a(), r("div", {
373
+ return (m, v) => (s(), u("div", {
202
374
  ref_key: "root",
203
- ref: s,
204
- class: y([`joy-input--${t.size}`])
375
+ ref: i,
376
+ class: d([`joy-input--${t.size}`])
205
377
  }, [
206
- g("div", {
207
- class: y([
378
+ n("div", {
379
+ class: d([
208
380
  "joy-input",
209
381
  {
210
- "joy-input--focusing": j.value,
211
- "joy-input--disabled": l(f).disabled,
212
- "joy-input--invalid": t.invalid,
213
- "joy-input--valid": !t.invalid && !l(f).disabled
382
+ "joy-input--focusing": o.value,
383
+ "joy-input--disabled": f(c).disabled,
384
+ "joy-input--invalid": m.invalid,
385
+ "joy-input--valid": !m.invalid && !f(c).disabled
214
386
  }
215
387
  ])
216
388
  }, [
217
- l(V) ? (a(), I(h, {
389
+ f(b) ? (s(), w(q, {
218
390
  key: 0,
219
- for: t.name,
220
- required: t.required && t.requiredMark,
391
+ for: m.name,
392
+ required: m.required && e.requiredMark,
221
393
  "optional-label": e.optionalLabel,
222
- size: e.labelSize
394
+ size: m.labelSize
223
395
  }, {
224
- default: J(() => [
225
- S(u.$slots, "default", {}, void 0, !0)
396
+ default: V(() => [
397
+ r(m.$slots, "default", {}, void 0, !0)
226
398
  ]),
227
399
  _: 3
228
- }, 8, ["for", "required", "optional-label", "size"])) : d("", !0),
229
- g("div", {
230
- class: y([
400
+ }, 8, ["for", "required", "optional-label", "size"])) : j("", !0),
401
+ n("div", {
402
+ class: d([
231
403
  "joy-input--wrapper",
232
404
  {
233
- "joy-input--wrapper-has-icon": !!t.icon,
234
- "joy-input--wrapper---clearable": t.clearable,
235
- "joy-input--wrapper-unit": !!t.unit,
236
- "joy-input--wrapper-margin": !l(C)
405
+ "joy-input--wrapper-has-icon": !!e.icon,
406
+ "joy-input--wrapper---clearable": e.clearable,
407
+ "joy-input--wrapper-unit": !!e.unit,
408
+ "joy-input--wrapper-margin": !f(I)
237
409
  }
238
410
  ])
239
411
  }, [
240
- g("input", x(u.$attrs, {
412
+ n("input", C(m.$attrs, {
241
413
  id: t.name,
242
414
  ref_key: "input",
243
- ref: p,
415
+ ref: l,
244
416
  class: [
245
417
  {
246
- "joy-input--field-disabled": l(f).disabled,
247
- "joy-input--field-invalid": t.invalid
418
+ "joy-input--field-disabled": f(c).disabled,
419
+ "joy-input--field-invalid": m.invalid
248
420
  }
249
421
  ],
250
- type: B.value,
422
+ type: g.value,
251
423
  value: e.modelValue,
252
- onFocus: o[0] || (o[0] = //@ts-ignore
253
- (...c) => i.onFocus && i.onFocus(...c)),
254
- onBlur: o[1] || (o[1] = //@ts-ignore
255
- (...c) => i.onBlur && i.onBlur(...c)),
256
- onInput: o[2] || (o[2] = //@ts-ignore
257
- (...c) => i.onInput && i.onInput(...c))
258
- }), null, 16, Y),
259
- l(k) ? (a(), r("joy-icon", {
424
+ onFocus: v[0] || (v[0] = //@ts-ignore
425
+ (...k) => $.onFocus && $.onFocus(...k)),
426
+ onBlur: v[1] || (v[1] = //@ts-ignore
427
+ (...k) => $.onBlur && $.onBlur(...k)),
428
+ onInput: v[2] || (v[2] = //@ts-ignore
429
+ (...k) => $.onInput && $.onInput(...k))
430
+ }), null, 16, Je),
431
+ f(p) ? (s(), u("joy-icon", {
260
432
  key: 0,
261
433
  size: "xxsmall",
262
434
  name: "cross",
263
435
  class: "joy-input--clear",
264
- onClick: o[3] || (o[3] = //@ts-ignore
265
- (...c) => i.clearValue && i.clearValue(...c))
266
- })) : d("", !0),
267
- t.unit ? (a(), r("div", {
436
+ onClick: v[3] || (v[3] = //@ts-ignore
437
+ (...k) => $.clearValue && $.clearValue(...k))
438
+ })) : j("", !0),
439
+ e.unit ? (s(), u("div", {
268
440
  key: 1,
269
- "data-unit": t.unit,
441
+ "data-unit": e.unit,
270
442
  class: "joy-input--unit"
271
- }, null, 8, ee)) : d("", !0)
443
+ }, null, 8, Ie)) : j("", !0)
272
444
  ], 2)
273
445
  ], 2)
274
446
  ], 2));
275
447
  }
276
448
  });
277
- const ne = /* @__PURE__ */ b(te, [["__scopeId", "data-v-2249f4f9"]]), oe = /* @__PURE__ */ _({
449
+ const Ve = /* @__PURE__ */ _(we, [["__scopeId", "data-v-6eb67b7e"]]), Be = ["teal", "white"], Le = ["href"], Ce = ["color", "name"], Ee = /* @__PURE__ */ y({
450
+ __name: "JoyLink",
451
+ props: {
452
+ href: {
453
+ type: String,
454
+ required: !0
455
+ },
456
+ color: {
457
+ type: String,
458
+ default: "teal",
459
+ validator(e) {
460
+ return Be.includes(e);
461
+ }
462
+ },
463
+ icon: String
464
+ },
465
+ setup(e) {
466
+ const a = e, t = J(() => a.color === "white" ? "white" : "teal");
467
+ return (l, i) => (s(), u("a", C({ href: e.href }, l.$attrs, {
468
+ class: ["joy-link", `joy-link_${e.color}`]
469
+ }), [
470
+ e.icon ? (s(), u("joy-icon", {
471
+ key: 0,
472
+ color: f(t),
473
+ name: e.icon
474
+ }, null, 8, Ce)) : j("", !0),
475
+ r(l.$slots, "default", {}, void 0, !0)
476
+ ], 16, Le));
477
+ }
478
+ });
479
+ const qe = /* @__PURE__ */ _(Ee, [["__scopeId", "data-v-640ee9a6"]]), ze = ["id", "value", "checked", "disabled", "required", "name"], Te = { class: "joy-radio-label" }, Re = { class: "joy-radio-content__wrapper" }, Oe = { class: "joy-radio-content" }, Ne = /* @__PURE__ */ y({
480
+ __name: "JoyRadio",
481
+ props: {
482
+ ...B,
483
+ modelValue: {
484
+ type: String
485
+ },
486
+ theme: {
487
+ type: String,
488
+ default: "default"
489
+ },
490
+ value: {
491
+ type: String
492
+ }
493
+ },
494
+ emits: ["update:modelValue"],
495
+ setup(e, { expose: a, emit: t }) {
496
+ const l = e, i = h(!1), c = h(null), S = h(null), o = E(), p = J(() => !l.modelValue || !l.value ? !1 : l.modelValue === l.value);
497
+ function b() {
498
+ i.value = !!o["expandable-content"] && p.value;
499
+ }
500
+ function I() {
501
+ t("update:modelValue", l.value), b();
502
+ }
503
+ return A(() => {
504
+ l.theme === "outline" && b();
505
+ }), D(
506
+ () => l.modelValue,
507
+ () => {
508
+ b();
509
+ }
510
+ ), a({
511
+ checked: p,
512
+ isExpanded: i
513
+ }), (g, $) => (s(), u("label", {
514
+ ref_key: "root",
515
+ ref: c,
516
+ class: d([
517
+ "joy-radio",
518
+ `joy-radio--${e.theme}`,
519
+ {
520
+ "joy-radio--checked": f(p),
521
+ "joy-radio--disabled": g.disabled,
522
+ "joy-radio--invalid": g.invalid
523
+ }
524
+ ])
525
+ }, [
526
+ n("input", {
527
+ id: g.name,
528
+ type: "radio",
529
+ value: e.value,
530
+ checked: f(p),
531
+ disabled: g.disabled,
532
+ required: g.required,
533
+ name: g.name,
534
+ onChange: I
535
+ }, null, 40, ze),
536
+ n("span", Te, [
537
+ r(g.$slots, "default", {}, void 0, !0)
538
+ ]),
539
+ n("div", Re, [
540
+ n("div", Oe, [
541
+ r(g.$slots, "radio-content", {}, void 0, !0)
542
+ ]),
543
+ n("div", {
544
+ ref_key: "expandableElement",
545
+ ref: S,
546
+ class: d(["joy-radio-expandable", { "joy-radio-expandable--expanded": i.value }])
547
+ }, [
548
+ r(g.$slots, "expandable-content", {}, void 0, !0)
549
+ ], 2)
550
+ ])
551
+ ], 2));
552
+ }
553
+ });
554
+ const Ae = /* @__PURE__ */ _(Ne, [["__scopeId", "data-v-822f5782"]]), Pe = ["form", "name"], Fe = /* @__PURE__ */ y({
555
+ __name: "JoyRadioGroup",
556
+ props: {
557
+ direction: {
558
+ type: String,
559
+ default: "horizontal"
560
+ },
561
+ form: {
562
+ type: String
563
+ },
564
+ modelValue: {
565
+ type: String
566
+ },
567
+ name: {
568
+ type: String
569
+ },
570
+ invalid: Boolean,
571
+ invalidText: {
572
+ type: String
573
+ }
574
+ },
575
+ setup(e) {
576
+ return (a, t) => (s(), u("fieldset", {
577
+ ref: "root",
578
+ class: "joy-radio-group-fieldset",
579
+ role: "radiogroup",
580
+ form: e.form,
581
+ name: e.name
582
+ }, [
583
+ r(a.$slots, "radio-group-legend", {}, void 0, !0),
584
+ n("div", {
585
+ class: d(["joy-radio-group-container", `joy-radio-group-${e.direction}`])
586
+ }, [
587
+ r(a.$slots, "default", {}, void 0, !0)
588
+ ], 2)
589
+ ], 8, Pe));
590
+ }
591
+ });
592
+ const He = /* @__PURE__ */ _(Fe, [["__scopeId", "data-v-09adf076"]]), Me = (e) => (O("data-v-7733736c"), e = e(), N(), e), De = ["id", "name", "aria-invalid", "required", "disabled", "value"], Ge = /* @__PURE__ */ Me(() => /* @__PURE__ */ n("joy-icon", {
593
+ class: "joy-select__chevron",
594
+ name: "chevron-down"
595
+ }, null, -1)), We = /* @__PURE__ */ y({
596
+ __name: "JoySelect",
597
+ props: {
598
+ ...B,
599
+ ...H,
600
+ modelValue: {
601
+ type: String,
602
+ default: ""
603
+ },
604
+ optionalLabel: {
605
+ type: String
606
+ },
607
+ requiredMark: {
608
+ type: Boolean,
609
+ default: !1
610
+ }
611
+ },
612
+ emits: ["update:modelValue"],
613
+ setup(e, { emit: a }) {
614
+ const t = e, l = h(), i = h(), c = E();
615
+ A(() => {
616
+ var b;
617
+ const o = c.label && c.label();
618
+ if (!o || !o.length)
619
+ return;
620
+ const p = o[0];
621
+ if (p.type === "JoyLabel") {
622
+ const I = (b = p.props) == null ? void 0 : b.for;
623
+ if (!I) {
624
+ console.warn("JoyLabel for attribute is missing");
625
+ return;
626
+ }
627
+ I !== t.id && console.warn("JoyLabel for attribute does not match with JoySelect id");
628
+ }
629
+ });
630
+ function S(o) {
631
+ const p = o.target.value;
632
+ a("update:modelValue", p);
633
+ }
634
+ return (o, p) => (s(), u("div", {
635
+ ref_key: "root",
636
+ ref: l
637
+ }, [
638
+ r(o.$slots, "label", {}, () => [
639
+ o.label ? (s(), w(q, {
640
+ key: 0,
641
+ required: o.required && e.requiredMark,
642
+ "optional-label": e.optionalLabel,
643
+ for: o.id || o.name,
644
+ size: o.labelSize
645
+ }, {
646
+ default: V(() => [
647
+ R(L(o.label), 1)
648
+ ]),
649
+ _: 1
650
+ }, 8, ["required", "optional-label", "for", "size"])) : j("", !0)
651
+ ], !0),
652
+ n("div", {
653
+ class: d({
654
+ "joy-select__wrapper": !0,
655
+ "joy-select--invalid": o.invalid,
656
+ "joy-select--disabled": o.disabled
657
+ })
658
+ }, [
659
+ n("select", {
660
+ id: o.id || o.name,
661
+ ref_key: "select",
662
+ ref: i,
663
+ class: "joy-select",
664
+ name: o.name,
665
+ "aria-invalid": o.invalid,
666
+ required: o.required,
667
+ disabled: o.disabled,
668
+ value: e.modelValue,
669
+ onInput: S
670
+ }, [
671
+ r(o.$slots, "default", {}, void 0, !0)
672
+ ], 40, De),
673
+ Ge
674
+ ], 2)
675
+ ], 512));
676
+ }
677
+ });
678
+ const Ze = /* @__PURE__ */ _(We, [["__scopeId", "data-v-7733736c"]]), Ue = /* @__PURE__ */ y({
278
679
  __name: "JoyWrapper",
279
680
  props: {
280
681
  justify: {
@@ -295,29 +696,144 @@ const ne = /* @__PURE__ */ b(te, [["__scopeId", "data-v-2249f4f9"]]), oe = /* @_
295
696
  }
296
697
  },
297
698
  setup(e) {
298
- return (n, t) => (a(), r("div", {
299
- class: y([
300
- "joy-wrapper",
301
- `joy-wrapper--justify-${e.justify}`,
302
- `joy-wrapper--align-${e.align}`,
303
- `joy-wrapper--direction-${e.direction}`,
304
- `joy-wrapper--wrap-${e.wrap}`
305
- ])
699
+ return (a, t) => (s(), u("div", {
700
+ class: d(["joy-wrapper", `joy-wrapper--justify-${e.justify}`, `joy-wrapper--align-${e.align}`, `joy-wrapper--direction-${e.direction}`, `joy-wrapper--wrap-${e.wrap}`])
701
+ }, [
702
+ r(a.$slots, "default", {}, void 0, !0)
703
+ ], 2));
704
+ }
705
+ });
706
+ const Ke = /* @__PURE__ */ _(Ue, [["__scopeId", "data-v-dce6df77"]]), Xe = { class: "joy-template__heading" }, Qe = { class: "joy-template__heading___headings" }, Ye = /* @__PURE__ */ y({
707
+ __name: "JoyTemplate",
708
+ props: {
709
+ full: { type: Boolean, default: !1 },
710
+ sidebar: { type: String, default: "right" }
711
+ },
712
+ setup(e) {
713
+ const a = e;
714
+ return (t, l) => (s(), u("main", {
715
+ class: d(["joy-template", { "joy-template--full": a.full }])
306
716
  }, [
307
- S(n.$slots, "default")
717
+ n("div", Xe, [
718
+ n("div", {
719
+ class: d({ "joy-template-slot-back": t.$slots["template-back"] })
720
+ }, [
721
+ r(t.$slots, "template-back", {}, void 0, !0)
722
+ ], 2),
723
+ n("div", Qe, [
724
+ n("div", {
725
+ class: d({ "joy-template-slot-title": t.$slots["template-title"] })
726
+ }, [
727
+ r(t.$slots, "template-title", {}, void 0, !0)
728
+ ], 2),
729
+ n("div", {
730
+ class: d({ "joy-template-slot-subtitle": t.$slots["template-subtitle"] })
731
+ }, [
732
+ r(t.$slots, "template-subtitle", {}, void 0, !0)
733
+ ], 2)
734
+ ])
735
+ ]),
736
+ n("div", {
737
+ class: d([
738
+ "joy-template__content",
739
+ {
740
+ "joy-template__content--reverse": a.sidebar === "left"
741
+ }
742
+ ])
743
+ }, [
744
+ n("div", {
745
+ class: d({ "joy-template-slot-main": t.$slots["template-main"] })
746
+ }, [
747
+ r(t.$slots, "template-main", {}, void 0, !0)
748
+ ], 2),
749
+ n("div", {
750
+ class: d({ "joy-template-slot-sidebar": t.$slots["template-sidebar"] })
751
+ }, [
752
+ r(t.$slots, "template-sidebar", {}, void 0, !0)
753
+ ], 2)
754
+ ], 2)
308
755
  ], 2));
309
756
  }
310
757
  });
311
- const le = {
758
+ const xe = /* @__PURE__ */ _(Ye, [["__scopeId", "data-v-d8b3fcfa"]]), et = ["name", "disabled", "checked", "required", "aria-checked", "value"], tt = { class: "joy-toggle__content" }, ot = /* @__PURE__ */ y({
759
+ __name: "JoyToggle",
760
+ props: F,
761
+ emits: ["update:modelValue"],
762
+ setup(e, { emit: a }) {
763
+ const t = {
764
+ onChange: (l) => {
765
+ const i = l.target.checked;
766
+ a("update:modelValue", i);
767
+ }
768
+ };
769
+ return (l, i) => (s(), u("div", null, [
770
+ n("label", {
771
+ class: d([
772
+ "joy-toggle",
773
+ {
774
+ "joy-toggle__checked": l.modelValue,
775
+ "joy-toggle__disabled": l.disabled
776
+ }
777
+ ])
778
+ }, [
779
+ n("input", {
780
+ ref: "input",
781
+ type: "checkbox",
782
+ class: "joy-toggle__input",
783
+ role: "checkbox",
784
+ name: l.name,
785
+ disabled: l.disabled,
786
+ checked: l.modelValue,
787
+ required: l.required,
788
+ "aria-checked": l.modelValue,
789
+ value: l.value,
790
+ onChange: i[0] || (i[0] = //@ts-ignore
791
+ (...c) => t.onChange && t.onChange(...c))
792
+ }, null, 40, et),
793
+ n("p", tt, [
794
+ r(l.$slots, "default", {}, void 0, !0)
795
+ ])
796
+ ], 2)
797
+ ]));
798
+ }
799
+ });
800
+ const at = /* @__PURE__ */ _(ot, [["__scopeId", "data-v-e617de9c"]]), lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
801
+ __proto__: null,
802
+ JoyButton: ae,
803
+ JoyCheckbox: de,
804
+ JoyFormError: _e,
805
+ JoyHighlight: be,
806
+ JoyInput: Ve,
807
+ JoyLabel: q,
808
+ JoyLink: qe,
809
+ JoyRadio: Ae,
810
+ JoyRadioGroup: He,
811
+ JoySelect: Ze,
812
+ JoySpinner: P,
813
+ JoyTemplate: xe,
814
+ JoyToggle: at,
815
+ JoyWrapper: Ke
816
+ }, Symbol.toStringTag, { value: "Module" })), it = {
312
817
  install: (e) => {
313
- e.component("JoyButton", G), e.component("JoyInput", ne), e.component("JoyLabel", h), e.component("JoySpinner", z), e.component("JoyWrapper", oe);
818
+ Object.entries(lt).forEach(([a, t]) => {
819
+ e.component(a, t);
820
+ });
314
821
  }
315
822
  };
316
823
  export {
317
- G as JoyButton,
318
- ne as JoyInput,
319
- h as JoyLabel,
320
- z as JoySpinner,
321
- le as JoyVuePlugin,
322
- oe as JoyWrapper
824
+ ae as JoyButton,
825
+ de as JoyCheckbox,
826
+ _e as JoyFormError,
827
+ be as JoyHighlight,
828
+ Ve as JoyInput,
829
+ q as JoyLabel,
830
+ qe as JoyLink,
831
+ Ae as JoyRadio,
832
+ He as JoyRadioGroup,
833
+ Ze as JoySelect,
834
+ P as JoySpinner,
835
+ xe as JoyTemplate,
836
+ at as JoyToggle,
837
+ it as JoyVuePlugin,
838
+ Ke as JoyWrapper
323
839
  };