ablok-components 0.3.99 → 0.3.102

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,10 +1,10 @@
1
- import { defineComponent as k, useTemplateRef as N, ref as p, computed as d, watch as B, onMounted as w, openBlock as s, createElementBlock as m, normalizeClass as v, createElementVNode as y, renderSlot as f, withDirectives as $, mergeProps as L, vModelDynamic as q, createCommentVNode as b, createVNode as z, Transition as E, withCtx as M, toDisplayString as C } from "vue";
2
- import { sanitizeInput as D, uniqueId as g } from "../../../utilities/helpers.js";
3
- import { sanitizeHtml as H } from "../../../composables/useSanitize.js";
4
- const T = { class: "input-group input__input-group" }, I = ["type", "id", "name", "placeholder", "pattern", "disabled", "readonly", "required", "maxlength", "true-value", "false-value", "aria-label", "role", "autocomplete"], O = ["for", "innerHTML"], A = {
1
+ import { defineComponent as N, useTemplateRef as B, ref as p, computed as d, watch as w, onMounted as $, openBlock as s, createElementBlock as m, normalizeClass as v, createElementVNode as y, renderSlot as f, withDirectives as L, mergeProps as q, vModelDynamic as z, createCommentVNode as b, createVNode as E, Transition as M, withCtx as C, toDisplayString as D } from "vue";
2
+ import { sanitizeInput as H, uniqueId as g } from "../../../utilities/helpers.js";
3
+ import { sanitizeHtml as T } from "../../../composables/useSanitize.js";
4
+ const I = { class: "input-group input__input-group" }, O = ["type", "id", "name", "placeholder", "pattern", "disabled", "readonly", "required", "maxlength", "true-value", "false-value", "aria-label", "role", "autocomplete"], A = ["for", "innerHTML"], P = {
5
5
  key: 0,
6
6
  class: "input__error alert alert-danger mt-3"
7
- }, j = /* @__PURE__ */ k({
7
+ }, F = /* @__PURE__ */ N({
8
8
  __name: "base-input",
9
9
  props: {
10
10
  modelValue: {
@@ -91,16 +91,16 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
91
91
  },
92
92
  emits: ["update:modelValue", "update:valid"],
93
93
  setup(e, { emit: h }) {
94
- const l = e, c = h, n = N("input"), i = p(l.valid), u = p(), x = d(
95
- () => H(`${l.label}${l.required ? " *" : ""}`)
94
+ const l = e, c = h, i = B("input"), n = p(l.valid), u = p(), V = d(
95
+ () => T(`${l.label}${l.required ? " *" : ""}`)
96
96
  ), o = d({
97
97
  get() {
98
98
  return l.modelValue;
99
99
  },
100
100
  set(t) {
101
- t = l.type === "number" ? l.max && Number(t) > l.max ? l.max : l.min !== void 0 && Number(t) < l.min ? l.min : Number(t) : t, l.sanitize && typeof t == "string" && !["checkbox", "radio", "number", "date", "datetime-local", "time", "month", "week", "email", "tel", "url"].includes(l.type) && (t = D(t)), c("update:modelValue", t);
101
+ t = l.type === "number" ? l.max && Number(t) > l.max ? l.max : l.min !== void 0 && Number(t) < l.min ? l.min : Number(t) : t, l.sanitize && typeof t == "string" && !["checkbox", "radio", "number", "date", "datetime-local", "time", "month", "week", "email", "tel", "url"].includes(l.type) && (t = H(t)), c("update:modelValue", t);
102
102
  }
103
- }), S = d(() => {
103
+ }), x = d(() => {
104
104
  if (l.type === "number") {
105
105
  const { min: t, max: a } = l;
106
106
  return {
@@ -110,29 +110,32 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
110
110
  }
111
111
  return {};
112
112
  });
113
- function r() {
114
- l.validate && n.value && (i.value = n.value.checkValidity(), i.value ? u.value = void 0 : u.value = n.value.validationMessage, c("update:valid", i.value));
113
+ function S() {
114
+ r();
115
115
  }
116
- return B(() => l.modelValue, () => {
117
- i.value === !1 && r();
118
- }), w(() => {
116
+ function r({ checkValidity: t = !0 } = {}) {
117
+ l.validate && i.value && (t ? n.value = i.value.checkValidity() : n.value = !0, n.value ? u.value = void 0 : u.value = i.value.validationMessage, c("update:valid", n.value));
118
+ }
119
+ return w(() => l.modelValue, () => {
120
+ n.value === !1 && r();
121
+ }), $(() => {
119
122
  let t = (a) => {
120
123
  o.value = typeof a.detail == "string" || typeof a.detail == "number" ? `${a.detail}` : "";
121
124
  };
122
- n.value?.addEventListener("focusin", (a) => {
125
+ i.value?.addEventListener("focusin", (a) => {
123
126
  window.addEventListener("update-focussed-input", t);
124
- }), n.value?.addEventListener("focusout", (a) => {
127
+ }), i.value?.addEventListener("focusout", (a) => {
125
128
  window.removeEventListener("update-focussed-input", t);
126
- }), r();
129
+ }), r({ checkValidity: !1 });
127
130
  }), (t, a) => (s(), m("div", {
128
- class: v(["input", `input--${e.type}${i.value ? "" : " input--invalid"}`])
131
+ class: v(["input", `input--${e.type}${n.value ? "" : " input--invalid"}`])
129
132
  }, [
130
- y("div", T, [
133
+ y("div", I, [
131
134
  f(t.$slots, "input-prepend", { slotScope: "props" }),
132
- $(y("input", L({
135
+ L(y("input", q({
133
136
  ref_key: "input",
134
- ref: n,
135
- "onUpdate:modelValue": a[0] || (a[0] = (V) => o.value = V),
137
+ ref: i,
138
+ "onUpdate:modelValue": a[0] || (a[0] = (k) => o.value = k),
136
139
  type: e.type === "color" ? "text" : e.type,
137
140
  id: e.id,
138
141
  name: e.name,
@@ -142,7 +145,7 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
142
145
  readonly: e.readOnly,
143
146
  required: e.required,
144
147
  maxlength: e.maxlength
145
- }, S.value, {
148
+ }, x.value, {
146
149
  "true-value": e.trueValue,
147
150
  "false-value": e.falseValue,
148
151
  class: ["form-control", {
@@ -151,9 +154,9 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
151
154
  "aria-label": e.label,
152
155
  role: e.role,
153
156
  autocomplete: e.autocomplete,
154
- onChange: r
155
- }), null, 16, I), [
156
- [q, o.value]
157
+ onChange: S
158
+ }), null, 16, O), [
159
+ [z, o.value]
157
160
  ]),
158
161
  f(t.$slots, "input-append", { slotScope: "props" })
159
162
  ]),
@@ -164,12 +167,12 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
164
167
  class: v(["input__label", {
165
168
  "form-check-label": e.type === "checkbox"
166
169
  }]),
167
- innerHTML: x.value
168
- }, null, 10, O)) : b("", !0)
170
+ innerHTML: V.value
171
+ }, null, 10, A)) : b("", !0)
169
172
  ]),
170
- z(E, { name: "fade" }, {
171
- default: M(() => [
172
- !i.value && u.value ? (s(), m("div", A, C(u.value), 1)) : b("", !0)
173
+ E(M, { name: "fade" }, {
174
+ default: C(() => [
175
+ !n.value && u.value ? (s(), m("div", P, D(u.value), 1)) : b("", !0)
173
176
  ]),
174
177
  _: 1
175
178
  })
@@ -177,5 +180,5 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
177
180
  }
178
181
  });
179
182
  export {
180
- j as default
183
+ F as default
181
184
  };
@@ -1,10 +1,10 @@
1
- import { defineComponent as g, getCurrentInstance as h, ref as y, onMounted as E, openBlock as $, createElementBlock as C, renderSlot as c, createElementVNode as s, createVNode as u, unref as p } from "vue";
2
- import i from "../../atoms/svg-icon/svg-icon.vue.js";
1
+ import { defineComponent as b, ref as v, onMounted as y, openBlock as E, createElementBlock as g, renderSlot as c, createElementVNode as s, createVNode as u } from "vue";
2
+ import a from "../../atoms/svg-icon/svg-icon.vue.js";
3
3
  /* empty css */
4
- const _ = { class: "touch-wrapper__controls" }, k = {
4
+ const _ = { class: "touch-wrapper__controls" }, h = {
5
5
  class: "btn-group",
6
6
  role: "group"
7
- }, N = /* @__PURE__ */ g({
7
+ }, C = /* @__PURE__ */ b({
8
8
  __name: "touch-wrapper",
9
9
  props: {
10
10
  modelValue: {
@@ -13,65 +13,56 @@ const _ = { class: "touch-wrapper__controls" }, k = {
13
13
  }
14
14
  },
15
15
  emits: ["update:modelValue"],
16
- setup(d, { emit: m }) {
17
- const a = h()?.appContext?.config?.globalProperties?.$config || { iconSprite: "/symbol-defs.svg" }, f = d, b = m, n = y();
18
- function o(t) {
19
- const e = f.modelValue + t;
20
- b("update:modelValue", t === 0 ? 1 : e >= 1 ? e : 1);
16
+ setup(i, { emit: d }) {
17
+ const m = i, p = d, o = v();
18
+ function n(t) {
19
+ const e = m.modelValue + t;
20
+ p("update:modelValue", t === 0 ? 1 : e >= 1 ? e : 1);
21
21
  }
22
- function v(t) {
22
+ function f(t) {
23
23
  if (t.ctrlKey) {
24
24
  t.preventDefault();
25
25
  const e = 0 - t.deltaY * 0.01;
26
- o(e);
26
+ n(e);
27
27
  }
28
28
  }
29
29
  function r(t) {
30
30
  t.preventDefault();
31
31
  const { scale: e } = t, l = e > 1 ? e * 0.01 : 0 - e;
32
- o(l);
32
+ n(l);
33
33
  }
34
- return E(() => {
35
- n.value && (n.value.addEventListener("wheel", v, !1), n.value.addEventListener("gesturestart", r, !1), n.value.addEventListener("gesturechange", r, !1), n.value.addEventListener("gestureend", r, !1));
36
- }), (t, e) => ($(), C("div", {
34
+ return y(() => {
35
+ o.value && (o.value.addEventListener("wheel", f, !1), o.value.addEventListener("gesturestart", r, !1), o.value.addEventListener("gesturechange", r, !1), o.value.addEventListener("gestureend", r, !1));
36
+ }), (t, e) => (E(), g("div", {
37
37
  ref_key: "touchElement",
38
- ref: n,
38
+ ref: o,
39
39
  class: "touch-wrapper"
40
40
  }, [
41
41
  c(t.$slots, "controls", {
42
- on: { setScale: o }
42
+ on: { setScale: n }
43
43
  }, () => [
44
44
  s("div", _, [
45
- s("div", k, [
45
+ s("div", h, [
46
46
  s("button", {
47
47
  type: "button",
48
48
  class: "btn",
49
- onClick: e[0] || (e[0] = (l) => o(-1))
49
+ onClick: e[0] || (e[0] = (l) => n(-1))
50
50
  }, [
51
- u(i, {
52
- symbol: "minus",
53
- "base-path": p(a).iconSprite
54
- }, null, 8, ["base-path"])
51
+ u(a, { symbol: "minus" })
55
52
  ]),
56
53
  s("button", {
57
54
  type: "button",
58
55
  class: "btn",
59
- onClick: e[1] || (e[1] = (l) => o(0))
56
+ onClick: e[1] || (e[1] = (l) => n(0))
60
57
  }, [
61
- u(i, {
62
- symbol: "maximize",
63
- "base-path": p(a).iconSprite
64
- }, null, 8, ["base-path"])
58
+ u(a, { symbol: "maximize" })
65
59
  ]),
66
60
  s("button", {
67
61
  type: "button",
68
62
  class: "btn",
69
- onClick: e[2] || (e[2] = (l) => o(1))
63
+ onClick: e[2] || (e[2] = (l) => n(1))
70
64
  }, [
71
- u(i, {
72
- symbol: "plus",
73
- "base-path": p(a).iconSprite
74
- }, null, 8, ["base-path"])
65
+ u(a, { symbol: "plus" })
75
66
  ])
76
67
  ])
77
68
  ])
@@ -81,5 +72,5 @@ const _ = { class: "touch-wrapper__controls" }, k = {
81
72
  }
82
73
  });
83
74
  export {
84
- N as default
75
+ C as default
85
76
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.99",
4
+ "version": "0.3.102",
5
5
  "dependencies": {
6
6
  "date-fns": "^3.0.0",
7
7
  "dompurify": "^3.3.1",