ablok-components 0.0.29 → 0.0.32

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,16 +1,13 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, computed, resolveComponent, createBlock, createCommentVNode, unref, toDisplayString, withDirectives, isRef, vModelDynamic, vModelText, ref, watch, onBeforeMount, Fragment, renderList, createTextVNode, withModifiers } from "vue";
2
- var svgIcon_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".svg-icon{display:inline-block}.svg-icon svg{display:block;stroke-width:0;stroke:currentColor;fill:currentColor;width:1.5em;height:1.5em}.svg-icon--xxl svg{width:12rem;height:12rem}.svg-icon--xl svg{width:8rem;height:8rem}.svg-icon--large svg{width:4rem;height:4rem}\n")();
3
- const _hoisted_1$6 = {
1
+ import { defineComponent as p, openBlock as u, createElementBlock as s, normalizeClass as v, createElementVNode as i, renderSlot as f, computed as g, resolveComponent as V, createBlock as w, createCommentVNode as k, unref as y, toDisplayString as h, withDirectives as M, isRef as C, vModelDynamic as N, vModelText as U, ref as S, watch as $, onBeforeMount as L, Fragment as B, renderList as x, createTextVNode as q, withModifiers as z, reactive as I, createVNode as T } from "vue";
2
+ const A = {
4
3
  class: "icon",
5
4
  preserveAspectRatio: "xMaxYMin"
6
- };
7
- const _hoisted_2$5 = ["xlink:href"];
8
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5
+ }, D = ["xlink:href"], he = /* @__PURE__ */ p({
9
6
  __name: "svg-icon",
10
7
  props: {
11
8
  basePath: {
12
9
  type: String,
13
- default: "/static/symbol-defs.svg"
10
+ default: "/symbol-defs.svg"
14
11
  },
15
12
  prefix: {
16
13
  type: String,
@@ -25,29 +22,24 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
25
22
  default: "default"
26
23
  }
27
24
  },
28
- setup(__props) {
29
- return (_ctx, _cache) => {
30
- return openBlock(), createElementBlock("i", {
31
- class: normalizeClass(["svg-icon", {
32
- [`svg-icon--${__props.size}`]: __props.size
33
- }])
34
- }, [
35
- (openBlock(), createElementBlock("svg", _hoisted_1$6, [
36
- createElementVNode("use", {
37
- "xlink:href": `${__props.basePath}#${__props.prefix}${__props.symbol}`,
38
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
39
- x: "0",
40
- y: "0"
41
- }, null, 8, _hoisted_2$5)
42
- ]))
43
- ], 2);
44
- };
25
+ setup(e) {
26
+ return (r, a) => (u(), s("i", {
27
+ class: v(["svg-icon", {
28
+ [`svg-icon--${e.size}`]: e.size
29
+ }])
30
+ }, [
31
+ (u(), s("svg", A, [
32
+ i("use", {
33
+ "xlink:href": `${e.basePath}#${e.prefix}${e.symbol}`,
34
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
35
+ x: "0",
36
+ y: "0"
37
+ }, null, 8, D)
38
+ ]))
39
+ ], 2));
45
40
  }
46
41
  });
47
- var loadingSpinner_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".loading-spinner{min-width:2rem}\n")();
48
- const _hoisted_1$5 = { class: "loading-spinner d-block" };
49
- const _hoisted_2$4 = { class: "loading-spinner__animation" };
50
- const _hoisted_3$2 = {
42
+ const R = { class: "loading-spinner d-block" }, P = { class: "loading-spinner__animation" }, F = {
51
43
  class: "d-block",
52
44
  version: "1.1",
53
45
  id: "L9",
@@ -58,9 +50,7 @@ const _hoisted_3$2 = {
58
50
  viewBox: "0 0 100 100",
59
51
  "enable-background": "new 0 0 0 0",
60
52
  "xml:space": "preserve"
61
- };
62
- const _hoisted_4$2 = ["fill"];
63
- const _hoisted_5$2 = /* @__PURE__ */ createElementVNode("animateTransform", {
53
+ }, H = ["fill"], E = /* @__PURE__ */ i("animateTransform", {
64
54
  attributeName: "transform",
65
55
  attributeType: "XML",
66
56
  type: "rotate",
@@ -68,11 +58,9 @@ const _hoisted_5$2 = /* @__PURE__ */ createElementVNode("animateTransform", {
68
58
  from: "0 50 50",
69
59
  to: "360 50 50",
70
60
  repeatCount: "indefinite"
71
- }, null, -1);
72
- const _hoisted_6$1 = [
73
- _hoisted_5$2
74
- ];
75
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
61
+ }, null, -1), j = [
62
+ E
63
+ ], ve = /* @__PURE__ */ p({
76
64
  __name: "loading-spinner",
77
65
  props: {
78
66
  color: {
@@ -80,25 +68,21 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
80
68
  default: "#fff"
81
69
  }
82
70
  },
83
- setup(__props) {
84
- return (_ctx, _cache) => {
85
- return openBlock(), createElementBlock("span", _hoisted_1$5, [
86
- createElementVNode("span", _hoisted_2$4, [
87
- (openBlock(), createElementBlock("svg", _hoisted_3$2, [
88
- createElementVNode("path", {
89
- fill: __props.color,
90
- d: "M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
91
- }, _hoisted_6$1, 8, _hoisted_4$2)
92
- ]))
93
- ]),
94
- renderSlot(_ctx.$slots, "default")
95
- ]);
96
- };
71
+ setup(e) {
72
+ return (r, a) => (u(), s("span", R, [
73
+ i("span", P, [
74
+ (u(), s("svg", F, [
75
+ i("path", {
76
+ fill: e.color,
77
+ d: "M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
78
+ }, j, 8, H)
79
+ ]))
80
+ ]),
81
+ f(r.$slots, "default")
82
+ ]));
97
83
  }
98
84
  });
99
- var baseButton_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".base-button{display:flex;justify-content:center;align-items:center;box-sizing:border-box;transition:all .2s ease;text-decoration:none;width:100%;margin:0;padding:1.036em 1.625em;appearance:none;outline:none;border:none;border-radius:.4375em;font-size:.875em;line-height:1.125em;text-transform:uppercase;font-weight:700}@media screen and (min-width: 600px){.base-button{width:auto}}.base-button .icon{width:16px;height:16px;margin-top:-1px}.base-button.s-collapsed>.caption{display:none}.base-button.s-pending{background-repeat:no-repeat;background-position:center center}.base-button.s-pending .caption{margin-left:25px;visibility:hidden}@media screen and (min-width: 600px){.base-button.s-pending{background-position:1.625em center}.base-button.s-pending .caption{visibility:visible}}.base-button[readonly],.base-button[disabled]{cursor:not-allowed}\n")();
100
- const _hoisted_1$4 = ["type", "disabled", "href", "to"];
101
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
85
+ const G = ["type", "disabled", "href", "to"], $e = /* @__PURE__ */ p({
102
86
  __name: "base-button",
103
87
  props: {
104
88
  type: null,
@@ -114,58 +98,49 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
114
98
  rounded: { type: Boolean },
115
99
  fab: { type: Boolean }
116
100
  },
117
- setup(__props) {
118
- const props = __props;
119
- const showCaption = computed(() => {
120
- return props.caption && !props.fab;
121
- });
122
- return (_ctx, _cache) => {
123
- const _component_svg_icon = resolveComponent("svg-icon");
124
- return openBlock(), createElementBlock("button", {
125
- type: __props.type,
126
- disabled: __props.disabled,
127
- href: __props.href,
128
- to: __props.to,
129
- class: normalizeClass(["base-button btn btn-primary", {
130
- disabled: __props.disabled,
131
- pending: __props.pending,
132
- rounded: __props.rounded,
133
- outlined: __props.outlined,
134
- fab: __props.fab,
135
- "x-large": __props.size === "x-large",
136
- "large": __props.size === "large",
137
- "small": __props.size === "small",
138
- "x-small": __props.size === "x-small"
101
+ setup(e) {
102
+ const r = e, a = g(() => r.caption && !r.fab);
103
+ return (n, d) => {
104
+ const l = V("svg-icon");
105
+ return u(), s("button", {
106
+ type: e.type,
107
+ disabled: e.disabled,
108
+ href: e.href,
109
+ to: e.to,
110
+ class: v(["base-button btn btn-primary", {
111
+ disabled: e.disabled,
112
+ pending: e.pending,
113
+ rounded: e.rounded,
114
+ outlined: e.outlined,
115
+ fab: e.fab,
116
+ "x-large": e.size === "x-large",
117
+ large: e.size === "large",
118
+ small: e.size === "small",
119
+ "x-small": e.size === "x-small"
139
120
  }])
140
121
  }, [
141
- renderSlot(_ctx.$slots, "default", {}, () => [
142
- __props.icon ? (openBlock(), createBlock(_component_svg_icon, {
122
+ f(n.$slots, "default", {}, () => [
123
+ e.icon ? (u(), w(l, {
143
124
  key: 0,
144
- id: __props.icon,
125
+ id: e.icon,
145
126
  class: "base-button__caption"
146
- }, null, 8, ["id"])) : createCommentVNode("", true),
147
- unref(showCaption) ? (openBlock(), createElementBlock("span", {
127
+ }, null, 8, ["id"])) : k("", !0),
128
+ y(a) ? (u(), s("span", {
148
129
  key: 1,
149
- class: normalizeClass(["base-button__caption", { "icon-padding": __props.icon }])
150
- }, toDisplayString(__props.caption), 3)) : createCommentVNode("", true)
130
+ class: v(["base-button__caption", { "icon-padding": e.icon }])
131
+ }, h(e.caption), 3)) : k("", !0)
151
132
  ])
152
- ], 10, _hoisted_1$4);
133
+ ], 10, G);
153
134
  };
154
135
  }
155
136
  });
156
- function uniqueId() {
137
+ function m() {
157
138
  return (new Date().valueOf() + Math.random()).toString(36);
158
139
  }
159
- var formInput_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".form-input{display:flex;flex-flow:column}.form-input>*{order:2}.form-input__label{order:0}.form-input__input-group{flex-wrap:nowrap;order:1}.form-input__color-swatch{flex:0 0 3rem;display:block;border-top-right-radius:.25rem;border-bottom-right-radius:.25rem;overflow:hidden}.form-input input[type=color]{display:block;height:100%;padding:0;border-width:0}\n")();
160
- const _hoisted_1$3 = { class: "input-group form-input__input-group" };
161
- const _hoisted_2$3 = ["type", "name", "id", "label", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"];
162
- const _hoisted_3$1 = {
140
+ const J = { class: "input-group form-input__input-group" }, X = ["type", "id", "name", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"], Y = {
163
141
  key: 0,
164
142
  class: "form-input__color-swatch"
165
- };
166
- const _hoisted_4$1 = ["name", "id", "disabled", "read-only", "required", "aria-label"];
167
- const _hoisted_5$1 = ["for", "innerHTML"];
168
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
143
+ }, K = ["name", "id", "disabled", "read-only", "required", "aria-label"], Q = ["for", "innerHTML"], Se = /* @__PURE__ */ p({
169
144
  __name: "form-input",
170
145
  props: {
171
146
  modelValue: {
@@ -178,11 +153,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
178
153
  },
179
154
  name: {
180
155
  type: String,
181
- default: () => uniqueId()
156
+ default: () => m()
182
157
  },
183
158
  id: {
184
159
  type: String,
185
- default: () => uniqueId()
160
+ default: () => m()
186
161
  },
187
162
  label: {
188
163
  type: String,
@@ -198,15 +173,15 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
198
173
  },
199
174
  disabled: {
200
175
  type: Boolean,
201
- default: false
176
+ default: !1
202
177
  },
203
178
  readOnly: {
204
179
  type: Boolean,
205
- default: false
180
+ default: !1
206
181
  },
207
182
  required: {
208
183
  type: Boolean,
209
- default: false
184
+ default: !1
210
185
  },
211
186
  maxlength: {
212
187
  type: Number
@@ -217,76 +192,70 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
217
192
  },
218
193
  checked: {
219
194
  type: Boolean,
220
- default: false
195
+ default: !1
221
196
  }
222
197
  },
223
198
  emits: ["update:modelValue"],
224
- setup(__props, { emit }) {
225
- const props = __props;
226
- const model = computed({
199
+ setup(e, { emit: r }) {
200
+ const a = e, n = g({
227
201
  get() {
228
- return props.modelValue;
202
+ return a.modelValue;
229
203
  },
230
- set(update) {
231
- emit("update:modelValue", update);
204
+ set(d) {
205
+ r("update:modelValue", d);
232
206
  }
233
207
  });
234
- return (_ctx, _cache) => {
235
- return openBlock(), createElementBlock("div", {
236
- class: normalizeClass(["form-input", `form-input--${__props.type}`])
237
- }, [
238
- createElementVNode("div", _hoisted_1$3, [
239
- renderSlot(_ctx.$slots, "input-prepend"),
240
- withDirectives(createElementVNode("input", {
241
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
242
- type: __props.type === "color" ? "text" : __props.type,
243
- name: __props.name,
244
- id: __props.id,
245
- label: `${__props.label}${__props.required ? " *" : ""}`,
246
- placeholder: __props.placeholder,
247
- pattern: __props.pattern,
248
- disabled: __props.disabled,
249
- "read-only": __props.readOnly,
250
- required: __props.required,
251
- maxlength: __props.maxlength,
252
- checked: __props.checked,
253
- class: "form-control",
254
- "aria-label": __props.label
255
- }, null, 8, _hoisted_2$3), [
256
- [vModelDynamic, unref(model)]
257
- ]),
258
- renderSlot(_ctx.$slots, "input-append", {}, () => [
259
- __props.type === "color" ? (openBlock(), createElementBlock("span", _hoisted_3$1, [
260
- withDirectives(createElementVNode("input", {
261
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(model) ? model.value = $event : null),
262
- type: "color",
263
- name: `${__props.name}-color`,
264
- id: `${__props.id}-color`,
265
- disabled: __props.disabled,
266
- "read-only": __props.readOnly,
267
- required: __props.required,
268
- class: "form-control",
269
- "aria-label": __props.label
270
- }, null, 8, _hoisted_4$1), [
271
- [vModelText, unref(model)]
272
- ])
273
- ])) : createCommentVNode("", true)
274
- ])
208
+ return (d, l) => (u(), s("div", {
209
+ class: v(["form-input", `form-input--${e.type}`])
210
+ }, [
211
+ i("div", J, [
212
+ f(d.$slots, "input-prepend"),
213
+ M(i("input", {
214
+ "onUpdate:modelValue": l[0] || (l[0] = (t) => C(n) ? n.value = t : null),
215
+ type: e.type === "color" ? "text" : e.type,
216
+ id: e.id,
217
+ name: e.name,
218
+ placeholder: e.placeholder,
219
+ pattern: e.pattern,
220
+ disabled: e.disabled,
221
+ "read-only": e.readOnly,
222
+ required: e.required,
223
+ maxlength: e.maxlength,
224
+ checked: e.checked,
225
+ class: "form-control",
226
+ "aria-label": e.label
227
+ }, null, 8, X), [
228
+ [N, y(n)]
275
229
  ]),
276
- renderSlot(_ctx.$slots, "label", {}, () => [
277
- createElementVNode("label", {
278
- for: __props.id,
279
- class: "form-input__label",
280
- innerHTML: __props.label
281
- }, null, 8, _hoisted_5$1)
230
+ f(d.$slots, "input-append", {}, () => [
231
+ e.type === "color" ? (u(), s("span", Y, [
232
+ M(i("input", {
233
+ "onUpdate:modelValue": l[1] || (l[1] = (t) => C(n) ? n.value = t : null),
234
+ type: "color",
235
+ name: `${e.name}-color`,
236
+ id: `${e.id}-color`,
237
+ disabled: e.disabled,
238
+ "read-only": e.readOnly,
239
+ required: e.required,
240
+ class: "form-control",
241
+ "aria-label": e.label
242
+ }, null, 8, K), [
243
+ [U, y(n)]
244
+ ])
245
+ ])) : k("", !0)
282
246
  ])
283
- ], 2);
284
- };
247
+ ]),
248
+ f(d.$slots, "label", {}, () => [
249
+ i("label", {
250
+ for: e.id,
251
+ class: "form-input__label",
252
+ innerHTML: `${e.label}${e.required ? " *" : ""}`
253
+ }, null, 8, Q)
254
+ ])
255
+ ], 2));
285
256
  }
286
257
  });
287
- const _hoisted_1$2 = { class: "radio-group" };
288
- const _hoisted_2$2 = ["for"];
289
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
258
+ const W = { class: "radio-group" }, Z = ["for"], Ve = /* @__PURE__ */ p({
290
259
  __name: "check-group",
291
260
  props: {
292
261
  modelValue: {
@@ -298,11 +267,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
298
267
  },
299
268
  name: {
300
269
  type: String,
301
- default: () => uniqueId()
270
+ default: () => m()
302
271
  },
303
272
  id: {
304
273
  type: String,
305
- default: () => uniqueId()
274
+ default: () => m()
306
275
  },
307
276
  label: {
308
277
  type: String,
@@ -314,66 +283,59 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
314
283
  },
315
284
  disabled: {
316
285
  type: Boolean,
317
- default: false
286
+ default: !1
318
287
  },
319
288
  readOnly: {
320
289
  type: Boolean,
321
- default: false
290
+ default: !1
322
291
  },
323
292
  required: {
324
293
  type: Boolean,
325
- default: false
294
+ default: !1
326
295
  }
327
296
  },
328
297
  emits: ["change", "update:modelValue"],
329
- setup(__props, { emit }) {
330
- const props = __props;
331
- const values = ref([]);
332
- watch(() => props.modelValue, (update, before) => {
333
- values.value = props.options.map((option) => option.value ? props.modelValue.some((modelValue) => modelValue["value "] === option.value) : props.modelValue.some((modelValue) => modelValue === option));
334
- }, { immediate: true });
335
- watch(values, (update, before) => {
336
- const options = update.reduce((mappedValues, option, index) => {
337
- const value = option && props.options[index] ? [props.options[index] || props.options[index]] : [];
338
- return [...mappedValues, ...value];
298
+ setup(e, { emit: r }) {
299
+ const a = e, n = S([]);
300
+ return $(() => a.modelValue, (d, l) => {
301
+ n.value = a.options.map(
302
+ (t) => t.value ? a.modelValue.some((o) => o["value "] === t.value) : a.modelValue.some((o) => o === t)
303
+ );
304
+ }, { immediate: !0 }), $(n, (d, l) => {
305
+ const t = d.reduce((o, c, b) => {
306
+ const O = c && a.options[b] ? [a.options[b] || a.options[b]] : [];
307
+ return [...o, ...O];
339
308
  }, []);
340
- emit("update:modelValue", options);
341
- }, { deep: true });
342
- onBeforeMount(() => {
343
- });
344
- return (_ctx, _cache) => {
345
- const _component_form_input = resolveComponent("form-input");
346
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
347
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
348
- return openBlock(), createBlock(_component_form_input, {
349
- key: index,
350
- modelValue: unref(values)[index],
351
- "onUpdate:modelValue": ($event) => unref(values)[index] = $event,
352
- type: "checkbox",
353
- name: __props.name,
354
- id: `${__props.id}-${index}`,
355
- label: `${option.text || option}${__props.required ? " *" : ""}`,
356
- disabled: __props.disabled,
357
- "read-only": __props.readOnly,
358
- required: __props.required
359
- }, null, 8, ["modelValue", "onUpdate:modelValue", "name", "id", "label", "disabled", "read-only", "required"]);
360
- }), 128)),
361
- createElementVNode("label", { for: __props.id }, [
362
- renderSlot(_ctx.$slots, "label", {}, () => [
363
- createTextVNode(toDisplayString(__props.label), 1)
309
+ r("update:modelValue", t);
310
+ }, { deep: !0 }), L(() => {
311
+ }), (d, l) => {
312
+ const t = V("form-input");
313
+ return u(), s("div", W, [
314
+ (u(!0), s(B, null, x(e.options, (o, c) => (u(), w(t, {
315
+ key: c,
316
+ modelValue: y(n)[c],
317
+ "onUpdate:modelValue": (b) => y(n)[c] = b,
318
+ type: "checkbox",
319
+ name: e.name,
320
+ id: `${e.id}-${c}`,
321
+ label: `${o.text || o}${e.required ? " *" : ""}`,
322
+ disabled: e.disabled,
323
+ "read-only": e.readOnly,
324
+ required: e.required
325
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "name", "id", "label", "disabled", "read-only", "required"]))), 128)),
326
+ i("label", { for: e.id }, [
327
+ f(d.$slots, "label", {}, () => [
328
+ q(h(e.label), 1)
364
329
  ])
365
- ], 8, _hoisted_2$2)
330
+ ], 8, Z)
366
331
  ]);
367
332
  };
368
333
  }
369
- });
370
- const _hoisted_1$1 = { class: "radio-group" };
371
- const _hoisted_2$1 = ["for"];
372
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
334
+ }), _ = { class: "radio-group" }, ee = ["for"], Be = /* @__PURE__ */ p({
373
335
  __name: "radio-group",
374
336
  props: {
375
337
  modelValue: {
376
- default: false
338
+ default: !1
377
339
  },
378
340
  options: {
379
341
  type: Array,
@@ -381,11 +343,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
381
343
  },
382
344
  name: {
383
345
  type: String,
384
- default: () => uniqueId()
346
+ default: () => m()
385
347
  },
386
348
  id: {
387
349
  type: String,
388
- default: () => uniqueId()
350
+ default: () => m()
389
351
  },
390
352
  label: {
391
353
  type: String,
@@ -397,64 +359,53 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
397
359
  },
398
360
  disabled: {
399
361
  type: Boolean,
400
- default: false
362
+ default: !1
401
363
  },
402
364
  readOnly: {
403
365
  type: Boolean,
404
- default: false
366
+ default: !1
405
367
  },
406
368
  required: {
407
369
  type: Boolean,
408
- default: false
370
+ default: !1
409
371
  }
410
372
  },
411
373
  emits: ["change", "update:modelValue"],
412
- setup(__props, { emit }) {
413
- const props = __props;
414
- ref(props.options.map((option) => option.value === props.modelValue));
415
- function change(value2) {
416
- emit("update:modelValue", value2);
374
+ setup(e, { emit: r }) {
375
+ const a = e;
376
+ S(a.options.map((d) => d.value === a.modelValue));
377
+ function n(d) {
378
+ r("update:modelValue", d);
417
379
  }
418
- onBeforeMount(() => {
419
- });
420
- return (_ctx, _cache) => {
421
- const _component_form_input = resolveComponent("form-input");
422
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
423
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
424
- return openBlock(), createBlock(_component_form_input, {
425
- key: index,
426
- type: "radio",
427
- name: __props.name,
428
- id: `${__props.id}-${index}`,
429
- value: option.value || option,
430
- label: `${option.text || option}${__props.required ? " *" : ""}`,
431
- checked: option.value ? option.value === __props.modelValue : option === __props.modelValue,
432
- disabled: __props.disabled,
433
- "read-only": __props.readOnly,
434
- required: __props.required,
435
- onChange: ($event) => change(option)
436
- }, null, 8, ["name", "id", "value", "label", "checked", "disabled", "read-only", "required", "onChange"]);
437
- }), 128)),
438
- createElementVNode("label", { for: __props.id }, [
439
- renderSlot(_ctx.$slots, "label", {}, () => [
440
- createTextVNode(toDisplayString(__props.label), 1)
380
+ return L(() => {
381
+ }), (d, l) => {
382
+ const t = V("form-input");
383
+ return u(), s("div", _, [
384
+ (u(!0), s(B, null, x(e.options, (o, c) => (u(), w(t, {
385
+ key: c,
386
+ type: "radio",
387
+ name: e.name,
388
+ id: `${e.id}-${c}`,
389
+ value: o.value || o,
390
+ label: `${o.text || o}${e.required ? " *" : ""}`,
391
+ checked: o.value ? o.value === e.modelValue : o === e.modelValue,
392
+ disabled: e.disabled,
393
+ "read-only": e.readOnly,
394
+ required: e.required,
395
+ onChange: (b) => n(o)
396
+ }, null, 8, ["name", "id", "value", "label", "checked", "disabled", "read-only", "required", "onChange"]))), 128)),
397
+ i("label", { for: e.id }, [
398
+ f(d.$slots, "label", {}, () => [
399
+ q(h(e.label), 1)
441
400
  ])
442
- ], 8, _hoisted_2$1)
401
+ ], 8, ee)
443
402
  ]);
444
403
  };
445
404
  }
446
- });
447
- const _hoisted_1 = { class: "input input-dropdown" };
448
- const _hoisted_2 = { class: "dropdown" };
449
- const _hoisted_3 = {
405
+ }), te = { class: "input input-dropdown" }, le = { class: "dropdown" }, ae = {
450
406
  class: "btn-group",
451
407
  role: "group"
452
- };
453
- const _hoisted_4 = ["id", "disabled"];
454
- const _hoisted_5 = ["aria-labelledby"];
455
- const _hoisted_6 = ["onClick"];
456
- const _hoisted_7 = ["for"];
457
- const _sfc_main = /* @__PURE__ */ defineComponent({
408
+ }, ne = ["id", "disabled"], de = ["aria-labelledby"], oe = ["onClick"], ie = ["for"], xe = /* @__PURE__ */ p({
458
409
  __name: "input-dropdown",
459
410
  props: {
460
411
  modelValue: {
@@ -463,11 +414,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
463
414
  },
464
415
  name: {
465
416
  type: String,
466
- default: () => uniqueId()
417
+ default: () => m()
467
418
  },
468
419
  id: {
469
420
  type: String,
470
- default: () => uniqueId()
421
+ default: () => m()
471
422
  },
472
423
  label: {
473
424
  type: String,
@@ -491,91 +442,290 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
491
442
  },
492
443
  disabled: {
493
444
  type: Boolean,
494
- default: false
445
+ default: !1
495
446
  },
496
447
  multiple: {
497
448
  type: Boolean,
498
- default: false
449
+ default: !1
499
450
  },
500
451
  required: {
501
452
  type: Boolean,
502
- default: false
453
+ default: !1
503
454
  },
504
455
  outline: {
505
456
  type: Boolean,
506
- default: true
457
+ default: !0
507
458
  },
508
459
  resetOption: {
509
460
  type: Boolean,
510
- default: true
461
+ default: !0
511
462
  }
512
463
  },
513
464
  emits: ["update:modelValue"],
514
- setup(__props, { emit }) {
515
- const props = __props;
516
- computed({
465
+ setup(e, { emit: r }) {
466
+ const a = e;
467
+ g({
517
468
  get() {
518
- return props.modelValue;
469
+ return a.modelValue;
519
470
  },
520
- set(update) {
521
- emit("update:modelValue", update);
471
+ set(t) {
472
+ r("update:modelValue", t);
522
473
  }
523
474
  });
524
- function select(update) {
525
- emit("update:modelValue", update);
475
+ function n(t) {
476
+ r("update:modelValue", t);
526
477
  }
527
- const extendedOptions = computed(() => {
528
- return [
529
- {
530
- text: "Please select"
531
- },
532
- ...props.options.map((option) => typeof option === "string" ? { value: option, text: option } : option)
533
- ];
534
- });
535
- const selectedOption = computed(() => {
536
- return [...props.options].find((option) => JSON.stringify(option.value) === JSON.stringify(props.modelValue));
537
- });
538
- return (_ctx, _cache) => {
539
- return openBlock(), createElementBlock("div", _hoisted_1, [
540
- createElementVNode("div", _hoisted_2, [
541
- createElementVNode("div", _hoisted_3, [
542
- createElementVNode("button", {
543
- class: normalizeClass(["btn dropdown-toggle", {
544
- [`btn-${__props.variant}`]: __props.variant,
545
- [`btn-${__props.color}`]: __props.color,
546
- [`btn-${__props.disabled}`]: __props.disabled,
547
- [`btn-outline-${__props.color || "dark"}`]: __props.outline
548
- }]),
549
- type: "button",
550
- id: __props.id,
551
- "data-bs-toggle": "dropdown",
552
- "aria-expanded": "false",
553
- disabled: __props.disabled
554
- }, toDisplayString(unref(selectedOption) ? unref(selectedOption).text : __props.placeholder), 11, _hoisted_4),
555
- createElementVNode("ul", {
556
- class: "dropdown-menu",
557
- "aria-labelledby": __props.id
558
- }, [
559
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(extendedOptions), (option, index) => {
560
- return openBlock(), createElementBlock("li", { key: index }, [
561
- renderSlot(_ctx.$slots, "option", {}, () => [
562
- createElementVNode("a", {
563
- class: "dropdown-item",
564
- onClick: withModifiers(($event) => select(option.value), ["prevent"])
565
- }, toDisplayString(option.text), 9, _hoisted_6)
566
- ])
567
- ]);
568
- }), 128))
569
- ], 8, _hoisted_5)
570
- ])
571
- ]),
572
- createElementVNode("label", { for: __props.id }, [
573
- renderSlot(_ctx.$slots, "label", {}, () => [
574
- createTextVNode(toDisplayString(__props.label), 1)
575
- ])
576
- ], 8, _hoisted_7)
478
+ const d = g(() => [
479
+ {
480
+ text: "Please select"
481
+ },
482
+ ...a.options.map(
483
+ (t) => typeof t == "string" ? { value: t, text: t } : t
484
+ )
485
+ ]), l = g(() => [...a.options].find((t) => JSON.stringify(t.value) === JSON.stringify(a.modelValue)));
486
+ return (t, o) => (u(), s("div", te, [
487
+ i("div", le, [
488
+ i("div", ae, [
489
+ i("button", {
490
+ class: v(["btn dropdown-toggle", {
491
+ [`btn-${e.variant}`]: e.variant,
492
+ [`btn-${e.color}`]: e.color,
493
+ [`btn-${e.disabled}`]: e.disabled,
494
+ [`btn-outline-${e.color || "dark"}`]: e.outline
495
+ }]),
496
+ type: "button",
497
+ id: e.id,
498
+ "data-bs-toggle": "dropdown",
499
+ "aria-expanded": "false",
500
+ disabled: e.disabled
501
+ }, h(y(l) ? y(l).text : e.placeholder), 11, ne),
502
+ i("ul", {
503
+ class: "dropdown-menu",
504
+ "aria-labelledby": e.id
505
+ }, [
506
+ (u(!0), s(B, null, x(y(d), (c, b) => (u(), s("li", { key: b }, [
507
+ f(t.$slots, "option", {}, () => [
508
+ i("a", {
509
+ class: "dropdown-item",
510
+ onClick: z((O) => n(c.value), ["prevent"])
511
+ }, h(c.text), 9, oe)
512
+ ])
513
+ ]))), 128))
514
+ ], 8, de)
515
+ ])
516
+ ]),
517
+ i("label", { for: e.id }, [
518
+ f(t.$slots, "label", {}, () => [
519
+ q(h(e.label), 1)
520
+ ])
521
+ ], 8, ie)
522
+ ]));
523
+ }
524
+ }), ue = ["id", "name", "multiple", "accept"], re = { class: "form-input__input-group input-group" }, se = ["value", "id", "name"], ce = ["for"], fe = ["for", "innerHTML"], ke = /* @__PURE__ */ p({
525
+ __name: "file-input",
526
+ props: {
527
+ modelValue: {
528
+ type: Array,
529
+ default: []
530
+ },
531
+ name: {
532
+ type: String,
533
+ default: () => m()
534
+ },
535
+ id: {
536
+ type: String,
537
+ default: () => m()
538
+ },
539
+ label: {
540
+ type: String,
541
+ default: ""
542
+ },
543
+ placeholder: {
544
+ type: String,
545
+ default: ""
546
+ },
547
+ variant: {
548
+ type: String,
549
+ default: ""
550
+ },
551
+ disabled: {
552
+ type: Boolean,
553
+ default: !1
554
+ },
555
+ readOnly: {
556
+ type: Boolean,
557
+ default: !1
558
+ },
559
+ required: {
560
+ type: Boolean,
561
+ default: !1
562
+ },
563
+ pattern: {
564
+ type: String,
565
+ default: null
566
+ },
567
+ multiple: {
568
+ type: Boolean,
569
+ default: !1
570
+ },
571
+ accept: {
572
+ type: String
573
+ }
574
+ },
575
+ emits: ["update:modelValue"],
576
+ setup(e, { emit: r }) {
577
+ function a(l) {
578
+ const t = l.target && l.target.files;
579
+ t && (n.splice(0, n.length), Array.from(t).forEach((o) => {
580
+ n.push(o);
581
+ }));
582
+ }
583
+ const n = I([]), d = g(() => n && n.map((l) => l.name));
584
+ return g(() => n.map((l) => URL.createObjectURL(l))), $(() => n, (l, t) => {
585
+ console.log("file input", l), r("update:modelValue", l);
586
+ }, { deep: !0 }), (l, t) => (u(), s("div", {
587
+ class: v(["form-input file-input", "file-input--primary"])
588
+ }, [
589
+ i("input", {
590
+ type: "file",
591
+ id: e.id,
592
+ name: e.name,
593
+ class: "d-none",
594
+ onChange: a,
595
+ multiple: e.multiple,
596
+ accept: e.accept
597
+ }, null, 40, ue),
598
+ i("div", re, [
599
+ f(l.$slots, "input-prepend"),
600
+ i("input", {
601
+ type: "text",
602
+ value: y(d),
603
+ id: e.id,
604
+ name: e.name,
605
+ class: "form-control"
606
+ }, null, 8, se),
607
+ f(l.$slots, "input-append", {}, () => [
608
+ i("label", {
609
+ for: e.id,
610
+ class: "btn btn-outline-dark"
611
+ }, " Select Image ", 8, ce)
612
+ ])
613
+ ]),
614
+ f(l.$slots, "label", {}, () => [
615
+ i("label", {
616
+ for: e.id,
617
+ class: "form-input__label",
618
+ innerHTML: `${e.label}${e.required ? " *" : ""}`
619
+ }, null, 8, fe)
620
+ ])
621
+ ]));
622
+ }
623
+ }), me = { class: "media-upload" }, ye = ["src"], pe = ["for"];
624
+ async function be(e) {
625
+ return await new Promise((r) => {
626
+ let a = new FileReader();
627
+ a.onload = () => r(a.result), a.readAsDataURL(e);
628
+ });
629
+ }
630
+ const we = /* @__PURE__ */ p({
631
+ __name: "media-upload",
632
+ props: {
633
+ modelValue: {
634
+ type: Array,
635
+ default: []
636
+ },
637
+ name: {
638
+ type: String,
639
+ default: () => m()
640
+ },
641
+ id: {
642
+ type: String,
643
+ default: () => m()
644
+ },
645
+ label: {
646
+ type: String,
647
+ default: ""
648
+ },
649
+ placeholder: {
650
+ type: String,
651
+ default: ""
652
+ },
653
+ variant: {
654
+ type: String,
655
+ default: ""
656
+ },
657
+ disabled: {
658
+ type: Boolean,
659
+ default: !1
660
+ },
661
+ readOnly: {
662
+ type: Boolean,
663
+ default: !1
664
+ },
665
+ required: {
666
+ type: Boolean,
667
+ default: !1
668
+ },
669
+ pattern: {
670
+ type: String,
671
+ default: null
672
+ },
673
+ multiple: {
674
+ type: Boolean,
675
+ default: !1
676
+ },
677
+ accept: {
678
+ type: String,
679
+ default: "image/*"
680
+ }
681
+ },
682
+ emits: ["update:modelValue"],
683
+ setup(e, { emit: r }) {
684
+ const a = S([]), n = S([]);
685
+ return $(() => a, async (d, l) => {
686
+ n.value = await Promise.all(
687
+ d.value.map(async (t) => ({
688
+ src: await be(t),
689
+ type: t.type
690
+ }))
691
+ );
692
+ }, { deep: !0 }), $(() => n, async (d, l) => {
693
+ r("update:modelValue", n.value);
694
+ }, { deep: !0 }), (d, l) => {
695
+ const t = V("file-input");
696
+ return u(), s("div", me, [
697
+ (u(!0), s(B, null, x(n.value, (o) => (u(), s("div", {
698
+ key: o.src
699
+ }, [
700
+ i("img", {
701
+ src: o.src,
702
+ class: "img-fluid rounded"
703
+ }, null, 8, ye)
704
+ ]))), 128)),
705
+ T(t, {
706
+ modelValue: a.value,
707
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => a.value = o),
708
+ id: e.id,
709
+ name: e.name,
710
+ accept: e.accept,
711
+ class: "d-none"
712
+ }, null, 8, ["modelValue", "id", "name", "accept"]),
713
+ i("label", {
714
+ for: e.id,
715
+ class: "btn btn-outline-dark"
716
+ }, " Select Image ", 8, pe)
577
717
  ]);
578
718
  };
579
719
  }
580
720
  });
581
- export { _sfc_main$4 as BaseButton, _sfc_main$2 as CheckGroup, _sfc_main$3 as FormInput, _sfc_main as InputDropdown, _sfc_main$5 as LoadingSpinner, _sfc_main$1 as RadioGroup, _sfc_main$6 as SvgIcon };
721
+ export {
722
+ $e as BaseButton,
723
+ Ve as CheckGroup,
724
+ ke as FileInput,
725
+ Se as FormInput,
726
+ xe as InputDropdown,
727
+ ve as LoadingSpinner,
728
+ we as MediaUpload,
729
+ Be as RadioGroup,
730
+ he as SvgIcon
731
+ };