ablok-components 0.0.19 → 0.0.22

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,138 @@ 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, Object],
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
+ color: {
464
+ type: String,
465
+ default: ""
466
+ },
467
+ disabled: {
468
+ type: Boolean,
469
+ default: false
470
+ },
471
+ multiple: {
472
+ type: Boolean,
473
+ default: false
474
+ },
475
+ required: {
476
+ type: Boolean,
477
+ default: false
478
+ },
479
+ resetOption: {
480
+ type: Boolean,
481
+ default: true
482
+ }
483
+ },
484
+ emits: ["update:modelValue"],
485
+ setup(__props, { emit }) {
486
+ const props = __props;
487
+ computed({
488
+ get() {
489
+ return props.modelValue;
490
+ },
491
+ set(update) {
492
+ emit("update:modelValue", update);
493
+ }
494
+ });
495
+ function select(update) {
496
+ emit("update:modelValue", update);
497
+ }
498
+ const extendedOptions = computed(() => {
499
+ return [
500
+ {
501
+ text: "Please select"
502
+ },
503
+ ...props.options.map((option) => typeof option === "string" ? { value: option, text: option } : option)
504
+ ];
505
+ });
506
+ const selectedOption = computed(() => {
507
+ return [...props.options].find((option) => JSON.stringify(option.value) === JSON.stringify(props.modelValue));
508
+ });
509
+ return (_ctx, _cache) => {
510
+ return openBlock(), createElementBlock("div", _hoisted_1, [
511
+ createElementVNode("div", _hoisted_2, [
512
+ createElementVNode("div", _hoisted_3, [
513
+ createElementVNode("button", {
514
+ class: normalizeClass(["btn dropdown-toggle", {
515
+ [`button-${__props.variant}`]: __props.variant,
516
+ [`button-${__props.color}`]: __props.color,
517
+ [`button-${__props.disabled}`]: __props.disabled
518
+ }]),
519
+ type: "button",
520
+ id: __props.id,
521
+ "data-bs-toggle": "dropdown",
522
+ "aria-expanded": "false",
523
+ disabled: __props.disabled
524
+ }, toDisplayString(unref(selectedOption) ? unref(selectedOption).text : __props.placeholder), 11, _hoisted_4),
525
+ createElementVNode("ul", {
526
+ class: "dropdown-menu",
527
+ "aria-labelledby": __props.id
528
+ }, [
529
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(extendedOptions), (option, index) => {
530
+ return openBlock(), createElementBlock("li", { key: index }, [
531
+ renderSlot(_ctx.$slots, "option", {}, () => [
532
+ createElementVNode("a", {
533
+ class: "dropdown-item",
534
+ onClick: withModifiers(($event) => select(option.value), ["prevent"])
535
+ }, toDisplayString(option.text), 9, _hoisted_6)
536
+ ])
537
+ ]);
538
+ }), 128))
539
+ ], 8, _hoisted_5)
540
+ ])
541
+ ]),
542
+ createElementVNode("label", { for: __props.id }, [
543
+ renderSlot(_ctx.$slots, "label", {}, () => [
544
+ createTextVNode(toDisplayString(__props.label), 1)
545
+ ])
546
+ ], 8, _hoisted_7)
418
547
  ]);
419
548
  };
420
549
  }
421
550
  });
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 };
551
+ 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 b={class:"icon",preserveAspectRatio:"xMaxYMin"},p=["xlink:href"],g=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,l)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["svg-icon",{[`svg-icon--${t.size}`]:t.size}])},[(e.openBlock(),e.createElementBlock("svg",b,[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,p)]))],2))}});var X=(()=>`.loading-spinner{min-width:2rem}
3
+ `)();const y={class:"loading-spinner d-block"},h={class:"loading-spinner__animation"},k={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"},B=["fill"],S=[e.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",dur:"1s",from:"0 50 50",to:"360 50 50",repeatCount:"indefinite"},null,-1)],$=e.defineComponent({__name:"loading-spinner",props:{color:{type:String,default:"#fff"}},setup(t){return(d,l)=>(e.openBlock(),e.createElementBlock("span",y,[e.createElementVNode("span",h,[(e.openBlock(),e.createElementBlock("svg",k,[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"},S,8,B)]))]),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 V=["type","disabled","href","to"],x=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,l=e.computed(()=>d.caption&&!d.fab);return(i,a)=>{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(l)?(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,V)}}});function m(){return(new Date().valueOf()+Math.random()).toString(36)}const w={class:"base-input"},E={class:"input-group"},N=["type","name","id","label","placeholder","pattern","disabled","read-only","required","maxlength","checked","aria-label"],C=["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 l=t,i=e.computed({get(){return l.modelValue},set(a){d("update:modelValue",a)}});return(a,c)=>(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("div",E,[e.renderSlot(a.$slots,"input-prepend"),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=n=>e.isRef(i)?i.value=n: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,N),[[e.vModelDynamic,e.unref(i)]]),e.renderSlot(a.$slots,"input-append")]),e.createElementVNode("label",{for:t.id},[e.renderSlot(a.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,C)]))}}),z={class:"radio-group"},O=["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 l=t,i=e.ref([]);return e.watch(()=>l.modelValue,(a,c)=>{i.value=l.options.map(n=>n.value?l.modelValue.some(o=>o["value "]===n.value):l.modelValue.some(o=>o===n))},{immediate:!0}),e.watch(i,(a,c)=>{const n=a.reduce((o,s,u)=>{const f=s&&l.options[u]?[l.options[u]||l.options[u]]:[];return[...o,...f]},[]);d("update:modelValue",n)},{deep:!0}),e.onBeforeMount(()=>{}),(a,c)=>{const n=e.resolveComponent("base-input");return e.openBlock(),e.createElementBlock("div",z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(o,s)=>(e.openBlock(),e.createBlock(n,{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:`${o.text||o}${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(a.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,O)])}}}),D={class:"radio-group"},T=["for"],L=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 l=t;e.ref(l.options.map(a=>a.value===l.modelValue));function i(a){d("update:modelValue",a)}return e.onBeforeMount(()=>{}),(a,c)=>{const n=e.resolveComponent("base-input");return e.openBlock(),e.createElementBlock("div",D,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(o,s)=>(e.openBlock(),e.createBlock(n,{key:s,type:"radio",name:t.name,id:`${t.id}-${s}`,value:o.value||o,label:`${o.text||o}${t.required?" *":""}`,checked:o.value?o.value===t.modelValue:o===t.modelValue,disabled:t.disabled,"read-only":t.readOnly,required:t.required,onChange:u=>i(o)},null,8,["name","id","value","label","checked","disabled","read-only","required","onChange"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(a.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,T)])}}}),A={class:"input input-dropdown"},I={class:"dropdown"},P={class:"btn-group",role:"group"},j=["id","disabled"],F=["aria-labelledby"],R=["onClick"],U=["for"],G=e.defineComponent({__name:"input-dropdown",props:{modelValue:{type:[String,Number,Boolean,Object],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:""},color:{type:String,default:""},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},required:{type:Boolean,default:!1},resetOption:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:d}){const l=t;e.computed({get(){return l.modelValue},set(n){d("update:modelValue",n)}});function i(n){d("update:modelValue",n)}const a=e.computed(()=>[{text:"Please select"},...l.options.map(n=>typeof n=="string"?{value:n,text:n}:n)]),c=e.computed(()=>[...l.options].find(n=>JSON.stringify(n.value)===JSON.stringify(l.modelValue)));return(n,o)=>(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",I,[e.createElementVNode("div",P,[e.createElementVNode("button",{class:e.normalizeClass(["btn dropdown-toggle",{[`button-${t.variant}`]:t.variant,[`button-${t.color}`]:t.color,[`button-${t.disabled}`]:t.disabled}]),type:"button",id:t.id,"data-bs-toggle":"dropdown","aria-expanded":"false",disabled:t.disabled},e.toDisplayString(e.unref(c)?e.unref(c).text:t.placeholder),11,j),e.createElementVNode("ul",{class:"dropdown-menu","aria-labelledby":t.id},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(s,u)=>(e.openBlock(),e.createElementBlock("li",{key:u},[e.renderSlot(n.$slots,"option",{},()=>[e.createElementVNode("a",{class:"dropdown-item",onClick:e.withModifiers(f=>i(s.value),["prevent"])},e.toDisplayString(s.text),9,R)])]))),128))],8,F)])]),e.createElementVNode("label",{for:t.id},[e.renderSlot(n.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,U)]))}});r.BaseButton=x,r.BaseInput=q,r.CheckGroup=M,r.InputDropdown=G,r.LoadingSpinner=$,r.RadioGroup=L,r.SvgIcon=g,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,141 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ type: (BooleanConstructor | ObjectConstructor | 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
+ color: {
44
+ type: StringConstructor;
45
+ default: string;
46
+ };
47
+ disabled: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ multiple: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
55
+ required: {
56
+ type: BooleanConstructor;
57
+ default: boolean;
58
+ };
59
+ resetOption: {
60
+ type: BooleanConstructor;
61
+ default: boolean;
62
+ };
63
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
64
+ modelValue: {
65
+ type: (BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
66
+ default: string;
67
+ };
68
+ name: {
69
+ type: StringConstructor;
70
+ default: () => string;
71
+ };
72
+ id: {
73
+ type: StringConstructor;
74
+ default: () => string;
75
+ };
76
+ label: {
77
+ type: StringConstructor;
78
+ default: string;
79
+ };
80
+ placeholder: {
81
+ type: StringConstructor;
82
+ default: string;
83
+ };
84
+ options: {
85
+ type: {
86
+ (arrayLength: number): any[];
87
+ (...items: any[]): any[];
88
+ new (arrayLength: number): any[];
89
+ new (...items: any[]): any[];
90
+ isArray(arg: any): arg is any[];
91
+ readonly prototype: any[];
92
+ from<T>(arrayLike: ArrayLike<T>): T[];
93
+ from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
94
+ from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
95
+ from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
96
+ of<T_4>(...items: T_4[]): T_4[];
97
+ readonly [Symbol.species]: ArrayConstructor;
98
+ };
99
+ default: never[];
100
+ };
101
+ variant: {
102
+ type: StringConstructor;
103
+ default: string;
104
+ };
105
+ color: {
106
+ type: StringConstructor;
107
+ default: string;
108
+ };
109
+ disabled: {
110
+ type: BooleanConstructor;
111
+ default: boolean;
112
+ };
113
+ multiple: {
114
+ type: BooleanConstructor;
115
+ default: boolean;
116
+ };
117
+ required: {
118
+ type: BooleanConstructor;
119
+ default: boolean;
120
+ };
121
+ resetOption: {
122
+ type: BooleanConstructor;
123
+ default: boolean;
124
+ };
125
+ }>> & {
126
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
127
+ }, {
128
+ options: any[];
129
+ required: boolean;
130
+ label: string;
131
+ modelValue: string | number | boolean | Record<string, any>;
132
+ id: string;
133
+ variant: string;
134
+ color: string;
135
+ name: string;
136
+ disabled: boolean;
137
+ placeholder: string;
138
+ multiple: boolean;
139
+ resetOption: boolean;
140
+ }>;
141
+ 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.22",
5
5
  "scripts": {
6
6
  "dev": "vite",
7
7
  "build": "vue-tsc --noEmit && vite build",