@simsustech/quasar-components 0.1.3 → 0.2.0

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 (64) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{QSubmitButton.vue_vue_type_script_setup_true_lang.1d0c06eb.js → QSubmitButton.vue_vue_type_script_setup_true_lang.65d6ac94.js} +6 -2
  3. package/dist/authentication.js +3 -3
  4. package/dist/en-US.d5751f99.js +217 -0
  5. package/dist/flags.js +5 -215
  6. package/dist/form.js +492 -0
  7. package/dist/general.js +341 -12
  8. package/dist/icons.js +2 -2
  9. package/dist/{nl.6b0aedb7.js → nl.1df15493.js} +1 -1
  10. package/dist/nl.7a710ba4.js +35 -0
  11. package/dist/style.css +2 -2
  12. package/dist/types/ui/form/BooleanItem.vue.d.ts +57 -0
  13. package/dist/types/ui/form/BooleanSelect.vue.d.ts +66 -0
  14. package/dist/types/ui/form/DateInput.vue.d.ts +61 -0
  15. package/dist/types/ui/form/FormInput.vue.d.ts +60 -0
  16. package/dist/types/ui/form/FormItem.vue.d.ts +64 -0
  17. package/dist/types/ui/form/GenderItem.vue.d.ts +57 -0
  18. package/dist/types/ui/form/GenderSelect.vue.d.ts +66 -0
  19. package/dist/types/ui/form/PostalCodeInput.vue.d.ts +67 -0
  20. package/dist/types/ui/form/TelephoneNumberInput.vue.d.ts +65 -0
  21. package/dist/types/ui/form/index.d.ts +9 -0
  22. package/dist/types/ui/form/lang/en-US.d.ts +3 -0
  23. package/dist/types/ui/form/lang/index.d.ts +68 -0
  24. package/dist/types/ui/form/lang/nl.d.ts +3 -0
  25. package/dist/types/ui/general/QLanguageSelect.vue.d.ts +58 -0
  26. package/dist/types/ui/general/QSubmitButton.vue.d.ts +21 -1
  27. package/dist/types/ui/general/ResourcePage.vue.d.ts +159 -0
  28. package/dist/types/ui/general/ResponsiveDialog.vue.d.ts +108 -0
  29. package/dist/types/ui/general/index.d.ts +3 -0
  30. package/dist/types/virtualModules.d.ts +1 -0
  31. package/dist/virtualModules.d.ts +1 -0
  32. package/dist/virtualModules.js +3 -2
  33. package/dist/vite-plugin.js +26 -5
  34. package/package.json +6 -1
  35. package/src/ui/authentication/lang/en-US.ts +1 -2
  36. package/src/ui/authentication/lang/nl.ts +1 -2
  37. package/src/ui/flags/README.md +1 -1
  38. package/src/ui/form/BooleanItem.vue +34 -0
  39. package/src/ui/form/BooleanSelect.vue +55 -0
  40. package/src/ui/form/DateInput.vue +70 -0
  41. package/src/ui/form/FormInput.vue +44 -0
  42. package/src/ui/form/FormItem.vue +50 -0
  43. package/src/ui/form/GenderItem.vue +35 -0
  44. package/src/ui/form/GenderSelect.vue +59 -0
  45. package/src/ui/form/PostalCodeInput.vue +47 -0
  46. package/src/ui/form/TelephoneNumberInput.vue +35 -0
  47. package/src/ui/form/index.ts +9 -0
  48. package/src/ui/form/lang/en-US.ts +36 -0
  49. package/src/ui/form/lang/index.ts +70 -0
  50. package/src/ui/form/lang/nl.ts +36 -0
  51. package/src/ui/general/QLanguageSelect.vue +86 -0
  52. package/src/ui/general/QStyledCard.vue +1 -1
  53. package/src/ui/general/QSubmitButton.vue +6 -1
  54. package/src/ui/general/ResourcePage.vue +121 -0
  55. package/src/ui/general/ResponsiveDialog.vue +94 -0
  56. package/src/ui/general/index.ts +3 -0
  57. package/src/ui/icons/README.md +2 -0
  58. package/src/virtualModules.ts +48 -5
  59. package/src/vite-plugin.ts +26 -6
  60. package/vite.config.ts +30 -30
  61. package/dist/types/ui/index.d.ts +0 -1
  62. package/src/ui/index.ts +0 -1
  63. /package/dist/types/ui/icons/{icons.d.ts → labels.d.ts} +0 -0
  64. /package/src/ui/icons/{icons.ts → labels.ts} +0 -0
package/dist/form.js ADDED
@@ -0,0 +1,492 @@
1
+ import { ref, defineComponent, useAttrs, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, computed, useSlots, renderSlot, createCommentVNode, resolveDirective, createElementVNode, withDirectives } from "vue";
2
+ import { useQuasar, QSelect, QItem, QItemSection, QItemLabel, QInput, QIcon, QBtn, QDate, QPopupProxy } from "quasar";
3
+ const lang$1 = {
4
+ isoName: "en-US",
5
+ yes: "Yes",
6
+ no: "No",
7
+ buttons: {
8
+ close: "Close"
9
+ },
10
+ fields: {
11
+ name: "Name",
12
+ firstName: "First name",
13
+ surname: "Surname",
14
+ address: "Address",
15
+ postalCode: "Postal code",
16
+ city: "City",
17
+ telephoneNumber: "Telephone number"
18
+ },
19
+ validations: {
20
+ fieldRequired: "Field is required."
21
+ },
22
+ gender: {
23
+ gender: "Gender",
24
+ male: "Male",
25
+ female: "Female",
26
+ other: "Other"
27
+ },
28
+ postalCode: {
29
+ postalCode: "Postal code",
30
+ validations: {
31
+ invalidPostalCode: "Invalid postal code"
32
+ }
33
+ }
34
+ };
35
+ const enUS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
36
+ __proto__: null,
37
+ default: lang$1
38
+ }, Symbol.toStringTag, { value: "Module" }));
39
+ const lang = ref(lang$1);
40
+ const locales = /* @__PURE__ */ Object.assign({ "./en-US.ts": () => Promise.resolve().then(() => enUS), "./nl.ts": () => import("./nl.7a710ba4.js") });
41
+ const useLang = () => {
42
+ return lang;
43
+ };
44
+ let loadingLanguage = false;
45
+ const loadLang = async (isoName) => {
46
+ if (!loadingLanguage) {
47
+ loadingLanguage = true;
48
+ try {
49
+ const data = (await locales[`./${isoName}.ts`]()).default;
50
+ if (data) {
51
+ lang.value = data;
52
+ }
53
+ } catch (e) {
54
+ if ({ "BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true }.DEBUG)
55
+ console.error(e);
56
+ throw new Error(
57
+ `[quasar-components] Failed to load ${isoName} language file.`
58
+ );
59
+ }
60
+ loadingLanguage = false;
61
+ }
62
+ };
63
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
64
+ __name: "GenderSelect",
65
+ props: {
66
+ modelValue: null,
67
+ required: { type: Boolean }
68
+ },
69
+ emits: ["update:modelValue"],
70
+ setup(__props) {
71
+ const props = __props;
72
+ const attrs = useAttrs();
73
+ const lang2 = useLang();
74
+ const $q = useQuasar();
75
+ if (lang2.value.isoName !== $q.lang.isoName)
76
+ loadLang($q.lang.isoName);
77
+ watch($q.lang, (val) => {
78
+ loadLang($q.lang.isoName);
79
+ });
80
+ const genderOptions = [
81
+ {
82
+ label: lang2.value.gender.male,
83
+ value: "male"
84
+ },
85
+ {
86
+ label: lang2.value.gender.female,
87
+ value: "female"
88
+ },
89
+ {
90
+ label: lang2.value.gender.other,
91
+ value: "other"
92
+ }
93
+ ];
94
+ const validations = ref([]);
95
+ if (props.required)
96
+ validations.value.push(
97
+ (val) => !!val || lang2.value.validations.fieldRequired
98
+ );
99
+ return (_ctx, _cache) => {
100
+ return openBlock(), createBlock(unref(QSelect), mergeProps(unref(attrs), {
101
+ rules: validations.value,
102
+ "model-value": __props.modelValue,
103
+ options: genderOptions,
104
+ label: `${unref(lang2).gender.gender}${__props.required ? "*" : ""}`,
105
+ "emit-value": "",
106
+ "map-options": "",
107
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
108
+ }), null, 16, ["rules", "model-value", "label"]);
109
+ };
110
+ }
111
+ });
112
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
113
+ __name: "GenderItem",
114
+ props: {
115
+ modelValue: null
116
+ },
117
+ setup(__props) {
118
+ const attrs = useAttrs();
119
+ const lang2 = useLang();
120
+ const $q = useQuasar();
121
+ if (lang2.value.isoName !== $q.lang.isoName)
122
+ loadLang($q.lang.isoName);
123
+ watch($q.lang, (val) => {
124
+ loadLang($q.lang.isoName);
125
+ });
126
+ return (_ctx, _cache) => {
127
+ return openBlock(), createBlock(unref(QItem), normalizeProps(guardReactiveProps(unref(attrs))), {
128
+ default: withCtx(() => [
129
+ createVNode(unref(QItemSection), null, {
130
+ default: withCtx(() => [
131
+ createVNode(unref(QItemLabel), { overline: "" }, {
132
+ default: withCtx(() => [
133
+ createTextVNode(toDisplayString(unref(lang2).gender.gender), 1)
134
+ ]),
135
+ _: 1
136
+ }),
137
+ createVNode(unref(QItemLabel), null, {
138
+ default: withCtx(() => [
139
+ createTextVNode(toDisplayString(__props.modelValue ? unref(lang2).gender[__props.modelValue] : ""), 1)
140
+ ]),
141
+ _: 1
142
+ })
143
+ ]),
144
+ _: 1
145
+ })
146
+ ]),
147
+ _: 1
148
+ }, 16);
149
+ };
150
+ }
151
+ });
152
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
153
+ __name: "PostalCodeInput",
154
+ props: {
155
+ modelValue: null,
156
+ locale: null,
157
+ required: { type: Boolean }
158
+ },
159
+ emits: ["update:modelValue"],
160
+ setup(__props) {
161
+ const props = __props;
162
+ const lang2 = useLang();
163
+ const attrs = useAttrs();
164
+ const masks = ref({
165
+ nl: "#### AA"
166
+ });
167
+ const validations = ref({
168
+ nl: [
169
+ (val) => !val || /^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i.test(val) || lang2.value.postalCode.validations.invalidPostalCode
170
+ ]
171
+ });
172
+ const computedValidations = computed(() => {
173
+ const val = validations.value[props.locale];
174
+ if (props.required)
175
+ val.push((val2) => !!val2 || lang2.value.validations.fieldRequired);
176
+ return val;
177
+ });
178
+ return (_ctx, _cache) => {
179
+ return openBlock(), createBlock(unref(QInput), mergeProps(unref(attrs), {
180
+ mask: masks.value[__props.locale],
181
+ rules: unref(computedValidations),
182
+ "model-value": __props.modelValue,
183
+ label: `${unref(lang2).postalCode.postalCode}${__props.required ? "*" : ""}`,
184
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
185
+ }), null, 16, ["mask", "rules", "model-value", "label"]);
186
+ };
187
+ }
188
+ });
189
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
190
+ __name: "FormItem",
191
+ props: {
192
+ modelValue: null,
193
+ label: null,
194
+ field: null
195
+ },
196
+ setup(__props) {
197
+ const attrs = useAttrs();
198
+ const slots = useSlots();
199
+ const lang2 = useLang();
200
+ const $q = useQuasar();
201
+ if (lang2.value.isoName !== $q.lang.isoName)
202
+ loadLang($q.lang.isoName);
203
+ watch($q.lang, (val) => {
204
+ loadLang($q.lang.isoName);
205
+ });
206
+ return (_ctx, _cache) => {
207
+ return openBlock(), createBlock(unref(QItem), normalizeProps(guardReactiveProps(unref(attrs))), {
208
+ default: withCtx(() => [
209
+ unref(slots).avatar ? (openBlock(), createBlock(unref(QItemSection), {
210
+ key: 0,
211
+ avatar: ""
212
+ }, {
213
+ default: withCtx(() => [
214
+ renderSlot(_ctx.$slots, "avatar")
215
+ ]),
216
+ _: 3
217
+ })) : createCommentVNode("", true),
218
+ createVNode(unref(QItemSection), null, {
219
+ default: withCtx(() => [
220
+ createVNode(unref(QItemLabel), { overline: "" }, {
221
+ default: withCtx(() => [
222
+ createTextVNode(toDisplayString(__props.label ? __props.label : __props.field ? unref(lang2).fields[__props.field] : ""), 1)
223
+ ]),
224
+ _: 1
225
+ }),
226
+ createVNode(unref(QItemLabel), null, {
227
+ default: withCtx(() => [
228
+ createTextVNode(toDisplayString(__props.modelValue || "-"), 1)
229
+ ]),
230
+ _: 1
231
+ })
232
+ ]),
233
+ _: 1
234
+ }),
235
+ unref(slots).side ? (openBlock(), createBlock(unref(QItemSection), {
236
+ key: 1,
237
+ side: ""
238
+ }, {
239
+ default: withCtx(() => [
240
+ renderSlot(_ctx.$slots, "side")
241
+ ]),
242
+ _: 3
243
+ })) : createCommentVNode("", true)
244
+ ]),
245
+ _: 3
246
+ }, 16);
247
+ };
248
+ }
249
+ });
250
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
251
+ __name: "FormInput",
252
+ props: {
253
+ modelValue: null,
254
+ field: null,
255
+ label: null,
256
+ required: { type: Boolean }
257
+ },
258
+ setup(__props) {
259
+ const props = __props;
260
+ const attrs = useAttrs();
261
+ const lang2 = useLang();
262
+ const $q = useQuasar();
263
+ if (lang2.value.isoName !== $q.lang.isoName)
264
+ loadLang($q.lang.isoName);
265
+ watch($q.lang, (val) => {
266
+ loadLang($q.lang.isoName);
267
+ });
268
+ const validations = ref([]);
269
+ if (props.required)
270
+ validations.value.push(
271
+ (val) => !!val || lang2.value.validations.fieldRequired
272
+ );
273
+ return (_ctx, _cache) => {
274
+ return openBlock(), createBlock(unref(QInput), mergeProps(unref(attrs), {
275
+ rules: validations.value,
276
+ "model-value": __props.modelValue,
277
+ label: `${__props.field ? unref(lang2).fields[__props.field] : __props.label ? __props.label : ""}${__props.required ? "*" : ""}`,
278
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
279
+ }), null, 16, ["rules", "model-value", "label"]);
280
+ };
281
+ }
282
+ });
283
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
284
+ __name: "TelephoneNumberInput",
285
+ props: {
286
+ modelValue: null,
287
+ required: { type: Boolean }
288
+ },
289
+ emits: ["update:modelValue"],
290
+ setup(__props) {
291
+ const props = __props;
292
+ const lang2 = useLang();
293
+ const attrs = useAttrs();
294
+ const validations = ref([]);
295
+ if (props.required)
296
+ validations.value.push(
297
+ (val) => !!val || lang2.value.validations.fieldRequired
298
+ );
299
+ return (_ctx, _cache) => {
300
+ return openBlock(), createBlock(unref(QInput), mergeProps(unref(attrs), {
301
+ rules: validations.value,
302
+ "model-value": __props.modelValue,
303
+ label: `${unref(lang2).fields.telephoneNumber}${__props.required ? "*" : ""}`,
304
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
305
+ }), null, 16, ["rules", "model-value", "label"]);
306
+ };
307
+ }
308
+ });
309
+ const _hoisted_1 = { class: "row items-center justify-end" };
310
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
311
+ __name: "DateInput",
312
+ props: {
313
+ modelValue: null,
314
+ label: null,
315
+ required: { type: Boolean },
316
+ clearable: { type: Boolean },
317
+ date: null
318
+ },
319
+ setup(__props) {
320
+ const props = __props;
321
+ const attrs = useAttrs();
322
+ const lang2 = useLang();
323
+ const $q = useQuasar();
324
+ if (lang2.value.isoName !== $q.lang.isoName)
325
+ loadLang($q.lang.isoName);
326
+ watch($q.lang, (val) => {
327
+ loadLang($q.lang.isoName);
328
+ });
329
+ const validations = ref([]);
330
+ if (props.required)
331
+ validations.value.push(
332
+ (val) => !!val || lang2.value.validations.fieldRequired
333
+ );
334
+ return (_ctx, _cache) => {
335
+ const _component_q_icon = QIcon;
336
+ const _component_q_btn = QBtn;
337
+ const _component_q_date = QDate;
338
+ const _component_q_popup_proxy = QPopupProxy;
339
+ const _directive_close_popup = resolveDirective("close-popup");
340
+ return openBlock(), createBlock(unref(QInput), mergeProps(unref(attrs), {
341
+ rules: validations.value,
342
+ "model-value": __props.modelValue,
343
+ label: `${__props.label}${__props.required ? "*" : ""}`,
344
+ mask: "date",
345
+ class: "q-pr-md",
346
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:modelValue", $event))
347
+ }), {
348
+ append: withCtx(() => [
349
+ __props.clearable ? (openBlock(), createBlock(_component_q_icon, {
350
+ key: 0,
351
+ name: "clear",
352
+ class: "cursor-pointer",
353
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", ""))
354
+ })) : createCommentVNode("", true),
355
+ createVNode(_component_q_icon, {
356
+ name: "event",
357
+ class: "cursor-pointer"
358
+ }, {
359
+ default: withCtx(() => [
360
+ createVNode(_component_q_popup_proxy, {
361
+ cover: "",
362
+ "transition-show": "scale",
363
+ "transition-hide": "scale"
364
+ }, {
365
+ default: withCtx(() => [
366
+ createVNode(_component_q_date, mergeProps(__props.date, {
367
+ "model-value": __props.modelValue,
368
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:modelValue", $event))
369
+ }), {
370
+ default: withCtx(() => [
371
+ createElementVNode("div", _hoisted_1, [
372
+ withDirectives(createVNode(_component_q_btn, {
373
+ label: unref(lang2).buttons.close,
374
+ color: "primary",
375
+ flat: ""
376
+ }, null, 8, ["label"]), [
377
+ [_directive_close_popup]
378
+ ])
379
+ ])
380
+ ]),
381
+ _: 1
382
+ }, 16, ["model-value"])
383
+ ]),
384
+ _: 1
385
+ })
386
+ ]),
387
+ _: 1
388
+ })
389
+ ]),
390
+ _: 1
391
+ }, 16, ["rules", "model-value", "label"]);
392
+ };
393
+ }
394
+ });
395
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
396
+ __name: "BooleanSelect",
397
+ props: {
398
+ modelValue: { type: Boolean },
399
+ label: null,
400
+ required: { type: Boolean }
401
+ },
402
+ emits: ["update:modelValue"],
403
+ setup(__props) {
404
+ const props = __props;
405
+ const attrs = useAttrs();
406
+ const lang2 = useLang();
407
+ const $q = useQuasar();
408
+ if (lang2.value.isoName !== $q.lang.isoName)
409
+ loadLang($q.lang.isoName);
410
+ watch($q.lang, (val) => {
411
+ loadLang($q.lang.isoName);
412
+ });
413
+ const booleanOptions = [
414
+ {
415
+ label: lang2.value.yes,
416
+ value: true
417
+ },
418
+ {
419
+ label: lang2.value.no,
420
+ value: false
421
+ }
422
+ ];
423
+ const validations = ref([]);
424
+ if (props.required)
425
+ validations.value.push(
426
+ (val) => !!val || lang2.value.validations.fieldRequired
427
+ );
428
+ return (_ctx, _cache) => {
429
+ return openBlock(), createBlock(unref(QSelect), mergeProps(unref(attrs), {
430
+ rules: validations.value,
431
+ "model-value": __props.modelValue,
432
+ options: booleanOptions,
433
+ label: `${__props.label}${__props.required ? "*" : ""}`,
434
+ "emit-value": "",
435
+ "map-options": "",
436
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
437
+ }), null, 16, ["rules", "model-value", "label"]);
438
+ };
439
+ }
440
+ });
441
+ const _sfc_main = /* @__PURE__ */ defineComponent({
442
+ __name: "BooleanItem",
443
+ props: {
444
+ modelValue: { type: Boolean },
445
+ label: null
446
+ },
447
+ setup(__props) {
448
+ const attrs = useAttrs();
449
+ const lang2 = useLang();
450
+ const $q = useQuasar();
451
+ if (lang2.value.isoName !== $q.lang.isoName)
452
+ loadLang($q.lang.isoName);
453
+ watch($q.lang, (val) => {
454
+ loadLang($q.lang.isoName);
455
+ });
456
+ return (_ctx, _cache) => {
457
+ return openBlock(), createBlock(unref(QItem), normalizeProps(guardReactiveProps(unref(attrs))), {
458
+ default: withCtx(() => [
459
+ createVNode(unref(QItemSection), null, {
460
+ default: withCtx(() => [
461
+ createVNode(unref(QItemLabel), { overline: "" }, {
462
+ default: withCtx(() => [
463
+ createTextVNode(toDisplayString(__props.label), 1)
464
+ ]),
465
+ _: 1
466
+ }),
467
+ createVNode(unref(QItemLabel), null, {
468
+ default: withCtx(() => [
469
+ createTextVNode(toDisplayString(__props.modelValue ? unref(lang2).yes : unref(lang2).no), 1)
470
+ ]),
471
+ _: 1
472
+ })
473
+ ]),
474
+ _: 1
475
+ })
476
+ ]),
477
+ _: 1
478
+ }, 16);
479
+ };
480
+ }
481
+ });
482
+ export {
483
+ _sfc_main as BooleanItem,
484
+ _sfc_main$1 as BooleanSelect,
485
+ _sfc_main$2 as DateInput,
486
+ _sfc_main$4 as FormInput,
487
+ _sfc_main$5 as FormItem,
488
+ _sfc_main$7 as GenderItem,
489
+ _sfc_main$8 as GenderSelect,
490
+ _sfc_main$6 as PostalCodeInput,
491
+ _sfc_main$3 as TelephoneNumberInput
492
+ };