ablok-components 0.0.19 → 0.0.20

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,11 +1,11 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, computed, resolveComponent, createBlock, createCommentVNode, unref, toDisplayString, withDirectives, isRef, vModelDynamic, createTextVNode, ref, watch, onBeforeMount, Fragment, renderList } from "vue";
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, computed, resolveComponent, createBlock, createCommentVNode, unref, toDisplayString, withDirectives, isRef, vModelDynamic, createTextVNode, ref, watch, onBeforeMount, Fragment, renderList, withModifiers } from "vue";
2
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$5 = {
3
+ const _hoisted_1$6 = {
4
4
  class: "icon",
5
5
  preserveAspectRatio: "xMaxYMin"
6
6
  };
7
- const _hoisted_2$4 = ["xlink:href"];
8
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
7
+ const _hoisted_2$5 = ["xlink:href"];
8
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
9
9
  __name: "svg-icon",
10
10
  props: {
11
11
  basePath: {
@@ -32,22 +32,22 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
32
32
  [`svg-icon--${__props.size}`]: __props.size
33
33
  }])
34
34
  }, [
35
- (openBlock(), createElementBlock("svg", _hoisted_1$5, [
35
+ (openBlock(), createElementBlock("svg", _hoisted_1$6, [
36
36
  createElementVNode("use", {
37
37
  "xlink:href": `${__props.basePath}#${__props.prefix}${__props.symbol}`,
38
38
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
39
39
  x: "0",
40
40
  y: "0"
41
- }, null, 8, _hoisted_2$4)
41
+ }, null, 8, _hoisted_2$5)
42
42
  ]))
43
43
  ], 2);
44
44
  };
45
45
  }
46
46
  });
47
47
  var loadingSpinner_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".loading-spinner{min-width:2rem}\n")();
48
- const _hoisted_1$4 = { class: "loading-spinner d-block" };
49
- const _hoisted_2$3 = { class: "loading-spinner__animation" };
50
- const _hoisted_3$1 = {
48
+ const _hoisted_1$5 = { class: "loading-spinner d-block" };
49
+ const _hoisted_2$4 = { class: "loading-spinner__animation" };
50
+ const _hoisted_3$2 = {
51
51
  class: "d-block",
52
52
  version: "1.1",
53
53
  id: "L9",
@@ -59,8 +59,8 @@ const _hoisted_3$1 = {
59
59
  "enable-background": "new 0 0 0 0",
60
60
  "xml:space": "preserve"
61
61
  };
62
- const _hoisted_4$1 = ["fill"];
63
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("animateTransform", {
62
+ const _hoisted_4$2 = ["fill"];
63
+ const _hoisted_5$1 = /* @__PURE__ */ createElementVNode("animateTransform", {
64
64
  attributeName: "transform",
65
65
  attributeType: "XML",
66
66
  type: "rotate",
@@ -69,10 +69,10 @@ const _hoisted_5 = /* @__PURE__ */ createElementVNode("animateTransform", {
69
69
  to: "360 50 50",
70
70
  repeatCount: "indefinite"
71
71
  }, null, -1);
72
- const _hoisted_6 = [
73
- _hoisted_5
72
+ const _hoisted_6$1 = [
73
+ _hoisted_5$1
74
74
  ];
75
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
75
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
76
76
  __name: "loading-spinner",
77
77
  props: {
78
78
  color: {
@@ -82,13 +82,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
82
82
  },
83
83
  setup(__props) {
84
84
  return (_ctx, _cache) => {
85
- return openBlock(), createElementBlock("span", _hoisted_1$4, [
86
- createElementVNode("span", _hoisted_2$3, [
87
- (openBlock(), createElementBlock("svg", _hoisted_3$1, [
85
+ return openBlock(), createElementBlock("span", _hoisted_1$5, [
86
+ createElementVNode("span", _hoisted_2$4, [
87
+ (openBlock(), createElementBlock("svg", _hoisted_3$2, [
88
88
  createElementVNode("path", {
89
89
  fill: __props.color,
90
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, 8, _hoisted_4$1)
91
+ }, _hoisted_6$1, 8, _hoisted_4$2)
92
92
  ]))
93
93
  ]),
94
94
  renderSlot(_ctx.$slots, "default")
@@ -97,8 +97,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
97
97
  }
98
98
  });
99
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$3 = ["type", "disabled", "href", "to"];
101
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
100
+ const _hoisted_1$4 = ["type", "disabled", "href", "to"];
101
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
102
102
  __name: "base-button",
103
103
  props: {
104
104
  type: null,
@@ -149,18 +149,18 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
149
149
  class: normalizeClass(["base-button__caption", { "icon-padding": __props.icon }])
150
150
  }, toDisplayString(__props.caption), 3)) : createCommentVNode("", true)
151
151
  ])
152
- ], 10, _hoisted_1$3);
152
+ ], 10, _hoisted_1$4);
153
153
  };
154
154
  }
155
155
  });
156
156
  function uniqueId() {
157
157
  return (new Date().valueOf() + Math.random()).toString(36);
158
158
  }
159
- const _hoisted_1$2 = { class: "base-input" };
160
- const _hoisted_2$2 = { class: "input-group" };
161
- const _hoisted_3 = ["type", "name", "id", "label", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"];
162
- const _hoisted_4 = ["for"];
163
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
159
+ const _hoisted_1$3 = { class: "base-input" };
160
+ const _hoisted_2$3 = { class: "input-group" };
161
+ const _hoisted_3$1 = ["type", "name", "id", "label", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"];
162
+ const _hoisted_4$1 = ["for"];
163
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
164
164
  __name: "base-input",
165
165
  props: {
166
166
  modelValue: {
@@ -227,8 +227,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
227
227
  }
228
228
  });
229
229
  return (_ctx, _cache) => {
230
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
231
- createElementVNode("div", _hoisted_2$2, [
230
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
231
+ createElementVNode("div", _hoisted_2$3, [
232
232
  renderSlot(_ctx.$slots, "input-prepend"),
233
233
  withDirectives(createElementVNode("input", {
234
234
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
@@ -245,7 +245,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
245
245
  checked: __props.checked,
246
246
  class: "form-control",
247
247
  "aria-label": __props.label
248
- }, null, 8, _hoisted_3), [
248
+ }, null, 8, _hoisted_3$1), [
249
249
  [vModelDynamic, unref(model)]
250
250
  ]),
251
251
  renderSlot(_ctx.$slots, "input-append")
@@ -254,14 +254,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
254
254
  renderSlot(_ctx.$slots, "label", {}, () => [
255
255
  createTextVNode(toDisplayString(__props.label), 1)
256
256
  ])
257
- ], 8, _hoisted_4)
257
+ ], 8, _hoisted_4$1)
258
258
  ]);
259
259
  };
260
260
  }
261
261
  });
262
- const _hoisted_1$1 = { class: "radio-group" };
263
- const _hoisted_2$1 = ["for"];
264
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
262
+ const _hoisted_1$2 = { class: "radio-group" };
263
+ const _hoisted_2$2 = ["for"];
264
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
265
265
  __name: "check-group",
266
266
  props: {
267
267
  modelValue: {
@@ -318,7 +318,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
318
318
  });
319
319
  return (_ctx, _cache) => {
320
320
  const _component_base_input = resolveComponent("base-input");
321
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
321
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
322
322
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
323
323
  return openBlock(), createBlock(_component_base_input, {
324
324
  key: index,
@@ -337,14 +337,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
337
337
  renderSlot(_ctx.$slots, "label", {}, () => [
338
338
  createTextVNode(toDisplayString(__props.label), 1)
339
339
  ])
340
- ], 8, _hoisted_2$1)
340
+ ], 8, _hoisted_2$2)
341
341
  ]);
342
342
  };
343
343
  }
344
344
  });
345
- const _hoisted_1 = { class: "radio-group" };
346
- const _hoisted_2 = ["for"];
347
- const _sfc_main = /* @__PURE__ */ defineComponent({
345
+ const _hoisted_1$1 = { class: "radio-group" };
346
+ const _hoisted_2$1 = ["for"];
347
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
348
348
  __name: "radio-group",
349
349
  props: {
350
350
  modelValue: {
@@ -394,7 +394,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
394
394
  });
395
395
  return (_ctx, _cache) => {
396
396
  const _component_base_input = resolveComponent("base-input");
397
- return openBlock(), createElementBlock("div", _hoisted_1, [
397
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
398
398
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
399
399
  return openBlock(), createBlock(_component_base_input, {
400
400
  key: index,
@@ -414,9 +414,121 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
414
414
  renderSlot(_ctx.$slots, "label", {}, () => [
415
415
  createTextVNode(toDisplayString(__props.label), 1)
416
416
  ])
417
- ], 8, _hoisted_2)
417
+ ], 8, _hoisted_2$1)
418
+ ]);
419
+ };
420
+ }
421
+ });
422
+ const _hoisted_1 = { class: "input input-dropdown" };
423
+ const _hoisted_2 = { class: "dropdown" };
424
+ const _hoisted_3 = {
425
+ class: "btn-group",
426
+ role: "group"
427
+ };
428
+ const _hoisted_4 = ["id", "disabled"];
429
+ const _hoisted_5 = ["aria-labelledby"];
430
+ const _hoisted_6 = ["onClick"];
431
+ const _hoisted_7 = ["for"];
432
+ const _sfc_main = /* @__PURE__ */ defineComponent({
433
+ __name: "input-dropdown",
434
+ props: {
435
+ modelValue: {
436
+ type: [String, Number, Boolean],
437
+ default: ""
438
+ },
439
+ name: {
440
+ type: String,
441
+ default: () => uniqueId()
442
+ },
443
+ id: {
444
+ type: String,
445
+ default: () => uniqueId()
446
+ },
447
+ label: {
448
+ type: String,
449
+ default: ""
450
+ },
451
+ placeholder: {
452
+ type: String,
453
+ default: "Please select"
454
+ },
455
+ options: {
456
+ type: Array,
457
+ default: []
458
+ },
459
+ variant: {
460
+ type: String,
461
+ default: ""
462
+ },
463
+ disabled: {
464
+ type: Boolean,
465
+ default: false
466
+ },
467
+ multiple: {
468
+ type: Boolean,
469
+ default: false
470
+ },
471
+ required: {
472
+ type: Boolean,
473
+ default: false
474
+ }
475
+ },
476
+ emits: ["update:modelValue"],
477
+ setup(__props, { emit }) {
478
+ const props = __props;
479
+ computed({
480
+ get() {
481
+ return props.modelValue;
482
+ },
483
+ set(update) {
484
+ emit("update:modelValue", update);
485
+ }
486
+ });
487
+ function select(update) {
488
+ emit("update:modelValue", update);
489
+ }
490
+ const selectedOption = computed(() => {
491
+ return [...props.options].find((option) => JSON.stringify(option.value) === JSON.stringify(props.modelValue));
492
+ });
493
+ return (_ctx, _cache) => {
494
+ return openBlock(), createElementBlock("div", _hoisted_1, [
495
+ createElementVNode("div", _hoisted_2, [
496
+ createElementVNode("div", _hoisted_3, [
497
+ createElementVNode("button", {
498
+ class: normalizeClass(["btn btn-secondary dropdown-toggle", {
499
+ [`button-${__props.variant}`]: __props.variant,
500
+ [`button-${__props.disabled}`]: __props.disabled
501
+ }]),
502
+ type: "button",
503
+ id: __props.id,
504
+ "data-bs-toggle": "dropdown",
505
+ "aria-expanded": "false",
506
+ disabled: __props.disabled
507
+ }, toDisplayString(unref(selectedOption) ? unref(selectedOption).text : __props.placeholder), 11, _hoisted_4),
508
+ createElementVNode("ul", {
509
+ class: "dropdown-menu",
510
+ "aria-labelledby": __props.id
511
+ }, [
512
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
513
+ return openBlock(), createElementBlock("li", { key: index }, [
514
+ renderSlot(_ctx.$slots, "option", {}, () => [
515
+ createElementVNode("a", {
516
+ class: "dropdown-item",
517
+ onClick: withModifiers(($event) => select(option.value), ["prevent"])
518
+ }, toDisplayString(option.text), 9, _hoisted_6)
519
+ ])
520
+ ]);
521
+ }), 128))
522
+ ], 8, _hoisted_5)
523
+ ])
524
+ ]),
525
+ createElementVNode("label", { for: __props.id }, [
526
+ renderSlot(_ctx.$slots, "label", {}, () => [
527
+ createTextVNode(toDisplayString(__props.label), 1)
528
+ ])
529
+ ], 8, _hoisted_7)
418
530
  ]);
419
531
  };
420
532
  }
421
533
  });
422
- export { _sfc_main$3 as BaseButton, _sfc_main$2 as BaseInput, _sfc_main$1 as CheckGroup, _sfc_main$4 as LoadingSpinner, _sfc_main as RadioGroup, _sfc_main$5 as SvgIcon };
534
+ export { _sfc_main$4 as BaseButton, _sfc_main$3 as BaseInput, _sfc_main$2 as CheckGroup, _sfc_main as InputDropdown, _sfc_main$5 as LoadingSpinner, _sfc_main$1 as RadioGroup, _sfc_main$6 as SvgIcon };
@@ -1,4 +1,4 @@
1
- (function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o.AblokComponents={},o.Vue))})(this,function(o,e){"use strict";var A=(()=>`.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}
2
- `)();const f={class:"icon",preserveAspectRatio:"xMaxYMin"},b=["xlink:href"],p=e.defineComponent({__name:"svg-icon",props:{basePath:{type:String,default:"/static/symbol-defs.svg"},prefix:{type:String,default:"icon-"},symbol:{type:String,default:""},size:{type:String,default:"default"}},setup(t){return(d,a)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["svg-icon",{[`svg-icon--${t.size}`]:t.size}])},[(e.openBlock(),e.createElementBlock("svg",f,[e.createElementVNode("use",{"xlink:href":`${t.basePath}#${t.prefix}${t.symbol}`,"xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0",y:"0"},null,8,b)]))],2))}});var I=(()=>`.loading-spinner{min-width:2rem}
3
- `)();const g={class:"loading-spinner d-block"},y={class:"loading-spinner__animation"},h={class:"d-block",version:"1.1",id:"L9",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 100 100","enable-background":"new 0 0 0 0","xml:space":"preserve"},k=["fill"],B=[e.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",dur:"1s",from:"0 50 50",to:"360 50 50",repeatCount:"indefinite"},null,-1)],x=e.defineComponent({__name:"loading-spinner",props:{color:{type:String,default:"#fff"}},setup(t){return(d,a)=>(e.openBlock(),e.createElementBlock("span",g,[e.createElementVNode("span",y,[(e.openBlock(),e.createElementBlock("svg",h,[e.createElementVNode("path",{fill:t.color,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"},B,8,k)]))]),e.renderSlot(d.$slots,"default")]))}});var P=(()=>`.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}
4
- `)();const S=["type","disabled","href","to"],$=e.defineComponent({__name:"base-button",props:{type:null,caption:null,variant:null,size:null,icon:null,href:null,to:null,disabled:{type:Boolean},pending:{type:Boolean},outlined:{type:Boolean},rounded:{type:Boolean},fab:{type:Boolean}},setup(t){const d=t,a=e.computed(()=>d.caption&&!d.fab);return(i,n)=>{const c=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("button",{type:t.type,disabled:t.disabled,href:t.href,to:t.to,class:e.normalizeClass(["base-button btn btn-primary",{disabled:t.disabled,pending:t.pending,rounded:t.rounded,outlined:t.outlined,fab:t.fab,"x-large":t.size==="x-large",large:t.size==="large",small:t.size==="small","x-small":t.size==="x-small"}])},[e.renderSlot(i.$slots,"default",{},()=>[t.icon?(e.openBlock(),e.createBlock(c,{key:0,id:t.icon,class:"base-button__caption"},null,8,["id"])):e.createCommentVNode("",!0),e.unref(a)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(["base-button__caption",{"icon-padding":t.icon}])},e.toDisplayString(t.caption),3)):e.createCommentVNode("",!0)])],10,S)}}});function m(){return(new Date().valueOf()+Math.random()).toString(36)}const V={class:"base-input"},w={class:"input-group"},C=["type","name","id","label","placeholder","pattern","disabled","read-only","required","maxlength","checked","aria-label"],E=["for"],q=e.defineComponent({__name:"base-input",props:{modelValue:{type:[String,Number,Boolean],default:""},type:{type:String,default:"text"},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxlength:{type:Number},pattern:{type:String,default:null},checked:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:d}){const a=t,i=e.computed({get(){return a.modelValue},set(n){d("update:modelValue",n)}});return(n,c)=>(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",w,[e.renderSlot(n.$slots,"input-prepend"),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=r=>e.isRef(i)?i.value=r:null),type:t.type,name:t.name,id:t.id,label:`${t.label}${t.required?" *":""}`,placeholder:t.placeholder,pattern:t.pattern,disabled:t.disabled,"read-only":t.readOnly,required:t.required,maxlength:t.maxlength,checked:t.checked,class:"form-control","aria-label":t.label},null,8,C),[[e.vModelDynamic,e.unref(i)]]),e.renderSlot(n.$slots,"input-append")]),e.createElementVNode("label",{for:t.id},[e.renderSlot(n.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,E)]))}}),N={class:"radio-group"},z=["for"],M=e.defineComponent({__name:"check-group",props:{modelValue:{default:[]},options:{type:Array,default:[]},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:d}){const a=t,i=e.ref([]);return e.watch(()=>a.modelValue,(n,c)=>{i.value=a.options.map(r=>r.value?a.modelValue.some(l=>l["value "]===r.value):a.modelValue.some(l=>l===r))},{immediate:!0}),e.watch(i,(n,c)=>{const r=n.reduce((l,s,u)=>{const L=s&&a.options[u]?[a.options[u]||a.options[u]]:[];return[...l,...L]},[]);d("update:modelValue",r)},{deep:!0}),e.onBeforeMount(()=>{}),(n,c)=>{const r=e.resolveComponent("base-input");return e.openBlock(),e.createElementBlock("div",N,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(l,s)=>(e.openBlock(),e.createBlock(r,{key:s,modelValue:e.unref(i)[s],"onUpdate:modelValue":u=>e.unref(i)[s]=u,type:"checkbox",name:t.name,id:`${t.id}-${s}`,label:`${l.text||l}${t.required?" *":""}`,disabled:t.disabled,"read-only":t.readOnly,required:t.required},null,8,["modelValue","onUpdate:modelValue","name","id","label","disabled","read-only","required"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(n.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,z)])}}}),O={class:"radio-group"},T=["for"],D=e.defineComponent({__name:"radio-group",props:{modelValue:{default:!1},options:{type:Array,default:[]},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:d}){const a=t;e.ref(a.options.map(n=>n.value===a.modelValue));function i(n){d("update:modelValue",n)}return e.onBeforeMount(()=>{}),(n,c)=>{const r=e.resolveComponent("base-input");return e.openBlock(),e.createElementBlock("div",O,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(l,s)=>(e.openBlock(),e.createBlock(r,{key:s,type:"radio",name:t.name,id:`${t.id}-${s}`,value:l.value||l,label:`${l.text||l}${t.required?" *":""}`,checked:l.value?l.value===t.modelValue:l===t.modelValue,disabled:t.disabled,"read-only":t.readOnly,required:t.required,onChange:u=>i(l)},null,8,["name","id","value","label","checked","disabled","read-only","required","onChange"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(n.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,T)])}}});o.BaseButton=$,o.BaseInput=q,o.CheckGroup=M,o.LoadingSpinner=x,o.RadioGroup=D,o.SvgIcon=p,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r.AblokComponents={},r.Vue))})(this,function(r,e){"use strict";var J=(()=>`.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}
2
+ `)();const f={class:"icon",preserveAspectRatio:"xMaxYMin"},b=["xlink:href"],p=e.defineComponent({__name:"svg-icon",props:{basePath:{type:String,default:"/static/symbol-defs.svg"},prefix:{type:String,default:"icon-"},symbol:{type:String,default:""},size:{type:String,default:"default"}},setup(t){return(d,n)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["svg-icon",{[`svg-icon--${t.size}`]:t.size}])},[(e.openBlock(),e.createElementBlock("svg",f,[e.createElementVNode("use",{"xlink:href":`${t.basePath}#${t.prefix}${t.symbol}`,"xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0",y:"0"},null,8,b)]))],2))}});var X=(()=>`.loading-spinner{min-width:2rem}
3
+ `)();const g={class:"loading-spinner d-block"},y={class:"loading-spinner__animation"},h={class:"d-block",version:"1.1",id:"L9",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 100 100","enable-background":"new 0 0 0 0","xml:space":"preserve"},k=["fill"],B=[e.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",dur:"1s",from:"0 50 50",to:"360 50 50",repeatCount:"indefinite"},null,-1)],S=e.defineComponent({__name:"loading-spinner",props:{color:{type:String,default:"#fff"}},setup(t){return(d,n)=>(e.openBlock(),e.createElementBlock("span",g,[e.createElementVNode("span",y,[(e.openBlock(),e.createElementBlock("svg",h,[e.createElementVNode("path",{fill:t.color,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"},B,8,k)]))]),e.renderSlot(d.$slots,"default")]))}});var H=(()=>`.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}
4
+ `)();const $=["type","disabled","href","to"],V=e.defineComponent({__name:"base-button",props:{type:null,caption:null,variant:null,size:null,icon:null,href:null,to:null,disabled:{type:Boolean},pending:{type:Boolean},outlined:{type:Boolean},rounded:{type:Boolean},fab:{type:Boolean}},setup(t){const d=t,n=e.computed(()=>d.caption&&!d.fab);return(i,l)=>{const o=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("button",{type:t.type,disabled:t.disabled,href:t.href,to:t.to,class:e.normalizeClass(["base-button btn btn-primary",{disabled:t.disabled,pending:t.pending,rounded:t.rounded,outlined:t.outlined,fab:t.fab,"x-large":t.size==="x-large",large:t.size==="large",small:t.size==="small","x-small":t.size==="x-small"}])},[e.renderSlot(i.$slots,"default",{},()=>[t.icon?(e.openBlock(),e.createBlock(o,{key:0,id:t.icon,class:"base-button__caption"},null,8,["id"])):e.createCommentVNode("",!0),e.unref(n)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(["base-button__caption",{"icon-padding":t.icon}])},e.toDisplayString(t.caption),3)):e.createCommentVNode("",!0)])],10,$)}}});function m(){return(new Date().valueOf()+Math.random()).toString(36)}const x={class:"base-input"},w={class:"input-group"},E=["type","name","id","label","placeholder","pattern","disabled","read-only","required","maxlength","checked","aria-label"],N=["for"],C=e.defineComponent({__name:"base-input",props:{modelValue:{type:[String,Number,Boolean],default:""},type:{type:String,default:"text"},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxlength:{type:Number},pattern:{type:String,default:null},checked:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:d}){const n=t,i=e.computed({get(){return n.modelValue},set(l){d("update:modelValue",l)}});return(l,o)=>(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("div",w,[e.renderSlot(l.$slots,"input-prepend"),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>e.isRef(i)?i.value=s:null),type:t.type,name:t.name,id:t.id,label:`${t.label}${t.required?" *":""}`,placeholder:t.placeholder,pattern:t.pattern,disabled:t.disabled,"read-only":t.readOnly,required:t.required,maxlength:t.maxlength,checked:t.checked,class:"form-control","aria-label":t.label},null,8,E),[[e.vModelDynamic,e.unref(i)]]),e.renderSlot(l.$slots,"input-append")]),e.createElementVNode("label",{for:t.id},[e.renderSlot(l.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,N)]))}}),q={class:"radio-group"},z=["for"],M=e.defineComponent({__name:"check-group",props:{modelValue:{default:[]},options:{type:Array,default:[]},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:d}){const n=t,i=e.ref([]);return e.watch(()=>n.modelValue,(l,o)=>{i.value=n.options.map(s=>s.value?n.modelValue.some(a=>a["value "]===s.value):n.modelValue.some(a=>a===s))},{immediate:!0}),e.watch(i,(l,o)=>{const s=l.reduce((a,c,u)=>{const G=c&&n.options[u]?[n.options[u]||n.options[u]]:[];return[...a,...G]},[]);d("update:modelValue",s)},{deep:!0}),e.onBeforeMount(()=>{}),(l,o)=>{const s=e.resolveComponent("base-input");return e.openBlock(),e.createElementBlock("div",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(a,c)=>(e.openBlock(),e.createBlock(s,{key:c,modelValue:e.unref(i)[c],"onUpdate:modelValue":u=>e.unref(i)[c]=u,type:"checkbox",name:t.name,id:`${t.id}-${c}`,label:`${a.text||a}${t.required?" *":""}`,disabled:t.disabled,"read-only":t.readOnly,required:t.required},null,8,["modelValue","onUpdate:modelValue","name","id","label","disabled","read-only","required"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(l.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,z)])}}}),D={class:"radio-group"},O=["for"],T=e.defineComponent({__name:"radio-group",props:{modelValue:{default:!1},options:{type:Array,default:[]},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:d}){const n=t;e.ref(n.options.map(l=>l.value===n.modelValue));function i(l){d("update:modelValue",l)}return e.onBeforeMount(()=>{}),(l,o)=>{const s=e.resolveComponent("base-input");return e.openBlock(),e.createElementBlock("div",D,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(a,c)=>(e.openBlock(),e.createBlock(s,{key:c,type:"radio",name:t.name,id:`${t.id}-${c}`,value:a.value||a,label:`${a.text||a}${t.required?" *":""}`,checked:a.value?a.value===t.modelValue:a===t.modelValue,disabled:t.disabled,"read-only":t.readOnly,required:t.required,onChange:u=>i(a)},null,8,["name","id","value","label","checked","disabled","read-only","required","onChange"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(l.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,O)])}}}),L={class:"input input-dropdown"},A={class:"dropdown"},I={class:"btn-group",role:"group"},P=["id","disabled"],j=["aria-labelledby"],F=["onClick"],R=["for"],U=e.defineComponent({__name:"input-dropdown",props:{modelValue:{type:[String,Number,Boolean],default:""},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},placeholder:{type:String,default:"Please select"},options:{type:Array,default:[]},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:d}){const n=t;e.computed({get(){return n.modelValue},set(o){d("update:modelValue",o)}});function i(o){d("update:modelValue",o)}const l=e.computed(()=>[...n.options].find(o=>JSON.stringify(o.value)===JSON.stringify(n.modelValue)));return(o,s)=>(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",A,[e.createElementVNode("div",I,[e.createElementVNode("button",{class:e.normalizeClass(["btn btn-secondary dropdown-toggle",{[`button-${t.variant}`]:t.variant,[`button-${t.disabled}`]:t.disabled}]),type:"button",id:t.id,"data-bs-toggle":"dropdown","aria-expanded":"false",disabled:t.disabled},e.toDisplayString(e.unref(l)?e.unref(l).text:t.placeholder),11,P),e.createElementVNode("ul",{class:"dropdown-menu","aria-labelledby":t.id},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(a,c)=>(e.openBlock(),e.createElementBlock("li",{key:c},[e.renderSlot(o.$slots,"option",{},()=>[e.createElementVNode("a",{class:"dropdown-item",onClick:e.withModifiers(u=>i(a.value),["prevent"])},e.toDisplayString(a.text),9,F)])]))),128))],8,j)])]),e.createElementVNode("label",{for:t.id},[e.renderSlot(o.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,R)]))}});r.BaseButton=V,r.BaseInput=C,r.CheckGroup=M,r.InputDropdown=U,r.LoadingSpinner=S,r.RadioGroup=T,r.SvgIcon=p,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -110,9 +110,9 @@ declare const _default: import("vue").DefineComponent<{
110
110
  type: string;
111
111
  label: string;
112
112
  pattern: string;
113
+ modelValue: string | number | boolean;
113
114
  id: string;
114
115
  variant: string;
115
- modelValue: string | number | boolean;
116
116
  name: string;
117
117
  disabled: boolean;
118
118
  placeholder: string;
@@ -75,13 +75,13 @@ declare const _default: import("vue").DefineComponent<{
75
75
  onChange?: ((...args: any[]) => any) | undefined;
76
76
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
77
77
  }, {
78
+ options: any[];
78
79
  required: boolean;
79
80
  label: string;
81
+ modelValue: never[];
80
82
  id: string;
81
83
  variant: string;
82
- modelValue: never[];
83
84
  name: string;
84
- options: any[];
85
85
  disabled: boolean;
86
86
  readOnly: boolean;
87
87
  }>;
@@ -0,0 +1,123 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ type: (BooleanConstructor | StringConstructor | NumberConstructor)[];
4
+ default: string;
5
+ };
6
+ name: {
7
+ type: StringConstructor;
8
+ default: () => string;
9
+ };
10
+ id: {
11
+ type: StringConstructor;
12
+ default: () => string;
13
+ };
14
+ label: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ placeholder: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ options: {
23
+ type: {
24
+ (arrayLength: number): any[];
25
+ (...items: any[]): any[];
26
+ new (arrayLength: number): any[];
27
+ new (...items: any[]): any[];
28
+ isArray(arg: any): arg is any[];
29
+ readonly prototype: any[];
30
+ from<T>(arrayLike: ArrayLike<T>): T[];
31
+ from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
32
+ from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
33
+ from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
34
+ of<T_4>(...items: T_4[]): T_4[];
35
+ readonly [Symbol.species]: ArrayConstructor;
36
+ };
37
+ default: never[];
38
+ };
39
+ variant: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ disabled: {
44
+ type: BooleanConstructor;
45
+ default: boolean;
46
+ };
47
+ multiple: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ required: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
55
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
56
+ modelValue: {
57
+ type: (BooleanConstructor | StringConstructor | NumberConstructor)[];
58
+ default: string;
59
+ };
60
+ name: {
61
+ type: StringConstructor;
62
+ default: () => string;
63
+ };
64
+ id: {
65
+ type: StringConstructor;
66
+ default: () => string;
67
+ };
68
+ label: {
69
+ type: StringConstructor;
70
+ default: string;
71
+ };
72
+ placeholder: {
73
+ type: StringConstructor;
74
+ default: string;
75
+ };
76
+ options: {
77
+ type: {
78
+ (arrayLength: number): any[];
79
+ (...items: any[]): any[];
80
+ new (arrayLength: number): any[];
81
+ new (...items: any[]): any[];
82
+ isArray(arg: any): arg is any[];
83
+ readonly prototype: any[];
84
+ from<T>(arrayLike: ArrayLike<T>): T[];
85
+ from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
86
+ from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
87
+ from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
88
+ of<T_4>(...items: T_4[]): T_4[];
89
+ readonly [Symbol.species]: ArrayConstructor;
90
+ };
91
+ default: never[];
92
+ };
93
+ variant: {
94
+ type: StringConstructor;
95
+ default: string;
96
+ };
97
+ disabled: {
98
+ type: BooleanConstructor;
99
+ default: boolean;
100
+ };
101
+ multiple: {
102
+ type: BooleanConstructor;
103
+ default: boolean;
104
+ };
105
+ required: {
106
+ type: BooleanConstructor;
107
+ default: boolean;
108
+ };
109
+ }>> & {
110
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
111
+ }, {
112
+ options: any[];
113
+ required: boolean;
114
+ label: string;
115
+ modelValue: string | number | boolean;
116
+ id: string;
117
+ variant: string;
118
+ name: string;
119
+ disabled: boolean;
120
+ placeholder: string;
121
+ multiple: boolean;
122
+ }>;
123
+ export default _default;
@@ -75,13 +75,13 @@ declare const _default: import("vue").DefineComponent<{
75
75
  onChange?: ((...args: any[]) => any) | undefined;
76
76
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
77
77
  }, {
78
+ options: any[];
78
79
  required: boolean;
79
80
  label: string;
81
+ modelValue: boolean;
80
82
  id: string;
81
83
  variant: string;
82
- modelValue: boolean;
83
84
  name: string;
84
- options: any[];
85
85
  disabled: boolean;
86
86
  readOnly: boolean;
87
87
  }>;
package/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { default as BaseButton } from "./components/base-button.vue";
4
4
  export { default as BaseInput } from "./components/base-input.vue";
5
5
  export { default as CheckGroup } from "./components/check-group.vue";
6
6
  export { default as RadioGroup } from "./components/radio-group.vue";
7
+ export { default as InputDropdown } from "./components/input-dropdown.vue";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.0.19",
4
+ "version": "0.0.20",
5
5
  "scripts": {
6
6
  "dev": "vite",
7
7
  "build": "vue-tsc --noEmit && vite build",