ablok-components 0.0.7 → 0.0.10

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,6 +1,6 @@
1
- import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, createElementVNode, renderSlot } from "vue";
1
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, createElementVNode, renderSlot, computed, createBlock, createCommentVNode, unref, toDisplayString, withDirectives, isRef, vModelDynamic, createTextVNode, ref, watch, onBeforeMount, Fragment, renderList, getCurrentInstance, inject, markRaw, reactive, effectScope, isReactive, toRaw, onUnmounted, nextTick, toRefs, getCurrentScope, onScopeDispose, shallowRef, withModifiers } from "vue";
2
2
  var baseIcon_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".base-icon{display:inline-block}.base-icon svg{display:block;stroke-width:0;stroke:currentColor;fill:currentColor;width:1.5em;height:1.5em}.base-icon--xxl svg{width:12rem;height:12rem}.base-icon--xl svg{width:8rem;height:8rem}.base-icon--large svg{width:4rem;height:4rem}\n")();
3
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4
4
  __name: "base-icon",
5
5
  props: {
6
6
  id: {
@@ -29,9 +29,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
29
29
  }
30
30
  });
31
31
  var loadingSpinner_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".loading-spinner{min-width:2rem}\n")();
32
- const _hoisted_1$1 = { class: "loading-spinner d-block" };
33
- const _hoisted_2$1 = { class: "loading-spinner__animation" };
34
- const _hoisted_3 = {
32
+ const _hoisted_1$5 = { class: "loading-spinner d-block" };
33
+ const _hoisted_2$4 = { class: "loading-spinner__animation" };
34
+ const _hoisted_3$1 = {
35
35
  class: "d-block",
36
36
  version: "1.1",
37
37
  id: "L9",
@@ -56,7 +56,7 @@ const _hoisted_5 = /* @__PURE__ */ createElementVNode("animateTransform", {
56
56
  const _hoisted_6 = [
57
57
  _hoisted_5
58
58
  ];
59
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
59
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
60
60
  __name: "loading-spinner",
61
61
  props: {
62
62
  color: {
@@ -66,9 +66,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
66
66
  },
67
67
  setup(__props) {
68
68
  return (_ctx, _cache) => {
69
- return openBlock(), createElementBlock("span", _hoisted_1$1, [
70
- createElementVNode("span", _hoisted_2$1, [
71
- (openBlock(), createElementBlock("svg", _hoisted_3, [
69
+ return openBlock(), createElementBlock("span", _hoisted_1$5, [
70
+ createElementVNode("span", _hoisted_2$4, [
71
+ (openBlock(), createElementBlock("svg", _hoisted_3$1, [
72
72
  createElementVNode("path", {
73
73
  fill: __props.color,
74
74
  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"
@@ -80,30 +80,947 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
80
80
  };
81
81
  }
82
82
  });
83
- var baseButton_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".btn{appearance:none;background:none;border:none}\n")();
84
- const _hoisted_1 = { class: "btn" };
85
- const _hoisted_2 = ["innerHTML"];
86
- const _sfc_main = /* @__PURE__ */ defineComponent({
83
+ 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")();
84
+ const _hoisted_1$4 = ["type", "disabled", "href", "to"];
85
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
87
86
  __name: "base-button",
88
87
  props: {
89
- caption: {
88
+ type: null,
89
+ caption: null,
90
+ variant: null,
91
+ size: null,
92
+ icon: null,
93
+ href: null,
94
+ to: null,
95
+ disabled: { type: Boolean },
96
+ pending: { type: Boolean },
97
+ outlined: { type: Boolean },
98
+ rounded: { type: Boolean },
99
+ fab: { type: Boolean }
100
+ },
101
+ setup(__props) {
102
+ const props = __props;
103
+ const showCaption = computed(() => {
104
+ return props.caption && !props.fab;
105
+ });
106
+ return (_ctx, _cache) => {
107
+ const _component_base_icon = resolveComponent("base-icon");
108
+ return openBlock(), createElementBlock("button", {
109
+ type: __props.type,
110
+ disabled: __props.disabled,
111
+ href: __props.href,
112
+ to: __props.to,
113
+ class: normalizeClass(["base-button", {
114
+ disabled: __props.disabled,
115
+ pending: __props.pending,
116
+ rounded: __props.rounded,
117
+ outlined: __props.outlined,
118
+ fab: __props.fab,
119
+ "x-large": __props.size === "x-large",
120
+ "large": __props.size === "large",
121
+ "small": __props.size === "small",
122
+ "x-small": __props.size === "x-small"
123
+ }])
124
+ }, [
125
+ renderSlot(_ctx.$slots, "default", {}, () => [
126
+ __props.icon ? (openBlock(), createBlock(_component_base_icon, {
127
+ key: 0,
128
+ id: __props.icon,
129
+ class: "base-button__caption"
130
+ }, null, 8, ["id"])) : createCommentVNode("", true),
131
+ unref(showCaption) ? (openBlock(), createElementBlock("span", {
132
+ key: 1,
133
+ class: normalizeClass(["base-button__caption", { "icon-padding": __props.icon }])
134
+ }, toDisplayString(__props.caption), 3)) : createCommentVNode("", true)
135
+ ])
136
+ ], 10, _hoisted_1$4);
137
+ };
138
+ }
139
+ });
140
+ function uniqueId() {
141
+ return (new Date().valueOf() + Math.random()).toString(36);
142
+ }
143
+ const _hoisted_1$3 = { class: "base-input" };
144
+ const _hoisted_2$3 = ["type", "name", "id", "label", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked"];
145
+ const _hoisted_3 = ["for"];
146
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
147
+ __name: "base-input",
148
+ props: {
149
+ modelValue: {
150
+ type: [String, Number, Boolean],
151
+ default: ""
152
+ },
153
+ type: {
90
154
  type: String,
91
- default: "Base Button"
155
+ default: "text"
92
156
  },
93
- size: {
157
+ name: {
94
158
  type: String,
95
- default: "default"
159
+ default: () => uniqueId()
160
+ },
161
+ id: {
162
+ type: String,
163
+ default: () => uniqueId()
164
+ },
165
+ label: {
166
+ type: String,
167
+ default: ""
168
+ },
169
+ placeholder: {
170
+ type: String,
171
+ default: ""
172
+ },
173
+ variant: {
174
+ type: String,
175
+ default: ""
176
+ },
177
+ disabled: {
178
+ type: Boolean,
179
+ default: false
180
+ },
181
+ readOnly: {
182
+ type: Boolean,
183
+ default: false
184
+ },
185
+ required: {
186
+ type: Boolean,
187
+ default: false
188
+ },
189
+ maxlength: {
190
+ type: Number
191
+ },
192
+ pattern: {
193
+ type: String,
194
+ default: null
195
+ },
196
+ checked: {
197
+ type: Boolean,
198
+ default: false
199
+ }
200
+ },
201
+ emits: ["update:modelValue"],
202
+ setup(__props, { emit }) {
203
+ const props = __props;
204
+ const model = computed({
205
+ get() {
206
+ return props.modelValue;
207
+ },
208
+ set(update) {
209
+ emit("update:modelValue", update);
210
+ }
211
+ });
212
+ return (_ctx, _cache) => {
213
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
214
+ withDirectives(createElementVNode("input", {
215
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
216
+ type: __props.type,
217
+ name: __props.name,
218
+ id: __props.id,
219
+ label: `${__props.label}${__props.required ? " *" : ""}`,
220
+ placeholder: __props.placeholder,
221
+ pattern: __props.pattern,
222
+ disabled: __props.disabled,
223
+ "read-only": __props.readOnly,
224
+ required: __props.required,
225
+ maxlength: __props.maxlength,
226
+ checked: __props.checked
227
+ }, null, 8, _hoisted_2$3), [
228
+ [vModelDynamic, unref(model)]
229
+ ]),
230
+ createElementVNode("label", { for: __props.id }, [
231
+ renderSlot(_ctx.$slots, "label", {}, () => [
232
+ createTextVNode(toDisplayString(__props.label), 1)
233
+ ])
234
+ ], 8, _hoisted_3)
235
+ ]);
236
+ };
237
+ }
238
+ });
239
+ const _hoisted_1$2 = { class: "radio-group" };
240
+ const _hoisted_2$2 = ["for"];
241
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
242
+ __name: "check-group",
243
+ props: {
244
+ modelValue: {
245
+ default: []
246
+ },
247
+ options: {
248
+ type: Array,
249
+ default: []
250
+ },
251
+ name: {
252
+ type: String,
253
+ default: () => uniqueId()
254
+ },
255
+ id: {
256
+ type: String,
257
+ default: () => uniqueId()
258
+ },
259
+ label: {
260
+ type: String,
261
+ default: ""
262
+ },
263
+ variant: {
264
+ type: String,
265
+ default: ""
266
+ },
267
+ disabled: {
268
+ type: Boolean,
269
+ default: false
270
+ },
271
+ readOnly: {
272
+ type: Boolean,
273
+ default: false
274
+ },
275
+ required: {
276
+ type: Boolean,
277
+ default: false
278
+ }
279
+ },
280
+ emits: ["change", "update:modelValue"],
281
+ setup(__props, { emit }) {
282
+ const props = __props;
283
+ const values = ref([]);
284
+ watch(() => props.modelValue, (update, before) => {
285
+ values.value = props.options.map((option) => option.value ? props.modelValue.some((modelValue) => modelValue["value "] === option.value) : props.modelValue.some((modelValue) => modelValue === option));
286
+ }, { immediate: true });
287
+ watch(values, (update, before) => {
288
+ const options = update.reduce((mappedValues, option, index) => {
289
+ const value = option && props.options[index] ? [props.options[index] || props.options[index]] : [];
290
+ return [...mappedValues, ...value];
291
+ }, []);
292
+ emit("update:modelValue", options);
293
+ }, { deep: true });
294
+ onBeforeMount(() => {
295
+ });
296
+ return (_ctx, _cache) => {
297
+ const _component_base_input = resolveComponent("base-input");
298
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
299
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
300
+ return openBlock(), createBlock(_component_base_input, {
301
+ key: index,
302
+ modelValue: unref(values)[index],
303
+ "onUpdate:modelValue": ($event) => unref(values)[index] = $event,
304
+ type: "checkbox",
305
+ name: __props.name,
306
+ id: `${__props.id}-${index}`,
307
+ label: `${option.text || option}${__props.required ? " *" : ""}`,
308
+ disabled: __props.disabled,
309
+ "read-only": __props.readOnly,
310
+ required: __props.required
311
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "name", "id", "label", "disabled", "read-only", "required"]);
312
+ }), 128)),
313
+ createElementVNode("label", { for: __props.id }, [
314
+ renderSlot(_ctx.$slots, "label", {}, () => [
315
+ createTextVNode(toDisplayString(__props.label), 1)
316
+ ])
317
+ ], 8, _hoisted_2$2)
318
+ ]);
319
+ };
320
+ }
321
+ });
322
+ const _hoisted_1$1 = { class: "radio-group" };
323
+ const _hoisted_2$1 = ["for"];
324
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
325
+ __name: "radio-group",
326
+ props: {
327
+ modelValue: {
328
+ default: false
329
+ },
330
+ options: {
331
+ type: Array,
332
+ default: []
333
+ },
334
+ name: {
335
+ type: String,
336
+ default: () => uniqueId()
337
+ },
338
+ id: {
339
+ type: String,
340
+ default: () => uniqueId()
341
+ },
342
+ label: {
343
+ type: String,
344
+ default: ""
345
+ },
346
+ variant: {
347
+ type: String,
348
+ default: ""
349
+ },
350
+ disabled: {
351
+ type: Boolean,
352
+ default: false
353
+ },
354
+ readOnly: {
355
+ type: Boolean,
356
+ default: false
357
+ },
358
+ required: {
359
+ type: Boolean,
360
+ default: false
361
+ }
362
+ },
363
+ emits: ["change", "update:modelValue"],
364
+ setup(__props, { emit }) {
365
+ const props = __props;
366
+ ref(props.options.map((option) => option.value === props.modelValue));
367
+ function change(value2) {
368
+ emit("update:modelValue", value2);
369
+ }
370
+ onBeforeMount(() => {
371
+ });
372
+ return (_ctx, _cache) => {
373
+ const _component_base_input = resolveComponent("base-input");
374
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
375
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
376
+ return openBlock(), createBlock(_component_base_input, {
377
+ key: index,
378
+ type: "radio",
379
+ name: __props.name,
380
+ id: `${__props.id}-${index}`,
381
+ value: option.value || option,
382
+ label: `${option.text || option}${__props.required ? " *" : ""}`,
383
+ checked: option.value ? option.value === __props.modelValue : option === __props.modelValue,
384
+ disabled: __props.disabled,
385
+ "read-only": __props.readOnly,
386
+ required: __props.required,
387
+ onChange: ($event) => change(option)
388
+ }, null, 8, ["name", "id", "value", "label", "checked", "disabled", "read-only", "required", "onChange"]);
389
+ }), 128)),
390
+ createElementVNode("label", { for: __props.id }, [
391
+ renderSlot(_ctx.$slots, "label", {}, () => [
392
+ createTextVNode(toDisplayString(__props.label), 1)
393
+ ])
394
+ ], 8, _hoisted_2$1)
395
+ ]);
396
+ };
397
+ }
398
+ });
399
+ /*!
400
+ * pinia v2.0.14
401
+ * (c) 2022 Eduardo San Martin Morote
402
+ * @license MIT
403
+ */
404
+ let activePinia;
405
+ const setActivePinia = (pinia) => activePinia = pinia;
406
+ const piniaSymbol = Symbol();
407
+ function isPlainObject(o) {
408
+ return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function";
409
+ }
410
+ var MutationType;
411
+ (function(MutationType2) {
412
+ MutationType2["direct"] = "direct";
413
+ MutationType2["patchObject"] = "patch object";
414
+ MutationType2["patchFunction"] = "patch function";
415
+ })(MutationType || (MutationType = {}));
416
+ const noop$1 = () => {
417
+ };
418
+ function addSubscription(subscriptions, callback, detached, onCleanup = noop$1) {
419
+ subscriptions.push(callback);
420
+ const removeSubscription = () => {
421
+ const idx = subscriptions.indexOf(callback);
422
+ if (idx > -1) {
423
+ subscriptions.splice(idx, 1);
424
+ onCleanup();
425
+ }
426
+ };
427
+ if (!detached && getCurrentInstance()) {
428
+ onUnmounted(removeSubscription);
429
+ }
430
+ return removeSubscription;
431
+ }
432
+ function triggerSubscriptions(subscriptions, ...args) {
433
+ subscriptions.slice().forEach((callback) => {
434
+ callback(...args);
435
+ });
436
+ }
437
+ function mergeReactiveObjects(target, patchToApply) {
438
+ for (const key in patchToApply) {
439
+ if (!patchToApply.hasOwnProperty(key))
440
+ continue;
441
+ const subPatch = patchToApply[key];
442
+ const targetValue = target[key];
443
+ if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) {
444
+ target[key] = mergeReactiveObjects(targetValue, subPatch);
445
+ } else {
446
+ target[key] = subPatch;
447
+ }
448
+ }
449
+ return target;
450
+ }
451
+ const skipHydrateSymbol = Symbol();
452
+ function shouldHydrate(obj) {
453
+ return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
454
+ }
455
+ const { assign } = Object;
456
+ function isComputed(o) {
457
+ return !!(isRef(o) && o.effect);
458
+ }
459
+ function createOptionsStore(id, options, pinia, hot) {
460
+ const { state, actions, getters } = options;
461
+ const initialState = pinia.state.value[id];
462
+ let store;
463
+ function setup() {
464
+ if (!initialState && true) {
465
+ {
466
+ pinia.state.value[id] = state ? state() : {};
467
+ }
468
+ }
469
+ const localState = toRefs(pinia.state.value[id]);
470
+ return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
471
+ computedGetters[name] = markRaw(computed(() => {
472
+ setActivePinia(pinia);
473
+ const store2 = pinia._s.get(id);
474
+ return getters[name].call(store2, store2);
475
+ }));
476
+ return computedGetters;
477
+ }, {}));
478
+ }
479
+ store = createSetupStore(id, setup, options, pinia, hot, true);
480
+ store.$reset = function $reset() {
481
+ const newState = state ? state() : {};
482
+ this.$patch(($state) => {
483
+ assign($state, newState);
484
+ });
485
+ };
486
+ return store;
487
+ }
488
+ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
489
+ let scope;
490
+ const optionsForPlugin = assign({ actions: {} }, options);
491
+ const $subscribeOptions = {
492
+ deep: true
493
+ };
494
+ let isListening;
495
+ let isSyncListening;
496
+ let subscriptions = markRaw([]);
497
+ let actionSubscriptions = markRaw([]);
498
+ let debuggerEvents;
499
+ const initialState = pinia.state.value[$id];
500
+ if (!isOptionsStore && !initialState && true) {
501
+ {
502
+ pinia.state.value[$id] = {};
503
+ }
504
+ }
505
+ ref({});
506
+ let activeListener;
507
+ function $patch(partialStateOrMutator) {
508
+ let subscriptionMutation;
509
+ isListening = isSyncListening = false;
510
+ if (typeof partialStateOrMutator === "function") {
511
+ partialStateOrMutator(pinia.state.value[$id]);
512
+ subscriptionMutation = {
513
+ type: MutationType.patchFunction,
514
+ storeId: $id,
515
+ events: debuggerEvents
516
+ };
517
+ } else {
518
+ mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
519
+ subscriptionMutation = {
520
+ type: MutationType.patchObject,
521
+ payload: partialStateOrMutator,
522
+ storeId: $id,
523
+ events: debuggerEvents
524
+ };
525
+ }
526
+ const myListenerId = activeListener = Symbol();
527
+ nextTick().then(() => {
528
+ if (activeListener === myListenerId) {
529
+ isListening = true;
530
+ }
531
+ });
532
+ isSyncListening = true;
533
+ triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
534
+ }
535
+ const $reset = noop$1;
536
+ function $dispose() {
537
+ scope.stop();
538
+ subscriptions = [];
539
+ actionSubscriptions = [];
540
+ pinia._s.delete($id);
541
+ }
542
+ function wrapAction(name, action) {
543
+ return function() {
544
+ setActivePinia(pinia);
545
+ const args = Array.from(arguments);
546
+ const afterCallbackList = [];
547
+ const onErrorCallbackList = [];
548
+ function after(callback) {
549
+ afterCallbackList.push(callback);
550
+ }
551
+ function onError(callback) {
552
+ onErrorCallbackList.push(callback);
553
+ }
554
+ triggerSubscriptions(actionSubscriptions, {
555
+ args,
556
+ name,
557
+ store,
558
+ after,
559
+ onError
560
+ });
561
+ let ret;
562
+ try {
563
+ ret = action.apply(this && this.$id === $id ? this : store, args);
564
+ } catch (error) {
565
+ triggerSubscriptions(onErrorCallbackList, error);
566
+ throw error;
567
+ }
568
+ if (ret instanceof Promise) {
569
+ return ret.then((value) => {
570
+ triggerSubscriptions(afterCallbackList, value);
571
+ return value;
572
+ }).catch((error) => {
573
+ triggerSubscriptions(onErrorCallbackList, error);
574
+ return Promise.reject(error);
575
+ });
576
+ }
577
+ triggerSubscriptions(afterCallbackList, ret);
578
+ return ret;
579
+ };
580
+ }
581
+ const partialStore = {
582
+ _p: pinia,
583
+ $id,
584
+ $onAction: addSubscription.bind(null, actionSubscriptions),
585
+ $patch,
586
+ $reset,
587
+ $subscribe(callback, options2 = {}) {
588
+ const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
589
+ const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
590
+ if (options2.flush === "sync" ? isSyncListening : isListening) {
591
+ callback({
592
+ storeId: $id,
593
+ type: MutationType.direct,
594
+ events: debuggerEvents
595
+ }, state);
596
+ }
597
+ }, assign({}, $subscribeOptions, options2)));
598
+ return removeSubscription;
599
+ },
600
+ $dispose
601
+ };
602
+ const store = reactive(assign({}, partialStore));
603
+ pinia._s.set($id, store);
604
+ const setupStore = pinia._e.run(() => {
605
+ scope = effectScope();
606
+ return scope.run(() => setup());
607
+ });
608
+ for (const key in setupStore) {
609
+ const prop = setupStore[key];
610
+ if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
611
+ if (!isOptionsStore) {
612
+ if (initialState && shouldHydrate(prop)) {
613
+ if (isRef(prop)) {
614
+ prop.value = initialState[key];
615
+ } else {
616
+ mergeReactiveObjects(prop, initialState[key]);
617
+ }
618
+ }
619
+ {
620
+ pinia.state.value[$id][key] = prop;
621
+ }
622
+ }
623
+ } else if (typeof prop === "function") {
624
+ const actionValue = wrapAction(key, prop);
625
+ {
626
+ setupStore[key] = actionValue;
627
+ }
628
+ optionsForPlugin.actions[key] = prop;
629
+ } else
630
+ ;
631
+ }
632
+ {
633
+ assign(store, setupStore);
634
+ assign(toRaw(store), setupStore);
635
+ }
636
+ Object.defineProperty(store, "$state", {
637
+ get: () => pinia.state.value[$id],
638
+ set: (state) => {
639
+ $patch(($state) => {
640
+ assign($state, state);
641
+ });
642
+ }
643
+ });
644
+ pinia._p.forEach((extender) => {
645
+ {
646
+ assign(store, scope.run(() => extender({
647
+ store,
648
+ app: pinia._a,
649
+ pinia,
650
+ options: optionsForPlugin
651
+ })));
652
+ }
653
+ });
654
+ if (initialState && isOptionsStore && options.hydrate) {
655
+ options.hydrate(store.$state, initialState);
656
+ }
657
+ isListening = true;
658
+ isSyncListening = true;
659
+ return store;
660
+ }
661
+ function defineStore(idOrOptions, setup, setupOptions) {
662
+ let id;
663
+ let options;
664
+ const isSetupStore = typeof setup === "function";
665
+ if (typeof idOrOptions === "string") {
666
+ id = idOrOptions;
667
+ options = isSetupStore ? setupOptions : setup;
668
+ } else {
669
+ options = idOrOptions;
670
+ id = idOrOptions.id;
671
+ }
672
+ function useStore(pinia, hot) {
673
+ const currentInstance = getCurrentInstance();
674
+ pinia = pinia || currentInstance && inject(piniaSymbol);
675
+ if (pinia)
676
+ setActivePinia(pinia);
677
+ pinia = activePinia;
678
+ if (!pinia._s.has(id)) {
679
+ if (isSetupStore) {
680
+ createSetupStore(id, setup, options, pinia);
681
+ } else {
682
+ createOptionsStore(id, options, pinia);
683
+ }
684
+ }
685
+ const store = pinia._s.get(id);
686
+ return store;
687
+ }
688
+ useStore.$id = id;
689
+ return useStore;
690
+ }
691
+ function tryOnScopeDispose(fn) {
692
+ if (getCurrentScope()) {
693
+ onScopeDispose(fn);
694
+ return true;
695
+ }
696
+ return false;
697
+ }
698
+ var _a;
699
+ const isClient = typeof window !== "undefined";
700
+ const isString = (val) => typeof val === "string";
701
+ const noop = () => {
702
+ };
703
+ isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
704
+ function createFilterWrapper(filter, fn) {
705
+ function wrapper(...args) {
706
+ filter(() => fn.apply(this, args), { fn, thisArg: this, args });
707
+ }
708
+ return wrapper;
709
+ }
710
+ const bypassFilter = (invoke) => {
711
+ return invoke();
712
+ };
713
+ function pausableFilter(extendFilter = bypassFilter) {
714
+ const isActive = ref(true);
715
+ function pause() {
716
+ isActive.value = false;
717
+ }
718
+ function resume() {
719
+ isActive.value = true;
720
+ }
721
+ const eventFilter = (...args) => {
722
+ if (isActive.value)
723
+ extendFilter(...args);
724
+ };
725
+ return { isActive, pause, resume, eventFilter };
726
+ }
727
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
728
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
729
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
730
+ var __objRest$5 = (source, exclude) => {
731
+ var target = {};
732
+ for (var prop in source)
733
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
734
+ target[prop] = source[prop];
735
+ if (source != null && __getOwnPropSymbols$5)
736
+ for (var prop of __getOwnPropSymbols$5(source)) {
737
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
738
+ target[prop] = source[prop];
739
+ }
740
+ return target;
741
+ };
742
+ function watchWithFilter(source, cb, options = {}) {
743
+ const _a2 = options, {
744
+ eventFilter = bypassFilter
745
+ } = _a2, watchOptions = __objRest$5(_a2, [
746
+ "eventFilter"
747
+ ]);
748
+ return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
749
+ }
750
+ var __defProp$1 = Object.defineProperty;
751
+ var __defProps$1 = Object.defineProperties;
752
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
753
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
754
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
755
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
756
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
757
+ var __spreadValues$1 = (a, b) => {
758
+ for (var prop in b || (b = {}))
759
+ if (__hasOwnProp$1.call(b, prop))
760
+ __defNormalProp$1(a, prop, b[prop]);
761
+ if (__getOwnPropSymbols$1)
762
+ for (var prop of __getOwnPropSymbols$1(b)) {
763
+ if (__propIsEnum$1.call(b, prop))
764
+ __defNormalProp$1(a, prop, b[prop]);
765
+ }
766
+ return a;
767
+ };
768
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
769
+ var __objRest$1 = (source, exclude) => {
770
+ var target = {};
771
+ for (var prop in source)
772
+ if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
773
+ target[prop] = source[prop];
774
+ if (source != null && __getOwnPropSymbols$1)
775
+ for (var prop of __getOwnPropSymbols$1(source)) {
776
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
777
+ target[prop] = source[prop];
96
778
  }
779
+ return target;
780
+ };
781
+ function watchPausable(source, cb, options = {}) {
782
+ const _a2 = options, {
783
+ eventFilter: filter
784
+ } = _a2, watchOptions = __objRest$1(_a2, [
785
+ "eventFilter"
786
+ ]);
787
+ const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
788
+ const stop = watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
789
+ eventFilter
790
+ }));
791
+ return { stop, pause, resume, isActive };
792
+ }
793
+ function unrefElement(elRef) {
794
+ var _a2;
795
+ const plain = unref(elRef);
796
+ return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
797
+ }
798
+ const defaultWindow = isClient ? window : void 0;
799
+ isClient ? window.document : void 0;
800
+ isClient ? window.navigator : void 0;
801
+ isClient ? window.location : void 0;
802
+ function useEventListener(...args) {
803
+ let target;
804
+ let event;
805
+ let listener;
806
+ let options;
807
+ if (isString(args[0])) {
808
+ [event, listener, options] = args;
809
+ target = defaultWindow;
810
+ } else {
811
+ [target, event, listener, options] = args;
812
+ }
813
+ if (!target)
814
+ return noop;
815
+ let cleanup = noop;
816
+ const stopWatch = watch(() => unrefElement(target), (el) => {
817
+ cleanup();
818
+ if (!el)
819
+ return;
820
+ el.addEventListener(event, listener, options);
821
+ cleanup = () => {
822
+ el.removeEventListener(event, listener, options);
823
+ cleanup = noop;
824
+ };
825
+ }, { immediate: true, flush: "post" });
826
+ const stop = () => {
827
+ stopWatch();
828
+ cleanup();
829
+ };
830
+ tryOnScopeDispose(stop);
831
+ return stop;
832
+ }
833
+ const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
834
+ const globalKey = "__vueuse_ssr_handlers__";
835
+ _global[globalKey] = _global[globalKey] || {};
836
+ const handlers = _global[globalKey];
837
+ function getSSRHandler(key, fallback) {
838
+ return handlers[key] || fallback;
839
+ }
840
+ function guessSerializerType(rawInit) {
841
+ return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : Array.isArray(rawInit) ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
842
+ }
843
+ const StorageSerializers = {
844
+ boolean: {
845
+ read: (v) => v === "true",
846
+ write: (v) => String(v)
847
+ },
848
+ object: {
849
+ read: (v) => JSON.parse(v),
850
+ write: (v) => JSON.stringify(v)
851
+ },
852
+ number: {
853
+ read: (v) => Number.parseFloat(v),
854
+ write: (v) => String(v)
855
+ },
856
+ any: {
857
+ read: (v) => v,
858
+ write: (v) => String(v)
859
+ },
860
+ string: {
861
+ read: (v) => v,
862
+ write: (v) => String(v)
863
+ },
864
+ map: {
865
+ read: (v) => new Map(JSON.parse(v)),
866
+ write: (v) => JSON.stringify(Array.from(v.entries()))
867
+ },
868
+ set: {
869
+ read: (v) => new Set(JSON.parse(v)),
870
+ write: (v) => JSON.stringify(Array.from(v))
871
+ },
872
+ date: {
873
+ read: (v) => new Date(v),
874
+ write: (v) => v.toISOString()
875
+ }
876
+ };
877
+ function useStorage(key, initialValue, storage, options = {}) {
878
+ var _a2;
879
+ const {
880
+ flush = "pre",
881
+ deep = true,
882
+ listenToStorageChanges = true,
883
+ writeDefaults = true,
884
+ shallow,
885
+ window: window2 = defaultWindow,
886
+ eventFilter,
887
+ onError = (e) => {
888
+ console.error(e);
889
+ }
890
+ } = options;
891
+ const data = (shallow ? shallowRef : ref)(initialValue);
892
+ if (!storage) {
893
+ try {
894
+ storage = getSSRHandler("getDefaultStorage", () => {
895
+ var _a22;
896
+ return (_a22 = defaultWindow) == null ? void 0 : _a22.localStorage;
897
+ })();
898
+ } catch (e) {
899
+ onError(e);
900
+ }
901
+ }
902
+ if (!storage)
903
+ return data;
904
+ const rawInit = unref(initialValue);
905
+ const type = guessSerializerType(rawInit);
906
+ const serializer = (_a2 = options.serializer) != null ? _a2 : StorageSerializers[type];
907
+ const { pause: pauseWatch, resume: resumeWatch } = watchPausable(data, () => write(data.value), { flush, deep, eventFilter });
908
+ if (window2 && listenToStorageChanges)
909
+ useEventListener(window2, "storage", update);
910
+ update();
911
+ return data;
912
+ function write(v) {
913
+ try {
914
+ if (v == null)
915
+ storage.removeItem(key);
916
+ else
917
+ storage.setItem(key, serializer.write(v));
918
+ } catch (e) {
919
+ onError(e);
920
+ }
921
+ }
922
+ function read(event) {
923
+ if (event && event.key !== key)
924
+ return;
925
+ pauseWatch();
926
+ try {
927
+ const rawValue = event ? event.newValue : storage.getItem(key);
928
+ if (rawValue == null) {
929
+ if (writeDefaults && rawInit !== null)
930
+ storage.setItem(key, serializer.write(rawInit));
931
+ return rawInit;
932
+ } else if (typeof rawValue !== "string") {
933
+ return rawValue;
934
+ } else {
935
+ return serializer.read(rawValue);
936
+ }
937
+ } catch (e) {
938
+ onError(e);
939
+ } finally {
940
+ resumeWatch();
941
+ }
942
+ }
943
+ function update(event) {
944
+ if (event && event.key !== key)
945
+ return;
946
+ data.value = read(event);
947
+ }
948
+ }
949
+ var SwipeDirection;
950
+ (function(SwipeDirection2) {
951
+ SwipeDirection2["UP"] = "UP";
952
+ SwipeDirection2["RIGHT"] = "RIGHT";
953
+ SwipeDirection2["DOWN"] = "DOWN";
954
+ SwipeDirection2["LEFT"] = "LEFT";
955
+ SwipeDirection2["NONE"] = "NONE";
956
+ })(SwipeDirection || (SwipeDirection = {}));
957
+ const useAuthUserStore = defineStore("auth/user", {
958
+ state: () => ({
959
+ firstName: useStorage("firstName", ""),
960
+ lastName: "",
961
+ userId: null
962
+ }),
963
+ getters: {
964
+ fullName: (state) => `${state.firstName} ${state.lastName}`,
965
+ loggedIn: (state) => state.userId !== null,
966
+ fullUserDetails(state) {
967
+ return {
968
+ ...state,
969
+ fullName: this.fullName
970
+ };
971
+ }
972
+ },
973
+ actions: {
974
+ updateUser(payload) {
975
+ this.firstName = payload.firstName;
976
+ this.lastName = payload.lastName;
977
+ this.userId = payload.userId;
978
+ },
979
+ clearUser() {
980
+ this.$reset();
981
+ }
982
+ }
983
+ });
984
+ var baseForm_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")();
985
+ const _hoisted_1 = { class: "base-form" };
986
+ const _hoisted_2 = ["onSubmit"];
987
+ const _sfc_main = /* @__PURE__ */ defineComponent({
988
+ __name: "base-form",
989
+ props: {
990
+ id: null,
991
+ name: null,
992
+ variant: null,
993
+ disabled: { type: Boolean },
994
+ pending: { type: Boolean }
97
995
  },
98
996
  setup(__props) {
997
+ const authUserStore = useAuthUserStore();
998
+ computed(() => authUserStore.firstName);
999
+ computed(() => authUserStore.fullName);
1000
+ function input(event) {
1001
+ authUserStore.updateUser({
1002
+ firstName: event.target.value
1003
+ });
1004
+ console.log("input", event);
1005
+ }
1006
+ function reset(event) {
1007
+ console.log("reset", event);
1008
+ }
1009
+ function submit(event) {
1010
+ console.log("submit", event);
1011
+ }
99
1012
  return (_ctx, _cache) => {
100
- return openBlock(), createElementBlock("button", _hoisted_1, [
101
- createElementVNode("span", {
102
- class: "caption",
103
- innerHTML: __props.caption
104
- }, null, 8, _hoisted_2)
1013
+ return openBlock(), createElementBlock("div", _hoisted_1, [
1014
+ createElementVNode("form", {
1015
+ ref: "form",
1016
+ onInput: input,
1017
+ onReset: reset,
1018
+ onSubmit: withModifiers(submit, ["prevent"])
1019
+ }, [
1020
+ renderSlot(_ctx.$slots, "default")
1021
+ ], 40, _hoisted_2)
105
1022
  ]);
106
1023
  };
107
1024
  }
108
1025
  });
109
- export { _sfc_main as BaseButton, _sfc_main$2 as BaseIcon, _sfc_main$1 as LoadingSpinner };
1026
+ export { _sfc_main$4 as BaseButton, _sfc_main as BaseForm, _sfc_main$6 as BaseIcon, _sfc_main$3 as BaseInput, _sfc_main$2 as CheckGroup, _sfc_main$5 as LoadingSpinner, _sfc_main$1 as RadioGroup };